Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
for (const node of specifiers.exports) {
if (_core.types.isExportAllDeclaration(node)) {
hasExportStar = true;
} else if (_core.types.isExportSpecifier(node)) {
exportNames.push(node.exported.name);
exportValues.push(_core.types.memberExpression(_core.types.identifier(target), node.local));
} else {}
}
setterBody = setterBody.concat(constructExportCall(path, _core.types.identifier(exportIdent), exportNames, exportValues, hasExportStar ? _core.types.identifier(target) : null));
}
sources.push(_core.types.stringLiteral(specifiers.key));
setters.push(_core.types.functionExpression(null, [_core.types.identifier(target)], _core.types.blockStatement(setterBody)));
});
let moduleName = (0, _helperModuleTransforms.getModuleName)(this.file.opts, options);
if (moduleName) moduleName = _core.types.stringLiteral(moduleName);
(0, _helperHoistVariables.default)(path, (id, name, hasInit) => {
variableIds.push(id);
if (!hasInit) {
exportNames.push(name);
exportValues.push(scope.buildUndefinedNode());
}
}, null);
if (variableIds.length) {
beforeBody.unshift(_core.types.variableDeclaration("var", variableIds.map(id => _core.types.variableDeclarator(id))));
}
if (exportNames.length) {
beforeBody = beforeBody.concat(constructExportCall(path, _core.types.identifier(exportIdent), exportNames, exportValues, null));
REQUIRE: _core.types.cloneNode(requireId)
}));
}
return;
}
const amdArgs = [];
const importNames = [];
if (requireId) {
amdArgs.push(_core.types.stringLiteral("require"));
importNames.push(_core.types.cloneNode(requireId));
}
let moduleName = (0, _helperModuleTransforms.getModuleName)(this.file.opts, options);
if (moduleName) moduleName = _core.types.stringLiteral(moduleName);
const {
meta,
headers
} = (0, _helperModuleTransforms.rewriteModuleStatementsAndPrepareHeader)(path, {
loose,
strict,
strictMode,
allowTopLevelThis,
noInterop
});
if ((0, _helperModuleTransforms.hasExports)(meta)) {
amdArgs.push(_core.types.stringLiteral("exports"));
importNames.push(_core.types.identifier(meta.exportName));
}
for (const node of specifiers.exports) {
if (_core.types.isExportAllDeclaration(node)) {
hasExportStar = true;
} else if (_core.types.isExportSpecifier(node)) {
exportNames.push(node.exported.name);
exportValues.push(_core.types.memberExpression(_core.types.identifier(target), node.local));
} else {}
}
setterBody = setterBody.concat(constructExportCall(path, _core.types.identifier(exportIdent), exportNames, exportValues, hasExportStar ? _core.types.identifier(target) : null));
}
sources.push(_core.types.stringLiteral(specifiers.key));
setters.push(_core.types.functionExpression(null, [_core.types.identifier(target)], _core.types.blockStatement(setterBody)));
});
let moduleName = (0, _helperModuleTransforms.getModuleName)(this.file.opts, options);
if (moduleName) moduleName = _core.types.stringLiteral(moduleName);
(0, _helperHoistVariables.default)(path, (id, name, hasInit) => {
variableIds.push(id);
if (!hasInit) {
exportNames.push(name);
exportValues.push(scope.buildUndefinedNode());
}
}, null);
if (variableIds.length) {
beforeBody.unshift(_core.types.variableDeclaration("var", variableIds.map(id => _core.types.variableDeclarator(id))));
}
if (exportNames.length) {
beforeBody = beforeBody.concat(constructExportCall(path, _core.types.identifier(exportIdent), exportNames, exportValues, null));