@angular/compiler-cli 15.2.0-rc.0 → 15.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/bundles/{chunk-HYFCMILZ.js → chunk-2OF2AI57.js} +11 -9
  2. package/bundles/chunk-2OF2AI57.js.map +6 -0
  3. package/bundles/{chunk-64X67E3N.js → chunk-2PLRZDNU.js} +4 -4
  4. package/bundles/{chunk-Q6W3UCXI.js → chunk-J3L7WZP3.js} +91 -124
  5. package/bundles/chunk-J3L7WZP3.js.map +6 -0
  6. package/bundles/{chunk-BEXFRTBC.js → chunk-MLCT4AWL.js} +3 -3
  7. package/bundles/{chunk-OAZD7RII.js → chunk-NXCQCU6C.js} +9 -7
  8. package/bundles/chunk-NXCQCU6C.js.map +6 -0
  9. package/bundles/{chunk-ZB4CDKOH.js → chunk-P6SWFK2U.js} +2 -2
  10. package/bundles/{chunk-JYL7IHZC.js → chunk-PKSKJEUS.js} +10 -8
  11. package/bundles/chunk-PKSKJEUS.js.map +6 -0
  12. package/bundles/chunk-QRHWLC7U.js +714 -0
  13. package/bundles/chunk-QRHWLC7U.js.map +6 -0
  14. package/bundles/chunk-ZCBRXUPO.js +877 -0
  15. package/bundles/chunk-ZCBRXUPO.js.map +6 -0
  16. package/bundles/index.js +6 -5
  17. package/bundles/index.js.map +1 -1
  18. package/bundles/linker/babel/index.js +3 -2
  19. package/bundles/linker/babel/index.js.map +1 -1
  20. package/bundles/linker/index.js +3 -2
  21. package/bundles/ngcc/index.js +6 -5
  22. package/bundles/ngcc/index.js.map +1 -1
  23. package/bundles/ngcc/main-ngcc.js +6 -5
  24. package/bundles/ngcc/main-ngcc.js.map +1 -1
  25. package/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js +5 -4
  26. package/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js.map +1 -1
  27. package/bundles/private/migrations.js +3 -2
  28. package/bundles/private/tooling.js +3 -1
  29. package/bundles/src/bin/ng_xi18n.js +5 -4
  30. package/bundles/src/bin/ng_xi18n.js.map +1 -1
  31. package/bundles/src/bin/ngc.js +5 -4
  32. package/bundles/src/bin/ngc.js.map +1 -1
  33. package/bundles_metadata.json +1 -1
  34. package/ngcc/src/packages/build_marker.d.ts +1 -1
  35. package/package.json +2 -2
  36. package/src/ngtsc/imports/index.d.ts +1 -0
  37. package/src/ngtsc/imports/src/default.d.ts +6 -10
  38. package/src/ngtsc/imports/src/patch_alias_reference_resolution.d.ts +61 -0
  39. package/bundles/chunk-HYFCMILZ.js.map +0 -6
  40. package/bundles/chunk-JYL7IHZC.js.map +0 -6
  41. package/bundles/chunk-OAZD7RII.js.map +0 -6
  42. package/bundles/chunk-Q6W3UCXI.js.map +0 -6
  43. package/bundles/chunk-Z534TW2O.js +0 -1540
  44. package/bundles/chunk-Z534TW2O.js.map +0 -6
  45. package/src/transformers/downlevel_decorators_transform/patch_alias_reference_resolution.d.ts +0 -14
  46. /package/bundles/{chunk-64X67E3N.js.map → chunk-2PLRZDNU.js.map} +0 -0
  47. /package/bundles/{chunk-BEXFRTBC.js.map → chunk-MLCT4AWL.js.map} +0 -0
  48. /package/bundles/{chunk-ZB4CDKOH.js.map → chunk-P6SWFK2U.js.map} +0 -0
@@ -1,1540 +0,0 @@
1
-
2
- import {createRequire as __cjsCompatRequire} from 'module';
3
- const require = __cjsCompatRequire(import.meta.url);
4
-
5
- import {
6
- LogicalProjectPath,
7
- absoluteFrom,
8
- absoluteFromSourceFile,
9
- dirname,
10
- getFileSystem,
11
- relative,
12
- resolve,
13
- stripExtension,
14
- toRelativeImport
15
- } from "./chunk-EC5K6QPP.js";
16
-
17
- // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/util/src/typescript.mjs
18
- import ts from "typescript";
19
- var TS = /\.tsx?$/i;
20
- var D_TS = /\.d\.ts$/i;
21
- function isSymbolWithValueDeclaration(symbol) {
22
- return symbol != null && symbol.valueDeclaration !== void 0 && symbol.declarations !== void 0;
23
- }
24
- function isDtsPath(filePath) {
25
- return D_TS.test(filePath);
26
- }
27
- function isNonDeclarationTsPath(filePath) {
28
- return TS.test(filePath) && !D_TS.test(filePath);
29
- }
30
- function isFromDtsFile(node) {
31
- let sf = node.getSourceFile();
32
- if (sf === void 0) {
33
- sf = ts.getOriginalNode(node).getSourceFile();
34
- }
35
- return sf !== void 0 && sf.isDeclarationFile;
36
- }
37
- function nodeNameForError(node) {
38
- if (node.name !== void 0 && ts.isIdentifier(node.name)) {
39
- return node.name.text;
40
- } else {
41
- const kind = ts.SyntaxKind[node.kind];
42
- const { line, character } = ts.getLineAndCharacterOfPosition(node.getSourceFile(), node.getStart());
43
- return `${kind}@${line}:${character}`;
44
- }
45
- }
46
- function getSourceFile(node) {
47
- const directSf = node.getSourceFile();
48
- return directSf !== void 0 ? directSf : ts.getOriginalNode(node).getSourceFile();
49
- }
50
- function getSourceFileOrNull(program, fileName) {
51
- return program.getSourceFile(fileName) || null;
52
- }
53
- function getTokenAtPosition(sf, pos) {
54
- return ts.getTokenAtPosition(sf, pos);
55
- }
56
- function identifierOfNode(decl) {
57
- if (decl.name !== void 0 && ts.isIdentifier(decl.name)) {
58
- return decl.name;
59
- } else {
60
- return null;
61
- }
62
- }
63
- function isDeclaration(node) {
64
- return isValueDeclaration(node) || isTypeDeclaration(node);
65
- }
66
- function isValueDeclaration(node) {
67
- return ts.isClassDeclaration(node) || ts.isFunctionDeclaration(node) || ts.isVariableDeclaration(node);
68
- }
69
- function isTypeDeclaration(node) {
70
- return ts.isEnumDeclaration(node) || ts.isTypeAliasDeclaration(node) || ts.isInterfaceDeclaration(node);
71
- }
72
- function isNamedDeclaration(node) {
73
- const namedNode = node;
74
- return namedNode.name !== void 0 && ts.isIdentifier(namedNode.name);
75
- }
76
- function getRootDirs(host, options) {
77
- const rootDirs = [];
78
- const cwd = host.getCurrentDirectory();
79
- const fs = getFileSystem();
80
- if (options.rootDirs !== void 0) {
81
- rootDirs.push(...options.rootDirs);
82
- } else if (options.rootDir !== void 0) {
83
- rootDirs.push(options.rootDir);
84
- } else {
85
- rootDirs.push(cwd);
86
- }
87
- return rootDirs.map((rootDir) => fs.resolve(cwd, host.getCanonicalFileName(rootDir)));
88
- }
89
- function nodeDebugInfo(node) {
90
- const sf = getSourceFile(node);
91
- const { line, character } = ts.getLineAndCharacterOfPosition(sf, node.pos);
92
- return `[${sf.fileName}: ${ts.SyntaxKind[node.kind]} @ ${line}:${character}]`;
93
- }
94
- function resolveModuleName(moduleName, containingFile, compilerOptions, compilerHost, moduleResolutionCache) {
95
- if (compilerHost.resolveModuleNames) {
96
- return compilerHost.resolveModuleNames(
97
- [moduleName],
98
- containingFile,
99
- void 0,
100
- void 0,
101
- compilerOptions
102
- )[0];
103
- } else {
104
- return ts.resolveModuleName(moduleName, containingFile, compilerOptions, compilerHost, moduleResolutionCache !== null ? moduleResolutionCache : void 0).resolvedModule;
105
- }
106
- }
107
- function isAssignment(node) {
108
- return ts.isBinaryExpression(node) && node.operatorToken.kind === ts.SyntaxKind.EqualsToken;
109
- }
110
- function toUnredirectedSourceFile(sf) {
111
- const redirectInfo = sf.redirectInfo;
112
- if (redirectInfo === void 0) {
113
- return sf;
114
- }
115
- return redirectInfo.unredirected;
116
- }
117
-
118
- // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/references.mjs
119
- var Reference = class {
120
- constructor(node, bestGuessOwningModule = null) {
121
- this.node = node;
122
- this.identifiers = [];
123
- this.synthetic = false;
124
- this._alias = null;
125
- this.bestGuessOwningModule = bestGuessOwningModule;
126
- const id = identifierOfNode(node);
127
- if (id !== null) {
128
- this.identifiers.push(id);
129
- }
130
- }
131
- get ownedByModuleGuess() {
132
- if (this.bestGuessOwningModule !== null) {
133
- return this.bestGuessOwningModule.specifier;
134
- } else {
135
- return null;
136
- }
137
- }
138
- get hasOwningModuleGuess() {
139
- return this.bestGuessOwningModule !== null;
140
- }
141
- get debugName() {
142
- const id = identifierOfNode(this.node);
143
- return id !== null ? id.text : null;
144
- }
145
- get alias() {
146
- return this._alias;
147
- }
148
- addIdentifier(identifier) {
149
- this.identifiers.push(identifier);
150
- }
151
- getIdentityIn(context) {
152
- return this.identifiers.find((id) => id.getSourceFile() === context) || null;
153
- }
154
- getIdentityInExpression(expr) {
155
- const sf = expr.getSourceFile();
156
- return this.identifiers.find((id) => {
157
- if (id.getSourceFile() !== sf) {
158
- return false;
159
- }
160
- return id.pos >= expr.pos && id.end <= expr.end;
161
- }) || null;
162
- }
163
- getOriginForDiagnostics(container, fallback = container) {
164
- const id = this.getIdentityInExpression(container);
165
- return id !== null ? id : fallback;
166
- }
167
- cloneWithAlias(alias) {
168
- const ref = new Reference(this.node, this.bestGuessOwningModule);
169
- ref.identifiers = [...this.identifiers];
170
- ref._alias = alias;
171
- return ref;
172
- }
173
- cloneWithNoIdentifiers() {
174
- const ref = new Reference(this.node, this.bestGuessOwningModule);
175
- ref._alias = this._alias;
176
- ref.identifiers = [];
177
- return ref;
178
- }
179
- };
180
-
181
- // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/alias.mjs
182
- import { ExternalExpr as ExternalExpr2 } from "@angular/compiler";
183
-
184
- // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/emitter.mjs
185
- import { ExternalExpr, ExternalReference, WrappedNodeExpr } from "@angular/compiler";
186
- import ts3 from "typescript";
187
-
188
- // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/diagnostics/src/error_code.mjs
189
- var ErrorCode;
190
- (function(ErrorCode2) {
191
- ErrorCode2[ErrorCode2["DECORATOR_ARG_NOT_LITERAL"] = 1001] = "DECORATOR_ARG_NOT_LITERAL";
192
- ErrorCode2[ErrorCode2["DECORATOR_ARITY_WRONG"] = 1002] = "DECORATOR_ARITY_WRONG";
193
- ErrorCode2[ErrorCode2["DECORATOR_NOT_CALLED"] = 1003] = "DECORATOR_NOT_CALLED";
194
- ErrorCode2[ErrorCode2["DECORATOR_UNEXPECTED"] = 1005] = "DECORATOR_UNEXPECTED";
195
- ErrorCode2[ErrorCode2["DECORATOR_COLLISION"] = 1006] = "DECORATOR_COLLISION";
196
- ErrorCode2[ErrorCode2["VALUE_HAS_WRONG_TYPE"] = 1010] = "VALUE_HAS_WRONG_TYPE";
197
- ErrorCode2[ErrorCode2["VALUE_NOT_LITERAL"] = 1011] = "VALUE_NOT_LITERAL";
198
- ErrorCode2[ErrorCode2["COMPONENT_MISSING_TEMPLATE"] = 2001] = "COMPONENT_MISSING_TEMPLATE";
199
- ErrorCode2[ErrorCode2["PIPE_MISSING_NAME"] = 2002] = "PIPE_MISSING_NAME";
200
- ErrorCode2[ErrorCode2["PARAM_MISSING_TOKEN"] = 2003] = "PARAM_MISSING_TOKEN";
201
- ErrorCode2[ErrorCode2["DIRECTIVE_MISSING_SELECTOR"] = 2004] = "DIRECTIVE_MISSING_SELECTOR";
202
- ErrorCode2[ErrorCode2["UNDECORATED_PROVIDER"] = 2005] = "UNDECORATED_PROVIDER";
203
- ErrorCode2[ErrorCode2["DIRECTIVE_INHERITS_UNDECORATED_CTOR"] = 2006] = "DIRECTIVE_INHERITS_UNDECORATED_CTOR";
204
- ErrorCode2[ErrorCode2["UNDECORATED_CLASS_USING_ANGULAR_FEATURES"] = 2007] = "UNDECORATED_CLASS_USING_ANGULAR_FEATURES";
205
- ErrorCode2[ErrorCode2["COMPONENT_RESOURCE_NOT_FOUND"] = 2008] = "COMPONENT_RESOURCE_NOT_FOUND";
206
- ErrorCode2[ErrorCode2["COMPONENT_INVALID_SHADOW_DOM_SELECTOR"] = 2009] = "COMPONENT_INVALID_SHADOW_DOM_SELECTOR";
207
- ErrorCode2[ErrorCode2["COMPONENT_NOT_STANDALONE"] = 2010] = "COMPONENT_NOT_STANDALONE";
208
- ErrorCode2[ErrorCode2["COMPONENT_IMPORT_NOT_STANDALONE"] = 2011] = "COMPONENT_IMPORT_NOT_STANDALONE";
209
- ErrorCode2[ErrorCode2["COMPONENT_UNKNOWN_IMPORT"] = 2012] = "COMPONENT_UNKNOWN_IMPORT";
210
- ErrorCode2[ErrorCode2["HOST_DIRECTIVE_INVALID"] = 2013] = "HOST_DIRECTIVE_INVALID";
211
- ErrorCode2[ErrorCode2["HOST_DIRECTIVE_NOT_STANDALONE"] = 2014] = "HOST_DIRECTIVE_NOT_STANDALONE";
212
- ErrorCode2[ErrorCode2["HOST_DIRECTIVE_COMPONENT"] = 2015] = "HOST_DIRECTIVE_COMPONENT";
213
- ErrorCode2[ErrorCode2["INJECTABLE_INHERITS_INVALID_CONSTRUCTOR"] = 2016] = "INJECTABLE_INHERITS_INVALID_CONSTRUCTOR";
214
- ErrorCode2[ErrorCode2["HOST_DIRECTIVE_UNDEFINED_BINDING"] = 2017] = "HOST_DIRECTIVE_UNDEFINED_BINDING";
215
- ErrorCode2[ErrorCode2["HOST_DIRECTIVE_CONFLICTING_ALIAS"] = 2018] = "HOST_DIRECTIVE_CONFLICTING_ALIAS";
216
- ErrorCode2[ErrorCode2["SYMBOL_NOT_EXPORTED"] = 3001] = "SYMBOL_NOT_EXPORTED";
217
- ErrorCode2[ErrorCode2["IMPORT_CYCLE_DETECTED"] = 3003] = "IMPORT_CYCLE_DETECTED";
218
- ErrorCode2[ErrorCode2["IMPORT_GENERATION_FAILURE"] = 3004] = "IMPORT_GENERATION_FAILURE";
219
- ErrorCode2[ErrorCode2["CONFIG_FLAT_MODULE_NO_INDEX"] = 4001] = "CONFIG_FLAT_MODULE_NO_INDEX";
220
- ErrorCode2[ErrorCode2["CONFIG_STRICT_TEMPLATES_IMPLIES_FULL_TEMPLATE_TYPECHECK"] = 4002] = "CONFIG_STRICT_TEMPLATES_IMPLIES_FULL_TEMPLATE_TYPECHECK";
221
- ErrorCode2[ErrorCode2["CONFIG_EXTENDED_DIAGNOSTICS_IMPLIES_STRICT_TEMPLATES"] = 4003] = "CONFIG_EXTENDED_DIAGNOSTICS_IMPLIES_STRICT_TEMPLATES";
222
- ErrorCode2[ErrorCode2["CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL"] = 4004] = "CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL";
223
- ErrorCode2[ErrorCode2["CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CHECK"] = 4005] = "CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CHECK";
224
- ErrorCode2[ErrorCode2["HOST_BINDING_PARSE_ERROR"] = 5001] = "HOST_BINDING_PARSE_ERROR";
225
- ErrorCode2[ErrorCode2["TEMPLATE_PARSE_ERROR"] = 5002] = "TEMPLATE_PARSE_ERROR";
226
- ErrorCode2[ErrorCode2["NGMODULE_INVALID_DECLARATION"] = 6001] = "NGMODULE_INVALID_DECLARATION";
227
- ErrorCode2[ErrorCode2["NGMODULE_INVALID_IMPORT"] = 6002] = "NGMODULE_INVALID_IMPORT";
228
- ErrorCode2[ErrorCode2["NGMODULE_INVALID_EXPORT"] = 6003] = "NGMODULE_INVALID_EXPORT";
229
- ErrorCode2[ErrorCode2["NGMODULE_INVALID_REEXPORT"] = 6004] = "NGMODULE_INVALID_REEXPORT";
230
- ErrorCode2[ErrorCode2["NGMODULE_MODULE_WITH_PROVIDERS_MISSING_GENERIC"] = 6005] = "NGMODULE_MODULE_WITH_PROVIDERS_MISSING_GENERIC";
231
- ErrorCode2[ErrorCode2["NGMODULE_REEXPORT_NAME_COLLISION"] = 6006] = "NGMODULE_REEXPORT_NAME_COLLISION";
232
- ErrorCode2[ErrorCode2["NGMODULE_DECLARATION_NOT_UNIQUE"] = 6007] = "NGMODULE_DECLARATION_NOT_UNIQUE";
233
- ErrorCode2[ErrorCode2["NGMODULE_DECLARATION_IS_STANDALONE"] = 6008] = "NGMODULE_DECLARATION_IS_STANDALONE";
234
- ErrorCode2[ErrorCode2["NGMODULE_BOOTSTRAP_IS_STANDALONE"] = 6009] = "NGMODULE_BOOTSTRAP_IS_STANDALONE";
235
- ErrorCode2[ErrorCode2["WARN_NGMODULE_ID_UNNECESSARY"] = 6100] = "WARN_NGMODULE_ID_UNNECESSARY";
236
- ErrorCode2[ErrorCode2["NGMODULE_VE_DEPENDENCY_ON_IVY_LIB"] = 6999] = "NGMODULE_VE_DEPENDENCY_ON_IVY_LIB";
237
- ErrorCode2[ErrorCode2["SCHEMA_INVALID_ELEMENT"] = 8001] = "SCHEMA_INVALID_ELEMENT";
238
- ErrorCode2[ErrorCode2["SCHEMA_INVALID_ATTRIBUTE"] = 8002] = "SCHEMA_INVALID_ATTRIBUTE";
239
- ErrorCode2[ErrorCode2["MISSING_REFERENCE_TARGET"] = 8003] = "MISSING_REFERENCE_TARGET";
240
- ErrorCode2[ErrorCode2["MISSING_PIPE"] = 8004] = "MISSING_PIPE";
241
- ErrorCode2[ErrorCode2["WRITE_TO_READ_ONLY_VARIABLE"] = 8005] = "WRITE_TO_READ_ONLY_VARIABLE";
242
- ErrorCode2[ErrorCode2["DUPLICATE_VARIABLE_DECLARATION"] = 8006] = "DUPLICATE_VARIABLE_DECLARATION";
243
- ErrorCode2[ErrorCode2["SPLIT_TWO_WAY_BINDING"] = 8007] = "SPLIT_TWO_WAY_BINDING";
244
- ErrorCode2[ErrorCode2["INVALID_BANANA_IN_BOX"] = 8101] = "INVALID_BANANA_IN_BOX";
245
- ErrorCode2[ErrorCode2["NULLISH_COALESCING_NOT_NULLABLE"] = 8102] = "NULLISH_COALESCING_NOT_NULLABLE";
246
- ErrorCode2[ErrorCode2["MISSING_CONTROL_FLOW_DIRECTIVE"] = 8103] = "MISSING_CONTROL_FLOW_DIRECTIVE";
247
- ErrorCode2[ErrorCode2["TEXT_ATTRIBUTE_NOT_BINDING"] = 8104] = "TEXT_ATTRIBUTE_NOT_BINDING";
248
- ErrorCode2[ErrorCode2["MISSING_NGFOROF_LET"] = 8105] = "MISSING_NGFOROF_LET";
249
- ErrorCode2[ErrorCode2["SUFFIX_NOT_SUPPORTED"] = 8106] = "SUFFIX_NOT_SUPPORTED";
250
- ErrorCode2[ErrorCode2["OPTIONAL_CHAIN_NOT_NULLABLE"] = 8107] = "OPTIONAL_CHAIN_NOT_NULLABLE";
251
- ErrorCode2[ErrorCode2["INLINE_TCB_REQUIRED"] = 8900] = "INLINE_TCB_REQUIRED";
252
- ErrorCode2[ErrorCode2["INLINE_TYPE_CTOR_REQUIRED"] = 8901] = "INLINE_TYPE_CTOR_REQUIRED";
253
- ErrorCode2[ErrorCode2["INJECTABLE_DUPLICATE_PROV"] = 9001] = "INJECTABLE_DUPLICATE_PROV";
254
- ErrorCode2[ErrorCode2["SUGGEST_STRICT_TEMPLATES"] = 10001] = "SUGGEST_STRICT_TEMPLATES";
255
- ErrorCode2[ErrorCode2["SUGGEST_SUBOPTIMAL_TYPE_INFERENCE"] = 10002] = "SUGGEST_SUBOPTIMAL_TYPE_INFERENCE";
256
- })(ErrorCode || (ErrorCode = {}));
257
-
258
- // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/diagnostics/src/docs.mjs
259
- var COMPILER_ERRORS_WITH_GUIDES = /* @__PURE__ */ new Set([
260
- ErrorCode.DECORATOR_ARG_NOT_LITERAL,
261
- ErrorCode.IMPORT_CYCLE_DETECTED,
262
- ErrorCode.PARAM_MISSING_TOKEN,
263
- ErrorCode.SCHEMA_INVALID_ELEMENT,
264
- ErrorCode.SCHEMA_INVALID_ATTRIBUTE,
265
- ErrorCode.MISSING_REFERENCE_TARGET,
266
- ErrorCode.COMPONENT_INVALID_SHADOW_DOM_SELECTOR,
267
- ErrorCode.WARN_NGMODULE_ID_UNNECESSARY
268
- ]);
269
-
270
- // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/diagnostics/src/error.mjs
271
- import ts2 from "typescript";
272
-
273
- // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/diagnostics/src/util.mjs
274
- var ERROR_CODE_MATCHER = /(\u001b\[\d+m ?)TS-99(\d+: ?\u001b\[\d+m)/g;
275
- function replaceTsWithNgInErrors(errors) {
276
- return errors.replace(ERROR_CODE_MATCHER, "$1NG$2");
277
- }
278
- function ngErrorCode(code) {
279
- return parseInt("-99" + code);
280
- }
281
-
282
- // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/diagnostics/src/error.mjs
283
- var FatalDiagnosticError = class {
284
- constructor(code, node, message, relatedInformation) {
285
- this.code = code;
286
- this.node = node;
287
- this.message = message;
288
- this.relatedInformation = relatedInformation;
289
- this._isFatalDiagnosticError = true;
290
- }
291
- toDiagnostic() {
292
- return makeDiagnostic(this.code, this.node, this.message, this.relatedInformation);
293
- }
294
- };
295
- function makeDiagnostic(code, node, messageText, relatedInformation) {
296
- node = ts2.getOriginalNode(node);
297
- return {
298
- category: ts2.DiagnosticCategory.Error,
299
- code: ngErrorCode(code),
300
- file: ts2.getOriginalNode(node).getSourceFile(),
301
- start: node.getStart(void 0, false),
302
- length: node.getWidth(),
303
- messageText,
304
- relatedInformation
305
- };
306
- }
307
- function makeDiagnosticChain(messageText, next) {
308
- return {
309
- category: ts2.DiagnosticCategory.Message,
310
- code: 0,
311
- messageText,
312
- next
313
- };
314
- }
315
- function makeRelatedInformation(node, messageText) {
316
- node = ts2.getOriginalNode(node);
317
- return {
318
- category: ts2.DiagnosticCategory.Message,
319
- code: 0,
320
- file: node.getSourceFile(),
321
- start: node.getStart(),
322
- length: node.getWidth(),
323
- messageText
324
- };
325
- }
326
- function addDiagnosticChain(messageText, add) {
327
- if (typeof messageText === "string") {
328
- return makeDiagnosticChain(messageText, add);
329
- }
330
- if (messageText.next === void 0) {
331
- messageText.next = add;
332
- } else {
333
- messageText.next.push(...add);
334
- }
335
- return messageText;
336
- }
337
- function isFatalDiagnosticError(err) {
338
- return err._isFatalDiagnosticError === true;
339
- }
340
-
341
- // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/diagnostics/src/error_details_base_url.mjs
342
- var ERROR_DETAILS_PAGE_BASE_URL = "https://angular.io/errors";
343
-
344
- // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/diagnostics/src/extended_template_diagnostic_name.mjs
345
- var ExtendedTemplateDiagnosticName;
346
- (function(ExtendedTemplateDiagnosticName2) {
347
- ExtendedTemplateDiagnosticName2["INVALID_BANANA_IN_BOX"] = "invalidBananaInBox";
348
- ExtendedTemplateDiagnosticName2["NULLISH_COALESCING_NOT_NULLABLE"] = "nullishCoalescingNotNullable";
349
- ExtendedTemplateDiagnosticName2["OPTIONAL_CHAIN_NOT_NULLABLE"] = "optionalChainNotNullable";
350
- ExtendedTemplateDiagnosticName2["MISSING_CONTROL_FLOW_DIRECTIVE"] = "missingControlFlowDirective";
351
- ExtendedTemplateDiagnosticName2["TEXT_ATTRIBUTE_NOT_BINDING"] = "textAttributeNotBinding";
352
- ExtendedTemplateDiagnosticName2["MISSING_NGFOROF_LET"] = "missingNgForOfLet";
353
- ExtendedTemplateDiagnosticName2["SUFFIX_NOT_SUPPORTED"] = "suffixNotSupported";
354
- })(ExtendedTemplateDiagnosticName || (ExtendedTemplateDiagnosticName = {}));
355
-
356
- // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/find_export.mjs
357
- function findExportedNameOfNode(target, file, reflector) {
358
- const exports = reflector.getExportsOfModule(file);
359
- if (exports === null) {
360
- return null;
361
- }
362
- const declaredName = isNamedDeclaration(target) ? target.name.text : null;
363
- let foundExportName = null;
364
- for (const [exportName, declaration] of exports) {
365
- if (declaration.node !== target) {
366
- continue;
367
- }
368
- if (exportName === declaredName) {
369
- return exportName;
370
- }
371
- foundExportName = exportName;
372
- }
373
- return foundExportName;
374
- }
375
-
376
- // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/emitter.mjs
377
- var ImportFlags;
378
- (function(ImportFlags2) {
379
- ImportFlags2[ImportFlags2["None"] = 0] = "None";
380
- ImportFlags2[ImportFlags2["ForceNewImport"] = 1] = "ForceNewImport";
381
- ImportFlags2[ImportFlags2["NoAliasing"] = 2] = "NoAliasing";
382
- ImportFlags2[ImportFlags2["AllowTypeImports"] = 4] = "AllowTypeImports";
383
- ImportFlags2[ImportFlags2["AllowRelativeDtsImports"] = 8] = "AllowRelativeDtsImports";
384
- })(ImportFlags || (ImportFlags = {}));
385
- function assertSuccessfulReferenceEmit(result, origin, typeKind) {
386
- if (result.kind === 0) {
387
- return;
388
- }
389
- const message = makeDiagnosticChain(`Unable to import ${typeKind} ${nodeNameForError(result.ref.node)}.`, [makeDiagnosticChain(result.reason)]);
390
- throw new FatalDiagnosticError(ErrorCode.IMPORT_GENERATION_FAILURE, origin, message, [makeRelatedInformation(result.ref.node, `The ${typeKind} is declared here.`)]);
391
- }
392
- var ReferenceEmitter = class {
393
- constructor(strategies) {
394
- this.strategies = strategies;
395
- }
396
- emit(ref, context, importFlags = ImportFlags.None) {
397
- for (const strategy of this.strategies) {
398
- const emitted = strategy.emit(ref, context, importFlags);
399
- if (emitted !== null) {
400
- return emitted;
401
- }
402
- }
403
- return {
404
- kind: 1,
405
- ref,
406
- context,
407
- reason: `Unable to write a reference to ${nodeNameForError(ref.node)}.`
408
- };
409
- }
410
- };
411
- var LocalIdentifierStrategy = class {
412
- emit(ref, context, importFlags) {
413
- const refSf = getSourceFile(ref.node);
414
- if (importFlags & ImportFlags.ForceNewImport && refSf !== context) {
415
- return null;
416
- }
417
- if (!isDeclaration(ref.node) && refSf === context) {
418
- return {
419
- kind: 0,
420
- expression: new WrappedNodeExpr(ref.node),
421
- importedFile: null
422
- };
423
- }
424
- const identifier = ref.getIdentityIn(context);
425
- if (identifier !== null) {
426
- return {
427
- kind: 0,
428
- expression: new WrappedNodeExpr(identifier),
429
- importedFile: null
430
- };
431
- } else {
432
- return null;
433
- }
434
- }
435
- };
436
- var AbsoluteModuleStrategy = class {
437
- constructor(program, checker, moduleResolver, reflectionHost) {
438
- this.program = program;
439
- this.checker = checker;
440
- this.moduleResolver = moduleResolver;
441
- this.reflectionHost = reflectionHost;
442
- this.moduleExportsCache = /* @__PURE__ */ new Map();
443
- }
444
- emit(ref, context, importFlags) {
445
- if (ref.bestGuessOwningModule === null) {
446
- return null;
447
- } else if (!isDeclaration(ref.node)) {
448
- throw new Error(`Debug assert: unable to import a Reference to non-declaration of type ${ts3.SyntaxKind[ref.node.kind]}.`);
449
- } else if ((importFlags & ImportFlags.AllowTypeImports) === 0 && isTypeDeclaration(ref.node)) {
450
- throw new Error(`Importing a type-only declaration of type ${ts3.SyntaxKind[ref.node.kind]} in a value position is not allowed.`);
451
- }
452
- const { specifier, resolutionContext } = ref.bestGuessOwningModule;
453
- const exports = this.getExportsOfModule(specifier, resolutionContext);
454
- if (exports.module === null) {
455
- return {
456
- kind: 1,
457
- ref,
458
- context,
459
- reason: `The module '${specifier}' could not be found.`
460
- };
461
- } else if (exports.exportMap === null || !exports.exportMap.has(ref.node)) {
462
- return {
463
- kind: 1,
464
- ref,
465
- context,
466
- reason: `The symbol is not exported from ${exports.module.fileName} (module '${specifier}').`
467
- };
468
- }
469
- const symbolName = exports.exportMap.get(ref.node);
470
- return {
471
- kind: 0,
472
- expression: new ExternalExpr(new ExternalReference(specifier, symbolName)),
473
- importedFile: exports.module
474
- };
475
- }
476
- getExportsOfModule(moduleName, fromFile) {
477
- if (!this.moduleExportsCache.has(moduleName)) {
478
- this.moduleExportsCache.set(moduleName, this.enumerateExportsOfModule(moduleName, fromFile));
479
- }
480
- return this.moduleExportsCache.get(moduleName);
481
- }
482
- enumerateExportsOfModule(specifier, fromFile) {
483
- const entryPointFile = this.moduleResolver.resolveModule(specifier, fromFile);
484
- if (entryPointFile === null) {
485
- return { module: null, exportMap: null };
486
- }
487
- const exports = this.reflectionHost.getExportsOfModule(entryPointFile);
488
- if (exports === null) {
489
- return { module: entryPointFile, exportMap: null };
490
- }
491
- const exportMap = /* @__PURE__ */ new Map();
492
- for (const [name, declaration] of exports) {
493
- if (exportMap.has(declaration.node)) {
494
- const existingExport = exportMap.get(declaration.node);
495
- if (isNamedDeclaration(declaration.node) && declaration.node.name.text === existingExport) {
496
- continue;
497
- }
498
- }
499
- exportMap.set(declaration.node, name);
500
- }
501
- return { module: entryPointFile, exportMap };
502
- }
503
- };
504
- var LogicalProjectStrategy = class {
505
- constructor(reflector, logicalFs) {
506
- this.reflector = reflector;
507
- this.logicalFs = logicalFs;
508
- this.relativePathStrategy = new RelativePathStrategy(this.reflector);
509
- }
510
- emit(ref, context, importFlags) {
511
- const destSf = getSourceFile(ref.node);
512
- const destPath = this.logicalFs.logicalPathOfSf(destSf);
513
- if (destPath === null) {
514
- if (destSf.isDeclarationFile && importFlags & ImportFlags.AllowRelativeDtsImports) {
515
- return this.relativePathStrategy.emit(ref, context);
516
- }
517
- return {
518
- kind: 1,
519
- ref,
520
- context,
521
- reason: `The file ${destSf.fileName} is outside of the configured 'rootDir'.`
522
- };
523
- }
524
- const originPath = this.logicalFs.logicalPathOfSf(context);
525
- if (originPath === null) {
526
- throw new Error(`Debug assert: attempt to import from ${context.fileName} but it's outside the program?`);
527
- }
528
- if (destPath === originPath) {
529
- return null;
530
- }
531
- const name = findExportedNameOfNode(ref.node, destSf, this.reflector);
532
- if (name === null) {
533
- return {
534
- kind: 1,
535
- ref,
536
- context,
537
- reason: `The symbol is not exported from ${destSf.fileName}.`
538
- };
539
- }
540
- const moduleName = LogicalProjectPath.relativePathBetween(originPath, destPath);
541
- return {
542
- kind: 0,
543
- expression: new ExternalExpr({ moduleName, name }),
544
- importedFile: destSf
545
- };
546
- }
547
- };
548
- var RelativePathStrategy = class {
549
- constructor(reflector) {
550
- this.reflector = reflector;
551
- }
552
- emit(ref, context) {
553
- const destSf = getSourceFile(ref.node);
554
- const relativePath = relative(dirname(absoluteFromSourceFile(context)), absoluteFromSourceFile(destSf));
555
- const moduleName = toRelativeImport(stripExtension(relativePath));
556
- const name = findExportedNameOfNode(ref.node, destSf, this.reflector);
557
- if (name === null) {
558
- return {
559
- kind: 1,
560
- ref,
561
- context,
562
- reason: `The symbol is not exported from ${destSf.fileName}.`
563
- };
564
- }
565
- return {
566
- kind: 0,
567
- expression: new ExternalExpr({ moduleName, name }),
568
- importedFile: destSf
569
- };
570
- }
571
- };
572
- var UnifiedModulesStrategy = class {
573
- constructor(reflector, unifiedModulesHost) {
574
- this.reflector = reflector;
575
- this.unifiedModulesHost = unifiedModulesHost;
576
- }
577
- emit(ref, context) {
578
- const destSf = getSourceFile(ref.node);
579
- const name = findExportedNameOfNode(ref.node, destSf, this.reflector);
580
- if (name === null) {
581
- return null;
582
- }
583
- const moduleName = this.unifiedModulesHost.fileNameToModuleName(destSf.fileName, context.fileName);
584
- return {
585
- kind: 0,
586
- expression: new ExternalExpr({ moduleName, name }),
587
- importedFile: destSf
588
- };
589
- }
590
- };
591
-
592
- // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/alias.mjs
593
- var CHARS_TO_ESCAPE = /[^a-zA-Z0-9/_]/g;
594
- var UnifiedModulesAliasingHost = class {
595
- constructor(unifiedModulesHost) {
596
- this.unifiedModulesHost = unifiedModulesHost;
597
- this.aliasExportsInDts = false;
598
- }
599
- maybeAliasSymbolAs(ref, context, ngModuleName, isReExport) {
600
- if (!isReExport) {
601
- return null;
602
- }
603
- return this.aliasName(ref.node, context);
604
- }
605
- getAliasIn(decl, via, isReExport) {
606
- if (!isReExport) {
607
- return null;
608
- }
609
- const moduleName = this.unifiedModulesHost.fileNameToModuleName(via.fileName, via.fileName);
610
- return new ExternalExpr2({ moduleName, name: this.aliasName(decl, via) });
611
- }
612
- aliasName(decl, context) {
613
- const declModule = this.unifiedModulesHost.fileNameToModuleName(decl.getSourceFile().fileName, context.fileName);
614
- const replaced = declModule.replace(CHARS_TO_ESCAPE, "_").replace(/\//g, "$");
615
- return "\u0275ng$" + replaced + "$$" + decl.name.text;
616
- }
617
- };
618
- var PrivateExportAliasingHost = class {
619
- constructor(host) {
620
- this.host = host;
621
- this.aliasExportsInDts = true;
622
- }
623
- maybeAliasSymbolAs(ref, context, ngModuleName) {
624
- if (ref.hasOwningModuleGuess) {
625
- return null;
626
- }
627
- const exports = this.host.getExportsOfModule(context);
628
- if (exports === null) {
629
- throw new Error(`Could not determine the exports of: ${context.fileName}`);
630
- }
631
- let found = false;
632
- exports.forEach((value) => {
633
- if (value.node === ref.node) {
634
- found = true;
635
- }
636
- });
637
- if (found) {
638
- return null;
639
- }
640
- return `\u0275ngExport\u0275${ngModuleName}\u0275${ref.node.name.text}`;
641
- }
642
- getAliasIn() {
643
- return null;
644
- }
645
- };
646
- var AliasStrategy = class {
647
- emit(ref, context, importMode) {
648
- if (importMode & ImportFlags.NoAliasing || ref.alias === null) {
649
- return null;
650
- }
651
- return {
652
- kind: 0,
653
- expression: ref.alias,
654
- importedFile: "unknown"
655
- };
656
- }
657
- };
658
-
659
- // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/util/src/path.mjs
660
- function relativePathBetween(from, to) {
661
- const relativePath = stripExtension(relative(dirname(resolve(from)), resolve(to)));
662
- return relativePath !== "" ? toRelativeImport(relativePath) : null;
663
- }
664
- function normalizeSeparators(path) {
665
- return path.replace(/\\/g, "/");
666
- }
667
-
668
- // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/core.mjs
669
- var NoopImportRewriter = class {
670
- shouldImportSymbol(symbol, specifier) {
671
- return true;
672
- }
673
- rewriteSymbol(symbol, specifier) {
674
- return symbol;
675
- }
676
- rewriteSpecifier(specifier, inContextOfFile) {
677
- return specifier;
678
- }
679
- };
680
- var CORE_SUPPORTED_SYMBOLS = /* @__PURE__ */ new Map([
681
- ["\u0275\u0275defineInjectable", "\u0275\u0275defineInjectable"],
682
- ["\u0275\u0275defineInjector", "\u0275\u0275defineInjector"],
683
- ["\u0275\u0275defineNgModule", "\u0275\u0275defineNgModule"],
684
- ["\u0275\u0275setNgModuleScope", "\u0275\u0275setNgModuleScope"],
685
- ["\u0275\u0275inject", "\u0275\u0275inject"],
686
- ["\u0275\u0275FactoryDeclaration", "\u0275\u0275FactoryDeclaration"],
687
- ["\u0275setClassMetadata", "setClassMetadata"],
688
- ["\u0275\u0275InjectableDeclaration", "\u0275\u0275InjectableDeclaration"],
689
- ["\u0275\u0275InjectorDeclaration", "\u0275\u0275InjectorDeclaration"],
690
- ["\u0275\u0275NgModuleDeclaration", "\u0275\u0275NgModuleDeclaration"],
691
- ["\u0275NgModuleFactory", "NgModuleFactory"],
692
- ["\u0275noSideEffects", "\u0275noSideEffects"]
693
- ]);
694
- var CORE_MODULE = "@angular/core";
695
- var R3SymbolsImportRewriter = class {
696
- constructor(r3SymbolsPath) {
697
- this.r3SymbolsPath = r3SymbolsPath;
698
- }
699
- shouldImportSymbol(symbol, specifier) {
700
- return true;
701
- }
702
- rewriteSymbol(symbol, specifier) {
703
- if (specifier !== CORE_MODULE) {
704
- return symbol;
705
- }
706
- return validateAndRewriteCoreSymbol(symbol);
707
- }
708
- rewriteSpecifier(specifier, inContextOfFile) {
709
- if (specifier !== CORE_MODULE) {
710
- return specifier;
711
- }
712
- const relativePathToR3Symbols = relativePathBetween(inContextOfFile, this.r3SymbolsPath);
713
- if (relativePathToR3Symbols === null) {
714
- throw new Error(`Failed to rewrite import inside ${CORE_MODULE}: ${inContextOfFile} -> ${this.r3SymbolsPath}`);
715
- }
716
- return relativePathToR3Symbols;
717
- }
718
- };
719
- function validateAndRewriteCoreSymbol(name) {
720
- if (!CORE_SUPPORTED_SYMBOLS.has(name)) {
721
- throw new Error(`Importing unexpected symbol ${name} while compiling ${CORE_MODULE}`);
722
- }
723
- return CORE_SUPPORTED_SYMBOLS.get(name);
724
- }
725
-
726
- // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/default.mjs
727
- import ts4 from "typescript";
728
- var DefaultImportDeclaration = Symbol("DefaultImportDeclaration");
729
- function attachDefaultImportDeclaration(expr, importDecl) {
730
- expr[DefaultImportDeclaration] = importDecl;
731
- }
732
- function getDefaultImportDeclaration(expr) {
733
- var _a;
734
- return (_a = expr[DefaultImportDeclaration]) != null ? _a : null;
735
- }
736
- var DefaultImportTracker = class {
737
- constructor() {
738
- this.sourceFileToUsedImports = /* @__PURE__ */ new Map();
739
- }
740
- recordUsedImport(importDecl) {
741
- const sf = getSourceFile(importDecl);
742
- if (!this.sourceFileToUsedImports.has(sf)) {
743
- this.sourceFileToUsedImports.set(sf, /* @__PURE__ */ new Set());
744
- }
745
- this.sourceFileToUsedImports.get(sf).add(importDecl);
746
- }
747
- importPreservingTransformer() {
748
- return (context) => {
749
- return (sf) => {
750
- return this.transformSourceFile(sf);
751
- };
752
- };
753
- }
754
- transformSourceFile(sf) {
755
- const originalSf = ts4.getOriginalNode(sf);
756
- if (!this.sourceFileToUsedImports.has(originalSf)) {
757
- return sf;
758
- }
759
- const importsToPreserve = this.sourceFileToUsedImports.get(originalSf);
760
- const statements = sf.statements.map((stmt) => {
761
- if (ts4.isImportDeclaration(stmt) && importsToPreserve.has(stmt)) {
762
- stmt = ts4.getMutableClone(stmt);
763
- }
764
- return stmt;
765
- });
766
- this.sourceFileToUsedImports.delete(originalSf);
767
- return ts4.factory.updateSourceFile(sf, statements);
768
- }
769
- };
770
-
771
- // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/resolver.mjs
772
- var ModuleResolver = class {
773
- constructor(program, compilerOptions, host, moduleResolutionCache) {
774
- this.program = program;
775
- this.compilerOptions = compilerOptions;
776
- this.host = host;
777
- this.moduleResolutionCache = moduleResolutionCache;
778
- }
779
- resolveModule(moduleName, containingFile) {
780
- const resolved = resolveModuleName(moduleName, containingFile, this.compilerOptions, this.host, this.moduleResolutionCache);
781
- if (resolved === void 0) {
782
- return null;
783
- }
784
- return getSourceFileOrNull(this.program, absoluteFrom(resolved.resolvedFileName));
785
- }
786
- };
787
-
788
- // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/translator/src/context.mjs
789
- var Context = class {
790
- constructor(isStatement) {
791
- this.isStatement = isStatement;
792
- }
793
- get withExpressionMode() {
794
- return this.isStatement ? new Context(false) : this;
795
- }
796
- get withStatementMode() {
797
- return !this.isStatement ? new Context(true) : this;
798
- }
799
- };
800
-
801
- // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/translator/src/translator.mjs
802
- import * as o from "@angular/compiler";
803
- var UNARY_OPERATORS = /* @__PURE__ */ new Map([
804
- [o.UnaryOperator.Minus, "-"],
805
- [o.UnaryOperator.Plus, "+"]
806
- ]);
807
- var BINARY_OPERATORS = /* @__PURE__ */ new Map([
808
- [o.BinaryOperator.And, "&&"],
809
- [o.BinaryOperator.Bigger, ">"],
810
- [o.BinaryOperator.BiggerEquals, ">="],
811
- [o.BinaryOperator.BitwiseAnd, "&"],
812
- [o.BinaryOperator.Divide, "/"],
813
- [o.BinaryOperator.Equals, "=="],
814
- [o.BinaryOperator.Identical, "==="],
815
- [o.BinaryOperator.Lower, "<"],
816
- [o.BinaryOperator.LowerEquals, "<="],
817
- [o.BinaryOperator.Minus, "-"],
818
- [o.BinaryOperator.Modulo, "%"],
819
- [o.BinaryOperator.Multiply, "*"],
820
- [o.BinaryOperator.NotEquals, "!="],
821
- [o.BinaryOperator.NotIdentical, "!=="],
822
- [o.BinaryOperator.Or, "||"],
823
- [o.BinaryOperator.Plus, "+"],
824
- [o.BinaryOperator.NullishCoalesce, "??"]
825
- ]);
826
- var ExpressionTranslatorVisitor = class {
827
- constructor(factory, imports, options) {
828
- this.factory = factory;
829
- this.imports = imports;
830
- this.downlevelTaggedTemplates = options.downlevelTaggedTemplates === true;
831
- this.downlevelVariableDeclarations = options.downlevelVariableDeclarations === true;
832
- this.recordWrappedNode = options.recordWrappedNode || (() => {
833
- });
834
- }
835
- visitDeclareVarStmt(stmt, context) {
836
- var _a;
837
- const varType = this.downlevelVariableDeclarations ? "var" : stmt.hasModifier(o.StmtModifier.Final) ? "const" : "let";
838
- return this.attachComments(this.factory.createVariableDeclaration(stmt.name, (_a = stmt.value) == null ? void 0 : _a.visitExpression(this, context.withExpressionMode), varType), stmt.leadingComments);
839
- }
840
- visitDeclareFunctionStmt(stmt, context) {
841
- return this.attachComments(this.factory.createFunctionDeclaration(stmt.name, stmt.params.map((param) => param.name), this.factory.createBlock(this.visitStatements(stmt.statements, context.withStatementMode))), stmt.leadingComments);
842
- }
843
- visitExpressionStmt(stmt, context) {
844
- return this.attachComments(this.factory.createExpressionStatement(stmt.expr.visitExpression(this, context.withStatementMode)), stmt.leadingComments);
845
- }
846
- visitReturnStmt(stmt, context) {
847
- return this.attachComments(this.factory.createReturnStatement(stmt.value.visitExpression(this, context.withExpressionMode)), stmt.leadingComments);
848
- }
849
- visitIfStmt(stmt, context) {
850
- return this.attachComments(this.factory.createIfStatement(stmt.condition.visitExpression(this, context), this.factory.createBlock(this.visitStatements(stmt.trueCase, context.withStatementMode)), stmt.falseCase.length > 0 ? this.factory.createBlock(this.visitStatements(stmt.falseCase, context.withStatementMode)) : null), stmt.leadingComments);
851
- }
852
- visitReadVarExpr(ast, _context) {
853
- const identifier = this.factory.createIdentifier(ast.name);
854
- this.setSourceMapRange(identifier, ast.sourceSpan);
855
- return identifier;
856
- }
857
- visitWriteVarExpr(expr, context) {
858
- const assignment = this.factory.createAssignment(this.setSourceMapRange(this.factory.createIdentifier(expr.name), expr.sourceSpan), expr.value.visitExpression(this, context));
859
- return context.isStatement ? assignment : this.factory.createParenthesizedExpression(assignment);
860
- }
861
- visitWriteKeyExpr(expr, context) {
862
- const exprContext = context.withExpressionMode;
863
- const target = this.factory.createElementAccess(expr.receiver.visitExpression(this, exprContext), expr.index.visitExpression(this, exprContext));
864
- const assignment = this.factory.createAssignment(target, expr.value.visitExpression(this, exprContext));
865
- return context.isStatement ? assignment : this.factory.createParenthesizedExpression(assignment);
866
- }
867
- visitWritePropExpr(expr, context) {
868
- const target = this.factory.createPropertyAccess(expr.receiver.visitExpression(this, context), expr.name);
869
- return this.factory.createAssignment(target, expr.value.visitExpression(this, context));
870
- }
871
- visitInvokeFunctionExpr(ast, context) {
872
- return this.setSourceMapRange(this.factory.createCallExpression(ast.fn.visitExpression(this, context), ast.args.map((arg) => arg.visitExpression(this, context)), ast.pure), ast.sourceSpan);
873
- }
874
- visitTaggedTemplateExpr(ast, context) {
875
- return this.setSourceMapRange(this.createTaggedTemplateExpression(ast.tag.visitExpression(this, context), {
876
- elements: ast.template.elements.map((e) => {
877
- var _a;
878
- return createTemplateElement({
879
- cooked: e.text,
880
- raw: e.rawText,
881
- range: (_a = e.sourceSpan) != null ? _a : ast.sourceSpan
882
- });
883
- }),
884
- expressions: ast.template.expressions.map((e) => e.visitExpression(this, context))
885
- }), ast.sourceSpan);
886
- }
887
- visitInstantiateExpr(ast, context) {
888
- return this.factory.createNewExpression(ast.classExpr.visitExpression(this, context), ast.args.map((arg) => arg.visitExpression(this, context)));
889
- }
890
- visitLiteralExpr(ast, _context) {
891
- return this.setSourceMapRange(this.factory.createLiteral(ast.value), ast.sourceSpan);
892
- }
893
- visitLocalizedString(ast, context) {
894
- const elements = [createTemplateElement(ast.serializeI18nHead())];
895
- const expressions = [];
896
- for (let i = 0; i < ast.expressions.length; i++) {
897
- const placeholder = this.setSourceMapRange(ast.expressions[i].visitExpression(this, context), ast.getPlaceholderSourceSpan(i));
898
- expressions.push(placeholder);
899
- elements.push(createTemplateElement(ast.serializeI18nTemplatePart(i + 1)));
900
- }
901
- const localizeTag = this.factory.createIdentifier("$localize");
902
- return this.setSourceMapRange(this.createTaggedTemplateExpression(localizeTag, { elements, expressions }), ast.sourceSpan);
903
- }
904
- createTaggedTemplateExpression(tag, template) {
905
- return this.downlevelTaggedTemplates ? this.createES5TaggedTemplateFunctionCall(tag, template) : this.factory.createTaggedTemplate(tag, template);
906
- }
907
- createES5TaggedTemplateFunctionCall(tagHandler, { elements, expressions }) {
908
- const { moduleImport, symbol } = this.imports.generateNamedImport("tslib", "__makeTemplateObject");
909
- const __makeTemplateObjectHelper = moduleImport === null ? this.factory.createIdentifier(symbol) : this.factory.createPropertyAccess(moduleImport, symbol);
910
- const cooked = [];
911
- const raw = [];
912
- for (const element of elements) {
913
- cooked.push(this.factory.setSourceMapRange(this.factory.createLiteral(element.cooked), element.range));
914
- raw.push(this.factory.setSourceMapRange(this.factory.createLiteral(element.raw), element.range));
915
- }
916
- const templateHelperCall = this.factory.createCallExpression(
917
- __makeTemplateObjectHelper,
918
- [this.factory.createArrayLiteral(cooked), this.factory.createArrayLiteral(raw)],
919
- false
920
- );
921
- return this.factory.createCallExpression(
922
- tagHandler,
923
- [templateHelperCall, ...expressions],
924
- false
925
- );
926
- }
927
- visitExternalExpr(ast, _context) {
928
- if (ast.value.name === null) {
929
- if (ast.value.moduleName === null) {
930
- throw new Error("Invalid import without name nor moduleName");
931
- }
932
- return this.imports.generateNamespaceImport(ast.value.moduleName);
933
- }
934
- if (ast.value.moduleName !== null) {
935
- const { moduleImport, symbol } = this.imports.generateNamedImport(ast.value.moduleName, ast.value.name);
936
- if (moduleImport === null) {
937
- return this.factory.createIdentifier(symbol);
938
- } else {
939
- return this.factory.createPropertyAccess(moduleImport, symbol);
940
- }
941
- } else {
942
- return this.factory.createIdentifier(ast.value.name);
943
- }
944
- }
945
- visitConditionalExpr(ast, context) {
946
- let cond = ast.condition.visitExpression(this, context);
947
- if (ast.condition instanceof o.ConditionalExpr) {
948
- cond = this.factory.createParenthesizedExpression(cond);
949
- }
950
- return this.factory.createConditional(cond, ast.trueCase.visitExpression(this, context), ast.falseCase.visitExpression(this, context));
951
- }
952
- visitNotExpr(ast, context) {
953
- return this.factory.createUnaryExpression("!", ast.condition.visitExpression(this, context));
954
- }
955
- visitFunctionExpr(ast, context) {
956
- var _a;
957
- return this.factory.createFunctionExpression((_a = ast.name) != null ? _a : null, ast.params.map((param) => param.name), this.factory.createBlock(this.visitStatements(ast.statements, context)));
958
- }
959
- visitBinaryOperatorExpr(ast, context) {
960
- if (!BINARY_OPERATORS.has(ast.operator)) {
961
- throw new Error(`Unknown binary operator: ${o.BinaryOperator[ast.operator]}`);
962
- }
963
- return this.factory.createBinaryExpression(ast.lhs.visitExpression(this, context), BINARY_OPERATORS.get(ast.operator), ast.rhs.visitExpression(this, context));
964
- }
965
- visitReadPropExpr(ast, context) {
966
- return this.factory.createPropertyAccess(ast.receiver.visitExpression(this, context), ast.name);
967
- }
968
- visitReadKeyExpr(ast, context) {
969
- return this.factory.createElementAccess(ast.receiver.visitExpression(this, context), ast.index.visitExpression(this, context));
970
- }
971
- visitLiteralArrayExpr(ast, context) {
972
- return this.factory.createArrayLiteral(ast.entries.map((expr) => this.setSourceMapRange(expr.visitExpression(this, context), ast.sourceSpan)));
973
- }
974
- visitLiteralMapExpr(ast, context) {
975
- const properties = ast.entries.map((entry) => {
976
- return {
977
- propertyName: entry.key,
978
- quoted: entry.quoted,
979
- value: entry.value.visitExpression(this, context)
980
- };
981
- });
982
- return this.setSourceMapRange(this.factory.createObjectLiteral(properties), ast.sourceSpan);
983
- }
984
- visitCommaExpr(ast, context) {
985
- throw new Error("Method not implemented.");
986
- }
987
- visitWrappedNodeExpr(ast, _context) {
988
- this.recordWrappedNode(ast);
989
- return ast.node;
990
- }
991
- visitTypeofExpr(ast, context) {
992
- return this.factory.createTypeOfExpression(ast.expr.visitExpression(this, context));
993
- }
994
- visitUnaryOperatorExpr(ast, context) {
995
- if (!UNARY_OPERATORS.has(ast.operator)) {
996
- throw new Error(`Unknown unary operator: ${o.UnaryOperator[ast.operator]}`);
997
- }
998
- return this.factory.createUnaryExpression(UNARY_OPERATORS.get(ast.operator), ast.expr.visitExpression(this, context));
999
- }
1000
- visitStatements(statements, context) {
1001
- return statements.map((stmt) => stmt.visitStatement(this, context)).filter((stmt) => stmt !== void 0);
1002
- }
1003
- setSourceMapRange(ast, span) {
1004
- return this.factory.setSourceMapRange(ast, createRange(span));
1005
- }
1006
- attachComments(statement, leadingComments) {
1007
- if (leadingComments !== void 0) {
1008
- this.factory.attachComments(statement, leadingComments);
1009
- }
1010
- return statement;
1011
- }
1012
- };
1013
- function createTemplateElement({ cooked, raw, range }) {
1014
- return { cooked, raw, range: createRange(range) };
1015
- }
1016
- function createRange(span) {
1017
- if (span === null) {
1018
- return null;
1019
- }
1020
- const { start, end } = span;
1021
- const { url, content } = start.file;
1022
- if (!url) {
1023
- return null;
1024
- }
1025
- return {
1026
- url,
1027
- content,
1028
- start: { offset: start.offset, line: start.line, column: start.col },
1029
- end: { offset: end.offset, line: end.line, column: end.col }
1030
- };
1031
- }
1032
-
1033
- // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/translator/src/import_manager.mjs
1034
- import ts5 from "typescript";
1035
- var ImportManager = class {
1036
- constructor(rewriter = new NoopImportRewriter(), prefix = "i") {
1037
- this.rewriter = rewriter;
1038
- this.prefix = prefix;
1039
- this.specifierToIdentifier = /* @__PURE__ */ new Map();
1040
- this.nextIndex = 0;
1041
- }
1042
- generateNamespaceImport(moduleName) {
1043
- if (!this.specifierToIdentifier.has(moduleName)) {
1044
- this.specifierToIdentifier.set(moduleName, ts5.factory.createIdentifier(`${this.prefix}${this.nextIndex++}`));
1045
- }
1046
- return this.specifierToIdentifier.get(moduleName);
1047
- }
1048
- generateNamedImport(moduleName, originalSymbol) {
1049
- const symbol = this.rewriter.rewriteSymbol(originalSymbol, moduleName);
1050
- if (!this.rewriter.shouldImportSymbol(symbol, moduleName)) {
1051
- return { moduleImport: null, symbol };
1052
- }
1053
- const moduleImport = this.generateNamespaceImport(moduleName);
1054
- return { moduleImport, symbol };
1055
- }
1056
- getAllImports(contextPath) {
1057
- const imports = [];
1058
- for (const [originalSpecifier, qualifier] of this.specifierToIdentifier) {
1059
- const specifier = this.rewriter.rewriteSpecifier(originalSpecifier, contextPath);
1060
- imports.push({
1061
- specifier,
1062
- qualifier
1063
- });
1064
- }
1065
- return imports;
1066
- }
1067
- };
1068
-
1069
- // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/translator/src/type_translator.mjs
1070
- import * as o2 from "@angular/compiler";
1071
- import ts7 from "typescript";
1072
-
1073
- // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/ts_compatibility/src/ts_cross_version_utils.mjs
1074
- import ts6 from "typescript";
1075
- var IS_AFTER_TS_49 = isAfterVersion(4, 9);
1076
- var createParameterDeclaration = IS_AFTER_TS_49 ? ts6.factory.createParameterDeclaration : (modifiers, dotDotDotToken, name, questionToken, type, initializer) => ts6.factory.createParameterDeclaration(...splitModifiers(modifiers), dotDotDotToken, name, questionToken, type, initializer);
1077
- var createImportDeclaration = IS_AFTER_TS_49 ? ts6.factory.createImportDeclaration : (modifiers, importClause, moduleSpecifier, assertClause) => ts6.factory.createImportDeclaration(void 0, modifiers, importClause, moduleSpecifier, assertClause);
1078
- var createFunctionDeclaration = IS_AFTER_TS_49 ? ts6.factory.createFunctionDeclaration : (modifiers, asteriskToken, name, typeParameters, parameters, type, body) => ts6.factory.createFunctionDeclaration(...splitModifiers(modifiers), asteriskToken, name, typeParameters, parameters, type, body);
1079
- var createIndexSignature = IS_AFTER_TS_49 ? ts6.factory.createIndexSignature : (modifiers, parameters, type) => ts6.factory.createIndexSignature(modifiers, parameters, type);
1080
- function splitModifiers(allModifiers) {
1081
- if (!allModifiers) {
1082
- return [void 0, void 0];
1083
- }
1084
- const decorators = [];
1085
- const modifiers = [];
1086
- for (const current of allModifiers) {
1087
- if (ts6.isDecorator(current)) {
1088
- decorators.push(current);
1089
- } else {
1090
- modifiers.push(current);
1091
- }
1092
- }
1093
- return [decorators.length ? decorators : void 0, modifiers.length ? modifiers : void 0];
1094
- }
1095
- function isAfterVersion(targetMajor, targetMinor) {
1096
- const [major, minor] = ts6.versionMajorMinor.split(".").map((part) => parseInt(part));
1097
- if (major < targetMajor) {
1098
- return false;
1099
- }
1100
- return major === targetMajor ? minor >= targetMinor : true;
1101
- }
1102
-
1103
- // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/translator/src/type_translator.mjs
1104
- function translateType(type, imports) {
1105
- return type.visitType(new TypeTranslatorVisitor(imports), new Context(false));
1106
- }
1107
- var TypeTranslatorVisitor = class {
1108
- constructor(imports) {
1109
- this.imports = imports;
1110
- }
1111
- visitBuiltinType(type, context) {
1112
- switch (type.name) {
1113
- case o2.BuiltinTypeName.Bool:
1114
- return ts7.factory.createKeywordTypeNode(ts7.SyntaxKind.BooleanKeyword);
1115
- case o2.BuiltinTypeName.Dynamic:
1116
- return ts7.factory.createKeywordTypeNode(ts7.SyntaxKind.AnyKeyword);
1117
- case o2.BuiltinTypeName.Int:
1118
- case o2.BuiltinTypeName.Number:
1119
- return ts7.factory.createKeywordTypeNode(ts7.SyntaxKind.NumberKeyword);
1120
- case o2.BuiltinTypeName.String:
1121
- return ts7.factory.createKeywordTypeNode(ts7.SyntaxKind.StringKeyword);
1122
- case o2.BuiltinTypeName.None:
1123
- return ts7.factory.createKeywordTypeNode(ts7.SyntaxKind.NeverKeyword);
1124
- default:
1125
- throw new Error(`Unsupported builtin type: ${o2.BuiltinTypeName[type.name]}`);
1126
- }
1127
- }
1128
- visitExpressionType(type, context) {
1129
- const typeNode = this.translateExpression(type.value, context);
1130
- if (type.typeParams === null) {
1131
- return typeNode;
1132
- }
1133
- if (!ts7.isTypeReferenceNode(typeNode)) {
1134
- throw new Error("An ExpressionType with type arguments must translate into a TypeReferenceNode");
1135
- } else if (typeNode.typeArguments !== void 0) {
1136
- throw new Error(`An ExpressionType with type arguments cannot have multiple levels of type arguments`);
1137
- }
1138
- const typeArgs = type.typeParams.map((param) => this.translateType(param, context));
1139
- return ts7.factory.createTypeReferenceNode(typeNode.typeName, typeArgs);
1140
- }
1141
- visitArrayType(type, context) {
1142
- return ts7.factory.createArrayTypeNode(this.translateType(type.of, context));
1143
- }
1144
- visitMapType(type, context) {
1145
- const parameter = createParameterDeclaration(void 0, void 0, "key", void 0, ts7.factory.createKeywordTypeNode(ts7.SyntaxKind.StringKeyword));
1146
- const typeArgs = type.valueType !== null ? this.translateType(type.valueType, context) : ts7.factory.createKeywordTypeNode(ts7.SyntaxKind.UnknownKeyword);
1147
- const indexSignature = createIndexSignature(void 0, [parameter], typeArgs);
1148
- return ts7.factory.createTypeLiteralNode([indexSignature]);
1149
- }
1150
- visitReadVarExpr(ast, context) {
1151
- if (ast.name === null) {
1152
- throw new Error(`ReadVarExpr with no variable name in type`);
1153
- }
1154
- return ts7.factory.createTypeQueryNode(ts7.factory.createIdentifier(ast.name));
1155
- }
1156
- visitWriteVarExpr(expr, context) {
1157
- throw new Error("Method not implemented.");
1158
- }
1159
- visitWriteKeyExpr(expr, context) {
1160
- throw new Error("Method not implemented.");
1161
- }
1162
- visitWritePropExpr(expr, context) {
1163
- throw new Error("Method not implemented.");
1164
- }
1165
- visitInvokeFunctionExpr(ast, context) {
1166
- throw new Error("Method not implemented.");
1167
- }
1168
- visitTaggedTemplateExpr(ast, context) {
1169
- throw new Error("Method not implemented.");
1170
- }
1171
- visitInstantiateExpr(ast, context) {
1172
- throw new Error("Method not implemented.");
1173
- }
1174
- visitLiteralExpr(ast, context) {
1175
- if (ast.value === null) {
1176
- return ts7.factory.createLiteralTypeNode(ts7.factory.createNull());
1177
- } else if (ast.value === void 0) {
1178
- return ts7.factory.createKeywordTypeNode(ts7.SyntaxKind.UndefinedKeyword);
1179
- } else if (typeof ast.value === "boolean") {
1180
- return ts7.factory.createLiteralTypeNode(ast.value ? ts7.factory.createTrue() : ts7.factory.createFalse());
1181
- } else if (typeof ast.value === "number") {
1182
- return ts7.factory.createLiteralTypeNode(ts7.factory.createNumericLiteral(ast.value));
1183
- } else {
1184
- return ts7.factory.createLiteralTypeNode(ts7.factory.createStringLiteral(ast.value));
1185
- }
1186
- }
1187
- visitLocalizedString(ast, context) {
1188
- throw new Error("Method not implemented.");
1189
- }
1190
- visitExternalExpr(ast, context) {
1191
- if (ast.value.moduleName === null || ast.value.name === null) {
1192
- throw new Error(`Import unknown module or symbol`);
1193
- }
1194
- const { moduleImport, symbol } = this.imports.generateNamedImport(ast.value.moduleName, ast.value.name);
1195
- const symbolIdentifier = ts7.factory.createIdentifier(symbol);
1196
- const typeName = moduleImport ? ts7.factory.createQualifiedName(moduleImport, symbolIdentifier) : symbolIdentifier;
1197
- const typeArguments = ast.typeParams !== null ? ast.typeParams.map((type) => this.translateType(type, context)) : void 0;
1198
- return ts7.factory.createTypeReferenceNode(typeName, typeArguments);
1199
- }
1200
- visitConditionalExpr(ast, context) {
1201
- throw new Error("Method not implemented.");
1202
- }
1203
- visitNotExpr(ast, context) {
1204
- throw new Error("Method not implemented.");
1205
- }
1206
- visitFunctionExpr(ast, context) {
1207
- throw new Error("Method not implemented.");
1208
- }
1209
- visitUnaryOperatorExpr(ast, context) {
1210
- throw new Error("Method not implemented.");
1211
- }
1212
- visitBinaryOperatorExpr(ast, context) {
1213
- throw new Error("Method not implemented.");
1214
- }
1215
- visitReadPropExpr(ast, context) {
1216
- throw new Error("Method not implemented.");
1217
- }
1218
- visitReadKeyExpr(ast, context) {
1219
- throw new Error("Method not implemented.");
1220
- }
1221
- visitLiteralArrayExpr(ast, context) {
1222
- const values = ast.entries.map((expr) => this.translateExpression(expr, context));
1223
- return ts7.factory.createTupleTypeNode(values);
1224
- }
1225
- visitLiteralMapExpr(ast, context) {
1226
- const entries = ast.entries.map((entry) => {
1227
- const { key, quoted } = entry;
1228
- const type = this.translateExpression(entry.value, context);
1229
- return ts7.factory.createPropertySignature(
1230
- void 0,
1231
- quoted ? ts7.factory.createStringLiteral(key) : key,
1232
- void 0,
1233
- type
1234
- );
1235
- });
1236
- return ts7.factory.createTypeLiteralNode(entries);
1237
- }
1238
- visitCommaExpr(ast, context) {
1239
- throw new Error("Method not implemented.");
1240
- }
1241
- visitWrappedNodeExpr(ast, context) {
1242
- const node = ast.node;
1243
- if (ts7.isEntityName(node)) {
1244
- return ts7.factory.createTypeReferenceNode(node, void 0);
1245
- } else if (ts7.isTypeNode(node)) {
1246
- return node;
1247
- } else if (ts7.isLiteralExpression(node)) {
1248
- return ts7.factory.createLiteralTypeNode(node);
1249
- } else {
1250
- throw new Error(`Unsupported WrappedNodeExpr in TypeTranslatorVisitor: ${ts7.SyntaxKind[node.kind]}`);
1251
- }
1252
- }
1253
- visitTypeofExpr(ast, context) {
1254
- const typeNode = this.translateExpression(ast.expr, context);
1255
- if (!ts7.isTypeReferenceNode(typeNode)) {
1256
- throw new Error(`The target of a typeof expression must be a type reference, but it was
1257
- ${ts7.SyntaxKind[typeNode.kind]}`);
1258
- }
1259
- return ts7.factory.createTypeQueryNode(typeNode.typeName);
1260
- }
1261
- translateType(type, context) {
1262
- const typeNode = type.visitType(this, context);
1263
- if (!ts7.isTypeNode(typeNode)) {
1264
- throw new Error(`A Type must translate to a TypeNode, but was ${ts7.SyntaxKind[typeNode.kind]}`);
1265
- }
1266
- return typeNode;
1267
- }
1268
- translateExpression(expr, context) {
1269
- const typeNode = expr.visitExpression(this, context);
1270
- if (!ts7.isTypeNode(typeNode)) {
1271
- throw new Error(`An Expression must translate to a TypeNode, but was ${ts7.SyntaxKind[typeNode.kind]}`);
1272
- }
1273
- return typeNode;
1274
- }
1275
- };
1276
-
1277
- // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/translator/src/typescript_ast_factory.mjs
1278
- import ts8 from "typescript";
1279
- var PureAnnotation;
1280
- (function(PureAnnotation2) {
1281
- PureAnnotation2["CLOSURE"] = "* @pureOrBreakMyCode ";
1282
- PureAnnotation2["TERSER"] = "@__PURE__";
1283
- })(PureAnnotation || (PureAnnotation = {}));
1284
- var UNARY_OPERATORS2 = {
1285
- "+": ts8.SyntaxKind.PlusToken,
1286
- "-": ts8.SyntaxKind.MinusToken,
1287
- "!": ts8.SyntaxKind.ExclamationToken
1288
- };
1289
- var BINARY_OPERATORS2 = {
1290
- "&&": ts8.SyntaxKind.AmpersandAmpersandToken,
1291
- ">": ts8.SyntaxKind.GreaterThanToken,
1292
- ">=": ts8.SyntaxKind.GreaterThanEqualsToken,
1293
- "&": ts8.SyntaxKind.AmpersandToken,
1294
- "/": ts8.SyntaxKind.SlashToken,
1295
- "==": ts8.SyntaxKind.EqualsEqualsToken,
1296
- "===": ts8.SyntaxKind.EqualsEqualsEqualsToken,
1297
- "<": ts8.SyntaxKind.LessThanToken,
1298
- "<=": ts8.SyntaxKind.LessThanEqualsToken,
1299
- "-": ts8.SyntaxKind.MinusToken,
1300
- "%": ts8.SyntaxKind.PercentToken,
1301
- "*": ts8.SyntaxKind.AsteriskToken,
1302
- "!=": ts8.SyntaxKind.ExclamationEqualsToken,
1303
- "!==": ts8.SyntaxKind.ExclamationEqualsEqualsToken,
1304
- "||": ts8.SyntaxKind.BarBarToken,
1305
- "+": ts8.SyntaxKind.PlusToken,
1306
- "??": ts8.SyntaxKind.QuestionQuestionToken
1307
- };
1308
- var VAR_TYPES = {
1309
- "const": ts8.NodeFlags.Const,
1310
- "let": ts8.NodeFlags.Let,
1311
- "var": ts8.NodeFlags.None
1312
- };
1313
- var TypeScriptAstFactory = class {
1314
- constructor(annotateForClosureCompiler) {
1315
- this.annotateForClosureCompiler = annotateForClosureCompiler;
1316
- this.externalSourceFiles = /* @__PURE__ */ new Map();
1317
- this.attachComments = attachComments;
1318
- this.createArrayLiteral = ts8.factory.createArrayLiteralExpression;
1319
- this.createElementAccess = ts8.factory.createElementAccessExpression;
1320
- this.createExpressionStatement = ts8.factory.createExpressionStatement;
1321
- this.createIdentifier = ts8.factory.createIdentifier;
1322
- this.createParenthesizedExpression = ts8.factory.createParenthesizedExpression;
1323
- this.createPropertyAccess = ts8.factory.createPropertyAccessExpression;
1324
- this.createThrowStatement = ts8.factory.createThrowStatement;
1325
- this.createTypeOfExpression = ts8.factory.createTypeOfExpression;
1326
- }
1327
- createAssignment(target, value) {
1328
- return ts8.factory.createBinaryExpression(target, ts8.SyntaxKind.EqualsToken, value);
1329
- }
1330
- createBinaryExpression(leftOperand, operator, rightOperand) {
1331
- return ts8.factory.createBinaryExpression(leftOperand, BINARY_OPERATORS2[operator], rightOperand);
1332
- }
1333
- createBlock(body) {
1334
- return ts8.factory.createBlock(body);
1335
- }
1336
- createCallExpression(callee, args, pure) {
1337
- const call = ts8.factory.createCallExpression(callee, void 0, args);
1338
- if (pure) {
1339
- ts8.addSyntheticLeadingComment(
1340
- call,
1341
- ts8.SyntaxKind.MultiLineCommentTrivia,
1342
- this.annotateForClosureCompiler ? PureAnnotation.CLOSURE : PureAnnotation.TERSER,
1343
- false
1344
- );
1345
- }
1346
- return call;
1347
- }
1348
- createConditional(condition, whenTrue, whenFalse) {
1349
- return ts8.factory.createConditionalExpression(condition, void 0, whenTrue, void 0, whenFalse);
1350
- }
1351
- createFunctionDeclaration(functionName, parameters, body) {
1352
- if (!ts8.isBlock(body)) {
1353
- throw new Error(`Invalid syntax, expected a block, but got ${ts8.SyntaxKind[body.kind]}.`);
1354
- }
1355
- return createFunctionDeclaration(void 0, void 0, functionName, void 0, parameters.map((param) => createParameterDeclaration(void 0, void 0, param)), void 0, body);
1356
- }
1357
- createFunctionExpression(functionName, parameters, body) {
1358
- if (!ts8.isBlock(body)) {
1359
- throw new Error(`Invalid syntax, expected a block, but got ${ts8.SyntaxKind[body.kind]}.`);
1360
- }
1361
- return ts8.factory.createFunctionExpression(void 0, void 0, functionName != null ? functionName : void 0, void 0, parameters.map((param) => createParameterDeclaration(void 0, void 0, param)), void 0, body);
1362
- }
1363
- createIfStatement(condition, thenStatement, elseStatement) {
1364
- return ts8.factory.createIfStatement(condition, thenStatement, elseStatement != null ? elseStatement : void 0);
1365
- }
1366
- createLiteral(value) {
1367
- if (value === void 0) {
1368
- return ts8.factory.createIdentifier("undefined");
1369
- } else if (value === null) {
1370
- return ts8.factory.createNull();
1371
- } else if (typeof value === "boolean") {
1372
- return value ? ts8.factory.createTrue() : ts8.factory.createFalse();
1373
- } else if (typeof value === "number") {
1374
- return ts8.factory.createNumericLiteral(value);
1375
- } else {
1376
- return ts8.factory.createStringLiteral(value);
1377
- }
1378
- }
1379
- createNewExpression(expression, args) {
1380
- return ts8.factory.createNewExpression(expression, void 0, args);
1381
- }
1382
- createObjectLiteral(properties) {
1383
- return ts8.factory.createObjectLiteralExpression(properties.map((prop) => ts8.factory.createPropertyAssignment(prop.quoted ? ts8.factory.createStringLiteral(prop.propertyName) : ts8.factory.createIdentifier(prop.propertyName), prop.value)));
1384
- }
1385
- createReturnStatement(expression) {
1386
- return ts8.factory.createReturnStatement(expression != null ? expression : void 0);
1387
- }
1388
- createTaggedTemplate(tag, template) {
1389
- let templateLiteral;
1390
- const length = template.elements.length;
1391
- const head = template.elements[0];
1392
- if (length === 1) {
1393
- templateLiteral = ts8.factory.createNoSubstitutionTemplateLiteral(head.cooked, head.raw);
1394
- } else {
1395
- const spans = [];
1396
- for (let i = 1; i < length - 1; i++) {
1397
- const { cooked, raw, range } = template.elements[i];
1398
- const middle = createTemplateMiddle(cooked, raw);
1399
- if (range !== null) {
1400
- this.setSourceMapRange(middle, range);
1401
- }
1402
- spans.push(ts8.factory.createTemplateSpan(template.expressions[i - 1], middle));
1403
- }
1404
- const resolvedExpression = template.expressions[length - 2];
1405
- const templatePart = template.elements[length - 1];
1406
- const templateTail = createTemplateTail(templatePart.cooked, templatePart.raw);
1407
- if (templatePart.range !== null) {
1408
- this.setSourceMapRange(templateTail, templatePart.range);
1409
- }
1410
- spans.push(ts8.factory.createTemplateSpan(resolvedExpression, templateTail));
1411
- templateLiteral = ts8.factory.createTemplateExpression(ts8.factory.createTemplateHead(head.cooked, head.raw), spans);
1412
- }
1413
- if (head.range !== null) {
1414
- this.setSourceMapRange(templateLiteral, head.range);
1415
- }
1416
- return ts8.factory.createTaggedTemplateExpression(tag, void 0, templateLiteral);
1417
- }
1418
- createUnaryExpression(operator, operand) {
1419
- return ts8.factory.createPrefixUnaryExpression(UNARY_OPERATORS2[operator], operand);
1420
- }
1421
- createVariableDeclaration(variableName, initializer, type) {
1422
- return ts8.factory.createVariableStatement(void 0, ts8.factory.createVariableDeclarationList([ts8.factory.createVariableDeclaration(variableName, void 0, void 0, initializer != null ? initializer : void 0)], VAR_TYPES[type]));
1423
- }
1424
- setSourceMapRange(node, sourceMapRange) {
1425
- if (sourceMapRange === null) {
1426
- return node;
1427
- }
1428
- const url = sourceMapRange.url;
1429
- if (!this.externalSourceFiles.has(url)) {
1430
- this.externalSourceFiles.set(url, ts8.createSourceMapSource(url, sourceMapRange.content, (pos) => pos));
1431
- }
1432
- const source = this.externalSourceFiles.get(url);
1433
- ts8.setSourceMapRange(node, { pos: sourceMapRange.start.offset, end: sourceMapRange.end.offset, source });
1434
- return node;
1435
- }
1436
- };
1437
- function createTemplateMiddle(cooked, raw) {
1438
- const node = ts8.factory.createTemplateHead(cooked, raw);
1439
- node.kind = ts8.SyntaxKind.TemplateMiddle;
1440
- return node;
1441
- }
1442
- function createTemplateTail(cooked, raw) {
1443
- const node = ts8.factory.createTemplateHead(cooked, raw);
1444
- node.kind = ts8.SyntaxKind.TemplateTail;
1445
- return node;
1446
- }
1447
- function attachComments(statement, leadingComments) {
1448
- for (const comment of leadingComments) {
1449
- const commentKind = comment.multiline ? ts8.SyntaxKind.MultiLineCommentTrivia : ts8.SyntaxKind.SingleLineCommentTrivia;
1450
- if (comment.multiline) {
1451
- ts8.addSyntheticLeadingComment(statement, commentKind, comment.toString(), comment.trailingNewline);
1452
- } else {
1453
- for (const line of comment.toString().split("\n")) {
1454
- ts8.addSyntheticLeadingComment(statement, commentKind, line, comment.trailingNewline);
1455
- }
1456
- }
1457
- }
1458
- }
1459
-
1460
- // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/translator/src/typescript_translator.mjs
1461
- function translateExpression(expression, imports, options = {}) {
1462
- return expression.visitExpression(new ExpressionTranslatorVisitor(new TypeScriptAstFactory(options.annotateForClosureCompiler === true), imports, options), new Context(false));
1463
- }
1464
- function translateStatement(statement, imports, options = {}) {
1465
- return statement.visitStatement(new ExpressionTranslatorVisitor(new TypeScriptAstFactory(options.annotateForClosureCompiler === true), imports, options), new Context(true));
1466
- }
1467
-
1468
- export {
1469
- ErrorCode,
1470
- COMPILER_ERRORS_WITH_GUIDES,
1471
- replaceTsWithNgInErrors,
1472
- ngErrorCode,
1473
- FatalDiagnosticError,
1474
- makeDiagnostic,
1475
- makeDiagnosticChain,
1476
- makeRelatedInformation,
1477
- addDiagnosticChain,
1478
- isFatalDiagnosticError,
1479
- ERROR_DETAILS_PAGE_BASE_URL,
1480
- ExtendedTemplateDiagnosticName,
1481
- isSymbolWithValueDeclaration,
1482
- isDtsPath,
1483
- isNonDeclarationTsPath,
1484
- isFromDtsFile,
1485
- nodeNameForError,
1486
- getSourceFile,
1487
- getSourceFileOrNull,
1488
- getTokenAtPosition,
1489
- identifierOfNode,
1490
- isDeclaration,
1491
- getRootDirs,
1492
- nodeDebugInfo,
1493
- isAssignment,
1494
- toUnredirectedSourceFile,
1495
- ImportFlags,
1496
- assertSuccessfulReferenceEmit,
1497
- ReferenceEmitter,
1498
- LocalIdentifierStrategy,
1499
- AbsoluteModuleStrategy,
1500
- LogicalProjectStrategy,
1501
- RelativePathStrategy,
1502
- UnifiedModulesStrategy,
1503
- UnifiedModulesAliasingHost,
1504
- PrivateExportAliasingHost,
1505
- AliasStrategy,
1506
- relativePathBetween,
1507
- normalizeSeparators,
1508
- NoopImportRewriter,
1509
- R3SymbolsImportRewriter,
1510
- validateAndRewriteCoreSymbol,
1511
- attachDefaultImportDeclaration,
1512
- getDefaultImportDeclaration,
1513
- DefaultImportTracker,
1514
- Reference,
1515
- ModuleResolver,
1516
- Context,
1517
- ImportManager,
1518
- ExpressionTranslatorVisitor,
1519
- createParameterDeclaration,
1520
- createImportDeclaration,
1521
- createFunctionDeclaration,
1522
- translateType,
1523
- translateExpression,
1524
- translateStatement
1525
- };
1526
- /*!
1527
- * @license
1528
- * Copyright Google LLC All Rights Reserved.
1529
- *
1530
- * Use of this source code is governed by an MIT-style license that can be
1531
- * found in the LICENSE file at https://angular.io/license
1532
- */
1533
- /**
1534
- * @license
1535
- * Copyright Google LLC All Rights Reserved.
1536
- *
1537
- * Use of this source code is governed by an MIT-style license that can be
1538
- * found in the LICENSE file at https://angular.io/license
1539
- */
1540
- //# sourceMappingURL=chunk-Z534TW2O.js.map