Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const bootstrapPropAccessExpr = bootstrapCallExpr.expression as ts.PropertyAccessExpression;
if (bootstrapPropAccessExpr.name.text !== 'bootstrapModule'
|| bootstrapPropAccessExpr.expression.kind !== ts.SyntaxKind.CallExpression) {
return;
}
const nsPlatformCallExpr = bootstrapPropAccessExpr.expression as ts.CallExpression;
if (!(getExpressionName(nsPlatformCallExpr.expression) === 'platformNativeScriptDynamic')) {
return;
}
const idPlatformNativeScript = ts.createUniqueName('__NgCli_bootstrap_1');
const idNgFactory = ts.createUniqueName('__NgCli_bootstrap_2');
const firstNode = getFirstNode(sourceFile);
// Add the transform operations.
// TODO: if (ivy)
const factoryClassName = entryModule.className; // + 'NgFactory';
const factoryModulePath = normalizedEntryModulePath; // + '.ngfactory';
const newBootstrapPropAccessExpr = ts.getMutableClone(bootstrapPropAccessExpr);
const newNsPlatformCallExpr = ts.getMutableClone(bootstrapPropAccessExpr.expression) as ts.CallExpression;
newNsPlatformCallExpr.expression = ts.createPropertyAccess(idPlatformNativeScript, 'platformNativeScript');
newBootstrapPropAccessExpr.expression = newNsPlatformCallExpr;
// TODO: if (ivy)
// newBootstrapPropAccessExpr.name = ts.createIdentifier("bootstrapModuleFactory");
newBootstrapPropAccessExpr.name = ts.createIdentifier("bootstrapModule");
const newBootstrapCallExpr = ts.getMutableClone(bootstrapCallExpr);
const standardTransform: StandardTransform = (sourceFile: ts.SourceFile) => {
const ops: TransformOperation[] = [];
if (options.main === sourceFile.fileName) {
const firstNode = getFirstNode(sourceFile);
ops.push(
...insertAllImport(sourceFile, 'reflect-metadata', firstNode, true),
...insertAllImport(
sourceFile,
'zone.js/dist/zone-node',
firstNode,
true,
),
);
}
return ops;
};