Compare commits

...

2866 Commits

Author SHA1 Message Date
Henry Zhu
cada040bec v7.0.0-rc.3 2018-08-24 14:06:00 -04:00
Nicolò Ribaudo
1f9b2a5c41 [_wrapNativeSuper] Don't wrap non-native constructors (#8501) 2018-08-24 19:58:49 +02:00
Logan Smyth
39fa102ee8 Use supportsStaticESM to toggle runtime module usage. (#8520) 2018-08-24 10:48:47 -07:00
Honza Javorek
e841ccca34 Upgrade slash (#8527) [skip ci]
The 1.x versions do not contain a full license text.
2018-08-24 11:31:27 -04:00
Artem Yavorsky
4249dbc8ea Add browserslist 4 support. (#8509) 2018-08-23 20:09:18 -05:00
Standa Opichal
a7cc3325cd Add LICENSE file to published npm packages [skip ci] (#8409) 2018-08-23 19:49:27 -04:00
Logan Smyth
023044c1d4 Reference the CommonJS helpers when a file is not explicitly a module. (#8518) 2018-08-23 15:09:14 -07:00
Rafael de Oleza
22bcfbe469 Fix path.scope.rename() to not change break clauses (#8478)
* Make labels on break and continue statements not referenced

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

fixes #8323

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

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

* Also babylon

* Enable test
2018-08-15 09:04:52 +02:00
Logan Smyth
1e0b649485 Allow transform-runtime to insert runtime references with absolute paths. (#8435) 2018-08-14 16:11:19 -07:00
Laxman
8c65230258 Fix link to babel-parser (#8464) [skip ci] 2018-08-13 15:54:07 +02:00
Mauro Bringolf
427aff559f Fix decorators interop bug with class field tdz
Co-authored-by: Jan Buschtöns <jan@buschtoens.me>
2018-08-13 08:57:09 +02:00
wtgtybhertgeghgtwtg
de16ac08be Remove lodash where it isn't used. (#8446) 2018-08-09 23:21:41 -04:00
Henry Zhu
0a958861c9 v7.0.0-rc.1 2018-08-09 16:06:08 -04:00
Henry Zhu
904bcaffe3 fix peer deps [skip ci] (#8445)
Should be anything 7.x
2018-08-09 15:59:14 -04:00
宋铄运
e855987c51 update sponsor [skip ci] (#8444)
Add issue.sh sponsor from Patreon
2018-08-09 15:58:28 -04:00
Henry Zhu
8b1406127a v7.0.0-rc.0 2018-08-09 11:56:00 -04:00
Henry Zhu
c8bb450032 remove proposals polyfills from default import [skip ci] (#8440)
The default import is replaced with only polyfills that are Stage 4; this is in alignment with how we have removed the Stage presets. This also would mean we would need to add new imports when necessary, but that can be in a future release.
2018-08-09 11:43:45 -04:00
Logan Smyth
b6db036ff7 Require v1.1.0 so that correct filter params are passed. (#8436)
PR #8418 introduced some new logic that uses the third parameter of `fs-readdir-recursive`'s `filter` option, the current directory, but missed that our dependencies only required `^1.0.0`, while that parameter was actually added in `1.1.0`. This means that if some other dependency forced a downgrade in the version to satisfy some range, or the user already had 1.0.0 module installed locally, it could cause problems,
2018-08-07 23:28:36 -04:00
Sam Grace
6476a0d089 Whitelist experimental-modules flag for babel-node (#8336) [skip ci] 2018-08-06 11:45:38 -04:00
Henry Zhu
6695f5e2f7 v7.0.0-beta.56 2018-08-03 21:02:42 -04:00
Henry Zhu
86ce2e4e0d remove old deps [skip ci] 2018-08-03 20:42:45 -04:00
Henry Zhu
8cffbbae75 Split @babel/runtime into 2 modules via @babel/runtime-corejs2 (#8266)
In Babel 6, we had `@babel/runtime` which _always_ uses `core-js` in its helpers, meaning that anyone who wants to use our helpers in a centralized modular way had to also use core-js, which isn't always ideal.

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

This PR splits our setup into two separate runtimes:

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

* remove unnessecary parameter

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

* Flow tests updated

* Fix type error

* Appropriate name was given to test folder

* Fix

* Empty

* Correct type annotation

* Add required changes in generator package

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

For issue references: Add a comma-separated list of a [closing word](https://help.github.com/articles/closing-issues-via-commit-messages/) followed by the ticket number fixed by the PR. (it should be underlined in the preview if done correctly)

If you are making a change that should have a docs update: submit another PR to https://github.com/babel/website
-->

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

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

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

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

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

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

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

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

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

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

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

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

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

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

* fix linting errors

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

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

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

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

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

* New test

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

For issue references: Add a comma-separated list of a [closing word](https://help.github.com/articles/closing-issues-via-commit-messages/) followed by the ticket number fixed by the PR. It should be underlined in the preview if done correctly.
-->

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

Good ol' plugin ordering 🙃

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

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

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

* docs: [skip ci] update READMEs

* docs: [skip ci] fix code block type

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

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

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

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

We used to generate:

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

but now we generate

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

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

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

For issue references: Add a comma-separated list of a [closing word](https://help.github.com/articles/closing-issues-via-commit-messages/) followed by the ticket number fixed by the PR. It should be underlined in the preview if done correctly.
-->

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

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

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

For issue references: Add a comma-separated list of a [closing word](https://help.github.com/articles/closing-issues-via-commit-messages/) followed by the ticket number fixed by the PR. It should be underlined in the preview if done correctly.
-->

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

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

* Fix test

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

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

This reverts commit f8ab9466d3.

* Only use getPrototypeOf if setPrototypeOf is implemented

* Update fixtures

* Helpers updates

* Update fixtures

* Fall back to getPrototypeOf

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

For any issue references: Add a comma-separated list of a [closing word](https://help.github.com/articles/closing-issues-via-commit-messages/) followed by the ticket number fixed by the PR
-->

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

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

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

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

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

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

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

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

* Move to Stage 3

* Break diretive parsing

* Update README

* Handle multi-escape sequences

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

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

* Private properties!

* Fixes

* Tests

* Update helper name

* Fix privates that reference other privates

* Don't extend a builtin

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

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

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

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

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

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

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

* Parse @flow pragma

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

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

* WIP: add tests for explicit type arguments

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

* Parse type arguments in new expressions

* Parse type arguments in call expressions

* Parse optional call expressions with explicit type args

* Add explicit type arguments to babel-types

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

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

* Add support for explicit type arguments to babel-generator

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

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

* Fix Flow parser shouldParseTypes() function

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

* Remove typeapp_call from whitelist of expected failures

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

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

* Use Babylon plugin options instead of parser options

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

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

* Fix tests on node 4

I DON'T KNOW WHY IT WORKS.

* Update fixtures

* Use Reflect.construct

* Parens

* Fix things

* Fix things

* Undo changes

* Fix with sham

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

* Parsing support for internal slot properties

* Print internal slots in babel-generator

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

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

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

* Add Babylon option decorators.secoratorsBeforeExport

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

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

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

* Update snapshots to reflect lazy loading

* Use pure annotation and remove unnecessary parenthesized expression

* Update snapshots

* Optimize lazy loading by doing assignment within logical expression

* Update snapshots to reflect optimization

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

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

* Fixed typo

* Fixed typos

* Revert "Fixed typo"

This reverts commit 06cfe9d4edba0b99257cbffc6dc08ae2f3460d78.

* Revert "Fixed typos"

This reverts commit ec3975c7392df9a0a42682ee4f32eadd2615c69c.

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

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

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

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

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

Currently however, the full file path is used:

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

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

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

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

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

* Use cwd-relative path for sourceFileName.

* Revert sourceMap `file` property change.

* fixup! Revert sourceMap `file` property change.

* Fix whitespace change from merge conflict

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

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

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

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

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

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

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

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

* Post #7772

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

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

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

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

Fixes #7733.

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

* Cleanup

* Little more comment cleanup

* Use unary plus

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

* Review comments

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

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

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

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

* update engines for babylon

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

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

* Correct logic

* reduce access

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

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

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

* Rename Decorator#expression to Decorator#callee

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

Fixes #7371.

* Fix node 4 test

* This damn node 4 test

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

* tmp

* tmp

* Use common class environment visitor

* Tests

* Use skipKey to avoid recursive traversal

* Remove old state

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

Fixes #7350.

* Review comments

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

* Add object nested in class cases

* Add object nested object cases

* Test class properties

* Undo changes to lerna.json

* Add tests arournd prefix/postfix super increment

* tmp

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

* fixtures

* Edge cases

* Add loose edge cases

* Spec compliant

* Add issue case

* Even more edge cases!

* Final updates

* Fix name

* Use Reflect.{get, set} when available

* Avoid block scoping in loose

* Remove semicolon

* Do not redefine a non-enumerable

* Get strictness from call site, not helpers

* Add called assertions

* Classes are always strict

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

* Fix undefined directives

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

* Update tests (#7349)

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

* Update tests (#7349)

* Update source mapping (#7349)

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

* Update tests (#7349)

* Update tests (#7349)

* Update tests (#7349)

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

* Constructor only classes are strict, too

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

* Fix test

* Wrapper not needed if class is already strict

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

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

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

* Add more computed literal test cases

* Always return a string in getNameFromLiteralId

- Also concatenate quasis id for regex literal

* Add a test clarifying function name for template literals

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

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

Additional ~11% speed improvement.

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

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

* Optimize isReferenced inside Functions

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

* Rename in preperation for private tests

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

Co-authored-by: CodingItWrong

* Private fields are optional

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

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

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

* path some flow types

* remove unused export

* get rid of class

* temporarily rename to vanilla for diff readability

* more setState with minor adjustments

* rename 'private' methods

* explicit null check

* adjust import ordering

* Rename createConstructor -> maybeCreateConstructor

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

* Keep the plugin order

* Detect invalid modules in regexp

* Add more tests for regexp

* Cover builtins, and unnormalized in the RegExp tests

* Remove babel-plugin- in all positions

* Change babel-plugin- prefix to string

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

* Handle partial matches explicitly

* Remove extra valid regexp check

* Optimise validation of plugins

* Optimise selecting the plugins

* Fix undefined include/exclude option

* Update documentation to reflect the new include matching

* Fix typo

* Apply reviews

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

Define flatten helper

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

* Use @babel/types and @babel/template via @babel/core
2018-03-15 14:45:26 +01:00
Mateusz Burzyński
586d3b5929 Wrap wrapNativeSuper helpers in redefining functions for better tree-shakeability (#7188) 2018-03-14 23:48:33 +01:00
Mateusz Burzyński
d682e32529 Favour extends helper over objectWithoutProperties when whole object gets copied anyway (#7390) 2018-03-14 22:59:02 +01:00
Simon Kjellberg
07ab02f6b2 Fix incorrect value of _cache in _wrapNativeSuper (#7570)
The boolean expressions returns false in environments where Map is missing.
This change explicitly sets _cache to undefined in such cases, to ensure the cache methods will be ignored.
2018-03-14 16:37:51 -04:00
Nicolò Ribaudo
91a114f74a [transform-classes] Fix typo in _wrapNativeSuper helper 2018-03-14 19:23:10 +01:00
Nicolò Ribaudo
6d9887fc0f [typeof-symbol] Guard against undefined built-in globals 2018-03-14 19:23:10 +01:00
Henry Zhu
d2a3a8151e update to beta.41 (#7568) 2018-03-14 12:40:59 -05:00
Henry Zhu
270ea17fed v7.0.0-beta.41 2018-03-14 12:25:26 -04:00
Daniel Tschinder
da2aea31f5 Fix —require 2018-03-14 13:26:07 +01:00
Daniel Tschinder
1d69cd41ca Fix import of type ConfigItem (#7561)
It is also exported as type
2018-03-13 13:31:32 -05:00
Daniel Tschinder
a7ec312cfe Run node 9 on circleci and remove from travis (#7560) 2018-03-13 09:53:37 -04:00
Sven SAULEAU
6ff91cfdae docs: [skip ci] fix proposal link text 2018-03-13 13:21:34 +01:00
Yael Hermon
dfb3795a97 update preset-env after build-data (#7543) 2018-03-12 20:49:52 -05:00
Logan Smyth
353d3199c2 Re-add TEST_ONLY and use Jest's -t for TEST_GREP. (#7556) 2018-03-12 15:12:39 -07:00
Haroen Viaene
bdd70c37e0 docs(babel-standalone): remove bower mention (#6588)
* docs(babel-standalone): remove bower mention

Since the package won't be downloadable as `@babel/standalone` it's best to just remove it, since it's pretty much deprecated as is. I left the other mention of babel-standalone-bower since I guess that's just the name and still useful in other cases

cc @daniel15 

reported in https://github.com/babel/babel/pull/6495#pullrequestreview-70980926

* Update README.md
2018-03-12 19:10:24 +01:00
Daniel Tschinder
9d2d499760 Replace lodash/map with array equivalent (#7550)
* Replace lodash/map with array equivalent

* Fix review comments
2018-03-12 11:03:03 +01:00
Yael Hermon
29807837bb preset-env - add Symbol.asyncIterator to shippedProposals builtIns (#7548)
* preset-env - add Symbol.asyncIterator to shippedProposals builtins

* fix typo
2018-03-11 16:29:22 -05:00
ngohoangthang
c14a6a7735 Fix "ran" to "run" for monorepo.md (#7547) [skip ci] 2018-03-11 13:12:34 +01:00
Daniel Tschinder
3a7881379a jest: ToEqual -> toBe 2018-03-10 11:48:09 +01:00
Deven Bansod
f3f0197890 Migrate babel-core tests to use jest-expect (#7513)
* Used codemods at: https://gist.github.com/devenbansod/03c5cff857661e076cbec72fcb2e7eb3 along with some manual intervention and review
2018-03-10 11:40:28 +01:00
Logan Smyth
8e030e28b3 Merge pull request #7538 from loganfsmyth/unambiguous-import-meta
Make 'sourceType:unambiguous' use 'module' when import.meta is used.
2018-03-09 15:00:13 -08:00
Logan Smyth
3c8e9acd4a Make the unambiguous grammar select module when import.meta is used. 2018-03-09 14:44:06 -08:00
Logan Smyth
958551fd89 Refactor unambiguous to track state during parsing. 2018-03-09 14:35:55 -08:00
Logan Smyth
b5e6536f26 Remove the sourceMapTarget option from core and implement it in babel-cli. (#7500) 2018-03-09 14:14:25 -08:00
Will Monk
0389035e15 Add exact Param To ObjectTypeAnnotations (#7535) 2018-03-09 19:22:01 +01:00
Brian Ng
4f4dd3d4a6 Assign another temp var when parsing assignment patterns in destructuring (#7333) 2018-03-09 09:39:25 +01:00
Logan Smyth
4da3f3bc64 Update helpers from #7491. (#7532) 2018-03-08 17:06:43 -08:00
Logan Smyth
7901e7d1b9 Fix flowtype errors introduced in #7503. (#7531) 2018-03-08 16:02:28 -08:00
Logan Smyth
4b6c7ac0f6 Run build-no-bundle in the watcher to get right files. (#7530) 2018-03-08 13:48:32 -08:00
Daniel Tschinder
24a07fc790 Use jest workers on travis-ci and circleCI (#7510) 2018-03-08 22:15:54 +01:00
Logan Smyth
1c9b0ff49e Merge pull request #7491 from loganfsmyth/require-array-rest-spread-iterable
Explicitly throw if the array rest/spread items are not iterable.
2018-03-08 12:39:53 -08:00
Logan Smyth
828e9a8538 Skip minification of large bundles during CI builds. (#7528) 2018-03-08 12:36:47 -08:00
Brian Ng
f97d4313c9 Update test262 test script and a few keyword escape fixes (#7503)
* Update test262 and whitelist

* Use test262-stream

* Check escapes in contextual keywords

* Check escapes when parsing new.target

* Check escapes for getters/setters

* Check escapes for static class methods

* Check escapes on async arrow and functions
2018-03-08 09:10:00 -06:00
Brian Ng
2a0071028d Add Number.parseFloat/parseInt mappins for preset-env 'usage' (#7421) 2018-03-08 09:08:43 -06:00
Sven SAULEAU
2c0d492674 Merge pull request #7515 from abouthiroppy/feature/modify-readme-of-babel-plugin-transform-block-scoped-functions
Update README.md and add test
2018-03-08 12:06:58 +01:00
Logan Smyth
e42cbb40a4 Merge pull request #7472 from loganfsmyth/expose-partial-config
Expose the partial Babel config for callers to load and mutate.
2018-03-07 18:23:27 -08:00
Logan Smyth
74ab2798e2 Tweaks around PR comments. 2018-03-07 18:02:38 -08:00
Logan Smyth
fef5c7e523 Expose the partial Babel config for people to load and mutate. 2018-03-07 16:33:25 -08:00
Logan Smyth
53825f8152 Show a more useful diff when comparing fixture files. (#7520) 2018-03-07 12:27:10 -08:00
Rory O’Kane
40819f112c Fix link to proposal in do expressions plugin README (#7519)
The old link, http://wiki.ecmascript.org/doku.php?id=strawman:do_expressions, fails to load for me.

[skip ci]
2018-03-07 15:01:39 -05:00
Yuta Hiroto
2d36549541 Update README.md and add test 2018-03-07 23:49:56 +09:00
Brian Ng
7e423de911 Restore passing SIGINT signals to spawned child processes (#7511) 2018-03-07 14:10:11 +01:00
Abu Shamsutdinov
8317f8ab14 added support Node's --require and -r flags in babel-node 2018-03-07 12:38:57 +03:00
Daniel Tschinder
65dcc4eabe Fix makefile indentation 2018-03-06 11:57:26 +01:00
Daniel Tschinder
c8992e4155 Enforce Prettier defaults + also format .babelrc and .json (#7499)
* .prettierrc: full configuration for Prettier

This way, contributors using different-from-default settings will still
use the correct prettier settings

* Makefile: also lint .babelrc.js

* Makefile: also prettify .json files

* Exclude package.json files and correct build dir

* Add more default options to prettierrc and load it in cli

This avoids prettier looking up the config for each file

* Format json

* Update prettier and eslint and reformat codebase

* Remove obsolete file

* Add comment
2018-03-06 11:40:36 +01:00
Raja Sekar
50b9fbb570 empty src dir error fix - fixes #7375 2018-03-05 17:46:38 -08:00
Daniel Tschinder
5d615dd198 Disallow setters to have RestElement (#7498) 2018-03-05 18:03:59 -06:00
Daniel Tschinder
eb2a0b0fcd Raise minimum version for debug to only allow secure version. (#7495) 2018-03-05 20:12:56 +01:00
Logan Smyth
eaa31b6ec3 Explicitly throw if the rest/spread items are not iterable. 2018-03-05 09:32:40 -08:00
Logan Smyth
4d76d5dddc Refactor Babel's helpers into smaller functions. 2018-03-05 09:32:39 -08:00
Nicolò Ribaudo
a86d311986 Reuse the assertThisInitialized helper in possibleConstructorReturn (#7493) 2018-03-05 08:11:16 -08:00
Daniel Tschinder
a340a2614f Fix reseting modules in jest and config (#7494)
* Fix reseting modules in jest and config

we have lib folders inside the source folders which should not be ignored.

* Add codemods lib folder

* Support mjs

* improve ignore pattern
2018-03-05 16:04:29 +01:00
Daniel Tschinder
f9857ca6ba Docs: Use namespace packages in all links (#7496)
preset-env and babylon were still linking to spearate repos
2018-03-05 08:49:27 -06:00
Daniel Tschinder
f43bf7fcd5 Enable babel-register tests again (#7487) 2018-03-05 10:47:00 +01:00
Gvozd
653318b7e4 Always transform for-await in async functions. (#7446)
for-await was transformed in @babel/helper-remap-async-to-generator, which was
called by @babel/plugin-transform-async-to-generator and
@babel/plugin-proposal-async-generator-functions. This prevented for-await
statements in async functions to be transpiled if the
transform-async-to-generator plugin was't enabled.
2018-03-05 09:30:25 +01:00
K Sashi Kumar
d187c26748 Spec Violation: Fix var initializer in for-in loop (#7392) 2018-03-04 16:18:32 -08:00
Kevin Ji
fc64ab5725 eslint: Rename to .json, mark as root config - fixes #7433 2018-03-04 16:00:41 -08:00
Nicolò Ribaudo
5cd8b5b7f0 Add eslint plugin to disallow t.clone and t.cloneDeep (#7191)
* Add eslint plugin to disallow `t.clone` and `t.cloneDeep`

* Make it better and add flow

* Other cases

* Superpowers

* Fix
2018-03-04 15:47:11 -08:00
Nicolò Ribaudo
a328b6ad1a Arrow functions and methods' params are binding identifiers (#6770) 2018-03-04 15:19:48 -08:00
Logan Smyth
15a80f0df8 Merge pull request #7490 from loganfsmyth/sourcetype-helpful-errors
Give helpful errors if the wrong sourceType is detected
2018-03-04 15:03:49 -08:00
Logan Smyth
a4795408b4 Allow plugins to assert that a specific babel version has loaded the plugin. (#7450) 2018-03-04 14:36:54 -08:00
Logan Smyth
5f6e3122a0 Give users helpful feedback if they are detected as using the wrong sourceType. 2018-03-04 14:12:37 -08:00
Logan Smyth
7f8f4e86dc Merge pull request #7484 from loganfsmyth/test-input-mjs
Require tests to use input.mjs for modules, and output.js/.mjs based on active transforms
2018-03-04 14:06:07 -08:00
Logan Smyth
5c3092d86f Expand .raise() to allow more options. 2018-03-04 13:38:12 -08:00
Logan Smyth
7cc00cce0d Require output fixture extension to match sourceType output. 2018-03-04 13:31:33 -08:00
Logan Smyth
beb99dfda1 Rename test fixtures using module syntax to .mjs files. 2018-03-04 13:31:32 -08:00
Logan Smyth
5f9539e9cc Rework the testrunner to pass the input filename only. 2018-03-04 13:28:25 -08:00
Logan Smyth
aa669ef902 Fix an issue with new update-expression tests. 2018-03-04 13:25:31 -08:00
Marvin Hagemeister
c92e8be612 Generating correct assignments for live bindings updated with UpdateExpressions (#7489)
Fixes #7488
2018-03-04 20:46:33 +01:00
K Sashi Kumar
ab1e295c74 [Doc] Remove build-babylon from contributing (#7474) [skip ci] 2018-03-04 19:55:25 +01:00
K Sashi Kumar
ae0df86340 Remove broken check in checkFunctionNameAndParams (#7473) 2018-03-04 16:34:16 +01:00
Deven Bansod
41bf66bca2 Migrate babel-code-frame tests to use expect (#7485)
* Replace `assert.equal` calls with appropriate `expect` calls
* Work-in-progress: Currently targeting only `babel-code-frame` tests
2018-03-04 11:39:12 +01:00
Logan Smyth
212058148c Require users to pass a filename, or specify --no-babelrc when using CLI with stdin. (#7461) 2018-03-03 12:29:11 -08:00
Daniel Tschinder
785131d8e6 Also run coverage with node: current (#7479) 2018-03-03 18:45:34 +01:00
Mauro Bringolf
81532103da Contributing docs: Add caveat about direct subdirectories and exec tests (#7482) [skip Ci]
* Add caveat about direct subdirectories and exec tests

* Fix _only_ typo
2018-03-03 18:01:29 +01:00
Michał Pierzchała
cc6e739f15 Add a brief summary to CLI's build output (#7439)
* feat(babel-cli): add a brief summary to build output

* address feedback

* further adjustments

* Use quiet output as default, add --verbose

* fix tests

* remove verbose alias
2018-03-03 13:29:26 +01:00
Daniel Tschinder
3e95830646 Migrate to jest (#7455) 2018-03-03 10:58:19 +01:00
Orta
53208d6998 Another iteration on the TS plugin readme (#7469) 2018-03-02 22:39:18 -06:00
Orta
fdfbd9a6f7 Update README for Babel TypeScript Plugin (#7443) 2018-03-01 08:46:54 -06:00
Daniel Tschinder
007f8d19b3 Remove unused dependencies (#7454)
Replace util.promisify with node internal version
2018-02-28 10:59:28 -05:00
Daniel Tschinder
586ba35950 Update to circleci v2 (#7451) 2018-02-28 10:58:47 -05:00
Daniel Tschinder
1a454f666c Install peerDependencies and remove unused async dependency (#7453) 2018-02-28 10:58:33 -05:00
Logan Smyth
a07f96ce3f Merge pull request #7449 from loganfsmyth/env-enhancement
Centralize the plugin/preset and config APIs into one place
2018-02-28 01:03:35 -08:00
Logan Smyth
2c3eb3096f Expand the '.env()' API call with more flexibility. 2018-02-27 18:48:24 -08:00
Logan Smyth
148e6dfc26 Centralize the plugin/configuration API object. 2018-02-27 18:48:24 -08:00
Logan Smyth
ddd40bf5c7 Rely entirely on sourceType for module vs script differentiation. (#7417) 2018-02-27 18:11:13 -08:00
Logan Smyth
bf8b25289b Merge pull request #7436 from loganfsmyth/less-upfront-work
Default to `ast:false` and do less work when loading core
2018-02-27 18:03:53 -08:00
Logan Smyth
b19b7fd2cf Fix PR comments. 2018-02-27 17:46:17 -08:00
Guy Bedford
f004972625 Ensure babel-preset-env targets input object is not mutated (#7438) 2018-02-27 08:46:24 -06:00
Yuta Hiroto
5459c75d64 Fix CONTRIBUTING.md (#7441) 2018-02-27 08:45:28 -06:00
Logan Smyth
8e3e6e0a88 Require AST output to be opt-in, rather than opt-out. 2018-02-26 18:44:59 -08:00
Logan Smyth
d4a8c7672c Avoid using lodash during config loading, for require() performance. 2018-02-26 18:44:58 -08:00
Logan Smyth
600106b9cb Lazy-initialize external helper template. 2018-02-26 18:44:57 -08:00
Logan Smyth
dffcef785a Lazy-initialize helper templates. 2018-02-26 18:18:57 -08:00
Logan Smyth
cb4f4f4d5f Ensure that typechecking artifacts are built up front for watch. 2018-02-25 21:38:11 -08:00
Logan Smyth
7ff4a73916 Upgrade flow to 0.66 and fix a few minor errors. (#7431) 2018-02-25 19:22:23 -08:00
Brian Ng
8823e4247e Fix up flow errors (#7227)
* charcodes@0.1.0

* Add hasFlowComment to tokenizer/state

* Fix babel-types flow errors

* Add isIterator to tokenizer/state

* Remove unnecessary argument from flow/readToken

* Add annotation to tokenizer/isIterator

* Fix reference to generated index.js.flow

* Add workaround in babel-template expression formatter

* Fix tsEatThenParseType return type

* Fix inconsistency with ParseSubscript state

* Add workaround for flow handling error with tagged template in optional chain

* Add flow workaround in expectPlugin inside tokenizer
2018-02-25 18:12:33 -08:00
Andy
6f3be3a543 typescript: Support definite assignment assertion (#7159) 2018-02-24 16:26:07 -06:00
Andy
6f6c8dabba TypeScript: Support conditional types syntax (#7404)
Microsoft/TypeScript#21316 and Microsoft/TypeScript#21496
2018-02-24 14:56:14 +01:00
Alasdair McLeay
960fa66c9e Reinstate --inspect-brk, lost when making babel-node standalone (#7423) [skip ci] 2018-02-23 15:18:13 -05:00
Logan Smyth
df50cddd63 Replace instead of merging babel-register options, and resolve cwd up front (#7416)
Replace instead of merging babel-register options, and resolve cwd up front
2018-02-23 08:51:42 -08:00
Brian Ng
455c04e60a Bump compat-table and regen preset-env data (#7401) 2018-02-23 08:46:14 -06:00
Brian Ng
182fe7b04e Add missing promise polyfill deps for preset-env's useBuiltIns: usage (#7400) 2018-02-23 08:45:22 -06:00
Brian Ng
959865b48d Update babel to beta.40 (#7413) 2018-02-23 08:44:45 -06:00
Logan Smyth
62c1046249 Avoid re-traversing inserted references to the namespace binding. (#7418) 2018-02-22 23:54:29 -08:00
Henry Zhu
70627ac92c we can use emojis 😊[skip ci] 2018-02-22 22:01:02 -05:00
Logan Smyth
a99e9614a6 Resolve the babel-register working directory up front. 2018-02-22 18:48:36 -08:00
Logan Smyth
cfb830b5bd Overwrite instead of merging babel-register options. 2018-02-22 18:43:47 -08:00
Mike S
84de90e572 Better error message for invalid plugin/preset (#7238)
- Error for invalid plugin/preset now includes file path
2018-02-22 18:30:01 -08:00
Mateusz Burzyński
d283324f8a Mark hoisted react constant elements as #__PURE__ (#7372) 2018-02-21 18:58:56 +01:00
Brian Ng
d75a6b8468 Remove istanbul hacks (#7403) 2018-02-21 09:56:30 -06:00
Deepak Pai
dad05ed503 Solves Tagged template literal size optimization (#7379)
* Tagged template literal size optimization
solves #7352

* Incorporates review changes
2018-02-20 15:39:22 -05:00
Justin Ridgewell
7e90d56024 Proposal: Logical Assignment Operators (#7385)
* Proposal: Logical Assignment Operators

https://github.com/jridgewell/proposal-logical-assignment

I'm bringing it [back](https://github.com/babel/babel/pull/516). 😉

* Use expectPlugin

* Add to stage 0 preset

* Add logicalAssignment missing plugin log stuff
2018-02-18 13:56:29 -05:00
Nicolò Ribaudo
3d49766f6b Don't extract rest elements from nested expressions (#7364)
* Don't extract rest elements from nested expressions

* Node 4
2018-02-17 16:22:38 +01:00
Brian Ng
4d17a96d50 Minor object-rest-spread README tweaks [skip ci] 2018-02-16 20:56:21 -06:00
James Reggio
6cbc585cf4 Fix over-zealous traversal by object-rest-spread (#7388)
Prior to this change, we'd conduct an open-ended traversal on the 'id'
of any VariableDeclarator to find a RestElement. The 'id' of
a VariableDeclarator can contain an AssignmentPattern (to supply
a default value), and if the right-hand side of the AssignmentPattern
contained a RestElement, we'd transform it.

The problem here is that the right-hand side of an AssignmentPattern can
be *any* Expression. If the right-hand side is a function body, we'd
traverse the entire function body, and if a RestElement occurred
anywhere in that function body, we'd transform it and emit the
transformations wherever we began the traversal (at least one scope
outside its usage).

The fix is to stop the inner traversal if we encounter an
AssignmentPattern. The outer traversal will still visit the
AssignmentPattern, so RestElements within the right-hand side of an
AssignmentPattern will be properly transformed at that time.
2018-02-16 21:19:09 -05:00
Andrea Puddu
ee6dfd1580 Fix object spread according to spec (#7034) 2018-02-16 20:06:17 -05:00
Logan Smyth
e732ee0c5b Preserve import binding locations during module rewriting (#7378)
* Only wrap import references that need it.

* Preserve the import binding location for sourcemaps.

* Add tests.
2018-02-14 10:17:27 -08:00
Justin Falcone
128fc6864e Link generator readme to Babylon AST spec [skip ci] (#7380) 2018-02-14 11:40:39 -05:00
Raja Sekar
6aed8e944f updated node debugger usage command in test (#7376) [skip ci] 2018-02-13 11:17:19 -05:00
Mateusz Burzyński
4d164bd8e6 Added babel-helper-split-export-declaration (#7313) 2018-02-13 16:44:05 +01:00
Henry Zhu
ea3f2d9299 v7.0.0-beta.40 2018-02-12 11:41:13 -05:00
Vojtěch Štěpančík
88a0f52230 Fix CLI compilation callback calling (#7366) 2018-02-12 08:10:35 -05:00
Yeonghoon Park
4a2e1dbbc3 Fix stage-3 name in README.md (#7363)
[skip-ci] Fix a typo in preset-env doc: `@babel/preset-stage-3` package name.
2018-02-11 14:04:31 +02:00
Clar Roʒe
2979dd99ac Update browserslist for babel-preset-env. (#7365) 2018-02-11 09:57:50 +02:00
Suchipi Izumi
534ee4734c Extract @babel/highlight package from @babel/code-frame
This creates a new package called @babel/highlight which syntax highlights
JavaScript code for terminal output. This functionality was already
present in @babel/code-frame, but exposing it as a separate package lets
other projects leverage it. @babel/code-frame has been refactored
slightly so that it uses @babel/highlight to do its syntax highlighting.
2018-02-09 09:31:37 +01:00
Steven Hargrove
a01007a3d3 Allow falsey, yet valid options for codeFrameColumns() (#7341)
Allow for overriding default linesAbove/linesBelow values.
2018-02-08 16:52:12 -05:00
Logan Smyth
493996e02a Merge pull request #7345 from loganfsmyth/small-bug-fixes
Small tweaks to prep for coming .babelrc lookup work
2018-02-08 13:30:49 -08:00
Justin Ridgewell
c03a34e509 Typo in nullish-coalescing-operator README.md 2018-02-08 14:34:41 -05:00
Naveen jain
92580e750d Fixes issues regarding super in optionalChain (#7356) 2018-02-08 14:31:47 -05:00
Logan Smyth
213805f21e Avoid duplicating types in index-browser. 2018-02-08 09:19:16 -08:00
Logan Smyth
28d13cb09b Fix small bug in the new .parse function. 2018-02-08 00:22:50 -08:00
Logan Smyth
9a8ba76e1f Merge .babelrc and .babelignore searching into a single pass. 2018-02-08 00:22:49 -08:00
Logan Smyth
d88173b9f8 Ensure that tests don't leave mutated global state in the environment. 2018-02-08 00:22:49 -08:00
Logan Smyth
85174b6ce1 Remove unneeded param from buildRootConfig. 2018-02-07 23:23:19 -08:00
Logan Smyth
ec2e0b664a Properly allow undefined ignore patterns for test/include/exclude. 2018-02-07 23:23:19 -08:00
Naveen jain
a3ad518ce1 [BugFix] : OptionalChaining Bug fixes (#7288)
* Added optionalExpression types to babylon and babel-types

* OptionalChain transforms bug fix

* Added OptionalExpressions to babel-generator. Fixed OptionalChain Bugs

* Removed 'optionalChain' from newExpression and added test cases

* Added test cases for optionalChain

* Update index.js
2018-02-07 19:42:14 -05:00
Nicolò Ribaudo
dd0337cc85 Fix failing test (#7344) 2018-02-06 17:42:55 -06:00
Nicolò Ribaudo
4887d81929 Remove bindings of removed paths from scope 2018-02-06 23:59:12 +01:00
Ben Newman
22555cd15d Failing test involving object rest/spread and clearScope().
This failing test case demonstrates a regression between 7.0.0-beta.38 and
7.0.0-beta.39 in the @babel/plugin-proposal-object-rest-spread package.

I distilled this test case from a larger configuration of plugins in my
application, one of which calls api.traverse.cache.clearScope(). Although
calling clearScope() is an uncommon thing for a plugin to do, it was a
reliable way to reproduce the problem. If I can find other reliable
reproductions, I'll push some additional failing tests to this PR.
Regardless of how common it is, clearing the scope cache should be a safe
operation that only slows down the transform (because scopes have to be
recreated and re-crawled). Crashing due to a spurious duplicate
declaration seems like a bug worth fixing.

My hunch is that [these two lines](eb38ea2b10/packages/babel-plugin-proposal-object-rest-spread/src/index.js (L75-L76))
(which were changed in `7.0.0-beta.39`) are not actually removing the
original rest element as a binding from the enclosing `Scope`, in certain
circumstances, so the new variable declaration ends up colliding with the
old (removed) binding.

Possibly related: #7304 (reported by @julien-f)
2018-02-06 23:59:12 +01:00
Daniel Tschinder
593c1a0861 Add core-js as valid polyfill source (#7315) 2018-02-04 17:53:54 -06:00
Kai Cataldo
7234442fde Add location information to parsing errors (#7314) 2018-02-04 13:00:03 -06:00
Justin Ridgewell
5ea1bfe780 Do not optimize away async/gen arrow functions (#7319)
* Do not optimize away async/gen arrow functions

* Node version 8
2018-02-03 17:08:12 -05:00
Tauyekel Kunzhol
2254ed45d2 [Bug fix] Reaching maximum calls stack when copying large number of non-js files in babel-cli (#7320)
Maximum call stack occurs when you try to copy large number of non-js files using `babel-cli@7.0.0-beta.38` or `babel-cli@7.0.0-beta.39`
2018-02-02 20:56:57 -08:00
Logan Smyth
278cd5e572 Preserve identifier location information when mapping this and arguments. (#7312) 2018-02-01 18:54:15 -08:00
Mathias Bynens
96c0415c86 Remove outdated sentence from README (#7311)
Unicode property escapes are now part of ECMAScript proper.

[skip ci]
2018-02-01 14:27:13 -08:00
K Sashi Kumar
ed98d2491e [Typescript] - Fix SyntaxError in async arrow functions with rest params (#7297)
* Fix: [Typescript] - SyntaxError in async arrow functions with rest params

* Fix optional params and add test code in flow
2018-01-31 21:05:24 +01:00
Henry Zhu
eb38ea2b10 Update babel to beta.39 (#7302) 2018-01-30 22:59:00 -05:00
Nicolò Ribaudo
f19d559ff3 Compile Babylon with Gulp (#7240) 2018-01-30 23:13:40 +01:00
Henry Zhu
73e64c6cb0 v7.0.0-beta.39 2018-01-30 15:27:19 -05:00
Brian Ng
3deb246c7d Add some es5 features to babel-preset-env (#6526) 2018-01-30 13:53:38 -06:00
Henry Zhu
1ebc229fa5 Revert "make babel injectable in babel-register" (#7298)
Revert "make babel injectable in babel-register"
2018-01-30 14:16:02 -05:00
Nicolò Ribaudo
cc4913699b Update packages/babylon/README.md [skip ci]
https://github.com/babel/babel/pull/7292#discussion_r164765384
2018-01-30 20:08:15 +01:00
Henry Zhu
82b6ee734b Revert "make babel injectable in babel-register" 2018-01-30 12:39:38 -05:00
Kai Cataldo
22c8f6376c babel-core: Add parse method (#7291) 2018-01-30 12:38:58 -05:00
Raja Sekar
023550c87b Docs: updated link relative to babel/babylon (#7292) [skip ci] 2018-01-30 12:05:43 -05:00
Henry Zhu
8e0d247e8c Fix: fixup package name [skip ci] 2018-01-30 12:04:52 -05:00
Naveen jain
65ae4ff15b Fix: export default decorated class parsed as class expression (#7189) 2018-01-30 12:00:29 -05:00
Owen Buckley
2185256589 update substitution placeholder message in @babel/template (#7255) 2018-01-30 11:54:31 -05:00
Mateusz Burzyński
3316a554bf Support cjs shorthand for modules option in preset-es2015 & preset-env (#7283) 2018-01-30 11:46:21 -05:00
Nicolò Ribaudo
252ea5a966 Fix reused nodes - part 2 (#7149) 2018-01-29 22:59:06 +01:00
Mateusz Burzyński
912bcc186d Fix reused nodes - part 1 (#7149) 2018-01-29 22:59:06 +01:00
Nicolò Ribaudo
63ae923987 Add t.cloneNode and deprecate t.clone and t.cloneDeep (#7149) 2018-01-29 22:59:06 +01:00
Nicolò Ribaudo
dde9274986 Disallow duplicated nodes in tests output (#7149) 2018-01-29 22:59:06 +01:00
Mauro Bringolf
ba111c13b5 Add notice on constant checks to documentation (#7279) [skip ci] 2018-01-29 09:23:01 -05:00
Sven SAULEAU
967414d926 Merge pull request #7273 from Janpot/babel-register-inject
make babel injectable in babel-register
2018-01-26 17:50:53 +01:00
Mauro Bringolf
92fc26d399 Remove check-constants plugin (#6987)
* Rebased onto new version

* Moved constants check into a separate method
2018-01-26 10:43:09 -05:00
Brian Ng
fa5eb4f605 Make comment props more consistent (#7246) 2018-01-26 10:39:52 -05:00
Jan Potoms
d6a782b09c use @babel/core 2018-01-26 16:36:29 +01:00
Jan Potoms
567d25cfa5 Document the feature 2018-01-26 08:38:16 +01:00
Jan Potoms
1da831baa4 improve spec 2018-01-25 10:26:21 +01:00
Jan Potoms
b0d8c62d1c Fix issue where babel was retained 2018-01-25 10:18:02 +01:00
Jan Potoms
0e570eceb2 make babel injectable in babel-register 2018-01-25 08:16:34 +01:00
Justin Ridgewell
ca18ea5e79 Re-add optional chaining delete (#7257)
* Re-add optional chaining delete

* Move exec tests next to output tests

* Forgot to commit these
2018-01-24 11:26:02 -08:00
Alexander Pepper
63d9998aa4 babel-preset-env: Fixed links in readme and improved "Built-ins" example (#7271) 2018-01-24 10:02:03 -06:00
Raja Sekar
88e550c733 removed plugin transform eval (#7262) 2018-01-23 17:31:45 -05:00
Andy
b96fdf8780 typescript: Fix enum emit when values are strings (#7160) 2018-01-23 15:42:32 -06:00
Justin Ridgewell
180eda3211 Remove old optional chain features (#6345) 2018-01-22 14:03:43 -08:00
Kristofer Baxter
b3969d35fa Add preset-env target esmodules (#7212) 2018-01-22 15:44:10 -06:00
Andy
dccfed3601 TypeScript: Support parsing 'unique' type operator (#7239) 2018-01-22 16:09:22 -05:00
Jamie Kyle
5759c33b4c Add opts.message option to code frames (#7243)
* Add opts.message option to code frames

* Fix for missing loc.start in code-frame

* Add docs
2018-01-21 14:19:20 +11:00
Brian Ng
193bccc93c Ensure isPureAnnotated returns a boolean 2018-01-20 13:42:49 -06:00
Brian Ng
5ce54799ff Tweak and add tests to babel-helper-annotate-as-pure (#7245) 2018-01-20 13:29:38 -05:00
Brian Ng
064c17e03f Bump prettier and related deps (#7244) 2018-01-20 17:00:21 +01:00
Matt Ziemer
f9804e6beb Add 'loose' option link for babel-preset-env (#7241)
- Added a external link to a good explanation of “loose” transformations.
http://2ality.com/2015/12/babel6-loose-mode.html
2018-01-20 14:34:52 +02:00
Henry Zhu
47ce7e71c9 Update to beta.38 (#7231) 2018-01-17 18:03:11 -05:00
Luca
5ac8ba19a4 Fix typo [skip ci] (#7229) 2018-01-17 13:43:59 -05:00
Henry Zhu
b5d20ab171 v7.0.0-beta.38 2018-01-17 11:31:32 -05:00
Henry Zhu
539009a980 Remove old command [skip ci] 2018-01-17 10:59:53 -05:00
Boris Cherny
c3654d83c8 Generate TypeScript typings, and improve generated Flow typings (#7101)
* generate typescript types

* improve type generator output

* move generator scripts to scripts/generators

* use new stringifier for generating flow types too

* export summary types

* add support for oneOfNodeOrValueTypes to improve type generation

* export typescript types from top level, and remove module declaration

* generate typescript/flow types and copy typescript types to babel-types/lib as part of make build

* copy flow types to babel-types/lib as part of make build (fix #6839)

* improve typing: Identifier->name should be a string, not any

* avoid destructuring, to support node 4

* update doc generator to share more code, regenerate babel-types readme, pipe all generator output to stdout

* regenerate babel-types readme as part of make build

* improve typing: ClassProperty->key should be Identifier | StringLiteral | NumericLiteral | Expression, not any

* improve typing: optional node properties are nullable, not undefinedable

* improve docs: FlowClassImplements should be ClassImplements

* make ts usage more friendly: when using babel-types api, make optional params | undefined, and when reading nodes keep optional params | null

* rm lib/types.d.ts and lib/types.js in favor of packages/babel-types/lib

* add missing variance node type, address review comments

* add tests for flow variance

* Comment should be a disjoint union of tagged types

* update .flowconfig
2018-01-17 10:31:46 -05:00
Andy
667f5815c1 typescript: Properly set this.state.inType one token before parsing a type (#7225)
* typescript: Properly set this.state.inType one token before parsing a type

* Reuse tsParseTypeArguments and inline tsExpectLessThanThenParseInType
2018-01-17 08:36:04 -05:00
Sven SAULEAU
4f39e6ea4a Merge pull request #7219 from Andarist/fix/deps
Fix dependencies in @babel/traverse
2018-01-16 10:31:40 +01:00
Nicolò Ribaudo
64dfb7574e Remove old comment (#7220) 2018-01-15 14:57:43 -06:00
Mateusz Burzyński
d36b142e30 Moved @babel/generator to dependencies in @babel/traverse 2018-01-15 19:47:15 +01:00
Jorrit Schippers
3c8d831fe4 Prevent object shape change in jsx helper (#7170)
Keeping the shape of an object constant is a performance improvement for modern javascript engines. At the point of the code change it is certain that the `children` property will be set later, so the property can already be set to `undefined`.
2018-01-15 16:37:57 +01:00
Mateusz Burzyński
0a517b51cd Added custom NodePath.prototype.toString method as debug utility (#7218) 2018-01-15 13:07:05 +01:00
Mateusz Burzyński
79c84f2f9b Fixed _containerInsertAfter setting path key as stringified index (#7213) 2018-01-15 08:08:42 +01:00
Joe Haddad
ca86648726 bugfix: set color level when color is forced (#7216)
Color level 1 matches our usages, level 0 is no color
2018-01-14 12:43:20 -06:00
Raja Sekar
2d05487293 Add support for @@iterator (#7058) 2018-01-12 09:19:11 -06:00
Peri Nikhil
c3352ad2e0 Fix: unicode characters not allowed in regexes (#7179)
Issue #6691
2018-01-10 15:33:21 +01:00
Antoine Prieëls
26e4911eb2 Use the async version of transform in babel-cli (#6826)
* use the async version of transform in babel-cli

* Modify compile to use async version of transformFile

* Babel-CLI: transform files sequentially

* Remove useless res in callback
2018-01-09 19:17:07 -08:00
Henry Zhu
aa888e666a fix wording [skip ci] 2018-01-09 15:09:47 -05:00
Nicolò Ribaudo
8659e1a88c Remove old expected.{js,json} files (#7187) 2018-01-09 13:10:30 -06:00
Maaz Syed Adeeb
9e384f3915 Cleaning up some TS parsing tests (#7184) 2018-01-09 11:37:05 -06:00
Raja Sekar
f694b5d034 Doc changes for https://github.com/babel/babel/issues/7063 (#7185) 2018-01-09 11:10:00 -06:00
Artem Yavorsky
d765573c0b Remove excess check for hidden files. (#7183) 2018-01-09 10:21:49 -06:00
Henry Zhu
64161fa0b5 Fix syntax plugins in babylon readme [skip ci] (#7182) 2018-01-09 10:04:54 -06:00
Henry Zhu
52f22e9e1e Merge pull request #7181 from nicolo-ribaudo/pr-7169
Rename actual/expected to input/output in fixtures.
2018-01-09 10:43:33 -05:00
Brian Ng
3e5fce07e4 Regen lib/types (#7180) 2018-01-09 09:25:45 -06:00
Raja Sekar
0f42accb87 Renamed files 2018-01-09 15:36:42 +01:00
Raja Sekar
07e69c009b Code changes 2018-01-09 10:36:11 +01:00
Claudio Procida
ce420ba51c Fixes React isCompatTag validator accepting leading dash character (#7164) 2018-01-09 09:42:05 +01:00
Nicolò Ribaudo
9fe30b98a1 Remove "quotes" internal flag from babel-generator (#7174) 2018-01-08 23:37:33 -08:00
Mauro Bringolf
0a9f136d5f Minor improvements to block-scoping/tdz (#6782)
* Add test case for simple reference in tdz

* Add more examples from old issues as test cases

* Fix two testcases by excluding function declarations from being tdz checked

* Document the  option for block-scoping

* Add test cases with destructuring assignments

* Remove failing test cases

* [skip ci] Include type and default value for options
2018-01-08 21:49:05 -08:00
Mouad Debbar
e9ed687666 Bail out on JSX fragments instead of throwing (#7166)
* Bail out on JSX fragments instead of throwing

The `transform-react-inline-elements` plugin doesn't handle JSX fragments. It throws an exception because `node.openingElement` is undefined.

* Add a comment explaining `node.openingElement`
2018-01-08 21:38:52 -08:00
mtpc
63157159ab Preserve namespaced attributes when throwIfNamespace is false (#7173)
Previously that part would throw since it expects a JSXIdentifier but it (logically) gets a JSXNamespacedName when using a namespaced attribute.
2018-01-08 21:24:02 -08:00
Maaz Syed Adeeb
74682f33bc Support 'assert and assign' TypeScript syntax (#7098) 2018-01-08 15:29:27 -06:00
Henry Zhu
b1bf7798ab update to v7-beta.37 (#7104) 2018-01-08 12:05:49 -05:00
Henry Zhu
7c99f4653f v7.0.0-beta.37 2018-01-08 11:02:14 -05:00
Logan Smyth
a19349a22a Merge pull request #7091 from loganfsmyth/config-overrides
Allow configs to have an 'overrides' array
2018-01-07 13:51:07 -08:00
Nicolò Ribaudo
b93184e430 [decorators] Only transform declarations to expressions when needed (#7124) 2018-01-06 16:38:28 +01:00
Logan Smyth
bb17b72f4f Process .babelignore before .babelrc (#7161) 2018-01-05 20:39:36 -08:00
Logan Smyth
a76709cabc Throw errors for users of 'ignore'/'only' options are passed in, but the filename is unknown. 2018-01-05 12:47:47 -08:00
Logan Smyth
c292140254 Implement an 'overrides' config array to process in order for overrides. 2018-01-05 12:47:47 -08:00
Logan Smyth
f4a24a38ca Allow config objects to use test/include/exclude to limit application to specific files. 2018-01-05 12:47:47 -08:00
Logan Smyth
193e841d89 Allow .env and .overrides in presets. 2018-01-05 12:47:47 -08:00
Steve Fan
1ded1d7ff6 [@babel/standalone] Remove additional function context (#7094) 2018-01-04 21:15:51 -06:00
Daniel Bayerlein
aec6e5c370 Update license year (#7141) 2018-01-04 20:35:43 -06:00
Raja Sekar
152e95fb52 Preserve jsx comment (#7155) 2018-01-04 14:11:08 -06:00
Sophie Alpert
8250ff963e Suggest JSX fragment syntax in adjacent tag error (#7152) 2018-01-04 09:21:39 +01:00
Elad Chen
82c6ca2f96 Update README.md (#7140) 2018-01-03 09:59:46 -06:00
Mateusz Burzyński
820edd1e23 Fix computed properties being inserted after the class, thus making them unavailable for instance methods & properties (#7147) 2018-01-03 15:39:07 +01:00
Raja Sekar
e872f0d975 Regex parsing issue fix after function declaration. (#7121) 2018-01-03 14:21:18 +01:00
Tim Seckinger
c3f6f7fe28 fix buildCodeFrameError empty code frames 2018-01-03 13:53:15 +11:00
Andy
49775e2f12 Remove redundant property declarations (#7144) 2018-01-02 22:20:54 +01:00
Raja Sekar
f3410e761c Flow comment parsing (#7007) 2017-12-30 23:53:08 +01:00
Brian Ng
ebbd5c7321 Bump regenerator-transform and regen fixture (#7137) 2017-12-30 16:44:22 -06:00
Boris Cherny
4208099f5b Add validators for Flow AST node fields (#7107) 2017-12-30 15:26:01 -06:00
h1b9b
068c65a1dd Remove hasBeenLogged flag from preset-env (#7130) 2017-12-29 08:19:11 -06:00
Fabian Streitel
3956b3ee0e Fix turning division operator into line comment in compact mode (#7131) 2017-12-29 08:11:35 -06:00
Nicolò Ribaudo
2297e2d764 Fix a regression introduced in #7040 (#7116) 2017-12-28 22:15:53 +01:00
Gustavo Rios de Sousa e Silva
d761d765bd Replace target: uglify tests with forceAllTransforms in preset-env 2017-12-28 13:17:28 -06:00
Alan Pierce
ad2019aa30 Add syntax-typescript and transform-typescript to babel-standalone (#7119)
The preset was already there, but this is nice for configs working directly with
plugins.
2017-12-28 10:03:28 -06:00
Diogo Franco
f9e0805337 Regenerate fixtures (#7120)
* Update line endings in test fixtures to match current output

* Fix incorrectly set up static-property-tdz fixtures

It seems the fixture runner does not look into subfolders.

* Remove expected file that should not exist

* Reenable disable optimisation test

* Reenable disabled nbsp tests

* Reenable comments between props test

The comments adjacent to children test is still broken so it stays off.
2017-12-28 19:28:05 +09:00
Diogo Franco
0f60d42fdf Avoid adding #__PURE__ annotation to .bind(this)() expressions (#7043)
* Avoid adding #__PURE__ annotation to .bind(this)() expressions

Fixes the #__PURE__ annotation getting added to (async () => {})() IIFEs when the arrow function transform is running with spec: true.

* Return false instead of undefined

* Fix indentation in json files

* Add one more case to the async-iife fixtures
2017-12-28 17:02:54 +09:00
Henry Zhu
7d798952d2 v7.0.0-beta.36 2017-12-25 14:04:08 -05:00
Joe Lim
ed2b88830e Remove extraneous console output when running preset-env tests (#6576) 2017-12-25 13:47:19 -05:00
Bogdan Chadkin
d25918aa5d Fix generation flow unnamed computed property (#7095) 2017-12-22 12:55:40 -06:00
Artem Yavorsky
035286a810 [preset-env] Move all defaults to the separate module (#7084)
* preset-env: Move all defaults to the separate module.

* preset-env: Add test cases for defaults.
2017-12-22 10:42:06 -05:00
Logan Smyth
c9a00fbae8 Merge pull request #7090 from loganfsmyth/chain-processing-rewrite
Refactor config processing more
2017-12-21 19:57:07 -08:00
Logan Smyth
758fd0369c Rewrite config chain loading to build chain recursively to keep caching readable. 2017-12-21 19:06:36 -08:00
Logan Smyth
7b861796cf Centralize validation logic in common folder. 2017-12-21 14:45:19 -08:00
Logan Smyth
f9825394a7 Remove unnecessary folder nesting. 2017-12-21 14:45:19 -08:00
Logan Smyth
43e7d1d2cc Use an object instead of a 2-tuple. 2017-12-21 12:31:48 -08:00
Logan Smyth
de63443762 Split babelrc and babelignore searching into two functions. 2017-12-21 12:28:51 -08:00
Andy
6a73f39199 Support parsing export default abstract class {} (#7075) 2017-12-21 16:13:31 +01:00
Azharuddin
2190e10e9a Better error messages when Babel fails to parse import = and export =… (#7079)
* Better error messages when Babel fails to parse import = and export = syntax from typescript when using babel-plugin-transform-typescript

* Fixing Test cases

* Ran make fix and broken looong sentence into smaller

* Slight changes to Messages after review with Nicolo & existentialism

* Removed trailing space
2017-12-21 02:00:36 +02:00
Nicolò Ribaudo
ae3f5b9149 Return the obj in setPrototypeOf fallback (#7080) 2017-12-20 22:48:10 +01:00
Nicolò Ribaudo
0c885b3200 Add support for extending builtins (#7020) 2017-12-20 14:46:00 -05:00
Artem Yavorsky
148fe7d3ff Add proposal-async-generator-functions to babel-standalone (#7073) 2017-12-20 20:37:16 +01:00
Henry Zhu
cabdf3769d Merge pull request #7065 from babel/dotall-preset-env
Add dot-all regex support to preset-env and standalone
2017-12-19 20:45:18 -05:00
Logan Smyth
1178799f07 Remove the LoadedFile class. 2017-12-19 15:36:54 -08:00
Logan Smyth
b2f1d01965 Add type annotations to utility file. 2017-12-19 15:36:19 -08:00
Logan Smyth
4f53496546 Drop the OptionManager class in favor of function. 2017-12-19 14:19:37 -08:00
Logan Smyth
1312a30d54 Perform normalization in the chain building process. 2017-12-19 14:19:37 -08:00
Logan Smyth
4afbc02476 Move descriptor merging into config chain processing. 2017-12-19 14:19:37 -08:00
Brian Ng
080c7f1e2d Clean up logPlugin 2017-12-19 14:57:19 -06:00
Brian Ng
3cea9f412a Add dot-all regex support to preset-env and standalone 2017-12-19 11:39:00 -06:00
Brian Ng
cd10ea03b4 Fix bug with debug output and unreleased versions 2017-12-19 11:38:59 -06:00
Mathias Bynens
5f8a1a2613 Fix unicode-property-regex installation instructions (#7064) 2017-12-19 11:27:26 -06:00
Mathias Bynens
44da8201a5 Import babel-plugin-transform-dotall-regex (#7059)
Original: https://github.com/mathiasbynens/babel-plugin-transform-dotall-regex

Moving it into the official Babel repository makes it easier to maintain the transform.
2017-12-19 11:01:59 -05:00
Brian Ng
2b065350b5 Treat import type * as a parser error (#7061) 2017-12-19 10:54:20 -05:00
Nicolò Ribaudo
68476b6ddd Make .insert{Before,After} work by default when the parent is an eport declaration (#7040) 2017-12-19 00:05:29 +01:00
Maaz Syed Adeeb
17b37b5013 Handling babylon parsing errors in a better way (#6961)
* Handling babylon parsing errors in a better way

* Better error messages + Helpful URLs

* Replaced message from babylon completely

* Add importMeta plugin to the map
2017-12-18 15:49:34 -05:00
Bo Lingen
56638e1370 Add pipeline operator plugins to babel-standalone (#6955) 2017-12-18 10:10:20 -06:00
Francisco Ryan Tolmasky I
f0e46772a6 babel-types lists JSXIdentifier as an Expression (#6960)
Currently, Babel is treating JSXIdentifier, JSXMemberExpression, and JSXEmptyExpression as expressions as well, which means Babel will for example incorrectly allow you to place these anywhere an expression is wanted.

Closes #6851.
2017-12-18 09:27:43 -06:00
Mahmut Surekci
398bc43656 Add MIT license to proposal-unicode-property-regex (#7047) 2017-12-18 13:48:30 +01:00
Logan Smyth
44ea9433c0 Merge pull request #6952 from loganfsmyth/commonjs-lazy
Add a 'lazy' options to modules-commonjs
2017-12-17 19:32:51 -08:00
Logan Smyth
53826aaaa0 Expose a 'lazy' option for the CommonJS transform. 2017-12-17 18:42:35 -08:00
Logan Smyth
b900a3e5c2 Consistently return AST nodes. 2017-12-17 18:33:47 -08:00
dnalborczyk
ed4d90b33d expose import.meta syntax parser option as plugin (#7008) 2017-12-16 15:06:23 -06:00
Anthony Bianco
209a598d51 Fix loose option description in transform-modules-commonjs 2017-12-16 14:41:05 -06:00
Nicolò Ribaudo
9a146d01b0 [decorators] Don't transform every AssignmentExpression (#7032) 2017-12-15 16:17:31 -05:00
Rouven Weßling
f2437583ba Bump globals to version 11.1.0 (#7006) 2017-12-15 13:20:22 -05:00
Sven SAULEAU
a24c9f8ed6 Merge pull request #7028 from sophiebits/getLetReferences-n2
Fix O(n^2) getLetReferences – 40% faster on large flat files
2017-12-15 07:59:57 +01:00
Sophie Alpert
6a7223af29 Fix O(n^2) getLetReferences – 40% faster on large flat files
`this.blockPath.get("body")` constructs an array of paths corresponding to each node in `blocks.body` so takes O(n) time if n is that length. We were re-constructing that array on each iteration, so the entire loop was O(n^2).

On files with many statements in a single block (such as Rollup-generated bundles), this takes a large portion of time. In particular, this makes transforming react-dom.development.js about 40% faster. Not that you should be transforming our bundle with Babel.

Test Plan:
Make an HTML file with these three lines and watch it in the Chrome Performance tab to see timings (on my machine: 2.9s before, 1.6s after):

```
<!DOCTYPE html>
<script src="https://unpkg.com/babel-standalone@7.0.0-beta.3/babel.js"></script>
<script type="text/babel" src="https://unpkg.com/react-dom@16.2.0/umd/react-dom.development.js"></script>
```
2017-12-14 21:55:26 -08:00
Diogo Franco
a66845169f Rename misleading identifier
notRegenerator actually _enabled_ transforming regeneratorRuntime references.
2017-12-15 11:20:15 +09:00
Henry Zhu
8a4124b2ff v7.0.0-beta.35 2017-12-14 16:47:27 -05:00
Nicolò Ribaudo
05b22d2597 Update @babel/helper-wrap-function templates (#6984)
This commit introduces 4 changes:

1) Function declarations are wrapped using function declarations.
   This has two advantages:
    - We can rely on native hoisting, instead of using _blockHoist
    - The function isn't wrapped until it is called. This avoids
      problems where `regeneratorRuntime.wrap` was called before
      that `babel-polyfill` was imported.

   Example:
     function fn() {}
     // becomes
     function fn() { return _fn.apply(this, arguments); }
     function _fn() {
       _fn = _wrapper(/* Original function ... */);
       return _fn.apply(this, arguments);
     }

2) Use a single template for both named and anonymous function
   expressions. They already had the same behavior, but the one
   used for named functions was a bit longer.

3) Use normal functions instead of arrow functions to wrap
   function expressions.

4) Generate a name based on the original one for wrapped
   functions (e.g. `foo` becomes `_foo` instead of `_ref`).
2017-12-13 16:21:58 +01:00
Peri Nikhil
9cc0a26694 Move helpers from 'babel-plugin-proposal-decorators' to 'babel-helpers' (#7017) 2017-12-13 16:08:19 +01:00
Brian Ng
f5ef928586 Add method property to ObjectTypeProperty (#7005) 2017-12-11 09:32:16 -06:00
Brian Ng
42f66782be Improve error message in types assert (#7001) 2017-12-11 09:31:56 -06:00
Daniel Poindexter
12ac1bccd7 Fix type definitions to fully support Typescript (#6939) 2017-12-08 17:03:01 -06:00
Diogo Franco
82357d79a7 Workaround bad #__PURE__ annotation placement on IIFEs (#6999)
Based on a fix suggested by @kzc
2017-12-08 09:51:48 -05:00
Diogo Franco
2958548c2c Fix code generation for async generator methods (#6998)
Fixes generator to write `async *foo() {}` instead of `*async foo() {}`.
2017-12-08 17:38:31 +09:00
Henry Zhu
468aecca21 Add Babel's song: Hallelujah (thanks to Angus) [skip ci] (#6994) 2017-12-07 21:18:17 -05:00
Brian Ng
c7980b2b90 Bump prettier (#6991) 2017-12-07 17:36:49 -05:00
Henry Zhu
d6db5fb1e1 Update to the latest version of regenerator that uses the MIT license (#6992) 2017-12-07 15:32:36 -05:00
K Sashi Kumar
ac745ded0d Fix destructuring assignment spec violation (#6986) 2017-12-07 09:14:03 -06:00
Nicolò Ribaudo
a2aabbd33d Generate better builder names for JSX* and TS* (#6967)
e.g. JSXIdentifier -> jsxIdentifier.
The jSXIdentifier alias isn't removed, so this commit doesn't introduce breaking changes.
2017-12-07 12:17:40 +01:00
Henry Zhu
fcfa987926 publish babylon as next tag since it's not a scoped module yet [skip ci] (#6982) 2017-12-06 15:05:48 -05:00
Nicolò Ribaudo
509dbb7302 this before super() is a runtime error, not a static one. (#6467)
* Check that super.* is after super() at runtime

* "missing super() call in constructor" runtime

* "'this' is not allowed before super()" runtime
2017-12-06 06:46:54 +01:00
Leo Hsieh
e270fbe7f0 Update babylon ast links on CONTRIBUTING.md (#6972) [skip ci] 2017-12-04 23:43:40 +01:00
Andy
aa38c47160 For babylon typescript parser, fix false positive for ! after a line break (#6969)
Closes #6798
2017-12-04 19:57:22 +01:00
Nicolò Ribaudo
62bbee97d7 Better error message for import.meta and import() without plugin (#6962)
The correct error was already thrown when they weren't in statement position.
2017-12-03 17:45:37 +01:00
Daniel Tschinder
ac72bfbd33 Update babylon to use unicode 10 (#6958) 2017-12-03 11:55:50 +01:00
Henry Zhu
a7c9264c79 v7.0.0-beta.34 2017-12-02 09:38:52 -05:00
Raja Sekar
c41eb0d052 Do Expression from Stage 0 to Stage 1 (#6943) 2017-12-02 09:02:31 -05:00
Daniel Tschinder
de5ab72c49 Update flow to 0.59 and fix some flow issues (#6957) 2017-12-02 08:59:46 -05:00
Henry Zhu
607916880d update to beta.33 (#6948)
* update to beta.33

* typeof is excluded by default in loose mode
2017-12-02 08:59:08 -05:00
Daniel Tschinder
8270903ba2 Refactor @babel/types to be 100% ES-module (#6741)
This generates the dynamic functions at buildtime and also
splits the package into smaller files to avoid dependency circles.
2017-12-02 12:20:10 +01:00
Brian Ng
95fe785354 Fix stage refs to exportNamespaceFrom and exportDefaultFrom (#6949) 2017-12-01 12:29:51 -05:00
Henry Zhu
413aa79711 v7.0.0-beta.33 2017-12-01 09:27:57 -05:00
Henry Zhu
1a3a502f97 Remove some built files before publish [skip ci] (#6946) 2017-12-01 09:25:27 -05:00
Henry Zhu
5761eb0bb4 add readme entry for for-of assumeArray, use it (#6942) 2017-11-30 17:40:23 -06:00
Raja Sekar
a992d06c41 Porting babel-plugin-transform-for-of-as-array into transform-for-of as an option (#6914) 2017-11-30 17:48:56 -05:00
Brian Ng
d8bbaaae0a Split exportExtensions into exportDefault and exportNamespace plugins… (#6920)
* Split exportExtensions into two plugins in babylon
* rename proposal-export-default to proposal-export-default-from
* rename proposal-export-namespace to proposal-export-namespace-from
2017-11-30 17:46:36 -05:00
Daniel Tschinder
9d9710c765 Copy getters and setters correctly in interopWildcard (#6850) 2017-11-30 15:50:10 -06:00
Sam Gluck
18b91a8388 [plugin-proposal-class-properties] Fix small loose docs typo (#6941) 2017-11-30 15:09:36 -06:00
Artem Yavorsky
0a2a37c31f Fix export from assignment order for loose mode. (#6863)
* Consider reexports for bindingKindLookup.

* Update test cases according to reexports change

* Fix order for assign reexports.

* void 0 assignation to module keys only for loose mode.

* Create buildReexportsFromMeta helper.

* Update umd/amd fixtures.

* Refactor reexports build.

* Hoist template for reexports.

* Use map as a second argument of Array.from.

* Remove unnecessary export.
2017-11-29 11:58:29 -08:00
Boda
d731acc351 updated Unpkg link (#6929)
...to be the same as the link in the Installation section
2017-11-29 11:41:13 -05:00
Logan Smyth
fba19295b4 Merge pull request #6905 from loganfsmyth/config-options-merge
Merge all config & programmatic plugins/preset rather than duplicating
2017-11-28 13:46:36 -08:00
Logan Smyth
8fc8a1f2ee Use public options API for tests. 2017-11-28 13:25:10 -08:00
Nicolò Ribaudo
18c8d97c3d UpdateExpressions as callees must be parenthesized (#6922) 2017-11-27 23:31:24 +01:00
Henry Zhu
58962c35b5 update regenerator (removed explicit babel-types dep) (#6917) 2017-11-27 23:16:41 +01:00
Brian Ng
881fc14329 Add handling parens for extends clause in generator (#6897) 2017-11-27 12:08:35 -06:00
Daniel Lo Nigro
7d8932b6be Add comment to babel-standalone to dissuade removal of whitelist (#6910)
There was a good discussion on https://github.com/babel/babel/pull/6177. Linking to it in the code to preserve the comments.
2017-11-27 10:08:28 -08:00
Mauro Bringolf
6330a152ce Implement TDZ for ClassFieldDefinitionEvaluation (#6855)
* First implementation sketch and testcase

* Use helper instead of inline IIFE's

* minNodeVersion 6.0.0

* Hoisted visitor for subtraversal and fixed edgest case

* Resolve merge conflicts in helpers

* Remove duplicated helper from messing up Git
2017-11-26 16:56:04 +01:00
Logan Smyth
189c56628a Replace repeated plugins/preset in top-level config instead of running both. 2017-11-25 18:47:13 -08:00
Logan Smyth
8be488652f Allow plugins and presets to have explicit names. 2017-11-25 18:46:00 -08:00
Logan Smyth
cdf420d4d8 Rewrite config chain tests to use public loadOptions API. (#6909) 2017-11-25 18:25:20 -08:00
Nicolas Marien
cf62908bbd Keep user options intact in transformFile (#6890)
* Preserve user options in transformFile

* Improve tests for transformFile user opts handling
2017-11-25 10:13:56 -08:00
Logan Smyth
66ee192a7f Merge pull request #6904 from loganfsmyth/config-merge-prep
Add a 'cwd' option, and misc refactoring and tweaks before simple config merging
2017-11-24 22:54:40 -08:00
Logan Smyth
c635ff9c32 Remove duplicate from plugin list. 2017-11-24 19:45:15 -08:00
Logan Smyth
6cb9d20a0a Tie presets pass metadata to descriptors. 2017-11-24 19:45:15 -08:00
Logan Smyth
b5cb78d33a Move plugin pass initialization logic a bit. 2017-11-24 19:45:15 -08:00
Logan Smyth
1d0a3d6772 Remove duplicated assertion. Covered by validate() 2017-11-24 19:45:14 -08:00
Logan Smyth
18ea5aca51 Expose a 'cwd' option for Babel's root options. 2017-11-24 19:43:25 -08:00
Logan Smyth
db28c18458 Disallow nested '.env' blocks since they are useless. 2017-11-24 17:45:27 -08:00
Logan Smyth
a89171910f Merge pull request #6834 from loganfsmyth/caching-refactor
Expose `envName` as a top-level Babel option to avoid using environmental variables
2017-11-24 17:42:16 -08:00
Mark Shulhin
0056fb1cfb Fixed ignore in readme for babel-register [skip ci] (#6899) 2017-11-24 17:45:49 -05:00
Sven SAULEAU
041dd4a536 Merge pull request #6893 from Arfey/features/updated-gitignore-file
feat: updated .gitignore file
2017-11-24 20:13:37 +01:00
misha.gavela
428e294ded Merge branch 'master' of https://github.com/babel/babel into features/updated-gitignore-file 2017-11-24 19:21:30 +02:00
Brian Ng
0a3c2a0c4c Fix babylon test 2017-11-24 09:15:17 -06:00
misha.gavela
917e3ede31 feat: updated .gitignore file 2017-11-24 15:18:13 +02:00
Martin McKeaveney
6d820a2757 removing expression field from ArrowFunctionExpression (#6836) 2017-11-23 22:12:13 +01:00
Mateusz Burzyński
1ef7e0f48e Allowed hintedNames for namespaced imports, changed some other defaults for more readable ones (#6744) 2017-11-23 21:01:47 +01:00
Daniel Tschinder
9206df964d Use only imports in babel-traverse and remove double exports (#6881) 2017-11-23 20:59:54 +01:00
Brian Ng
c583a04a55 Fix setting deopt properly after evaluating multiple expressions (#6882) 2017-11-22 20:06:57 -05:00
Gidi Meir Morris
edbf5d33dc Fix "Better error messaging for unexpected tokens #6715" (#6875) 2017-11-22 15:31:03 -06:00
Brian Ng
8393a6d089 Add firefox 58 mappings to preset-env data (#6874) 2017-11-22 15:30:07 -06:00
Nicolò Ribaudo
464df13c69 Allow yielding an arrow function withour parens around the param (#6877) 2017-11-22 15:28:37 -06:00
Logan Smyth
80b4b7120b Quick fix for typescript import crash. (#6879) 2017-11-22 13:27:31 -08:00
Brian Ng
ccd7c25174 Regen babel-types docsdocs and interfaces [skip ci] 2017-11-22 08:53:16 -06:00
Sven SAULEAU
4384d38b90 Merge pull request #6862 from maurobringolf/const-violation-helper
Define readOnlyError helper and use in check-constants plugin
2017-11-22 12:18:52 +01:00
Yifeng Wang
3fae022320 Update CONTRIBUTING.md (#6868) 2017-11-22 10:47:06 +01:00
Henry Zhu
70361f1200 Remove the experimental folder 2017-11-21 20:03:16 -05:00
Artem Yavorsky
d72d567d43 Merge pull request #6866 from aaharu/reduce-preset-env-pkg-size
Add `.github` and `.idea` to `.npmignore` for babel-preset-env.
2017-11-21 21:06:52 +02:00
aaharu
4a455639e7 Add .github and .idea to .npmignore 2017-11-22 02:22:55 +09:00
Mauro Bringolf
ba441c5ce4 Define readOnlyError helper and use in check-constants plugin 2017-11-20 16:41:15 +01:00
Daniel Tschinder
7064b298d7 Make SpreadProperty and RestProperty a deprecatedAlias (#6853)
instead of hardcoding backwards compatiblity.
This way we get deprecation warnings and also builders will work.
2017-11-18 21:54:24 +01:00
Daniel Tschinder
f3004d0d4d Fix validation of WithStatement and enable flow in definitions (#6852)
Fixes also flow errors after activating flow
2017-11-18 18:17:31 +01:00
Vincent Chan
037b2025a6 description about building and testing babylon in CONTRIBUTING.md (#6756)
developers maybe confuse about the steps of building and testings in the mono project
2017-11-18 12:57:58 +01:00
Darío Hereñú
7d534dc32c Minor fix (styling) (#6849) [skip ci] 2017-11-18 06:51:44 +01:00
Anatoli Papirovski
2b710d0387 Do not access out of bounds arguments (#6792)
Potentially out of bounds arguments should not just be directly
accessed, instead use a ternary operator to check length.
2017-11-17 21:39:08 +01:00
Kevin Ji
e67cfc5b31 README: Use HTTPS and relative links when possible [skip ci] (#6843) 2017-11-17 10:34:44 -05:00
Sven SAULEAU
4552ee9962 Merge pull request #6844 from nicolo-ribaudo/babyon-watch
Add "make watch-babylon" [skip ci]
2017-11-17 14:16:32 +01:00
Nicolò Ribaudo
3c64554716 Add "make watch-babylon" [skip ci] 2017-11-17 09:50:46 +01:00
Steven Hargrove
cee9ae48e0 [skip ci] removed shorthand usage of official babel scoped presets & plugins from README.md's (#6820) 2017-11-16 22:51:23 -05:00
Logan Smyth
39dae28d5c Add missing argument and remove nonexistent one. (#6842) 2017-11-16 16:32:47 -08:00
Valerii Iatsko
16e898c692 @babel/cli: removed babel-node mention in README.md [skip ci] (#6829)
Follow up to 2374062bbd
2017-11-16 18:04:10 +01:00
Sven SAULEAU
bb89364813 Merge pull request #6727 from babel/feat-use-charcode-constants
[Babylon] Use char codes contants
2017-11-16 10:35:42 +01:00
Sven SAULEAU
57e2c45cbe chore: upgrade charcode 2017-11-16 09:57:20 +01:00
Raja Sekar
63397d0aad Better error message for super when not using an object method (#6754) 2017-11-15 21:29:46 -06:00
Artem Yavorsky
48906604f2 Add safari technology preview for babel-preset-env. (#6791) 2017-11-15 17:14:54 -06:00
Brian Ng
0f2ab2fe20 Fix some reserved type handling and declare class with multiple extends (#6725) 2017-11-15 16:16:15 -06:00
Artem Yavorsky
de3597983a [preset-env] Exclude transform-typeof-symbol with loose option. (#6831) 2017-11-15 14:13:59 -06:00
Logan Smyth
aa2d415507 Expose the envName as a programmatic and CLI option. 2017-11-15 11:24:39 -08:00
Sven SAULEAU
4c584ae341 chore: upgrade and fix charcodes 2017-11-15 19:53:30 +01:00
Logan Smyth
74439889d8 Centralize envName lookup using caching sidechannel. 2017-11-15 10:05:48 -08:00
Logan Smyth
74ea70718e Allow passing an cachable 'sidechannel' object into cache handlers. 2017-11-15 10:05:47 -08:00
Logan Smyth
bbff566024 Use expanded caching API to simplify usage. 2017-11-15 09:51:13 -08:00
Logan Smyth
3942862a2a Expose more caching flexibility for Babel's internal use. 2017-11-15 09:51:12 -08:00
Brian Ng
f3fd2ee3b2 Maintain plugin order with items in the include option (#6663) 2017-11-15 10:45:16 -06:00
Marcio Junior
6a19c2299a docs: [skip-ci] Remove @babel scope from babel-preset-env include/exc… (#6825) 2017-11-15 10:25:21 -06:00
Brian Ng
6371200215 Fix preset-env test 2017-11-15 10:07:04 -06:00
Brian Ng
47d5f0c20c Update dep versions inside preset-env-standalone 2017-11-15 09:54:03 -06:00
Artem Yavorsky
262d7518bd Move babel-preset-env-standalone to the monorepo. (#6438) 2017-11-15 09:50:36 -06:00
Brian Ng
287b485d0e Fix bug in preset-env usage plugin with destructure in for-of (#6662) 2017-11-15 09:45:54 -06:00
Nicolò Ribaudo
9ae23639ad Parse async arrows with flow type parameters (#6802)
Fixes #6712
2017-11-14 16:24:14 +01:00
Brian Ng
3c359698a7 Remove unneeded .eslintrc files (#6815) [skip ci] 2017-11-13 18:12:26 -05:00
Artem Yavorsky
056a995dd8 Fix shadow variables reassignment for block scoping in loops. (#6814) 2017-11-14 00:06:32 +01:00
Henry Zhu
84fe8e4181 use pr instead of tag for changelog/prs [skip ci] (#6819) 2017-11-13 16:08:08 -05:00
Logan Smyth
e44cef3473 Merge pull request #6818 from loganfsmyth/async-warnings
Add some nice warnings if plugins happen to return promises instead of sync values.
2017-11-13 12:42:58 -08:00
Logan Smyth
44c2791849 Expose a function for plugins to check if async plugins are supported by the current compilation. 2017-11-13 11:58:31 -08:00
Logan Smyth
0e88156d0c Add warnings to places where we might allow promises to be returned in later minors. 2017-11-13 11:58:30 -08:00
Henry Zhu
394ad93d22 Update to v7-beta.31 (#6804) 2017-11-13 10:50:29 -05:00
Sven SAULEAU
82a4919c11 Merge pull request #6803 from satya164/async-to-generator-pure
Add /*#__PURE__*/ annotatiotion for babel-plugin-async-to-generator
2017-11-13 16:31:37 +01:00
Sven SAULEAU
186f04a3e9 feat: use charcodes in JSX plugin 2017-11-13 13:15:32 +01:00
Sven SAULEAU
42c740ca0a Merge branch 'master' into async-to-generator-pure 2017-11-13 11:49:16 +01:00
Henry Zhu
4e6cd298c7 v7.0.0-beta.32 2017-11-12 08:32:53 -05:00
Satyajit Sahoo
7ae6e1e5a0 Add /*#__PURE__*/ annotatiotion for babel-plugin-async-to-generator. Fixes #6572 2017-11-12 18:31:48 +05:30
Clement Hoang
a18f83b4de Prefix XJS test directories with JSX instead (#6801) 2017-11-11 20:43:10 -05:00
Sven SAULEAU
097ff40001 feat: more charCodes 2017-11-11 18:08:43 +01:00
Mathias Bynens
25bde88dff Link to README on GitHub rather than the npm copy (#6796) 2017-11-11 08:14:45 -06:00
Logan Smyth
1165ecc616 Update README with new Sync-suffix functions. (#6794) 2017-11-10 15:19:24 -08:00
Logan Smyth
432a9b5092 Allow sourceType:unambiguous as a way to tell Babylon to guess the type. (#6789)
* Allow sourceType:unambiguous as a way to tell Babylon to guess the type.

* Update some docs.
2017-11-10 15:00:06 -08:00
John-David Dalton
330f9006a7 Add cache.clear() to clear the data reference when cache option is false. 2017-11-10 14:00:55 -08:00
Logan Smyth
47a93d6e2b Merge pull request #6783 from loganfsmyth/lazy-options-defaults
Apply option defaults when transforming, not up front.
2017-11-10 10:05:39 -08:00
Sven SAULEAU
c7a1bc774e Merge pull request #6785 from maurobringolf/new-ast-spec-link
Update AST spec link to new babylon location
2017-11-10 14:22:19 +01:00
maurobringolf
6707c83149 [skip ci] Swap repository for package 2017-11-10 13:39:48 +01:00
Sven SAULEAU
b75f3d25e4 docs: [skip ci] correct Babylon link 2017-11-10 10:48:42 +01:00
Sven SAULEAU
43960b561a docs: [skip ci] correct Babylon link 2017-11-10 10:46:55 +01:00
Mauro Bringolf
791b1f1bab Update AST spec link to new babylon location 2017-11-09 22:44:10 +01:00
Nicolò Ribaudo
9a231c5671 Remove support for flow bindings (#6528)
Flow bindings have been deprecated for a while.
The reason behind this change is that `declare var foo`
doesn't introduce a new local binding, but it represents
a global one.
2017-11-09 12:29:04 -08:00
Logan Smyth
4a5d551370 Set babelrc:false on config load for more consistent loading. 2017-11-09 12:26:40 -08:00
Logan Smyth
2bfa2eb5cd Apply option defaults when transforming, not up front. 2017-11-09 12:20:52 -08:00
Amin Marashi
83cd3fb2c9 Lazy-install sourceMapSupport (#6651)
* Install sourceMapSupport only when sourceMaps are requested

* Add tests for sourceMapSupport

* Fix sourceMap position for tests

* Fix gen_error file

* fix the test descriptions

* Refactor install sourceMap support

* Run sourceMapSupport only once

* Handle cases where sourceMaps is undefined
2017-11-09 12:20:26 -08:00
Anatoli Papirovski
aefbb1380e No unneeded empty arrays in transform spread (#6763)
* No unneeded empty arrays in transform spread

Since Array.prototype.concat creates a new array from inputs, there's
no need to call it from a new empty array ([].concat()).

* [fixup] simplify detection of new array
2017-11-09 14:51:56 -05:00
Logan Smyth
617d35245f Merge pull request #6776 from loganfsmyth/more-plugin-options
Hoist more plugin options and default useUnicodeFlag to 'true'.
2017-11-09 10:56:15 -08:00
Logan Smyth
d90ba531ee Merge pull request #6781 from loganfsmyth/parsegen-plugins
Make official API for plugins to override parser/generator
2017-11-09 10:45:12 -08:00
Logan Smyth
3782c7267e Default unicode-property-regex to outputting 'u' flag regexes. 2017-11-09 10:39:52 -08:00
Logan Smyth
fc7fcfac0a Expose a clear API for plugins to override the parser/generator. 2017-11-09 10:34:12 -08:00
Logan Smyth
52d337e4d9 Move plugin object validation into plugin file. 2017-11-09 10:24:04 -08:00
Logan Smyth
98969b8a73 Standardize on Sync suffix for sync APIs (with backward-compat) (#6780) 2017-11-09 10:22:51 -08:00
Sven SAULEAU
b79e3c0e99 fix: minor changes 2017-11-09 18:07:10 +01:00
Sven SAULEAU
88c1b4ef1c feat: more charcodes 2017-11-09 17:13:36 +01:00
Logan Smyth
e7c57ae85a Move a few more references to plugin options to the top level. 2017-11-08 23:07:56 -08:00
Logan Smyth
6fe7f77eb4 Merge pull request #6778 from loganfsmyth/use-peerdep
Use the peerDep to load types/template/traverse in plugins
2017-11-08 23:05:08 -08:00
Logan Smyth
e0fc5e974d Merge pull request #6777 from loganfsmyth/options-simplified
Add an official 'state.filename' and be more explicit about option passing.
2017-11-08 23:00:44 -08:00
Logan Smyth
d5643d27f4 Remove unused dependency. 2017-11-08 17:38:55 -08:00
Logan Smyth
4d7d4605b6 Centralize parserOpts and generatorOpts normalization. 2017-11-08 17:06:01 -08:00
Logan Smyth
39119f88e7 Pass explicit options list to babel-code-frame 2017-11-08 17:00:02 -08:00
Logan Smyth
6684986372 Expose an official API to access the current filename. 2017-11-08 16:48:25 -08:00
Logan Smyth
82513465ee Pass an explicit whitelist of options down into babel-generator. 2017-11-08 16:41:33 -08:00
Diogo Franco
81811bf1b9 Fix transform-arrow-functions in { spec: true } shadowing (#6760)
* Fix transform-arrow-functions in { spec: true } shadowing

The function name matching the variable declaration name could
shadow the actual function object inside the generated function,
leading to invalid behavior due to holding a reference to the
original unbound function.

* Combine it with transform-function-name just to be sure in spec: false

* Revert "Fix transform-arrow-functions in { spec: true } shadowing"

This reverts commit 1cafe2561d0b0ddd181b956a85eb074621da12e8.

* Much simpler version of the above fix

* Missing fixture updates

* Avoid using rest/spread to make the tests pass on node 4

* ...actually update _all_ the fixtures
2017-11-08 17:21:30 -05:00
Sven SAULEAU
6b417a8ecb chore: bump charcode plugin 2017-11-08 16:56:25 +01:00
Sven SAULEAU
cd8a869a18 fix: remove unwanted change 2017-11-08 13:20:11 +01:00
Sven SAULEAU
f3f005c67e feat: use charcode AOT transform 2017-11-07 19:16:04 +01:00
Sven SAULEAU
7dfa79f4c8 Merge branch 'master' into feat-use-charcode-constants 2017-11-07 18:09:52 +01:00
Sven SAULEAU
3e34162092 chore: bump charcode 2017-11-07 18:07:38 +01:00
Brian Ng
c440f045f5 Update preset-env README with removing core-js stubs change [skip ci] 2017-11-07 08:48:50 -06:00
Brian Ng
ef47d8b1be Remove core-js/regenerator-runtime stubs (#6755) 2017-11-07 08:23:38 -05:00
Logan Smyth
b19b66d94b Use peerDep rather than plugin param for common APIs. 2017-11-06 11:32:47 -08:00
Daniel Tschinder
7dbed2170e Move typscript test copy script to scripts folder and run once (#6749) 2017-11-06 09:46:49 -06:00
Daniel Tschinder
cc66495a95 Unify eslint/prettier config (#6747)
* Unify eslint/prettier config

Use a prettier config file and correctly configure trailing commas

Enable curly in babylon as in all other packages.

* Add experimental and codemods
2017-11-06 14:19:59 +01:00
Benedikt Meurer
de72ce6ce7 Changed for..in loops to iterating through Object.keys, so only own properties gets processed (#6748)
* Properly guard for..in loops with Object#hasOwnProperty.

I noticed that babylon spends a lot of time in what we call *slow mode*
`for..in` when running in Node (on V8), and the reason for that is that
the version distributed on npm is build with *loose mode*, which turns
methods on the prototype into enumerable properties. Let's look at a
simplified example of the `State` class from `src/tokenizer/state.js`:

```js
class State {
  constructor() { this.x = 1; }

  clone() {
    var state = new State();
    for (var key in this) {
      var val = this[key];
      state[key] = val;
    }
    return state;
  }
}
```

According to the specification the `State.prototype.clone` method is
non-enumerable. However when transpiling this with loose mode, we get
the following output:

```js
var State = (function() {
  function State() { this.x = 1; }

  State.prototype.clone = function clone() {
    var state = new State();
    for (var key in this) {
      var val = this[key];
      state[key] = val;
    }
    return state;
  }

  return State;
})();
```

So all of a sudden the `State.prototype.clone` method is enumerable.
This means that the `for..in` loop inside of that method enumerates
`x` and `clone` for `key`, whereas originally it was supposed to only
enumerate `x`. This in turn means that the shape of the result of a
call to `clone` will be different than the shape of a state that is
created via the `State` constructor. You can check this in `d8` using
the `--allow-natives-syntax` flag and this simple test driver:

```js
const s = new State;
%DebugPrint(s);
%DebugPrint(s.clone());
```

Using either the class version or the transpiled version we see:

```
$ out/Release/d8 --allow-natives-syntax state-original.js
0x2a9d7970d329 <State map = 0x2a9d40b0c751>
0x2a9d7970d3c1 <State map = 0x2a9d40b0c751>
$ out/Release/d8 --allow-natives-syntax state-loose.js
0x3729ee30d1b9 <State map = 0x3729af90c701>
0x3729ee30d251 <State map = 0x3729af90c7a1>
```

So as you can see, the transpiled version (using *loose mode*) produces
a different shape for the result of `clone`, whereas the original
version is fine. This pollutes all sites which use either a state
created from the `State` constructor or returned from the `clone`
method. The original one has only the `x` property in either case,
whereas in the transpiled version the result of `clone` has properties
`x` and `clone` on the instance.

To mitigate this effect, it's best to guard the `for..in` loops with
`Object.prototype.hasOwnProperty` calls, such that the actual body of
the loop only deals with own properties and not with properties from the
prototype chain. This change does exactly that for the two affected
`clone` functions.

In addition to the performance hit because of the unnecessary
polymorphism, there's also the performance hit because of the *slow
mode* `for..in` itself, which has to collect the properties from the
instance plus the prototype. Ideally the prototype properties shouldn't
be enumerable to avoid this whole set of problems. I see a couple of
possible solutions:

1. Distribute the original ES2015 version via npm.
2. Don't use loose mode, so that `Object.defineProperty` is used
   instead, correctly passing `enumerable:false`.
3. Globally change loose mode in Babel to generate the correct and
   fast `Object.defineProperty` instead.

I'd personally prefer a combination of 1. and 3. here, but I'm aware
that distributing the ES2015 code might not be an option yet. So the
mitigation of properly guarding the `for..in` here should already help.
But it'd be nice to have a discussion on using `Object.defineProperty`
in general, as I imagine that this could easily bite other applications
as well and this performance cliff is completely unobvious to
developers.

* Switch to Object.keys and Array.prototype.forEach.
2017-11-06 13:23:20 +01:00
Brian Ng
d81cca3b5f Add additional support for loose mode in helper-module-transforms (#6742) 2017-11-05 20:54:14 -05:00
Henry Zhu
e8a33165ff Publish to the latest dist tag [skip ci] (#6738)
- This is because with scoped packages the `latest` package was the first publish we did
- This happens to be beta.4..
- So in this case we should publish whatever version as latest anyway
2017-11-04 01:02:26 -04:00
Henry Zhu
f76ac0b197 v7.0.0-beta.31 2017-11-03 16:03:01 -04:00
Henry Zhu
f5b6e69214 Change version to beta.30 since babylon was already at that version [skip ci] 2017-11-03 15:56:41 -04:00
Henry Zhu
efdc32fec5 Run with loose, exclude typeof in standalone (#6736) 2017-11-03 15:42:37 -04:00
Henry Zhu
1196ec1e38 add loose/useBuiltIns option to stage presets, use it, opt babylon build (#6733)
* add loose, useBuiltIns options to presets + use loose class properties

* whitelist helpers for babylon

* use transform-for-of-as-array in babylon
2017-11-03 14:22:06 -04:00
Artem Yavorsky
9cf017b2ca Fix global reference for use-built-ins plugin (#6478)
* Consider instance type for polyfills.

* Add test cases for evaluated objects.

* preset-env fixtures: babel-polyfill -> @babel/polyfill

* Split up fixtures with evaluated variables.
2017-11-03 11:22:11 -04:00
Clement Hoang
1a7194a22f Add JSX Fragment syntax support (#6552)
* Add JSX Fragments to babel-types

* Support JSX fragments in the transform-react-jsx plugin

* Add tests JSX fragments

* Update helper-builder and transform plugin documentations for jsx fragment

* Add generator for jsx fragments

* Add test for jsx fragment generator

* Split jsx transform example into normal and fragment examples

* Remove unnecessary fields from ElementState in babel-helper-builder-react-jsx

* inline [skip ci]
2017-11-03 10:43:48 -04:00
Sven SAULEAU
b93800d3cb fix: use charcode package 2017-11-03 09:52:45 +01:00
Sven SAULEAU
233e60c765 Merge branch 'master' into feat-use-charcode-constants 2017-11-03 08:52:54 +01:00
Sven SAULEAU
72a90cb63d feat: more charcodes 2017-11-03 08:51:48 +01:00
Sven SAULEAU
b51ac5e60a feat: sort by value
Vim 🖤
2017-11-03 08:27:03 +01:00
Logan Smyth
9e2828322e Merge pull request #6556 from loganfsmyth/early-validation
Strictly validate Babel's options to centralize Flow refinement of datatype
2017-11-02 16:24:36 -07:00
Sven SAULEAU
8b206b2c3b feat: generate charCodes
Vim 🖤
2017-11-02 20:13:44 +01:00
MICHAEL JACKSON
ce53c7668a Fix unpkg link (#6730) [skip ci] 2017-11-02 13:36:05 -04:00
Sven SAULEAU
a2ed843636 feat: add more charCodes 2017-11-02 18:14:29 +01:00
Sven SAULEAU
b95810f4b4 refactor: switch to individual exports 2017-11-02 17:57:58 +01:00
Raja Sekar
2d0211a085 Fix parsing arrow with existential return type (#6726) 2017-11-02 10:56:27 -05:00
Sven SAULEAU
abb4850709 refactor: use charCodes 2017-11-02 16:40:08 +01:00
Sven SAULEAU
459e289d63 feat: setup constants 2017-11-02 09:10:26 +01:00
Daniel Tschinder
3b540e3f5a Integrate babylon into babel workflow 2017-11-01 23:26:51 +01:00
Daniel Tschinder
52537410ef Merge histories of babylon and babel 2017-11-01 16:17:41 +01:00
Daniel Tschinder
2d378d076e Move babylon into monorepo 2017-11-01 16:16:48 +01:00
Daniel Tschinder
1b612148bf "yield" parsing inside function name and parameters (#689)
* Use parseFunctionParams to parse method parameters

* [funct] Set this.state.inGenerator before parsing the function name/params

This allows "yield" inside generator parameters to be actually
parsed as a yield expression

* [funct] Disallow yield in function parameters

* [arrow] "yield" can start an arrow function (e.g. "yield => {}")

* [arrow] Disallow YieldExpressions inside arrow parameters.

* [err msg] Disallow yield as fn name in strict mode using checkReservedWord.

So Babylon throws "yield is a reserved word" instead of
a custom "Binding yield in strict mode"

* [err msg] "X is reserved in strict mode" should have precedence over "X is reserved", since it is more specific.

This was observable if "checkKeywords" is true and the word is both a keyword and a reserved
word in strict mode

* Disallow "yield" as an identifier inside generators

* [tests] Add tests, update wrong esprima tests and enable disabled esprima tests

* [tests] Move uncategorized tests to es2015/yield

* [tests] Update test262 whitelist

* Fix regression introduced by 8c77073

* [tests] Update flow whitelist

* Fix flow errors
2017-11-01 16:05:18 +01:00
Logan Smyth
0b3182911a Avoid node duplication to fix spread bug with import. (#6657) 2017-10-31 20:37:16 -07:00
Henry Zhu
dbff057b8c update lockfile [skip ci] 2017-10-31 21:26:54 -04:00
Logan Smyth
d31c2c1470 Merge pull request #6655 from loganfsmyth/more-peerdeps
Use peerDeps in register and babel-node, add missing peerDependencies, and declare devDependencies
2017-10-31 18:10:55 -07:00
Logan Smyth
2d7685bdeb Explicitly declare devDependency to satisfy peerDep on babel-core. 2017-10-31 17:00:55 -07:00
Logan Smyth
ffad34e1a6 Remove unused @babel/types dependency. 2017-10-31 17:00:45 -07:00
Logan Smyth
8c95145c14 Use peerDependency for @babel register/node/cli. 2017-10-31 17:00:41 -07:00
Logan Smyth
948f741067 Add missing peerDependencies. 2017-10-31 16:57:56 -07:00
Henry Zhu
0e2a249746 Update to beta.5 with scoped packages 👻 (#6654)
* Update to beta.5 with scoped packages

* update to released version

* allow node 9 [skip ci]
2017-10-31 19:55:54 -04:00
Brian Ng
29a4aea27b Update parsing flow type/typeof imports (#773)
* Remove extranneous backticks from type/typeof error message

* Add isLookaheadContextual util

* Update parsing flow type/typeof imports
2017-10-31 17:09:39 +01:00
Nicolò Ribaudo
cd050e1405 Parse parameters inside function's env (#652)
* Parse parameters inside function context

* Add test for new.target inside parameters
2017-10-31 16:31:35 +01:00
M Behzad
fee7de2c1d white lists getter and setter acceseors for having stage-2 decorators (#766)
- adds `get` and `set` kind in addition to `method` to the list of allowed class members for having a decorator,
- adds tests for this two cases (decorator + set and decorator + get)
2017-10-31 16:13:04 +01:00
Henry Zhu
690d6465d8 v7.0.0-beta.5 2017-10-30 16:55:46 -04:00
Henry Zhu
bede73122d fixup places that aren not scoped [skip ci] (#6646) 2017-10-30 16:47:13 -04:00
Mateusz Burzyński
a1c7449a92 Fixed incorrect static class field initialization order (#6530) 2017-10-30 16:32:45 -04:00
Henry Zhu
624f00f23c Fix peerDep to ^ for beta only (#6644) 2017-10-30 16:24:42 -04:00
Henry Zhu
38f984f956 v7.0.0-beta.4 2017-10-30 14:33:56 -04:00
Henry Zhu
acfe99a4bc remove deprecated lerna command [skip ci] 2017-10-30 14:27:41 -04:00
Henry Zhu
96c380899b update types [skip ci] 2017-10-30 12:35:08 -04:00
Henry Zhu
397953c32d update lock [skip ci] 2017-10-30 12:21:20 -04:00
Benedikt Meurer
00342452e2 Fix OOB string character access in Printer#_maybeAddParen. (#6589)
* Fix OOB string character access in Printer#_maybeAddParen.

The `_maybeAddParen` method of the `Printer` class does

```js
const chaPost = str[i + 1]
```

without checking that `i + 1` is still within the bounds of `str`. It
seems like this triggers fairly often that the `str[i + 1]` access is
out of bounds. The first out of bounds access will turn the KeyedLoadIC
(in case of V8) into *MEGAMORPHIC* state, which is significantly slower
for strings (there's a fix in flight for V8 to mitigate the cost a bit
in that case). Even worse than that, the out of bounds access also
pollutes the later comparisons, namely

```js
chaPost === "/"
```

and

```js
chaPost === "*"
```

which are now no longer monomorphic on strings, since `chaPost` was
sometimes `undefined`.

This is a non-breaking performance fix, which improves babel execution
on the [web-tooling-benchmark](github.com/v8/web-tooling-benchmark)
workload by around 6-9%.

* Restructure and optimize the code a bit.
2017-10-30 09:16:44 -04:00
Daniel Tschinder
86abc16b37 Fix decorators2 to support export @decorator class A {} (#767)
* Fix decorators2 to support `export @decorator class A {}`

* change to better error message

Also ensure that null/undefined options get default value
2017-10-29 12:20:15 +01:00
Jakub Beneš
04d2c030be Add a 'throwIfNamespace' option for JSX transform (#6563)
* Added tests for ifThrowNamespace flag

* JSX transformator could work with XMLNamespaces (ifThrowNamespace flag)

* Use template literal instead

* Attempt to reword the message

* Added docs

* Reworded docs

* Reworded docs

* Fixed missing space in error message
2017-10-28 20:44:15 -04:00
Henry Zhu
9ac326b075 remove es20xx prefixes from plugins and rename folders (#6575) 2017-10-28 20:43:15 -04:00
Henry Zhu
92a3caeb9c remove warning (still applies but don't need it there) [skip ci] (#6579) 2017-10-28 20:17:16 -04:00
Benedikt Meurer
ffe4301fe2 Fix property lookup on booleans in needsWhitespace. (#6584)
The code

```js
linesInfo && linesInfo[type]
```

performs a lot of dynamic lookups on the `Boolean.prototype`, as the
*ToBoolean* operation let's `true` pass for `linesInfo` (which might
itself be concerning that this can be a boolean). Instead of the
coercion, the code should properly check for valid objects via `typeof`
and strict equality with `null` comparison.

This is a non-breaking performance fix.
2017-10-28 20:16:48 -04:00
Benedikt Meurer
5baa36109e Fix access to "-1" property on nodesOut array. (#6582)
Similar to the fixes in https://github.com/babel/babel/pull/6580 and
https://github.com/babel/babel/pull/6581, accesses of the form

```js
nodesOut[nodesOut.length - 1]
```

where `nodesOut` can be an empty array, are bad for performance in Node.
In this particular case it's easy to restructure the code a bit to not
require the array access at all, but just track the current `tail` as we
go.

This is a non-breaking performance fix.
2017-10-28 20:16:04 -04:00
Henry Zhu
962128c0f0 Update to babylon v7 beta.30 (#6587) 2017-10-28 20:01:52 -04:00
Henry Zhu
8f8ea04b62 7.0.0-beta.30 2017-10-28 19:40:53 -04:00
Henry Zhu
c6d369b32b fix flow unused supressing comment [skip ci] 2017-10-28 19:40:31 -04:00
Benedikt Meurer
f9e0643460 Fix path.popContext() to not try to load "-1" from contexts array. (#6580)
* Fix path.popContext() to not try to load "-1" from contexts array.

The current implement of popContext does

```js
this.setContext(this.contexts[this.contexts.length - 1]);
```

even if `this.contexts` can be empty, which causes it to lookup the
property `"-1"`, which is not found on the array itself and obviously
also not in the `Object.prototype` and the `Array.prototype`. However
since `"-1"` is not a valid array index, but has a valid integer
representation, this is a very expensive lookup in V8 (and probably
other engines too, but that is probably less relevant, since Babel
most often runs on Node nowadays).

* Make zero check explicit (for readability).
2017-10-28 16:17:05 -04:00
Benedikt Meurer
df0d9d05a3 Fix hasRest to not try to load "-1" from params array. (#6581)
Similar in spirit to https://github.com/babel/babel/pull/6580, the
current implementation did

```js
node.params[node.params.length - 1]
```

where `node.params` can also be empty, which causes it to lookup the
property `"-1"`, which is not found on the array itself and obviously
also not in the `Object.prototype` and the `Array.prototype`. However
since `"-1"` is not a valid array index, but has a valid integer
representation, this is a very expensive lookup in V8 (and probably
other engines too, but that is probably less relevant, since Babel
most often runs on Node nowadays). In V8 this causes a call to
the `%SetProperty` runtime function for each of these `"-1"`
property lookups, and in addition sends the whole `KeyedLoadIC`
to `MEGAMORPHIC` state, which also penalizes other accesses
on this line.

This is a small non-breaking performance fix.
2017-10-28 16:16:05 -04:00
Clement Hoang
a1125b26ce Add JSX fragment syntax support (#755) 2017-10-28 16:12:14 -04:00
Benedikt Meurer
55d5545614 Fix "-1" array accesses in CommentsParser. (#777)
Similar to the fixes in https://github.com/babel/babel/pull/6580 and
https://github.com/babel/babel/pull/6581, accesses of the form

```js
stack[stack.length - 1];
```

when `stack` can be an empty array are pretty bad for performance.
In this case it also breaks the type safety, since the function
`last<T>` is declared to only return values of type `T`, but
occasionally also returns `undefined` now, since the `stack` parameters
passed to it never contain a property `"-1"` and neither do the
`Object.prototype` or the `Array.prototype`.

This is a non-breaking performance fix, which adds proper checking
to ensure that `last` is only invoked on non-empty arrays.
2017-10-28 16:07:28 -04:00
Henry Zhu
5b47e4a6cb Merge transform-async-to-module-method into transform-async-to-generator (#6573) 2017-10-27 17:14:40 -04:00
Henry Zhu
f5ec9251c9 updated readme organization [skip ci] 2017-10-27 17:12:45 -04:00
Henry Zhu
c41abd79a1 Rename all proposal plugins to -proposal- from -transform- (#6570) 2017-10-27 15:26:38 -04:00
Logan Smyth
e4bcd1d0ff Allow Flowtype's imports and exports when sourceType:script is set. (#771) 2017-10-27 11:55:24 -07:00
Brian Ng
a94aa54230 Re-add electron-to-chromium as preset-env devdep (#6551) 2017-10-27 11:51:46 -04:00
Henry Zhu
476ec5ed8f Fix readmes to use @babel/ [skip ci] (#6569) 2017-10-27 11:50:59 -04:00
Henry Zhu
e5e7f5bf79 Lerna: Add publishConfig access public [skip ci] (#6557) 2017-10-26 19:22:13 -04:00
Logan Smyth
1d6cbd8dce Standardize descriptor creation. 2017-10-25 15:55:58 -07:00
Logan Smyth
fed2a14da1 Fail if there are cycles in config files. 2017-10-25 15:55:58 -07:00
Logan Smyth
0f31ce5686 Disallow 'null' as a general blank option placeholder. 2017-10-25 15:55:58 -07:00
Logan Smyth
64abf75d1f Perform option validation up front to avoid repeating assertions. 2017-10-25 15:55:58 -07:00
Logan Smyth
3673fbbd52 Refactor config item processing. 2017-10-25 15:55:58 -07:00
Logan Smyth
14901aa74f Remove the .loc from config items. 2017-10-25 15:55:57 -07:00
Logan Smyth
a25942bda9 Remove unused suppressDeprecationMessages option. 2017-10-25 15:55:57 -07:00
Logan Smyth
107648cd0b Remove unused 'mode' option. 2017-10-25 15:55:57 -07:00
Logan Smyth
0a2a0bb254 Remove the relative babel-core option. 2017-10-25 15:55:57 -07:00
Henry Zhu
0a823fbe8d add another team link [skip ci] 2017-10-25 17:51:47 -04:00
Henry Zhu
e3cebbf6bc Add peerDep on specific babel-core version in transform plugins, presets, and cli (#6549) 2017-10-25 08:36:00 -07:00
Simon Lydell
d2b3138bdd Make syntax highlighting for @ and # nicer (#6550) 2017-10-25 03:10:32 -04:00
Brian Ng
cb6082e98f Update flow tests whitelist (#770) 2017-10-24 15:58:27 -05:00
Sylvain Delabye
eb19ea18cc Remove stale emoji tests in plugin-transform-unicode-property-regex (#6548) 2017-10-24 13:17:05 -05:00
Raja Sekar
7f5a216e2d Changed Team link to babel website 2017-10-24 08:56:16 -05:00
Logan Smyth
11d8e0555f Avoid mutating the passed-in options for babel-register (#6542) 2017-10-23 15:49:10 -07:00
Ruslan Gunawardana
70818c3db8 UepdateEADME: useBuiltins: true is changed to "entry" [skip ci] (#6527)
babel-preset-env@next founds "useBuiltins": true is illegal. README is updated accordingly.
2017-10-23 17:08:00 -05:00
Sven SAULEAU
101529ffe0 Merge pull request #6529 from Borales/core-transformation-file-has
Providing File.has method for core/transformation package
2017-10-23 15:37:00 +02:00
Adam
3214c5004e docs - Add helper-get-function-arity readme [skip ci] (#6532)
* Add README to babel-helper-get-function-arity

* Use javascript template

* Address code review

* Comment out ellipsis
2017-10-23 10:30:36 +02:00
Sven SAULEAU
7185bd25e8 Merge pull request #6533 from athomann/add-helper-bindify-decorators-docs
Add API to helper-bindify-decorators README [skip ci]
2017-10-23 10:28:52 +02:00
Sven SAULEAU
546a844e32 Merge pull request #6534 from athomann/add-helper-hoist-variables-api
Add API to babel-helper-hoist-vars README [skip ci]
2017-10-23 10:23:32 +02:00
Adam Thomann
aeedabfa4f Add installation 2017-10-22 21:42:27 -04:00
Adam Thomann
9cebe88a9c Add API to babel-helper-hoist-vars README 2017-10-22 21:31:07 -04:00
Adam Thomann
a94b0d2e54 Add API to helper-bindify-decorators 2017-10-22 21:14:48 -04:00
Lucas Azzola
cd4f0ae393 Add loose mode for nullish coalescing operator (#6531)
* Add loose mode for nullish-coalescing

* Remove unneeded SequenceExpression
2017-10-22 13:25:29 +02:00
Borales
416e9aba39 Providing File.has method for core/transformation package 2017-10-22 00:45:40 +02:00
Lucas Azzola
9e0f5235b1 Optional Chaining: Account for document.all (#6525) 2017-10-21 15:55:39 -04:00
Mateusz Burzyński
4684edaec7 Adhering to async generator yield behavior change (#6452) 2017-10-21 21:48:27 +02:00
Alex Jover
39d05da3ed fix(babel-core): add missing extension to package.json dependency (#6524) 2017-10-21 11:46:10 +02:00
Mateusz Burzyński
54aa4cb3f9 Fixed async generator named declarations with inline helpers 2017-10-20 14:23:27 +02:00
Logan Smyth
765e920e48 Fix regression that leaks JSX pragma config between files. (#6519) 2017-10-19 16:09:56 -07:00
Mateusz Burzyński
fc75198fb4 Cloning reused node in class properties transform (#6517) 2017-10-19 18:12:57 -04:00
Justin Ridgewell
8d4674ca5a Fix destructuring in pipeline operator (#6515)
* Fix destructuring in pipeline operator

Fixes #6514.

* Run exec only on node 6
2017-10-19 15:59:36 -04:00
Brian Ng
923fd4705e Remove syntax-trailing-function-commas from Babel presets (#6513) 2017-10-19 15:50:48 -04:00
Jen Luker
c2c72c4224 Update reference from babel- to @babel/ in README.md (#6508) 2017-10-19 11:23:58 -05:00
Jen Luker
b6ae9e2db2 Updating references to @babel/ and adding dependencies to package.json (#6509)
* Updating references to @babel/ and adding dependencies to package.json all in babel-runtime.

* Removing extra ../../ from the require calls.
2017-10-19 08:23:27 -04:00
Will
752a16d44c Remove babel-plugin-transform-async-functions (#6510) [skip ci]
This is leftover from #6495

Closes #6504

Signed-off-by: Will Soto <will.soto9@gmail.com>
2017-10-19 08:05:52 -04:00
Logan Smyth
c87cc18586 Merge pull request #6379 from nicolo-ribaudo/helper-runtime-dependencies
Fix helper dependencies in babel runtime
2017-10-18 18:11:44 -07:00
Nicolò Ribaudo
a740b28a9e Commit the temporalRef runtime helper 2017-10-19 00:37:09 +02:00
Nicolò Ribaudo
d2af56bcae Fix helpers dependencies loading 2017-10-19 00:37:09 +02:00
Nicolò Ribaudo
e0a6e1e864 Import temporalUndefined inside temporalRef helper 2017-10-19 00:32:43 +02:00
Mauro Bringolf
2311ddbe67 Add transform to rename variables that are ES3 reserved words (#6479)
* Initial version

* Replace .includes with .indexOf and better node set to visit

* Alphabetically sort es3 reserved words and make difference helper for readability

* Fix second Array.include error that was not polyfilled

* Move es3 keywords into separate babel-types helper and use in all es3 transforms

* Reference local plugin build directly for tests

* Try relative import for babel-types

* Update to scoped package name and beta 3

* Fix unscoped package import

* Replace local plugin reference with proper plugin name
2017-10-18 15:00:58 -07:00
Robert Rossmann
e6d44fd68e babel-core: Pass the right err to callback in transformFile() (#6503) 2017-10-18 14:14:35 -07:00
Logan Smyth
97a217db30 Merge pull request #6492 from loganfsmyth/better-template
Make babel-template nicer in a bunch of ways
2017-10-18 14:14:14 -07:00
Logan Smyth
f230497d08 Use literal-based templates for more stuff. 2017-10-18 13:58:48 -07:00
Logan Smyth
673eaf839a Simplfy assertion generation. 2017-10-18 13:58:48 -07:00
Logan Smyth
107c37715e Use .program template for helpers. 2017-10-18 13:58:47 -07:00
Logan Smyth
cc802c1e00 Reimplement 'babel-template' with better caching and tagged literal utilities. 2017-10-18 13:58:47 -07:00
Logan Smyth
191624d800 Add a new utility for traversing the AST. 2017-10-18 13:55:14 -07:00
Logan Smyth
ef185feb35 Split template module into multiple files. 2017-10-18 13:55:14 -07:00
Logan Smyth
fc3433c5cf Default templates to sourceType:module. 2017-10-18 13:55:14 -07:00
Logan Smyth
afc3963848 Clean up template calls. 2017-10-18 13:55:14 -07:00
Logan Smyth
cc22ea04bb Add type declaration for t.validate. 2017-10-18 13:55:13 -07:00
Logan Smyth
ad05c9935e Generate types with %checks annotations. 2017-10-18 13:55:13 -07:00
Logan Smyth
e6beb7cb61 Regenerate flow types and add more types. 2017-10-18 13:55:13 -07:00
Mathias Bynens
5d4c736413 Import babel-plugin-transform-unicode-property-regex (#6499)
* Import babel-plugin-transform-unicode-property-regex

Original: https://github.com/mathiasbynens/babel-plugin-transform-unicode-property-regex

Moving it into the official Babel repository makes it easier to maintain the transform.

* Update package.json

* Update README.md

* fixup

* fixup 2
2017-10-18 13:58:44 -04:00
Logan Smyth
1b4307205e Limit file-based plugins/presets to only exporting functions. (#6494) 2017-10-18 10:17:45 -07:00
Logan Smyth
445b252bc4 Simplify dirname option in plugins/presets? (#6436) 2017-10-18 08:59:32 -07:00
Brian Ng
85d82152c6 Update scope pkg ref in nullish syntax README [skip ci] 2017-10-18 09:54:51 -05:00
Brian Ng
d7af472dc0 Update scope pkg ref in nullish README [skip ci] 2017-10-18 09:53:16 -05:00
Brian Ng
c23281dc54 Update more scope package refs in preset-env docs [skip ci] 2017-10-18 09:51:35 -05:00
Brian Ng
72d1a72122 Update babel-types docs and lib/types [skip ci] 2017-10-18 09:43:54 -05:00
Lucas Azzola
99be60b53d Implement transform for nullish-coalescing operator (#6483)
* Implement transform for nullish-coalescing operator

* Update example output

* Switch from BinaryExpression to LogicalExpression

* Address review comments

- Use generateUidIdentifierBasedOnNode
- Inline "??"
- Clone ref node
- Move "??" to LogicalExpression in babel-types

* Fix reference to @babel/helper-plugin-test-runner

* Fix reference to @babel/plugin-syntax-nullish-coalescing-operator

* Don't use parent scope

* Remove .vscode from .gitignore, change 'lib/index.js' to 'lib'

* Ensure `document.all ?? 0 === document.all`

* Fix note and copy to an inline comment
2017-10-18 03:10:05 -04:00
James Kyle
5c47929983 Export File from babel-core again 2017-10-18 12:28:56 +11:00
Logan Smyth
a75e69ecec Regenerate incorrectly-updated helpers from @babel scope PR. 2017-10-17 10:47:15 -07:00
Daniel Tschinder
c16986b0c7 [preset-env] Add 1.6.1 to Changelog [skip ci] 2017-10-17 14:40:16 +02:00
Henry Zhu
830c527bb7 Merge pull request #6495 from babel/scoped-packages
Rename everything: use scoped packages
2017-10-17 08:29:18 -04:00
Henry Zhu
20729b2625 Scoped: fix flow module resolution thanks to James 2017-10-16 23:35:50 -04:00
Henry Zhu
5eea11f1f9 Scoped: misc fixes 2017-10-16 23:00:48 -04:00
Henry Zhu
f30924e655 Scoped: fix tests [skip ci] 2017-10-16 22:49:57 -04:00
Henry Zhu
33af5f745a Scoped: fix more tests in preset-env [skip ci] 2017-10-16 22:49:57 -04:00
Henry Zhu
3400b3644b Scoped: fix bugs in tests [skip ci] 2017-10-16 22:49:57 -04:00
Mateusz Burzyński
6d2f4a6955 Scoped: updated more docs with scoped packages change [skip ci] 2017-10-16 22:49:57 -04:00
Mateusz Burzyński
859ea4b175 Scoped: updated numerous docs with scoped packages change [skip ci] 2017-10-16 22:49:57 -04:00
Henry Zhu
919bdf5e79 Scoped: remove unncessary deps from standalone [skip ci] 2017-10-16 22:49:57 -04:00
Henry Zhu
eab0a1fadb Scoped: remove old references to default enabled syntax plugins, fix bootstrap [skip ci] 2017-10-16 22:49:57 -04:00
Henry Zhu
d19a0e8635 Scoped: fix dep [skip ci] 2017-10-16 22:49:57 -04:00
Henry Zhu
425c2090c1 Scoped: update standalone [skip ci] 2017-10-16 22:49:57 -04:00
Henry Zhu
c0a958098f Scoped: update readme headers to @babel/ [skip ci] 2017-10-16 22:49:57 -04:00
Mateusz Burzyński
adfacbb270 Removed deprecated babel-core/register [skip ci] 2017-10-16 22:49:57 -04:00
Mateusz Burzyński
df721f067e reverted change to keywords in package.jsons [skip ci] 2017-10-16 22:49:57 -04:00
Mateusz Burzyński
47fa189053 Scoped: update more babel- to @babel/ [skip ci] 2017-10-16 22:49:56 -04:00
Henry Zhu
696df10f51 Scoped: update more babel- to @babel/ [skip ci] 2017-10-16 22:49:56 -04:00
Brian Ng
65495105e9 Scoped: rename installation instructions for transforms [skip ci] 2017-10-16 22:49:56 -04:00
Brian Ng
645bf56838 Scoped: rename installation instructions for presets [skip ci] 2017-10-16 22:49:56 -04:00
Brian Ng
4739677965 Scoped: rename installation instructions for syntax plugins [skip ci] 2017-10-16 22:49:56 -04:00
Henry Zhu
79ddf12d9d Scoped: rename to @babel/ in readme [skip ci] 2017-10-16 22:49:56 -04:00
Henry Zhu
dfbbe82598 Scoped: rename npm pkg keyword [skip ci] 2017-10-16 22:49:56 -04:00
Henry Zhu
70080063a4 Scoped: update experimental/codemods to @babel/ [skip ci] 2017-10-16 22:49:56 -04:00
Henry Zhu
691f90a774 Scoped: change test imports to @babel/ [skip ci] 2017-10-16 22:49:56 -04:00
Henry Zhu
cde0054227 Scoped: change src imports to @babel/ [skip ci] 2017-10-16 22:49:56 -04:00
Henry Zhu
8e5e27577a Scoped: update package.json dependencies to @babel/ [skip ci] 2017-10-16 22:49:56 -04:00
Henry Zhu
1cd564bd16 Scoped: rename package names to @babel/ [skip ci] 2017-10-16 22:49:01 -04:00
Henry Zhu
279f55cd9b update to babylon beta.29 2017-10-16 20:10:55 -05:00
Henry Zhu
24d62cd191 7.0.0-beta.29 2017-10-16 18:34:08 -04:00
Henry Zhu
eaf054ba1f Merge pull request #762 from azz/nullish-tests
Add more tests for the nullish coalescing operator
2017-10-16 18:32:26 -04:00
Zachary Sang
98621a6901 Removed index.js stub from packages/babel-core (#6474)
* Removed index.js stub from packages/babel-core

Added "main":"./lib/index.js" entry to package.json to replace index.js in packages/babel-core

* Fix indentation of new main.
2017-10-16 08:52:56 -07:00
Henry Zhu
58da50aace simplify register test (#6391) 2017-10-16 11:09:11 -04:00
Daniel Tschinder
9d00dac416 Update compat-data in babel-preset-env (#6489) 2017-10-16 11:07:41 -04:00
Henry Zhu
3659652fae update to beta.3 (#6488) 2017-10-16 10:51:56 -04:00
Lucas Azzola
727767c923 Add tests for ?? with other LogicalExpressions 2017-10-16 19:34:52 +11:00
Sven SAULEAU
12c389b718 Merge pull request #6490 from Andarist/deps-fix
Fixed es2015-template-literals dependencies
2017-10-15 20:33:56 +02:00
Mateusz Burzyński
1215db2dd3 Fixed es2015-template-literals dependencies 2017-10-15 18:05:05 +02:00
Daniel Tschinder
d80fea47af Add polyfills for ES6 static Object methods
These functions do exist in ES5, but we still need to
load the polyfills, as they differ in ES6 sligthly
2017-10-15 09:27:27 -05:00
Lucas Azzola
f1b8404750 Move ?? to LogicalExpression 2017-10-15 15:10:34 +11:00
Lucas Azzola
fcdfb0e31e Add more tests for the nullish coalescing operator 2017-10-15 12:04:10 +11:00
Henry Zhu
f1d2db6cf4 7.0.0-beta.28 2017-10-14 18:23:44 -04:00
Lucas Azzola
e53ce38c75 Implement nullish coalescing operator in parser (#761)
* Implement nullish coalescing operator in parser

* Add ?? to AST
2017-10-14 17:18:28 -04:00
Brian Ng
b5e6ba62db Allow new.target in class properties (#759) 2017-10-14 16:50:21 -04:00
Brian Ng
60ea39aa70 Fix export extensions handling of TS declare keyword (#757) 2017-10-14 15:25:42 -04:00
Andy
0fbf3a61fb Fix new type errors (#754) 2017-10-10 16:11:28 -05:00
Sven SAULEAU
6fc9af52ca Merge pull request #751 from gebilaoxiong/remove-unnecessary-return
chore: remove unnecessary return
2017-10-09 13:53:21 +02:00
gebilaoxiong
94a17419d4 chore: remove unnecessary return 2017-10-09 00:48:40 +08:00
Brandon Weaver
43afb984c4 fix readme (#749) [skip ci]
Amusingly the pipeline OP "breaks" the readme formatting because Markdown likes the `|` character a bit too much. Escaping the `|` fixes this and makes the readme display properly
2017-10-03 20:06:07 -04:00
greenkeeper[bot]
bbdde80992 Update flow-bin to the latest version 🚀 (#746) 2017-10-03 09:09:15 -05:00
Henry Zhu
64366a207e 7.0.0-beta.27 2017-09-28 23:26:01 -04:00
Henry Zhu
d2e06a9496 Pipeline Operator proposal (#742) 2017-09-28 23:13:41 -04:00
Rick Waldron
18c6b4e3e9 Fix: major revision to valid and invalid numeric literal separator "sibling" characters (#745) 2017-09-28 23:12:46 -04:00
greenkeeper[bot]
17be9360af Update babel-eslint to the latest version 🚀 (#738)
* chore(package): update babel-eslint to version 8.0.1

* chore(package): update lockfile

https://npm.im/greenkeeper-lockfile
2017-09-28 14:25:43 -04:00
Rick Waldron
b8ba10532e Fix NumericLiteralSeparator SyntaxError message to match V8 (#743) 2017-09-28 14:25:30 -04:00
Henry Zhu
ab268877fd don't build for tags (#741) 2017-09-28 10:51:04 -04:00
Henry Zhu
508cb70a35 7.0.0-beta.26 2017-09-27 14:34:39 -04:00
Nicolò Ribaudo
664ff37b36 Fix flow errors (#735) 2017-09-27 14:33:11 -04:00
Justin Ridgewell
8af007d560 Add throw expressions (#740) 2017-09-27 14:12:30 -04:00
Zoe Carver
ef8e30419c Add yield-result (#737) 2017-09-27 11:00:14 -05:00
Nicolò Ribaudo
4de29fe5e6 Distinguish between ternary's : and arrow fn's return type (#596) 2017-09-26 00:32:52 +02:00
Henry Zhu
20ec5c77b7 7.0.0-beta.25 2017-09-25 15:48:29 -04:00
James Kyle
d9766932db Ensure no-overlap between Flow and TS node types (#710) 2017-09-25 15:42:33 -04:00
Zoe Carver
a4acf2da6d Clean up uncatagorised decorators (1/2) (#731)
* Re-name uncatagorised 1 and 2

* Move to es2015

* Add expected.json to parenthesized lhs object

* Orginize into parenthesized-lhs-array and parenthesized-lhs-object

* Remove uncategorised/33 because it was repeditive decorators/class-decorator

* Move uncatagorised/34 to decorators/class-decorator-assignment

* Move uncategorised/35 to decorators/method-decorator

* Move uncategorised/36 to decorators/class-decorator-setter

* Move uncategorised/37 to decorators/class-decorator-getter

* Move uncategorised/38 to decorators/class-decorators-multiple

* Clean up syntax

* Move uncategorised/39 to decorators/object-decorator

* Remove syntax in order to pass tests

* Re-add uncategorisd/33 as decorators/class-decorator-new-line

* Move class-decorator-new-line to class-decorator-same-line
2017-09-24 16:33:01 -04:00
Zoe Carver
bfd9c7ba50 Clean up uncategorised tests (#730) 2017-09-21 16:12:36 -05:00
Brian Ng
5983ae38fc Merge pull request #729 from babel/greenkeeper/flow-bin-0.55.0
Update flow-bin to the latest version 🚀
2017-09-21 10:34:50 -05:00
greenkeeper[bot]
f6d7209f0e chore(package): update lockfile
https://npm.im/greenkeeper-lockfile
2017-09-20 19:59:29 +00:00
greenkeeper[bot]
040e46d4f8 chore(package): update flow-bin to version 0.55.0 2017-09-20 19:51:48 +00:00
Henry Zhu
38504c68e3 7.0.0-beta.24 2017-09-19 14:19:01 -04:00
greenkeeper[bot]
7eaf556094 Update babel-eslint to the latest version 🚀 (#719) [skip ci]
* chore(package): update babel-eslint to version 8.0.0

* chore(package): update lockfile

https://npm.im/greenkeeper-lockfile
2017-09-19 14:12:25 -04:00
Brian Ng
d016deac3d Merge pull request #727 from jridgewell/private-methods
classPrivateMethods enables PrivateName usage
2017-09-18 08:55:44 -05:00
Justin Ridgewell
1f11dc0881 classPrivateMethods enables PrivateName usage
This separates `classPrivateMethods`'s dependency on
`classPrivateProperties`. It also starts a `PrivateName` at the hash
symbol, not the `Identifier`.
2017-09-17 21:24:37 -04:00
greenkeeper[bot]
9b582c913a Update rollup to the latest version 🚀 (#725)
* chore(package): update rollup to version 0.50.0

* chore(package): update lockfile

https://npm.im/greenkeeper-lockfile
2017-09-16 15:47:33 -04:00
Henry Zhu
4df30fc300 7.0.0-beta.23 2017-09-14 20:38:17 -04:00
Sven SAULEAU
3bd142ba8a Merge pull request #716 from babel/rollup
Bump rollup
2017-09-10 09:36:52 +02:00
Brian Ng
b8544de9a8 Bump rollup 2017-09-08 10:00:59 -05:00
Brian Ng
e8c533ba68 Merge pull request #715 from nicolo-ribaudo/makePredicate-comment
Remove outdated code
2017-09-08 09:56:16 -05:00
Nicolò Ribaudo
b97c534b32 Remove outdated imports
They were not needed since c4fb3fe742
because now each files declare a new class
instead of adding method to the existing one.
2017-09-08 15:24:46 +02:00
Nicolò Ribaudo
ef31a148a6 Remove outdated comment
The described code was removed in 5f1c3c3b8d (2 years ago!)
2017-09-08 12:59:22 +02:00
Karl Cheng
65bea96544 Add support for class private methods (#703)
* Add support for class private methods

This commit adds parser support for the TC39 Stage 2 Private Methods
proposal.

This commit also changes "key" in ClassPrivateProperty from an
Identifier to a PrivateName, as well as disallowing #constructor as a
valid private field name.

* Add tests for string literal get/set/async

These should be treated as regular methods and not special get/set/async
behaviour.

* Add tests for class private methods

This also removes a test from the Test262 whitelist that failed before
the changes for private methods support and now passes.

* Modify class private prop tests for PrivateName

* Add class private prop tests for #constructor

* Fix existing ASI test case failure
2017-09-06 18:09:12 -04:00
greenkeeper[bot]
b65b5a2f1c Update flow-bin to the latest version 🚀 (#714)
* chore(package): update flow-bin to version 0.54.1

* chore(package): update lockfile

https://npm.im/greenkeeper-lockfile
2017-09-06 13:56:26 -04:00
Brian Ng
8cc89e6228 Remove duplicate flow travis job, and update whitelist (#711) 2017-09-01 12:41:34 -04:00
Daniel Tschinder
5e018d507b Use correct branch for babel test (#707) 2017-08-31 20:36:57 +02:00
Henry Zhu
c6b2c6bef0 Merge pull request #680 from nicolo-ribaudo/flow-tests
Fix flow test runner
2017-08-31 14:36:47 -04:00
Brian Ng
0beaf4d54e Merge pull request #705 from babel/flow-declare-var-primitive
Add allowPrimitiveOverride option to flowParseTypeAnnotatableIdentifier
2017-08-29 21:19:20 -05:00
Brian Ng
55f38933bf Add allowPrimitiveOverride option to flowParseTypeAnnotatableIdentifier 2017-08-29 14:11:50 -05:00
Henry Zhu
3f1dbecd2e 7.0.0-beta.22 2017-08-28 18:06:39 -04:00
Henry Zhu
cde42329ac Merge pull request #658 from babel/expect
Syntax Error: add message with the plugin that should be enabled
2017-08-28 15:44:26 -06:00
Daniel Tschinder
19c099d116 Use expectPlugin 2017-08-28 17:31:58 -04:00
Daniel Tschinder
96bd271495 Fix tests 2017-08-28 17:31:58 -04:00
Daniel Tschinder
aec1bdb359 Enable no-case-declarations to prevent bugs and remove if (true) 2017-08-28 17:31:58 -04:00
Daniel Tschinder
dfb279f478 Add test for function. 2017-08-28 17:30:10 -04:00
Henry Zhu
de47b0423f rename folders, add more 2017-08-28 17:30:10 -04:00
Henry Zhu
2dbba25d1a change some things to expectPlugin 2017-08-28 17:30:10 -04:00
Moti Zilberman
cf3ebacf4f add expectPlugin which throws an error with the missing plugin 2017-08-28 17:30:09 -04:00
Brian Ng
2f76fc88be Fix regression with generic type and jsx (#702) 2017-08-28 14:51:37 -06:00
Karl Cheng
19bc694e7d Rename PrivateName.name to .id (#698)
Given that it refers to an identifier, it's somewhat confusing to have
to use .name.name to get the actual string. The type declared within
types.js is also incorrect, which this commit fixes.
2017-08-28 13:47:37 -04:00
Henry Zhu
6d24416645 7.0.0-beta.21 2017-08-26 12:05:26 -06:00
James Henry
acf0e65090 Apply location data fix to decorators plugin (#699) 2017-08-26 11:38:11 -04:00
Brian Ng
8f2f250144 Merge pull request #696 from babel/obj-rest-not-last
Throw if rest element is not in last position for object expressions
2017-08-26 09:57:51 -05:00
Brian Ng
2fa1f9929f Throw if rest element is not in last position for object expressions 2017-08-26 09:34:33 -05:00
Brian Ng
083a44658c Enable optionalCatchBinding plugin for test262 tests (#697) 2017-08-26 12:14:56 +02:00
Brian Ng
6ba38a2a78 Merge pull request #693 from babel/trailing-comma-rest-param
Raise error if trailing comma after rest element in async func params
2017-08-25 20:12:59 -05:00
Brian Ng
a659ac6bda Merge pull request #695 from babel/issue691
Fix TypeScript TypeParameterDeclaration location start values
2017-08-25 20:12:47 -05:00
Brian Ng
af2c974473 Fix TypeScript TypeParameterDeclaration location start values 2017-08-25 09:54:16 -05:00
James Henry
87b322cfc2 Add failing test case 2017-08-25 09:49:03 -05:00
Brian Ng
65db277364 Raise error if trailing comma after rest element in async func params 2017-08-24 21:59:01 -05:00
Brian Ng
c441afeaa6 Improve error message for comma after rest element in arrow func 2017-08-24 21:28:19 -05:00
Brian Ng
27aae6c0f9 Merge pull request #686 from babel/invalid-label-declarations 2017-08-24 19:45:17 -05:00
Brian Ng
2bc124bf49 Fix some cases of keywords with escape sequences 2017-08-24 19:27:09 -05:00
Brian Ng
5e60ad6688 Fix some cases of invalid labeled declarations 2017-08-24 19:00:52 -05:00
Mateusz Burzyński
5d83e2692f Adjusted Object Rest/Spread syntax handling to the latest spec (#670) 2017-08-24 18:31:50 -05:00
Mateusz Burzyński
5df1139567 Test262 update (#692) 2017-08-24 17:42:04 -05:00
Brian Ng
be0fe1c6b6 Update rollup config options (#685) 2017-08-22 15:59:05 -04:00
Sangboak Lee
d83064a82e add test for do expressions (#688) 2017-08-22 08:48:56 -05:00
James Henry
d0c7d7a8c7 Fix: Use parseExprAtom() for TS module id string (#684) 2017-08-20 10:38:55 -05:00
greenkeeper[bot]
d685b3999c Update rollup to the latest version 🚀 (#682) 2017-08-20 10:27:15 -05:00
Nicolò Ribaudo
79d6bad5c2 Disallow failures in the flow-test JOB 🎉 2017-08-19 23:13:47 +02:00
Nicolò Ribaudo
748b6fc477 Add option to update the whitelist 2017-08-19 22:18:10 +02:00
Nicolò Ribaudo
656815a53a Add whitelist to flow tests 2017-08-19 22:02:27 +02:00
Nicolò Ribaudo
942d22dd70 Remove the get_harcoded_tests function, use get_tests 2017-08-19 18:25:18 +02:00
Nicolò Ribaudo
1a9b340cb9 Use a Map instead of an Obejct to store tests
This change has two reasons:
- The object was actually used as a map
- Using an object leads some problems with the
  private_class_fields/constructor.js test, since
  `tests[test_name] || {}` returned the Obejct
  constructor instead of an empty object.
2017-08-19 18:24:21 +02:00
Henry Zhu
f87b81a8b1 7.0.0-beta.20 2017-08-19 10:36:28 -04:00
Daniel Tschinder
559e333557 Remove babel-cli as unused (#679) 2017-08-19 07:34:06 -04:00
Daniel Tschinder
9c2b5e6b1f Update dependencies and add babel-core as dependency
it is requried by rollup-plugin-babel
2017-08-19 12:08:46 +02:00
laoxiong
a8021fafc4 chore: add comment for whitespace char code (#676) 2017-08-16 21:51:56 +02:00
greenkeeper[bot]
dfec243fba Update flow-bin to the latest version 🚀 (#675)
* chore(package): update flow-bin to version 0.53.0

* chore(package): update lockfile

https://npm.im/greenkeeper-lockfile
2017-08-16 13:33:41 +02:00
greenkeeper[bot]
3a5690ab1c Update ava to the latest version 🚀 (#672)
* chore(package): update ava to version 0.22.0

* chore(package): update lockfile

https://npm.im/greenkeeper-lockfile
2017-08-15 12:55:56 +02:00
Justin Ridgewell
bab28d68f6 Merge pull request #669 from babel/greenkeeper/rollup-0.47.0
Update rollup to the latest version 🚀
2017-08-13 20:33:09 -04:00
greenkeeper[bot]
e9aeffcb60 chore(package): update lockfile
https://npm.im/greenkeeper-lockfile
2017-08-12 03:23:30 +00:00
greenkeeper[bot]
10a3965772 chore(package): update rollup to version 0.47.0 2017-08-12 03:17:33 +00:00
greenkeeper[bot]
88cf1bc140 Update rollup to the latest version 🚀 (#668)
* chore(package): update rollup to version 0.46.0

* chore(package): update lockfile

https://npm.im/greenkeeper-lockfile
2017-08-11 10:56:38 -05:00
Andy
a39ea5dc9d Fix indentation in typescript.js (#665) [skip ci] 2017-08-08 22:44:20 -04:00
Andy
d565eca976 Don't enable class properties just because "typescript" plugin is enabled (#666) 2017-08-08 20:51:57 -05:00
Andy
00ad6d8310 Fix conflict between "typescript" and "exportExtensions" plugins (#664)
* Fix conflict between "typescript" and "exportExtensions" plugins

* `==` -> `===`
2017-08-08 22:30:08 +02:00
Henry Zhu
41debcd286 rollup-plugin-babel v3.0.1 2017-08-07 17:36:42 -04:00
greenkeeper[bot]
77aa094122 chore(package): update rollup-plugin-babel to version 3.0.1 (#662) 2017-08-07 17:36:03 -04:00
jugglinmike
0466504d7b Integrate Test262 (#654)
* Integrate Test262

Introduce a GNU Make target for retrieving TC-39's Test262 suite and
validating parsing of the files it contains. Interpret each file as a
parser test in accordance with that project's `INTERPRETING.md`
document. Allow for the specification of allowed failures via a
"whitelist" file so that the test suite may help prevent regressions in
this project in situations where this project has known bugs. Initialize
the "whitelist" file with a listing of all tests that are currently
failing. Extend the continuous integration environment's configuration
to automatically run these tests.

* use graceful-fs and latest yarn on travis
2017-08-06 21:20:25 -04:00
Daniel Tschinder
fb6d0491f6 Upgrade dependencies 2017-08-05 00:37:55 +02:00
Nicolò Ribaudo
7353a38846 Arrow fns can't be used as the left side of a binary or ternary expression (#559)
* Arrow fns can't be used as the left side of a binary or ternary expression

Fixes #536

* Add test for logical expression with arrow function

* Fix eslint
2017-08-05 00:27:11 +02:00
Henry Zhu
5c867240f7 7.0.0-beta.19 2017-08-04 12:44:51 -04:00
Henry Zhu
9c91e75cb3 yarn.lock 2017-08-04 12:38:08 -04:00
Henry Zhu
579aabf23e alpha.18 (#660) 2017-08-04 12:34:17 -04:00
Naveen jain
0c11af8fc5 Fix #656 (#659)
* Fix #656

* Fix #656
2017-08-04 11:54:03 +02:00
Nicolò Ribaudo
eee1a3854e Alow regex after "of" in for(...of...) (#579)
Fixes #456
2017-08-03 09:11:31 -05:00
greenkeeper[bot]
880fa582c3 Update flow-bin to the latest version 🚀 (#657)
* chore(package): update flow-bin to version 0.52.0

* chore(package): update lockfile

https://npm.im/greenkeeper-lockfile
2017-08-03 11:02:29 +02:00
Justin Ridgewell
6821cfb064 Merge pull request #648 from Qantas94Heavy/private-field-no-shorthand
Remove private field shorthand
2017-07-27 14:56:19 -04:00
Henry Zhu
0bc9d78927 7.0.0-beta.18 2017-07-25 18:23:45 -04:00
Henry Zhu
a3128619ff update (#649) 2017-07-25 18:22:07 -04:00
Karl Cheng
42d5dbe544 Remove private field shorthand
There seems to be tentative agreement to remove the private field
shorthand given the added confusion and edge cases involved with the
shorthand.

Refs: https://github.com/tc39/proposal-class-fields/issues/21
2017-07-25 11:53:38 +10:00
Daniel Tschinder
59ffa6268e Fix flow test runner (#647)
* Fix flow test runner

* Retry parsing in scriptmode
2017-07-22 11:11:52 +02:00
greenkeeper[bot]
23d325ba75 Update flow-bin to the latest version 🚀 (#646)
* chore(package): update flow-bin to version 0.51.0

* chore(package): update lockfile

https://npm.im/greenkeeper-lockfile
2017-07-22 09:38:18 +02:00
Henry Zhu
92d64f202d 7.0.0-beta.17 2017-07-21 15:56:42 -04:00
jbrown215
e7e7593ca5 Flow opaque type aliases parsing (#643)
* Add support for Flow opaque type aliases

* Add tests for Flow opaque type aliases
2017-07-21 10:48:28 -04:00
MarckK
c88af90c0a Add optionality to catch bindings (#634)
* Add optionality to catch bindings (plus tests)

* Update ast/spec, README, set param to null if no param with plugin optionalCatchBinding

* Fix: wrap param = null in else case

* Fix tests for optional catch binding; add tests which include finally clause
2017-07-21 10:18:57 -04:00
Brian Ng
77bdb9ae3e Reorganize new.target tests (#642) 2017-07-20 16:17:40 -05:00
Henry Zhu
2f50fd00c3 update to babel 7 alpha.15 (#638) 2017-07-19 16:38:45 -04:00
Henry Zhu
135c3bafac drop node 7 [skip ci] 2017-07-19 16:37:09 -04:00
Brian Ng
a46f87f726 Check for function when parsing export async (#639) 2017-07-19 14:03:49 -04:00
greenkeeper[bot]
fa4d4040dc Update flow-bin to the latest version 🚀 (#629)
* chore(package): update flow-bin to version 0.50.0

* chore(package): update lockfile

https://npm.im/greenkeeper-lockfile
2017-07-17 11:45:00 +02:00
Joseph Frazier
f9b8fa1ddf Add comments property to babylon.parseExpression() result 2017-07-14 09:22:23 -05:00
Brian Ng
688a1e523e Fix parsing a <!-- b in modules (#626) 2017-07-14 09:16:31 -05:00
Brian Ng
63143ea5e9 Fix incorrect parsing of %* (#624) 2017-07-13 15:04:05 -05:00
greenkeeper[bot]
f2b8d1f179 Update ava to the latest version 🚀 (#625) 2017-07-13 11:12:34 -05:00
Nicolò Ribaudo
b0c3a9dcdd Add support for flow's export type * from (#617) 2017-07-11 22:56:04 -05:00
greenkeeper[bot]
ff513df283 Update rollup to the latest version 🚀 (#618)
* chore(package): update rollup to version 0.45.1

* chore(package): update lockfile

https://npm.im/greenkeeper-lockfile
2017-07-11 05:43:07 +02:00
greenkeeper[bot]
39ae6f6d28 Update rollup to the latest version 🚀 (#615) 2017-07-09 23:52:20 -05:00
Justin Ridgewell
68fb475661 Merge pull request #604 from babel/greenkeeper/chalk-2.0.0
Update chalk to the latest version 🚀
2017-07-09 20:16:25 -04:00
Justin Ridgewell
880b9a38a3 Merge pull request #614 from babel/greenkeeper/rollup-0.43.1
Update rollup to the latest version 🚀
2017-07-09 20:12:44 -04:00
greenkeeper[bot]
c020a0b2b4 chore(package): update lockfile
https://npm.im/greenkeeper-lockfile
2017-07-09 23:26:21 +00:00
greenkeeper[bot]
a48f5a6780 chore(package): update rollup to version 0.43.1 2017-07-09 23:20:37 +00:00
Justin Ridgewell
cc643668c8 Merge pull request #613 from jridgewell/function-sent-statement
Fix function.sent parsing
2017-07-09 08:56:06 -04:00
Justin Ridgewell
aa1bad90d1 Test function.sent statement without declarations 2017-07-08 02:08:46 -04:00
Justin Ridgewell
62d313e753 Fix function.sent parsing 2017-07-07 23:14:20 -04:00
Justin Ridgewell
f09eb3200f Merge pull request #609 from jridgewell/static-private
Add static private class field support
2017-07-03 19:55:34 -04:00
Justin Ridgewell
9c9f9e2adb Add static private class field support 2017-07-02 01:44:12 -04:00
Nicolò Ribaudo
5e1e94917c Add link to decorators proposal (#606) [skip ci] 2017-07-01 06:21:52 -04:00
greenkeeper[bot]
4d851fa44d chore(package): update lockfile
https://npm.im/greenkeeper-lockfile
2017-06-30 00:10:05 +00:00
greenkeeper[bot]
2f1b7d543d chore(package): update chalk to version 2.0.0 2017-06-29 23:59:29 +00:00
Daniel Tschinder
5f5c6fcc4e Remove deprecated option in flowconfig 2017-06-29 10:38:44 -07:00
greenkeeper[bot]
62b527851f Update ava to the latest version 🚀 (#599)
* chore(package): update ava to version 0.20.0

* Update yarn.lock
2017-06-29 10:20:20 -07:00
greenkeeper[bot]
30dfccf84c Update flow-bin to the latest version 🚀 (#601)
* chore(package): update flow-bin to version 0.49.1

* Update yarn.lock
2017-06-29 10:20:09 -07:00
Daniel Tschinder
ae5e6b954c Add greenkeeper-lockfile support (#602) 2017-06-29 10:19:57 -07:00
Brian Ng
7576397b25 Force color output in test runs to ensure consistent behavior in Travis (#603) 2017-06-29 10:19:29 -07:00
Henry Zhu
6474dd5b88 basic publish steps [skip ci] 2017-06-28 12:50:31 -04:00
Henry Zhu
364a9fe72d 7.0.0-beta.16 2017-06-28 12:48:05 -04:00
Brian Ng
5180ecdca4 Use prettier (#600) 2017-06-28 12:41:42 -04:00
Henry Zhu
a95f55c468 add ts to readme [skip ci] 2017-06-28 10:59:02 -04:00
Andy
97c23461f9 TypeScript parser plugin (#523) 2017-06-28 10:57:50 -04:00
Henry Zhu
f7547fd35a Use the string "module" in err message (#598) 2017-06-28 10:46:30 -04:00
Nicolò Ribaudo
03b3b39b17 Allow jsx to be the body of a typed arrow function (#595)
Fixes #593
2017-06-28 10:17:51 -04:00
Sebastian McKenzie
759266a2e8 Remove future plans from README (#597) [skip ci] 2017-06-28 08:44:47 -04:00
Henry Zhu
7795615dac fix example [skip ci] 2017-06-28 06:49:55 -04:00
Henry Zhu
107aea75f1 add a code example [skip ci] (#594) 2017-06-27 23:53:23 -04:00
William Horton
baa5f4dca7 Stage 2: BigInt (#588)
* Stage 2: BigInt

* Change plugin name to bigInt (camelcase).

* Update based on PR review, add test cases.

* Use hex for charCodes.
2017-06-27 23:35:57 -04:00
Daniel Tschinder
fecdb6feeb Make tokens optional (#563)
Adding tokens to the ast is significant slower and most tools
don't ever use them anyway
2017-06-27 23:26:24 -04:00
Henry Zhu
3d03414c05 update readme with decorators2 [skip ci] 2017-06-27 16:06:33 -04:00
Henry Zhu
a0f054b5ce 7.0.0-beta.15 2017-06-27 16:03:30 -04:00
Henry Zhu
88298536c5 Revert "Distinguish between ternary's : and arrow fn's return type (#573)"
This reverts commit a9a55fbd3f.
2017-06-27 15:58:57 -04:00
Nicolò Ribaudo
a9a55fbd3f Distinguish between ternary's : and arrow fn's return type (#573)
* Distinguish between ternary's : and arrow fn's return type

* Correctly parse nested arrow functions inside conditional expressions

Defer the conversion of arrow function parameters to assignable nodes so that
it is possible to use the (invalid) ast to get the exact position of the (wrong)
arrow functions.

* Check params of arrow fns w/ type params or w/o return type

* Fix also async functions

* Add test from prettier

https://github.com/prettier/prettier/issues/2194

* Don't check arrow params if they are valid at the first attemp

* Use state instead of relying on the "noArrowParamsConversion" parameter

* Remove noArrowParamsConversion
2017-06-27 15:44:56 -04:00
Henry Zhu
39447b1cca Merge pull request #590 from peey/decorators-followup
Follow-up on Decorators PR
2017-06-27 15:34:44 -04:00
Peeyush Kushwaha
f2ad94d0e3 Incorporate suggestions from review 2017-06-27 22:46:43 +05:30
Henry Zhu
994cde616d Merge pull request #589 from Qantas94Heavy/fix-private-fields
Add delete check and fix nested class parsing for private fields
2017-06-27 11:33:19 -04:00
Justin Ridgewell
1c7151e8ba Merge pull request #592 from nicolo-ribaudo/dead-code
Remove dead code
2017-06-25 19:07:36 -04:00
Nicolò Ribaudo
d93860393c Remove dead code 2017-06-26 00:48:18 +02:00
Peeyush Kushwaha
c3b992e031 Minor change in an error message 2017-06-23 22:04:35 +05:30
Peeyush Kushwaha
2c8fc75643 Add test case for decorated static method 2017-06-23 18:13:51 +05:30
Peeyush Kushwaha
37fa77e84f Support decorator in decorator
Fixes #524
2017-06-23 18:10:16 +05:30
Karl Cheng
44d842c30b Add private fields numeric name test 2017-06-23 18:34:59 +10:00
Karl Cheng
b4e06aa279 Fix parsing of nested classes with private fields
The parsing of private fields checks whether or not it is within a
class to determine if it is valid or not. However, the state.inClass
property is incorrect as it marks it as outside a class when the inner
class is closed.

This commit fixes this problem by replacing the state.inClass property
with a class nesting counter.
2017-06-23 18:34:59 +10:00
Karl Cheng
43dba7e7c1 Throw on attempt to delete a private field
Given that private fields can only be used within classes, any code
using them must be in a strict mode context. As private fields cannot
be deleted, throw an early SyntaxError.
2017-06-23 18:34:59 +10:00
Peeyush Kushwaha
add8e4ad13 Helpful error message for @dec export class 2017-06-23 02:19:08 +05:30
Henry Zhu
f976bdd21c Merge pull request #587 from peey/decorators-stage-2
Decorators Stage 2 Parsing
2017-06-22 10:20:08 -04:00
Peeyush Kushwaha
d99618cdfe renames files 2017-06-22 02:01:28 +05:30
Peeyush Kushwaha
e5fdb3448d rename decoratorsStage2 -> decorators2 2017-06-22 02:00:36 +05:30
Peeyush Kushwaha
e1972baff5 Decorated classes/methods start where the decorator starts 2017-06-22 01:45:53 +05:30
Peeyush Kushwaha
04b40868f9 Add more tests; fix plugin conflict code 2017-06-19 23:45:57 +05:30
Henry Zhu
a59103f15d link to the handbook [skip ci] 2017-06-19 12:42:53 -04:00
Henry Zhu
8febb09404 update babel alpha 12, fixes build issues (#583) 2017-06-18 19:01:02 -04:00
Daniel Tschinder
cb09891fff 7.0.0-beta.14 2017-06-18 23:06:56 +02:00
aardito2
ac936e315a Fix comment attachment for call expressions (#575) 2017-06-18 22:57:42 +02:00
Peeyush Kushwaha
b60ac52ae6 Reorganize tests and add tests
Add tests for static properties and private properties
2017-06-18 02:00:13 +05:30
Peeyush Kushwaha
4f8ac6bada Merge branch 'master' into decorators-stage-2 2017-06-18 01:33:16 +05:30
Peeyush Kushwaha
b7c1c559c7 Add test case for object properties 2017-06-18 01:30:46 +05:30
Peeyush Kushwaha
38c417e971 Reorganize tests; camelCase plugin name 2017-06-18 01:25:54 +05:30
Daniel Tschinder
e1e2c32bf3 Correctly put typeParameters on FunctionExpression (#585) 2017-06-17 15:43:31 -04:00
Daniel Tschinder
e982c0652c Fix v8 deopts (#581) 2017-06-17 11:41:23 -04:00
Peeyush Kushwaha
b5e23835ce Disallow exports between decorator & class body
For stage 2 decorators
2017-06-17 18:12:14 +05:30
Peeyush Kushwaha
9c639743dd Disallow in object literals, params, class props
And add tests to reflect the same
2017-06-17 17:49:33 +05:30
Peeyush Kushwaha
162bc905a6 Throw if both decorators decorators-stage-2 used 2017-06-17 13:38:04 +05:30
Peeyush Kushwaha
001044ffa7 Add tests for stage 2 decorators from PR#353 2017-06-17 13:33:42 +05:30
Peeyush Kushwaha
a24dc6e630 Let decorator stage 2 parsing be under a new plugin name
Parse stage 0 decorators when "decorators" plugin is active and
parse stage 2 decorators when "decorators-stage-2" plugin is active
2017-06-17 13:25:21 +05:30
Kevin Gibbons
06afa0761b Update decorator parsing to match current spec
Refer to PR #353
2017-06-17 13:23:30 +05:30
Daniel Tschinder
e11794c735 Add back shorthand field to Property (#580)
Also add some better types for estree
2017-06-17 01:05:32 +02:00
Nicolò Ribaudo
6b4fba4deb The { after a function generic type annotation is a statement (#578)
This would have previously been interpreted as an expression,
because usually after ">" there can't be a statement.

Fixes #36
2017-06-15 09:39:39 -05:00
Andy
50ae16de38 Factor parseSubscript out of parseSubscripts (#576) 2017-06-14 00:26:12 +02:00
Henry Zhu
dc87d99713 7.0.0-beta.13 2017-06-06 11:50:17 -04:00
Henry Zhu
2b7fab87d0 fix flow 2017-06-06 11:49:24 -04:00
Daniel Tschinder
69cba43f82 Fix parsing of private fields (#566)
The computed key is not part of the spec.
key for ClassProperties is an Expression
Do not parse computed and literal keys for PrivateClassProperties
2017-06-06 11:42:07 -04:00
Henry Zhu
37793d5be7 add links [skip ci] 2017-06-06 11:28:08 -04:00
greenkeeper[bot]
e5e4981e79 Update rollup-watch to the latest version 🚀 (#568)
* chore(package): update rollup-watch to version 4.0.0

* Update yarn.lock
2017-06-06 11:38:53 +02:00
Sven SAULEAU
e064bb9135 Merge pull request #545 from xtuc/feat-optional-chaining
Optional Chaining: Stage 1 plugin
2017-06-05 23:13:16 +02:00
Henry Zhu
4c8f4a23db add another test 2017-06-05 16:51:45 -04:00
Daniel Tschinder
775dcfa6d6 Improve performance by removing all spread/rest usages (#561) 2017-06-05 19:21:41 +02:00
Michal Srb
bbc3cd45cf Fix location info on FunctionTypeParam nodes (#565) 2017-06-05 12:41:46 -04:00
Daniel Tschinder
e579109f0b Use preset-env and update other dependencies (#562) 2017-06-04 00:01:36 +02:00
Daniel Tschinder
0656717552 Fix stmt value being the raw value (#557) 2017-06-03 16:16:45 +02:00
Sven SAULEAU
4628bb957d Merge pull request #1 from jridgewell/pr/545
Finish optionalChaining plugin
2017-06-03 16:07:38 +02:00
Justin Ridgewell
e1ec23cd3e Finish optionalChaining plugin 2017-06-03 01:20:40 -04:00
Boopathi Rajaa
edf34dc780 [skip ci] Add classPrivateProperties to README & fix classProperties proposal link (#554) 2017-06-01 21:31:25 -04:00
Daniel Tschinder
c3e256fdb5 Add node 8 to travis (#552) 2017-06-01 11:50:25 +02:00
Henry Zhu
2dd624b44e Merge branch 'master' into feat-optional-chaining 2017-05-31 14:33:47 -04:00
Henry Zhu
324e2f0253 7.0.0-beta.12 2017-05-30 19:30:08 -04:00
Jan Olaf Krems
d4e842d4eb Add plugin for import.meta proposal (#544)
* Add plugin for import.meta proposal

Fixes https://github.com/babel/babylon/issues/539

* Tests for assignment/mutation of import.meta

* Use correct identifier in failure message

* Simpler & more consistent script errors for import.meta
2017-05-30 19:28:51 -04:00
Rick Waldron
2f5d146d54 Don't treat e, b, E, B as forbidden siblings for hex literals. (#549) 2017-05-30 18:14:31 -05:00
Rick Waldron
3ca75dc9ec Adds test to ensure that numericSeparator plugin does not alter "_" handling in Identifier (#548) 2017-05-30 14:31:13 -05:00
Sven SAULEAU
c1702e1da6 fix: minor change 2017-05-30 20:16:13 +02:00
Sven SAULEAU
b0386005c8 docs: NewExpression spec 2017-05-30 20:14:19 +02:00
Sven SAULEAU
9bcd85acf3 feat: CallExpression support 2017-05-30 20:12:43 +02:00
Sven SAULEAU
26096d6a3d style: [skip ci] updated comment 2017-05-30 18:38:50 +02:00
Sven SAULEAU
51bd87baa8 feat: use syntax plugin 2017-05-30 18:35:29 +02:00
Sven SAULEAU
03d89b6307 docs: fix typo in spec [skip ci] 2017-05-29 18:46:52 +02:00
Sven SAULEAU
d3bc8fcbdf Merge branch 'master' into feat-optional-chaining 2017-05-29 18:43:40 +02:00
Henry Zhu
f326ef6424 7.0.0-beta.11 2017-05-27 00:19:22 -04:00
Andy
50694f99b1 Extract 'parseClassMember' method (#533) 2017-05-26 23:44:56 -04:00
Brian Ng
aad95c63ec Fix some flow unused warnings (#543) 2017-05-26 23:44:36 -04:00
Henry Zhu
81ce415359 add proposal links [skip ci] 2017-05-26 16:44:25 -04:00
Rick Waldron
b344f62056 NumberLiteralSeparator: Stage 1 feature plugin. Closes gh-538 (#541)
* NumberLiteralSeparator: Stage 1 feature plugin

Signed-off-by: Rick Waldron <waldron.rick@gmail.com>

* fix-up per review

Signed-off-by: Rick Waldron <waldron.rick@gmail.com>

* nit: forbiddenNumericLiteralSeparatorSibling -> forbiddenNumericLiteralSeparatorSiblings

Signed-off-by: Rick Waldron <waldron.rick@gmail.com>

* fix-up to change includes -> indexOf

Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
2017-05-26 16:37:05 -04:00
Henry Zhu
589ceb4ee7 add extra note [skip ci] 2017-05-26 16:27:16 -04:00
Henry Zhu
ed1809c2d1 link to contributing [skip ci] 2017-05-26 16:25:45 -04:00
Henry Zhu
702d413b83 add contributing docs on making a plugin [skip ci] (#542)
* add contributing docs on making a plugin [skip ci]

* fixes [skip ci]
2017-05-26 16:24:10 -04:00
greenkeeper[bot]
dd83ad6d60 Update flow-bin to the latest version 🚀 (#537)
* chore(package): update flow-bin to version 0.47.0

* Update yarn.lock
2017-05-26 15:48:56 -04:00
Henry Zhu
6eeb0317b9 pin to alpha.9 2017-05-26 12:27:28 -04:00
Henry Zhu
9709c8d932 7.0.0-beta.10 2017-05-22 17:02:42 -04:00
aardito2
557696da3a Fixed disappearing comments following a trailing comma on the last property of an object literal or the last argument of a call expression (#478) 2017-05-22 17:02:02 -04:00
Henry Zhu
0f66dbd4b6 add changelog label data [skip ci] 2017-05-22 17:01:48 -04:00
Henry Zhu
1a92c1f34c 7.0.0-beta.9 2017-05-22 14:57:21 -04:00
Andy
2541ab5fda Simplify PrivateName and ClassPrivateProperty types (#532)
* Simplify PrivateName and ClassPrivateProperty types

* ClassPrivateProperty is not a ClassMemberBase; can't be static, can't be computed
2017-05-22 13:42:32 -04:00
Diego Ferreiro Val
01da62283c Modify grammar to support Private Fields proposal: (#260)
* Modify grammar to support Private Fields proposal:
- Adding optional plugin `classPrivateProperties`
- Adding PrivateName type identifier
- Adding ClassPrivateProperty to ClassBody
- Allow PrivateName in MemberExpression
- Allow PrivateName as a reference
- Adding tests

* Remove unnecesary liberal parameter

* Guarding for plugin dependecy for future versioning

* update spec.md [skip ci]

* move comment [skip ci]

* remove unused param [skip ci]

* Refactor PrivateName to contain Identifier in name property
2017-05-22 11:33:48 -04:00
Kevin Gibbons
6c4acecf00 Fix #437: only prohibit 'export type from "module" ' when flow is enabled (#438)
* Only prohibit 'export type' when flow is enabled

* Fix lint
2017-05-19 10:05:44 +02:00
Brian Ng
dcef4012a0 Disallow SpreadElement inside dynamic import (#529)
* Disallow SpreadElement inside dynamic import

* tweak error message
2017-05-17 12:07:09 -04:00
James Browning
23ff45fcfa Spec fix as BindExpression only have a single object/callee not an Array (#436) [skip ci]
* Fixed spec.md to reflect that BindExpressions only have a single node not an array for their properties

* Added semicolons to BindExpression props
2017-05-17 10:25:10 -04:00
Max Schaefer
b08fdf87e8 Fix handling of anonymous parameters in flowParseObjectTypeMethodish. (#526)
By analogy with `flowParseFunctionTypeParams` (cf. commit 407c97c9c2).
2017-05-16 22:53:13 +02:00
greenkeeper[bot]
4ef964e066 Update cross-env to the latest version 🚀 (#520)
* chore(package): update cross-env to version 5.0.0

* Update yarn.lock
2017-05-14 20:03:20 +02:00
Andy
aa78011666 Fix type check errors (#521) 2017-05-14 19:59:56 +02:00
Andy
d95b5fb83d Remove unused parameters from parseParenAndDistinguishExpression (#522) 2017-05-14 19:59:03 +02:00
Andy
a738870472 Type-check ExpressionParser (#488)
* Type-check ExpressionParser

* Improve test coverage
2017-05-11 16:30:21 +02:00
Andy
7a8b64c0d3 Type-check StatementParser (#489) 2017-05-11 16:28:12 +02:00
Daniel Tschinder
f6020aecbf Convert argument of SpreadElement correctly to assignable (#518) 2017-05-11 00:45:08 +02:00
Daniel Tschinder
d605a9a4de Fix flow errors (#517) 2017-05-11 00:04:43 +02:00
Andy
1773ca7457 Type-check State (#492) 2017-05-10 21:55:09 +02:00
greenkeeper[bot]
8862c96237 Update flow-bin to the latest version 🚀 (#497)
* chore(package): update flow-bin to version 0.45.0

https://greenkeeper.io/

* Update yarn.lock
2017-05-10 21:50:30 +02:00
Andy
1f113fd650 Fix FunctionDeclaration spec: Id may be null (#503)
* Fix FunctionDeclaration spec: Id may be null

* Use OptFunctionDeclaration and OptFunctionExpression
2017-05-10 21:29:05 +02:00
Alex Rattray
4e776bf00b Better error message for anonymous class declarations (#509) 2017-05-10 21:26:38 +02:00
Daniel Tschinder
7f9eb50b2c Fix changelog 2017-05-10 18:40:12 +02:00
Daniel Tschinder
2b77908ac9 Merge branch '6.x'
# Conflicts:
#	CHANGELOG.md
#	package.json
#	src/parser/expression.js
#	src/parser/statement.js
#	src/plugins/flow.js
#	test/fixtures/flow/type-annotations/135/expected.json
#	test/fixtures/flow/type-annotations/136/expected.json
#	test/fixtures/flow/type-annotations/139/options.json
#	test/fixtures/flow/type-generics/1/expected.json
#	test/fixtures/flow/type-generics/2/expected.json
2017-05-10 18:39:32 +02:00
Daniel Tschinder
28985e7acc 6.17.1 2017-05-10 18:25:58 +02:00
Daniel Tschinder
934a3a78b6 Update changelog 2017-05-10 18:25:13 +02:00
Daniel Tschinder
9a1ef48ae3 Merge pull request #516 from babel/backport2
Backport #433 #473 + typo
2017-05-10 18:22:06 +02:00
Brian Ng
1077a7304e Fix typo in flow spread operator error [skip ci] 2017-05-10 18:20:06 +02:00
Alex Kuzmenko
b98f463aa7 Fixed invalid number literal parsing (#473)
* Fixed invalid number literal parsing

* Don't ignore period or E characters after octal numbers
cherry-pick fix from acorn

* Fix tests
2017-05-10 18:14:09 +02:00
Alex Kuzmenko
406c3dabc0 Fix number parser (#433)
Fixed number parser #2

Added one more test
2017-05-10 18:13:46 +02:00
Daniel Tschinder
8c885eaef6 Merge pull request #515 from babel/backport1
Backport #499, #510, #475, #479
2017-05-10 18:03:58 +02:00
Brian Ng
7c56c24bb0 Ensure non pattern shorthand props are checked for reserved words (#479) 2017-05-10 16:59:09 +02:00
Brian Ng
67db275c94 Remove jsx context when parsing arrow functions (#475) 2017-05-10 16:56:21 +02:00
Brian Ng
4a29ccdd1a Allow super in class properties (#499) 2017-05-10 16:46:45 +02:00
Brian Ng
63412e54f4 Allow flow class field to be named constructor (#510) 2017-05-10 16:46:38 +02:00
Brian Ng
9d1f819320 Allow flow class field to be named constructor (#510) 2017-05-10 16:18:08 +02:00
Sven SAULEAU
0e12f565da Document babylon plugin system (#507) [skip ci]
* docs: document babylon plugin system

* [skip ci]

* [skip ci]

* [skip ci] it's -> its

* [skip ci]
2017-05-03 10:56:22 -04:00
Brian Ng
d33c82781a Allow super in class properties (#499) 2017-05-02 14:41:10 -04:00
Andy
9660f06b25 Don't add 'shorthand' property to ObjectMethod (#506) 2017-05-02 14:39:21 -04:00
Andy
3a6b77f374 Don't add 'await' property to ForInStatement (#504) 2017-05-02 14:37:58 -04:00
Andy
e81b5f8af2 Type-check flow plugin (#495)
* Type-check flow plugin

* Fix typo
2017-04-27 12:04:06 -04:00
Henry Zhu
5ae165d489 update changelog [skip ci] 2017-04-27 11:16:48 -04:00
Andy
cccee00606 Type-check JSX plugin (#496)
* Type-check JSX plugin

* Improve test coverage
2017-04-27 10:58:33 -04:00
Andy
8288f7d9e4 Type-check tokenizer/types.js (#493) 2017-04-27 10:53:17 -04:00
Andy
cd5bfb786a Type-check estree plugin (#494) 2017-04-27 10:40:51 -04:00
Andy
d8ff63181e Type-check LValParser (#487) 2017-04-27 10:37:08 -04:00
Andy
e1a06544bc Type-check utils (#491)
* Type-check utils

* Improve test coverage
2017-04-27 10:23:13 -04:00
Andy
47cade874c Type-check options.js and index.js (#490) 2017-04-26 17:18:17 -04:00
Andy
7627c5a2be Type-check UtilParser (#485) 2017-04-25 18:01:55 -04:00
Andy
3199ceecdb Type-check node.js (#486) 2017-04-25 17:54:47 -04:00
Andy
34acecca2e Type-check CommentsParser and LocationParser (#484) 2017-04-25 16:07:01 -04:00
Brian Ng
68967bf515 Remove jsx context when parsing arrow functions (#475) 2017-04-24 00:45:19 +02:00
Andy
c4fb3fe742 Convert each file with parser methods to a class in an inheritance chain (#481) 2017-04-24 00:40:49 +02:00
Andy
2c1193b7da Move plugin helpers out of Parser.prototype and into the plugin itself (#482) 2017-04-24 00:34:35 +02:00
Andy
8601f2f7da Add type declarations for AST nodes (#480) 2017-04-21 19:48:09 +02:00
Brian Ng
bc0719a145 Ensure non pattern shorthand props are checked for reserved words (#479) 2017-04-21 16:25:34 +02:00
Andy
d975b91a54 Refresh property ordering in baselines (#454) 2017-04-21 15:59:46 +02:00
Alex Kuzmenko
00d6db9fbb Fixed invalid number literal parsing (#473)
* Fixed invalid number literal parsing

* Don't ignore period or E characters after octal numbers
cherry-pick fix from acorn

* Fix tests
2017-04-21 15:22:50 +02:00
Daniel Tschinder
d1a5220b89 Add support for declare export + fixes (#224)
* Add support for declare export

* Do not allow declare module inside declare module

* Reallow module exports outside module

* Add handling of `declare export default`

Add check for multiple module.export declarations

* Disallow export let/const/type

Refactor parsing object properties to share more code and add support
for getters and setters

* Rename tests

* Update test fixtures

* Optimize for performance

* disallow declare export interface outside of module

* Refactor code to be more readable and less lookahead

* Add comments

* Add test for export star as

* Test for number literal getter/setter

* Add more tests

* Fix tests

* Allow union types and correctly eat semi after type

* Use non computed keys

* Fix tests
2017-04-21 14:41:59 +02:00
greenkeeper[bot]
28ccd05bab Update flow-bin to the latest version 🚀 (#468)
* chore(package): update flow-bin to version 0.44.0

https://greenkeeper.io/

* Update yarn.lock
2017-04-21 14:26:30 +02:00
Andy
5e156310ca Type-check tokenizer/index.js (#460)
* Type-check tokenizer/index.js

* Update test baselines
2017-04-21 14:25:31 +02:00
Andy
ad284d5c36 Convert each plugin to a function from a class to an overriding class (#459)
* Convert each plugin to a function from a class to an overriding class

* Handle undefined options

* Fix indentation

* Fix double space
2017-04-21 13:53:51 +02:00
Sebastian McKenzie
a2c143299a Add changelog 2017-04-20 16:43:47 +01:00
Sebastian McKenzie
2e17e5bc39 6.17.0 2017-04-20 16:41:23 +01:00
Sebastian McKenzie
a4ca1cc645 Cherry-pick #418 to 6.x (#476)
* Add support for flow type spread (#418)

* Add support for flow type spread

* Broaden spreadable types from primary to all, more tests

* Eliminate variance sigil for type spreads, better errors, fix tests

# Conflicts:
#	src/plugins/flow.js

* Fix tests
2017-04-20 16:40:55 +01:00
Brian Ng
2ef436641e Ensure locations in ObjectTypeAnnotations do not include semi or comma (#472) 2017-04-19 14:08:51 +02:00
Brian Ng
17f2a2036c Allow namespace exotic to be exported as default (#474) 2017-04-19 13:59:49 +02:00
Sven SAULEAU
bc9edd139f fix: move tests in experimental 2017-04-17 13:33:48 +02:00
Sven SAULEAU
b2fdd944fe feat: add tests 2017-04-17 13:33:00 +02:00
Sven SAULEAU
0927e24ac6 Merge remote-tracking branch 'kristofdegrave/nullPropagation' into feat-optional-chaining 2017-04-17 13:21:35 +02:00
Sven SAULEAU
7b51979152 feat: add optional MemberExpression 2017-04-15 18:19:43 +02:00
Andy
482b8155a3 Update test baselines (#461) 2017-04-10 11:24:34 -05:00
Brian Ng
637119a017 Fix typo in flow spread operator error [skip ci] 2017-04-10 10:48:51 -05:00
greenkeeper[bot]
344f070445 Update ava to the latest version 🚀 (#450)
* chore(package): update ava to version 0.19.0

https://greenkeeper.io/

* Fix tests for latest ava
2017-04-07 15:52:19 +02:00
greenkeeper[bot]
aef9e4fb5c Update flow-bin to the latest version 🚀 (#448)
* chore(package): update flow-bin to version 0.43.0

https://greenkeeper.io/

* Update yarn.lock
2017-04-07 15:02:11 +02:00
Andy
4bf18ccbea Simplify cd commands (#452) [skip ci] 2017-04-06 13:48:20 -04:00
Logan Smyth
1c07efb5fc Use a .babelignore to skip compiling lib and fixtures. (#451) 2017-04-05 15:16:51 -04:00
Daniel Tschinder
ed452b6f78 Update CONTRIBUTING.md 2017-04-04 23:16:59 +02:00
Daniel Tschinder
4147c01ac0 7.0.0-beta.8 2017-04-04 22:08:28 +02:00
Daniel Tschinder
c8ac8abad7 Update yarn.lock 2017-04-04 22:07:44 +02:00
Brian Ng
bdfa92464b Fix predicate attachment to match flow parser (#428) 2017-04-04 15:48:50 +02:00
Alex Rattray
cbf4203237 Add extra.raw back to JSXText and JSXAttribute (#344) 2017-04-04 15:47:59 +02:00
Brian Ng
14b7f50e51 Fix rest parameters with array and objects (#424)
* Fix rest parameters with array and objects

* Add test for array rest  with object

* reuse parseBindingIdentifier
2017-04-03 22:27:43 +02:00
Alex Kuzmenko
22741a8068 Fix number parser (#433)
Fixed number parser #2

Added one more test
2017-04-03 22:25:29 +02:00
greenkeeper[bot]
9222562b82 Update cross-env to the latest version 🚀 (#443)
* chore(package): update cross-env to version 4.0.0

https://greenkeeper.io/

* Update yarn.lock
2017-04-03 22:23:44 +02:00
greenkeeper[bot]
786d73b2ce Update rollup-plugin-node-resolve to the latest version 🚀 (#445)
* chore(package): update rollup-plugin-node-resolve to version 3.0.0

https://greenkeeper.io/

* Update yarn.lock
2017-04-03 22:23:02 +02:00
Conrad Buck
213fdab063 Add support for flow type spread (#418)
* Add support for flow type spread

* Broaden spreadable types from primary to all, more tests

* Eliminate variance sigil for type spreads, better errors, fix tests
2017-04-03 22:05:05 +02:00
Brian Ng
4d18221098 Use babel-register script when running babel smoke tests (#442) 2017-03-30 11:25:23 -04:00
Alex Kuzmenko
2f3123ca03 Fix CONTRIBUTING.md [skip ci] (#432) 2017-03-24 10:57:36 +01:00
Brian Ng
a495d7f65d Allow statics in flow interfaces (#427) 2017-03-23 22:10:07 +01:00
Henry Zhu
e4e1cb0bda 7.0.0-beta.7 2017-03-22 14:07:10 -04:00
Henry Zhu
9f7d9080cf remove babylon plugin for template revision since it's stage-4 (#426) 2017-03-22 14:05:56 -04:00
Daniel Tschinder
32eabf620b Fix push-pop logic in flow (#405) 2017-03-22 10:25:10 +01:00
Henry Zhu
af5fdc2ebd 7.0.0-beta.6 2017-03-22 00:08:04 -04:00
Henry Zhu
ad1eb149fe update lock [skip ci] 2017-03-22 00:07:32 -04:00
Arshabh Kumar Agarwal
964105e3fb Improves error message when super is called outside of constructor (#408) 2017-03-21 17:44:21 -04:00
Henry Zhu
0f982799b6 Merge branch '7.0' 2017-03-21 17:05:48 -04:00
Kevin Gibbons
2e467ef3bc Add support for invalid escapes in tagged templates (#274)
Per the stage-3 TC39 proposal:
https://github.com/tc39/proposal-template-literal-revision
2017-03-21 16:55:54 -04:00
Kevin Gibbons
fab343e379 Add support for invalid escapes in tagged templates (#274)
Per the stage-3 TC39 proposal:
https://github.com/tc39/proposal-template-literal-revision
2017-03-21 16:50:34 -04:00
James Browning
5f048b4f5d [7.0] Moved value field in spec from ObjectMember to ObjectProperty as ObjectMethod's don't have it (#415) [skip ci] 2017-03-21 16:44:54 -04:00
Henry Zhu
6a94d0eb9c 7.0.0-beta.5 2017-03-21 15:56:16 -04:00
Daniel Tschinder
0811438c82 Update flow (#422) 2017-03-19 22:07:16 +01:00
Andy
0545173f66 Test runner: Detect extra property in 'actual' but not in 'expected'. (#407)
* Test runner: Detect extra property in 'actual' but not in 'expected'.

Also update all expected.json where this would result in errors.

* Include rmExpected.js script in case it is needed again
2017-03-19 22:03:11 +01:00
Daniel Tschinder
82b7872cb8 Optimize travis builds (#419)
* Optimize travis builds

* Use yarn

* Fix babel tests to correctly fail

* Check against 7.0 branch of babel
2017-03-19 21:58:20 +01:00
Daniel Tschinder
9690daabd4 Update codecov to 2.0 (#412) 2017-03-15 23:40:58 +01:00
Andy
873bf284ba Fix spec for ClassMethod: It doesn't have a function, it *is* a function. (#406) [skip ci] 2017-03-13 20:52:12 -04:00
James Browning
a5386433e1 Changed Non-existent RestPattern to RestElement which is what is actually parsed (#409) [skip ci] 2017-03-13 17:27:16 -04:00
Daniel Tschinder
4a813dc51a Revert "Disable failing tests (fixed in 7.0)"
This reverts commit 4c88cfe765.
2017-03-10 13:51:24 +01:00
Daniel Tschinder
90f2b12569 Merge branch 'master' into 7.0
* master:
  Disable failing tests (fixed in 7.0)
2017-03-10 13:51:05 +01:00
Daniel Tschinder
4c88cfe765 Disable failing tests (fixed in 7.0) 2017-03-10 13:50:53 +01:00
Daniel Tschinder
68e8550e84 Merge branch 'master' into 7.0
* master:
  Upgrade flow to 0.41
  Throw error if new.target is used outside of a function (#402)
  Fix watch command (#403)
  Update yarn lock
  Fix parsing of class properties (#351)

# Conflicts:
#	src/parser/statement.js
#	test/fixtures/experimental/class-constructor-call/illegal-key/options.json
2017-03-10 13:47:45 +01:00
Daniel Tschinder
c0a89f4c15 Upgrade flow to 0.41 2017-03-10 13:41:08 +01:00
Brian Ng
ca652bd934 Throw error if new.target is used outside of a function (#402) 2017-03-10 13:38:45 +01:00
Brian Ng
35e7732156 Fix watch command (#403) 2017-03-10 13:37:54 +01:00
Daniel Tschinder
902f93d937 Update yarn lock 2017-03-10 13:35:49 +01:00
Brian Ng
250cd65479 Fix watch command (#403) 2017-03-10 12:45:45 +01:00
Kevin Gibbons
81056eeee7 Fix parsing of class properties (#351) 2017-03-10 12:43:45 +01:00
Brian Ng
7a6d495704 Throw error if new.target is used outside of a function (#402) 2017-03-08 16:34:22 +01:00
Henry Zhu
5e0dc7a689 add version badge [skip ci] 2017-03-08 08:43:49 -05:00
greenkeeper[bot]
c7492454ca chore(package): update flow-bin to version 0.41.0 (#395)
https://greenkeeper.io/
2017-03-05 13:53:48 +01:00
Daniel Tschinder
12abc20575 Merge branch 'master' into 7.0 2017-03-04 21:00:42 +01:00
Daniel Tschinder
0b7da509d9 Add estree test for correct order of directives 2017-03-04 21:00:10 +01:00
Alex Kuzmenko
962ce16e84 Add DoExpression to spec (#364) 2017-03-03 21:38:04 +01:00
Henry Zhu
1165d7e8c7 typo [skip ci] 2017-03-02 11:48:55 -05:00
Sumedh Nimkarde
05dd6d4545 Mention cloning of repository in CONTRIBUTING.md (#391) [skip ci] 2017-03-02 11:10:02 -05:00
Aaron Ang
265d2c1e4f Explain how to run only one test (#389) [skip ci] 2017-03-01 22:48:14 -05:00
Henry Zhu
2766263eea 7.0-beta.3 changelog [skip ci] 2017-03-01 12:32:08 -05:00
Henry Zhu
38cf1910c1 7.0.0-beta.4 2017-03-01 12:15:32 -05:00
Brian Ng
c8c71684c4 Don't consume async when checking for async func decl (#377) 2017-03-01 12:11:48 -05:00
Henry Zhu
fdb0b50c86 add ranges [skip ci] 2017-03-01 11:00:36 -05:00
Henry Zhu
f1e2cca767 Add back ranges property (#363)
* Add back ranges property

* Correctly adjust range in flow plugin

* Make it an option
2017-03-01 10:57:06 -05:00
Andrew Levine
aec4beff0c Don't parse class properties without initializers when classProperties is disabled and Flow is enabled (#300) 2017-03-01 11:55:24 +01:00
Henry Zhu
56a92ccec1 changelog [skip ci] 2017-02-28 14:56:40 -05:00
Henry Zhu
e2cd62449e 7.0.0-beta.3 2017-02-28 14:47:08 -05:00
Henry Zhu
575e0d58dd update lock 2017-02-28 14:46:25 -05:00
Henry Zhu
5e0cce4974 Merge branch 'master' into 7.0 2017-02-28 14:37:13 -05:00
Alex Kuzmenko
d9e9466350 Update spec.md [skip ci] (#367) 2017-02-28 12:45:25 -05:00
Brian Ng
09bb9bc6be Fix parsing yield with dynamicImport (#383) 2017-02-28 12:43:34 -05:00
Henry Zhu
8d90dc0d10 [7.0] Change RestProperty/SpreadProperty to RestElement/SpreadElement (#384)
* [7.0] Change RestProperty/SpreadProperty to RestElement/SpreadElement

* Fix rest element in array pattern at invalid location
2017-02-28 12:31:58 -05:00
Brian Ng
cd133ff8e1 Ensure consistent start args for parseParenItem (#386) 2017-02-28 12:56:56 +01:00
greenkeeper[bot]
9a5d93fa61 chore(package): update flow-bin to version 0.40.0 (#380)
https://greenkeeper.io/
2017-02-27 12:08:56 +01:00
Henry Zhu
1e747835db add estree to docs [skip ci] (#372) 2017-02-23 18:12:30 -05:00
Henry Zhu
539d345d9b 6.16.1 2017-02-23 09:53:50 -05:00
Henry Zhu
2dd57d17b9 Revert "Fix export default async function to be FunctionDeclaration" (#375) 2017-02-23 09:50:33 -05:00
Henry Zhu
b0f8405b52 Revert "Don't parse class properties without initializers when classProperties plugin is disabled, and Flow is enabled" (#376) 2017-02-23 09:50:25 -05:00
Daniel Tschinder
9ed026df08 Fix error in changelog 2017-02-23 14:04:25 +01:00
Daniel Tschinder
b301d436da 6.16.0 2017-02-23 14:00:35 +01:00
Daniel Tschinder
76c7f55fb5 Fix date [skip ci] 2017-02-23 13:56:22 +01:00
Daniel Tschinder
99484d4c39 Fix typo [skip ci] 2017-02-23 13:52:53 +01:00
Daniel Tschinder
8dbdeff762 Fix typo [skip ci] 2017-02-23 13:51:44 +01:00
Daniel Tschinder
c6c4222789 Changelog 6.16 (#371)
* Update CHANGELOG.md

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update CHANGELOG.md

* Address review comments

* Update CHANGELOG.md
2017-02-23 13:50:41 +01:00
Kevin Gibbons
561d4f74b0 Forbid semicolons after decorators in classes (#352) 2017-02-22 16:24:40 +01:00
Brian Ng
ad8d520406 Ensure takeDecorators is called on exported class (#358) 2017-02-22 16:22:38 +01:00
Alex Rattray
94eda1254e Fix generator-method-with-computed-name spec (#360) 2017-02-22 16:21:44 +01:00
Alex Rattray
fab4ca2a18 Fix flow type-parameter-declaration test with unintended semantic (#361) 2017-02-22 16:19:42 +01:00
Daniel Tschinder
fe2d2a99ea 7.0.0-beta.2 2017-02-20 23:50:07 +01:00
Daniel Tschinder
7bf553a575 Merge branch 'master' into 7.0 2017-02-20 23:49:27 +01:00
Daniel Tschinder
b023470c7e estree: correctly change literals in all cases (#368) 2017-02-20 23:47:57 +01:00
Daniel Tschinder
a4bf244f9a 7.0.0-beta.1 2017-02-20 23:12:19 +01:00
Daniel Tschinder
e52962f4c9 upgrade yarn.lock 2017-02-20 23:11:47 +01:00
Daniel Tschinder
72a0f10825 Merge branch '7.0-dev' into 7.0 2017-02-20 23:09:42 +01:00
Daniel Tschinder
50ffa49201 Merge branch 'master' into 7.0
# Conflicts:
#	src/plugins/flow.js
2017-02-20 22:47:17 +01:00
Daniel Tschinder
2ef00a6631 Fix negative number literal typeannotations (#366)
* Fix negative number literal typeannotations

Also use parseLiteral() to parser string and number literal typeannotations
so that future changes (estree) to literals are also reflected to flow.

* Instead of invalid fallthrough throw immediately

* Increase coverage and better error mesage
2017-02-20 22:43:59 +01:00
Henry Zhu
401733d19f 7.0.0-beta.0 2017-02-15 14:28:29 -05:00
Daniel Tschinder
d2ccc6ae22 Fix test 2017-02-12 15:39:52 +01:00
Daniel Tschinder
09c1f069f9 Fix test 2017-02-12 15:38:11 +01:00
Brian Ng
57aaceaae7 Update contributing with more test info [skip ci] (#355) 2017-02-12 13:45:23 +01:00
Daniel Tschinder
d88befdd30 Merge branch 'master' into 7.0
# Conflicts:
#	src/parser/index.js
2017-02-12 13:32:06 +01:00
Daniel Tschinder
1cca7000d1 Reintroduce Variance node (#333)
* Reintroduce Variance node

* Optimize code and coverage

tt.plusMin can only be + or - so no need to have an elseif
2017-02-12 13:28:14 +01:00
Charles Pick
cd3f14921e Rename NumericLiteralTypeAnnotation to NumberLiteralTypeAnnotation (#332) 2017-02-12 13:14:35 +01:00
Daniel Tschinder
fac13290d7 Estree compatibility as plugin (#277)
* Initial estree support for ClassMethod

* Handle literals for estree

* Fix regex

* correct output of regexp and regenerate test

* Add tests for validation stuff with estree plugin

* Parse Properties correctly

This also refactors how babylon parses obj properties in general
so that this logic can be more easily extended.

* Run all throws-tests a second time with estree plugin

* Fix all throw tests

* Remove rebase conflict

* Correctly set kind

This ensures state.inMethod gets propagated correctly

* Add computed: false to methods with ident async

* Implement directive field on Directives

* Test invalid directives

* more tests
2017-02-12 12:48:41 +01:00
Kristof Degrave
1eaf01661b babel/babylon#328 babel/babylon#205 ?. as nullPropagation. For now it only works for member access. (.? or ?.[) If the object is undefined this will return undefined. If the object on which you want to access the property is defined, the value of the propery will be given back. 2017-02-11 21:20:15 +01:00
Kristof Degrave
b902fe6c7b ?. && ?[ as member access with nullPropagation. If the object is undefined this will return undefined. If the object on which you want to access the property is defined, the value of the propery will be given back. 2017-02-11 16:44:28 +01:00
Daniel Tschinder
c79dd953ea Fix #304 and #309 (#339) 2017-02-10 15:36:46 +01:00
Raphael Mu
f25a2fbc78 add startLine option (#346) 2017-02-10 15:06:28 +01:00
Daniel Tschinder
407c97c9c2 Fix #321 by allowing question marks in type params (#338)
* Fix #321 by allowing question marks in type params

* Require commas between params
2017-02-10 15:03:15 +01:00
Daniel Tschinder
bc771bd0f9 Fix #336 by correctly setting arrow-param (#337) 2017-02-10 15:01:39 +01:00
Timothy Gu
88d38a1abb Update API documentation (#330) 2017-02-10 14:59:35 +01:00
Daniel Tschinder
4bd682e90b keywords are not allowed as local specifier (#307)
Also fix some error messages to be more specific
2017-02-10 14:58:44 +01:00
Panagiotis Vekris
e049ec3456 [Flow] Function predicate declaration (#103)
* [Flow] Function predicate declaration

The accepted syntax for function declarations is extended to allow
the following predicate declaration:

  FunctionReturnType :=
    Type
    Predicate
    Type Predicate

  Predicate :=
    %checks
    %checks ( ConditionalExpression )

* [Flow] Minor tweaks and more examples to function predicates

* [Flow] Clean-up and better message for function predicates

* [Flow] Adding abstract function predicate example

* [Flow] Rearranging the `predicate` field to ease babel generator.
2017-02-10 14:55:13 +01:00
Brandon Dail
56928dca66 [7.0] Remove ForAwaitStatement, add await flag to ForOfStatement (#349)
* Remove ForAwaitStatement, add await flag to ForOfStatement

* Set await flag for all ForOfStatements
2017-02-09 17:37:03 -05:00
greenkeeper[bot]
0834cb5b72 chore(package): update ava to version 0.18.0 (#345)
https://greenkeeper.io/
2017-02-09 14:55:55 +01:00
greenkeeper[bot]
b0220bfd3e chore(package): update babel-plugin-istanbul to version 4.0.0 (#350)
https://greenkeeper.io/
2017-02-09 14:30:19 +01:00
Daniel Tschinder
0309a5ba8a Merge branch 'master' into 7.0
# Conflicts:
#	src/parser/statement.js
#	src/plugins/jsx/index.js
2017-01-27 23:12:20 +01:00
Daniel Tschinder
e614032504 Change location of ObjectTypeIndexer to match flow (#228) 2017-01-27 23:08:20 +01:00
jeromew
898c4a7623 Add a parseExpression public method (#213) 2017-01-27 20:13:02 +01:00
Dmytro
b6b4610cea added keywords to package.json (#323) 2017-01-27 19:44:09 +01:00
Daniel Tschinder
d2faddf0d9 Fix export default async function to be FunctionDeclaration (#324) 2017-01-27 19:43:06 +01:00
Toru Kobayashi
c424156751 Rename flow AST Type ExistentialTypeParam to ExistsTypeAnnotation (#322) 2017-01-27 19:42:15 +01:00
Andrew Levine
9929baaca8 Don't parse class properties without initializers when classProperties is disabled and Flow is enabled (#300) 2017-01-23 23:56:39 +01:00
Daniel Tschinder
b6c3b5aa83 Cleanup and splitup parser functions (#295)
This makes it easier to integrate the estree plugin.
2017-01-20 23:52:16 +01:00
Daniel Tschinder
0a00aff2fe Do not allow overwritting of primitive types (#314)
* Do not allow overwritting of primitive types

* Better name for method
2017-01-20 22:22:25 +01:00
Brian Ng
461ed45942 Fix parse error when destructuring set with default value (#317) 2017-01-20 22:21:40 +01:00
Daniel Tschinder
55df6631fa Address comments on flow type imports (#312) 2017-01-20 22:20:13 +01:00
Daniel Tschinder
d5cd2c3231 Allow imports in declare module (#315)
* Allow imports in declare module {}

* Rename bodyElement to bodyNode
2017-01-20 22:19:50 +01:00
Mathias Bynens
f2df08e253 AST spec: fix casing of RegExpLiteral (#318) [skip ci] 2017-01-20 11:05:21 -05:00
Daniel Tschinder
a1bfa0253a Update yarn.lock 2017-01-18 20:43:31 +01:00
greenkeeper[bot]
1150c0d3fb chore(package): update flow-bin to version 0.38.0 (#313)
https://greenkeeper.io/
2017-01-18 16:49:12 +01:00
Daniel Tschinder
999b655ca6 Disallow import type { type a } from … (#305) 2017-01-17 20:34:20 +01:00
Daniel Tschinder
bd001767fb Revert "Temporary rollback for erroring on trailing comma with spread (#154)" (#290)
This reverts commit 5bac6e8ad9.
2017-01-16 10:50:51 +01:00
Brian Ng
c5462e1a30 Remove classConstructorCall plugin (#291) 2017-01-16 10:49:42 +01:00
Dan Harper
28c467e8fe Fix ObjectTypeCallProperty static (#298)
* add failing test for ObjectTypeCallProperty static (#297)

* fix ObjectTypeCallProperty static
2017-01-16 10:42:13 +01:00
Gabriel Peña
00f03bb3b0 Remove '*' as a plugin option (#301) 2017-01-16 10:34:23 +01:00
Daniel Tschinder
5977479f57 Call inner function instead of 1:1 copy to plugin (#294) 2017-01-16 10:21:44 +01:00
greenkeeper[bot]
68a173c97c Update eslint-config-babel to the latest version 🚀 (#299)
* chore(package): update eslint-config-babel to version 6.0.0

https://greenkeeper.io/

* Fix linting
2017-01-15 11:12:49 +01:00
Brian Ng
9d78213ab6 Improve error message on attempt to destructure named import (#288) 2017-01-14 15:38:30 +01:00
Daniel Tschinder
b918554d73 Correct indent eslint rule config (#276)
* Change indent rule to correctly lint

* Remove rule again
2017-01-14 15:11:50 +01:00
greenkeeper[bot]
62d1970f77 Update eslint-config-babel to the latest version 🚀 (#293)
* chore(package): update eslint-config-babel to version 5.0.0

https://greenkeeper.io/

* fix lint warnings
2017-01-14 15:04:10 +01:00
Kai Cataldo
a465d2580e devDeps: remove eslint-plugin-babel (#292) 2017-01-14 08:01:13 -05:00
Daniel Tschinder
7a3e717f15 Update yarn.lock 2017-01-12 22:55:00 +01:00
Daniel Tschinder
8f7a19e3ad Update cross-env to 3.x 2017-01-12 22:53:48 +01:00
Sergey Rubanov
b72d4d40a5 [7.0] Remove node 0.10, 0.12 and 5 from Travis (#284)
* Remove node 0.10, 0.12 and 5 from Travis

* add engines to package.json
2017-01-12 22:51:05 +01:00
Daniel Tschinder
5785f0ce72 Merge branch 'master' into 7.0 2017-01-12 22:42:25 +01:00
Daniel Tschinder
13bebfdf45 Fail tests that have expected.json and throws-option (#285)
* Fail tests that have expected.json and throws

* Remove obsolete test files
2017-01-12 22:38:41 +01:00
Daniel Tschinder
aa1a4be5ec 6.15.0 2017-01-10 22:38:45 +01:00
Daniel Tschinder
fdc106c9b6 Update yarn.lock 2017-01-10 22:37:36 +01:00
Daniel Tschinder
0f0b7290f4 Changelog 6.15.0 (#283)
* Update CHANGELOG.md

* Update CHANGELOG.md [skip ci]
2017-01-10 22:35:19 +01:00
Sven SAULEAU
ed13a4ab05 Refactor tokenizer types file (#263)
* refactor(tokenizer): use class for keywork tokens

* refactor(tokenizer): re-use constacts in types

* refactor(tokenizer): binop token type

* feat(tokenizer): use beforeAndStartExpr for shortcut

* fix(tokenizer): typo in keywordTokenType

* refactor(tokenizer): don't use spread operator

* refactor(tokenizer): constant for isLoop, isAssign, prefix, postfix

* fix(tokenizer): remove constant beforeAndStartExpr

* style(tokenizer): space after comma
2017-01-10 20:22:56 +01:00
Mathias Bynens
ed625cb2e1 Remove String.fromCodePoint shim (#279)
This is not necessary anymore if we drop support for Node.js v0.10 and v0.12.

Ref. https://github.com/babel/babel/issues/4315.
2017-01-10 20:14:11 +01:00
Ryan Plant
5055b335b2 Rename folder to avoid Windows-illegal characters (#281) 2017-01-10 14:12:13 -05:00
greenkeeper[bot]
6773279039 Update eslint-config-babel to the latest version 🚀 (#273)
* chore(package): update eslint-config-babel to version 4.0.0

https://greenkeeper.io/

* Fix prefer-const

* Update package.json
2017-01-10 19:42:43 +01:00
Daniel Tschinder
cd9aaf2a58 Fix syntax error in .travis.yml 2017-01-10 15:06:08 +01:00
Daniel Tschinder
008a29cb5f Update yarn.lock 2017-01-08 00:33:39 +01:00
greenkeeper[bot]
326670dd29 chore(package): update rollup to version 0.41.0 (#272)
https://greenkeeper.io/
2017-01-08 00:28:44 +01:00
Andrew Levine
cec8bc0354 Add some test coverage for decorators stage-0 plugin (#250) 2017-01-05 22:07:40 +01:00
Vladimir Kurchatkin
3267e5f365 Don't set inType flag when parsing property names (#266)
* Don't set inType flag when parsing property names

* Add inPropertyName type definition

* Move inPropertyName check before this.curContext()
2017-01-05 12:25:57 +01:00
greenkeeper[bot]
dd4c4ead2d chore(package): update rollup to version 0.40.0 (#270)
https://greenkeeper.io/
2017-01-05 12:24:31 +01:00
Jeff Morrison
9ea4e9dead Add support for Flow shorthand import type (#267) 2017-01-03 10:52:18 +01:00
Alex Rattray
68bb1c6598 Allow this.state.clone() when parsing decorators (#262)
Adding the line `this.state = this.state.clone();` in a parser plugin 
(specifically, in my case `parseExprAtom`)
would break decorators. 

This change fixes that.
2017-01-02 10:37:05 +01:00
Ryan Duffy
1c13800efd Use fromCodePoint to convert high value unicode entities (#243)
* Use fromCodePoint to convert high value unicode entities

* Include polyfill for String.fromCodePoint

* copy and adapt fromCodePoint into String.fromcodepoint

In order to avoid modifying String as the polyfill does, I've copied
the source from the polyfill and adapted it return the polyfill
function if the native version does not exist. Once support for node
versions that lack fromCodePoint is dropped, this polyfill can be
removed.

* move license notice to top of file
2017-01-02 10:15:56 +01:00
Vladimir Kurchatkin
3dc403974c flow: allow leading pipes in all positions (#256) 2017-01-02 10:13:53 +01:00
Daniel Tschinder
b875ed755b Update yarn.lock 2017-01-02 10:00:13 +01:00
Daniel Tschinder
0fb1be4744 User external-helpers (#254)
Add yarn.lock as recommended
2017-01-02 09:57:55 +01:00
greenkeeper[bot]
7e6b0dac5c chore(package): update rollup to version 0.39.0 (#269)
https://greenkeeper.io/
2017-01-02 09:57:05 +01:00
greenkeeper[bot]
d3507eb5ce chore(package): update rollup to version 0.38.0 (#265)
https://greenkeeper.io/
2016-12-28 22:59:57 +01:00
James Long
ba96b91f40 Fix source location for JSXEmptyExpression nodes (fixes #248) (#249) 2016-12-14 16:32:36 -05:00
greenkeeper[bot]
4958225645 chore(package): update rollup to version 0.37.0 (#253)
https://greenkeeper.io/
2016-12-13 23:50:07 +01:00
greenkeeper[bot]
9adfd4c4e2 chore(package): update flow-bin to version 0.37.0 (#255)
https://greenkeeper.io/
2016-12-13 10:31:59 +01:00
Daniel Tschinder
375838db35 Prepare tests for multiple fixture runners. (#240)
* Prepare tests for multiple fixture runners.

* Replace ES2015
2016-12-08 17:58:53 +01:00
Andrew Levine
30545e883f Freeze current plugins list for "*" option, and remove from README.md (#245) 2016-12-06 14:09:36 -05:00
Kai Cataldo
4072dfddab Add watch script for dev (#234) 2016-12-05 16:54:18 -05:00
Kai Cataldo
5fb4353778 Throw error when exporting non-declaration (#241)
* Throw error when exporting non-declaration

fixes #238

* Do check ahead of parsing export statement
2016-12-01 21:03:13 +01:00
greenkeeper[bot]
5630380026 Update dependencies to enable Greenkeeper 🌴 (#233)
* chore(package): update dependencies

https://greenkeeper.io/

* cross-env 3 is not compatible to node 0.10

* ignore cross-env
2016-11-28 23:22:42 +01:00
Henry Zhu
9b6bb3cb9b 6.14.1 2016-11-17 19:09:24 -05:00
Henry Zhu
225adb100b v6.14.1 changelog [skip ci] 2016-11-17 19:08:57 -05:00
Henry Zhu
89a606ce11 document * [skip ci] 2016-11-17 19:06:16 -05:00
Daniel Tschinder
6d3b63454c Allow plugins:["*"] (#229) 2016-11-17 19:04:58 -05:00
Daniel Tschinder
03352cb480 Fix date in Changelog 2016-11-16 16:52:59 +01:00
Daniel Tschinder
38dcafc8ac 6.14.0 2016-11-16 16:32:32 +01:00
Daniel Tschinder
186a58ac31 6.14.0 (#221) [skip ci]
* 6.14.0

* fixes [skip ci]

* fixes [skip ci]
2016-11-16 16:29:11 +01:00
Daniel Tschinder
2caee29703 Run npm test with sourceMaps (#222) 2016-11-15 13:32:02 -05:00
Ryan Clark
b4c56ce9f9 Fix typo (#226) [skip ci] 2016-11-14 20:37:32 -05:00
Daniel Tschinder
58887ed14e Run tests of flow with babylon (#225)
* Run tests of flow with babylon

* Fix travis

* Fix typo

* Again...

* Brtter hint

* proper exit code

* Fix some flase-positives and better reporting

* Enable some plugins, that flow supports by default
2016-11-14 18:16:36 +01:00
Henry Zhu
48873f886a Correctly eat a semicolon at the end of DelcareModuleExports (#223) 2016-11-14 10:25:19 -05:00
Daniel Tschinder
ad88d461d3 Correctly eat a semicolon at the end of DelcareModuleExports 2016-11-13 14:29:46 +01:00
Daniel Tschinder
c30a556615 Replace emojis with github tags 2016-11-13 10:35:04 +01:00
Bernhard Häussner
01ed943deb Parse flow nested array type annotations like number[][] (#219)
* Parse flow nested array type annotations like number[][]

Fixes #217.

* Do not parse a newline separated array statement into a flow type annotation

* Get rid of lineBreak dependency in flow.js in favor of higher level method
2016-11-13 10:22:16 +01:00
Moti Zilberman
6cb023590a Count Babel tests towards Babylon code coverage (#182)
* Add code coverage from Babel tests

* Configure nyc correctly for Babel test coverage

* Guard against nyc config conflicts if Babel switches to nyc in the future

* Move .nyc_output from Babel build dir to root
2016-11-09 17:24:57 +01:00
Kai Cataldo
e260381e06 Throw error for reserved words enum and await (#195)
* Throw error for reserved words enum and await when source type is module

* Extract reserved word check into method

* Fix tests
2016-11-09 16:29:02 +01:00
Gabe Levi
643124744f Optional names for function types and object type indexers (#197)
* Use .gitattributes to ignore files with weird newlines

* [Flow] Make parameter names in function types optional

* [Flow] Anonymous function types with single params can omit parens

* [Flow] Optional names for object indexer keys

* Add noAnonFunctionType explicitly to state

* Adjust gitattributes as files have been fixed
2016-11-09 16:22:53 +01:00
Thomas Grainger
e05bbeefd1 Fix strange line endings (#214) 2016-11-09 16:19:00 +01:00
Daniel Tschinder
4141683935 Add node 7 2016-11-01 21:00:50 +01:00
Greenkeeper
96404aa4fe chore(package): update flow-bin to version 0.34.0 (#204)
https://greenkeeper.io/
2016-11-01 16:51:56 +01:00
Daniel Tschinder
ca0de3b7d4 Correct repo [skip ci] 2016-11-01 16:51:12 +01:00
Daniel Tschinder
87707c18ca Create github Templates (#209) [skip ci]
* Create PULL_REQUEST_TEMPLATE.md

* Create ISSUE_TEMPLATE.md
2016-11-01 11:49:30 -04:00
Henry Zhu
572bc9c199 v6.13.1 changelog [skip ci] 2016-10-26 12:11:54 -04:00
Henry Zhu
b5de37fcd7 6.13.1 2016-10-26 12:08:01 -04:00
Henry Zhu
2ba3dcf4ff add clean command [skip ci] (#201) 2016-10-26 10:56:27 -04:00
Andrew Levine
beb8db6264 Use rollup for bundling to speed up startup time (#190) 2016-10-26 10:44:21 -04:00
Henry Zhu
d1b0886d46 add ForAwaitStatement (async generator already added) [skip ci] (#196) 2016-10-25 16:25:25 +02:00
Daniel Tschinder
930cdd01a7 6.13.0 2016-10-21 16:39:40 +02:00
Daniel Tschinder
b77a57faf8 Changelog 6.13.0 (#193) [skip ci]
* Update CHANGELOG.md

* Add link to flow docs [skip ci]

* type [skip ci]
2016-10-21 16:39:02 +02:00
Moti Zilberman
e047a1b89a Flow: Allow class properties to be named static (#184)
Related: #158
2016-10-17 15:55:50 -04:00
Moti Zilberman
d14c8bd894 Fix .gitattributes line ending setting (#191)
h/t @nhajidin in babel/babel#4744
2016-10-17 15:53:54 -04:00
Daniel Tschinder
0d72a89df6 Fix flowtype and add inType to state (#189)
this improves the performance slightly
2016-10-17 10:45:46 -04:00
Andrew Levine
01e984fd0f Allow "async" as identifier for object literal property shorthand (#187) 2016-10-17 10:33:18 -04:00
Moti Zilberman
9b6e243736 Raise error on duplicate definition of __proto__ (#183)
Spec: http://www.ecma-international.org/ecma-262/6.0/#sec-__proto__-property-names-in-object-initializers

This brings back to life a bit of dead code in Parser.prototype.checkPropClash, and enables several tests that were previously disabled.
2016-10-16 15:16:38 +02:00
Moti Zilberman
7c18bf83cc Increase test coverage (#175)
* Increase test coverage

* Test for error when binding `this` in destructuring pattern

* Ignore coverage of inAsync check in parseAwait - already checked externally

* Ignore coverage of default case in checkPropClash

* Remove unused parameter isAsync from parseParenAndDistinguishExpression

* Ignore coverage of an `else` branch in flowParseTypeParameterDeclaration

* Flow: remove unused parameters to flowParseTypeAnnotatableIdentifier

* Flow: ignore coverage of pass-through throw statement in parseConditional

* Flow: Add test for error on property with type param

* Flow: ignore coverage of pass-through throw statements in parseMaybeAssign, parseArrow

* Add test for error on XML-style comment in module code

* Update test for error on method in object pattern

* Test for error: "Only '=' operator can be used for specifying default value"
2016-10-16 15:04:13 +02:00
Moti Zilberman
490ae9a44c Error on missing expected.json fixture in CI (#188) 2016-10-16 07:55:41 -04:00
Moti Zilberman
394c9543c9 Add .gitattributes and .editorconfig for LF line endings (#179)
* Add .gitattributes forcing LF line endings

* Add .editorconfig from Babel
2016-10-15 11:08:12 +02:00
Daniel Tschinder
0bbe1e1eec Readd missin .eslinignore for IDEs 2016-10-15 10:33:05 +02:00
Sam Goldman
26809e8ce7 Property variance type annotations for Flow plugin (#161)
* Property variance type annotations for Flow plugin

Non-method properties and indexers of object types, declare class, and
interfaces can be "positive" or "negative." Class fields, but again not
methods, can also have variance.

This PR generalizes the variance annotations for type parameters into a
new node type, and reuses that node for those properties.

The code for object types is reused for interfaces and declare classes.
The changes there are straightfoward.

The code for class fields is reused for object literals, which do not
support variance annotations (currently). This code is a bit sketchy,
because we always parse variance annotations in the `parsePropertyName`
extension, then error in a the subsequent parse phase for object
literals (`parseObjPropValue`) or class methods (`parseClassMethod`).

* Remove bogus unreachable code, clarify variance parsing conditional

* Don't use a new node type for variance annotations

Adding a new node type, specifically changing the TypeParameter node's
variance property to be node-valued, is a breaking change. We might
choose to make this breaking change in a later version.

* s/start/variancePos
2016-10-14 23:13:27 +02:00
Moti Zilberman
b5877f04b1 Fix up #172 (#177)
* Update two esprima tests to the new "expected TOKEN" messages

* Update dynamic-import to use "expected (" error message
2016-10-14 16:50:07 -04:00
Henry Zhu
3525c00397 v6.12.0 changelog [skip ci] (#176) 2016-10-14 16:17:17 -04:00
Henry Zhu
a88a8e9c15 6.12.0 2016-10-14 16:14:54 -04:00
Henry Zhu
6b4a19d520 test fixes 2016-10-14 16:14:38 -04:00
Henry Zhu
9ecf763218 lint [skip ci] 2016-10-14 16:12:05 -04:00
Moti Zilberman
d3af158ba5 Annotate more errors with expected token (#172)
Expanding on #150, this allows `unexpected()` to accept the expected token type instead of a message string.
This overload is then used in a couple more places (that independently implement a logic similar to `expect()`'s) to construct an `Unexpected token, expected FOO` message.
2016-10-14 16:10:09 -04:00
Dan Harper
99fbcefa65 allow keyword in Flow object declaration property names with type parameters (#146) 2016-10-14 21:15:00 +02:00
Dan Harper
f7c1af1c1f allow keyword in object/class property names with Flow type parameters (#145) 2016-10-14 21:13:00 +02:00
Jordan Gensler
c63c1bc728 [dynamic-import] Implementing import() syntax (#163) 2016-10-14 14:54:21 -04:00
Daniel Tschinder
4c445fd5f8 Remove kcheck (#173) 2016-10-14 12:12:55 -04:00
Daniel Tschinder
b31834ad29 Allow typeAnnotations for yield epressions (#174) 2016-10-14 12:07:46 -04:00
Sam Goldman
44f77bd724 Add EmptyTypeAnnotation (#171)
I also noticed that there was missing test coverage for builtin types,
so I added a test for that, which includes the newly added type as well
as the other existing types.
2016-10-13 19:22:13 -04:00
Henry Zhu
c300230a59 v6.11.6 changelog [skip ci] 2016-10-12 19:39:59 -04:00
Henry Zhu
c6e36eff86 6.11.6 2016-10-12 19:37:16 -04:00
Jeroen Engels
e14f93d1bb Fix crash when exporting with destructuring and sparse array (#170)
* Create reproducible crash when exporting with destructuring and sparse array

* Fix crash when exporting with destructuring and sparse array
2016-10-12 19:36:08 -04:00
Henry Zhu
b1fc65530d v6.11.4 changelog [skip ci] 2016-10-12 11:58:11 -04:00
Henry Zhu
066826f7fa skipped v6.11.4 [skip ci] 2016-10-12 11:56:14 -04:00
Henry Zhu
ebe7c8a90c 6.11.5 2016-10-12 11:53:46 -04:00
Henry Zhu
b05bd7839a fixes [skip ci] 2016-10-12 11:52:26 -04:00
Henry Zhu
02d6cc6ccb v6.11.4 changelog [skip ci] (#168) 2016-10-12 11:50:40 -04:00
Henry Zhu
6e17a646ff changelog emoji [skip ci] 2016-10-12 11:33:19 -04:00
Daniel Tschinder
d4d6d05d25 Slightly better error messages (#150)
* Slightly better errors

Instead of "Unexpected token" we now print
"Unexpected token, expected <type.label>"
2016-10-12 10:38:26 -04:00
Kai Cataldo
4fc0a3839e Fix: Allow identifier async for default param in arrow expression (#165)
fixes #118
2016-10-12 10:46:40 +02:00
Kai Cataldo
7dd45f7465 Check for duplicate named exports in exported rest elements/properties (#164) 2016-10-10 10:10:16 -04:00
Henry Zhu
2697bfd820 clarify proposals [skip ci] 2016-10-06 19:38:43 -04:00
Daniel Tschinder
680f35f606 Update links to estree 2016-10-04 18:02:56 +02:00
Kai Cataldo
76e69277d7 Check for duplicate named exports in exported destructuring assignments (#144)
* Check for duplicate named exports in exported destructuring assignments

* Refactor duplicate error reporting

* Remove unnecessary check
2016-10-04 15:06:26 +02:00
Henry Zhu
7c2302a02f 6.11.4 2016-10-01 20:08:48 -04:00
Henry Zhu
5bac6e8ad9 Temporary rollback for erroring on trailing comma with spread (#154) 2016-10-01 20:08:25 -04:00
Henry Zhu
1285131e3e v6.11.3 changelog [skip ci] (#153)
* v6.11.3 changelog [skip ci]
2016-10-01 17:33:31 -04:00
Henry Zhu
45c68c7311 6.11.3 2016-10-01 16:33:29 -04:00
Henry Zhu
4847403b84 add npm run changelog 2016-10-01 16:33:10 -04:00
Daniel Tschinder
7877829fcb Add static errors for object rest (#149)
* Fix parsing object rest

This makes object-rest-spread behave according to spec and only
allow one rest operator and enforces it to be the last
param in the object.

Also move all object-rest-spread tests to a own folder.

* Show nicer error messages
2016-09-30 11:37:55 -04:00
jezell
9cc0981c51 get / set are valid property names in default assignment (#142) 2016-09-27 23:29:16 +02:00
Daniel Tschinder
4115bcb97d Fix travis 2016-09-26 10:05:16 +02:00
Henry Zhu
44d44a20f9 changelog update 2016-09-23 00:51:29 -04:00
Henry Zhu
a1c0ef220a Don't build on *.md change [skip ci] 2016-09-23 00:50:36 -04:00
Henry Zhu
6ce192d883 6.11.2 changelog [skip ci] 2016-09-23 00:49:06 -04:00
Henry Zhu
fbd3f6a183 6.11.2 2016-09-23 00:44:36 -04:00
Henry Zhu
1d04d12794 Don't do the duplicate check if not an identifier (#140) 2016-09-23 00:44:13 -04:00
Daniel Tschinder
101e9e5636 Fix styling 2016-09-22 22:31:30 +02:00
Daniel Tschinder
4b11aad516 6.11.1 (#138)
* Update CHANGELOG.md

* Update CHANGELOG.md
2016-09-22 22:30:41 +02:00
Henry Zhu
8a544542db 6.11.1 2016-09-22 16:01:02 -04:00
Daniel Tschinder
952d50faf9 Make exportIdentifiers and array so that base object properties are not accounted (#137) 2016-09-22 16:00:39 -04:00
Henry Zhu
3210bbbce0 6.11.0 2016-09-22 14:08:21 -04:00
Henry Zhu
b1584cac6a link to example pr [skip ci] 2016-09-22 14:05:20 -04:00
Henry Zhu
0ca8f167c7 6.11.0 changelog [skip ci] (#136)
* 6.11.0 changelog [skip ci]

* add examples [skip ci]
2016-09-22 14:03:44 -04:00
Moti Zilberman
774e6b446b Rephrase "assigning/binding to rvalue" errors to include context (#119) (#123)
* Rephrase "assigning/binding to rvalue" error messages with context (#119)

* Fix code style in parser/lval.js

* istanbul ignore some unused branches in parser/lval.js

* Fix code style again in parser/lval.js
2016-09-22 12:02:20 -04:00
Kai Cataldo
650e33376a Disallow duplicate named exports (#107)
fixes #69
2016-09-22 10:20:47 -04:00
Moti Zilberman
4e1fbd48d5 Add support for computed class property names (#120) (#121) 2016-09-21 21:24:59 -04:00
Dan Harper
b68918e377 fix static falling through in declare class Flow AST (#135) 2016-09-21 00:17:55 -04:00
Daniel Tschinder
9cb73d8e96 fix call to this.parseMaybeAssign with correct arguments (#133) 2016-09-20 09:42:14 -04:00
Daniel Tschinder
8d2fdb1515 let travis handle depth 2016-09-19 20:39:06 +02:00
Henry Zhu
374908611c add semver note to changelog [skip ci] (#131)
* add semver note to changelog [skip ci]

* fix [skip ci]
2016-09-19 11:40:37 -04:00
Henry Zhu
df60dcbb98 6.10.0 2016-09-19 11:32:59 -04:00
Henry Zhu
399bc6e931 explanation + fix [skip ci] 2016-09-17 23:11:41 -04:00
Steve Mao
c04a8594ae fix typo: interspatial (#129) 2016-09-16 10:28:11 +02:00
Henry Zhu
8fc6c28900 add note about spec-compliancy and semver (#128)
* add note about spec-compliancy and semver

* review [skip ci]
2016-09-15 19:24:19 -04:00
Henry Zhu
d000ead2b3 6.10.0 changelog [skip ci] 2016-09-15 19:23:54 -04:00
Daniel Tschinder
f91da191a1 Include typeParameter location in the arrow function expression (#126) 2016-09-15 19:08:33 -04:00
Timothy Gu
643d3f37a4 Implement ES2016 check for simple parameter list in strict mode (#106)
* Slightly simplify logic

* Implement ES2016 check for simple parameter list in strict mode

See e.g. ECMA-262 7.0 14.1.2:

> It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
> IsSimpleParameterList of FormalParameters is false.

Similar clauses cover arrow functions, generator functions, methods, and
generator methods, as well as async functions and async arrow functions.
2016-09-15 19:58:01 +02:00
Dan Harper
64145b07e3 error on invalid flow type annotation with default assignment (#122) 2016-09-15 19:35:03 +02:00
Dan Harper
dc3036627b Fix Flow return types on arrow functions (#124)
* fix: arrow return type on next line is valid

https://github.com/babel/babel-eslint/issues/348

* fix: arrow on line after return type annotation is invalid

* lint
2016-09-15 19:27:11 +02:00
Daniel Tschinder
abf6ca8e5e Add tests for export extensions (#127)
The case which includes a namespaced and default import was not tested yet
2016-09-15 19:24:11 +02:00
Daniel Tschinder
0adca96529 Fix Contributing guidelines [skip ci] 2016-09-15 18:39:10 +02:00
Basil Hosmer
ddbda7dd04 exact object type annotations for Flow plugin (#104)
* exact object type annotations for Flow plugin

* Couple tweaks per suggestions

* s/==/===/

* add test for unexpected token in flowObjectType Semicolon
2016-09-13 10:07:23 -04:00
Henry Zhu
015035cd27 6.9.2 changelog [skip ci] 2016-09-09 11:02:16 -04:00
Henry Zhu
7d561e7a04 6.9.2 2016-09-09 10:54:59 -04:00
Henry Zhu
75cb271134 Package.json: remove dependencies object [skip ci] 2016-09-09 10:51:48 -04:00
Henry Zhu
5f9c381f9c update packages, use es2015 loose mode, remove babel-runtime transform (#110)
* update packages, use es2015 loose mode, remove babel-runtime transform

* reuse [skip ci]

* remove runtime
2016-09-09 10:47:07 -04:00
Daniel Tschinder
69a9ba86ae Enable partial code coverage (#109) 2016-09-06 15:14:19 +02:00
Daniel Tschinder
e3d5a7d646 Update contributing [skip ci] (#108)
* Update contributing [skip ci]

* typo
2016-09-05 23:31:46 +02:00
Daniel Tschinder
dc56c0b54d Change to export codecoverage as json (#102) 2016-08-30 23:50:56 +02:00
Daniel Tschinder
e0b2c86950 Remove deprecated plugin from README.md (#101)
As we probably remove it anyway in the next major we can already at least not expose it in the readme.
2016-08-29 11:06:23 -04:00
Daniel Tschinder
abec2a70e9 changelog 6.9.1 2016-08-24 11:25:39 +02:00
Henry Zhu
32d5c7195e 6.9.1 2016-08-23 17:48:08 -04:00
Henry Zhu
c8b32485a0 Update readme - es2017 [skip ci] 2016-08-23 17:47:20 -04:00
Daniel Tschinder
27ad69d43f Fix declare class with qualified type identifier (#97)
This makes declare class extends behave the same way as in flow
The ast-token after the extends keyword, might be either Identifier or
QualifiedTypeIdentifier

To do that this commits splits the parseGenericType into two functions,
one for parsing genericType and on for qualifiedTypeIdentifier
2016-08-23 17:29:23 -04:00
Dan Harper
efab40154e Fix arrow functions with destructuring, types & default value (#94)
Flow's "toAssignable" override wasn't calling the inner function,
resulting in the destructuring in an AssignmentPattern not having the
node type changed from ObjectExpression to ObjectPattern, resulting in
"Binding rvalue" thrown from "checkLVal()"
2016-08-23 17:27:39 -04:00
Daniel Tschinder
db0705bc51 Fix issues with flow-types and async function (#95)
the typeAnnotation was not correctly resolved in async
functions
2016-08-23 17:22:01 -04:00
Daniel Tschinder
2cfae60b15 Fix issues with default object params in async functions (#96)
This change allows async functions to have a spread argument which
defines a default value.
2016-08-23 17:19:49 -04:00
Daniel Tschinder
4506822180 Remove exponentiationOperator, asyncFunctions, trailingFunctionCommas (#98)
* This removes the exponentiationOperator as it is now in es2016

* Remove from tests

* Remove asyncFunctions and restructure test dirs

* Remove trailingFunctionCommas
2016-08-23 17:11:01 -04:00
Daniel Tschinder
b6496718a7 Correct codecoverage paths (#93) 2016-08-17 18:21:25 +02:00
Daniel Tschinder
8bef3156be Correct code example 2016-08-16 19:07:56 +02:00
Daniel Tschinder
56c7d5a67d Update CHANGELOG.md [skip ci] (#91) 2016-08-16 16:34:51 +02:00
Sebastian McKenzie
dc6a5d2f86 6.9.0 2016-08-16 15:11:06 +01:00
Sebastian McKenzie
4af484b805 Merge pull request #65 from danez/fix-syntax-error-pos
Fixes SyntaxError position with flow optional type
2016-08-16 15:06:25 +01:00
Sebastian McKenzie
43cdd2f5b0 Merge pull request #57 from danez/fix-arrow-location
Fix arrow param locations with flow types
2016-08-16 15:06:19 +01:00
Sebastian McKenzie
0b87d4c97c Add identifier name to node loc field (#90) 2016-08-16 09:41:10 -04:00
Daniel Tschinder
69e914baeb Set correct include patterns for code-coverage 2016-08-14 12:39:41 +02:00
Greenkeeper
2abef9dbaa chore(package): update nyc to version 8.0.0 (#88)
https://greenkeeper.io/
2016-08-14 12:37:25 +02:00
Greenkeeper
0b23e5cc2d chore(package): update babel-plugin-istanbul to version 2.0.0 (#89)
https://greenkeeper.io/
2016-08-14 12:27:05 +02:00
Greenkeeper
0a6d333531 chore(package): update ava to version 0.16.0 (#86)
https://greenkeeper.io/
2016-08-06 18:29:38 +02:00
Sebastian McKenzie
c9a7bed6d0 Merge pull request #83 from gabelevi/flow
Small fix for parsing type parameter declarations
2016-08-04 00:37:37 +10:00
Daniel Tschinder
eb691425b6 Only allow declares inside declare module (#73)
* Only allow declares inside declare module

* Better error message
2016-07-29 20:22:49 +02:00
Gabe Levi
859ed04be9 Small fix for parsing type parameter declarations 2016-07-29 12:45:20 -04:00
Dale Bustad
4811d617ce If supplied, attach filename property to comment node loc. (#80) 2016-07-28 23:12:41 +02:00
Daniel Tschinder
64ca55cfe0 Fixes Syntax error position with flow optional type 2016-07-28 23:09:40 +02:00
Daniel Tschinder
cd987cd8e4 Fix arrow param locations with flow types
This patch corrects the end locations for params in arrow functions
which use type params.
2016-07-28 23:09:19 +02:00
Daniel Tschinder
f576865ce9 Add support for declare module.exports (#72)
* Add support for declare module.exports

* Use doublequotes

* Use expect instead of eat
2016-07-28 22:16:58 +02:00
Max Schaefer
fd18d89d8e Fix accidental fall-through in Flow type parsing. (#82)
When parsing a primary type, `>` would erroneously be treated like `(`.
2016-07-28 22:12:47 +02:00
Daniel Tschinder
88d7e2012c Fix lookahead to not add comments to arrays which are not cloned (#76)
We do not clone arrays in lookahead() but comments were added
to leading/trailing arrays during lookahead, leading to leak to the next next() call.

Also extracted parsing of JSXSpreadChild to own parse function.
2016-07-17 11:08:25 +02:00
Daniel Tschinder
97325592fa Fix exponential operator to behave according to spec (#75) 2016-07-17 11:08:12 +02:00
Greenkeeper
f5df4b9411 chore(package): update cross-env to version 2.0.0 (#77)
https://greenkeeper.io/
2016-07-14 00:35:13 +02:00
Daniel Tschinder
406cd33ca2 Use plugin-babel-istanbul for codecoverage 2016-07-13 11:43:31 +02:00
Sebastian McKenzie
3fad8cc9a7 Merge pull request #42 from calebmer/feat/jsx-spread-children
Add JSX spread children
2016-07-13 01:32:09 +01:00
Daniel Tschinder
b00ba47e6c run build before publish with production env 2016-07-13 01:02:11 +02:00
Daniel Tschinder
964bd4d609 Add coverage badge 2016-07-13 00:43:26 +02:00
Daniel Tschinder
0b62ecee21 Add sourcemaps for code coverage 2016-07-13 00:27:53 +02:00
Daniel Tschinder
149a339932 Use codecov node client 2016-07-12 23:05:13 +02:00
Daniel Tschinder
f4b8b85f11 Use correct coverage reporter 2016-07-12 22:34:43 +02:00
Daniel Tschinder
47d11ae084 Enable coverage on travis 2016-07-12 22:20:31 +02:00
Daniel Tschinder
15a391d305 Fix tests to not save expected output if we expect the test to fail 2016-07-11 13:35:50 +02:00
Daniel Tschinder
50422c6db1 Add PR numbers to changelog [skip ci] 2016-07-07 10:17:33 +02:00
Daniel Tschinder
ee6a578478 Make a shallow clone of babel for testing
There is no need to retrieve the whole history.
2016-07-07 10:00:04 +02:00
Henry Zhu
46ed49fe3a add 6.8.3,6.8.4 changelog [skip ci] 2016-07-06 19:40:51 -04:00
Henry Zhu
46fc224382 6.8.4 2016-07-06 19:34:38 -04:00
Daniel Tschinder
34a82f716e Fix the location of params, when flow and default value used (#68)
Fixes #67
2016-07-06 17:48:47 -04:00
Daniel Tschinder
83bf84f7cd 6.8.2 changelog [skip ci] (#60) 2016-07-06 17:48:31 -04:00
Sebastian McKenzie
e0639505d1 6.8.3 2016-07-03 16:47:35 +01:00
Sebastian McKenzie
22cf1f8826 Merge pull request #63 from danez/performance-regression
Fix performance regression introduced in 6.8.2
2016-07-03 16:46:44 +01:00
Daniel Tschinder
4e2072def8 Fix performance regression introduced in 6.8.2
This commit e6c11a0 (#19) made a big performance regression.
The reason was that parseConditional was always cloning the current state
even if no question mark (potential conditional or flow-optional
token) was at the current position.
Simply checking if questionmark matches the current token solves the problem.

Fixes #62
2016-07-03 11:52:01 +02:00
Daniel Tschinder
84b1bc52e1 Ensure that build directories are not included in release 2016-06-30 00:59:43 +02:00
Daniel Tschinder
b02dba8d24 Ignore build directory in eslint 2016-06-30 00:55:03 +02:00
Daniel Tschinder
5a74dedeb6 Remove cache because of outdated versions on travis 2016-06-30 00:34:35 +02:00
Daniel Tschinder
7593b802ae Enable babel tests on travis 2016-06-30 00:26:36 +02:00
Daniel Tschinder
5e1e1d296a Merge pull request #56 from babel/hzoo-patch-1
6.8.1 changelog [skip ci]
2016-06-29 19:42:37 +02:00
Henry Zhu
4dd64dbe0f 6.8.1 changelog [skip ci] 2016-06-24 14:43:37 -04:00
Sebastian McKenzie
376fb835b9 6.8.2 2016-06-24 18:36:50 +01:00
Sebastian McKenzie
d976b56bbe Merge pull request #54 from gabelevi/arrow
[Flow] Arrow function type parameter declarations
2016-06-24 18:36:07 +01:00
Gabe Levi
22374b6bec [Flow] Arrow function type parameter declarations 2016-06-24 10:34:09 -07:00
Sebastian McKenzie
f30f1942b6 Merge pull request #55 from vkurchatkin/gen-getset
flow: allow generic method with name get or set
2016-06-24 18:24:27 +01:00
Vladimir Kurchatkin
f0c7660980 move logic to flow plugin 2016-06-24 20:23:02 +03:00
Vladimir Kurchatkin
d5f75cb2f0 flow: allow generic method with name get or set 2016-06-24 19:47:30 +03:00
Sebastian McKenzie
cde17b33bd Merge branch 'master' of github.com:babel/babylon 2016-06-22 15:28:24 +01:00
Henry Zhu
3f266691a8 fix ast links again [skip ci] 2016-06-22 09:54:05 -04:00
Sebastian McKenzie
59537a473b Merge pull request #50 from jmm/ast-spec-link
Fix link to AST spec
2016-06-22 14:49:06 +01:00
Jesse McCarthy
6dac2afd43 Fix link to AST spec
[ci skip]
2016-06-22 09:46:26 -04:00
Sebastian McKenzie
cf6e0d365e rename parser context types 2016-06-22 14:06:58 +01:00
Henry Zhu
c8e35ee70a Test on node 6, remove iojs 2016-06-22 08:58:39 -04:00
Henry Zhu
dcc3b981f9 rm extraneous text [skip ci] 2016-06-22 08:55:41 -04:00
Sebastian McKenzie
0b58ad29ab Merge pull request #46 from babel/ast-spec
Move ast spec from babel/babel [skip ci]
2016-06-22 13:54:05 +01:00
Sebastian McKenzie
b0236b8ede Merge pull request #47 from babel/hzoo-patch-1
Update Output, change links [skip ci]
2016-06-22 13:53:56 +01:00
Sebastian McKenzie
35b6c09f8f Merge pull request #45 from mathiasbynens/unicode-9
Update to Unicode v9
2016-06-22 13:53:25 +01:00
Henry Zhu
2d4c117485 Update Output, change links [skip ci] 2016-06-22 08:50:48 -04:00
Sebastian McKenzie
3524ad510f remove grouped type arrow restriction as it seems flow no longer has it - fixes #44 2016-06-22 13:43:32 +01:00
Henry Zhu
be7d968903 Move ast spec from babel/babel [skip ci] 2016-06-22 08:39:29 -04:00
Mathias Bynens
b7ed4f5d12 Update to Unicode v9 2016-06-22 14:35:19 +02:00
Sebastian McKenzie
f63802c716 add missing generate-identifier-regex script - fixes #7 2016-06-22 13:24:35 +01:00
Sebastian McKenzie
4ca3cd8d1a remove line terminator restriction after await keyword - fixes #38 2016-06-22 13:18:43 +01:00
Sebastian McKenzie
43e01e40f1 upgrade ava 2016-06-22 13:17:31 +01:00
Sebastian McKenzie
ec0a349ec8 support negative numeric type literals - fixes T7450 2016-06-22 13:17:27 +01:00
Sebastian McKenzie
96a7eadbe4 Merge branch 'danez-fix-flow-optional-type' 2016-06-22 12:52:55 +01:00
Sebastian McKenzie
461261b181 Merge branch 'fix-flow-optional-type' of https://github.com/danez/babylon into danez-fix-flow-optional-type
# Conflicts:
#	src/plugins/flow.js
2016-06-22 12:52:42 +01:00
Sebastian McKenzie
74ee30bfbe Merge pull request #21 from danez/test-babel
Test babel with dev babylon
2016-06-22 12:45:05 +01:00
Sebastian McKenzie
78597290ec Merge pull request #23 from danez/fix-comments
Fix leading comments added from previous node
2016-06-22 12:44:12 +01:00
Sebastian McKenzie
55d47ab7b4 Merge pull request #41 from nene/ast-spec
Document AST differences from ESTree
2016-06-22 12:43:41 +01:00
Sebastian McKenzie
4d2e1dddfb Merge pull request #10 from danez/fix-flow-arrow-spread
Fix flow plugin when flow+arrow+spread used together
2016-06-22 12:36:52 +01:00
Daniel Tschinder
f11a82c96c Adjust cloning of nodes in import/export-specifiers and obj-destructuring (#24)
The cloning caused comments that where added to the original node to be persisted into
the cloned node.
Espree/Acorn does not have any cloning, that's why it is working there.
This change omits comments when cloning, as removing the cloning
causes tests in babel to fail.
2016-06-21 09:55:15 -04:00
Sebastian McKenzie
92d45c3f6c Merge pull request #16 from danez/enable-tests
Enable deactivated tests
2016-06-21 00:03:38 +01:00
Sebastian McKenzie
8977d8c75a Merge pull request #31 from eldereal/master
Allow use react elements after yield statement
2016-06-20 22:50:36 +01:00
calebmer
a25a4ffdc1 Add JSX spread children 2016-06-19 10:48:20 -04:00
Rene Saarsoo
d7dc857bbf Document AST deviations from ESTree spec
Refs #40
2016-06-18 11:05:48 +03:00
Rene Saarsoo
dd8856d5cc Correct Options heading level in README 2016-06-18 10:30:55 +03:00
Sebastian McKenzie
ca6450b057 6.8.1 2016-06-06 19:21:21 +01:00
Sebastian McKenzie
1c48c4c9db Merge pull request #25 from gabelevi/default
Support defaults in Flow's type parameter declarations
2016-05-17 01:00:49 +01:00
Yiyuan Bai
de56e12c68 Allow use react elements after yield statement 2016-05-12 18:41:41 +08:00
Henry Zhu
21c4b4d779 6.8.0 changelog (#27) 2016-05-04 10:05:58 -04:00
Henry Zhu
6ef4a731b7 6.8.0 2016-05-04 10:04:32 -04:00
Henry Zhu
d4cd0bf7b7 Actually remove it.. 2016-05-02 22:44:50 -04:00
Henry Zhu
c81db57b03 Remove unused file
Ref f81c281fc4 (commitcomment-17331315)
2016-05-02 22:43:47 -04:00
Gabe Levi
fe5193a40a Support defaults in Flow's type parameter declarations
The primary goal of this commit is to add the ability to parse type parameter
declarations with defaults, like `type Foo<T = string> = T`. While I was in the
code, I fixed a few small things, like

* Type parameter declarations need 1 or more type parameters.
* The existential type `*` is not a valid type parameter.
* The existential type `*` is a primary type
* The param list for type parameter declarations now consists of
  `TypeParameter` nodes
2016-04-27 16:12:10 -04:00
Daniel Tschinder
4bfececdad Fix leading comments added from previous node
This fixes an issue that comments were added as leading comments
to expressions, which are not immediately folowing the comment.
This was also reported and fixed in espree, and is basically a port to
babylon. eslint/espree#256

this also fixes an issue in babel-eslint with certain rules babel/babel-eslint#289
2016-04-23 12:24:20 +02:00
Daniel Tschinder
91b818d486 Add Makefile that makes it able to test babel with current babylon 2016-04-17 22:16:15 +02:00
Daniel Tschinder
e6c11a0673 Fix support for flow optional parameters in arrow functions T7096
This overwrites the conditional handling in babylon for flow to support
optional parameters in arrow functions.
2016-04-10 13:06:48 +02:00
Sebastian McKenzie
b926e401c6 Merge pull request #17 from zenparsing/master
Parse for-await statements when asyncGenerators plugin is active
2016-04-05 18:42:44 +01:00
Kevin Smith
f81c281fc4 Parse for-await statements when asyncGenerators plugin is active 2016-04-05 13:33:49 -04:00
Daniel Tschinder
bb6586d1e6 Enable deactivated tests, as it seems they work now 2016-04-04 18:22:10 +02:00
Daniel Tschinder
d15a2310cd Fix flow plugin when flow+arrow+spread used together
The fix includes creating a new method on the parser called `parseArrow`.
This new function by default only checks if current position matches an
arrow. If it does returns the `node` otherwise `undefined`.
The flow plugin can then extend this function and correctly parse the typeAnnotation
and add it to the node.

With this change, in the flow plugin there is no need anymore to extend
`parseParenAndDistinguishExpression` and the arrow handling in `parseParenItem`
could also be removed, because it is all handled now in `parseArrow`.

Some existing tests were failing, because `extra->parentesized` is now missing,
but this is correct as it is now inline with parsing without flow annotation. No extra
is added for arrow function without type annotations.

In the expression-parser `this.next()` was replaced by a more specific
`this.expect(tt.parenL)`.
2016-04-04 18:10:58 +02:00
Sebastian McKenzie
8b150813f5 Merge pull request #12 from shuhei/parameter-decorators
Parse parameter decorators
2016-03-28 22:14:15 +01:00
Shuhei Kagawa
29a6578658 parse parameter decorators 2016-03-25 14:04:33 +09:00
Sebastian McKenzie
6b14e4cb91 Merge pull request #2 from babel/travis-badge
Add travis badge
2016-03-10 14:57:01 +00:00
Sebastian McKenzie
695109d505 t push
Merge branch 'master' of github.com:babel/babylon
2016-03-10 14:48:51 +00:00
Sebastian McKenzie
2115a28b40 add lodash to dev deps 2016-03-10 14:48:46 +00:00
Henry Zhu
e31dd18750 Add travis badge 2016-03-10 09:45:41 -05:00
Sebastian McKenzie
b75f175863 Merge pull request #1 from babel/hzoo-patch-1
don't ignore compiled files
2016-03-10 13:31:47 +00:00
Henry Zhu
a47286ba2b don't ignore compiled files 2016-03-10 08:28:33 -05:00
Sebastian McKenzie
64ff4c3561 first commit 2016-03-10 06:24:44 +00:00
Amjad Masad
f8e33840b0 v6.7.0 2016-03-08 16:52:45 -08:00
Amjad Masad
6b498d7e5a Merge pull request #3323 from divmain/master
Source-map support for multiple input source files
2016-03-07 11:57:59 -08:00
Dale Bustad
bb4919500c Attach filename property to node.loc when provided. 2016-03-07 02:47:28 -08:00
Sam Goldman
b85d6c7e4a Add support for Flow def-site variance syntax
This syntax allows you to specify whether a type variable can appear in
a covariant or contravariant position, and is super useful for, say,
Promise.

Right now this is hacked in jankily, but in the next major release we
should stop using Identifier nodes for type parameters.
2016-03-06 14:44:09 -08:00
Henry Zhu
6adbe96bf1 v6.6.5 2016-03-04 18:16:17 -05:00
Amjad Masad
aca8010438 Remove remaining @flow annotations 2016-03-03 15:10:59 -08:00
Amjad Masad
b5315d4b27 Revert "Remove Flow annotations and pragmas"
This reverts commit 4252244d06.
2016-03-03 15:03:55 -08:00
Amjad Masad
9a180797c0 Revert "Remove flow"
This reverts commit 2827ff6b01.
2016-03-03 14:49:20 -08:00
Henry Zhu
5b7fa17cbe v6.6.4 2016-03-02 16:29:17 -05:00
Sam Goldman
d6ee428857 Remove flow 2016-03-01 22:33:30 -08:00
Henry Zhu
48e8db2247 v6.6.0 2016-02-29 16:12:12 -05:00
Sam Goldman
08249b29e4 Remove weird codemod artifact 2016-02-28 13:23:28 -10:00
Sam Goldman
085361ad1a Remove Flow annotations and pragmas 2016-02-28 13:18:57 -10:00
Logan Smyth
5f94206382 Merge pull request #3355 from loganfsmyth/babylon-browserifiable
Clean up babylon bundle to allow it to be re-bundled - fixes T6930
2016-02-22 08:50:06 -08:00
Sebastian McKenzie
31f3eba4c1 Merge pull request #3361 from babel/klint
Switch to klint, fix some lint rules
2016-02-14 23:26:30 +00:00
Sebastian McKenzie
c9f9435445 Switch to klint, fix some lint rules 2016-02-14 23:25:14 +00:00
Logan Smyth
40e5f505f4 Properly fail to parse >== and <== - fixes T2921 2016-02-13 10:08:05 -08:00
Logan Smyth
19de6dea3d Clean up babylon bundle to allow it to be re-bundled - fixes T6930 2016-02-12 22:48:00 -08:00
Henry Zhu
13cb34a966 v6.5.2 2016-02-12 11:29:58 -05:00
Henry Zhu
2e73358fcc Add class properties test with a generator method that results in a parse error 2016-02-11 13:03:36 -05:00
Logan Smyth
88a67773e6 Merge pull request #3332 from loganfsmyth/revert-prop-semi
Revert to standard ASI behavior for class properties
2016-02-10 22:40:44 -07:00
Logan Smyth
abd39d688e Add tests for class property ASI. 2016-02-06 23:01:38 -08:00
Logan Smyth
0c35bbfc07 Revert "babylon: throw parse error if class properties do not have a semicolon (fixes T6873)"
This reverts commit 976edfc067.
2016-02-06 18:36:31 -08:00
Logan Smyth
d9ade8a63a Revert "babylon: fix error location for class properties with a missing semicolon"
This reverts commit f31099f383.
2016-02-06 18:36:22 -08:00
Henry Zhu
8d241c9c40 v6.5.0 2016-02-06 19:06:41 -05:00
Amjad Masad
024cba6433 Merge pull request #3305 from jviereck/T7052
Fix: Arrow functions with trailing comma + return type are throwing an error when parsing
2016-02-05 13:50:57 -08:00
Jeff Morrison
acc946c09e Add support for leading pipes in Flow type alias RHS syntax 2016-02-05 13:23:55 -05:00
Henry Zhu
5f0ece0bdb add some more flow types 2016-02-04 11:07:03 -05:00
Julian Viereck
a121d1b7b5 Fix and tests 2016-01-31 01:22:31 +01:00
Henry Zhu
97fd9d65e7 v6.4.5 2016-01-19 18:02:31 -05:00
Bradley Farias
b6f5b6ab11 fix flow for babylon 2016-01-19 13:01:26 -06:00
Chris Cowan
d425927ff1 Make babylon ignore duplicate plugins. 2016-01-15 19:29:21 -08:00
Chris Cowan
9c75f27240 Make Babylon correctly handle "flow" being present multiple times in plugins. 2016-01-15 19:00:38 -08:00
Henry Zhu
98504720df v6.4.2 2016-01-06 21:26:43 -05:00
Henry Zhu
2f00b4c329 babylon: fix error location for class properties with a missing semicolon 2016-01-06 18:42:26 -05:00
Henry Zhu
359b8533b6 v6.4.0 2016-01-06 15:34:12 -05:00
Sebastian McKenzie
6c79639801 Merge pull request #3225 from hzoo/cp-semi
`babylon`: throw parse error if class properties do not have a semico…
2016-01-06 15:22:37 +00:00
Sam Goldman
541b576c7a Guard export interface against isExportDefaultSpecifier 2016-01-05 17:28:21 -08:00
Sam Goldman
a04948f70f Add export interface Flow syntax support
An interface export is just like a type export. In fact, it's a syntax affordance which makes the following equivalent:

```javascript
interface I_ { ... }
export type I = I_;
```

```javascript
export interface I { ... }
```

See facebook/flow#1145
2016-01-05 15:57:45 -08:00
Sam Goldman
bd5c1a5b1b Add support for "declare interface" Flow syntax
This has been a feature in Flow for a long time (couldn't easily find a
specific commit adding this). Interfaces are basically undocumented, though, so
it's easy to see how this was missed.
2016-01-04 11:50:12 -08:00
Sam Goldman
0980819346 Add support for "declare type" Flow syntax
See facebook/flow#1105
2016-01-04 11:42:43 -08:00
Henry Zhu
e849c62144 babylon: throw parse error if class properties do not have a semicolon (fixes T6873) 2015-12-30 14:01:46 -05:00
Jesse McCarthy
b1da92e8cb Don't make directive from parenthesized string. 2015-12-28 11:04:33 -05:00
Jesse McCarthy
c5a8d4c5b0 Add non-directive fixture.
(Failing.)
2015-12-28 11:04:33 -05:00
Sebastian McKenzie
326e157e5d Merge pull request #3203 from samwgoldman/flow-mixins-6.x
Add support for mixins to Babel 6.x
2015-12-27 21:04:40 +00:00
Sebastian McKenzie
c72ef3755a stop people from patching babylon by building it 2015-12-24 03:58:52 +00:00
Sam Goldman
137abcaf7a Add support for mixins to Babel 6.x 2015-12-23 16:09:12 -05:00
Sam Goldman
f0fd729883 Add support for this type to Babel 6.x 2015-12-23 13:54:57 -05:00
Amjad Masad
939ad92deb v6.3.26 2015-12-22 23:11:59 -08:00
Amjad Masad
1d82e48d36 Merge pull request #3190 from hzoo/remove-await-star
Remove await* from babel-generator, add parsing error to babylon - (fixes T6688)
2015-12-22 22:57:23 -08:00
Henry Zhu
c7bdf7fc63 remove all property, fixup tests 2015-12-23 00:02:02 -05:00
Amjad Masad
75e2a398af v6.3.25 2015-12-21 13:59:11 -08:00
Henry Zhu
7bac3627fe Remove await* from babel-generator, add parsing error to babylon - (fixes T6688) 2015-12-19 23:15:09 -05:00
TSUYUSATO Kitsune
8d8f75a5b8 Fix ignoring previous strict mode after twice "use strict"
For example:

    var foo = function () {
      "use strict";
      "use strict";
      // there is inside of strict mode,
      // so `0123` (octal number) occurs a syntax error.
    };
    // there is outside of strict mode,
    0123; // so left is valid syntax.
    // however:
    //   SyntaxError: Invalid number (8:0)

I fixed it and add the test case.
2015-12-19 09:26:10 +09:00
Amjad Masad
2304ce0b4a v6.3.21 2015-12-18 00:23:03 -08:00
Marshall Roch
4a140af08d Upgrade to flow 0.20.0 2015-12-17 12:49:48 -08:00
Amjad Masad
f350853db9 v6.3.20 2015-12-16 12:24:45 -08:00
Henry Zhu
fa23b4359b add functionBind to babylon plugins readme 2015-12-16 09:47:08 -05:00
Amjad Masad
b0eb0f3ff9 v6.3.18 2015-12-13 23:01:37 -08:00
Sebastian McKenzie
694ad8eb8a Merge pull request #3107 from MakeNowJust/fix/t6675-2
Fixed T6675
2015-12-12 01:30:05 +11:00
Henry Zhu
15e02657fa v6.3.15 2015-12-06 11:31:46 -05:00
Henry Zhu
d833e8bbee eslint: add space-after-keywords 2015-12-06 11:30:07 -05:00
Henry Zhu
b3de3c2514 v6.3.14 2015-12-04 13:52:36 -05:00
Sebastian McKenzie
80a10e144b Merge branch 'master' of github.com:babel/babel 2015-12-04 23:17:11 +11:00
Sebastian McKenzie
e81a5dc8fe v6.3.13 2015-12-04 22:56:51 +11:00
Sebastian McKenzie
a5cd87c401 v6.3.12 2015-12-04 22:56:13 +11:00
Amjad Masad
8716fb6f3f Test name, and remove todos 2015-12-04 00:12:37 -08:00
Amjad Masad
e3da84bcc3 Add support for null literal type 2015-12-03 23:58:25 -08:00
Amjad Masad
5a15231cfe v6.3.0 2015-11-30 14:58:30 -08:00
TSUYUSATO Kitsune
dc596d73d3 Fixed T6675
https://phabricator.babeljs.io/T6675.
2015-11-24 22:39:50 +09:00
Aliaksei Shytkin
5e987cd46e Make arrow functions to work with multiple args and flow return type (fixes T2422) 2015-11-23 15:20:16 +03:00
Sebastian McKenzie
59ec2b2dfb v6.2.0 2015-11-18 20:33:47 -08:00
Sebastian McKenzie
d79d0cf73d add function.sent 2015-11-17 23:02:21 -08:00
Daniel Lo Nigro
20a483cd58 Fix Flow.
Removed `@flow` annotation from files that don't actually pass Flow check at the moment. These will be added back file by file once the files are properly converted to use Flow.

Closes #3064
2015-11-15 21:30:22 -08:00
Sebastian McKenzie
a3fe3933da v6.1.21 2015-11-13 16:57:03 -08:00
Jesse McCarthy
81edfcbd93 Correct option name: features => plugins. 2015-11-13 10:25:40 -05:00
Sebastian McKenzie
c985006597 v6.1.20 2015-11-13 03:38:54 -08:00
Jordan Klassen
021688e1c0 Remove unused second parameter of isIdentifierStart 2015-11-12 22:45:35 -08:00
Sebastian McKenzie
3017999b3c v6.1.18 2015-11-12 13:46:30 -08:00
Sebastian McKenzie
7625e61b97 v6.1.17 2015-11-12 13:40:25 -08:00
Sebastian McKenzie
e28e01bb86 v6.1.16 2015-11-12 13:33:20 -08:00
Sebastian McKenzie
d2fdd1f673 v6.1.15 2015-11-12 12:15:47 -08:00
Sebastian McKenzie
a2aa3583b6 v6.1.14 2015-11-12 12:01:18 -08:00
Sebastian McKenzie
8f9c531531 v6.1.13 2015-11-12 11:57:45 -08:00
Sebastian McKenzie
2ee4960944 v6.1.12 2015-11-12 00:47:51 -08:00
Sebastian McKenzie
903201af31 v6.1.11 2015-11-11 23:58:22 -08:00
Sebastian McKenzie
4b2194e793 v6.1.10 2015-11-11 23:52:57 -08:00
Sebastian McKenzie
b65774993d v6.1.9 2015-11-11 23:46:00 -08:00
Sebastian McKenzie
1165090c58 v6.1.8 2015-11-11 23:40:20 -08:00
Sebastian McKenzie
d52985f575 v6.1.7 2015-11-11 23:37:19 -08:00
Sebastian McKenzie
f37616c5fd v6.1.6 2015-11-11 23:32:43 -08:00
Sebastian McKenzie
7d4a603356 v6.1.5 2015-11-11 23:30:14 -08:00
Sebastian McKenzie
e5d3eed9f0 v6.1.10 2015-11-11 23:28:53 -08:00
Sebastian McKenzie
398eb606df v6.1.9 2015-11-11 23:27:56 -08:00
Sebastian McKenzie
6e01f3cbc0 v6.1.5 2015-11-11 22:48:30 -08:00
Sebastian McKenzie
6ca969684e v6.1.4 2015-11-11 02:04:26 -08:00
Sebastian McKenzie
dfd9316e27 abstract out test runner into a module, move traceur and esnext tests to babel-preset-es2015, clean up and make existing tests more consistent 2015-11-08 21:58:01 -08:00
Sebastian McKenzie
bbfb599be2 fix __proto__ clashes in parser in old v8 2015-11-08 05:34:11 -08:00
Sebastian McKenzie
c06576497b v6.1.2 2015-11-05 11:10:22 +00:00
Sebastian McKenzie
779675610f fix defaults on type annotated arrow function params - fixes #2493 2015-11-05 09:49:03 +00:00
Sebastian McKenzie
2b6f78df83 fix existential type param parsing 2015-11-03 20:04:55 +00:00
Sebastian McKenzie
4016bae694 add ExistentialTypeParam - fixes #2587 2015-11-03 13:48:03 +00:00
Sebastian McKenzie
c3b1b25966 simplify Parser::semicolon method 2015-11-03 11:46:11 +00:00
Sebastian McKenzie
14ca4d1dc9 add lineBreak test to tt.name.updateContext - fixes #2591 2015-11-03 11:46:01 +00:00
Sebastian McKenzie
3b3c1897d0 add support for async generator concise methods - fixes #2603 2015-11-03 11:19:04 +00:00
Sebastian McKenzie
cbe94f4653 fix object rest/spread in arrow function params - fixes #2631 2015-11-03 11:14:12 +00:00
Sebastian McKenzie
924423123b v6.0.18 2015-11-03 01:23:11 +00:00
Sebastian McKenzie
ea40d0134f rename NumberLiteral to NumericLiteral and RegexLiteral to RegExpLiteral 2015-11-03 01:19:35 +00:00
Sebastian McKenzie
87bb8a84f3 v6.0.17 2015-11-02 19:53:45 +00:00
Sebastian McKenzie
c2973d0c7a disallow invalid async function forms inside object literals - fixes #2629 2015-11-02 08:00:01 +00:00
Sebastian McKenzie
7fabc4c83d v6.0.14 2015-10-30 23:30:40 +00:00
Sebastian McKenzie
3d842df554 update exponentiation operator precedence - fixes #2431 2015-10-30 23:14:10 +00:00
Sebastian McKenzie
c224a7a370 fix parser bug where arrow functions have a higher precedence than they should - fixes #2118 2015-10-30 22:50:53 +00:00
Sebastian McKenzie
37294c3c0a Merge branch 'master' of github.com:babel/babel 2015-10-30 19:17:19 +00:00
Sebastian McKenzie
466f22afff fix babel-runtime dependencies - fixes #2655 2015-10-30 19:16:42 +00:00
James Kyle
19d1b53fc5 Update package.json 2015-10-30 11:38:02 -07:00
Sebastian McKenzie
470d5738e1 Merge branch 'development'
Conflicts:
	VERSION
	packages/babel-cli/package.json
	packages/babel-generator/src/buffer.js
	packages/babel-runtime/package.json
	packages/babel-traverse/src/scope/index.js
	packages/babel-types/src/validators.js
	packages/babel/package.json
	packages/babel/src/generation/generators/expressions.js
	packages/babel/src/generation/generators/statements.js
	packages/babel/src/transformation/transformers/es6/tail-call.js
	packages/babel/src/transformation/transformers/es7/async-functions.js
	packages/babel/src/transformation/transformers/es7/exponentiation-operator.js
	packages/babel/src/types/retrievers.js
	packages/babel/test/fixtures/transformation/es6.tail-call/default-parameters/expected.js
	packages/babel/test/fixtures/transformation/es6.tail-call/factorial/expected.js
	packages/babel/test/fixtures/transformation/es6.tail-call/max-args/expected.js
	packages/babel/test/fixtures/transformation/es6.tail-call/recursion/expected.js
	packages/babylon/package.json
2015-10-30 00:48:36 +00:00
Sebastian McKenzie
d7610ef9b0 v6.0.2 2015-10-29 18:06:55 +00:00
Sebastian McKenzie
32ef6b465b v6.0.0 2015-10-29 18:02:15 +00:00
Sebastian McKenzie
b909a81ab7 6.0.0
I'm extremely stupid and didn't commit as I go. To anyone reading this
I'm extremely sorry. A lot of these changes are very broad and I plan on
releasing Babel 6.0.0 today live on stage at Ember Camp London so I'm
afraid I couldn't wait. If you're ever in London I'll buy you a beer
(or assorted beverage!) to make up for it, also I'll kiss your feet and
give you a back massage, maybe.
2015-10-29 17:51:24 +00:00
Sebastian McKenzie
543378b81f v5.8.29 2015-10-24 17:26:54 +01:00
Sebastian McKenzie
d0b584fd13 add filename to babylon test errors 2015-10-05 16:40:55 +01:00
Sebastian McKenzie
9908dc6f50 update babylon tests 2015-10-05 16:40:43 +01:00
Sebastian McKenzie
6d6ddf0bcd type annotate babylon 2015-09-23 15:59:41 +01:00
Sebastian McKenzie
0612f69141 flesh out babylon readme 2015-09-15 06:25:52 +01:00
Sebastian McKenzie
f3a016df30 add babel-runtime to babylon dependencies 2015-09-15 06:20:21 +01:00
Sebastian McKenzie
446cc3e869 add babylon description 2015-09-15 06:20:03 +01:00
Sebastian McKenzie
fc87af4c81 add dead simple babylon bin 2015-09-15 06:19:49 +01:00
Sebastian McKenzie
e8fa03ea1c add parser util addExtra method 2015-09-15 06:19:35 +01:00
Sebastian McKenzie
bf841c7e27 use extra.parenthesized rather than parenthesizedExpression 2015-09-15 06:19:26 +01:00
Sebastian McKenzie
d1ecb04d0f add hasFeature util method 2015-09-15 06:18:23 +01:00
Sebastian McKenzie
40aab69ed0 remove weird acorn conditional formatting 2015-09-15 06:18:15 +01:00
Sebastian McKenzie
9e264e70ae only allow identifiers as rest expressions 2015-09-15 06:18:04 +01:00
Sebastian McKenzie
54a4f16b08 add RestProperty node 2015-09-15 06:17:45 +01:00
Sebastian McKenzie
c5e2e4d39e loop over all directives to check for use strict 2015-09-15 06:16:57 +01:00
Sebastian McKenzie
c892cae6af use hasFeature rather than directly looking up options 2015-09-15 06:16:46 +01:00
Sebastian McKenzie
415752dbb7 add directives property to Program and BlockStatement 2015-09-15 06:16:07 +01:00
Sebastian McKenzie
59948c6649 add babylon hasFeature util method 2015-09-15 06:15:19 +01:00
Sebastian McKenzie
ae85fc0251 rename features in babylon tests 2015-09-15 06:13:11 +01:00
Sebastian McKenzie
069b969b1d make export default anoynmous class/function statements - fixes #2205 2015-09-01 05:34:11 +01:00
Sebastian McKenzie
446b297465 unoverload Literal AST node 2015-09-01 04:49:16 +01:00
Sebastian McKenzie
4088d85e32 Merge branch 'master' into development
Conflicts:
	packages/babel/package.json
	packages/babel/src/traversal/scope/index.js
2015-08-27 16:42:21 -07:00
Sebastian McKenzie
a20a926de1 v5.8.23 2015-08-27 16:38:34 -07:00
Sebastian McKenzie
d97240ae09 Merge remote-tracking branch 'origin/master' into development
Conflicts:
	packages/babel/scripts/build-dist.sh
2015-08-27 11:12:00 -07:00
Cesar Andreu
bc59b09f6b Start ObjectTypeProperty's optional property as false in each loop 2015-08-27 00:07:26 -04:00
Cesar Andreu
60f4003345 Add failing flow ObjectTypeProperty test 2015-08-26 06:51:12 -04:00
Sebastian McKenzie
6e24626482 fix weird legacy acorn formatting 2015-08-24 15:31:41 -04:00
Sebastian McKenzie
032ca7ae1c never attempt to represent regexes natively 2015-08-24 15:31:30 -04:00
Sebastian McKenzie
ac9ee75dac parser: don't mutate or clone state arrays when doing a lookahead - fixes #2211 2015-08-15 19:07:42 -04:00
Sebastian McKenzie
860322f7b8 add more jsx tests 2015-08-12 02:57:18 +01:00
Sebastian McKenzie
8887444cf7 fix various bugs surfaced by the esprima test suite, remove some incorrect tests 2015-08-11 16:58:20 +01:00
Sebastian McKenzie
b7b43dc282 Merge branch 'master' into development 2015-08-11 01:05:04 +01:00
Sebastian McKenzie
87c604b64e v5.8.22 2015-08-11 01:00:54 +01:00
Sebastian McKenzie
df021c7f23 add esprima tests and fix bugs picked up by it 2015-08-11 00:59:15 +01:00
Henry Zhu
babf64473b fix broken test from regex-after-block 2015-08-10 19:31:26 -04:00
Henry Zhu
8f3615bf7b fix unexpected token issue for regex after block case
- Ex: `if (1) {} /foo/`

Fixes babel/babel-eslint#161
Ref marijnh/acorn#289
2015-08-10 19:03:13 -04:00
Sebastian McKenzie
c318c88050 forward all arguments to parseClassId in flow parser plugin 2015-08-10 13:10:32 +01:00
Sebastian McKenzie
b581a7590c fix export default function expression disambiguation - fixes #2189 2015-08-10 13:04:08 +01:00
Sebastian McKenzie
4fda34ce6f properly distinguish shorthand async keys that are the last property - fixes #2176 2015-08-06 19:33:48 +01:00
Sebastian McKenzie
5ec9f78493 fix patterns with async keys - fixes #2171 2015-08-05 23:22:31 +01:00
Sebastian McKenzie
9826be30cc Merge branch 'master' of github.com:babel/babel 2015-08-05 22:45:00 +01:00
Sebastian McKenzie
68e70e55e2 v5.8.21 2015-08-05 22:22:57 +01:00
Sebastian McKenzie
226bf3f80d style nits 2015-08-05 21:45:22 +01:00
Sebastian McKenzie
79c62ded0a remove operator property from AssignmentPattern 2015-08-05 21:45:11 +01:00
Sebastian McKenzie
71bbffa797 fix handling of flow method shorthand - fixes #2169 2015-08-05 21:42:15 +01:00
Naman Goel
b5c4dcb7ae fix typos
Found some typos while reading the code.
2015-08-05 00:26:52 +02:00
Sebastian McKenzie
94e345e0b2 check valid function/class token when parsing export default before converting to a declaration - fixes #2145 2015-08-02 21:36:52 +01:00
Sebastian McKenzie
a0f9d5fbc8 add support for export types 2015-07-31 23:34:45 +01:00
Sebastian McKenzie
c050722611 v5.8.20 2015-07-31 21:24:00 +01:00
Sebastian McKenzie
9ccbc89653 put containsEsc on state rather than as a local variable 2015-07-31 12:44:54 +01:00
Sebastian McKenzie
b1c3ed6d2d fix linting error and add missing tests 2015-07-30 23:47:59 +01:00
Sebastian McKenzie
1d81dd995c add support for boolean flow literals - fixes #2127 2015-07-30 23:44:36 +01:00
Sebastian McKenzie
c91c2eb748 add acorn license - cc @RReverser 2015-07-30 12:57:23 +01:00
Sebastian McKenzie
53952cb765 fix syntax error 2015-07-29 16:43:52 +01:00
Sebastian McKenzie
ffee5615e4 clear rawValue from JSX attribute values as they're tokenised and parsed differently - fixes #2114 2015-07-29 16:15:47 +01:00
Sebastian McKenzie
4945b8e6f6 v5.8.19 2015-07-29 13:32:27 +01:00
Sebastian McKenzie
0888686eb1 v5.8.18 2015-07-29 13:30:00 +01:00
Sebastian McKenzie
a6fabeebaa v5.8.17 2015-07-29 13:28:24 +01:00
Sebastian McKenzie
361c6970c0 v5.8.13 2015-07-28 13:41:00 +01:00
Sebastian McKenzie
c966885157 Merge branch 'development'
cially if it merges an updated upstream into a topic branch.
2015-07-28 09:10:49 +01:00
Sebastian McKenzie
a998fa308b v5.8.12 2015-07-28 01:38:31 +01:00
Logan Smyth
c60ffdef7b Ensure that the original state is restored on lookahead - fixes #2086 2015-07-26 20:56:07 -07:00
Sebastian McKenzie
a96b9e1afa v5.8.9 2015-07-27 00:14:29 +01:00
Sebastian McKenzie
e6e3a68a39 make flow transformer use internal state to track whether we're in a type or not - fixes #2083 2015-07-27 00:06:26 +01:00
Sebastian McKenzie
2eebf8f5e0 v5.8.8 2015-07-26 22:07:32 +01:00
Sebastian McKenzie
c42f1974da v5.8.7 2015-07-26 21:59:55 +01:00
Sebastian McKenzie
0bbe94c38b really fix comment attachment 2015-07-26 21:58:22 +01:00
Sebastian McKenzie
04ce3db23b add back missing comment fix - fixes #2072 2015-07-26 21:56:28 +01:00
Sebastian McKenzie
a571907c5d v5.8.6 2015-07-26 21:50:46 +01:00
Sebastian McKenzie
6ef86f67f4 update jsx tests 2015-07-26 05:34:03 +01:00
Sebastian McKenzie
671196dffa remove rawValue property from JSX inner text Literal nodes 2015-07-26 05:30:27 +01:00
Sebastian McKenzie
e229f8ea55 remove gross acorn conditional statement styling 2015-07-26 05:22:33 +01:00
Sebastian McKenzie
c2c8b2db57 add token match method and remove more dead code 2015-07-26 04:48:42 +01:00
Sebastian McKenzie
23aa7b002d improve babylon test coverage and remove dead code 2015-07-25 19:54:19 +01:00
Sebastian McKenzie
2948108c90 finish reorganisation of babylon 2015-07-25 08:03:39 +01:00
Sebastian McKenzie
e7fec51feb remove range property from nodes, clean up babylon codebase 2015-07-25 07:07:22 +01:00
Sebastian McKenzie
af03a301ae fix broken tests take 2 2015-07-25 06:16:50 +01:00
Sebastian McKenzie
0e9413e926 fix broken tests 2015-07-25 06:14:09 +01:00
Sebastian McKenzie
bed14e9b42 add espree comment attachment tests and remove ranges test property from babylon tests 2015-07-25 06:07:51 +01:00
Sebastian McKenzie
006f3db76a update babylon fixtures to use File as the root node rather than Program 2015-07-25 05:24:58 +01:00
Sebastian McKenzie
b088f8e6ef switch babylon tests to fixtures 2015-07-25 05:19:32 +01:00
Sebastian McKenzie
73ff38e35b check whether the last child is the same node as the one we're removing comments from - fixes #2072, fixes #2068 2015-07-25 02:16:31 +01:00
Sebastian McKenzie
ea479ca5a8 v5.8.5 2015-07-24 21:59:14 +01:00
Sebastian McKenzie
709f1421bc v5.8.4 2015-07-24 21:30:26 +01:00
Sebastian McKenzie
3023afcff4 Merge branch 'master' of github.com:babel/babel
t push# especially if it merges an updated upstream into a topic branch.
2015-07-21 22:44:54 +01:00
Chris Parker
6241742580 fix tryCreateRegexp function scope 2015-07-21 17:23:31 -04:00
Sebastian McKenzie
ba7b5ce5c8 v5.8.3 2015-07-21 18:22:42 +01:00
Sebastian McKenzie
4e4202ef73 v5.8.2 2015-07-21 18:11:11 +01:00
Sebastian McKenzie
ad4389b465 v5.7.5 2015-07-21 02:39:55 +01:00
Sebastian McKenzie
3c5b4f2d89 update flow literal annotations to have a rawValue 2015-07-21 02:37:43 +01:00
Sebastian McKenzie
da94ea7fa5 Merge branch 'master' into development 2015-07-21 02:28:00 +01:00
Sebastian McKenzie
ee04db074d properly disallow type casts in reference lists 2015-07-21 02:01:48 +01:00
Sebastian McKenzie
7f34827a72 reimplement async function type parameters backfix - fixes #2028 2015-07-21 01:13:35 +01:00
Sebastian McKenzie
0ca73d2474 add comment attachment to the parser and remove dead acorn options 2015-07-21 01:13:07 +01:00
Franky Chung
f3c7ef6707 Add number literal type annotations for flow 2015-07-20 11:35:46 +09:00
Sebastian McKenzie
9219b7f7bf don't return from within parseSubscripts when we parse an async arrow function - fixes #2027 2015-07-17 23:31:46 -07:00
Sebastian McKenzie
49f18bb8ba v5.7.2 2015-07-15 20:35:57 +01:00
Sebastian McKenzie
a84242386d flow parser plugin: move up startPos and startLoc default assignments 2015-07-15 20:33:56 +01:00
Sebastian McKenzie
043d007285 rewrite async function parsing, properly parse flow return types of arrow functions - fixes #1991 2015-07-15 20:08:10 +01:00
Sebastian McKenzie
a8b8482326 add feature flag for es7.exponentiationOperator 2015-07-15 18:07:25 +01:00
Sebastian McKenzie
2007469305 remove dead babylon code 2015-07-15 18:07:13 +01:00
Sebastian McKenzie
85cb123939 Merge branch 'master' into development 2015-07-15 17:10:58 +01:00
Sebastian McKenzie
6bcf98a3d5 v5.7.1 2015-07-15 17:09:26 +01:00
Sebastian McKenzie
b21db8a37e finish removal of ecmaVersion option 2015-07-15 16:41:32 +01:00
Sebastian McKenzie
bd2fb6126b remove ecmaVersion <= 6 2015-07-15 15:34:47 +01:00
Sebastian McKenzie
38553a6c42 switch node definitions to a DSL 2015-07-15 13:51:47 +01:00
Sebastian McKenzie
91cf6a823d v5.6.23 2015-07-15 11:23:07 +01:00
Sebastian McKenzie
04e152ac77 fix use strict parsing 2015-07-14 17:14:32 +01:00
Sebastian McKenzie
a0097e2ec8 add npmignore to babylon 2015-07-14 16:48:43 +01:00
Sebastian McKenzie
e9d0e55c39 sync tests with upstream acorn 2015-07-14 15:15:36 +01:00
Sebastian McKenzie
7c6de96ad7 elaborate on babylon readme 2015-07-14 15:14:57 +01:00
Sebastian McKenzie
ec6f919377 v5.6.21 2015-07-13 23:37:01 +01:00
Sebastian McKenzie
a3a19d73b3 2.6.20 2015-07-13 21:09:45 +01:00
Sebastian McKenzie
da9493e1fa Revert "remove do expressions"
This reverts commit 420492388b.
2015-07-13 20:45:49 +01:00
Sebastian McKenzie
1e77212efa remove do expressions 2015-07-13 16:37:08 +01:00
Sebastian McKenzie
6cc59a3ce7 t 2015-07-13 16:34:43 +01:00
Sebastian McKenzie
6c5c216c40 add scripts 2015-07-12 12:51:20 +01:00
Sebastian McKenzie
a1a1ad3d1c add missing semicolons 2015-07-12 00:36:21 +01:00
Sebastian McKenzie
a08c21302d Merge branch 'master' into top-secret
# Conflicts:
#	packages/babylon/src/options.js
#	src/acorn/plugins/flow.js
#	src/acorn/src/util.js
2015-07-11 21:04:33 +01:00
Sebastian McKenzie
ff6620c8ea more architectural changes 2015-07-11 20:56:26 +01:00
Sebastian McKenzie
423d8c510d Begin transition of Babel to a more scalable architecture, async flow to allow for RPC and better build system for multiple packages 2015-07-11 12:39:54 +01:00
cpojer
f757ca01a1 Add support for import typeof, fixes #1975 2015-07-11 01:54:25 -07:00
Sebastian McKenzie
04a29f8344 remove accidental stackTraceLimit assignment 2015-07-09 16:12:06 +01:00
Sebastian McKenzie
0da4ba4598 clean up inType tracking in flow parser plugin 2015-06-26 23:26:32 +01:00
Sebastian McKenzie
84c773a7ca add support for trailing commas in arrow function parameter lists - fixes #1841 2015-06-26 00:37:33 +01:00
Sebastian McKenzie
030d5f7c6b add labels, and inX properties to lookahead getState 2015-06-24 23:26:59 +01:00
Sebastian McKenzie
9e0cc028ed add inType assignment in flow parse declare method 2015-06-24 23:26:48 +01:00
Sebastian McKenzie
a7f669e154 fix isKeyword flow overload 2015-06-24 23:18:21 +01:00
Sebastian McKenzie
9a39b131ea acorn resync 2015-06-24 23:15:27 +01:00
Sebastian McKenzie
f5540d19a4 parse void as an identifier when inside a type annotation to avoid setting void keyword token - cc @DmitrySoshnikov 2015-06-24 23:15:00 +01:00
Sebastian McKenzie
5b5d27c9b8 resync with upstream acorn 2015-06-20 23:28:49 +01:00
Sebastian McKenzie
8ba270bde1 disallow line terminator after async contextual keyword - fixes #1711 2015-06-08 21:25:16 +01:00
Sebastian McKenzie
98b6effeef update template literal parsing to properly handle newlines 2015-06-05 09:36:37 +01:00
Sebastian McKenzie
f268049fdc check if es7.exportExtensions ie enabled in parser 2015-06-03 10:05:39 +01:00
Greg Hurrell
6f912edaab Add "mixed" Flow type
"mixed" is one of the base types listed here:

http://flowtype.org/docs/base-types.html

So this commit adds support for it.
2015-06-02 07:15:06 -07:00
Sebastian McKenzie
f6e7cf4a31 remove DoExpression statement parsing and clear labels and set inFunction to false when parsing DoExpression body - fixes #1658 2015-06-01 03:36:14 +01:00
Ingvar Stepanyan
4001a28983 Fix some parsing edge cases for :: operator. 2015-05-14 12:47:51 +03:00
Ingvar Stepanyan
b026927775 Add experimental support for ES7 function bind. (issue #1287) 2015-05-13 17:58:21 +03:00
Sebastian McKenzie
251a31a0fc sync with upstream acorn 2015-05-12 23:21:30 +01:00
Amjad Masad
f387715293 Allow trailing commas in methods 2015-05-12 13:20:36 -07:00
Sebastian McKenzie
0ae1943466 register as inside a type when parsing type aliases to avoid ambiguous jsx parsing - fixes #1378 2015-05-11 23:44:22 +01:00
Sebastian McKenzie
fe739b97dd fix acorn hacky lookahead with token contexts - fixes #1349 2015-05-11 23:20:51 +01:00
Amjad Masad
49077e2e03 New expressions is allowed to have trailing commas in es7 proposal 2015-05-08 19:12:53 -07:00
Christopher Monsanto
4ed4baac99 disallow async constructors -- fixes #1454 2015-05-06 02:50:11 -04:00
Sebastian McKenzie
8039772007 remove embedded jsx plugin and use acorn-jsx 2015-05-04 04:33:46 +01:00
Christopher Monsanto
c263a25b54 support commas as obj property separators in flow 2015-05-01 00:09:26 -04:00
Sebastian McKenzie
1a53d5ca46 upgrade to babel 5 2015-04-28 14:55:28 +01:00
Sebastian McKenzie
562dba872d fix spread properties in assignment position - fixes #1315 2015-04-21 16:24:34 +01:00
Sebastian McKenzie
5f1c3c3b8d remove unnecessary csp makePredicate - fixes #1267 2015-04-15 15:13:12 -07:00
Sebastian McKenzie
8ee54e0756 Mark function token as able to start an expression 2015-04-14 08:18:06 -07:00
Sebastian McKenzie
28589d459d make illegal LHS pattern error messages more user friendly 2015-04-13 16:40:13 -07:00
Sebastian McKenzie
075ff67aca make parenthesized array patterns illegal - cc @michaelficarra 2015-04-13 16:16:57 -07:00
Sebastian McKenzie
25a3bbce91 only make parenthesized object patterns illegal - fixes #1254, ref jshint/jshint#2269 2015-04-13 15:44:54 -07:00
Sebastian McKenzie
eed185c4dc remove useless kind on import declarations 2015-04-13 14:55:46 -07:00
Sebastian McKenzie
e15f8a79d6 make parsing of decorators stateless - fixes shuhei/babel-angular2-app#4 2015-04-13 08:26:51 -07:00
Sebastian McKenzie
7944e3b1fa Merge pull request #1215 from AluisioASG/es7-trailing-function-commas
ES7 trailing function commas
2015-04-12 19:17:02 -07:00
Sebastian McKenzie
85f2e79f95 add support for object literal decorators - fixes #1154 2015-04-11 16:30:55 -07:00
Sebastian McKenzie
82384f4761 parse await expression as a unary instead of an assignment - fixes #1225 2015-04-10 15:23:11 -07:00
Sebastian McKenzie
4f41b7c5e5 set canBeArrow to true when parsing async functions 2015-04-10 13:51:30 -07:00
Sebastian McKenzie
d0bf19681a update to latest acorn 2015-04-10 13:44:50 -07:00
Sebastian McKenzie
3b0b31ef9e don't emit tokens when doing a lookahead 2015-04-09 06:44:16 -07:00
Sebastian McKenzie
ab40459198 fix order of parameter type annotation parsing - fixes #1168 2015-04-06 06:19:13 -07:00
Aluísio Augusto Silva Gonçalves
58284c5002 [ES7] Trailing comma in function parameter list
Currenly a stage 1 proposal.
See https://github.com/jeffmo/es-trailing-function-commas.
2015-04-06 09:10:44 -03:00
Sebastian McKenzie
a2a8ebbe95 fix missing this in acorn parseExprAtom 2015-04-05 03:26:41 +10:00
Sebastian McKenzie
9a3e36055d fix es7 export extensions compound list 2015-04-01 23:21:16 +11:00
Sebastian McKenzie
2fffffe780 fix paramless async calls 2015-04-01 13:57:59 +11:00
Sebastian McKenzie
4280c2d846 fix incorrect interpreation of export default shorthand, update to new ast definitions - #1091 2015-03-30 06:08:37 +11:00
Sebastian McKenzie
f794e360f0 add support for export extensions https://github.com/leebyron/ecmascript-more-export-from - closes #1091 2015-03-30 03:38:14 +11:00
Sebastian McKenzie
d93a315df4 fix class decorator methods 2015-03-29 19:30:34 +11:00
Sebastian McKenzie
54fa079bf4 fixes #1114
- The visitor keys for `ObjectTypeAnnotation`s were incorrect so those nodes weren't being traversed so comments weren't attached for them.
 - The type parser wasn't eating the semicolons for the nodes so the `end` location of each of the type properties wasn't accurate which threw off the code generation newline algorithm.
 - Type properties hadn't been given the `UserWhitespacable` alias.
2015-03-29 16:44:36 +11:00
Sebastian McKenzie
aeb0cfcbbe remove es7.classProperties check from parser 2015-03-28 03:59:01 +11:00
Sebastian McKenzie
ddd173a4b3 restructure testing infrastructure to be more modular 2015-03-28 01:21:48 +11:00
Sebastian McKenzie
5f6a216809 add support for decorators before class exports 2015-03-28 00:22:38 +11:00
Sebastian McKenzie
f5f77d4720 better parsing of decorators - support class expressions 2015-03-26 00:58:38 +11:00
Sebastian McKenzie
e52af24999 add class property initializers, add more TraversalPath flexibility with additional node injection method 2015-03-24 03:34:34 +11:00
Sebastian McKenzie
6d87a99d1d make method definitions with expression bodies illegal - fixes #1066 2015-03-23 20:24:32 +11:00
Sebastian McKenzie
2cbbd86552 remove acorn compiled source 2015-03-22 04:09:18 +11:00
Sebastian McKenzie
37072737b9 add support for class decorators 2015-03-22 04:07:38 +11:00
Sebastian McKenzie
6128fd9687 add do expressions 2015-03-22 04:06:15 +11:00
Logan Smyth
01b39d67f0 Merge acorn 1.0.0 (formerly 'update to modular acorn' in original history). 2016-03-14 22:47:51 -07:00
Sebastian McKenzie
0d143f005f update to latest acorn, better array shortcuts, don't add code frame to error message 2016-03-14 22:40:33 -07:00
Sebastian McKenzie
f830892ab8 fix modules generation logic and remove dead node types 2016-03-14 22:40:24 -07:00
Sebastian McKenzie
7c84db45fd more estree updates - finish flow parsing 2016-03-14 22:40:16 -07:00
Sebastian McKenzie
57af08bea8 move acorn into vendor 2016-03-14 22:39:57 -07:00
Logan Smyth
16e8224ce6 Merge acorn 0.12.1 and acorn-babel (formerly "embed acorn" in the original git history). 2016-03-14 22:39:24 -07:00
Marijn Haverbeke
44c0231c09 Don't require a semicolon after 'export default [function|class] ...'
Issue #225
2015-03-20 22:40:51 +01:00
Marijn Haverbeke
1fc1d32e1f Add some notes on plugins to the README 2015-03-20 21:29:50 +01:00
Marijn Haverbeke
35d0b80976 Properly export acorn.plugins 2015-03-20 21:12:26 +01:00
Marijn Haverbeke
a1022f38e1 Fix trying to run .sh file with node in prepublish script 2015-03-20 21:05:14 +01:00
Marijn Haverbeke
5d7f4d7a23 Update README 2015-03-20 21:01:05 +01:00
Marijn Haverbeke
659f2c9091 Teach the walker about Super and MetaProperty 2015-03-20 17:51:50 +01:00
Marijn Haverbeke
2ed8f8f2b8 Fix infinite loop introduced by 685b51e 2015-03-20 17:49:51 +01:00
Marijn Haverbeke
013e48439f Update tools/generate-identifier-regex.js
So that it can also spit out the astral maps.
2015-03-20 17:47:46 +01:00
Marijn Haverbeke
685b51e0ae Make the loose parser's parseIdent actually returns an identifier with a name 2015-03-20 17:36:47 +01:00
Marijn Haverbeke
0fee7a395e Fix the way 'npm test' loads the library 2015-03-20 17:35:51 +01:00
Ingvar Stepanyan
864268abb6 Add support for meta-properties.
estree/estree#32
2015-03-20 17:35:37 +01:00
Ingvar Stepanyan
921e45ab2b SuperExpression -> Super 2015-03-20 17:23:01 +01:00
Marijn Haverbeke
e88a5431db Allow init-less destructing bindings in for/in and for/of 2015-03-20 17:19:35 +01:00
Marijn Haverbeke
35c417d02b Remove remnants of docco-based homepage 2015-03-20 17:05:23 +01:00
Marijn Haverbeke
f538706db3 Code style -- less semicolons, more let variables 2015-03-20 17:00:32 +01:00
Marijn Haverbeke
6dd254d999 Tie everything together in the new build system 2015-03-20 16:36:24 +01:00
Marijn Haverbeke
cf613ce287 Split up the loose parser, set up a build script 2015-03-20 14:41:55 +01:00
Marijn Haverbeke
dd89c6e112 Make loose parser work with minor interface changes introduced by modularization 2015-03-20 12:04:33 +01:00
Marijn Haverbeke
a1fe3a1859 Finish splitting up main parser 2015-03-20 11:47:31 +01:00
Marijn Haverbeke
7b05e660b4 Move location-related code into location.js 2015-03-19 16:28:28 +01:00
Marijn Haverbeke
fec42cb596 Move tokenizer into modules 2015-03-19 16:17:43 +01:00
Marijn Haverbeke
93b919c1a0 Split out identifier-related code 2015-03-19 15:49:58 +01:00
Marijn Haverbeke
9808459940 Start on ES6 port 2015-03-19 15:40:12 +01:00
Mathias Bynens
575421b3c2 Make readRegexp more tolerant 2015-03-19 14:48:43 +01:00
Marijn Haverbeke
9673146cc1 Verify that property name can be bound to in short-hand object pattern properties
Issue #221
2015-03-19 14:05:16 +01:00
Marijn Haverbeke
a45172e044 Unify checkLVal and checkFunctionParam 2015-03-19 13:42:26 +01:00
Marijn Haverbeke
0a755156a8 Ignore backslash-escapes in identifiers in ES6 mode 2015-03-19 13:11:17 +01:00
Marijn Haverbeke
5d5b8eb3c8 Don't crash when converting missing array elements to assignable
Closes #220
2015-03-19 12:58:34 +01:00
Marijn Haverbeke
b6e8310848 Require an initalization value when let/var/const-declaring a complex pattern
Closes #222
2015-03-19 12:46:36 +01:00
Marijn Haverbeke
a75a685610 Add a startsExpr property to token types, use it to properly parse yield
Issue #219
2015-03-19 12:34:41 +01:00
Ingvar Stepanyan
0473c368e6 [es6][estree] Add support for sourceType: script|module modes.
+ Fix list of keywords and reserved words in ES6.
2015-03-18 13:42:49 +02:00
Ingvar Stepanyan
024a98431d [estree] Add SuperExpression.
(we're almost there)
2015-03-17 23:01:42 +02:00
Ingvar Stepanyan
876e774bfe [estree] Align method kinds.
[loose] Split parseObj and parseClass.
2015-03-17 22:36:34 +02:00
Marijn Haverbeke
19ef4ef69c Require semicolon after 'import * from ...' 2015-03-17 12:30:12 +01:00
Sebastian McKenzie
f651807069 v0.11.1-38 2015-03-13 13:22:32 +11:00
Sebastian McKenzie
d08d63b01d support bounded polymorphism in flow facebook/esprima#103 2015-03-13 13:22:09 +11:00
Marijn Haverbeke
57bc9b1b0a Move parsing of yield into parseMaybeAssign
Issue #219
2015-03-12 23:11:33 +01:00
Marijn Haverbeke
16a342082a Allow trailing commas in array patterns
Closes #975
2015-03-12 22:39:00 +01:00
Marijn Haverbeke
811d19ab76 Allow any number of digits when killing \u{} sequences in regexps 2015-03-12 22:26:31 +01:00
Marijn Haverbeke
4735ef53ef Replace the forbidReserved option with an allowReserved option
For consistency with similar options
2015-03-12 22:02:41 +01:00
Marijn Haverbeke
ba750b253b Replace strictSemicolons and allowTrailingCommas with onInsertedSemicolon and onTrailingComma 2015-03-12 22:02:41 +01:00
Marijn Haverbeke
9fb3a4f5ce Move as much as possible code in test driver out of try block 2015-03-12 22:01:33 +01:00
Ingvar Stepanyan
34050d3917 Support for for (const ...).
Fixes #213.

Also changes API to pass token type to `parseVar` to reduce string comparison ops.
2015-03-10 11:36:15 +02:00
Ingvar Stepanyan
ff60ee4fdb [estree] Align export ... representations. 2015-03-10 10:37:00 +02:00
Ingvar Stepanyan
722bc65e79 [estree] Align Import specifiers. 2015-03-10 02:27:24 +02:00
Marijn Haverbeke
12558821c5 Use an object argument in the TokenType constuctor 2015-03-06 10:37:35 +01:00
Marijn Haverbeke
4e0a7fac71 Linting changes 2015-03-06 10:36:17 +01:00
Marijn Haverbeke
8459481e65 Represent a tokenizer as an instance of the parser
This completely changes the interface, and removes most of the complexity
in the old tokenizer interface (jump-to-position was removed, since it is
all kinds of unreliable given the new tokenizer context system).
2015-03-05 17:30:48 +01:00
Marijn Haverbeke
0df2affdfe Move loose parser to object style
Drop dependency on tokenizer interface
2015-03-05 17:22:06 +01:00
Marijn Haverbeke
3365478645 Add a plugin mechanism to allow JSX parser to be a module
And export a few more things
2015-03-05 16:00:34 +01:00
Marijn Haverbeke
06f3b3c224 Attach context update algorithm to token types
For, theoretically, easier extendability
2015-03-05 15:59:12 +01:00
Marijn Haverbeke
6bd1013f2c Use uniform object type for node types
Speeds things up by about 9% on io.js 1.3
2015-03-05 15:59:12 +01:00
Marijn Haverbeke
141905f9fd Consume whitespace before, rather than after, reading a token
Simplifies several things
2015-03-05 15:59:12 +01:00
Marijn Haverbeke
bc48c02a18 Move the parser state into an object
Makes almost everything in acorn.js a method of this object.

Performance is not significantly affected on a modern V8. Makes the
code reentrant and allows us to more easily expose more methods
externally in the future.

On the other hand, the proliferation of `this.` is unfortunate.
2015-03-05 15:59:12 +01:00
Marijn Haverbeke
33307e789a Update tools/generate-identifier-regex.js
So that it can also spit out the astral maps.
2015-03-05 15:55:38 +01:00
Marijn Haverbeke
d76ea4b3be Make the tokenizer aware of multi-byte characters in ES6 mode
Add a data structure to recognize astral identifier chars. Parse whole
code points when looking for identifiers.

Issue #215
2015-03-05 15:55:38 +01:00
Marijn Haverbeke
891d5d07dd Allow braced \u escapes in identifiers
We still can't properly recognize code points as ES6-style
identifier chars.

Issue #214
2015-03-04 15:37:26 +01:00
Marijn Haverbeke
59dc29f3f0 In ES6-mode, don't treat keywords with escaped characters as regular identifiers
See https://mathiasbynens.be/notes/javascript-identifiers-es6
2015-03-04 15:29:15 +01:00
Marijn Haverbeke
cbd8aa8f06 Bump version number post-0.12 2015-03-02 11:31:27 +01:00
Marijn Haverbeke
99f1989f72 Mark release 0.12 2015-03-02 11:31:11 +01:00
Marijn Haverbeke
8c98acf5d6 Make sure all ignored files are ignored in npmigore 2015-03-02 11:30:47 +01:00
Sebastian McKenzie
ec131eaecc v0.11.1-37 2015-02-28 22:34:32 +11:00
Sebastian McKenzie
854e892cda fix type annotation property on arrow function params returnType to typeAnnotation 2015-02-28 22:33:03 +11:00
Sebastian McKenzie
65e1646dbf v0.11.1-35 2015-02-26 08:32:08 +11:00
Sebastian McKenzie
1424c35d13 correctly handle SpreadProperty - fixes babel/babel#897 2015-02-26 08:31:49 +11:00
Marijn Haverbeke
2a0ccb1030 Wording change in readme funding link 2015-02-23 11:49:44 +01:00
Andres Suarez
2b6f24ea86 Add .npmignore 2015-02-23 11:36:37 +01:00
Sebastian McKenzie
631b78e07d v0.11.1-34 2015-02-22 22:42:07 +11:00
Sebastian McKenzie
e9a6f83c00 rewrite async function parsing - fixes #27 2015-02-22 14:05:22 +11:00
Sebastian McKenzie
5a0861c1b9 remove dead _dotQuestion code 2015-02-22 12:33:09 +11:00
Marijn Haverbeke
b6b1bc2bae [README] Add NPM and funding links 2015-02-19 11:51:27 +01:00
Sebastian McKenzie
f8eba046b3 v0.11.1-33 2015-02-18 10:25:29 +11:00
Sebastian McKenzie
82e3819f38 fix PrivateDeclaration/SpreadProperty strict mode 2015-02-18 10:25:17 +11:00
Marijn Haverbeke
de544da8f3 [walker] Understand ParenthesizedExpression nodes
Closes #210
2015-02-17 15:09:18 +01:00
Marijn Haverbeke
9a617a59e4 [loose parser] Don't tokenize ellipsis when ecmaVersion < 6
Issue marijnh/tern#493
2015-02-17 14:41:33 +01:00
Sebastian McKenzie
f4c39613f5 v0.11.1-32 2015-02-15 17:46:52 +11:00
Sebastian McKenzie
36381d1785 rename to acorn-babel 2015-02-15 17:46:45 +11:00
Sebastian McKenzie
032d66d79f v0.11.1-31 2015-02-14 12:53:40 +11:00
Sebastian McKenzie
fe0b679104 add support for flow type casts and import/export types - facebook/react#3143 2015-02-14 12:52:42 +11:00
Sebastian McKenzie
12768c40d9 update to latest esprima-fb flow tests 2015-02-14 12:52:08 +11:00
Sebastian McKenzie
383fcec1f0 v0.11.1-30 2015-02-13 15:04:54 +11:00
Sebastian McKenzie
04c64c4592 remove this shorthand playground tests 2015-02-13 15:04:33 +11:00
Sebastian McKenzie
91b79e9178 Merge branch 'thetalecrafter-multiline' 2015-02-13 15:03:20 +11:00
Sebastian McKenzie
987694bb23 Merge branch 'multiline' of https://github.com/thetalecrafter/acorn-jsx into thetalecrafter-multiline
Conflicts:
	acorn.js
	acorn_loose.js
	package.json
2015-02-13 15:03:03 +11:00
Andy VanWagoner
9f73a10f61 Allow multiline JSX string attributes. 2015-02-12 20:47:00 -07:00
Sebastian McKenzie
a6a156e039 v0.11.1-29 2015-02-11 10:58:33 +11:00
Sebastian McKenzie
ac2dfced36 add support for class initializer properties - 6to5/6to5#619 2015-02-11 10:57:54 +11:00
Sebastian McKenzie
04cf3f3f9d v0.11.1-28 2015-02-08 20:40:13 +11:00
Sebastian McKenzie
57fccb55ff remove this shorthand - closes 6to5/6to5#717 2015-02-08 20:39:48 +11:00
Sebastian McKenzie
7458d57e4f v0.11.1-27 2015-02-08 16:18:13 +11:00
Sebastian McKenzie
1aa8c6a37c fix function parsing due to faulty merge 2015-02-08 16:17:53 +11:00
Sebastian McKenzie
e268c4eefb v0.11.1-26 2015-02-08 16:10:06 +11:00
Sebastian McKenzie
7ec50ebd57 Merge https://github.com/marijnh/acorn
Conflicts:
	acorn.js
	acorn_loose.js
2015-02-08 16:09:46 +11:00
Sebastian McKenzie
ce7abeab18 fix strictMode option 2015-02-08 16:06:32 +11:00
Ingvar Stepanyan
7264bc0178 Fix found V8 deopt.
Increases perf from 230K to 360K lines/sec on std bench on my machine.
2015-02-05 00:02:21 +02:00
Ingvar Stepanyan
c034550215 Disallow line break between arrow function params and =>. 2015-02-04 12:57:18 +02:00
Sebastian McKenzie
06c4334808 use all property instead of delegate on await expressions - facebook/regenerator#171 2015-01-29 13:24:22 +11:00
Sebastian McKenzie
695f7ce648 ignore ds_store 2015-01-29 13:05:15 +11:00
Ingvar Stepanyan
3cbad64c1e Update version. 2015-01-27 18:26:03 +02:00
Ingvar Stepanyan
e0bcfca03f Add JSX support to loose parser. 2015-01-27 18:25:49 +02:00
Ingvar Stepanyan
95479ab6aa Optimize JSX text reading. 2015-01-27 16:51:45 +02:00
Ingvar Stepanyan
55ae051c81 Update version after merge. 2015-01-27 16:28:12 +02:00
Ingvar Stepanyan
2f40d7e30e Merge branch 'upstream' into jsx2 2015-01-27 16:27:59 +02:00
Ingvar Stepanyan
6eb177582d Fix export default declarations.
Closes #184.
2015-01-27 16:21:41 +02:00
Ingvar Stepanyan
e4a97ab877 Finalized destructuring support in loose parser; fixed startNodeAt. 2015-01-27 15:53:16 +02:00
Ingvar Stepanyan
6660a21b79 Disallow MemberExpression in bindings; clarify function namings. 2015-01-27 15:23:09 +02:00
Ingvar Stepanyan
3d5964ceed Fix locations for AssignmentPatterns. 2015-01-27 15:10:25 +02:00
Sebastian McKenzie
256ae1a011 v0.11.1-25 2015-01-26 20:30:35 +11:00
Sebastian McKenzie
e14e6473ff fix flow type param parsing position - fixes #24 2015-01-26 20:30:21 +11:00
Sebastian McKenzie
189d2c3fa9 v0.11.1-24 2015-01-26 16:58:58 +11:00
Sebastian McKenzie
301f639f73 fix incorrect parseExpression arguments - not sure where this came from 2015-01-26 16:58:41 +11:00
Sebastian McKenzie
37ca3c3d29 v0.11.1-23 2015-01-26 12:02:42 +11:00
Sebastian McKenzie
2fb5a3c46e reference exports.Node so we can replace it if necessary 2015-01-26 01:25:41 +11:00
Sebastian McKenzie
45bb4b00f0 0.11.1-22 2015-01-26 00:12:29 +11:00
Sebastian McKenzie
1221112610 add canInsertSemicolon check to async function parsing 2015-01-26 00:12:01 +11:00
Sebastian McKenzie
766e42d140 clean up async function declaration parsing 2015-01-25 23:44:17 +11:00
Sebastian McKenzie
c297f5a57f fix parseAssignableListItem function name misspelling 2015-01-25 22:06:58 +11:00
Sebastian McKenzie
0530e7c28d 0.11.1-21 2015-01-25 17:22:49 +11:00
Sebastian McKenzie
2c3d2ec875 simplify parse assignable list types 2015-01-25 17:22:37 +11:00
Sebastian McKenzie
1937e93e58 update flow rest param tests 2015-01-25 17:22:26 +11:00
Sebastian McKenzie
7ea883a3b5 Merge https://github.com/RReverser/acorn-jsx
Conflicts:
	acorn.js
	package.json
2015-01-25 17:08:37 +11:00
Sebastian McKenzie
e397a0c4d3 support flow types in arrow function params, add support for async function declarations 2015-01-25 17:06:13 +11:00
Sebastian McKenzie
c5197e1cad Merge https://github.com/marijnh/acorn
Conflicts:
	acorn.js
	acorn_loose.js
2015-01-25 11:50:02 +11:00
Ingvar Stepanyan
012f7dbddd Introduce helpers for contextual keywords. 2015-01-25 10:36:06 +11:00
Sebastian McKenzie
97dd99d171 Remove useless noLess 2015-01-25 10:03:51 +11:00
Ingvar Stepanyan
401e6c4f30 Update version. 2015-01-25 00:33:14 +02:00
Ingvar Stepanyan
719ecbd203 Improve JSX braces context handling. 2015-01-25 00:33:03 +02:00
Ingvar Stepanyan
e93b69d595 Add regression test for #15. 2015-01-25 00:27:06 +02:00
Ingvar Stepanyan
c445d073e2 Merge branch 'upstream' into jsx2
Conflicts:
	acorn.js
2015-01-25 00:20:02 +02:00
Sebastian McKenzie
78215a17cd Merge https://github.com/marijnh/acorn
Conflicts:
	acorn.js
	package.json
2015-01-24 22:49:06 +11:00
Ingvar Stepanyan
5d96bbd781 Simplify & fix rest argument validity checks. 2015-01-24 13:38:14 +02:00
Ingvar Stepanyan
cdd444eff1 Speed-up reading words, strings and templates.
Now identifiers and strings even with escaped chars are read
in optimized way by reading entire chunks delimited by escape
chars (and not bailing to deopt mode on first one).
2015-01-24 12:42:19 +02:00
Ingvar Stepanyan
65d09eac6e Implement shorthand property assignment in ambiguous contexts.
Issue #181.
2015-01-24 12:40:24 +02:00
Ingvar Stepanyan
f0569147e6 Avoid extra call and arg in parseExpression for single-expression case. 2015-01-23 21:48:33 +02:00
Ingvar Stepanyan
41ad304955 Introduce helpers for contextual keywords. 2015-01-23 21:36:16 +02:00
Ingvar Stepanyan
08b34933d7 Added acorn_csp to .gitignore and fixed generation under Windows. 2015-01-23 15:39:49 +02:00
Ingvar Stepanyan
2e9180f041 Add ES6 patterns to util/walk.js 2015-01-23 15:33:28 +02:00
Ingvar Stepanyan
917de714b1 Switch from Function.{rest,defaults} to AssignmentPattern and RestElement.
Closes #182.
2015-01-23 15:29:37 +02:00
Sebastian McKenzie
90513be27c 0.11.1-20 2015-01-23 23:45:53 +11:00
Sebastian McKenzie
f031700b67 Merge https://github.com/marijnh/acorn
Conflicts:
	acorn.js
2015-01-23 23:16:59 +11:00
Sebastian McKenzie
cb76f3f7ba Merge https://github.com/marijnh/acorn
Conflicts:
	acorn.js
2015-01-23 23:16:08 +11:00
Ingvar Stepanyan
38609ae26d Closes #205. 2015-01-23 14:14:02 +02:00
Ingvar Stepanyan
cb94a0851c Add regex comparison to test driver. 2015-01-23 13:50:01 +02:00
Ingvar Stepanyan
e6f1e1027e Fix dividing function expression.
Fixes #204.
2015-01-23 13:17:03 +02:00
Sebastian McKenzie
78923eae15 add back missing class type parsing 2015-01-23 21:38:13 +11:00
Sebastian McKenzie
ac4fdac04a add flow tests 2015-01-23 21:37:26 +11:00
Sebastian McKenzie
957d2b4c44 Merge https://github.com/marijnh/acorn 2015-01-23 21:02:23 +11:00
Ingvar Stepanyan
39d752dc6b Make top-level equal to block statement context.
Fixes #203.
2015-01-23 11:48:39 +02:00
Sebastian McKenzie
c1da7ac939 Merge branch 'master' of github.com:6to5/acorn-6to5 2015-01-23 08:07:51 +11:00
Sebastian McKenzie
04e6d02d1e 0.11.1-19 2015-01-23 08:07:39 +11:00
Sebastian McKenzie
af7630b963 Merge https://github.com/RReverser/acorn-jsx
Conflicts:
	.gitignore
	README.md
	acorn.js
	package.json
	test/run.js
	test/tests-harmony.js
	test/tests-jsx.js
2015-01-23 08:07:09 +11:00
Ingvar Stepanyan
2e55540bbe Fix {start,end}Loc -> loc.{start,end} in acorn_loose; remove forceRegexp. 2015-01-22 18:53:45 +02:00
Ingvar Stepanyan
555c7898c8 Remove Token::{startLoc,endLoc} so they don't appear in next release. 2015-01-22 18:21:38 +02:00
Ingvar Stepanyan
de23a869ae Add acorn_csp.js to .gitignore. 2015-01-22 17:26:18 +02:00
Ingvar Stepanyan
5e1f60dbae Update repository metadata and readme. 2015-01-22 17:25:50 +02:00
Ingvar Stepanyan
a7d5734a59 Fix spread attribute parsing after merge. 2015-01-22 17:13:56 +02:00
Ingvar Stepanyan
0d4f1f6ce9 Update version. 2015-01-22 16:39:30 +02:00
Ingvar Stepanyan
252bb46f70 Merge branch 'upstream' into jsx2 2015-01-22 16:11:28 +02:00
Ingvar Stepanyan
caa5da6ce1 Improve spread element parsing (fix allowed contexts and error locations). 2015-01-21 23:51:40 +02:00
Ingvar Stepanyan
d1f28b75aa Merge branch 'upstream' into jsx2 2015-01-21 03:01:27 +00:00
Ingvar Stepanyan
29910d2b2d XJS -> JSX as per facebook/esprima#83. 2015-01-21 03:00:12 +00:00
Ingvar Stepanyan
cae13fd75a Small simplifications after merge. 2015-01-21 02:58:02 +00:00
Marijn Haverbeke
94b5efcd3e Disallow declaration statements in block-less context
Closes #202
2015-01-20 12:55:21 +01:00
Forbes Lindesay
33a7c9fc24 Support import and export declarations in acorn/util/walk 2015-01-20 12:28:20 +01:00
Marijn Haverbeke
a1d2561cfa Restore patch 9f7cb55264 to original shape
And make loose parser handle stray class semicolons

Issue #190
2015-01-20 12:02:30 +01:00
Sebastian McKenzie
9f7cb55264 Add stray semicolons as class elements 2015-01-20 11:56:33 +01:00
Ingvar Stepanyan
d64efe1be4 Merge branch 'upstream' into jsx2
Conflicts:
	acorn.js
2015-01-19 14:12:24 +00:00
Sebastian McKenzie
dce9e241db Merge pull request #23 from hawkrives/patch-1
Update .npmignore to ignore big, not-used-in-NPM directories
2015-01-19 08:28:19 +11:00
Hawken Rives
9564ce9fd4 Update .npmignore
Ignore `test` (2.7MB) and `docs` (651KB)
2015-01-18 09:42:10 -06:00
Sebastian McKenzie
b82d5f0290 Merge branch 'master' of github.com:6to5/acorn-6to5 2015-01-18 19:24:30 +11:00
Sebastian McKenzie
89d8eff5ad v0.11.1-18 2015-01-18 19:20:51 +11:00
Sebastian McKenzie
587ab0d07c Merge pull request #22 from tricknotes/fix-repo-name
Fix repository name
2015-01-18 19:17:52 +11:00
Ryunosuke SATO
d24b59ca42 Fix repository name
Now `acorn-6to5` is owned by 6to5 organization.
2015-01-18 17:17:14 +09:00
Sebastian McKenzie
d425759ca7 Merge pull request #21 from charliesome/fix-associativity-parsing-again
Fix associativity parsing, hopefully for good this time
2015-01-18 19:15:44 +11:00
Sebastian McKenzie
d6dec48335 Merge pull request #20 from tricknotes/keep-acorn_scp
Keep acorn_csp.js for npm module
2015-01-18 19:14:48 +11:00
Charlie Somerville
8296fe1415 fix associativity parsing, hopefully for good this time 2015-01-18 19:14:19 +11:00
Ryunosuke SATO
a2f1b75243 Keep acorn_csp.js for npm module
The published version v0.11.1-17 doesn't include acorn_csp.js.
`.npmignore` is required to keep it on NPM module.
2015-01-18 17:12:05 +09:00
Sebastian McKenzie
5f9f588386 fix flow function param type parsing - allow optional notation as well as type declaration - fixes 6to5/6to5#524 2015-01-18 18:33:42 +11:00
Sebastian McKenzie
2debaf0f5e v0.11.1-17 2015-01-18 12:14:49 +11:00
Sebastian McKenzie
7c3a487355 fix exponentiation tests 2015-01-18 12:13:38 +11:00
Sebastian McKenzie
a0a20f9fb2 fix styling in right associative 2015-01-18 10:38:13 +11:00
Sebastian McKenzie
a189dbdcef Merge pull request #19 from charliesome/fix-right-associative-parse
Fix right associative parse precedence
2015-01-18 10:36:12 +11:00
Charlie Somerville
30e9978ffb pass minPrec when right recursing rather than prec - 1 2015-01-18 10:34:34 +11:00
Marijn Haverbeke
dac747dfa9 Add a test for issue #201 2015-01-17 22:26:34 +01:00
Marijn Haverbeke
3e513fc6a8 Kill finishNodeAt in acorn_loose as well
Issue #200
2015-01-17 22:22:26 +01:00
Ingvar Stepanyan
6dee98d1b9 Adapt ES6 template handling to new tokenizer.
Avoid need for:
* extra `templates` array in favor of new `tokContext`;
* special location handling for first & last template elements;
* separate `_templateContinued` token in favor of same `_template`.

Adds:
* token types for backQuote and dollarBraceL instead of skipping them
so they can be handled (i.e. highlighted differently).
2015-01-17 22:21:22 +01:00
Sebastian McKenzie
bdb8e57283 add extra exponentiation operator test 2015-01-18 00:55:12 +11:00
Sebastian McKenzie
572b98b6b9 Merge pull request #18 from charliesome/pow-associativity
Fix ** operator associativity
2015-01-18 00:46:24 +11:00
Charlie Somerville
b51118c3fc use right recursion for right associative operators 2015-01-18 00:44:17 +11:00
Charlie Somerville
5f42326f34 set the rightAssociative flag on _exponent 2015-01-18 00:44:14 +11:00
Sebastian McKenzie
f558bd7db4 remove acorn csp from repo 2015-01-18 00:28:13 +11:00
Sebastian McKenzie
1322501276 add make build task 2015-01-18 00:25:01 +11:00
Sebastian McKenzie
58f84e595f add more exponentation operator tests 2015-01-18 00:24:48 +11:00
Sebastian McKenzie
dc197cecf7 add acorn_csp.js to gitignore 2015-01-18 00:24:28 +11:00
Sebastian McKenzie
8aa74ab845 Merge pull request #17 from jridgewell/mallot
Support Mallet operator
2015-01-17 21:58:48 +11:00
Justin Ridgewell
856571e948 Support Mallet operator
The mallet will check to see if the variable is falsey, and if
it is, override it. It's almost the same as `a = a || b`.

Re: 6to5/6to5#516
2015-01-16 18:28:25 -05:00
Sebastian McKenzie
196ab15f80 Merge pull request #16 from kossnocorp/acorn-6to5/fix_test
Turn on playground for `"obj ?= 2"`
2015-01-17 10:08:53 +11:00
Sasha Koss
ff769780ea Turn on playground for "obj ?= 2"
Without it fail with different issue, doesn’t connected to real case:
`Got error message: Unexpected token (1:5)`.
2015-01-16 20:09:07 +05:30
Ingvar Stepanyan
f6c45ac59f Re-read only number or string after "use strict".
Fixes double-entering same tokContext for various parentheses.
2015-01-14 23:10:10 +02:00
Sebastian McKenzie
f3299fa88d v0.11.1-16 2015-01-15 02:44:52 +11:00
Sebastian McKenzie
886d84c18c limit memoisation assignment operator to playground mode 2015-01-15 02:44:15 +11:00
Ingvar Stepanyan
d34aea63ab Update tests. 2015-01-14 12:36:25 +02:00
Ingvar Stepanyan
e7beee177d Remove deprecated ComprehensionBlock.of property.
Comprehensions were moved to ES7 anyway, so there is no sense
in keeping intermediate no-more-supported syntax.
2015-01-14 12:35:00 +02:00
Ingvar Stepanyan
7e85da74cb shouldSkipSpace is no more needed in finishToken. 2015-01-14 12:31:59 +02:00
Ingvar Stepanyan
ad9411d2ae Made tokenize() compliant with ES6 iterables for easier processing. 2015-01-14 12:29:20 +02:00
Ingvar Stepanyan
802c4cd8cb Initial rewrite of JSX parser onto new tokenizer (all tests passing). 2015-01-14 12:18:08 +02:00
Marijn Haverbeke
0f55a53a7d [loose parser] Fetch token before comment when tokenizer raises unterminated comment error
Closes #197
2015-01-13 22:18:55 +01:00
Forbes Lindesay
cee56dab67 Add --ecma7 option to CLI 2015-01-13 22:08:50 +01:00
Sebastian McKenzie
741fcefa31 Merge pull request #14 from kossnocorp/fix_tests
Fix broken test
2015-01-13 23:46:37 +11:00
Sasha Koss
3ae0f24344 Fix broken test
Starting from
https://github.com/6to5/acorn-6to5/commit/40350cafb8d2c66cad7864e04792e9
046734c633 this shorthand also part of call expression
2015-01-13 18:15:16 +05:30
Sebastian McKenzie
1ed9daf827 v0.11.1-14 2015-01-13 22:42:44 +11:00
Sebastian McKenzie
0f10fbb440 fix makefile indentation 2015-01-13 22:42:01 +11:00
Sebastian McKenzie
482b94563e add csp version as default - fixes #13 2015-01-13 22:39:00 +11:00
Marijn Haverbeke
1b8069e48c Restore onToken functionality for loose parser 2015-01-13 09:53:42 +01:00
Ingvar Stepanyan
d1f95ece42 Revert "Disallow parentheses in lvalue except as in computed keys or default values."
This reverts commit 85087f2a09.
Fixes #193.
2015-01-12 20:31:38 +02:00
Sebastian McKenzie
735c7614ed bump version 2015-01-12 11:44:56 +11:00
Sebastian McKenzie
bde6ef2e0c Merge https://github.com/RReverser/acorn-jsx
Conflicts:
	package.json
	test/tests-jsx.js
2015-01-12 09:59:21 +11:00
Ingvar Stepanyan
eb37a57fb0 Fix for '</' constructs.
Fixes #12.
2015-01-11 23:36:41 +02:00
Ingvar Stepanyan
bc2e01aa03 Allow static as method name in class (fixes #192).
Add uncommitted tests for #191.
2015-01-09 15:31:01 +02:00
Ingvar Stepanyan
3d9048a692 Allow pattern in catch param (fixes #191). 2015-01-09 02:50:32 +02:00
Ingvar Stepanyan
85087f2a09 Disallow parentheses in lvalue except as in computed keys or default values. 2015-01-08 23:00:22 +02:00
Sebastian McKenzie
8ca1be061e fix destructering defaults in params 2015-01-09 05:58:57 +11:00
Sebastian McKenzie
9d4ab350f5 bump version 2015-01-09 05:54:50 +11:00
Sebastian McKenzie
5c0d9a0e61 Parse assignment patterns in-place in certain contexts.
* Parsing assignables without extra transform step when possible (speed-up).
* Added support for shorthand defaults in such certain contexts (issue #181).

Conflicts:
	acorn.js
	acorn_loose.js
2015-01-09 05:54:16 +11:00
Ingvar Stepanyan
4d4a76588c Parse assignment patterns in-place in certain contexts.
* Parsing assignables without extra transform step when possible (speed-up).
* Added support for shorthand defaults in such certain contexts (issue #181).
2015-01-08 20:19:48 +02:00
Marijn Haverbeke
db59bd0296 Remove outdated note about loose parser not supporting ES6 2015-01-06 11:15:34 +01:00
Marijn Haverbeke
0897901f1f Slight cleanup of '/' disambiguation
Issue #189
2015-01-06 11:03:50 +01:00
Marijn Haverbeke
b6b085ac8e Make tokenizer independent of parser (with regards to '/' disambiguation)
Issue #189
2015-01-06 10:58:52 +01:00
Sebastian McKenzie
8c25cb0d80 add higher priority to exponent operator, better async contextual functions 2015-01-06 10:42:57 +11:00
Nick Fitzgerald
af0debc849 Add support for running just the tokenizer to the bin/acorn script. 2015-01-04 22:38:24 +01:00
Marijn Haverbeke
459a169262 Make tests pass again for loose parser
Issue #181
2015-01-04 22:34:42 +01:00
Marijn Haverbeke
7c6a8b7c76 Use parseExprSubscripts instead of parseExpression when parsing superclass
Issue #187
2015-01-04 22:30:50 +01:00
Marijn Haverbeke
045d8c02f5 Revert "Require superclass expressions to be lvals"
This reverts commit 0b59fc198b.

Issue #187
2015-01-04 22:28:16 +01:00
Marijn Haverbeke
e271168cf6 Make onToken only fire for actual final tokens
Issue #189
2015-01-04 22:27:03 +01:00
Sebastian McKenzie
29a4dcc975 Merge https://github.com/marijnh/acorn
Conflicts:
	acorn.js
2015-01-04 22:03:02 +11:00
Ingvar Stepanyan
431a44bc74 Add support for destructuring defaults (not for shorthand props yet).
Related to #181.
2015-01-04 12:15:24 +02:00
Sebastian McKenzie
f2c78674af better class element semicolons 2015-01-04 21:14:18 +11:00
Sebastian McKenzie
1eeb505bf4 no line terminator after contextual async keyword 2015-01-04 20:35:51 +11:00
Sebastian McKenzie
8dad17b675 remove console.trace 2015-01-04 19:49:10 +11:00
Sebastian McKenzie
cec7b1ba3f better acorn async statement parsing 2015-01-04 19:37:38 +11:00
Sebastian McKenzie
55b3e96d95 add support for semicolons as class elements 2015-01-04 18:20:08 +11:00
Sebastian McKenzie
9c3c569ac6 remove checkLVal from class heritage 2015-01-04 08:12:23 +11:00
Sebastian McKenzie
017d76c720 set location info on ThisExpression node in this shorthand - fixes 6to5/6to5#367 2015-01-03 06:09:37 +11:00
Sebastian McKenzie
c8fc778ffb add ecmaVersion check to async function statements 2015-01-02 05:02:59 +11:00
Sebastian McKenzie
56bc618d33 actually parse async functions as statements 2015-01-02 04:21:56 +11:00
Sebastian McKenzie
b5c8ee2120 bump version 2014-12-31 11:50:54 +11:00
Sebastian McKenzie
a727a121ae Merge https://github.com/marijnh/acorn
Conflicts:
	acorn.js
2014-12-31 11:50:15 +11:00
Sebastian McKenzie
9e6e19eca8 parse this shorthand as an ident with subscripts instead of a regular expression 2014-12-31 11:48:25 +11:00
Marijn Haverbeke
0b59fc198b Require superclass expressions to be lvals
And remove a test that violates this.

Closes #185
2014-12-30 12:54:25 +01:00
Ingvar Stepanyan
0084ac14ae Fixed #186. 2014-12-30 13:42:37 +02:00
Sebastian McKenzie
d727f97497 fix export default declarations 2014-12-27 20:07:59 +11:00
Sebastian McKenzie
3e676a0183 Merge branch 'master' of github.com:6to5/acorn-6to5 2014-12-27 20:02:23 +11:00
Sebastian McKenzie
ff4228c09d Merge branch 'master' of https://github.com/marijnh/acorn
Conflicts:
	README.md
	acorn.js
	package.json
2014-12-27 20:02:15 +11:00
Sebastian McKenzie
29a33f5ae9 Merge branch 'export-default-declarations' of https://github.com/sebmck/acorn 2014-12-27 19:55:15 +11:00
Sebastian McKenzie
0bea7c9d51 Fix export default functions and classes being parsed as expressions instead of declarations 2014-12-27 19:54:23 +11:00
Marijn Haverbeke
5512e26ac0 Note allowHashBang option in README
Issue #180
2014-12-18 10:19:22 +01:00
Ingvar Stepanyan
adec9f4b8e Provide better error on member expression in binding's left side. 2014-12-17 20:37:00 +02:00
Ingvar Stepanyan
e37c07248e Added optional support for hashbang directives.
Fixes #180.
2014-12-17 19:58:38 +02:00
Marijn Haverbeke
8e84aa02f4 Bump version number post-0.11 2014-12-17 11:54:40 +01:00
Marijn Haverbeke
78e1d7ada6 Mark version 0.11.0 2014-12-17 11:54:09 +01:00
Marijn Haverbeke
97f4e9a026 [loose parser] Make unclosed objects / lists span to the start of the next node
That way, whitespace at their end is considered part of them,
and Tern can recognize when the cursor is inside of them.
2014-12-17 11:53:20 +01:00
Sebastian McKenzie
804481aad8 Merge pull request #11 from fkling/export_async
Support async functions in export declarations
2014-12-16 17:43:21 +11:00
Felix Kling
59c9f473ae Support async functions in export declarations
6to5 is able to transpile `export async function foo(){}` but acorn-6to5 is
unable to parse it.
2014-12-15 22:33:47 -08:00
Marijn Haverbeke
75b58c07d4 [loose parser] Improve autoclosing of expression lists 2014-12-15 17:32:38 +01:00
Sebastian McKenzie
16b7d59ae5 allow async generator functions - closes #10 - thanks @fkling 2014-12-15 09:39:24 +11:00
Sebastian McKenzie
e3b63530b1 bump version 2014-12-14 14:52:25 +11:00
Sebastian McKenzie
e0b6302649 add support for private declarations 2014-12-14 13:19:22 +11:00
Sebastian McKenzie
c30abbb52b Merge branch 'flow-types' of https://github.com/RReverser/acorn-jsx
Conflicts:
	acorn.js
	package.json
2014-12-13 12:45:28 +11:00
Sebastian McKenzie
46977807b7 fix isX variables not being reset on parseObj 2014-12-13 12:33:07 +11:00
Sebastian McKenzie
3a59b5a151 better async contextual identifiers 2014-12-13 12:06:42 +11:00
Sebastian McKenzie
24115acee0 Add flow type support 2014-12-13 05:01:29 +11:00
Ingvar Stepanyan
f188613e09 Add support for unknown entities (treat as ampersand + regular text).
Fixes #10.
2014-12-12 18:46:58 +02:00
Sebastian McKenzie
8bef320d58 change bind member operator to a hash - fixes #6 2014-12-13 00:47:13 +11:00
Sebastian McKenzie
71bb9d6123 contextual async/await keywords - closes 6to5/6to5#157 2014-12-13 00:37:40 +11:00
Marijn Haverbeke
6915519498 Give TemplateElements a narrower range
Issue #169
2014-12-11 17:44:45 +01:00
Marijn Haverbeke
c671bcfaf7 Bump version number post-0.10 2014-12-11 14:52:32 +01:00
Marijn Haverbeke
0a812b6020 Mark release 0.10.0 2014-12-11 14:51:45 +01:00
Marijn Haverbeke
c989857aa5 Add allowImportExportEverywhere option
Closes #174
2014-12-11 14:48:03 +01:00
Marijn Haverbeke
91e5ac0fdd Make loose parser parse template strings 2014-12-11 14:30:24 +01:00
Marijn Haverbeke
2cb3dbcb41 Change token structure of template literals
Fix various template parsing issues, makes tokenizer useable from outside
the parser.

Closes #169
Closes #173
2014-12-11 14:20:01 +01:00
Sebastian McKenzie
53d98f1175 Make semicolon optional in do-while in >=ES6 2014-12-10 13:14:25 +01:00
Sebastian McKenzie
6623756312 bump version 2014-12-10 21:49:55 +11:00
Sebastian McKenzie
1b760db578 Merge branch 'master' of https://github.com/RReverser/acorn 2014-12-10 20:32:56 +11:00
Sebastian McKenzie
4d985230cc Merge branch 'do-optional-semicolon' of https://github.com/sebmck/acorn 2014-12-10 19:07:39 +11:00
Sebastian McKenzie
c87a7a7095 Revert "Merge branch 'do-optional-semicolon' of https://github.com/sebmck/acorn"
This reverts commit c526814896711439b89f613fe0412aad4c1730a8, reversing
changes made to e7fea263dac65061941a4cee25c7a84c4e50c8bf.
2014-12-10 19:07:27 +11:00
Sebastian McKenzie
841ab6802f Make semicolon optional in do-while in >=ES6 2014-12-10 18:59:24 +11:00
Sebastian McKenzie
03891a7f8c Merge branch 'do-optional-semicolon' of https://github.com/sebmck/acorn 2014-12-10 15:24:44 +11:00
Sebastian McKenzie
7dbddd566c Merge branch 'master' of https://github.com/marijnh/acorn
Conflicts:
	acorn.js
2014-12-10 15:24:36 +11:00
Sebastian McKenzie
876eed9c04 Add dot question token 2014-12-10 15:21:19 +11:00
Sebastian McKenzie
49119b7714 Make semicolon optional in do-while 2014-12-10 15:19:45 +11:00
Marijn Haverbeke
e252acbe67 Upgrade jQuery used as test input
Closes #175
2014-12-09 15:36:50 +01:00
Ingvar Stepanyan
96bc831306 Fix #173. 2014-12-07 19:55:31 +02:00
Sebastian McKenzie
404058f9da Add object memo getters, this expressions and improve tenary syntax in playground 2014-12-06 20:43:32 +11:00
Sebastian McKenzie
ac197399bb Add @ token 2014-12-05 14:46:56 +11:00
Sebastian McKenzie
7a0fb32064 Add playground conditionals check 2014-12-05 14:46:51 +11:00
Marijn Haverbeke
e98176d5e9 Fix bug in update_authors.sh 2014-12-04 21:48:10 +01:00
Sebastian McKenzie
0bf7938142 Merge branch 'master' of https://github.com/RReverser/acorn-jsx
Conflicts:
	acorn.js
	package.json
2014-11-30 11:09:25 +11:00
Ingvar Stepanyan
879d40989a Fix #9 by removing invalid logic introduced with #1. 2014-11-28 16:51:50 +02:00
Sebastian McKenzie
d14f446177 rename PretzelMap to BindFunctionExpression 2014-11-26 17:23:11 +11:00
Sebastian McKenzie
2ec2a4b5af add pretzel maps 2014-11-26 16:16:47 +11:00
Sebastian McKenzie
9e204a7fee add playground 2014-11-25 23:48:48 +11:00
Ingvar Stepanyan
33d5082043 Parse import Thing ... in the same way as import {default as Thing} ....
Adjusts with Reflect.parse output and simplifies handling of "default" case
in external tools by providing regular named ImportSpecifier.
2014-11-23 14:06:13 +02:00
Sebastian McKenzie
f9c642e2c5 add support for ES7 exponentiation operator 2014-11-23 22:56:24 +11:00
Sebastian McKenzie
f8ee0c3066 bump version 2014-11-23 21:45:56 +11:00
Sebastian McKenzie
25c45a1e8e add support for es7 object/spread and move acorn-6to5 tests to a separate file 2014-11-23 21:00:15 +11:00
Sebastian McKenzie
9b38a4826b add support for abstract references 2014-11-23 17:43:46 +11:00
Sebastian McKenzie
6b4f40f556 Merge branch 'master' of https://github.com/RReverser/acorn-jsx
Conflicts:
	package.json
2014-11-23 11:30:14 +11:00
Ingvar Stepanyan
7a3683de2b Fix space not being skipped after object literal inside expression container.
Fixes #7.
2014-11-22 11:51:28 +02:00
Sebastian McKenzie
f3f49cee80 Fix #5 regression text 2014-11-20 21:38:16 +11:00
Sebastian McKenzie
16b298f38c 0.9.1-3 2014-11-20 21:26:45 +11:00
Sebastian McKenzie
5ad85c5612 Merge https://github.com/RReverser/acorn-jsx
Conflicts:
	package.json
	test/run.js
2014-11-20 21:26:40 +11:00
Sebastian McKenzie
b3ddc683a4 0.9.1-2 2014-11-20 21:25:43 +11:00
Ingvar Stepanyan
731984ebc7 Update version. 2014-11-20 12:23:49 +02:00
Ingvar Stepanyan
29c028acf9 Temporarily disable JSX parser. 2014-11-20 12:22:53 +02:00
Ingvar Stepanyan
46c95f5aee Merge pull request #6 from sebmck/patch-1
Fix spread attributes within elements inside expression containers.
2014-11-20 12:22:15 +02:00
Sebastian McKenzie
20a5d62ac6 Add regression test for #5 2014-11-20 21:07:03 +11:00
Sebastian McKenzie
d3e987896c Fix spread attributes within elements inside expression containers 2014-11-20 19:46:47 +11:00
Ingvar Stepanyan
51bc64a558 Update tests for #158 2014-11-19 20:23:38 +01:00
Ingvar Stepanyan
ba73b0e17e Disallow parenthesis in patterns
Fixes #155
2014-11-19 20:23:37 +01:00
Ingvar Stepanyan
4496ca411a Fixed import declaration for default+batch case.
Also removed deprecated `kind` property.
Fixes #161.
2014-11-19 14:05:34 +01:00
Sebastian McKenzie
5e119c22d6 Revert "Better async/await support"
This reverts commit 89437cfd7f8bb380490fb574fd91a128a120f5b4.
2014-11-19 13:20:59 +11:00
Sebastian McKenzie
f35dad0980 Revert "fix up async/await"
This reverts commit f18f264a330258da521027cc4edd5852e26f8add.
2014-11-19 13:20:47 +11:00
Sebastian McKenzie
b0bf126c22 fix up async/await 2014-11-19 12:49:41 +11:00
Sebastian McKenzie
d09acb7d3b disable loose test runner 2014-11-19 12:49:33 +11:00
Sebastian McKenzie
7393455b2e Merge pull request #2 from Naddiseo/async_await
Better async/await support
2014-11-19 12:00:10 +11:00
Richard Eames
68acfb7cc5 Better async/await support 2014-11-18 13:08:24 -07:00
Sebastian McKenzie
61810eef8d Merge https://github.com/RReverser/acorn-jsx
Conflicts:
	acorn.js
	package.json
2014-11-15 11:34:27 +11:00
Ingvar Stepanyan
82f88c459d Fix ignored whitespaces before children elements.
Similar to 790afe (template literals).
Fixes #4.
2014-11-15 02:30:12 +02:00
Ingvar Stepanyan
8ef9ecc34d Update version. 2014-11-13 19:25:25 +02:00
Ingvar Stepanyan
42d21f5064 Merge branch 'upstream' into jsx
Conflicts:
	acorn.js
	test/run.js
2014-11-13 19:25:00 +02:00
Sebastian McKenzie
b3c4ca26fa Merge branch 'async-await' of https://github.com/sebmck/acorn 2014-11-13 13:17:10 +11:00
Sebastian McKenzie
2506be7b1a Add support for exporting async functions 2014-11-13 13:16:49 +11:00
Sebastian McKenzie
e58be3b8bb Merge branch 'master' of https://github.com/marijnh/acorn
Conflicts:
	acorn.js
	test/run.js
2014-11-13 12:48:14 +11:00
Rich Harris
f48a921e24 allow export { default } from "foo" 2014-11-12 17:42:55 +01:00
Marijn Haverbeke
98691e5b80 Properly initialize top node start position 2014-11-12 17:31:45 +01:00
Marijn Haverbeke
249e6961f8 Make tests pass for loose parser
Define Program node extent to be the whole program, make
both parser and the tests conform to this.

Fix a bunch of bugs in the loose parser's handling of corner
cases.

Issue #151
2014-11-12 17:05:19 +01:00
Ingvar Stepanyan
bc64d3c5f4 Add support for nested groups in log (Chrome console + browser). 2014-11-12 16:19:16 +01:00
Ingvar Stepanyan
96ccdb05fa Web-driver support for loose parser + small fixes.
* Added support for acorn_loose and grouped log to web-driver.
* Removed unused copy-pasted `parseTemplate` from loose parser.
* Throw non-SyntaxError errors immediately (as those are generic).
2014-11-12 16:19:16 +01:00
Ingvar Stepanyan
6bf8311061 Loose: fix #33. 2014-11-12 16:19:16 +01:00
Ingvar Stepanyan
2419de74dc Loose: Fix regex after tokenizer changes in #144. 2014-11-12 16:19:16 +01:00
Ingvar Stepanyan
fc2e96fa01 Loose: respect optional semicolons in break/continue/class/import/export. 2014-11-12 16:19:16 +01:00
Ingvar Stepanyan
d4565fed53 Loose: ES6 import, export.
Removed "kind" from tests for ES6 import/export as it's
left only for backward compatibility.
2014-11-12 16:19:15 +01:00
Ingvar Stepanyan
4647f966eb Loose: don't silently skip missed elements in expr list. 2014-11-12 16:19:15 +01:00
Ingvar Stepanyan
aa96edf769 Loose: support for-of without var. 2014-11-12 16:19:15 +01:00
Ingvar Stepanyan
1589a959fa Loose: yield support. 2014-11-12 16:19:15 +01:00
Ingvar Stepanyan
80f8d527ff Loose: Skip ES7 tests as we are targeting ES6 now. 2014-11-12 16:19:15 +01:00
Ingvar Stepanyan
bdce88c184 Loose: for-of statement. 2014-11-12 16:19:15 +01:00
Ingvar Stepanyan
992fc0503d Loose: arrow functions. 2014-11-12 16:19:15 +01:00
Ingvar Stepanyan
ede10a079c Loose: class support. 2014-11-12 16:19:15 +01:00
Ingvar Stepanyan
c6b6ef389e Loose: Remove own tabSize initialization in favor of defaultOptions. 2014-11-12 16:19:15 +01:00
Ingvar Stepanyan
9cdc6809ce Loose: fix pattern+defaults case in function params. 2014-11-12 16:19:15 +01:00
Ingvar Stepanyan
b46b53e149 Loose: implement object methods; expose processed options from acorn. 2014-11-12 16:19:15 +01:00
Ingvar Stepanyan
143066184c Emit full stack trace for unknown exceptions. 2014-11-12 16:19:15 +01:00
Ingvar Stepanyan
dda90580df Loose: Added support for shorthand properties. 2014-11-12 16:19:15 +01:00
Ingvar Stepanyan
963a26e46f Loose: Added support for let and const.
Fixes #146.
2014-11-12 16:19:15 +01:00
Ingvar Stepanyan
4879af22d1 Loose: Added support for assignment patterns to expression and variables. 2014-11-12 16:19:15 +01:00
Ingvar Stepanyan
c5145cedb2 Fix no-options case for acorn. 2014-11-12 16:19:14 +01:00
Ingvar Stepanyan
eba8a5646c Loose: added support for holes in arrays (but disallows trailing comma). 2014-11-12 16:19:14 +01:00
Ingvar Stepanyan
a14a5c8192 Loose: Added support for rest parameters.
Includes correction of mistype ".." vs "...".
2014-11-12 16:19:14 +01:00
Ingvar Stepanyan
b47696eecf Avoid UnaryExpression-specific properties in SpreadElement (just in case). 2014-11-12 16:19:14 +01:00
Ingvar Stepanyan
72df78cc88 Avoid separate handling of SpreadElement in favor of UnaryExpression parser. 2014-11-12 16:19:14 +01:00
Ingvar Stepanyan
ac8bdc608d Allow specifying expected comments/tokens arrays with onComment/onToken.
Allows to avoid both custom `testAssert` and adding extra arguments in `test`.
2014-11-12 16:19:14 +01:00
Ingvar Stepanyan
6d64834352 Removed manual onComment test in favor of new argument. 2014-11-12 16:19:14 +01:00
Ingvar Stepanyan
0abe4b64a8 Collect test stats separately for each mode. 2014-11-12 16:19:14 +01:00
Ingvar Stepanyan
b7367a2a8c Make setOptions non-destructive for original object. 2014-11-12 16:19:14 +01:00
Ingvar Stepanyan
11ecb20e9e Loose: ES6 function params support. 2014-11-12 16:19:14 +01:00
Ingvar Stepanyan
c26fd33826 Clone test options object since calling parse is destructive for it. 2014-11-12 16:19:14 +01:00
Ingvar Stepanyan
61d2067b2b Loose: Added ParenthesizedExpression. 2014-11-12 16:19:13 +01:00
Ingvar Stepanyan
7db211d56a Added loose parser support to test runner (currently failing for 208/1680). 2014-11-12 16:19:13 +01:00
Ingvar Stepanyan
d424874cf8 Editorconfig: enforce Unix line endings and extra new line in the end of file. 2014-11-12 16:19:13 +01:00
Ingvar Stepanyan
86f8c56d2b Added .editorconfig. 2014-11-12 16:19:13 +01:00
Ingvar Stepanyan
074db16fb7 Indentation fix. 2014-11-12 16:19:13 +01:00
Ingvar Stepanyan
d745bd7e32 Make test runner more generic. 2014-11-12 16:19:13 +01:00
Sebastian McKenzie
c5ca7ee32c Add remaining esprima-fb async/await tests 2014-11-12 20:41:55 +11:00
Sebastian McKenzie
81f3b99251 Merge branch 'async-await' of https://github.com/sebmck/acorn
Conflicts:
	acorn.js
2014-11-11 09:46:46 +11:00
Sebastian McKenzie
273dda04f1 Revert "Merge branch 'async-await' of https://github.com/sebmck/acorn"
This reverts commit 904d46ae736214d50da3a5c2b616204f0e0ae7d1, reversing
changes made to 49e421660af161af0e75c2fa066ea356d6650e69.
2014-11-11 09:43:15 +11:00
Sebastian McKenzie
211b3a6fdf Implement ES7 Async/Await 2014-11-11 09:29:56 +11:00
Sebastian McKenzie
ea1119c72c Merge branch 'patch-1' of https://github.com/RReverser/acorn 2014-11-11 09:20:05 +11:00
Sebastian McKenzie
59990722e4 Merge branch 'async-await' of https://github.com/sebmck/acorn
Conflicts:
	acorn.js
2014-11-11 09:18:57 +11:00
Sebastian McKenzie
ac42c108f4 Implement ES7 Async/Await 2014-11-11 09:13:42 +11:00
Ingvar Stepanyan
1f1a476930 Update tests for #158 2014-11-09 16:02:12 +02:00
Sebastian McKenzie
9f8ab713de Merge branch 'patch-1' of https://github.com/RReverser/acorn 2014-11-10 00:11:46 +11:00
Sebastian McKenzie
97c06f2699 Revert "Merge branch 'check-lval-paren-expressions' of https://github.com/sebmck/acorn"
This reverts commit c8d701914832367e3cc6f570f8da9e6096d26eef, reversing
changes made to 0f40710d6a6c846d613764f314e9fb38c247e471.
2014-11-10 00:10:54 +11:00
Ingvar Stepanyan
d231f10c36 Disallow parenthesis in patterns
Fixes #155
2014-11-09 15:08:59 +02:00
Sebastian McKenzie
41f7959d9c fix package.json identation 2014-11-09 16:11:16 +11:00
Sebastian McKenzie
fc046bab54 remove build status from readme 2014-11-09 16:09:22 +11:00
Sebastian McKenzie
c90022e97f fix sebmck@gmail.com email 2014-11-09 16:09:16 +11:00
Sebastian McKenzie
39e0b51d17 Merge branch 'check-lval-paren-expressions' of https://github.com/sebmck/acorn 2014-11-09 13:07:41 +11:00
Sebastian McKenzie
521ab6c11d Support ParanthesizedExpressions in checkLval 2014-11-09 13:07:00 +11:00
Sebastian McKenzie
a18f3d1003 Add support for computed static mutator class methods 2014-11-04 11:08:36 +01:00
Sebastian McKenzie
f82896a919 Merge branch 'computed-static-mutator-class-methods' of https://github.com/sebmck/acorn 2014-11-04 11:41:49 +11:00
Sebastian McKenzie
4f0c37eb68 Add support for computed static mutator class methods 2014-11-04 11:40:49 +11:00
Sebastian McKenzie
7f57741824 fix options.strictMode reference 2014-11-03 22:39:26 +11:00
Sebastian McKenzie
16063dd8b3 add strictMode option 2014-11-02 14:18:40 +11:00
Sebastian McKenzie
21900ae2b0 add acorn-jsx shoutout to readme 2014-11-01 23:18:01 +11:00
Sebastian McKenzie
d6771b1cef update package.json 2014-11-01 23:17:32 +11:00
Sebastian McKenzie
62670e74cb remove readme 2014-11-01 23:17:25 +11:00
Sebastian McKenzie
71832ee45d Merge branch 'master' of https://github.com/marijnh/acorn 2014-10-29 21:02:48 +11:00
Sebastian McKenzie
fb0fb90911 Merge branch 'fix-semicolons-modules' of https://github.com/sebmck/acorn
Conflicts:
	acorn.js
2014-10-29 21:02:26 +11:00
Sebastian McKenzie
9d3580b23a make ImportDeclaration and ExportDeclaration semicolons more spec-compliant 2014-10-29 10:46:39 +01:00
Sebastian McKenzie
1be5b3c823 make ImportDeclaration and ExportDeclaration semicolons more spec-compliant 2014-10-29 20:35:37 +11:00
Marijn Haverbeke
8a799c6077 Remove redundant range info from tests 2014-10-27 10:59:16 +01:00
Ingvar Stepanyan
f26b656ea5 Remove property name clash check in ES6 as per Draft Rev 26.
See https://github.com/rwaldron/tc39-notes/blob/master/es6/2014-06/jun-6.md#conclusionresolution-3 for details.

Conflicts:
	test/tests-harmony.js
2014-10-27 10:56:06 +01:00
Marijn Haverbeke
5d1db2e993 Only apply kludge from f48503cd31 when unicode regexps are not supported 2014-10-27 10:54:46 +01:00
Sebastian McKenzie
f48503cd31 add unicode flag support to regex 2014-10-27 10:51:23 +01:00
Ingvar Stepanyan
fd79ac5879 Move comprehension support under ecmaVersion: 7 as per spec. 2014-10-27 10:34:53 +01:00
Sebastian McKenzie
0cc9322bca Merge branch 'add-unicode-regex-support' of https://github.com/sebmck/acorn
Conflicts:
	acorn.js
2014-10-25 12:52:21 +11:00
Sebastian McKenzie
6eeb101185 add regex tests 2014-10-25 09:02:34 +11:00
Sebastian McKenzie
397d87fd11 add additional regex property to regex literals containing pattern and flags 2014-10-25 09:02:24 +11:00
Ingvar Stepanyan
156fee8b4d Update version. 2014-10-22 14:09:05 +03:00
Ingvar Stepanyan
d27a568002 Merge pull request #3 from sebmck/master
Merge with latest acorn.
2014-10-22 14:07:03 +03:00
Sebastian McKenzie
7a4715c2de Merge branch 'master' of https://github.com/marijnh/acorn
Conflicts:
	acorn.js
	package.json
2014-10-22 21:30:58 +11:00
Marijn Haverbeke
5ff7e59a0a Remove bogus support for \U escapes
Issue #147
2014-10-21 16:39:48 +02:00
Marijn Haverbeke
437ce2d9be [loose parser] Ignore shebang lines
Closes marijnh/tern#408
2014-10-21 12:35:06 +02:00
Mike Rennie
ad69446c0a Make parse_dammit honour the 'ranges' option
Closes #140
2014-10-21 12:14:18 +02:00
Marijn Haverbeke
51e0b81eea Note lack of es6 support in parse_dammit in the README 2014-10-21 10:24:57 +02:00
Sebastian McKenzie
0258dafa8a add unicode flag support to regex 2014-10-19 18:01:34 +11:00
Max Schaefer
d525c45644 Add option for representing parenthesized expressions in the AST. 2014-10-13 12:19:39 +02:00
Max Schaefer
e9c7209f8b Guard against missing elements in array patterns when checking function parameters. 2014-10-13 12:17:29 +02:00
Marijn Haverbeke
bdee9e8195 Make locations in loose parser consistent with those in regular parser
Issue #136
2014-10-08 12:35:57 +02:00
Marijn Haverbeke
3603f7d0b1 Adjust start positions of parenthesized expressions to not include parentheses
Issue #136
2014-10-08 11:52:49 +02:00
Marijn Haverbeke
1c9e0a9272 Bump version number post 0.9 2014-10-01 23:21:56 +02:00
Marijn Haverbeke
01a89cfec1 Mark release 0.9.0 2014-10-01 23:21:25 +02:00
r-e-d
f3e759cd03 Strict mode incorrectly reset after function 2014-09-30 11:45:20 +02:00
Max Schaefer
015a0e90bc Only accept for-of loops in ECMA6 mode. 2014-09-29 11:27:14 +02:00
Ingvar Stepanyan
daedc6fcb3 Fixes #129 and spaces in template quasi literals.
* Added hack to correctly handle skipped spaces after= template expressions.
* Added `null` default values for regular functions.
* Added regression tests for both.
2014-09-26 17:04:22 +02:00
Ingvar Stepanyan
203384f7c2 Fixes marijnh/acorn#127. 2014-09-23 22:58:44 +02:00
Marijn Haverbeke
6ea4139be1 Add note about deprecated scopeVisitor object
See issue #126
2014-09-22 17:08:50 +02:00
Marijn Haverbeke
49680b1c60 [loose parser] Take brace-line indentation into account for objlit closing heuristic 2014-09-22 15:15:12 +02:00
Marijn Haverbeke
39fa62e90f [loose parser] Be slightly more agressive about heuristically closing object literals 2014-09-22 15:03:54 +02:00
Marijn Haverbeke
12cbfed34f [loose parser] Don't omit unfinished object literal properties 2014-09-22 14:46:41 +02:00
Ingvar Stepanyan
96024e6950 Updated docs. 2014-09-17 20:55:59 +03:00
Ingvar Stepanyan
9c17926e3f Version update.
Simplified shouldSkipSpace condition, fixed indentation.
2014-09-17 20:54:41 +03:00
Ingvar Stepanyan
4b4c63f924 Merge pull request #1 from NekR/master
Fix in child XJS MemberExpression.
2014-09-17 20:42:02 +03:00
Marijn Haverbeke
d0497ab212 Add parseExpressionAt function to the API 2014-09-15 21:03:07 +02:00
Marijn Haverbeke
ac31b0314c Bump version number post-0.8 2014-09-12 16:57:40 +02:00
Marijn Haverbeke
456f74e34f Mark version 0.8.0 2014-09-12 16:57:17 +02:00
Marijn Haverbeke
d98a432673 Really remove html from git repository
(The hook was still in place last time.)
2014-09-12 16:55:42 +02:00
Marijn Haverbeke
0322beb0aa Add a prepublish step to package.json 2014-09-12 16:54:28 +02:00
Marijn Haverbeke
4d4daa07e0 Don't keep the docco output in the repository anymore 2014-09-12 15:50:34 +02:00
Marijn Haverbeke
91911bcfcd Add bin/without_eval utility 2014-09-12 14:08:31 +02:00
Arthur Stolyar
78a6caf673 Add test for inXJSChild MemberExpression 2014-09-09 02:12:39 +03:00
Arthur Stolyar
d3cece14fd Fix spaceSkip after inXJSChildExpression 2014-09-09 01:56:30 +03:00
Arthur Stolyar
ae9fae6c76 Fix in child XJS MemberExpression 2014-09-09 01:06:52 +03:00
Ingvar Stepanyan
533d1d62ec Updated docs. 2014-09-09 00:06:06 +03:00
Ingvar Stepanyan
fe805f396e Update version. 2014-09-08 23:58:44 +03:00
Ingvar Stepanyan
3086621905 Merge branch 'master' into jsx. 2014-09-08 23:58:19 +03:00
Ingvar Stepanyan
10553cbced Make token format compatible with Esprima and Mozilla-styled locations.
* Tokens are now instances of single exported constructor Token.
* Token objects are compatible with Esprima (only `type` format is different).
* Added token.loc in format of node.loc (Mozilla).
* Deprecated token.startLoc & token.endLoc.
* Updated comment generation example.

Also added ability to pass arrays in `onToken`/`onComment` where
tokens/comments will be collected in Esprima's format so you can
simply pass those arrays to `escodegen.attachComments`.

Updated docs and comment attachment example.
2014-09-08 12:20:08 +02:00
Ingvar Stepanyan
5c89414c5a Final polishing after rebase. 2014-09-05 17:23:03 +03:00
Ingvar Stepanyan
2fbf640e60 Update README.md 2014-09-05 17:15:29 +03:00
Ingvar Stepanyan
35c8f104bd Spread attribute support and small optimizations.
Conflicts:
	acorn.js
	docs/acorn.html
	package.json
	test/tests.js
2014-09-05 17:01:42 +03:00
Max Schaefer
a246bf83d0 Do not throw syntax error if strict mode function has same name as one of its parameters. 2014-09-05 15:59:57 +02:00
Ingvar Stepanyan
fe6cafa141 Upgrade esprima to esprima-fb and update docs.
Conflicts:
	test/compare/esprima.js
2014-09-05 16:54:56 +03:00
Ingvar Stepanyan
817120b370 Small test refactoring. 2014-09-05 16:54:29 +03:00
Ingvar Stepanyan
95a1231c6d Metadata & docs updates.
Conflicts:
	.gitignore
	README.md
	acorn.js
	index.html
	package.json
2014-09-05 16:54:29 +03:00
Max Schaefer
7da3b6f1fd Fix start position for HTML comments and add tests. 2014-09-05 15:53:36 +02:00
Ingvar Stepanyan
daf9e82ab5 Final fixes for spaces.
Conflicts:
	acorn.js
2014-09-05 16:50:23 +03:00
Ingvar Stepanyan
7560ba4c94 Fixed in-tag spaces in hacky way (to be refactored).
Conflicts:
	acorn.js
2014-09-05 16:49:07 +03:00
Ingvar Stepanyan
292942c1d8 Small refactoring related to handling XJSText.
Conflicts:
	acorn.js
2014-09-05 16:48:50 +03:00
Ingvar Stepanyan
4ed5087bea Revert space counting after the opening tag in favor of better fix since this one introduces extra parsing error.
Conflicts:
	acorn.js
2014-09-05 16:48:40 +03:00
Ingvar Stepanyan
77e05c4edc Fixed XJSEmptyExpression location tracking. 2014-09-05 16:47:57 +03:00
Ingvar Stepanyan
f53f89a0ae Fixed test with parenthesis. 2014-09-05 16:47:57 +03:00
Ingvar Stepanyan
3253f56602 Fixed skipping spaces at the beginning of JSX contents.
Conflicts:
	acorn.js
2014-09-05 16:47:57 +03:00
Ingvar Stepanyan
2c3740c159 Fixed nesting elements in attributes. 2014-09-05 16:43:17 +03:00
Ingvar Stepanyan
5d2ace2f58 Added JSX text and string literal parsing. 2014-09-05 16:43:17 +03:00
Ingvar Stepanyan
22e8f7b90e Added basic attribute and element nesting support. 2014-09-05 16:43:16 +03:00
Ingvar Stepanyan
6091a0cf55 Added JSX-specific identifier parsing.
Conflicts:
	acorn.js
2014-09-05 16:43:16 +03:00
Ingvar Stepanyan
b4c5d1f2e9 Added support for namespaces and member expressions in tag names. 2014-09-05 16:42:29 +03:00
Ingvar Stepanyan
283d47c038 Started porting JSX support from esprima-fb.
Conflicts:
	acorn.js
	test/tests.js
2014-09-05 16:42:29 +03:00
Marijn Haverbeke
6c854ad221 [loose parser] Be more careful about calling resetTo
It will try to eat whitespace, and can thus raise an unterminated comment exception

Issue #375
2014-09-05 15:31:15 +02:00
Marijn Haverbeke
40f1c67161 Remove trailing whitespace from acorn.js 2014-08-21 18:12:04 +02:00
Max Schaefer
1ca2115294 Remove unused local variables. 2014-08-21 18:10:48 +02:00
Marijn Haverbeke
e58f401b82 Bump version number post 0.7 2014-08-14 13:25:01 +02:00
Marijn Haverbeke
fe767e4cd8 Mark version 0.7.0 2014-08-14 13:24:24 +02:00
Marijn Haverbeke
69cadaa1e9 Add basic ES6 support in util/walk.js 2014-08-14 13:23:03 +02:00
Ingvar Stepanyan
372e1d42f3 Split ES6 Template logic from main functionality. 2014-08-14 12:48:50 +02:00
Marijn Haverbeke
d1a5db36cc Fix sentence broken by 11dc953bc6 2014-08-14 12:48:12 +02:00
Ingvar Stepanyan
11dc953bc6 Fix docs about sourceFile/directSourceFile. 2014-08-14 12:47:26 +02:00
Ingvar Stepanyan
ef045b9718 Remove copyToken from acorn_loose (not needed anymore). 2014-07-31 14:33:40 +03:00
Ingvar Stepanyan
1bf8c1420f Added example for comments attachment.
* Fixed `onToken` & `tokenize` to return `startLoc` & `endLoc`
in token object only when `options.locations` is `true`.
* Fixed `onToken` tests.
* Added example for generating comments with escodegen.
2014-07-31 14:01:39 +03:00
Ingvar Stepanyan
be11e04383 Added onToken support. 2014-07-31 14:01:39 +03:00
Ingvar Stepanyan
278ac258df Moved inTemplate initializer to appropriate place. 2014-07-31 14:01:38 +03:00
Marijn Haverbeke
73a890d6be More nuanced attribution in comment 2014-07-29 15:18:59 +02:00
Marijn Haverbeke
292f8ece64 Re-run update_authors.sh to get proper project name in AUTHORS 2014-07-29 15:14:02 +02:00
Marijn Haverbeke
aac1807838 Include Harmony tests in test/index.html 2014-07-29 14:43:20 +02:00
Ingvar Stepanyan
3393460ebb Fix Travis URL for future merge. 2014-07-29 14:41:50 +02:00
Ingvar Stepanyan
de48f8434d Fixes for ES3 compatibility. 2014-07-29 14:41:50 +02:00
Ingvar Stepanyan
f0579c3e56 Renamed _multiplyModulo to _modulo as it's left as the only purpose of this token. 2014-07-29 14:41:50 +02:00
Ingvar Stepanyan
4663f6ae95 Update README.md 2014-07-29 14:41:49 +02:00
Ingvar Stepanyan
ff9c3550a4 Allow computed class method names (as per ariya/esprima#271). 2014-07-29 14:41:49 +02:00
Ingvar Stepanyan
acbef8557f Treat line ending after yield keyword as end of YieldExpression
(as per http://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-runtime-semantics-evaluation).
2014-07-29 14:41:45 +02:00
Ingvar Stepanyan
9d552efe45 Added Generator Comprehension support. 2014-07-29 14:41:44 +02:00
Ingvar Stepanyan
1c548e7848 Add missing Traceur source to repo. 2014-07-29 14:41:44 +02:00
Ingvar Stepanyan
e9635f450e Delete harmonytest.js 2014-07-29 14:41:44 +02:00
Ingvar Stepanyan
afefac56bf Added test to represent "import x, { ... } from 'module'" case. 2014-07-29 14:41:44 +02:00
Ingvar Stepanyan
9d5e0e7973 Increased benchmark time to 5 seconds per parser to get more realistic numbers. 2014-07-29 14:41:44 +02:00
Ingvar Stepanyan
711d21ec5a Simplified name clash test. 2014-07-29 14:41:44 +02:00
Ingvar Stepanyan
8d30ad6196 Added separate token for star ('*') as it may have special meaning.
Fixed name clash check.
Moved check functions to single place.
2014-07-29 14:41:38 +02:00
Ingvar Stepanyan
8b19246615 Replaced UglifyJS2 with Traceur for fair comparison of ES6-enabled parsers. 2014-07-29 14:41:38 +02:00
Ingvar Stepanyan
7aab3539ce Cleaning up + performance improvement by using hash objects for name clash checks. 2014-07-29 14:41:38 +02:00
Ingvar Stepanyan
67615ffd41 Simplified newline check in strings. 2014-07-29 14:41:38 +02:00
Ingvar Stepanyan
1955e94925 Removed keywords that are not actual keywords
as per https://people.mozilla.org/~jorendorff/es6-draft.html#sec-keywords in favor of "magic" identifiers.
2014-07-29 14:41:33 +02:00
Ingvar Stepanyan
82b9f30fc9 Allow some keywords to be treated as identifier names; update ecmaVersion in benchmark. 2014-07-29 14:41:32 +02:00
Ingvar Stepanyan
eb7ccea743 Stricter tokVal -> tokType comparisons. 2014-07-29 14:41:32 +02:00
Ingvar Stepanyan
a061f1f0a6 Updated README and bin utility to be aware of ES6 support. 2014-07-29 14:41:32 +02:00
Ingvar Stepanyan
3ee9e288a2 Forbid spread element in sequence expressions. 2014-07-29 14:41:32 +02:00
Ingvar Stepanyan
8f96965d36 Added yield support (completed generators). 2014-07-29 14:41:32 +02:00
Ingvar Stepanyan
b8a3300a21 Added function * support (part of generators feature). 2014-07-29 14:41:32 +02:00
Ingvar Stepanyan
4f24e13fd5 Added template string support. 2014-07-29 14:41:32 +02:00
Ingvar Stepanyan
a8cf37fc46 Test fixes for imports. 2014-07-29 14:41:32 +02:00
Ingvar Stepanyan
26818e1f36 Removed module-related tests and implemented corresponding alternatives support.
`module ModuleName { ... }` was removed from spec in favor of separate files.
`module LocalName from '...'` is being replaced with `import * as LocalName from '...'` as per http://jsmodules.io/ and https://twitter.com/domenic/status/492735387140243456 (c) @domenic.
2014-07-29 14:41:29 +02:00
Ingvar Stepanyan
b38c15a94b Added export declaration support.
See http://people.mozilla.org/~jorendorff/es6-draft.html#sec-exports, ariya/esprima#216, square/es6-module-transpiler#63 for latest decisions on `export default 42` vs `export default = 42` (first wins, so returning AST as it was in older Esprima Harmony and used by https://github.com/square/es6-module-transpiler/).
2014-07-29 14:41:24 +02:00
Ingvar Stepanyan
f2dfeff977 Added test for BindingPattern inside ArrayComprehension
(fails in esprima - https://code.google.com/p/esprima/issues/detail?id=570).
2014-07-29 14:41:18 +02:00
Ingvar Stepanyan
bcc97e2d52 Array Comprehensions as per latest ES6 drafts. 2014-07-29 14:41:18 +02:00
Ingvar Stepanyan
dd37866fdb Added backward-compatible test that object properties have type of "Property".
(Better fix for Constellation/estraverse#4, Constellation/escodegen#80 and similar bugs)
2014-07-29 14:41:10 +02:00
Ingvar Stepanyan
648f3159cc Added for (..of..) support and guard against for (let var=.. in|of ..) loops. 2014-07-29 14:41:09 +02:00
Ingvar Stepanyan
8b0be7cec9 Improved destruction assignment guards. 2014-07-29 14:41:09 +02:00
Ingvar Stepanyan
0f56e32512 Object shorthand properties; small fixes to ES6 function parameters. 2014-07-29 14:41:09 +02:00
Ingvar Stepanyan
50a82135c4 Recursive destructuring assignment with function arguments name clash checks. 2014-07-29 14:41:09 +02:00
Ingvar Stepanyan
66e6bcd10f Assignable patterns. 2014-07-29 14:41:09 +02:00
Ingvar Stepanyan
9b697af803 Destructuring assignments. 2014-07-29 14:41:09 +02:00
Ingvar Stepanyan
5ab6837208 Workaround for joyent/node#3584. 2014-07-29 14:41:09 +02:00
Ingvar Stepanyan
7c34bb34ce Exit should wait for stdout (joyent/node#1669). 2014-07-29 14:41:09 +02:00
Ingvar Stepanyan
3779ed41a4 Added exit code 1 for failed test session. 2014-07-29 14:41:09 +02:00
Ingvar Stepanyan
f7fe322490 Better parentheses check for arrow expression argument list. 2014-07-29 14:41:09 +02:00
Ingvar Stepanyan
1f801001cf ArrowExpression rest parameter support, brackets check and test fixes. 2014-07-29 14:41:09 +02:00
Ingvar Stepanyan
5d50be1447 Removed dirty hack in favor of fixed expected locations for arrow and method functions (node's location should include arguments). 2014-07-29 14:41:09 +02:00
Ingvar Stepanyan
19696af666 Added computed properties support. 2014-07-29 14:41:09 +02:00
Ingvar Stepanyan
1d3810dcdb Turned on Travis CI. 2014-07-29 14:41:09 +02:00
Ingvar Stepanyan
44a4f8c016 Added ES6 classes support. 2014-07-29 14:41:09 +02:00
Ingvar Stepanyan
eadda16c42 Added SpreadElement support.
testFail message fixes for object methods.
2014-07-29 14:41:09 +02:00
Ingvar Stepanyan
67bca2d549 Added object method support. 2014-07-29 14:41:09 +02:00
Ingvar Stepanyan
48f6ea8e63 Force LF endings in code. 2014-07-29 14:41:08 +02:00
Ingvar Stepanyan
a5cf393134 Fixed testFail messages for character escape sequences. 2014-07-29 14:41:08 +02:00
Ingvar Stepanyan
2db14fbb08 Checking argument names clash in strict mode for arrow functions.
Some more testFail message fixes.
2014-07-29 14:41:08 +02:00
Ingvar Stepanyan
47c4196d41 Some testFail message fixes. 2014-07-29 14:41:08 +02:00
Ingvar Stepanyan
16b9ba5db0 Fixed parsing x => 1, 2 like expressions. 2014-07-29 14:41:08 +02:00
Ingvar Stepanyan
757545a612 Basic ES6 Arrow Expressions support.
Added Property type to ObjectExpression properties.
Reserved ES6 properties in Property type.
2014-07-29 14:41:08 +02:00
Ingvar Stepanyan
12ac95732d Added ES6-specific Function properties. 2014-07-29 14:41:08 +02:00
Ingvar Stepanyan
839338b270 Added octal and binary number support; added ES6 version checks. 2014-07-29 14:41:08 +02:00
Ingvar Stepanyan
a31bad6773 ES6 Unicode Code Point Escape Sequence support. 2014-07-29 14:41:08 +02:00
Ingvar Stepanyan
47587e6e9b Turned on location tracking for harmony tests. 2014-07-29 14:41:08 +02:00
Ingvar Stepanyan
88e355a6ae Converted esprima's harmony tests. 2014-07-29 14:41:08 +02:00
Ingvar Stepanyan
937350dd84 Updated esprima and added harmonytest.js from ariya/esprima@2bb17ef9a4. 2014-07-29 14:41:08 +02:00
Marijn Haverbeke
7ac7d8fa5e Add an AUTHORS list 2014-07-29 14:33:33 +02:00
Marijn Haverbeke
14bd14088a Remove bogus copy-pasted chunk from LICENSE 2014-07-29 12:37:36 +02:00
Johannes Herr
3d35d067a8 Removed some dead code in parseThrowStatement 2014-07-24 15:51:00 +02:00
Marijn Haverbeke
3d444e8eca Update docco output for df9eda514a 2014-07-15 18:35:09 +02:00
Mathias Bynens
df9eda514a Add a script that generates the regular expressions for identifiers 2014-07-15 18:33:01 +02:00
Marijn Haverbeke
caeaf37c31 Fix another bogus piece of code from 31e77b975e 2014-06-17 11:08:12 +02:00
Marijn Haverbeke
c1b2742ee7 Bump version number post 0.6 2014-06-06 22:42:22 +02:00
Marijn Haverbeke
4435013900 Mark version 0.6.0 2014-06-06 22:42:03 +02:00
impinball
29feccf3cd Split up parseStatement()
It was purely interpreted by the V8 engine. Splitting it up allows the
individual pieces to be optimized, so less is interpreted.
2014-06-06 12:40:32 +02:00
Marijn Haverbeke
55b507b715 Note partial es6 support in docs 2014-06-06 12:11:20 +02:00
Artem Govorov
1e5bfc2c55 ecma 6 partial support: let and const 2014-06-06 12:10:09 +02:00
Marijn Haverbeke
3a34f7ba8c Add note about browser compatibility to README
Closes #105
2014-06-04 22:51:05 +02:00
Marijn Haverbeke
7f0f07e1f9 Check duplicate argument names for rest params
Issue #79
2014-05-28 23:24:10 +02:00
PlNG
dccd45528a Minor: Remove unused argument from readToken_slash
Possible dev relic.

readToken_slash currently does not have any arguments and does not appear to look at arguments. All existing tests pass after removal of extraneous argument while calling readToken_slash.
2014-05-28 22:27:41 +02:00
Marijn Haverbeke
5dcd50447b Clean up previous patch
Issue #100
2014-05-15 10:38:28 +02:00
impinball
31e77b975e Add option: --
Had a few bugs in the initial patch request (#98) as well...

Also, fixed the help() command to print to stderr on nonzero exit statuses given.
2014-05-15 10:32:32 +02:00
Brandon Mills
5552e866f9 Support rest parameters
http://wiki.ecmascript.org/doku.php?id=harmony:rest_parameters
The final parameter to a function is a rest parameter if it is
prefixed by "...". FunctionExpression and FunctionDeclaration
nodes have a new "rest" property that is null if there is no
rest parameter, or contains an Identifer for the parameter.
https://developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_API#Functions

Implemented by adding a new token, `_ellipsis`, which consists of
three dots. Modified the body of parseFunction to allow a single
rest parameter at the end of an argument list. Both the token and
the rest parameter require `options.ecmaVersion` >= 6, otherwise
three dots are tokenized as three dots.
2014-05-08 07:46:47 +02:00
Conrad Irwin
2de16b8cb0 [loose parser] Fix interpretation of f."
Before this the ast produced by parse_dammit crashed in the following
code, as Uglify correctly noticed that f."" is invalid.

    sample = 'f."';

    loose = require('acorn/acorn_loose');
    uglify = require('uglify-js');

    out = new uglify.OutputStream();
    ast = loose.parse_dammit(sample);
    ast = uglify.AST_Node.from_mozilla_ast(ast);
    ast.print(out);
    // TypeError: Cannot call method 'toString' of undefined
    // member_exp.computed = false && member_exp.property == ""

    console.log(out.toString());

After this the round-tripped AST looks like: `t.✖;"";`, which is
consistent with how `foo.{` is parsed.

I also considered making it parse as t[""], but as this only turns up in
the wild when people try to use multiline strings, I felt it was better
to be obviously wrong.
2014-04-17 23:03:18 +02:00
Charles Hughes
6f41a2215d Updates license year 2014-03-25 17:50:49 +01:00
Marijn Haverbeke
4869ccfa55 Prevent loose parser from tripping on invalid regexps
Issue #39
2014-03-25 17:45:58 +01:00
Marijn Haverbeke
93124c9eb8 Don't export Node from loose parser, reuse existing Node's proto
Issue #92
2014-03-25 17:31:03 +01:00
Marijn Haverbeke
e5439847fd Rename remaining *_t constructors to something sane 2014-03-25 17:29:17 +01:00
David Bonnet
7b9a46710d Renamed node_t to Node and exported it
This is to let programmers extend the Node object with utility methods
2014-03-25 17:23:30 +01:00
Marijn Haverbeke
e282ee4c01 Bump version number post-0.5 2014-03-12 17:32:17 +01:00
Marijn Haverbeke
a09455d2bf Mark version 0.5 2014-03-12 17:25:55 +01:00
Peter Rust
954ddac8b9 [walker] Supply ancestors to visitor functions 2014-02-28 17:53:39 +01:00
Marijn Haverbeke
5bd50cce6f Don't complain about reserved words in property name position
Also add forbidReserved: "everywhere" support.

Issue #85
2014-02-14 11:27:48 +01:00
Marijn Haverbeke
716ade22fb Add allowReturnOutsideFunction option
Issue #86
2014-02-14 09:55:05 +01:00
Marijn Haverbeke
d55b6dee4a Update lastEnd in tokenizer interface
The hack for parsing --> depends on it.

Closes #84
2014-01-17 10:09:15 +01:00
Marijn Haverbeke
d973261940 [loose parser] Make sure VariableDeclaration nodes have at least one decl
Closes marijnh/tern#255
2013-12-09 17:55:16 +01:00
Marijn Haverbeke
e6ff440e9f [walker] Handle catch scopes more accurately in scopeVisitor 2013-11-28 16:56:14 +01:00
Marijn Haverbeke
b1623b10c1 Note non-reentrancy of parser in onComment docs
Closes #80
2013-11-20 10:59:12 +01:00
Marijn Haverbeke
baaa16cee7 Make sure syntax errors in regular expressions raise conforming exceptions
Just letting the error from new RegExp through creates an exception missing the
pos/loc/raisedAt properties.

Issue #82
Issue #81
2013-11-20 10:56:28 +01:00
Marijn Haverbeke
dd456e3ad5 Fix bug causing comments after 'use strict' to be handled twice
Closes #76
2013-11-11 11:25:59 +01:00
Marijn Haverbeke
cb79f13d3d [README] Search/replace gone bad 2013-11-04 16:53:28 +01:00
Marijn Haverbeke
6be7a84649 Work around broken Markdown implementation on github
Not that I can blame anyone for making mistakes implementing a
poorly specified mess like markdown.
2013-11-04 16:52:34 +01:00
Marijn Haverbeke
5ec47cf80d Rewrite README 2013-11-04 16:43:07 +01:00
Aparajita Fishman
3b05fcf16c docco is wonderful, but it isn't exactly the most concise way of figuring out how to use acorn. Here's a real README.
Fixed a typo in the options comments.
2013-11-04 15:39:22 +01:00
Marijn Haverbeke
456f099cbe Bump version for added option 2013-10-15 13:12:07 +02:00
Marijn Haverbeke
356e0be759 Add directSourceFile option 2013-10-15 13:08:56 +02:00
Aparajita Fishman
824eb798f9 More descriptive names for binop token type 2013-10-12 18:04:09 +02:00
Aparajita Fishman
9ff4981ca2 More concise way of slicing off the last character 2013-10-12 18:00:19 +02:00
Aparajita Fishman
6e6c7b0af4 Just being consistent with quote usage 2013-10-10 23:45:40 +02:00
Marijn Haverbeke
987fb51feb Bump version number post-0.4.0 2013-10-10 10:41:19 +02:00
Marijn Haverbeke
1ed25992a7 Mark release 0.4 2013-10-10 10:40:31 +02:00
Aparajita Fishman
389c9b225b Fixed: tokLineStart and tokCurLine have no meaning if options.locations is false.
Everywhere else (except one place which is a bug) those variables only appear within an `if (options.locations)` block.
2013-10-10 09:59:16 +02:00
Marijn Haverbeke
b7972ad95c Remove invalid of tokLineStart
This is only tracked when locations are on, so it can't be used
unconditionally.

Closes #71
2013-10-10 09:58:23 +02:00
Aparajita Fishman
6fd79e50fb Fixed: skipSpace did not consider 8232 and 8233 as eol, but elsewhere it was.
Both readString and skipLineComment considered 8232/8233 as eol, but skipSpace itself would not increment the line counters if they were found.

Previously 8232/8233 were listed in nonASCIIwhitespace, but since that is only used within skipSpace and those values are checked separately, they could be removed from nonASCIIwhitespace.
2013-10-08 16:33:40 +02:00
Marijn Haverbeke
22c3161b6e Fix wrong end position for VariableDeclaration nodes
It should include the semicolon.

Closes #67
2013-10-02 20:39:51 +02:00
Aparajita Fishman
b7417cec8c Just want to be a little clearer what is happening to the node var declared earlier. 2013-10-01 17:33:01 +02:00
Marijn Haverbeke
83bfd6c536 Different approach to working around html comment issue 2013-09-11 12:23:25 +02:00
Marijn Haverbeke
3d932fcfba Add .gitignore and .tern-project 2013-09-09 22:11:12 +02:00
Marijn Haverbeke
36d001a4be Work around docco leaving in a <!-- comment start
Closes #66
2013-09-09 22:10:24 +02:00
Martin Carlberg
ba8da57d16 Use correct paragraph separator for newline
0x2089(8329) is Subscript nine
0x2028(8232) is Line separator
0x2029(8233) is Paragraph separator
2013-09-09 11:35:33 +02:00
Marijn Haverbeke
b998d5e22d Add support for bizarro <!-- and --> behavior
Issue #62
2013-09-06 10:52:04 +02:00
Aparajita Fishman
411b29791b Formatting
Just being consistent.

In every other place where a between comparison is done, the lower limit is on the left. It's a whole lot easier to see it's a between comparison when the limits are in order.
2013-09-05 10:33:03 +02:00
Aparajita Fishman
cfbbeebe8b Fixed: replace absolute with relative require, remove unsupported --trackComments from usage.
Unless I'm missing something, the simple relative path "../acorn.js" is exactly equivalent to the absolute path being constructed in the old code.
2013-09-03 17:51:46 +02:00
Marijn Haverbeke
c152be4a2e Improve error message for ++/re/
Closes #54
2013-08-28 16:22:30 +02:00
Marijn Haverbeke
6659f7a033 Fix special case to handle regexps that start with =
Closes #55
2013-08-28 10:35:21 +02:00
Marijn Haverbeke
2ace0fa8dc Further refine parseExprList indentation heuristic
Closes marijnh/tern#221
2013-08-27 12:52:02 +02:00
Marijn Haverbeke
6113324cd2 Fix bug with parsing slash after operator-keyword property
Closes #53
2013-08-25 15:01:20 +02:00
Jürg Lehni
097b4162da Pass on 'this' as root scope, for better inclusion of Acorn inside Paper.js
Use same approach as Esprima.
2013-07-26 08:59:07 +02:00
Jiaxing Wang
a84e21e0ff Line number start from 1 after getToken.jumpTo() 2013-07-11 12:28:58 +02:00
Jiaxing Wang
16b54e0698 parseMaybeUnary() doesn't need parameter @noIn 2013-07-11 08:20:05 +02:00
Jiaxing Wang
567f3ca32a Remove redundant if conditions that are tested above 2013-07-11 08:20:04 +02:00
Marijn Haverbeke
328d0e514c Linting 2013-07-08 09:07:10 +02:00
Marijn Haverbeke
d3b9eb177a Always attach a guardedHandlers property to TryStatements
Closes #48
2013-07-08 09:03:23 +02:00
Marijn Haverbeke
67c48229b9 Bump version number post-0.3.1 2013-06-11 12:44:35 +02:00
Marijn Haverbeke
d2673d465a Release 0.3.1 to fix release-making-script screwup in 0.3.0 2013-06-11 12:43:56 +02:00
Marijn Haverbeke
7e248c7e3b Mark release 0.3.0 2013-06-11 12:41:03 +02:00
Marijn Haverbeke
2372b12df7 [loose parser] Refine closing heuristic for expression lists
Issue marijnh/tern#171
2013-06-10 18:02:17 +02:00
Marijn Haverbeke
3ca3aa5a25 Run a lint pass, clean up lots of small issues 2013-06-10 16:52:22 +02:00
Marijn Haverbeke
6fe123947b Prefix keywords with underscore in tokTypes object 2013-06-10 15:47:29 +02:00
Marijn Haverbeke
314327537a Add charset to script link that includes test suite
So that browsers don't get confused by the utf-8 sequences.
2013-06-08 20:36:50 +02:00
Marijn Haverbeke
adf16e33c0 Don't assume options object has a hasOwnProperty method
Closes #43
2013-06-08 20:36:44 +02:00
Marijn Haverbeke
c979446572 [package.json] Use 'repository' rather than 'repositories' field
Apparently the second is no longer supported in npm 1.2 (?).

Closes #42
2013-05-21 14:36:49 +02:00
Marijn Haverbeke
38f0e80547 Include diacritical combining marks in identifier character set
Closes marijn/tern#157
2013-05-21 09:07:50 +02:00
Marijn Haverbeke
6dd35f870a [loose parser] Fix bug in continued-expression closing
When the continued expression sat on column 1 after a non-whitespace char,
the heuristic would consider it the start of the line, even though it wasn't.

Issue marijnh/tern#141
2013-05-15 12:03:00 +02:00
Marijn Haverbeke
9eee5300db [loose parser] Less aggressive termination heuristic for comma-separated lists
See https://github.com/marijnh/tern/issues/118
2013-05-08 15:21:25 +02:00
Marijn Haverbeke
4d8eeabf52 In browser loader, refer to global object as 'this', not 'self'
Closes #41
2013-05-08 15:16:06 +02:00
Marijn Haverbeke
df763df61b Bump version number post-0.2 2013-05-03 11:54:04 +02:00
Marijn Haverbeke
4146605738 Mark version 0.2.0 2013-05-03 11:52:42 +02:00
Marijn Haverbeke
30b399ece7 Export isIdentifierChar and isIdentifierStart 2013-04-24 07:44:11 +02:00
Marijn Haverbeke
f3c70d76ef Remove assignment to non-existing var 2013-04-03 15:05:00 +02:00
Marijn Haverbeke
cc12062b9c [loose parser] Fix a whole bunch of issues in the options.locations support
Closes #40
2013-04-02 13:47:50 +02:00
Marijn Haverbeke
62bc3641af Use a single .handler property on TryStatements
As the wiki page for the spec currently seems to prescribe.
2013-04-02 09:30:35 +02:00
Paul Harper
a6b3034e71 [loose parser] More fixes to locations 2013-03-27 10:57:48 +01:00
Marijn Haverbeke
54e78b7035 Properly back up line state when re-reading a token on strict mode
Issue #38
2013-03-25 15:10:55 +01:00
Oskar Schöldström
a8a24f538b Fix \v being treated as v in IE < 9
IE < 9 treats '\v' as 'v' instead of a vertical tab ('\u000b').
Read more: http://mathiasbynens.be/notes/javascript-escapes
2013-03-23 19:18:28 +01:00
Marijn Haverbeke
76be1f8eee Make Acorn work with AMD modules
(Hopefully)
2013-03-17 22:56:49 +01:00
Paul Harper
559518acc8 .parse_dammit() now recognizes the locations option, and will add a loc object to the ast nodes as .parse() does 2013-03-17 22:07:14 +01:00
Marijn Haverbeke
38179fd855 Fix node boundaries for unexpected regular expressions
Closes #33
2013-02-28 19:28:20 +01:00
Marijn Haverbeke
0b10aa2256 Add walk.findNodeBefore 2013-02-28 19:27:29 +01:00
Marijn Haverbeke
83cdcf7dbf Remove outdated option from bin/acorn 2013-02-27 09:59:42 +01:00
zsjforcn
173d94f019 [package] Add "bin" property to package.json for npm to auto generate exection files. 2013-02-27 09:39:09 +01:00
Marijn Haverbeke
9a55d60324 Move back to regular string accumulation in readString
The apply call is a stack overflow hazard.

Closes #31
2013-02-24 21:26:09 +01:00
Marijn Haverbeke
b1845b51b1 [util/walk] Add findNodeAfter 2013-02-24 21:25:25 +01:00
Marijn Haverbeke
72d2fc2644 Fix start offset of block nodes 2013-02-20 10:48:36 +01:00
Marijn Haverbeke
782259bea1 [loose parser] Fix bug where peeked tokens persist across parses 2013-02-14 14:05:54 +01:00
Marijn Haverbeke
adcb354498 [walker] Fix broken handling of node predicates 2013-02-14 14:02:48 +01:00
Marijn Haverbeke
006d5f1c04 Bump version post-0.1 2013-02-14 10:02:27 +01:00
Marijn Haverbeke
c108741d07 Mark release 0.1 2013-02-14 10:00:19 +01:00
Marijn Haverbeke
da83f80d29 Allow passing a test predicate to findNodeAt and findNodeAround 2013-02-12 17:35:04 +01:00
Marijn Haverbeke
76c41d3a71 [loose parser] Improve closing heuristic in parseExprList 2013-02-06 13:47:05 +01:00
Marijn Haverbeke
82980794a9 Fix bug in expression-terminating heuristic
Dedented tokens should only end an expression if they are actually the first
token on the line.

This to prevent code like this from going wrong:

    x = (function(..) {
      blah();
    })(); // <-- indented same as start of expression
2013-02-05 13:49:51 +01:00
Marijn Haverbeke
d98e378590 Store default walker in exports.base, rather than exports itself
My initial idea, that client code would constantly need to access the individual
walker functions directly, isn't actually the case. This prevents unnecessary copying
of other interface functions into walkers.
2013-01-30 19:11:27 +01:00
Alistair Braidwood
0632b36c94 Improve options.locations performance by tracking newlines rather than finding them 2013-01-30 17:30:38 +01:00
Marijn Haverbeke
87a6a5a8cd Clean up readNumber, fix parsing of '2.+2'
Issue #9
2013-01-30 16:38:31 +01:00
Marijn Haverbeke
792fa96e93 Add walk.findNodeAround 2013-01-28 17:17:51 +01:00
Marijn Haverbeke
1de79a277c [loose parser] Refine block-closing heuristics, add expression-continuing heuristics 2013-01-28 16:43:19 +01:00
Marijn Haverbeke
e95c4cce50 Add walk.findNodeAt utility 2013-01-28 13:00:08 +01:00
keeyipchan
44f7aff2b7 Add testAssert() for arbitrary tests; fix skinLineComments() passing off-by-1 character to onComment(slice(.., end)) 2013-01-27 10:09:06 +01:00
Marijn Haverbeke
17a0094694 [loose parser] Improve recovery from unterminated strings and regexps 2013-01-17 15:01:13 +01:00
Marijn Haverbeke
f8bcc75378 [loose parser] Fix typo 2013-01-17 14:49:20 +01:00
Marijn Haverbeke
e130dc3fbb [loose parser] Use ✖ rather than question mark for placeholders
This way, attempts to re-parse the pretty-printed code won't
be confused by the question marks.
2013-01-17 14:45:16 +01:00
Marijn Haverbeke
207bf64e8d [loose parser] Revise strategy for forcing token consumption
It's easier and more flexible to simply handle it at the call site.
2013-01-17 14:44:00 +01:00
Marijn Haverbeke
b8ec8aab2c [loose parser] Fix bug in argument list parsing 2013-01-17 14:17:22 +01:00
Marijn Haverbeke
7d73fe243a Upgrade Esprima 2013-01-17 14:17:10 +01:00
Marijn Haverbeke
1d974ce2b6 [loose parser] Several small tweaks 2013-01-16 19:09:06 +01:00
Marijn Haverbeke
d08144c1d7 [loose parser] Support tabSize option 2013-01-16 17:53:37 +01:00
Marijn Haverbeke
3981dfa133 [loose parser] Add note about imprecision 2013-01-16 17:43:27 +01:00
Marijn Haverbeke
a2788f8864 [loose parser] Make expect check two tokens ahead if it fails to find its target 2013-01-16 17:38:56 +01:00
Marijn Haverbeke
038e438949 Add a loose parser
For getting a halfway meaningful AST out of code that may contain
syntax errors.

Use case: analyzing code as the user is editing it.
2013-01-16 17:27:28 +01:00
Marijn Haverbeke
965166cdfd Small fixes noticed while going over the when writing loose parser 2013-01-16 16:47:21 +01:00
Marijn Haverbeke
4d2d8408de Export the tokenizer 2013-01-16 12:46:26 +01:00
Marijn Haverbeke
c2dd92fec0 Attach position information to errors 2013-01-16 12:20:19 +01:00
Marijn Haverbeke
3c2bd590da Fix regexp detection after void/typeof/instanceof/delete 2013-01-15 15:58:16 +01:00
Marijn Haverbeke
8104257495 Bump version to 0.0.2 2013-01-13 22:05:46 +01:00
Marijn Haverbeke
cade51347a Remove trackComments, add onComment option
trackComments was too obscure and complicated, and not all that useful.
2013-01-13 22:04:45 +01:00
Martin Carlberg
5e4ea00f3c Unnecessary 'if' as we already know 'ch !== 92' 2013-01-09 10:13:26 +01:00
Marijn Haverbeke
e6485e61fd [walker] Allow recursive walks without building a new walker obj 2013-01-08 13:17:37 +01:00
Marijn Haverbeke
cc5971f617 Formatting 2013-01-04 09:37:21 +01:00
Arian Stolwijk
f6e0182a3a Fixes sourceFile option.
When setting the .prototype.source the sourceFile variable is undefined, and
setting the sourceFile option doesn't change the .source property on the
prototype anymore.

By setting the .source property inside the node_loc_t constructor, the correct
sourceFile is set in the loc object.
2013-01-04 09:32:43 +01:00
Alistair Braidwood
3d0f85d616 line_loc type for v8 perf 2012-12-30 12:46:54 +01:00
Alistair Braidwood
c8eb50fabe create node 'class' - improve v8 performance 2012-12-30 12:46:45 +01:00
Alistair Braidwood
2bad03e654 reduce array creation in readString 2012-12-30 12:27:13 +01:00
krator
5b19196bac Give true/false/null literals a raw property
In the generated ast, "null"/"true"/"false" are "Literal" nodes.
As every "Literal" node has a 'raw' property,
When i am doing something with the ast using python,
the 3 "Literal"s caused some problem.
make the 3 "Literal"s have 'raw' property.
2012-12-24 14:26:03 +01:00
Marijn Haverbeke
f58bb9a480 Use 'self' instead of 'window' in browser, in order to work in a web worker 2012-11-29 10:08:32 +01:00
Marijn Haverbeke
d36c70bbbf Add missing labels.pop() to allow re-using labels in a block
Issue #15
2012-11-22 10:11:00 +01:00
Marijn Haverbeke
5c44c13465 Make sure readInt doesn't try to read past len, if given
Issue #15
2012-11-22 10:07:19 +01:00
Marijn Haverbeke
5771c8b4b2 Add missing semicolon() calls to debugger and throw statement parsers
Issue #5
2012-11-22 09:48:01 +01:00
Marijn Haverbeke
74536b9eb7 Remove test that raised error from the JS engine's RegExp parser 2012-11-21 14:38:21 +01:00
Marijn Haverbeke
4229ef792e Give readToken sub-functions meaningful names 2012-11-20 16:58:57 +01:00
Alistair Braidwood
04a69abae0 Split readToken to smaller functions 2012-11-20 16:58:57 +01:00
Marijn Haverbeke
4c650ad16b Add an acorn-only button to bench.html 2012-11-20 16:58:57 +01:00
Marijn Haverbeke
905124c291 Assign parenthesized expressions a range that includes the parens
This way, composite expressions that they are part of won't get bogus
unsyntactic substrings as their range (i.e. in '(1)+1', the binop expression
would span '1)+1').

Closes #14
2012-11-18 21:17:49 +01:00
Marijn Haverbeke
f91d7f5836 [walker] Allow custom fields to be added to new walkers
Issue #13
2012-11-08 21:07:48 +01:00
Marijn Haverbeke
cb6cd3038e Make the walker's scope module use objects for variables
So that subsequent passes can attach and retrieve information
from them.
2012-11-07 12:15:32 +01:00
Marijn Haverbeke
3ba6913d30 Comment walker module 2012-11-06 11:10:58 +01:00
Marijn Haverbeke
043386067a Stop accumulating line comments when trackComments is off 2012-11-05 22:39:22 +01:00
Marijn Haverbeke
b660ff6d1c Add an AST walker utility 2012-11-05 22:32:39 +01:00
Marijn Haverbeke
16f8259dab Don't allow keywords as properties when forbidReserved is on 2012-11-05 22:25:57 +01:00
Marijn Haverbeke
b591c41513 Actually make strictSemicolons forbid all semicolon insertion 2012-11-05 22:25:40 +01:00
Marijn Haverbeke
5d83150951 Attach .raw property to literal nodes 2012-11-02 16:35:09 +01:00
Marijn Haverbeke
93d4a31abb Upgrade Esprima 2012-10-19 10:31:55 +02:00
Marijn Haverbeke
48bbcd9437 Restore nonasciiwhitespace regexp
It won't make any difference except in really strange code.
2012-10-19 10:10:53 +02:00
Alistair Braidwood
b3366233d3 skipLineComment 2012-10-19 10:05:59 +02:00
Alistair Braidwood
b38a98ffd2 skipSpace 2012-10-19 10:04:51 +02:00
Marijn Haverbeke
906a8b8e5b Simplify an if/switch combo to just a switch 2012-10-19 09:58:08 +02:00
Alistair Braidwood
5fa1f088cb readString 2012-10-19 09:53:11 +02:00
Alistair Braidwood
9bdbbaaf96 isIdentifierChar to numeric 2012-10-19 09:50:08 +02:00
abraidwood
c20cdbf8fc rearrange isIdentifierStart 2012-10-19 09:47:38 +02:00
Marijn Haverbeke
6b52dc8a84 Disallow newline after throw
Closes #11
2012-10-18 15:50:07 +02:00
Marijn Haverbeke
daefc220da Require a semicolon after do/while 2012-10-17 23:09:15 +02:00
Marijn Haverbeke
e3514627a4 Add funky newlines to nonASCIIwhitespace 2012-10-17 23:02:48 +02:00
Marijn Haverbeke
330084f993 Make 'this' a proper keyword 2012-10-17 16:34:00 +02:00
Marijn Haverbeke
96d911a30f Properly parse 10. as a valid number
Closes #9
2012-10-12 23:34:11 +02:00
Marijn Haverbeke
d198b7ed64 Upgrade Esprima and UglifyJS in benchmark comparison 2012-10-12 23:27:59 +02:00
Marijn Haverbeke
eb888141fd Add 'ranges' option to support range arrays on nodes
Closes #7
2012-10-12 23:19:04 +02:00
Marijn Haverbeke
fb003fff3a Document program and sourceFile options 2012-10-12 23:13:26 +02:00
Marijn Haverbeke
07152c41c4 Use 'new Function' instead of '(1, eval)'
In the hope that it'll be less confusing.
2012-10-12 23:09:23 +02:00
Mihai Bazon
feaa7df563 added sourceFile and program options to parse
- if `program` is given, it'll be used as the toplevel node, instead of
  creating a new node, and statements will be added to its body
- if `sourceFile` is given and `locations` is ON, it'll set the `source`
  property in every node's `loc`.
2012-10-12 23:06:44 +02:00
Marijn Haverbeke
b5e580a876 Properly enable strict mode
Closes #8
2012-10-06 12:32:45 +02:00
Marijn Haverbeke
0590d12240 Accept \0 in strings in strict mode
Closes #3
2012-10-03 22:18:52 +02:00
Mathieu 'p01' Henri
bb6687e3d1 Stricter lineBreak regexp
Checking for `\r\n?` is redundant with the `|[\n\r\u2028\u2029]`, better straighten the regexp and check for `\r\n|[\n\r\u2028\u2029]`. This might even be a itsy bitsty bit faster.
2012-10-03 11:08:27 +02:00
Marijn Haverbeke
7feb14c0ea Add a shell interface 2012-10-03 11:04:26 +02:00
Marijn Haverbeke
0820a593a6 Handle break-to-labeled-non-loop
Closes #1
2012-10-03 10:25:53 +02:00
Marijn Haverbeke
e864318883 Fix bug in benchmark
Since previous commit, Acorn is no longer properly benchmarked
when locations are on.
2012-10-02 20:22:02 +02:00
Marijn Haverbeke
4472608994 Write test status to dom rather than console 2012-10-02 18:03:22 +02:00
Marijn Haverbeke
5db60dcac9 Conform to Moz spec with regards to loc properties 2012-10-02 18:01:32 +02:00
Marijn Haverbeke
b39c337694 Extend benchmark page 2012-10-02 17:32:00 +02:00
Marijn Haverbeke
6f4e7fd502 Extend benchmark page 2012-10-02 17:17:00 +02:00
Marijn Haverbeke
30b348728c Typo in docs 2012-10-02 16:20:48 +02:00
Marijn Haverbeke
4cbe2afae5 Add docco output 2012-10-02 16:17:48 +02:00
Marijn Haverbeke
42d0c4535a More or less finish comments 2012-10-02 16:14:18 +02:00
Marijn Haverbeke
32e62f1cfc Partial parser comments 2012-10-02 10:14:57 +02:00
Marijn Haverbeke
237bfbfb9b Comment tokenizer 2012-10-02 08:44:41 +02:00
Marijn Haverbeke
60178c3d68 Shuffle parseExprAtom for expected probabilities 2012-09-24 22:06:44 +02:00
Marijn Haverbeke
092a524f43 Fix bug in number parser 2012-09-24 21:34:42 +02:00
Marijn Haverbeke
ec27961703 Less reliance on regexps, more on hacks 2012-09-24 16:15:33 +02:00
Marijn Haverbeke
a1d9587519 Add esprima and uglifyjs to compare against 2012-09-24 13:40:48 +02:00
Marijn Haverbeke
61906485a1 Add a README 2012-09-24 12:10:30 +02:00
Marijn Haverbeke
56b7db4e96 Add temp index page 2012-09-24 12:03:23 +02:00
Marijn Haverbeke
a46f0012ed Add package.json 2012-09-24 11:50:18 +02:00
Marijn Haverbeke
820f148002 Add LICENSE file 2012-09-24 11:50:10 +02:00
Marijn Haverbeke
03d95cda2c Make tests runnable under node 2012-09-24 11:50:03 +02:00
Marijn Haverbeke
587c790f7b Add esprima-derived tests, trivial benchmark 2012-09-24 11:42:01 +02:00
Marijn Haverbeke
aedcd4e12f Initial import 2012-09-24 10:48:45 +02:00
15208 changed files with 504087 additions and 68686 deletions

View File

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

View File

@@ -1,57 +0,0 @@
"use strict";
// Blame Logan for this.
// This works around https://github.com/istanbuljs/istanbuljs/issues/92 until
// we have a version of Istanbul that actually works with 7.x.
function istanbulHacks() {
return {
inherits: require("babel-plugin-istanbul").default,
visitor: {
Program: {
exit: function(path) {
if (!this.__dv__) return
const node = path.node.body[0];
if (
node.type !== "VariableDeclaration" ||
node.declarations[0].id.type !== "Identifier" ||
!node.declarations[0].id.name.match(/cov_/) ||
node._blockHoist !== 3
) {
throw new Error("Something has gone wrong in Logan's hacks.");
}
// Gross hacks to put the code coverage block above all compiled
// import statement output.
node._blockHoist = 5;
},
},
},
};
}
let envOpts = {
loose: true
};
module.exports = {
comments: false,
presets: [
["env", envOpts],
"stage-0",
"flow"
],
env: {
cov: {
auxiliaryCommentBefore: "istanbul ignore next",
plugins: [istanbulHacks]
}
}
};
if (process.env.BABEL_ENV === "development") {
envOpts.targets = {
node: "current"
};
envOpts.debug = true;
}

56
.circleci/config.yml Normal file
View File

@@ -0,0 +1,56 @@
version: 2
aliases:
- &restore-node-modules-cache
keys:
- v1-yarn-deps-{{ checksum "yarn.lock" }}
- &restore-yarn-cache
keys:
- v1-yarn-cache
- &save-node-modules-cache
paths:
- node_modules
key: v1-yarn-deps-{{ checksum "yarn.lock" }}
- &save-yarn-cache
paths:
- ~/.yarn-cache
key: v1-yarn-cache
- &artifact_babel
path: ~/babel/packages/babel-standalone/babel.js
- &artifact_babel_min
path: ~/babel/packages/babel-standalone/babel.min.js
- &artifact_env
path: ~/babel/packages/babel-preset-env-standalone/babel-preset-env.js
- &artifact_env_min
path: ~/babel/packages/babel-preset-env-standalone/babel-preset-env.min.js
jobs:
build:
working_directory: ~/babel
docker:
- image: circleci/node:10
steps:
- checkout
- restore-cache: *restore-yarn-cache
- restore-cache: *restore-node-modules-cache
- run: yarn --version
- run: make test-ci-coverage
# Builds babel-standalone with the regular Babel config
- run: make build
# test-ci-coverage doesn't test babel-standalone, as trying to gather coverage
# data for a JS file that's several megabytes large is bound to fail. Here,
# we just run the babel-standalone test separately.
- run: ./node_modules/.bin/jest packages/babel-standalone/test/
- run: ./node_modules/.bin/jest packages/babel-preset-env-standalone/test/
- store_artifacts: *artifact_babel
- store_artifacts: *artifact_babel_min
- store_artifacts: *artifact_env
- store_artifacts: *artifact_env_min
- save_cache: *save-node-modules-cache
- save_cache: *save-yarn-cache

View File

@@ -9,3 +9,6 @@ end_of_line = lf
[*.{js,json}]
indent_style = space
indent_size = 2
[*.{md,markdown}]
trim_trailing_whitespace = false

View File

@@ -1,7 +1,12 @@
/lib
/build
/.git
package.json
lerna.json
packages/babel-runtime
!packages/babel-runtime/scripts
!packages/babel-runtime/core-js.js
!packages/babel-plugin-transform-runtime/scripts
!packages/babel-runtime-corejs2/core-js.js
packages/babel-runtime-corejs2
packages/*/node_modules
packages/*/lib
packages/*/dist
@@ -12,15 +17,10 @@ codemods/*/lib
codemods/*/dist
codemods/*/test/fixtures
codemods/*/test/tmp
experimental/*/lib
experimental/*/node_modules
experimental/*/test/fixtures
experimental/*/test/tmp
experimental/babel-preset-env/data
experimental/babel-preset-env/test/debug-fixtures
packages/babel-preset-env/data
packages/babel-preset-env/test/debug-fixtures
packages/babel-preset-env-standalone/babel-preset-env.js
packages/babel-preset-env-standalone/babel-preset-env.min.js
packages/babel-standalone/babel.js
packages/babel-standalone/babel.min.js
# Prettier tries to insert trailing commas in function calls, which Node.js
# doesn't natively support. This causes an error when loading the Gulp tasks.
packages/babel-standalone/src/gulpTasks.js
packages/babel-parser/test/expressions

View File

@@ -1,14 +0,0 @@
{
"extends": "babel",
"plugins": [
"prettier"
],
"rules": {
"curly": ["error", "multi-line"],
"prettier/prettier": ["error", { "trailingComma": "es5" }]
},
"env": {
"node": true,
"mocha": true
}
}

33
.eslintrc.json Normal file
View File

@@ -0,0 +1,33 @@
{
"root": true,
"extends": "babel",
"plugins": ["prettier"],
"rules": {
"curly": ["error", "multi-line"],
"prettier/prettier": "error",
"no-case-declarations": "error"
},
"env": {
"node": true
},
"overrides": [
{
"files": ["packages/*/src/**/*.js", "codemods/*/src/**/*.js"],
"rules": {
"no-undefined-identifier": "error",
"no-deprecated-clone": "error"
}
},
{
"files": [
"packages/*/test/**/*.js",
"codemods/*/test/**/*.js",
"packages/babel-helper-transform-fixture-test-runner/src/helpers.js",
"test/**/*.js"
],
"env": {
"jest": true
}
}
]
}

View File

@@ -1,24 +1,28 @@
[ignore]
.*/build/.*
.*/packages/.*/lib
.*/packages/.*/test
.*/codemods/.*/lib
.*/codemods/.*/test
.*/experimental/.*/lib
.*/experimental/.*/test
.*/node_modules/conventional-changelog-core/
.*/node_modules/module-deps/
[include]
packages/*/src
codemods/*/src
experimental/*/src
[libs]
lib/file.js
lib/parser.js
lib/types.js
lib/third-party-libs.js.flow
packages/babel-types/lib/index.js.flow
[options]
include_warnings=true
suppress_comment= \\(.\\|\n\\)*\\$FlowFixMe
suppress_comment= \\(.\\|\n\\)*\\$FlowIssue
suppress_comment= \\(.\\|\n\\)*\\$FlowIgnore
suppress_type=$FlowFixMe
suppress_type=$FlowSubtype
esproposal.export_star_as=enable
module.name_mapper='^@babel\/\([a-zA-Z0-9_\-]+\)$' -> '<PROJECT_ROOT>/packages/babel-\1/src/index'

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

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

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

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

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

File diff suppressed because it is too large Load Diff

View File

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

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

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

View File

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

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

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

View File

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

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

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

View File

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

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

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

38
.gitignore vendored
View File

@@ -1,26 +1,41 @@
.DS_Store
/node_modules
/packages/*/node_modules
/packages/*/LICENSE
!/packages/babel-parser/LICENSE
!/packages/babel-plugin-transform-object-assign/LICENSE
*.log
*.cache
/build
/.eslintcache
/browser.js
/browser-polyfill.js
/runtime.js
/coverage
coverage
dist
/.package.json
package-lock.json
/packages/babel-runtime/core-js/**/*.js
!/packages/babel-runtime/core-js/map.js
/packages/babel-runtime/helpers/*.js
!/packages/babel-runtime/helpers/toArray.js
/packages/babel-runtime/helpers/builtin/*.js
!/packages/babel-runtime/helpers/builtin/toArray.js
/packages/babel-runtime/helpers/builtin/es6/*.js
!/packages/babel-runtime/helpers/builtin/es6/toArray.js
/packages/babel-runtime/helpers/es6/*.js
!/packages/babel-runtime/helpers/es6/toArray.js
!/packages/babel-runtime/helpers/iterableToArray.js
!/packages/babel-runtime/helpers/temporalRef.js
/packages/babel-runtime/helpers/esm/*.js
!/packages/babel-runtime/helpers/esm/toArray.js
!/packages/babel-runtime/helpers/esm/iterableToArray.js
!/packages/babel-runtime/helpers/esm/temporalRef.js
/packages/babel-runtime-corejs2/helpers/*.js
!/packages/babel-runtime-corejs2/helpers/toArray.js
!/packages/babel-runtime-corejs2/helpers/iterableToArray.js
!/packages/babel-runtime-corejs2/helpers/temporalRef.js
/packages/babel-runtime-corejs2/helpers/esm/*.js
!/packages/babel-runtime-corejs2/helpers/esm/toArray.js
!/packages/babel-runtime-corejs2/helpers/esm/iterableToArray.js
!/packages/babel-runtime-corejs2/helpers/esm/temporalRef.js
/packages/babel-runtime-corejs2/core-js/**/*.js
!/packages/babel-runtime-corejs2/core-js/map.js
/packages/babel-register/test/.babel
/packages/babel-cli/test/tmp
/packages/babel-node/test/tmp
@@ -29,5 +44,10 @@ package-lock.json
/babel.sublime-workspace
packages/babel-standalone/babel.js
packages/babel-standalone/babel.min.js
packages/babel-preset-env-standalone/babel-preset-env.js
packages/babel-preset-env-standalone/babel-preset-env.min.js
/codemods/*/lib
/codemods/*/node_modules
/packages/babel-parser/build
.idea/
/.changelog

2
.prettierignore Normal file
View File

@@ -0,0 +1,2 @@
package.json
packages/babel-preset-env/data

23
.prettierrc Normal file
View File

@@ -0,0 +1,23 @@
{
"arrowParens": "avoid",
"trailingComma": "es5",
"useTabs": false,
"semi": true,
"singleQuote": false,
"bracketSpacing": true,
"jsxBracketSameLine": false,
"tabWidth": 2,
"parser": "babylon",
"printWidth": 80,
"overrides": [{
"files": [
"**/codemods/*/src/**/*.js",
"**/codemods/*/test/**/*.js",
"**/packages/*/src/**/*.js",
"**/packages/*/test/**/*.js"
],
"options": {
"trailingComma": "all"
}
}]
}

View File

@@ -5,11 +5,12 @@ language: node_js
cache:
yarn: true
directories:
- node_modules
- node_modules
node_js:
# We test the latest version on circleci
- '9'
- '8'
- '6'
- '4'
env:
global:
@@ -19,15 +20,27 @@ env:
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash
install: yarn --ignore-engines
before_script:
- 'if [ "$JOB" = "babel-parser-flow-tests" ]; then make bootstrap-flow; fi'
- 'if [ "$JOB" = "babel-parser-test262-tests" ]; then make bootstrap-test262; fi'
script:
- 'if [ "$JOB" = "test" ]; then make test-ci; fi'
- 'if [ "$JOB" = "lint" ]; then make lint && make flow; fi'
- 'if [ "$JOB" = "babel-parser-flow-tests" ]; then make test-flow-ci; fi'
- 'if [ "$JOB" = "babel-parser-test262-tests" ]; then make test-test262-ci; fi'
matrix:
fast_finish: true
include:
- node_js: "node"
env: JOB=lint
- node_js: "node"
env: JOB=babel-parser-flow-tests
- node_js: "node"
env: JOB=babel-parser-test262-tests
notifications:
slack:

File diff suppressed because it is too large Load Diff

View File

@@ -3,7 +3,7 @@
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
contributors and maintainers pledge to make participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and

View File

@@ -1,5 +1,3 @@
# NOTE: DO NOT OPEN ISSUES FOR QUESTIONS AND SUPPORT. SEE THE README FOR MORE INFO.
----
<p align="center" class="toc">
@@ -19,30 +17,31 @@
# Contributing
> Before contributing, please read our [code of conduct](https://github.com/babel/babel/blob/master/CODE_OF_CONDUCT.md).
Contributions are always welcome, no matter how large or small.
Contributions are always welcome, no matter how large or small. Before
contributing, please read the
[code of conduct](https://github.com/babel/babel/blob/master/CODE_OF_CONDUCT.md).
## 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/babylon/blob/master/ast/spec.md) is a bit different from [ESTree](https://github.com/estree/estree). The differences are listed [here](https://github.com/babel/babylon#output).
- [ASTs](https://en.wikipedia.org/wiki/Abstract_syntax_tree) (Abstract Syntax Tree): The Babel AST [spec](https://github.com/babel/babel/blob/master/packages/babel-parser/ast/spec.md) is a bit different from [ESTree](https://github.com/estree/estree). The differences are listed [here](https://github.com/babel/babel/tree/master/packages/babel-parser#output).
- Check out [`/doc`](https://github.com/babel/babel/tree/master/doc) for information about Babel's internals
- Check out [the Babel Plugin Handbook](https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#babel-plugin-handbook) - core plugins are written the same way as any other plugin!
- Check out [AST Explorer](http://astexplorer.net/#/scUfOmVOG5) to learn more about ASTs or make your own plugin in the browser
- When you feel ready to jump into the Babel source code, a good place to start is to look for issues tagged with [help wanted](https://github.com/babel/babel/labels/help%20wanted) and/or [good first issue](https://github.com/babel/babel/labels/good%20first%20issue).
- Follow along with what we are working on by joining our Slack, following our announcements on [Twitter](https://twitter.com/babeljs), and reading (or participating!) in our [meeting notes](https://github.com/babel/notes).
- Follow along with what we are working on by joining our [Slack](https://babeljs.slack.com) (you can sign-up [here](https://slack.babeljs.io/)
for an invite), following our announcements on [Twitter](https://twitter.com/babeljs), and reading (or participating!) in our [meeting notes](https://github.com/babel/notes).
- Check out our [website](http://babeljs.io/) and the [repo](https://github.com/babel/website)
## Chat
Feel free to check out the `#discussion`/`#development` channels on our [Slack](https://slack.babeljs.io). Some of us are always online to chat!
Feel free to check out the `#discussion`/`#development` channels on our [Slack](https://slack.babeljs.io) (you can sign-up [here](https://slack.babeljs.io/) for an invite). Some of us are always online to chat!
## Developing
**Note:** Versions `< 5.1.10` can't be built.
Babel is built for Node 4 and up but we develop using Node 8 and yarn. You can check this with `node -v`.
Babel is built for Node 6 and up but we develop using Node 8 and yarn. You can check this with `node -v`.
Make sure that Yarn is installed with version >= `0.28.0`.
Installation instructions can be found here: https://yarnpkg.com/en/docs/install.
@@ -117,8 +116,8 @@ $ TEST_ONLY=babel-cli make test
`TEST_ONLY` will also match substrings of the package name:
```sh
# Run tests for the babel-plugin-transform-es2015-classes package.
$ TEST_ONLY=es2015-class make test
# Run tests for the @babel/plugin-transform-classes package.
$ TEST_ONLY=babel-plugin-transform-classes make test
```
Use the `TEST_GREP` variable to run a subset of tests by name:
@@ -141,6 +140,12 @@ $ TEST_DEBUG=true make test
You can combine `TEST_DEBUG` with `TEST_GREP` or `TEST_ONLY` to debug a subset of tests. If you plan to stay long in the debugger (which you'll likely do!), you may increase the test timeout by editing [test/mocha.opts](https://github.com/babel/babel/blob/master/test/mocha.opts).
To overwrite any test fixtures when fixing a bug or anything, add the env variable `OVERWRITE=true`
```sh
$ OVERWRITE=true TEST_ONLY=babel-plugin-transform-classes make test-only
```
To test the code coverage, use:
```sh
@@ -148,7 +153,6 @@ $ BABEL_ENV=cov make build
$ ./scripts/test-cov.sh
```
#### Troubleshooting Tests
In case you're not able to reproduce an error on CI locally, it may be due to
@@ -164,43 +168,43 @@ In case you're locally getting errors which are not on the CI, it may be due to
Most packages in [`/packages`](https://github.com/babel/babel/tree/master/packages) have a `test` folder, however some tests might be in other packages or in [`/packages/babel-core`](https://github.com/babel/babel/tree/master/packages/babel-core/test/fixtures).
#### `babel-plugin-x`
#### `@babel/plugin-x`
All the Babel plugins (and other packages) that have a `/test/fixtures` are written in a similar way.
For example, in [`babel-plugin-transform-exponentiation-operator/test`](https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-exponentiation-operator/test):
For example, in [`@babel/plugin-transform-exponentiation-operator/test`](https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-exponentiation-operator/test):
- There is an `index.js` file. It imports our [test helper](https://github.com/babel/babel/tree/master/packages/babel-helper-plugin-test-runner). (You don't have to worry about this).
- There can be multiple folders under [`/fixtures`](https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-exponentiation-operator/test/fixtures)
- There is an [`options.json`](https://github.com/babel/babel/blob/master/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/exponentian-operator/options.json) file whose function is similar to a `.babelrc` file, allowing you to pass in the plugins and settings you need for your tests.
- For this test, we only need the relevant plugin, so it's just `{ "plugins": ["transform-exponentiation-operator"] }`.
- For this test, we only need the relevant plugin, so it's just `{ "plugins": ["@babel/plugin-transform-exponentiation-operator"] }`.
- If necessary, you can have an `options.json` with different options in each subfolder.
- In each subfolder, you can organize your directory structure by categories of tests. (Example: these folders can be named after the feature you are testing or can reference the issue number they fix)
- Generally, there are two kinds of tests for plugins
- The first is a simple test of the input and output produced by running Babel on some code. We do this by creating an [`actual.js`](https://github.com/babel/babel/blob/master/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/exponentian-operator/binary/actual.js) file and an [`expected.js`](https://github.com/babel/babel/blob/master/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/exponentian-operator/binary/expected.js) file.
- If you need to expect an error, you can ignore creating the `expected.js` file and pass a new `throws` key to the `options.json` that contains the error string that is created.
  - The first is a simple test of the input and output produced by running Babel on some code. We do this by creating an [`input.js`](https://github.com/babel/babel/blob/master/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/exponentian-operator/binary/input.js) file and an [`output.js`](https://github.com/babel/babel/blob/master/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/exponentian-operator/binary/output.js) file. This kind of test only works in sub-subdirectories of `/fixtures`, i.e. `/fixtures/exponentian-operator/binary/input.js` and **not** `/fixtures/exponentian-operator/input.js`.
- If you need to expect an error, you can ignore creating the `output.js` file and pass a new `throws` key to the `options.json` that contains the error string that is created.
- The second and preferred type is a test that actually evaluates the produced code and asserts that certain properties are true or false. We do this by creating an [`exec.js`](https://github.com/babel/babel/blob/master/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/exponentian-operator/comprehensive/exec.js) file.
In an actual/expected test, you simply write out the code you want transformed in `actual.js`.
In a fixture test, you simply write out the code you want to transform in `input.js`.
```js
// actual.js
// input.js
2 ** 2;
```
and the expected output after transforming it with your `options.json` in `expected.js`.
and the expected output after transforming it with your `options.json` in `output.js`.
```js
// expected.js
// output.js
Math.pow(2, 2);
```
In an `exec.js` test, we run or check that the code actually does what it's supposed to do rather than just check the static output.
```js
// exec.js
assert.equal(8, 2 ** 3);
assert.equal(24, 3 * 2 ** 3);
expect(2 ** 3).toBe(8);
expect(3 * 2 ** 3).toBe(24);
```
If you need to check for an error that is thrown you can add to the `options.json`
@@ -208,8 +212,8 @@ If you need to check for an error that is thrown you can add to the `options.jso
```js
// options.json example
{
"plugins": [["transform-object-rest-spread", { "useBuiltIns": "invalidOption" }]],
"throws": "transform-object-rest-spread currently only accepts a boolean option for useBuiltIns (defaults to false)"
"plugins": [["@babel/plugin-proposal-object-rest-spread", { "useBuiltIns": "invalidOption" }]],
"throws": "@babel/plugin-proposal-object-rest-spread currently only accepts a boolean option for useBuiltIns (defaults to false)"
}
```
@@ -222,20 +226,45 @@ If the test requires a minimum Node version, you can add `minNodeVersion` (must
}
```
#### `@babel/parser` (babylon)
Writing tests for the babel parser is very
similar to the other packages.
Inside the `packages/babel-parser/test/fixtures` folder are categories/groupings of test fixtures (es2015, flow,
etc.). To add a test, create a folder under one of these groupings (or create a new one) with a
descriptive name, and add the following:
* Create an `input.js` file that contains the code you want the babel parser to parse.
* Add an `output.json` file with the expected parser output. For added convenience, if there is no `output.json` present, the test runner will generate one for you.
After writing tests for @babel/parser, just build it by running:
```sh
$ make build
```
Then, to run the tests, use:
```sh
$ TEST_ONLY=babel-parser make test-only
```
#### Bootstrapping expected output
For both `babel-plugin-x` and `babylon`, you can easily generate an `expected.js`/`expected.json` automatically by just providing `actual.js` and running the tests as you usually would.
For both `@babel/plugin-x` and `@babel/parser`, you can easily generate an `output.js`/`output.json` automatically by just providing `input.js` and running the tests as you usually would.
```
// Example
- babylon
- test
- fixtures
- comments
- basic
- block-trailing-comment
- actual.js
- expected.json (will be generated if not created)
- packages
- babel-parser
- test
- fixtures
- comments
- basic
- block-trailing-comment
- input.js
- output.json (will be generated if not created)
```
### Debugging code
@@ -257,7 +286,7 @@ To include the changes, we have to make sure to build Babel:
$ make build
```
Next, we need to execute `Generator.generate()`, which can be achieved by running a test case in the `babel-generator` package.
Next, we need to execute `Generator.generate()`, which can be achieved by running a test case in the `@babel/generator` package.
For example, we can run the test case that tests the generation of class declarations:
```bash
@@ -265,7 +294,6 @@ $ TEST_DEBUG=true TEST_GREP=ClassDeclaration make test-only
./scripts/test.sh
Debugger listening on port 9229.
Warning: This is an experimental feature and could change at any time.
To start debugging, open the following URL in Chrome:
chrome-devtools://devtools/remote/serve_file/@60cd6e859b9f557d2312f5bf532f6aec5f284980/inspector.html?experiments=true&v8only=true&ws=127.0.0.1:9229/3cdaebd2-be88-4e7b-a94b-432950ab72d0
```
@@ -275,9 +303,21 @@ The debugger starts at the first executed line of code, which is Mocha's first l
Click _Resume script execution_ <img src="https://i.imgur.com/TmYBn9d.png" alt="Resume script execution button." width="16"> to jump to the set breakpoint.
Note that the code shown in Chrome DevTools is compiled code and therefore differs.
## Creating a new plugin (`spec-new`)
> Example: https://github.com/babel/babylon/pull/541
- 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)
- [ ] Make sure you use the `this.hasPlugin("plugin-name-here")` check in the babel parser so that your new plugin code only runs when that flag is turned on (not default behavior)
- [ ] Add failing/passing tests according to spec behavior
- Start working about the Babel transform itself!
## Internals
- AST spec ([babylon/ast/spec.md](https://github.com/babel/babylon/blob/master/ast/spec.md))
- Versioning ([doc/design/versioning.md](https://github.com/babel/babel/blob/master/doc/design/versioning.md)
- AST spec ([babel-parser/ast/spec.md](https://github.com/babel/babel/blob/master/packages/babel-parser/ast/spec.md))
- Versioning ([doc/design/versioning.md](https://github.com/babel/babel/blob/master/doc/design/versioning.md))
- Monorepo ([doc/design/monorepo.md](https://github.com/babel/babel/blob/master/doc/design/monorepo.md))
- Compiler environment support ([doc/design/compiler-environment-support.md](https://github.com/babel/babel/blob/master/doc/design/compiler-environment-support.md))
- Compiler assumptions ([doc/design/compiler-assumptions.md](https://github.com/babel/babel/blob/master/doc/design/compiler-assumptions.md))

View File

@@ -3,22 +3,24 @@
const plumber = require("gulp-plumber");
const through = require("through2");
const chalk = require("chalk");
const pump = require("pump");
const uglify = require("gulp-uglify");
const rename = require("gulp-rename");
const newer = require("gulp-newer");
const babel = require("gulp-babel");
const watch = require("gulp-watch");
const gulpWatch = require("gulp-watch");
const gutil = require("gulp-util");
const filter = require("gulp-filter");
const gulp = require("gulp");
const path = require("path");
const merge = require("merge-stream");
const RootMostResolvePlugin = require("webpack-dependency-suite")
.RootMostResolvePlugin;
const webpack = require("webpack");
const webpackStream = require("webpack-stream");
const merge = require("merge-stream");
const rollup = require("rollup-stream");
const source = require("vinyl-source-stream");
const buffer = require("vinyl-buffer");
const rollupBabel = require("rollup-plugin-babel");
const rollupNodeResolve = require("rollup-plugin-node-resolve");
const registerStandalonePackageTask = require("./scripts/gulp-tasks")
.registerStandalonePackageTask;
const sources = ["codemods", "packages", "experimental"];
const sources = ["codemods", "packages"];
function swapSrcWithLib(srcPath) {
const parts = srcPath.split(path.sep);
@@ -30,143 +32,141 @@ function getGlobFromSource(source) {
return `./${source}/*/src/**/*.js`;
}
gulp.task("default", ["build"]);
function getIndexFromPackage(name) {
return `${name}/src/index.js`;
}
gulp.task("build", function() {
function compilationLogger(rollup) {
return through.obj(function(file, enc, callback) {
gutil.log(
`Compiling '${chalk.cyan(file.relative)}'${
rollup ? " with rollup " : ""
}...`
);
callback(null, file);
});
}
function errorsLogger() {
return plumber({
errorHandler(err) {
gutil.log(err.stack);
},
});
}
function rename(fn) {
return through.obj(function(file, enc, callback) {
file.path = fn(file);
callback(null, file);
});
}
function buildBabel(exclude) {
return merge(
sources.map(source => {
const base = path.join(__dirname, source);
return gulp
.src(getGlobFromSource(source), { base: base })
.pipe(
plumber({
errorHandler: function(err) {
gutil.log(err.stack);
},
})
)
.pipe(
newer({
dest: base,
map: swapSrcWithLib,
})
)
.pipe(
through.obj(function(file, enc, callback) {
gutil.log("Compiling", "'" + chalk.cyan(file.relative) + "'...");
callback(null, file);
})
)
let stream = gulp.src(getGlobFromSource(source), { base: base });
if (exclude) {
const filters = exclude.map(p => `!**/${p}/**`);
filters.unshift("**");
stream = stream.pipe(filter(filters));
}
return stream
.pipe(errorsLogger())
.pipe(newer({ dest: base, map: swapSrcWithLib }))
.pipe(compilationLogger())
.pipe(babel())
.pipe(
through.obj(function(file, enc, callback) {
// Passing 'file.relative' because newer() above uses a relative
// path and this keeps it consistent.
file.path = path.resolve(file.base, swapSrcWithLib(file.relative));
callback(null, file);
})
// Passing 'file.relative' because newer() above uses a relative
// path and this keeps it consistent.
rename(file => path.resolve(file.base, swapSrcWithLib(file.relative)))
)
.pipe(gulp.dest(base));
})
);
});
gulp.task("watch", ["build"], function() {
watch(sources.map(getGlobFromSource), { debounceDelay: 200 }, function() {
gulp.start("build");
});
});
gulp.task("build-babel-standalone", cb => {
pump(
[
gulp.src(__dirname + "/packages/babel-standalone/src/index.js"),
webpackBuild(),
gulp.dest(__dirname + "/packages/babel-standalone"),
uglify(),
rename({ extname: ".min.js" }),
gulp.dest(__dirname + "/packages/babel-standalone"),
],
cb
);
});
function webpackBuild() {
let version = require("./packages/babel-core/package.json").version;
// If this build is part of a pull request, include the pull request number in
// the version number.
if (process.env.CIRCLE_PR_NUMBER) {
version += "+pr." + process.env.CIRCLE_PR_NUMBER;
}
const config = {
module: {
rules: [
{
test: /\.js$/,
include: /node_modules/,
loader: "babel-loader",
options: {
// Some of the node_modules may have their own "babel" section in
// their project.json (or a ".babelrc" file). We need to ignore
// those as we're using our own Babel options.
babelrc: false,
presets: ["env"],
},
},
{
test: /\.js$/,
exclude: /node_modules/,
loader: "babel-loader",
options: {
// Some of the node_modules may have their own "babel" section in
// their project.json (or a ".babelrc" file). We need to ignore
// those as we're using our own Babel options.
babelrc: false,
presets: ["env", "stage-0"],
},
},
],
},
node: {
// Mock Node.js modules that Babel require()s but that we don't
// particularly care about.
fs: "empty",
module: "empty",
net: "empty",
},
output: {
filename: "babel.js",
library: "Babel",
libraryTarget: "umd",
},
plugins: [
new webpack.DefinePlugin({
"process.env.NODE_ENV": '"production"',
BABEL_VERSION: JSON.stringify(version),
VERSION: JSON.stringify(version),
}),
/*new webpack.NormalModuleReplacementPlugin(
/..\/..\/package/,
"../../../../src/babel-package-shim"
),*/
new webpack.optimize.ModuleConcatenationPlugin(),
],
resolve: {
plugins: [
// Dedupe packages that are used across multiple plugins.
// This replaces DedupePlugin from Webpack 1.x
new RootMostResolvePlugin(__dirname, true),
],
},
};
return webpackStream(config, webpack);
// To write JSON for debugging:
/*return webpackStream(config, webpack, (err, stats) => {
require('gulp-util').log(stats.toString({colors: true}));
require('fs').writeFileSync('webpack-debug.json', JSON.stringify(stats.toJson()));
});*/
}
function buildRollup(packages) {
return merge(
packages.map(pkg => {
return rollup({
input: getIndexFromPackage(pkg),
format: "cjs",
plugins: [
rollupBabel({
envName: "babel-parser",
}),
rollupNodeResolve(),
],
})
.pipe(source("index.js"))
.pipe(buffer())
.pipe(errorsLogger())
.pipe(compilationLogger(/* rollup */ true))
.pipe(gulp.dest(path.join(pkg, "lib")));
})
);
}
gulp.task("build", function() {
const bundles = ["packages/babel-parser"];
return merge([buildBabel(/* exclude */ bundles), buildRollup(bundles)]);
});
gulp.task("default", gulp.series("build"));
gulp.task("build-no-bundle", () => buildBabel());
gulp.task(
"watch",
gulp.series("build-no-bundle", function watch() {
gulpWatch(
sources.map(getGlobFromSource),
{ debounceDelay: 200 },
gulp.task("build-no-bundle")
);
})
);
registerStandalonePackageTask(
gulp,
"babel",
"Babel",
path.join(__dirname, "packages"),
require("./packages/babel-core/package.json").version
);
const presetEnvWebpackPlugins = [
new webpack.NormalModuleReplacementPlugin(
/\.\/available-plugins/,
require.resolve(
path.join(
__dirname,
"./packages/babel-preset-env-standalone/src/available-plugins"
)
)
),
new webpack.NormalModuleReplacementPlugin(
/caniuse-lite\/data\/regions\/.+/,
require.resolve(
path.join(
__dirname,
"./packages/babel-preset-env-standalone/src/caniuse-lite-regions"
)
)
),
];
registerStandalonePackageTask(
gulp,
"babel-preset-env",
"babelPresetEnv",
path.join(__dirname, "packages"),
require("./packages/babel-preset-env/package.json").version,
presetEnvWebpackPlugins
);

View File

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

View File

@@ -1,49 +1,60 @@
MAKEFLAGS = -j1
export NODE_ENV = test
FLOW_COMMIT = bea8b83f50f597454941d2a7ecef6e93a881e576
TEST262_COMMIT = f90a52b39609a620c0854e0bd0b3a906c930fd17
# Fix color output until TravisCI fixes https://github.com/travis-ci/travis-ci/issues/7967
export FORCE_COLOR = true
SOURCES = packages codemods experimental
SOURCES = packages codemods
.PHONY: build build-dist watch lint fix clean test-clean test-only test test-ci publish bootstrap
build: clean
make clean-lib
build: clean clean-lib
./node_modules/.bin/gulp build
ifneq ("$(BABEL_ENV)", "cov")
node ./packages/babel-types/scripts/generateTypeHelpers.js
# call build again as the generated files might need to be compiled again.
./node_modules/.bin/gulp build
# generate flow and typescript typings
node scripts/generators/flow.js > ./packages/babel-types/lib/index.js.flow
node scripts/generators/typescript.js > ./packages/babel-types/lib/index.d.ts
ifneq ("$(BABEL_COVERAGE)", "true")
make build-standalone
make build-preset-env-standalone
endif
build-standalone:
./node_modules/.bin/gulp build-babel-standalone
build-preset-env-standalone:
./node_modules/.bin/gulp build-babel-preset-env-standalone
build-dist: build
cd packages/babel-polyfill; \
scripts/build-dist.sh
cd packages/babel-runtime; \
cd packages/babel-plugin-transform-runtime; \
node scripts/build-dist.js
node scripts/generate-babel-types-docs.js
watch: clean
make clean-lib
watch: clean clean-lib
# Ensure that build artifacts for types are created during local
# development too.
BABEL_ENV=development ./node_modules/.bin/gulp build-no-bundle
node ./packages/babel-types/scripts/generateTypeHelpers.js
node scripts/generators/flow.js > ./packages/babel-types/lib/index.js.flow
BABEL_ENV=development ./node_modules/.bin/gulp watch
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 --rulesdir="./scripts/eslint_rules"
fix:
./node_modules/.bin/eslint scripts $(SOURCES) *.js --format=codeframe --fix --rulesdir="./scripts/eslint_rules"
./node_modules/.bin/eslint scripts $(SOURCES) '*.js' --format=codeframe --fix --rulesdir="./scripts/eslint_rules"
clean: test-clean
rm -rf packages/babel-polyfill/browser*
rm -rf packages/babel-polyfill/dist
# rm -rf packages/babel-runtime/helpers
# rm -rf packages/babel-runtime/core-js
rm -rf coverage
rm -rf packages/*/npm-debug*
@@ -52,37 +63,69 @@ test-clean:
$(call clean-source-test, $(source)))
test-only:
./scripts/test.sh
BABEL_ENV=test ./scripts/test.sh
make test-clean
test: lint test-only
test-ci:
make bootstrap
make test-only
test-ci: bootstrap test-only
test-ci-coverage: SHELL:=/bin/bash
test-ci-coverage:
BABEL_ENV=cov make bootstrap
./scripts/test-cov.sh
BABEL_COVERAGE=true BABEL_ENV=test make bootstrap
BABEL_ENV=test TEST_TYPE=cov ./scripts/test-cov.sh
bash <(curl -s https://codecov.io/bash) -f coverage/coverage-final.json
bootstrap-flow:
rm -rf ./build/flow
mkdir -p ./build
git clone --branch=master --single-branch --shallow-since=2017-01-01 https://github.com/facebook/flow.git ./build/flow
cd build/flow && git checkout $(FLOW_COMMIT)
test-flow:
node scripts/tests/flow/run_babel_parser_flow_tests.js
test-flow-ci: bootstrap test-flow
test-flow-update-whitelist:
node scripts/tests/flow/run_babel_parser_flow_tests.js --update-whitelist
bootstrap-test262:
rm -rf ./build/test262
mkdir -p ./build
git clone --branch=master --single-branch --shallow-since=2017-01-01 https://github.com/tc39/test262.git ./build/test262
cd build/test262 && git checkout $(TEST262_COMMIT)
test-test262:
node scripts/tests/test262/run_babel_parser_test262.js
test-test262-ci: bootstrap test-test262
test-test262-update-whitelist:
node scripts/tests/test262/run_babel_parser_test262.js --update-whitelist
clone-license:
./scripts/clone-license.sh
publish:
git pull --rebase
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 ^
# --only-explicit-updates
./node_modules/.bin/lerna publish --force-publish=* --npm-tag=next --exact --skip-temp-tag
./node_modules/.bin/lerna publish --force-publish=* --exact --skip-temp-tag
make clean
bootstrap:
make clean-all
yarn
./node_modules/.bin/lerna bootstrap
bootstrap: clean-all
yarn --ignore-engines
./node_modules/.bin/lerna bootstrap -- --ignore-engines
make build
cd packages/babel-runtime; \
cd packages/babel-plugin-transform-runtime; \
node scripts/build-dist.js
clean-lib:
@@ -92,6 +135,7 @@ clean-lib:
clean-all:
rm -rf node_modules
rm -rf package-lock.json
rm -rf .changelog
$(foreach source, $(SOURCES), \
$(call clean-source-all, $(source)))

196
README.md
View File

@@ -24,10 +24,56 @@
<a href="https://medium.com/friendship-dot-js/i-peeked-into-my-node-modules-directory-and-you-wont-believe-what-happened-next-b89f63d21558"><img alt="Business Strategy Status" src="https://img.shields.io/badge/business%20model-flavortown-green.svg"></a>
</p>
Babel is community-driven and thus mostly maintained by a group of volunteers. It has a lot of [companies and projects](http://babeljs.io/users) using it but almost no sponsors/people funded to work on it. If you'd like to help maintain the future of the project, please consider:
Babel 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](slack.babeljs.io))
- [Giving funds by becoming a backer/sponsor on OpenCollective](https://opencollective.com/babel)
- Giving developer time on the project. (Message us on [Twitter](https://twitter.com/babeljs) or [Slack](https://slack.babeljs.io/) for guidance!)
- Giving funds by becoming a sponsor (see below)!
## Open Collective Sponsors
Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/babel#sponsor)]
<a href="https://opencollective.com/babel/sponsor/0/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/0/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/1/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/1/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/2/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/2/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/3/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/3/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/4/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/4/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/5/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/5/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/6/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/6/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/7/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/7/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/8/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/8/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/9/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/9/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/10/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/10/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/11/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/11/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/12/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/12/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/13/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/13/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/14/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/14/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/15/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/15/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/16/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/16/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/17/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/17/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/18/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/18/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/19/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/19/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/20/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/20/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/21/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/21/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/22/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/22/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/23/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/23/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/24/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/24/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/25/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/25/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/26/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/26/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/27/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/27/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/28/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/28/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/29/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/29/avatar.svg"></a>
## Patreon Sponsors
Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://www.patreon.com/henryzhu)]
## Bronze
<a href="http://teamextension.io/" target="_blank"><img src="https://teamextension.io/dist/img/logo/te-logo-compact.png" height="64"></a>
<a href="https://webflow.com/" target="_blank"><img src="https://opencollective.com/proxy/images/?src=https%3A%2F%2Fopencollective-production.s3-us-west-1.amazonaws.com%2F4a5024b0-8cf2-11e7-b1a2-b30b1de1463c.png&height=64"></a>
<a href="https://issue.sh/?utm_medium=github&utm_campaign=babel" target="_blank"><img src="https://user-images.githubusercontent.com/5557143/43912065-c8cdff78-9c33-11e8-829a-0b4166ccc215.png"></a>
<p><a href="https://twitter.com/mikesherov">Mike Sherov</a></p>
## Intro
@@ -50,153 +96,41 @@ Babel is a tool that helps you write code in the latest version of JavaScript. W
Try it out at our [REPL](https://babeljs.io/repl/build/master#?code_lz=NoRgNATGDMC6B0BbAhgBwBQDsAEBeAfNjgNTYgCUA3EA&lineWrap=true&presets=es2015%2Ces2016%2Ces2017&version=7.0.0-beta.2).
- [FAQ](#faq)
- [Team](#team)
- [Backers](#backers)
- [Sponsors](#sponsors)
- [License](#license)
## FAQ
### Docs?
### Who maintains Babel?
Check out our website: [babeljs.io](http://babeljs.io/)
Mostly a handful of volunteers! Please check out our [team page](https://babeljs.io/team)!
### Looking for support?
For questions and support please visit join our [Slack Community](https://slack.babeljs.io/), ask a question on [Stack Overflow](http://stackoverflow.com/questions/tagged/babeljs), or ping us on [Twitter](https://twitter.com/babeljs/).
For questions and support please visit join our [Slack Community](https://slack.babeljs.io/) (you can sign-up [here](https://slack.babeljs.io/) for an invite), ask a question on [Stack Overflow](https://stackoverflow.com/questions/tagged/babeljs), or ping us on [Twitter](https://twitter.com/babeljs).
### Is there a Babel song?
I'm so glad you asked: [Hallelujah —— In Praise of Babel](SONG.md) by [@angus-c](https://github.com/angus-c), [audio version](https://youtu.be/40abpedBKK8) by [@swyx](https://twitter.com/@swyx). Tweet us your recordings!
### Where are the docs?
Check out our website: [babeljs.io](https://babeljs.io/), and report issues/features at [babel/website](https://github.com/babel/website/issues).
### Want to report a bug or request a feature?
Please read through our [CONTRIBUTING.md](https://github.com/babel/babel/blob/master/CONTRIBUTING.md) and fill out the issue template at [babel/issues](https://github.com/babel/babel/issues)!
### Want to report an issue with our website ([babeljs.io](https://babeljs.io))?
For docs/website issues please visit the [babel/website](https://github.com/babel/website/issues).
Please read through our [CONTRIBUTING.md](CONTRIBUTING.md) and fill out the issue template at [babel/issues](https://github.com/babel/babel/issues)!
### Want to contribute to Babel?
Check out our [CONTRIBUTING.md](https://github.com/babel/babel/blob/master/CONTRIBUTING.md) to get started with setting up the repo.
Check out our [CONTRIBUTING.md](CONTRIBUTING.md) to get started with setting up the repo.
- If you have already joined Slack, join our [#development](https://babeljs.slack.com/messages/development) channel and say hi!
- Check out the issues with the [good first issue](https://github.com/babel/babel/labels/good%20first%20issue) and [help wanted](https://github.com/babel/babel/labels/help%20wanted) label.
- Check out the issues with the [good first issue](https://github.com/babel/babel/labels/good%20first%20issue) and [help wanted](https://github.com/babel/babel/labels/help%20wanted) label. We suggest also looking at the closed ones to get a sense of the kinds of issues you can tackle.
- Our discussions/notes/roadmap: [babel/notes](https://github.com/babel/notes)
- Our progress on TC39 proposals: [babel/proposals](https://github.com/babel/proposals)
### How is the repo structured?
The Babel repo is managed as a [monorepo](https://github.com/babel/babel/blob/master/doc/design/monorepo.md) that is composed of many [npm packages](/packages#readme).
## Team
### Core members
[![Babel](https://avatars.githubusercontent.com/u/9637642?s=64)](https://github.com/babel) | [![Daniel Tschinder](https://avatars.githubusercontent.com/u/231804?s=64)](https://github.com/danez) | [![Logan Smyth](https://avatars.githubusercontent.com/u/132260?s=64)](https://github.com/loganfsmyth) | [![Henry Zhu](https://avatars.githubusercontent.com/u/588473?s=64)](https://github.com/hzoo) |
|---|---|---|---|
Babel | Daniel Tschinder | Logan Smyth | Henry Zhu |
:octocat: [@babel](https://github.com/babel) | [@danez](https://github.com/danez) | [@loganfsmyth](https://github.com/loganfsmyth) | [@hzoo](https://github.com/hzoo) |
:bird: [@babeljs](https://twitter.com/babeljs) | [@TschinderDaniel](https://twitter.com/TschinderDaniel) | [@loganfsmyth](https://twitter.com/loganfsmyth) | [@left_pad](https://twitter.com/left_pad) |
### Members
[![Andrew Levine](https://avatars.githubusercontent.com/u/5233399?s=64)](https://github.com/drewml) | [![Boopathi Rajaa](https://avatars.githubusercontent.com/u/294474?s=64)](https://github.com/boopathi) | [![Brian Ng](https://avatars.githubusercontent.com/u/56288?s=64)](https://github.com/existentialism) | [![Dan Harper](https://avatars.githubusercontent.com/u/510740?s=64)](https://github.com/danharper) | [![diogo franco](https://avatars.githubusercontent.com/u/73085?s=64)](https://github.com/kovensky) | [![Aaron Ang](https://avatars1.githubusercontent.com/u/7579804?s=64)](https://github.com/aaronang) | [![Artem Yavorsky](https://avatars2.githubusercontent.com/u/1521229?s=64)](https://github.com/yavorsky) |
|---|---|---|---|---|---|---|
| Andrew Levine | Boopathi Rajaa | Brian Ng | Dan Harper | Diogo Franco | Aaron Ang | Artem Yavorsky |
| [@drewml](https://github.com/drewml) | [@boopathi](https://github.com/boopathi) | [@existentialism](https://github.com/existentialism) | [@danharper](https://github.com/danharper) | [@kovensky](https://github.com/kovensky) | [@aaronang](https://github.com/aaronang) | [@yavorsky](https://github.com/yavorsky) |
| [@drewml](https://twitter.com/drewml) | [@heisenbugger](https://twitter.com/heisenbugger) | [@existentialism](https://twitter.com/existentialism) | [@DanHarper7](https://twitter.com/DanHarper7) | [@kovnsk](https://twitter.com/kovnsk) | [@_aaronang](https://twitter.com/_aaronang) | [@yavorsky_](https://twitter.com/yavorsky_) |
[![Juriy Zaytsev](https://avatars.githubusercontent.com/u/383?s=64)](https://github.com/kangax) | [![Kai Cataldo](https://avatars.githubusercontent.com/u/7041728?s=64)](https://github.com/kaicataldo) | [![Moti Zilberman](https://avatars.githubusercontent.com/u/2246565?s=64)](https://github.com/motiz88) | [![Sven Sauleau](https://avatars3.githubusercontent.com/u/1493671?s=64)](https://github.com/xtuc) | [![Samuel Reed](https://avatars3.githubusercontent.com/u/1197375?s=64)](https://github.com/STRML) | [![Sergey Rubanov](https://avatars1.githubusercontent.com/u/1507086?s=64)](https://github.com/chicoxyzzy) |
|---|---|---|---|---|---|
| Juriy Zaytsev | Kai Cataldo | Moti Zilberman | Sven Sauleau | Samuel Reed | Sergey Rubanov |
| [@kangax](https://github.com/kangax) | [@kaicataldo](https://github.com/kaicataldo) | [@motiz88](https://github.com/motiz88) | [@xtuc](https://github.com/xtuc) | [@STRML](https://github.com/STRML) | [@chicoxyzzy](https://github.com/chicoxyzzy) |
| [@kangax](https://twitter.com/kangax) | [@kai_cataldo](https://twitter.com/kai_cataldo) | [@motiz88](https://twitter.com/motiz88) | [@svensauleau](https://twitter.com/svensauleau) | [@STRML_](https://twitter.com/STRML_) | [@chicoxyzzy](https://twitter.com/chicoxyzzy) |
### Non-Human Members
[<img src="https://github.com/babel/babel-bot/raw/master/babel-bot.png" height="64">](https://github.com/babel-bot) |
|---|
| Babel Bot |
| [@babel-bot](https://github.com/babel-bot) |
| [@babeljs](https://twitter.com/babeljs) |
### Inactive members
[![Amjad Masad](https://avatars.githubusercontent.com/u/587518?s=64)](https://github.com/amasad) | [![James Kyle](https://avatars.githubusercontent.com/u/952783?s=64)](https://github.com/thejameskyle) | [![Jesse McCarthy](https://avatars.githubusercontent.com/u/129203?s=64)](https://github.com/jmm) | [![Sebastian McKenzie](https://avatars.githubusercontent.com/u/853712?s=64)](https://github.com/kittens) (Creator) |
|---|---|---|---|
Amjad Masad | James Kyle | Jesse McCarthy | Sebastian McKenzie |
[@amasad](https://github.com/amasad) | [@thejameskyle](https://github.com/thejameskyle) | [@jmm](https://github.com/jmm) | [@sebmck](https://twitter.com/sebmck) |
| [@amasad](https://twitter.com/amasad) | [@thejameskyle](https://twitter.com/thejameskyle) | [@mccjm](https://twitter.com/mccjm) | [@kittens](https://github.com/kittens)
## Backers
Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/babel#backer)]
<a href="https://opencollective.com/babel/backer/0/website" target="_blank"><img src="https://opencollective.com/babel/backer/0/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/1/website" target="_blank"><img src="https://opencollective.com/babel/backer/1/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/2/website" target="_blank"><img src="https://opencollective.com/babel/backer/2/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/3/website" target="_blank"><img src="https://opencollective.com/babel/backer/3/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/4/website" target="_blank"><img src="https://opencollective.com/babel/backer/4/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/5/website" target="_blank"><img src="https://opencollective.com/babel/backer/5/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/6/website" target="_blank"><img src="https://opencollective.com/babel/backer/6/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/7/website" target="_blank"><img src="https://opencollective.com/babel/backer/7/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/8/website" target="_blank"><img src="https://opencollective.com/babel/backer/8/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/9/website" target="_blank"><img src="https://opencollective.com/babel/backer/9/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/10/website" target="_blank"><img src="https://opencollective.com/babel/backer/10/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/11/website" target="_blank"><img src="https://opencollective.com/babel/backer/11/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/12/website" target="_blank"><img src="https://opencollective.com/babel/backer/12/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/13/website" target="_blank"><img src="https://opencollective.com/babel/backer/13/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/14/website" target="_blank"><img src="https://opencollective.com/babel/backer/14/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/15/website" target="_blank"><img src="https://opencollective.com/babel/backer/15/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/16/website" target="_blank"><img src="https://opencollective.com/babel/backer/16/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/17/website" target="_blank"><img src="https://opencollective.com/babel/backer/17/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/18/website" target="_blank"><img src="https://opencollective.com/babel/backer/18/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/19/website" target="_blank"><img src="https://opencollective.com/babel/backer/19/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/20/website" target="_blank"><img src="https://opencollective.com/babel/backer/20/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/21/website" target="_blank"><img src="https://opencollective.com/babel/backer/21/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/22/website" target="_blank"><img src="https://opencollective.com/babel/backer/22/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/23/website" target="_blank"><img src="https://opencollective.com/babel/backer/23/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/24/website" target="_blank"><img src="https://opencollective.com/babel/backer/24/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/25/website" target="_blank"><img src="https://opencollective.com/babel/backer/25/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/26/website" target="_blank"><img src="https://opencollective.com/babel/backer/26/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/27/website" target="_blank"><img src="https://opencollective.com/babel/backer/27/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/28/website" target="_blank"><img src="https://opencollective.com/babel/backer/28/avatar.svg"></a>
<a href="https://opencollective.com/babel/backer/29/website" target="_blank"><img src="https://opencollective.com/babel/backer/29/avatar.svg"></a>
## Sponsors
Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/babel#sponsor)]
<a href="https://opencollective.com/babel/sponsor/0/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/0/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/1/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/1/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/2/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/2/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/3/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/3/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/4/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/4/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/5/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/5/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/6/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/6/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/7/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/7/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/8/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/8/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/9/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/9/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/10/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/10/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/11/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/11/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/12/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/12/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/13/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/13/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/14/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/14/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/15/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/15/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/16/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/16/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/17/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/17/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/18/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/18/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/19/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/19/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/20/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/20/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/21/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/21/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/22/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/22/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/23/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/23/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/24/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/24/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/25/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/25/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/26/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/26/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/27/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/27/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/28/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/28/avatar.svg"></a>
<a href="https://opencollective.com/babel/sponsor/29/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/29/avatar.svg"></a>
The Babel repo is managed as a [monorepo](doc/design/monorepo.md) that is composed of many [npm packages](packages/README.md).
## License
[MIT](https://github.com/babel/babel/blob/master/LICENSE)
[MIT](LICENSE)

69
SONG.md Normal file
View File

@@ -0,0 +1,69 @@
## Hallelujah—In Praise of Babel
➤ [🎶 Audio version here!](https://youtu.be/40abpedBKK8)
I heard there was a clever trick
That rewrote all your JavaScript
But you dont really care for magic, do you
Well it goes like this: the source, the dist
The ES five, the ES six
The sacred script transforming Hallelujah
Hallelujah, Hallelujah
Hallelujah, Hallelujah
So I added all the shiny things
Classes, spreads and template strings
Through syntax sugared code I tried to woo you
Generators, const and let
I used them all without regret
And its a terse and a destructured Hallelujah
Hallelujah etc.
Well my faith was strong but I needed proof
The standard was my source of truth
But TC39 meant nothing to you
So even though you werent impressed
I checked the build against the spec
And its a more-or-less compliant Hallelujah
Hallelujah etc.
Now you say the build steps too complex
And you claim no need for ES Next
Well I used to think that way before I knew you
But your code grows older with each line
Its a joyless dirge on a withered vine
Its a threnody for a bygone Hallelujah
Hallelujah etc.
Yes I learned about the danger signs
How theyd polyfilled a thousand lines
The cost of using Maps and Symbols threw you
Still I disregarded common sense
Now my source is small but the builds immense
And its a slow and unresponsive Hallelujah
Hallelujah etc.
There was a time when they let me know
Whats really going on below
But now theres only source maps there to school you
And debuggings not a progress march
Its a frenzied fumble in the dark
Its a labyrinthine search for Hallelujah
Hallelujah etc.
Well, maybe theres a god up there
But all I ever got from prayers
Was broken builds and errors that would spook you
And that anguished cry you hear at night
Is the plugin I forgot to write
Its a cold and its a broken Hallelujah
Hallelujah etc.
[Angus Croll](https://github.com/angus-c)

128
babel.config.js Normal file
View File

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

View File

@@ -1,27 +0,0 @@
general:
artifacts:
- "packages/babel-standalone/babel.js"
- "packages/babel-standalone/babel.min.js"
machine:
node:
version:
8
dependencies:
pre:
- curl -o- -L https://yarnpkg.com/install.sh | bash
cache_directories:
- ~/.yarn-cache
override:
- yarn
test:
override:
- make test-ci-coverage
# Builds babel-standalone with the regular Babel config
- make build
# test-ci-coverage doesn't test babel-standalone, as trying to gather coverage
# data for a JS file that's several megabytes large is bound to fail. Here,
# we just run the babel-standalone test separately.
- ./node_modules/mocha/bin/_mocha packages/babel-standalone/test/ --opts test/mocha.opts

View File

@@ -1,6 +0,0 @@
{
"rules": {
"prettier/prettier": ["error", { "trailingComma": "all" }],
"no-undefined-identifier": 2
}
}

View File

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

View File

@@ -0,0 +1,25 @@
{
"name": "@babel/plugin-codemod-object-assign-to-object-spread",
"version": "7.0.0-rc.3",
"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",
"main": "lib/index.js",
"keywords": [
"@babel/codemod",
"@babel/plugin"
],
"dependencies": {
"@babel/plugin-syntax-object-rest-spread": "7.0.0-rc.3"
},
"peerDependencies": {
"@babel/core": "^7.0.0-0"
},
"devDependencies": {
"@babel/core": "7.0.0-rc.3",
"@babel/helper-plugin-test-runner": "7.0.0-rc.3"
},
"publishConfig": {
"access": "public"
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,3 @@
import runner from "@babel/helper-plugin-test-runner";
runner(__dirname);

View File

@@ -1,4 +1,4 @@
# babel-plugin-codemod-optional-catch-binding
# @babel/plugin-codemod-optional-catch-binding
> If the argument bound to the catch block is not referenced in the catch block, that argument and the catch binding is removed.
@@ -22,11 +22,10 @@ try {
}
```
## Installation
```sh
npm install --save-dev babel-plugin-codemod-optional-catch-binding
npm install --save-dev @babel/plugin-codemod-optional-catch-binding
```
## Usage
@@ -37,21 +36,21 @@ npm install --save-dev babel-plugin-codemod-optional-catch-binding
```json
{
"plugins": ["codemod-optional-catch-binding"]
"plugins": ["@babel/plugin-codemod-optional-catch-binding"]
}
```
### Via CLI
```sh
babel --plugins codemod-optional-catch-binding script.js
babel --plugins @babel/plugin-codemod-optional-catch-binding script.js
```
### Via Node API
```javascript
require("babel-core").transform("code", {
plugins: ["codemod-optional-catch-binding"]
require("@babel/core").transform("code", {
plugins: ["@babel/plugin-codemod-optional-catch-binding"]
});
```

View File

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

View File

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

View File

@@ -1,3 +1,3 @@
import runner from "babel-helper-plugin-test-runner";
import runner from "@babel/helper-plugin-test-runner";
runner(__dirname);

View File

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

View File

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

View File

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

View File

@@ -1,6 +0,0 @@
{
"rules": {
"prettier/prettier": ["error", { "trailingComma": "all" }],
"no-undefined-identifier": 2
}
}

View File

@@ -1,6 +0,0 @@
/lib
debug-fixtures
fixtures
/data
/flow-typed
test/tmp

View File

@@ -1,15 +0,0 @@
coverage
src
test
lib/types.js
node_modules
scripts
.eslintignore
.travis.yml
codecov.yml
yarn.lock
.nyc_output
.vscode
.eslintrc
babel-preset-env-*.tgz
flow-typed

View File

@@ -1,654 +0,0 @@
# Changelog
## v1.6.0 (2017-07-04)
### :rocket: New Feature
- Bump compat-table for node8 support ([#363](https://github.com/babel/babel-preset-env/pull/363)) (@existentialism)
We updated our mappings to support native trailing function commas and string paddings in Node.js 8+.
### :bug: Bug Fix
- Handle `chromeandroid` browserslist value ([#367](https://github.com/babel/babel-preset-env/pull/367)) (@yavorsky)
We added support for using browserslist's `chromeandroid` in `targets`.
### :memo: Documentation
- Tweak uglify option docs ([#368](https://github.com/babel/babel-preset-env/pull/368)) (@existentialism)
Thanks to @graingert and @pfiaux for pointing out some needed updates to the `uglify-js`-related docs.
## v1.5.2 (2017-06-07)
### :bug: Bug Fix
- Ensure explicit targets always override browsers key targets ([#346](https://github.com/babel/babel-preset-env/pull/346)) (@existentialism)
`browser` targets should be overridden by explicit targets, and we inadvertently broke this when we landed string version support.
## v1.5.1 (2017-05-22)
### :bug: Bug Fix
- Compile with loose mode ([#322](https://github.com/babel/babel-preset-env/pull/332)) (@existentialism)
## v1.5.0 (2017-05-19)
### :rocket: New Feature
- Support target versions as strings ([#321](https://github.com/babel/babel-preset-env/pull/321)) (@existentialism)
We were originally waiting on 2.x for a breaking change, but since node v7.10
and other targets are causing some pain, we decided to land a backwards
compatible version.
### :house: Internal
- Backport: use preset-env and remove flow-strip-types ([#324](https://github.com/babel/babel-preset-env/pull/324)) (@yavorsky)
- Bump electron-to-chromium ([#329](https://github.com/babel/babel-preset-env/pull/329)) (@existentialism)
- Tweak version mappings to match compat-table updates ([#323](https://github.com/babel/babel-preset-env/pull/323)) (@existentialism)
- Bump browserslist ([#319](https://github.com/babel/babel-preset-env/pull/319)) (@existentialism)
- Bump compat-table ([#307](https://github.com/babel/babel-preset-env/pull/307)) (@existentialism)
- Add debug-fixtures and test/tmp to .eslintignore ([#305](https://github.com/babel/babel-preset-env/pull/305)) (@yavorsky)
## v1.4.0 (2017-04-14)
### :rocket: New Feature
- Support `spec` option ([#98](https://github.com/babel/babel-preset-env/pull/98)) (@Kovensky)
Added an option to enable more spec compliant, but potentially slower, transformations for any plugins in this preset that support them.
- Bump compat-table for Edge 15 support ([#273](https://github.com/babel/babel-preset-env/pull/273)) (@existentialism)
We updated our mappings so that you can get native support for async/await and other goodies when targeting Edge 15!
### :bug: Bug Fix
- Add Android browser to name map ([#270](https://github.com/babel/babel-preset-env/pull/270)) (@existentialism)
Fixed a bug that was ignoring Android targets in browserslist queries (for example: "Android >= 4").
### :memo: Documentation
- Clarify note about loading polyfills only once ([#282](https://github.com/babel/babel-preset-env/pull/282)) (@darahak)
- Add a reminder about include/exclude options ([#275](https://github.com/babel/babel-preset-env/pull/275)) (@existentialism)
### :house: Internal
- Chore: reduce package size. ([#281](https://github.com/babel/babel-preset-env/pull/281)) (@evilebottnawi)
- Remove deprecated comment ([#271](https://github.com/babel/babel-preset-env/pull/271)) (@yavorsky)
## v1.3.3 (2017-04-07)
### :bug: Bug Fix
- Support electron version in a string format ([#252](https://github.com/babel/babel-preset-env/pull/252)) (@yavorsky)
Adding electron as a target was an inadvertent breaking change as it no longer
allowed string versions. We added an exception for now, even though it is
inconsistent with other versions. Just as a note, the upcoming version 2.x will
allow _both_ number and string versions.
- Ensure const-check plugin order ([#257](https://github.com/babel/babel-preset-env/pull/257)) (@existentialism)
We now force the `const-es2015-check` plugin to run first (so that it can
correctly report issues before they get transpiled away).
### :rocket: New Feature
- Allow use `babel-plugin-` prefix for include and exclude ([#242](https://github.com/babel/babel-preset-env/pull/242)) (@yavorsky)
The `include` and `exclude` options now allow both prefixed (`babel-plugin-transform-es2015-spread`)
and prefix-less (`transform-es2015-spread`) plugin names.
### :memo: Documentation
- Note babel plugin prefix handling in include/exclude ([#245](https://github.com/babel/babel-preset-env/pull/245)) (@existentialism)
- Fix README: debug option shows info in stdout. ([#236](https://github.com/babel/babel-preset-env/pull/236)) (@Gerhut)
### :house: Internal
- Add simple smoke-test ([#240](https://github.com/babel/babel-preset-env/pull/240)) (@existentialism)
- Add prepublish script (@existentialism)
## v1.3.2 (2017-03-30)
- Fixed an issue with a broken publish
## v1.3.1 (2017-03-30)
- Fixed a regression with missing files due to `.npmignore`.
## v1.3.0 (2017-03-30)
### :bug: Bug Fix
- Add check for ArrayBuffer[Symbol.species] ([#233](https://github.com/babel/babel-preset-env/pull/233)) (@existentialism)
We now properly check for `Symbol.species` support in ArrayBuffer and include the
polyfill if necessary. This should, as a side effect, fix ArrayBuffer-related
errors on IE9.
### :nail_care: Polish
- Fill data with electron as a target. ([#229](https://github.com/babel/babel-preset-env/pull/229)) (@yavorsky)
We've simplified things by adding `electron` as a target instead of doing a bunch of
things at runtime. Electron targets should now also be displayed in the debug output.
- separate default builtins for platforms ([#226](https://github.com/babel/babel-preset-env/pull/226)) (@restrry)
If you are targeting the `node` environment exclusively, the always-included web polyfills
(like `dom.iterable`, and a few others) will now no longer be included.
### :memo: Documentation
* remove deprecated projects ([#223](https://github.com/babel/babel-preset-env/pull/223)) [skip ci] (@stevemao)
### :house: Internal
* npmignore: Add related to build data and codecov. ([#216](https://github.com/babel/babel-preset-env/pull/216)) (@yavorsky)
## v1.2.2 (2017-03-14)
### :bug: Bug Fix
- Refactor browser data parsing to handle families ([#208](https://github.com/babel/babel-preset-env/pull/208)) (@existentialism)
When parsing plugin data, we weren't properly handling browser families. This caused
`transform-es2015-block-scoping` and other plugins to be incorrectly added for Edge >= 12.
(s/o to @mgol for the the report and review!)
- Add typed array methods to built-ins features. ([#198](https://github.com/babel/babel-preset-env/pull/198)) (@yavorsky)
Fixes an issue where some TypedArray features were not being polyfilled properly. (s/o to @alippai for the report!)
### :memo: Documentation
- Fixed minor typo in readme ([#199](https://github.com/babel/babel-preset-env/pull/199)) (@bl4ckdu5t)
- Add built-ins, better links, compat-table url, etc ([#195](https://github.com/babel/babel-preset-env/pull/195)) (@yavorsky)
- Change CONTRIBUTING.md to use absolute paths ([#194](https://github.com/babel/babel-preset-env/pull/194)) (@aaronang)
### :house: Internal
- Bump plugins ([#201](https://github.com/babel/babel-preset-env/pull/201)) (@yavorsky)
- Enable code coverage ([#200](https://github.com/babel/babel-preset-env/pull/200)) (@alxpy)
- Increase mocha timeout to 10s ([#202](https://github.com/babel/babel-preset-env/pull/202)) (@yavorsky)
## v1.2.1 (2017-03-06)
### :bug: Bug Fix
- Add transform-duplicate-keys mapping ([#192](https://github.com/babel/babel-preset-env/pull/192)) (@existentialism)
Our plugin data was missing a mapping for the `transform-duplicate-keys` plugin which caused it to never be included. (s/o to @Timer for the report!)
### :memo: Documentation
- Clarify reasons for the uglify option in README.md ([#188](https://github.com/babel/babel-preset-env/pull/188)) (@mikegreiling)
## v1.2.0 (2017-03-03)
### :rocket: New Feature
- Add uglify as a target ([#178](https://github.com/babel/babel-preset-env/pull/178)) (@yavorsky)
Support for `uglify` as a target is now available! This will enable all plugins and, as a result, fully compiles your code to ES5. Note, that useBuiltIns will work as before, and only the polyfills that your other target(s) need will be included.
```json
{
"presets": [
["env", {
"targets": {
"chrome": 55,
"uglify": true
},
"useBuiltIns": true,
"modules": false
}]
]
}
```
### :bug: Bug Fix
- Respect older versions in invert equals map ([#180](https://github.com/babel/babel-preset-env/pull/180)) (@danez)
Fixes a number of bugs that caused some incorrect and/or missing environment data when parsing `compat-table`.
## v1.1.11 (2017-03-01)
This release primarily upgrades `compat-table`, which adds support for async on Node 7.6!
### :bug: Bug Fix
- Fix hasBeenWarned condition. ([#175](https://github.com/babel/babel-preset-env/pull/175)) (@yavorsky)
### :memo: Documentation
- Add yarn example. ([#174](https://github.com/babel/babel-preset-env/pull/174)) (@yavorsky)
### :house: Internal
- Bump compat-table ([#177](https://github.com/babel/babel-preset-env/pull/177)) (@existentialism)
- Add electron version exception test ([#176](https://github.com/babel/babel-preset-env/pull/176)) (@existentialism)
## v1.1.10 (2017-02-24)
### :bug: Bug Fix
- Drop use of lodash/intersection from checkDuplicateIncludeExcludes ([#173](https://github.com/babel/babel-preset-env/pull/173)) (@existentialism)
## v1.1.9 (2017-02-24)
### :bug: Bug Fix
- Add tests for debug output ([#156](https://github.com/babel/babel-preset-env/pull/156)) (@existentialism)
Since we've (mostly @yavorsky) have fixed a number of bugs recently with the `debug` option output, we added the ability to assert stdout matches what we expect. Read the updated [CONTRIBUTING.md](https://github.com/babel/babel-preset-env/blob/master/CONTRIBUTING.md#testing-the-debug-option) for more info.
- Fixes #143. Log correct targets. ([#155](https://github.com/babel/babel-preset-env/pull/155)) (@yavorsky)
This fixes a bug in the `debug` output where incorrect target(s) were being displayed for why a particular plugin/preset was being included.
Given targets:
```txt
{
"firefox": 52,
"node": 7.4
}
```
Before:
```txt
Using plugins:
transform-es2015-destructuring {"node":6.5}
transform-es2015-for-of {"node":6.5}
transform-es2015-function-name {"node":6.5}
transform-es2015-literals {"node":4}
transform-exponentiation-operator {"firefox":52}
syntax-trailing-function-commas {"firefox":52}
```
After:
```txt
Using plugins:
transform-es2015-destructuring {"firefox":52}
transform-es2015-for-of {"firefox":52}
transform-es2015-function-name {"firefox":52}
transform-es2015-literals {"firefox":52}
transform-exponentiation-operator {"node":7.4}
syntax-trailing-function-commas {"node":7.4}
```
### :memo: Documentation
- Fix compat-table link in contributing.md (@existentialism)
- Update README examples to fix website ([#151](https://github.com/babel/babel-preset-env/pull/)) (@existentialism)
- Fix few typos ([#146](https://github.com/babel/babel-preset-env/pull/146)) (@existentialism)
- Add configuration example to clarify `debug: true` ([#138](https://github.com/babel/babel-preset-env/pull/138)) (@yavorsky)
- Fix CHANGELOGs v1.1.8 updates typo. ([#136](https://github.com/babel/babel-preset-env/pull/136)) (@yavorsky)
- README: Update `debug: true` example. ([#138](https://github.com/babel/babel-preset-env/pull/138)) (@yavorsky)
### :house: Internal
- update compat ([#169](https://github.com/babel/babel-preset-env/pull/169)) (@hzoo)
- Use external Electron to Chromium library ([#144](https://github.com/babel/babel-preset-env/pull/144)) (@Kilian)
- Update yarn lockfile ([#152](https://github.com/babel/babel-preset-env/pull/152)) (@existentialism)
- Extract option normalization into independant file ([#125](https://github.com/babel/babel-preset-env/pull/125)) (@baer)
- Update yarnfile ([#145](https://github.com/babel/babel-preset-env/pull/145)) (@baer)
- devDeps: eslint-config-babel v5.0.0 ([#139](https://github.com/babel/babel-preset-env/pull/139)) (@kaicataldo)
- Update compat-table, build data ([#135](https://github.com/babel/babel-preset-env/pull/135)) (@hzoo)
## v1.1.8 (2017-01-10)
### :bug: Bug Fix
- Debug: Transformations before logs. ([#128](https://github.com/babel/babel-preset-env/pull/128)) (@yavorsky)
Makes sure that all transformations on `targets` (such as `exclude`/`include`) are run before logging out with the `debug` option. Fixes ([#127](https://github.com/babel/babel-preset-env/issues/127)).
### :house: Internal
- Remove unnecessary extension. ([#131](https://github.com/babel/babel-preset-env/pull/131)) (@roman-yakobnyuk)
- Include yarn.lock and update CI. ([#124](https://github.com/babel/babel-preset-env/pull/124)) (@existentialism)
## v1.1.7 (2017-01-09)
Had a publishing issue in the previous release.
## v1.1.6 (2017-01-06)
### :bug: Bug Fix
- Explicitly resolve lowest browser version. ([#121](https://github.com/babel/babel-preset-env/pull/121)) (@brokenmass)
```js
{
"targets": {
"browsers": ["ios >= 6"] // was resolving to {ios: 10} rather than {ios: 6}
}
}
```
## v1.1.5 (2017-01-04)
### :bug: Bug Fix
- Show error if target version is not a number. ([#107](https://github.com/babel/babel-preset-env/pull/107)) (@existentialism)
```js
{
"presets": [
["env", {
"targets": {
"chrome": "52", // will error since it's not a number,
"chrome": 52 // correct!
}
}]
]
}
```
- Fix targets for the `debug` option. ([#109](https://github.com/babel/babel-preset-env/pull/109)) (@yavorsky)
Now it prints the transformed targets/environments rather than the browsers query.
```txt
Using targets:
{
"chrome": 53,
"ie": 10,
"node": 6
}
Modules transform: false
Using plugins:
transform-es2015-arrow-functions {"chrome":47,"node":6}
transform-es2015-block-scoped-functions {"chrome":41,"ie":11,"node":4}
Using polyfills:
es6.typed.uint8-clamped-array {"chrome":5,"node":0.12}
es6.map {"chrome":51,"node":6.5}
```
## v1.1.4 (2016-12-16)
v1.1.2-v1.1.4
### :bug: Bug Fix
The new `exclude`/`include` options weren't working correctly for built-ins. ([#102](https://github.com/babel/babel-preset-env/pull/102)).
Also fixes an issue with debug option.
## v1.1.1 (2016-12-13)
### :bug: Bug Fix
Regression with the previous release due to using `Object.values` (ES2017). This wasn't caught because we are using babel-register to run tests and includes polyfills so it didn't fail on CI even though we have Node 0.10 as an env. Looking into fixing this to prevent future issues.
## v1.1.0 (2016-12-13)
### :rocket: New Feature
- Add `exclude` option, rename `whitelist` to `include` ([#89](https://github.com/babel/babel-preset-env/pull/89)) (@hzoo)
Example:
```js
{
"presets": [
["env", {
"targets": {
"browsers": ["last 2 versions", "safari >= 7"]
},
"include": ["transform-es2015-arrow-functions"],
"exclude": [
"transform-regenerator",
"transform-async-to-generator",
"map"
],
"useBuiltIns": true
}]
]
}
```
`"exclude": ["transform-regenerator"]` doesn't transform generators and removes `regeneratorRuntime` from being imported.
`"exclude": ["transform-async-to-generator"]` doesn't use the built-in async-to-gen transform so you can use something like [fast-async](https://github.com/MatAtBread/fast-async).
`"exclude": ["map"]` doesn't include the `Map` polyfill if you know you aren't using it in your code (w/ `useBuiltIns`). (We will figure out a way to automatically do this [#84](https://github.com/babel/babel-preset-env/issues/84)).
If you pass a wrong plugin it will error: valid options for `include/exclude` are in [/data/plugin-features.js](https://github.com/babel/babel-preset-env/blob/master/data/plugin-features.js) and [/data/built-in-features.js](https://github.com/babel/babel-preset-env/blob/master/data/built-in-features.js) (without the `es6.`)
### :house: Internal
- Optimize result filtration. ([#77](https://github.com/babel/babel-preset-env/pull/77)) (@yavorsky)
- Update eslint config to align with other babel projects ([#79](https://github.com/babel/babel-preset-env/pull/79)) (@baer)
- Update pathnames to avoid uppercase ([#80](https://github.com/babel/babel-preset-env/pull/80)) (@baer)
- Refactor build data for clarity/consistency ([#81](https://github.com/babel/babel-preset-env/pull/81)) (@baer)
- Update linting rules to cover all js ([#82](https://github.com/babel/babel-preset-env/pull/82)) (@baer)
- Cleanup lib before rebuilding ([#87](https://github.com/babel/babel-preset-env/pull/87)) (@baer)
- Move linting dependency to be dev only ([#88](https://github.com/babel/babel-preset-env/pull/88)) (@baer)
### :memo: Documentation
- Fix typo ([#78](https://github.com/babel/babel-preset-env/pull/78)) (@rohmanhm)
- Fix PR link in changelog. ([#75](https://github.com/babel/babel-preset-env/pull/75)) (@nhajidin)
## v1.0.2 (2016-12-10)
### :bug: Bug Fix
* Fix issue with Object.getOwnPropertySymbols ([#71](https://github.com/babel/babel-preset-env/pull/71)) ([@existentialism](https://github.com/existentialism))
Was requiring the wrong module kinda of like in v1.0.1:
https://github.com/zloirock/core-js#ecmascript-6-symbol
```diff
-import "core-js/modules/es6.object.get-own-property-symbols";
```
The test is just a part of `Symbol`.
## v1.0.1 (2016-12-10)
### :bug: Bug Fix
* Fix regenerator import ([#68](https://github.com/babel/babel-preset-env/pull/68)) ([@hzoo](https://github.com/hzoo))
We were outputting an invalid path for `regenerator`!
```diff
+import "regenerator-runtime/runtime";
-import "core-js/modules/regenerator-runtime/runtime"-
```
## v1.0.0 (2016-12-09)
### :rocket: New Feature
* Add `useBuiltIns` option ([#56](https://github.com/babel/babel-preset-env/pull/56)) ([@hzoo](https://github.com/hzoo)), ([@yavorsky](https://github.com/yavorsky)), ([@existentialism](https://github.com/existentialism))
A way to apply `babel-preset-env` for polyfills (via `"babel-polyfill"``).
> This option will apply a new Babel plugin that replaces `require("babel-polyfill")` with the individual requires for `babel-polyfill` based on the target environments.
Install
```
npm install babel-polyfill --save
```
In
```js
import "babel-polyfill"; // create an entry js file that contains this
// or
import "core-js";
```
Out (different based on environment)
```js
// chrome 55
import "core-js/modules/es7.string.pad-start"; // haha left_pad
import "core-js/modules/es7.string.pad-end";
import "core-js/modules/web.timers";
import "core-js/modules/web.immediate";
import "core-js/modules/web.dom.iterable";
```
`.babelrc` Usage
```js
{
"presets": [
["env", {
"targets": {
"electron": 1.4
},
"modules": false, // webpack 2
"useBuiltIns": true // new option
}]
]
}
```
> Also looking to make an easier integration point via Webpack with this method. Please reach out if you have ideas!
---
* Support [Electron](http://electron.atom.io/) ([#55](https://github.com/babel/babel-preset-env/pull/55)) ([@paulcbetts](https://github.com/paulcbetts))
Electron is also an environment, so [Paul went ahead](https://twitter.com/paulcbetts/status/804507070103851008) and added support for this!
`.babelrc` Usage
```js
{
"presets": [ ["env", {"targets": { "electron": 1.4 }}]]
}
```
> Currently we are manually updating the data in [/data/electron-to-chromium.js](https://github.com/babel/babel-preset-env/blob/master/data/electron-to-chromium.js), but [@kevinsawicki](https://github.com/kevinsawicki) says we could generate the data from [atom-shell/dist/index.json](https://gh-contractor-zcbenz.s3.amazonaws.com/atom-shell/dist/index.json) as well! (Someone should make a PR :smile:)
## v0.0.9 (2016-11-24)
### :rocket: New Feature
* Support Opera ([#48](https://github.com/babel/babel-preset-env/pull/48)) (Henry Zhu)
Was as simple as modifying the chrome version and subtracting 13! (so chrome 54 = opera 41)
```js
{
"presets": [
["env", {
"targets": {
"opera": 41
}
}]
]
}
```
## v0.0.8 (2016-11-16)
### :nail_care: Polish
* Only print the debug info once ([#46](https://github.com/babel/babel-preset-env/pull/46) (Henry Zhu)
When using the `debug` option it was printing the data for each file processed rather than once.
```js
{
"presets": [
["env", {
"debug": true
}]
]
}
```
## v0.0.7 (2016-11-02)
### :rocket: New Feature
* hardcode a current node version option ([#35](https://github.com/babel/babel-preset-env/pull/35)) (Henry Zhu)
```js
{
"presets": [
["env", {
"targets": {
"node": "current" // parseFloat(process.versions.node)
}
}]
]
}
```
* add 'whitelist' option ([#31](https://github.com/babel/babel-preset-env/pull/31)) (Henry Zhu)
```js
{
"presets": [
["env", {
"targets": {
"chrome": 52
},
"whitelist": ["transform-es2015-arrow-functions"]
}]
]
}
```
* Add more aliases (Henry Zhu)
* Update plugin data: firefox 52 supports async/await! ([#29](https://github.com/babel/babel-preset-env/pull/29)) (Henry Zhu)
### :bug: Bug Fixes
* Use compat-table equals option ([#36](https://github.com/babel/babel-preset-env/pull/36)) (Henry Zhu)
Compute and use `compat-table` equivalents
```js
{
"safari6": "phantom",
"chrome44": "iojs",
"chrome50": "node64",
"chrome51": "node65",
"chrome54": "node7",
"chrome30": "android44",
"chrome37": "android50",
"chrome39": "android51",
"safari7": "ios7",
"safari71_8": "ios8",
"safari9": "ios9",
"safari10": "ios10",
"chrome50": "node6"
}
```
* Change default behavior to act the same as babel-preset-latest ([#33](https://github.com/babel/babel-preset-env/pull/33)) (Henry Zhu)
```js
{ "presets": ["env"] } // should act the same as babel-preset-latest
```
## Internal
* Add fixture helper for tests ([#28](https://github.com/babel/babel-preset-env/pull/28)) (Henry Zhu)

View File

@@ -1,572 +0,0 @@
# babel-preset-env [![npm](https://img.shields.io/npm/v/babel-preset-env.svg)](https://www.npmjs.com/package/babel-preset-env) [![travis](https://img.shields.io/travis/babel/babel-preset-env/master.svg)](https://travis-ci.org/babel/babel-preset-env) [![npm-downloads](https://img.shields.io/npm/dm/babel-preset-env.svg)](https://www.npmjs.com/package/babel-preset-env) [![codecov](https://img.shields.io/codecov/c/github/babel/babel-preset-env/master.svg?maxAge=43200)](https://codecov.io/github/babel/babel-preset-env)
> A Babel preset that compiles [ES2015+](https://github.com/tc39/proposals/blob/master/finished-proposals.md) down to ES5 by automatically determining the Babel plugins and polyfills you need based on your targeted browser or runtime environments.
```sh
npm install babel-preset-env --save-dev
```
Without any configuration options, babel-preset-env behaves exactly the same as babel-preset-latest (or babel-preset-es2015, babel-preset-es2016, and babel-preset-es2017 together).
```json
{
"presets": ["env"]
}
```
You can also configure it to only include the polyfills and transforms needed for the browsers you support. Compiling only what's needed can make your bundles smaller and your life easier.
This example only includes the polyfills and code transforms needed for the last two versions of each browser, and versions of Safari greater than or equal to 7. We use [browserslist](https://github.com/ai/browserslist) to parse this information, so you can use [any valid query format supported by browserslist](https://github.com/ai/browserslist#queries).
```json
{
"presets": [
["env", {
"targets": {
"browsers": ["last 2 versions", "safari >= 7"]
}
}]
]
}
```
Similarly, if you're targeting Node.js instead of the browser, you can configure babel-preset-env to only include the polyfills and transforms necessary for a particular version:
```json
{
"presets": [
["env", {
"targets": {
"node": "6.10"
}
}]
]
}
```
For convenience, you can use `"node": "current"` to only include the necessary polyfills and transforms for the Node.js version that you use to run Babel:
```json
{
"presets": [
["env", {
"targets": {
"node": "current"
}
}]
]
}
```
- [How it Works](#how-it-works)
- [Install](#install)
- [Usage](#usage)
- [Options](#options)
- [Examples](#examples)
- [Issues](#issues)
## How it Works
### Determine environment support for ECMAScript features
Use external data such as [`compat-table`](https://github.com/kangax/compat-table) to determine browser support. (We should create PRs there when necessary)
![](https://cloud.githubusercontent.com/assets/588473/19214029/58deebce-8d48-11e6-9004-ee3fbcb75d8b.png)
We can periodically run [build-data.js](https://github.com/babel/babel-preset-env/blob/master/scripts/build-data.js) which generates [plugins.json](https://github.com/babel/babel-preset-env/blob/master/data/plugins.json).
Ref: [#7](https://github.com/babel/babel-preset-env/issues/7)
### Maintain a mapping between JavaScript features and Babel plugins
> Currently located at [plugin-features.js](https://github.com/babel/babel-preset-env/blob/master/data/plugin-features.js).
This should be straightforward to do in most cases. There might be cases where plugins should be split up more or certain plugins aren't standalone enough (or impossible to do).
### Support all plugins in Babel that are considered `latest`
> Default behavior without options is the same as `babel-preset-latest`.
It won't include `stage-x` plugins. env will support all plugins in what we consider the latest version of JavaScript (by matching what we do in [`babel-preset-latest`](http://babeljs.io/docs/plugins/preset-latest/)).
Ref: [#14](https://github.com/babel/babel-preset-env/issues/14)
### Determine the lowest common denominator of plugins to be included in the preset
If you are targeting IE 8 and Chrome 55 it will include all plugins required by IE 8 since you would need to support both still.
### Support a target option `"node": "current"` to compile for the currently running node version.
For example, if you are building on Node 6, arrow functions won't be converted, but they will if you build on Node 0.12.
### Support a `browsers` option like autoprefixer.
Use [browserslist](https://github.com/ai/browserslist) to declare supported environments by performing queries like `> 1%, last 2 versions`.
Ref: [#19](https://github.com/babel/babel-preset-env/pull/19)
### Browserslist support.
[Browserslist](https://github.com/ai/browserslist) is a library used to share a supported list of browsers between different front-end tools like [autoprefixer](https://github.com/postcss/autoprefixer), [stylelint](https://stylelint.io/), [eslint-plugin-compat](https://github.com/amilajack/eslint-plugin-compat) and many others.
By default, babel-preset-env will use [browserslist config sources](https://github.com/ai/browserslist#queries).
For example, to enable only the polyfills and plugins needed for a project targeting *last 2 versions* and *IE10*:
**.babelrc**
```json
{
"presets": [
["env", {
"useBuiltIns": true
}]
]
}
```
**browserslist**
```
Last 2 versions
IE 10
```
or
**package.json**
```
"browserslist": "last 2 versions, ie 10"
```
Browserslist config will be ignored if: 1) `targets.browsers` was specified 2) or with `ignoreBrowserslistConfig: true` option ([see more](#ignoreBrowserslistConfig)):
#### Targets merging.
1. If [targets.browsers](#targetsbrowsers) is defined - the browserslist config will be ignored. The browsers specified in `targets` will be merged with [any other explicitly defined targets](#targets). If merged, targets defined explicitly will override the same targets received from `targets.browsers`.
2. If [targets.browsers](#targetsbrowsers) is _not_ defined - the program will search browserslist file or `package.json` with `browserslist` field. The search will start from the working directory of the process or from the path specified by the `configPath` option, and go up to the system root. If both a browserslist file and configuration inside a `package.json` are found, an exception will be thrown.
3. If a browserslist config was found and other targets are defined (but not [targets.browsers](#targetsbrowsers)), the targets will be merged in the same way as `targets` defined explicitly with `targets.browsers`.
## Install
With [npm](https://www.npmjs.com):
```sh
npm install --save-dev babel-preset-env
```
Or [yarn](https://yarnpkg.com):
```sh
yarn add babel-preset-env --dev
```
## Usage
The default behavior without options runs all transforms (behaves the same as [babel-preset-latest](https://babeljs.io/docs/plugins/preset-latest/)).
```json
{
"presets": ["env"]
}
```
## Options
For more information on setting options for a preset, refer to the [plugin/preset options](http://babeljs.io/docs/plugins/#plugin-preset-options) documentation.
### `targets`
`{ [string]: number | string }`, defaults to `{}`.
Takes an object of environment versions to support.
Each target environment takes a number or a string (we recommend using a string when specifying minor versions like `node: "6.10"`).
Example environments: `chrome`, `opera`, `edge`, `firefox`, `safari`, `ie`, `ios`, `android`, `node`, `electron`.
The [data](https://github.com/babel/babel-preset-env/blob/master/data/plugins.json) for this is generated by running the [build-data script](https://github.com/babel/babel-preset-env/blob/master/scripts/build-data.js) which pulls in data from [compat-table](https://kangax.github.io/compat-table).
### `targets.node`
`number | string | "current" | true`
If you want to compile against the current node version, you can specify `"node": true` or `"node": "current"`, which would be the same as `"node": process.versions.node`.
### `targets.browsers`
`Array<string> | string`
A query to select browsers (ex: last 2 versions, > 5%) using [browserslist](https://github.com/ai/browserslist).
Note, browsers' results are overridden by explicit items from `targets`.
### `spec`
`boolean`, defaults to `false`.
Enable more spec compliant, but potentially slower, transformations for any plugins in this preset that support them.
### `loose`
`boolean`, defaults to `false`.
Enable "loose" transformations for any plugins in this preset that allow them.
### `modules`
`"amd" | "umd" | "systemjs" | "commonjs" | false`, defaults to `"commonjs"`.
Enable transformation of ES6 module syntax to another module type.
Setting this to `false` will not transform modules.
### `debug`
`boolean`, defaults to `false`.
Outputs the targets/plugins used and the version specified in [plugin data version](https://github.com/babel/babel-preset-env/blob/master/data/plugins.json) to `console.log`.
### `include`
`Array<string>`, defaults to `[]`.
An array of plugins to always include.
Valid options include any:
- [Babel plugins](https://github.com/babel/babel-preset-env/blob/master/data/plugin-features.js) - both with (`babel-plugin-transform-es2015-spread`) and without prefix (`transform-es2015-spread`) are supported.
- [Built-ins](https://github.com/babel/babel-preset-env/blob/master/data/built-in-features.js), such as `map`, `set`, or `object.assign`.
This option is useful if there is a bug in a native implementation, or a combination of a non-supported feature + a supported one doesn't work.
For example, Node 4 supports native classes but not spread. If `super` is used with a spread argument, then the `transform-es2015-classes` transform needs to be `include`d, as it is not possible to transpile a spread with `super` otherwise.
> NOTE: The `include` and `exclude` options _only_ work with the [plugins included with this preset](https://github.com/babel/babel-preset-env/blob/master/data/plugin-features.js); so, for example, including `transform-do-expressions` or excluding `transform-function-bind` will throw errors. To use a plugin _not_ included with this preset, add them to your [config](https://babeljs.io/docs/usage/babelrc/) directly.
### `exclude`
`Array<string>`, defaults to `[]`.
An array of plugins to always exclude/remove.
The possible options are the same as the `include` option.
This option is useful for "blacklisting" a transform like `transform-regenerator` if you don't use generators and don't want to include `regeneratorRuntime` (when using `useBuiltIns`) or for using another plugin like [fast-async](https://github.com/MatAtBread/fast-async) instead of [Babel's async-to-gen](http://babeljs.io/docs/plugins/transform-async-generator-functions/).
### `useBuiltIns`
`"usage"` | `"entry"` | `false`, defaults to `false`.
A way to apply `babel-preset-env` for polyfills (via `babel-polyfill`).
```sh
npm install babel-polyfill --save
```
#### `useBuiltIns: 'usage'`
Adds specific imports for polyfills when they are used in each file. We take advantage of the fact that a bundler will load the same polyfill only once.
**In**
a.js
```js
var a = new Promise();
```
b.js
```js
var b = new Map();
```
**Out (if environment doesn't support it)**
```js
import "babel-polyfill/core-js/modules/es6.promise";
var a = new Promise();
```
```js
import "babel-polyfill/core-js/modules/es6.map";
var b = new Map();
```
**Out (if environment supports it)**
```js
var a = new Promise();
```
```js
var b = new Map();
```
#### `useBuiltIns: 'entry'`
> NOTE: Only use `require("babel-polyfill");` once in your whole app.
> Multiple imports or requires of `babel-polyfill` will throw an error since it can cause global collisions and other issues that are hard to trace.
> We recommend creating a single entry file that only contains the `require` statement.
This option enables a new plugin that replaces the statement `import "babel-polyfill"` or `require("babel-polyfill")` with individual requires for `babel-polyfill` based on environment.
**In**
```js
import "babel-polyfill";
```
**Out (different based on environment)**
```js
import "babel-polyfill/core-js/modules/es7.string.pad-start";
import "babel-polyfill/core-js/modules/es7.string.pad-end";
```
#### `useBuiltIns: false`
Don't add polyfills automatically per file, or transform `import "babel-polyfill"` to individual polyfills.
### `forceAllTransforms`
`boolean`, defaults to `false`.
<p><details>
<summary><b>Example</b></summary>
With Babel 7's .babelrc.js support, you can force all transforms to be run if env is set to `production`.
```js
module.exports = {
presets: [
["env", {
targets: {
chrome: 59,
edge: 13,
firefox: 50,
},
// for uglifyjs...
forceAllTransforms: process.env === "production"
}],
],
};
```
</details></p>
> NOTE: `targets.uglify` is deprecated and will be removed in the next major in
favor of this.
By default, this preset will run all the transforms needed for the targeted
environment(s). Enable this option if you want to force running _all_
transforms, which is useful if the output will be run through UglifyJS or an
environment that only supports ES5.
> NOTE: Uglify has a work-in-progress "Harmony" branch to address the lack of
ES6 support, but it is not yet stable. You can follow its progress in
[UglifyJS2 issue #448](https://github.com/mishoo/UglifyJS2/issues/448). If you
require an alternative minifier which _does_ support ES6 syntax, we recommend
using [babel-minify](https://github.com/babel/minify).
### `configPath`
`string`, defaults to `process.cwd()`
The starting point where the config search for browserslist will start, and ascend to the system root until found.
### `ignoreBrowserslistConfig`
`boolean`, defaults to `false`
Toggles whether or not [browserslist config sources](https://github.com/ai/browserslist#queries) are used, which includes searching for any browserslist files or referencing the browserslist key inside package.json. This is useful for projects that use a browserslist config for files that won't be compiled with Babel.
### `shippedProposals`
`boolean`, defaults to `false`
Toggles enabling support for builtin/feature proposals that have shipped in browsers. If your target environments have native support for a feature proposal, its matching parser syntax plugin is enabled instead of performing any transform. Note that this _does not_ enable the same transformations as [`babel-preset-stage3`](https://babeljs.io/docs/plugins/preset-stage-3/), since proposals can continue to change before landing in browsers.
The following are currently supported:
**Builtins**
- [Promise.prototype.finally](https://github.com/tc39/proposal-promise-finally)
**Features**
- [Asynchronous Iterators](https://github.com/tc39/proposal-async-iteration)
- [Object rest/spread properties](https://github.com/tc39/proposal-object-rest-spread)
- [Optional catch binding](https://github.com/tc39/proposal-optional-catch-binding)
- [Unicode property escapes in regular expressions](https://github.com/tc39/proposal-regexp-unicode-property-escapes)
---
## Examples
### Export with various targets
```js
export class A {}
```
#### Target only Chrome 52
**.babelrc**
```json
{
"presets": [
["env", {
"targets": {
"chrome": 52
}
}]
]
}
```
**Out**
```js
class A {}
exports.A = A;
```
#### Target Chrome 52 with webpack 2/rollup and loose mode
**.babelrc**
```json
{
"presets": [
["env", {
"targets": {
"chrome": 52
},
"modules": false,
"loose": true
}]
]
}
```
**Out**
```js
export class A {}
```
#### Target specific browsers via browserslist
**.babelrc**
```json
{
"presets": [
["env", {
"targets": {
"chrome": 52,
"browsers": ["last 2 versions", "safari 7"]
}
}]
]
}
```
**Out**
```js
export var A = function A() {
_classCallCheck(this, A);
};
```
#### Target latest node via `node: true` or `node: "current"`
**.babelrc**
```json
{
"presets": [
["env", {
"targets": {
"node": "current"
}
}]
]
}
```
**Out**
```js
class A {}
exports.A = A;
```
### Show debug output
**.babelrc**
```json
{
"presets": [
[ "env", {
"targets": {
"safari": 10
},
"modules": false,
"useBuiltIns": true,
"debug": true
}]
]
}
```
**stdout**
```sh
Using targets:
{
"safari": 10
}
Modules transform: false
Using plugins:
transform-exponentiation-operator {}
transform-async-to-generator {}
Using polyfills:
es7.object.values {}
es7.object.entries {}
es7.object.get-own-property-descriptors {}
web.timers {}
web.immediate {}
web.dom.iterable {}
```
### Include and exclude specific plugins/built-ins
> always include arrow functions, explicitly exclude generators
```json
{
"presets": [
["env", {
"targets": {
"browsers": ["last 2 versions", "safari >= 7"]
},
"include": ["transform-es2015-arrow-functions", "es6.map"],
"exclude": ["transform-regenerator", "es6.set"]
}]
]
}
```
## Issues
If you get a `SyntaxError: Unexpected token ...` error when using the [object-rest-spread](https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-object-rest-spread) transform then make sure the plugin has been updated to, at least, `v6.19.0`.

View File

@@ -1,194 +0,0 @@
const typedArrayMethods = [
"typed arrays / %TypedArray%.from",
"typed arrays / %TypedArray%.of",
"typed arrays / %TypedArray%.prototype.subarray",
"typed arrays / %TypedArray%.prototype.join",
"typed arrays / %TypedArray%.prototype.indexOf",
"typed arrays / %TypedArray%.prototype.lastIndexOf",
"typed arrays / %TypedArray%.prototype.slice",
"typed arrays / %TypedArray%.prototype.every",
"typed arrays / %TypedArray%.prototype.filter",
"typed arrays / %TypedArray%.prototype.forEach",
"typed arrays / %TypedArray%.prototype.map",
"typed arrays / %TypedArray%.prototype.reduce",
"typed arrays / %TypedArray%.prototype.reduceRight",
"typed arrays / %TypedArray%.prototype.reverse",
"typed arrays / %TypedArray%.prototype.some",
"typed arrays / %TypedArray%.prototype.sort",
"typed arrays / %TypedArray%.prototype.copyWithin",
"typed arrays / %TypedArray%.prototype.find",
"typed arrays / %TypedArray%.prototype.findIndex",
"typed arrays / %TypedArray%.prototype.fill",
"typed arrays / %TypedArray%.prototype.keys",
"typed arrays / %TypedArray%.prototype.values",
"typed arrays / %TypedArray%.prototype.entries",
"typed arrays / %TypedArray%.prototype[Symbol.iterator]",
"typed arrays / %TypedArray%[Symbol.species]",
];
const es2015 = {
"es6.typed.array-buffer": "typed arrays / ArrayBuffer[Symbol.species]",
"es6.typed.data-view": "typed arrays / DataView",
"es6.typed.int8-array": {
features: ["typed arrays / Int8Array"].concat(typedArrayMethods)
},
"es6.typed.uint8-array": {
features: ["typed arrays / Uint8Array"].concat(typedArrayMethods)
},
"es6.typed.uint8-clamped-array": {
features: ["typed arrays / Uint8ClampedArray"].concat(typedArrayMethods)
},
"es6.typed.int16-array": {
features: ["typed arrays / Int16Array"].concat(typedArrayMethods)
},
"es6.typed.uint16-array": {
features: ["typed arrays / Uint16Array"].concat(typedArrayMethods)
},
"es6.typed.int32-array": {
features: ["typed arrays / Int32Array"].concat(typedArrayMethods)
},
"es6.typed.uint32-array": {
features: ["typed arrays / Uint32Array"].concat(typedArrayMethods)
},
"es6.typed.float32-array": {
features: ["typed arrays / Float32Array"].concat(typedArrayMethods)
},
"es6.typed.float64-array": {
features: ["typed arrays / Float64Array"].concat(typedArrayMethods)
},
"es6.map": "Map",
"es6.set": "Set",
"es6.weak-map": "WeakMap",
"es6.weak-set": "WeakSet",
// Proxy not implementable
"es6.reflect.apply": "Reflect / Reflect.apply",
"es6.reflect.construct": "Reflect / Reflect.construct",
"es6.reflect.define-property": "Reflect / Reflect.defineProperty",
"es6.reflect.delete-property": "Reflect / Reflect.deleteProperty",
"es6.reflect.get": "Reflect / Reflect.get",
"es6.reflect.get-own-property-descriptor": "Reflect / Reflect.getOwnPropertyDescriptor",
"es6.reflect.get-prototype-of": "Reflect / Reflect.getPrototypeOf",
"es6.reflect.has": "Reflect / Reflect.has",
"es6.reflect.is-extensible": "Reflect / Reflect.isExtensible",
"es6.reflect.own-keys": "Reflect / Reflect.ownKeys",
"es6.reflect.prevent-extensions": "Reflect / Reflect.preventExtensions",
"es6.reflect.set": "Reflect / Reflect.set",
"es6.reflect.set-prototype-of": "Reflect / Reflect.setPrototypeOf",
"es6.promise": {
features: [
"Promise / basic functionality",
"Promise / constructor requires new",
"Promise / Promise.prototype isn\'t an instance",
"Promise / Promise.all",
"Promise / Promise.all, generic iterables",
"Promise / Promise.race",
"Promise / Promise.race, generic iterables",
"Promise / Promise[Symbol.species]"
]
},
"es6.symbol": {
features: [
"Symbol",
"Object static methods / Object.getOwnPropertySymbols",
"well-known symbols / Symbol.hasInstance",
"well-known symbols / Symbol.isConcatSpreadable",
"well-known symbols / Symbol.iterator",
"well-known symbols / Symbol.match",
"well-known symbols / Symbol.replace",
"well-known symbols / Symbol.search",
"well-known symbols / Symbol.species",
"well-known symbols / Symbol.split",
"well-known symbols / Symbol.toPrimitive",
"well-known symbols / Symbol.toStringTag",
"well-known symbols / Symbol.unscopables",
]
},
"es6.object.assign": "Object static methods / Object.assign",
"es6.object.is": "Object static methods / Object.is",
"es6.object.set-prototype-of": "Object static methods / Object.setPrototypeOf",
"es6.function.name": "function \"name\" property",
"es6.string.raw": "String static methods / String.raw",
"es6.string.from-code-point": "String static methods / String.fromCodePoint",
"es6.string.code-point-at": "String.prototype methods / String.prototype.codePointAt",
// "String.prototype methods / String.prototype.normalize" not implemented
"es6.string.repeat": "String.prototype methods / String.prototype.repeat",
"es6.string.starts-with": "String.prototype methods / String.prototype.startsWith",
"es6.string.ends-with": "String.prototype methods / String.prototype.endsWith",
"es6.string.includes": "String.prototype methods / String.prototype.includes",
"es6.regexp.flags": "RegExp.prototype properties / RegExp.prototype.flags",
"es6.regexp.match": "RegExp.prototype properties / RegExp.prototype[Symbol.match]",
"es6.regexp.replace": "RegExp.prototype properties / RegExp.prototype[Symbol.replace]",
"es6.regexp.split": "RegExp.prototype properties / RegExp.prototype[Symbol.split]",
"es6.regexp.search": "RegExp.prototype properties / RegExp.prototype[Symbol.search]",
"es6.array.from": "Array static methods / Array.from",
"es6.array.of": "Array static methods / Array.of",
"es6.array.copy-within": "Array.prototype methods / Array.prototype.copyWithin",
"es6.array.find": "Array.prototype methods / Array.prototype.find",
"es6.array.find-index": "Array.prototype methods / Array.prototype.findIndex",
"es6.array.fill": "Array.prototype methods / Array.prototype.fill",
"es6.array.iterator": {
features: [
"Array.prototype methods / Array.prototype.keys",
// can use Symbol.iterator, not implemented in many environments
// "Array.prototype methods / Array.prototype.values",
"Array.prototype methods / Array.prototype.entries",
]
},
"es6.number.is-finite": "Number properties / Number.isFinite",
"es6.number.is-integer": "Number properties / Number.isInteger",
"es6.number.is-safe-integer": "Number properties / Number.isSafeInteger",
"es6.number.is-nan": "Number properties / Number.isNaN",
"es6.number.epsilon": "Number properties / Number.EPSILON",
"es6.number.min-safe-integer": "Number properties / Number.MIN_SAFE_INTEGER",
"es6.number.max-safe-integer": "Number properties / Number.MAX_SAFE_INTEGER",
"es6.number.parse-float": "Number properties / Number.parseFloat",
"es6.number.parse-int": "Number properties / Number.parseInt",
"es6.math.acosh": "Math methods / Math.acosh",
"es6.math.asinh": "Math methods / Math.asinh",
"es6.math.atanh": "Math methods / Math.atanh",
"es6.math.cbrt": "Math methods / Math.cbrt",
"es6.math.clz32": "Math methods / Math.clz32",
"es6.math.cosh": "Math methods / Math.cosh",
"es6.math.expm1": "Math methods / Math.expm1",
"es6.math.fround": "Math methods / Math.fround",
"es6.math.hypot": "Math methods / Math.hypot",
"es6.math.imul": "Math methods / Math.imul",
"es6.math.log1p": "Math methods / Math.log1p",
"es6.math.log10": "Math methods / Math.log10",
"es6.math.log2": "Math methods / Math.log2",
"es6.math.sign": "Math methods / Math.sign",
"es6.math.sinh": "Math methods / Math.sinh",
"es6.math.tanh": "Math methods / Math.tanh",
"es6.math.trunc": "Math methods / Math.trunc",
};
const es2016 = {
"es7.array.includes": "Array.prototype.includes",
};
const es2017 = {
"es7.object.values": "Object static methods / Object.values",
"es7.object.entries": "Object static methods / Object.entries",
"es7.object.get-own-property-descriptors": "Object static methods / Object.getOwnPropertyDescriptors",
"es7.string.pad-start": "String padding / String.prototype.padStart",
"es7.string.pad-end": "String padding / String.prototype.padEnd",
};
const proposals = require("./shipped-proposals").builtIns;
module.exports = Object.assign({}, es2015, es2016, es2017, proposals);

View File

@@ -1,853 +0,0 @@
{
"es6.typed.array-buffer": {
"chrome": "51",
"edge": "13",
"firefox": "48",
"safari": "10",
"node": "6.5",
"ios": "10",
"opera": "38",
"electron": "1.2"
},
"es6.typed.data-view": {
"chrome": "5",
"opera": "12",
"edge": "12",
"firefox": "15",
"safari": "5.1",
"node": "0.12",
"ie": "10",
"android": "4",
"ios": "6",
"electron": "1.1"
},
"es6.typed.int8-array": {
"chrome": "51",
"edge": "13",
"firefox": "48",
"safari": "10",
"node": "6.5",
"ios": "10",
"opera": "38",
"electron": "1.2"
},
"es6.typed.uint8-array": {
"chrome": "51",
"edge": "13",
"firefox": "48",
"safari": "10",
"node": "6.5",
"ios": "10",
"opera": "38",
"electron": "1.2"
},
"es6.typed.uint8-clamped-array": {
"chrome": "51",
"edge": "13",
"firefox": "48",
"safari": "10",
"node": "6.5",
"ios": "10",
"opera": "38",
"electron": "1.2"
},
"es6.typed.int16-array": {
"chrome": "51",
"edge": "13",
"firefox": "48",
"safari": "10",
"node": "6.5",
"ios": "10",
"opera": "38",
"electron": "1.2"
},
"es6.typed.uint16-array": {
"chrome": "51",
"edge": "13",
"firefox": "48",
"safari": "10",
"node": "6.5",
"ios": "10",
"opera": "38",
"electron": "1.2"
},
"es6.typed.int32-array": {
"chrome": "51",
"edge": "13",
"firefox": "48",
"safari": "10",
"node": "6.5",
"ios": "10",
"opera": "38",
"electron": "1.2"
},
"es6.typed.uint32-array": {
"chrome": "51",
"edge": "13",
"firefox": "48",
"safari": "10",
"node": "6.5",
"ios": "10",
"opera": "38",
"electron": "1.2"
},
"es6.typed.float32-array": {
"chrome": "51",
"edge": "13",
"firefox": "48",
"safari": "10",
"node": "6.5",
"ios": "10",
"opera": "38",
"electron": "1.2"
},
"es6.typed.float64-array": {
"chrome": "51",
"edge": "13",
"firefox": "48",
"safari": "10",
"node": "6.5",
"ios": "10",
"opera": "38",
"electron": "1.2"
},
"es6.map": {
"chrome": "51",
"edge": "15",
"firefox": "53",
"safari": "10",
"node": "6.5",
"ios": "10",
"opera": "38",
"electron": "1.2"
},
"es6.set": {
"chrome": "51",
"edge": "15",
"firefox": "53",
"safari": "10",
"node": "6.5",
"ios": "10",
"opera": "38",
"electron": "1.2"
},
"es6.weak-map": {
"chrome": "51",
"edge": "15",
"firefox": "53",
"safari": "9",
"node": "6.5",
"ios": "9",
"opera": "38",
"electron": "1.2"
},
"es6.weak-set": {
"chrome": "51",
"edge": "15",
"firefox": "53",
"safari": "9",
"node": "6.5",
"ios": "9",
"opera": "38",
"electron": "1.2"
},
"es6.reflect.apply": {
"chrome": "49",
"edge": "12",
"firefox": "42",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "36",
"electron": "1"
},
"es6.reflect.construct": {
"chrome": "49",
"edge": "13",
"firefox": "44",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "36",
"electron": "1"
},
"es6.reflect.define-property": {
"chrome": "49",
"edge": "13",
"firefox": "42",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "36",
"electron": "1"
},
"es6.reflect.delete-property": {
"chrome": "49",
"edge": "12",
"firefox": "42",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "36",
"electron": "1"
},
"es6.reflect.get": {
"chrome": "49",
"edge": "12",
"firefox": "42",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "36",
"electron": "1"
},
"es6.reflect.get-own-property-descriptor": {
"chrome": "49",
"edge": "12",
"firefox": "42",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "36",
"electron": "1"
},
"es6.reflect.get-prototype-of": {
"chrome": "49",
"edge": "12",
"firefox": "42",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "36",
"electron": "1"
},
"es6.reflect.has": {
"chrome": "49",
"edge": "12",
"firefox": "42",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "36",
"electron": "1"
},
"es6.reflect.is-extensible": {
"chrome": "49",
"edge": "12",
"firefox": "42",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "36",
"electron": "1"
},
"es6.reflect.own-keys": {
"chrome": "49",
"edge": "12",
"firefox": "42",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "36",
"electron": "1"
},
"es6.reflect.prevent-extensions": {
"chrome": "49",
"edge": "12",
"firefox": "42",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "36",
"electron": "1"
},
"es6.reflect.set": {
"chrome": "49",
"edge": "12",
"firefox": "42",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "36",
"electron": "1"
},
"es6.reflect.set-prototype-of": {
"chrome": "49",
"edge": "12",
"firefox": "42",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "36",
"electron": "1"
},
"es6.promise": {
"chrome": "51",
"edge": "13",
"firefox": "45",
"safari": "10",
"node": "6.5",
"ios": "10",
"opera": "38",
"electron": "1.2"
},
"es6.symbol": {
"chrome": "51",
"firefox": "51",
"safari": "10",
"node": "6.5",
"ios": "10",
"opera": "38",
"electron": "1.2"
},
"es6.object.assign": {
"chrome": "45",
"edge": "12",
"firefox": "34",
"safari": "9",
"node": "4",
"ios": "9",
"opera": "32",
"electron": "0.35"
},
"es6.object.is": {
"chrome": "19",
"edge": "12",
"firefox": "22",
"safari": "9",
"node": "0.12",
"android": "4.1",
"ios": "9",
"electron": "0.2"
},
"es6.object.set-prototype-of": {
"chrome": "34",
"edge": "12",
"firefox": "31",
"safari": "9",
"node": "0.12",
"ie": "11",
"ios": "9",
"opera": "21",
"electron": "0.2"
},
"es6.function.name": {
"chrome": "51",
"firefox": "53",
"safari": "10",
"node": "6.5",
"ios": "10",
"opera": "38",
"electron": "1.2"
},
"es6.string.raw": {
"chrome": "41",
"edge": "12",
"firefox": "34",
"safari": "9",
"node": "4",
"ios": "9",
"opera": "28",
"electron": "0.24"
},
"es6.string.from-code-point": {
"chrome": "41",
"edge": "12",
"firefox": "29",
"safari": "9",
"node": "4",
"ios": "9",
"opera": "28",
"electron": "0.24"
},
"es6.string.code-point-at": {
"chrome": "41",
"edge": "12",
"firefox": "29",
"safari": "9",
"node": "4",
"ios": "9",
"opera": "28",
"electron": "0.24"
},
"es6.string.repeat": {
"chrome": "41",
"edge": "12",
"firefox": "24",
"safari": "9",
"node": "4",
"ios": "9",
"opera": "28",
"electron": "0.24"
},
"es6.string.starts-with": {
"chrome": "41",
"edge": "12",
"firefox": "29",
"safari": "9",
"node": "4",
"ios": "9",
"opera": "28",
"electron": "0.24"
},
"es6.string.ends-with": {
"chrome": "41",
"edge": "12",
"firefox": "29",
"safari": "9",
"node": "4",
"ios": "9",
"opera": "28",
"electron": "0.24"
},
"es6.string.includes": {
"chrome": "41",
"edge": "12",
"firefox": "40",
"safari": "9",
"node": "4",
"ios": "9",
"opera": "28",
"electron": "0.24"
},
"es6.regexp.flags": {
"chrome": "49",
"firefox": "37",
"safari": "9",
"node": "6",
"ios": "9",
"opera": "36",
"electron": "1"
},
"es6.regexp.match": {
"chrome": "50",
"firefox": "49",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "37",
"electron": "1.1"
},
"es6.regexp.replace": {
"chrome": "50",
"firefox": "49",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "37",
"electron": "1.1"
},
"es6.regexp.split": {
"chrome": "50",
"firefox": "49",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "37",
"electron": "1.1"
},
"es6.regexp.search": {
"chrome": "50",
"firefox": "49",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "37",
"electron": "1.1"
},
"es6.array.from": {
"chrome": "51",
"edge": "15",
"firefox": "36",
"safari": "10",
"node": "6.5",
"ios": "10",
"opera": "38",
"electron": "1.2"
},
"es6.array.of": {
"chrome": "45",
"edge": "12",
"firefox": "25",
"safari": "9",
"node": "4",
"ios": "9",
"opera": "32",
"electron": "0.35"
},
"es6.array.copy-within": {
"chrome": "45",
"edge": "12",
"firefox": "32",
"safari": "9",
"node": "4",
"ios": "9",
"opera": "32",
"electron": "0.35"
},
"es6.array.find": {
"chrome": "45",
"edge": "12",
"firefox": "25",
"safari": "7.1",
"node": "4",
"ios": "8",
"opera": "32",
"electron": "0.35"
},
"es6.array.find-index": {
"chrome": "45",
"edge": "12",
"firefox": "25",
"safari": "7.1",
"node": "4",
"ios": "8",
"opera": "32",
"electron": "0.35"
},
"es6.array.fill": {
"chrome": "45",
"edge": "12",
"firefox": "31",
"safari": "7.1",
"node": "4",
"ios": "8",
"opera": "32",
"electron": "0.35"
},
"es6.array.iterator": {
"chrome": "38",
"edge": "12",
"firefox": "28",
"safari": "7.1",
"node": "0.12",
"ios": "8",
"opera": "25",
"electron": "0.2"
},
"es6.number.is-finite": {
"chrome": "19",
"edge": "12",
"firefox": "16",
"safari": "9",
"node": "0.12",
"android": "4.1",
"ios": "9",
"electron": "0.2"
},
"es6.number.is-integer": {
"chrome": "34",
"edge": "12",
"firefox": "16",
"safari": "9",
"node": "0.12",
"ios": "9",
"opera": "21",
"electron": "0.2"
},
"es6.number.is-safe-integer": {
"chrome": "34",
"edge": "12",
"firefox": "32",
"safari": "9",
"node": "0.12",
"ios": "9",
"opera": "21",
"electron": "0.2"
},
"es6.number.is-nan": {
"chrome": "19",
"edge": "12",
"firefox": "15",
"safari": "9",
"node": "0.12",
"android": "4.1",
"ios": "9",
"electron": "0.2"
},
"es6.number.epsilon": {
"chrome": "34",
"edge": "12",
"firefox": "25",
"safari": "9",
"node": "0.12",
"ios": "9",
"opera": "21",
"electron": "0.2"
},
"es6.number.min-safe-integer": {
"chrome": "34",
"edge": "12",
"firefox": "31",
"safari": "9",
"node": "0.12",
"ios": "9",
"opera": "21",
"electron": "0.2"
},
"es6.number.max-safe-integer": {
"chrome": "34",
"edge": "12",
"firefox": "31",
"safari": "9",
"node": "0.12",
"ios": "9",
"opera": "21",
"electron": "0.2"
},
"es6.number.parse-float": {
"chrome": "34",
"edge": "12",
"firefox": "25",
"safari": "9",
"node": "0.12",
"ios": "9",
"opera": "21",
"electron": "0.2"
},
"es6.number.parse-int": {
"chrome": "34",
"edge": "12",
"firefox": "25",
"safari": "9",
"node": "0.12",
"ios": "9",
"opera": "21",
"electron": "0.2"
},
"es6.math.acosh": {
"chrome": "38",
"edge": "12",
"firefox": "25",
"safari": "7.1",
"node": "0.12",
"ios": "8",
"opera": "25",
"electron": "0.2"
},
"es6.math.asinh": {
"chrome": "38",
"edge": "12",
"firefox": "25",
"safari": "7.1",
"node": "0.12",
"ios": "8",
"opera": "25",
"electron": "0.2"
},
"es6.math.atanh": {
"chrome": "38",
"edge": "12",
"firefox": "25",
"safari": "7.1",
"node": "0.12",
"ios": "8",
"opera": "25",
"electron": "0.2"
},
"es6.math.cbrt": {
"chrome": "38",
"edge": "12",
"firefox": "25",
"safari": "7.1",
"node": "0.12",
"ios": "8",
"opera": "25",
"electron": "0.2"
},
"es6.math.clz32": {
"chrome": "38",
"edge": "12",
"firefox": "31",
"safari": "9",
"node": "0.12",
"ios": "9",
"opera": "25",
"electron": "0.2"
},
"es6.math.cosh": {
"chrome": "38",
"edge": "12",
"firefox": "25",
"safari": "7.1",
"node": "0.12",
"ios": "8",
"opera": "25",
"electron": "0.2"
},
"es6.math.expm1": {
"chrome": "38",
"edge": "12",
"firefox": "25",
"safari": "7.1",
"node": "0.12",
"ios": "8",
"opera": "25",
"electron": "0.2"
},
"es6.math.fround": {
"chrome": "38",
"edge": "12",
"firefox": "26",
"safari": "7.1",
"node": "0.12",
"ios": "8",
"opera": "25",
"electron": "0.2"
},
"es6.math.hypot": {
"chrome": "38",
"edge": "12",
"firefox": "27",
"safari": "7.1",
"node": "0.12",
"ios": "8",
"opera": "25",
"electron": "0.2"
},
"es6.math.imul": {
"chrome": "30",
"edge": "12",
"firefox": "23",
"safari": "7",
"node": "0.12",
"android": "4.4",
"ios": "7",
"opera": "17",
"electron": "0.2"
},
"es6.math.log1p": {
"chrome": "38",
"edge": "12",
"firefox": "25",
"safari": "7.1",
"node": "0.12",
"ios": "8",
"opera": "25",
"electron": "0.2"
},
"es6.math.log10": {
"chrome": "38",
"edge": "12",
"firefox": "25",
"safari": "7.1",
"node": "0.12",
"ios": "8",
"opera": "25",
"electron": "0.2"
},
"es6.math.log2": {
"chrome": "38",
"edge": "12",
"firefox": "25",
"safari": "7.1",
"node": "0.12",
"ios": "8",
"opera": "25",
"electron": "0.2"
},
"es6.math.sign": {
"chrome": "38",
"edge": "12",
"firefox": "25",
"safari": "9",
"node": "0.12",
"ios": "9",
"opera": "25",
"electron": "0.2"
},
"es6.math.sinh": {
"chrome": "38",
"edge": "12",
"firefox": "25",
"safari": "7.1",
"node": "0.12",
"ios": "8",
"opera": "25",
"electron": "0.2"
},
"es6.math.tanh": {
"chrome": "38",
"edge": "12",
"firefox": "25",
"safari": "7.1",
"node": "0.12",
"ios": "8",
"opera": "25",
"electron": "0.2"
},
"es6.math.trunc": {
"chrome": "38",
"edge": "12",
"firefox": "25",
"safari": "7.1",
"node": "0.12",
"ios": "8",
"opera": "25",
"electron": "0.2"
},
"es7.array.includes": {
"chrome": "47",
"edge": "14",
"firefox": "43",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "34",
"electron": "0.36"
},
"es7.object.values": {
"chrome": "54",
"edge": "14",
"firefox": "47",
"safari": "10.1",
"node": "7",
"ios": "10.3",
"opera": "41",
"electron": "1.5"
},
"es7.object.entries": {
"chrome": "54",
"edge": "14",
"firefox": "47",
"safari": "10.1",
"node": "7",
"ios": "10.3",
"opera": "41",
"electron": "1.5"
},
"es7.object.get-own-property-descriptors": {
"chrome": "54",
"edge": "15",
"firefox": "50",
"safari": "10.1",
"node": "7",
"ios": "10.3",
"opera": "41",
"electron": "1.5"
},
"es7.string.pad-start": {
"chrome": "57",
"edge": "15",
"firefox": "48",
"safari": "10",
"node": "8",
"ios": "10",
"opera": "44",
"electron": "1.7"
},
"es7.string.pad-end": {
"chrome": "57",
"edge": "15",
"firefox": "48",
"safari": "10",
"node": "8",
"ios": "10",
"opera": "44",
"electron": "1.7"
},
"es7.promise.finally": {
"chrome": "63",
"opera": "50"
}
}

View File

@@ -1,140 +0,0 @@
const es2015 = {
"check-es2015-constants": {
features: [
"const",
],
},
"transform-es2015-arrow-functions": {
features: [
"arrow functions",
],
},
"transform-es2015-block-scoped-functions": {
features: [
"block-level function declaration"
],
},
"transform-es2015-block-scoping": {
features: [
"const",
"let",
],
},
"transform-es2015-classes": {
features: [
"class",
"super",
],
},
"transform-es2015-computed-properties": {
features: [
"object literal extensions / computed properties",
],
},
"transform-es2015-destructuring": {
features: [
"destructuring, assignment",
"destructuring, declarations",
"destructuring, parameters",
],
},
"transform-es2015-duplicate-keys": {
features: [
"miscellaneous / duplicate property names in strict mode",
],
},
"transform-es2015-for-of": {
features: [
"for..of loops",
],
},
"transform-es2015-function-name": {
features: [
"function \"name\" property",
]
},
"transform-es2015-literals": {
features: [
"Unicode code point escapes",
],
},
"transform-es2015-object-super": {
features: [
"super",
],
},
"transform-es2015-parameters": {
features: [
"default function parameters",
"rest parameters",
],
},
"transform-es2015-shorthand-properties": {
features: [
"object literal extensions / shorthand properties",
],
},
"transform-es2015-spread": {
features: [
"spread (...) operator",
],
},
"transform-es2015-sticky-regex": {
features: [
"RegExp \"y\" and \"u\" flags / \"y\" flag, lastIndex",
"RegExp \"y\" and \"u\" flags / \"y\" flag",
],
},
"transform-es2015-template-literals": {
features: [
"template literals",
],
},
"transform-es2015-typeof-symbol": {
features: [
"Symbol / typeof support"
],
},
"transform-es2015-unicode-regex": {
features: [
"RegExp \"y\" and \"u\" flags / \"u\" flag, case folding",
"RegExp \"y\" and \"u\" flags / \"u\" flag, Unicode code point escapes",
"RegExp \"y\" and \"u\" flags / \"u\" flag",
],
},
"transform-new-target": {
features: [
"new.target",
],
},
"transform-regenerator": {
features: [
"generators",
],
}
};
const es2016 = {
"transform-exponentiation-operator": {
features: [
"exponentiation (**) operator",
],
}
};
const es2017 = {
"transform-async-to-generator": {
features: [
"async functions",
],
},
"syntax-trailing-function-commas": {
features: [
"trailing commas in function syntax",
],
}
};
const proposals = require("./shipped-proposals").features;
module.exports = Object.assign({}, es2015, es2016, es2017, proposals);

View File

@@ -1,253 +0,0 @@
{
"check-es2015-constants": {
"chrome": "49",
"edge": "14",
"firefox": "51",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "36",
"electron": "1"
},
"transform-es2015-arrow-functions": {
"chrome": "47",
"edge": "13",
"firefox": "45",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "34",
"electron": "0.36"
},
"transform-es2015-block-scoped-functions": {
"chrome": "41",
"edge": "12",
"firefox": "46",
"safari": "10",
"node": "4",
"ie": "11",
"ios": "10",
"opera": "28",
"electron": "0.24"
},
"transform-es2015-block-scoping": {
"chrome": "49",
"edge": "14",
"firefox": "51",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "36",
"electron": "1"
},
"transform-es2015-classes": {
"chrome": "46",
"edge": "13",
"firefox": "45",
"safari": "10",
"node": "5",
"ios": "10",
"opera": "33",
"electron": "0.36"
},
"transform-es2015-computed-properties": {
"chrome": "44",
"edge": "12",
"firefox": "34",
"safari": "7.1",
"node": "4",
"ios": "8",
"opera": "31",
"electron": "0.31"
},
"transform-es2015-destructuring": {
"chrome": "51",
"firefox": "53",
"safari": "10",
"node": "6.5",
"ios": "10",
"opera": "38",
"electron": "1.2"
},
"transform-es2015-duplicate-keys": {
"chrome": "42",
"edge": "12",
"firefox": "34",
"safari": "9",
"node": "4",
"ios": "9",
"opera": "29",
"electron": "0.27"
},
"transform-es2015-for-of": {
"chrome": "51",
"edge": "15",
"firefox": "53",
"safari": "10",
"node": "6.5",
"ios": "10",
"opera": "38",
"electron": "1.2"
},
"transform-es2015-function-name": {
"chrome": "51",
"firefox": "53",
"safari": "10",
"node": "6.5",
"ios": "10",
"opera": "38",
"electron": "1.2"
},
"transform-es2015-literals": {
"chrome": "44",
"edge": "12",
"firefox": "53",
"safari": "9",
"node": "4",
"ios": "9",
"opera": "31",
"electron": "0.31"
},
"transform-es2015-object-super": {
"chrome": "46",
"edge": "13",
"firefox": "45",
"safari": "10",
"node": "5",
"ios": "10",
"opera": "33",
"electron": "0.36"
},
"transform-es2015-parameters": {
"chrome": "49",
"edge": "14",
"firefox": "53",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "36",
"electron": "1"
},
"transform-es2015-shorthand-properties": {
"chrome": "43",
"edge": "12",
"firefox": "33",
"safari": "9",
"node": "4",
"ios": "9",
"opera": "30",
"electron": "0.29"
},
"transform-es2015-spread": {
"chrome": "46",
"edge": "13",
"firefox": "36",
"safari": "10",
"node": "5",
"ios": "10",
"opera": "33",
"electron": "0.36"
},
"transform-es2015-sticky-regex": {
"chrome": "49",
"edge": "13",
"firefox": "3",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "36",
"electron": "1"
},
"transform-es2015-template-literals": {
"chrome": "41",
"edge": "13",
"firefox": "34",
"safari": "9",
"node": "4",
"ios": "9",
"opera": "28",
"electron": "0.24"
},
"transform-es2015-typeof-symbol": {
"chrome": "38",
"edge": "12",
"firefox": "36",
"safari": "9",
"node": "0.12",
"ios": "9",
"opera": "25",
"electron": "0.2"
},
"transform-es2015-unicode-regex": {
"chrome": "50",
"edge": "13",
"firefox": "46",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "37",
"electron": "1.1"
},
"transform-new-target": {
"chrome": "46",
"edge": "14",
"firefox": "41",
"safari": "10",
"node": "5",
"ios": "10",
"opera": "33",
"electron": "0.36"
},
"transform-regenerator": {
"chrome": "50",
"edge": "13",
"firefox": "53",
"safari": "10",
"node": "6",
"ios": "10",
"opera": "37",
"electron": "1.1"
},
"transform-exponentiation-operator": {
"chrome": "52",
"edge": "14",
"firefox": "52",
"safari": "10.1",
"node": "7",
"ios": "10.3",
"opera": "39",
"electron": "1.3"
},
"transform-async-to-generator": {
"chrome": "55",
"edge": "15",
"firefox": "52",
"safari": "10.1",
"node": "7.6",
"ios": "10.3",
"opera": "42",
"electron": "1.6"
},
"syntax-trailing-function-commas": {
"chrome": "58",
"edge": "14",
"firefox": "52",
"safari": "10",
"node": "8",
"ios": "10",
"opera": "45",
"electron": "1.7"
},
"transform-async-generator-functions": {
"chrome": "63",
"opera": "50"
},
"transform-object-rest-spread": {
"chrome": "60",
"firefox": "55",
"node": "8.3",
"opera": "47"
},
"transform-optional-catch-binding": {},
"transform-unicode-property-regex": {}
}

View File

@@ -1,22 +0,0 @@
// These mappings represent the builtin/feature proposals that have been
// shipped by browsers, and are enabled by the `shippedProposals` option.
const builtIns = {
"es7.promise.finally": "Promise.prototype.finally"
};
const features = {
"transform-async-generator-functions": "Asynchronous Iterators",
"transform-object-rest-spread": "object rest/spread properties",
"transform-optional-catch-binding": "optional catch binding",
"transform-unicode-property-regex": "RegExp Unicode Property Escapes",
};
const pluginSyntaxMap = new Map([
["transform-async-generator-functions", "syntax-async-generators"],
["transform-object-rest-spread", "syntax-object-rest-spread"],
["transform-optional-catch-binding", "syntax-optional-catch-binding"],
["transform-unicode-property-regex", null],
]);
module.exports = { builtIns, features, pluginSyntaxMap };

View File

@@ -1,59 +0,0 @@
{
"name": "babel-preset-env",
"version": "7.0.0-beta.3",
"description": "A Babel preset for each environment.",
"author": "Henry Zhu <hi@henryzoo.com>",
"homepage": "https://babeljs.io/",
"license": "MIT",
"repository": "https://github.com/babel/babel/tree/master/experimental/babel-preset-env",
"main": "lib/index.js",
"scripts": {
"build-data": "node ./scripts/build-data.js"
},
"dependencies": {
"babel-plugin-check-es2015-constants": "7.0.0-beta.3",
"babel-plugin-syntax-async-generators": "7.0.0-beta.3",
"babel-plugin-syntax-object-rest-spread": "7.0.0-beta.3",
"babel-plugin-syntax-optional-catch-binding": "7.0.0-beta.3",
"babel-plugin-syntax-trailing-function-commas": "7.0.0-beta.0",
"babel-plugin-transform-async-generator-functions": "7.0.0-beta.3",
"babel-plugin-transform-async-to-generator": "7.0.0-beta.3",
"babel-plugin-transform-es2015-arrow-functions": "7.0.0-beta.3",
"babel-plugin-transform-es2015-block-scoped-functions": "7.0.0-beta.3",
"babel-plugin-transform-es2015-block-scoping": "7.0.0-beta.3",
"babel-plugin-transform-es2015-classes": "7.0.0-beta.3",
"babel-plugin-transform-es2015-computed-properties": "7.0.0-beta.3",
"babel-plugin-transform-es2015-destructuring": "7.0.0-beta.3",
"babel-plugin-transform-es2015-duplicate-keys": "7.0.0-beta.3",
"babel-plugin-transform-es2015-for-of": "7.0.0-beta.3",
"babel-plugin-transform-es2015-function-name": "7.0.0-beta.3",
"babel-plugin-transform-es2015-literals": "7.0.0-beta.3",
"babel-plugin-transform-es2015-modules-amd": "7.0.0-beta.3",
"babel-plugin-transform-es2015-modules-commonjs": "7.0.0-beta.3",
"babel-plugin-transform-es2015-modules-systemjs": "7.0.0-beta.3",
"babel-plugin-transform-es2015-modules-umd": "7.0.0-beta.3",
"babel-plugin-transform-es2015-object-super": "7.0.0-beta.3",
"babel-plugin-transform-es2015-parameters": "7.0.0-beta.3",
"babel-plugin-transform-es2015-shorthand-properties": "7.0.0-beta.3",
"babel-plugin-transform-es2015-spread": "7.0.0-beta.3",
"babel-plugin-transform-es2015-sticky-regex": "7.0.0-beta.3",
"babel-plugin-transform-es2015-template-literals": "7.0.0-beta.3",
"babel-plugin-transform-es2015-typeof-symbol": "7.0.0-beta.3",
"babel-plugin-transform-es2015-unicode-regex": "7.0.0-beta.3",
"babel-plugin-transform-exponentiation-operator": "7.0.0-beta.3",
"babel-plugin-transform-new-target": "7.0.0-beta.3",
"babel-plugin-transform-object-rest-spread": "7.0.0-beta.3",
"babel-plugin-transform-optional-catch-binding": "7.0.0-beta.3",
"babel-plugin-transform-regenerator": "7.0.0-beta.3",
"babel-plugin-transform-unicode-property-regex": "^2.0.5",
"browserslist": "^2.4.0",
"invariant": "^2.2.2",
"semver": "^5.3.0"
},
"devDependencies": {
"babel-cli": "7.0.0-beta.3",
"babel-helper-fixtures": "7.0.0-beta.3",
"babel-helper-plugin-test-runner": "7.0.0-beta.3",
"compat-table": "kangax/compat-table#07dce174cc63f2b15b5f86b99cdfc89358dd072a"
}
}

View File

@@ -1,5 +0,0 @@
{
"rules": {
"prettier/prettier": ["error", { "trailingComma": "es5" }]
}
}

View File

@@ -1,37 +0,0 @@
export default {
"check-es2015-constants": require("babel-plugin-check-es2015-constants"),
"syntax-async-generators": require("babel-plugin-syntax-async-generators"),
"syntax-object-rest-spread": require("babel-plugin-syntax-object-rest-spread"),
"syntax-optional-catch-binding": require("babel-plugin-syntax-optional-catch-binding"),
"syntax-trailing-function-commas": require("babel-plugin-syntax-trailing-function-commas"),
"transform-async-to-generator": require("babel-plugin-transform-async-to-generator"),
"transform-async-generator-functions": require("babel-plugin-transform-async-generator-functions"),
"transform-es2015-arrow-functions": require("babel-plugin-transform-es2015-arrow-functions"),
"transform-es2015-block-scoped-functions": require("babel-plugin-transform-es2015-block-scoped-functions"),
"transform-es2015-block-scoping": require("babel-plugin-transform-es2015-block-scoping"),
"transform-es2015-classes": require("babel-plugin-transform-es2015-classes"),
"transform-es2015-computed-properties": require("babel-plugin-transform-es2015-computed-properties"),
"transform-es2015-destructuring": require("babel-plugin-transform-es2015-destructuring"),
"transform-es2015-duplicate-keys": require("babel-plugin-transform-es2015-duplicate-keys"),
"transform-es2015-for-of": require("babel-plugin-transform-es2015-for-of"),
"transform-es2015-function-name": require("babel-plugin-transform-es2015-function-name"),
"transform-es2015-literals": require("babel-plugin-transform-es2015-literals"),
"transform-es2015-modules-amd": require("babel-plugin-transform-es2015-modules-amd"),
"transform-es2015-modules-commonjs": require("babel-plugin-transform-es2015-modules-commonjs"),
"transform-es2015-modules-systemjs": require("babel-plugin-transform-es2015-modules-systemjs"),
"transform-es2015-modules-umd": require("babel-plugin-transform-es2015-modules-umd"),
"transform-es2015-object-super": require("babel-plugin-transform-es2015-object-super"),
"transform-es2015-parameters": require("babel-plugin-transform-es2015-parameters"),
"transform-es2015-shorthand-properties": require("babel-plugin-transform-es2015-shorthand-properties"),
"transform-es2015-spread": require("babel-plugin-transform-es2015-spread"),
"transform-es2015-sticky-regex": require("babel-plugin-transform-es2015-sticky-regex"),
"transform-es2015-template-literals": require("babel-plugin-transform-es2015-template-literals"),
"transform-es2015-typeof-symbol": require("babel-plugin-transform-es2015-typeof-symbol"),
"transform-es2015-unicode-regex": require("babel-plugin-transform-es2015-unicode-regex"),
"transform-exponentiation-operator": require("babel-plugin-transform-exponentiation-operator"),
"transform-new-target": require("babel-plugin-transform-new-target"),
"transform-object-rest-spread": require("babel-plugin-transform-object-rest-spread"),
"transform-optional-catch-binding": require("babel-plugin-transform-optional-catch-binding"),
"transform-regenerator": require("babel-plugin-transform-regenerator"),
"transform-unicode-property-regex": require("babel-plugin-transform-unicode-property-regex"),
};

View File

@@ -1,109 +0,0 @@
// TODO: this is the opposite of built-in-features so maybe generate one from the other?
export const definitions = {
builtins: {
DataView: "es6.typed.data-view",
Int8Array: "es6.typed.int8-array",
Uint8Array: "es6.typed.uint8-array",
Uint8ClampedArray: "es6.typed.uint8-clamped-array",
Int16Array: "es6.typed.int16-array",
Uint16Array: "es6.typed.uint16-array",
Int32Array: "es6.typed.int32-array",
Uint32Array: "es6.typed.uint32-array",
Float32Array: "es6.typed.float32-array",
Float64Array: "es6.typed.float64-array",
Map: "es6.map",
Set: "es6.set",
WeakMap: "es6.weak-map",
WeakSet: "es6.weak-set",
Promise: "es6.promise",
Symbol: "es6.symbol",
},
instanceMethods: {
name: ["es6.function.name"],
fromCodePoint: ["es6.string.from-code-point"],
codePointAt: ["es6.string.code-point-at"],
repeat: ["es6.string.repeat"],
startsWith: ["es6.string.starts-with"],
endsWith: ["es6.string.ends-with"],
includes: ["es6.string.includes", "es7.array.includes"],
flags: ["es6.regexp.flags"],
match: ["es6.regexp.match"],
replace: ["es6.regexp.replace"],
split: ["es6.regexp.split"],
search: ["es6.regexp.search"],
copyWithin: ["es6.array.copy-within"],
find: ["es6.array.find"],
findIndex: ["es6.array.find-index"],
fill: ["es6.array.fill"],
padStart: ["es7.string.pad-start"],
padEnd: ["es7.string.pad-end"],
},
staticMethods: {
Array: {
from: "es6.array.from",
of: "es6.array.of",
},
Object: {
assign: "es6.object.assign",
is: "es6.object.is",
getOwnPropertySymbols: "es6.object.get-own-property-symbols",
setPrototypeOf: "es6.object.set-prototype-of",
values: "es7.object.values",
entries: "es7.object.entries",
getOwnPropertyDescriptors: "es7.object.get-own-property-descriptors",
},
Math: {
acosh: "es6.math.acosh",
asinh: "es6.math.asinh",
atanh: "es6.math.atanh",
cbrt: "es6.math.cbrt",
clz32: "es6.math.clz32",
cosh: "es6.math.cosh",
expm1: "es6.math.expm1",
fround: "es6.math.fround",
hypot: "es6.math.hypot",
imul: "es6.math.imul",
log1p: "es6.math.log1p",
log10: "es6.math.log10",
log2: "es6.math.log2",
sign: "es6.math.sign",
sinh: "es6.math.sinh",
tanh: "es6.math.tanh",
trunc: "es6.math.trunc",
},
String: {
raw: "es6.string.raw",
},
Number: {
isFinite: "es6.number.is-finite",
isInteger: "es6.number.is-integer",
isSafeInteger: "es6.number.is-safe-integer",
isNaN: "es6.number.is-nan",
EPSILON: "es6.number.epsilon",
MIN_SAFE_INTEGER: "es6.number.min-safe-integer",
MAX_SAFE_INTEGER: "es6.number.max-safe-integer",
},
Reflect: {
apply: "es6.reflect.apply",
construct: "es6.reflect.construct",
defineProperty: "es6.reflect.define-property",
deleteProperty: "es6.reflect.delete-property",
get: "es6.reflect.get",
getOwnPropertyDescriptor: "es6.reflect.get-own-property-descriptor",
getPrototypeOf: "es6.reflect.get-prototype-of",
has: "es6.reflect.has",
isExtensible: "es6.reflect.is-extensible",
ownKeys: "es6.reflect.own-keys",
preventExtensions: "es6.reflect.prevent-extensions",
set: "es6.reflect.set",
setPrototypeOf: "es6.reflect.set-prototype-of",
},
},
};

View File

@@ -1,75 +0,0 @@
/*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
import semver from "semver";
import { prettifyVersion, semverify } from "./utils";
const wordEnds = size => {
return size > 1 ? "s" : "";
};
export const logMessage = (message, context) => {
const pre = context ? `[${context}] ` : "";
const logStr = ` ${pre}${message}`;
console.log(logStr);
};
export const logPlugin = (plugin, targets, list, context) => {
const envList = list[plugin] || {};
const filteredList = Object.keys(targets).reduce((a, b) => {
if (!envList[b] || semver.lt(targets[b], semverify(envList[b]))) {
a[b] = prettifyVersion(targets[b]);
}
return a;
}, {});
const formattedTargets = JSON.stringify(filteredList)
.replace(/,/g, ", ")
.replace(/^\{"/, '{ "')
.replace(/"\}$/, '" }');
logMessage(`${plugin} ${formattedTargets}`, context);
};
export const logEntryPolyfills = (
importPolyfillIncluded,
polyfills,
filename,
onDebug,
) => {
if (!importPolyfillIncluded) {
console.log(
`
[${filename}] \`import 'babel-polyfill'\` was not found.`,
);
return;
}
if (!polyfills.size) {
console.log(
`
[${filename}] Based on your targets, none were added.`,
);
return;
}
console.log(
`
[${filename}] Replaced \`babel-polyfill\` with the following polyfill${wordEnds(
polyfills.size,
)}:`,
);
onDebug(polyfills);
};
export const logUsagePolyfills = (polyfills, filename, onDebug) => {
if (!polyfills.size) {
console.log(
`
[${filename}] Based on your code and targets, none were added.`,
);
return;
}
console.log(
`
[${filename}] Added following polyfill${wordEnds(polyfills.size)}:`,
);
onDebug(polyfills);
};

View File

@@ -1,272 +0,0 @@
//@flow
import semver from "semver";
import builtInsList from "../data/built-ins.json";
import { logPlugin } from "./debug";
import { defaultWebIncludes } from "./default-includes";
import moduleTransformations from "./module-transformations";
import normalizeOptions from "./normalize-options.js";
import pluginList from "../data/plugins.json";
import {
builtIns as proposalBuiltIns,
features as proposalPlugins,
pluginSyntaxMap,
} from "../data/shipped-proposals.js";
import useBuiltInsEntryPlugin from "./use-built-ins-entry-plugin";
import addUsedBuiltInsPlugin from "./use-built-ins-plugin";
import getTargets from "./targets-parser";
import availablePlugins from "./available-plugins";
import { filterStageFromList, prettifyTargets, semverify } from "./utils";
import type { Plugin, Targets } from "./types";
const getPlugin = (pluginName: string) => {
const plugin = availablePlugins[pluginName];
if (!plugin) {
throw new Error(
`Could not find plugin "${pluginName}". Ensure there is an entry in ./available-plugins.js for it.`,
);
}
return plugin;
};
const builtInsListWithoutProposals = filterStageFromList(
builtInsList,
proposalBuiltIns,
);
const pluginListWithoutProposals = filterStageFromList(
pluginList,
proposalPlugins,
);
export const isPluginRequired = (
supportedEnvironments: Targets,
plugin: Targets,
): boolean => {
const targetEnvironments: Array<string> = Object.keys(supportedEnvironments);
if (targetEnvironments.length === 0) {
return true;
}
const isRequiredForEnvironments: Array<
string,
> = targetEnvironments.filter(environment => {
// Feature is not implemented in that environment
if (!plugin[environment]) {
return true;
}
const lowestImplementedVersion: string = plugin[environment];
const lowestTargetedVersion: string = supportedEnvironments[environment];
if (!semver.valid(lowestTargetedVersion)) {
throw new Error(
// eslint-disable-next-line max-len
`Invalid version passed for target "${environment}": "${lowestTargetedVersion}". Versions must be in semver format (major.minor.patch)`,
);
}
return semver.gt(
semverify(lowestImplementedVersion),
lowestTargetedVersion,
);
});
return isRequiredForEnvironments.length > 0;
};
let hasBeenLogged = false;
const getBuiltInTargets = targets => {
const builtInTargets = Object.assign({}, targets);
if (builtInTargets.uglify != null) {
delete builtInTargets.uglify;
}
return builtInTargets;
};
export const transformIncludesAndExcludes = (opts: Array<string>): Object => {
return opts.reduce(
(result, opt) => {
const target = opt.match(/^(es\d+|web)\./) ? "builtIns" : "plugins";
result[target].add(opt);
return result;
},
{
all: opts,
plugins: new Set(),
builtIns: new Set(),
},
);
};
const getPlatformSpecificDefaultFor = (targets: Targets): ?Array<string> => {
const targetNames = Object.keys(targets);
const isAnyTarget = !targetNames.length;
const isWebTarget = targetNames.some(name => name !== "node");
return isAnyTarget || isWebTarget ? defaultWebIncludes : null;
};
const filterItems = (
list,
includes,
excludes,
targets,
defaultItems,
): Set<string> => {
const result = new Set();
for (const item in list) {
const excluded = excludes.has(item);
if (!excluded) {
if (isPluginRequired(targets, list[item])) {
result.add(item);
} else {
const shippedProposalsSyntax = pluginSyntaxMap.get(item);
if (shippedProposalsSyntax) {
result.add(shippedProposalsSyntax);
}
}
}
}
if (defaultItems) {
defaultItems.forEach(item => !excludes.has(item) && result.add(item));
}
includes.forEach(item => result.add(item));
return result;
};
export default function buildPreset(
context: Object,
opts: Object = {},
): { plugins: Array<Plugin> } {
const {
configPath,
debug,
exclude: optionsExclude,
forceAllTransforms,
ignoreBrowserslistConfig,
include: optionsInclude,
loose,
modules,
shippedProposals,
spec,
targets: optionsTargets,
useBuiltIns,
} = normalizeOptions(opts);
// TODO: remove this in next major
let hasUglifyTarget = false;
if (optionsTargets && optionsTargets.uglify) {
hasUglifyTarget = true;
delete optionsTargets.uglify;
console.log("");
console.log("The uglify target has been deprecated. Set the top level");
console.log("option `forceAllTransforms: true` instead.");
console.log("");
}
const targets = getTargets(optionsTargets, {
ignoreBrowserslistConfig,
configPath,
});
const include = transformIncludesAndExcludes(optionsInclude);
const exclude = transformIncludesAndExcludes(optionsExclude);
const transformTargets = forceAllTransforms || hasUglifyTarget ? {} : targets;
const transformations = filterItems(
shippedProposals ? pluginList : pluginListWithoutProposals,
include.plugins,
exclude.plugins,
transformTargets,
);
let polyfills;
let polyfillTargets;
if (useBuiltIns) {
polyfillTargets = getBuiltInTargets(targets);
polyfills = filterItems(
shippedProposals ? builtInsList : builtInsListWithoutProposals,
include.builtIns,
exclude.builtIns,
polyfillTargets,
getPlatformSpecificDefaultFor(polyfillTargets),
);
}
const plugins = [];
const pluginUseBuiltIns = useBuiltIns !== false;
// NOTE: not giving spec here yet to avoid compatibility issues when
// babel-plugin-transform-es2015-modules-commonjs gets its spec mode
if (modules !== false && moduleTransformations[modules]) {
plugins.push([getPlugin(moduleTransformations[modules]), { loose }]);
}
transformations.forEach(pluginName =>
plugins.push([
getPlugin(pluginName),
{ spec, loose, useBuiltIns: pluginUseBuiltIns },
]),
);
const regenerator = transformations.has("transform-regenerator");
if (debug && !hasBeenLogged) {
hasBeenLogged = true;
console.log("babel-preset-env: `DEBUG` option");
console.log("\nUsing targets:");
console.log(JSON.stringify(prettifyTargets(targets), null, 2));
console.log(`\nUsing modules transform: ${modules.toString()}`);
console.log("\nUsing plugins:");
transformations.forEach(transform => {
logPlugin(transform, targets, pluginList);
});
if (!useBuiltIns) {
console.log(
"\nUsing polyfills: No polyfills were added, since the `useBuiltIns` option was not set.",
);
} else {
console.log(
`
Using polyfills with \`${useBuiltIns}\` option:`,
);
}
}
if (useBuiltIns === "usage" || useBuiltIns === "entry") {
const pluginOptions = {
debug,
polyfills,
regenerator,
onDebug: (polyfills, context) => {
polyfills.forEach(polyfill =>
logPlugin(polyfill, polyfillTargets, builtInsList, context),
);
},
};
plugins.push([
useBuiltIns === "usage" ? addUsedBuiltInsPlugin : useBuiltInsEntryPlugin,
pluginOptions,
]);
}
return {
plugins,
};
}

View File

@@ -1,6 +0,0 @@
export default {
amd: "transform-es2015-modules-amd",
commonjs: "transform-es2015-modules-commonjs",
systemjs: "transform-es2015-modules-systemjs",
umd: "transform-es2015-modules-umd",
};

View File

@@ -1,175 +0,0 @@
//@flow
import invariant from "invariant";
import browserslist from "browserslist";
import builtInsList from "../data/built-ins.json";
import { defaultWebIncludes } from "./default-includes";
import moduleTransformations from "./module-transformations";
import pluginsList from "../data/plugins.json";
import type { Targets, Options, ModuleOption, BuiltInsOption } from "./types";
const validIncludesAndExcludes = new Set([
...Object.keys(pluginsList),
...Object.keys(moduleTransformations).map(m => moduleTransformations[m]),
...Object.keys(builtInsList),
...defaultWebIncludes,
]);
export const validateIncludesAndExcludes = (
opts: Array<string> = [],
type: string,
): Array<string> => {
invariant(
Array.isArray(opts),
`Invalid Option: The '${type}' option must be an Array<String> of plugins/built-ins`,
);
const unknownOpts = opts.filter(opt => !validIncludesAndExcludes.has(opt));
invariant(
unknownOpts.length === 0,
`Invalid Option: The plugins/built-ins '${unknownOpts.join(
", ",
)}' passed to the '${type}' option are not
valid. Please check data/[plugin-features|built-in-features].js in babel-preset-env`,
);
return opts;
};
const validBrowserslistTargets = [
...Object.keys(browserslist.data),
...Object.keys(browserslist.aliases),
];
export const normalizePluginName = (plugin: string): string =>
plugin.replace(/^babel-plugin-/, "");
export const normalizePluginNames = (plugins: Array<string>): Array<string> =>
plugins.map(normalizePluginName);
export const checkDuplicateIncludeExcludes = (
include: Array<string> = [],
exclude: Array<string> = [],
): void => {
const duplicates: Array<string> = include.filter(
opt => exclude.indexOf(opt) >= 0,
);
invariant(
duplicates.length === 0,
`Invalid Option: The plugins/built-ins '${duplicates.join(
", ",
)}' were found in both the "include" and
"exclude" options.`,
);
};
export const validateConfigPathOption = (
configPath: string = process.cwd(),
) => {
invariant(
typeof configPath === "string",
`Invalid Option: The configPath option '${configPath}' is invalid, only strings are allowed.`,
);
return configPath;
};
export const validateBoolOption = (
name: string,
value: ?boolean,
defaultValue: boolean,
) => {
if (typeof value === "undefined") {
value = defaultValue;
}
if (typeof value !== "boolean") {
throw new Error(`Preset env: '${name}' option must be a boolean.`);
}
return value;
};
export const validateIgnoreBrowserslistConfig = (
ignoreBrowserslistConfig: boolean,
) =>
validateBoolOption(
"ignoreBrowserslistConfig",
ignoreBrowserslistConfig,
false,
);
export const validateModulesOption = (
modulesOpt: ModuleOption = "commonjs",
) => {
invariant(
modulesOpt === false ||
Object.keys(moduleTransformations).indexOf(modulesOpt) > -1,
`Invalid Option: The 'modules' option must be either 'false' to indicate no modules, or a
module type which can be be one of: 'commonjs' (default), 'amd', 'umd', 'systemjs'.`,
);
return modulesOpt;
};
export const objectToBrowserslist = (object: Targets) => {
return Object.keys(object).reduce((list, targetName) => {
if (validBrowserslistTargets.indexOf(targetName) >= 0) {
const targetVersion = object[targetName];
return list.concat(`${targetName} ${targetVersion}`);
}
return list;
}, []);
};
export const validateUseBuiltInsOption = (
builtInsOpt: BuiltInsOption = false,
): BuiltInsOption => {
invariant(
builtInsOpt === "usage" || builtInsOpt === false || builtInsOpt === "entry",
`Invalid Option: The 'useBuiltIns' option must be either
'false' (default) to indicate no polyfill,
'"entry"' to indicate replacing the entry polyfill, or
'"usage"' to import only used polyfills per file`,
);
return builtInsOpt;
};
export default function normalizeOptions(opts: Options) {
if (opts.exclude) {
opts.exclude = normalizePluginNames(opts.exclude);
}
if (opts.include) {
opts.include = normalizePluginNames(opts.include);
}
checkDuplicateIncludeExcludes(opts.include, opts.exclude);
return {
configPath: validateConfigPathOption(opts.configPath),
debug: opts.debug,
exclude: validateIncludesAndExcludes(opts.exclude, "exclude"),
forceAllTransforms: validateBoolOption(
"forceAllTransforms",
opts.forceAllTransforms,
false,
),
ignoreBrowserslistConfig: validateIgnoreBrowserslistConfig(
opts.ignoreBrowserslistConfig,
),
include: validateIncludesAndExcludes(opts.include, "include"),
loose: validateBoolOption("loose", opts.loose, false),
modules: validateModulesOption(opts.modules),
shippedProposals: validateBoolOption(
"shippedProposals",
opts.shippedProposals,
false,
),
spec: validateBoolOption("loose", opts.spec, false),
targets: opts.targets,
useBuiltIns: validateUseBuiltInsOption(opts.useBuiltIns),
};
}

View File

@@ -1,144 +0,0 @@
// @flow
import browserslist from "browserslist";
import semver from "semver";
import { semverify } from "./utils";
import { objectToBrowserslist } from "./normalize-options";
import type { Targets } from "./types";
const browserNameMap = {
android: "android",
chrome: "chrome",
and_chr: "chrome",
edge: "edge",
firefox: "firefox",
ie: "ie",
ios_saf: "ios",
safari: "safari",
};
const isBrowsersQueryValid = (browsers: string | Array<string>): boolean =>
typeof browsers === "string" || Array.isArray(browsers);
const semverMin = (first: ?string, second: string): string => {
return first && semver.lt(first, second) ? first : second;
};
const mergeBrowsers = (fromQuery: Targets, fromTarget: Targets) => {
return Object.keys(fromTarget).reduce((queryObj, targKey) => {
if (targKey !== "browsers") {
queryObj[targKey] = fromTarget[targKey];
}
return queryObj;
}, fromQuery);
};
const getLowestVersions = (browsers: Array<string>): Targets => {
return browsers.reduce((all: Object, browser: string): Object => {
const [browserName, browserVersion] = browser.split(" ");
const normalizedBrowserName = browserNameMap[browserName];
if (!normalizedBrowserName) {
return all;
}
try {
// Browser version can return as "10.0-10.2"
const splitVersion = browserVersion.split("-")[0];
const parsedBrowserVersion = semverify(splitVersion);
all[normalizedBrowserName] = semverMin(
all[normalizedBrowserName],
parsedBrowserVersion,
);
} catch (e) {}
return all;
}, {});
};
const outputDecimalWarning = (decimalTargets: Array<Object>): void => {
if (!decimalTargets || !decimalTargets.length) {
return;
}
console.log("Warning, the following targets are using a decimal version:");
console.log("");
decimalTargets.forEach(({ target, value }) =>
console.log(` ${target}: ${value}`),
);
console.log("");
console.log(
"We recommend using a string for minor/patch versions to avoid numbers like 6.10",
);
console.log("getting parsed as 6.1, which can lead to unexpected behavior.");
console.log("");
};
const targetParserMap = {
__default: (target, value) => [target, semverify(value)],
// Parse `node: true` and `node: "current"` to version
node: (target, value) => {
const parsed =
value === true || value === "current"
? process.versions.node
: semverify(value);
return [target, parsed];
},
};
type ParsedResult = {
targets: Targets,
decimalWarnings: Array<Object>,
};
const getTargets = (targets: Object = {}, options: Object = {}): Targets => {
const targetOpts: Targets = {};
// Parse browsers target via browserslist;
const queryIsValid = isBrowsersQueryValid(targets.browsers);
const browsersquery = queryIsValid ? targets.browsers : null;
if (queryIsValid || !options.ignoreBrowserslistConfig) {
browserslist.defaults = objectToBrowserslist(targets);
const browsers = browserslist(browsersquery, { path: options.configPath });
const queryBrowsers = getLowestVersions(browsers);
targets = mergeBrowsers(queryBrowsers, targets);
}
// Parse remaining targets
const parsed = Object.keys(targets)
.sort()
.reduce(
(results: ParsedResult, target: string): ParsedResult => {
if (target !== "browsers") {
const value = targets[target];
// Warn when specifying minor/patch as a decimal
if (typeof value === "number" && value % 1 !== 0) {
results.decimalWarnings.push({ target, value });
}
// Check if we have a target parser?
const parser = targetParserMap[target] || targetParserMap.__default;
const [parsedTarget, parsedValue] = parser(target, value);
if (parsedValue) {
// Merge (lowest wins)
results.targets[parsedTarget] = parsedValue;
}
}
return results;
},
{
targets: targetOpts,
decimalWarnings: [],
},
);
outputDecimalWarning(parsed.decimalWarnings);
return parsed.targets;
};
export default getTargets;

View File

@@ -1,30 +0,0 @@
//@flow
// Targets
export type Target = string;
export type Targets = {
[target: string]: Target,
};
// Options
// Use explicit modules to prevent typo errors.
export type ModuleOption = false | "amd" | "commonjs" | "systemjs" | "umd";
export type BuiltInsOption = false | "entry" | "usage";
export type Options = {
configPath: string,
debug: boolean,
exclude: Array<string>,
forceAllTransforms: boolean,
ignoreBrowserslistConfig: boolean,
include: Array<string>,
loose: boolean,
modules: ModuleOption,
shippedProposals: boolean,
spec: boolean,
targets: Targets,
useBuiltIns: BuiltInsOption,
};
// Babel
export type Plugin = [Object, Object];

View File

@@ -1,126 +0,0 @@
//@flow
import { logEntryPolyfills } from "./debug";
type Plugin = {
visitor: Object,
pre: Function,
post: Function,
name: string,
};
type RequireType = "require" | "import";
function isPolyfillSource(value: string): boolean {
return value === "babel-polyfill";
}
export default function({ types: t }: { types: Object }): Plugin {
function createImportDeclaration(polyfill: string): Object {
const declar = t.importDeclaration([], t.stringLiteral(polyfill));
declar._blockHoist = 3;
return declar;
}
function createRequireStatement(polyfill: string): Object {
return t.expressionStatement(
t.callExpression(t.identifier("require"), [t.stringLiteral(polyfill)]),
);
}
function isRequire(path: Object): boolean {
return (
t.isExpressionStatement(path.node) &&
t.isCallExpression(path.node.expression) &&
t.isIdentifier(path.node.expression.callee) &&
path.node.expression.callee.name === "require" &&
path.node.expression.arguments.length === 1 &&
t.isStringLiteral(path.node.expression.arguments[0]) &&
isPolyfillSource(path.node.expression.arguments[0].value)
);
}
function createImport(
polyfill: string,
requireType: RequireType,
core: ?boolean,
): Object {
if (core) {
polyfill = `babel-polyfill/lib/core-js/modules/${polyfill}`;
}
if (requireType === "import") {
return createImportDeclaration(polyfill);
}
return createRequireStatement(polyfill);
}
function createImports(
polyfills: Array<string>,
requireType: RequireType,
regenerator: boolean,
): Array<Object> {
const items = Array.isArray(polyfills) ? new Set(polyfills) : polyfills;
const imports = [];
items.forEach(p => imports.push(createImport(p, requireType, true)));
if (regenerator) {
imports.push(
createImport(
"babel-polyfill/lib/regenerator-runtime/runtime",
requireType,
),
);
}
return imports;
}
const isPolyfillImport = {
ImportDeclaration(path, state) {
if (
path.node.specifiers.length === 0 &&
isPolyfillSource(path.node.source.value)
) {
this.importPolyfillIncluded = true;
path.replaceWithMultiple(
createImports(state.opts.polyfills, "import", state.opts.regenerator),
);
}
},
Program(path, state) {
path.get("body").forEach(bodyPath => {
if (isRequire(bodyPath)) {
bodyPath.replaceWithMultiple(
createImports(
state.opts.polyfills,
"require",
state.opts.regenerator,
),
);
}
});
},
};
return {
name: "transform-polyfill-require",
visitor: isPolyfillImport,
pre() {
this.numPolyfillImports = 0;
this.importPolyfillIncluded = false;
},
post() {
const { debug, onDebug, polyfills } = this.opts;
if (debug) {
logEntryPolyfills(
this.importPolyfillIncluded,
polyfills,
this.file.opts.filename,
onDebug,
);
}
},
};
}

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