@babel/helper-module-imports
Advanced tools
Comparing version 7.16.7 to 7.18.6
@@ -31,4 +31,2 @@ "use strict"; | ||
this._resultName = null; | ||
this._scope = null; | ||
this._hub = null; | ||
this._importedSource = void 0; | ||
@@ -74,3 +72,4 @@ this._scope = scope; | ||
default(name) { | ||
name = this._scope.generateUidIdentifier(name); | ||
const id = this._scope.generateUidIdentifier(name); | ||
const statement = this._statements[this._statements.length - 1]; | ||
@@ -82,4 +81,4 @@ | ||
statement.specifiers = [importDefaultSpecifier(name)]; | ||
this._resultName = cloneNode(name); | ||
statement.specifiers = [importDefaultSpecifier(id)]; | ||
this._resultName = cloneNode(id); | ||
return this; | ||
@@ -90,3 +89,5 @@ } | ||
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]; | ||
@@ -98,4 +99,4 @@ | ||
statement.specifiers = [importSpecifier(name, identifier(importName))]; | ||
this._resultName = cloneNode(name); | ||
statement.specifiers = [importSpecifier(id, identifier(importName))]; | ||
this._resultName = cloneNode(id); | ||
return this; | ||
@@ -105,3 +106,4 @@ } | ||
var(name) { | ||
name = this._scope.generateUidIdentifier(name); | ||
const id = this._scope.generateUidIdentifier(name); | ||
let statement = this._statements[this._statements.length - 1]; | ||
@@ -117,4 +119,4 @@ | ||
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; | ||
@@ -121,0 +123,0 @@ } |
@@ -54,31 +54,21 @@ "use strict"; | ||
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; | ||
} | ||
@@ -85,0 +75,0 @@ |
{ | ||
"name": "@babel/helper-module-imports", | ||
"version": "7.16.7", | ||
"version": "7.18.6", | ||
"description": "Babel helper functions for inserting module loads", | ||
@@ -18,11 +18,12 @@ "author": "The Babel Team (https://babel.dev/team)", | ||
"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" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16068
400
Updated@babel/types@^7.18.6