refactor: remove unused local imports and use spread instead of slice (#30482)
This is a purly estatic change and a minor cleanup PR Close #30482
This commit is contained in:
parent
b766987b98
commit
f9404d9e7c
@ -32,11 +32,7 @@ export function isDirectory(data: MockFileOrDirectory | undefined): data is Mock
|
|||||||
return typeof data !== 'string';
|
return typeof data !== 'string';
|
||||||
}
|
}
|
||||||
|
|
||||||
const NODE_MODULES = '/node_modules/';
|
|
||||||
const IS_GENERATED = /\.(ngfactory|ngstyle)$/;
|
|
||||||
const angularts = /@angular\/(\w|\/|-)+\.tsx?$/;
|
|
||||||
const rxjs = /\/rxjs\//;
|
const rxjs = /\/rxjs\//;
|
||||||
const tsxfile = /\.tsx$/;
|
|
||||||
export const settings: ts.CompilerOptions = {
|
export const settings: ts.CompilerOptions = {
|
||||||
target: ts.ScriptTarget.ES5,
|
target: ts.ScriptTarget.ES5,
|
||||||
declaration: true,
|
declaration: true,
|
||||||
@ -231,7 +227,7 @@ export class MockCompilerHost implements ts.CompilerHost {
|
|||||||
private traces: string[] = [];
|
private traces: string[] = [];
|
||||||
|
|
||||||
constructor(scriptNames: string[], private data: MockDirectory) {
|
constructor(scriptNames: string[], private data: MockDirectory) {
|
||||||
this.scriptNames = scriptNames.slice(0);
|
this.scriptNames = [...scriptNames];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test API
|
// Test API
|
||||||
@ -778,7 +774,7 @@ export function compile(
|
|||||||
aotHost.tsFilesOnly();
|
aotHost.tsFilesOnly();
|
||||||
}
|
}
|
||||||
const tsSettings = {...settings, ...tsOptions};
|
const tsSettings = {...settings, ...tsOptions};
|
||||||
const program = ts.createProgram(host.scriptNames.slice(0), tsSettings, host);
|
const program = ts.createProgram([...host.scriptNames], tsSettings, host);
|
||||||
preCompile(program);
|
preCompile(program);
|
||||||
const {compiler, reflector} = createAotCompiler(aotHost, options, (err) => { throw err; });
|
const {compiler, reflector} = createAotCompiler(aotHost, options, (err) => { throw err; });
|
||||||
const analyzedModules =
|
const analyzedModules =
|
||||||
@ -792,7 +788,7 @@ export function compile(
|
|||||||
host.override(file.genFileUrl, source);
|
host.override(file.genFileUrl, source);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const newProgram = ts.createProgram(host.scriptNames.slice(0), tsSettings, host);
|
const newProgram = ts.createProgram([...host.scriptNames], tsSettings, host);
|
||||||
postCompile(newProgram);
|
postCompile(newProgram);
|
||||||
if (emit) {
|
if (emit) {
|
||||||
newProgram.emit();
|
newProgram.emit();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user