Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"=",
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,
IMPORT_NAMES: importNames,
GLOBAL_TO_ASSIGN: buildBrowserInit(
browserGlobals,
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,
GLOBAL_TO_ASSIGN: buildBrowserInit(
browserGlobals,
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);
},
},
"=",
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,
}),
);
},
},
`;
} 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);
},
},
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];
const amdFactory = amdWrapper
.get("expression.arguments")
.filter(arg => arg.isFunctionExpression())[0]