12409 Commits

Author SHA1 Message Date
Babel Bot
4cf7d0c828 Add v7.4.1 to CHANGELOG.md [skip ci] 2019-03-19 23:12:21 +00:00
Nicolò Ribaudo
94d1a5e8d7
v7.4.1 2019-03-20 00:10:54 +01:00
Nicolò Ribaudo
6402d8d58c
Alias @babel/preset-env/data/built-ins.json.js (#9711)
Fixes vuejs/vue-cli#3671

Even if it has the `.js` extension, `require("@babel/preset-env/data/built-ins.json")` will still work.
2019-03-20 00:09:09 +01:00
Nicolò Ribaudo
c548e789bb
Bring back isPluginRequired (#9709) 2019-03-19 23:35:13 +01:00
Babel Bot
8476cf692f Add v7.4.0 to CHANGELOG.md [skip ci] 2019-03-19 20:30:23 +00:00
Nicolò Ribaudo
f1328fb913
v7.4.0 2019-03-19 21:27:16 +01:00
Denis Pushkarev
3303b079c5 Update to core-js@3 (#7646)
### `@babel/runtime`
- Added `@babel/runtime-corejs3` package and `corejs: 3` options to `@babel/plugin-transform-runtime`.
- Added support of instance methods, fixes #8928.
- Added flag `proposals` (in `corejs: { version: 3, proposals: true }` format) for support all proposals polyfills from `core-js`.
- Used separate directories in runtime for `core-js` entry points with proposals and without.
- Used `get-iterator-method` helper for getting iterators, fixes #2500.
- As a cheap bonus, added support of IE8- (except some cases of `regenerator`).

### `@babel/polyfill`
- Should be deprecated in favor of separate usage required features from `core-js` and `regenerator-runtime` with an informative message.

### `@babel/preset-env`
- Uses for built-ins data from [`core-js-compat`](https://github.com/zloirock/core-js/tree/master/packages/core-js-compat) instead of `compat-table` since information from `compat-table` [is not enough](https://github.com/zloirock/core-js/tree/master/packages/core-js-compat).
- `useBuilIns` now requires direct setting of `corejs` version option, without it will be used `2` by default and shown deprecation warning.
- Added support of minor `core-js` versions for simplify updating in the future.
- For preventing some order-related problems, polyfills in the both `core-js@3` plugins added on `post` stage in the order of `core-js-compat` data.
- Divided plugins and polyfills parts of `preset-env`, instead of 2 internal plugins for adding polyfills, we have 6: usage and entry versions of plugins for `core-js@2`, ### Current state:
`core-js@3`, `regenerator-runtime`.
- Added support `samsung` target (for Samsung Internet) since `core-js-compat` and `compat-table` now contains mapping for this, fixes #6602.

#### `useBuilIns: entry` with `corejs: 3`
- No longer transforms `@babel/polyfill`.
- Transforms **all possible** `core-js` entry points to import of related modules (based on data from [`core-js-compat`](https://unpkg.com/core-js-compat@3.0.0-beta.15/entries.json)).
- Since of this, we no longer need `shippedProposals` / `proposals` flags with `useBuilIns: entry`.
- Removes `regenerator-runtime/runtime` import where it's not required.

#### `useBuilIns: usage` with `corejs: 3`
- In addition to `shippedProposals`, added flag `proposals`  (in `corejs: { version: 3, proposals: true }` format) for polyfill all proposals from `core-js`.
- Fixed list of dependencies in built-in definitions.
- Improved the way of determination method / built-in name and source of this method.
- Adds import of required polyfills on `MemberExpression`, `ObjectPattern`, `in` operator.
- Adds import of required polyfills on access to global object properties.
- Adds import of all required common iterators on all syntax features which use iterators protocol (`for-of`, destructuring, spread, `yield` delegation, etc.).
- Adds import of promises on syntax features which use promises (async functions/generators, dynamic import, etc.), fixes #9250, #7402, etc.

### `core-js@2` stuff
I didn't want to tough `core-js@2`-related stuff, however
- Fixed some serious errors in definitions which breaks `Object.getOwnPropertySymbols`, `Symbol.toStringTag` logic, `Promise#finally`, `Array#forEach`, etc.
- `Array#flatMap` and trim methods moved to stable features as a part of ES2019 and loaded by deprecated `@babel/polyfill` and `@babel/preset-env` with `corejs: 2` option.
2019-03-19 21:07:45 +01:00
Nicolò Ribaudo
7df0d16131
Update main.workflow 2019-03-19 19:02:54 +01:00
Nicolò Ribaudo
f2ee84b6a3
Publish to npm using a GitHub action (#9588) 2019-03-19 18:59:35 +01:00
Mattias Buelens
60005b35e4 Update regenerator-runtime to latest version (#9442) 2019-03-19 18:46:47 +01:00
Tim McClure
e068281e28 Fix super Method Calls in Class Private Methods (#9704)
This fixes an issue with the use of super method calls in class private methods. See https://github.com/babel/babel/issues/9580 for more info re: behavior of the bug.
2019-03-19 18:43:02 +01:00
Daniel Tschinder
48d66eb648
Correctly parse TS TypeAssertions around arrow functions (#9699) 2019-03-18 22:18:47 -07:00
Nicolò Ribaudo
c285d5409e
Add %%placeholders%% support to @babel/template (#9648)
This is the last step to make https://github.com/babel/babel/pull/9364 usable in Babel. I'm sorry for opening this PR so late, but I hope to get it in v7.4.

In this PR I added a new option to `@babel/template`, `syntacticPlaceholders: ?boolean`, which toggles between `%%foo%%` placeholders (when `true`) and `FOO` placeholders. If it isn't specified, Babel tries to be "smart" to avoid breaking backward compat: if `%%foo%%` is used `syntacticPlaceholders` defaults to `true`, otherwise to `false`.

0e58e252913efe84eba926cc9c9c19fb18d5c620 commit shows how some templates we used could be simplified by using this new placeholders syntax (we can't actually do it yet because we are importing `template` from `@babel/core` which could be an older version).

NOTE: Since I wanted to keep this PR as small as possible to make it easier to review, I didn't migrate `template.ast` to internally use the new syntax. It is an implementation detail, so it will be possible to change it in a patch release.
2019-03-18 21:23:10 +01:00
Daniel Tschinder
f36a6987e4
Correctly preserve reference to array in for-of loop (#9697)
* Correctly preserve reference to array in for-of loop

* Add more tests
2019-03-17 21:41:35 -07:00
Andrew Goldis
efd2ca9040 Move abstract removal ClassDeclaration > Class. (#9693)
Usage of "@babel/plugin-proposal-decorators" with legacy
support causes "abstract" keyword to be preserved.
This fixes it by moving "abstract" node property removal
from "ClassDeclaration" visitor to "Class". Resolves #8172
2019-03-17 20:44:50 +01:00
Pelle Nielsen
a35e5a314a Fix TSFunctionType visitors definition (#9692)
When traversing a tree parsing for TypeScript syntax and hitting a `TSFunctionType` node, the `typeParameters` and `typeAnnotation` fields are correctly visited but the `parameters` field isn't. As a result visitors by default don't visit `foo` below:

```
var x: (foo) => void; // foo is never visited
```
```
module.exports = function() {
  return {
    visitor: {
      Identifier(path) {
        if (path.node.name == "foo") {
          // Never hit because it's nested within TSFunctionType.parameters
          path.node.name = "bar";
        }
      }
    }
  };
}
```

It appears to be a bug in babel-types/src/definitions/typescript.js which omits `parameters` in the visitors list for `fnOrCtr`. Fixed by adding it.
2019-03-16 09:24:23 +01:00
Tan Li Hau
cc45608423 Add readonly to TypeScript type modifier (#9529)
* add readonly to TSTypeOperator

* add more test cases for readonly
2019-03-16 06:41:51 +01:00
Tan Li Hau
25a3825a1d TypeScript Constant contexts (#9534)
* Add as const fixtures

* parse constant context

* parse constant context

* quick check for literal

* code review, better error message, check array elements

* Removed unneeded test cases
2019-03-16 06:40:39 +01:00
Amir Seljubac
0a69b45126 Remove dependency on home-or-tmp package (#9678) 2019-03-13 17:20:29 -05:00
piotr
a64bf63639 [proposal-object-rest-spread] fix templateLiteral in extractNormalizedKeys (#9628)
Added additional check in extractNormalizedKeys function to handle templates differently than string.
2019-03-13 21:39:50 +01:00
Behrang Yarahmadi
29cd27b545 Partial application plugin (#9474)
* add partial application syntax and some tests

remove unnecessary error message and hasPartial function from parseNewArguments

add types for PartialExpression

Update the tests

rename PartialExpression to Partial

move Partial from expressions to types and rename to ArgumentPlaceholder

add tests for ArgumentPlaceholder in babel-generator

rename Partial to ArgumentPlaceholder

update the tests

remove alias from the type and undo changes in generated folder

adds a nice error message

better definition for the type

auto-generated files

update the conditional for allowPlaceholder message and tests

update CallExpression definition to accept ArgumentPlaceholder

change description

clean up

indent ArgumentPlaceholder entry and revert unwanted changes

* add Partial Application Plugin

* update unwrapArguments function and add replacePlaceholders.

* update the tests

* remove unnecessary clone

* update readme and description an package.json

* put options.json one level up and add test for not assigned and chained

* add await to fix the test

* use Promise in the test instead of async await

* remove unnecessary method test [#9474]

* push sequenceExpressions to an array [#9474]
2019-03-13 12:21:10 +01:00
Brian Ng
a6cb24fa1a
Merge pull request #9672 from babel/deps 2019-03-12 19:22:34 -05:00
Tim McClure
81c130ffc9 Private Static Class Methods (Stage 3) (#9446) 2019-03-13 00:11:16 +01:00
Brian Ng
db669a0c6e
gulp-uglify@3.0.2 2019-03-12 17:09:54 -05:00
Brian Ng
2f9c4d0045
rollup@1.6.0 2019-03-12 17:09:14 -05:00
Brian Ng
0bf6091305
eslint@5.15.1 2019-03-12 17:05:27 -05:00
Brian Ng
ad2c969097
jest@24.5.0 2019-03-12 17:03:45 -05:00
Brian Ng
b7fb71ffe2
regexpu-core@4.5.4 2019-03-12 16:55:57 -05:00
Daniel Tschinder
cf4bd8bb8d
Remove input and length from state (#9646) 2019-03-11 00:42:42 -07:00
Daniel Tschinder
ec318d01fa
Switch from rollup-stream to rollup and update deps (#9640) 2019-03-11 00:42:25 -07:00
Guy Bedford
a891b73401 System modules - Hoist classes like other variables (#9639) 2019-03-10 23:33:19 +01:00
Jimmy Jia
dd2ffda387 fix: Don't transpile ES2018 symbol properties (#9650)
This is a repeat of #5195 to work around the same upstream issue.
2019-03-10 23:22:59 +01:00
Daniel Tschinder
b2b96e0b15
Add WarningsToErrorsPlugin to webpack to avoid missing build problems on CI (#9647) 2019-03-07 15:44:36 -08:00
Mathias Bynens
7c909e822f
Update regexpu-core dependency (#9642)
This should resolve the issue @danez mentions here:
https://github.com/babel/babel/pull/9636#issuecomment-469870217
2019-03-07 16:40:20 +01:00
Nicolò Ribaudo
15dfce33df
Add placeholders support to @babel/types and @babel/generator (#9542) 2019-03-07 11:47:39 +01:00
Daniel Tschinder
095e5c0e09
Generate plugins file 2019-03-06 19:34:08 -08:00
Daniel Tschinder
fb81e8f8b4
Make babel-standalone an ESModule and enable flow (#9025)
* Make babel-standalone an ESModule and enable flow

* autogenerate plugin list

* Make config an array
2019-03-06 14:30:43 -08:00
Daniel Tschinder
d8a5329834
Reorganize token types and use a map for them (#9645) 2019-03-06 14:30:04 -08:00
Matt Tingen
e53be4b387 [TS] Allow context type annotation on getters/setters (#9641)
* Allow context type annotation on getters/setters

* Extract getAccessorsExpectedParamCount
2019-03-06 22:54:42 +01:00
Erik Arvidsson
fba5655a44 Parenthesized expressions (#8025)
* Add parser createParenthesizedExpressions option  …

When set to `true` we create `ParenthesizedExpression` nodes instead of
setting `extra.parenthesized`.

* Also update babel-parser.d.ts
2019-03-06 22:43:36 +01:00
Mathias Bynens
28c71e88e2
Fix label name 2019-03-06 11:41:03 +01:00
Daniel Tschinder
29999007f6
Disallow escape sequences in contextual keywords (#9618)
* Disallow escape sequences in async

* Disallow escape sequences in get, set and async in class

* invalid escape tests

* Update whitelist

* tests for async in parens

* Add test for invalid newline between params and arrow

* Move canInsertSemilcolon() into shouldPArseAsyncArrow
2019-03-05 17:20:36 -08:00
Mathias Bynens
349c0d4836 Update babel-plugin-proposal-unicode-property-regex for Unicode v12 (#9636)
https://github.com/tc39/ecma262/issues/1467
https://github.com/tc39/ecma262/pull/1468


Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2019-03-05 18:06:33 +01:00
Mathias Bynens
54ba6d80c0 Update identifier parsing per Unicode v12 (#9637)
https://github.com/tc39/ecma262/issues/1467
https://github.com/tc39/ecma262/pull/1468
2019-03-05 17:05:03 +01:00
Nicolò Ribaudo
d832c0f434
Add parser support for placeholders (#9364) 2019-03-05 00:45:42 +01:00
Behrang Yarahmadi
c60c4dd375
Partial Application Syntax: Stage 1 (#9343)
* add partial application syntax and some tests

* remove unnecessary error message and hasPartial function from parseNewArguments

* add types for PartialExpression

* Update the tests

* rename PartialExpression to Partial

* move Partial from expressions to types and rename to ArgumentPlaceholder

* add tests for ArgumentPlaceholder in babel-generator

* rename Partial to ArgumentPlaceholder

* update the tests

* remove alias from the type and undo changes in generated folder

* adds a nice error message

* better definition for the type

* auto-generated files

* update the conditional for allowPlaceholder message and tests

* update CallExpression definition to accept ArgumentPlaceholder

* change description

* clean up

* indent ArgumentPlaceholder entry and revert unwanted changes
2019-03-05 00:34:02 +01:00
Daniel Tschinder
37a427f692
Update dependencies (#9624) 2019-03-04 14:26:39 -08:00
Daniel Tschinder
38ef4b7467
Add editorconfig for Makefile (#9623) 2019-03-04 14:26:22 -08:00
Nicolò Ribaudo
f195daa092
Don't add params of anonymous exported function decls to the outer scope (#9613)
* Don't add params of anonymous exported function decls to the outer scope

* Test
2019-03-01 00:09:49 +01:00
Daniel Tschinder
17f4195bcc
Allow any reserved word in export {} from specifiers (#9616) 2019-02-28 15:07:20 -08:00