@angular/compiler-cli 14.0.0-next.9 → 14.0.0-rc.2
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.
- package/bundles/{chunk-LX5Q27EF.js → chunk-7J66ZDC5.js} +3 -3
- package/bundles/{chunk-LX5Q27EF.js.map → chunk-7J66ZDC5.js.map} +0 -0
- package/bundles/{chunk-W6KM7BUM.js → chunk-AKU7LV22.js} +6 -6
- package/bundles/{chunk-W6KM7BUM.js.map → chunk-AKU7LV22.js.map} +0 -0
- package/bundles/{chunk-WGBFSDVQ.js → chunk-BFPVXDJN.js} +7 -7
- package/bundles/{chunk-WGBFSDVQ.js.map → chunk-BFPVXDJN.js.map} +0 -0
- package/bundles/{chunk-SNAJD4VP.js → chunk-GGBQTGO6.js} +52 -41
- package/bundles/chunk-GGBQTGO6.js.map +6 -0
- package/bundles/{chunk-R3C7RFJ4.js → chunk-HMWNYAAE.js} +2 -2
- package/bundles/{chunk-R3C7RFJ4.js.map → chunk-HMWNYAAE.js.map} +0 -0
- package/bundles/{chunk-T7MYRXIE.js → chunk-MURZUYM7.js} +7 -7
- package/bundles/{chunk-T7MYRXIE.js.map → chunk-MURZUYM7.js.map} +0 -0
- package/bundles/{chunk-R4NY3TJC.js → chunk-QK4SXRQA.js} +5 -5
- package/bundles/{chunk-R4NY3TJC.js.map → chunk-QK4SXRQA.js.map} +0 -0
- package/bundles/{chunk-34QUU6SJ.js → chunk-RV5PLZZB.js} +130 -85
- package/bundles/chunk-RV5PLZZB.js.map +6 -0
- package/bundles/{chunk-UMDDHI5B.js → chunk-SFACRVMZ.js} +27 -26
- package/bundles/chunk-SFACRVMZ.js.map +6 -0
- package/bundles/{chunk-AGDZS4UG.js → chunk-SYV2KBTF.js} +5 -5
- package/bundles/{chunk-AGDZS4UG.js.map → chunk-SYV2KBTF.js.map} +0 -0
- package/bundles/{chunk-OLGEBPBY.js → chunk-U2VFXNL7.js} +4 -4
- package/bundles/{chunk-OLGEBPBY.js.map → chunk-U2VFXNL7.js.map} +0 -0
- package/bundles/{chunk-FJDIFR5C.js → chunk-VEAB5CR7.js} +97 -61
- package/bundles/chunk-VEAB5CR7.js.map +6 -0
- package/bundles/{chunk-M3IOYIU5.js → chunk-VLER5B3O.js} +1051 -982
- package/bundles/chunk-VLER5B3O.js.map +6 -0
- package/bundles/{chunk-GYVY4Y2L.js → chunk-VSZPIAX6.js} +1173 -881
- package/bundles/chunk-VSZPIAX6.js.map +6 -0
- package/bundles/{chunk-2IMT6JFI.js → chunk-ZJCM37WF.js} +6 -6
- package/bundles/{chunk-2IMT6JFI.js.map → chunk-ZJCM37WF.js.map} +0 -0
- package/bundles/index.js +13 -14
- package/bundles/index.js.map +1 -1
- package/bundles/linker/babel/index.js +16 -16
- package/bundles/linker/babel/index.js.map +1 -1
- package/bundles/linker/index.js +4 -4
- package/bundles/ngcc/index.js +12 -12
- package/bundles/ngcc/main-ngcc.js +13 -13
- package/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js +13 -13
- package/bundles/ngcc/src/locking/lock_file_with_child_process/ngcc_lock_unlocker.js +4 -4
- package/bundles/private/bazel.js +1 -1
- package/bundles/private/localize.js +3 -3
- package/bundles/private/migrations.js +5 -5
- package/bundles/private/tooling.js +2 -2
- package/bundles/src/bin/ng_xi18n.js +10 -10
- package/bundles/src/bin/ngc.js +8 -8
- package/bundles_metadata.json +1 -1
- package/ngcc/src/dependencies/module_resolver.d.ts +5 -2
- package/ngcc/src/execution/cluster/api.d.ts +1 -1
- package/ngcc/src/execution/cluster/package_json_updater.d.ts +1 -1
- package/ngcc/src/execution/tasks/api.d.ts +2 -2
- package/ngcc/src/packages/build_marker.d.ts +1 -1
- package/ngcc/src/packages/entry_point.d.ts +1 -7
- package/ngcc/src/utils.d.ts +26 -0
- package/ngcc/src/writing/package_json_updater.d.ts +2 -1
- package/package.json +4 -4
- package/src/ngtsc/annotations/common/index.d.ts +1 -0
- package/src/ngtsc/annotations/common/src/schema.d.ts +12 -0
- package/src/ngtsc/annotations/common/src/util.d.ts +7 -1
- package/src/ngtsc/annotations/component/src/handler.d.ts +1 -1
- package/src/ngtsc/annotations/component/src/metadata.d.ts +7 -8
- package/src/ngtsc/annotations/component/src/resources.d.ts +1 -1
- package/src/ngtsc/annotations/ng_module/index.d.ts +1 -0
- package/src/ngtsc/annotations/ng_module/src/handler.d.ts +10 -26
- package/src/ngtsc/annotations/ng_module/src/module_with_providers.d.ts +26 -0
- package/src/ngtsc/core/api/src/adapter.d.ts +12 -1
- package/src/ngtsc/core/src/host.d.ts +9 -2
- package/src/ngtsc/diagnostics/src/error_code.d.ts +4 -0
- package/src/ngtsc/metadata/src/api.d.ts +32 -5
- package/src/ngtsc/metadata/src/util.d.ts +1 -0
- package/src/ngtsc/partial_evaluator/index.d.ts +1 -0
- package/src/ngtsc/partial_evaluator/src/dynamic.d.ts +9 -1
- package/src/ngtsc/partial_evaluator/src/interface.d.ts +2 -1
- package/src/ngtsc/partial_evaluator/src/result.d.ts +2 -1
- package/src/ngtsc/partial_evaluator/src/synthetic.d.ts +19 -0
- package/src/ngtsc/program_driver/src/ts_create_program_driver.d.ts +2 -2
- package/src/ngtsc/scope/index.d.ts +4 -3
- package/src/ngtsc/scope/src/api.d.ts +36 -14
- package/src/ngtsc/scope/src/component_scope.d.ts +2 -16
- package/src/ngtsc/scope/src/local.d.ts +4 -11
- package/src/ngtsc/scope/src/standalone.d.ts +26 -0
- package/src/ngtsc/scope/src/typecheck.d.ts +1 -1
- package/src/ngtsc/scope/src/util.d.ts +15 -0
- package/src/ngtsc/transform/src/compilation.d.ts +3 -1
- package/src/ngtsc/typecheck/api/api.d.ts +1 -0
- package/src/ngtsc/typecheck/api/checker.d.ts +6 -6
- package/src/ngtsc/typecheck/api/completion.d.ts +3 -3
- package/src/ngtsc/typecheck/api/context.d.ts +2 -1
- package/src/ngtsc/typecheck/api/symbols.d.ts +23 -16
- package/src/ngtsc/typecheck/src/checker.d.ts +5 -4
- package/src/ngtsc/typecheck/src/completion.d.ts +6 -5
- package/src/ngtsc/typecheck/src/context.d.ts +1 -1
- package/src/ngtsc/typecheck/src/dom.d.ts +4 -2
- package/src/ngtsc/typecheck/src/template_symbol_builder.d.ts +4 -3
- package/src/ngtsc/typecheck/src/ts_util.d.ts +7 -0
- package/src/ngtsc/typecheck/src/type_check_block.d.ts +2 -1
- package/bundles/chunk-34QUU6SJ.js.map +0 -6
- package/bundles/chunk-FJDIFR5C.js.map +0 -6
- package/bundles/chunk-GYVY4Y2L.js.map +0 -6
- package/bundles/chunk-M3IOYIU5.js.map +0 -6
- package/bundles/chunk-SNAJD4VP.js.map +0 -6
- package/bundles/chunk-UMDDHI5B.js.map +0 -6
- package/src/ngtsc/annotations/component/src/scope.d.ts +0 -20
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
reflectObjectLiteral,
|
|
14
14
|
reflectTypeEntityToDeclaration,
|
|
15
15
|
typeNodeToValueExpr
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-ZJCM37WF.js";
|
|
17
17
|
import {
|
|
18
18
|
ErrorCode,
|
|
19
19
|
FatalDiagnosticError,
|
|
@@ -26,31 +26,29 @@ import {
|
|
|
26
26
|
getSourceFile,
|
|
27
27
|
identifierOfNode,
|
|
28
28
|
isDeclaration,
|
|
29
|
-
isDtsPath,
|
|
30
|
-
isNonDeclarationTsPath,
|
|
31
29
|
makeDiagnostic,
|
|
32
30
|
makeRelatedInformation,
|
|
33
31
|
nodeDebugInfo,
|
|
32
|
+
nodeNameForError,
|
|
34
33
|
translateExpression,
|
|
35
34
|
translateStatement,
|
|
36
35
|
translateType
|
|
37
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-SFACRVMZ.js";
|
|
38
37
|
import {
|
|
39
38
|
absoluteFrom,
|
|
40
39
|
absoluteFromSourceFile,
|
|
41
|
-
basename,
|
|
42
40
|
relative
|
|
43
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-MURZUYM7.js";
|
|
44
42
|
import {
|
|
45
43
|
PerfEvent,
|
|
46
44
|
PerfPhase
|
|
47
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-QK4SXRQA.js";
|
|
48
46
|
import {
|
|
49
47
|
__spreadProps,
|
|
50
48
|
__spreadValues
|
|
51
49
|
} from "./chunk-GMSUYBZP.js";
|
|
52
50
|
|
|
53
|
-
// bazel-out/
|
|
51
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/common/src/util.mjs
|
|
54
52
|
import { ExternalExpr, ParseLocation, ParseSourceFile, ParseSourceSpan, ReadPropExpr, WrappedNodeExpr } from "@angular/compiler";
|
|
55
53
|
import ts from "typescript";
|
|
56
54
|
function valueReferenceToExpression(valueRef) {
|
|
@@ -143,21 +141,26 @@ function tryUnwrapForwardRef(node, reflector) {
|
|
|
143
141
|
}
|
|
144
142
|
return expr;
|
|
145
143
|
}
|
|
146
|
-
|
|
147
|
-
if (!isAngularCoreReference(
|
|
148
|
-
return
|
|
144
|
+
var forwardRefResolver = (fn, callExpr, resolve, unresolvable) => {
|
|
145
|
+
if (!isAngularCoreReference(fn, "forwardRef") || callExpr.arguments.length !== 1) {
|
|
146
|
+
return unresolvable;
|
|
149
147
|
}
|
|
150
|
-
|
|
151
|
-
|
|
148
|
+
const expanded = expandForwardRef(callExpr.arguments[0]);
|
|
149
|
+
if (expanded !== null) {
|
|
150
|
+
return resolve(expanded);
|
|
151
|
+
} else {
|
|
152
|
+
return unresolvable;
|
|
153
|
+
}
|
|
154
|
+
};
|
|
152
155
|
function combineResolvers(resolvers) {
|
|
153
|
-
return (
|
|
156
|
+
return (fn, callExpr, resolve, unresolvable) => {
|
|
154
157
|
for (const resolver of resolvers) {
|
|
155
|
-
const resolved = resolver(
|
|
156
|
-
if (resolved !==
|
|
158
|
+
const resolved = resolver(fn, callExpr, resolve, unresolvable);
|
|
159
|
+
if (resolved !== unresolvable) {
|
|
157
160
|
return resolved;
|
|
158
161
|
}
|
|
159
162
|
}
|
|
160
|
-
return
|
|
163
|
+
return unresolvable;
|
|
161
164
|
};
|
|
162
165
|
}
|
|
163
166
|
function isExpressionForwardReference(expr, context, contextSource) {
|
|
@@ -271,8 +274,17 @@ function resolveImportedFile(moduleResolver, importedFile, expr, origin) {
|
|
|
271
274
|
}
|
|
272
275
|
return moduleResolver.resolveModule(expr.value.moduleName, origin.fileName);
|
|
273
276
|
}
|
|
277
|
+
function getOriginNodeForDiagnostics(expr, container) {
|
|
278
|
+
const nodeSf = expr.getSourceFile();
|
|
279
|
+
const exprSf = container.getSourceFile();
|
|
280
|
+
if (nodeSf === exprSf && expr.pos >= container.pos && expr.end <= container.end) {
|
|
281
|
+
return expr;
|
|
282
|
+
} else {
|
|
283
|
+
return container;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
274
286
|
|
|
275
|
-
// bazel-out/
|
|
287
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/partial_evaluator/src/dynamic.mjs
|
|
276
288
|
var DynamicValue = class {
|
|
277
289
|
constructor(node, reason, code) {
|
|
278
290
|
this.node = node;
|
|
@@ -303,8 +315,11 @@ var DynamicValue = class {
|
|
|
303
315
|
static fromDynamicType(node) {
|
|
304
316
|
return new DynamicValue(node, void 0, 7);
|
|
305
317
|
}
|
|
318
|
+
static fromSyntheticInput(node, value) {
|
|
319
|
+
return new DynamicValue(node, value, 8);
|
|
320
|
+
}
|
|
306
321
|
static fromUnknown(node) {
|
|
307
|
-
return new DynamicValue(node, void 0,
|
|
322
|
+
return new DynamicValue(node, void 0, 9);
|
|
308
323
|
}
|
|
309
324
|
isFromDynamicInput() {
|
|
310
325
|
return this.code === 0;
|
|
@@ -331,7 +346,7 @@ var DynamicValue = class {
|
|
|
331
346
|
return this.code === 7;
|
|
332
347
|
}
|
|
333
348
|
isFromUnknown() {
|
|
334
|
-
return this.code ===
|
|
349
|
+
return this.code === 9;
|
|
335
350
|
}
|
|
336
351
|
accept(visitor) {
|
|
337
352
|
switch (this.code) {
|
|
@@ -352,15 +367,17 @@ var DynamicValue = class {
|
|
|
352
367
|
case 7:
|
|
353
368
|
return visitor.visitDynamicType(this);
|
|
354
369
|
case 8:
|
|
370
|
+
return visitor.visitSyntheticInput(this);
|
|
371
|
+
case 9:
|
|
355
372
|
return visitor.visitUnknown(this);
|
|
356
373
|
}
|
|
357
374
|
}
|
|
358
375
|
};
|
|
359
376
|
|
|
360
|
-
// bazel-out/
|
|
377
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/partial_evaluator/src/interpreter.mjs
|
|
361
378
|
import ts2 from "typescript";
|
|
362
379
|
|
|
363
|
-
// bazel-out/
|
|
380
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/partial_evaluator/src/result.mjs
|
|
364
381
|
var ResolvedModule = class {
|
|
365
382
|
constructor(exports, evaluate) {
|
|
366
383
|
this.exports = exports;
|
|
@@ -390,7 +407,7 @@ var EnumValue = class {
|
|
|
390
407
|
var KnownFn = class {
|
|
391
408
|
};
|
|
392
409
|
|
|
393
|
-
// bazel-out/
|
|
410
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/partial_evaluator/src/builtin.mjs
|
|
394
411
|
var ArraySliceBuiltinFn = class extends KnownFn {
|
|
395
412
|
constructor(lhs) {
|
|
396
413
|
super();
|
|
@@ -461,7 +478,7 @@ var ObjectAssignBuiltinFn = class extends KnownFn {
|
|
|
461
478
|
}
|
|
462
479
|
};
|
|
463
480
|
|
|
464
|
-
// bazel-out/
|
|
481
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/partial_evaluator/src/ts_helpers.mjs
|
|
465
482
|
var AssignHelperFn = class extends ObjectAssignBuiltinFn {
|
|
466
483
|
};
|
|
467
484
|
var SpreadHelperFn = class extends KnownFn {
|
|
@@ -514,7 +531,7 @@ var ReadHelperFn = class extends KnownFn {
|
|
|
514
531
|
}
|
|
515
532
|
};
|
|
516
533
|
|
|
517
|
-
// bazel-out/
|
|
534
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/partial_evaluator/src/known_declaration.mjs
|
|
518
535
|
var jsGlobalObjectValue = /* @__PURE__ */ new Map([["assign", new ObjectAssignBuiltinFn()]]);
|
|
519
536
|
var assignTsHelperFn = new AssignHelperFn();
|
|
520
537
|
var spreadTsHelperFn = new SpreadHelperFn();
|
|
@@ -538,7 +555,14 @@ function resolveKnownDeclaration(decl) {
|
|
|
538
555
|
}
|
|
539
556
|
}
|
|
540
557
|
|
|
541
|
-
// bazel-out/
|
|
558
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/partial_evaluator/src/synthetic.mjs
|
|
559
|
+
var SyntheticValue = class {
|
|
560
|
+
constructor(value) {
|
|
561
|
+
this.value = value;
|
|
562
|
+
}
|
|
563
|
+
};
|
|
564
|
+
|
|
565
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/partial_evaluator/src/interpreter.mjs
|
|
542
566
|
function literalBinaryOp(op) {
|
|
543
567
|
return { op, literal: true };
|
|
544
568
|
}
|
|
@@ -853,6 +877,8 @@ var StaticInterpreter = class {
|
|
|
853
877
|
}
|
|
854
878
|
} else if (lhs instanceof DynamicValue) {
|
|
855
879
|
return DynamicValue.fromDynamicInput(node, lhs);
|
|
880
|
+
} else if (lhs instanceof SyntheticValue) {
|
|
881
|
+
return DynamicValue.fromSyntheticInput(node, lhs);
|
|
856
882
|
}
|
|
857
883
|
return DynamicValue.fromUnknown(node);
|
|
858
884
|
}
|
|
@@ -874,31 +900,24 @@ var StaticInterpreter = class {
|
|
|
874
900
|
if (!isFunctionOrMethodReference(lhs)) {
|
|
875
901
|
return DynamicValue.fromInvalidExpressionType(node.expression, lhs);
|
|
876
902
|
}
|
|
877
|
-
|
|
878
|
-
let
|
|
879
|
-
if (
|
|
880
|
-
|
|
881
|
-
}
|
|
882
|
-
if (expr === null) {
|
|
883
|
-
return DynamicValue.fromDynamicInput(node, DynamicValue.fromExternalReference(node.expression, lhs));
|
|
884
|
-
}
|
|
885
|
-
if (expr.getSourceFile() !== node.expression.getSourceFile() && lhs.bestGuessOwningModule !== null) {
|
|
886
|
-
context = __spreadProps(__spreadValues({}, context), {
|
|
903
|
+
const resolveFfrExpr = (expr) => {
|
|
904
|
+
let contextExtension = {};
|
|
905
|
+
if (fn.body === null && expr.getSourceFile() !== node.expression.getSourceFile() && lhs.bestGuessOwningModule !== null) {
|
|
906
|
+
contextExtension = {
|
|
887
907
|
absoluteModuleName: lhs.bestGuessOwningModule.specifier,
|
|
888
908
|
resolutionContext: lhs.bestGuessOwningModule.resolutionContext
|
|
889
|
-
}
|
|
909
|
+
};
|
|
890
910
|
}
|
|
891
|
-
return this.visitFfrExpression(expr, context);
|
|
911
|
+
return this.visitFfrExpression(expr, __spreadValues(__spreadValues({}, context), contextExtension));
|
|
912
|
+
};
|
|
913
|
+
if (fn.body === null && context.foreignFunctionResolver !== void 0) {
|
|
914
|
+
const unresolvable = DynamicValue.fromDynamicInput(node, DynamicValue.fromExternalReference(node.expression, lhs));
|
|
915
|
+
return context.foreignFunctionResolver(lhs, node, resolveFfrExpr, unresolvable);
|
|
892
916
|
}
|
|
893
|
-
|
|
917
|
+
const res = this.visitFunctionBody(node, fn, context);
|
|
894
918
|
if (res instanceof DynamicValue && context.foreignFunctionResolver !== void 0) {
|
|
895
|
-
const
|
|
896
|
-
|
|
897
|
-
const ffrRes = this.visitFfrExpression(ffrExpr, context);
|
|
898
|
-
if (!(ffrRes instanceof DynamicValue)) {
|
|
899
|
-
res = ffrRes;
|
|
900
|
-
}
|
|
901
|
-
}
|
|
919
|
+
const unresolvable = DynamicValue.fromComplexFunctionCall(node, fn);
|
|
920
|
+
return context.foreignFunctionResolver(lhs, node, resolveFfrExpr, unresolvable);
|
|
902
921
|
}
|
|
903
922
|
return res;
|
|
904
923
|
}
|
|
@@ -1125,7 +1144,7 @@ function owningModule(context, override = null) {
|
|
|
1125
1144
|
}
|
|
1126
1145
|
}
|
|
1127
1146
|
|
|
1128
|
-
// bazel-out/
|
|
1147
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/partial_evaluator/src/interface.mjs
|
|
1129
1148
|
var PartialEvaluator = class {
|
|
1130
1149
|
constructor(host, checker, dependencyTracker) {
|
|
1131
1150
|
this.host = host;
|
|
@@ -1145,7 +1164,7 @@ var PartialEvaluator = class {
|
|
|
1145
1164
|
}
|
|
1146
1165
|
};
|
|
1147
1166
|
|
|
1148
|
-
// bazel-out/
|
|
1167
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/partial_evaluator/src/diagnostics.mjs
|
|
1149
1168
|
import ts3 from "typescript";
|
|
1150
1169
|
function describeResolvedType(value, maxDepth = 1) {
|
|
1151
1170
|
var _a, _b;
|
|
@@ -1205,6 +1224,9 @@ var TraceDynamicValueVisitor = class {
|
|
|
1205
1224
|
}
|
|
1206
1225
|
return trace;
|
|
1207
1226
|
}
|
|
1227
|
+
visitSyntheticInput(value) {
|
|
1228
|
+
return [makeRelatedInformation(value.node, "Unable to evaluate this expression further.")];
|
|
1229
|
+
}
|
|
1208
1230
|
visitDynamicString(value) {
|
|
1209
1231
|
return [makeRelatedInformation(value.node, "A string value could not be determined statically.")];
|
|
1210
1232
|
}
|
|
@@ -1272,7 +1294,7 @@ function getContainerNode(node) {
|
|
|
1272
1294
|
return node.getSourceFile();
|
|
1273
1295
|
}
|
|
1274
1296
|
|
|
1275
|
-
// bazel-out/
|
|
1297
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/common/src/di.mjs
|
|
1276
1298
|
import { LiteralExpr, WrappedNodeExpr as WrappedNodeExpr2 } from "@angular/compiler";
|
|
1277
1299
|
import ts4 from "typescript";
|
|
1278
1300
|
function getConstructorDependencies(clazz, reflector, isCore) {
|
|
@@ -1416,7 +1438,7 @@ function createUnsuitableInjectionTokenError(clazz, error) {
|
|
|
1416
1438
|
return new FatalDiagnosticError(ErrorCode.PARAM_MISSING_TOKEN, param.nameNode, chain, hints);
|
|
1417
1439
|
}
|
|
1418
1440
|
|
|
1419
|
-
// bazel-out/
|
|
1441
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/common/src/diagnostics.mjs
|
|
1420
1442
|
import ts5 from "typescript";
|
|
1421
1443
|
function makeDuplicateDeclarationError(node, data, kind) {
|
|
1422
1444
|
const context = [];
|
|
@@ -1524,7 +1546,7 @@ function getInheritedUndecoratedCtorDiagnostic(node, baseClass, reader) {
|
|
|
1524
1546
|
return makeDiagnostic(ErrorCode.DIRECTIVE_INHERITS_UNDECORATED_CTOR, node.name, `The ${dirOrComp.toLowerCase()} ${node.name.text} inherits its constructor from ${baseClassName}, but the latter does not have an Angular decorator of its own. Dependency injection will not be able to resolve the parameters of ${baseClassName}'s constructor. Either add a @Directive decorator to ${baseClassName}, or add an explicit constructor to ${node.name.text}.`);
|
|
1525
1547
|
}
|
|
1526
1548
|
|
|
1527
|
-
// bazel-out/
|
|
1549
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/common/src/evaluation.mjs
|
|
1528
1550
|
import ts6 from "typescript";
|
|
1529
1551
|
function resolveEnumValue(evaluator, metadata, field, enumSymbolName) {
|
|
1530
1552
|
let resolved = null;
|
|
@@ -1557,7 +1579,7 @@ function resolveLiteral(decorator, literalCache) {
|
|
|
1557
1579
|
return meta;
|
|
1558
1580
|
}
|
|
1559
1581
|
|
|
1560
|
-
// bazel-out/
|
|
1582
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/common/src/factory.mjs
|
|
1561
1583
|
import { compileDeclareFactoryFunction, compileFactoryFunction } from "@angular/compiler";
|
|
1562
1584
|
function compileNgFactoryDefField(metadata) {
|
|
1563
1585
|
const res = compileFactoryFunction(metadata);
|
|
@@ -1568,7 +1590,7 @@ function compileDeclareFactory(metadata) {
|
|
|
1568
1590
|
return { name: "\u0275fac", initializer: res.expression, statements: res.statements, type: res.type };
|
|
1569
1591
|
}
|
|
1570
1592
|
|
|
1571
|
-
// bazel-out/
|
|
1593
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/common/src/metadata.mjs
|
|
1572
1594
|
import { FunctionExpr, LiteralArrayExpr, LiteralExpr as LiteralExpr2, literalMap, ReturnStatement, WrappedNodeExpr as WrappedNodeExpr3 } from "@angular/compiler";
|
|
1573
1595
|
import ts7 from "typescript";
|
|
1574
1596
|
function extractClassMetadata(clazz, reflection, isCore, annotateForClosureCompiler, angularDecoratorTransform = (dec) => dec) {
|
|
@@ -1656,17 +1678,47 @@ function removeIdentifierReferences(node, name) {
|
|
|
1656
1678
|
return result.transformed[0];
|
|
1657
1679
|
}
|
|
1658
1680
|
|
|
1659
|
-
// bazel-out/
|
|
1681
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/common/src/references_registry.mjs
|
|
1660
1682
|
var NoopReferencesRegistry = class {
|
|
1661
1683
|
add(source, ...references) {
|
|
1662
1684
|
}
|
|
1663
1685
|
};
|
|
1664
1686
|
|
|
1665
|
-
// bazel-out/
|
|
1666
|
-
import {
|
|
1667
|
-
|
|
1687
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/common/src/schema.mjs
|
|
1688
|
+
import { CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA } from "@angular/compiler";
|
|
1689
|
+
function extractSchemas(rawExpr, evaluator, context) {
|
|
1690
|
+
const schemas = [];
|
|
1691
|
+
const result = evaluator.evaluate(rawExpr);
|
|
1692
|
+
if (!Array.isArray(result)) {
|
|
1693
|
+
throw createValueHasWrongTypeError(rawExpr, result, `${context}.schemas must be an array`);
|
|
1694
|
+
}
|
|
1695
|
+
for (const schemaRef of result) {
|
|
1696
|
+
if (!(schemaRef instanceof Reference)) {
|
|
1697
|
+
throw createValueHasWrongTypeError(rawExpr, result, `${context}.schemas must be an array of schemas`);
|
|
1698
|
+
}
|
|
1699
|
+
const id = schemaRef.getIdentityIn(schemaRef.node.getSourceFile());
|
|
1700
|
+
if (id === null || schemaRef.ownedByModuleGuess !== "@angular/core") {
|
|
1701
|
+
throw createValueHasWrongTypeError(rawExpr, result, `${context}.schemas must be an array of schemas`);
|
|
1702
|
+
}
|
|
1703
|
+
switch (id.text) {
|
|
1704
|
+
case "CUSTOM_ELEMENTS_SCHEMA":
|
|
1705
|
+
schemas.push(CUSTOM_ELEMENTS_SCHEMA);
|
|
1706
|
+
break;
|
|
1707
|
+
case "NO_ERRORS_SCHEMA":
|
|
1708
|
+
schemas.push(NO_ERRORS_SCHEMA);
|
|
1709
|
+
break;
|
|
1710
|
+
default:
|
|
1711
|
+
throw createValueHasWrongTypeError(rawExpr, schemaRef, `'${schemaRef.debugName}' is not a valid ${context} schema`);
|
|
1712
|
+
}
|
|
1713
|
+
}
|
|
1714
|
+
return schemas;
|
|
1715
|
+
}
|
|
1668
1716
|
|
|
1669
|
-
// bazel-out/
|
|
1717
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/component/src/handler.mjs
|
|
1718
|
+
import { compileClassMetadata as compileClassMetadata3, compileComponentFromMetadata, compileDeclareClassMetadata as compileDeclareClassMetadata3, compileDeclareComponentFromMetadata, CssSelector as CssSelector2, DEFAULT_INTERPOLATION_CONFIG as DEFAULT_INTERPOLATION_CONFIG2, DomElementSchemaRegistry, FactoryTarget as FactoryTarget3, makeBindingParser as makeBindingParser2, R3TargetBinder, R3TemplateDependencyKind, SelectorMatcher as SelectorMatcher2, ViewEncapsulation, WrappedNodeExpr as WrappedNodeExpr7 } from "@angular/compiler";
|
|
1719
|
+
import ts24 from "typescript";
|
|
1720
|
+
|
|
1721
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/semantic_graph/src/api.mjs
|
|
1670
1722
|
import ts8 from "typescript";
|
|
1671
1723
|
var SemanticSymbol = class {
|
|
1672
1724
|
constructor(decl) {
|
|
@@ -1682,7 +1734,7 @@ function getSymbolIdentifier(decl) {
|
|
|
1682
1734
|
return decl.name.text;
|
|
1683
1735
|
}
|
|
1684
1736
|
|
|
1685
|
-
// bazel-out/
|
|
1737
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/semantic_graph/src/graph.mjs
|
|
1686
1738
|
import { ExternalExpr as ExternalExpr2 } from "@angular/compiler";
|
|
1687
1739
|
var OpaqueSymbol = class extends SemanticSymbol {
|
|
1688
1740
|
isPublicApiAffected() {
|
|
@@ -1825,10 +1877,10 @@ function getImportPath(expr) {
|
|
|
1825
1877
|
}
|
|
1826
1878
|
}
|
|
1827
1879
|
|
|
1828
|
-
// bazel-out/
|
|
1880
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/semantic_graph/src/type_parameters.mjs
|
|
1829
1881
|
import ts9 from "typescript";
|
|
1830
1882
|
|
|
1831
|
-
// bazel-out/
|
|
1883
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/semantic_graph/src/util.mjs
|
|
1832
1884
|
function isSymbolEqual(a, b) {
|
|
1833
1885
|
if (a.decl === b.decl) {
|
|
1834
1886
|
return true;
|
|
@@ -1878,7 +1930,7 @@ function isSetEqual(a, b, equalityTester = referenceEquality) {
|
|
|
1878
1930
|
return true;
|
|
1879
1931
|
}
|
|
1880
1932
|
|
|
1881
|
-
// bazel-out/
|
|
1933
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/semantic_graph/src/type_parameters.mjs
|
|
1882
1934
|
function extractSemanticTypeParameters(node) {
|
|
1883
1935
|
if (!ts9.isClassDeclaration(node) || node.typeParameters === void 0) {
|
|
1884
1936
|
return null;
|
|
@@ -1898,17 +1950,18 @@ function isTypeParameterEqual(a, b) {
|
|
|
1898
1950
|
return a.hasGenericTypeBound === b.hasGenericTypeBound;
|
|
1899
1951
|
}
|
|
1900
1952
|
|
|
1901
|
-
// bazel-out/
|
|
1902
|
-
var
|
|
1903
|
-
(function(
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1953
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/metadata/src/api.mjs
|
|
1954
|
+
var MetaKind;
|
|
1955
|
+
(function(MetaKind2) {
|
|
1956
|
+
MetaKind2[MetaKind2["Directive"] = 0] = "Directive";
|
|
1957
|
+
MetaKind2[MetaKind2["Pipe"] = 1] = "Pipe";
|
|
1958
|
+
MetaKind2[MetaKind2["NgModule"] = 2] = "NgModule";
|
|
1959
|
+
})(MetaKind || (MetaKind = {}));
|
|
1907
1960
|
|
|
1908
|
-
// bazel-out/
|
|
1961
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/metadata/src/dts.mjs
|
|
1909
1962
|
import ts11 from "typescript";
|
|
1910
1963
|
|
|
1911
|
-
// bazel-out/
|
|
1964
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/metadata/src/property_mapping.mjs
|
|
1912
1965
|
var ClassPropertyMapping = class {
|
|
1913
1966
|
constructor(forwardMap) {
|
|
1914
1967
|
this.forwardMap = forwardMap;
|
|
@@ -1984,7 +2037,7 @@ function reverseMapFromForwardMap(forwardMap) {
|
|
|
1984
2037
|
return reverseMap;
|
|
1985
2038
|
}
|
|
1986
2039
|
|
|
1987
|
-
// bazel-out/
|
|
2040
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/metadata/src/util.mjs
|
|
1988
2041
|
import ts10 from "typescript";
|
|
1989
2042
|
function extractReferencesFromType(checker, def, bestGuessOwningModule) {
|
|
1990
2043
|
if (!ts10.isTupleTypeNode(def)) {
|
|
@@ -2006,6 +2059,19 @@ function extractReferencesFromType(checker, def, bestGuessOwningModule) {
|
|
|
2006
2059
|
}
|
|
2007
2060
|
});
|
|
2008
2061
|
}
|
|
2062
|
+
function readBooleanType(type) {
|
|
2063
|
+
if (!ts10.isLiteralTypeNode(type)) {
|
|
2064
|
+
return null;
|
|
2065
|
+
}
|
|
2066
|
+
switch (type.literal.kind) {
|
|
2067
|
+
case ts10.SyntaxKind.TrueKeyword:
|
|
2068
|
+
return true;
|
|
2069
|
+
case ts10.SyntaxKind.FalseKeyword:
|
|
2070
|
+
return false;
|
|
2071
|
+
default:
|
|
2072
|
+
return null;
|
|
2073
|
+
}
|
|
2074
|
+
}
|
|
2009
2075
|
function readStringType(type) {
|
|
2010
2076
|
if (!ts10.isLiteralTypeNode(type) || !ts10.isStringLiteral(type.literal)) {
|
|
2011
2077
|
return null;
|
|
@@ -2151,7 +2217,7 @@ function hasInjectableFields(clazz, host) {
|
|
|
2151
2217
|
return members.some(({ isStatic, name }) => isStatic && (name === "\u0275prov" || name === "\u0275fac"));
|
|
2152
2218
|
}
|
|
2153
2219
|
|
|
2154
|
-
// bazel-out/
|
|
2220
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/metadata/src/dts.mjs
|
|
2155
2221
|
var DtsMetadataReader = class {
|
|
2156
2222
|
constructor(checker, reflector) {
|
|
2157
2223
|
this.checker = checker;
|
|
@@ -2167,15 +2233,19 @@ var DtsMetadataReader = class {
|
|
|
2167
2233
|
}
|
|
2168
2234
|
const [_, declarationMetadata, importMetadata, exportMetadata] = ngModuleDef.type.typeArguments;
|
|
2169
2235
|
return {
|
|
2236
|
+
kind: MetaKind.NgModule,
|
|
2170
2237
|
ref,
|
|
2171
2238
|
declarations: extractReferencesFromType(this.checker, declarationMetadata, ref.bestGuessOwningModule),
|
|
2172
2239
|
exports: extractReferencesFromType(this.checker, exportMetadata, ref.bestGuessOwningModule),
|
|
2173
2240
|
imports: extractReferencesFromType(this.checker, importMetadata, ref.bestGuessOwningModule),
|
|
2174
2241
|
schemas: [],
|
|
2175
|
-
rawDeclarations: null
|
|
2242
|
+
rawDeclarations: null,
|
|
2243
|
+
rawImports: null,
|
|
2244
|
+
rawExports: null
|
|
2176
2245
|
};
|
|
2177
2246
|
}
|
|
2178
2247
|
getDirectiveMetadata(ref) {
|
|
2248
|
+
var _a;
|
|
2179
2249
|
const clazz = ref.node;
|
|
2180
2250
|
const def = this.reflector.getMembersOfClass(clazz).find((field) => field.isStatic && (field.name === "\u0275cmp" || field.name === "\u0275dir"));
|
|
2181
2251
|
if (def === void 0) {
|
|
@@ -2188,10 +2258,11 @@ var DtsMetadataReader = class {
|
|
|
2188
2258
|
const isStructural = !isComponent && ctorParams !== null && ctorParams.some((param) => {
|
|
2189
2259
|
return param.typeValueReference.kind === 1 && param.typeValueReference.moduleName === "@angular/core" && param.typeValueReference.importedName === "TemplateRef";
|
|
2190
2260
|
});
|
|
2261
|
+
const isStandalone = def.type.typeArguments.length > 7 && ((_a = readBooleanType(def.type.typeArguments[7])) != null ? _a : false);
|
|
2191
2262
|
const inputs = ClassPropertyMapping.fromMappedObject(readStringMapType(def.type.typeArguments[3]));
|
|
2192
2263
|
const outputs = ClassPropertyMapping.fromMappedObject(readStringMapType(def.type.typeArguments[4]));
|
|
2193
2264
|
return __spreadProps(__spreadValues({
|
|
2194
|
-
|
|
2265
|
+
kind: MetaKind.Directive,
|
|
2195
2266
|
ref,
|
|
2196
2267
|
name: clazz.name.text,
|
|
2197
2268
|
isComponent,
|
|
@@ -2205,10 +2276,13 @@ var DtsMetadataReader = class {
|
|
|
2205
2276
|
isPoisoned: false,
|
|
2206
2277
|
isStructural,
|
|
2207
2278
|
animationTriggerNames: null,
|
|
2208
|
-
isStandalone
|
|
2279
|
+
isStandalone,
|
|
2280
|
+
imports: null,
|
|
2281
|
+
schemas: null
|
|
2209
2282
|
});
|
|
2210
2283
|
}
|
|
2211
2284
|
getPipeMetadata(ref) {
|
|
2285
|
+
var _a;
|
|
2212
2286
|
const def = this.reflector.getMembersOfClass(ref.node).find((field) => field.isStatic && field.name === "\u0275pipe");
|
|
2213
2287
|
if (def === void 0) {
|
|
2214
2288
|
return null;
|
|
@@ -2220,12 +2294,13 @@ var DtsMetadataReader = class {
|
|
|
2220
2294
|
return null;
|
|
2221
2295
|
}
|
|
2222
2296
|
const name = type.literal.text;
|
|
2297
|
+
const isStandalone = def.type.typeArguments.length > 2 && ((_a = readBooleanType(def.type.typeArguments[2])) != null ? _a : false);
|
|
2223
2298
|
return {
|
|
2224
|
-
|
|
2299
|
+
kind: MetaKind.Pipe,
|
|
2225
2300
|
ref,
|
|
2226
2301
|
name,
|
|
2227
2302
|
nameExpr: null,
|
|
2228
|
-
isStandalone
|
|
2303
|
+
isStandalone
|
|
2229
2304
|
};
|
|
2230
2305
|
}
|
|
2231
2306
|
};
|
|
@@ -2254,7 +2329,7 @@ function readBaseClass2(clazz, checker, reflector) {
|
|
|
2254
2329
|
return null;
|
|
2255
2330
|
}
|
|
2256
2331
|
|
|
2257
|
-
// bazel-out/
|
|
2332
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/metadata/src/inheritance.mjs
|
|
2258
2333
|
function flattenInheritedDirectiveMetadata(reader, dir) {
|
|
2259
2334
|
const topMeta = reader.getDirectiveMetadata(dir);
|
|
2260
2335
|
if (topMeta === null) {
|
|
@@ -2311,7 +2386,7 @@ function flattenInheritedDirectiveMetadata(reader, dir) {
|
|
|
2311
2386
|
});
|
|
2312
2387
|
}
|
|
2313
2388
|
|
|
2314
|
-
// bazel-out/
|
|
2389
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/metadata/src/registry.mjs
|
|
2315
2390
|
var LocalMetadataRegistry = class {
|
|
2316
2391
|
constructor() {
|
|
2317
2392
|
this.directives = /* @__PURE__ */ new Map();
|
|
@@ -2370,7 +2445,7 @@ var InjectableClassRegistry = class {
|
|
|
2370
2445
|
}
|
|
2371
2446
|
};
|
|
2372
2447
|
|
|
2373
|
-
// bazel-out/
|
|
2448
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/metadata/src/resource_registry.mjs
|
|
2374
2449
|
var ResourceRegistry = class {
|
|
2375
2450
|
constructor() {
|
|
2376
2451
|
this.externalTemplateToComponentsMap = /* @__PURE__ */ new Map();
|
|
@@ -2435,442 +2510,584 @@ var ResourceRegistry = class {
|
|
|
2435
2510
|
}
|
|
2436
2511
|
};
|
|
2437
2512
|
|
|
2438
|
-
// bazel-out/
|
|
2439
|
-
var
|
|
2440
|
-
(function(
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
})(
|
|
2444
|
-
var HandlerPrecedence;
|
|
2445
|
-
(function(HandlerPrecedence2) {
|
|
2446
|
-
HandlerPrecedence2[HandlerPrecedence2["PRIMARY"] = 0] = "PRIMARY";
|
|
2447
|
-
HandlerPrecedence2[HandlerPrecedence2["SHARED"] = 1] = "SHARED";
|
|
2448
|
-
HandlerPrecedence2[HandlerPrecedence2["WEAK"] = 2] = "WEAK";
|
|
2449
|
-
})(HandlerPrecedence || (HandlerPrecedence = {}));
|
|
2450
|
-
var HandlerFlags;
|
|
2451
|
-
(function(HandlerFlags2) {
|
|
2452
|
-
HandlerFlags2[HandlerFlags2["NONE"] = 0] = "NONE";
|
|
2453
|
-
HandlerFlags2[HandlerFlags2["FULL_INHERITANCE"] = 1] = "FULL_INHERITANCE";
|
|
2454
|
-
})(HandlerFlags || (HandlerFlags = {}));
|
|
2455
|
-
|
|
2456
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/alias.mjs
|
|
2457
|
-
import ts12 from "typescript";
|
|
2458
|
-
function aliasTransformFactory(exportStatements) {
|
|
2459
|
-
return (context) => {
|
|
2460
|
-
return (file) => {
|
|
2461
|
-
if (ts12.isBundle(file) || !exportStatements.has(file.fileName)) {
|
|
2462
|
-
return file;
|
|
2463
|
-
}
|
|
2464
|
-
const statements = [...file.statements];
|
|
2465
|
-
exportStatements.get(file.fileName).forEach(([moduleName, symbolName], aliasName) => {
|
|
2466
|
-
const stmt = ts12.factory.createExportDeclaration(void 0, void 0, false, ts12.createNamedExports([ts12.factory.createExportSpecifier(false, symbolName, aliasName)]), ts12.factory.createStringLiteral(moduleName));
|
|
2467
|
-
statements.push(stmt);
|
|
2468
|
-
});
|
|
2469
|
-
return ts12.factory.updateSourceFile(file, statements);
|
|
2470
|
-
};
|
|
2471
|
-
};
|
|
2472
|
-
}
|
|
2473
|
-
|
|
2474
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/compilation.mjs
|
|
2475
|
-
import ts16 from "typescript";
|
|
2476
|
-
|
|
2477
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/adapter.mjs
|
|
2478
|
-
import ts13 from "typescript";
|
|
2479
|
-
|
|
2480
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/shims/src/expando.mjs
|
|
2481
|
-
var NgExtension = Symbol("NgExtension");
|
|
2482
|
-
function isExtended(sf) {
|
|
2483
|
-
return sf[NgExtension] !== void 0;
|
|
2484
|
-
}
|
|
2485
|
-
function sfExtensionData(sf) {
|
|
2486
|
-
const extSf = sf;
|
|
2487
|
-
if (extSf[NgExtension] !== void 0) {
|
|
2488
|
-
return extSf[NgExtension];
|
|
2489
|
-
}
|
|
2490
|
-
const extension = {
|
|
2491
|
-
isTopLevelShim: false,
|
|
2492
|
-
fileShim: null,
|
|
2493
|
-
originalReferencedFiles: null,
|
|
2494
|
-
taggedReferenceFiles: null
|
|
2495
|
-
};
|
|
2496
|
-
extSf[NgExtension] = extension;
|
|
2497
|
-
return extension;
|
|
2498
|
-
}
|
|
2499
|
-
function isFileShimSourceFile(sf) {
|
|
2500
|
-
return isExtended(sf) && sf[NgExtension].fileShim !== null;
|
|
2501
|
-
}
|
|
2502
|
-
function isShim(sf) {
|
|
2503
|
-
return isExtended(sf) && (sf[NgExtension].fileShim !== null || sf[NgExtension].isTopLevelShim);
|
|
2504
|
-
}
|
|
2505
|
-
function copyFileShimData(from, to) {
|
|
2506
|
-
if (!isFileShimSourceFile(from)) {
|
|
2507
|
-
return;
|
|
2508
|
-
}
|
|
2509
|
-
sfExtensionData(to).fileShim = sfExtensionData(from).fileShim;
|
|
2510
|
-
}
|
|
2511
|
-
function untagAllTsFiles(program) {
|
|
2512
|
-
for (const sf of program.getSourceFiles()) {
|
|
2513
|
-
untagTsFile(sf);
|
|
2514
|
-
}
|
|
2515
|
-
}
|
|
2516
|
-
function retagAllTsFiles(program) {
|
|
2517
|
-
for (const sf of program.getSourceFiles()) {
|
|
2518
|
-
retagTsFile(sf);
|
|
2519
|
-
}
|
|
2520
|
-
}
|
|
2521
|
-
function untagTsFile(sf) {
|
|
2522
|
-
if (sf.isDeclarationFile || !isExtended(sf)) {
|
|
2523
|
-
return;
|
|
2524
|
-
}
|
|
2525
|
-
const ext = sfExtensionData(sf);
|
|
2526
|
-
if (ext.originalReferencedFiles !== null) {
|
|
2527
|
-
sf.referencedFiles = ext.originalReferencedFiles;
|
|
2528
|
-
}
|
|
2529
|
-
}
|
|
2530
|
-
function retagTsFile(sf) {
|
|
2531
|
-
if (sf.isDeclarationFile || !isExtended(sf)) {
|
|
2532
|
-
return;
|
|
2533
|
-
}
|
|
2534
|
-
const ext = sfExtensionData(sf);
|
|
2535
|
-
if (ext.taggedReferenceFiles !== null) {
|
|
2536
|
-
sf.referencedFiles = ext.taggedReferenceFiles;
|
|
2537
|
-
}
|
|
2538
|
-
}
|
|
2513
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/scope/src/api.mjs
|
|
2514
|
+
var ComponentScopeKind;
|
|
2515
|
+
(function(ComponentScopeKind2) {
|
|
2516
|
+
ComponentScopeKind2[ComponentScopeKind2["NgModule"] = 0] = "NgModule";
|
|
2517
|
+
ComponentScopeKind2[ComponentScopeKind2["Standalone"] = 1] = "Standalone";
|
|
2518
|
+
})(ComponentScopeKind || (ComponentScopeKind = {}));
|
|
2539
2519
|
|
|
2540
|
-
// bazel-out/
|
|
2541
|
-
var
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
}
|
|
2545
|
-
function generatedModuleName(originalModuleName, originalFileName, genSuffix) {
|
|
2546
|
-
let moduleName;
|
|
2547
|
-
if (originalFileName.endsWith("/index.ts")) {
|
|
2548
|
-
moduleName = originalModuleName + "/index" + genSuffix;
|
|
2549
|
-
} else {
|
|
2550
|
-
moduleName = originalModuleName + genSuffix;
|
|
2520
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/scope/src/component_scope.mjs
|
|
2521
|
+
var CompoundComponentScopeReader = class {
|
|
2522
|
+
constructor(readers) {
|
|
2523
|
+
this.readers = readers;
|
|
2551
2524
|
}
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
constructor(delegate, tsRootFiles, topLevelGenerators, perFileGenerators, oldProgram) {
|
|
2558
|
-
this.delegate = delegate;
|
|
2559
|
-
this.shims = /* @__PURE__ */ new Map();
|
|
2560
|
-
this.priorShims = /* @__PURE__ */ new Map();
|
|
2561
|
-
this.notShims = /* @__PURE__ */ new Set();
|
|
2562
|
-
this.generators = [];
|
|
2563
|
-
this.ignoreForEmit = /* @__PURE__ */ new Set();
|
|
2564
|
-
this.extensionPrefixes = [];
|
|
2565
|
-
for (const gen of perFileGenerators) {
|
|
2566
|
-
const pattern = `^(.*)\\.${gen.extensionPrefix}\\.ts$`;
|
|
2567
|
-
const regexp = new RegExp(pattern, "i");
|
|
2568
|
-
this.generators.push({
|
|
2569
|
-
generator: gen,
|
|
2570
|
-
test: regexp,
|
|
2571
|
-
suffix: `.${gen.extensionPrefix}.ts`
|
|
2572
|
-
});
|
|
2573
|
-
this.extensionPrefixes.push(gen.extensionPrefix);
|
|
2574
|
-
}
|
|
2575
|
-
const extraInputFiles = [];
|
|
2576
|
-
for (const gen of topLevelGenerators) {
|
|
2577
|
-
const sf = gen.makeTopLevelShim();
|
|
2578
|
-
sfExtensionData(sf).isTopLevelShim = true;
|
|
2579
|
-
if (!gen.shouldEmit) {
|
|
2580
|
-
this.ignoreForEmit.add(sf);
|
|
2581
|
-
}
|
|
2582
|
-
const fileName = absoluteFromSourceFile(sf);
|
|
2583
|
-
this.shims.set(fileName, sf);
|
|
2584
|
-
extraInputFiles.push(fileName);
|
|
2585
|
-
}
|
|
2586
|
-
for (const rootFile of tsRootFiles) {
|
|
2587
|
-
for (const gen of this.generators) {
|
|
2588
|
-
extraInputFiles.push(makeShimFileName(rootFile, gen.suffix));
|
|
2525
|
+
getScopeForComponent(clazz) {
|
|
2526
|
+
for (const reader of this.readers) {
|
|
2527
|
+
const meta = reader.getScopeForComponent(clazz);
|
|
2528
|
+
if (meta !== null) {
|
|
2529
|
+
return meta;
|
|
2589
2530
|
}
|
|
2590
2531
|
}
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2532
|
+
return null;
|
|
2533
|
+
}
|
|
2534
|
+
getRemoteScope(clazz) {
|
|
2535
|
+
for (const reader of this.readers) {
|
|
2536
|
+
const remoteScope = reader.getRemoteScope(clazz);
|
|
2537
|
+
if (remoteScope !== null) {
|
|
2538
|
+
return remoteScope;
|
|
2598
2539
|
}
|
|
2599
2540
|
}
|
|
2541
|
+
return null;
|
|
2600
2542
|
}
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2543
|
+
};
|
|
2544
|
+
|
|
2545
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/scope/src/dependency.mjs
|
|
2546
|
+
var MetadataDtsModuleScopeResolver = class {
|
|
2547
|
+
constructor(dtsMetaReader, aliasingHost) {
|
|
2548
|
+
this.dtsMetaReader = dtsMetaReader;
|
|
2549
|
+
this.aliasingHost = aliasingHost;
|
|
2550
|
+
this.cache = /* @__PURE__ */ new Map();
|
|
2551
|
+
}
|
|
2552
|
+
resolve(ref) {
|
|
2553
|
+
const clazz = ref.node;
|
|
2554
|
+
const sourceFile = clazz.getSourceFile();
|
|
2555
|
+
if (!sourceFile.isDeclarationFile) {
|
|
2556
|
+
throw new Error(`Debug error: DtsModuleScopeResolver.read(${ref.debugName} from ${sourceFile.fileName}), but not a .d.ts file`);
|
|
2606
2557
|
}
|
|
2607
|
-
if (
|
|
2608
|
-
this.
|
|
2558
|
+
if (this.cache.has(clazz)) {
|
|
2559
|
+
return this.cache.get(clazz);
|
|
2560
|
+
}
|
|
2561
|
+
const dependencies = [];
|
|
2562
|
+
const meta = this.dtsMetaReader.getNgModuleMetadata(ref);
|
|
2563
|
+
if (meta === null) {
|
|
2564
|
+
this.cache.set(clazz, null);
|
|
2609
2565
|
return null;
|
|
2610
2566
|
}
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2567
|
+
const declarations = /* @__PURE__ */ new Set();
|
|
2568
|
+
for (const declRef of meta.declarations) {
|
|
2569
|
+
declarations.add(declRef.node);
|
|
2570
|
+
}
|
|
2571
|
+
for (const exportRef of meta.exports) {
|
|
2572
|
+
const directive = this.dtsMetaReader.getDirectiveMetadata(exportRef);
|
|
2573
|
+
if (directive !== null) {
|
|
2574
|
+
const isReExport = !declarations.has(exportRef.node);
|
|
2575
|
+
dependencies.push(this.maybeAlias(directive, sourceFile, isReExport));
|
|
2614
2576
|
continue;
|
|
2615
2577
|
}
|
|
2616
|
-
const
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
return void 0;
|
|
2622
|
-
}
|
|
2578
|
+
const pipe = this.dtsMetaReader.getPipeMetadata(exportRef);
|
|
2579
|
+
if (pipe !== null) {
|
|
2580
|
+
const isReExport = !declarations.has(exportRef.node);
|
|
2581
|
+
dependencies.push(this.maybeAlias(pipe, sourceFile, isReExport));
|
|
2582
|
+
continue;
|
|
2623
2583
|
}
|
|
2624
|
-
const
|
|
2625
|
-
if (
|
|
2626
|
-
|
|
2584
|
+
const exportScope2 = this.resolve(exportRef);
|
|
2585
|
+
if (exportScope2 !== null) {
|
|
2586
|
+
if (this.aliasingHost === null) {
|
|
2587
|
+
dependencies.push(...exportScope2.exported.dependencies);
|
|
2588
|
+
} else {
|
|
2589
|
+
for (const dep of exportScope2.exported.dependencies) {
|
|
2590
|
+
dependencies.push(this.maybeAlias(dep, sourceFile, true));
|
|
2591
|
+
}
|
|
2592
|
+
}
|
|
2627
2593
|
}
|
|
2628
|
-
|
|
2594
|
+
continue;
|
|
2629
2595
|
}
|
|
2630
|
-
|
|
2631
|
-
|
|
2596
|
+
const exportScope = {
|
|
2597
|
+
exported: {
|
|
2598
|
+
dependencies,
|
|
2599
|
+
isPoisoned: false
|
|
2600
|
+
}
|
|
2601
|
+
};
|
|
2602
|
+
this.cache.set(clazz, exportScope);
|
|
2603
|
+
return exportScope;
|
|
2632
2604
|
}
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
if (this.
|
|
2636
|
-
|
|
2637
|
-
this.priorShims.delete(fileName);
|
|
2605
|
+
maybeAlias(dirOrPipe, maybeAliasFrom, isReExport) {
|
|
2606
|
+
const ref = dirOrPipe.ref;
|
|
2607
|
+
if (this.aliasingHost === null || ref.node.getSourceFile() === maybeAliasFrom) {
|
|
2608
|
+
return dirOrPipe;
|
|
2638
2609
|
}
|
|
2639
|
-
const
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
generatedFrom: absoluteFromSourceFile(inputFile)
|
|
2643
|
-
};
|
|
2644
|
-
if (!generator.shouldEmit) {
|
|
2645
|
-
this.ignoreForEmit.add(shimSf);
|
|
2610
|
+
const alias = this.aliasingHost.getAliasIn(ref.node, maybeAliasFrom, isReExport);
|
|
2611
|
+
if (alias === null) {
|
|
2612
|
+
return dirOrPipe;
|
|
2646
2613
|
}
|
|
2647
|
-
|
|
2648
|
-
|
|
2614
|
+
return __spreadProps(__spreadValues({}, dirOrPipe), {
|
|
2615
|
+
ref: ref.cloneWithAlias(alias)
|
|
2616
|
+
});
|
|
2649
2617
|
}
|
|
2650
2618
|
};
|
|
2651
2619
|
|
|
2652
|
-
// bazel-out/
|
|
2653
|
-
import
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
}
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
const
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
sourceText = leadingComment + "\n\n";
|
|
2671
|
-
}
|
|
2672
|
-
if (symbolNames.length > 0) {
|
|
2673
|
-
const varLines = symbolNames.map((name) => `export const ${name}NgFactory: i0.\u0275NgModuleFactory<any> = new i0.\u0275NgModuleFactory(${name});`);
|
|
2674
|
-
sourceText += [
|
|
2675
|
-
`import * as i0 from '@angular/core';`,
|
|
2676
|
-
`import {${symbolNames.join(", ")}} from '${relativePathToSource}';`,
|
|
2677
|
-
...varLines
|
|
2678
|
-
].join("\n");
|
|
2679
|
-
}
|
|
2680
|
-
sourceText += "\nexport const \u0275NonEmptyModule = true;";
|
|
2681
|
-
const genFile = ts14.createSourceFile(genFilePath, sourceText, sf.languageVersion, true, ts14.ScriptKind.TS);
|
|
2682
|
-
if (sf.moduleName !== void 0) {
|
|
2683
|
-
genFile.moduleName = generatedModuleName(sf.moduleName, sf.fileName, ".ngfactory");
|
|
2684
|
-
}
|
|
2685
|
-
const moduleSymbols = /* @__PURE__ */ new Map();
|
|
2686
|
-
this.sourceToFactorySymbols.set(absoluteSfPath, moduleSymbols);
|
|
2687
|
-
this.sourceInfo.set(genFilePath, {
|
|
2688
|
-
sourceFilePath: absoluteSfPath,
|
|
2689
|
-
moduleSymbols
|
|
2690
|
-
});
|
|
2691
|
-
return genFile;
|
|
2692
|
-
}
|
|
2693
|
-
track(sf, moduleInfo) {
|
|
2694
|
-
if (this.sourceToFactorySymbols.has(sf.fileName)) {
|
|
2695
|
-
this.sourceToFactorySymbols.get(sf.fileName).set(moduleInfo.name, moduleInfo);
|
|
2620
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/scope/src/local.mjs
|
|
2621
|
+
import { ExternalExpr as ExternalExpr3 } from "@angular/compiler";
|
|
2622
|
+
import ts12 from "typescript";
|
|
2623
|
+
|
|
2624
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/scope/src/util.mjs
|
|
2625
|
+
function getDiagnosticNode(ref, rawExpr) {
|
|
2626
|
+
return rawExpr !== null ? ref.getOriginForDiagnostics(rawExpr) : ref.node.name;
|
|
2627
|
+
}
|
|
2628
|
+
function makeNotStandaloneDiagnostic(scopeReader, ref, rawExpr, kind) {
|
|
2629
|
+
const scope = scopeReader.getScopeForComponent(ref.node);
|
|
2630
|
+
let message = `The ${kind} '${ref.node.name.text}' appears in 'imports', but is not standalone and cannot be imported directly.`;
|
|
2631
|
+
let relatedInformation = void 0;
|
|
2632
|
+
if (scope !== null && scope.kind === ComponentScopeKind.NgModule) {
|
|
2633
|
+
const isExported = scope.exported.dependencies.some((dep) => dep.ref.node === ref.node);
|
|
2634
|
+
if (isExported) {
|
|
2635
|
+
relatedInformation = [makeRelatedInformation(scope.ngModule.name, `It can be imported using its NgModule '${scope.ngModule.name.text}' instead.`)];
|
|
2636
|
+
} else {
|
|
2637
|
+
relatedInformation = [makeRelatedInformation(scope.ngModule.name, `It's declared in the NgModule '${scope.ngModule.name.text}', but is not exported. Consider exporting it.`)];
|
|
2696
2638
|
}
|
|
2639
|
+
} else {
|
|
2697
2640
|
}
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2641
|
+
if (relatedInformation === void 0) {
|
|
2642
|
+
message += " It must be imported via an NgModule.";
|
|
2643
|
+
}
|
|
2644
|
+
return makeDiagnostic(ErrorCode.COMPONENT_IMPORT_NOT_STANDALONE, getDiagnosticNode(ref, rawExpr), message, relatedInformation);
|
|
2701
2645
|
}
|
|
2702
|
-
function
|
|
2703
|
-
return (
|
|
2704
|
-
return (file) => {
|
|
2705
|
-
return transformFactorySourceFile(factoryMap, context, importRewriter, file);
|
|
2706
|
-
};
|
|
2707
|
-
};
|
|
2646
|
+
function makeUnknownComponentImportDiagnostic(ref, rawExpr) {
|
|
2647
|
+
return makeDiagnostic(ErrorCode.COMPONENT_UNKNOWN_IMPORT, getDiagnosticNode(ref, rawExpr), `Component imports must be standalone components, directives, pipes, or must be NgModules.`);
|
|
2708
2648
|
}
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2649
|
+
|
|
2650
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/scope/src/local.mjs
|
|
2651
|
+
var LocalModuleScopeRegistry = class {
|
|
2652
|
+
constructor(localReader, fullReader, dependencyScopeReader, refEmitter, aliasingHost) {
|
|
2653
|
+
this.localReader = localReader;
|
|
2654
|
+
this.fullReader = fullReader;
|
|
2655
|
+
this.dependencyScopeReader = dependencyScopeReader;
|
|
2656
|
+
this.refEmitter = refEmitter;
|
|
2657
|
+
this.aliasingHost = aliasingHost;
|
|
2658
|
+
this.sealed = false;
|
|
2659
|
+
this.declarationToModule = /* @__PURE__ */ new Map();
|
|
2660
|
+
this.duplicateDeclarations = /* @__PURE__ */ new Map();
|
|
2661
|
+
this.moduleToRef = /* @__PURE__ */ new Map();
|
|
2662
|
+
this.cache = /* @__PURE__ */ new Map();
|
|
2663
|
+
this.remoteScoping = /* @__PURE__ */ new Map();
|
|
2664
|
+
this.scopeErrors = /* @__PURE__ */ new Map();
|
|
2665
|
+
this.modulesWithStructuralErrors = /* @__PURE__ */ new Set();
|
|
2666
|
+
}
|
|
2667
|
+
registerNgModuleMetadata(data) {
|
|
2668
|
+
this.assertCollecting();
|
|
2669
|
+
const ngModule = data.ref.node;
|
|
2670
|
+
this.moduleToRef.set(data.ref.node, data.ref);
|
|
2671
|
+
for (const decl of data.declarations) {
|
|
2672
|
+
this.registerDeclarationOfModule(ngModule, decl, data.rawDeclarations);
|
|
2673
|
+
}
|
|
2674
|
+
}
|
|
2675
|
+
registerDirectiveMetadata(directive) {
|
|
2676
|
+
}
|
|
2677
|
+
registerPipeMetadata(pipe) {
|
|
2678
|
+
}
|
|
2679
|
+
getScopeForComponent(clazz) {
|
|
2680
|
+
const scope = !this.declarationToModule.has(clazz) ? null : this.getScopeOfModule(this.declarationToModule.get(clazz).ngModule);
|
|
2681
|
+
return scope;
|
|
2682
|
+
}
|
|
2683
|
+
getDuplicateDeclarations(node) {
|
|
2684
|
+
if (!this.duplicateDeclarations.has(node)) {
|
|
2685
|
+
return null;
|
|
2686
|
+
}
|
|
2687
|
+
return Array.from(this.duplicateDeclarations.get(node).values());
|
|
2688
|
+
}
|
|
2689
|
+
getScopeOfModule(clazz) {
|
|
2690
|
+
return this.moduleToRef.has(clazz) ? this.getScopeOfModuleReference(this.moduleToRef.get(clazz)) : null;
|
|
2691
|
+
}
|
|
2692
|
+
getDiagnosticsOfModule(clazz) {
|
|
2693
|
+
this.getScopeOfModule(clazz);
|
|
2694
|
+
if (this.scopeErrors.has(clazz)) {
|
|
2695
|
+
return this.scopeErrors.get(clazz);
|
|
2696
|
+
} else {
|
|
2697
|
+
return null;
|
|
2698
|
+
}
|
|
2699
|
+
}
|
|
2700
|
+
registerDeclarationOfModule(ngModule, decl, rawDeclarations) {
|
|
2701
|
+
const declData = {
|
|
2702
|
+
ngModule,
|
|
2703
|
+
ref: decl,
|
|
2704
|
+
rawDeclarations
|
|
2705
|
+
};
|
|
2706
|
+
if (this.duplicateDeclarations.has(decl.node)) {
|
|
2707
|
+
this.duplicateDeclarations.get(decl.node).set(ngModule, declData);
|
|
2708
|
+
} else if (this.declarationToModule.has(decl.node) && this.declarationToModule.get(decl.node).ngModule !== ngModule) {
|
|
2709
|
+
const duplicateDeclMap = /* @__PURE__ */ new Map();
|
|
2710
|
+
const firstDeclData = this.declarationToModule.get(decl.node);
|
|
2711
|
+
this.modulesWithStructuralErrors.add(firstDeclData.ngModule);
|
|
2712
|
+
this.modulesWithStructuralErrors.add(ngModule);
|
|
2713
|
+
duplicateDeclMap.set(firstDeclData.ngModule, firstDeclData);
|
|
2714
|
+
duplicateDeclMap.set(ngModule, declData);
|
|
2715
|
+
this.duplicateDeclarations.set(decl.node, duplicateDeclMap);
|
|
2716
|
+
this.declarationToModule.delete(decl.node);
|
|
2717
|
+
} else {
|
|
2718
|
+
this.declarationToModule.set(decl.node, declData);
|
|
2719
|
+
}
|
|
2720
|
+
}
|
|
2721
|
+
getScopeOfModuleReference(ref) {
|
|
2722
|
+
if (this.cache.has(ref.node)) {
|
|
2723
|
+
return this.cache.get(ref.node);
|
|
2724
|
+
}
|
|
2725
|
+
this.sealed = true;
|
|
2726
|
+
const ngModule = this.localReader.getNgModuleMetadata(ref);
|
|
2727
|
+
if (ngModule === null) {
|
|
2728
|
+
this.cache.set(ref.node, null);
|
|
2729
|
+
return null;
|
|
2730
|
+
}
|
|
2731
|
+
const diagnostics = [];
|
|
2732
|
+
const compilationDirectives = /* @__PURE__ */ new Map();
|
|
2733
|
+
const compilationPipes = /* @__PURE__ */ new Map();
|
|
2734
|
+
const declared = /* @__PURE__ */ new Set();
|
|
2735
|
+
const exportDirectives = /* @__PURE__ */ new Map();
|
|
2736
|
+
const exportPipes = /* @__PURE__ */ new Map();
|
|
2737
|
+
let isPoisoned = false;
|
|
2738
|
+
if (this.modulesWithStructuralErrors.has(ngModule.ref.node)) {
|
|
2739
|
+
isPoisoned = true;
|
|
2740
|
+
}
|
|
2741
|
+
for (const decl of ngModule.imports) {
|
|
2742
|
+
const importScope = this.getExportedScope(decl, diagnostics, ref.node, "import");
|
|
2743
|
+
if (importScope !== null) {
|
|
2744
|
+
if (importScope === "invalid" || importScope.exported.isPoisoned) {
|
|
2745
|
+
diagnostics.push(invalidTransitiveNgModuleRef(decl, ngModule.rawImports, "import"));
|
|
2746
|
+
isPoisoned = true;
|
|
2747
|
+
if (importScope === "invalid") {
|
|
2748
|
+
continue;
|
|
2749
|
+
}
|
|
2724
2750
|
}
|
|
2751
|
+
for (const dep of importScope.exported.dependencies) {
|
|
2752
|
+
if (dep.kind === MetaKind.Directive) {
|
|
2753
|
+
compilationDirectives.set(dep.ref.node, dep);
|
|
2754
|
+
} else if (dep.kind === MetaKind.Pipe) {
|
|
2755
|
+
compilationPipes.set(dep.ref.node, dep);
|
|
2756
|
+
}
|
|
2757
|
+
}
|
|
2758
|
+
continue;
|
|
2759
|
+
}
|
|
2760
|
+
const directive = this.fullReader.getDirectiveMetadata(decl);
|
|
2761
|
+
if (directive !== null) {
|
|
2762
|
+
if (directive.isStandalone) {
|
|
2763
|
+
compilationDirectives.set(directive.ref.node, directive);
|
|
2764
|
+
} else {
|
|
2765
|
+
diagnostics.push(makeNotStandaloneDiagnostic(this, decl, ngModule.rawImports, directive.isComponent ? "component" : "directive"));
|
|
2766
|
+
isPoisoned = true;
|
|
2767
|
+
}
|
|
2768
|
+
continue;
|
|
2769
|
+
}
|
|
2770
|
+
const pipe = this.fullReader.getPipeMetadata(decl);
|
|
2771
|
+
if (pipe !== null) {
|
|
2772
|
+
if (pipe.isStandalone) {
|
|
2773
|
+
compilationPipes.set(pipe.ref.node, pipe);
|
|
2774
|
+
} else {
|
|
2775
|
+
diagnostics.push(makeNotStandaloneDiagnostic(this, decl, ngModule.rawImports, "pipe"));
|
|
2776
|
+
isPoisoned = true;
|
|
2777
|
+
}
|
|
2778
|
+
continue;
|
|
2779
|
+
}
|
|
2780
|
+
diagnostics.push(invalidRef(decl, ngModule.rawImports, "import"));
|
|
2781
|
+
isPoisoned = true;
|
|
2782
|
+
}
|
|
2783
|
+
for (const decl of ngModule.declarations) {
|
|
2784
|
+
const directive = this.localReader.getDirectiveMetadata(decl);
|
|
2785
|
+
const pipe = this.localReader.getPipeMetadata(decl);
|
|
2786
|
+
if (directive !== null) {
|
|
2787
|
+
if (directive.isStandalone) {
|
|
2788
|
+
const refType = directive.isComponent ? "Component" : "Directive";
|
|
2789
|
+
diagnostics.push(makeDiagnostic(ErrorCode.NGMODULE_DECLARATION_IS_STANDALONE, decl.getOriginForDiagnostics(ngModule.rawDeclarations), `${refType} ${decl.node.name.text} is standalone, and cannot be declared in an NgModule. Did you mean to import it instead?`));
|
|
2790
|
+
isPoisoned = true;
|
|
2791
|
+
continue;
|
|
2792
|
+
}
|
|
2793
|
+
compilationDirectives.set(decl.node, __spreadProps(__spreadValues({}, directive), { ref: decl }));
|
|
2794
|
+
if (directive.isPoisoned) {
|
|
2795
|
+
isPoisoned = true;
|
|
2796
|
+
}
|
|
2797
|
+
} else if (pipe !== null) {
|
|
2798
|
+
if (pipe.isStandalone) {
|
|
2799
|
+
diagnostics.push(makeDiagnostic(ErrorCode.NGMODULE_DECLARATION_IS_STANDALONE, decl.getOriginForDiagnostics(ngModule.rawDeclarations), `Pipe ${decl.node.name.text} is standalone, and cannot be declared in an NgModule. Did you mean to import it instead?`));
|
|
2800
|
+
isPoisoned = true;
|
|
2801
|
+
continue;
|
|
2802
|
+
}
|
|
2803
|
+
compilationPipes.set(decl.node, __spreadProps(__spreadValues({}, pipe), { ref: decl }));
|
|
2725
2804
|
} else {
|
|
2726
|
-
|
|
2805
|
+
const errorNode = decl.getOriginForDiagnostics(ngModule.rawDeclarations);
|
|
2806
|
+
diagnostics.push(makeDiagnostic(ErrorCode.NGMODULE_INVALID_DECLARATION, errorNode, `The class '${decl.node.name.text}' is listed in the declarations of the NgModule '${ngModule.ref.node.name.text}', but is not a directive, a component, or a pipe. Either remove it from the NgModule's declarations, or add an appropriate Angular decorator.`, [makeRelatedInformation(decl.node.name, `'${decl.node.name.text}' is declared here.`)]));
|
|
2807
|
+
isPoisoned = true;
|
|
2808
|
+
continue;
|
|
2727
2809
|
}
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2810
|
+
declared.add(decl.node);
|
|
2811
|
+
}
|
|
2812
|
+
for (const decl of ngModule.exports) {
|
|
2813
|
+
const exportScope = this.getExportedScope(decl, diagnostics, ref.node, "export");
|
|
2814
|
+
if (exportScope === "invalid" || exportScope !== null && exportScope.exported.isPoisoned) {
|
|
2815
|
+
diagnostics.push(invalidTransitiveNgModuleRef(decl, ngModule.rawExports, "export"));
|
|
2816
|
+
isPoisoned = true;
|
|
2817
|
+
if (exportScope === "invalid") {
|
|
2733
2818
|
continue;
|
|
2734
2819
|
}
|
|
2735
|
-
|
|
2736
|
-
const
|
|
2737
|
-
|
|
2738
|
-
|
|
2820
|
+
} else if (exportScope !== null) {
|
|
2821
|
+
for (const dep of exportScope.exported.dependencies) {
|
|
2822
|
+
if (dep.kind == MetaKind.Directive) {
|
|
2823
|
+
exportDirectives.set(dep.ref.node, dep);
|
|
2824
|
+
} else if (dep.kind === MetaKind.Pipe) {
|
|
2825
|
+
exportPipes.set(dep.ref.node, dep);
|
|
2826
|
+
}
|
|
2739
2827
|
}
|
|
2828
|
+
} else if (compilationDirectives.has(decl.node)) {
|
|
2829
|
+
const directive = compilationDirectives.get(decl.node);
|
|
2830
|
+
exportDirectives.set(decl.node, directive);
|
|
2831
|
+
} else if (compilationPipes.has(decl.node)) {
|
|
2832
|
+
const pipe = compilationPipes.get(decl.node);
|
|
2833
|
+
exportPipes.set(decl.node, pipe);
|
|
2740
2834
|
} else {
|
|
2741
|
-
|
|
2835
|
+
const dirMeta = this.fullReader.getDirectiveMetadata(decl);
|
|
2836
|
+
const pipeMeta = this.fullReader.getPipeMetadata(decl);
|
|
2837
|
+
if (dirMeta !== null || pipeMeta !== null) {
|
|
2838
|
+
const isStandalone = dirMeta !== null ? dirMeta.isStandalone : pipeMeta.isStandalone;
|
|
2839
|
+
diagnostics.push(invalidReexport(decl, ngModule.rawExports, isStandalone));
|
|
2840
|
+
} else {
|
|
2841
|
+
diagnostics.push(invalidRef(decl, ngModule.rawExports, "export"));
|
|
2842
|
+
}
|
|
2843
|
+
isPoisoned = true;
|
|
2844
|
+
continue;
|
|
2742
2845
|
}
|
|
2743
|
-
} else {
|
|
2744
|
-
transformedStatements.push(stmt);
|
|
2745
2846
|
}
|
|
2847
|
+
const exported = {
|
|
2848
|
+
dependencies: [...exportDirectives.values(), ...exportPipes.values()],
|
|
2849
|
+
isPoisoned
|
|
2850
|
+
};
|
|
2851
|
+
const reexports = this.getReexports(ngModule, ref, declared, exported.dependencies, diagnostics);
|
|
2852
|
+
const scope = {
|
|
2853
|
+
kind: ComponentScopeKind.NgModule,
|
|
2854
|
+
ngModule: ngModule.ref.node,
|
|
2855
|
+
compilation: {
|
|
2856
|
+
dependencies: [...compilationDirectives.values(), ...compilationPipes.values()],
|
|
2857
|
+
isPoisoned
|
|
2858
|
+
},
|
|
2859
|
+
exported,
|
|
2860
|
+
reexports,
|
|
2861
|
+
schemas: ngModule.schemas
|
|
2862
|
+
};
|
|
2863
|
+
if (diagnostics.length > 0) {
|
|
2864
|
+
this.scopeErrors.set(ref.node, diagnostics);
|
|
2865
|
+
this.modulesWithStructuralErrors.add(ref.node);
|
|
2866
|
+
}
|
|
2867
|
+
this.cache.set(ref.node, scope);
|
|
2868
|
+
return scope;
|
|
2746
2869
|
}
|
|
2747
|
-
|
|
2748
|
-
|
|
2870
|
+
getRemoteScope(node) {
|
|
2871
|
+
return this.remoteScoping.has(node) ? this.remoteScoping.get(node) : null;
|
|
2749
2872
|
}
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2873
|
+
setComponentRemoteScope(node, directives, pipes) {
|
|
2874
|
+
this.remoteScoping.set(node, { directives, pipes });
|
|
2875
|
+
}
|
|
2876
|
+
getExportedScope(ref, diagnostics, ownerForErrors, type) {
|
|
2877
|
+
if (ref.node.getSourceFile().isDeclarationFile) {
|
|
2878
|
+
if (!ts12.isClassDeclaration(ref.node)) {
|
|
2879
|
+
const code = type === "import" ? ErrorCode.NGMODULE_INVALID_IMPORT : ErrorCode.NGMODULE_INVALID_EXPORT;
|
|
2880
|
+
diagnostics.push(makeDiagnostic(code, identifierOfNode(ref.node) || ref.node, `Appears in the NgModule.${type}s of ${nodeNameForError(ownerForErrors)}, but could not be resolved to an NgModule`));
|
|
2881
|
+
return "invalid";
|
|
2882
|
+
}
|
|
2883
|
+
return this.dependencyScopeReader.resolve(ref);
|
|
2884
|
+
} else {
|
|
2885
|
+
return this.getScopeOfModuleReference(ref);
|
|
2886
|
+
}
|
|
2887
|
+
}
|
|
2888
|
+
getReexports(ngModule, ref, declared, exported, diagnostics) {
|
|
2889
|
+
let reexports = null;
|
|
2890
|
+
const sourceFile = ref.node.getSourceFile();
|
|
2891
|
+
if (this.aliasingHost === null) {
|
|
2892
|
+
return null;
|
|
2893
|
+
}
|
|
2894
|
+
reexports = [];
|
|
2895
|
+
const reexportMap = /* @__PURE__ */ new Map();
|
|
2896
|
+
const ngModuleRef = ref;
|
|
2897
|
+
const addReexport = (exportRef) => {
|
|
2898
|
+
if (exportRef.node.getSourceFile() === sourceFile) {
|
|
2899
|
+
return;
|
|
2900
|
+
}
|
|
2901
|
+
const isReExport = !declared.has(exportRef.node);
|
|
2902
|
+
const exportName = this.aliasingHost.maybeAliasSymbolAs(exportRef, sourceFile, ngModule.ref.node.name.text, isReExport);
|
|
2903
|
+
if (exportName === null) {
|
|
2904
|
+
return;
|
|
2905
|
+
}
|
|
2906
|
+
if (!reexportMap.has(exportName)) {
|
|
2907
|
+
if (exportRef.alias && exportRef.alias instanceof ExternalExpr3) {
|
|
2908
|
+
reexports.push({
|
|
2909
|
+
fromModule: exportRef.alias.value.moduleName,
|
|
2910
|
+
symbolName: exportRef.alias.value.name,
|
|
2911
|
+
asAlias: exportName
|
|
2912
|
+
});
|
|
2913
|
+
} else {
|
|
2914
|
+
const emittedRef = this.refEmitter.emit(exportRef.cloneWithNoIdentifiers(), sourceFile);
|
|
2915
|
+
assertSuccessfulReferenceEmit(emittedRef, ngModuleRef.node.name, "class");
|
|
2916
|
+
const expr = emittedRef.expression;
|
|
2917
|
+
if (!(expr instanceof ExternalExpr3) || expr.value.moduleName === null || expr.value.name === null) {
|
|
2918
|
+
throw new Error("Expected ExternalExpr");
|
|
2919
|
+
}
|
|
2920
|
+
reexports.push({
|
|
2921
|
+
fromModule: expr.value.moduleName,
|
|
2922
|
+
symbolName: expr.value.name,
|
|
2923
|
+
asAlias: exportName
|
|
2924
|
+
});
|
|
2759
2925
|
}
|
|
2926
|
+
reexportMap.set(exportName, exportRef);
|
|
2927
|
+
} else {
|
|
2928
|
+
const prevRef = reexportMap.get(exportName);
|
|
2929
|
+
diagnostics.push(reexportCollision(ngModuleRef.node, prevRef, exportRef));
|
|
2760
2930
|
}
|
|
2761
|
-
return node;
|
|
2762
2931
|
};
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
function getFileoverviewComment(sourceFile) {
|
|
2768
|
-
const text = sourceFile.getFullText();
|
|
2769
|
-
const trivia = text.substring(0, sourceFile.getStart());
|
|
2770
|
-
const leadingComments = ts14.getLeadingCommentRanges(trivia, 0);
|
|
2771
|
-
if (!leadingComments || leadingComments.length === 0) {
|
|
2772
|
-
return null;
|
|
2932
|
+
for (const { ref: ref2 } of exported) {
|
|
2933
|
+
addReexport(ref2);
|
|
2934
|
+
}
|
|
2935
|
+
return reexports;
|
|
2773
2936
|
}
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2937
|
+
assertCollecting() {
|
|
2938
|
+
if (this.sealed) {
|
|
2939
|
+
throw new Error(`Assertion: LocalModuleScopeRegistry is not COLLECTING`);
|
|
2940
|
+
}
|
|
2777
2941
|
}
|
|
2778
|
-
|
|
2779
|
-
|
|
2942
|
+
};
|
|
2943
|
+
function invalidRef(decl, rawExpr, type) {
|
|
2944
|
+
const code = type === "import" ? ErrorCode.NGMODULE_INVALID_IMPORT : ErrorCode.NGMODULE_INVALID_EXPORT;
|
|
2945
|
+
const resolveTarget = type === "import" ? "NgModule" : "NgModule, Component, Directive, or Pipe";
|
|
2946
|
+
const message = `'${decl.node.name.text}' does not appear to be an ${resolveTarget} class.`;
|
|
2947
|
+
const library = decl.ownedByModuleGuess !== null ? ` (${decl.ownedByModuleGuess})` : "";
|
|
2948
|
+
const sf = decl.node.getSourceFile();
|
|
2949
|
+
let relatedMessage;
|
|
2950
|
+
if (!sf.isDeclarationFile) {
|
|
2951
|
+
const annotationType = type === "import" ? "@NgModule" : "Angular";
|
|
2952
|
+
relatedMessage = `Is it missing an ${annotationType} annotation?`;
|
|
2953
|
+
} else if (sf.fileName.indexOf("node_modules") !== -1) {
|
|
2954
|
+
relatedMessage = `This likely means that the library${library} which declares ${decl.debugName} has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.`;
|
|
2955
|
+
} else {
|
|
2956
|
+
relatedMessage = `This likely means that the dependency${library} which declares ${decl.debugName} has not been processed correctly by ngcc.`;
|
|
2780
2957
|
}
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2958
|
+
return makeDiagnostic(code, getDiagnosticNode(decl, rawExpr), message, [makeRelatedInformation(decl.node.name, relatedMessage)]);
|
|
2959
|
+
}
|
|
2960
|
+
function invalidTransitiveNgModuleRef(decl, rawExpr, type) {
|
|
2961
|
+
const code = type === "import" ? ErrorCode.NGMODULE_INVALID_IMPORT : ErrorCode.NGMODULE_INVALID_EXPORT;
|
|
2962
|
+
return makeDiagnostic(code, getDiagnosticNode(decl, rawExpr), `This ${type} contains errors, which may affect components that depend on this NgModule.`);
|
|
2963
|
+
}
|
|
2964
|
+
function invalidReexport(decl, rawExpr, isStandalone) {
|
|
2965
|
+
let message = `Can't be exported from this NgModule, as `;
|
|
2966
|
+
if (isStandalone) {
|
|
2967
|
+
message += "it must be imported first";
|
|
2968
|
+
} else if (decl.node.getSourceFile().isDeclarationFile) {
|
|
2969
|
+
message += "it must be imported via its NgModule first";
|
|
2970
|
+
} else {
|
|
2971
|
+
message += "it must be either declared by this NgModule, or imported here via its NgModule first";
|
|
2784
2972
|
}
|
|
2785
|
-
return
|
|
2973
|
+
return makeDiagnostic(ErrorCode.NGMODULE_INVALID_REEXPORT, getDiagnosticNode(decl, rawExpr), message);
|
|
2786
2974
|
}
|
|
2787
|
-
function
|
|
2788
|
-
const
|
|
2789
|
-
return
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2975
|
+
function reexportCollision(module, refA, refB) {
|
|
2976
|
+
const childMessageText = `This directive/pipe is part of the exports of '${module.name.text}' and shares the same name as another exported directive/pipe.`;
|
|
2977
|
+
return makeDiagnostic(ErrorCode.NGMODULE_REEXPORT_NAME_COLLISION, module.name, `
|
|
2978
|
+
There was a name collision between two classes named '${refA.node.name.text}', which are both part of the exports of '${module.name.text}'.
|
|
2979
|
+
|
|
2980
|
+
Angular generates re-exports of an NgModule's exported directives/pipes from the module's source file in certain cases, using the declared name of the class. If two classes of the same name are exported, this automatic naming does not work.
|
|
2981
|
+
|
|
2982
|
+
To fix this problem please re-export one or both classes directly from this file.
|
|
2983
|
+
`.trim(), [
|
|
2984
|
+
makeRelatedInformation(refA.node.name, childMessageText),
|
|
2985
|
+
makeRelatedInformation(refB.node.name, childMessageText)
|
|
2793
2986
|
]);
|
|
2794
2987
|
}
|
|
2795
|
-
function updateInitializers(stmt, update) {
|
|
2796
|
-
return ts14.factory.updateVariableStatement(stmt, stmt.modifiers, ts14.factory.updateVariableDeclarationList(stmt.declarationList, stmt.declarationList.declarations.map((decl) => ts14.updateVariableDeclaration(decl, decl.name, decl.type, update(decl.initializer)))));
|
|
2797
|
-
}
|
|
2798
2988
|
|
|
2799
|
-
// bazel-out/
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
this.
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2989
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/scope/src/typecheck.mjs
|
|
2990
|
+
import { CssSelector, SelectorMatcher } from "@angular/compiler";
|
|
2991
|
+
import ts13 from "typescript";
|
|
2992
|
+
var TypeCheckScopeRegistry = class {
|
|
2993
|
+
constructor(scopeReader, metaReader) {
|
|
2994
|
+
this.scopeReader = scopeReader;
|
|
2995
|
+
this.metaReader = metaReader;
|
|
2996
|
+
this.flattenedDirectiveMetaCache = /* @__PURE__ */ new Map();
|
|
2997
|
+
this.scopeCache = /* @__PURE__ */ new Map();
|
|
2998
|
+
}
|
|
2999
|
+
getTypeCheckScope(node) {
|
|
3000
|
+
const matcher = new SelectorMatcher();
|
|
3001
|
+
const directives = [];
|
|
3002
|
+
const pipes = /* @__PURE__ */ new Map();
|
|
3003
|
+
const scope = this.scopeReader.getScopeForComponent(node);
|
|
3004
|
+
if (scope === null) {
|
|
3005
|
+
return {
|
|
3006
|
+
matcher,
|
|
3007
|
+
directives,
|
|
3008
|
+
pipes,
|
|
3009
|
+
schemas: [],
|
|
3010
|
+
isPoisoned: false
|
|
3011
|
+
};
|
|
2809
3012
|
}
|
|
2810
|
-
const
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
const
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
3013
|
+
const cacheKey = scope.kind === ComponentScopeKind.NgModule ? scope.ngModule : scope.component;
|
|
3014
|
+
const dependencies = scope.kind === ComponentScopeKind.NgModule ? scope.compilation.dependencies : scope.dependencies;
|
|
3015
|
+
if (this.scopeCache.has(cacheKey)) {
|
|
3016
|
+
return this.scopeCache.get(cacheKey);
|
|
3017
|
+
}
|
|
3018
|
+
for (const meta of dependencies) {
|
|
3019
|
+
if (meta.kind === MetaKind.Directive && meta.selector !== null) {
|
|
3020
|
+
const extMeta = this.getTypeCheckDirectiveMetadata(meta.ref);
|
|
3021
|
+
matcher.addSelectables(CssSelector.parse(meta.selector), extMeta);
|
|
3022
|
+
directives.push(extMeta);
|
|
3023
|
+
} else if (meta.kind === MetaKind.Pipe) {
|
|
3024
|
+
if (!ts13.isClassDeclaration(meta.ref.node)) {
|
|
3025
|
+
throw new Error(`Unexpected non-class declaration ${ts13.SyntaxKind[meta.ref.node.kind]} for pipe ${meta.ref.debugName}`);
|
|
3026
|
+
}
|
|
3027
|
+
pipes.set(meta.name, meta.ref);
|
|
3028
|
+
}
|
|
2822
3029
|
}
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
3030
|
+
const typeCheckScope = {
|
|
3031
|
+
matcher,
|
|
3032
|
+
directives,
|
|
3033
|
+
pipes,
|
|
3034
|
+
schemas: scope.schemas,
|
|
3035
|
+
isPoisoned: scope.kind === ComponentScopeKind.NgModule ? scope.compilation.isPoisoned || scope.exported.isPoisoned : scope.isPoisoned
|
|
3036
|
+
};
|
|
3037
|
+
this.scopeCache.set(cacheKey, typeCheckScope);
|
|
3038
|
+
return typeCheckScope;
|
|
2826
3039
|
}
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
this.
|
|
3040
|
+
getTypeCheckDirectiveMetadata(ref) {
|
|
3041
|
+
const clazz = ref.node;
|
|
3042
|
+
if (this.flattenedDirectiveMetaCache.has(clazz)) {
|
|
3043
|
+
return this.flattenedDirectiveMetaCache.get(clazz);
|
|
3044
|
+
}
|
|
3045
|
+
const meta = flattenInheritedDirectiveMetadata(this.metaReader, ref);
|
|
3046
|
+
this.flattenedDirectiveMetaCache.set(clazz, meta);
|
|
3047
|
+
return meta;
|
|
2830
3048
|
}
|
|
2831
3049
|
};
|
|
2832
3050
|
|
|
2833
|
-
// bazel-out/
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
3051
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/api.mjs
|
|
3052
|
+
var CompilationMode;
|
|
3053
|
+
(function(CompilationMode2) {
|
|
3054
|
+
CompilationMode2[CompilationMode2["FULL"] = 0] = "FULL";
|
|
3055
|
+
CompilationMode2[CompilationMode2["PARTIAL"] = 1] = "PARTIAL";
|
|
3056
|
+
})(CompilationMode || (CompilationMode = {}));
|
|
3057
|
+
var HandlerPrecedence;
|
|
3058
|
+
(function(HandlerPrecedence2) {
|
|
3059
|
+
HandlerPrecedence2[HandlerPrecedence2["PRIMARY"] = 0] = "PRIMARY";
|
|
3060
|
+
HandlerPrecedence2[HandlerPrecedence2["SHARED"] = 1] = "SHARED";
|
|
3061
|
+
HandlerPrecedence2[HandlerPrecedence2["WEAK"] = 2] = "WEAK";
|
|
3062
|
+
})(HandlerPrecedence || (HandlerPrecedence = {}));
|
|
3063
|
+
var HandlerFlags;
|
|
3064
|
+
(function(HandlerFlags2) {
|
|
3065
|
+
HandlerFlags2[HandlerFlags2["NONE"] = 0] = "NONE";
|
|
3066
|
+
HandlerFlags2[HandlerFlags2["FULL_INHERITANCE"] = 1] = "FULL_INHERITANCE";
|
|
3067
|
+
})(HandlerFlags || (HandlerFlags = {}));
|
|
3068
|
+
|
|
3069
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/alias.mjs
|
|
3070
|
+
import ts14 from "typescript";
|
|
3071
|
+
function aliasTransformFactory(exportStatements) {
|
|
3072
|
+
return (context) => {
|
|
3073
|
+
return (file) => {
|
|
3074
|
+
if (ts14.isBundle(file) || !exportStatements.has(file.fileName)) {
|
|
3075
|
+
return file;
|
|
2855
3076
|
}
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
genFile.moduleName = generatedModuleName(sf.moduleName, sf.fileName, ".ngsummary");
|
|
2865
|
-
}
|
|
2866
|
-
return genFile;
|
|
2867
|
-
}
|
|
2868
|
-
};
|
|
2869
|
-
function isExported2(decl) {
|
|
2870
|
-
return decl.modifiers !== void 0 && decl.modifiers.some((mod) => mod.kind == ts15.SyntaxKind.ExportKeyword);
|
|
3077
|
+
const statements = [...file.statements];
|
|
3078
|
+
exportStatements.get(file.fileName).forEach(([moduleName, symbolName], aliasName) => {
|
|
3079
|
+
const stmt = ts14.factory.createExportDeclaration(void 0, void 0, false, ts14.createNamedExports([ts14.factory.createExportSpecifier(false, symbolName, aliasName)]), ts14.factory.createStringLiteral(moduleName));
|
|
3080
|
+
statements.push(stmt);
|
|
3081
|
+
});
|
|
3082
|
+
return ts14.factory.updateSourceFile(file, statements);
|
|
3083
|
+
};
|
|
3084
|
+
};
|
|
2871
3085
|
}
|
|
2872
3086
|
|
|
2873
|
-
// bazel-out/
|
|
3087
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/compilation.mjs
|
|
3088
|
+
import ts15 from "typescript";
|
|
3089
|
+
|
|
3090
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/trait.mjs
|
|
2874
3091
|
var TraitState;
|
|
2875
3092
|
(function(TraitState2) {
|
|
2876
3093
|
TraitState2[TraitState2["Pending"] = 0] = "Pending";
|
|
@@ -2925,9 +3142,9 @@ var TraitImpl = class {
|
|
|
2925
3142
|
}
|
|
2926
3143
|
};
|
|
2927
3144
|
|
|
2928
|
-
// bazel-out/
|
|
3145
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/compilation.mjs
|
|
2929
3146
|
var TraitCompiler = class {
|
|
2930
|
-
constructor(handlers, reflector, perf, incrementalBuild, compileNonExportedClasses, compilationMode, dtsTransforms, semanticDepGraphUpdater) {
|
|
3147
|
+
constructor(handlers, reflector, perf, incrementalBuild, compileNonExportedClasses, compilationMode, dtsTransforms, semanticDepGraphUpdater, sourceFileTypeIdentifier) {
|
|
2931
3148
|
this.handlers = handlers;
|
|
2932
3149
|
this.reflector = reflector;
|
|
2933
3150
|
this.perf = perf;
|
|
@@ -2936,6 +3153,7 @@ var TraitCompiler = class {
|
|
|
2936
3153
|
this.compilationMode = compilationMode;
|
|
2937
3154
|
this.dtsTransforms = dtsTransforms;
|
|
2938
3155
|
this.semanticDepGraphUpdater = semanticDepGraphUpdater;
|
|
3156
|
+
this.sourceFileTypeIdentifier = sourceFileTypeIdentifier;
|
|
2939
3157
|
this.classes = /* @__PURE__ */ new Map();
|
|
2940
3158
|
this.fileToClasses = /* @__PURE__ */ new Map();
|
|
2941
3159
|
this.filesWithoutTraits = /* @__PURE__ */ new Set();
|
|
@@ -2952,7 +3170,7 @@ var TraitCompiler = class {
|
|
|
2952
3170
|
return this.analyze(sf, true);
|
|
2953
3171
|
}
|
|
2954
3172
|
analyze(sf, preanalyze) {
|
|
2955
|
-
if (sf.isDeclarationFile || isShim(sf)) {
|
|
3173
|
+
if (sf.isDeclarationFile || this.sourceFileTypeIdentifier.isShim(sf) || this.sourceFileTypeIdentifier.isResource(sf)) {
|
|
2956
3174
|
return void 0;
|
|
2957
3175
|
}
|
|
2958
3176
|
const promises = [];
|
|
@@ -2973,7 +3191,7 @@ var TraitCompiler = class {
|
|
|
2973
3191
|
if (this.reflector.isClass(node)) {
|
|
2974
3192
|
this.analyzeClass(node, preanalyze ? promises : null);
|
|
2975
3193
|
}
|
|
2976
|
-
|
|
3194
|
+
ts15.forEachChild(node, visit2);
|
|
2977
3195
|
};
|
|
2978
3196
|
visit2(sf);
|
|
2979
3197
|
if (!this.fileToClasses.has(sf)) {
|
|
@@ -3087,7 +3305,7 @@ var TraitCompiler = class {
|
|
|
3087
3305
|
}
|
|
3088
3306
|
if (isPrimaryHandler && record.hasPrimaryHandler) {
|
|
3089
3307
|
record.metaDiagnostics = [{
|
|
3090
|
-
category:
|
|
3308
|
+
category: ts15.DiagnosticCategory.Error,
|
|
3091
3309
|
code: Number("-99" + ErrorCode.DECORATOR_COLLISION),
|
|
3092
3310
|
file: getSourceFile(clazz),
|
|
3093
3311
|
start: clazz.getStart(void 0, false),
|
|
@@ -3295,7 +3513,7 @@ var TraitCompiler = class {
|
|
|
3295
3513
|
}
|
|
3296
3514
|
}
|
|
3297
3515
|
compile(clazz, constantPool) {
|
|
3298
|
-
const original =
|
|
3516
|
+
const original = ts15.getOriginalNode(clazz);
|
|
3299
3517
|
if (!this.reflector.isClass(clazz) || !this.reflector.isClass(original) || !this.classes.has(original)) {
|
|
3300
3518
|
return null;
|
|
3301
3519
|
}
|
|
@@ -3326,7 +3544,7 @@ var TraitCompiler = class {
|
|
|
3326
3544
|
return res.length > 0 ? res : null;
|
|
3327
3545
|
}
|
|
3328
3546
|
decoratorsFor(node) {
|
|
3329
|
-
const original =
|
|
3547
|
+
const original = ts15.getOriginalNode(node);
|
|
3330
3548
|
if (!this.reflector.isClass(original) || !this.classes.has(original)) {
|
|
3331
3549
|
return [];
|
|
3332
3550
|
}
|
|
@@ -3336,7 +3554,7 @@ var TraitCompiler = class {
|
|
|
3336
3554
|
if (trait.state !== TraitState.Resolved) {
|
|
3337
3555
|
continue;
|
|
3338
3556
|
}
|
|
3339
|
-
if (trait.detected.trigger !== null &&
|
|
3557
|
+
if (trait.detected.trigger !== null && ts15.isDecorator(trait.detected.trigger)) {
|
|
3340
3558
|
decorators.push(trait.detected.trigger);
|
|
3341
3559
|
}
|
|
3342
3560
|
}
|
|
@@ -3365,27 +3583,27 @@ var TraitCompiler = class {
|
|
|
3365
3583
|
}
|
|
3366
3584
|
};
|
|
3367
3585
|
function containsErrors(diagnostics) {
|
|
3368
|
-
return diagnostics !== null && diagnostics.some((diag) => diag.category ===
|
|
3586
|
+
return diagnostics !== null && diagnostics.some((diag) => diag.category === ts15.DiagnosticCategory.Error);
|
|
3369
3587
|
}
|
|
3370
3588
|
|
|
3371
|
-
// bazel-out/
|
|
3372
|
-
import ts18 from "typescript";
|
|
3373
|
-
|
|
3374
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/utils.mjs
|
|
3589
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/declaration.mjs
|
|
3375
3590
|
import ts17 from "typescript";
|
|
3591
|
+
|
|
3592
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/utils.mjs
|
|
3593
|
+
import ts16 from "typescript";
|
|
3376
3594
|
function addImports(importManager, sf, extraStatements = []) {
|
|
3377
3595
|
const addedImports = importManager.getAllImports(sf.fileName).map((i) => {
|
|
3378
|
-
const qualifier =
|
|
3379
|
-
const importClause =
|
|
3380
|
-
const decl =
|
|
3381
|
-
|
|
3596
|
+
const qualifier = ts16.factory.createIdentifier(i.qualifier.text);
|
|
3597
|
+
const importClause = ts16.factory.createImportClause(false, void 0, ts16.factory.createNamespaceImport(qualifier));
|
|
3598
|
+
const decl = ts16.factory.createImportDeclaration(void 0, void 0, importClause, ts16.factory.createStringLiteral(i.specifier));
|
|
3599
|
+
ts16.setOriginalNode(i.qualifier, decl);
|
|
3382
3600
|
return decl;
|
|
3383
3601
|
});
|
|
3384
3602
|
const existingImports = sf.statements.filter((stmt) => isImportStatement(stmt));
|
|
3385
3603
|
const body = sf.statements.filter((stmt) => !isImportStatement(stmt));
|
|
3386
3604
|
if (addedImports.length > 0) {
|
|
3387
|
-
const fileoverviewAnchorStmt =
|
|
3388
|
-
return
|
|
3605
|
+
const fileoverviewAnchorStmt = ts16.factory.createNotEmittedStatement(sf);
|
|
3606
|
+
return ts16.factory.updateSourceFile(sf, ts16.factory.createNodeArray([
|
|
3389
3607
|
fileoverviewAnchorStmt,
|
|
3390
3608
|
...existingImports,
|
|
3391
3609
|
...addedImports,
|
|
@@ -3396,10 +3614,10 @@ function addImports(importManager, sf, extraStatements = []) {
|
|
|
3396
3614
|
return sf;
|
|
3397
3615
|
}
|
|
3398
3616
|
function isImportStatement(stmt) {
|
|
3399
|
-
return
|
|
3617
|
+
return ts16.isImportDeclaration(stmt) || ts16.isImportEqualsDeclaration(stmt) || ts16.isNamespaceImport(stmt);
|
|
3400
3618
|
}
|
|
3401
3619
|
|
|
3402
|
-
// bazel-out/
|
|
3620
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/declaration.mjs
|
|
3403
3621
|
var DtsTransformRegistry = class {
|
|
3404
3622
|
constructor() {
|
|
3405
3623
|
this.ivyDeclarationTransforms = /* @__PURE__ */ new Map();
|
|
@@ -3414,7 +3632,7 @@ var DtsTransformRegistry = class {
|
|
|
3414
3632
|
if (!sf.isDeclarationFile) {
|
|
3415
3633
|
return null;
|
|
3416
3634
|
}
|
|
3417
|
-
const originalSf =
|
|
3635
|
+
const originalSf = ts17.getOriginalNode(sf);
|
|
3418
3636
|
let transforms = null;
|
|
3419
3637
|
if (this.ivyDeclarationTransforms.has(originalSf)) {
|
|
3420
3638
|
transforms = [];
|
|
@@ -3427,7 +3645,7 @@ function declarationTransformFactory(transformRegistry, importRewriter, importPr
|
|
|
3427
3645
|
return (context) => {
|
|
3428
3646
|
const transformer = new DtsTransformer(context, importRewriter, importPrefix);
|
|
3429
3647
|
return (fileOrBundle) => {
|
|
3430
|
-
if (
|
|
3648
|
+
if (ts17.isBundle(fileOrBundle)) {
|
|
3431
3649
|
return fileOrBundle;
|
|
3432
3650
|
}
|
|
3433
3651
|
const transforms = transformRegistry.getAllTransforms(fileOrBundle);
|
|
@@ -3447,15 +3665,15 @@ var DtsTransformer = class {
|
|
|
3447
3665
|
transform(sf, transforms) {
|
|
3448
3666
|
const imports = new ImportManager(this.importRewriter, this.importPrefix);
|
|
3449
3667
|
const visitor = (node) => {
|
|
3450
|
-
if (
|
|
3668
|
+
if (ts17.isClassDeclaration(node)) {
|
|
3451
3669
|
return this.transformClassDeclaration(node, transforms, imports);
|
|
3452
|
-
} else if (
|
|
3670
|
+
} else if (ts17.isFunctionDeclaration(node)) {
|
|
3453
3671
|
return this.transformFunctionDeclaration(node, transforms, imports);
|
|
3454
3672
|
} else {
|
|
3455
|
-
return
|
|
3673
|
+
return ts17.visitEachChild(node, visitor, this.ctx);
|
|
3456
3674
|
}
|
|
3457
3675
|
};
|
|
3458
|
-
sf =
|
|
3676
|
+
sf = ts17.visitNode(sf, visitor);
|
|
3459
3677
|
return addImports(imports, sf);
|
|
3460
3678
|
}
|
|
3461
3679
|
transformClassDeclaration(clazz, transforms, imports) {
|
|
@@ -3483,7 +3701,7 @@ var DtsTransformer = class {
|
|
|
3483
3701
|
}
|
|
3484
3702
|
}
|
|
3485
3703
|
if (elementsChanged && clazz === newClazz) {
|
|
3486
|
-
newClazz =
|
|
3704
|
+
newClazz = ts17.factory.updateClassDeclaration(clazz, clazz.decorators, clazz.modifiers, clazz.name, clazz.typeParameters, clazz.heritageClauses, elements);
|
|
3487
3705
|
}
|
|
3488
3706
|
return newClazz;
|
|
3489
3707
|
}
|
|
@@ -3505,31 +3723,31 @@ var IvyDeclarationDtsTransform = class {
|
|
|
3505
3723
|
this.declarationFields.set(decl, fields);
|
|
3506
3724
|
}
|
|
3507
3725
|
transformClass(clazz, members, imports) {
|
|
3508
|
-
const original =
|
|
3726
|
+
const original = ts17.getOriginalNode(clazz);
|
|
3509
3727
|
if (!this.declarationFields.has(original)) {
|
|
3510
3728
|
return clazz;
|
|
3511
3729
|
}
|
|
3512
3730
|
const fields = this.declarationFields.get(original);
|
|
3513
3731
|
const newMembers = fields.map((decl) => {
|
|
3514
|
-
const modifiers = [
|
|
3732
|
+
const modifiers = [ts17.factory.createModifier(ts17.SyntaxKind.StaticKeyword)];
|
|
3515
3733
|
const typeRef = translateType(decl.type, imports);
|
|
3516
3734
|
markForEmitAsSingleLine(typeRef);
|
|
3517
|
-
return
|
|
3735
|
+
return ts17.factory.createPropertyDeclaration(void 0, modifiers, decl.name, void 0, typeRef, void 0);
|
|
3518
3736
|
});
|
|
3519
|
-
return
|
|
3737
|
+
return ts17.factory.updateClassDeclaration(clazz, clazz.decorators, clazz.modifiers, clazz.name, clazz.typeParameters, clazz.heritageClauses, [...members, ...newMembers]);
|
|
3520
3738
|
}
|
|
3521
3739
|
};
|
|
3522
3740
|
function markForEmitAsSingleLine(node) {
|
|
3523
|
-
|
|
3524
|
-
|
|
3741
|
+
ts17.setEmitFlags(node, ts17.EmitFlags.SingleLine);
|
|
3742
|
+
ts17.forEachChild(node, markForEmitAsSingleLine);
|
|
3525
3743
|
}
|
|
3526
3744
|
|
|
3527
|
-
// bazel-out/
|
|
3745
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/transform.mjs
|
|
3528
3746
|
import { ConstantPool } from "@angular/compiler";
|
|
3529
|
-
import ts20 from "typescript";
|
|
3530
|
-
|
|
3531
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/util/src/visitor.mjs
|
|
3532
3747
|
import ts19 from "typescript";
|
|
3748
|
+
|
|
3749
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/util/src/visitor.mjs
|
|
3750
|
+
import ts18 from "typescript";
|
|
3533
3751
|
function visit(node, visitor, context) {
|
|
3534
3752
|
return visitor._visit(node, context);
|
|
3535
3753
|
}
|
|
@@ -3553,8 +3771,8 @@ var Visitor = class {
|
|
|
3553
3771
|
}
|
|
3554
3772
|
_visit(node, context) {
|
|
3555
3773
|
let visitedNode = null;
|
|
3556
|
-
node =
|
|
3557
|
-
if (
|
|
3774
|
+
node = ts18.visitEachChild(node, (child) => this._visit(child, context), context);
|
|
3775
|
+
if (ts18.isClassDeclaration(node)) {
|
|
3558
3776
|
visitedNode = this._visitListEntryNode(node, (node2) => this.visitClassDeclaration(node2));
|
|
3559
3777
|
} else {
|
|
3560
3778
|
visitedNode = this.visitOtherNode(node);
|
|
@@ -3568,7 +3786,7 @@ var Visitor = class {
|
|
|
3568
3786
|
if (node.statements.every((stmt) => !this._before.has(stmt) && !this._after.has(stmt))) {
|
|
3569
3787
|
return node;
|
|
3570
3788
|
}
|
|
3571
|
-
const clone =
|
|
3789
|
+
const clone = ts18.getMutableClone(node);
|
|
3572
3790
|
const newStatements = [];
|
|
3573
3791
|
clone.statements.forEach((stmt) => {
|
|
3574
3792
|
if (this._before.has(stmt)) {
|
|
@@ -3581,7 +3799,7 @@ var Visitor = class {
|
|
|
3581
3799
|
this._after.delete(stmt);
|
|
3582
3800
|
}
|
|
3583
3801
|
});
|
|
3584
|
-
clone.statements =
|
|
3802
|
+
clone.statements = ts18.factory.createNodeArray(newStatements, node.statements.hasTrailingComma);
|
|
3585
3803
|
return clone;
|
|
3586
3804
|
}
|
|
3587
3805
|
};
|
|
@@ -3590,7 +3808,7 @@ function hasStatements(node) {
|
|
|
3590
3808
|
return block.statements !== void 0 && Array.isArray(block.statements);
|
|
3591
3809
|
}
|
|
3592
3810
|
|
|
3593
|
-
// bazel-out/
|
|
3811
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/transform.mjs
|
|
3594
3812
|
var NO_DECORATORS = /* @__PURE__ */ new Set();
|
|
3595
3813
|
var CLOSURE_FILE_OVERVIEW_REGEXP = /\s+@fileoverview\s+/i;
|
|
3596
3814
|
function ivyTransformFactory(compilation, reflector, importRewriter, defaultImportTracker, perf, isCore, isClosureCompilerEnabled) {
|
|
@@ -3639,14 +3857,14 @@ var IvyTransformationVisitor = class extends Visitor {
|
|
|
3639
3857
|
const members = [...node.members];
|
|
3640
3858
|
for (const field of this.classCompilationMap.get(node)) {
|
|
3641
3859
|
const exprNode = translateExpression(field.initializer, this.importManager, translateOptions);
|
|
3642
|
-
const property =
|
|
3860
|
+
const property = ts19.factory.createPropertyDeclaration(void 0, [ts19.factory.createToken(ts19.SyntaxKind.StaticKeyword)], field.name, void 0, void 0, exprNode);
|
|
3643
3861
|
if (this.isClosureCompilerEnabled) {
|
|
3644
|
-
|
|
3862
|
+
ts19.addSyntheticLeadingComment(property, ts19.SyntaxKind.MultiLineCommentTrivia, "* @nocollapse ", false);
|
|
3645
3863
|
}
|
|
3646
3864
|
field.statements.map((stmt) => translateStatement(stmt, this.importManager, translateOptions)).forEach((stmt) => statements.push(stmt));
|
|
3647
3865
|
members.push(property);
|
|
3648
3866
|
}
|
|
3649
|
-
node =
|
|
3867
|
+
node = ts19.factory.updateClassDeclaration(node, maybeFilterDecorator(node.decorators, this.compilation.decoratorsFor(node)), node.modifiers, node.name, node.typeParameters, node.heritageClauses || [], members.map((member) => this._stripAngularDecorators(member)));
|
|
3650
3868
|
return { node, after: statements };
|
|
3651
3869
|
}
|
|
3652
3870
|
_angularCoreDecorators(decl) {
|
|
@@ -3675,25 +3893,25 @@ var IvyTransformationVisitor = class extends Visitor {
|
|
|
3675
3893
|
if (filtered.length === 0) {
|
|
3676
3894
|
return void 0;
|
|
3677
3895
|
}
|
|
3678
|
-
const array =
|
|
3896
|
+
const array = ts19.factory.createNodeArray(filtered);
|
|
3679
3897
|
array.pos = node.decorators.pos;
|
|
3680
3898
|
array.end = node.decorators.end;
|
|
3681
3899
|
return array;
|
|
3682
3900
|
}
|
|
3683
3901
|
_stripAngularDecorators(node) {
|
|
3684
|
-
if (
|
|
3685
|
-
node =
|
|
3686
|
-
} else if (
|
|
3687
|
-
node =
|
|
3688
|
-
} else if (
|
|
3689
|
-
node =
|
|
3690
|
-
} else if (
|
|
3691
|
-
node =
|
|
3692
|
-
} else if (
|
|
3693
|
-
node =
|
|
3694
|
-
} else if (
|
|
3902
|
+
if (ts19.isParameter(node)) {
|
|
3903
|
+
node = ts19.factory.updateParameterDeclaration(node, this._nonCoreDecoratorsOnly(node), node.modifiers, node.dotDotDotToken, node.name, node.questionToken, node.type, node.initializer);
|
|
3904
|
+
} else if (ts19.isMethodDeclaration(node) && node.decorators !== void 0) {
|
|
3905
|
+
node = ts19.factory.updateMethodDeclaration(node, this._nonCoreDecoratorsOnly(node), node.modifiers, node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters, node.type, node.body);
|
|
3906
|
+
} else if (ts19.isPropertyDeclaration(node) && node.decorators !== void 0) {
|
|
3907
|
+
node = ts19.factory.updatePropertyDeclaration(node, this._nonCoreDecoratorsOnly(node), node.modifiers, node.name, node.questionToken, node.type, node.initializer);
|
|
3908
|
+
} else if (ts19.isGetAccessor(node)) {
|
|
3909
|
+
node = ts19.factory.updateGetAccessorDeclaration(node, this._nonCoreDecoratorsOnly(node), node.modifiers, node.name, node.parameters, node.type, node.body);
|
|
3910
|
+
} else if (ts19.isSetAccessor(node)) {
|
|
3911
|
+
node = ts19.factory.updateSetAccessorDeclaration(node, this._nonCoreDecoratorsOnly(node), node.modifiers, node.name, node.parameters, node.body);
|
|
3912
|
+
} else if (ts19.isConstructorDeclaration(node)) {
|
|
3695
3913
|
const parameters = node.parameters.map((param) => this._stripAngularDecorators(param));
|
|
3696
|
-
node =
|
|
3914
|
+
node = ts19.factory.updateConstructorDeclaration(node, node.decorators, node.modifiers, parameters, node.body);
|
|
3697
3915
|
}
|
|
3698
3916
|
return node;
|
|
3699
3917
|
}
|
|
@@ -3705,7 +3923,7 @@ function transformIvySourceFile(compilation, context, reflector, importRewriter,
|
|
|
3705
3923
|
visit(file, compilationVisitor, context);
|
|
3706
3924
|
const transformationVisitor = new IvyTransformationVisitor(compilation, compilationVisitor.classCompilationMap, reflector, importManager, recordWrappedNode, isClosureCompilerEnabled, isCore);
|
|
3707
3925
|
let sf = visit(file, transformationVisitor, context);
|
|
3708
|
-
const downlevelTranslatedCode = getLocalizeCompileTarget(context) <
|
|
3926
|
+
const downlevelTranslatedCode = getLocalizeCompileTarget(context) < ts19.ScriptTarget.ES2015;
|
|
3709
3927
|
const constants = constantPool.statements.map((stmt) => translateStatement(stmt, importManager, {
|
|
3710
3928
|
recordWrappedNode,
|
|
3711
3929
|
downlevelTaggedTemplates: downlevelTranslatedCode,
|
|
@@ -3720,17 +3938,17 @@ function transformIvySourceFile(compilation, context, reflector, importRewriter,
|
|
|
3720
3938
|
return sf;
|
|
3721
3939
|
}
|
|
3722
3940
|
function getLocalizeCompileTarget(context) {
|
|
3723
|
-
const target = context.getCompilerOptions().target ||
|
|
3724
|
-
return target !==
|
|
3941
|
+
const target = context.getCompilerOptions().target || ts19.ScriptTarget.ES2015;
|
|
3942
|
+
return target !== ts19.ScriptTarget.JSON ? target : ts19.ScriptTarget.ES2015;
|
|
3725
3943
|
}
|
|
3726
3944
|
function getFileOverviewComment(statements) {
|
|
3727
3945
|
if (statements.length > 0) {
|
|
3728
3946
|
const host = statements[0];
|
|
3729
3947
|
let trailing = false;
|
|
3730
|
-
let comments =
|
|
3948
|
+
let comments = ts19.getSyntheticLeadingComments(host);
|
|
3731
3949
|
if (!comments || comments.length === 0) {
|
|
3732
3950
|
trailing = true;
|
|
3733
|
-
comments =
|
|
3951
|
+
comments = ts19.getSyntheticTrailingComments(host);
|
|
3734
3952
|
}
|
|
3735
3953
|
if (comments && comments.length > 0 && CLOSURE_FILE_OVERVIEW_REGEXP.test(comments[0].text)) {
|
|
3736
3954
|
return { comments, host, trailing };
|
|
@@ -3742,22 +3960,22 @@ function setFileOverviewComment(sf, fileoverview) {
|
|
|
3742
3960
|
const { comments, host, trailing } = fileoverview;
|
|
3743
3961
|
if (sf.statements.length > 0 && host !== sf.statements[0]) {
|
|
3744
3962
|
if (trailing) {
|
|
3745
|
-
|
|
3963
|
+
ts19.setSyntheticTrailingComments(host, void 0);
|
|
3746
3964
|
} else {
|
|
3747
|
-
|
|
3965
|
+
ts19.setSyntheticLeadingComments(host, void 0);
|
|
3748
3966
|
}
|
|
3749
|
-
|
|
3967
|
+
ts19.setSyntheticLeadingComments(sf.statements[0], comments);
|
|
3750
3968
|
}
|
|
3751
3969
|
}
|
|
3752
3970
|
function maybeFilterDecorator(decorators, toRemove) {
|
|
3753
3971
|
if (decorators === void 0) {
|
|
3754
3972
|
return void 0;
|
|
3755
3973
|
}
|
|
3756
|
-
const filtered = decorators.filter((dec) => toRemove.find((decToRemove) =>
|
|
3974
|
+
const filtered = decorators.filter((dec) => toRemove.find((decToRemove) => ts19.getOriginalNode(dec) === decToRemove) === void 0);
|
|
3757
3975
|
if (filtered.length === 0) {
|
|
3758
3976
|
return void 0;
|
|
3759
3977
|
}
|
|
3760
|
-
return
|
|
3978
|
+
return ts19.factory.createNodeArray(filtered);
|
|
3761
3979
|
}
|
|
3762
3980
|
function isFromAngularCore(decorator) {
|
|
3763
3981
|
return decorator.import !== null && decorator.import.from === "@angular/core";
|
|
@@ -3771,12 +3989,12 @@ function createRecorderFn(defaultImportTracker) {
|
|
|
3771
3989
|
};
|
|
3772
3990
|
}
|
|
3773
3991
|
|
|
3774
|
-
// bazel-out/
|
|
3992
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/directive/src/handler.mjs
|
|
3775
3993
|
import { compileClassMetadata, compileDeclareClassMetadata, compileDeclareDirectiveFromMetadata, compileDirectiveFromMetadata, FactoryTarget, makeBindingParser, WrappedNodeExpr as WrappedNodeExpr5 } from "@angular/compiler";
|
|
3776
3994
|
|
|
3777
|
-
// bazel-out/
|
|
3778
|
-
import { createMayBeForwardRefExpression, emitDistinctChangesOnlyDefaultValue, ExternalExpr as
|
|
3779
|
-
import
|
|
3995
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/directive/src/shared.mjs
|
|
3996
|
+
import { createMayBeForwardRefExpression, emitDistinctChangesOnlyDefaultValue, ExternalExpr as ExternalExpr4, getSafePropertyAccessString, parseHostBindings, verifyHostBindings, WrappedNodeExpr as WrappedNodeExpr4 } from "@angular/compiler";
|
|
3997
|
+
import ts20 from "typescript";
|
|
3780
3998
|
var EMPTY_OBJECT = {};
|
|
3781
3999
|
var QUERY_TYPES = /* @__PURE__ */ new Set([
|
|
3782
4000
|
"ContentChild",
|
|
@@ -3792,7 +4010,7 @@ function extractDirectiveMetadata(clazz, decorator, reflector, evaluator, isCore
|
|
|
3792
4010
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, Decorator.nodeForError(decorator), `Incorrect number of arguments to @${decorator.name} decorator`);
|
|
3793
4011
|
} else {
|
|
3794
4012
|
const meta = unwrapExpression(decorator.args[0]);
|
|
3795
|
-
if (!
|
|
4013
|
+
if (!ts20.isObjectLiteralExpression(meta)) {
|
|
3796
4014
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, meta, `@${decorator.name} argument must be an object literal`);
|
|
3797
4015
|
}
|
|
3798
4016
|
directive = reflectObjectLiteral(meta);
|
|
@@ -3844,7 +4062,7 @@ function extractDirectiveMetadata(clazz, decorator, reflector, evaluator, isCore
|
|
|
3844
4062
|
}
|
|
3845
4063
|
const rawCtorDeps = getConstructorDependencies(clazz, reflector, isCore);
|
|
3846
4064
|
const ctorDeps = selector !== null ? validateConstructorDependencies(clazz, rawCtorDeps) : unwrapConstructorDependencies(rawCtorDeps);
|
|
3847
|
-
const isStructural = ctorDeps !== null && ctorDeps !== "invalid" && ctorDeps.some((dep) => dep.token instanceof
|
|
4065
|
+
const isStructural = ctorDeps !== null && ctorDeps !== "invalid" && ctorDeps.some((dep) => dep.token instanceof ExternalExpr4 && dep.token.value.moduleName === "@angular/core" && dep.token.value.name === "TemplateRef");
|
|
3848
4066
|
let isStandalone = false;
|
|
3849
4067
|
if (directive.has("standalone")) {
|
|
3850
4068
|
const expr = directive.get("standalone");
|
|
@@ -3913,7 +4131,7 @@ function extractQueryMetadata(exprNode, name, args, propertyName, reflector, eva
|
|
|
3913
4131
|
let emitDistinctChangesOnly = emitDistinctChangesOnlyDefaultValue;
|
|
3914
4132
|
if (args.length === 2) {
|
|
3915
4133
|
const optionsExpr = unwrapExpression(args[1]);
|
|
3916
|
-
if (!
|
|
4134
|
+
if (!ts20.isObjectLiteralExpression(optionsExpr)) {
|
|
3917
4135
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, optionsExpr, `@${name} options must be an object literal`);
|
|
3918
4136
|
}
|
|
3919
4137
|
const options = reflectObjectLiteral(optionsExpr);
|
|
@@ -4008,16 +4226,16 @@ function extractHostBindings(members, evaluator, coreModule, metadata) {
|
|
|
4008
4226
|
}
|
|
4009
4227
|
function extractQueriesFromDecorator(queryData, reflector, evaluator, isCore) {
|
|
4010
4228
|
const content = [], view = [];
|
|
4011
|
-
if (!
|
|
4229
|
+
if (!ts20.isObjectLiteralExpression(queryData)) {
|
|
4012
4230
|
throw new FatalDiagnosticError(ErrorCode.VALUE_HAS_WRONG_TYPE, queryData, "Decorator queries metadata must be an object literal");
|
|
4013
4231
|
}
|
|
4014
4232
|
reflectObjectLiteral(queryData).forEach((queryExpr, propertyName) => {
|
|
4015
4233
|
queryExpr = unwrapExpression(queryExpr);
|
|
4016
|
-
if (!
|
|
4234
|
+
if (!ts20.isNewExpression(queryExpr)) {
|
|
4017
4235
|
throw new FatalDiagnosticError(ErrorCode.VALUE_HAS_WRONG_TYPE, queryData, "Decorator query metadata must be an instance of a query type");
|
|
4018
4236
|
}
|
|
4019
|
-
const queryType =
|
|
4020
|
-
if (!
|
|
4237
|
+
const queryType = ts20.isPropertyAccessExpression(queryExpr.expression) ? queryExpr.expression.name : queryExpr.expression;
|
|
4238
|
+
if (!ts20.isIdentifier(queryType)) {
|
|
4021
4239
|
throw new FatalDiagnosticError(ErrorCode.VALUE_HAS_WRONG_TYPE, queryData, "Decorator query metadata must be an instance of a query type");
|
|
4022
4240
|
}
|
|
4023
4241
|
const type = reflector.getImportOfIdentifier(queryType);
|
|
@@ -4138,7 +4356,7 @@ function evaluateHostExpressionBindings(hostExpr, evaluator) {
|
|
|
4138
4356
|
return bindings;
|
|
4139
4357
|
}
|
|
4140
4358
|
|
|
4141
|
-
// bazel-out/
|
|
4359
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/directive/src/symbol.mjs
|
|
4142
4360
|
var DirectiveSymbol = class extends SemanticSymbol {
|
|
4143
4361
|
constructor(decl, selector, inputs, outputs, exportAs, typeCheckMeta, typeParameters) {
|
|
4144
4362
|
super(decl);
|
|
@@ -4215,7 +4433,7 @@ function isBaseClassEqual(current, previous) {
|
|
|
4215
4433
|
return isSymbolEqual(current, previous);
|
|
4216
4434
|
}
|
|
4217
4435
|
|
|
4218
|
-
// bazel-out/
|
|
4436
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/directive/src/handler.mjs
|
|
4219
4437
|
var FIELD_DECORATORS = [
|
|
4220
4438
|
"Input",
|
|
4221
4439
|
"Output",
|
|
@@ -4263,6 +4481,9 @@ var DirectiveDecoratorHandler = class {
|
|
|
4263
4481
|
}
|
|
4264
4482
|
analyze(node, decorator, flags = HandlerFlags.NONE) {
|
|
4265
4483
|
if (this.compileUndecoratedClassesWithAngularFeatures === false && decorator === null) {
|
|
4484
|
+
if (this.isCore) {
|
|
4485
|
+
return {};
|
|
4486
|
+
}
|
|
4266
4487
|
return { diagnostics: [getUndecoratedClassWithAngularFeaturesDiagnostic(node)] };
|
|
4267
4488
|
}
|
|
4268
4489
|
this.perf.eventCount(PerfEvent.AnalyzeDirective);
|
|
@@ -4296,7 +4517,7 @@ var DirectiveDecoratorHandler = class {
|
|
|
4296
4517
|
register(node, analysis) {
|
|
4297
4518
|
const ref = new Reference(node);
|
|
4298
4519
|
this.metaRegistry.registerDirectiveMetadata(__spreadProps(__spreadValues({
|
|
4299
|
-
|
|
4520
|
+
kind: MetaKind.Directive,
|
|
4300
4521
|
ref,
|
|
4301
4522
|
name: node.name.text,
|
|
4302
4523
|
selector: analysis.meta.selector,
|
|
@@ -4310,7 +4531,9 @@ var DirectiveDecoratorHandler = class {
|
|
|
4310
4531
|
isPoisoned: analysis.isPoisoned,
|
|
4311
4532
|
isStructural: analysis.isStructural,
|
|
4312
4533
|
animationTriggerNames: null,
|
|
4313
|
-
isStandalone: analysis.meta.isStandalone
|
|
4534
|
+
isStandalone: analysis.meta.isStandalone,
|
|
4535
|
+
imports: null,
|
|
4536
|
+
schemas: null
|
|
4314
4537
|
}));
|
|
4315
4538
|
this.injectableRegistry.registerInjectable(node);
|
|
4316
4539
|
}
|
|
@@ -4354,9 +4577,78 @@ var DirectiveDecoratorHandler = class {
|
|
|
4354
4577
|
}
|
|
4355
4578
|
};
|
|
4356
4579
|
|
|
4357
|
-
// bazel-out/
|
|
4358
|
-
import { compileClassMetadata as compileClassMetadata2, compileDeclareClassMetadata as compileDeclareClassMetadata2, compileDeclareInjectorFromMetadata, compileDeclareNgModuleFromMetadata, compileInjector, compileNgModule,
|
|
4580
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/ng_module/src/handler.mjs
|
|
4581
|
+
import { compileClassMetadata as compileClassMetadata2, compileDeclareClassMetadata as compileDeclareClassMetadata2, compileDeclareInjectorFromMetadata, compileDeclareNgModuleFromMetadata, compileInjector, compileNgModule, ExternalExpr as ExternalExpr5, FactoryTarget as FactoryTarget2, InvokeFunctionExpr, LiteralArrayExpr as LiteralArrayExpr2, R3Identifiers, R3SelectorScopeMode, WrappedNodeExpr as WrappedNodeExpr6 } from "@angular/compiler";
|
|
4359
4582
|
import ts22 from "typescript";
|
|
4583
|
+
|
|
4584
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/ng_module/src/module_with_providers.mjs
|
|
4585
|
+
import ts21 from "typescript";
|
|
4586
|
+
function createModuleWithProvidersResolver(reflector, isCore) {
|
|
4587
|
+
function _reflectModuleFromTypeParam(type, node) {
|
|
4588
|
+
if (!ts21.isTypeReferenceNode(type)) {
|
|
4589
|
+
return null;
|
|
4590
|
+
}
|
|
4591
|
+
const typeName = type && (ts21.isIdentifier(type.typeName) && type.typeName || ts21.isQualifiedName(type.typeName) && type.typeName.right) || null;
|
|
4592
|
+
if (typeName === null) {
|
|
4593
|
+
return null;
|
|
4594
|
+
}
|
|
4595
|
+
const id = reflector.getImportOfIdentifier(typeName);
|
|
4596
|
+
if (id === null || id.name !== "ModuleWithProviders") {
|
|
4597
|
+
return null;
|
|
4598
|
+
}
|
|
4599
|
+
if (!isCore && id.from !== "@angular/core") {
|
|
4600
|
+
return null;
|
|
4601
|
+
}
|
|
4602
|
+
if (type.typeArguments === void 0 || type.typeArguments.length !== 1) {
|
|
4603
|
+
const parent = ts21.isMethodDeclaration(node) && ts21.isClassDeclaration(node.parent) ? node.parent : null;
|
|
4604
|
+
const symbolName = (parent && parent.name ? parent.name.getText() + "." : "") + (node.name ? node.name.getText() : "anonymous");
|
|
4605
|
+
throw new FatalDiagnosticError(ErrorCode.NGMODULE_MODULE_WITH_PROVIDERS_MISSING_GENERIC, type, `${symbolName} returns a ModuleWithProviders type without a generic type argument. Please add a generic type argument to the ModuleWithProviders type. If this occurrence is in library code you don't control, please contact the library authors.`);
|
|
4606
|
+
}
|
|
4607
|
+
const arg = type.typeArguments[0];
|
|
4608
|
+
return typeNodeToValueExpr(arg);
|
|
4609
|
+
}
|
|
4610
|
+
function _reflectModuleFromLiteralType(type) {
|
|
4611
|
+
if (!ts21.isIntersectionTypeNode(type)) {
|
|
4612
|
+
return null;
|
|
4613
|
+
}
|
|
4614
|
+
for (const t of type.types) {
|
|
4615
|
+
if (ts21.isTypeLiteralNode(t)) {
|
|
4616
|
+
for (const m of t.members) {
|
|
4617
|
+
const ngModuleType = ts21.isPropertySignature(m) && ts21.isIdentifier(m.name) && m.name.text === "ngModule" && m.type || null;
|
|
4618
|
+
const ngModuleExpression = ngModuleType && typeNodeToValueExpr(ngModuleType);
|
|
4619
|
+
if (ngModuleExpression) {
|
|
4620
|
+
return ngModuleExpression;
|
|
4621
|
+
}
|
|
4622
|
+
}
|
|
4623
|
+
}
|
|
4624
|
+
}
|
|
4625
|
+
return null;
|
|
4626
|
+
}
|
|
4627
|
+
return (fn, callExpr, resolve, unresolvable) => {
|
|
4628
|
+
var _a;
|
|
4629
|
+
const rawType = fn.node.type;
|
|
4630
|
+
if (rawType === void 0) {
|
|
4631
|
+
return unresolvable;
|
|
4632
|
+
}
|
|
4633
|
+
const type = (_a = _reflectModuleFromTypeParam(rawType, fn.node)) != null ? _a : _reflectModuleFromLiteralType(rawType);
|
|
4634
|
+
if (type === null) {
|
|
4635
|
+
return unresolvable;
|
|
4636
|
+
}
|
|
4637
|
+
const ngModule = resolve(type);
|
|
4638
|
+
if (!(ngModule instanceof Reference) || !isNamedClassDeclaration(ngModule.node)) {
|
|
4639
|
+
return unresolvable;
|
|
4640
|
+
}
|
|
4641
|
+
return new SyntheticValue({
|
|
4642
|
+
ngModule,
|
|
4643
|
+
mwpCall: callExpr
|
|
4644
|
+
});
|
|
4645
|
+
};
|
|
4646
|
+
}
|
|
4647
|
+
function isResolvedModuleWithProviders(sv) {
|
|
4648
|
+
return typeof sv.value === "object" && sv.value != null && sv.value.hasOwnProperty("ngModule") && sv.value.hasOwnProperty("mwpCall");
|
|
4649
|
+
}
|
|
4650
|
+
|
|
4651
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/ng_module/src/handler.mjs
|
|
4360
4652
|
var NgModuleSymbol = class extends SemanticSymbol {
|
|
4361
4653
|
constructor() {
|
|
4362
4654
|
super(...arguments);
|
|
@@ -4448,7 +4740,7 @@ var NgModuleDecoratorHandler = class {
|
|
|
4448
4740
|
return {};
|
|
4449
4741
|
}
|
|
4450
4742
|
const moduleResolvers = combineResolvers([
|
|
4451
|
-
(
|
|
4743
|
+
createModuleWithProvidersResolver(this.reflector, this.isCore),
|
|
4452
4744
|
forwardRefResolver
|
|
4453
4745
|
]);
|
|
4454
4746
|
const diagnostics = [];
|
|
@@ -4457,7 +4749,7 @@ var NgModuleDecoratorHandler = class {
|
|
|
4457
4749
|
if (ngModule.has("declarations")) {
|
|
4458
4750
|
rawDeclarations = ngModule.get("declarations");
|
|
4459
4751
|
const declarationMeta = this.evaluator.evaluate(rawDeclarations, forwardRefResolver);
|
|
4460
|
-
declarationRefs = this.resolveTypeList(rawDeclarations, declarationMeta, name, "declarations");
|
|
4752
|
+
declarationRefs = this.resolveTypeList(rawDeclarations, declarationMeta, name, "declarations", 0).references;
|
|
4461
4753
|
for (const ref of declarationRefs) {
|
|
4462
4754
|
if (ref.node.getSourceFile().isDeclarationFile) {
|
|
4463
4755
|
const errorNode = ref.getOriginForDiagnostics(rawDeclarations);
|
|
@@ -4469,51 +4761,33 @@ var NgModuleDecoratorHandler = class {
|
|
|
4469
4761
|
return { diagnostics };
|
|
4470
4762
|
}
|
|
4471
4763
|
let importRefs = [];
|
|
4764
|
+
let rawImports = null;
|
|
4472
4765
|
if (ngModule.has("imports")) {
|
|
4473
|
-
|
|
4766
|
+
rawImports = ngModule.get("imports");
|
|
4474
4767
|
const importsMeta = this.evaluator.evaluate(rawImports, moduleResolvers);
|
|
4475
|
-
importRefs = this.resolveTypeList(rawImports, importsMeta, name, "imports");
|
|
4768
|
+
importRefs = this.resolveTypeList(rawImports, importsMeta, name, "imports", 0).references;
|
|
4476
4769
|
}
|
|
4477
4770
|
let exportRefs = [];
|
|
4771
|
+
let rawExports = null;
|
|
4478
4772
|
if (ngModule.has("exports")) {
|
|
4479
|
-
|
|
4773
|
+
rawExports = ngModule.get("exports");
|
|
4480
4774
|
const exportsMeta = this.evaluator.evaluate(rawExports, moduleResolvers);
|
|
4481
|
-
exportRefs = this.resolveTypeList(rawExports, exportsMeta, name, "exports");
|
|
4775
|
+
exportRefs = this.resolveTypeList(rawExports, exportsMeta, name, "exports", 0).references;
|
|
4482
4776
|
this.referencesRegistry.add(node, ...exportRefs);
|
|
4483
4777
|
}
|
|
4484
4778
|
let bootstrapRefs = [];
|
|
4485
4779
|
if (ngModule.has("bootstrap")) {
|
|
4486
4780
|
const expr = ngModule.get("bootstrap");
|
|
4487
4781
|
const bootstrapMeta = this.evaluator.evaluate(expr, forwardRefResolver);
|
|
4488
|
-
bootstrapRefs = this.resolveTypeList(expr, bootstrapMeta, name, "bootstrap");
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
|
|
4493
|
-
const result = this.evaluator.evaluate(rawExpr);
|
|
4494
|
-
if (!Array.isArray(result)) {
|
|
4495
|
-
throw createValueHasWrongTypeError(rawExpr, result, `NgModule.schemas must be an array`);
|
|
4496
|
-
}
|
|
4497
|
-
for (const schemaRef of result) {
|
|
4498
|
-
if (!(schemaRef instanceof Reference)) {
|
|
4499
|
-
throw createValueHasWrongTypeError(rawExpr, result, "NgModule.schemas must be an array of schemas");
|
|
4500
|
-
}
|
|
4501
|
-
const id2 = schemaRef.getIdentityIn(schemaRef.node.getSourceFile());
|
|
4502
|
-
if (id2 === null || schemaRef.ownedByModuleGuess !== "@angular/core") {
|
|
4503
|
-
throw createValueHasWrongTypeError(rawExpr, result, "NgModule.schemas must be an array of schemas");
|
|
4504
|
-
}
|
|
4505
|
-
switch (id2.text) {
|
|
4506
|
-
case "CUSTOM_ELEMENTS_SCHEMA":
|
|
4507
|
-
schemas.push(CUSTOM_ELEMENTS_SCHEMA);
|
|
4508
|
-
break;
|
|
4509
|
-
case "NO_ERRORS_SCHEMA":
|
|
4510
|
-
schemas.push(NO_ERRORS_SCHEMA);
|
|
4511
|
-
break;
|
|
4512
|
-
default:
|
|
4513
|
-
throw createValueHasWrongTypeError(rawExpr, schemaRef, `'${schemaRef.debugName}' is not a valid NgModule schema`);
|
|
4782
|
+
bootstrapRefs = this.resolveTypeList(expr, bootstrapMeta, name, "bootstrap", 0).references;
|
|
4783
|
+
for (const ref of bootstrapRefs) {
|
|
4784
|
+
const dirMeta = this.metaReader.getDirectiveMetadata(ref);
|
|
4785
|
+
if (dirMeta == null ? void 0 : dirMeta.isStandalone) {
|
|
4786
|
+
diagnostics.push(makeStandaloneBootstrapDiagnostic(node, ref, expr));
|
|
4514
4787
|
}
|
|
4515
4788
|
}
|
|
4516
4789
|
}
|
|
4790
|
+
const schemas = ngModule.has("schemas") ? extractSchemas(ngModule.get("schemas"), this.evaluator, "NgModule") : [];
|
|
4517
4791
|
let id = null;
|
|
4518
4792
|
if (ngModule.has("id")) {
|
|
4519
4793
|
const idExpr = ngModule.get("id");
|
|
@@ -4555,16 +4829,38 @@ var NgModuleDecoratorHandler = class {
|
|
|
4555
4829
|
};
|
|
4556
4830
|
const rawProviders = ngModule.has("providers") ? ngModule.get("providers") : null;
|
|
4557
4831
|
const wrapperProviders = rawProviders !== null ? new WrappedNodeExpr6(this.annotateForClosureCompiler ? wrapFunctionExpressionsInParens(rawProviders) : rawProviders) : null;
|
|
4558
|
-
const
|
|
4832
|
+
const topLevelImports = [];
|
|
4559
4833
|
if (ngModule.has("imports")) {
|
|
4560
|
-
|
|
4834
|
+
const rawImports2 = unwrapExpression(ngModule.get("imports"));
|
|
4835
|
+
let topLevelExpressions = [];
|
|
4836
|
+
if (ts22.isArrayLiteralExpression(rawImports2)) {
|
|
4837
|
+
for (const element of rawImports2.elements) {
|
|
4838
|
+
if (ts22.isSpreadElement(element)) {
|
|
4839
|
+
topLevelExpressions.push(element.expression);
|
|
4840
|
+
continue;
|
|
4841
|
+
}
|
|
4842
|
+
topLevelExpressions.push(element);
|
|
4843
|
+
}
|
|
4844
|
+
} else {
|
|
4845
|
+
topLevelExpressions.push(rawImports2);
|
|
4846
|
+
}
|
|
4847
|
+
let absoluteIndex = 0;
|
|
4848
|
+
for (const importExpr of topLevelExpressions) {
|
|
4849
|
+
const resolved = this.evaluator.evaluate(importExpr, moduleResolvers);
|
|
4850
|
+
const { references, hasModuleWithProviders } = this.resolveTypeList(importExpr, [resolved], node.name.text, "imports", absoluteIndex);
|
|
4851
|
+
absoluteIndex += references.length;
|
|
4852
|
+
topLevelImports.push({
|
|
4853
|
+
expression: importExpr,
|
|
4854
|
+
resolvedReferences: references,
|
|
4855
|
+
hasModuleWithProviders
|
|
4856
|
+
});
|
|
4857
|
+
}
|
|
4561
4858
|
}
|
|
4562
4859
|
const injectorMetadata = {
|
|
4563
4860
|
name,
|
|
4564
4861
|
type,
|
|
4565
4862
|
internalType,
|
|
4566
|
-
providers: wrapperProviders
|
|
4567
|
-
imports: injectorImports
|
|
4863
|
+
providers: wrapperProviders
|
|
4568
4864
|
};
|
|
4569
4865
|
const factoryMetadata = {
|
|
4570
4866
|
name,
|
|
@@ -4584,8 +4880,11 @@ var NgModuleDecoratorHandler = class {
|
|
|
4584
4880
|
fac: factoryMetadata,
|
|
4585
4881
|
declarations: declarationRefs,
|
|
4586
4882
|
rawDeclarations,
|
|
4587
|
-
imports:
|
|
4883
|
+
imports: topLevelImports,
|
|
4884
|
+
rawImports,
|
|
4885
|
+
importRefs,
|
|
4588
4886
|
exports: exportRefs,
|
|
4887
|
+
rawExports,
|
|
4589
4888
|
providers: rawProviders,
|
|
4590
4889
|
providersRequiringFactory: rawProviders ? resolveProvidersRequiringFactory(rawProviders, this.reflector, this.evaluator) : null,
|
|
4591
4890
|
classMetadata: extractClassMetadata(node, this.reflector, this.isCore, this.annotateForClosureCompiler),
|
|
@@ -4598,12 +4897,15 @@ var NgModuleDecoratorHandler = class {
|
|
|
4598
4897
|
}
|
|
4599
4898
|
register(node, analysis) {
|
|
4600
4899
|
this.metaRegistry.registerNgModuleMetadata({
|
|
4900
|
+
kind: MetaKind.NgModule,
|
|
4601
4901
|
ref: new Reference(node),
|
|
4602
4902
|
schemas: analysis.schemas,
|
|
4603
4903
|
declarations: analysis.declarations,
|
|
4604
|
-
imports: analysis.
|
|
4904
|
+
imports: analysis.importRefs,
|
|
4605
4905
|
exports: analysis.exports,
|
|
4606
|
-
rawDeclarations: analysis.rawDeclarations
|
|
4906
|
+
rawDeclarations: analysis.rawDeclarations,
|
|
4907
|
+
rawImports: analysis.rawImports,
|
|
4908
|
+
rawExports: analysis.rawExports
|
|
4607
4909
|
});
|
|
4608
4910
|
if (this.factoryTracker !== null) {
|
|
4609
4911
|
this.factoryTracker.track(node.getSourceFile(), {
|
|
@@ -4626,6 +4928,34 @@ var NgModuleDecoratorHandler = class {
|
|
|
4626
4928
|
const data = {
|
|
4627
4929
|
injectorImports: []
|
|
4628
4930
|
};
|
|
4931
|
+
for (const topLevelImport of analysis.imports) {
|
|
4932
|
+
if (topLevelImport.hasModuleWithProviders) {
|
|
4933
|
+
data.injectorImports.push(new WrappedNodeExpr6(topLevelImport.expression));
|
|
4934
|
+
continue;
|
|
4935
|
+
}
|
|
4936
|
+
const refsToEmit = [];
|
|
4937
|
+
for (const ref of topLevelImport.resolvedReferences) {
|
|
4938
|
+
const dirMeta = this.metaReader.getDirectiveMetadata(ref);
|
|
4939
|
+
if (dirMeta !== null && !dirMeta.isComponent) {
|
|
4940
|
+
continue;
|
|
4941
|
+
}
|
|
4942
|
+
const pipeMeta = dirMeta === null ? this.metaReader.getPipeMetadata(ref) : null;
|
|
4943
|
+
if (pipeMeta !== null) {
|
|
4944
|
+
continue;
|
|
4945
|
+
}
|
|
4946
|
+
refsToEmit.push(ref);
|
|
4947
|
+
}
|
|
4948
|
+
if (refsToEmit.length === topLevelImport.resolvedReferences.length) {
|
|
4949
|
+
data.injectorImports.push(new WrappedNodeExpr6(topLevelImport.expression));
|
|
4950
|
+
} else {
|
|
4951
|
+
const context = node.getSourceFile();
|
|
4952
|
+
for (const ref of refsToEmit) {
|
|
4953
|
+
const emittedRef = this.refEmitter.emit(ref, context);
|
|
4954
|
+
assertSuccessfulReferenceEmit(emittedRef, topLevelImport.expression, "class");
|
|
4955
|
+
data.injectorImports.push(emittedRef.expression);
|
|
4956
|
+
}
|
|
4957
|
+
}
|
|
4958
|
+
}
|
|
4629
4959
|
if (scope !== null && !scope.compilation.isPoisoned) {
|
|
4630
4960
|
const context = getSourceFile(node);
|
|
4631
4961
|
for (const exportRef of analysis.exports) {
|
|
@@ -4642,15 +4972,8 @@ var NgModuleDecoratorHandler = class {
|
|
|
4642
4972
|
if (dirMeta.selector === null) {
|
|
4643
4973
|
throw new FatalDiagnosticError(ErrorCode.DIRECTIVE_MISSING_SELECTOR, decl.node, `${refType} ${decl.node.name.text} has no selector, please add it!`);
|
|
4644
4974
|
}
|
|
4645
|
-
if (dirMeta.isStandalone) {
|
|
4646
|
-
diagnostics.push(makeDiagnostic(ErrorCode.NGMODULE_DECLARATION_IS_STANDALONE, decl.getOriginForDiagnostics(analysis.rawDeclarations), `${refType} ${decl.node.name.text} is standalone, and cannot be declared in an NgModule. Did you mean to import it instead?`));
|
|
4647
|
-
}
|
|
4648
4975
|
continue;
|
|
4649
4976
|
}
|
|
4650
|
-
const pipeMeta = this.metaReader.getPipeMetadata(decl);
|
|
4651
|
-
if (pipeMeta !== null && pipeMeta.isStandalone) {
|
|
4652
|
-
diagnostics.push(makeDiagnostic(ErrorCode.NGMODULE_DECLARATION_IS_STANDALONE, decl.getOriginForDiagnostics(analysis.rawDeclarations), `Pipe ${decl.node.name.text} is standalone, and cannot be declared in an NgModule. Did you mean to import it instead?`));
|
|
4653
|
-
}
|
|
4654
4977
|
}
|
|
4655
4978
|
}
|
|
4656
4979
|
if (diagnostics.length > 0) {
|
|
@@ -4667,7 +4990,9 @@ var NgModuleDecoratorHandler = class {
|
|
|
4667
4990
|
}
|
|
4668
4991
|
compileFull(node, { inj, mod, fac, classMetadata, declarations }, { injectorImports }) {
|
|
4669
4992
|
const factoryFn = compileNgFactoryDefField(fac);
|
|
4670
|
-
const ngInjectorDef = compileInjector(
|
|
4993
|
+
const ngInjectorDef = compileInjector(__spreadProps(__spreadValues({}, inj), {
|
|
4994
|
+
imports: injectorImports
|
|
4995
|
+
}));
|
|
4671
4996
|
const ngModuleDef = compileNgModule(mod);
|
|
4672
4997
|
const statements = ngModuleDef.statements;
|
|
4673
4998
|
const metadata = classMetadata !== null ? compileClassMetadata2(classMetadata) : null;
|
|
@@ -4677,15 +5002,14 @@ var NgModuleDecoratorHandler = class {
|
|
|
4677
5002
|
}
|
|
4678
5003
|
compilePartial(node, { inj, fac, mod, classMetadata }, { injectorImports }) {
|
|
4679
5004
|
const factoryFn = compileDeclareFactory(fac);
|
|
4680
|
-
const injectorDef = compileDeclareInjectorFromMetadata(
|
|
5005
|
+
const injectorDef = compileDeclareInjectorFromMetadata(__spreadProps(__spreadValues({}, inj), {
|
|
5006
|
+
imports: injectorImports
|
|
5007
|
+
}));
|
|
4681
5008
|
const ngModuleDef = compileDeclareNgModuleFromMetadata(mod);
|
|
4682
5009
|
const metadata = classMetadata !== null ? compileDeclareClassMetadata2(classMetadata) : null;
|
|
4683
5010
|
this.insertMetadataStatement(ngModuleDef.statements, metadata);
|
|
4684
5011
|
return this.compileNgModule(factoryFn, injectorDef, ngModuleDef);
|
|
4685
5012
|
}
|
|
4686
|
-
mergeInjectorImports(inj, injectorImports) {
|
|
4687
|
-
return __spreadProps(__spreadValues({}, inj), { imports: [...inj.imports, ...injectorImports] });
|
|
4688
|
-
}
|
|
4689
5013
|
insertMetadataStatement(ngModuleStatements, metadata) {
|
|
4690
5014
|
if (metadata !== null) {
|
|
4691
5015
|
ngModuleStatements.unshift(metadata.toStmt());
|
|
@@ -4711,7 +5035,7 @@ var NgModuleDecoratorHandler = class {
|
|
|
4711
5035
|
const componentType = this.refEmitter.emit(decl, context);
|
|
4712
5036
|
assertSuccessfulReferenceEmit(componentType, node, "component");
|
|
4713
5037
|
const declExpr = componentType.expression;
|
|
4714
|
-
const setComponentScope = new
|
|
5038
|
+
const setComponentScope = new ExternalExpr5(R3Identifiers.setComponentScope);
|
|
4715
5039
|
const callExpr = new InvokeFunctionExpr(setComponentScope, [declExpr, directiveArray, pipesArray]);
|
|
4716
5040
|
ngModuleStatements.push(callExpr.toStmt());
|
|
4717
5041
|
}
|
|
@@ -4747,84 +5071,59 @@ var NgModuleDecoratorHandler = class {
|
|
|
4747
5071
|
return toR3Reference(origin, valueRef, typeRef, valueContext, typeContext, this.refEmitter);
|
|
4748
5072
|
}
|
|
4749
5073
|
}
|
|
4750
|
-
_extractModuleFromModuleWithProvidersFn(node) {
|
|
4751
|
-
const type = node.type || null;
|
|
4752
|
-
return type && (this._reflectModuleFromTypeParam(type, node) || this._reflectModuleFromLiteralType(type));
|
|
4753
|
-
}
|
|
4754
|
-
_reflectModuleFromTypeParam(type, node) {
|
|
4755
|
-
if (!ts22.isTypeReferenceNode(type)) {
|
|
4756
|
-
return null;
|
|
4757
|
-
}
|
|
4758
|
-
const typeName = type && (ts22.isIdentifier(type.typeName) && type.typeName || ts22.isQualifiedName(type.typeName) && type.typeName.right) || null;
|
|
4759
|
-
if (typeName === null) {
|
|
4760
|
-
return null;
|
|
4761
|
-
}
|
|
4762
|
-
const id = this.reflector.getImportOfIdentifier(typeName);
|
|
4763
|
-
if (id === null || id.name !== "ModuleWithProviders") {
|
|
4764
|
-
return null;
|
|
4765
|
-
}
|
|
4766
|
-
if (!this.isCore && id.from !== "@angular/core") {
|
|
4767
|
-
return null;
|
|
4768
|
-
}
|
|
4769
|
-
if (type.typeArguments === void 0 || type.typeArguments.length !== 1) {
|
|
4770
|
-
const parent = ts22.isMethodDeclaration(node) && ts22.isClassDeclaration(node.parent) ? node.parent : null;
|
|
4771
|
-
const symbolName = (parent && parent.name ? parent.name.getText() + "." : "") + (node.name ? node.name.getText() : "anonymous");
|
|
4772
|
-
throw new FatalDiagnosticError(ErrorCode.NGMODULE_MODULE_WITH_PROVIDERS_MISSING_GENERIC, type, `${symbolName} returns a ModuleWithProviders type without a generic type argument. Please add a generic type argument to the ModuleWithProviders type. If this occurrence is in library code you don't control, please contact the library authors.`);
|
|
4773
|
-
}
|
|
4774
|
-
const arg = type.typeArguments[0];
|
|
4775
|
-
return typeNodeToValueExpr(arg);
|
|
4776
|
-
}
|
|
4777
|
-
_reflectModuleFromLiteralType(type) {
|
|
4778
|
-
if (!ts22.isIntersectionTypeNode(type)) {
|
|
4779
|
-
return null;
|
|
4780
|
-
}
|
|
4781
|
-
for (const t of type.types) {
|
|
4782
|
-
if (ts22.isTypeLiteralNode(t)) {
|
|
4783
|
-
for (const m of t.members) {
|
|
4784
|
-
const ngModuleType = ts22.isPropertySignature(m) && ts22.isIdentifier(m.name) && m.name.text === "ngModule" && m.type || null;
|
|
4785
|
-
const ngModuleExpression = ngModuleType && typeNodeToValueExpr(ngModuleType);
|
|
4786
|
-
if (ngModuleExpression) {
|
|
4787
|
-
return ngModuleExpression;
|
|
4788
|
-
}
|
|
4789
|
-
}
|
|
4790
|
-
}
|
|
4791
|
-
}
|
|
4792
|
-
return null;
|
|
4793
|
-
}
|
|
4794
5074
|
isClassDeclarationReference(ref) {
|
|
4795
5075
|
return this.reflector.isClass(ref.node);
|
|
4796
5076
|
}
|
|
4797
|
-
resolveTypeList(expr, resolvedList, className, arrayName) {
|
|
5077
|
+
resolveTypeList(expr, resolvedList, className, arrayName, absoluteIndex) {
|
|
5078
|
+
let hasModuleWithProviders = false;
|
|
4798
5079
|
const refList = [];
|
|
4799
5080
|
if (!Array.isArray(resolvedList)) {
|
|
4800
5081
|
throw createValueHasWrongTypeError(expr, resolvedList, `Expected array when reading the NgModule.${arrayName} of ${className}`);
|
|
4801
5082
|
}
|
|
4802
|
-
resolvedList.
|
|
4803
|
-
|
|
5083
|
+
for (let idx = 0; idx < resolvedList.length; idx++) {
|
|
5084
|
+
let entry = resolvedList[idx];
|
|
5085
|
+
if (entry instanceof SyntheticValue && isResolvedModuleWithProviders(entry)) {
|
|
5086
|
+
entry = entry.value.ngModule;
|
|
5087
|
+
hasModuleWithProviders = true;
|
|
5088
|
+
} else if (entry instanceof Map && entry.has("ngModule")) {
|
|
4804
5089
|
entry = entry.get("ngModule");
|
|
5090
|
+
hasModuleWithProviders = true;
|
|
4805
5091
|
}
|
|
4806
5092
|
if (Array.isArray(entry)) {
|
|
4807
|
-
|
|
5093
|
+
const recursiveResult = this.resolveTypeList(expr, entry, className, arrayName, absoluteIndex);
|
|
5094
|
+
refList.push(...recursiveResult.references);
|
|
5095
|
+
absoluteIndex += recursiveResult.references.length;
|
|
5096
|
+
hasModuleWithProviders = hasModuleWithProviders || recursiveResult.hasModuleWithProviders;
|
|
4808
5097
|
} else if (entry instanceof Reference) {
|
|
4809
5098
|
if (!this.isClassDeclarationReference(entry)) {
|
|
4810
|
-
throw createValueHasWrongTypeError(entry.node, entry, `Value at position ${
|
|
5099
|
+
throw createValueHasWrongTypeError(entry.node, entry, `Value at position ${absoluteIndex} in the NgModule.${arrayName} of ${className} is not a class`);
|
|
4811
5100
|
}
|
|
4812
5101
|
refList.push(entry);
|
|
5102
|
+
absoluteIndex += 1;
|
|
4813
5103
|
} else {
|
|
4814
|
-
throw createValueHasWrongTypeError(expr, entry, `Value at position ${
|
|
5104
|
+
throw createValueHasWrongTypeError(expr, entry, `Value at position ${absoluteIndex} in the NgModule.${arrayName} of ${className} is not a reference`);
|
|
4815
5105
|
}
|
|
4816
|
-
}
|
|
4817
|
-
return
|
|
5106
|
+
}
|
|
5107
|
+
return {
|
|
5108
|
+
references: refList,
|
|
5109
|
+
hasModuleWithProviders
|
|
5110
|
+
};
|
|
4818
5111
|
}
|
|
4819
5112
|
};
|
|
4820
5113
|
function isNgModule(node, compilation) {
|
|
4821
|
-
return !compilation.
|
|
5114
|
+
return !compilation.dependencies.some((dep) => dep.ref.node === node);
|
|
4822
5115
|
}
|
|
4823
5116
|
function isModuleIdExpression(expr) {
|
|
4824
5117
|
return ts22.isPropertyAccessExpression(expr) && ts22.isIdentifier(expr.expression) && expr.expression.text === "module" && expr.name.text === "id";
|
|
4825
5118
|
}
|
|
5119
|
+
function makeStandaloneBootstrapDiagnostic(ngModuleClass, bootstrappedClassRef, rawBootstrapExpr) {
|
|
5120
|
+
const componentClassName = bootstrappedClassRef.node.name.text;
|
|
5121
|
+
const message = `The \`${componentClassName}\` class is a standalone component, which can not be used in the \`@NgModule.bootstrap\` array. Use the \`bootstrapApplication\` function for bootstrap instead.`;
|
|
5122
|
+
const relatedInformation = [makeRelatedInformation(ngModuleClass, `The 'bootstrap' array is present on this NgModule.`)];
|
|
5123
|
+
return makeDiagnostic(ErrorCode.NGMODULE_BOOTSTRAP_IS_STANDALONE, getDiagnosticNode(bootstrappedClassRef, rawBootstrapExpr), message, relatedInformation);
|
|
5124
|
+
}
|
|
4826
5125
|
|
|
4827
|
-
// bazel-out/
|
|
5126
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/component/src/diagnostics.mjs
|
|
4828
5127
|
function makeCyclicImportInfo(ref, type, cycle) {
|
|
4829
5128
|
const name = ref.debugName || "(unknown)";
|
|
4830
5129
|
const path = cycle.getPath().map((sf) => sf.fileName).join(" -> ");
|
|
@@ -4847,7 +5146,7 @@ function checkCustomElementSelectorForErrors(selector) {
|
|
|
4847
5146
|
return null;
|
|
4848
5147
|
}
|
|
4849
5148
|
|
|
4850
|
-
// bazel-out/
|
|
5149
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/component/src/resources.mjs
|
|
4851
5150
|
import { DEFAULT_INTERPOLATION_CONFIG, InterpolationConfig, ParseSourceFile as ParseSourceFile2, parseTemplate } from "@angular/compiler";
|
|
4852
5151
|
import ts23 from "typescript";
|
|
4853
5152
|
function getTemplateDeclarationNodeForError(declaration) {
|
|
@@ -5047,11 +5346,11 @@ function makeResourceNotFoundError(file, nodeForError, resourceType) {
|
|
|
5047
5346
|
}
|
|
5048
5347
|
return new FatalDiagnosticError(ErrorCode.COMPONENT_RESOURCE_NOT_FOUND, nodeForError, errorText);
|
|
5049
5348
|
}
|
|
5050
|
-
function
|
|
5349
|
+
function transformDecoratorResources(dec, component, styles, template) {
|
|
5051
5350
|
if (dec.name !== "Component") {
|
|
5052
5351
|
return dec;
|
|
5053
5352
|
}
|
|
5054
|
-
if (!component.has("templateUrl") && !component.has("styleUrls")) {
|
|
5353
|
+
if (!component.has("templateUrl") && !component.has("styleUrls") && !component.has("styles")) {
|
|
5055
5354
|
return dec;
|
|
5056
5355
|
}
|
|
5057
5356
|
const metadata = new Map(component);
|
|
@@ -5059,9 +5358,20 @@ function transformDecoratorToInlineResources(dec, component, styles, template) {
|
|
|
5059
5358
|
metadata.delete("templateUrl");
|
|
5060
5359
|
metadata.set("template", ts23.factory.createStringLiteral(template.content));
|
|
5061
5360
|
}
|
|
5062
|
-
if (metadata.has("styleUrls")) {
|
|
5361
|
+
if (metadata.has("styleUrls") || metadata.has("styles")) {
|
|
5362
|
+
metadata.delete("styles");
|
|
5063
5363
|
metadata.delete("styleUrls");
|
|
5064
|
-
|
|
5364
|
+
if (styles.length > 0) {
|
|
5365
|
+
const styleNodes = styles.reduce((result, style) => {
|
|
5366
|
+
if (style.trim().length > 0) {
|
|
5367
|
+
result.push(ts23.factory.createStringLiteral(style));
|
|
5368
|
+
}
|
|
5369
|
+
return result;
|
|
5370
|
+
}, []);
|
|
5371
|
+
if (styleNodes.length > 0) {
|
|
5372
|
+
metadata.set("styles", ts23.factory.createArrayLiteralExpression(styleNodes));
|
|
5373
|
+
}
|
|
5374
|
+
}
|
|
5065
5375
|
}
|
|
5066
5376
|
const newMetadataFields = [];
|
|
5067
5377
|
for (const [name, value] of metadata.entries()) {
|
|
@@ -5139,113 +5449,7 @@ function _extractTemplateStyleUrls(template) {
|
|
|
5139
5449
|
return template.styleUrls.map((url) => ({ url, source: 1, nodeForError }));
|
|
5140
5450
|
}
|
|
5141
5451
|
|
|
5142
|
-
// bazel-out/
|
|
5143
|
-
function scopeTemplate(scopeReader, dtsScopeReader, scopeRegistry, metaReader, node, analysis, usePoisonedData) {
|
|
5144
|
-
const scope = scopeReader.getScopeForComponent(node);
|
|
5145
|
-
if (analysis.meta.isStandalone && scope !== null) {
|
|
5146
|
-
return null;
|
|
5147
|
-
} else if (scope !== null && scope.compilation.isPoisoned && !usePoisonedData) {
|
|
5148
|
-
return null;
|
|
5149
|
-
}
|
|
5150
|
-
if (scope !== null) {
|
|
5151
|
-
return {
|
|
5152
|
-
directives: scope.compilation.directives,
|
|
5153
|
-
pipes: scope.compilation.pipes,
|
|
5154
|
-
ngModule: scope.ngModule,
|
|
5155
|
-
diagnostics: []
|
|
5156
|
-
};
|
|
5157
|
-
} else if (analysis.meta.isStandalone) {
|
|
5158
|
-
if (analysis.imports === null) {
|
|
5159
|
-
return {
|
|
5160
|
-
directives: [],
|
|
5161
|
-
pipes: [],
|
|
5162
|
-
ngModule: null,
|
|
5163
|
-
diagnostics: []
|
|
5164
|
-
};
|
|
5165
|
-
}
|
|
5166
|
-
const diagnostics = [];
|
|
5167
|
-
const directives = /* @__PURE__ */ new Map();
|
|
5168
|
-
const pipes = /* @__PURE__ */ new Map();
|
|
5169
|
-
for (const ref of analysis.imports.resolved) {
|
|
5170
|
-
const dirMeta = metaReader.getDirectiveMetadata(ref);
|
|
5171
|
-
if (dirMeta !== null) {
|
|
5172
|
-
if (!dirMeta.isStandalone) {
|
|
5173
|
-
diagnostics.push(makeNotStandaloneDiagnostic(scopeReader, ref, analysis.imports.raw, dirMeta.isComponent ? "component" : "directive"));
|
|
5174
|
-
continue;
|
|
5175
|
-
}
|
|
5176
|
-
if (!directives.has(ref.node)) {
|
|
5177
|
-
directives.set(ref.node, dirMeta);
|
|
5178
|
-
}
|
|
5179
|
-
continue;
|
|
5180
|
-
}
|
|
5181
|
-
const pipeMeta = metaReader.getPipeMetadata(ref);
|
|
5182
|
-
if (pipeMeta !== null) {
|
|
5183
|
-
if (!pipeMeta.isStandalone) {
|
|
5184
|
-
diagnostics.push(makeNotStandaloneDiagnostic(scopeReader, ref, analysis.imports.raw, "pipe"));
|
|
5185
|
-
continue;
|
|
5186
|
-
}
|
|
5187
|
-
}
|
|
5188
|
-
const ngModuleMeta = metaReader.getNgModuleMetadata(ref);
|
|
5189
|
-
if (ngModuleMeta !== null) {
|
|
5190
|
-
let scope2;
|
|
5191
|
-
if (ref.node.getSourceFile().isDeclarationFile) {
|
|
5192
|
-
scope2 = dtsScopeReader.resolve(ref);
|
|
5193
|
-
} else {
|
|
5194
|
-
scope2 = scopeRegistry.getScopeOfModule(ref.node);
|
|
5195
|
-
}
|
|
5196
|
-
if (scope2 === null) {
|
|
5197
|
-
continue;
|
|
5198
|
-
}
|
|
5199
|
-
if (scope2.exported.isPoisoned && !usePoisonedData) {
|
|
5200
|
-
return null;
|
|
5201
|
-
}
|
|
5202
|
-
for (const dir of scope2.exported.directives) {
|
|
5203
|
-
if (!directives.has(dir.ref.node)) {
|
|
5204
|
-
directives.set(dir.ref.node, dir);
|
|
5205
|
-
}
|
|
5206
|
-
}
|
|
5207
|
-
for (const pipe of scope2.exported.pipes) {
|
|
5208
|
-
if (!pipes.has(pipe.ref.node)) {
|
|
5209
|
-
pipes.set(pipe.ref.node, pipe);
|
|
5210
|
-
}
|
|
5211
|
-
}
|
|
5212
|
-
}
|
|
5213
|
-
}
|
|
5214
|
-
return {
|
|
5215
|
-
directives: Array.from(directives.values()),
|
|
5216
|
-
pipes: Array.from(pipes.values()),
|
|
5217
|
-
diagnostics,
|
|
5218
|
-
ngModule: null
|
|
5219
|
-
};
|
|
5220
|
-
} else {
|
|
5221
|
-
return {
|
|
5222
|
-
directives: [],
|
|
5223
|
-
pipes: [],
|
|
5224
|
-
ngModule: null,
|
|
5225
|
-
diagnostics: []
|
|
5226
|
-
};
|
|
5227
|
-
}
|
|
5228
|
-
}
|
|
5229
|
-
function makeNotStandaloneDiagnostic(scopeReader, ref, rawExpr, kind) {
|
|
5230
|
-
const scope = scopeReader.getScopeForComponent(ref.node);
|
|
5231
|
-
let relatedInformation = void 0;
|
|
5232
|
-
if (scope !== null) {
|
|
5233
|
-
const isExported3 = scope.exported.directives.some((exp) => exp.ref.node === ref.node) || scope.exported.pipes.some((exp) => exp.ref.node);
|
|
5234
|
-
if (isExported3) {
|
|
5235
|
-
relatedInformation = [makeRelatedInformation(scope.ngModule.name, `It can be imported using its NgModule '${scope.ngModule.name.text}' instead.`)];
|
|
5236
|
-
} else {
|
|
5237
|
-
relatedInformation = [makeRelatedInformation(scope.ngModule.name, `It's declared in the NgModule '${scope.ngModule.name.text}', but is not exported. Consider exporting it.`)];
|
|
5238
|
-
}
|
|
5239
|
-
} else {
|
|
5240
|
-
}
|
|
5241
|
-
let extraText = "";
|
|
5242
|
-
if (relatedInformation === void 0) {
|
|
5243
|
-
extraText = " It must be imported via an NgModule.";
|
|
5244
|
-
}
|
|
5245
|
-
return makeDiagnostic(ErrorCode.COMPONENT_IMPORT_NOT_STANDALONE, ref.getOriginForDiagnostics(rawExpr), `The ${kind} '${ref.node.name.text}' appears in 'imports', but is not standalone and cannot be imported directly.${extraText}`, relatedInformation);
|
|
5246
|
-
}
|
|
5247
|
-
|
|
5248
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/component/src/symbol.mjs
|
|
5452
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/component/src/symbol.mjs
|
|
5249
5453
|
var ComponentSymbol = class extends DirectiveSymbol {
|
|
5250
5454
|
constructor() {
|
|
5251
5455
|
super(...arguments);
|
|
@@ -5280,8 +5484,7 @@ var ComponentSymbol = class extends DirectiveSymbol {
|
|
|
5280
5484
|
}
|
|
5281
5485
|
};
|
|
5282
5486
|
|
|
5283
|
-
// bazel-out/
|
|
5284
|
-
import ts24 from "typescript";
|
|
5487
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/component/src/util.mjs
|
|
5285
5488
|
function collectAnimationNames(value, animationTriggerNames) {
|
|
5286
5489
|
if (value instanceof Map) {
|
|
5287
5490
|
const name = value.get("name");
|
|
@@ -5301,19 +5504,18 @@ function collectAnimationNames(value, animationTriggerNames) {
|
|
|
5301
5504
|
function isAngularAnimationsReference(reference, symbolName) {
|
|
5302
5505
|
return reference.ownedByModuleGuess === "@angular/animations" && reference.debugName === symbolName;
|
|
5303
5506
|
}
|
|
5304
|
-
var animationTriggerResolver = (
|
|
5507
|
+
var animationTriggerResolver = (fn, node, resolve, unresolvable) => {
|
|
5305
5508
|
const animationTriggerMethodName = "trigger";
|
|
5306
|
-
if (!isAngularAnimationsReference(
|
|
5307
|
-
return
|
|
5509
|
+
if (!isAngularAnimationsReference(fn, animationTriggerMethodName)) {
|
|
5510
|
+
return unresolvable;
|
|
5308
5511
|
}
|
|
5309
|
-
const triggerNameExpression =
|
|
5512
|
+
const triggerNameExpression = node.arguments[0];
|
|
5310
5513
|
if (!triggerNameExpression) {
|
|
5311
|
-
return
|
|
5514
|
+
return unresolvable;
|
|
5312
5515
|
}
|
|
5313
|
-
const
|
|
5314
|
-
|
|
5315
|
-
|
|
5316
|
-
], true);
|
|
5516
|
+
const res = /* @__PURE__ */ new Map();
|
|
5517
|
+
res.set("name", resolve(triggerNameExpression));
|
|
5518
|
+
return res;
|
|
5317
5519
|
};
|
|
5318
5520
|
function validateAndFlattenComponentImports(imports, expr) {
|
|
5319
5521
|
const flattened = [];
|
|
@@ -5336,15 +5538,29 @@ function validateAndFlattenComponentImports(imports, expr) {
|
|
|
5336
5538
|
} else {
|
|
5337
5539
|
diagnostics.push(createValueHasWrongTypeError(ref.getOriginForDiagnostics(expr), ref, `'imports' must be an array of components, directives, pipes, or NgModules`).toDiagnostic());
|
|
5338
5540
|
}
|
|
5541
|
+
} else if (isLikelyModuleWithProviders(ref)) {
|
|
5542
|
+
let origin = expr;
|
|
5543
|
+
if (ref instanceof SyntheticValue) {
|
|
5544
|
+
origin = getOriginNodeForDiagnostics(ref.value.mwpCall, expr);
|
|
5545
|
+
}
|
|
5546
|
+
diagnostics.push(makeDiagnostic(ErrorCode.COMPONENT_UNKNOWN_IMPORT, origin, `'imports' contains a ModuleWithProviders value, likely the result of a 'Module.forRoot()'-style call. These calls are not used to configure components and are not valid in standalone component imports - consider importing them in the application bootstrap instead.`));
|
|
5339
5547
|
} else {
|
|
5340
5548
|
diagnostics.push(createValueHasWrongTypeError(expr, imports, `'imports' must be an array of components, directives, pipes, or NgModules`).toDiagnostic());
|
|
5341
5549
|
}
|
|
5342
5550
|
}
|
|
5343
5551
|
return { imports: flattened, diagnostics };
|
|
5344
5552
|
}
|
|
5553
|
+
function isLikelyModuleWithProviders(value) {
|
|
5554
|
+
if (value instanceof SyntheticValue && isResolvedModuleWithProviders(value)) {
|
|
5555
|
+
return true;
|
|
5556
|
+
}
|
|
5557
|
+
if (value instanceof Map && value.has("ngModule")) {
|
|
5558
|
+
return true;
|
|
5559
|
+
}
|
|
5560
|
+
return false;
|
|
5561
|
+
}
|
|
5345
5562
|
|
|
5346
|
-
// bazel-out/
|
|
5347
|
-
var EMPTY_MAP = /* @__PURE__ */ new Map();
|
|
5563
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/component/src/handler.mjs
|
|
5348
5564
|
var EMPTY_ARRAY = [];
|
|
5349
5565
|
var ComponentDecoratorHandler = class {
|
|
5350
5566
|
constructor(reflector, evaluator, metaRegistry, metaReader, scopeReader, dtsScopeReader, scopeRegistry, typeCheckScopeRegistry, resourceRegistry, isCore, resourceLoader, rootDirs, defaultPreserveWhitespaces, i18nUseExternalIds, enableI18nLegacyMessageIdFormat, usePoisonedData, i18nNormalizeLineEndingsInICUs, moduleResolver, cycleAnalyzer, cycleHandlingStrategy, refEmitter, depTracker, injectableRegistry, semanticDepGraphUpdater, annotateForClosureCompiler, perf) {
|
|
@@ -5484,20 +5700,24 @@ var ComponentDecoratorHandler = class {
|
|
|
5484
5700
|
if (component.has("providers")) {
|
|
5485
5701
|
providersRequiringFactory = resolveProvidersRequiringFactory(component.get("providers"), this.reflector, this.evaluator);
|
|
5486
5702
|
}
|
|
5487
|
-
let
|
|
5703
|
+
let resolvedImports = null;
|
|
5704
|
+
let rawImports = null;
|
|
5488
5705
|
if (component.has("imports") && !metadata.isStandalone) {
|
|
5489
5706
|
if (diagnostics === void 0) {
|
|
5490
5707
|
diagnostics = [];
|
|
5491
5708
|
}
|
|
5492
|
-
diagnostics.push(makeDiagnostic(ErrorCode.COMPONENT_NOT_STANDALONE, component.get("imports"), `'imports' is only valid on a component that is standalone
|
|
5709
|
+
diagnostics.push(makeDiagnostic(ErrorCode.COMPONENT_NOT_STANDALONE, component.get("imports"), `'imports' is only valid on a component that is standalone.`, [makeRelatedInformation(node.name, `Did you forget to add 'standalone: true' to this @Component?`)]));
|
|
5710
|
+
isPoisoned = true;
|
|
5493
5711
|
} else if (component.has("imports")) {
|
|
5494
5712
|
const expr = component.get("imports");
|
|
5495
|
-
const
|
|
5713
|
+
const importResolvers = combineResolvers([
|
|
5714
|
+
createModuleWithProvidersResolver(this.reflector, this.isCore),
|
|
5715
|
+
forwardRefResolver
|
|
5716
|
+
]);
|
|
5717
|
+
const imported = this.evaluator.evaluate(expr, importResolvers);
|
|
5496
5718
|
const { imports: flattened, diagnostics: importDiagnostics } = validateAndFlattenComponentImports(imported, expr);
|
|
5497
|
-
|
|
5498
|
-
|
|
5499
|
-
raw: expr
|
|
5500
|
-
};
|
|
5719
|
+
resolvedImports = flattened;
|
|
5720
|
+
rawImports = expr;
|
|
5501
5721
|
if (importDiagnostics.length > 0) {
|
|
5502
5722
|
isPoisoned = true;
|
|
5503
5723
|
if (diagnostics === void 0) {
|
|
@@ -5506,6 +5726,17 @@ var ComponentDecoratorHandler = class {
|
|
|
5506
5726
|
diagnostics.push(...importDiagnostics);
|
|
5507
5727
|
}
|
|
5508
5728
|
}
|
|
5729
|
+
let schemas = null;
|
|
5730
|
+
if (component.has("schemas") && !metadata.isStandalone) {
|
|
5731
|
+
if (diagnostics === void 0) {
|
|
5732
|
+
diagnostics = [];
|
|
5733
|
+
}
|
|
5734
|
+
diagnostics.push(makeDiagnostic(ErrorCode.COMPONENT_NOT_STANDALONE, component.get("schemas"), `'schemas' is only valid on a component that is standalone.`));
|
|
5735
|
+
} else if (component.has("schemas")) {
|
|
5736
|
+
schemas = extractSchemas(component.get("schemas"), this.evaluator, "Component");
|
|
5737
|
+
} else if (metadata.isStandalone) {
|
|
5738
|
+
schemas = [];
|
|
5739
|
+
}
|
|
5509
5740
|
let template;
|
|
5510
5741
|
if (this.preanalyzeTemplateCache.has(node)) {
|
|
5511
5742
|
const preanalyzed = this.preanalyzeTemplateCache.get(node);
|
|
@@ -5595,7 +5826,7 @@ var ComponentDecoratorHandler = class {
|
|
|
5595
5826
|
relativeContextFilePath
|
|
5596
5827
|
}),
|
|
5597
5828
|
typeCheckMeta: extractDirectiveTypeCheckMeta(node, inputs, this.reflector),
|
|
5598
|
-
classMetadata: extractClassMetadata(node, this.reflector, this.isCore, this.annotateForClosureCompiler, (dec) =>
|
|
5829
|
+
classMetadata: extractClassMetadata(node, this.reflector, this.isCore, this.annotateForClosureCompiler, (dec) => transformDecoratorResources(dec, component, styles, template)),
|
|
5599
5830
|
template,
|
|
5600
5831
|
providersRequiringFactory,
|
|
5601
5832
|
viewProvidersRequiringFactory,
|
|
@@ -5607,7 +5838,9 @@ var ComponentDecoratorHandler = class {
|
|
|
5607
5838
|
},
|
|
5608
5839
|
isPoisoned,
|
|
5609
5840
|
animationTriggerNames,
|
|
5610
|
-
|
|
5841
|
+
rawImports,
|
|
5842
|
+
resolvedImports,
|
|
5843
|
+
schemas
|
|
5611
5844
|
},
|
|
5612
5845
|
diagnostics
|
|
5613
5846
|
};
|
|
@@ -5623,7 +5856,7 @@ var ComponentDecoratorHandler = class {
|
|
|
5623
5856
|
register(node, analysis) {
|
|
5624
5857
|
const ref = new Reference(node);
|
|
5625
5858
|
this.metaRegistry.registerDirectiveMetadata(__spreadProps(__spreadValues({
|
|
5626
|
-
|
|
5859
|
+
kind: MetaKind.Directive,
|
|
5627
5860
|
ref,
|
|
5628
5861
|
name: node.name.text,
|
|
5629
5862
|
selector: analysis.meta.selector,
|
|
@@ -5637,7 +5870,9 @@ var ComponentDecoratorHandler = class {
|
|
|
5637
5870
|
isPoisoned: analysis.isPoisoned,
|
|
5638
5871
|
isStructural: false,
|
|
5639
5872
|
isStandalone: analysis.meta.isStandalone,
|
|
5640
|
-
|
|
5873
|
+
imports: analysis.resolvedImports,
|
|
5874
|
+
animationTriggerNames: analysis.animationTriggerNames,
|
|
5875
|
+
schemas: analysis.schemas
|
|
5641
5876
|
}));
|
|
5642
5877
|
this.resourceRegistry.registerResources(analysis.resources, node);
|
|
5643
5878
|
this.injectableRegistry.registerInjectable(node);
|
|
@@ -5648,14 +5883,15 @@ var ComponentDecoratorHandler = class {
|
|
|
5648
5883
|
}
|
|
5649
5884
|
const scope = this.scopeReader.getScopeForComponent(node);
|
|
5650
5885
|
const selector = analysis.meta.selector;
|
|
5651
|
-
const matcher = new
|
|
5886
|
+
const matcher = new SelectorMatcher2();
|
|
5652
5887
|
if (scope !== null) {
|
|
5653
|
-
|
|
5888
|
+
let { dependencies, isPoisoned } = scope.kind === ComponentScopeKind.NgModule ? scope.compilation : scope;
|
|
5889
|
+
if ((isPoisoned || scope.kind === ComponentScopeKind.NgModule && scope.exported.isPoisoned) && !this.usePoisonedData) {
|
|
5654
5890
|
return null;
|
|
5655
5891
|
}
|
|
5656
|
-
for (const
|
|
5657
|
-
if (
|
|
5658
|
-
matcher.addSelectables(
|
|
5892
|
+
for (const dep of dependencies) {
|
|
5893
|
+
if (dep.kind === MetaKind.Directive && dep.selector !== null) {
|
|
5894
|
+
matcher.addSelectables(CssSelector2.parse(dep.selector), dep);
|
|
5659
5895
|
}
|
|
5660
5896
|
}
|
|
5661
5897
|
}
|
|
@@ -5672,7 +5908,7 @@ var ComponentDecoratorHandler = class {
|
|
|
5672
5908
|
});
|
|
5673
5909
|
}
|
|
5674
5910
|
typeCheck(ctx, node, meta) {
|
|
5675
|
-
if (this.typeCheckScopeRegistry === null || !
|
|
5911
|
+
if (this.typeCheckScopeRegistry === null || !ts24.isClassDeclaration(node)) {
|
|
5676
5912
|
return;
|
|
5677
5913
|
}
|
|
5678
5914
|
if (meta.isPoisoned && !this.usePoisonedData) {
|
|
@@ -5683,7 +5919,7 @@ var ComponentDecoratorHandler = class {
|
|
|
5683
5919
|
return;
|
|
5684
5920
|
}
|
|
5685
5921
|
const binder = new R3TargetBinder(scope.matcher);
|
|
5686
|
-
ctx.addTemplate(new Reference(node), binder, meta.template.diagNodes, scope.pipes, scope.schemas, meta.template.sourceMapping, meta.template.file, meta.template.errors);
|
|
5922
|
+
ctx.addTemplate(new Reference(node), binder, meta.template.diagNodes, scope.pipes, scope.schemas, meta.template.sourceMapping, meta.template.file, meta.template.errors, meta.meta.isStandalone);
|
|
5687
5923
|
}
|
|
5688
5924
|
extendedTemplateCheck(component, extendedTemplateChecker) {
|
|
5689
5925
|
return extendedTemplateChecker.getDiagnosticsForComponent(component);
|
|
@@ -5698,90 +5934,122 @@ var ComponentDecoratorHandler = class {
|
|
|
5698
5934
|
const context = getSourceFile(node);
|
|
5699
5935
|
const metadata = analysis.meta;
|
|
5700
5936
|
const data = {
|
|
5701
|
-
|
|
5702
|
-
pipes: EMPTY_MAP,
|
|
5937
|
+
declarations: EMPTY_ARRAY,
|
|
5703
5938
|
declarationListEmitMode: 0
|
|
5704
5939
|
};
|
|
5705
5940
|
const diagnostics = [];
|
|
5706
|
-
const scope =
|
|
5941
|
+
const scope = this.scopeReader.getScopeForComponent(node);
|
|
5707
5942
|
if (scope !== null) {
|
|
5708
|
-
|
|
5709
|
-
const matcher = new SelectorMatcher();
|
|
5710
|
-
for (const dir of scope.directives) {
|
|
5711
|
-
if (dir.selector !== null) {
|
|
5712
|
-
matcher.addSelectables(CssSelector.parse(dir.selector), dir);
|
|
5713
|
-
}
|
|
5714
|
-
}
|
|
5943
|
+
const matcher = new SelectorMatcher2();
|
|
5715
5944
|
const pipes = /* @__PURE__ */ new Map();
|
|
5716
|
-
|
|
5717
|
-
|
|
5945
|
+
const dependencies = scope.kind === ComponentScopeKind.NgModule ? scope.compilation.dependencies : scope.dependencies;
|
|
5946
|
+
for (const dep of dependencies) {
|
|
5947
|
+
if (dep.kind === MetaKind.Directive && dep.selector !== null) {
|
|
5948
|
+
matcher.addSelectables(CssSelector2.parse(dep.selector), dep);
|
|
5949
|
+
} else if (dep.kind === MetaKind.Pipe) {
|
|
5950
|
+
pipes.set(dep.name, dep);
|
|
5951
|
+
}
|
|
5718
5952
|
}
|
|
5719
5953
|
const binder = new R3TargetBinder(matcher);
|
|
5720
5954
|
const bound = binder.bind({ template: metadata.template.nodes });
|
|
5721
|
-
const
|
|
5722
|
-
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
|
|
5726
|
-
|
|
5727
|
-
importedFile: type.importedFile,
|
|
5728
|
-
selector: directive.selector,
|
|
5729
|
-
inputs: directive.inputs.propertyNames,
|
|
5730
|
-
outputs: directive.outputs.propertyNames,
|
|
5731
|
-
exportAs: directive.exportAs,
|
|
5732
|
-
isComponent: directive.isComponent
|
|
5733
|
-
};
|
|
5734
|
-
});
|
|
5735
|
-
const usedPipes = [];
|
|
5736
|
-
for (const pipeName of bound.getUsedPipes()) {
|
|
5737
|
-
if (!pipes.has(pipeName)) {
|
|
5955
|
+
const used = /* @__PURE__ */ new Set();
|
|
5956
|
+
for (const dir of bound.getUsedDirectives()) {
|
|
5957
|
+
used.add(dir.ref.node);
|
|
5958
|
+
}
|
|
5959
|
+
for (const name of bound.getUsedPipes()) {
|
|
5960
|
+
if (!pipes.has(name)) {
|
|
5738
5961
|
continue;
|
|
5739
5962
|
}
|
|
5740
|
-
|
|
5741
|
-
|
|
5742
|
-
|
|
5743
|
-
|
|
5744
|
-
|
|
5745
|
-
|
|
5746
|
-
|
|
5747
|
-
|
|
5748
|
-
|
|
5963
|
+
used.add(pipes.get(name).ref.node);
|
|
5964
|
+
}
|
|
5965
|
+
const declarations = [];
|
|
5966
|
+
const seen = /* @__PURE__ */ new Set();
|
|
5967
|
+
for (const dep of dependencies) {
|
|
5968
|
+
if (seen.has(dep.ref.node)) {
|
|
5969
|
+
continue;
|
|
5970
|
+
}
|
|
5971
|
+
seen.add(dep.ref.node);
|
|
5972
|
+
switch (dep.kind) {
|
|
5973
|
+
case MetaKind.Directive:
|
|
5974
|
+
if (!used.has(dep.ref.node)) {
|
|
5975
|
+
continue;
|
|
5976
|
+
}
|
|
5977
|
+
const dirType = this.refEmitter.emit(dep.ref, context);
|
|
5978
|
+
assertSuccessfulReferenceEmit(dirType, node.name, dep.isComponent ? "component" : "directive");
|
|
5979
|
+
declarations.push({
|
|
5980
|
+
kind: R3TemplateDependencyKind.Directive,
|
|
5981
|
+
ref: dep.ref,
|
|
5982
|
+
type: dirType.expression,
|
|
5983
|
+
importedFile: dirType.importedFile,
|
|
5984
|
+
selector: dep.selector,
|
|
5985
|
+
inputs: dep.inputs.propertyNames,
|
|
5986
|
+
outputs: dep.outputs.propertyNames,
|
|
5987
|
+
exportAs: dep.exportAs,
|
|
5988
|
+
isComponent: dep.isComponent
|
|
5989
|
+
});
|
|
5990
|
+
break;
|
|
5991
|
+
case MetaKind.Pipe:
|
|
5992
|
+
if (!used.has(dep.ref.node)) {
|
|
5993
|
+
continue;
|
|
5994
|
+
}
|
|
5995
|
+
const pipeType = this.refEmitter.emit(dep.ref, context);
|
|
5996
|
+
assertSuccessfulReferenceEmit(pipeType, node.name, "pipe");
|
|
5997
|
+
declarations.push({
|
|
5998
|
+
kind: R3TemplateDependencyKind.Pipe,
|
|
5999
|
+
type: pipeType.expression,
|
|
6000
|
+
name: dep.name,
|
|
6001
|
+
ref: dep.ref,
|
|
6002
|
+
importedFile: pipeType.importedFile
|
|
6003
|
+
});
|
|
6004
|
+
break;
|
|
6005
|
+
case MetaKind.NgModule:
|
|
6006
|
+
const ngModuleType = this.refEmitter.emit(dep.ref, context);
|
|
6007
|
+
assertSuccessfulReferenceEmit(ngModuleType, node.name, "NgModule");
|
|
6008
|
+
declarations.push({
|
|
6009
|
+
kind: R3TemplateDependencyKind.NgModule,
|
|
6010
|
+
type: ngModuleType.expression,
|
|
6011
|
+
importedFile: ngModuleType.importedFile
|
|
6012
|
+
});
|
|
6013
|
+
break;
|
|
6014
|
+
}
|
|
5749
6015
|
}
|
|
6016
|
+
const isUsedDirective = (decl) => decl.kind === R3TemplateDependencyKind.Directive;
|
|
6017
|
+
const isUsedPipe = (decl) => decl.kind === R3TemplateDependencyKind.Pipe;
|
|
6018
|
+
const getSemanticReference = (decl) => this.semanticDepGraphUpdater.getSemanticReference(decl.ref.node, decl.type);
|
|
5750
6019
|
if (this.semanticDepGraphUpdater !== null) {
|
|
5751
|
-
symbol.usedDirectives =
|
|
5752
|
-
symbol.usedPipes =
|
|
6020
|
+
symbol.usedDirectives = declarations.filter(isUsedDirective).map(getSemanticReference);
|
|
6021
|
+
symbol.usedPipes = declarations.filter(isUsedPipe).map(getSemanticReference);
|
|
5753
6022
|
}
|
|
5754
6023
|
const cyclesFromDirectives = /* @__PURE__ */ new Map();
|
|
5755
|
-
for (const usedDirective of usedDirectives) {
|
|
5756
|
-
const cycle = this._checkForCyclicImport(usedDirective.importedFile, usedDirective.type, context);
|
|
5757
|
-
if (cycle !== null) {
|
|
5758
|
-
cyclesFromDirectives.set(usedDirective, cycle);
|
|
5759
|
-
}
|
|
5760
|
-
}
|
|
5761
6024
|
const cyclesFromPipes = /* @__PURE__ */ new Map();
|
|
5762
|
-
|
|
5763
|
-
const
|
|
5764
|
-
|
|
5765
|
-
|
|
6025
|
+
if (!metadata.isStandalone) {
|
|
6026
|
+
for (const usedDep of declarations) {
|
|
6027
|
+
const cycle = this._checkForCyclicImport(usedDep.importedFile, usedDep.type, context);
|
|
6028
|
+
if (cycle !== null) {
|
|
6029
|
+
switch (usedDep.kind) {
|
|
6030
|
+
case R3TemplateDependencyKind.Directive:
|
|
6031
|
+
cyclesFromDirectives.set(usedDep, cycle);
|
|
6032
|
+
break;
|
|
6033
|
+
case R3TemplateDependencyKind.Pipe:
|
|
6034
|
+
cyclesFromPipes.set(usedDep, cycle);
|
|
6035
|
+
break;
|
|
6036
|
+
}
|
|
6037
|
+
}
|
|
5766
6038
|
}
|
|
5767
6039
|
}
|
|
5768
6040
|
const cycleDetected = cyclesFromDirectives.size !== 0 || cyclesFromPipes.size !== 0;
|
|
5769
6041
|
if (!cycleDetected) {
|
|
5770
|
-
for (const { type, importedFile } of
|
|
5771
|
-
this.
|
|
5772
|
-
}
|
|
5773
|
-
for (const { expression, importedFile } of usedPipes) {
|
|
5774
|
-
this._recordSyntheticImport(importedFile, expression, context);
|
|
6042
|
+
for (const { type, importedFile } of declarations) {
|
|
6043
|
+
this.maybeRecordSyntheticImport(importedFile, type, context);
|
|
5775
6044
|
}
|
|
5776
|
-
const wrapDirectivesAndPipesInClosure =
|
|
5777
|
-
data.
|
|
5778
|
-
data.pipes = new Map(usedPipes.map((pipe) => [pipe.pipeName, pipe.expression]));
|
|
6045
|
+
const wrapDirectivesAndPipesInClosure = declarations.some((decl) => isExpressionForwardReference(decl.type, node.name, context));
|
|
6046
|
+
data.declarations = declarations;
|
|
5779
6047
|
data.declarationListEmitMode = wrapDirectivesAndPipesInClosure ? 1 : 0;
|
|
5780
6048
|
} else {
|
|
5781
6049
|
if (this.cycleHandlingStrategy === 0) {
|
|
5782
|
-
this.scopeRegistry.setComponentRemoteScope(node,
|
|
6050
|
+
this.scopeRegistry.setComponentRemoteScope(node, declarations.filter(isUsedDirective).map((dir) => dir.ref), declarations.filter(isUsedPipe).map((pipe) => pipe.ref));
|
|
5783
6051
|
symbol.isRemotelyScoped = true;
|
|
5784
|
-
if (this.semanticDepGraphUpdater !== null && scope.ngModule !== null) {
|
|
6052
|
+
if (this.semanticDepGraphUpdater !== null && scope.kind === ComponentScopeKind.NgModule && scope.ngModule !== null) {
|
|
5785
6053
|
const moduleSymbol = this.semanticDepGraphUpdater.getSymbol(scope.ngModule);
|
|
5786
6054
|
if (!(moduleSymbol instanceof NgModuleSymbol)) {
|
|
5787
6055
|
throw new Error(`AssertionError: Expected ${scope.ngModule.name} to be an NgModuleSymbol.`);
|
|
@@ -5800,6 +6068,10 @@ var ComponentDecoratorHandler = class {
|
|
|
5800
6068
|
}
|
|
5801
6069
|
}
|
|
5802
6070
|
}
|
|
6071
|
+
if (analysis.resolvedImports !== null && analysis.rawImports !== null) {
|
|
6072
|
+
const standaloneDiagnostics = validateStandaloneImports(analysis.resolvedImports, analysis.rawImports, this.metaReader, this.scopeReader);
|
|
6073
|
+
diagnostics.push(...standaloneDiagnostics);
|
|
6074
|
+
}
|
|
5803
6075
|
if (analysis.providersRequiringFactory !== null && analysis.meta.providers instanceof WrappedNodeExpr7) {
|
|
5804
6076
|
const providerDiagnostics = getProviderDiagnostics(analysis.providersRequiringFactory, analysis.meta.providers.node, this.injectableRegistry);
|
|
5805
6077
|
diagnostics.push(...providerDiagnostics);
|
|
@@ -5846,7 +6118,7 @@ var ComponentDecoratorHandler = class {
|
|
|
5846
6118
|
for (const styleText of analysis.template.styles) {
|
|
5847
6119
|
styles.push(styleText);
|
|
5848
6120
|
}
|
|
5849
|
-
analysis.meta.styles = styles;
|
|
6121
|
+
analysis.meta.styles = styles.filter((s) => s.trim().length > 0);
|
|
5850
6122
|
}
|
|
5851
6123
|
compileFull(node, analysis, resolution, pool) {
|
|
5852
6124
|
if (analysis.template.errors !== null && analysis.template.errors.length > 0) {
|
|
@@ -5881,7 +6153,7 @@ var ComponentDecoratorHandler = class {
|
|
|
5881
6153
|
}
|
|
5882
6154
|
return this.cycleAnalyzer.wouldCreateCycle(origin, imported);
|
|
5883
6155
|
}
|
|
5884
|
-
|
|
6156
|
+
maybeRecordSyntheticImport(importedFile, expr, origin) {
|
|
5885
6157
|
const imported = resolveImportedFile(this.moduleResolver, importedFile, expr, origin);
|
|
5886
6158
|
if (imported === null) {
|
|
5887
6159
|
return;
|
|
@@ -5889,10 +6161,35 @@ var ComponentDecoratorHandler = class {
|
|
|
5889
6161
|
this.cycleAnalyzer.recordSyntheticImport(origin, imported);
|
|
5890
6162
|
}
|
|
5891
6163
|
};
|
|
6164
|
+
function validateStandaloneImports(importRefs, importExpr, metaReader, scopeReader) {
|
|
6165
|
+
const diagnostics = [];
|
|
6166
|
+
for (const ref of importRefs) {
|
|
6167
|
+
const dirMeta = metaReader.getDirectiveMetadata(ref);
|
|
6168
|
+
if (dirMeta !== null) {
|
|
6169
|
+
if (!dirMeta.isStandalone) {
|
|
6170
|
+
diagnostics.push(makeNotStandaloneDiagnostic(scopeReader, ref, importExpr, dirMeta.isComponent ? "component" : "directive"));
|
|
6171
|
+
}
|
|
6172
|
+
continue;
|
|
6173
|
+
}
|
|
6174
|
+
const pipeMeta = metaReader.getPipeMetadata(ref);
|
|
6175
|
+
if (pipeMeta !== null) {
|
|
6176
|
+
if (!pipeMeta.isStandalone) {
|
|
6177
|
+
diagnostics.push(makeNotStandaloneDiagnostic(scopeReader, ref, importExpr, "pipe"));
|
|
6178
|
+
}
|
|
6179
|
+
continue;
|
|
6180
|
+
}
|
|
6181
|
+
const ngModuleMeta = metaReader.getNgModuleMetadata(ref);
|
|
6182
|
+
if (ngModuleMeta !== null) {
|
|
6183
|
+
continue;
|
|
6184
|
+
}
|
|
6185
|
+
diagnostics.push(makeUnknownComponentImportDiagnostic(ref, importExpr));
|
|
6186
|
+
}
|
|
6187
|
+
return diagnostics;
|
|
6188
|
+
}
|
|
5892
6189
|
|
|
5893
|
-
// bazel-out/
|
|
6190
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/src/injectable.mjs
|
|
5894
6191
|
import { compileClassMetadata as compileClassMetadata4, compileDeclareClassMetadata as compileDeclareClassMetadata4, compileDeclareInjectableFromMetadata, compileInjectable, createMayBeForwardRefExpression as createMayBeForwardRefExpression2, FactoryTarget as FactoryTarget4, LiteralExpr as LiteralExpr3, WrappedNodeExpr as WrappedNodeExpr8 } from "@angular/compiler";
|
|
5895
|
-
import
|
|
6192
|
+
import ts25 from "typescript";
|
|
5896
6193
|
var InjectableDecoratorHandler = class {
|
|
5897
6194
|
constructor(reflector, isCore, strictCtorDeps, injectableRegistry, perf, errorOnDuplicateProv = true) {
|
|
5898
6195
|
this.reflector = reflector;
|
|
@@ -5983,7 +6280,7 @@ function extractInjectableMetadata(clazz, decorator, reflector) {
|
|
|
5983
6280
|
};
|
|
5984
6281
|
} else if (decorator.args.length === 1) {
|
|
5985
6282
|
const metaNode = decorator.args[0];
|
|
5986
|
-
if (!
|
|
6283
|
+
if (!ts25.isObjectLiteralExpression(metaNode)) {
|
|
5987
6284
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, metaNode, `@Injectable argument must be an object literal`);
|
|
5988
6285
|
}
|
|
5989
6286
|
const meta = reflectObjectLiteral(metaNode);
|
|
@@ -5991,7 +6288,7 @@ function extractInjectableMetadata(clazz, decorator, reflector) {
|
|
|
5991
6288
|
let deps = void 0;
|
|
5992
6289
|
if ((meta.has("useClass") || meta.has("useFactory")) && meta.has("deps")) {
|
|
5993
6290
|
const depsExpr = meta.get("deps");
|
|
5994
|
-
if (!
|
|
6291
|
+
if (!ts25.isArrayLiteralExpression(depsExpr)) {
|
|
5995
6292
|
throw new FatalDiagnosticError(ErrorCode.VALUE_NOT_LITERAL, depsExpr, `@Injectable deps metadata must be an inline array`);
|
|
5996
6293
|
}
|
|
5997
6294
|
deps = depsExpr.elements.map((dep) => getDep(dep, reflector));
|
|
@@ -6073,12 +6370,12 @@ function getDep(dep, reflector) {
|
|
|
6073
6370
|
}
|
|
6074
6371
|
return true;
|
|
6075
6372
|
}
|
|
6076
|
-
if (
|
|
6373
|
+
if (ts25.isArrayLiteralExpression(dep)) {
|
|
6077
6374
|
dep.elements.forEach((el) => {
|
|
6078
6375
|
let isDecorator = false;
|
|
6079
|
-
if (
|
|
6376
|
+
if (ts25.isIdentifier(el)) {
|
|
6080
6377
|
isDecorator = maybeUpdateDecorator(el, reflector);
|
|
6081
|
-
} else if (
|
|
6378
|
+
} else if (ts25.isNewExpression(el) && ts25.isIdentifier(el.expression)) {
|
|
6082
6379
|
const token = el.arguments && el.arguments.length > 0 && el.arguments[0] || void 0;
|
|
6083
6380
|
isDecorator = maybeUpdateDecorator(el.expression, reflector, token);
|
|
6084
6381
|
}
|
|
@@ -6090,9 +6387,9 @@ function getDep(dep, reflector) {
|
|
|
6090
6387
|
return meta;
|
|
6091
6388
|
}
|
|
6092
6389
|
|
|
6093
|
-
// bazel-out/
|
|
6390
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/src/pipe.mjs
|
|
6094
6391
|
import { compileClassMetadata as compileClassMetadata5, compileDeclareClassMetadata as compileDeclareClassMetadata5, compileDeclarePipeFromMetadata, compilePipeFromMetadata, FactoryTarget as FactoryTarget5, WrappedNodeExpr as WrappedNodeExpr9 } from "@angular/compiler";
|
|
6095
|
-
import
|
|
6392
|
+
import ts26 from "typescript";
|
|
6096
6393
|
var PipeSymbol = class extends SemanticSymbol {
|
|
6097
6394
|
constructor(decl, name) {
|
|
6098
6395
|
super(decl);
|
|
@@ -6147,7 +6444,7 @@ var PipeDecoratorHandler = class {
|
|
|
6147
6444
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, Decorator.nodeForError(decorator), "@Pipe must have exactly one argument");
|
|
6148
6445
|
}
|
|
6149
6446
|
const meta = unwrapExpression(decorator.args[0]);
|
|
6150
|
-
if (!
|
|
6447
|
+
if (!ts26.isObjectLiteralExpression(meta)) {
|
|
6151
6448
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, meta, "@Pipe must have a literal argument");
|
|
6152
6449
|
}
|
|
6153
6450
|
const pipe = reflectObjectLiteral(meta);
|
|
@@ -6195,12 +6492,12 @@ var PipeDecoratorHandler = class {
|
|
|
6195
6492
|
};
|
|
6196
6493
|
}
|
|
6197
6494
|
symbol(node, analysis) {
|
|
6198
|
-
return new PipeSymbol(node, analysis.meta.
|
|
6495
|
+
return new PipeSymbol(node, analysis.meta.pipeName);
|
|
6199
6496
|
}
|
|
6200
6497
|
register(node, analysis) {
|
|
6201
6498
|
const ref = new Reference(node);
|
|
6202
6499
|
this.metaRegistry.registerPipeMetadata({
|
|
6203
|
-
|
|
6500
|
+
kind: MetaKind.Pipe,
|
|
6204
6501
|
ref,
|
|
6205
6502
|
name: analysis.meta.pipeName,
|
|
6206
6503
|
nameExpr: analysis.pipeNameExpr,
|
|
@@ -6239,25 +6536,21 @@ export {
|
|
|
6239
6536
|
PartialEvaluator,
|
|
6240
6537
|
NoopReferencesRegistry,
|
|
6241
6538
|
SemanticDepGraphUpdater,
|
|
6539
|
+
MetaKind,
|
|
6242
6540
|
CompoundMetadataReader,
|
|
6243
6541
|
DtsMetadataReader,
|
|
6244
|
-
flattenInheritedDirectiveMetadata,
|
|
6245
6542
|
LocalMetadataRegistry,
|
|
6246
6543
|
CompoundMetadataRegistry,
|
|
6247
6544
|
InjectableClassRegistry,
|
|
6248
6545
|
ResourceRegistry,
|
|
6546
|
+
ComponentScopeKind,
|
|
6547
|
+
CompoundComponentScopeReader,
|
|
6548
|
+
MetadataDtsModuleScopeResolver,
|
|
6549
|
+
LocalModuleScopeRegistry,
|
|
6550
|
+
TypeCheckScopeRegistry,
|
|
6249
6551
|
CompilationMode,
|
|
6250
6552
|
HandlerFlags,
|
|
6251
6553
|
aliasTransformFactory,
|
|
6252
|
-
isShim,
|
|
6253
|
-
copyFileShimData,
|
|
6254
|
-
untagAllTsFiles,
|
|
6255
|
-
retagAllTsFiles,
|
|
6256
|
-
ShimAdapter,
|
|
6257
|
-
FactoryGenerator,
|
|
6258
|
-
generatedFactoryTransform,
|
|
6259
|
-
ShimReferenceTagger,
|
|
6260
|
-
SummaryGenerator,
|
|
6261
6554
|
TraitState,
|
|
6262
6555
|
TraitCompiler,
|
|
6263
6556
|
DtsTransformRegistry,
|
|
@@ -6276,5 +6569,4 @@ export {
|
|
|
6276
6569
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6277
6570
|
* found in the LICENSE file at https://angular.io/license
|
|
6278
6571
|
*/
|
|
6279
|
-
|
|
6280
|
-
//# sourceMappingURL=chunk-GYVY4Y2L.js.map
|
|
6572
|
+
//# sourceMappingURL=chunk-VSZPIAX6.js.map
|