MCPcopy Index your code
hub / github.com/angular/angular / setupCompilation

Method setupCompilation

packages/compiler-cli/src/ngtsc/tsc_plugin.ts:105–170  ·  view source on GitHub ↗
(
    program: ts.Program,
    oldProgram?: ts.Program,
  )

Source from the content-addressed store, hash-verified

103 }
104
105 setupCompilation(
106 program: ts.Program,
107 oldProgram?: ts.Program,
108 ): {
109 ignoreForDiagnostics: Set<ts.SourceFile>;
110 ignoreForEmit: Set<ts.SourceFile>;
111 } {
112 // TODO(alxhub): we provide a `PerfRecorder` to the compiler, but because we're not driving the
113 // compilation, the information captured within it is incomplete, and may not include timings
114 // for phases such as emit.
115 //
116 // Additionally, nothing actually captures the perf results here, so recording stats at all is
117 // somewhat moot for now :)
118 const perfRecorder = ActivePerfRecorder.zeroedToNow();
119 if (this.host === null || this.options === null) {
120 throw new Error('Lifecycle error: setupCompilation() before wrapHost().');
121 }
122 this.host.postProgramCreationCleanup();
123 const programDriver = new TsCreateProgramDriver(
124 program,
125 this.host,
126 this.options,
127 this.host.shimExtensionPrefixes,
128 );
129 const strategy = new PatchedProgramIncrementalBuildStrategy();
130 const oldState = oldProgram !== undefined ? strategy.getIncrementalState(oldProgram) : null;
131 let ticket: CompilationTicket;
132
133 const modifiedResourceFiles = new Set<AbsoluteFsPath>();
134 if (this.host.getModifiedResourceFiles !== undefined) {
135 for (const resourceFile of this.host.getModifiedResourceFiles() ?? []) {
136 modifiedResourceFiles.add(resolve(resourceFile));
137 }
138 }
139
140 if (oldProgram === undefined || oldState === null) {
141 ticket = freshCompilationTicket(
142 program,
143 this.options,
144 strategy,
145 programDriver,
146 perfRecorder,
147 /* enableTemplateTypeChecker */ false,
148 /* usePoisonedData */ false,
149 );
150 } else {
151 strategy.toNextBuildStrategy().getIncrementalState(oldProgram);
152 ticket = incrementalFromStateTicket(
153 oldProgram,
154 oldState,
155 program,
156 this.options,
157 strategy,
158 programDriver,
159 modifiedResourceFiles,
160 perfRecorder,
161 false,
162 false,

Callers

nothing calls this directly

Calls 11

getIncrementalStateMethod · 0.95
toNextBuildStrategyMethod · 0.95
resolveFunction · 0.90
freshCompilationTicketFunction · 0.90
zeroedToNowMethod · 0.80
fromTicketMethod · 0.80
addMethod · 0.65
getIncrementalStateMethod · 0.65

Tested by

no test coverage detected