Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create @babel/plugin-proposal-dynamic-import #9552

Merged
merged 5 commits into from Jun 30, 2019
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Prev

Update babel-plugin-dynamic-import-node

  • Loading branch information...
nicolo-ribaudo committed Jun 18, 2019
commit ab64e9347b3ca4379e2e82be1d02f39f41f8be98
@@ -10,7 +10,8 @@
"main": "lib/index.js",
"dependencies": {
"@babel/helper-module-transforms": "^7.1.0",
"@babel/helper-plugin-utils": "^7.0.0"
"@babel/helper-plugin-utils": "^7.0.0",
"babel-plugin-dynamic-import-node": "^2.3.0"
},
"keywords": [
"babel-plugin"
@@ -9,6 +9,7 @@ import {
wrapInterop,
} from "@babel/helper-module-transforms";
import { template, types as t } from "@babel/core";
import { getImportSource } from "babel-plugin-dynamic-import-node/utils";

const buildWrapper = template(`
define(MODULE_NAME, AMD_ARGUMENTS, function(IMPORT_NAMES) {
@@ -68,7 +69,7 @@ export default declare((api, options) => {
template.expression.ast`
new Promise((${resolveId}, ${rejectId}) =>
${requireId}(
[${path.node.arguments[0]}],
[${getImportSource(t, path.node)}],
imported => ${resolveId}(${result}),
${rejectId}
)
@@ -12,7 +12,7 @@
"@babel/helper-module-transforms": "^7.4.4",
"@babel/helper-plugin-utils": "^7.0.0",
"@babel/helper-simple-access": "^7.1.0",
"babel-plugin-dynamic-import-node": "^2.2.0"
"babel-plugin-dynamic-import-node": "^2.3.0"
},
"keywords": [
"babel-plugin"
@@ -10,15 +10,12 @@ import {
import simplifyAccess from "@babel/helper-simple-access";
import { template, types as t } from "@babel/core";

import babelPluginDynamicImportNode from "babel-plugin-dynamic-import-node";
import { createDynamicImportTransform } from "babel-plugin-dynamic-import-node/utils";

export default declare((api, options) => {
api.assertVersion(7);

// TODO: expose a better interface
const transformImportCall = Function.call.bind(
babelPluginDynamicImportNode(api).visitor.Import,
);
const transformImportCall = createDynamicImportTransform(api);

const {
loose,
@@ -10,7 +10,8 @@
"main": "lib/index.js",
"dependencies": {
"@babel/helper-hoist-variables": "^7.4.4",
"@babel/helper-plugin-utils": "^7.0.0"
"@babel/helper-plugin-utils": "^7.0.0",
"babel-plugin-dynamic-import-node": "^2.3.0"
},
"keywords": [
"babel-plugin"
@@ -1,6 +1,7 @@
import { declare } from "@babel/helper-plugin-utils";
import hoistVariables from "@babel/helper-hoist-variables";
import { template, types as t } from "@babel/core";
import { getImportSource } from "babel-plugin-dynamic-import-node/utils";

const buildTemplate = template(`
SYSTEM_REGISTER(MODULE_NAME, SOURCES, function (EXPORT_IDENTIFIER, CONTEXT_IDENTIFIER) {
@@ -189,7 +190,7 @@ export default declare((api, options) => {
t.identifier(state.contextIdent),
t.identifier("import"),
),
path.node.arguments,
[getImportSource(t, path.node)],
),
);
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.