11661 Commits

Author SHA1 Message Date
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 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