@angular/compiler-cli 18.0.0-next.0 → 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-SQY7XLGB.js → chunk-ALDR4XSX.js} +1107 -57
- package/bundles/chunk-ALDR4XSX.js.map +6 -0
- package/bundles/{chunk-4A7ZWBEL.js → chunk-AWB4ZG2D.js} +24 -24
- package/bundles/chunk-AWB4ZG2D.js.map +6 -0
- package/bundles/{chunk-64VF23SF.js → chunk-B454JZVO.js} +2 -2
- package/bundles/{chunk-NB6ZWAGP.js → chunk-C4L7A7U3.js} +16 -16
- 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-A46CQFUG.js → chunk-OHOBDHII.js} +174 -217
- 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/linker/src/file_linker/partial_linkers/util.d.ts +1 -1
- 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/core/src/core_version.d.ts +11 -0
- 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-4A7ZWBEL.js.map +0 -6
- package/bundles/chunk-6X7GQ6BQ.js.map +0 -6
- package/bundles/chunk-A46CQFUG.js.map +0 -6
- package/bundles/chunk-NB6ZWAGP.js.map +0 -6
- package/bundles/chunk-SQY7XLGB.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-64VF23SF.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
|
}
|
|
@@ -3639,10 +3597,10 @@ function compileInputTransformFields(inputs) {
|
|
|
3639
3597
|
|
|
3640
3598
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/component/src/handler.mjs
|
|
3641
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";
|
|
3642
|
-
import
|
|
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.`);
|
|
@@ -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);
|
|
@@ -4823,7 +4781,7 @@ function extractDecoratorQueryMetadata(exprNode, name, args, propertyName, refle
|
|
|
4823
4781
|
let emitDistinctChangesOnly = emitDistinctChangesOnlyDefaultValue;
|
|
4824
4782
|
if (args.length === 2) {
|
|
4825
4783
|
const optionsExpr = unwrapExpression(args[1]);
|
|
4826
|
-
if (!
|
|
4784
|
+
if (!ts22.isObjectLiteralExpression(optionsExpr)) {
|
|
4827
4785
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, optionsExpr, `@${name} options must be an object literal`);
|
|
4828
4786
|
}
|
|
4829
4787
|
const options = reflectObjectLiteral(optionsExpr);
|
|
@@ -4922,16 +4880,16 @@ function extractHostBindings(members, evaluator, coreModule, compilationMode, me
|
|
|
4922
4880
|
function extractQueriesFromDecorator(queryData, reflector, evaluator, isCore) {
|
|
4923
4881
|
const content = [];
|
|
4924
4882
|
const view = [];
|
|
4925
|
-
if (!
|
|
4883
|
+
if (!ts22.isObjectLiteralExpression(queryData)) {
|
|
4926
4884
|
throw new FatalDiagnosticError(ErrorCode.VALUE_HAS_WRONG_TYPE, queryData, "Decorator queries metadata must be an object literal");
|
|
4927
4885
|
}
|
|
4928
4886
|
reflectObjectLiteral(queryData).forEach((queryExpr, propertyName) => {
|
|
4929
4887
|
queryExpr = unwrapExpression(queryExpr);
|
|
4930
|
-
if (!
|
|
4888
|
+
if (!ts22.isNewExpression(queryExpr)) {
|
|
4931
4889
|
throw new FatalDiagnosticError(ErrorCode.VALUE_HAS_WRONG_TYPE, queryData, "Decorator query metadata must be an instance of a query type");
|
|
4932
4890
|
}
|
|
4933
|
-
const queryType =
|
|
4934
|
-
if (!
|
|
4891
|
+
const queryType = ts22.isPropertyAccessExpression(queryExpr.expression) ? queryExpr.expression.name : queryExpr.expression;
|
|
4892
|
+
if (!ts22.isIdentifier(queryType)) {
|
|
4935
4893
|
throw new FatalDiagnosticError(ErrorCode.VALUE_HAS_WRONG_TYPE, queryData, "Decorator query metadata must be an instance of a query type");
|
|
4936
4894
|
}
|
|
4937
4895
|
const type = reflector.getImportOfIdentifier(queryType);
|
|
@@ -5179,7 +5137,7 @@ function parseDecoratorInputTransformFunction(clazz, classPropertyName, value, r
|
|
|
5179
5137
|
}
|
|
5180
5138
|
return {
|
|
5181
5139
|
node: node2,
|
|
5182
|
-
type: new Reference(
|
|
5140
|
+
type: new Reference(ts22.factory.createKeywordTypeNode(ts22.SyntaxKind.UnknownKeyword))
|
|
5183
5141
|
};
|
|
5184
5142
|
}
|
|
5185
5143
|
const definition = reflector.getDefinitionOfFunction(value.node);
|
|
@@ -5207,7 +5165,7 @@ function parseDecoratorInputTransformFunction(clazz, classPropertyName, value, r
|
|
|
5207
5165
|
if (!firstParam) {
|
|
5208
5166
|
return {
|
|
5209
5167
|
node,
|
|
5210
|
-
type: new Reference(
|
|
5168
|
+
type: new Reference(ts22.factory.createKeywordTypeNode(ts22.SyntaxKind.UnknownKeyword))
|
|
5211
5169
|
};
|
|
5212
5170
|
}
|
|
5213
5171
|
if (!firstParam.type) {
|
|
@@ -5222,7 +5180,7 @@ function parseDecoratorInputTransformFunction(clazz, classPropertyName, value, r
|
|
|
5222
5180
|
}
|
|
5223
5181
|
function assertEmittableInputType(type, contextFile, reflector, refEmitter) {
|
|
5224
5182
|
(function walk(node) {
|
|
5225
|
-
if (
|
|
5183
|
+
if (ts22.isTypeReferenceNode(node) && ts22.isIdentifier(node.typeName)) {
|
|
5226
5184
|
const declaration = reflector.getDeclarationOfIdentifier(node.typeName);
|
|
5227
5185
|
if (declaration !== null) {
|
|
5228
5186
|
if (declaration.node.getSourceFile() !== contextFile) {
|
|
@@ -5402,7 +5360,7 @@ function extractHostDirectives(rawHostDirectives, evaluator, compilationMode) {
|
|
|
5402
5360
|
let directive;
|
|
5403
5361
|
let nameForErrors = (fieldName) => "@Directive.hostDirectives";
|
|
5404
5362
|
if (compilationMode === CompilationMode.LOCAL && hostReference instanceof DynamicValue) {
|
|
5405
|
-
if (!
|
|
5363
|
+
if (!ts22.isIdentifier(hostReference.node) && !ts22.isPropertyAccessExpression(hostReference.node)) {
|
|
5406
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`);
|
|
5407
5365
|
}
|
|
5408
5366
|
directive = new WrappedNodeExpr5(hostReference.node);
|
|
@@ -5732,16 +5690,16 @@ var DirectiveDecoratorHandler = class {
|
|
|
5732
5690
|
|
|
5733
5691
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/ng_module/src/handler.mjs
|
|
5734
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";
|
|
5735
|
-
import
|
|
5693
|
+
import ts24 from "typescript";
|
|
5736
5694
|
|
|
5737
5695
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/ng_module/src/module_with_providers.mjs
|
|
5738
|
-
import
|
|
5696
|
+
import ts23 from "typescript";
|
|
5739
5697
|
function createModuleWithProvidersResolver(reflector, isCore) {
|
|
5740
5698
|
function _reflectModuleFromTypeParam(type, node) {
|
|
5741
|
-
if (!
|
|
5699
|
+
if (!ts23.isTypeReferenceNode(type)) {
|
|
5742
5700
|
return null;
|
|
5743
5701
|
}
|
|
5744
|
-
const typeName = type && (
|
|
5702
|
+
const typeName = type && (ts23.isIdentifier(type.typeName) && type.typeName || ts23.isQualifiedName(type.typeName) && type.typeName.right) || null;
|
|
5745
5703
|
if (typeName === null) {
|
|
5746
5704
|
return null;
|
|
5747
5705
|
}
|
|
@@ -5753,7 +5711,7 @@ function createModuleWithProvidersResolver(reflector, isCore) {
|
|
|
5753
5711
|
return null;
|
|
5754
5712
|
}
|
|
5755
5713
|
if (type.typeArguments === void 0 || type.typeArguments.length !== 1) {
|
|
5756
|
-
const parent =
|
|
5714
|
+
const parent = ts23.isMethodDeclaration(node) && ts23.isClassDeclaration(node.parent) ? node.parent : null;
|
|
5757
5715
|
const symbolName = (parent && parent.name ? parent.name.getText() + "." : "") + (node.name ? node.name.getText() : "anonymous");
|
|
5758
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.`);
|
|
5759
5717
|
}
|
|
@@ -5761,15 +5719,15 @@ function createModuleWithProvidersResolver(reflector, isCore) {
|
|
|
5761
5719
|
return typeNodeToValueExpr(arg);
|
|
5762
5720
|
}
|
|
5763
5721
|
function _reflectModuleFromLiteralType(type) {
|
|
5764
|
-
if (!
|
|
5722
|
+
if (!ts23.isIntersectionTypeNode(type)) {
|
|
5765
5723
|
return null;
|
|
5766
5724
|
}
|
|
5767
5725
|
for (const t of type.types) {
|
|
5768
|
-
if (
|
|
5726
|
+
if (ts23.isTypeLiteralNode(t)) {
|
|
5769
5727
|
for (const m of t.members) {
|
|
5770
|
-
const ngModuleType =
|
|
5728
|
+
const ngModuleType = ts23.isPropertySignature(m) && ts23.isIdentifier(m.name) && m.name.text === "ngModule" && m.type || null;
|
|
5771
5729
|
let ngModuleExpression = null;
|
|
5772
|
-
if (ngModuleType !== null &&
|
|
5730
|
+
if (ngModuleType !== null && ts23.isTypeQueryNode(ngModuleType)) {
|
|
5773
5731
|
ngModuleExpression = entityNameToValue(ngModuleType.exprName);
|
|
5774
5732
|
} else if (ngModuleType !== null) {
|
|
5775
5733
|
ngModuleExpression = typeNodeToValueExpr(ngModuleType);
|
|
@@ -5917,8 +5875,8 @@ var NgModuleDecoratorHandler = class {
|
|
|
5917
5875
|
if (decorator.args === null || decorator.args.length > 1) {
|
|
5918
5876
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, decorator.node, `Incorrect number of arguments to @NgModule decorator`);
|
|
5919
5877
|
}
|
|
5920
|
-
const meta = decorator.args.length === 1 ? unwrapExpression(decorator.args[0]) :
|
|
5921
|
-
if (!
|
|
5878
|
+
const meta = decorator.args.length === 1 ? unwrapExpression(decorator.args[0]) : ts24.factory.createObjectLiteralExpression([]);
|
|
5879
|
+
if (!ts24.isObjectLiteralExpression(meta)) {
|
|
5922
5880
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, meta, "@NgModule argument must be an object literal");
|
|
5923
5881
|
}
|
|
5924
5882
|
const ngModule = reflectObjectLiteral(meta);
|
|
@@ -5991,7 +5949,7 @@ var NgModuleDecoratorHandler = class {
|
|
|
5991
5949
|
id = new WrappedNodeExpr7(idExpr);
|
|
5992
5950
|
} else {
|
|
5993
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.`);
|
|
5994
|
-
diag.category =
|
|
5952
|
+
diag.category = ts24.DiagnosticCategory.Warning;
|
|
5995
5953
|
diagnostics.push(diag);
|
|
5996
5954
|
}
|
|
5997
5955
|
}
|
|
@@ -6043,16 +6001,16 @@ var NgModuleDecoratorHandler = class {
|
|
|
6043
6001
|
}
|
|
6044
6002
|
const rawProviders = ngModule.has("providers") ? ngModule.get("providers") : null;
|
|
6045
6003
|
let wrappedProviders = null;
|
|
6046
|
-
if (rawProviders !== null && (!
|
|
6004
|
+
if (rawProviders !== null && (!ts24.isArrayLiteralExpression(rawProviders) || rawProviders.elements.length > 0)) {
|
|
6047
6005
|
wrappedProviders = new WrappedNodeExpr7(this.annotateForClosureCompiler ? wrapFunctionExpressionsInParens(rawProviders) : rawProviders);
|
|
6048
6006
|
}
|
|
6049
6007
|
const topLevelImports = [];
|
|
6050
6008
|
if (this.compilationMode !== CompilationMode.LOCAL && ngModule.has("imports")) {
|
|
6051
6009
|
const rawImports2 = unwrapExpression(ngModule.get("imports"));
|
|
6052
6010
|
let topLevelExpressions = [];
|
|
6053
|
-
if (
|
|
6011
|
+
if (ts24.isArrayLiteralExpression(rawImports2)) {
|
|
6054
6012
|
for (const element of rawImports2.elements) {
|
|
6055
|
-
if (
|
|
6013
|
+
if (ts24.isSpreadElement(element)) {
|
|
6056
6014
|
topLevelExpressions.push(element.expression);
|
|
6057
6015
|
continue;
|
|
6058
6016
|
}
|
|
@@ -6091,7 +6049,7 @@ var NgModuleDecoratorHandler = class {
|
|
|
6091
6049
|
if (exp === null) {
|
|
6092
6050
|
continue;
|
|
6093
6051
|
}
|
|
6094
|
-
if (
|
|
6052
|
+
if (ts24.isArrayLiteralExpression(exp)) {
|
|
6095
6053
|
if (exp.elements) {
|
|
6096
6054
|
injectorMetadata.imports.push(...exp.elements.map((n) => new WrappedNodeExpr7(n)));
|
|
6097
6055
|
}
|
|
@@ -6405,7 +6363,7 @@ function isNgModule(node, compilation) {
|
|
|
6405
6363
|
return !compilation.dependencies.some((dep) => dep.ref.node === node);
|
|
6406
6364
|
}
|
|
6407
6365
|
function isModuleIdExpression(expr) {
|
|
6408
|
-
return
|
|
6366
|
+
return ts24.isPropertyAccessExpression(expr) && ts24.isIdentifier(expr.expression) && expr.expression.text === "module" && expr.name.text === "id";
|
|
6409
6367
|
}
|
|
6410
6368
|
function makeStandaloneBootstrapDiagnostic(ngModuleClass, bootstrappedClassRef, rawBootstrapExpr) {
|
|
6411
6369
|
const componentClassName = bootstrappedClassRef.node.name.text;
|
|
@@ -6442,7 +6400,7 @@ function checkCustomElementSelectorForErrors(selector) {
|
|
|
6442
6400
|
|
|
6443
6401
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/component/src/resources.mjs
|
|
6444
6402
|
import { DEFAULT_INTERPOLATION_CONFIG, InterpolationConfig, ParseSourceFile as ParseSourceFile2, parseTemplate } from "@angular/compiler";
|
|
6445
|
-
import
|
|
6403
|
+
import ts25 from "typescript";
|
|
6446
6404
|
function getTemplateDeclarationNodeForError(declaration) {
|
|
6447
6405
|
return declaration.isInline ? declaration.expression : declaration.templateUrlExpression;
|
|
6448
6406
|
}
|
|
@@ -6454,7 +6412,7 @@ function extractTemplate(node, template, evaluator, depTracker, resourceLoader,
|
|
|
6454
6412
|
let sourceMapping;
|
|
6455
6413
|
let escapedString = false;
|
|
6456
6414
|
let sourceMapUrl;
|
|
6457
|
-
if (
|
|
6415
|
+
if (ts25.isStringLiteral(template.expression) || ts25.isNoSubstitutionTemplateLiteral(template.expression)) {
|
|
6458
6416
|
sourceParseRange = getTemplateRange(template.expression);
|
|
6459
6417
|
sourceStr = template.expression.getSourceFile().text;
|
|
6460
6418
|
templateContent = template.expression.text;
|
|
@@ -6631,7 +6589,7 @@ function preloadAndParseTemplate(evaluator, resourceLoader, depTracker, preanaly
|
|
|
6631
6589
|
}
|
|
6632
6590
|
function getTemplateRange(templateExpr) {
|
|
6633
6591
|
const startPos = templateExpr.getStart() + 1;
|
|
6634
|
-
const { line, character } =
|
|
6592
|
+
const { line, character } = ts25.getLineAndCharacterOfPosition(templateExpr.getSourceFile(), startPos);
|
|
6635
6593
|
return {
|
|
6636
6594
|
startPos,
|
|
6637
6595
|
startLine: line,
|
|
@@ -6664,7 +6622,7 @@ function transformDecoratorResources(dec, component, styles, template) {
|
|
|
6664
6622
|
const metadata = new Map(component);
|
|
6665
6623
|
if (metadata.has("templateUrl")) {
|
|
6666
6624
|
metadata.delete("templateUrl");
|
|
6667
|
-
metadata.set("template",
|
|
6625
|
+
metadata.set("template", ts25.factory.createStringLiteral(template.content));
|
|
6668
6626
|
}
|
|
6669
6627
|
if (metadata.has("styleUrls") || metadata.has("styleUrl") || metadata.has("styles")) {
|
|
6670
6628
|
metadata.delete("styles");
|
|
@@ -6673,20 +6631,20 @@ function transformDecoratorResources(dec, component, styles, template) {
|
|
|
6673
6631
|
if (styles.length > 0) {
|
|
6674
6632
|
const styleNodes = styles.reduce((result, style) => {
|
|
6675
6633
|
if (style.trim().length > 0) {
|
|
6676
|
-
result.push(
|
|
6634
|
+
result.push(ts25.factory.createStringLiteral(style));
|
|
6677
6635
|
}
|
|
6678
6636
|
return result;
|
|
6679
6637
|
}, []);
|
|
6680
6638
|
if (styleNodes.length > 0) {
|
|
6681
|
-
metadata.set("styles",
|
|
6639
|
+
metadata.set("styles", ts25.factory.createArrayLiteralExpression(styleNodes));
|
|
6682
6640
|
}
|
|
6683
6641
|
}
|
|
6684
6642
|
}
|
|
6685
6643
|
const newMetadataFields = [];
|
|
6686
6644
|
for (const [name, value] of metadata.entries()) {
|
|
6687
|
-
newMetadataFields.push(
|
|
6645
|
+
newMetadataFields.push(ts25.factory.createPropertyAssignment(name, value));
|
|
6688
6646
|
}
|
|
6689
|
-
return { ...dec, args: [
|
|
6647
|
+
return { ...dec, args: [ts25.factory.createObjectLiteralExpression(newMetadataFields)] };
|
|
6690
6648
|
}
|
|
6691
6649
|
function extractComponentStyleUrls(evaluator, component) {
|
|
6692
6650
|
const styleUrlsExpr = component.get("styleUrls");
|
|
@@ -6712,9 +6670,9 @@ function extractComponentStyleUrls(evaluator, component) {
|
|
|
6712
6670
|
}
|
|
6713
6671
|
function extractStyleUrlsFromExpression(evaluator, styleUrlsExpr) {
|
|
6714
6672
|
const styleUrls = [];
|
|
6715
|
-
if (
|
|
6673
|
+
if (ts25.isArrayLiteralExpression(styleUrlsExpr)) {
|
|
6716
6674
|
for (const styleUrlExpr of styleUrlsExpr.elements) {
|
|
6717
|
-
if (
|
|
6675
|
+
if (ts25.isSpreadElement(styleUrlExpr)) {
|
|
6718
6676
|
styleUrls.push(...extractStyleUrlsFromExpression(evaluator, styleUrlExpr.expression));
|
|
6719
6677
|
} else {
|
|
6720
6678
|
const styleUrl = evaluator.evaluate(styleUrlExpr);
|
|
@@ -6746,18 +6704,18 @@ function extractStyleUrlsFromExpression(evaluator, styleUrlsExpr) {
|
|
|
6746
6704
|
function extractStyleResources(resourceLoader, component, containingFile) {
|
|
6747
6705
|
const styles = /* @__PURE__ */ new Set();
|
|
6748
6706
|
function stringLiteralElements(array) {
|
|
6749
|
-
return array.elements.filter((e) =>
|
|
6707
|
+
return array.elements.filter((e) => ts25.isStringLiteralLike(e));
|
|
6750
6708
|
}
|
|
6751
6709
|
const styleUrlExpr = component.get("styleUrl");
|
|
6752
6710
|
const styleUrlsExpr = component.get("styleUrls");
|
|
6753
|
-
if (styleUrlsExpr !== void 0 &&
|
|
6711
|
+
if (styleUrlsExpr !== void 0 && ts25.isArrayLiteralExpression(styleUrlsExpr)) {
|
|
6754
6712
|
for (const expression of stringLiteralElements(styleUrlsExpr)) {
|
|
6755
6713
|
const resource = stringLiteralUrlToResource(resourceLoader, expression, containingFile);
|
|
6756
6714
|
if (resource !== null) {
|
|
6757
6715
|
styles.add(resource);
|
|
6758
6716
|
}
|
|
6759
6717
|
}
|
|
6760
|
-
} else if (styleUrlExpr !== void 0 &&
|
|
6718
|
+
} else if (styleUrlExpr !== void 0 && ts25.isStringLiteralLike(styleUrlExpr)) {
|
|
6761
6719
|
const resource = stringLiteralUrlToResource(resourceLoader, styleUrlExpr, containingFile);
|
|
6762
6720
|
if (resource !== null) {
|
|
6763
6721
|
styles.add(resource);
|
|
@@ -6765,11 +6723,11 @@ function extractStyleResources(resourceLoader, component, containingFile) {
|
|
|
6765
6723
|
}
|
|
6766
6724
|
const stylesExpr = component.get("styles");
|
|
6767
6725
|
if (stylesExpr !== void 0) {
|
|
6768
|
-
if (
|
|
6726
|
+
if (ts25.isArrayLiteralExpression(stylesExpr)) {
|
|
6769
6727
|
for (const expression of stringLiteralElements(stylesExpr)) {
|
|
6770
6728
|
styles.add({ path: null, expression });
|
|
6771
6729
|
}
|
|
6772
|
-
} else if (
|
|
6730
|
+
} else if (ts25.isStringLiteralLike(stylesExpr)) {
|
|
6773
6731
|
styles.add({ path: null, expression: stylesExpr });
|
|
6774
6732
|
}
|
|
6775
6733
|
}
|
|
@@ -7324,7 +7282,7 @@ var ComponentDecoratorHandler = class {
|
|
|
7324
7282
|
}
|
|
7325
7283
|
typeCheck(ctx, node, meta) {
|
|
7326
7284
|
var _a;
|
|
7327
|
-
if (this.typeCheckScopeRegistry === null || !
|
|
7285
|
+
if (this.typeCheckScopeRegistry === null || !ts26.isClassDeclaration(node)) {
|
|
7328
7286
|
return;
|
|
7329
7287
|
}
|
|
7330
7288
|
if (meta.isPoisoned && !this.usePoisonedData) {
|
|
@@ -7700,12 +7658,12 @@ var ComponentDecoratorHandler = class {
|
|
|
7700
7658
|
}
|
|
7701
7659
|
collectExplicitlyDeferredSymbols(rawDeferredImports) {
|
|
7702
7660
|
const deferredTypes = /* @__PURE__ */ new Map();
|
|
7703
|
-
if (!
|
|
7661
|
+
if (!ts26.isArrayLiteralExpression(rawDeferredImports)) {
|
|
7704
7662
|
return deferredTypes;
|
|
7705
7663
|
}
|
|
7706
7664
|
for (const element of rawDeferredImports.elements) {
|
|
7707
7665
|
const node = tryUnwrapForwardRef(element, this.reflector) || element;
|
|
7708
|
-
if (!
|
|
7666
|
+
if (!ts26.isIdentifier(node)) {
|
|
7709
7667
|
continue;
|
|
7710
7668
|
}
|
|
7711
7669
|
const imp = this.reflector.getImportOfIdentifier(node);
|
|
@@ -7772,12 +7730,12 @@ var ComponentDecoratorHandler = class {
|
|
|
7772
7730
|
}
|
|
7773
7731
|
}
|
|
7774
7732
|
registerDeferrableCandidates(componentClassDecl, importsExpr, isDeferredImport, allDeferredDecls, eagerlyUsedDecls, resolutionData) {
|
|
7775
|
-
if (!
|
|
7733
|
+
if (!ts26.isArrayLiteralExpression(importsExpr)) {
|
|
7776
7734
|
return;
|
|
7777
7735
|
}
|
|
7778
7736
|
for (const element of importsExpr.elements) {
|
|
7779
7737
|
const node = tryUnwrapForwardRef(element, this.reflector) || element;
|
|
7780
|
-
if (!
|
|
7738
|
+
if (!ts26.isIdentifier(node)) {
|
|
7781
7739
|
continue;
|
|
7782
7740
|
}
|
|
7783
7741
|
const imp = this.reflector.getImportOfIdentifier(node);
|
|
@@ -7911,7 +7869,7 @@ function isDefaultImport(node) {
|
|
|
7911
7869
|
|
|
7912
7870
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/src/injectable.mjs
|
|
7913
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";
|
|
7914
|
-
import
|
|
7872
|
+
import ts27 from "typescript";
|
|
7915
7873
|
var InjectableDecoratorHandler = class {
|
|
7916
7874
|
constructor(reflector, evaluator, isCore, strictCtorDeps, injectableRegistry, perf, includeClassMetadata, compilationMode, errorOnDuplicateProv = true) {
|
|
7917
7875
|
this.reflector = reflector;
|
|
@@ -8031,7 +7989,7 @@ function extractInjectableMetadata(clazz, decorator, reflector) {
|
|
|
8031
7989
|
};
|
|
8032
7990
|
} else if (decorator.args.length === 1) {
|
|
8033
7991
|
const metaNode = decorator.args[0];
|
|
8034
|
-
if (!
|
|
7992
|
+
if (!ts27.isObjectLiteralExpression(metaNode)) {
|
|
8035
7993
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, metaNode, `@Injectable argument must be an object literal`);
|
|
8036
7994
|
}
|
|
8037
7995
|
const meta = reflectObjectLiteral(metaNode);
|
|
@@ -8039,7 +7997,7 @@ function extractInjectableMetadata(clazz, decorator, reflector) {
|
|
|
8039
7997
|
let deps = void 0;
|
|
8040
7998
|
if ((meta.has("useClass") || meta.has("useFactory")) && meta.has("deps")) {
|
|
8041
7999
|
const depsExpr = meta.get("deps");
|
|
8042
|
-
if (!
|
|
8000
|
+
if (!ts27.isArrayLiteralExpression(depsExpr)) {
|
|
8043
8001
|
throw new FatalDiagnosticError(ErrorCode.VALUE_NOT_LITERAL, depsExpr, `@Injectable deps metadata must be an inline array`);
|
|
8044
8002
|
}
|
|
8045
8003
|
deps = depsExpr.elements.map((dep) => getDep(dep, reflector));
|
|
@@ -8124,12 +8082,12 @@ function getDep(dep, reflector) {
|
|
|
8124
8082
|
}
|
|
8125
8083
|
return true;
|
|
8126
8084
|
}
|
|
8127
|
-
if (
|
|
8085
|
+
if (ts27.isArrayLiteralExpression(dep)) {
|
|
8128
8086
|
dep.elements.forEach((el) => {
|
|
8129
8087
|
let isDecorator = false;
|
|
8130
|
-
if (
|
|
8088
|
+
if (ts27.isIdentifier(el)) {
|
|
8131
8089
|
isDecorator = maybeUpdateDecorator(el, reflector);
|
|
8132
|
-
} else if (
|
|
8090
|
+
} else if (ts27.isNewExpression(el) && ts27.isIdentifier(el.expression)) {
|
|
8133
8091
|
const token = el.arguments && el.arguments.length > 0 && el.arguments[0] || void 0;
|
|
8134
8092
|
isDecorator = maybeUpdateDecorator(el.expression, reflector, token);
|
|
8135
8093
|
}
|
|
@@ -8143,7 +8101,7 @@ function getDep(dep, reflector) {
|
|
|
8143
8101
|
|
|
8144
8102
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/src/pipe.mjs
|
|
8145
8103
|
import { compileClassMetadata as compileClassMetadata4, compileDeclareClassMetadata as compileDeclareClassMetadata5, compileDeclarePipeFromMetadata, compilePipeFromMetadata, FactoryTarget as FactoryTarget5 } from "@angular/compiler";
|
|
8146
|
-
import
|
|
8104
|
+
import ts28 from "typescript";
|
|
8147
8105
|
var PipeSymbol = class extends SemanticSymbol {
|
|
8148
8106
|
constructor(decl, name) {
|
|
8149
8107
|
super(decl);
|
|
@@ -8201,7 +8159,7 @@ var PipeDecoratorHandler = class {
|
|
|
8201
8159
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARITY_WRONG, decorator.node, "@Pipe must have exactly one argument");
|
|
8202
8160
|
}
|
|
8203
8161
|
const meta = unwrapExpression(decorator.args[0]);
|
|
8204
|
-
if (!
|
|
8162
|
+
if (!ts28.isObjectLiteralExpression(meta)) {
|
|
8205
8163
|
throw new FatalDiagnosticError(ErrorCode.DECORATOR_ARG_NOT_LITERAL, meta, "@Pipe must have a literal argument");
|
|
8206
8164
|
}
|
|
8207
8165
|
const pipe = reflectObjectLiteral(meta);
|
|
@@ -8317,7 +8275,6 @@ export {
|
|
|
8317
8275
|
CompilationMode,
|
|
8318
8276
|
aliasTransformFactory,
|
|
8319
8277
|
TraitCompiler,
|
|
8320
|
-
addImports,
|
|
8321
8278
|
DtsTransformRegistry,
|
|
8322
8279
|
declarationTransformFactory,
|
|
8323
8280
|
ivyTransformFactory,
|
|
@@ -8354,4 +8311,4 @@ export {
|
|
|
8354
8311
|
* Use of this source code is governed by an MIT-style license that can be
|
|
8355
8312
|
* found in the LICENSE file at https://angular.io/license
|
|
8356
8313
|
*/
|
|
8357
|
-
//# sourceMappingURL=chunk-
|
|
8314
|
+
//# sourceMappingURL=chunk-OHOBDHII.js.map
|