Split exportExtensions into exportDefault and exportNamespace plugins… (#6920)
* 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
This commit is contained in:
parent
9d9710c765
commit
d8bbaaae0a
@ -1 +1 @@
|
||||
{ "plugins": ["exportExtensions"] }
|
||||
{ "plugins": ["exportNamespaceFrom"] }
|
||||
|
||||
@ -1 +1 @@
|
||||
{ "plugins": ["exportExtensions"] }
|
||||
{ "plugins": ["exportNamespaceFrom"] }
|
||||
|
||||
@ -1 +1 @@
|
||||
{ "plugins": ["exportExtensions"] }
|
||||
{ "plugins": ["exportDefaultFrom"] }
|
||||
|
||||
@ -1 +1 @@
|
||||
{ "plugins": ["exportExtensions"] }
|
||||
{ "plugins": ["exportNamespaceFrom"] }
|
||||
|
||||
@ -1 +1 @@
|
||||
{ "plugins": ["exportExtensions"] }
|
||||
{ "plugins": ["exportDefaultFrom"] }
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"plugins": ["exportExtensions", "typescript"]
|
||||
"plugins": ["exportDefaultFrom", "typescript"]
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
# @babel/plugin-proposal-export-default
|
||||
# @babel/plugin-proposal-export-default-from
|
||||
|
||||
> Compile export-default-from statements to ES2015
|
||||
|
||||
@ -11,7 +11,7 @@ export v from 'mod';
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/plugin-proposal-export-default
|
||||
npm install --save-dev @babel/plugin-proposal-export-default-from
|
||||
```
|
||||
|
||||
## Usage
|
||||
@ -22,21 +22,21 @@ npm install --save-dev @babel/plugin-proposal-export-default
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["@babel/plugin-proposal-export-default"]
|
||||
"plugins": ["@babel/plugin-proposal-export-default-from"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins @babel/plugin-proposal-export-default script.js
|
||||
babel --plugins @babel/plugin-proposal-export-default-from script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["@babel/plugin-proposal-export-default"]
|
||||
plugins: ["@babel/plugin-proposal-export-default-from"]
|
||||
});
|
||||
```
|
||||
## References
|
||||
@ -1,15 +1,15 @@
|
||||
{
|
||||
"name": "@babel/plugin-proposal-export-default",
|
||||
"name": "@babel/plugin-proposal-export-default-from",
|
||||
"version": "7.0.0-beta.32",
|
||||
"description": "Compile export default to ES2015",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-export-default",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-export-default-from",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"keywords": [
|
||||
"babel-plugin"
|
||||
],
|
||||
"dependencies": {
|
||||
"@babel/plugin-syntax-export-extensions": "7.0.0-beta.32"
|
||||
"@babel/plugin-syntax-export-default-from": "7.0.0-beta.32"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": "7.0.0-beta.32"
|
||||
@ -1,9 +1,9 @@
|
||||
import syntaxExportExtensions from "@babel/plugin-syntax-export-extensions";
|
||||
import syntaxExportDefaultFrom from "@babel/plugin-syntax-export-default-from";
|
||||
import { types as t } from "@babel/core";
|
||||
|
||||
export default function() {
|
||||
return {
|
||||
inherits: syntaxExportExtensions,
|
||||
inherits: syntaxExportDefaultFrom,
|
||||
|
||||
visitor: {
|
||||
ExportNamedDeclaration(path) {
|
||||
3
packages/babel-plugin-proposal-export-default-from/test/fixtures/export-default/options.json
vendored
Normal file
3
packages/babel-plugin-proposal-export-default-from/test/fixtures/export-default/options.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["external-helpers", "proposal-export-default-from"]
|
||||
}
|
||||
@ -1 +0,0 @@
|
||||
export v, * as all from "mod";
|
||||
@ -1,3 +0,0 @@
|
||||
import _v from "mod";
|
||||
export { _v as v };
|
||||
export * as all from "mod";
|
||||
@ -1 +0,0 @@
|
||||
export * as foo from "bar";
|
||||
@ -1,3 +0,0 @@
|
||||
{
|
||||
"plugins": ["external-helpers", "proposal-export-default"]
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
# @babel/plugin-proposal-export-namespace
|
||||
# @babel/plugin-proposal-export-namespace-from
|
||||
|
||||
> Compile export-ns-from statements to ES2015
|
||||
|
||||
@ -11,7 +11,7 @@ export * as ns from 'mod';
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/plugin-proposal-export-namespace
|
||||
npm install --save-dev @babel/plugin-proposal-export-namespace-from
|
||||
```
|
||||
|
||||
## Usage
|
||||
@ -22,21 +22,21 @@ npm install --save-dev @babel/plugin-proposal-export-namespace
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["@babel/plugin-proposal-export-namespace"]
|
||||
"plugins": ["@babel/plugin-proposal-export-namespace-from"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins @babel/plugin-proposal-export-namespace script.js
|
||||
babel --plugins @babel/plugin-proposal-export-namespace-from script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["@babel/plugin-proposal-export-namespace"]
|
||||
plugins: ["@babel/plugin-proposal-export-namespace-from"]
|
||||
});
|
||||
```
|
||||
## References
|
||||
@ -1,15 +1,15 @@
|
||||
{
|
||||
"name": "@babel/plugin-proposal-export-namespace",
|
||||
"name": "@babel/plugin-proposal-export-namespace-from",
|
||||
"version": "7.0.0-beta.32",
|
||||
"description": "Compile export namespace to ES2015",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-export-namespace",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-export-namespace-from",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"keywords": [
|
||||
"babel-plugin"
|
||||
],
|
||||
"dependencies": {
|
||||
"@babel/plugin-syntax-export-extensions": "7.0.0-beta.32"
|
||||
"@babel/plugin-syntax-export-namespace-from": "7.0.0-beta.32"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": "7.0.0-beta.32"
|
||||
@ -1,9 +1,9 @@
|
||||
import syntaxExportExtensions from "@babel/plugin-syntax-export-extensions";
|
||||
import syntaxExportNamespaceFrom from "@babel/plugin-syntax-export-namespace-from";
|
||||
import { types as t } from "@babel/core";
|
||||
|
||||
export default function() {
|
||||
return {
|
||||
inherits: syntaxExportExtensions,
|
||||
inherits: syntaxExportNamespaceFrom,
|
||||
|
||||
visitor: {
|
||||
ExportNamedDeclaration(path) {
|
||||
@ -0,0 +1 @@
|
||||
export * as foo, { bar } from "bar";
|
||||
@ -0,0 +1,3 @@
|
||||
import * as _foo from "bar";
|
||||
export { _foo as foo };
|
||||
export { bar } from "bar";
|
||||
@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["external-helpers", "proposal-export-namespace-from"]
|
||||
}
|
||||
@ -1 +0,0 @@
|
||||
export foo from "bar";
|
||||
@ -1 +0,0 @@
|
||||
export foo from "bar";
|
||||
@ -1 +0,0 @@
|
||||
export v, * as ns from "mod";
|
||||
@ -1,3 +0,0 @@
|
||||
export v from "mod";
|
||||
import * as _ns from "mod";
|
||||
export { _ns as ns };
|
||||
@ -1 +0,0 @@
|
||||
export * as foo from "bar";
|
||||
@ -1,3 +0,0 @@
|
||||
{
|
||||
"plugins": ["external-helpers", "proposal-export-namespace"]
|
||||
}
|
||||
35
packages/babel-plugin-syntax-export-default-from/README.md
Normal file
35
packages/babel-plugin-syntax-export-default-from/README.md
Normal file
@ -0,0 +1,35 @@
|
||||
# @babel/plugin-syntax-export-default-from
|
||||
|
||||
> Allow parsing of `export default from`.
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/plugin-syntax-export-default-from
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Via `.babelrc` (Recommended)
|
||||
|
||||
**.babelrc**
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["@babel/plugin-syntax-export-default-from"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins @babel/plugin-syntax-export-default-from script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["@babel/plugin-syntax-export-default-from"]
|
||||
});
|
||||
```
|
||||
@ -1,8 +1,8 @@
|
||||
{
|
||||
"name": "@babel/plugin-syntax-export-extensions",
|
||||
"name": "@babel/plugin-syntax-export-default-from",
|
||||
"version": "7.0.0-beta.32",
|
||||
"description": "Allow parsing of export extensions",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-export-extensions",
|
||||
"description": "Allow parsing of export default from",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-export-default-from",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"keywords": [
|
||||
@ -1,7 +1,7 @@
|
||||
export default function() {
|
||||
return {
|
||||
manipulateOptions(opts, parserOpts) {
|
||||
parserOpts.plugins.push("exportExtensions");
|
||||
parserOpts.plugins.push("exportDefaultFrom");
|
||||
},
|
||||
};
|
||||
}
|
||||
@ -1,35 +0,0 @@
|
||||
# @babel/plugin-syntax-export-extensions
|
||||
|
||||
> Allow parsing of export extensions.
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/plugin-syntax-export-extensions
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Via `.babelrc` (Recommended)
|
||||
|
||||
**.babelrc**
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["@babel/plugin-syntax-export-extensions"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins @babel/plugin-syntax-export-extensions script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["@babel/plugin-syntax-export-extensions"]
|
||||
});
|
||||
```
|
||||
@ -0,0 +1,3 @@
|
||||
src
|
||||
test
|
||||
*.log
|
||||
35
packages/babel-plugin-syntax-export-namespace-from/README.md
Normal file
35
packages/babel-plugin-syntax-export-namespace-from/README.md
Normal file
@ -0,0 +1,35 @@
|
||||
# @babel/plugin-syntax-export-namespace-from
|
||||
|
||||
> Allow parsing of `export * as namespace from`.
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/plugin-syntax-export-namespace-from
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Via `.babelrc` (Recommended)
|
||||
|
||||
**.babelrc**
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["@babel/plugin-syntax-export-namespace-from"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins @babel/plugin-syntax-export-namespace-from script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["@babel/plugin-syntax-export-namespace-from"]
|
||||
});
|
||||
```
|
||||
@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "@babel/plugin-syntax-export-namespace-from",
|
||||
"version": "7.0.0-beta.32",
|
||||
"description": "Allow parsing of export namespace from",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-export-namespace-from",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"keywords": [
|
||||
"babel-plugin"
|
||||
],
|
||||
"peerDependencies": {
|
||||
"@babel/core": "7.0.0-beta.32"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "7.0.0-beta.32"
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
export default function() {
|
||||
return {
|
||||
manipulateOptions(opts, parserOpts) {
|
||||
parserOpts.plugins.push("exportNamespaceFrom");
|
||||
},
|
||||
};
|
||||
}
|
||||
@ -16,6 +16,8 @@
|
||||
"@babel/plugin-proposal-class-properties": "7.0.0-beta.32",
|
||||
"@babel/plugin-proposal-decorators": "7.0.0-beta.32",
|
||||
"@babel/plugin-proposal-do-expressions": "7.0.0-beta.32",
|
||||
"@babel/plugin-proposal-export-default-from": "7.0.0-beta.32",
|
||||
"@babel/plugin-proposal-export-namespace-from": "7.0.0-beta.32",
|
||||
"@babel/plugin-proposal-function-bind": "7.0.0-beta.32",
|
||||
"@babel/plugin-proposal-object-rest-spread": "7.0.0-beta.32",
|
||||
"@babel/plugin-proposal-optional-catch-binding": "7.0.0-beta.32",
|
||||
@ -25,7 +27,8 @@
|
||||
"@babel/plugin-syntax-decorators": "7.0.0-beta.32",
|
||||
"@babel/plugin-syntax-do-expressions": "7.0.0-beta.32",
|
||||
"@babel/plugin-syntax-dynamic-import": "7.0.0-beta.32",
|
||||
"@babel/plugin-syntax-export-extensions": "7.0.0-beta.32",
|
||||
"@babel/plugin-syntax-export-default-from": "7.0.0-beta.32",
|
||||
"@babel/plugin-syntax-export-namespace-from": "7.0.0-beta.32",
|
||||
"@babel/plugin-syntax-flow": "7.0.0-beta.32",
|
||||
"@babel/plugin-syntax-function-bind": "7.0.0-beta.32",
|
||||
"@babel/plugin-syntax-function-sent": "7.0.0-beta.32",
|
||||
|
||||
@ -147,7 +147,8 @@ registerPlugins({
|
||||
"syntax-decorators": require("@babel/plugin-syntax-decorators"),
|
||||
"syntax-do-expressions": require("@babel/plugin-syntax-do-expressions"),
|
||||
"syntax-dynamic-import": require("@babel/plugin-syntax-dynamic-import"),
|
||||
"syntax-export-extensions": require("@babel/plugin-syntax-export-extensions"),
|
||||
"syntax-export-default-from": require("@babel/plugin-syntax-export-default-from"),
|
||||
"syntax-export-namespace-from": require("@babel/plugin-syntax-export-namespace-from"),
|
||||
"syntax-flow": require("@babel/plugin-syntax-flow"),
|
||||
"syntax-function-bind": require("@babel/plugin-syntax-function-bind"),
|
||||
"syntax-function-sent": require("@babel/plugin-syntax-function-sent"),
|
||||
@ -158,6 +159,8 @@ registerPlugins({
|
||||
"proposal-class-properties": require("@babel/plugin-proposal-class-properties"),
|
||||
"proposal-decorators": require("@babel/plugin-proposal-decorators"),
|
||||
"proposal-do-expressions": require("@babel/plugin-proposal-do-expressions"),
|
||||
"proposal-export-default-from": require("@babel/plugin-proposal-export-default-from"),
|
||||
"proposal-export-namespace-from": require("@babel/plugin-proposal-export-namespace-from"),
|
||||
"transform-arrow-functions": require("@babel/plugin-transform-arrow-functions"),
|
||||
"transform-block-scoped-functions": require("@babel/plugin-transform-block-scoped-functions"),
|
||||
"transform-block-scoping": require("@babel/plugin-transform-block-scoping"),
|
||||
|
||||
@ -1310,12 +1310,10 @@ export default class StatementParser extends ExpressionParser {
|
||||
parseExport(node: N.Node): N.Node {
|
||||
// export * from '...'
|
||||
if (this.shouldParseExportStar()) {
|
||||
this.parseExportStar(node, this.hasPlugin("exportExtensions"));
|
||||
this.parseExportStar(node);
|
||||
if (node.type === "ExportAllDeclaration") return node;
|
||||
} else if (
|
||||
this.hasPlugin("exportExtensions") &&
|
||||
this.isExportDefaultSpecifier()
|
||||
) {
|
||||
} else if (this.isExportDefaultSpecifier()) {
|
||||
this.expectPlugin("exportDefaultFrom");
|
||||
const specifier = this.startNode();
|
||||
specifier.exported = this.parseIdentifier(true);
|
||||
const specifiers = [this.finishNode(specifier, "ExportDefaultSpecifier")];
|
||||
@ -1426,27 +1424,35 @@ export default class StatementParser extends ExpressionParser {
|
||||
return this.match(tt.star);
|
||||
}
|
||||
|
||||
parseExportStar(node: N.ExportNamedDeclaration, allowNamed: boolean): void {
|
||||
parseExportStar(node: N.ExportNamedDeclaration): void {
|
||||
this.expect(tt.star);
|
||||
|
||||
if (allowNamed && this.isContextual("as")) {
|
||||
const specifier = this.startNodeAt(
|
||||
this.state.lastTokStart,
|
||||
this.state.lastTokStartLoc,
|
||||
);
|
||||
this.next();
|
||||
specifier.exported = this.parseIdentifier(true);
|
||||
node.specifiers = [
|
||||
this.finishNode(specifier, "ExportNamespaceSpecifier"),
|
||||
];
|
||||
this.parseExportSpecifiersMaybe(node);
|
||||
this.parseExportFrom(node, true);
|
||||
if (this.isContextual("as")) {
|
||||
this.parseExportNamespace(node);
|
||||
} else {
|
||||
this.parseExportFrom(node, true);
|
||||
this.finishNode(node, "ExportAllDeclaration");
|
||||
}
|
||||
}
|
||||
|
||||
parseExportNamespace(node: N.ExportNamedDeclaration): void {
|
||||
this.expectPlugin("exportNamespaceFrom");
|
||||
|
||||
const specifier = this.startNodeAt(
|
||||
this.state.lastTokStart,
|
||||
this.state.lastTokStartLoc,
|
||||
);
|
||||
|
||||
this.next();
|
||||
|
||||
specifier.exported = this.parseIdentifier(true);
|
||||
|
||||
node.specifiers = [this.finishNode(specifier, "ExportNamespaceSpecifier")];
|
||||
|
||||
this.parseExportSpecifiersMaybe(node);
|
||||
this.parseExportFrom(node, true);
|
||||
}
|
||||
|
||||
shouldParseExportDeclaration(): boolean {
|
||||
return (
|
||||
this.state.type.keyword === "var" ||
|
||||
|
||||
@ -1585,13 +1585,20 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
);
|
||||
}
|
||||
|
||||
parseExportStar(node: N.ExportNamedDeclaration, allowNamed: boolean): void {
|
||||
parseExportStar(node: N.ExportNamedDeclaration): void {
|
||||
if (this.eatContextual("type")) {
|
||||
node.exportKind = "type";
|
||||
allowNamed = false;
|
||||
}
|
||||
|
||||
return super.parseExportStar(node, allowNamed);
|
||||
return super.parseExportStar(node);
|
||||
}
|
||||
|
||||
parseExportNamespace(node: N.ExportNamedDeclaration) {
|
||||
if (node.exportKind === "type") {
|
||||
this.unexpected();
|
||||
}
|
||||
|
||||
return super.parseExportNamespace(node);
|
||||
}
|
||||
|
||||
parseClassId(node: N.Class, isStatement: boolean, optionalId: ?boolean) {
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "Unexpected token, expected \";\" (1:20)"
|
||||
"throws": "This experimental syntax requires enabling the parser plugin: 'exportDefaultFrom' (1:7)"
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
{
|
||||
"throws": "This experimental syntax requires enabling the parser plugin: 'exportExtensions' (1:1)",
|
||||
"throws": "This experimental syntax requires enabling the parser plugin: 'exportDefaultFrom' (1:7)",
|
||||
"plugins": []
|
||||
}
|
||||
1
packages/babylon/test/fixtures/experimental/_no-plugin/export-namespace/actual.js
vendored
Normal file
1
packages/babylon/test/fixtures/experimental/_no-plugin/export-namespace/actual.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
export * as A from 'test';
|
||||
4
packages/babylon/test/fixtures/experimental/_no-plugin/export-namespace/options.json
vendored
Normal file
4
packages/babylon/test/fixtures/experimental/_no-plugin/export-namespace/options.json
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"throws": "This experimental syntax requires enabling the parser plugin: 'exportNamespaceFrom' (1:9)",
|
||||
"plugins": []
|
||||
}
|
||||
4
packages/babylon/test/fixtures/experimental/export-extensions/default-and-named/options.json
vendored
Normal file
4
packages/babylon/test/fixtures/experimental/export-extensions/default-and-named/options.json
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"sourceType": "module",
|
||||
"plugins": ["exportDefaultFrom"]
|
||||
}
|
||||
4
packages/babylon/test/fixtures/experimental/export-extensions/default-and-ns/options.json
vendored
Normal file
4
packages/babylon/test/fixtures/experimental/export-extensions/default-and-ns/options.json
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": ["exportDefaultFrom", "exportNamespaceFrom"],
|
||||
"sourceType": "module"
|
||||
}
|
||||
4
packages/babylon/test/fixtures/experimental/export-extensions/default-default/options.json
vendored
Normal file
4
packages/babylon/test/fixtures/experimental/export-extensions/default-default/options.json
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"sourceType": "module",
|
||||
"plugins": ["exportDefaultFrom"]
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
{
|
||||
"plugins": ["exportExtensions", "flow"],
|
||||
"plugins": ["exportDefaultFrom", "flow"],
|
||||
"sourceType": "module",
|
||||
"throws": "Unexpected token, expected \"=\" (1:17)"
|
||||
}
|
||||
|
||||
@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": ["exportDefaultFrom"],
|
||||
"sourceType": "module"
|
||||
}
|
||||
4
packages/babylon/test/fixtures/experimental/export-extensions/default/options.json
vendored
Normal file
4
packages/babylon/test/fixtures/experimental/export-extensions/default/options.json
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": ["exportDefaultFrom"],
|
||||
"sourceType": "module"
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
{
|
||||
"plugins": ["exportExtensions", "typescript"],
|
||||
"plugins": ["exportDefaultFrom", "typescript"],
|
||||
"sourceType": "module"
|
||||
}
|
||||
|
||||
4
packages/babylon/test/fixtures/experimental/export-extensions/ns-and-named/options.json
vendored
Normal file
4
packages/babylon/test/fixtures/experimental/export-extensions/ns-and-named/options.json
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"sourceType": "module",
|
||||
"plugins": ["exportNamespaceFrom"]
|
||||
}
|
||||
4
packages/babylon/test/fixtures/experimental/export-extensions/ns-default/options.json
vendored
Normal file
4
packages/babylon/test/fixtures/experimental/export-extensions/ns-default/options.json
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": ["exportNamespaceFrom"],
|
||||
"sourceType": "module"
|
||||
}
|
||||
4
packages/babylon/test/fixtures/experimental/export-extensions/ns/options.json
vendored
Normal file
4
packages/babylon/test/fixtures/experimental/export-extensions/ns/options.json
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": ["exportNamespaceFrom"],
|
||||
"sourceType": "module"
|
||||
}
|
||||
@ -1,4 +0,0 @@
|
||||
{
|
||||
"plugins": ["exportExtensions"],
|
||||
"sourceType": "module"
|
||||
}
|
||||
@ -1,4 +0,0 @@
|
||||
{
|
||||
"sourceType": "module",
|
||||
"plugins": ["exportExtensions"]
|
||||
}
|
||||
@ -1,4 +0,0 @@
|
||||
{
|
||||
"sourceType": "module",
|
||||
"plugins": ["exportExtensions"]
|
||||
}
|
||||
@ -1 +0,0 @@
|
||||
export foo from "bar";
|
||||
@ -1,103 +0,0 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 22,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 22
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 22,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 22
|
||||
}
|
||||
},
|
||||
"sourceType": "module",
|
||||
"body": [
|
||||
{
|
||||
"type": "ExportNamedDeclaration",
|
||||
"start": 0,
|
||||
"end": 22,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 22
|
||||
}
|
||||
},
|
||||
"specifiers": [
|
||||
{
|
||||
"type": "ExportDefaultSpecifier",
|
||||
"start": 7,
|
||||
"end": 10,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 7
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 10
|
||||
}
|
||||
},
|
||||
"exported": {
|
||||
"type": "Identifier",
|
||||
"start": 7,
|
||||
"end": 10,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 7
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 10
|
||||
},
|
||||
"identifierName": "foo"
|
||||
},
|
||||
"name": "foo"
|
||||
}
|
||||
}
|
||||
],
|
||||
"source": {
|
||||
"type": "StringLiteral",
|
||||
"start": 16,
|
||||
"end": 21,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 16
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 21
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": "bar",
|
||||
"raw": "\"bar\""
|
||||
},
|
||||
"value": "bar"
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@ -1,4 +0,0 @@
|
||||
{
|
||||
"sourceType": "module",
|
||||
"plugins": ["exportExtensions"]
|
||||
}
|
||||
@ -1,4 +0,0 @@
|
||||
{
|
||||
"sourceType": "module",
|
||||
"plugins": ["exportExtensions"]
|
||||
}
|
||||
@ -1 +0,0 @@
|
||||
export * as foo from "bar";
|
||||
@ -1,103 +0,0 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 27,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 27
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 27,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 27
|
||||
}
|
||||
},
|
||||
"sourceType": "module",
|
||||
"body": [
|
||||
{
|
||||
"type": "ExportNamedDeclaration",
|
||||
"start": 0,
|
||||
"end": 27,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 27
|
||||
}
|
||||
},
|
||||
"specifiers": [
|
||||
{
|
||||
"type": "ExportNamespaceSpecifier",
|
||||
"start": 7,
|
||||
"end": 15,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 7
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 15
|
||||
}
|
||||
},
|
||||
"exported": {
|
||||
"type": "Identifier",
|
||||
"start": 12,
|
||||
"end": 15,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 12
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 15
|
||||
},
|
||||
"identifierName": "foo"
|
||||
},
|
||||
"name": "foo"
|
||||
}
|
||||
}
|
||||
],
|
||||
"source": {
|
||||
"type": "StringLiteral",
|
||||
"start": 21,
|
||||
"end": 26,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 21
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 26
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": "bar",
|
||||
"raw": "\"bar\""
|
||||
},
|
||||
"value": "bar"
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
@ -1,4 +0,0 @@
|
||||
{
|
||||
"sourceType": "module",
|
||||
"plugins": ["exportExtensions"]
|
||||
}
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"plugins": ["jsx", "flow", "exportExtensions"]
|
||||
"plugins": ["jsx", "flow", "exportNamespaceFrom"]
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
{
|
||||
"sourceType": "module",
|
||||
"plugins": ["flow","exportExtensions"],
|
||||
"plugins": ["flow", "exportNamespaceFrom"],
|
||||
"throws": "Unexpected token (1:14)"
|
||||
}
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"plugins": ["exportExtensions", "typescript"]
|
||||
"plugins": ["exportDefaultFrom", "typescript"]
|
||||
}
|
||||
|
||||
@ -107,7 +107,7 @@ const options = {
|
||||
const flowOptionsMapping = {
|
||||
esproposal_class_instance_fields: "classProperties",
|
||||
esproposal_class_static_fields: "classProperties",
|
||||
esproposal_export_star_as: "exportExtensions",
|
||||
esproposal_export_star_as: "exportNamespaceFrom",
|
||||
esproposal_decorators: "decorators",
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user