Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
);
if (interop) {
const header = t.expressionStatement(
t.assignmentExpression(
"=",
t.identifier(metadata.name),
interop,
),
);
header.loc = meta.loc;
headers.push(header);
}
}
headers.push(
...buildNamespaceInitStatements(meta, metadata, loose),
);
}
ensureStatementsHoisted(headers);
path.unshiftContainer("body", headers);
const { body, directives } = path.node;
path.node.directives = [];
path.node.body = [];
const umdWrapper = path.pushContainer("body", [
buildWrapper({
MODULE_NAME: moduleName,
AMD_ARGUMENTS: t.arrayExpression(amdArgs),
COMMONJS_ARGUMENTS: commonjsArgs,
BROWSER_ARGUMENTS: browserArgs,
);
if (interop) {
const header = t.expressionStatement(
t.assignmentExpression(
"=",
t.identifier(metadata.name),
interop,
),
);
header.loc = metadata.loc;
headers.push(header);
}
}
headers.push(
...buildNamespaceInitStatements(meta, metadata, loose),
);
}
ensureStatementsHoisted(headers);
path.unshiftContainer("body", headers);
injectWrapper(
path,
buildWrapper({
MODULE_NAME: moduleName,
AMD_ARGUMENTS: t.arrayExpression(amdArgs),
IMPORT_NAMES: importNames,
}),
);
},
const data = ${init};
${metadata.name} = function(){ return data; };
return data;
}
`;
} else {
header = template.ast`
var ${metadata.name} = ${init};
`;
}
}
header.loc = metadata.loc;
headers.push(header);
headers.push(
...buildNamespaceInitStatements(meta, metadata, loose),
);
}
ensureStatementsHoisted(headers);
path.unshiftContainer("body", headers);
},
},
metadata.interop,
);
if (interop) {
const header = t.expressionStatement(
t.assignmentExpression(
"=",
t.identifier(metadata.name),
interop,
),
);
header.loc = metadata.loc;
headers.push(header);
}
}
headers.push(...buildNamespaceInitStatements(meta, metadata));
}
ensureStatementsHoisted(headers);
path.unshiftContainer("body", headers);
const { body, directives } = path.node;
path.node.directives = [];
path.node.body = [];
const amdWrapper = path.pushContainer("body", [
buildWrapper({
MODULE_NAME: moduleName,
AMD_ARGUMENTS: t.arrayExpression(amdArgs),
IMPORT_NAMES: importNames,
}),
])[0];
let header;
if (isSideEffectImport(metadata)) {
header = t.expressionStatement(loadExpr);
} else {
header = t.variableDeclaration("var", [
t.variableDeclarator(
t.identifier(metadata.name),
wrapInterop(path, loadExpr, metadata.interop) || loadExpr,
),
]);
}
header.loc = metadata.loc;
headers.push(header);
headers.push(...buildNamespaceInitStatements(meta, metadata));
}
ensureStatementsHoisted(headers);
path.unshiftContainer("body", headers);
},
},
metadata.interop,
);
if (interop) {
const header = t.expressionStatement(
t.assignmentExpression(
"=",
t.identifier(metadata.name),
interop,
),
);
header.loc = meta.loc;
headers.push(header);
}
}
headers.push(...buildNamespaceInitStatements(meta, metadata));
}
ensureStatementsHoisted(headers);
path.unshiftContainer("body", headers);
const { body, directives } = path.node;
path.node.directives = [];
path.node.body = [];
const umdWrapper = path.pushContainer("body", [
buildWrapper({
MODULE_NAME: moduleName,
AMD_ARGUMENTS: t.arrayExpression(amdArgs),
COMMONJS_ARGUMENTS: commonjsArgs,
BROWSER_ARGUMENTS: browserArgs,
IMPORT_NAMES: importNames,