String import/export specifier (#12091)
* feat: parse moduleExportName * feat: add validators * Support string specifier name in commonjs transform * Support string specifier name in export-ns-from * test: add loose testcases * test: add testcases for amd and umd * feat: support systemjs * test: update fixtures fixed in #12110 * add plugin name typings * test: rename test layout * feat: implement under moduleStringNames flag * chore: add plugin syntax module string names * feat: support ModuleExportName as ModuleExportName * test: update test fixtures * fix flow errors * docs: update AST spec * feat: support { "some imports" as "some exports" } * feat: support { "some imports" as "some exports" } in systemjs * test: add test on `import { "foo" }` * Address review comments * add moduleStringNames to missing plugin helpers * Apply suggestions from code review * update test fixtures * Update packages/babel-parser/src/parser/error-message.js * update test fixtures Co-Authored-By: Kai Cataldo <kai@kaicataldo.com> Co-authored-by: Brian Ng <bng412@gmail.com>
This commit is contained in:
committed by
Nicolò Ribaudo
parent
1b90d90fcc
commit
21d7ee2610
@@ -0,0 +1 @@
|
||||
export { "some imports" as "some exports" } from "foo";
|
||||
@@ -0,0 +1,8 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["some exports"] = void 0;
|
||||
|
||||
var _foo = require("foo");
|
||||
|
||||
exports["some exports"] = _foo["some imports"];
|
||||
@@ -0,0 +1 @@
|
||||
export { "some exports" } from "foo";
|
||||
@@ -0,0 +1,8 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["some exports"] = void 0;
|
||||
|
||||
var _foo = require("foo");
|
||||
|
||||
exports["some exports"] = _foo["some exports"];
|
||||
@@ -0,0 +1 @@
|
||||
export { foo as "some exports" } from "foo";
|
||||
@@ -0,0 +1,8 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports["some exports"] = void 0;
|
||||
|
||||
var _foo = require("foo");
|
||||
|
||||
exports["some exports"] = _foo.foo;
|
||||
@@ -0,0 +1,2 @@
|
||||
var foo, bar;
|
||||
export {foo as "defaultExports", bar};
|
||||
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.bar = exports.defaultExports = void 0;
|
||||
var foo, bar;
|
||||
exports.bar = bar;
|
||||
exports.defaultExports = foo;
|
||||
@@ -0,0 +1,2 @@
|
||||
var foo, bar;
|
||||
export {foo as "default exports", bar};
|
||||
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.bar = exports["default exports"] = void 0;
|
||||
var foo, bar;
|
||||
exports.bar = bar;
|
||||
exports["default exports"] = foo;
|
||||
@@ -0,0 +1,3 @@
|
||||
import { "defaultImports" as bar} from "foo";
|
||||
|
||||
bar;
|
||||
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
var _foo = require("foo");
|
||||
|
||||
_foo.defaultImports;
|
||||
@@ -0,0 +1,3 @@
|
||||
import {"default imports" as bar} from "foo";
|
||||
|
||||
bar;
|
||||
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
var _foo = require("foo");
|
||||
|
||||
_foo["default imports"];
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"plugins": [
|
||||
"external-helpers",
|
||||
["transform-modules-commonjs", { "loose": true }],
|
||||
"syntax-module-string-names"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export { "some imports" as "some exports" } from "foo";
|
||||
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "some exports", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _foo["some imports"];
|
||||
}
|
||||
});
|
||||
|
||||
var _foo = require("foo");
|
||||
@@ -0,0 +1 @@
|
||||
export { "some exports" } from "foo";
|
||||
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "some exports", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _foo["some exports"];
|
||||
}
|
||||
});
|
||||
|
||||
var _foo = require("foo");
|
||||
@@ -0,0 +1 @@
|
||||
export { foo as "some exports" } from "foo";
|
||||
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "some exports", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _foo.foo;
|
||||
}
|
||||
});
|
||||
|
||||
var _foo = require("foo");
|
||||
@@ -0,0 +1,2 @@
|
||||
var foo, bar;
|
||||
export {foo as "defaultExports", bar};
|
||||
@@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.bar = exports.defaultExports = void 0;
|
||||
var foo, bar;
|
||||
exports.bar = bar;
|
||||
exports.defaultExports = foo;
|
||||
@@ -0,0 +1,2 @@
|
||||
var foo, bar;
|
||||
export {foo as "default exports", bar};
|
||||
@@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.bar = exports["default exports"] = void 0;
|
||||
var foo, bar;
|
||||
exports.bar = bar;
|
||||
exports["default exports"] = foo;
|
||||
@@ -0,0 +1,3 @@
|
||||
import { "defaultImports" as bar} from "foo";
|
||||
|
||||
bar;
|
||||
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
var _foo = require("foo");
|
||||
|
||||
_foo.defaultImports;
|
||||
@@ -0,0 +1,3 @@
|
||||
import {"default imports" as bar} from "foo";
|
||||
|
||||
bar;
|
||||
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
var _foo = require("foo");
|
||||
|
||||
_foo["default imports"];
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"plugins": [
|
||||
"external-helpers",
|
||||
"transform-modules-commonjs",
|
||||
"syntax-module-string-names"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user