Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create @babel/plugin-proposal-dynamic-import (#9552)
* Create @babel/plugin-proposal-dynamic-import * Use airbnb/babel-plugin-dynamic-import-node Do not duplicate code, which will unavoidably lead to bugs being fixed in one plugin and not in the other. * Update error message * Add error callback to amd interop * Update babel-plugin-dynamic-import-node
- Loading branch information
1 parent
a4170b5
commit 38f8bba
Showing
61 changed files
with
406 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
src | ||
test | ||
*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# @babel/plugin-proposal-dynamic-import | ||
|
||
> Transform import() expressions | ||
See our website [@babel/plugin-proposal-dynamic-import](https://babeljs.io/docs/en/next/babel-plugin-proposal-dynamic-import.html) for more information. | ||
|
||
## Install | ||
|
||
Using npm: | ||
|
||
```sh | ||
npm install --save-dev @babel/plugin-proposal-dynamic-import | ||
``` | ||
|
||
or using yarn: | ||
|
||
```sh | ||
yarn add @babel/plugin-proposal-dynamic-import --dev | ||
``` |
25 changes: 25 additions & 0 deletions
25
packages/babel-plugin-proposal-dynamic-import/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"name": "@babel/plugin-proposal-dynamic-import", | ||
"version": "7.4.0", | ||
"description": "Transform import() expressions", | ||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-dynamic-import", | ||
"license": "MIT", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"main": "lib/index.js", | ||
"keywords": [ | ||
"babel-plugin" | ||
], | ||
"dependencies": { | ||
"@babel/helper-plugin-utils": "^7.0.0", | ||
"@babel/plugin-syntax-dynamic-import": "^7.2.0" | ||
}, | ||
"peerDependencies": { | ||
"@babel/core": "^7.0.0-0" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.2.0", | ||
"@babel/helper-plugin-test-runner": "^7.0.0" | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
packages/babel-plugin-proposal-dynamic-import/src/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { declare } from "@babel/helper-plugin-utils"; | ||
import syntaxDynamicImport from "@babel/plugin-syntax-dynamic-import"; | ||
import { version } from "../package.json"; | ||
|
||
const SUPPORTED_MODULES = ["commonjs", "amd", "systemjs"]; | ||
|
||
const MODULES_NOT_FOUND = `\ | ||
@babel/plugin-proposal-dynamic-import depends on a modules | ||
transform plugin. Supported plugins are: | ||
- @babel/plugin-transform-modules-commonjs ^7.4.0 | ||
- @babel/plugin-transform-modules-amd ^7.4.0 | ||
- @babel/plugin-transform-modules-systemjs ^7.4.0 | ||
If you are using Webpack or Rollup and thus don't want | ||
Babel to transpile your imports and exports, you can use | ||
the @babel/plugin-syntax-dynamic-import plugin and let your | ||
bundler handle dynamic imports. | ||
`; | ||
|
||
export default declare(api => { | ||
api.assertVersion(7); | ||
|
||
return { | ||
name: "proposal-dynamic-import", | ||
inherits: syntaxDynamicImport, | ||
|
||
pre() { | ||
this.file.set("@babel/plugin-proposal-dynamic-import", version); | ||
}, | ||
|
||
visitor: { | ||
Program() { | ||
const modules = this.file.get("@babel/plugin-transform-modules-*"); | ||
|
||
if (!SUPPORTED_MODULES.includes(modules)) { | ||
throw new Error(MODULES_NOT_FOUND); | ||
} | ||
}, | ||
}, | ||
}; | ||
}); |
3 changes: 3 additions & 0 deletions
3
packages/babel-plugin-proposal-dynamic-import/test/fixtures/amd/missing-plugin/input.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import "a"; | ||
|
||
import("b"); |
7 changes: 7 additions & 0 deletions
7
packages/babel-plugin-proposal-dynamic-import/test/fixtures/amd/missing-plugin/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"plugins": [ | ||
"syntax-dynamic-import", | ||
"transform-modules-amd", | ||
"external-helpers" | ||
] | ||
} |
5 changes: 5 additions & 0 deletions
5
packages/babel-plugin-proposal-dynamic-import/test/fixtures/amd/missing-plugin/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
define(["a"], function (_a) { | ||
"use strict"; | ||
|
||
import("b"); | ||
}); |
1 change: 1 addition & 0 deletions
1
packages/babel-plugin-proposal-dynamic-import/test/fixtures/amd/module/input.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
var modP = import("mod"); |
5 changes: 5 additions & 0 deletions
5
packages/babel-plugin-proposal-dynamic-import/test/fixtures/amd/module/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
define(["require"], function (_require) { | ||
"use strict"; | ||
|
||
var modP = new Promise((_resolve, _reject) => _require(["mod"], imported => _resolve(babelHelpers.interopRequireWildcard(imported)), _reject)); | ||
}); |
1 change: 1 addition & 0 deletions
1
packages/babel-plugin-proposal-dynamic-import/test/fixtures/amd/no-interop/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
var modP = import("mod"); |
7 changes: 7 additions & 0 deletions
7
packages/babel-plugin-proposal-dynamic-import/test/fixtures/amd/no-interop/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"plugins": [ | ||
"proposal-dynamic-import", | ||
["transform-modules-amd", { "noInterop": true }], | ||
"external-helpers" | ||
] | ||
} |
3 changes: 3 additions & 0 deletions
3
packages/babel-plugin-proposal-dynamic-import/test/fixtures/amd/no-interop/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
define(["require"], function (_require) { | ||
var modP = new Promise((_resolve, _reject) => _require(["mod"], imported => _resolve(imported), _reject)); | ||
}); |
7 changes: 7 additions & 0 deletions
7
packages/babel-plugin-proposal-dynamic-import/test/fixtures/amd/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"plugins": [ | ||
"proposal-dynamic-import", | ||
"transform-modules-amd", | ||
"external-helpers" | ||
] | ||
} |
1 change: 1 addition & 0 deletions
1
packages/babel-plugin-proposal-dynamic-import/test/fixtures/amd/script/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
var modP = import("mod"); |
3 changes: 3 additions & 0 deletions
3
packages/babel-plugin-proposal-dynamic-import/test/fixtures/amd/script/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
define(["require"], function (_require) { | ||
var modP = new Promise((_resolve, _reject) => _require(["mod"], imported => _resolve(babelHelpers.interopRequireWildcard(imported)), _reject)); | ||
}); |
8 changes: 8 additions & 0 deletions
8
...babel-plugin-proposal-dynamic-import/test/fixtures/amd/with-other-import-export/input.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
var mod; | ||
|
||
import foo from "foo"; | ||
|
||
import("mod").then(m => mod = m); | ||
|
||
export { mod }; | ||
|
12 changes: 12 additions & 0 deletions
12
...babel-plugin-proposal-dynamic-import/test/fixtures/amd/with-other-import-export/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
define(["require", "exports", "foo"], function (_require, _exports, _foo) { | ||
"use strict"; | ||
|
||
Object.defineProperty(_exports, "__esModule", { | ||
value: true | ||
}); | ||
_exports.mod = void 0; | ||
_foo = babelHelpers.interopRequireDefault(_foo); | ||
var mod; | ||
_exports.mod = mod; | ||
new Promise((_resolve, _reject) => _require(["mod"], imported => _resolve(babelHelpers.interopRequireWildcard(imported)), _reject)).then(m => _exports.mod = mod = m); | ||
}); |
4 changes: 4 additions & 0 deletions
4
packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/exec-interop/exec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
return import("./mod.js").then(({ default: def, named }) => { | ||
expect(def()).toBe("foo"); | ||
expect(named()).toBe("bar"); | ||
}); |
2 changes: 2 additions & 0 deletions
2
packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/exec-interop/mod.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module.exports = () => "foo"; | ||
module.exports.named = () => "bar"; |
5 changes: 5 additions & 0 deletions
5
...ges/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/exec-interop/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"parserOpts": { | ||
"allowReturnOutsideFunction": true | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
...s/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/exec-transpiled-dep/exec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
return import("./mod.js").then(({ default: def, named }) => { | ||
expect(def()).toBe("foo"); | ||
expect(named()).toBe("bar"); | ||
}); |
5 changes: 5 additions & 0 deletions
5
...es/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/exec-transpiled-dep/mod.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = { | ||
__esModule: true, | ||
default: () => "foo", | ||
named: () => "bar", | ||
}; |
5 changes: 5 additions & 0 deletions
5
...el-plugin-proposal-dynamic-import/test/fixtures/commonjs/exec-transpiled-dep/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"parserOpts": { | ||
"allowReturnOutsideFunction": true | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
...ages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/missing-plugin/input.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import "a"; | ||
|
||
import("b"); |
7 changes: 7 additions & 0 deletions
7
...s/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/missing-plugin/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"plugins": [ | ||
"syntax-dynamic-import", | ||
"transform-modules-commonjs", | ||
"external-helpers" | ||
] | ||
} |
5 changes: 5 additions & 0 deletions
5
...ages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/missing-plugin/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
"use strict"; | ||
|
||
require("a"); | ||
|
||
import("b"); |
1 change: 1 addition & 0 deletions
1
packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/module/input.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
var modP = import("mod"); |
3 changes: 3 additions & 0 deletions
3
packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/module/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
"use strict"; | ||
|
||
var modP = Promise.resolve().then(() => babelHelpers.interopRequireWildcard(require("mod"))); |
1 change: 1 addition & 0 deletions
1
packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/no-interop/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
var modP = import("mod"); |
7 changes: 7 additions & 0 deletions
7
packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/no-interop/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"plugins": [ | ||
"proposal-dynamic-import", | ||
["transform-modules-commonjs", { "noInterop": true }], | ||
"external-helpers" | ||
] | ||
} |
1 change: 1 addition & 0 deletions
1
packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/no-interop/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
var modP = Promise.resolve().then(() => require("mod")); |
7 changes: 7 additions & 0 deletions
7
packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"plugins": [ | ||
"proposal-dynamic-import", | ||
"transform-modules-commonjs", | ||
"external-helpers" | ||
] | ||
} |
1 change: 1 addition & 0 deletions
1
packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/script/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
var modP = import("mod"); |
1 change: 1 addition & 0 deletions
1
packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/script/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
var modP = Promise.resolve().then(() => babelHelpers.interopRequireWildcard(require("mod"))); |
6 changes: 6 additions & 0 deletions
6
...ges/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/shadowed-require/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
var require = "foo"; | ||
|
||
(async function () { | ||
var require = "bar"; | ||
await import("./mod"); | ||
})(); |
6 changes: 6 additions & 0 deletions
6
...es/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/shadowed-require/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
var _require2 = "foo"; | ||
|
||
(async function () { | ||
var _require = "bar"; | ||
await Promise.resolve().then(() => babelHelpers.interopRequireWildcard(require("./mod"))); | ||
})(); |
1 change: 1 addition & 0 deletions
1
packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/to-string/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import(2); |
1 change: 1 addition & 0 deletions
1
packages/babel-plugin-proposal-dynamic-import/test/fixtures/commonjs/to-string/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Promise.resolve().then(() => babelHelpers.interopRequireWildcard(require(`${2}`))); |
Empty file.
4 changes: 4 additions & 0 deletions
4
...namic-import/test/fixtures/missing-module-transform/missing-module-transform/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"plugins": ["proposal-dynamic-import"], | ||
"throws": "@babel/plugin-proposal-dynamic-import depends on a modules\ntransform plugin. Supported plugins are:" | ||
} |
5 changes: 5 additions & 0 deletions
5
...ages/babel-plugin-proposal-dynamic-import/test/fixtures/systemjs/missing-plugin/input.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// TODO: This should throw in Babel 8 | ||
|
||
import "a"; | ||
|
||
import("b"); |
7 changes: 7 additions & 0 deletions
7
...s/babel-plugin-proposal-dynamic-import/test/fixtures/systemjs/missing-plugin/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"plugins": [ | ||
"syntax-dynamic-import", | ||
"transform-modules-systemjs", | ||
"external-helpers" | ||
] | ||
} |
11 changes: 11 additions & 0 deletions
11
...ges/babel-plugin-proposal-dynamic-import/test/fixtures/systemjs/missing-plugin/output.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
System.register(["a"], function (_export, _context) { | ||
"use strict"; | ||
|
||
return { | ||
setters: [function (_a) {}], | ||
execute: function () { | ||
// TODO: This should throw in Babel 8 | ||
_context.import("b"); | ||
} | ||
}; | ||
}); |
1 change: 1 addition & 0 deletions
1
packages/babel-plugin-proposal-dynamic-import/test/fixtures/systemjs/module/input.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
var modP = import("mod"); |
11 changes: 11 additions & 0 deletions
11
packages/babel-plugin-proposal-dynamic-import/test/fixtures/systemjs/module/output.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
System.register([], function (_export, _context) { | ||
"use strict"; | ||
|
||
var modP; | ||
return { | ||
setters: [], | ||
execute: function () { | ||
modP = _context.import("mod"); | ||
} | ||
}; | ||
}); |
7 changes: 7 additions & 0 deletions
7
packages/babel-plugin-proposal-dynamic-import/test/fixtures/systemjs/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"plugins": [ | ||
"proposal-dynamic-import", | ||
"transform-modules-systemjs", | ||
"external-helpers" | ||
] | ||
} |
1 change: 1 addition & 0 deletions
1
packages/babel-plugin-proposal-dynamic-import/test/fixtures/systemjs/script/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
var modP = import("mod"); |
11 changes: 11 additions & 0 deletions
11
packages/babel-plugin-proposal-dynamic-import/test/fixtures/systemjs/script/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
System.register([], function (_export, _context) { | ||
"use strict"; | ||
|
||
var modP; | ||
return { | ||
setters: [], | ||
execute: function () { | ||
modP = _context.import("mod"); | ||
} | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import runner from "@babel/helper-plugin-test-runner"; | ||
|
||
runner(__dirname); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.