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

Class NgCompiler

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected