1600 Commits

Author SHA1 Message Date
Letladi Sebesho
4d12c8971b added flow to babel cli (#10244)
* added flow to babel cli

* added 'SourceMapGenerator' as a argument to 'fromObject'
2019-07-25 09:59:41 +02: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
Daniel Tschinder
756ded4d64 Remove definition of micromatch which was removed. (#8988) 2018-11-07 16:49:27 -06:00
Logan Smyth
810b7916c2 Expose an API to check if a helper is available in a given version range. 2018-08-02 18:44:56 -07:00
Logan Smyth
9bd4b46fd6
Merge pull request #8198 from loganfsmyth/sourcemap-loading
Prefer explicit object maps, and properly load relative maps.
2018-07-04 15:39:42 -07:00
Logan Smyth
532c25c8db Ensure that file-path sourcemaps load relative to the file containing the comment. 2018-06-18 22:06:08 -07:00
Serhii Nanovskyi
3de053cc6c Validate @babel/preset-env options (#8031) 2018-06-09 18:38:14 -05:00
Logan Smyth
9e7fe0ab49 Add type definitions for source-map library. 2018-04-25 12:02:05 -07:00
Logan Smyth
7ff4a73916
Upgrade flow to 0.66 and fix a few minor errors. (#7431) 2018-02-25 19:22:23 -08:00
Boris Cherny
c3654d83c8 Generate TypeScript typings, and improve generated Flow typings (#7101)
* generate typescript types

* improve type generator output

* move generator scripts to scripts/generators

* use new stringifier for generating flow types too

* export summary types

* add support for oneOfNodeOrValueTypes to improve type generation

* export typescript types from top level, and remove module declaration

* generate typescript/flow types and copy typescript types to babel-types/lib as part of make build

* copy flow types to babel-types/lib as part of make build (fix #6839)

* improve typing: Identifier->name should be a string, not any

* avoid destructuring, to support node 4

* update doc generator to share more code, regenerate babel-types readme, pipe all generator output to stdout

* regenerate babel-types readme as part of make build

* improve typing: ClassProperty->key should be Identifier | StringLiteral | NumericLiteral | Expression, not any

* improve typing: optional node properties are nullable, not undefinedable

* improve docs: FlowClassImplements should be ClassImplements

* make ts usage more friendly: when using babel-types api, make optional params | undefined, and when reading nodes keep optional params | null

* rm lib/types.d.ts and lib/types.js in favor of packages/babel-types/lib

* add missing variance node type, address review comments

* add tests for flow variance

* Comment should be a disjoint union of tagged types

* update .flowconfig
2018-01-17 10:31:46 -05:00
Brian Ng
3e5fce07e4
Regen lib/types (#7180) 2018-01-09 09:25:45 -06:00
Francisco Ryan Tolmasky I
f0e46772a6 babel-types lists JSXIdentifier as an Expression (#6960)
Currently, Babel is treating JSXIdentifier, JSXMemberExpression, and JSXEmptyExpression as expressions as well, which means Babel will for example incorrectly allow you to place these anywhere an expression is wanted.

Closes #6851.
2017-12-18 09:27:43 -06:00
Daniel Poindexter
12ac1bccd7 Fix type definitions to fully support Typescript (#6939) 2017-12-08 17:03:01 -06:00
Brian Ng
ccd7c25174
Regen babel-types docsdocs and interfaces [skip ci] 2017-11-22 08:53:16 -06:00
Henry Zhu
bede73122d
fixup places that aren not scoped [skip ci] (#6646) 2017-10-30 16:47:13 -04:00
Logan Smyth
191624d800 Add a new utility for traversing the AST. 2017-10-18 13:55:14 -07:00
Logan Smyth
cc22ea04bb Add type declaration for t.validate. 2017-10-18 13:55:13 -07:00
Logan Smyth
ad05c9935e Generate types with %checks annotations. 2017-10-18 13:55:13 -07:00
Logan Smyth
e6beb7cb61 Regenerate flow types and add more types. 2017-10-18 13:55:13 -07:00
Brian Ng
72d1a72122
Update babel-types docs and lib/types [skip ci] 2017-10-18 09:43:54 -05:00
Logan Smyth
7d6b15bba9 Regenerate types with scripts. 2017-10-08 22:31:31 -04:00
Logan Smyth
eae76e5b89 Break apart the File class into multiple files and add type definitions. 2017-10-02 13:55:37 -07:00
Sarup Banskota
75808a2d14 Prevent getFunctionParent from returning Program (#5923) 2017-08-02 16:30:33 -05:00
jbrown215
4e9a25e34a Flow opaque type aliases (#5990) 2017-08-02 16:30:19 -05:00
Brian Ng
21eeed8a8c Fix generate interfaces script (#6031)
* Fix typo in TSPropertySignature type definition

* Sort fields in generate-interfaces script
2017-08-01 14:38:46 -04:00
Logan Smyth
0eae6a432c Remove merge helper and add more type declarations. (#5649) 2017-04-18 19:08:39 -07:00
Logan Smyth
6af8e64711 Typecheck much more of the config loading process (#5642)
* Add type declarations for micromatch.

* Enable Flowtype on all config loading.

* Remove unneeded comments.
2017-04-18 09:28:18 -07:00
Toru Kobayashi
9188be9ed5 [7.0] Rename flow AST Type ExistentialTypeParam to ExistsTypeAnnotation (#5199) 2017-02-15 14:58:07 -05:00
Charles Pick
bc8f476d33 [7.0] Rename NumericLiteralTypeAnnotation to NumberLiteralTypeAnnotation (#5229) 2017-02-15 14:54:27 -05:00
Brian Ng
0aa3ac2bb5 Update babel parser options (#4688)
* Update babel parser options
2016-10-07 14:30:47 -04:00
Daniel Tschinder
308de41992 Add support for the new declare module.exports of flow. (#3570) 2016-08-16 16:54:00 +02:00
Henry Zhu
e998e53466 run generate-iterfaces 2016-02-04 11:07:04 -05:00
Daniel Lo Nigro
0076204f80 Fix Flow.
Removed `@flow` annotation from files that don't actually pass Flow check at the moment. These will be added back file by file once the files are properly converted to use Flow.

Closes #3064
2015-11-15 21:30:22 -08:00
Sebastian McKenzie
e62a00df50 rename NumberLiteral to NumericLiteral and RegexLiteral to RegExpLiteral 2015-11-03 01:19:35 +00:00
Sebastian McKenzie
ad7b1c6578 add flow types definition 2015-11-02 19:40:59 +00:00
Sebastian McKenzie
119520ed87 add lib folder 2015-09-23 16:00:41 +01:00
Sebastian McKenzie
ca79fff0c4 remove acorn compiled source 2015-03-22 04:09:18 +11:00
Sebastian McKenzie
30b1c0154d update to modular acorn 2015-03-21 15:25:32 +11:00
Sebastian McKenzie
2c39d406d1 move acorn into vendor 2015-03-18 19:01:30 +11:00
Sebastian McKenzie
ec526f9224 embed acorn 2015-03-17 02:44:05 +11:00
Sebastian McKenzie
339bd2b6d9 self-host #443 2015-02-25 22:36:23 +11:00
Sebastian McKenzie
b7f19221a9 fix rc json error message 2015-02-25 22:00:32 +11:00
Sebastian McKenzie
cfe2c19a02 fix linting errors 2015-02-25 21:57:49 +11:00
Sebastian McKenzie
5889233adc rejigger path traversal class for es6ification 2015-02-25 21:50:40 +11:00
Sebastian McKenzie
7bb98352df add .babelrc - fixes #351 2015-02-25 21:49:48 +11:00
Sebastian McKenzie
12ebeed7c6 add missing extension to umd-strict formatter... - fixes #890 2015-02-25 19:10:20 +11:00
Sebastian McKenzie
7d87e52377 rejigger strict directives transformer logic so they're included in the body before module formatters are ran - @jayphelps 2015-02-25 17:20:23 +11:00
Sebastian McKenzie
2bab285970 temporarily disable own binding identification in nameMethod helper - fixes #871 2015-02-25 11:07:51 +11:00
Sebastian McKenzie
b13aa41a75 fixing linting error 2015-02-24 22:15:27 +11:00
Sebastian McKenzie
bef315efd6 fix up JSXElement alias keys 2015-02-24 22:11:25 +11:00