* 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
* 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
* Update test262 and whitelist
* Use test262-stream
* Check escapes in contextual keywords
* Check escapes when parsing new.target
* Check escapes for getters/setters
* Check escapes for static class methods
* Check escapes on async arrow and functions
* 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
* Split exportExtensions into two plugins in babylon
* rename proposal-export-default to proposal-export-default-from
* rename proposal-export-namespace to proposal-export-namespace-from
* Move babel-standalone into main Babel repo
* Don't try to gather coverage data for babel-standalone test
* Fix JSX test
* Always use npm v4 on Travis
* Include pull request number as part of version number
* Cherry-picking 5721b2e43e
Remove deprecated packages to prevent Babel v6 files from being pulled in
* Use RootMostResolvePlugin to dedupe packages
* Avoid destructuring so the build works on archaic Node.js versions
* - Fix version number
- Remove Babili packages (they should be in separate babili-standalone)
- Remove deprecated syntax-class-constructor-call
* - Remove more Babili packages
- Remove `babel-plugin-inline-replace-variables` for now as it pulls in Babel 6 stuff
* Actually remove reference to babel-plugin-undeclared-variables-check
* Add Babylon to root package.json so we hoist the right version. This fixes the tests.