committed by
GitHub
parent
20d2b4f98d
commit
e4f3964f67
24
node_modules/@babel/helper-module-imports/lib/import-builder.js
generated
vendored
24
node_modules/@babel/helper-module-imports/lib/import-builder.js
generated
vendored
@ -28,8 +28,6 @@ class ImportBuilder {
|
||||
constructor(importedSource, scope, hub) {
|
||||
this._statements = [];
|
||||
this._resultName = null;
|
||||
this._scope = null;
|
||||
this._hub = null;
|
||||
this._importedSource = void 0;
|
||||
this._scope = scope;
|
||||
this._hub = hub;
|
||||
@ -70,34 +68,38 @@ class ImportBuilder {
|
||||
}
|
||||
|
||||
default(name) {
|
||||
name = this._scope.generateUidIdentifier(name);
|
||||
const id = this._scope.generateUidIdentifier(name);
|
||||
|
||||
const statement = this._statements[this._statements.length - 1];
|
||||
|
||||
_assert(statement.type === "ImportDeclaration");
|
||||
|
||||
_assert(statement.specifiers.length === 0);
|
||||
|
||||
statement.specifiers = [importDefaultSpecifier(name)];
|
||||
this._resultName = cloneNode(name);
|
||||
statement.specifiers = [importDefaultSpecifier(id)];
|
||||
this._resultName = cloneNode(id);
|
||||
return this;
|
||||
}
|
||||
|
||||
named(name, importName) {
|
||||
if (importName === "default") return this.default(name);
|
||||
name = this._scope.generateUidIdentifier(name);
|
||||
|
||||
const id = this._scope.generateUidIdentifier(name);
|
||||
|
||||
const statement = this._statements[this._statements.length - 1];
|
||||
|
||||
_assert(statement.type === "ImportDeclaration");
|
||||
|
||||
_assert(statement.specifiers.length === 0);
|
||||
|
||||
statement.specifiers = [importSpecifier(name, identifier(importName))];
|
||||
this._resultName = cloneNode(name);
|
||||
statement.specifiers = [importSpecifier(id, identifier(importName))];
|
||||
this._resultName = cloneNode(id);
|
||||
return this;
|
||||
}
|
||||
|
||||
var(name) {
|
||||
name = this._scope.generateUidIdentifier(name);
|
||||
const id = this._scope.generateUidIdentifier(name);
|
||||
|
||||
let statement = this._statements[this._statements.length - 1];
|
||||
|
||||
if (statement.type !== "ExpressionStatement") {
|
||||
@ -108,8 +110,8 @@ class ImportBuilder {
|
||||
this._statements.push(statement);
|
||||
}
|
||||
|
||||
this._statements[this._statements.length - 1] = variableDeclaration("var", [variableDeclarator(name, statement.expression)]);
|
||||
this._resultName = cloneNode(name);
|
||||
this._statements[this._statements.length - 1] = variableDeclaration("var", [variableDeclarator(id, statement.expression)]);
|
||||
this._resultName = cloneNode(id);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
26
node_modules/@babel/helper-module-imports/lib/import-injector.js
generated
vendored
26
node_modules/@babel/helper-module-imports/lib/import-injector.js
generated
vendored
@ -51,35 +51,25 @@ class ImportInjector {
|
||||
}
|
||||
|
||||
addSideEffect(importedSourceIn, opts) {
|
||||
return this._generateImport(this._applyDefaults(importedSourceIn, opts), false);
|
||||
return this._generateImport(this._applyDefaults(importedSourceIn, opts), void 0);
|
||||
}
|
||||
|
||||
_applyDefaults(importedSource, opts, isInit = false) {
|
||||
const optsList = [];
|
||||
let newOpts;
|
||||
|
||||
if (typeof importedSource === "string") {
|
||||
optsList.push({
|
||||
newOpts = Object.assign({}, this._defaultOpts, {
|
||||
importedSource
|
||||
});
|
||||
optsList.push(opts);
|
||||
}, opts);
|
||||
} else {
|
||||
_assert(!opts, "Unexpected secondary arguments.");
|
||||
|
||||
optsList.push(importedSource);
|
||||
newOpts = Object.assign({}, this._defaultOpts, importedSource);
|
||||
}
|
||||
|
||||
const newOpts = Object.assign({}, this._defaultOpts);
|
||||
|
||||
for (const opts of optsList) {
|
||||
if (!opts) continue;
|
||||
Object.keys(newOpts).forEach(key => {
|
||||
if (opts[key] !== undefined) newOpts[key] = opts[key];
|
||||
});
|
||||
|
||||
if (!isInit) {
|
||||
if (opts.nameHint !== undefined) newOpts.nameHint = opts.nameHint;
|
||||
if (opts.blockHoist !== undefined) newOpts.blockHoist = opts.blockHoist;
|
||||
}
|
||||
if (!isInit && opts) {
|
||||
if (opts.nameHint !== undefined) newOpts.nameHint = opts.nameHint;
|
||||
if (opts.blockHoist !== undefined) newOpts.blockHoist = opts.blockHoist;
|
||||
}
|
||||
|
||||
return newOpts;
|
||||
|
11
node_modules/@babel/helper-module-imports/package.json
generated
vendored
11
node_modules/@babel/helper-module-imports/package.json
generated
vendored
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/helper-module-imports",
|
||||
"version": "7.16.7",
|
||||
"version": "7.18.6",
|
||||
"description": "Babel helper functions for inserting module loads",
|
||||
"author": "The Babel Team (https://babel.dev/team)",
|
||||
"homepage": "https://babel.dev/docs/en/next/babel-helper-module-imports",
|
||||
@ -15,13 +15,14 @@
|
||||
},
|
||||
"main": "./lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.16.7"
|
||||
"@babel/types": "^7.18.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.16.7",
|
||||
"@babel/traverse": "^7.16.7"
|
||||
"@babel/core": "^7.18.6",
|
||||
"@babel/traverse": "^7.18.6"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"type": "commonjs"
|
||||
}
|
Reference in New Issue
Block a user