@babel/helper-module-imports
Advanced tools
Comparing version 7.12.13 to 7.13.12
@@ -8,4 +8,2 @@ "use strict"; | ||
var _assert = _interopRequireDefault(require("assert")); | ||
var t = _interopRequireWildcard(require("@babel/types")); | ||
@@ -17,3 +15,3 @@ | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
const assert = require("assert"); | ||
@@ -26,2 +24,3 @@ class ImportBuilder { | ||
this._hub = null; | ||
this._importedSource = void 0; | ||
this._scope = scope; | ||
@@ -52,8 +51,9 @@ this._hub = hub; | ||
namespace(name = "namespace") { | ||
name = this._scope.generateUidIdentifier(name); | ||
const local = this._scope.generateUidIdentifier(name); | ||
const statement = this._statements[this._statements.length - 1]; | ||
(0, _assert.default)(statement.type === "ImportDeclaration"); | ||
(0, _assert.default)(statement.specifiers.length === 0); | ||
statement.specifiers = [t.importNamespaceSpecifier(name)]; | ||
this._resultName = t.cloneNode(name); | ||
assert(statement.type === "ImportDeclaration"); | ||
assert(statement.specifiers.length === 0); | ||
statement.specifiers = [t.importNamespaceSpecifier(local)]; | ||
this._resultName = t.cloneNode(local); | ||
return this; | ||
@@ -65,4 +65,4 @@ } | ||
const statement = this._statements[this._statements.length - 1]; | ||
(0, _assert.default)(statement.type === "ImportDeclaration"); | ||
(0, _assert.default)(statement.specifiers.length === 0); | ||
assert(statement.type === "ImportDeclaration"); | ||
assert(statement.specifiers.length === 0); | ||
statement.specifiers = [t.importDefaultSpecifier(name)]; | ||
@@ -77,4 +77,4 @@ this._resultName = t.cloneNode(name); | ||
const statement = this._statements[this._statements.length - 1]; | ||
(0, _assert.default)(statement.type === "ImportDeclaration"); | ||
(0, _assert.default)(statement.specifiers.length === 0); | ||
assert(statement.type === "ImportDeclaration"); | ||
assert(statement.specifiers.length === 0); | ||
statement.specifiers = [t.importSpecifier(name, t.identifier(importName))]; | ||
@@ -90,3 +90,3 @@ this._resultName = t.cloneNode(name); | ||
if (statement.type !== "ExpressionStatement") { | ||
(0, _assert.default)(this._resultName); | ||
assert(this._resultName); | ||
statement = t.expressionStatement(this._resultName); | ||
@@ -116,6 +116,6 @@ | ||
} else if (statement.type === "VariableDeclaration") { | ||
(0, _assert.default)(statement.declarations.length === 1); | ||
assert(statement.declarations.length === 1); | ||
statement.declarations[0].init = t.callExpression(callee, [statement.declarations[0].init]); | ||
} else { | ||
_assert.default.fail("Unexpected type."); | ||
assert.fail("Unexpected type."); | ||
} | ||
@@ -132,6 +132,6 @@ | ||
} else if (statement.type === "VariableDeclaration") { | ||
(0, _assert.default)(statement.declarations.length === 1); | ||
assert(statement.declarations.length === 1); | ||
statement.declarations[0].init = t.memberExpression(statement.declarations[0].init, t.identifier(name)); | ||
} else { | ||
_assert.default.fail("Unexpected type:" + statement.type); | ||
assert.fail("Unexpected type:" + statement.type); | ||
} | ||
@@ -138,0 +138,0 @@ |
@@ -8,4 +8,2 @@ "use strict"; | ||
var _assert = _interopRequireDefault(require("assert")); | ||
var t = _interopRequireWildcard(require("@babel/types")); | ||
@@ -17,2 +15,4 @@ | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; } | ||
@@ -22,3 +22,3 @@ | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
const assert = require("assert"); | ||
@@ -48,3 +48,3 @@ class ImportInjector { | ||
addNamed(importName, importedSourceIn, opts) { | ||
(0, _assert.default)(typeof importName === "string"); | ||
assert(typeof importName === "string"); | ||
return this._generateImport(this._applyDefaults(importedSourceIn, opts), importName); | ||
@@ -70,3 +70,3 @@ } | ||
} else { | ||
(0, _assert.default)(!opts, "Unexpected secondary arguments."); | ||
assert(!opts, "Unexpected secondary arguments."); | ||
optsList.push(importedSource); | ||
@@ -73,0 +73,0 @@ } |
{ | ||
"name": "@babel/helper-module-imports", | ||
"version": "7.12.13", | ||
"version": "7.13.12", | ||
"description": "Babel helper functions for inserting module loads", | ||
@@ -18,7 +18,8 @@ "author": "Logan Smyth <loganfsmyth@gmail.com>", | ||
"dependencies": { | ||
"@babel/types": "^7.12.13" | ||
"@babel/types": "^7.13.12" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "7.12.13" | ||
"@babel/core": "7.13.10", | ||
"@babel/traverse": "7.13.0" | ||
} | ||
} |
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
18175
2
Updated@babel/types@^7.13.12