Henry Zhu
962128c0f0
Update to babylon v7 beta.30 ( #6587 )
2017-10-28 20:01:52 -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
Mateusz Burzyński
859ea4b175
Scoped: updated numerous docs with scoped packages change [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
Brian Ng
645bf56838
Scoped: rename installation instructions for presets [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
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
94da889ab7
v7.0.0-beta.3
2017-10-15 09:12:00 -04:00
William
36d8a13f4d
Fix catch error on do expression and add tests ( #6372 )
...
Fixes #6331
2017-10-04 18:19:54 +02:00
Logan Smyth
eae76e5b89
Break apart the File class into multiple files and add type definitions.
2017-10-02 13:55:37 -07:00
Logan Smyth
c1df126b83
Remove wrap function and calculate code frames earlier.
2017-10-02 13:48:02 -07:00
Henry Zhu
4a8137c6b4
Merge pull request #6335 from jridgewell/pipeline
...
Pipeline operator
2017-10-02 16:32:15 -04:00
Justin Ridgewell
73fba55c9f
Requeueing sometimes has wrong scope ( #6351 )
...
This prevents a requeued path from inheriting a totally wrong scope later on. I can't find exactly where this is happening, but either way a path should only inherit scope from it's ancestors.
2017-10-02 15:26:10 -04:00
Henry Zhu
6816b26994
Merge pull request #6356 from JeromeFitz/babel-messages-inline
...
Remove babel-messages and inline the usages
2017-09-30 23:25:06 -04:00
JeromeFitz
ae168edcfa
Remove babel-messages ( #6347 ), continuation of #6352
...
package.json "babel-messages" removed:
- babel-core
- babel-helper-replace-supers
- babel-plugin-transform-es2015-classes
- babel-traverse
"messages" remove from:
- babel-plugin-check-es2015-constants/src/index.js
- babel-plugin-transform-es2015-for-of/src/index.js
export "babel-messages" removed from:
- babel-core/src/index.js
import "babel-messages" removed from:
- babel-generator/src/index.js
- babel-helper-replace-supers/src/index.js
- babel-traverse/src/index.js
- babel-traverse/src/scope/index.js
- babel-traverse/src/visitors.js
package "babel-messages" removed completely.
💯 ️ All tests pass.
2017-09-30 09:31:53 -04:00
Abhilash Singh
6230855b71
unshiftContainer seems to incorrectly handle function params #6150 ( #6354 )
2017-09-30 09:14:51 -04:00
Justin Ridgewell
0e432f0e0d
Remove debug closures ( #6349 )
...
God, can you imagine how many useless closures this was creating?
2017-09-29 21:31:43 -04:00
Gilbert
81496ab7b1
Pipeline operator
2017-09-29 19:01:18 -04:00
Justin Ridgewell
3746273eda
Path#ensureBlock keeps path context ( #6337 )
...
* Path#ensureBlock keeps path context
This ensures that if you're inside an ArrowFunction with an expression body (say, you're on the BooleanLiteral in `() => true`), you don't suddenly lose your path context after inserting a variable.
This is because of 82d8aded8e (diff-9e0668ad44535be897b934e7077ecea5R14) . Basically, an innocent `Scope#push` caused my visitor to suddenly stop working. Now, we mutate the Path so it's still in the tree.
* Tests
2017-09-29 19:00:10 -04:00
Logan Smyth
8339e036bf
Remove babel.analyse and surrounding helpers.
2017-09-29 15:17:11 -07:00
Justin Ridgewell
23f98a753a
Add throw expressions ( #6325 )
...
* Add throw expressions
Stage 2 proposal: https://github.com/tc39/proposal-throw-expressions
* Update babylon
* Add to stage 2
2017-09-27 16:15:44 -04:00
Henry Zhu
70547efcc1
v7.0.0-beta.2
2017-09-26 11:14:41 -04:00
Henry Zhu
314bd31b85
update generator/babel-types printing, babylon ( #6306 )
...
* update generator printing, babylon [skip ci]
* Update babel-types for TS node types
2017-09-26 10:01:55 -04:00
Mateusz Burzyński
413ffe6639
Extracted babel-helper-annotate-as-pure ( #6267 )
2017-09-25 17:40:51 +02:00
Henry Zhu
23121d2bd3
v7.0.0-beta.1
2017-09-19 16:24:07 -04:00
Logan Smyth
20679979fc
Remove the unused 'scope' param from 'traverse.hasType'.
2017-09-12 16:48:05 -07:00
Henry Zhu
1c13250807
v7.0.0-beta.0
2017-09-11 23:01:41 -04:00
Justin Ridgewell
4daf11528c
Return inserted/replaced paths ( #5710 )
...
* Return inserted/replaced paths
This gives `Path`’s replacement and insertion methods a consistent
return value: the inserted/replaced paths.
Before, they could return `undefined`, a `node`, or a the current path
inside an array. It was kinda pointless. But now they always return an
array of paths, which is useful for solving
https://github.com/babel/babel/pull/4935#discussion_r96151368 .
* Return inserted nodes and not BlockStatement
Addded test for bug #4363
* Cleanups
- `#replaceWith` will now return the current path if it's the same node
- `#insertAfter` and `#insertBefore` use public Path APIs now
- Makes container insertion faster (single splice call)
- Use public APIs in container insertion
- Replacing a statement with an expression returns the expression's path
- Replacing an expression with multiple statements returns the inserted
closure's body's paths.
2017-09-11 16:07:04 -04:00
Ruben Verborgh
6560a29c36
Redeclaring a variable counts as a modification ( #6219 )
...
* Redeclaring a variable counts as a modification.
Fixes #6217 .
* Remove "existing" logic from Binding.
Was added in #5745 , but no longer triggered since 6536e605a.
2017-09-08 23:02:26 -04:00
Justin Ridgewell
5df70e6a94
Fix bad Scope#parent caching ( #6155 )
...
* Fix bad Scope#parent caching
Now, we traverse the path until we find a parent scope.
Fixes #6057 .
* Fix bad merge
* Remove cached data
* I need to stop using Github editor
* Fix infinite loops due to scopable paths being moved up
2017-09-02 01:03:10 -04:00
Daniel Tschinder
ca117e08cb
fix(requeue): Always requeue implicitely created BlockStatements ( #6193 )
...
This reverts the former fix done in #5743 and always requeues
BlockStatements when they get created.
This also fixes a bug in babel-generator which would indent code
even though no comments are present.
2017-09-02 01:02:21 -04:00
Daniel Tschinder
ab30fa54cb
Update debug to 3.0 ( #6184 )
2017-08-31 23:30:04 -04:00
Daniel Tschinder
44f6ff5e85
Update prettier, eslint + plugins, flow, husky and lint-staged ( #6183 )
2017-08-31 22:56:29 +02:00
Daniel Tschinder
0189b38702
Merge branch '6.x' into 7.0
...
# Conflicts:
# CONTRIBUTING.md
# Makefile
# README.md
# lerna.json
# lib/types.js
# package.json
# packages/babel-cli/package.json
# packages/babel-code-frame/package.json
# packages/babel-core/package.json
# packages/babel-core/test/fixtures/transformation/misc/regression-2892/expected.js
# packages/babel-generator/package.json
# packages/babel-generator/src/generators/flow.js
# packages/babel-generator/src/index.js
# packages/babel-generator/test/fixtures/flow/declare-statements/expected.js
# packages/babel-generator/test/fixtures/flow/object-literal-types/expected.js
# packages/babel-generator/test/fixtures/flow/opaque-type-alias/expected.js
# packages/babel-helper-bindify-decorators/package.json
# packages/babel-helper-builder-binary-assignment-operator-visitor/package.json
# packages/babel-helper-builder-conditional-assignment-operator-visitor/package.json
# packages/babel-helper-builder-react-jsx/package.json
# packages/babel-helper-call-delegate/package.json
# packages/babel-helper-define-map/package.json
# packages/babel-helper-explode-assignable-expression/package.json
# packages/babel-helper-explode-class/package.json
# packages/babel-helper-fixtures/package.json
# packages/babel-helper-function-name/package.json
# packages/babel-helper-get-function-arity/package.json
# packages/babel-helper-hoist-variables/package.json
# packages/babel-helper-optimise-call-expression/package.json
# packages/babel-helper-plugin-test-runner/package.json
# packages/babel-helper-regex/package.json
# packages/babel-helper-remap-async-to-generator/package.json
# packages/babel-helper-replace-supers/package.json
# packages/babel-helper-transform-fixture-test-runner/package.json
# packages/babel-helpers/package.json
# packages/babel-plugin-transform-async-generator-functions/package.json
# packages/babel-plugin-transform-async-to-generator/package.json
# packages/babel-plugin-transform-async-to-module-method/package.json
# packages/babel-plugin-transform-class-constructor-call/package.json
# packages/babel-plugin-transform-class-properties/package.json
# packages/babel-plugin-transform-decorators/package.json
# packages/babel-plugin-transform-es2015-block-scoping/package.json
# packages/babel-plugin-transform-es2015-classes/package.json
# packages/babel-plugin-transform-es2015-classes/test/fixtures/regression/T6755/expected.js
# packages/babel-plugin-transform-es2015-computed-properties/package.json
# packages/babel-plugin-transform-es2015-duplicate-keys/package.json
# packages/babel-plugin-transform-es2015-function-name/package.json
# packages/babel-plugin-transform-es2015-modules-amd/package.json
# packages/babel-plugin-transform-es2015-modules-commonjs/package.json
# packages/babel-plugin-transform-es2015-modules-commonjs/src/index.js
# packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/interop/export-destructured/expected.js
# packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/strict/export-const-destructuring-object-default-params/expected.js
# packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/strict/export-const-destructuring-object-rest/expected.js
# packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/strict/export-const-destructuring-object/expected.js
# packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/strict/options.json
# packages/babel-plugin-transform-es2015-modules-systemjs/package.json
# packages/babel-plugin-transform-es2015-modules-umd/package.json
# packages/babel-plugin-transform-es2015-object-super/package.json
# packages/babel-plugin-transform-es2015-parameters/package.json
# packages/babel-plugin-transform-es2015-shorthand-properties/package.json
# packages/babel-plugin-transform-es2015-sticky-regex/package.json
# packages/babel-plugin-transform-es2015-unicode-regex/package.json
# packages/babel-plugin-transform-es5-property-mutators/package.json
# packages/babel-plugin-transform-exponentiation-operator/package.json
# packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/opaque-type-alias/expected.js
# packages/babel-plugin-transform-object-rest-spread/package.json
# packages/babel-plugin-transform-object-rest-spread/src/index.js
# packages/babel-plugin-transform-object-rest-spread/test/fixtures/object-rest/nested-2/expected.js
# packages/babel-plugin-transform-object-rest-spread/test/fixtures/object-rest/nested/expected.js
# packages/babel-plugin-transform-proto-to-assign/package.json
# packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/regression-node-type-export-default/expected.js
# packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/regression-node-type-export/expected.js
# packages/babel-plugin-transform-react-display-name/package.json
# packages/babel-plugin-transform-react-display-name/src/index.js
# packages/babel-plugin-transform-react-display-name/test/fixtures/display-name/assignment-expression/expected.js
# packages/babel-plugin-transform-react-display-name/test/fixtures/display-name/nested/expected.js
# packages/babel-plugin-transform-react-display-name/test/fixtures/display-name/object-property/expected.js
# packages/babel-plugin-transform-react-display-name/test/fixtures/display-name/variable-declarator/expected.js
# packages/babel-plugin-transform-react-jsx-compat/package.json
# packages/babel-plugin-transform-react-jsx/package.json
# packages/babel-plugin-transform-regenerator/package.json
# packages/babel-plugin-transform-regenerator/test/fixtures/regression/6733/expected.js
# packages/babel-plugin-transform-regenerator/test/fixtures/regression/T7041/expected.js
# packages/babel-plugin-transform-regenerator/test/fixtures/variable-renaming/retain-lines/expected.js
# packages/babel-plugin-transform-runtime/README.md
# packages/babel-plugin-transform-runtime/test/fixtures/runtime/custom-runtime/expected.js
# packages/babel-plugin-transform-runtime/test/fixtures/runtime/full/expected.js
# packages/babel-plugin-transform-runtime/test/fixtures/runtime/regenerator-runtime/expected.js
# packages/babel-plugin-transform-strict-mode/package.json
# packages/babel-polyfill/package.json
# packages/babel-preset-es2015/package.json
# packages/babel-preset-es2016/package.json
# packages/babel-preset-es2017/package.json
# packages/babel-preset-latest/package.json
# packages/babel-preset-react/package.json
# packages/babel-preset-stage-0/package.json
# packages/babel-preset-stage-1/package.json
# packages/babel-preset-stage-2/package.json
# packages/babel-preset-stage-3/package.json
# packages/babel-register/README.md
# packages/babel-register/package.json
# packages/babel-runtime/package.json
# packages/babel-template/package.json
# packages/babel-traverse/package.json
# packages/babel-traverse/src/scope/lib/renamer.js
# packages/babel-traverse/test/evaluation.js
# packages/babel-traverse/test/replacement.js
# packages/babel-types/README.md
# packages/babel-types/package.json
# packages/babel-types/src/converters.js
# packages/babel-types/src/definitions/core.js
# packages/babel-types/src/definitions/es2015.js
# packages/babel-types/src/definitions/flow.js
# packages/babel-types/test/converters.js
# packages/babel-types/test/validators.js
# scripts/generate-interfaces.js
# yarn.lock
2017-08-31 17:44:17 +02:00
Henry Zhu
b82b65a31e
v7.0.0-alpha.20
2017-08-30 15:02:49 -04:00
Henry Zhu
0a4f1b0a6e
update babylon beta.22 ( #6167 )
2017-08-29 17:53:29 -04:00
Buu Nguyen
75861fac87
Fix bug replacement nodes not requeued ( #5743 )
2017-08-28 15:10:00 -06:00
Henry Zhu
827d84536a
Merge pull request #6156 from jridgewell/pr/5502
...
Fix overshadowing local binding
2017-08-28 13:38:21 -06:00
Justin Ridgewell
ac6eda2709
Class instance properties define their own context ( #6158 )
2017-08-28 12:47:17 -06:00
Justin Ridgewell
4b297907d1
Move fix into #checkBlockScopedCollisions
2017-08-25 19:23:11 -04:00
Moti Zilberman
48c114169f
Move up check for binding kind "local"
...
This puts the check before the call to `checkBlockScopedCollisions`.
Fixes #4946 .
2017-08-25 19:21:38 -04:00
Moti Zilberman
c3e8715010
Mask existing "local" bindings when registering new binding
...
Fixes #5491 .
2017-08-25 19:21:38 -04:00
Mauro Bringolf
d8b4073536
Consistent const violations ( #6100 )
...
* Changed updateExpression to report itself as violation instead of its argument
* Update getBindingIdentifiers to work with forXStatement and return proper node as violation
* Updated unaryExpression violation to be consistent with changes.
2017-08-24 21:19:02 -04:00
Henry Zhu
cee4cde53e
v6.26.0
2017-08-16 11:54:08 -04:00
Henry Zhu
5749276d7e
update deps
2017-08-16 10:21:19 -04:00
jbrown215
c28465e03e
Flow opaque type 6.x backport ( #6081 )
...
* Flow opaque type backport
* Add tests for strip types, comments, and babel-generator
* Fix failing tests, run scripts
* Bump babylon to 6.18.0
2017-08-15 16:44:15 -04:00