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,10 @@
|
||||
System.register(["foo"], function (_export, _context) {
|
||||
"use strict";
|
||||
|
||||
return {
|
||||
setters: [function (_foo) {
|
||||
_export("some exports", _foo["some imports"]);
|
||||
}],
|
||||
execute: function () {}
|
||||
};
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
export { "some exports" } from "foo";
|
||||
@@ -0,0 +1,10 @@
|
||||
System.register(["foo"], function (_export, _context) {
|
||||
"use strict";
|
||||
|
||||
return {
|
||||
setters: [function (_foo) {
|
||||
_export("some exports", _foo["some exports"]);
|
||||
}],
|
||||
execute: function () {}
|
||||
};
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
export { foo as "some exports" } from "foo";
|
||||
@@ -0,0 +1,10 @@
|
||||
System.register(["foo"], function (_export, _context) {
|
||||
"use strict";
|
||||
|
||||
return {
|
||||
setters: [function (_foo) {
|
||||
_export("some exports", _foo.foo);
|
||||
}],
|
||||
execute: function () {}
|
||||
};
|
||||
});
|
||||
@@ -0,0 +1,2 @@
|
||||
var foo, bar;
|
||||
export {foo as "defaultExports", bar};
|
||||
@@ -0,0 +1,15 @@
|
||||
System.register([], function (_export, _context) {
|
||||
"use strict";
|
||||
|
||||
var foo, bar;
|
||||
|
||||
_export({
|
||||
defaultExports: void 0,
|
||||
bar: void 0
|
||||
});
|
||||
|
||||
return {
|
||||
setters: [],
|
||||
execute: function () {}
|
||||
};
|
||||
});
|
||||
@@ -0,0 +1,2 @@
|
||||
var foo, bar;
|
||||
export {foo as "default exports", bar};
|
||||
@@ -0,0 +1,15 @@
|
||||
System.register([], function (_export, _context) {
|
||||
"use strict";
|
||||
|
||||
var foo, bar;
|
||||
|
||||
_export({
|
||||
"default exports": void 0,
|
||||
bar: void 0
|
||||
});
|
||||
|
||||
return {
|
||||
setters: [],
|
||||
execute: function () {}
|
||||
};
|
||||
});
|
||||
@@ -0,0 +1,3 @@
|
||||
import { "defaultImports" as bar} from "foo";
|
||||
|
||||
bar;
|
||||
@@ -0,0 +1,13 @@
|
||||
System.register(["foo"], function (_export, _context) {
|
||||
"use strict";
|
||||
|
||||
var bar;
|
||||
return {
|
||||
setters: [function (_foo) {
|
||||
bar = _foo["defaultImports"];
|
||||
}],
|
||||
execute: function () {
|
||||
bar;
|
||||
}
|
||||
};
|
||||
});
|
||||
@@ -0,0 +1,3 @@
|
||||
import {"default imports" as bar} from "foo";
|
||||
|
||||
bar;
|
||||
@@ -0,0 +1,13 @@
|
||||
System.register(["foo"], function (_export, _context) {
|
||||
"use strict";
|
||||
|
||||
var bar;
|
||||
return {
|
||||
setters: [function (_foo) {
|
||||
bar = _foo["default imports"];
|
||||
}],
|
||||
execute: function () {
|
||||
bar;
|
||||
}
|
||||
};
|
||||
});
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"plugins": [
|
||||
"external-helpers",
|
||||
"transform-modules-systemjs",
|
||||
"syntax-module-string-names"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user