@angular/compiler-cli 17.3.1 → 18.0.0-next.1
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-VH6EDOMC.js → chunk-ALDR4XSX.js} +1095 -66
- package/bundles/chunk-ALDR4XSX.js.map +6 -0
- package/bundles/{chunk-OXIOYWLB.js → chunk-AWB4ZG2D.js} +24 -24
- package/bundles/chunk-AWB4ZG2D.js.map +6 -0
- package/bundles/{chunk-F2QV65AH.js → chunk-B454JZVO.js} +2 -2
- package/bundles/{chunk-E5DF5SRS.js → chunk-C4L7A7U3.js} +24 -40
- package/bundles/chunk-C4L7A7U3.js.map +6 -0
- package/bundles/{chunk-6X7GQ6BQ.js → chunk-GGJA4IFT.js} +475 -197
- package/bundles/chunk-GGJA4IFT.js.map +6 -0
- package/bundles/{chunk-3ESFLGKJ.js → chunk-OHOBDHII.js} +248 -288
- package/bundles/chunk-OHOBDHII.js.map +6 -0
- package/bundles/index.js +5 -5
- package/bundles/linker/babel/index.js +2 -2
- package/bundles/linker/index.js +2 -2
- package/bundles/private/migrations.js +2 -2
- package/bundles/private/tooling.js +3 -3
- package/bundles/src/bin/ng_xi18n.js +4 -4
- package/bundles/src/bin/ngc.js +4 -4
- package/bundles_metadata.json +1 -1
- package/index.d.ts +1 -1
- package/linker/src/file_linker/partial_linkers/partial_component_linker_1.d.ts +1 -2
- package/linker/src/file_linker/partial_linkers/util.d.ts +1 -2
- package/linker/src/file_linker/translator.d.ts +2 -2
- package/linker/src/linker_import_generator.d.ts +5 -5
- package/package.json +3 -3
- package/src/ngtsc/annotations/component/src/handler.d.ts +2 -4
- package/src/ngtsc/annotations/component/src/metadata.d.ts +36 -7
- package/src/ngtsc/annotations/directive/src/handler.d.ts +1 -2
- package/src/ngtsc/annotations/directive/src/shared.d.ts +1 -1
- package/src/ngtsc/core/api/src/public_options.d.ts +0 -4
- package/src/ngtsc/imports/index.d.ts +1 -1
- package/src/ngtsc/imports/src/core.d.ts +0 -9
- package/src/ngtsc/imports/src/patch_alias_reference_resolution.d.ts +3 -1
- package/src/ngtsc/transform/index.d.ts +0 -1
- package/src/ngtsc/transform/src/declaration.d.ts +1 -1
- package/src/ngtsc/translator/index.d.ts +2 -2
- package/src/ngtsc/translator/src/api/import_generator.d.ts +22 -10
- package/src/ngtsc/translator/src/import_manager/check_unique_identifier_name.d.ts +13 -0
- package/src/ngtsc/translator/src/import_manager/import_manager.d.ts +94 -0
- package/src/ngtsc/translator/src/import_manager/import_typescript_transform.d.ts +17 -0
- package/src/ngtsc/translator/src/import_manager/reuse_generated_imports.d.ts +32 -0
- package/src/ngtsc/translator/src/import_manager/reuse_source_file_imports.d.ts +38 -0
- package/src/ngtsc/translator/src/translator.d.ts +3 -2
- package/src/ngtsc/translator/src/type_translator.d.ts +1 -1
- package/src/ngtsc/translator/src/typescript_translator.d.ts +2 -2
- package/src/ngtsc/typecheck/src/reference_emit_environment.d.ts +1 -1
- package/src/ngtsc/typecheck/src/ts_util.d.ts +0 -2
- package/src/transformers/jit_transforms/initializer_api_transforms/transform_api.d.ts +1 -1
- package/bundles/chunk-3ESFLGKJ.js.map +0 -6
- package/bundles/chunk-6X7GQ6BQ.js.map +0 -6
- package/bundles/chunk-E5DF5SRS.js.map +0 -6
- package/bundles/chunk-OXIOYWLB.js.map +0 -6
- package/bundles/chunk-VH6EDOMC.js.map +0 -6
- package/src/ngtsc/transform/src/utils.d.ts +0 -15
- package/src/ngtsc/translator/src/import_manager.d.ts +0 -47
- /package/bundles/{chunk-F2QV65AH.js.map → chunk-B454JZVO.js.map} +0 -0
|
@@ -24,13 +24,14 @@ import {
|
|
|
24
24
|
makeRelatedInformation,
|
|
25
25
|
nodeDebugInfo,
|
|
26
26
|
nodeNameForError,
|
|
27
|
+
presetImportManagerForceNamespaceImports,
|
|
27
28
|
reflectObjectLiteral,
|
|
28
29
|
reflectTypeEntityToDeclaration,
|
|
29
30
|
translateExpression,
|
|
30
31
|
translateStatement,
|
|
31
32
|
translateType,
|
|
32
33
|
typeNodeToValueExpr
|
|
33
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-GGJA4IFT.js";
|
|
34
35
|
import {
|
|
35
36
|
PerfEvent,
|
|
36
37
|
PerfPhase
|
|
@@ -1352,7 +1353,7 @@ function createUnsuitableInjectionTokenError(clazz, error) {
|
|
|
1352
1353
|
}
|
|
1353
1354
|
|
|
1354
1355
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/common/src/diagnostics.mjs
|
|
1355
|
-
import
|
|
1356
|
+
import ts12 from "typescript";
|
|
1356
1357
|
|
|
1357
1358
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/metadata/src/api.mjs
|
|
1358
1359
|
var MetaKind;
|
|
@@ -2677,53 +2678,7 @@ function containsErrors(diagnostics) {
|
|
|
2677
2678
|
}
|
|
2678
2679
|
|
|
2679
2680
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/declaration.mjs
|
|
2680
|
-
import ts10 from "typescript";
|
|
2681
|
-
|
|
2682
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/utils.mjs
|
|
2683
2681
|
import ts9 from "typescript";
|
|
2684
|
-
function addImports(factory = ts9.factory, importManager, sf, extraStatements = []) {
|
|
2685
|
-
const addedImports = importManager.getAllImports(sf.fileName).map((i) => i.qualifier !== null ? createNamespaceImportDecl(i, factory) : createSideEffectImportDecl(i, factory));
|
|
2686
|
-
const existingImports = sf.statements.filter((stmt) => isImportStatement(stmt));
|
|
2687
|
-
const body = sf.statements.filter((stmt) => !isImportStatement(stmt));
|
|
2688
|
-
if (addedImports.length > 0) {
|
|
2689
|
-
const fileoverviewAnchorStmt = factory.createNotEmittedStatement(sf);
|
|
2690
|
-
return factory.updateSourceFile(sf, factory.createNodeArray([
|
|
2691
|
-
fileoverviewAnchorStmt,
|
|
2692
|
-
...existingImports,
|
|
2693
|
-
...addedImports,
|
|
2694
|
-
...extraStatements,
|
|
2695
|
-
...body
|
|
2696
|
-
]));
|
|
2697
|
-
}
|
|
2698
|
-
return sf;
|
|
2699
|
-
}
|
|
2700
|
-
function createNamespaceImportDecl(i, factory) {
|
|
2701
|
-
const qualifier = factory.createIdentifier(i.qualifier.text);
|
|
2702
|
-
const importClause = factory.createImportClause(
|
|
2703
|
-
false,
|
|
2704
|
-
void 0,
|
|
2705
|
-
factory.createNamespaceImport(qualifier)
|
|
2706
|
-
);
|
|
2707
|
-
const decl = factory.createImportDeclaration(
|
|
2708
|
-
void 0,
|
|
2709
|
-
importClause,
|
|
2710
|
-
factory.createStringLiteral(i.specifier)
|
|
2711
|
-
);
|
|
2712
|
-
ts9.setOriginalNode(i.qualifier, decl);
|
|
2713
|
-
return decl;
|
|
2714
|
-
}
|
|
2715
|
-
function createSideEffectImportDecl(i, factory) {
|
|
2716
|
-
return factory.createImportDeclaration(
|
|
2717
|
-
void 0,
|
|
2718
|
-
void 0,
|
|
2719
|
-
ts9.factory.createStringLiteral(i.specifier)
|
|
2720
|
-
);
|
|
2721
|
-
}
|
|
2722
|
-
function isImportStatement(stmt) {
|
|
2723
|
-
return ts9.isImportDeclaration(stmt) || ts9.isImportEqualsDeclaration(stmt) || ts9.isNamespaceImport(stmt);
|
|
2724
|
-
}
|
|
2725
|
-
|
|
2726
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/declaration.mjs
|
|
2727
2682
|
var DtsTransformRegistry = class {
|
|
2728
2683
|
constructor() {
|
|
2729
2684
|
this.ivyDeclarationTransforms = /* @__PURE__ */ new Map();
|
|
@@ -2738,7 +2693,7 @@ var DtsTransformRegistry = class {
|
|
|
2738
2693
|
if (!sf.isDeclarationFile) {
|
|
2739
2694
|
return null;
|
|
2740
2695
|
}
|
|
2741
|
-
const originalSf =
|
|
2696
|
+
const originalSf = ts9.getOriginalNode(sf);
|
|
2742
2697
|
let transforms = null;
|
|
2743
2698
|
if (this.ivyDeclarationTransforms.has(originalSf)) {
|
|
2744
2699
|
transforms = [];
|
|
@@ -2747,11 +2702,11 @@ var DtsTransformRegistry = class {
|
|
|
2747
2702
|
return transforms;
|
|
2748
2703
|
}
|
|
2749
2704
|
};
|
|
2750
|
-
function declarationTransformFactory(transformRegistry, reflector, refEmitter, importRewriter
|
|
2705
|
+
function declarationTransformFactory(transformRegistry, reflector, refEmitter, importRewriter) {
|
|
2751
2706
|
return (context) => {
|
|
2752
|
-
const transformer = new DtsTransformer(context, reflector, refEmitter, importRewriter
|
|
2707
|
+
const transformer = new DtsTransformer(context, reflector, refEmitter, importRewriter);
|
|
2753
2708
|
return (fileOrBundle) => {
|
|
2754
|
-
if (
|
|
2709
|
+
if (ts9.isBundle(fileOrBundle)) {
|
|
2755
2710
|
return fileOrBundle;
|
|
2756
2711
|
}
|
|
2757
2712
|
const transforms = transformRegistry.getAllTransforms(fileOrBundle);
|
|
@@ -2763,26 +2718,25 @@ function declarationTransformFactory(transformRegistry, reflector, refEmitter, i
|
|
|
2763
2718
|
};
|
|
2764
2719
|
}
|
|
2765
2720
|
var DtsTransformer = class {
|
|
2766
|
-
constructor(ctx, reflector, refEmitter, importRewriter
|
|
2721
|
+
constructor(ctx, reflector, refEmitter, importRewriter) {
|
|
2767
2722
|
this.ctx = ctx;
|
|
2768
2723
|
this.reflector = reflector;
|
|
2769
2724
|
this.refEmitter = refEmitter;
|
|
2770
2725
|
this.importRewriter = importRewriter;
|
|
2771
|
-
this.importPrefix = importPrefix;
|
|
2772
2726
|
}
|
|
2773
2727
|
transform(sf, transforms) {
|
|
2774
|
-
const imports = new ImportManager(this.importRewriter
|
|
2728
|
+
const imports = new ImportManager({ ...presetImportManagerForceNamespaceImports, rewriter: this.importRewriter });
|
|
2775
2729
|
const visitor = (node) => {
|
|
2776
|
-
if (
|
|
2730
|
+
if (ts9.isClassDeclaration(node)) {
|
|
2777
2731
|
return this.transformClassDeclaration(node, transforms, imports);
|
|
2778
|
-
} else if (
|
|
2732
|
+
} else if (ts9.isFunctionDeclaration(node)) {
|
|
2779
2733
|
return this.transformFunctionDeclaration(node, transforms, imports);
|
|
2780
2734
|
} else {
|
|
2781
|
-
return
|
|
2735
|
+
return ts9.visitEachChild(node, visitor, this.ctx);
|
|
2782
2736
|
}
|
|
2783
2737
|
};
|
|
2784
|
-
sf =
|
|
2785
|
-
return
|
|
2738
|
+
sf = ts9.visitNode(sf, visitor, ts9.isSourceFile) || sf;
|
|
2739
|
+
return imports.transformTsFile(this.ctx, sf);
|
|
2786
2740
|
}
|
|
2787
2741
|
transformClassDeclaration(clazz, transforms, imports) {
|
|
2788
2742
|
let elements = clazz.members;
|
|
@@ -2809,7 +2763,7 @@ var DtsTransformer = class {
|
|
|
2809
2763
|
}
|
|
2810
2764
|
}
|
|
2811
2765
|
if (elementsChanged && clazz === newClazz) {
|
|
2812
|
-
newClazz =
|
|
2766
|
+
newClazz = ts9.factory.updateClassDeclaration(
|
|
2813
2767
|
clazz,
|
|
2814
2768
|
clazz.modifiers,
|
|
2815
2769
|
clazz.name,
|
|
@@ -2838,16 +2792,16 @@ var IvyDeclarationDtsTransform = class {
|
|
|
2838
2792
|
this.declarationFields.set(decl, fields);
|
|
2839
2793
|
}
|
|
2840
2794
|
transformClass(clazz, members, reflector, refEmitter, imports) {
|
|
2841
|
-
const original =
|
|
2795
|
+
const original = ts9.getOriginalNode(clazz);
|
|
2842
2796
|
if (!this.declarationFields.has(original)) {
|
|
2843
2797
|
return clazz;
|
|
2844
2798
|
}
|
|
2845
2799
|
const fields = this.declarationFields.get(original);
|
|
2846
2800
|
const newMembers = fields.map((decl) => {
|
|
2847
|
-
const modifiers = [
|
|
2801
|
+
const modifiers = [ts9.factory.createModifier(ts9.SyntaxKind.StaticKeyword)];
|
|
2848
2802
|
const typeRef = translateType(decl.type, original.getSourceFile(), reflector, refEmitter, imports);
|
|
2849
2803
|
markForEmitAsSingleLine(typeRef);
|
|
2850
|
-
return
|
|
2804
|
+
return ts9.factory.createPropertyDeclaration(
|
|
2851
2805
|
modifiers,
|
|
2852
2806
|
decl.name,
|
|
2853
2807
|
void 0,
|
|
@@ -2855,7 +2809,7 @@ var IvyDeclarationDtsTransform = class {
|
|
|
2855
2809
|
void 0
|
|
2856
2810
|
);
|
|
2857
2811
|
});
|
|
2858
|
-
return
|
|
2812
|
+
return ts9.factory.updateClassDeclaration(
|
|
2859
2813
|
clazz,
|
|
2860
2814
|
clazz.modifiers,
|
|
2861
2815
|
clazz.name,
|
|
@@ -2866,16 +2820,16 @@ var IvyDeclarationDtsTransform = class {
|
|
|
2866
2820
|
}
|
|
2867
2821
|
};
|
|
2868
2822
|
function markForEmitAsSingleLine(node) {
|
|
2869
|
-
|
|
2870
|
-
|
|
2823
|
+
ts9.setEmitFlags(node, ts9.EmitFlags.SingleLine);
|
|
2824
|
+
ts9.forEachChild(node, markForEmitAsSingleLine);
|
|
2871
2825
|
}
|
|
2872
2826
|
|
|
2873
2827
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/transform.mjs
|
|
2874
2828
|
import { ConstantPool } from "@angular/compiler";
|
|
2875
|
-
import
|
|
2829
|
+
import ts11 from "typescript";
|
|
2876
2830
|
|
|
2877
2831
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/util/src/visitor.mjs
|
|
2878
|
-
import
|
|
2832
|
+
import ts10 from "typescript";
|
|
2879
2833
|
function visit(node, visitor, context) {
|
|
2880
2834
|
return visitor._visit(node, context);
|
|
2881
2835
|
}
|
|
@@ -2899,13 +2853,13 @@ var Visitor = class {
|
|
|
2899
2853
|
}
|
|
2900
2854
|
_visit(node, context) {
|
|
2901
2855
|
let visitedNode = null;
|
|
2902
|
-
node =
|
|
2903
|
-
if (
|
|
2856
|
+
node = ts10.visitEachChild(node, (child) => child && this._visit(child, context), context);
|
|
2857
|
+
if (ts10.isClassDeclaration(node)) {
|
|
2904
2858
|
visitedNode = this._visitListEntryNode(node, (node2) => this.visitClassDeclaration(node2));
|
|
2905
2859
|
} else {
|
|
2906
2860
|
visitedNode = this.visitOtherNode(node);
|
|
2907
2861
|
}
|
|
2908
|
-
if (visitedNode && (
|
|
2862
|
+
if (visitedNode && (ts10.isBlock(visitedNode) || ts10.isSourceFile(visitedNode))) {
|
|
2909
2863
|
visitedNode = this._maybeProcessStatements(visitedNode);
|
|
2910
2864
|
}
|
|
2911
2865
|
return visitedNode;
|
|
@@ -2926,11 +2880,11 @@ var Visitor = class {
|
|
|
2926
2880
|
this._after.delete(stmt);
|
|
2927
2881
|
}
|
|
2928
2882
|
});
|
|
2929
|
-
const statementsArray =
|
|
2930
|
-
if (
|
|
2931
|
-
return
|
|
2883
|
+
const statementsArray = ts10.factory.createNodeArray(newStatements, node.statements.hasTrailingComma);
|
|
2884
|
+
if (ts10.isBlock(node)) {
|
|
2885
|
+
return ts10.factory.updateBlock(node, statementsArray);
|
|
2932
2886
|
} else {
|
|
2933
|
-
return
|
|
2887
|
+
return ts10.factory.updateSourceFile(node, statementsArray, node.isDeclarationFile, node.referencedFiles, node.typeReferenceDirectives, node.hasNoDefaultLib, node.libReferenceDirectives);
|
|
2934
2888
|
}
|
|
2935
2889
|
}
|
|
2936
2890
|
};
|
|
@@ -2989,30 +2943,31 @@ var IvyTransformationVisitor = class extends Visitor {
|
|
|
2989
2943
|
};
|
|
2990
2944
|
const statements = [];
|
|
2991
2945
|
const members = [...node.members];
|
|
2946
|
+
const sourceFile = ts11.getOriginalNode(node).getSourceFile();
|
|
2992
2947
|
for (const field of this.classCompilationMap.get(node)) {
|
|
2993
2948
|
if (field.initializer === null) {
|
|
2994
2949
|
continue;
|
|
2995
2950
|
}
|
|
2996
|
-
const exprNode = translateExpression(field.initializer, this.importManager, translateOptions);
|
|
2997
|
-
const property =
|
|
2951
|
+
const exprNode = translateExpression(sourceFile, field.initializer, this.importManager, translateOptions);
|
|
2952
|
+
const property = ts11.factory.createPropertyDeclaration([ts11.factory.createToken(ts11.SyntaxKind.StaticKeyword)], field.name, void 0, void 0, exprNode);
|
|
2998
2953
|
if (this.isClosureCompilerEnabled) {
|
|
2999
|
-
|
|
2954
|
+
ts11.addSyntheticLeadingComment(
|
|
3000
2955
|
property,
|
|
3001
|
-
|
|
2956
|
+
ts11.SyntaxKind.MultiLineCommentTrivia,
|
|
3002
2957
|
"* @nocollapse ",
|
|
3003
2958
|
false
|
|
3004
2959
|
);
|
|
3005
2960
|
}
|
|
3006
|
-
field.statements.map((stmt) => translateStatement(stmt, this.importManager, translateOptions)).forEach((stmt) => statements.push(stmt));
|
|
2961
|
+
field.statements.map((stmt) => translateStatement(sourceFile, stmt, this.importManager, translateOptions)).forEach((stmt) => statements.push(stmt));
|
|
3007
2962
|
members.push(property);
|
|
3008
2963
|
}
|
|
3009
|
-
const filteredDecorators = maybeFilterDecorator(
|
|
3010
|
-
const nodeModifiers =
|
|
2964
|
+
const filteredDecorators = maybeFilterDecorator(ts11.getDecorators(node), this.compilation.decoratorsFor(node));
|
|
2965
|
+
const nodeModifiers = ts11.getModifiers(node);
|
|
3011
2966
|
let updatedModifiers;
|
|
3012
2967
|
if ((filteredDecorators == null ? void 0 : filteredDecorators.length) || (nodeModifiers == null ? void 0 : nodeModifiers.length)) {
|
|
3013
2968
|
updatedModifiers = [...filteredDecorators || [], ...nodeModifiers || []];
|
|
3014
2969
|
}
|
|
3015
|
-
node =
|
|
2970
|
+
node = ts11.factory.updateClassDeclaration(
|
|
3016
2971
|
node,
|
|
3017
2972
|
updatedModifiers,
|
|
3018
2973
|
node.name,
|
|
@@ -3023,7 +2978,7 @@ var IvyTransformationVisitor = class extends Visitor {
|
|
|
3023
2978
|
return { node, after: statements };
|
|
3024
2979
|
}
|
|
3025
2980
|
visitOtherNode(node) {
|
|
3026
|
-
if (
|
|
2981
|
+
if (ts11.isImportDeclaration(node) && this.deferrableImports.has(node)) {
|
|
3027
2982
|
return null;
|
|
3028
2983
|
}
|
|
3029
2984
|
return node;
|
|
@@ -3041,7 +2996,7 @@ var IvyTransformationVisitor = class extends Visitor {
|
|
|
3041
2996
|
}
|
|
3042
2997
|
}
|
|
3043
2998
|
_nonCoreDecoratorsOnly(node) {
|
|
3044
|
-
const decorators =
|
|
2999
|
+
const decorators = ts11.getDecorators(node);
|
|
3045
3000
|
if (decorators === void 0) {
|
|
3046
3001
|
return void 0;
|
|
3047
3002
|
}
|
|
@@ -3058,35 +3013,35 @@ var IvyTransformationVisitor = class extends Visitor {
|
|
|
3058
3013
|
return nodeArrayFromDecoratorsArray(filtered);
|
|
3059
3014
|
}
|
|
3060
3015
|
_stripAngularDecorators(node) {
|
|
3061
|
-
const modifiers =
|
|
3062
|
-
const nonCoreDecorators =
|
|
3016
|
+
const modifiers = ts11.canHaveModifiers(node) ? ts11.getModifiers(node) : void 0;
|
|
3017
|
+
const nonCoreDecorators = ts11.canHaveDecorators(node) ? this._nonCoreDecoratorsOnly(node) : void 0;
|
|
3063
3018
|
const combinedModifiers = [...nonCoreDecorators || [], ...modifiers || []];
|
|
3064
|
-
if (
|
|
3065
|
-
node =
|
|
3066
|
-
} else if (
|
|
3067
|
-
node =
|
|
3068
|
-
} else if (
|
|
3069
|
-
node =
|
|
3070
|
-
} else if (
|
|
3071
|
-
node =
|
|
3072
|
-
} else if (
|
|
3073
|
-
node =
|
|
3074
|
-
} else if (
|
|
3019
|
+
if (ts11.isParameter(node)) {
|
|
3020
|
+
node = ts11.factory.updateParameterDeclaration(node, combinedModifiers, node.dotDotDotToken, node.name, node.questionToken, node.type, node.initializer);
|
|
3021
|
+
} else if (ts11.isMethodDeclaration(node)) {
|
|
3022
|
+
node = ts11.factory.updateMethodDeclaration(node, combinedModifiers, node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters, node.type, node.body);
|
|
3023
|
+
} else if (ts11.isPropertyDeclaration(node)) {
|
|
3024
|
+
node = ts11.factory.updatePropertyDeclaration(node, combinedModifiers, node.name, node.questionToken, node.type, node.initializer);
|
|
3025
|
+
} else if (ts11.isGetAccessor(node)) {
|
|
3026
|
+
node = ts11.factory.updateGetAccessorDeclaration(node, combinedModifiers, node.name, node.parameters, node.type, node.body);
|
|
3027
|
+
} else if (ts11.isSetAccessor(node)) {
|
|
3028
|
+
node = ts11.factory.updateSetAccessorDeclaration(node, combinedModifiers, node.name, node.parameters, node.body);
|
|
3029
|
+
} else if (ts11.isConstructorDeclaration(node)) {
|
|
3075
3030
|
const parameters = node.parameters.map((param) => this._stripAngularDecorators(param));
|
|
3076
|
-
node =
|
|
3031
|
+
node = ts11.factory.updateConstructorDeclaration(node, modifiers, parameters, node.body);
|
|
3077
3032
|
}
|
|
3078
3033
|
return node;
|
|
3079
3034
|
}
|
|
3080
3035
|
};
|
|
3081
3036
|
function transformIvySourceFile(compilation, context, reflector, importRewriter, localCompilationExtraImportsTracker, file, isCore, isClosureCompilerEnabled, recordWrappedNode) {
|
|
3082
3037
|
const constantPool = new ConstantPool(isClosureCompilerEnabled);
|
|
3083
|
-
const importManager = new ImportManager(importRewriter);
|
|
3038
|
+
const importManager = new ImportManager({ ...presetImportManagerForceNamespaceImports, rewriter: importRewriter });
|
|
3084
3039
|
const compilationVisitor = new IvyCompilationVisitor(compilation, constantPool);
|
|
3085
3040
|
visit(file, compilationVisitor, context);
|
|
3086
3041
|
const transformationVisitor = new IvyTransformationVisitor(compilation, compilationVisitor.classCompilationMap, reflector, importManager, recordWrappedNode, isClosureCompilerEnabled, isCore, compilationVisitor.deferrableImports);
|
|
3087
3042
|
let sf = visit(file, transformationVisitor, context);
|
|
3088
|
-
const downlevelTranslatedCode = getLocalizeCompileTarget(context) <
|
|
3089
|
-
const constants = constantPool.statements.map((stmt) => translateStatement(stmt, importManager, {
|
|
3043
|
+
const downlevelTranslatedCode = getLocalizeCompileTarget(context) < ts11.ScriptTarget.ES2015;
|
|
3044
|
+
const constants = constantPool.statements.map((stmt) => translateStatement(file, stmt, importManager, {
|
|
3090
3045
|
recordWrappedNode,
|
|
3091
3046
|
downlevelTaggedTemplates: downlevelTranslatedCode,
|
|
3092
3047
|
downlevelVariableDeclarations: downlevelTranslatedCode,
|
|
@@ -3095,27 +3050,27 @@ function transformIvySourceFile(compilation, context, reflector, importRewriter,
|
|
|
3095
3050
|
const fileOverviewMeta = isClosureCompilerEnabled ? getFileOverviewComment(sf.statements) : null;
|
|
3096
3051
|
if (localCompilationExtraImportsTracker !== null) {
|
|
3097
3052
|
for (const moduleName of localCompilationExtraImportsTracker.getImportsForFile(sf)) {
|
|
3098
|
-
importManager.
|
|
3053
|
+
importManager.addSideEffectImport(sf, moduleName);
|
|
3099
3054
|
}
|
|
3100
3055
|
}
|
|
3101
|
-
sf =
|
|
3056
|
+
sf = importManager.transformTsFile(context, sf, constants);
|
|
3102
3057
|
if (fileOverviewMeta !== null) {
|
|
3103
|
-
|
|
3058
|
+
sf = insertFileOverviewComment(sf, fileOverviewMeta);
|
|
3104
3059
|
}
|
|
3105
3060
|
return sf;
|
|
3106
3061
|
}
|
|
3107
3062
|
function getLocalizeCompileTarget(context) {
|
|
3108
|
-
const target = context.getCompilerOptions().target ||
|
|
3109
|
-
return target !==
|
|
3063
|
+
const target = context.getCompilerOptions().target || ts11.ScriptTarget.ES2015;
|
|
3064
|
+
return target !== ts11.ScriptTarget.JSON ? target : ts11.ScriptTarget.ES2015;
|
|
3110
3065
|
}
|
|
3111
3066
|
function getFileOverviewComment(statements) {
|
|
3112
3067
|
if (statements.length > 0) {
|
|
3113
3068
|
const host = statements[0];
|
|
3114
3069
|
let trailing = false;
|
|
3115
|
-
let comments =
|
|
3070
|
+
let comments = ts11.getSyntheticLeadingComments(host);
|
|
3116
3071
|
if (!comments || comments.length === 0) {
|
|
3117
3072
|
trailing = true;
|
|
3118
|
-
comments =
|
|
3073
|
+
comments = ts11.getSyntheticTrailingComments(host);
|
|
3119
3074
|
}
|
|
3120
3075
|
if (comments && comments.length > 0 && CLOSURE_FILE_OVERVIEW_REGEXP.test(comments[0].text)) {
|
|
3121
3076
|
return { comments, host, trailing };
|
|
@@ -3123,26 +3078,29 @@ function getFileOverviewComment(statements) {
|
|
|
3123
3078
|
}
|
|
3124
3079
|
return null;
|
|
3125
3080
|
}
|
|
3126
|
-
function
|
|
3081
|
+
function insertFileOverviewComment(sf, fileoverview) {
|
|
3127
3082
|
const { comments, host, trailing } = fileoverview;
|
|
3128
3083
|
if (sf.statements.length > 0 && host !== sf.statements[0]) {
|
|
3129
3084
|
if (trailing) {
|
|
3130
|
-
|
|
3085
|
+
ts11.setSyntheticTrailingComments(host, void 0);
|
|
3131
3086
|
} else {
|
|
3132
|
-
|
|
3087
|
+
ts11.setSyntheticLeadingComments(host, void 0);
|
|
3133
3088
|
}
|
|
3134
|
-
|
|
3089
|
+
const commentNode = ts11.factory.createNotEmittedStatement(sf);
|
|
3090
|
+
ts11.setSyntheticLeadingComments(commentNode, comments);
|
|
3091
|
+
return ts11.factory.updateSourceFile(sf, [commentNode, ...sf.statements], sf.isDeclarationFile, sf.referencedFiles, sf.typeReferenceDirectives, sf.hasNoDefaultLib, sf.libReferenceDirectives);
|
|
3135
3092
|
}
|
|
3093
|
+
return sf;
|
|
3136
3094
|
}
|
|
3137
3095
|
function maybeFilterDecorator(decorators, toRemove) {
|
|
3138
3096
|
if (decorators === void 0) {
|
|
3139
3097
|
return void 0;
|
|
3140
3098
|
}
|
|
3141
|
-
const filtered = decorators.filter((dec) => toRemove.find((decToRemove) =>
|
|
3099
|
+
const filtered = decorators.filter((dec) => toRemove.find((decToRemove) => ts11.getOriginalNode(dec) === decToRemove) === void 0);
|
|
3142
3100
|
if (filtered.length === 0) {
|
|
3143
3101
|
return void 0;
|
|
3144
3102
|
}
|
|
3145
|
-
return
|
|
3103
|
+
return ts11.factory.createNodeArray(filtered);
|
|
3146
3104
|
}
|
|
3147
3105
|
function isFromAngularCore(decorator) {
|
|
3148
3106
|
return decorator.import !== null && decorator.import.from === "@angular/core";
|
|
@@ -3156,7 +3114,7 @@ function createRecorderFn(defaultImportTracker) {
|
|
|
3156
3114
|
};
|
|
3157
3115
|
}
|
|
3158
3116
|
function nodeArrayFromDecoratorsArray(decorators) {
|
|
3159
|
-
const array =
|
|
3117
|
+
const array = ts11.factory.createNodeArray(decorators);
|
|
3160
3118
|
if (array.length > 0) {
|
|
3161
3119
|
array.pos = decorators[0].pos;
|
|
3162
3120
|
array.end = decorators[decorators.length - 1].end;
|
|
@@ -3193,11 +3151,11 @@ function createValueHasWrongTypeError(node, value, messageText) {
|
|
|
3193
3151
|
}
|
|
3194
3152
|
const chain = {
|
|
3195
3153
|
messageText,
|
|
3196
|
-
category:
|
|
3154
|
+
category: ts12.DiagnosticCategory.Error,
|
|
3197
3155
|
code: 0,
|
|
3198
3156
|
next: [{
|
|
3199
3157
|
messageText: chainedMessage,
|
|
3200
|
-
category:
|
|
3158
|
+
category: ts12.DiagnosticCategory.Message,
|
|
3201
3159
|
code: 0
|
|
3202
3160
|
}]
|
|
3203
3161
|
};
|
|
@@ -3373,7 +3331,7 @@ function assertLocalCompilationUnresolvedConst(compilationMode, value, nodeToHig
|
|
|
3373
3331
|
|
|
3374
3332
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/common/src/evaluation.mjs
|
|
3375
3333
|
import { ViewEncapsulation } from "@angular/compiler";
|
|
3376
|
-
import
|
|
3334
|
+
import ts13 from "typescript";
|
|
3377
3335
|
function resolveEnumValue(evaluator, metadata, field, enumSymbolName) {
|
|
3378
3336
|
let resolved = null;
|
|
3379
3337
|
if (metadata.has(field)) {
|
|
@@ -3415,7 +3373,7 @@ function resolveLiteral(decorator, literalCache) {
|
|
|
3415
3373
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, decorator.node, `Incorrect number of arguments to @${decorator.name} decorator`);
|
|
3416
3374
|
}
|
|
3417
3375
|
const meta = unwrapExpression(decorator.args[0]);
|
|
3418
|
-
if (!
|
|
3376
|
+
if (!ts13.isObjectLiteralExpression(meta)) {
|
|
3419
3377
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, meta, `Decorator argument must be literal.`);
|
|
3420
3378
|
}
|
|
3421
3379
|
literalCache.set(decorator, meta);
|
|
@@ -3473,7 +3431,7 @@ var InjectableClassRegistry = class {
|
|
|
3473
3431
|
|
|
3474
3432
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/common/src/metadata.mjs
|
|
3475
3433
|
import { ArrowFunctionExpr, LiteralArrayExpr, LiteralExpr as LiteralExpr2, literalMap, WrappedNodeExpr as WrappedNodeExpr3 } from "@angular/compiler";
|
|
3476
|
-
import
|
|
3434
|
+
import ts14 from "typescript";
|
|
3477
3435
|
function extractClassMetadata(clazz, reflection, isCore, annotateForClosureCompiler, angularDecoratorTransform = (dec) => dec) {
|
|
3478
3436
|
if (!reflection.isClass(clazz)) {
|
|
3479
3437
|
return null;
|
|
@@ -3487,7 +3445,7 @@ function extractClassMetadata(clazz, reflection, isCore, annotateForClosureCompi
|
|
|
3487
3445
|
if (ngClassDecorators.length === 0) {
|
|
3488
3446
|
return null;
|
|
3489
3447
|
}
|
|
3490
|
-
const metaDecorators = new WrappedNodeExpr3(
|
|
3448
|
+
const metaDecorators = new WrappedNodeExpr3(ts14.factory.createArrayLiteralExpression(ngClassDecorators));
|
|
3491
3449
|
let metaCtorParameters = null;
|
|
3492
3450
|
const classCtorParameters = reflection.getConstructorParameters(clazz);
|
|
3493
3451
|
if (classCtorParameters !== null) {
|
|
@@ -3505,7 +3463,7 @@ function extractClassMetadata(clazz, reflection, isCore, annotateForClosureCompi
|
|
|
3505
3463
|
return classMemberToMetadata((_a = member.nameNode) != null ? _a : member.name, member.decorators, isCore);
|
|
3506
3464
|
});
|
|
3507
3465
|
if (decoratedMembers.length > 0) {
|
|
3508
|
-
metaPropDecorators = new WrappedNodeExpr3(
|
|
3466
|
+
metaPropDecorators = new WrappedNodeExpr3(ts14.factory.createObjectLiteralExpression(decoratedMembers));
|
|
3509
3467
|
}
|
|
3510
3468
|
return {
|
|
3511
3469
|
type: new WrappedNodeExpr3(id),
|
|
@@ -3521,37 +3479,37 @@ function ctorParameterToMetadata(param, isCore) {
|
|
|
3521
3479
|
];
|
|
3522
3480
|
if (param.decorators !== null) {
|
|
3523
3481
|
const ngDecorators = param.decorators.filter((dec) => isAngularDecorator2(dec, isCore)).map((decorator) => decoratorToMetadata(decorator));
|
|
3524
|
-
const value = new WrappedNodeExpr3(
|
|
3482
|
+
const value = new WrappedNodeExpr3(ts14.factory.createArrayLiteralExpression(ngDecorators));
|
|
3525
3483
|
mapEntries.push({ key: "decorators", value, quoted: false });
|
|
3526
3484
|
}
|
|
3527
3485
|
return literalMap(mapEntries);
|
|
3528
3486
|
}
|
|
3529
3487
|
function classMemberToMetadata(name, decorators, isCore) {
|
|
3530
3488
|
const ngDecorators = decorators.filter((dec) => isAngularDecorator2(dec, isCore)).map((decorator) => decoratorToMetadata(decorator));
|
|
3531
|
-
const decoratorMeta =
|
|
3532
|
-
return
|
|
3489
|
+
const decoratorMeta = ts14.factory.createArrayLiteralExpression(ngDecorators);
|
|
3490
|
+
return ts14.factory.createPropertyAssignment(name, decoratorMeta);
|
|
3533
3491
|
}
|
|
3534
3492
|
function decoratorToMetadata(decorator, wrapFunctionsInParens) {
|
|
3535
3493
|
if (decorator.identifier === null) {
|
|
3536
3494
|
throw new Error("Illegal state: synthesized decorator cannot be emitted in class metadata.");
|
|
3537
3495
|
}
|
|
3538
3496
|
const properties = [
|
|
3539
|
-
|
|
3497
|
+
ts14.factory.createPropertyAssignment("type", decorator.identifier)
|
|
3540
3498
|
];
|
|
3541
3499
|
if (decorator.args !== null && decorator.args.length > 0) {
|
|
3542
3500
|
const args = decorator.args.map((arg) => {
|
|
3543
3501
|
return wrapFunctionsInParens ? wrapFunctionExpressionsInParens(arg) : arg;
|
|
3544
3502
|
});
|
|
3545
|
-
properties.push(
|
|
3503
|
+
properties.push(ts14.factory.createPropertyAssignment("args", ts14.factory.createArrayLiteralExpression(args)));
|
|
3546
3504
|
}
|
|
3547
|
-
return
|
|
3505
|
+
return ts14.factory.createObjectLiteralExpression(properties, true);
|
|
3548
3506
|
}
|
|
3549
3507
|
function isAngularDecorator2(decorator, isCore) {
|
|
3550
3508
|
return isCore || decorator.import !== null && decorator.import.from === "@angular/core";
|
|
3551
3509
|
}
|
|
3552
3510
|
function removeIdentifierReferences(node, names) {
|
|
3553
|
-
const result =
|
|
3554
|
-
return
|
|
3511
|
+
const result = ts14.transform(node, [(context) => (root) => ts14.visitNode(root, function walk(current) {
|
|
3512
|
+
return ts14.isIdentifier(current) && (typeof names === "string" ? current.text === names : names.has(current.text)) ? ts14.factory.createIdentifier(current.text) : ts14.visitEachChild(current, walk, context);
|
|
3555
3513
|
})]);
|
|
3556
3514
|
return result.transformed[0];
|
|
3557
3515
|
}
|
|
@@ -3638,11 +3596,11 @@ function compileInputTransformFields(inputs) {
|
|
|
3638
3596
|
}
|
|
3639
3597
|
|
|
3640
3598
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/component/src/handler.mjs
|
|
3641
|
-
import { compileClassDebugInfo, compileComponentClassMetadata, compileComponentFromMetadata, compileDeclareClassMetadata as compileDeclareClassMetadata3, compileDeclareComponentFromMetadata, CssSelector as CssSelector2, DEFAULT_INTERPOLATION_CONFIG as DEFAULT_INTERPOLATION_CONFIG2, DomElementSchemaRegistry, ExternalExpr as ExternalExpr6, FactoryTarget as FactoryTarget3, makeBindingParser as makeBindingParser2, R3TargetBinder, R3TemplateDependencyKind, SelectorMatcher as SelectorMatcher2, ViewEncapsulation as ViewEncapsulation2
|
|
3642
|
-
import
|
|
3599
|
+
import { compileClassDebugInfo, compileComponentClassMetadata, compileComponentFromMetadata, compileDeclareClassMetadata as compileDeclareClassMetadata3, compileDeclareComponentFromMetadata, compileDeferResolverFunction, CssSelector as CssSelector2, DEFAULT_INTERPOLATION_CONFIG as DEFAULT_INTERPOLATION_CONFIG2, DomElementSchemaRegistry, ExternalExpr as ExternalExpr6, FactoryTarget as FactoryTarget3, makeBindingParser as makeBindingParser2, outputAst as o2, R3TargetBinder, R3TemplateDependencyKind, SelectorMatcher as SelectorMatcher2, ViewEncapsulation as ViewEncapsulation2 } from "@angular/compiler";
|
|
3600
|
+
import ts26 from "typescript";
|
|
3643
3601
|
|
|
3644
3602
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/semantic_graph/src/api.mjs
|
|
3645
|
-
import
|
|
3603
|
+
import ts15 from "typescript";
|
|
3646
3604
|
var SemanticSymbol = class {
|
|
3647
3605
|
constructor(decl) {
|
|
3648
3606
|
this.decl = decl;
|
|
@@ -3651,7 +3609,7 @@ var SemanticSymbol = class {
|
|
|
3651
3609
|
}
|
|
3652
3610
|
};
|
|
3653
3611
|
function getSymbolIdentifier(decl) {
|
|
3654
|
-
if (!
|
|
3612
|
+
if (!ts15.isSourceFile(decl.parent)) {
|
|
3655
3613
|
return null;
|
|
3656
3614
|
}
|
|
3657
3615
|
return decl.name.text;
|
|
@@ -3801,7 +3759,7 @@ function getImportPath(expr) {
|
|
|
3801
3759
|
}
|
|
3802
3760
|
|
|
3803
3761
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/semantic_graph/src/type_parameters.mjs
|
|
3804
|
-
import
|
|
3762
|
+
import ts16 from "typescript";
|
|
3805
3763
|
|
|
3806
3764
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/semantic_graph/src/util.mjs
|
|
3807
3765
|
function isSymbolEqual(a, b) {
|
|
@@ -3855,7 +3813,7 @@ function isSetEqual(a, b, equalityTester = referenceEquality) {
|
|
|
3855
3813
|
|
|
3856
3814
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/incremental/semantic_graph/src/type_parameters.mjs
|
|
3857
3815
|
function extractSemanticTypeParameters(node) {
|
|
3858
|
-
if (!
|
|
3816
|
+
if (!ts16.isClassDeclaration(node) || node.typeParameters === void 0) {
|
|
3859
3817
|
return null;
|
|
3860
3818
|
}
|
|
3861
3819
|
return node.typeParameters.map((typeParam) => ({ hasGenericTypeBound: typeParam.constraint !== void 0 }));
|
|
@@ -3983,7 +3941,7 @@ var MetadataDtsModuleScopeResolver = class {
|
|
|
3983
3941
|
|
|
3984
3942
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/scope/src/local.mjs
|
|
3985
3943
|
import { ExternalExpr as ExternalExpr3 } from "@angular/compiler";
|
|
3986
|
-
import
|
|
3944
|
+
import ts17 from "typescript";
|
|
3987
3945
|
|
|
3988
3946
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/scope/src/util.mjs
|
|
3989
3947
|
function getDiagnosticNode(ref, rawExpr) {
|
|
@@ -4239,7 +4197,7 @@ var LocalModuleScopeRegistry = class {
|
|
|
4239
4197
|
}
|
|
4240
4198
|
getExportedScope(ref, diagnostics, ownerForErrors, type) {
|
|
4241
4199
|
if (ref.node.getSourceFile().isDeclarationFile) {
|
|
4242
|
-
if (!
|
|
4200
|
+
if (!ts17.isClassDeclaration(ref.node)) {
|
|
4243
4201
|
const code = type === "import" ? ErrorCode.NGMODULE_INVALID_IMPORT : ErrorCode.NGMODULE_INVALID_EXPORT;
|
|
4244
4202
|
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`));
|
|
4245
4203
|
return "invalid";
|
|
@@ -4352,7 +4310,7 @@ function reexportCollision(module, refA, refB) {
|
|
|
4352
4310
|
|
|
4353
4311
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/scope/src/typecheck.mjs
|
|
4354
4312
|
import { CssSelector, SelectorMatcher } from "@angular/compiler";
|
|
4355
|
-
import
|
|
4313
|
+
import ts18 from "typescript";
|
|
4356
4314
|
var TypeCheckScopeRegistry = class {
|
|
4357
4315
|
constructor(scopeReader, metaReader, hostDirectivesResolver) {
|
|
4358
4316
|
this.scopeReader = scopeReader;
|
|
@@ -4395,8 +4353,8 @@ var TypeCheckScopeRegistry = class {
|
|
|
4395
4353
|
matcher.addSelectables(CssSelector.parse(meta.selector), [...this.hostDirectivesResolver.resolve(directiveMeta), directiveMeta]);
|
|
4396
4354
|
directives.push(directiveMeta);
|
|
4397
4355
|
} else if (meta.kind === MetaKind.Pipe) {
|
|
4398
|
-
if (!
|
|
4399
|
-
throw new Error(`Unexpected non-class declaration ${
|
|
4356
|
+
if (!ts18.isClassDeclaration(meta.ref.node)) {
|
|
4357
|
+
throw new Error(`Unexpected non-class declaration ${ts18.SyntaxKind[meta.ref.node.kind]} for pipe ${meta.ref.debugName}`);
|
|
4400
4358
|
}
|
|
4401
4359
|
pipes.set(meta.name, meta);
|
|
4402
4360
|
}
|
|
@@ -4433,12 +4391,12 @@ import { compileClassMetadata, compileDeclareClassMetadata, compileDeclareDirect
|
|
|
4433
4391
|
|
|
4434
4392
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/directive/src/shared.mjs
|
|
4435
4393
|
import { createMayBeForwardRefExpression as createMayBeForwardRefExpression2, emitDistinctChangesOnlyDefaultValue, ExternalExpr as ExternalExpr4, getSafePropertyAccessString, parseHostBindings, verifyHostBindings, WrappedNodeExpr as WrappedNodeExpr5 } from "@angular/compiler";
|
|
4436
|
-
import
|
|
4394
|
+
import ts22 from "typescript";
|
|
4437
4395
|
|
|
4438
4396
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/directive/src/initializer_functions.mjs
|
|
4439
|
-
import
|
|
4397
|
+
import ts19 from "typescript";
|
|
4440
4398
|
function tryParseInitializerApiMember(functions, member, reflector, importTracker) {
|
|
4441
|
-
if (member.value === null || !
|
|
4399
|
+
if (member.value === null || !ts19.isCallExpression(member.value)) {
|
|
4442
4400
|
return null;
|
|
4443
4401
|
}
|
|
4444
4402
|
const call = member.value;
|
|
@@ -4458,7 +4416,7 @@ function tryParseInitializerApiMember(functions, member, reflector, importTracke
|
|
|
4458
4416
|
}
|
|
4459
4417
|
function parseTopLevelCall(call, functions, importTracker) {
|
|
4460
4418
|
const node = call.expression;
|
|
4461
|
-
if (!
|
|
4419
|
+
if (!ts19.isIdentifier(node)) {
|
|
4462
4420
|
return null;
|
|
4463
4421
|
}
|
|
4464
4422
|
const matchingApi = functions.find((fn) => importTracker.isPotentialReferenceToNamedImport(node, fn.functionName, fn.owningModule));
|
|
@@ -4469,7 +4427,7 @@ function parseTopLevelCall(call, functions, importTracker) {
|
|
|
4469
4427
|
}
|
|
4470
4428
|
function parseTopLevelRequiredCall(call, functions, importTracker) {
|
|
4471
4429
|
const node = call.expression;
|
|
4472
|
-
if (!
|
|
4430
|
+
if (!ts19.isPropertyAccessExpression(node) || !ts19.isIdentifier(node.expression) || node.name.text !== "required") {
|
|
4473
4431
|
return null;
|
|
4474
4432
|
}
|
|
4475
4433
|
const expression = node.expression;
|
|
@@ -4481,17 +4439,17 @@ function parseTopLevelRequiredCall(call, functions, importTracker) {
|
|
|
4481
4439
|
}
|
|
4482
4440
|
function parseTopLevelCallFromNamespace(call, functions, importTracker) {
|
|
4483
4441
|
const node = call.expression;
|
|
4484
|
-
if (!
|
|
4442
|
+
if (!ts19.isPropertyAccessExpression(node)) {
|
|
4485
4443
|
return null;
|
|
4486
4444
|
}
|
|
4487
4445
|
let apiReference = null;
|
|
4488
4446
|
let matchingApi = void 0;
|
|
4489
4447
|
let isRequired = false;
|
|
4490
|
-
if (
|
|
4448
|
+
if (ts19.isIdentifier(node.expression) && ts19.isIdentifier(node.name)) {
|
|
4491
4449
|
const namespaceRef = node.expression;
|
|
4492
4450
|
apiReference = node.name;
|
|
4493
4451
|
matchingApi = functions.find((fn) => node.name.text === fn.functionName && importTracker.isPotentialReferenceToNamespaceImport(namespaceRef, fn.owningModule));
|
|
4494
|
-
} else if (
|
|
4452
|
+
} else if (ts19.isPropertyAccessExpression(node.expression) && ts19.isIdentifier(node.expression.expression) && ts19.isIdentifier(node.expression.name) && node.name.text === "required") {
|
|
4495
4453
|
const potentialName = node.expression.name.text;
|
|
4496
4454
|
const namespaceRef = node.expression.expression;
|
|
4497
4455
|
apiReference = node.expression.name;
|
|
@@ -4505,16 +4463,16 @@ function parseTopLevelCallFromNamespace(call, functions, importTracker) {
|
|
|
4505
4463
|
}
|
|
4506
4464
|
|
|
4507
4465
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/directive/src/input_output_parse_options.mjs
|
|
4508
|
-
import
|
|
4466
|
+
import ts20 from "typescript";
|
|
4509
4467
|
function parseAndValidateInputAndOutputOptions(optionsNode) {
|
|
4510
|
-
if (!
|
|
4468
|
+
if (!ts20.isObjectLiteralExpression(optionsNode)) {
|
|
4511
4469
|
throw new FatalDiagnosticError(ErrorCode.VALUE_HAS_WRONG_TYPE, optionsNode, "Argument needs to be an object literal that is statically analyzable.");
|
|
4512
4470
|
}
|
|
4513
4471
|
const options = reflectObjectLiteral(optionsNode);
|
|
4514
4472
|
let alias = void 0;
|
|
4515
4473
|
if (options.has("alias")) {
|
|
4516
4474
|
const aliasExpr = options.get("alias");
|
|
4517
|
-
if (!
|
|
4475
|
+
if (!ts20.isStringLiteralLike(aliasExpr)) {
|
|
4518
4476
|
throw new FatalDiagnosticError(ErrorCode.VALUE_HAS_WRONG_TYPE, aliasExpr, "Alias needs to be a string that is statically analyzable.");
|
|
4519
4477
|
}
|
|
4520
4478
|
alias = aliasExpr.text;
|
|
@@ -4597,7 +4555,7 @@ function tryParseInitializerBasedOutput(member, reflector, importTracker) {
|
|
|
4597
4555
|
|
|
4598
4556
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/directive/src/query_functions.mjs
|
|
4599
4557
|
import { createMayBeForwardRefExpression, outputAst as o } from "@angular/compiler";
|
|
4600
|
-
import
|
|
4558
|
+
import ts21 from "typescript";
|
|
4601
4559
|
var queryFunctionNames = ["viewChild", "viewChildren", "contentChild", "contentChildren"];
|
|
4602
4560
|
var defaultDescendantsValue = (type) => type !== "contentChildren";
|
|
4603
4561
|
function tryParseSignalQueryFromInitializer(member, reflector, importTracker) {
|
|
@@ -4613,7 +4571,7 @@ function tryParseSignalQueryFromInitializer(member, reflector, importTracker) {
|
|
|
4613
4571
|
throw new FatalDiagnosticError(ErrorCode.VALUE_HAS_WRONG_TYPE, query.call, "No locator specified.");
|
|
4614
4572
|
}
|
|
4615
4573
|
const optionsNode = query.call.arguments[1];
|
|
4616
|
-
if (optionsNode !== void 0 && !
|
|
4574
|
+
if (optionsNode !== void 0 && !ts21.isObjectLiteralExpression(optionsNode)) {
|
|
4617
4575
|
throw new FatalDiagnosticError(ErrorCode.VALUE_HAS_WRONG_TYPE, optionsNode, "Argument needs to be an object literal.");
|
|
4618
4576
|
}
|
|
4619
4577
|
const options = optionsNode && reflectObjectLiteral(optionsNode);
|
|
@@ -4639,24 +4597,24 @@ function parseLocator(expression, reflector) {
|
|
|
4639
4597
|
if (unwrappedExpression !== null) {
|
|
4640
4598
|
expression = unwrappedExpression;
|
|
4641
4599
|
}
|
|
4642
|
-
if (
|
|
4600
|
+
if (ts21.isStringLiteralLike(expression)) {
|
|
4643
4601
|
return [expression.text];
|
|
4644
4602
|
}
|
|
4645
4603
|
return createMayBeForwardRefExpression(new o.WrappedNodeExpr(expression), unwrappedExpression !== null ? 2 : 0);
|
|
4646
4604
|
}
|
|
4647
4605
|
function parseReadOption(value) {
|
|
4648
|
-
if (
|
|
4606
|
+
if (ts21.isExpressionWithTypeArguments(value) || ts21.isParenthesizedExpression(value) || ts21.isAsExpression(value)) {
|
|
4649
4607
|
return parseReadOption(value.expression);
|
|
4650
4608
|
}
|
|
4651
|
-
if (
|
|
4609
|
+
if (ts21.isPropertyAccessExpression(value) && ts21.isIdentifier(value.expression) || ts21.isIdentifier(value)) {
|
|
4652
4610
|
return new o.WrappedNodeExpr(value);
|
|
4653
4611
|
}
|
|
4654
4612
|
throw new FatalDiagnosticError(ErrorCode.VALUE_NOT_LITERAL, value, `Query "read" option expected a literal class reference.`);
|
|
4655
4613
|
}
|
|
4656
4614
|
function parseDescendantsOption(value) {
|
|
4657
|
-
if (value.kind ===
|
|
4615
|
+
if (value.kind === ts21.SyntaxKind.TrueKeyword) {
|
|
4658
4616
|
return true;
|
|
4659
|
-
} else if (value.kind ===
|
|
4617
|
+
} else if (value.kind === ts21.SyntaxKind.FalseKeyword) {
|
|
4660
4618
|
return false;
|
|
4661
4619
|
}
|
|
4662
4620
|
throw new FatalDiagnosticError(ErrorCode.VALUE_HAS_WRONG_TYPE, value, `Expected "descendants" option to be a boolean literal.`);
|
|
@@ -4666,7 +4624,7 @@ function parseDescendantsOption(value) {
|
|
|
4666
4624
|
var EMPTY_OBJECT = {};
|
|
4667
4625
|
var queryDecoratorNames = ["ViewChild", "ViewChildren", "ContentChild", "ContentChildren"];
|
|
4668
4626
|
var QUERY_TYPES = new Set(queryDecoratorNames);
|
|
4669
|
-
function extractDirectiveMetadata(clazz, decorator, reflector, importTracker, evaluator, refEmitter, referencesRegistry, isCore, annotateForClosureCompiler, compilationMode, defaultSelector
|
|
4627
|
+
function extractDirectiveMetadata(clazz, decorator, reflector, importTracker, evaluator, refEmitter, referencesRegistry, isCore, annotateForClosureCompiler, compilationMode, defaultSelector) {
|
|
4670
4628
|
let directive;
|
|
4671
4629
|
if (decorator.args === null || decorator.args.length === 0) {
|
|
4672
4630
|
directive = /* @__PURE__ */ new Map();
|
|
@@ -4674,7 +4632,7 @@ function extractDirectiveMetadata(clazz, decorator, reflector, importTracker, ev
|
|
|
4674
4632
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, decorator.node, `Incorrect number of arguments to @${decorator.name} decorator`);
|
|
4675
4633
|
} else {
|
|
4676
4634
|
const meta = unwrapExpression(decorator.args[0]);
|
|
4677
|
-
if (!
|
|
4635
|
+
if (!ts22.isObjectLiteralExpression(meta)) {
|
|
4678
4636
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, meta, `@${decorator.name} argument must be an object literal`);
|
|
4679
4637
|
}
|
|
4680
4638
|
directive = reflectObjectLiteral(meta);
|
|
@@ -4768,8 +4726,7 @@ function extractDirectiveMetadata(clazz, decorator, reflector, importTracker, ev
|
|
|
4768
4726
|
name: clazz.name.text,
|
|
4769
4727
|
deps: ctorDeps,
|
|
4770
4728
|
host: {
|
|
4771
|
-
...host
|
|
4772
|
-
useTemplatePipeline
|
|
4729
|
+
...host
|
|
4773
4730
|
},
|
|
4774
4731
|
lifecycle: {
|
|
4775
4732
|
usesOnChanges
|
|
@@ -4824,7 +4781,7 @@ function extractDecoratorQueryMetadata(exprNode, name, args, propertyName, refle
|
|
|
4824
4781
|
let emitDistinctChangesOnly = emitDistinctChangesOnlyDefaultValue;
|
|
4825
4782
|
if (args.length === 2) {
|
|
4826
4783
|
const optionsExpr = unwrapExpression(args[1]);
|
|
4827
|
-
if (!
|
|
4784
|
+
if (!ts22.isObjectLiteralExpression(optionsExpr)) {
|
|
4828
4785
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, optionsExpr, `@${name} options must be an object literal`);
|
|
4829
4786
|
}
|
|
4830
4787
|
const options = reflectObjectLiteral(optionsExpr);
|
|
@@ -4923,16 +4880,16 @@ function extractHostBindings(members, evaluator, coreModule, compilationMode, me
|
|
|
4923
4880
|
function extractQueriesFromDecorator(queryData, reflector, evaluator, isCore) {
|
|
4924
4881
|
const content = [];
|
|
4925
4882
|
const view = [];
|
|
4926
|
-
if (!
|
|
4883
|
+
if (!ts22.isObjectLiteralExpression(queryData)) {
|
|
4927
4884
|
throw new FatalDiagnosticError(ErrorCode.VALUE_HAS_WRONG_TYPE, queryData, "Decorator queries metadata must be an object literal");
|
|
4928
4885
|
}
|
|
4929
4886
|
reflectObjectLiteral(queryData).forEach((queryExpr, propertyName) => {
|
|
4930
4887
|
queryExpr = unwrapExpression(queryExpr);
|
|
4931
|
-
if (!
|
|
4888
|
+
if (!ts22.isNewExpression(queryExpr)) {
|
|
4932
4889
|
throw new FatalDiagnosticError(ErrorCode.VALUE_HAS_WRONG_TYPE, queryData, "Decorator query metadata must be an instance of a query type");
|
|
4933
4890
|
}
|
|
4934
|
-
const queryType =
|
|
4935
|
-
if (!
|
|
4891
|
+
const queryType = ts22.isPropertyAccessExpression(queryExpr.expression) ? queryExpr.expression.name : queryExpr.expression;
|
|
4892
|
+
if (!ts22.isIdentifier(queryType)) {
|
|
4936
4893
|
throw new FatalDiagnosticError(ErrorCode.VALUE_HAS_WRONG_TYPE, queryData, "Decorator query metadata must be an instance of a query type");
|
|
4937
4894
|
}
|
|
4938
4895
|
const type = reflector.getImportOfIdentifier(queryType);
|
|
@@ -5180,7 +5137,7 @@ function parseDecoratorInputTransformFunction(clazz, classPropertyName, value, r
|
|
|
5180
5137
|
}
|
|
5181
5138
|
return {
|
|
5182
5139
|
node: node2,
|
|
5183
|
-
type: new Reference(
|
|
5140
|
+
type: new Reference(ts22.factory.createKeywordTypeNode(ts22.SyntaxKind.UnknownKeyword))
|
|
5184
5141
|
};
|
|
5185
5142
|
}
|
|
5186
5143
|
const definition = reflector.getDefinitionOfFunction(value.node);
|
|
@@ -5208,7 +5165,7 @@ function parseDecoratorInputTransformFunction(clazz, classPropertyName, value, r
|
|
|
5208
5165
|
if (!firstParam) {
|
|
5209
5166
|
return {
|
|
5210
5167
|
node,
|
|
5211
|
-
type: new Reference(
|
|
5168
|
+
type: new Reference(ts22.factory.createKeywordTypeNode(ts22.SyntaxKind.UnknownKeyword))
|
|
5212
5169
|
};
|
|
5213
5170
|
}
|
|
5214
5171
|
if (!firstParam.type) {
|
|
@@ -5223,7 +5180,7 @@ function parseDecoratorInputTransformFunction(clazz, classPropertyName, value, r
|
|
|
5223
5180
|
}
|
|
5224
5181
|
function assertEmittableInputType(type, contextFile, reflector, refEmitter) {
|
|
5225
5182
|
(function walk(node) {
|
|
5226
|
-
if (
|
|
5183
|
+
if (ts22.isTypeReferenceNode(node) && ts22.isIdentifier(node.typeName)) {
|
|
5227
5184
|
const declaration = reflector.getDeclarationOfIdentifier(node.typeName);
|
|
5228
5185
|
if (declaration !== null) {
|
|
5229
5186
|
if (declaration.node.getSourceFile() !== contextFile) {
|
|
@@ -5403,7 +5360,7 @@ function extractHostDirectives(rawHostDirectives, evaluator, compilationMode) {
|
|
|
5403
5360
|
let directive;
|
|
5404
5361
|
let nameForErrors = (fieldName) => "@Directive.hostDirectives";
|
|
5405
5362
|
if (compilationMode === CompilationMode.LOCAL && hostReference instanceof DynamicValue) {
|
|
5406
|
-
if (!
|
|
5363
|
+
if (!ts22.isIdentifier(hostReference.node) && !ts22.isPropertyAccessExpression(hostReference.node)) {
|
|
5407
5364
|
throw new FatalDiagnosticError(ErrorCode.LOCAL_COMPILATION_UNSUPPORTED_EXPRESSION, hostReference.node, `In local compilation mode, host directive cannot be an expression. Use an identifier instead`);
|
|
5408
5365
|
}
|
|
5409
5366
|
directive = new WrappedNodeExpr5(hostReference.node);
|
|
@@ -5560,7 +5517,7 @@ var LIFECYCLE_HOOKS = /* @__PURE__ */ new Set([
|
|
|
5560
5517
|
"ngAfterContentChecked"
|
|
5561
5518
|
]);
|
|
5562
5519
|
var DirectiveDecoratorHandler = class {
|
|
5563
|
-
constructor(reflector, evaluator, metaRegistry, scopeRegistry, metaReader, injectableRegistry, refEmitter, referencesRegistry, isCore, strictCtorDeps, semanticDepGraphUpdater, annotateForClosureCompiler, perf, importTracker, includeClassMetadata, compilationMode,
|
|
5520
|
+
constructor(reflector, evaluator, metaRegistry, scopeRegistry, metaReader, injectableRegistry, refEmitter, referencesRegistry, isCore, strictCtorDeps, semanticDepGraphUpdater, annotateForClosureCompiler, perf, importTracker, includeClassMetadata, compilationMode, generateExtraImportsInLocalMode) {
|
|
5564
5521
|
this.reflector = reflector;
|
|
5565
5522
|
this.evaluator = evaluator;
|
|
5566
5523
|
this.metaRegistry = metaRegistry;
|
|
@@ -5577,7 +5534,6 @@ var DirectiveDecoratorHandler = class {
|
|
|
5577
5534
|
this.importTracker = importTracker;
|
|
5578
5535
|
this.includeClassMetadata = includeClassMetadata;
|
|
5579
5536
|
this.compilationMode = compilationMode;
|
|
5580
|
-
this.useTemplatePipeline = useTemplatePipeline;
|
|
5581
5537
|
this.generateExtraImportsInLocalMode = generateExtraImportsInLocalMode;
|
|
5582
5538
|
this.precedence = HandlerPrecedence.PRIMARY;
|
|
5583
5539
|
this.name = "DirectiveDecoratorHandler";
|
|
@@ -5611,8 +5567,7 @@ var DirectiveDecoratorHandler = class {
|
|
|
5611
5567
|
this.isCore,
|
|
5612
5568
|
this.annotateForClosureCompiler,
|
|
5613
5569
|
this.compilationMode,
|
|
5614
|
-
null
|
|
5615
|
-
this.useTemplatePipeline
|
|
5570
|
+
null
|
|
5616
5571
|
);
|
|
5617
5572
|
if (directiveResult === void 0) {
|
|
5618
5573
|
return {};
|
|
@@ -5735,16 +5690,16 @@ var DirectiveDecoratorHandler = class {
|
|
|
5735
5690
|
|
|
5736
5691
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/ng_module/src/handler.mjs
|
|
5737
5692
|
import { compileClassMetadata as compileClassMetadata2, compileDeclareClassMetadata as compileDeclareClassMetadata2, compileDeclareInjectorFromMetadata, compileDeclareNgModuleFromMetadata, compileInjector, compileNgModule, ExternalExpr as ExternalExpr5, FactoryTarget as FactoryTarget2, FunctionExpr, InvokeFunctionExpr, LiteralArrayExpr as LiteralArrayExpr2, R3Identifiers, R3NgModuleMetadataKind, R3SelectorScopeMode, ReturnStatement, WrappedNodeExpr as WrappedNodeExpr7 } from "@angular/compiler";
|
|
5738
|
-
import
|
|
5693
|
+
import ts24 from "typescript";
|
|
5739
5694
|
|
|
5740
5695
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/ng_module/src/module_with_providers.mjs
|
|
5741
|
-
import
|
|
5696
|
+
import ts23 from "typescript";
|
|
5742
5697
|
function createModuleWithProvidersResolver(reflector, isCore) {
|
|
5743
5698
|
function _reflectModuleFromTypeParam(type, node) {
|
|
5744
|
-
if (!
|
|
5699
|
+
if (!ts23.isTypeReferenceNode(type)) {
|
|
5745
5700
|
return null;
|
|
5746
5701
|
}
|
|
5747
|
-
const typeName = type && (
|
|
5702
|
+
const typeName = type && (ts23.isIdentifier(type.typeName) && type.typeName || ts23.isQualifiedName(type.typeName) && type.typeName.right) || null;
|
|
5748
5703
|
if (typeName === null) {
|
|
5749
5704
|
return null;
|
|
5750
5705
|
}
|
|
@@ -5756,7 +5711,7 @@ function createModuleWithProvidersResolver(reflector, isCore) {
|
|
|
5756
5711
|
return null;
|
|
5757
5712
|
}
|
|
5758
5713
|
if (type.typeArguments === void 0 || type.typeArguments.length !== 1) {
|
|
5759
|
-
const parent =
|
|
5714
|
+
const parent = ts23.isMethodDeclaration(node) && ts23.isClassDeclaration(node.parent) ? node.parent : null;
|
|
5760
5715
|
const symbolName = (parent && parent.name ? parent.name.getText() + "." : "") + (node.name ? node.name.getText() : "anonymous");
|
|
5761
5716
|
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.`);
|
|
5762
5717
|
}
|
|
@@ -5764,15 +5719,15 @@ function createModuleWithProvidersResolver(reflector, isCore) {
|
|
|
5764
5719
|
return typeNodeToValueExpr(arg);
|
|
5765
5720
|
}
|
|
5766
5721
|
function _reflectModuleFromLiteralType(type) {
|
|
5767
|
-
if (!
|
|
5722
|
+
if (!ts23.isIntersectionTypeNode(type)) {
|
|
5768
5723
|
return null;
|
|
5769
5724
|
}
|
|
5770
5725
|
for (const t of type.types) {
|
|
5771
|
-
if (
|
|
5726
|
+
if (ts23.isTypeLiteralNode(t)) {
|
|
5772
5727
|
for (const m of t.members) {
|
|
5773
|
-
const ngModuleType =
|
|
5728
|
+
const ngModuleType = ts23.isPropertySignature(m) && ts23.isIdentifier(m.name) && m.name.text === "ngModule" && m.type || null;
|
|
5774
5729
|
let ngModuleExpression = null;
|
|
5775
|
-
if (ngModuleType !== null &&
|
|
5730
|
+
if (ngModuleType !== null && ts23.isTypeQueryNode(ngModuleType)) {
|
|
5776
5731
|
ngModuleExpression = entityNameToValue(ngModuleType.exprName);
|
|
5777
5732
|
} else if (ngModuleType !== null) {
|
|
5778
5733
|
ngModuleExpression = typeNodeToValueExpr(ngModuleType);
|
|
@@ -5920,8 +5875,8 @@ var NgModuleDecoratorHandler = class {
|
|
|
5920
5875
|
if (decorator.args === null || decorator.args.length > 1) {
|
|
5921
5876
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, decorator.node, `Incorrect number of arguments to @NgModule decorator`);
|
|
5922
5877
|
}
|
|
5923
|
-
const meta = decorator.args.length === 1 ? unwrapExpression(decorator.args[0]) :
|
|
5924
|
-
if (!
|
|
5878
|
+
const meta = decorator.args.length === 1 ? unwrapExpression(decorator.args[0]) : ts24.factory.createObjectLiteralExpression([]);
|
|
5879
|
+
if (!ts24.isObjectLiteralExpression(meta)) {
|
|
5925
5880
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, meta, "@NgModule argument must be an object literal");
|
|
5926
5881
|
}
|
|
5927
5882
|
const ngModule = reflectObjectLiteral(meta);
|
|
@@ -5994,7 +5949,7 @@ var NgModuleDecoratorHandler = class {
|
|
|
5994
5949
|
id = new WrappedNodeExpr7(idExpr);
|
|
5995
5950
|
} else {
|
|
5996
5951
|
const diag = makeDiagnostic(ErrorCode.WARN_NGMODULE_ID_UNNECESSARY, idExpr, `Using 'module.id' for NgModule.id is a common anti-pattern that is ignored by the Angular compiler.`);
|
|
5997
|
-
diag.category =
|
|
5952
|
+
diag.category = ts24.DiagnosticCategory.Warning;
|
|
5998
5953
|
diagnostics.push(diag);
|
|
5999
5954
|
}
|
|
6000
5955
|
}
|
|
@@ -6046,16 +6001,16 @@ var NgModuleDecoratorHandler = class {
|
|
|
6046
6001
|
}
|
|
6047
6002
|
const rawProviders = ngModule.has("providers") ? ngModule.get("providers") : null;
|
|
6048
6003
|
let wrappedProviders = null;
|
|
6049
|
-
if (rawProviders !== null && (!
|
|
6004
|
+
if (rawProviders !== null && (!ts24.isArrayLiteralExpression(rawProviders) || rawProviders.elements.length > 0)) {
|
|
6050
6005
|
wrappedProviders = new WrappedNodeExpr7(this.annotateForClosureCompiler ? wrapFunctionExpressionsInParens(rawProviders) : rawProviders);
|
|
6051
6006
|
}
|
|
6052
6007
|
const topLevelImports = [];
|
|
6053
6008
|
if (this.compilationMode !== CompilationMode.LOCAL && ngModule.has("imports")) {
|
|
6054
6009
|
const rawImports2 = unwrapExpression(ngModule.get("imports"));
|
|
6055
6010
|
let topLevelExpressions = [];
|
|
6056
|
-
if (
|
|
6011
|
+
if (ts24.isArrayLiteralExpression(rawImports2)) {
|
|
6057
6012
|
for (const element of rawImports2.elements) {
|
|
6058
|
-
if (
|
|
6013
|
+
if (ts24.isSpreadElement(element)) {
|
|
6059
6014
|
topLevelExpressions.push(element.expression);
|
|
6060
6015
|
continue;
|
|
6061
6016
|
}
|
|
@@ -6094,7 +6049,7 @@ var NgModuleDecoratorHandler = class {
|
|
|
6094
6049
|
if (exp === null) {
|
|
6095
6050
|
continue;
|
|
6096
6051
|
}
|
|
6097
|
-
if (
|
|
6052
|
+
if (ts24.isArrayLiteralExpression(exp)) {
|
|
6098
6053
|
if (exp.elements) {
|
|
6099
6054
|
injectorMetadata.imports.push(...exp.elements.map((n) => new WrappedNodeExpr7(n)));
|
|
6100
6055
|
}
|
|
@@ -6408,7 +6363,7 @@ function isNgModule(node, compilation) {
|
|
|
6408
6363
|
return !compilation.dependencies.some((dep) => dep.ref.node === node);
|
|
6409
6364
|
}
|
|
6410
6365
|
function isModuleIdExpression(expr) {
|
|
6411
|
-
return
|
|
6366
|
+
return ts24.isPropertyAccessExpression(expr) && ts24.isIdentifier(expr.expression) && expr.expression.text === "module" && expr.name.text === "id";
|
|
6412
6367
|
}
|
|
6413
6368
|
function makeStandaloneBootstrapDiagnostic(ngModuleClass, bootstrappedClassRef, rawBootstrapExpr) {
|
|
6414
6369
|
const componentClassName = bootstrappedClassRef.node.name.text;
|
|
@@ -6445,7 +6400,7 @@ function checkCustomElementSelectorForErrors(selector) {
|
|
|
6445
6400
|
|
|
6446
6401
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/component/src/resources.mjs
|
|
6447
6402
|
import { DEFAULT_INTERPOLATION_CONFIG, InterpolationConfig, ParseSourceFile as ParseSourceFile2, parseTemplate } from "@angular/compiler";
|
|
6448
|
-
import
|
|
6403
|
+
import ts25 from "typescript";
|
|
6449
6404
|
function getTemplateDeclarationNodeForError(declaration) {
|
|
6450
6405
|
return declaration.isInline ? declaration.expression : declaration.templateUrlExpression;
|
|
6451
6406
|
}
|
|
@@ -6457,7 +6412,7 @@ function extractTemplate(node, template, evaluator, depTracker, resourceLoader,
|
|
|
6457
6412
|
let sourceMapping;
|
|
6458
6413
|
let escapedString = false;
|
|
6459
6414
|
let sourceMapUrl;
|
|
6460
|
-
if (
|
|
6415
|
+
if (ts25.isStringLiteral(template.expression) || ts25.isNoSubstitutionTemplateLiteral(template.expression)) {
|
|
6461
6416
|
sourceParseRange = getTemplateRange(template.expression);
|
|
6462
6417
|
sourceStr = template.expression.getSourceFile().text;
|
|
6463
6418
|
templateContent = template.expression.text;
|
|
@@ -6634,7 +6589,7 @@ function preloadAndParseTemplate(evaluator, resourceLoader, depTracker, preanaly
|
|
|
6634
6589
|
}
|
|
6635
6590
|
function getTemplateRange(templateExpr) {
|
|
6636
6591
|
const startPos = templateExpr.getStart() + 1;
|
|
6637
|
-
const { line, character } =
|
|
6592
|
+
const { line, character } = ts25.getLineAndCharacterOfPosition(templateExpr.getSourceFile(), startPos);
|
|
6638
6593
|
return {
|
|
6639
6594
|
startPos,
|
|
6640
6595
|
startLine: line,
|
|
@@ -6667,7 +6622,7 @@ function transformDecoratorResources(dec, component, styles, template) {
|
|
|
6667
6622
|
const metadata = new Map(component);
|
|
6668
6623
|
if (metadata.has("templateUrl")) {
|
|
6669
6624
|
metadata.delete("templateUrl");
|
|
6670
|
-
metadata.set("template",
|
|
6625
|
+
metadata.set("template", ts25.factory.createStringLiteral(template.content));
|
|
6671
6626
|
}
|
|
6672
6627
|
if (metadata.has("styleUrls") || metadata.has("styleUrl") || metadata.has("styles")) {
|
|
6673
6628
|
metadata.delete("styles");
|
|
@@ -6676,20 +6631,20 @@ function transformDecoratorResources(dec, component, styles, template) {
|
|
|
6676
6631
|
if (styles.length > 0) {
|
|
6677
6632
|
const styleNodes = styles.reduce((result, style) => {
|
|
6678
6633
|
if (style.trim().length > 0) {
|
|
6679
|
-
result.push(
|
|
6634
|
+
result.push(ts25.factory.createStringLiteral(style));
|
|
6680
6635
|
}
|
|
6681
6636
|
return result;
|
|
6682
6637
|
}, []);
|
|
6683
6638
|
if (styleNodes.length > 0) {
|
|
6684
|
-
metadata.set("styles",
|
|
6639
|
+
metadata.set("styles", ts25.factory.createArrayLiteralExpression(styleNodes));
|
|
6685
6640
|
}
|
|
6686
6641
|
}
|
|
6687
6642
|
}
|
|
6688
6643
|
const newMetadataFields = [];
|
|
6689
6644
|
for (const [name, value] of metadata.entries()) {
|
|
6690
|
-
newMetadataFields.push(
|
|
6645
|
+
newMetadataFields.push(ts25.factory.createPropertyAssignment(name, value));
|
|
6691
6646
|
}
|
|
6692
|
-
return { ...dec, args: [
|
|
6647
|
+
return { ...dec, args: [ts25.factory.createObjectLiteralExpression(newMetadataFields)] };
|
|
6693
6648
|
}
|
|
6694
6649
|
function extractComponentStyleUrls(evaluator, component) {
|
|
6695
6650
|
const styleUrlsExpr = component.get("styleUrls");
|
|
@@ -6715,9 +6670,9 @@ function extractComponentStyleUrls(evaluator, component) {
|
|
|
6715
6670
|
}
|
|
6716
6671
|
function extractStyleUrlsFromExpression(evaluator, styleUrlsExpr) {
|
|
6717
6672
|
const styleUrls = [];
|
|
6718
|
-
if (
|
|
6673
|
+
if (ts25.isArrayLiteralExpression(styleUrlsExpr)) {
|
|
6719
6674
|
for (const styleUrlExpr of styleUrlsExpr.elements) {
|
|
6720
|
-
if (
|
|
6675
|
+
if (ts25.isSpreadElement(styleUrlExpr)) {
|
|
6721
6676
|
styleUrls.push(...extractStyleUrlsFromExpression(evaluator, styleUrlExpr.expression));
|
|
6722
6677
|
} else {
|
|
6723
6678
|
const styleUrl = evaluator.evaluate(styleUrlExpr);
|
|
@@ -6749,18 +6704,18 @@ function extractStyleUrlsFromExpression(evaluator, styleUrlsExpr) {
|
|
|
6749
6704
|
function extractStyleResources(resourceLoader, component, containingFile) {
|
|
6750
6705
|
const styles = /* @__PURE__ */ new Set();
|
|
6751
6706
|
function stringLiteralElements(array) {
|
|
6752
|
-
return array.elements.filter((e) =>
|
|
6707
|
+
return array.elements.filter((e) => ts25.isStringLiteralLike(e));
|
|
6753
6708
|
}
|
|
6754
6709
|
const styleUrlExpr = component.get("styleUrl");
|
|
6755
6710
|
const styleUrlsExpr = component.get("styleUrls");
|
|
6756
|
-
if (styleUrlsExpr !== void 0 &&
|
|
6711
|
+
if (styleUrlsExpr !== void 0 && ts25.isArrayLiteralExpression(styleUrlsExpr)) {
|
|
6757
6712
|
for (const expression of stringLiteralElements(styleUrlsExpr)) {
|
|
6758
6713
|
const resource = stringLiteralUrlToResource(resourceLoader, expression, containingFile);
|
|
6759
6714
|
if (resource !== null) {
|
|
6760
6715
|
styles.add(resource);
|
|
6761
6716
|
}
|
|
6762
6717
|
}
|
|
6763
|
-
} else if (styleUrlExpr !== void 0 &&
|
|
6718
|
+
} else if (styleUrlExpr !== void 0 && ts25.isStringLiteralLike(styleUrlExpr)) {
|
|
6764
6719
|
const resource = stringLiteralUrlToResource(resourceLoader, styleUrlExpr, containingFile);
|
|
6765
6720
|
if (resource !== null) {
|
|
6766
6721
|
styles.add(resource);
|
|
@@ -6768,11 +6723,11 @@ function extractStyleResources(resourceLoader, component, containingFile) {
|
|
|
6768
6723
|
}
|
|
6769
6724
|
const stylesExpr = component.get("styles");
|
|
6770
6725
|
if (stylesExpr !== void 0) {
|
|
6771
|
-
if (
|
|
6726
|
+
if (ts25.isArrayLiteralExpression(stylesExpr)) {
|
|
6772
6727
|
for (const expression of stringLiteralElements(stylesExpr)) {
|
|
6773
6728
|
styles.add({ path: null, expression });
|
|
6774
6729
|
}
|
|
6775
|
-
} else if (
|
|
6730
|
+
} else if (ts25.isStringLiteralLike(stylesExpr)) {
|
|
6776
6731
|
styles.add({ path: null, expression: stylesExpr });
|
|
6777
6732
|
}
|
|
6778
6733
|
}
|
|
@@ -6911,7 +6866,7 @@ var EMPTY_ARRAY2 = [];
|
|
|
6911
6866
|
var isUsedDirective = (decl) => decl.kind === R3TemplateDependencyKind.Directive;
|
|
6912
6867
|
var isUsedPipe = (decl) => decl.kind === R3TemplateDependencyKind.Pipe;
|
|
6913
6868
|
var ComponentDecoratorHandler = class {
|
|
6914
|
-
constructor(reflector, evaluator, metaRegistry, metaReader, scopeReader, dtsScopeReader, scopeRegistry, typeCheckScopeRegistry, resourceRegistry, isCore, strictCtorDeps, resourceLoader, rootDirs, defaultPreserveWhitespaces, i18nUseExternalIds, enableI18nLegacyMessageIdFormat, usePoisonedData, i18nNormalizeLineEndingsInICUs, moduleResolver, cycleAnalyzer, cycleHandlingStrategy, refEmitter, referencesRegistry, depTracker, injectableRegistry, semanticDepGraphUpdater, annotateForClosureCompiler, perf, hostDirectivesResolver, importTracker, includeClassMetadata, compilationMode, deferredSymbolTracker, forbidOrphanRendering, enableBlockSyntax,
|
|
6869
|
+
constructor(reflector, evaluator, metaRegistry, metaReader, scopeReader, dtsScopeReader, scopeRegistry, typeCheckScopeRegistry, resourceRegistry, isCore, strictCtorDeps, resourceLoader, rootDirs, defaultPreserveWhitespaces, i18nUseExternalIds, enableI18nLegacyMessageIdFormat, usePoisonedData, i18nNormalizeLineEndingsInICUs, moduleResolver, cycleAnalyzer, cycleHandlingStrategy, refEmitter, referencesRegistry, depTracker, injectableRegistry, semanticDepGraphUpdater, annotateForClosureCompiler, perf, hostDirectivesResolver, importTracker, includeClassMetadata, compilationMode, deferredSymbolTracker, forbidOrphanRendering, enableBlockSyntax, localCompilationExtraImportsTracker) {
|
|
6915
6870
|
this.reflector = reflector;
|
|
6916
6871
|
this.evaluator = evaluator;
|
|
6917
6872
|
this.metaRegistry = metaRegistry;
|
|
@@ -6947,7 +6902,6 @@ var ComponentDecoratorHandler = class {
|
|
|
6947
6902
|
this.deferredSymbolTracker = deferredSymbolTracker;
|
|
6948
6903
|
this.forbidOrphanRendering = forbidOrphanRendering;
|
|
6949
6904
|
this.enableBlockSyntax = enableBlockSyntax;
|
|
6950
|
-
this.useTemplatePipeline = useTemplatePipeline;
|
|
6951
6905
|
this.localCompilationExtraImportsTracker = localCompilationExtraImportsTracker;
|
|
6952
6906
|
this.literalCache = /* @__PURE__ */ new Map();
|
|
6953
6907
|
this.elementSchemaRegistry = new DomElementSchemaRegistry();
|
|
@@ -7025,7 +6979,7 @@ var ComponentDecoratorHandler = class {
|
|
|
7025
6979
|
this.literalCache.delete(decorator);
|
|
7026
6980
|
let diagnostics;
|
|
7027
6981
|
let isPoisoned = false;
|
|
7028
|
-
const directiveResult = extractDirectiveMetadata(node, decorator, this.reflector, this.importTracker, this.evaluator, this.refEmitter, this.referencesRegistry, this.isCore, this.annotateForClosureCompiler, this.compilationMode, this.elementSchemaRegistry.getDefaultComponentElementName()
|
|
6982
|
+
const directiveResult = extractDirectiveMetadata(node, decorator, this.reflector, this.importTracker, this.evaluator, this.refEmitter, this.referencesRegistry, this.isCore, this.annotateForClosureCompiler, this.compilationMode, this.elementSchemaRegistry.getDefaultComponentElementName());
|
|
7029
6983
|
if (directiveResult === void 0) {
|
|
7030
6984
|
return {};
|
|
7031
6985
|
}
|
|
@@ -7035,13 +6989,13 @@ var ComponentDecoratorHandler = class {
|
|
|
7035
6989
|
if (this.compilationMode !== CompilationMode.LOCAL) {
|
|
7036
6990
|
changeDetection = resolveEnumValue(this.evaluator, component, "changeDetection", "ChangeDetectionStrategy");
|
|
7037
6991
|
} else if (component.has("changeDetection")) {
|
|
7038
|
-
changeDetection = new
|
|
6992
|
+
changeDetection = new o2.WrappedNodeExpr(component.get("changeDetection"));
|
|
7039
6993
|
}
|
|
7040
6994
|
let animations = null;
|
|
7041
6995
|
let animationTriggerNames = null;
|
|
7042
6996
|
if (component.has("animations")) {
|
|
7043
6997
|
const animationExpression = component.get("animations");
|
|
7044
|
-
animations = new
|
|
6998
|
+
animations = new o2.WrappedNodeExpr(animationExpression);
|
|
7045
6999
|
const animationsValue = this.evaluator.evaluate(animationExpression, animationTriggerResolver);
|
|
7046
7000
|
animationTriggerNames = { includesDynamicAnimations: false, staticTriggerNames: [] };
|
|
7047
7001
|
collectAnimationNames(animationsValue, animationTriggerNames);
|
|
@@ -7060,7 +7014,7 @@ var ComponentDecoratorHandler = class {
|
|
|
7060
7014
|
if (component.has("viewProviders")) {
|
|
7061
7015
|
const viewProviders = component.get("viewProviders");
|
|
7062
7016
|
viewProvidersRequiringFactory = resolveProvidersRequiringFactory(viewProviders, this.reflector, this.evaluator);
|
|
7063
|
-
wrappedViewProviders = new
|
|
7017
|
+
wrappedViewProviders = new o2.WrappedNodeExpr(this.annotateForClosureCompiler ? wrapFunctionExpressionsInParens(viewProviders) : viewProviders);
|
|
7064
7018
|
}
|
|
7065
7019
|
if (component.has("providers")) {
|
|
7066
7020
|
providersRequiringFactory = resolveProvidersRequiringFactory(component.get("providers"), this.reflector, this.evaluator);
|
|
@@ -7195,8 +7149,9 @@ var ComponentDecoratorHandler = class {
|
|
|
7195
7149
|
if (metadata.isStandalone && rawDeferredImports !== null) {
|
|
7196
7150
|
const deferredTypes = this.collectExplicitlyDeferredSymbols(rawDeferredImports);
|
|
7197
7151
|
for (const [deferredType, importDetails] of deferredTypes) {
|
|
7198
|
-
explicitlyDeferredTypes != null ? explicitlyDeferredTypes : explicitlyDeferredTypes =
|
|
7199
|
-
explicitlyDeferredTypes.
|
|
7152
|
+
explicitlyDeferredTypes != null ? explicitlyDeferredTypes : explicitlyDeferredTypes = [];
|
|
7153
|
+
explicitlyDeferredTypes.push({
|
|
7154
|
+
symbolName: importDetails.name,
|
|
7200
7155
|
importPath: importDetails.from,
|
|
7201
7156
|
isDefaultImport: isDefaultImport(importDetails.node)
|
|
7202
7157
|
});
|
|
@@ -7221,8 +7176,7 @@ var ComponentDecoratorHandler = class {
|
|
|
7221
7176
|
viewProviders: wrappedViewProviders,
|
|
7222
7177
|
i18nUseExternalIds: this.i18nUseExternalIds,
|
|
7223
7178
|
relativeContextFilePath,
|
|
7224
|
-
rawImports: rawImports !== null ? new
|
|
7225
|
-
useTemplatePipeline: this.useTemplatePipeline
|
|
7179
|
+
rawImports: rawImports !== null ? new o2.WrappedNodeExpr(rawImports) : void 0
|
|
7226
7180
|
},
|
|
7227
7181
|
typeCheckMeta: extractDirectiveTypeCheckMeta(node, inputs, this.reflector),
|
|
7228
7182
|
classMetadata: this.includeClassMetadata ? extractClassMetadata(node, this.reflector, this.isCore, this.annotateForClosureCompiler, (dec) => transformDecoratorResources(dec, component, styles, template)) : null,
|
|
@@ -7328,7 +7282,7 @@ var ComponentDecoratorHandler = class {
|
|
|
7328
7282
|
}
|
|
7329
7283
|
typeCheck(ctx, node, meta) {
|
|
7330
7284
|
var _a;
|
|
7331
|
-
if (this.typeCheckScopeRegistry === null || !
|
|
7285
|
+
if (this.typeCheckScopeRegistry === null || !ts26.isClassDeclaration(node)) {
|
|
7332
7286
|
return;
|
|
7333
7287
|
}
|
|
7334
7288
|
if (meta.isPoisoned && !this.usePoisonedData) {
|
|
@@ -7348,6 +7302,7 @@ var ComponentDecoratorHandler = class {
|
|
|
7348
7302
|
return templateSemanticsChecker.getDiagnosticsForComponent(component);
|
|
7349
7303
|
}
|
|
7350
7304
|
resolve(node, analysis, symbol) {
|
|
7305
|
+
var _a;
|
|
7351
7306
|
const metadata = analysis.meta;
|
|
7352
7307
|
const diagnostics = [];
|
|
7353
7308
|
const context = getSourceFile(node);
|
|
@@ -7364,10 +7319,10 @@ var ComponentDecoratorHandler = class {
|
|
|
7364
7319
|
data = {
|
|
7365
7320
|
declarations: EMPTY_ARRAY2,
|
|
7366
7321
|
declarationListEmitMode: !analysis.meta.isStandalone || analysis.rawImports !== null ? 3 : 0,
|
|
7367
|
-
|
|
7322
|
+
deferPerBlockDependencies: this.locateDeferBlocksWithoutScope(analysis.template),
|
|
7368
7323
|
deferBlockDepsEmitMode: 1,
|
|
7369
7324
|
deferrableDeclToImportDecl: /* @__PURE__ */ new Map(),
|
|
7370
|
-
|
|
7325
|
+
deferPerComponentDependencies: (_a = analysis.explicitlyDeferredTypes) != null ? _a : []
|
|
7371
7326
|
};
|
|
7372
7327
|
if (this.localCompilationExtraImportsTracker === null) {
|
|
7373
7328
|
return { data };
|
|
@@ -7376,10 +7331,10 @@ var ComponentDecoratorHandler = class {
|
|
|
7376
7331
|
data = {
|
|
7377
7332
|
declarations: EMPTY_ARRAY2,
|
|
7378
7333
|
declarationListEmitMode: 0,
|
|
7379
|
-
|
|
7334
|
+
deferPerBlockDependencies: /* @__PURE__ */ new Map(),
|
|
7380
7335
|
deferBlockDepsEmitMode: 0,
|
|
7381
7336
|
deferrableDeclToImportDecl: /* @__PURE__ */ new Map(),
|
|
7382
|
-
|
|
7337
|
+
deferPerComponentDependencies: []
|
|
7383
7338
|
};
|
|
7384
7339
|
}
|
|
7385
7340
|
if (this.semanticDepGraphUpdater !== null && analysis.baseClass instanceof Reference) {
|
|
@@ -7490,7 +7445,7 @@ var ComponentDecoratorHandler = class {
|
|
|
7490
7445
|
}
|
|
7491
7446
|
const eagerDeclarations = Array.from(declarations.values()).filter((decl) => decl.kind === R3TemplateDependencyKind.NgModule || eagerlyUsed.has(decl.ref.node));
|
|
7492
7447
|
if (this.compilationMode !== CompilationMode.LOCAL) {
|
|
7493
|
-
this.resolveDeferBlocks(node, deferBlocks, declarations, data, analysis, eagerlyUsed
|
|
7448
|
+
this.resolveDeferBlocks(node, deferBlocks, declarations, data, analysis, eagerlyUsed);
|
|
7494
7449
|
}
|
|
7495
7450
|
const cyclesFromDirectives = /* @__PURE__ */ new Map();
|
|
7496
7451
|
const cyclesFromPipes = /* @__PURE__ */ new Map();
|
|
@@ -7550,7 +7505,7 @@ var ComponentDecoratorHandler = class {
|
|
|
7550
7505
|
}
|
|
7551
7506
|
}
|
|
7552
7507
|
} else {
|
|
7553
|
-
data.
|
|
7508
|
+
data.deferPerBlockDependencies = this.locateDeferBlocksWithoutScope(metadata.template);
|
|
7554
7509
|
}
|
|
7555
7510
|
if (this.compilationMode !== CompilationMode.LOCAL) {
|
|
7556
7511
|
if (analysis.resolvedImports !== null && analysis.rawImports !== null) {
|
|
@@ -7561,11 +7516,11 @@ var ComponentDecoratorHandler = class {
|
|
|
7561
7516
|
const importDiagnostics = validateStandaloneImports(analysis.resolvedDeferredImports, analysis.rawDeferredImports, this.metaReader, this.scopeReader, true);
|
|
7562
7517
|
diagnostics.push(...importDiagnostics);
|
|
7563
7518
|
}
|
|
7564
|
-
if (analysis.providersRequiringFactory !== null && analysis.meta.providers instanceof
|
|
7519
|
+
if (analysis.providersRequiringFactory !== null && analysis.meta.providers instanceof o2.WrappedNodeExpr) {
|
|
7565
7520
|
const providerDiagnostics = getProviderDiagnostics(analysis.providersRequiringFactory, analysis.meta.providers.node, this.injectableRegistry);
|
|
7566
7521
|
diagnostics.push(...providerDiagnostics);
|
|
7567
7522
|
}
|
|
7568
|
-
if (analysis.viewProvidersRequiringFactory !== null && analysis.meta.viewProviders instanceof
|
|
7523
|
+
if (analysis.viewProvidersRequiringFactory !== null && analysis.meta.viewProviders instanceof o2.WrappedNodeExpr) {
|
|
7569
7524
|
const viewProviderDiagnostics = getProviderDiagnostics(analysis.viewProvidersRequiringFactory, analysis.meta.viewProviders.node, this.injectableRegistry);
|
|
7570
7525
|
diagnostics.push(...viewProviderDiagnostics);
|
|
7571
7526
|
}
|
|
@@ -7619,12 +7574,10 @@ var ComponentDecoratorHandler = class {
|
|
|
7619
7574
|
return [];
|
|
7620
7575
|
}
|
|
7621
7576
|
const deferrableTypes = this.collectDeferredSymbols(resolution);
|
|
7622
|
-
const useTemplatePipeline = this.useTemplatePipeline;
|
|
7623
7577
|
const meta = {
|
|
7624
7578
|
...analysis.meta,
|
|
7625
7579
|
...resolution,
|
|
7626
|
-
|
|
7627
|
-
useTemplatePipeline
|
|
7580
|
+
defer: this.compileDeferBlocks(resolution)
|
|
7628
7581
|
};
|
|
7629
7582
|
const fac = compileNgFactoryDefField(toFactoryMetadata(meta, FactoryTarget3.Component));
|
|
7630
7583
|
removeDeferrableTypesFromComponentDecorator(analysis, deferrableTypes);
|
|
@@ -7643,13 +7596,12 @@ var ComponentDecoratorHandler = class {
|
|
|
7643
7596
|
content: analysis.template.content,
|
|
7644
7597
|
sourceUrl: analysis.template.declaration.resolvedTemplateUrl,
|
|
7645
7598
|
isInline: analysis.template.declaration.isInline,
|
|
7646
|
-
inlineTemplateLiteralExpression: analysis.template.sourceMapping.type === "direct" ? new
|
|
7599
|
+
inlineTemplateLiteralExpression: analysis.template.sourceMapping.type === "direct" ? new o2.WrappedNodeExpr(analysis.template.sourceMapping.node) : null
|
|
7647
7600
|
};
|
|
7648
|
-
const useTemplatePipeline = this.useTemplatePipeline;
|
|
7649
7601
|
const meta = {
|
|
7650
7602
|
...analysis.meta,
|
|
7651
7603
|
...resolution,
|
|
7652
|
-
|
|
7604
|
+
defer: this.compileDeferBlocks(resolution)
|
|
7653
7605
|
};
|
|
7654
7606
|
const fac = compileDeclareFactory(toFactoryMetadata(meta, FactoryTarget3.Component));
|
|
7655
7607
|
const inputTransformFields = compileInputTransformFields(analysis.inputs);
|
|
@@ -7662,12 +7614,10 @@ var ComponentDecoratorHandler = class {
|
|
|
7662
7614
|
return [];
|
|
7663
7615
|
}
|
|
7664
7616
|
const deferrableTypes = analysis.explicitlyDeferredTypes;
|
|
7665
|
-
const useTemplatePipeline = this.useTemplatePipeline;
|
|
7666
7617
|
const meta = {
|
|
7667
7618
|
...analysis.meta,
|
|
7668
7619
|
...resolution,
|
|
7669
|
-
|
|
7670
|
-
useTemplatePipeline
|
|
7620
|
+
defer: this.compileDeferBlocks(resolution)
|
|
7671
7621
|
};
|
|
7672
7622
|
if (analysis.explicitlyDeferredTypes !== null) {
|
|
7673
7623
|
removeDeferrableTypesFromComponentDecorator(analysis, analysis.explicitlyDeferredTypes);
|
|
@@ -7685,30 +7635,22 @@ var ComponentDecoratorHandler = class {
|
|
|
7685
7635
|
const directivelessBinder = new R3TargetBinder(new SelectorMatcher2());
|
|
7686
7636
|
const bound = directivelessBinder.bind({ template: template.nodes });
|
|
7687
7637
|
const deferredBlocks = bound.getDeferBlocks();
|
|
7688
|
-
const triggerElements = /* @__PURE__ */ new Map();
|
|
7689
7638
|
for (const block of deferredBlocks) {
|
|
7690
|
-
|
|
7691
|
-
this.resolveDeferTriggers(block, block.prefetchTriggers, bound, triggerElements);
|
|
7692
|
-
deferBlocks.set(block, { deps: [], triggerElements });
|
|
7639
|
+
deferBlocks.set(block, []);
|
|
7693
7640
|
}
|
|
7694
7641
|
return deferBlocks;
|
|
7695
7642
|
}
|
|
7696
7643
|
collectDeferredSymbols(resolution) {
|
|
7697
7644
|
var _a;
|
|
7698
|
-
const deferrableTypes =
|
|
7699
|
-
for (const [_,
|
|
7700
|
-
for (const deferBlockDep of
|
|
7701
|
-
const
|
|
7702
|
-
const classDecl = dep.classDeclaration;
|
|
7703
|
-
const importDecl = (_a = resolution.deferrableDeclToImportDecl.get(classDecl)) != null ? _a : null;
|
|
7645
|
+
const deferrableTypes = [];
|
|
7646
|
+
for (const [_, deps] of resolution.deferPerBlockDependencies) {
|
|
7647
|
+
for (const deferBlockDep of deps) {
|
|
7648
|
+
const importDecl = (_a = resolution.deferrableDeclToImportDecl.get(deferBlockDep.declaration.node)) != null ? _a : null;
|
|
7704
7649
|
if (importDecl !== null && this.deferredSymbolTracker.canDefer(importDecl)) {
|
|
7705
7650
|
deferBlockDep.isDeferrable = true;
|
|
7706
7651
|
deferBlockDep.importPath = importDecl.moduleSpecifier.text;
|
|
7707
7652
|
deferBlockDep.isDefaultImport = isDefaultImport(importDecl);
|
|
7708
|
-
deferrableTypes.
|
|
7709
|
-
importPath: deferBlockDep.importPath,
|
|
7710
|
-
isDefaultImport: deferBlockDep.isDefaultImport
|
|
7711
|
-
});
|
|
7653
|
+
deferrableTypes.push(deferBlockDep);
|
|
7712
7654
|
}
|
|
7713
7655
|
}
|
|
7714
7656
|
}
|
|
@@ -7716,12 +7658,12 @@ var ComponentDecoratorHandler = class {
|
|
|
7716
7658
|
}
|
|
7717
7659
|
collectExplicitlyDeferredSymbols(rawDeferredImports) {
|
|
7718
7660
|
const deferredTypes = /* @__PURE__ */ new Map();
|
|
7719
|
-
if (!
|
|
7661
|
+
if (!ts26.isArrayLiteralExpression(rawDeferredImports)) {
|
|
7720
7662
|
return deferredTypes;
|
|
7721
7663
|
}
|
|
7722
7664
|
for (const element of rawDeferredImports.elements) {
|
|
7723
7665
|
const node = tryUnwrapForwardRef(element, this.reflector) || element;
|
|
7724
|
-
if (!
|
|
7666
|
+
if (!ts26.isIdentifier(node)) {
|
|
7725
7667
|
continue;
|
|
7726
7668
|
}
|
|
7727
7669
|
const imp = this.reflector.getImportOfIdentifier(node);
|
|
@@ -7745,13 +7687,18 @@ var ComponentDecoratorHandler = class {
|
|
|
7745
7687
|
}
|
|
7746
7688
|
this.cycleAnalyzer.recordSyntheticImport(origin, imported);
|
|
7747
7689
|
}
|
|
7748
|
-
resolveDeferBlocks(componentClassDecl, deferBlocks, deferrableDecls, resolutionData, analysisData, eagerlyUsedDecls
|
|
7690
|
+
resolveDeferBlocks(componentClassDecl, deferBlocks, deferrableDecls, resolutionData, analysisData, eagerlyUsedDecls) {
|
|
7749
7691
|
const allDeferredDecls = /* @__PURE__ */ new Set();
|
|
7750
7692
|
for (const [deferBlock, bound] of deferBlocks) {
|
|
7751
7693
|
const usedDirectives = new Set(bound.getEagerlyUsedDirectives().map((d) => d.ref.node));
|
|
7752
7694
|
const usedPipes = new Set(bound.getEagerlyUsedPipes());
|
|
7753
|
-
|
|
7754
|
-
|
|
7695
|
+
let deps;
|
|
7696
|
+
if (resolutionData.deferPerBlockDependencies.has(deferBlock)) {
|
|
7697
|
+
deps = resolutionData.deferPerBlockDependencies.get(deferBlock);
|
|
7698
|
+
} else {
|
|
7699
|
+
deps = [];
|
|
7700
|
+
resolutionData.deferPerBlockDependencies.set(deferBlock, deps);
|
|
7701
|
+
}
|
|
7755
7702
|
for (const decl of Array.from(deferrableDecls.values())) {
|
|
7756
7703
|
if (decl.kind === R3TemplateDependencyKind.NgModule) {
|
|
7757
7704
|
continue;
|
|
@@ -7763,18 +7710,15 @@ var ComponentDecoratorHandler = class {
|
|
|
7763
7710
|
continue;
|
|
7764
7711
|
}
|
|
7765
7712
|
deps.push({
|
|
7766
|
-
|
|
7767
|
-
symbolName: decl.ref.node.name.
|
|
7713
|
+
typeReference: decl.type,
|
|
7714
|
+
symbolName: decl.ref.node.name.text,
|
|
7768
7715
|
isDeferrable: false,
|
|
7769
7716
|
importPath: null,
|
|
7770
7717
|
isDefaultImport: false,
|
|
7771
|
-
|
|
7718
|
+
declaration: decl.ref
|
|
7772
7719
|
});
|
|
7773
7720
|
allDeferredDecls.add(decl.ref.node);
|
|
7774
7721
|
}
|
|
7775
|
-
this.resolveDeferTriggers(deferBlock, deferBlock.triggers, componentBoundTarget, triggerElements);
|
|
7776
|
-
this.resolveDeferTriggers(deferBlock, deferBlock.prefetchTriggers, componentBoundTarget, triggerElements);
|
|
7777
|
-
resolutionData.deferBlocks.set(deferBlock, { deps, triggerElements });
|
|
7778
7722
|
}
|
|
7779
7723
|
if (analysisData.meta.isStandalone) {
|
|
7780
7724
|
if (analysisData.rawImports !== null) {
|
|
@@ -7786,12 +7730,12 @@ var ComponentDecoratorHandler = class {
|
|
|
7786
7730
|
}
|
|
7787
7731
|
}
|
|
7788
7732
|
registerDeferrableCandidates(componentClassDecl, importsExpr, isDeferredImport, allDeferredDecls, eagerlyUsedDecls, resolutionData) {
|
|
7789
|
-
if (!
|
|
7733
|
+
if (!ts26.isArrayLiteralExpression(importsExpr)) {
|
|
7790
7734
|
return;
|
|
7791
7735
|
}
|
|
7792
7736
|
for (const element of importsExpr.elements) {
|
|
7793
7737
|
const node = tryUnwrapForwardRef(element, this.reflector) || element;
|
|
7794
|
-
if (!
|
|
7738
|
+
if (!ts26.isIdentifier(node)) {
|
|
7795
7739
|
continue;
|
|
7796
7740
|
}
|
|
7797
7741
|
const imp = this.reflector.getImportOfIdentifier(node);
|
|
@@ -7826,11 +7770,28 @@ var ComponentDecoratorHandler = class {
|
|
|
7826
7770
|
this.deferredSymbolTracker.markAsDeferrableCandidate(node, imp.node, componentClassDecl, isDeferredImport);
|
|
7827
7771
|
}
|
|
7828
7772
|
}
|
|
7829
|
-
|
|
7830
|
-
|
|
7831
|
-
|
|
7832
|
-
|
|
7833
|
-
|
|
7773
|
+
compileDeferBlocks(resolution) {
|
|
7774
|
+
const { deferBlockDepsEmitMode: mode, deferPerBlockDependencies: perBlockDeps, deferPerComponentDependencies: perComponentDeps } = resolution;
|
|
7775
|
+
if (mode === 0) {
|
|
7776
|
+
if (!perBlockDeps) {
|
|
7777
|
+
throw new Error("Internal error: deferPerBlockDependencies must be present when compiling in PerBlock mode");
|
|
7778
|
+
}
|
|
7779
|
+
const blocks = /* @__PURE__ */ new Map();
|
|
7780
|
+
for (const [block, dependencies] of perBlockDeps) {
|
|
7781
|
+
blocks.set(block, dependencies.length === 0 ? null : compileDeferResolverFunction({ mode, dependencies }));
|
|
7782
|
+
}
|
|
7783
|
+
return { mode, blocks };
|
|
7784
|
+
}
|
|
7785
|
+
if (mode === 1) {
|
|
7786
|
+
if (!perComponentDeps) {
|
|
7787
|
+
throw new Error("Internal error: deferPerComponentDependencies must be present in PerComponent mode");
|
|
7788
|
+
}
|
|
7789
|
+
return {
|
|
7790
|
+
mode: 1,
|
|
7791
|
+
dependenciesFn: perComponentDeps.length === 0 ? null : compileDeferResolverFunction({ mode, dependencies: perComponentDeps })
|
|
7792
|
+
};
|
|
7793
|
+
}
|
|
7794
|
+
throw new Error(`Invalid deferBlockDepsEmitMode. Cannot compile deferred block metadata.`);
|
|
7834
7795
|
}
|
|
7835
7796
|
};
|
|
7836
7797
|
function createTargetBinder(dependencies) {
|
|
@@ -7856,9 +7817,9 @@ function extractPipes(dependencies) {
|
|
|
7856
7817
|
}
|
|
7857
7818
|
function removeDeferrableTypesFromComponentDecorator(analysis, deferrableTypes) {
|
|
7858
7819
|
if (analysis.classMetadata) {
|
|
7859
|
-
const deferrableSymbols = new Set(deferrableTypes.
|
|
7820
|
+
const deferrableSymbols = new Set(deferrableTypes.map((t) => t.symbolName));
|
|
7860
7821
|
const rewrittenDecoratorsNode = removeIdentifierReferences(analysis.classMetadata.decorators.node, deferrableSymbols);
|
|
7861
|
-
analysis.classMetadata.decorators = new
|
|
7822
|
+
analysis.classMetadata.decorators = new o2.WrappedNodeExpr(rewrittenDecoratorsNode);
|
|
7862
7823
|
}
|
|
7863
7824
|
}
|
|
7864
7825
|
function validateNoImportOverlap(eagerDeps, deferredDeps, rawDeferredImports) {
|
|
@@ -7907,8 +7868,8 @@ function isDefaultImport(node) {
|
|
|
7907
7868
|
}
|
|
7908
7869
|
|
|
7909
7870
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/src/injectable.mjs
|
|
7910
|
-
import { compileClassMetadata as compileClassMetadata3, compileDeclareClassMetadata as compileDeclareClassMetadata4, compileDeclareInjectableFromMetadata, compileInjectable, createMayBeForwardRefExpression as createMayBeForwardRefExpression3, FactoryTarget as FactoryTarget4, LiteralExpr as LiteralExpr3, WrappedNodeExpr as
|
|
7911
|
-
import
|
|
7871
|
+
import { compileClassMetadata as compileClassMetadata3, compileDeclareClassMetadata as compileDeclareClassMetadata4, compileDeclareInjectableFromMetadata, compileInjectable, createMayBeForwardRefExpression as createMayBeForwardRefExpression3, FactoryTarget as FactoryTarget4, LiteralExpr as LiteralExpr3, WrappedNodeExpr as WrappedNodeExpr8 } from "@angular/compiler";
|
|
7872
|
+
import ts27 from "typescript";
|
|
7912
7873
|
var InjectableDecoratorHandler = class {
|
|
7913
7874
|
constructor(reflector, evaluator, isCore, strictCtorDeps, injectableRegistry, perf, includeClassMetadata, compilationMode, errorOnDuplicateProv = true) {
|
|
7914
7875
|
this.reflector = reflector;
|
|
@@ -8028,7 +7989,7 @@ function extractInjectableMetadata(clazz, decorator, reflector) {
|
|
|
8028
7989
|
};
|
|
8029
7990
|
} else if (decorator.args.length === 1) {
|
|
8030
7991
|
const metaNode = decorator.args[0];
|
|
8031
|
-
if (!
|
|
7992
|
+
if (!ts27.isObjectLiteralExpression(metaNode)) {
|
|
8032
7993
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, metaNode, `@Injectable argument must be an object literal`);
|
|
8033
7994
|
}
|
|
8034
7995
|
const meta = reflectObjectLiteral(metaNode);
|
|
@@ -8036,7 +7997,7 @@ function extractInjectableMetadata(clazz, decorator, reflector) {
|
|
|
8036
7997
|
let deps = void 0;
|
|
8037
7998
|
if ((meta.has("useClass") || meta.has("useFactory")) && meta.has("deps")) {
|
|
8038
7999
|
const depsExpr = meta.get("deps");
|
|
8039
|
-
if (!
|
|
8000
|
+
if (!ts27.isArrayLiteralExpression(depsExpr)) {
|
|
8040
8001
|
throw new FatalDiagnosticError(ErrorCode.VALUE_NOT_LITERAL, depsExpr, `@Injectable deps metadata must be an inline array`);
|
|
8041
8002
|
}
|
|
8042
8003
|
deps = depsExpr.elements.map((dep) => getDep(dep, reflector));
|
|
@@ -8050,7 +8011,7 @@ function extractInjectableMetadata(clazz, decorator, reflector) {
|
|
|
8050
8011
|
result.useClass = getProviderExpression(meta.get("useClass"), reflector);
|
|
8051
8012
|
result.deps = deps;
|
|
8052
8013
|
} else if (meta.has("useFactory")) {
|
|
8053
|
-
result.useFactory = new
|
|
8014
|
+
result.useFactory = new WrappedNodeExpr8(meta.get("useFactory"));
|
|
8054
8015
|
result.deps = deps;
|
|
8055
8016
|
}
|
|
8056
8017
|
return result;
|
|
@@ -8060,7 +8021,7 @@ function extractInjectableMetadata(clazz, decorator, reflector) {
|
|
|
8060
8021
|
}
|
|
8061
8022
|
function getProviderExpression(expression, reflector) {
|
|
8062
8023
|
const forwardRefValue = tryUnwrapForwardRef(expression, reflector);
|
|
8063
|
-
return createMayBeForwardRefExpression3(new
|
|
8024
|
+
return createMayBeForwardRefExpression3(new WrappedNodeExpr8(forwardRefValue != null ? forwardRefValue : expression), forwardRefValue !== null ? 2 : 0);
|
|
8064
8025
|
}
|
|
8065
8026
|
function extractInjectableCtorDeps(clazz, meta, decorator, reflector, isCore, strictCtorDeps) {
|
|
8066
8027
|
if (decorator.args === null) {
|
|
@@ -8089,7 +8050,7 @@ function requiresValidCtor(meta) {
|
|
|
8089
8050
|
}
|
|
8090
8051
|
function getDep(dep, reflector) {
|
|
8091
8052
|
const meta = {
|
|
8092
|
-
token: new
|
|
8053
|
+
token: new WrappedNodeExpr8(dep),
|
|
8093
8054
|
attributeNameType: null,
|
|
8094
8055
|
host: false,
|
|
8095
8056
|
optional: false,
|
|
@@ -8104,7 +8065,7 @@ function getDep(dep, reflector) {
|
|
|
8104
8065
|
switch (source.name) {
|
|
8105
8066
|
case "Inject":
|
|
8106
8067
|
if (token !== void 0) {
|
|
8107
|
-
meta.token = new
|
|
8068
|
+
meta.token = new WrappedNodeExpr8(token);
|
|
8108
8069
|
}
|
|
8109
8070
|
break;
|
|
8110
8071
|
case "Optional":
|
|
@@ -8121,17 +8082,17 @@ function getDep(dep, reflector) {
|
|
|
8121
8082
|
}
|
|
8122
8083
|
return true;
|
|
8123
8084
|
}
|
|
8124
|
-
if (
|
|
8085
|
+
if (ts27.isArrayLiteralExpression(dep)) {
|
|
8125
8086
|
dep.elements.forEach((el) => {
|
|
8126
8087
|
let isDecorator = false;
|
|
8127
|
-
if (
|
|
8088
|
+
if (ts27.isIdentifier(el)) {
|
|
8128
8089
|
isDecorator = maybeUpdateDecorator(el, reflector);
|
|
8129
|
-
} else if (
|
|
8090
|
+
} else if (ts27.isNewExpression(el) && ts27.isIdentifier(el.expression)) {
|
|
8130
8091
|
const token = el.arguments && el.arguments.length > 0 && el.arguments[0] || void 0;
|
|
8131
8092
|
isDecorator = maybeUpdateDecorator(el.expression, reflector, token);
|
|
8132
8093
|
}
|
|
8133
8094
|
if (!isDecorator) {
|
|
8134
|
-
meta.token = new
|
|
8095
|
+
meta.token = new WrappedNodeExpr8(el);
|
|
8135
8096
|
}
|
|
8136
8097
|
});
|
|
8137
8098
|
}
|
|
@@ -8140,7 +8101,7 @@ function getDep(dep, reflector) {
|
|
|
8140
8101
|
|
|
8141
8102
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/src/pipe.mjs
|
|
8142
8103
|
import { compileClassMetadata as compileClassMetadata4, compileDeclareClassMetadata as compileDeclareClassMetadata5, compileDeclarePipeFromMetadata, compilePipeFromMetadata, FactoryTarget as FactoryTarget5 } from "@angular/compiler";
|
|
8143
|
-
import
|
|
8104
|
+
import ts28 from "typescript";
|
|
8144
8105
|
var PipeSymbol = class extends SemanticSymbol {
|
|
8145
8106
|
constructor(decl, name) {
|
|
8146
8107
|
super(decl);
|
|
@@ -8198,7 +8159,7 @@ var PipeDecoratorHandler = class {
|
|
|
8198
8159
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, decorator.node, "@Pipe must have exactly one argument");
|
|
8199
8160
|
}
|
|
8200
8161
|
const meta = unwrapExpression(decorator.args[0]);
|
|
8201
|
-
if (!
|
|
8162
|
+
if (!ts28.isObjectLiteralExpression(meta)) {
|
|
8202
8163
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, meta, "@Pipe must have a literal argument");
|
|
8203
8164
|
}
|
|
8204
8165
|
const pipe = reflectObjectLiteral(meta);
|
|
@@ -8314,7 +8275,6 @@ export {
|
|
|
8314
8275
|
CompilationMode,
|
|
8315
8276
|
aliasTransformFactory,
|
|
8316
8277
|
TraitCompiler,
|
|
8317
|
-
addImports,
|
|
8318
8278
|
DtsTransformRegistry,
|
|
8319
8279
|
declarationTransformFactory,
|
|
8320
8280
|
ivyTransformFactory,
|
|
@@ -8351,4 +8311,4 @@ export {
|
|
|
8351
8311
|
* Use of this source code is governed by an MIT-style license that can be
|
|
8352
8312
|
* found in the LICENSE file at https://angular.io/license
|
|
8353
8313
|
*/
|
|
8354
|
-
//# sourceMappingURL=chunk-
|
|
8314
|
+
//# sourceMappingURL=chunk-OHOBDHII.js.map
|