65 Commits

Author SHA1 Message Date
Álvaro Mondéjar
b649f8d192
Fix packages documentation README links. (#12289) 2020-10-30 21:19:21 +01:00
Rodolfo Rodriguez
c6a4108e57 Update READMEs for yarn (#8215) [skip ci]
Closes https://github.com/babel/babel/pull/8255
2018-07-03 09:03:18 -04:00
Sven Sauleau
8f8b4e8e82 Switch new website in READMEs (#8181) [skip ci] 2018-06-15 10:13:20 -04:00
Alex Zherdev
8070a2204d Link to open issues in READMEs [skip ci] 2018-06-08 20:54:44 -07:00
Sven SAULEAU
8bbb10c021
chore: [skip ci] regen READMEs 2018-06-04 17:33:21 +02:00
Sven SAULEAU
b445b79734 Refactor move docs (#8108)
* feat: [skip] generate readme script

* docs: [skip ci] update READMEs

* docs: [skip ci] fix code block type

* chore: [skip ci] move generator script
2018-06-04 10:32:39 -04:00
Nicolò Ribaudo
b8dcd6f593
Remove parser support for decorators optional parentheses (#8037)
* Remove parser support for decorators optional parentheses

* Update fixtures
2018-06-02 13:07:15 +02:00
Sam Goldman
f0283572a5 Support Flow's proto modifier syntax for declared classes (#7978)
<!--
Before making a PR please make sure to read our contributing guidelines
https://github.com/babel/babel/blob/master/CONTRIBUTING.md

For issue references: Add a comma-separated list of a [closing word](https://help.github.com/articles/closing-issues-via-commit-messages/) followed by the ticket number fixed by the PR. It should be underlined in the preview if done correctly.
-->

| Q                        | A <!--(Can use an emoji 👍) -->
| ------------------------ | ---
| Fixed Issues?            | <!-- remove the (`) quotes to link the issues -->
| Patch: Bug Fix?          |
| Major: Breaking Change?  | No
| Minor: New Feature?      | Yes
| Tests Added + Pass?      | Yes
| Documentation PR         | <!-- If so, add `[skip ci]` to your commit message to skip CI -->
| Any Dependency Changes?  |
| License                  | MIT

See eb815be907 for more information about this feature.
    
The proto modifier indicates that a property declared using `x: T` syntax is actually present on the prototype object of the class, rather than an own property.
    
The proto and static modifiers are mutually exclusive, as class declarations don't simultaneously define the static prototype object, as they do the instance prototype.
    
This syntax is only supported on declared classes, not object types, interfaces, or runtime class declarations, and as such should only appear in library definitions.
2018-05-25 15:40:56 -05:00
Nicolò Ribaudo
dccaec7691 Update types (BigInt) 2018-05-24 00:30:57 +02:00
Nicolò Ribaudo
7d641d2e74
Update babel-types docs (InterpreterDirective) [skip ci] (#8004)
Introduced in #7928
2018-05-22 17:50:15 +02:00
Chaitanya Kumar Kamatham
daf0ca8680 Rename "babylon" to "@babel/parser" (#7937) 🎉 2018-05-19 00:03:05 -04:00
Ben Newman
70eb206c03 TypeScript: Fix TSInferType .typeParameter type. (#7967)
Follow-up to https://github.com/babel/babel/pull/7404

There is no TypeParameter type in the Babylon TypeScript AST hierarchy.
Flow does have a TypeParameter type, but it should not be confused with
the TypeScript TSTypeParameter, since Flow !== TypeScript, and the types
have totally different fields. Instead, the .typeParameter.type of a
Babylon-parsed TSInferType node should be TSTypeParameter.

It would probably be fine to leave the declared type of the TSInferType
.typeParameter field as TSType instead of TSTypeParameter, but the more
specific TSTypeParameter type should be safe/correct, since the TypeScript
parseInferType function always uses SyntaxKind.TypeParameter:
66d6e5e6e0/src/compiler/parser.ts (L3006)

I noticed this typo because it has been causing ast-types test failures
lately, e.g. https://travis-ci.org/benjamn/ast-types/jobs/369634972
2018-05-18 10:15:48 -05:00
Nicolò Ribaudo
229179b8aa Update babel-types (flow internal slots) (#7977) 2018-05-18 08:47:31 -05:00
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
Brian Ng
3299086955
Add support for flow implements (#7741) 2018-04-18 08:54:30 -05:00
Nicolò Ribaudo
341bdab90c Update decorators parsing (#7719)
* Update decorators parsing

This commit introduces three changes:
1) Class properties can be decorated
2) Decorators can contain arbitrary expressions, using @(...)
3) The Decorator node type has a new property, "arguments". This
    makes it possible do distinguish @dec() and @(dec()), which have
    different behaviors because @(dec()) is equivalent to @(dec())().

* Rename Decorator#expression to Decorator#callee

* Add test for @dec()()
2018-04-17 16:22:03 -05:00
Hendrik Niemann
fdd0789936 Fix literal type annotation argument number (#7706)
Added the value argument to the visitors of flow literal type
annotations.
Literal type annotations need a value since they work very much like
primitive literals in normal JavaScript.

Fixes #7697
2018-04-10 09:38:20 -04:00
Justin Ridgewell
43040a4181
Private Properties phase 1 (#7666)
* Private Properties phase 1

Co-authored-by: CodingItWrong

* Private fields are optional

* Docs update
2018-04-05 11:17:34 +01:00
unconfident
0200e6256a Allow StringLiteral to be used as ObjectTypeProperty.key (#7639) 2018-03-28 09:20:46 -05:00
Will Monk
0389035e15 Add exact Param To ObjectTypeAnnotations (#7535) 2018-03-09 19:22:01 +01:00
Logan Smyth
7ff4a73916
Upgrade flow to 0.66 and fix a few minor errors. (#7431) 2018-02-25 19:22:23 -08:00
Andy
6f6c8dabba TypeScript: Support conditional types syntax (#7404)
Microsoft/TypeScript#21316 and Microsoft/TypeScript#21496
2018-02-24 14:56:14 +01:00
Naveen jain
a3ad518ce1 [BugFix] : OptionalChaining Bug fixes (#7288)
* Added optionalExpression types to babylon and babel-types

* OptionalChain transforms bug fix

* Added OptionalExpressions to babel-generator. Fixed OptionalChain Bugs

* Removed 'optionalChain' from newExpression and added test cases

* Added test cases for optionalChain

* Update index.js
2018-02-07 19:42:14 -05: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
Boris Cherny
4208099f5b Add validators for Flow AST node fields (#7107) 2017-12-30 15:26:01 -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
Clement Hoang
1a7194a22f Add JSX Fragment syntax support (#6552)
* Add JSX Fragments to babel-types

* Support JSX fragments in the transform-react-jsx plugin

* Add tests JSX fragments

* Update helper-builder and transform plugin documentations for jsx fragment

* Add generator for jsx fragments

* Add test for jsx fragment generator

* Split jsx transform example into normal and fragment examples

* Remove unnecessary fields from ElementState in babel-helper-builder-react-jsx

* inline [skip ci]
2017-11-03 10:43:48 -04:00
Henry Zhu
96c380899b update types [skip ci] 2017-10-30 12:35:08 -04:00
Brian Ng
72d1a72122
Update babel-types docs and lib/types [skip ci] 2017-10-18 09:43:54 -05:00
Henry Zhu
c0a958098f Scoped: update readme headers to @babel/ [skip ci] 2017-10-16 22:49:57 -04:00
Brian Ng
645bf56838 Scoped: rename installation instructions for presets [skip ci] 2017-10-16 22:49:56 -04:00
Logan Smyth
7d6b15bba9 Regenerate types with scripts. 2017-10-08 22:31:31 -04:00
Henry Zhu
195745f25f update types readme [skip ci] 2017-09-26 11:06:03 -04:00
Henry Zhu
314bd31b85 update generator/babel-types printing, babylon (#6306)
* update generator printing, babylon [skip ci]

* Update babel-types for TS node types
2017-09-26 10:01:55 -04:00
Henry Zhu
1cdacf85ae update types readme [skip ci] 2017-09-11 23:04:12 -04:00
Andy
a74b307752 babel-types: Add missing field, fix incorrect definitions (#6083)
* babel-types: Add missing field, fix incorrect definitions

* Regenerate babel-types readme
2017-08-09 16:56:19 -04:00
Henry Zhu
d479673074 prepublish [skip ci] 2017-08-03 18:18:36 -04: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
Henry Zhu
2841945095 temporarily rename function-sent pkg to 2 (#6011) [skip ci]
* update readme [skip ci]

* rename to sent2 until we get the package [skip ci]
2017-07-25 17:30:31 -04:00
Brian Ng
9a1b8ea443 Add support for flow predicates in babel-generator (#5984) 2017-07-25 11:38:17 -04:00
Brian Ng
4710b8a5ba Update babel-types docs [skip ci] (#5941) 2017-07-11 22:20:43 -04:00
Sarup Banskota
003b8918c2 Fix typo in babel-types doc script + run it (#5855) 2017-07-06 16:19:51 -04:00
Henry Zhu
9e2ef0cf9e update types [skip ci] 2017-05-25 15:23:30 -04:00
Henry Zhu
67ed224df0 update babel-types readme [skip ci] 2017-03-02 15:58:12 -05:00
Daniel Tschinder
7c62278dcd [7.0] Change for-await to use new AST (#5321) 2017-02-15 17:29:09 -05: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