Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const acceptHmrNode = ts.createIdentifier(getAcceptMainModuleCode(appModulePath));
const objectAssignNode = ts.createPropertyAccess(ts.createIdentifier("Object"), ts.createIdentifier("assign"));
const extendAppOptionsNode = ts.createCall(objectAssignNode, undefined, [currentAppOptionsInitializationNode, ts.createIdentifier(GeneratedDynamicAppOptions)]);
const newNsDynamicCallArgs = ts.createNodeArray([extendAppOptionsNode, ...nativeScriptPlatformCallNode.arguments.slice(1)]);
const nsPlatformPath = findNativeScriptPlatformPathInSource(mainFile);
const nsPlatformText = getExpressionName(nativeScriptPlatformCallNode.expression);
const newNsDynamicCallNode = ts.createCall(ts.createPropertyAccess(ts.createIdentifier(NsNgPlatformStarImport), ts.createIdentifier(nsPlatformText)), [], newNsDynamicCallArgs);
return [
...insertStarImport(mainFile, ts.createIdentifier(NsNgPlatformStarImport), nsPlatformPath, firstImportNode, true),
new AddNodeOperation(mainFile, lastImportNode, undefined, optionsStatement),
new AddNodeOperation(mainFile, lastImportNode, undefined, setHmrOptionsNode),
new AddNodeOperation(mainFile, lastImportNode, undefined, acceptHmrNode),
new ReplaceNodeOperation(mainFile, nativeScriptPlatformCallNode, newNsDynamicCallNode)
];
}
const setHmrOptionsNode = ts.createIdentifier(getHmrOptionsCode(appModuleName, appModulePath));
const acceptHmrNode = ts.createIdentifier(getAcceptMainModuleCode(appModulePath));
const objectAssignNode = ts.createPropertyAccess(ts.createIdentifier("Object"), ts.createIdentifier("assign"));
const extendAppOptionsNode = ts.createCall(objectAssignNode, undefined, [currentAppOptionsInitializationNode, ts.createIdentifier(GeneratedDynamicAppOptions)]);
const newNsDynamicCallArgs = ts.createNodeArray([extendAppOptionsNode, ...nativeScriptPlatformCallNode.arguments.slice(1)]);
const nsPlatformPath = findNativeScriptPlatformPathInSource(mainFile);
const nsPlatformText = getExpressionName(nativeScriptPlatformCallNode.expression);
const newNsDynamicCallNode = ts.createCall(ts.createPropertyAccess(ts.createIdentifier(NsNgPlatformStarImport), ts.createIdentifier(nsPlatformText)), [], newNsDynamicCallArgs);
return [
...insertStarImport(mainFile, ts.createIdentifier(NsNgPlatformStarImport), nsPlatformPath, firstImportNode, true),
new AddNodeOperation(mainFile, lastImportNode, undefined, optionsStatement),
new AddNodeOperation(mainFile, lastImportNode, undefined, setHmrOptionsNode),
new AddNodeOperation(mainFile, lastImportNode, undefined, acceptHmrNode),
new ReplaceNodeOperation(mainFile, nativeScriptPlatformCallNode, newNsDynamicCallNode)
];
}
const setHmrOptionsNode = ts.createIdentifier(getHmrOptionsCode(appModuleName, appModulePath));
const acceptHmrNode = ts.createIdentifier(getAcceptMainModuleCode(appModulePath));
const objectAssignNode = ts.createPropertyAccess(ts.createIdentifier("Object"), ts.createIdentifier("assign"));
const extendAppOptionsNode = ts.createCall(objectAssignNode, undefined, [currentAppOptionsInitializationNode, ts.createIdentifier(GeneratedDynamicAppOptions)]);
const newNsDynamicCallArgs = ts.createNodeArray([extendAppOptionsNode, ...nativeScriptPlatformCallNode.arguments.slice(1)]);
const nsPlatformPath = findNativeScriptPlatformPathInSource(mainFile);
const nsPlatformText = getExpressionName(nativeScriptPlatformCallNode.expression);
const newNsDynamicCallNode = ts.createCall(ts.createPropertyAccess(ts.createIdentifier(NsNgPlatformStarImport), ts.createIdentifier(nsPlatformText)), [], newNsDynamicCallArgs);
return [
...insertStarImport(mainFile, ts.createIdentifier(NsNgPlatformStarImport), nsPlatformPath, firstImportNode, true),
new AddNodeOperation(mainFile, lastImportNode, undefined, optionsStatement),
new AddNodeOperation(mainFile, lastImportNode, undefined, setHmrOptionsNode),
new AddNodeOperation(mainFile, lastImportNode, undefined, acceptHmrNode),
new ReplaceNodeOperation(mainFile, nativeScriptPlatformCallNode, newNsDynamicCallNode)
];
}