UNPKG

5.49 kBJavaScriptView Raw
1
2 import {createRequire as __cjsCompatRequire} from 'module';
3 const require = __cjsCompatRequire(import.meta.url);
4 const __ESM_IMPORT_META_URL__ = import.meta.url;
5
6import {
7 GLOBAL_DEFS_FOR_TERSER,
8 GLOBAL_DEFS_FOR_TERSER_WITH_AOT,
9 constructorParametersDownlevelTransform
10} from "./chunk-HTCAZIYK.js";
11import {
12 DEFAULT_ERROR_CODE,
13 EmitFlags,
14 NgCompiler,
15 NgCompilerHost,
16 NgtscProgram,
17 OptimizeFor,
18 PatchedProgramIncrementalBuildStrategy,
19 SOURCE,
20 TsCreateProgramDriver,
21 UNKNOWN_ERROR_CODE,
22 calcProjectFileAndBasePath,
23 createCompilerHost,
24 createProgram,
25 defaultGatherDiagnostics,
26 exitCodeFromResult,
27 formatDiagnostics,
28 freshCompilationTicket,
29 incrementalFromStateTicket,
30 isTsDiagnostic,
31 performCompilation,
32 readConfiguration,
33 untagAllTsFiles
34} from "./chunk-ZPZWKMTE.js";
35import "./chunk-KAJ5EOEG.js";
36import "./chunk-Q5GIQ3RV.js";
37import {
38 ConsoleLogger,
39 LogLevel
40} from "./chunk-LX5Q27EF.js";
41import "./chunk-WXB5AWIG.js";
42import {
43 LogicalFileSystem,
44 LogicalProjectPath,
45 NgtscCompilerHost,
46 NodeJSFileSystem,
47 absoluteFrom,
48 absoluteFromSourceFile,
49 basename,
50 dirname,
51 getFileSystem,
52 getSourceFileOrError,
53 isLocalRelativePath,
54 isRoot,
55 isRooted,
56 join,
57 relative,
58 relativeFrom,
59 resolve,
60 setFileSystem,
61 toRelativeImport
62} from "./chunk-CLV7JFJQ.js";
63import {
64 ActivePerfRecorder,
65 PerfPhase
66} from "./chunk-R4NY3TJC.js";
67import {
68 __spreadValues
69} from "./chunk-GMSUYBZP.js";
70
71// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/version.mjs
72import { Version } from "@angular/compiler";
73var VERSION = new Version("13.3.8");
74
75// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/tsc_plugin.mjs
76var NgTscPlugin = class {
77 constructor(ngOptions) {
78 this.ngOptions = ngOptions;
79 this.name = "ngtsc";
80 this.options = null;
81 this.host = null;
82 this._compiler = null;
83 setFileSystem(new NodeJSFileSystem());
84 }
85 get compiler() {
86 if (this._compiler === null) {
87 throw new Error("Lifecycle error: setupCompilation() must be called first.");
88 }
89 return this._compiler;
90 }
91 wrapHost(host, inputFiles, options) {
92 this.options = __spreadValues(__spreadValues({}, this.ngOptions), options);
93 this.host = NgCompilerHost.wrap(host, inputFiles, this.options, null);
94 return this.host;
95 }
96 setupCompilation(program, oldProgram) {
97 var _a;
98 const perfRecorder = ActivePerfRecorder.zeroedToNow();
99 if (this.host === null || this.options === null) {
100 throw new Error("Lifecycle error: setupCompilation() before wrapHost().");
101 }
102 this.host.postProgramCreationCleanup();
103 untagAllTsFiles(program);
104 const programDriver = new TsCreateProgramDriver(program, this.host, this.options, this.host.shimExtensionPrefixes);
105 const strategy = new PatchedProgramIncrementalBuildStrategy();
106 const oldState = oldProgram !== void 0 ? strategy.getIncrementalState(oldProgram) : null;
107 let ticket;
108 const modifiedResourceFiles = /* @__PURE__ */ new Set();
109 if (this.host.getModifiedResourceFiles !== void 0) {
110 for (const resourceFile of (_a = this.host.getModifiedResourceFiles()) != null ? _a : []) {
111 modifiedResourceFiles.add(resolve(resourceFile));
112 }
113 }
114 if (oldProgram === void 0 || oldState === null) {
115 ticket = freshCompilationTicket(program, this.options, strategy, programDriver, perfRecorder, false, false);
116 } else {
117 strategy.toNextBuildStrategy().getIncrementalState(oldProgram);
118 ticket = incrementalFromStateTicket(oldProgram, oldState, program, this.options, strategy, programDriver, modifiedResourceFiles, perfRecorder, false, false);
119 }
120 this._compiler = NgCompiler.fromTicket(ticket, this.host);
121 return {
122 ignoreForDiagnostics: this._compiler.ignoreForDiagnostics,
123 ignoreForEmit: this._compiler.ignoreForEmit
124 };
125 }
126 getDiagnostics(file) {
127 if (file === void 0) {
128 return this.compiler.getDiagnostics();
129 }
130 return this.compiler.getDiagnosticsForFile(file, OptimizeFor.WholeProgram);
131 }
132 getOptionDiagnostics() {
133 return this.compiler.getOptionDiagnostics();
134 }
135 getNextProgram() {
136 return this.compiler.getCurrentProgram();
137 }
138 createTransformers() {
139 this.compiler.perfRecorder.phase(PerfPhase.TypeScriptEmit);
140 return this.compiler.prepareEmit().transformers;
141 }
142};
143
144// bazel-out/k8-fastbuild/bin/packages/compiler-cli/index.mjs
145setFileSystem(new NodeJSFileSystem());
146export {
147 ConsoleLogger,
148 DEFAULT_ERROR_CODE,
149 EmitFlags,
150 GLOBAL_DEFS_FOR_TERSER,
151 GLOBAL_DEFS_FOR_TERSER_WITH_AOT,
152 LogLevel,
153 LogicalFileSystem,
154 LogicalProjectPath,
155 NgTscPlugin,
156 NgtscCompilerHost,
157 NgtscProgram,
158 NodeJSFileSystem,
159 OptimizeFor,
160 SOURCE,
161 UNKNOWN_ERROR_CODE,
162 VERSION,
163 absoluteFrom,
164 absoluteFromSourceFile,
165 basename,
166 calcProjectFileAndBasePath,
167 constructorParametersDownlevelTransform,
168 createCompilerHost,
169 createProgram,
170 defaultGatherDiagnostics,
171 dirname,
172 exitCodeFromResult,
173 formatDiagnostics,
174 getFileSystem,
175 getSourceFileOrError,
176 isLocalRelativePath,
177 isRoot,
178 isRooted,
179 isTsDiagnostic,
180 join,
181 performCompilation,
182 readConfiguration,
183 relative,
184 relativeFrom,
185 resolve,
186 setFileSystem,
187 toRelativeImport
188};
189/**
190 * @license
191 * Copyright Google LLC All Rights Reserved.
192 *
193 * Use of this source code is governed by an MIT-style license that can be
194 * found in the LICENSE file at https://angular.io/license
195 */
196//# sourceMappingURL=index.js.map