* Add --keep-module-extension option to babel-cli
* Rename keep-module-extension option to keep-file-extension; Change option to preserve all file extensions
* 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.
* Add failing test case for object rest after array rest.
Discovered while upgrading https://github.com/meteor/babel to Babel 7.
The error is:
1) babel-plugin-transform-object-rest-spread/object rest with array rest:
TypeError: /Users/ben/dev/babel/packages/babel-plugin-transform-object-rest-spread/test/fixtures/object-rest/with-array-rest/actual.js: Property id of VariableDeclarator expected node to be of a type ["LVal"] but instead got null
at Object.validate (packages/babel-types/lib/definitions/index.js:73:13)
at validate (packages/babel-types/lib/index.js:460:9)
at Object.builder (packages/babel-types/lib/index.js:428:7)
at Object.RestElement (packages/babel-plugin-transform-object-rest-spread/lib/index.js:157:41)
at NodePath._call (packages/babel-traverse/lib/path/context.js:53:20)
at NodePath.call (packages/babel-traverse/lib/path/context.js:40:17)
at NodePath.visit (packages/babel-traverse/lib/path/context.js:84:12)
...
* Fix object rest following array rest. (#6213)
* Avoid treating array ...rest elements as object ...rest properties.
* Also avoid treating ...rest parameters as object ...rest properties.
Returning early if the parent was an ArrayPattern was not quite enough,
since a RestElement can appear as a parameter in a Function as well.
* Move RestElement parent check earlier in visitor method.
* Fix output directory if filename is given
* Add test for relative output path
* Add option to define output dir relative to input
* Add tests for --copy-files
* Test error handling for wrong arguments
* Redeclaring a variable counts as a modification.
Fixes#6217.
* Remove "existing" logic from Binding.
Was added in #5745, but no longer triggered since 6536e605a.
* Removed the deprecated jsx pragma detection code and the concerned tests that included jsx-pragma
* Removed extra tests
* Restored packages/babel-plugin-transform-react-jsx/test/fixtures/react/honor-custom-jsx-pragma-option/
* Added JSX_ANNOTATION_REGEX
* Reverted the tests for jsx-pragma-options and removed those which throw deprecated message
* 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
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.