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

Class NgCompiler

packages/compiler-cli/src/ngtsc/core/src/compiler.ts:365–1747  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

363 * See the README.md for more information.
364 */
365export class NgCompiler {
366 /**
367 * Lazily evaluated state of the compilation.
368 *
369 * This is created on demand by calling `ensureAnalyzed`.
370 */
371 private compilation: LazyCompilationState | null = null;
372
373 /**
374 * Any diagnostics related to the construction of the compilation.
375 *
376 * These are diagnostics which arose during setup of the host and/or program.
377 */
378 private constructionDiagnostics: ts.Diagnostic[] = [];
379
380 /**
381 * Non-template diagnostics related to the program itself. Does not include template
382 * diagnostics because the template type checker memoizes them itself.
383 *
384 * This is set by (and memoizes) `getNonTemplateDiagnostics`.
385 */
386 private nonTemplateDiagnostics: ts.Diagnostic[] | null = null;
387
388 private closureCompilerEnabled: boolean;
389 private currentProgram: ts.Program;
390 private entryPoint: ts.SourceFile | null;
391 private moduleResolver: ModuleResolver;
392 private resourceManager: AdapterResourceLoader;
393 private cycleAnalyzer: CycleAnalyzer;
394 readonly ignoreForDiagnostics: Set<ts.SourceFile>;
395 readonly ignoreForEmit: Set<ts.SourceFile>;
396 readonly enableTemplateTypeChecker: boolean;
397 private readonly enableBlockSyntax: boolean;
398 private readonly enableLetSyntax: boolean;
399 private readonly angularCoreVersion: string | null;
400 private readonly enableHmr: boolean;
401 private readonly implicitStandaloneValue: boolean;
402 private readonly emitDeclarationOnly: boolean;
403 private readonly enableTemplateSourceLocations: boolean;
404
405 /**
406 * `NgCompiler` can be reused for multiple compilations (for resource-only changes), and each
407 * new compilation uses a fresh `PerfRecorder`. Thus, classes created with a lifespan of the
408 * `NgCompiler` use a `DelegatingPerfRecorder` so the `PerfRecorder` they write to can be updated
409 * with each fresh compilation.
410 */
411 private delegatingPerfRecorder: DelegatingPerfRecorder;
412
413 /**
414 * Convert a `CompilationTicket` into an `NgCompiler` instance for the requested compilation.
415 *
416 * Depending on the nature of the compilation request, the `NgCompiler` instance may be reused
417 * from a previous compilation and updated with any changes, it may be a new instance which
418 * incrementally reuses state from a previous compilation, or it may represent a fresh
419 * compilation entirely.
420 */
421 static fromTicket(ticket: CompilationTicket, adapter: NgCompilerAdapter) {
422 switch (ticket.kind) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected