12445 Commits

Author SHA1 Message Date
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
Nicolò Ribaudo
f13f4adcbb
[TS] Disallow type casts in arrow parameters (#9612) 2019-02-28 23:58:27 +01:00
Evan Henley
d72f3aa758 [plugin-transform-typescript] Strip type imports used in Enums and object types (#9605)
* fix: strip type imports used in Enums and object types

* chore: update failing snapshot

* docs: correct TSPropertySignature comment

* fix: enum value should be considered a reference

* chore: add tests for TSPropertySignature and TSEnumMember
2019-02-28 22:03:12 +01:00
Daniel Tschinder
98ab1b6428
Refactor parsing object members (#9607)
* Refactor parsing object members

* Ensure decorators on rest don’t swallow decorators silently

* Use hasPrecedingLineBreak

* Add test for async with linebreak

* Update flow whitelist
2019-02-28 11:42:12 -08:00
Daniel Tschinder
208195f425
Disallow duplicate params in methods (#9599)
* Disallow duplicate params in methods

* Fix plugins
2019-02-27 15:54:07 -08:00
Daniel Tschinder
5cb280f986
Fix scope check for 2nd+ lexical bindings (#9600) 2019-02-27 15:53:28 -08:00
Nicolò Ribaudo
9aec606c69
Don't loose "this" in helper-call-delegate (#9601) 2019-02-28 00:34:48 +01:00
Nicolò Ribaudo
5c8cc0d536
Mark FOO in "var { x: FOO }˝ as a binding, not as a reference (#9492) 2019-02-27 00:17:11 +01:00
Daniel Tschinder
43eed1ac92
Check exported bindings are defined (#9589)
* Check exported bindings are defined

* Add tests

* Update flow whitelist

* Add tests for builtins
2019-02-26 13:28:10 -08:00
Sven Sauleau
e883ff295d
Merge pull request #9597 from danez/Update-charcodes
Update charcodes
2019-02-26 22:17:59 +01:00
Daniel Tschinder
c1e51e08d3
Update charcodes 2019-02-26 12:29:10 -08:00
Justin Ridgewell
039a74a8b9
preset-env: minimally supporting version (#9596)
* preset-env: minimally supporting version

This changes the "does browser support X" algorithm to "lowest version such that all higher versions support it".

Eg, given `{ chrome70: true, chrome60: false, chrome50: true }`, the lowest version is chrome70, not chrome50.

This is done to remove Tagged Template Literal support from Safari, which introduced a bug in Safari 12 but correctly implemented the feature in Safari 11-9.

* Add tests

* Fix tests

* Fix comment
2019-02-26 15:18:52 -05:00
Nicolò Ribaudo
a029071b8f
[TS] Correctly forget awaits after parsing async arrows with type args (#9593) 2019-02-26 20:35:18 +01:00
Daniel Tschinder
244e4580e9
Remove always false param allowExpressionBody (#9591) 2019-02-26 11:15:34 -08:00
Justin Ridgewell
e1ff4c47b9 preset-env: Sort versions before determining lowest (#9595)
Likely because of implicit `equals` (ie, Safari 12 support implies iOS Safari 12), the versions in the `res` hash are not always sorted in version order.

Doing a semver sort reveals some builtins have actually been supported a little longer than we thought!
2019-02-26 11:11:49 -08:00