MCPcopy Create free account
hub / github.com/angular/angular / runPipeline

Function runPipeline

packages/compiler-cli/preprocessor/test/utils.ts:352–590  ·  view source on GitHub ↗
(
  sourceFiles: TestFile[],
  options: {
    optimize: boolean;
    sidecar?: boolean;
    templateParseOptions?: Record<string, any>;
    errors?: string[];
    format?: boolean;
    complianceMode?: boolean;
  },
)

Source from the content-addressed store, hash-verified

350 * Run the test pipeline with virtual files
351 */
352export async function runPipeline(
353 sourceFiles: TestFile[],
354 options: {
355 optimize: boolean;
356 sidecar?: boolean;
357 templateParseOptions?: Record<string, any>;
358 errors?: string[];
359 format?: boolean;
360 complianceMode?: boolean;
361 },
362): Promise<TestFile[]> {
363 const maybeFormat = (p: string, content: string): Promise<string> =>
364 options.format === false ? Promise.resolve(content) : formatContent(p, content);
365
366 const nodeModulesPath = resolveFixtureNodeModules();
367
368 const virtualFiles: Record<string, string> = {};
369 for (const f of sourceFiles) {
370 virtualFiles[f.path] = f.content;
371 }
372
373 const tsconfigFile = sourceFiles.find((f) => f.path.endsWith('tsconfig.json'));
374 if (!tsconfigFile) {
375 throw new Error('tsconfig.json must be provided in source files');
376 }
377
378 let tsconfigOptions: any = {};
379 let compilerOptions: any = {};
380 let bazelOptions: any = {};
381 try {
382 const parsed = JSON.parse(tsconfigFile.content);
383 tsconfigOptions = parsed.angularCompilerOptions ?? {};
384 compilerOptions = parsed.compilerOptions ?? {};
385 bazelOptions = parsed.bazelOptions || parsed.bazelOpts || {};
386 } catch (e) {
387 // Ignore
388 }
389
390 const isClosureCompilerEnabled =
391 tsconfigOptions.annotateForClosureCompiler === true ||
392 bazelOptions.annotateForClosureCompiler === true ||
393 bazelOptions.tsickle === true;
394
395 const emitDeclarationOnly =
396 compilerOptions.emitDeclarationOnly === true &&
397 tsconfigOptions._experimentalAllowEmitDeclarationOnly === true;
398
399 const onlyPublishPublicTypingsForNgModules =
400 tsconfigOptions.onlyPublishPublicTypingsForNgModules === true;
401
402 const forbidOrphanComponents = tsconfigOptions.forbidOrphanComponents === true;
403 const supportJitMode = tsconfigOptions.supportJitMode !== false;
404 const ngtscOptions = {
405 preserveWhitespaces: tsconfigOptions.preserveWhitespaces,
406 supportTestBed: tsconfigOptions.supportTestBed,
407 enableI18nLegacyMessageIdFormat: tsconfigOptions.enableI18nLegacyMessageIdFormat ?? false,
408 i18nUseExternalIds: tsconfigOptions.i18nUseExternalIds,
409 i18nNormalizeLineEndingsInICUs: tsconfigOptions.i18nNormalizeLineEndingsInICUs,

Callers 15

compileFunction · 0.85
compileCoreFunction · 0.85
compileFunction · 0.85
compileFilesFunction · 0.85
compileFilesFunction · 0.85
compliance_spec.tsFile · 0.85
emitFunction · 0.85
diagnoseFunction · 0.85
compileFilesFunction · 0.85

Calls 15

initializeMethod · 0.95
analyzeOptimizedMethod · 0.95
analyzeMethod · 0.95
prepareChunkMethod · 0.95
processFileMethod · 0.95
getDiagnosticsMethod · 0.95
normalizePathKeyFunction · 0.85
buildTypeCheckingConfigFunction · 0.85
resolveSidecarBinaryFunction · 0.85
createAnalyzerFunction · 0.85
verifyCompilerOptionsFunction · 0.85

Tested by

no test coverage detected