9088 Commits

Author SHA1 Message Date
Logan Smyth
158e9fbfd7 Represent helpers as simple modules. 2017-09-12 22:15:16 -07:00
Sven SAULEAU
0c5fae2faa Make sure source type is module when parsing .mjs (#5700)
* feat: force source type module for mjs extension

* style: fix lint
2017-09-12 20:59:00 -07:00
Logan Smyth
7179136401 Ensure the AMD/UMD loaders all have params for each import to avoid lazy-loading (#6237) 2017-09-12 20:13:16 -07:00
Maël Nison
5bb6a83fa8 Add new tests for export * from with other names. 2017-09-12 19:51:48 -07:00
Logan Smyth
5006c81b77 Apply the new module transform the the babel-runtime helper files. 2017-09-12 17:51:52 -07:00
Logan Smyth
1e750a945c Convert CommonJS to use new shared implementation. 2017-09-12 17:17:41 -07:00
Logan Smyth
f17d30692c Convert AMD to use new shared implementation. 2017-09-12 17:17:41 -07:00
Logan Smyth
95e08b6d2a Convert UMD to use new implementation of module logic. 2017-09-12 17:17:41 -07:00
Logan Smyth
47a254025a Return a unique identifier node for each use. 2017-09-12 17:17:41 -07:00
Logan Smyth
20679979fc Remove the unused 'scope' param from 'traverse.hasType'. 2017-09-12 16:48:05 -07:00
Henry Zhu
feed22c822 2.0.0-beta.0 2017-09-12 09:40:53 -04:00
Henry Zhu
a381f9b5f0 update to beta.0 (#413) 2017-09-12 09:40:35 -04:00
Henry Zhu
1cdacf85ae update types readme [skip ci] 2017-09-11 23:04:12 -04:00
Henry Zhu
1c13250807 v7.0.0-beta.0 v7.0.0-beta.0 2017-09-11 23:01:41 -04:00
Laurin Quast
8742012b5e Add --keep-file-extension option to babel-cli (#6221)
* Add --keep-module-extension option to babel-cli

* Rename keep-module-extension option to keep-file-extension; Change option to preserve all file extensions
2017-09-11 18:06:44 -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
Mateusz Burzyński
c47258d68c Annotating transformed classes with #__PURE__ comment (#6209) 2017-09-11 11:18:37 -04:00
Ben Newman
c4f6a7a06f Add failing test case for object rest after array rest, and fix it. (#6213)
* 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.
2017-09-11 11:16:14 -04:00
Sven SAULEAU
1341e4163b fix(preset-es2015): pass loose option (#6224) 2017-09-11 10:37:18 -04:00
Lukas Geiger
b6467a68ca Add option to define output directory relative to the input (#5421)
* 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
2017-09-09 20:38:06 -04:00
Daniel Tschinder
5565e1b406 Correctly requeue CallExpression in AMD transform (#5497)
* Correctly requeue the define()-CallExpression

* Use pushContainer
2017-09-09 20:33:35 -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
4e612058c0 Do not fix linting errors in precommit hooks (#6218)
It's just damn annoying. Supersedes #5908.
2017-09-08 19:52:49 -04:00
Nicolò Ribaudo
4e7961dcf8 Use /bin/bash instead of /bin/sh in scripts
`/bin/sh` isn't always an alias of `/bin/bash`, so bash-specific syntax broke the scripts.
(like 777a9ae6e4/scripts/_get-test-directories.sh (L7))
2017-09-07 17:19:40 -07:00
Henry Zhu
bbac1ebe45 2.0.0-alpha.20 2017-09-06 11:36:30 -04:00
Henry Zhu
7c70b27b53 add basic example [skip ci] (#409) 2017-09-06 00:03:06 -04:00
Noah Lemen
777a9ae6e4 warn about class properties support in decorators readme and error messaging (#6196) 2017-09-05 14:24:21 -04:00
Astha Sharma
3a2b7fe3cd JSX pragma revert (#6195)
* 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
2017-09-04 00:25:56 -04:00
Logan Smyth
d6ba4d0a24 Only compile files inside the cwd in babel-register. (#5590) 2017-09-02 01:07: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
Zev Isert
2dd03e3ee9 Allow NodeJS v8.4 experimental HTTP2 (#6175)
* Allow NodeJS v8.4 experimental HTTP2

Native NodeJS HTTP/2 support experimental though, so might not be worth merging this

* Linter picked up on a line with only spaces

Removed the spaces
2017-09-02 00:42:45 +02:00
Logan Smyth
4f441ff27e Ignore the standalone output bundle so it will require() faster. 2017-09-01 15:31:29 -07:00
Justin Ridgewell
f7109658f9 Added --delete-dir-on-start option for babel (#6187)
* added --delete-dir-on-start option 

added --delete-dir-on-start-option to delete dir on start of compilation to remove deleted files from the orignial files from the --out-dir

* added option --delete-dir-on-start

added --delete-dir-on-start that option will delete the --out-dir before the compilation of code to remove the deleted files from the source from the out directory

* added --delete-dir-on-start option

added --delete-dir-on-start-option to delete dir on start of compilation to remove deleted files from the orignial files from the --out-dir

* bug removed deleting the correct dir

in the previous code, the source dir was deleted each time rather than deleting the out dir

* Remove shorthand

* Prevent babel-cli option from reaching babel-core

* Lint
2017-09-01 17:45:13 -04:00
Justin Ridgewell
f39811d271 Derived constructors don't always need a super (#6189) 2017-09-01 17:14:25 -04:00
Logan Smyth
fad9345c85 Revert Yarn workspace changes from #6056 for now.
Yarn currently fails to add the correct symlinks in some cases. See https://github.com/yarnpkg/yarn/issues/4289
2017-09-01 13:17:25 -07:00
Justin Ridgewell
1797ac5015 Update babylon and remove bad label tests (#6188) 2017-09-01 12:29:48 -04:00
Mateusz Burzyński
76161e0a73 Added new outputType - module - for build-external-helpers tool. Should help with tree-shaking story. It's strongly influenced by how the helpers are transformed by rollup-plugin-babel. (#5916) 2017-08-31 23:44:24 -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
Henry Zhu
6108bee4f9 update changelog labels [skip ci] 2017-08-31 15:59:05 -04: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
Artem Yavorsky
22ff8be4a7 Bump browserslist to 2.4. (#406) 2017-08-31 07:57:31 -05:00
Henry Zhu
39bd9b58e1 update to alpha.20 (#405) 2017-08-30 16:04:33 -04:00
Henry Zhu
b82b65a31e v7.0.0-alpha.20 v7.0.0-alpha.20 2017-08-30 15:02:49 -04:00
Cory Simmons
5196b94fa5 Add Node usage (#398) [skip ci]
I can never remember the syntax and end up coming here to copy/paste this snippet all the time.

I assume other people want to as well, or at least make it clear for newbs that this can be used with Node without them having to scroll.
2017-08-30 00:25:10 -04:00
Justin Ridgewell
5e7fce3fe0 Update babylon (#6172) 2017-08-30 00:19:36 -04:00
Brandon Max
84580cc2d1 Refactor es2015-loose and es2015-no-commonjs presets to use preset op… (#6168) 2017-08-30 00:02:54 -04:00
Noah Lemen
d70603ffa9 re-add template literals tests, add ones that were missing (#6169) 2017-08-29 21:06:05 -04:00
Logan Smyth
d79a7920a1 Merge pull request #5586 from loganfsmyth/config-dependency-cycles
Handle cycles of plugins compiling themselves and .babelrc.js files loading themselves
2017-08-29 15:11:51 -07:00