@angular/compiler-cli 13.0.2 → 13.0.3
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/index.js +628 -673
- package/bundles/index.js.map +2 -2
- package/bundles/linker/babel/index.js +2 -2
- package/bundles/linker/babel/index.js.map +1 -1
- package/bundles/linker/index.js +2 -2
- package/bundles/linker/index.js.map +1 -1
- package/bundles/ngcc/index.js +886 -868
- package/bundles/ngcc/index.js.map +2 -2
- package/bundles/ngcc/main-ngcc.js +886 -868
- package/bundles/ngcc/main-ngcc.js.map +2 -2
- package/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js +518 -500
- package/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js.map +2 -2
- package/bundles/private/migrations.js +20 -0
- package/bundles/private/migrations.js.map +1 -1
- package/bundles/private/tooling.js +2 -2
- package/bundles/private/tooling.js.map +1 -1
- package/bundles/src/bin/ng_xi18n.js +638 -683
- package/bundles/src/bin/ng_xi18n.js.map +2 -2
- package/bundles/src/bin/ngc.js +638 -683
- package/bundles/src/bin/ngc.js.map +2 -2
- package/bundles_metadata.json +1 -1
- package/ngcc/src/host/delegating_host.d.ts +1 -2
- package/ngcc/src/host/esm2015_host.d.ts +1 -8
- package/ngcc/src/host/ngcc_host.d.ts +0 -13
- package/ngcc/src/host/umd_host.d.ts +3 -0
- package/ngcc/src/packages/build_marker.d.ts +1 -1
- package/ngcc/src/packages/transformer.d.ts +0 -2
- package/ngcc/src/rendering/esm_rendering_formatter.d.ts +1 -5
- package/ngcc/src/rendering/renderer.d.ts +2 -3
- package/ngcc/src/rendering/rendering_formatter.d.ts +0 -2
- package/ngcc/src/utils.d.ts +0 -7
- package/package.json +2 -2
- package/src/ngtsc/partial_evaluator/src/builtin.d.ts +5 -0
- package/ngcc/src/analysis/switch_marker_analyzer.d.ts +0 -35
- package/src/ngtsc/switch/index.d.ts +0 -9
- package/src/ngtsc/switch/src/switch.d.ts +0 -10
|
@@ -554,7 +554,7 @@ import {
|
|
|
554
554
|
|
|
555
555
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/perform_compile.mjs
|
|
556
556
|
import { isSyntaxError as isSyntaxError2 } from "@angular/compiler";
|
|
557
|
-
import
|
|
557
|
+
import ts85 from "typescript";
|
|
558
558
|
|
|
559
559
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/diagnostics/src/error_code.mjs
|
|
560
560
|
var ErrorCode;
|
|
@@ -739,13 +739,13 @@ import {
|
|
|
739
739
|
readFileSync as readFileSync2
|
|
740
740
|
} from "fs";
|
|
741
741
|
import * as path6 from "path";
|
|
742
|
-
import
|
|
742
|
+
import ts84 from "typescript";
|
|
743
743
|
|
|
744
744
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/diagnostics/translate_diagnostics.mjs
|
|
745
745
|
import ts10 from "typescript";
|
|
746
746
|
|
|
747
747
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/compiler.mjs
|
|
748
|
-
import
|
|
748
|
+
import ts72 from "typescript";
|
|
749
749
|
|
|
750
750
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/src/component.mjs
|
|
751
751
|
import { compileClassMetadata as compileClassMetadata3, compileComponentFromMetadata, compileDeclareClassMetadata as compileDeclareClassMetadata3, compileDeclareComponentFromMetadata, CssSelector, DEFAULT_INTERPOLATION_CONFIG, DomElementSchemaRegistry, ExternalExpr as ExternalExpr7, FactoryTarget as FactoryTarget3, InterpolationConfig, makeBindingParser as makeBindingParser2, ParseSourceFile as ParseSourceFile2, parseTemplate, R3TargetBinder, SelectorMatcher, ViewEncapsulation, WrappedNodeExpr as WrappedNodeExpr6 } from "@angular/compiler";
|
|
@@ -2717,6 +2717,24 @@ var ArrayConcatBuiltinFn = class extends KnownFn {
|
|
|
2717
2717
|
return result;
|
|
2718
2718
|
}
|
|
2719
2719
|
};
|
|
2720
|
+
var StringConcatBuiltinFn = class extends KnownFn {
|
|
2721
|
+
constructor(lhs) {
|
|
2722
|
+
super();
|
|
2723
|
+
this.lhs = lhs;
|
|
2724
|
+
}
|
|
2725
|
+
evaluate(node, args) {
|
|
2726
|
+
let result = this.lhs;
|
|
2727
|
+
for (const arg of args) {
|
|
2728
|
+
const resolved = arg instanceof EnumValue ? arg.resolved : arg;
|
|
2729
|
+
if (typeof resolved === "string" || typeof resolved === "number" || typeof resolved === "boolean" || resolved == null) {
|
|
2730
|
+
result = result.concat(resolved);
|
|
2731
|
+
} else {
|
|
2732
|
+
return DynamicValue.fromUnknown(node);
|
|
2733
|
+
}
|
|
2734
|
+
}
|
|
2735
|
+
return result;
|
|
2736
|
+
}
|
|
2737
|
+
};
|
|
2720
2738
|
var ObjectAssignBuiltinFn = class extends KnownFn {
|
|
2721
2739
|
evaluate(node, args) {
|
|
2722
2740
|
if (args.length === 0) {
|
|
@@ -3106,6 +3124,8 @@ var StaticInterpreter = class {
|
|
|
3106
3124
|
return DynamicValue.fromInvalidExpressionType(node, rhs);
|
|
3107
3125
|
}
|
|
3108
3126
|
return lhs[rhs];
|
|
3127
|
+
} else if (typeof lhs === "string" && rhs === "concat") {
|
|
3128
|
+
return new StringConcatBuiltinFn(lhs);
|
|
3109
3129
|
} else if (lhs instanceof Reference) {
|
|
3110
3130
|
const ref = lhs.node;
|
|
3111
3131
|
if (this.host.isClass(ref)) {
|
|
@@ -8179,9 +8199,6 @@ var TypeCheckScopeRegistry = class {
|
|
|
8179
8199
|
}
|
|
8180
8200
|
};
|
|
8181
8201
|
|
|
8182
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/switch/src/switch.mjs
|
|
8183
|
-
import ts52 from "typescript";
|
|
8184
|
-
|
|
8185
8202
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/checker.mjs
|
|
8186
8203
|
import { CssSelector as CssSelector3, DomElementSchemaRegistry as DomElementSchemaRegistry3 } from "@angular/compiler";
|
|
8187
8204
|
|
|
@@ -8216,7 +8233,7 @@ var SymbolKind;
|
|
|
8216
8233
|
})(SymbolKind || (SymbolKind = {}));
|
|
8217
8234
|
|
|
8218
8235
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/diagnostics/src/diagnostic.mjs
|
|
8219
|
-
import
|
|
8236
|
+
import ts52 from "typescript";
|
|
8220
8237
|
|
|
8221
8238
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/diagnostics/src/id.mjs
|
|
8222
8239
|
var TEMPLATE_ID = Symbol("ngTemplateId");
|
|
@@ -8224,11 +8241,11 @@ var NEXT_TEMPLATE_ID = Symbol("ngNextTemplateId");
|
|
|
8224
8241
|
|
|
8225
8242
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/completion.mjs
|
|
8226
8243
|
import { EmptyExpr, ImplicitReceiver as ImplicitReceiver2, PropertyRead, PropertyWrite, SafePropertyRead, TmplAstReference as TmplAstReference2, TmplAstTextAttribute } from "@angular/compiler";
|
|
8227
|
-
import
|
|
8244
|
+
import ts54 from "typescript";
|
|
8228
8245
|
|
|
8229
8246
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/comments.mjs
|
|
8230
8247
|
import { AbsoluteSourceSpan as AbsoluteSourceSpan2 } from "@angular/compiler";
|
|
8231
|
-
import
|
|
8248
|
+
import ts53 from "typescript";
|
|
8232
8249
|
var CommentTriviaType;
|
|
8233
8250
|
(function(CommentTriviaType2) {
|
|
8234
8251
|
CommentTriviaType2["DIAGNOSTIC"] = "D";
|
|
@@ -8243,47 +8260,47 @@ var ExpressionIdentifier;
|
|
|
8243
8260
|
var IGNORE_FOR_DIAGNOSTICS_MARKER = `${CommentTriviaType.DIAGNOSTIC}:ignore`;
|
|
8244
8261
|
|
|
8245
8262
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/context.mjs
|
|
8246
|
-
import
|
|
8263
|
+
import ts68 from "typescript";
|
|
8247
8264
|
|
|
8248
8265
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/dom.mjs
|
|
8249
8266
|
import { DomElementSchemaRegistry as DomElementSchemaRegistry2 } from "@angular/compiler";
|
|
8250
|
-
import
|
|
8267
|
+
import ts55 from "typescript";
|
|
8251
8268
|
var REGISTRY = new DomElementSchemaRegistry2();
|
|
8252
8269
|
|
|
8253
8270
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/environment.mjs
|
|
8254
8271
|
import { ExpressionType, ExternalExpr as ExternalExpr9 } from "@angular/compiler";
|
|
8255
|
-
import
|
|
8272
|
+
import ts61 from "typescript";
|
|
8256
8273
|
|
|
8257
8274
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/ts_util.mjs
|
|
8258
|
-
import
|
|
8275
|
+
import ts56 from "typescript";
|
|
8259
8276
|
var SAFE_TO_CAST_WITHOUT_PARENS = new Set([
|
|
8260
|
-
|
|
8261
|
-
|
|
8262
|
-
|
|
8263
|
-
|
|
8264
|
-
|
|
8265
|
-
|
|
8266
|
-
|
|
8267
|
-
|
|
8268
|
-
|
|
8269
|
-
|
|
8270
|
-
|
|
8271
|
-
|
|
8272
|
-
|
|
8273
|
-
|
|
8277
|
+
ts56.SyntaxKind.ParenthesizedExpression,
|
|
8278
|
+
ts56.SyntaxKind.Identifier,
|
|
8279
|
+
ts56.SyntaxKind.CallExpression,
|
|
8280
|
+
ts56.SyntaxKind.NonNullExpression,
|
|
8281
|
+
ts56.SyntaxKind.ElementAccessExpression,
|
|
8282
|
+
ts56.SyntaxKind.PropertyAccessExpression,
|
|
8283
|
+
ts56.SyntaxKind.ArrayLiteralExpression,
|
|
8284
|
+
ts56.SyntaxKind.ObjectLiteralExpression,
|
|
8285
|
+
ts56.SyntaxKind.StringLiteral,
|
|
8286
|
+
ts56.SyntaxKind.NumericLiteral,
|
|
8287
|
+
ts56.SyntaxKind.TrueKeyword,
|
|
8288
|
+
ts56.SyntaxKind.FalseKeyword,
|
|
8289
|
+
ts56.SyntaxKind.NullKeyword,
|
|
8290
|
+
ts56.SyntaxKind.UndefinedKeyword
|
|
8274
8291
|
]);
|
|
8275
8292
|
|
|
8276
8293
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_constructor.mjs
|
|
8277
|
-
import
|
|
8294
|
+
import ts60 from "typescript";
|
|
8278
8295
|
|
|
8279
8296
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/tcb_util.mjs
|
|
8280
|
-
import
|
|
8297
|
+
import ts59 from "typescript";
|
|
8281
8298
|
|
|
8282
8299
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_parameter_emitter.mjs
|
|
8283
|
-
import
|
|
8300
|
+
import ts58 from "typescript";
|
|
8284
8301
|
|
|
8285
8302
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_emitter.mjs
|
|
8286
|
-
import
|
|
8303
|
+
import ts57 from "typescript";
|
|
8287
8304
|
|
|
8288
8305
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/tcb_util.mjs
|
|
8289
8306
|
var TcbInliningRequirement;
|
|
@@ -8295,47 +8312,47 @@ var TcbInliningRequirement;
|
|
|
8295
8312
|
|
|
8296
8313
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/oob.mjs
|
|
8297
8314
|
import { TmplAstElement as TmplAstElement2 } from "@angular/compiler";
|
|
8298
|
-
import
|
|
8315
|
+
import ts62 from "typescript";
|
|
8299
8316
|
|
|
8300
8317
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/shim.mjs
|
|
8301
|
-
import
|
|
8318
|
+
import ts63 from "typescript";
|
|
8302
8319
|
|
|
8303
8320
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.mjs
|
|
8304
8321
|
import { BindingPipe, Call as Call2, DYNAMIC_TYPE, ImplicitReceiver as ImplicitReceiver4, PropertyRead as PropertyRead2, PropertyWrite as PropertyWrite2, SafePropertyRead as SafePropertyRead3, ThisReceiver, TmplAstBoundAttribute, TmplAstBoundText, TmplAstElement as TmplAstElement3, TmplAstIcu, TmplAstReference as TmplAstReference3, TmplAstTemplate as TmplAstTemplate2, TmplAstTextAttribute as TmplAstTextAttribute2, TmplAstVariable as TmplAstVariable2 } from "@angular/compiler";
|
|
8305
|
-
import
|
|
8322
|
+
import ts66 from "typescript";
|
|
8306
8323
|
|
|
8307
8324
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/diagnostics.mjs
|
|
8308
8325
|
import { AbsoluteSourceSpan as AbsoluteSourceSpan3 } from "@angular/compiler";
|
|
8309
|
-
import
|
|
8326
|
+
import ts64 from "typescript";
|
|
8310
8327
|
|
|
8311
8328
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/expression.mjs
|
|
8312
8329
|
import { ASTWithSource as ASTWithSource2, Call, EmptyExpr as EmptyExpr2, SafeKeyedRead, SafePropertyRead as SafePropertyRead2 } from "@angular/compiler";
|
|
8313
|
-
import
|
|
8314
|
-
var NULL_AS_ANY =
|
|
8315
|
-
var UNDEFINED =
|
|
8330
|
+
import ts65 from "typescript";
|
|
8331
|
+
var NULL_AS_ANY = ts65.createAsExpression(ts65.createNull(), ts65.createKeywordTypeNode(ts65.SyntaxKind.AnyKeyword));
|
|
8332
|
+
var UNDEFINED = ts65.createIdentifier("undefined");
|
|
8316
8333
|
var UNARY_OPS = new Map([
|
|
8317
|
-
["+",
|
|
8318
|
-
["-",
|
|
8334
|
+
["+", ts65.SyntaxKind.PlusToken],
|
|
8335
|
+
["-", ts65.SyntaxKind.MinusToken]
|
|
8319
8336
|
]);
|
|
8320
8337
|
var BINARY_OPS = new Map([
|
|
8321
|
-
["+",
|
|
8322
|
-
["-",
|
|
8323
|
-
["<",
|
|
8324
|
-
[">",
|
|
8325
|
-
["<=",
|
|
8326
|
-
[">=",
|
|
8327
|
-
["==",
|
|
8328
|
-
["===",
|
|
8329
|
-
["*",
|
|
8330
|
-
["/",
|
|
8331
|
-
["%",
|
|
8332
|
-
["!=",
|
|
8333
|
-
["!==",
|
|
8334
|
-
["||",
|
|
8335
|
-
["&&",
|
|
8336
|
-
["&",
|
|
8337
|
-
["|",
|
|
8338
|
-
["??",
|
|
8338
|
+
["+", ts65.SyntaxKind.PlusToken],
|
|
8339
|
+
["-", ts65.SyntaxKind.MinusToken],
|
|
8340
|
+
["<", ts65.SyntaxKind.LessThanToken],
|
|
8341
|
+
[">", ts65.SyntaxKind.GreaterThanToken],
|
|
8342
|
+
["<=", ts65.SyntaxKind.LessThanEqualsToken],
|
|
8343
|
+
[">=", ts65.SyntaxKind.GreaterThanEqualsToken],
|
|
8344
|
+
["==", ts65.SyntaxKind.EqualsEqualsToken],
|
|
8345
|
+
["===", ts65.SyntaxKind.EqualsEqualsEqualsToken],
|
|
8346
|
+
["*", ts65.SyntaxKind.AsteriskToken],
|
|
8347
|
+
["/", ts65.SyntaxKind.SlashToken],
|
|
8348
|
+
["%", ts65.SyntaxKind.PercentToken],
|
|
8349
|
+
["!=", ts65.SyntaxKind.ExclamationEqualsToken],
|
|
8350
|
+
["!==", ts65.SyntaxKind.ExclamationEqualsEqualsToken],
|
|
8351
|
+
["||", ts65.SyntaxKind.BarBarToken],
|
|
8352
|
+
["&&", ts65.SyntaxKind.AmpersandAmpersandToken],
|
|
8353
|
+
["&", ts65.SyntaxKind.AmpersandToken],
|
|
8354
|
+
["|", ts65.SyntaxKind.BarToken],
|
|
8355
|
+
["??", ts65.SyntaxKind.QuestionQuestionToken]
|
|
8339
8356
|
]);
|
|
8340
8357
|
var VeSafeLhsInferenceBugDetector = class {
|
|
8341
8358
|
static veWillInferAnyFor(ast) {
|
|
@@ -8418,10 +8435,10 @@ var TcbGenericContextBehavior;
|
|
|
8418
8435
|
TcbGenericContextBehavior2[TcbGenericContextBehavior2["CopyClassNodes"] = 1] = "CopyClassNodes";
|
|
8419
8436
|
TcbGenericContextBehavior2[TcbGenericContextBehavior2["FallbackToAny"] = 2] = "FallbackToAny";
|
|
8420
8437
|
})(TcbGenericContextBehavior || (TcbGenericContextBehavior = {}));
|
|
8421
|
-
var INFER_TYPE_FOR_CIRCULAR_OP_EXPR =
|
|
8438
|
+
var INFER_TYPE_FOR_CIRCULAR_OP_EXPR = ts66.createNonNullExpression(ts66.createNull());
|
|
8422
8439
|
|
|
8423
8440
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_file.mjs
|
|
8424
|
-
import
|
|
8441
|
+
import ts67 from "typescript";
|
|
8425
8442
|
|
|
8426
8443
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/context.mjs
|
|
8427
8444
|
var InliningMode;
|
|
@@ -8435,21 +8452,21 @@ import { ParseLocation as ParseLocation2, ParseSourceSpan as ParseSourceSpan2 }
|
|
|
8435
8452
|
|
|
8436
8453
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/template_symbol_builder.mjs
|
|
8437
8454
|
import { AST, ASTWithSource as ASTWithSource3, BindingPipe as BindingPipe2, PropertyRead as PropertyRead3, PropertyWrite as PropertyWrite3, SafePropertyRead as SafePropertyRead4, TmplAstBoundAttribute as TmplAstBoundAttribute2, TmplAstBoundEvent, TmplAstElement as TmplAstElement4, TmplAstReference as TmplAstReference4, TmplAstTemplate as TmplAstTemplate3, TmplAstTextAttribute as TmplAstTextAttribute3, TmplAstVariable as TmplAstVariable3 } from "@angular/compiler";
|
|
8438
|
-
import
|
|
8455
|
+
import ts69 from "typescript";
|
|
8439
8456
|
|
|
8440
8457
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/checker.mjs
|
|
8441
8458
|
var REGISTRY2 = new DomElementSchemaRegistry3();
|
|
8442
8459
|
|
|
8443
8460
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/invalid_banana_in_box/index.mjs
|
|
8444
8461
|
import { TmplAstBoundEvent as TmplAstBoundEvent2 } from "@angular/compiler";
|
|
8445
|
-
import
|
|
8462
|
+
import ts70 from "typescript";
|
|
8446
8463
|
|
|
8447
8464
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/api/api.mjs
|
|
8448
8465
|
import { ASTWithSource as ASTWithSource4, RecursiveAstVisitor as RecursiveAstVisitor3 } from "@angular/compiler";
|
|
8449
8466
|
|
|
8450
8467
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/nullish_coalescing_not_nullable/index.mjs
|
|
8451
8468
|
import { Binary } from "@angular/compiler";
|
|
8452
|
-
import
|
|
8469
|
+
import ts71 from "typescript";
|
|
8453
8470
|
|
|
8454
8471
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/compiler.mjs
|
|
8455
8472
|
var CompilationTicketKind;
|
|
@@ -8461,7 +8478,7 @@ var CompilationTicketKind;
|
|
|
8461
8478
|
|
|
8462
8479
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/program.mjs
|
|
8463
8480
|
import { HtmlParser, MessageBundle } from "@angular/compiler";
|
|
8464
|
-
import
|
|
8481
|
+
import ts75 from "typescript";
|
|
8465
8482
|
|
|
8466
8483
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/i18n.mjs
|
|
8467
8484
|
import { Xliff, Xliff2, Xmb } from "@angular/compiler";
|
|
@@ -8472,39 +8489,39 @@ import {
|
|
|
8472
8489
|
} from "path";
|
|
8473
8490
|
|
|
8474
8491
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/typescript_support.mjs
|
|
8475
|
-
import
|
|
8476
|
-
var tsVersion =
|
|
8492
|
+
import ts73 from "typescript";
|
|
8493
|
+
var tsVersion = ts73.version;
|
|
8477
8494
|
|
|
8478
8495
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/host.mjs
|
|
8479
|
-
import
|
|
8496
|
+
import ts74 from "typescript";
|
|
8480
8497
|
|
|
8481
8498
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/downlevel_decorators_transform/downlevel_decorators_transform.mjs
|
|
8482
|
-
import
|
|
8499
|
+
import ts77 from "typescript";
|
|
8483
8500
|
|
|
8484
8501
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/downlevel_decorators_transform/patch_alias_reference_resolution.mjs
|
|
8485
|
-
import
|
|
8502
|
+
import ts76 from "typescript";
|
|
8486
8503
|
var patchedReferencedAliasesSymbol = Symbol("patchedReferencedAliases");
|
|
8487
8504
|
|
|
8488
8505
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/inline_resources.mjs
|
|
8489
|
-
import
|
|
8506
|
+
import ts78 from "typescript";
|
|
8490
8507
|
|
|
8491
8508
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/lower_expressions.mjs
|
|
8492
8509
|
import { createLoweredSymbol, isLoweredSymbol } from "@angular/compiler";
|
|
8493
|
-
import
|
|
8510
|
+
import ts79 from "typescript";
|
|
8494
8511
|
|
|
8495
8512
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/metadata_cache.mjs
|
|
8496
|
-
import
|
|
8513
|
+
import ts80 from "typescript";
|
|
8497
8514
|
|
|
8498
8515
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/node_emitter_transform.mjs
|
|
8499
|
-
import
|
|
8516
|
+
import ts82 from "typescript";
|
|
8500
8517
|
|
|
8501
8518
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/node_emitter.mjs
|
|
8502
8519
|
import { BinaryOperator as BinaryOperator2, BuiltinMethod, BuiltinVar, ClassStmt, ExternalExpr as ExternalExpr10, Statement, StmtModifier as StmtModifier2, UnaryOperator as UnaryOperator2 } from "@angular/compiler";
|
|
8503
|
-
import
|
|
8520
|
+
import ts81 from "typescript";
|
|
8504
8521
|
|
|
8505
8522
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/r3_metadata_transform.mjs
|
|
8506
8523
|
import { ClassStmt as ClassStmt2, StmtModifier as StmtModifier3 } from "@angular/compiler";
|
|
8507
|
-
import
|
|
8524
|
+
import ts83 from "typescript";
|
|
8508
8525
|
|
|
8509
8526
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/program.mjs
|
|
8510
8527
|
var VE_DISABLED_MESSAGE = `
|
|
@@ -8533,7 +8550,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
8533
8550
|
var _a;
|
|
8534
8551
|
try {
|
|
8535
8552
|
const fs5 = getFileSystem();
|
|
8536
|
-
const readConfigFile = (configFile) =>
|
|
8553
|
+
const readConfigFile = (configFile) => ts85.readConfigFile(configFile, (file) => host.readFile(host.resolve(file)));
|
|
8537
8554
|
const readAngularCompilerOptions = (configFile, parentOptions = {}) => {
|
|
8538
8555
|
const { config: config2, error: error3 } = readConfigFile(configFile);
|
|
8539
8556
|
if (error3) {
|
|
@@ -8565,7 +8582,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
8565
8582
|
basePath
|
|
8566
8583
|
}, readAngularCompilerOptions(configFileName)), existingOptions);
|
|
8567
8584
|
const parseConfigHost = createParseConfigHost(host, fs5);
|
|
8568
|
-
const { options, errors, fileNames: rootNames, projectReferences } =
|
|
8585
|
+
const { options, errors, fileNames: rootNames, projectReferences } = ts85.parseJsonConfigFileContent(config, parseConfigHost, basePath, existingCompilerOptions, configFileName);
|
|
8569
8586
|
options.enableIvy = !!((_a = options.enableIvy) != null ? _a : true);
|
|
8570
8587
|
let emitFlags = EmitFlags.Default;
|
|
8571
8588
|
if (!(options.skipMetadataEmit || options.flatModuleOutFile)) {
|
|
@@ -8577,7 +8594,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
8577
8594
|
return { project: projectFile, rootNames, projectReferences, options, errors, emitFlags };
|
|
8578
8595
|
} catch (e) {
|
|
8579
8596
|
const errors = [{
|
|
8580
|
-
category:
|
|
8597
|
+
category: ts85.DiagnosticCategory.Error,
|
|
8581
8598
|
messageText: e.stack,
|
|
8582
8599
|
file: void 0,
|
|
8583
8600
|
start: void 0,
|
|
@@ -8591,7 +8608,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
8591
8608
|
function createParseConfigHost(host, fs5 = getFileSystem()) {
|
|
8592
8609
|
return {
|
|
8593
8610
|
fileExists: host.exists.bind(host),
|
|
8594
|
-
readDirectory:
|
|
8611
|
+
readDirectory: ts85.sys.readDirectory,
|
|
8595
8612
|
readFile: host.readFile.bind(host),
|
|
8596
8613
|
useCaseSensitiveFileNames: fs5.isCaseSensitive()
|
|
8597
8614
|
};
|
|
@@ -8611,7 +8628,7 @@ function getExtendedConfigPathWorker(configFile, extendsValue, host, fs5) {
|
|
|
8611
8628
|
}
|
|
8612
8629
|
} else {
|
|
8613
8630
|
const parseConfigHost = createParseConfigHost(host, fs5);
|
|
8614
|
-
const { resolvedModule } =
|
|
8631
|
+
const { resolvedModule } = ts85.nodeModuleNameResolver(extendsValue, configFile, { moduleResolution: ts85.ModuleResolutionKind.NodeJs, resolveJsonModule: true }, parseConfigHost);
|
|
8615
8632
|
if (resolvedModule) {
|
|
8616
8633
|
return absoluteFrom(resolvedModule.resolvedFileName);
|
|
8617
8634
|
}
|
|
@@ -8620,34 +8637,22 @@ function getExtendedConfigPathWorker(configFile, extendsValue, host, fs5) {
|
|
|
8620
8637
|
}
|
|
8621
8638
|
|
|
8622
8639
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/packages/entry_point.mjs
|
|
8623
|
-
import
|
|
8640
|
+
import ts92 from "typescript";
|
|
8624
8641
|
|
|
8625
8642
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/host/umd_host.mjs
|
|
8626
|
-
import
|
|
8643
|
+
import ts91 from "typescript";
|
|
8627
8644
|
|
|
8628
8645
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/utils.mjs
|
|
8629
|
-
import
|
|
8646
|
+
import ts86 from "typescript";
|
|
8630
8647
|
function isDefined(value) {
|
|
8631
8648
|
return value !== void 0 && value !== null;
|
|
8632
8649
|
}
|
|
8633
8650
|
function getNameText(name) {
|
|
8634
|
-
return
|
|
8635
|
-
}
|
|
8636
|
-
function findAll(node, test) {
|
|
8637
|
-
const nodes = [];
|
|
8638
|
-
findAllVisitor(node);
|
|
8639
|
-
return nodes;
|
|
8640
|
-
function findAllVisitor(n) {
|
|
8641
|
-
if (test(n)) {
|
|
8642
|
-
nodes.push(n);
|
|
8643
|
-
} else {
|
|
8644
|
-
n.forEachChild((child) => findAllVisitor(child));
|
|
8645
|
-
}
|
|
8646
|
-
}
|
|
8651
|
+
return ts86.isIdentifier(name) || ts86.isLiteralExpression(name) ? name.text : name.getText();
|
|
8647
8652
|
}
|
|
8648
8653
|
function hasNameIdentifier(declaration) {
|
|
8649
8654
|
const namedDeclaration = declaration;
|
|
8650
|
-
return namedDeclaration.name !== void 0 &&
|
|
8655
|
+
return namedDeclaration.name !== void 0 && ts86.isIdentifier(namedDeclaration.name);
|
|
8651
8656
|
}
|
|
8652
8657
|
function isRelativePath(path7) {
|
|
8653
8658
|
return isRooted(path7) || /^\.\.?(\/|\\|$)/.test(path7);
|
|
@@ -8677,10 +8682,10 @@ function resolveFileWithPostfixes(fs5, path7, postFixes) {
|
|
|
8677
8682
|
return null;
|
|
8678
8683
|
}
|
|
8679
8684
|
function getTsHelperFnFromDeclaration(decl) {
|
|
8680
|
-
if (!
|
|
8685
|
+
if (!ts86.isFunctionDeclaration(decl) && !ts86.isVariableDeclaration(decl)) {
|
|
8681
8686
|
return null;
|
|
8682
8687
|
}
|
|
8683
|
-
if (decl.name === void 0 || !
|
|
8688
|
+
if (decl.name === void 0 || !ts86.isIdentifier(decl.name)) {
|
|
8684
8689
|
return null;
|
|
8685
8690
|
}
|
|
8686
8691
|
return getTsHelperFnFromIdentifier(decl.name);
|
|
@@ -8709,25 +8714,25 @@ function stripExtension2(fileName) {
|
|
|
8709
8714
|
}
|
|
8710
8715
|
|
|
8711
8716
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/host/commonjs_umd_utils.mjs
|
|
8712
|
-
import
|
|
8717
|
+
import ts87 from "typescript";
|
|
8713
8718
|
function findNamespaceOfIdentifier(id) {
|
|
8714
|
-
return id.parent &&
|
|
8719
|
+
return id.parent && ts87.isPropertyAccessExpression(id.parent) && id.parent.name === id && ts87.isIdentifier(id.parent.expression) ? id.parent.expression : null;
|
|
8715
8720
|
}
|
|
8716
8721
|
function findRequireCallReference(id, checker) {
|
|
8717
8722
|
var _a, _b;
|
|
8718
8723
|
const symbol = checker.getSymbolAtLocation(id) || null;
|
|
8719
8724
|
const declaration = (_b = symbol == null ? void 0 : symbol.valueDeclaration) != null ? _b : (_a = symbol == null ? void 0 : symbol.declarations) == null ? void 0 : _a[0];
|
|
8720
|
-
const initializer = declaration &&
|
|
8725
|
+
const initializer = declaration && ts87.isVariableDeclaration(declaration) && declaration.initializer || null;
|
|
8721
8726
|
return initializer && isRequireCall(initializer) ? initializer : null;
|
|
8722
8727
|
}
|
|
8723
8728
|
function isWildcardReexportStatement(stmt) {
|
|
8724
|
-
if (!
|
|
8729
|
+
if (!ts87.isExpressionStatement(stmt) || !ts87.isCallExpression(stmt.expression)) {
|
|
8725
8730
|
return false;
|
|
8726
8731
|
}
|
|
8727
8732
|
let fnName = null;
|
|
8728
|
-
if (
|
|
8733
|
+
if (ts87.isIdentifier(stmt.expression.expression)) {
|
|
8729
8734
|
fnName = stmt.expression.expression.text;
|
|
8730
|
-
} else if (
|
|
8735
|
+
} else if (ts87.isPropertyAccessExpression(stmt.expression.expression) && ts87.isIdentifier(stmt.expression.expression.name)) {
|
|
8731
8736
|
fnName = stmt.expression.expression.name.text;
|
|
8732
8737
|
}
|
|
8733
8738
|
if (fnName !== "__export" && fnName !== "__exportStar") {
|
|
@@ -8736,10 +8741,10 @@ function isWildcardReexportStatement(stmt) {
|
|
|
8736
8741
|
return stmt.expression.arguments.length > 0;
|
|
8737
8742
|
}
|
|
8738
8743
|
function isDefinePropertyReexportStatement(stmt) {
|
|
8739
|
-
if (!
|
|
8744
|
+
if (!ts87.isExpressionStatement(stmt) || !ts87.isCallExpression(stmt.expression)) {
|
|
8740
8745
|
return false;
|
|
8741
8746
|
}
|
|
8742
|
-
if (!
|
|
8747
|
+
if (!ts87.isPropertyAccessExpression(stmt.expression.expression) || !ts87.isIdentifier(stmt.expression.expression.expression) || stmt.expression.expression.expression.text !== "Object" || !ts87.isIdentifier(stmt.expression.expression.name) || stmt.expression.expression.name.text !== "defineProperty") {
|
|
8743
8748
|
return false;
|
|
8744
8749
|
}
|
|
8745
8750
|
const args = stmt.expression.arguments;
|
|
@@ -8747,33 +8752,33 @@ function isDefinePropertyReexportStatement(stmt) {
|
|
|
8747
8752
|
return false;
|
|
8748
8753
|
}
|
|
8749
8754
|
const exportsObject = args[0];
|
|
8750
|
-
if (!
|
|
8755
|
+
if (!ts87.isIdentifier(exportsObject) || exportsObject.text !== "exports") {
|
|
8751
8756
|
return false;
|
|
8752
8757
|
}
|
|
8753
8758
|
const propertyKey = args[1];
|
|
8754
|
-
if (!
|
|
8759
|
+
if (!ts87.isStringLiteral(propertyKey)) {
|
|
8755
8760
|
return false;
|
|
8756
8761
|
}
|
|
8757
8762
|
const propertyDescriptor = args[2];
|
|
8758
|
-
if (!
|
|
8763
|
+
if (!ts87.isObjectLiteralExpression(propertyDescriptor)) {
|
|
8759
8764
|
return false;
|
|
8760
8765
|
}
|
|
8761
|
-
return propertyDescriptor.properties.some((prop) => prop.name !== void 0 &&
|
|
8766
|
+
return propertyDescriptor.properties.some((prop) => prop.name !== void 0 && ts87.isIdentifier(prop.name) && prop.name.text === "get");
|
|
8762
8767
|
}
|
|
8763
8768
|
function extractGetterFnExpression(statement) {
|
|
8764
8769
|
const args = statement.expression.arguments;
|
|
8765
|
-
const getterFn = args[2].properties.find((prop) => prop.name !== void 0 &&
|
|
8766
|
-
if (getterFn === void 0 || !
|
|
8770
|
+
const getterFn = args[2].properties.find((prop) => prop.name !== void 0 && ts87.isIdentifier(prop.name) && prop.name.text === "get");
|
|
8771
|
+
if (getterFn === void 0 || !ts87.isPropertyAssignment(getterFn) || !ts87.isFunctionExpression(getterFn.initializer)) {
|
|
8767
8772
|
return null;
|
|
8768
8773
|
}
|
|
8769
8774
|
const returnStatement = getterFn.initializer.body.statements[0];
|
|
8770
|
-
if (!
|
|
8775
|
+
if (!ts87.isReturnStatement(returnStatement) || returnStatement.expression === void 0) {
|
|
8771
8776
|
return null;
|
|
8772
8777
|
}
|
|
8773
8778
|
return returnStatement.expression;
|
|
8774
8779
|
}
|
|
8775
8780
|
function isRequireCall(node) {
|
|
8776
|
-
return
|
|
8781
|
+
return ts87.isCallExpression(node) && ts87.isIdentifier(node.expression) && node.expression.text === "require" && node.arguments.length === 1 && ts87.isStringLiteral(node.arguments[0]);
|
|
8777
8782
|
}
|
|
8778
8783
|
function isExternalImport(path7) {
|
|
8779
8784
|
return !/^\.\.?(\/|$)/.test(path7);
|
|
@@ -8782,10 +8787,10 @@ function isExportsDeclaration(expr) {
|
|
|
8782
8787
|
return expr.parent && isExportsAssignment(expr.parent);
|
|
8783
8788
|
}
|
|
8784
8789
|
function isExportsAssignment(expr) {
|
|
8785
|
-
return isAssignment(expr) &&
|
|
8790
|
+
return isAssignment(expr) && ts87.isPropertyAccessExpression(expr.left) && ts87.isIdentifier(expr.left.expression) && expr.left.expression.text === "exports" && ts87.isIdentifier(expr.left.name);
|
|
8786
8791
|
}
|
|
8787
8792
|
function isExportsStatement(stmt) {
|
|
8788
|
-
return
|
|
8793
|
+
return ts87.isExpressionStatement(stmt) && isExportsAssignment(stmt.expression);
|
|
8789
8794
|
}
|
|
8790
8795
|
function skipAliases(node) {
|
|
8791
8796
|
while (isAssignment(node)) {
|
|
@@ -8795,7 +8800,7 @@ function skipAliases(node) {
|
|
|
8795
8800
|
}
|
|
8796
8801
|
|
|
8797
8802
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/host/esm2015_host.mjs
|
|
8798
|
-
import
|
|
8803
|
+
import ts89 from "typescript";
|
|
8799
8804
|
|
|
8800
8805
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/analysis/util.mjs
|
|
8801
8806
|
function isWithinPackage(packagePath, filePath) {
|
|
@@ -8812,18 +8817,10 @@ var NoopDependencyTracker = class {
|
|
|
8812
8817
|
};
|
|
8813
8818
|
var NOOP_DEPENDENCY_TRACKER = new NoopDependencyTracker();
|
|
8814
8819
|
|
|
8815
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/host/ngcc_host.mjs
|
|
8816
|
-
import ts89 from "typescript";
|
|
8817
|
-
var PRE_R3_MARKER = "__PRE_R3__";
|
|
8818
|
-
var POST_R3_MARKER = "__POST_R3__";
|
|
8819
|
-
function isSwitchableVariableDeclaration(node) {
|
|
8820
|
-
return ts89.isVariableDeclaration(node) && !!node.initializer && ts89.isIdentifier(node.initializer) && node.initializer.text.endsWith(PRE_R3_MARKER);
|
|
8821
|
-
}
|
|
8822
|
-
|
|
8823
8820
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/host/utils.mjs
|
|
8824
|
-
import
|
|
8821
|
+
import ts88 from "typescript";
|
|
8825
8822
|
function stripParentheses(node) {
|
|
8826
|
-
return
|
|
8823
|
+
return ts88.isParenthesizedExpression(node) ? node.expression : node;
|
|
8827
8824
|
}
|
|
8828
8825
|
|
|
8829
8826
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/host/esm2015_host.mjs
|
|
@@ -8926,7 +8923,7 @@ ${declaration.getText()}`);
|
|
|
8926
8923
|
let declarationNode = superDeclaration.node;
|
|
8927
8924
|
if (isNamedVariableDeclaration(superDeclaration.node) && !isTopLevel(superDeclaration.node)) {
|
|
8928
8925
|
const variableValue = this.getVariableValue(superDeclaration.node);
|
|
8929
|
-
if (variableValue !== null &&
|
|
8926
|
+
if (variableValue !== null && ts89.isClassExpression(variableValue)) {
|
|
8930
8927
|
declarationNode = getContainingStatement(variableValue);
|
|
8931
8928
|
}
|
|
8932
8929
|
}
|
|
@@ -8939,7 +8936,7 @@ ${declaration.getText()}`);
|
|
|
8939
8936
|
if (aliasedIdentifier !== null) {
|
|
8940
8937
|
return this.getDeclarationOfIdentifier(aliasedIdentifier);
|
|
8941
8938
|
}
|
|
8942
|
-
if (isConcreteDeclaration(declaration) &&
|
|
8939
|
+
if (isConcreteDeclaration(declaration) && ts89.isVariableDeclaration(declaration.node)) {
|
|
8943
8940
|
const enumMembers = this.resolveEnumMembers(declaration.node);
|
|
8944
8941
|
if (enumMembers !== null) {
|
|
8945
8942
|
declaration.identity = { kind: 0, enumMembers };
|
|
@@ -8954,9 +8951,6 @@ ${declaration.getText()}`);
|
|
|
8954
8951
|
}
|
|
8955
8952
|
return Array.from(classDecorators);
|
|
8956
8953
|
}
|
|
8957
|
-
getSwitchableDeclarations(module2) {
|
|
8958
|
-
return module2.getText().indexOf(PRE_R3_MARKER) >= 0 ? findAll(module2, isSwitchableVariableDeclaration) : [];
|
|
8959
|
-
}
|
|
8960
8954
|
getVariableValue(declaration) {
|
|
8961
8955
|
const value = super.getVariableValue(declaration);
|
|
8962
8956
|
if (value) {
|
|
@@ -8964,16 +8958,16 @@ ${declaration.getText()}`);
|
|
|
8964
8958
|
}
|
|
8965
8959
|
const block = declaration.parent.parent.parent;
|
|
8966
8960
|
const symbol = this.checker.getSymbolAtLocation(declaration.name);
|
|
8967
|
-
if (symbol && (
|
|
8961
|
+
if (symbol && (ts89.isBlock(block) || ts89.isSourceFile(block))) {
|
|
8968
8962
|
const decorateCall = this.findDecoratedVariableValue(block, symbol);
|
|
8969
8963
|
const target = decorateCall && decorateCall.arguments[1];
|
|
8970
|
-
if (target &&
|
|
8964
|
+
if (target && ts89.isIdentifier(target)) {
|
|
8971
8965
|
const targetSymbol = this.checker.getSymbolAtLocation(target);
|
|
8972
8966
|
const targetDeclaration = targetSymbol && targetSymbol.valueDeclaration;
|
|
8973
8967
|
if (targetDeclaration) {
|
|
8974
|
-
if (
|
|
8968
|
+
if (ts89.isClassDeclaration(targetDeclaration) || ts89.isFunctionDeclaration(targetDeclaration)) {
|
|
8975
8969
|
return targetDeclaration.name || null;
|
|
8976
|
-
} else if (
|
|
8970
|
+
} else if (ts89.isVariableDeclaration(targetDeclaration)) {
|
|
8977
8971
|
let targetValue = targetDeclaration.initializer;
|
|
8978
8972
|
while (targetValue && isAssignment2(targetValue)) {
|
|
8979
8973
|
targetValue = targetValue.right;
|
|
@@ -8994,7 +8988,7 @@ ${declaration.getText()}`);
|
|
|
8994
8988
|
}
|
|
8995
8989
|
getGenericArityOfClass(clazz) {
|
|
8996
8990
|
const dtsDeclaration = this.getDtsDeclaration(clazz);
|
|
8997
|
-
if (dtsDeclaration &&
|
|
8991
|
+
if (dtsDeclaration && ts89.isClassDeclaration(dtsDeclaration)) {
|
|
8998
8992
|
return dtsDeclaration.typeParameters ? dtsDeclaration.typeParameters.length : 0;
|
|
8999
8993
|
}
|
|
9000
8994
|
return null;
|
|
@@ -9031,13 +9025,13 @@ ${declaration.getText()}`);
|
|
|
9031
9025
|
if (implementationStatement === null)
|
|
9032
9026
|
return last;
|
|
9033
9027
|
const container = implementationStatement.parent;
|
|
9034
|
-
if (
|
|
9035
|
-
const returnStatementIndex = container.statements.findIndex(
|
|
9028
|
+
if (ts89.isBlock(container)) {
|
|
9029
|
+
const returnStatementIndex = container.statements.findIndex(ts89.isReturnStatement);
|
|
9036
9030
|
if (returnStatementIndex === -1) {
|
|
9037
9031
|
throw new Error(`Compiled class wrapper IIFE does not have a return statement: ${classSymbol.name} in ${classSymbol.declaration.valueDeclaration.getSourceFile().fileName}`);
|
|
9038
9032
|
}
|
|
9039
9033
|
last = container.statements[returnStatementIndex - 1];
|
|
9040
|
-
} else if (
|
|
9034
|
+
} else if (ts89.isSourceFile(container)) {
|
|
9041
9035
|
if (implementation.exports !== void 0) {
|
|
9042
9036
|
implementation.exports.forEach((exportSymbol) => {
|
|
9043
9037
|
if (exportSymbol.valueDeclaration === void 0) {
|
|
@@ -9066,14 +9060,14 @@ ${declaration.getText()}`);
|
|
|
9066
9060
|
return decl;
|
|
9067
9061
|
}
|
|
9068
9062
|
addClassSymbolsFromStatement(classes, statement) {
|
|
9069
|
-
if (
|
|
9063
|
+
if (ts89.isVariableStatement(statement)) {
|
|
9070
9064
|
statement.declarationList.declarations.forEach((declaration) => {
|
|
9071
9065
|
const classSymbol = this.getClassSymbol(declaration);
|
|
9072
9066
|
if (classSymbol) {
|
|
9073
9067
|
classes.set(classSymbol.implementation, classSymbol);
|
|
9074
9068
|
}
|
|
9075
9069
|
});
|
|
9076
|
-
} else if (
|
|
9070
|
+
} else if (ts89.isClassDeclaration(statement)) {
|
|
9077
9071
|
const classSymbol = this.getClassSymbol(statement);
|
|
9078
9072
|
if (classSymbol) {
|
|
9079
9073
|
classes.set(classSymbol.implementation, classSymbol);
|
|
@@ -9104,7 +9098,7 @@ ${declaration.getText()}`);
|
|
|
9104
9098
|
}
|
|
9105
9099
|
getClassSymbolFromInnerDeclaration(declaration) {
|
|
9106
9100
|
let outerDeclaration = void 0;
|
|
9107
|
-
if (
|
|
9101
|
+
if (ts89.isClassExpression(declaration) && hasNameIdentifier(declaration)) {
|
|
9108
9102
|
outerDeclaration = getFarLeftHandSideOfAssignment(declaration);
|
|
9109
9103
|
if (outerDeclaration !== void 0 && !isTopLevel(outerDeclaration)) {
|
|
9110
9104
|
outerDeclaration = getContainingVariableDeclaration(outerDeclaration);
|
|
@@ -9146,7 +9140,7 @@ ${declaration.getText()}`);
|
|
|
9146
9140
|
return void 0;
|
|
9147
9141
|
}
|
|
9148
9142
|
const innerDeclaration = implementationSymbol.valueDeclaration;
|
|
9149
|
-
if (!
|
|
9143
|
+
if (!ts89.isClassExpression(innerDeclaration) && !ts89.isFunctionExpression(innerDeclaration)) {
|
|
9150
9144
|
return void 0;
|
|
9151
9145
|
}
|
|
9152
9146
|
const adjacentDeclaration = getFarLeftHandSideOfAssignment(innerDeclaration);
|
|
@@ -9179,7 +9173,7 @@ ${declaration.getText()}`);
|
|
|
9179
9173
|
}
|
|
9180
9174
|
}
|
|
9181
9175
|
preprocessStatement(statement) {
|
|
9182
|
-
if (!
|
|
9176
|
+
if (!ts89.isVariableStatement(statement)) {
|
|
9183
9177
|
return;
|
|
9184
9178
|
}
|
|
9185
9179
|
const declarations = statement.declarationList.declarations;
|
|
@@ -9188,7 +9182,7 @@ ${declaration.getText()}`);
|
|
|
9188
9182
|
}
|
|
9189
9183
|
const declaration = declarations[0];
|
|
9190
9184
|
const initializer = declaration.initializer;
|
|
9191
|
-
if (!
|
|
9185
|
+
if (!ts89.isIdentifier(declaration.name) || !initializer || !isAssignment2(initializer) || !ts89.isIdentifier(initializer.left) || !this.isClass(declaration)) {
|
|
9192
9186
|
return;
|
|
9193
9187
|
}
|
|
9194
9188
|
const aliasedIdentifier = initializer.left;
|
|
@@ -9205,11 +9199,11 @@ ${declaration.getText()}`);
|
|
|
9205
9199
|
if (!node) {
|
|
9206
9200
|
return null;
|
|
9207
9201
|
}
|
|
9208
|
-
if (
|
|
9202
|
+
if (ts89.isBinaryExpression(node) && node.operatorToken.kind === ts89.SyntaxKind.EqualsToken) {
|
|
9209
9203
|
const left = node.left;
|
|
9210
9204
|
const right = node.right;
|
|
9211
|
-
if (
|
|
9212
|
-
return
|
|
9205
|
+
if (ts89.isIdentifier(left) && this.checker.getSymbolAtLocation(left) === symbol) {
|
|
9206
|
+
return ts89.isCallExpression(right) && getCalleeName(right) === "__decorate" ? right : null;
|
|
9213
9207
|
}
|
|
9214
9208
|
return this.findDecoratedVariableValue(right, symbol);
|
|
9215
9209
|
}
|
|
@@ -9255,7 +9249,7 @@ ${declaration.getText()}`);
|
|
|
9255
9249
|
getClassDecoratorsFromStaticProperty(decoratorsSymbol) {
|
|
9256
9250
|
const decoratorsIdentifier = decoratorsSymbol.valueDeclaration;
|
|
9257
9251
|
if (decoratorsIdentifier && decoratorsIdentifier.parent) {
|
|
9258
|
-
if (
|
|
9252
|
+
if (ts89.isBinaryExpression(decoratorsIdentifier.parent) && decoratorsIdentifier.parent.operatorToken.kind === ts89.SyntaxKind.EqualsToken) {
|
|
9259
9253
|
const decoratorsArray = decoratorsIdentifier.parent.right;
|
|
9260
9254
|
return this.reflectDecorators(decoratorsArray).filter((decorator) => this.isFromCore(decorator));
|
|
9261
9255
|
}
|
|
@@ -9286,7 +9280,7 @@ ${declaration.getText()}`);
|
|
|
9286
9280
|
}
|
|
9287
9281
|
});
|
|
9288
9282
|
}
|
|
9289
|
-
if (
|
|
9283
|
+
if (ts89.isVariableDeclaration(symbol.declaration.valueDeclaration)) {
|
|
9290
9284
|
if (symbol.declaration.exports) {
|
|
9291
9285
|
symbol.declaration.exports.forEach((value, key) => {
|
|
9292
9286
|
const decorators = decoratorsMap.get(key);
|
|
@@ -9299,7 +9293,7 @@ ${declaration.getText()}`);
|
|
|
9299
9293
|
}
|
|
9300
9294
|
}
|
|
9301
9295
|
if (symbol.adjacent !== void 0) {
|
|
9302
|
-
if (
|
|
9296
|
+
if (ts89.isVariableDeclaration(symbol.adjacent.valueDeclaration)) {
|
|
9303
9297
|
if (symbol.adjacent.exports !== void 0) {
|
|
9304
9298
|
symbol.adjacent.exports.forEach((value, key) => {
|
|
9305
9299
|
const decorators = decoratorsMap.get(key);
|
|
@@ -9330,7 +9324,7 @@ ${declaration.getText()}`);
|
|
|
9330
9324
|
getMemberDecoratorsFromStaticProperty(decoratorsProperty) {
|
|
9331
9325
|
const memberDecorators = new Map();
|
|
9332
9326
|
const propDecoratorsMap = getPropertyValueFromSymbol(decoratorsProperty);
|
|
9333
|
-
if (propDecoratorsMap &&
|
|
9327
|
+
if (propDecoratorsMap && ts89.isObjectLiteralExpression(propDecoratorsMap)) {
|
|
9334
9328
|
const propertiesMap = reflectObjectLiteral(propDecoratorsMap);
|
|
9335
9329
|
propertiesMap.forEach((value, name) => {
|
|
9336
9330
|
const decorators = this.reflectDecorators(value).filter((decorator) => this.isFromCore(decorator));
|
|
@@ -9401,18 +9395,18 @@ ${declaration.getText()}`);
|
|
|
9401
9395
|
return { classDecorators, memberDecorators, constructorParamInfo };
|
|
9402
9396
|
}
|
|
9403
9397
|
reflectDecorateHelperEntry(expression) {
|
|
9404
|
-
if (!
|
|
9398
|
+
if (!ts89.isCallExpression(expression)) {
|
|
9405
9399
|
return null;
|
|
9406
9400
|
}
|
|
9407
9401
|
const call = expression;
|
|
9408
9402
|
const helperName = getCalleeName(call);
|
|
9409
9403
|
if (helperName === "__metadata") {
|
|
9410
9404
|
const key = call.arguments[0];
|
|
9411
|
-
if (key === void 0 || !
|
|
9405
|
+
if (key === void 0 || !ts89.isStringLiteral(key) || key.text !== "design:paramtypes") {
|
|
9412
9406
|
return null;
|
|
9413
9407
|
}
|
|
9414
9408
|
const value = call.arguments[1];
|
|
9415
|
-
if (value === void 0 || !
|
|
9409
|
+
if (value === void 0 || !ts89.isArrayLiteralExpression(value)) {
|
|
9416
9410
|
return null;
|
|
9417
9411
|
}
|
|
9418
9412
|
return {
|
|
@@ -9422,12 +9416,12 @@ ${declaration.getText()}`);
|
|
|
9422
9416
|
}
|
|
9423
9417
|
if (helperName === "__param") {
|
|
9424
9418
|
const indexArg = call.arguments[0];
|
|
9425
|
-
const index = indexArg &&
|
|
9419
|
+
const index = indexArg && ts89.isNumericLiteral(indexArg) ? parseInt(indexArg.text, 10) : NaN;
|
|
9426
9420
|
if (isNaN(index)) {
|
|
9427
9421
|
return null;
|
|
9428
9422
|
}
|
|
9429
9423
|
const decoratorCall = call.arguments[1];
|
|
9430
|
-
if (decoratorCall === void 0 || !
|
|
9424
|
+
if (decoratorCall === void 0 || !ts89.isCallExpression(decoratorCall)) {
|
|
9431
9425
|
return null;
|
|
9432
9426
|
}
|
|
9433
9427
|
const decorator2 = this.reflectDecoratorCall(decoratorCall);
|
|
@@ -9454,7 +9448,7 @@ ${declaration.getText()}`);
|
|
|
9454
9448
|
if (!isDecoratorIdentifier(decoratorExpression)) {
|
|
9455
9449
|
return null;
|
|
9456
9450
|
}
|
|
9457
|
-
const decoratorIdentifier =
|
|
9451
|
+
const decoratorIdentifier = ts89.isIdentifier(decoratorExpression) ? decoratorExpression : decoratorExpression.name;
|
|
9458
9452
|
return {
|
|
9459
9453
|
name: decoratorIdentifier.text,
|
|
9460
9454
|
identifier: decoratorExpression,
|
|
@@ -9464,12 +9458,12 @@ ${declaration.getText()}`);
|
|
|
9464
9458
|
};
|
|
9465
9459
|
}
|
|
9466
9460
|
getHelperCall(statement, helperNames) {
|
|
9467
|
-
if ((
|
|
9461
|
+
if ((ts89.isExpressionStatement(statement) || ts89.isReturnStatement(statement)) && statement.expression) {
|
|
9468
9462
|
let expression = statement.expression;
|
|
9469
9463
|
while (isAssignment2(expression)) {
|
|
9470
9464
|
expression = expression.right;
|
|
9471
9465
|
}
|
|
9472
|
-
if (
|
|
9466
|
+
if (ts89.isCallExpression(expression)) {
|
|
9473
9467
|
const calleeName = getCalleeName(expression);
|
|
9474
9468
|
if (calleeName !== null && helperNames.includes(calleeName)) {
|
|
9475
9469
|
return expression;
|
|
@@ -9480,14 +9474,14 @@ ${declaration.getText()}`);
|
|
|
9480
9474
|
}
|
|
9481
9475
|
reflectDecorators(decoratorsArray) {
|
|
9482
9476
|
const decorators = [];
|
|
9483
|
-
if (
|
|
9477
|
+
if (ts89.isArrayLiteralExpression(decoratorsArray)) {
|
|
9484
9478
|
decoratorsArray.elements.forEach((node) => {
|
|
9485
|
-
if (
|
|
9479
|
+
if (ts89.isObjectLiteralExpression(node)) {
|
|
9486
9480
|
const decorator = reflectObjectLiteral(node);
|
|
9487
9481
|
if (decorator.has("type")) {
|
|
9488
9482
|
let decoratorType = decorator.get("type");
|
|
9489
9483
|
if (isDecoratorIdentifier(decoratorType)) {
|
|
9490
|
-
const decoratorIdentifier =
|
|
9484
|
+
const decoratorIdentifier = ts89.isIdentifier(decoratorType) ? decoratorType : decoratorType.name;
|
|
9491
9485
|
decorators.push({
|
|
9492
9486
|
name: decoratorIdentifier.text,
|
|
9493
9487
|
identifier: decoratorType,
|
|
@@ -9503,10 +9497,10 @@ ${declaration.getText()}`);
|
|
|
9503
9497
|
return decorators;
|
|
9504
9498
|
}
|
|
9505
9499
|
reflectMembers(symbol, decorators, isStatic) {
|
|
9506
|
-
if (symbol.flags &
|
|
9500
|
+
if (symbol.flags & ts89.SymbolFlags.Accessor) {
|
|
9507
9501
|
const members = [];
|
|
9508
|
-
const setter = symbol.declarations && symbol.declarations.find(
|
|
9509
|
-
const getter = symbol.declarations && symbol.declarations.find(
|
|
9502
|
+
const setter = symbol.declarations && symbol.declarations.find(ts89.isSetAccessor);
|
|
9503
|
+
const getter = symbol.declarations && symbol.declarations.find(ts89.isGetAccessor);
|
|
9510
9504
|
const setterMember = setter && this.reflectMember(setter, ClassMemberKind.Setter, decorators, isStatic);
|
|
9511
9505
|
if (setterMember) {
|
|
9512
9506
|
members.push(setterMember);
|
|
@@ -9519,9 +9513,9 @@ ${declaration.getText()}`);
|
|
|
9519
9513
|
return members;
|
|
9520
9514
|
}
|
|
9521
9515
|
let kind = null;
|
|
9522
|
-
if (symbol.flags &
|
|
9516
|
+
if (symbol.flags & ts89.SymbolFlags.Method) {
|
|
9523
9517
|
kind = ClassMemberKind.Method;
|
|
9524
|
-
} else if (symbol.flags &
|
|
9518
|
+
} else if (symbol.flags & ts89.SymbolFlags.Property) {
|
|
9525
9519
|
kind = ClassMemberKind.Property;
|
|
9526
9520
|
}
|
|
9527
9521
|
const node = symbol.valueDeclaration || symbol.declarations && symbol.declarations[0];
|
|
@@ -9549,7 +9543,7 @@ ${declaration.getText()}`);
|
|
|
9549
9543
|
name = node.left.name.text;
|
|
9550
9544
|
value = node.right;
|
|
9551
9545
|
isStatic = false;
|
|
9552
|
-
} else if (
|
|
9546
|
+
} else if (ts89.isConstructorDeclaration(node)) {
|
|
9553
9547
|
kind = ClassMemberKind.Constructor;
|
|
9554
9548
|
name = "constructor";
|
|
9555
9549
|
isStatic = false;
|
|
@@ -9567,7 +9561,7 @@ ${declaration.getText()}`);
|
|
|
9567
9561
|
}
|
|
9568
9562
|
}
|
|
9569
9563
|
if (isStatic === void 0) {
|
|
9570
|
-
isStatic = node.modifiers !== void 0 && node.modifiers.some((mod) => mod.kind ===
|
|
9564
|
+
isStatic = node.modifiers !== void 0 && node.modifiers.some((mod) => mod.kind === ts89.SyntaxKind.StaticKeyword);
|
|
9571
9565
|
}
|
|
9572
9566
|
const type = node.type || null;
|
|
9573
9567
|
return {
|
|
@@ -9640,9 +9634,9 @@ ${declaration.getText()}`);
|
|
|
9640
9634
|
};
|
|
9641
9635
|
}
|
|
9642
9636
|
getImportOfExpression(expression) {
|
|
9643
|
-
if (
|
|
9637
|
+
if (ts89.isIdentifier(expression)) {
|
|
9644
9638
|
return this.getImportOfIdentifier(expression);
|
|
9645
|
-
} else if (
|
|
9639
|
+
} else if (ts89.isPropertyAccessExpression(expression) && ts89.isIdentifier(expression.name)) {
|
|
9646
9640
|
return this.getImportOfIdentifier(expression.name);
|
|
9647
9641
|
} else {
|
|
9648
9642
|
return null;
|
|
@@ -9651,10 +9645,10 @@ ${declaration.getText()}`);
|
|
|
9651
9645
|
getParamInfoFromStaticProperty(paramDecoratorsProperty) {
|
|
9652
9646
|
const paramDecorators = getPropertyValueFromSymbol(paramDecoratorsProperty);
|
|
9653
9647
|
if (paramDecorators) {
|
|
9654
|
-
const container =
|
|
9655
|
-
if (
|
|
9648
|
+
const container = ts89.isArrowFunction(paramDecorators) ? paramDecorators.body : paramDecorators;
|
|
9649
|
+
if (ts89.isArrayLiteralExpression(container)) {
|
|
9656
9650
|
const elements = container.elements;
|
|
9657
|
-
return elements.map((element) =>
|
|
9651
|
+
return elements.map((element) => ts89.isObjectLiteralExpression(element) ? reflectObjectLiteral(element) : null).map((paramInfo) => {
|
|
9658
9652
|
const typeExpression = paramInfo && paramInfo.has("type") ? paramInfo.get("type") : null;
|
|
9659
9653
|
const decoratorInfo = paramInfo && paramInfo.has("decorators") ? paramInfo.get("decorators") : null;
|
|
9660
9654
|
const decorators = decoratorInfo && this.reflectDecorators(decoratorInfo).filter((decorator) => this.isFromCore(decorator));
|
|
@@ -9675,7 +9669,7 @@ ${declaration.getText()}`);
|
|
|
9675
9669
|
return this.getModuleStatements(classNode.getSourceFile());
|
|
9676
9670
|
}
|
|
9677
9671
|
const statement = getContainingStatement(classNode);
|
|
9678
|
-
if (
|
|
9672
|
+
if (ts89.isBlock(statement.parent)) {
|
|
9679
9673
|
return Array.from(statement.parent.statements);
|
|
9680
9674
|
}
|
|
9681
9675
|
throw new Error(`Unable to find adjacent statements for ${classSymbol.name}`);
|
|
@@ -9716,7 +9710,7 @@ ${declaration.getText()}`);
|
|
|
9716
9710
|
if (moduleExports) {
|
|
9717
9711
|
moduleExports.forEach((exportedSymbol) => {
|
|
9718
9712
|
const name = exportedSymbol.name;
|
|
9719
|
-
if (exportedSymbol.flags &
|
|
9713
|
+
if (exportedSymbol.flags & ts89.SymbolFlags.Alias) {
|
|
9720
9714
|
exportedSymbol = checker.getAliasedSymbol(exportedSymbol);
|
|
9721
9715
|
}
|
|
9722
9716
|
const declaration = exportedSymbol.valueDeclaration;
|
|
@@ -9737,14 +9731,14 @@ ${declaration.getText()}`);
|
|
|
9737
9731
|
}
|
|
9738
9732
|
}
|
|
9739
9733
|
getDeclarationOfExpression(expression) {
|
|
9740
|
-
if (
|
|
9734
|
+
if (ts89.isIdentifier(expression)) {
|
|
9741
9735
|
return this.getDeclarationOfIdentifier(expression);
|
|
9742
9736
|
}
|
|
9743
|
-
if (!
|
|
9737
|
+
if (!ts89.isPropertyAccessExpression(expression) || !ts89.isIdentifier(expression.expression)) {
|
|
9744
9738
|
return null;
|
|
9745
9739
|
}
|
|
9746
9740
|
const namespaceDecl = this.getDeclarationOfIdentifier(expression.expression);
|
|
9747
|
-
if (!namespaceDecl || !
|
|
9741
|
+
if (!namespaceDecl || !ts89.isSourceFile(namespaceDecl.node)) {
|
|
9748
9742
|
return null;
|
|
9749
9743
|
}
|
|
9750
9744
|
const namespaceExports = this.getExportsOfModule(namespaceDecl.node);
|
|
@@ -9759,11 +9753,11 @@ ${declaration.getText()}`);
|
|
|
9759
9753
|
}
|
|
9760
9754
|
isJavaScriptObjectDeclaration(decl) {
|
|
9761
9755
|
const node = decl.node;
|
|
9762
|
-
if (!
|
|
9756
|
+
if (!ts89.isVariableDeclaration(node) || !ts89.isIdentifier(node.name) || node.name.text !== "Object" || node.type === void 0) {
|
|
9763
9757
|
return false;
|
|
9764
9758
|
}
|
|
9765
9759
|
const typeNode = node.type;
|
|
9766
|
-
if (!
|
|
9760
|
+
if (!ts89.isTypeReferenceNode(typeNode) || !ts89.isIdentifier(typeNode.typeName) || typeNode.typeName.text !== "ObjectConstructor") {
|
|
9767
9761
|
return false;
|
|
9768
9762
|
}
|
|
9769
9763
|
return this.src.program.isSourceFileDefaultLibrary(node.getSourceFile());
|
|
@@ -9772,22 +9766,22 @@ ${declaration.getText()}`);
|
|
|
9772
9766
|
if (declaration.initializer !== void 0)
|
|
9773
9767
|
return null;
|
|
9774
9768
|
const variableStmt = declaration.parent.parent;
|
|
9775
|
-
if (!
|
|
9769
|
+
if (!ts89.isVariableStatement(variableStmt))
|
|
9776
9770
|
return null;
|
|
9777
9771
|
const block = variableStmt.parent;
|
|
9778
|
-
if (!
|
|
9772
|
+
if (!ts89.isBlock(block) && !ts89.isSourceFile(block))
|
|
9779
9773
|
return null;
|
|
9780
9774
|
const declarationIndex = block.statements.findIndex((statement) => statement === variableStmt);
|
|
9781
9775
|
if (declarationIndex === -1 || declarationIndex === block.statements.length - 1)
|
|
9782
9776
|
return null;
|
|
9783
9777
|
const subsequentStmt = block.statements[declarationIndex + 1];
|
|
9784
|
-
if (!
|
|
9778
|
+
if (!ts89.isExpressionStatement(subsequentStmt))
|
|
9785
9779
|
return null;
|
|
9786
9780
|
const iife = stripParentheses(subsequentStmt.expression);
|
|
9787
|
-
if (!
|
|
9781
|
+
if (!ts89.isCallExpression(iife) || !isEnumDeclarationIife(iife))
|
|
9788
9782
|
return null;
|
|
9789
9783
|
const fn = stripParentheses(iife.expression);
|
|
9790
|
-
if (!
|
|
9784
|
+
if (!ts89.isFunctionExpression(fn))
|
|
9791
9785
|
return null;
|
|
9792
9786
|
return this.reflectEnumMembers(fn);
|
|
9793
9787
|
}
|
|
@@ -9795,7 +9789,7 @@ ${declaration.getText()}`);
|
|
|
9795
9789
|
if (fn.parameters.length !== 1)
|
|
9796
9790
|
return null;
|
|
9797
9791
|
const enumName = fn.parameters[0].name;
|
|
9798
|
-
if (!
|
|
9792
|
+
if (!ts89.isIdentifier(enumName))
|
|
9799
9793
|
return null;
|
|
9800
9794
|
const enumMembers = [];
|
|
9801
9795
|
for (const statement of fn.body.statements) {
|
|
@@ -9808,7 +9802,7 @@ ${declaration.getText()}`);
|
|
|
9808
9802
|
return enumMembers;
|
|
9809
9803
|
}
|
|
9810
9804
|
reflectEnumMember(enumName, statement) {
|
|
9811
|
-
if (!
|
|
9805
|
+
if (!ts89.isExpressionStatement(statement))
|
|
9812
9806
|
return null;
|
|
9813
9807
|
const expression = statement.expression;
|
|
9814
9808
|
if (!isEnumAssignment(enumName, expression)) {
|
|
@@ -9836,78 +9830,78 @@ function isEnumDeclarationIife(iife) {
|
|
|
9836
9830
|
if (iife.arguments.length !== 1)
|
|
9837
9831
|
return false;
|
|
9838
9832
|
const arg = iife.arguments[0];
|
|
9839
|
-
if (!
|
|
9833
|
+
if (!ts89.isBinaryExpression(arg) || arg.operatorToken.kind !== ts89.SyntaxKind.BarBarToken || !ts89.isParenthesizedExpression(arg.right)) {
|
|
9840
9834
|
return false;
|
|
9841
9835
|
}
|
|
9842
9836
|
const right = arg.right.expression;
|
|
9843
|
-
if (!
|
|
9837
|
+
if (!ts89.isBinaryExpression(right) || right.operatorToken.kind !== ts89.SyntaxKind.EqualsToken) {
|
|
9844
9838
|
return false;
|
|
9845
9839
|
}
|
|
9846
|
-
if (!
|
|
9840
|
+
if (!ts89.isObjectLiteralExpression(right.right) || right.right.properties.length !== 0) {
|
|
9847
9841
|
return false;
|
|
9848
9842
|
}
|
|
9849
9843
|
return true;
|
|
9850
9844
|
}
|
|
9851
9845
|
function isEnumAssignment(enumName, expression) {
|
|
9852
|
-
if (!
|
|
9846
|
+
if (!ts89.isBinaryExpression(expression) || expression.operatorToken.kind !== ts89.SyntaxKind.EqualsToken || !ts89.isElementAccessExpression(expression.left)) {
|
|
9853
9847
|
return false;
|
|
9854
9848
|
}
|
|
9855
9849
|
const enumIdentifier = expression.left.expression;
|
|
9856
|
-
return
|
|
9850
|
+
return ts89.isIdentifier(enumIdentifier) && enumIdentifier.text === enumName.text;
|
|
9857
9851
|
}
|
|
9858
9852
|
function reflectEnumAssignment(expression) {
|
|
9859
9853
|
const memberName = expression.left.argumentExpression;
|
|
9860
|
-
if (!
|
|
9854
|
+
if (!ts89.isPropertyName(memberName))
|
|
9861
9855
|
return null;
|
|
9862
9856
|
return { name: memberName, initializer: expression.right };
|
|
9863
9857
|
}
|
|
9864
9858
|
function isAssignmentStatement(statement) {
|
|
9865
|
-
return
|
|
9859
|
+
return ts89.isExpressionStatement(statement) && isAssignment2(statement.expression) && ts89.isIdentifier(statement.expression.left);
|
|
9866
9860
|
}
|
|
9867
9861
|
function getIifeBody(expression) {
|
|
9868
9862
|
const call = stripParentheses(expression);
|
|
9869
|
-
if (!
|
|
9863
|
+
if (!ts89.isCallExpression(call)) {
|
|
9870
9864
|
return void 0;
|
|
9871
9865
|
}
|
|
9872
9866
|
const fn = stripParentheses(call.expression);
|
|
9873
|
-
if (!
|
|
9867
|
+
if (!ts89.isFunctionExpression(fn) && !ts89.isArrowFunction(fn)) {
|
|
9874
9868
|
return void 0;
|
|
9875
9869
|
}
|
|
9876
9870
|
return fn.body;
|
|
9877
9871
|
}
|
|
9878
9872
|
function isAssignment2(node) {
|
|
9879
|
-
return
|
|
9873
|
+
return ts89.isBinaryExpression(node) && node.operatorToken.kind === ts89.SyntaxKind.EqualsToken;
|
|
9880
9874
|
}
|
|
9881
9875
|
function isClassDecorateCall(call, matches) {
|
|
9882
9876
|
const helperArgs = call.arguments[0];
|
|
9883
|
-
if (helperArgs === void 0 || !
|
|
9877
|
+
if (helperArgs === void 0 || !ts89.isArrayLiteralExpression(helperArgs)) {
|
|
9884
9878
|
return false;
|
|
9885
9879
|
}
|
|
9886
9880
|
const target = call.arguments[1];
|
|
9887
|
-
return target !== void 0 &&
|
|
9881
|
+
return target !== void 0 && ts89.isIdentifier(target) && matches(target);
|
|
9888
9882
|
}
|
|
9889
9883
|
function isMemberDecorateCall(call, matches) {
|
|
9890
9884
|
const helperArgs = call.arguments[0];
|
|
9891
|
-
if (helperArgs === void 0 || !
|
|
9885
|
+
if (helperArgs === void 0 || !ts89.isArrayLiteralExpression(helperArgs)) {
|
|
9892
9886
|
return false;
|
|
9893
9887
|
}
|
|
9894
9888
|
const target = call.arguments[1];
|
|
9895
|
-
if (target === void 0 || !
|
|
9889
|
+
if (target === void 0 || !ts89.isPropertyAccessExpression(target) || !ts89.isIdentifier(target.expression) || !matches(target.expression) || target.name.text !== "prototype") {
|
|
9896
9890
|
return false;
|
|
9897
9891
|
}
|
|
9898
9892
|
const memberName = call.arguments[2];
|
|
9899
|
-
return memberName !== void 0 &&
|
|
9893
|
+
return memberName !== void 0 && ts89.isStringLiteral(memberName);
|
|
9900
9894
|
}
|
|
9901
9895
|
function getPropertyValueFromSymbol(propSymbol) {
|
|
9902
9896
|
const propIdentifier = propSymbol.valueDeclaration;
|
|
9903
9897
|
const parent = propIdentifier && propIdentifier.parent;
|
|
9904
|
-
return parent &&
|
|
9898
|
+
return parent && ts89.isBinaryExpression(parent) ? parent.right : void 0;
|
|
9905
9899
|
}
|
|
9906
9900
|
function getCalleeName(call) {
|
|
9907
|
-
if (
|
|
9901
|
+
if (ts89.isIdentifier(call.expression)) {
|
|
9908
9902
|
return stripDollarSuffix(call.expression.text);
|
|
9909
9903
|
}
|
|
9910
|
-
if (
|
|
9904
|
+
if (ts89.isPropertyAccessExpression(call.expression)) {
|
|
9911
9905
|
return stripDollarSuffix(call.expression.name.text);
|
|
9912
9906
|
}
|
|
9913
9907
|
return null;
|
|
@@ -9923,25 +9917,25 @@ function skipClassAliases(node) {
|
|
|
9923
9917
|
return expression;
|
|
9924
9918
|
}
|
|
9925
9919
|
function getInnerClassDeclaration(expression) {
|
|
9926
|
-
if (
|
|
9920
|
+
if (ts89.isClassExpression(expression) && hasNameIdentifier(expression)) {
|
|
9927
9921
|
return expression;
|
|
9928
9922
|
}
|
|
9929
9923
|
const iifeBody = getIifeBody(expression);
|
|
9930
9924
|
if (iifeBody === void 0) {
|
|
9931
9925
|
return null;
|
|
9932
9926
|
}
|
|
9933
|
-
if (!
|
|
9934
|
-
return
|
|
9927
|
+
if (!ts89.isBlock(iifeBody)) {
|
|
9928
|
+
return ts89.isClassExpression(iifeBody) && isNamedDeclaration2(iifeBody) ? iifeBody : null;
|
|
9935
9929
|
} else {
|
|
9936
9930
|
for (const statement of iifeBody.statements) {
|
|
9937
9931
|
if (isNamedClassDeclaration(statement) || isNamedFunctionDeclaration(statement)) {
|
|
9938
9932
|
return statement;
|
|
9939
9933
|
}
|
|
9940
|
-
if (
|
|
9934
|
+
if (ts89.isVariableStatement(statement)) {
|
|
9941
9935
|
for (const declaration of statement.declarationList.declarations) {
|
|
9942
9936
|
if (isInitializedVariableClassDeclaration(declaration)) {
|
|
9943
9937
|
const expression2 = skipClassAliases(declaration);
|
|
9944
|
-
if (
|
|
9938
|
+
if (ts89.isClassExpression(expression2) && hasNameIdentifier(expression2)) {
|
|
9945
9939
|
return expression2;
|
|
9946
9940
|
}
|
|
9947
9941
|
}
|
|
@@ -9952,29 +9946,29 @@ function getInnerClassDeclaration(expression) {
|
|
|
9952
9946
|
return null;
|
|
9953
9947
|
}
|
|
9954
9948
|
function getDecoratorArgs(node) {
|
|
9955
|
-
const argsProperty = node.properties.filter(
|
|
9949
|
+
const argsProperty = node.properties.filter(ts89.isPropertyAssignment).find((property2) => getNameText(property2.name) === "args");
|
|
9956
9950
|
const argsExpression = argsProperty && argsProperty.initializer;
|
|
9957
|
-
return argsExpression &&
|
|
9951
|
+
return argsExpression && ts89.isArrayLiteralExpression(argsExpression) ? Array.from(argsExpression.elements) : [];
|
|
9958
9952
|
}
|
|
9959
9953
|
function isPropertyAccess(node) {
|
|
9960
|
-
return !!node.parent &&
|
|
9954
|
+
return !!node.parent && ts89.isBinaryExpression(node.parent) && ts89.isPropertyAccessExpression(node);
|
|
9961
9955
|
}
|
|
9962
9956
|
function isThisAssignment(node) {
|
|
9963
|
-
return
|
|
9957
|
+
return ts89.isBinaryExpression(node) && ts89.isPropertyAccessExpression(node.left) && node.left.expression.kind === ts89.SyntaxKind.ThisKeyword;
|
|
9964
9958
|
}
|
|
9965
9959
|
function isNamedDeclaration2(node) {
|
|
9966
9960
|
const anyNode = node;
|
|
9967
|
-
return !!anyNode.name &&
|
|
9961
|
+
return !!anyNode.name && ts89.isIdentifier(anyNode.name);
|
|
9968
9962
|
}
|
|
9969
9963
|
function isClassMemberType(node) {
|
|
9970
|
-
return (
|
|
9964
|
+
return (ts89.isClassElement(node) || isPropertyAccess(node) || ts89.isBinaryExpression(node)) && !ts89.isIndexSignatureDeclaration(node);
|
|
9971
9965
|
}
|
|
9972
9966
|
function getFarLeftHandSideOfAssignment(declaration) {
|
|
9973
9967
|
let node = declaration.parent;
|
|
9974
|
-
if (isAssignment2(node) &&
|
|
9968
|
+
if (isAssignment2(node) && ts89.isIdentifier(node.left)) {
|
|
9975
9969
|
node = node.parent;
|
|
9976
9970
|
}
|
|
9977
|
-
return
|
|
9971
|
+
return ts89.isVariableDeclaration(node) ? node : void 0;
|
|
9978
9972
|
}
|
|
9979
9973
|
function getContainingVariableDeclaration(node) {
|
|
9980
9974
|
node = node.parent;
|
|
@@ -9990,23 +9984,23 @@ function isSynthesizedConstructor(constructor) {
|
|
|
9990
9984
|
if (!constructor.body)
|
|
9991
9985
|
return false;
|
|
9992
9986
|
const firstStatement = constructor.body.statements[0];
|
|
9993
|
-
if (!firstStatement || !
|
|
9987
|
+
if (!firstStatement || !ts89.isExpressionStatement(firstStatement))
|
|
9994
9988
|
return false;
|
|
9995
9989
|
return isSynthesizedSuperCall(firstStatement.expression);
|
|
9996
9990
|
}
|
|
9997
9991
|
function isSynthesizedSuperCall(expression) {
|
|
9998
|
-
if (!
|
|
9992
|
+
if (!ts89.isCallExpression(expression))
|
|
9999
9993
|
return false;
|
|
10000
|
-
if (expression.expression.kind !==
|
|
9994
|
+
if (expression.expression.kind !== ts89.SyntaxKind.SuperKeyword)
|
|
10001
9995
|
return false;
|
|
10002
9996
|
if (expression.arguments.length !== 1)
|
|
10003
9997
|
return false;
|
|
10004
9998
|
const argument = expression.arguments[0];
|
|
10005
|
-
return
|
|
9999
|
+
return ts89.isSpreadElement(argument) && ts89.isIdentifier(argument.expression) && argument.expression.text === "arguments";
|
|
10006
10000
|
}
|
|
10007
10001
|
function getContainingStatement(node) {
|
|
10008
10002
|
while (node.parent) {
|
|
10009
|
-
if (
|
|
10003
|
+
if (ts89.isBlock(node.parent) || ts89.isSourceFile(node.parent)) {
|
|
10010
10004
|
break;
|
|
10011
10005
|
}
|
|
10012
10006
|
node = node.parent;
|
|
@@ -10026,30 +10020,30 @@ function getNonRootPackageFiles(bundle) {
|
|
|
10026
10020
|
}
|
|
10027
10021
|
function isTopLevel(node) {
|
|
10028
10022
|
while (node = node.parent) {
|
|
10029
|
-
if (
|
|
10023
|
+
if (ts89.isBlock(node)) {
|
|
10030
10024
|
return false;
|
|
10031
10025
|
}
|
|
10032
10026
|
}
|
|
10033
10027
|
return true;
|
|
10034
10028
|
}
|
|
10035
10029
|
function getOuterNodeFromInnerDeclaration(node) {
|
|
10036
|
-
if (!
|
|
10030
|
+
if (!ts89.isFunctionDeclaration(node) && !ts89.isClassDeclaration(node) && !ts89.isVariableStatement(node)) {
|
|
10037
10031
|
return null;
|
|
10038
10032
|
}
|
|
10039
10033
|
let outerNode = node.parent;
|
|
10040
|
-
if (!outerNode || !
|
|
10034
|
+
if (!outerNode || !ts89.isBlock(outerNode))
|
|
10041
10035
|
return null;
|
|
10042
10036
|
outerNode = outerNode.parent;
|
|
10043
|
-
if (!outerNode || !
|
|
10037
|
+
if (!outerNode || !ts89.isFunctionExpression(outerNode) && !ts89.isArrowFunction(outerNode)) {
|
|
10044
10038
|
return null;
|
|
10045
10039
|
}
|
|
10046
10040
|
outerNode = outerNode.parent;
|
|
10047
|
-
if (outerNode &&
|
|
10041
|
+
if (outerNode && ts89.isParenthesizedExpression(outerNode))
|
|
10048
10042
|
outerNode = outerNode.parent;
|
|
10049
|
-
if (!outerNode || !
|
|
10043
|
+
if (!outerNode || !ts89.isCallExpression(outerNode))
|
|
10050
10044
|
return null;
|
|
10051
10045
|
outerNode = outerNode.parent;
|
|
10052
|
-
if (outerNode &&
|
|
10046
|
+
if (outerNode && ts89.isParenthesizedExpression(outerNode))
|
|
10053
10047
|
outerNode = outerNode.parent;
|
|
10054
10048
|
while (isAssignment2(outerNode.parent)) {
|
|
10055
10049
|
outerNode = outerNode.parent;
|
|
@@ -10058,7 +10052,7 @@ function getOuterNodeFromInnerDeclaration(node) {
|
|
|
10058
10052
|
}
|
|
10059
10053
|
|
|
10060
10054
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/host/esm5_host.mjs
|
|
10061
|
-
import
|
|
10055
|
+
import ts90 from "typescript";
|
|
10062
10056
|
var Esm5ReflectionHost = class extends Esm2015ReflectionHost {
|
|
10063
10057
|
getBaseClassExpression(clazz) {
|
|
10064
10058
|
const superBaseClassExpression = super.getBaseClassExpression(clazz);
|
|
@@ -10071,7 +10065,7 @@ var Esm5ReflectionHost = class extends Esm2015ReflectionHost {
|
|
|
10071
10065
|
if (iife.parameters.length !== 1 || !isSuperIdentifier(iife.parameters[0].name)) {
|
|
10072
10066
|
return null;
|
|
10073
10067
|
}
|
|
10074
|
-
if (!
|
|
10068
|
+
if (!ts90.isCallExpression(iife.parent)) {
|
|
10075
10069
|
return null;
|
|
10076
10070
|
}
|
|
10077
10071
|
return iife.parent.arguments[0];
|
|
@@ -10092,14 +10086,14 @@ var Esm5ReflectionHost = class extends Esm2015ReflectionHost {
|
|
|
10092
10086
|
if (declaration === null || declaration.node === null || declaration.known !== null) {
|
|
10093
10087
|
return declaration;
|
|
10094
10088
|
}
|
|
10095
|
-
if (!
|
|
10089
|
+
if (!ts90.isVariableDeclaration(declaration.node) || declaration.node.initializer !== void 0 || !ts90.isBlock(declaration.node.parent.parent.parent)) {
|
|
10096
10090
|
return declaration;
|
|
10097
10091
|
}
|
|
10098
10092
|
const block = declaration.node.parent.parent.parent;
|
|
10099
10093
|
const aliasSymbol = this.checker.getSymbolAtLocation(declaration.node.name);
|
|
10100
10094
|
for (let i = 0; i < block.statements.length; i++) {
|
|
10101
10095
|
const statement = block.statements[i];
|
|
10102
|
-
if (isAssignmentStatement(statement) &&
|
|
10096
|
+
if (isAssignmentStatement(statement) && ts90.isIdentifier(statement.expression.left) && ts90.isIdentifier(statement.expression.right) && this.checker.getSymbolAtLocation(statement.expression.left) === aliasSymbol) {
|
|
10103
10097
|
return this.getDeclarationOfIdentifier(statement.expression.right);
|
|
10104
10098
|
}
|
|
10105
10099
|
}
|
|
@@ -10143,7 +10137,7 @@ var Esm5ReflectionHost = class extends Esm2015ReflectionHost {
|
|
|
10143
10137
|
}
|
|
10144
10138
|
getConstructorParameterDeclarations(classSymbol) {
|
|
10145
10139
|
const constructor = classSymbol.implementation.valueDeclaration;
|
|
10146
|
-
if (!
|
|
10140
|
+
if (!ts90.isFunctionDeclaration(constructor))
|
|
10147
10141
|
return null;
|
|
10148
10142
|
if (constructor.parameters.length > 0) {
|
|
10149
10143
|
return Array.from(constructor.parameters);
|
|
@@ -10157,7 +10151,7 @@ var Esm5ReflectionHost = class extends Esm2015ReflectionHost {
|
|
|
10157
10151
|
const paramDecorators = getPropertyValueFromSymbol(paramDecoratorsProperty);
|
|
10158
10152
|
const returnStatement = getReturnStatement(paramDecorators);
|
|
10159
10153
|
const expression = returnStatement ? returnStatement.expression : paramDecorators;
|
|
10160
|
-
if (expression &&
|
|
10154
|
+
if (expression && ts90.isArrayLiteralExpression(expression)) {
|
|
10161
10155
|
const elements = expression.elements;
|
|
10162
10156
|
return elements.map(reflectArrayElement).map((paramInfo) => {
|
|
10163
10157
|
const typeExpression = paramInfo && paramInfo.has("type") ? paramInfo.get("type") : null;
|
|
@@ -10206,7 +10200,7 @@ var Esm5ReflectionHost = class extends Esm2015ReflectionHost {
|
|
|
10206
10200
|
}
|
|
10207
10201
|
const members = super.reflectMembers(symbol, decorators, isStatic);
|
|
10208
10202
|
members && members.forEach((member) => {
|
|
10209
|
-
if (member && member.kind === ClassMemberKind.Method && member.isStatic && member.node &&
|
|
10203
|
+
if (member && member.kind === ClassMemberKind.Method && member.isStatic && member.node && ts90.isPropertyAccessExpression(member.node) && member.node.parent && ts90.isBinaryExpression(member.node.parent) && ts90.isFunctionExpression(member.node.parent.right)) {
|
|
10210
10204
|
member.implementation = member.node.parent.right;
|
|
10211
10205
|
}
|
|
10212
10206
|
});
|
|
@@ -10214,7 +10208,7 @@ var Esm5ReflectionHost = class extends Esm2015ReflectionHost {
|
|
|
10214
10208
|
}
|
|
10215
10209
|
getStatementsForClass(classSymbol) {
|
|
10216
10210
|
const classDeclarationParent = classSymbol.implementation.valueDeclaration.parent;
|
|
10217
|
-
return
|
|
10211
|
+
return ts90.isBlock(classDeclarationParent) ? Array.from(classDeclarationParent.statements) : [];
|
|
10218
10212
|
}
|
|
10219
10213
|
isSynthesizedConstructor(constructor) {
|
|
10220
10214
|
if (!constructor.body)
|
|
@@ -10225,13 +10219,13 @@ var Esm5ReflectionHost = class extends Esm2015ReflectionHost {
|
|
|
10225
10219
|
return this.isSynthesizedSuperThisAssignment(firstStatement) || this.isSynthesizedSuperReturnStatement(firstStatement);
|
|
10226
10220
|
}
|
|
10227
10221
|
isSynthesizedSuperThisAssignment(statement) {
|
|
10228
|
-
if (!
|
|
10222
|
+
if (!ts90.isVariableStatement(statement))
|
|
10229
10223
|
return false;
|
|
10230
10224
|
const variableDeclarations = statement.declarationList.declarations;
|
|
10231
10225
|
if (variableDeclarations.length !== 1)
|
|
10232
10226
|
return false;
|
|
10233
10227
|
const variableDeclaration = variableDeclarations[0];
|
|
10234
|
-
if (!
|
|
10228
|
+
if (!ts90.isIdentifier(variableDeclaration.name) || !variableDeclaration.name.text.startsWith("_this"))
|
|
10235
10229
|
return false;
|
|
10236
10230
|
const initializer = variableDeclaration.initializer;
|
|
10237
10231
|
if (!initializer)
|
|
@@ -10239,7 +10233,7 @@ var Esm5ReflectionHost = class extends Esm2015ReflectionHost {
|
|
|
10239
10233
|
return this.isSynthesizedDefaultSuperCall(initializer);
|
|
10240
10234
|
}
|
|
10241
10235
|
isSynthesizedSuperReturnStatement(statement) {
|
|
10242
|
-
if (!
|
|
10236
|
+
if (!ts90.isReturnStatement(statement))
|
|
10243
10237
|
return false;
|
|
10244
10238
|
const expression = statement.expression;
|
|
10245
10239
|
if (!expression)
|
|
@@ -10247,29 +10241,29 @@ var Esm5ReflectionHost = class extends Esm2015ReflectionHost {
|
|
|
10247
10241
|
return this.isSynthesizedDefaultSuperCall(expression);
|
|
10248
10242
|
}
|
|
10249
10243
|
isSynthesizedDefaultSuperCall(expression) {
|
|
10250
|
-
if (!isBinaryExpr(expression,
|
|
10244
|
+
if (!isBinaryExpr(expression, ts90.SyntaxKind.BarBarToken))
|
|
10251
10245
|
return false;
|
|
10252
|
-
if (expression.right.kind !==
|
|
10246
|
+
if (expression.right.kind !== ts90.SyntaxKind.ThisKeyword)
|
|
10253
10247
|
return false;
|
|
10254
10248
|
const left = expression.left;
|
|
10255
|
-
if (isBinaryExpr(left,
|
|
10249
|
+
if (isBinaryExpr(left, ts90.SyntaxKind.AmpersandAmpersandToken)) {
|
|
10256
10250
|
return isSuperNotNull(left.left) && this.isSuperApplyCall(left.right);
|
|
10257
10251
|
} else {
|
|
10258
10252
|
return this.isSuperApplyCall(left);
|
|
10259
10253
|
}
|
|
10260
10254
|
}
|
|
10261
10255
|
isSuperApplyCall(expression) {
|
|
10262
|
-
if (!
|
|
10256
|
+
if (!ts90.isCallExpression(expression) || expression.arguments.length !== 2)
|
|
10263
10257
|
return false;
|
|
10264
10258
|
const targetFn = expression.expression;
|
|
10265
|
-
if (!
|
|
10259
|
+
if (!ts90.isPropertyAccessExpression(targetFn))
|
|
10266
10260
|
return false;
|
|
10267
10261
|
if (!isSuperIdentifier(targetFn.expression))
|
|
10268
10262
|
return false;
|
|
10269
10263
|
if (targetFn.name.text !== "apply")
|
|
10270
10264
|
return false;
|
|
10271
10265
|
const thisArgument = expression.arguments[0];
|
|
10272
|
-
if (thisArgument.kind !==
|
|
10266
|
+
if (thisArgument.kind !== ts90.SyntaxKind.ThisKeyword)
|
|
10273
10267
|
return false;
|
|
10274
10268
|
const argumentsExpr = expression.arguments[1];
|
|
10275
10269
|
if (isArgumentsIdentifier(argumentsExpr)) {
|
|
@@ -10289,7 +10283,7 @@ var Esm5ReflectionHost = class extends Esm2015ReflectionHost {
|
|
|
10289
10283
|
return false;
|
|
10290
10284
|
}
|
|
10291
10285
|
const firstArg = call.args[0];
|
|
10292
|
-
if (!
|
|
10286
|
+
if (!ts90.isArrayLiteralExpression(firstArg) || firstArg.elements.length !== 0) {
|
|
10293
10287
|
return false;
|
|
10294
10288
|
}
|
|
10295
10289
|
const secondArg = this.extractKnownHelperCall(call.args[1]);
|
|
@@ -10302,14 +10296,14 @@ var Esm5ReflectionHost = class extends Esm2015ReflectionHost {
|
|
|
10302
10296
|
}
|
|
10303
10297
|
}
|
|
10304
10298
|
extractKnownHelperCall(expression) {
|
|
10305
|
-
if (!
|
|
10299
|
+
if (!ts90.isCallExpression(expression)) {
|
|
10306
10300
|
return null;
|
|
10307
10301
|
}
|
|
10308
10302
|
const receiverExpr = expression.expression;
|
|
10309
10303
|
let receiver = null;
|
|
10310
|
-
if (
|
|
10304
|
+
if (ts90.isIdentifier(receiverExpr)) {
|
|
10311
10305
|
receiver = this.getDeclarationOfIdentifier(receiverExpr);
|
|
10312
|
-
} else if (
|
|
10306
|
+
} else if (ts90.isPropertyAccessExpression(receiverExpr) && ts90.isIdentifier(receiverExpr.name)) {
|
|
10313
10307
|
receiver = this.getDeclarationOfIdentifier(receiverExpr.name);
|
|
10314
10308
|
}
|
|
10315
10309
|
if (receiver === null || receiver.known === null) {
|
|
@@ -10322,13 +10316,13 @@ var Esm5ReflectionHost = class extends Esm2015ReflectionHost {
|
|
|
10322
10316
|
}
|
|
10323
10317
|
};
|
|
10324
10318
|
function getPropertyDefinition(node) {
|
|
10325
|
-
if (!
|
|
10319
|
+
if (!ts90.isCallExpression(node))
|
|
10326
10320
|
return null;
|
|
10327
10321
|
const fn = node.expression;
|
|
10328
|
-
if (!
|
|
10322
|
+
if (!ts90.isPropertyAccessExpression(fn) || !ts90.isIdentifier(fn.expression) || fn.expression.text !== "Object" || fn.name.text !== "defineProperty")
|
|
10329
10323
|
return null;
|
|
10330
10324
|
const descriptor = node.arguments[2];
|
|
10331
|
-
if (!descriptor || !
|
|
10325
|
+
if (!descriptor || !ts90.isObjectLiteralExpression(descriptor))
|
|
10332
10326
|
return null;
|
|
10333
10327
|
return {
|
|
10334
10328
|
setter: readPropertyFunctionExpression(descriptor, "set"),
|
|
@@ -10336,29 +10330,29 @@ function getPropertyDefinition(node) {
|
|
|
10336
10330
|
};
|
|
10337
10331
|
}
|
|
10338
10332
|
function readPropertyFunctionExpression(object, name) {
|
|
10339
|
-
const property2 = object.properties.find((p2) =>
|
|
10340
|
-
return property2 &&
|
|
10333
|
+
const property2 = object.properties.find((p2) => ts90.isPropertyAssignment(p2) && ts90.isIdentifier(p2.name) && p2.name.text === name);
|
|
10334
|
+
return property2 && ts90.isFunctionExpression(property2.initializer) && property2.initializer || null;
|
|
10341
10335
|
}
|
|
10342
10336
|
function getReturnStatement(declaration) {
|
|
10343
|
-
return declaration &&
|
|
10337
|
+
return declaration && ts90.isFunctionExpression(declaration) ? declaration.body.statements.find(ts90.isReturnStatement) : void 0;
|
|
10344
10338
|
}
|
|
10345
10339
|
function reflectArrayElement(element) {
|
|
10346
|
-
return
|
|
10340
|
+
return ts90.isObjectLiteralExpression(element) ? reflectObjectLiteral(element) : null;
|
|
10347
10341
|
}
|
|
10348
10342
|
function isArgumentsIdentifier(expression) {
|
|
10349
|
-
return
|
|
10343
|
+
return ts90.isIdentifier(expression) && expression.text === "arguments";
|
|
10350
10344
|
}
|
|
10351
10345
|
function isSuperNotNull(expression) {
|
|
10352
|
-
return isBinaryExpr(expression,
|
|
10346
|
+
return isBinaryExpr(expression, ts90.SyntaxKind.ExclamationEqualsEqualsToken) && isSuperIdentifier(expression.left);
|
|
10353
10347
|
}
|
|
10354
10348
|
function isBinaryExpr(expression, operator) {
|
|
10355
|
-
return
|
|
10349
|
+
return ts90.isBinaryExpression(expression) && expression.operatorToken.kind === operator;
|
|
10356
10350
|
}
|
|
10357
10351
|
function isSuperIdentifier(node) {
|
|
10358
|
-
return
|
|
10352
|
+
return ts90.isIdentifier(node) && node.text.startsWith("_super");
|
|
10359
10353
|
}
|
|
10360
10354
|
function captureParamInitializer(statement, parameters) {
|
|
10361
|
-
if (
|
|
10355
|
+
if (ts90.isIfStatement(statement) && isUndefinedComparison(statement.expression) && ts90.isBlock(statement.thenStatement) && statement.thenStatement.statements.length === 1) {
|
|
10362
10356
|
const ifStatementComparison = statement.expression;
|
|
10363
10357
|
const thenStatement = statement.thenStatement.statements[0];
|
|
10364
10358
|
if (isAssignmentStatement(thenStatement)) {
|
|
@@ -10376,7 +10370,7 @@ function captureParamInitializer(statement, parameters) {
|
|
|
10376
10370
|
return false;
|
|
10377
10371
|
}
|
|
10378
10372
|
function isUndefinedComparison(expression) {
|
|
10379
|
-
return
|
|
10373
|
+
return ts90.isBinaryExpression(expression) && expression.operatorToken.kind === ts90.SyntaxKind.EqualsEqualsEqualsToken && ts90.isVoidExpression(expression.right) && ts90.isIdentifier(expression.left);
|
|
10380
10374
|
}
|
|
10381
10375
|
function getIifeFn(classSymbol) {
|
|
10382
10376
|
if (classSymbol === void 0) {
|
|
@@ -10384,11 +10378,11 @@ function getIifeFn(classSymbol) {
|
|
|
10384
10378
|
}
|
|
10385
10379
|
const innerDeclaration = classSymbol.implementation.valueDeclaration;
|
|
10386
10380
|
const iifeBody = innerDeclaration.parent;
|
|
10387
|
-
if (!
|
|
10381
|
+
if (!ts90.isBlock(iifeBody)) {
|
|
10388
10382
|
return null;
|
|
10389
10383
|
}
|
|
10390
10384
|
const iifeWrapper = iifeBody.parent;
|
|
10391
|
-
return iifeWrapper &&
|
|
10385
|
+
return iifeWrapper && ts90.isFunctionExpression(iifeWrapper) ? iifeWrapper : null;
|
|
10392
10386
|
}
|
|
10393
10387
|
|
|
10394
10388
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/host/umd_host.mjs
|
|
@@ -10456,7 +10450,7 @@ var UmdReflectionHost = class extends Esm5ReflectionHost {
|
|
|
10456
10450
|
return void 0;
|
|
10457
10451
|
}
|
|
10458
10452
|
let initializer = skipAliases(declaration.parent.right);
|
|
10459
|
-
if (
|
|
10453
|
+
if (ts91.isIdentifier(initializer)) {
|
|
10460
10454
|
const implementation = this.getDeclarationOfIdentifier(initializer);
|
|
10461
10455
|
if (implementation !== null) {
|
|
10462
10456
|
const implementationSymbol = this.getClassSymbol(implementation.node);
|
|
@@ -10501,7 +10495,7 @@ var UmdReflectionHost = class extends Esm5ReflectionHost {
|
|
|
10501
10495
|
}
|
|
10502
10496
|
const declaration = statement.expression.left;
|
|
10503
10497
|
const initializer = statement.expression.right;
|
|
10504
|
-
if (!isAssignment2(initializer) || !
|
|
10498
|
+
if (!isAssignment2(initializer) || !ts91.isIdentifier(initializer.left) || !this.isClass(declaration)) {
|
|
10505
10499
|
return;
|
|
10506
10500
|
}
|
|
10507
10501
|
const aliasedIdentifier = initializer.left;
|
|
@@ -10572,11 +10566,11 @@ var UmdReflectionHost = class extends Esm5ReflectionHost {
|
|
|
10572
10566
|
}
|
|
10573
10567
|
extractUmdWildcardReexports(statement, containingFile) {
|
|
10574
10568
|
const reexportArg = statement.expression.arguments[0];
|
|
10575
|
-
const requireCall = isRequireCall(reexportArg) ? reexportArg :
|
|
10569
|
+
const requireCall = isRequireCall(reexportArg) ? reexportArg : ts91.isIdentifier(reexportArg) ? findRequireCallReference(reexportArg, this.checker) : null;
|
|
10576
10570
|
let importPath = null;
|
|
10577
10571
|
if (requireCall !== null) {
|
|
10578
10572
|
importPath = requireCall.arguments[0].text;
|
|
10579
|
-
} else if (
|
|
10573
|
+
} else if (ts91.isIdentifier(reexportArg)) {
|
|
10580
10574
|
const importParameter = this.findUmdImportParameter(reexportArg);
|
|
10581
10575
|
importPath = importParameter && this.getUmdImportPath(importParameter);
|
|
10582
10576
|
}
|
|
@@ -10621,7 +10615,7 @@ var UmdReflectionHost = class extends Esm5ReflectionHost {
|
|
|
10621
10615
|
findUmdImportParameter(id) {
|
|
10622
10616
|
const symbol = id && this.checker.getSymbolAtLocation(id) || null;
|
|
10623
10617
|
const declaration = symbol && symbol.valueDeclaration;
|
|
10624
|
-
return declaration &&
|
|
10618
|
+
return declaration && ts91.isParameter(declaration) ? declaration : null;
|
|
10625
10619
|
}
|
|
10626
10620
|
getUmdDeclaration(id) {
|
|
10627
10621
|
const nsIdentifier = findNamespaceOfIdentifier(id);
|
|
@@ -10630,7 +10624,7 @@ var UmdReflectionHost = class extends Esm5ReflectionHost {
|
|
|
10630
10624
|
}
|
|
10631
10625
|
if (nsIdentifier.parent.parent && isExportsAssignment(nsIdentifier.parent.parent)) {
|
|
10632
10626
|
const initializer = nsIdentifier.parent.parent.right;
|
|
10633
|
-
if (
|
|
10627
|
+
if (ts91.isIdentifier(initializer)) {
|
|
10634
10628
|
return this.getDeclarationOfIdentifier(initializer);
|
|
10635
10629
|
}
|
|
10636
10630
|
return this.detectKnownDeclaration({
|
|
@@ -10642,7 +10636,7 @@ var UmdReflectionHost = class extends Esm5ReflectionHost {
|
|
|
10642
10636
|
});
|
|
10643
10637
|
}
|
|
10644
10638
|
const moduleDeclaration = this.getUmdModuleDeclaration(nsIdentifier);
|
|
10645
|
-
if (moduleDeclaration === null || moduleDeclaration.node === null || !
|
|
10639
|
+
if (moduleDeclaration === null || moduleDeclaration.node === null || !ts91.isSourceFile(moduleDeclaration.node)) {
|
|
10646
10640
|
return null;
|
|
10647
10641
|
}
|
|
10648
10642
|
const moduleExports = this.getExportsOfModule(moduleDeclaration.node);
|
|
@@ -10660,8 +10654,8 @@ var UmdReflectionHost = class extends Esm5ReflectionHost {
|
|
|
10660
10654
|
if (!isExportsIdentifier(id)) {
|
|
10661
10655
|
return null;
|
|
10662
10656
|
}
|
|
10663
|
-
const exportsSymbol = this.checker.getSymbolsInScope(id,
|
|
10664
|
-
const node = (exportsSymbol == null ? void 0 : exportsSymbol.valueDeclaration) !== void 0 && !
|
|
10657
|
+
const exportsSymbol = this.checker.getSymbolsInScope(id, ts91.SymbolFlags.Variable).find((symbol) => symbol.name === "exports");
|
|
10658
|
+
const node = (exportsSymbol == null ? void 0 : exportsSymbol.valueDeclaration) !== void 0 && !ts91.isFunctionExpression(exportsSymbol.valueDeclaration.parent) ? exportsSymbol.valueDeclaration : id.getSourceFile();
|
|
10665
10659
|
return {
|
|
10666
10660
|
kind: 0,
|
|
10667
10661
|
node,
|
|
@@ -10717,7 +10711,7 @@ var UmdReflectionHost = class extends Esm5ReflectionHost {
|
|
|
10717
10711
|
const moduleInfo = this.compilerHost.resolveModuleNames([moduleName], containingFile.fileName, void 0, void 0, this.program.getCompilerOptions())[0];
|
|
10718
10712
|
return moduleInfo && this.program.getSourceFile(absoluteFrom(moduleInfo.resolvedFileName));
|
|
10719
10713
|
} else {
|
|
10720
|
-
const moduleInfo =
|
|
10714
|
+
const moduleInfo = ts91.resolveModuleName(moduleName, containingFile.fileName, this.program.getCompilerOptions(), this.compilerHost);
|
|
10721
10715
|
return moduleInfo.resolvedModule && this.program.getSourceFile(absoluteFrom(moduleInfo.resolvedModule.resolvedFileName));
|
|
10722
10716
|
}
|
|
10723
10717
|
}
|
|
@@ -10726,60 +10720,176 @@ function parseStatementForUmdModule(statement) {
|
|
|
10726
10720
|
const wrapper = getUmdWrapper(statement);
|
|
10727
10721
|
if (wrapper === null)
|
|
10728
10722
|
return null;
|
|
10729
|
-
const factoryFnParamIndex = wrapper.fn.parameters.findIndex((parameter) =>
|
|
10723
|
+
const factoryFnParamIndex = wrapper.fn.parameters.findIndex((parameter) => ts91.isIdentifier(parameter.name) && parameter.name.text === "factory");
|
|
10730
10724
|
if (factoryFnParamIndex === -1)
|
|
10731
10725
|
return null;
|
|
10732
10726
|
const factoryFn = stripParentheses(wrapper.call.arguments[factoryFnParamIndex]);
|
|
10733
|
-
if (!factoryFn || !
|
|
10727
|
+
if (!factoryFn || !ts91.isFunctionExpression(factoryFn))
|
|
10734
10728
|
return null;
|
|
10735
|
-
|
|
10729
|
+
let factoryCalls = null;
|
|
10730
|
+
return {
|
|
10731
|
+
wrapperFn: wrapper.fn,
|
|
10732
|
+
factoryFn,
|
|
10733
|
+
get factoryCalls() {
|
|
10734
|
+
if (factoryCalls === null) {
|
|
10735
|
+
factoryCalls = parseUmdWrapperFunction(this.wrapperFn);
|
|
10736
|
+
}
|
|
10737
|
+
return factoryCalls;
|
|
10738
|
+
}
|
|
10739
|
+
};
|
|
10736
10740
|
}
|
|
10737
10741
|
function getUmdWrapper(statement) {
|
|
10738
|
-
if (!
|
|
10742
|
+
if (!ts91.isExpressionStatement(statement))
|
|
10739
10743
|
return null;
|
|
10740
|
-
if (
|
|
10744
|
+
if (ts91.isParenthesizedExpression(statement.expression) && ts91.isCallExpression(statement.expression.expression) && ts91.isFunctionExpression(statement.expression.expression.expression)) {
|
|
10741
10745
|
const call = statement.expression.expression;
|
|
10742
10746
|
const fn = statement.expression.expression.expression;
|
|
10743
10747
|
return { call, fn };
|
|
10744
10748
|
}
|
|
10745
|
-
if (
|
|
10749
|
+
if (ts91.isCallExpression(statement.expression) && ts91.isParenthesizedExpression(statement.expression.expression) && ts91.isFunctionExpression(statement.expression.expression.expression)) {
|
|
10746
10750
|
const call = statement.expression;
|
|
10747
10751
|
const fn = statement.expression.expression.expression;
|
|
10748
10752
|
return { call, fn };
|
|
10749
10753
|
}
|
|
10750
10754
|
return null;
|
|
10751
10755
|
}
|
|
10752
|
-
function
|
|
10753
|
-
const
|
|
10754
|
-
|
|
10755
|
-
|
|
10756
|
-
|
|
10757
|
-
|
|
10756
|
+
function parseUmdWrapperFunction(wrapperFn) {
|
|
10757
|
+
const stmt = wrapperFn.body.statements[0];
|
|
10758
|
+
let conditionalFactoryCalls;
|
|
10759
|
+
if (ts91.isExpressionStatement(stmt) && ts91.isConditionalExpression(stmt.expression)) {
|
|
10760
|
+
conditionalFactoryCalls = extractFactoryCallsFromConditionalExpression(stmt.expression);
|
|
10761
|
+
} else if (ts91.isIfStatement(stmt)) {
|
|
10762
|
+
conditionalFactoryCalls = extractFactoryCallsFromIfStatement(stmt);
|
|
10763
|
+
} else {
|
|
10764
|
+
throw new Error("UMD wrapper body is not in a supported format (expected a conditional expression or if statement):\n" + wrapperFn.body.getText());
|
|
10765
|
+
}
|
|
10766
|
+
const amdDefine = getAmdDefineCall(conditionalFactoryCalls);
|
|
10767
|
+
const commonJs = getCommonJsFactoryCall(conditionalFactoryCalls);
|
|
10768
|
+
const commonJs2 = getCommonJs2FactoryCall(conditionalFactoryCalls);
|
|
10769
|
+
const global = getGlobalFactoryCall(conditionalFactoryCalls);
|
|
10770
|
+
const cjsCallForImports = commonJs2 || commonJs;
|
|
10771
|
+
if (cjsCallForImports === null) {
|
|
10772
|
+
throw new Error("Unable to find a CommonJS or CommonJS2 factory call inside the UMD wrapper function:\n" + stmt.getText());
|
|
10773
|
+
}
|
|
10774
|
+
return { amdDefine, commonJs, commonJs2, global, cjsCallForImports };
|
|
10775
|
+
}
|
|
10776
|
+
function extractFactoryCallsFromConditionalExpression(node) {
|
|
10777
|
+
const factoryCalls = [];
|
|
10778
|
+
let currentNode = node;
|
|
10779
|
+
while (ts91.isConditionalExpression(currentNode)) {
|
|
10780
|
+
if (!ts91.isBinaryExpression(currentNode.condition)) {
|
|
10781
|
+
throw new Error("Condition inside UMD wrapper is not a binary expression:\n" + currentNode.condition.getText());
|
|
10782
|
+
}
|
|
10783
|
+
factoryCalls.push({
|
|
10784
|
+
condition: currentNode.condition,
|
|
10785
|
+
factoryCall: getFunctionCallFromExpression(currentNode.whenTrue)
|
|
10758
10786
|
});
|
|
10787
|
+
currentNode = currentNode.whenFalse;
|
|
10759
10788
|
}
|
|
10760
|
-
|
|
10789
|
+
factoryCalls.push({
|
|
10790
|
+
condition: null,
|
|
10791
|
+
factoryCall: getFunctionCallFromExpression(currentNode)
|
|
10792
|
+
});
|
|
10793
|
+
return factoryCalls;
|
|
10761
10794
|
}
|
|
10762
|
-
function
|
|
10763
|
-
const
|
|
10764
|
-
|
|
10765
|
-
|
|
10795
|
+
function extractFactoryCallsFromIfStatement(node) {
|
|
10796
|
+
const factoryCalls = [];
|
|
10797
|
+
let currentNode = node;
|
|
10798
|
+
while (currentNode && ts91.isIfStatement(currentNode)) {
|
|
10799
|
+
if (!ts91.isBinaryExpression(currentNode.expression)) {
|
|
10800
|
+
throw new Error("Condition inside UMD wrapper is not a binary expression:\n" + currentNode.expression.getText());
|
|
10801
|
+
}
|
|
10802
|
+
if (!ts91.isExpressionStatement(currentNode.thenStatement)) {
|
|
10803
|
+
throw new Error("Then-statement inside UMD wrapper is not an expression statement:\n" + currentNode.thenStatement.getText());
|
|
10804
|
+
}
|
|
10805
|
+
factoryCalls.push({
|
|
10806
|
+
condition: currentNode.expression,
|
|
10807
|
+
factoryCall: getFunctionCallFromExpression(currentNode.thenStatement.expression)
|
|
10808
|
+
});
|
|
10809
|
+
currentNode = currentNode.elseStatement;
|
|
10766
10810
|
}
|
|
10767
|
-
|
|
10768
|
-
|
|
10769
|
-
|
|
10770
|
-
function findModulePaths(node) {
|
|
10771
|
-
if (isRequireCall(node)) {
|
|
10772
|
-
const argument = node.arguments[0];
|
|
10773
|
-
if (ts93.isStringLiteral(argument)) {
|
|
10774
|
-
modulePaths.push(argument.text);
|
|
10775
|
-
}
|
|
10776
|
-
} else {
|
|
10777
|
-
node.forEachChild(findModulePaths);
|
|
10811
|
+
if (currentNode) {
|
|
10812
|
+
if (!ts91.isExpressionStatement(currentNode)) {
|
|
10813
|
+
throw new Error("Else-statement inside UMD wrapper is not an expression statement:\n" + currentNode.getText());
|
|
10778
10814
|
}
|
|
10815
|
+
factoryCalls.push({
|
|
10816
|
+
condition: null,
|
|
10817
|
+
factoryCall: getFunctionCallFromExpression(currentNode.expression)
|
|
10818
|
+
});
|
|
10779
10819
|
}
|
|
10820
|
+
return factoryCalls;
|
|
10821
|
+
}
|
|
10822
|
+
function getFunctionCallFromExpression(node) {
|
|
10823
|
+
if (ts91.isParenthesizedExpression(node)) {
|
|
10824
|
+
return getFunctionCallFromExpression(node.expression);
|
|
10825
|
+
}
|
|
10826
|
+
if (ts91.isBinaryExpression(node) && [ts91.SyntaxKind.CommaToken, ts91.SyntaxKind.EqualsToken].includes(node.operatorToken.kind)) {
|
|
10827
|
+
return getFunctionCallFromExpression(node.right);
|
|
10828
|
+
}
|
|
10829
|
+
if (!ts91.isCallExpression(node)) {
|
|
10830
|
+
throw new Error("Expression inside UMD wrapper is not a call expression:\n" + node.getText());
|
|
10831
|
+
}
|
|
10832
|
+
return node;
|
|
10833
|
+
}
|
|
10834
|
+
function getAmdDefineCall(calls) {
|
|
10835
|
+
var _a;
|
|
10836
|
+
const amdConditionalCall = calls.find((call) => {
|
|
10837
|
+
var _a2;
|
|
10838
|
+
return ((_a2 = call.condition) == null ? void 0 : _a2.operatorToken.kind) === ts91.SyntaxKind.AmpersandAmpersandToken && oneOfBinaryConditions(call.condition, (exp) => isTypeOf(exp, "define")) && ts91.isIdentifier(call.factoryCall.expression) && call.factoryCall.expression.text === "define";
|
|
10839
|
+
});
|
|
10840
|
+
return (_a = amdConditionalCall == null ? void 0 : amdConditionalCall.factoryCall) != null ? _a : null;
|
|
10841
|
+
}
|
|
10842
|
+
function getCommonJsFactoryCall(calls) {
|
|
10843
|
+
var _a;
|
|
10844
|
+
const cjsConditionalCall = calls.find((call) => {
|
|
10845
|
+
var _a2;
|
|
10846
|
+
return ((_a2 = call.condition) == null ? void 0 : _a2.operatorToken.kind) === ts91.SyntaxKind.EqualsEqualsEqualsToken && isTypeOf(call.condition, "exports") && ts91.isIdentifier(call.factoryCall.expression) && call.factoryCall.expression.text === "factory";
|
|
10847
|
+
});
|
|
10848
|
+
return (_a = cjsConditionalCall == null ? void 0 : cjsConditionalCall.factoryCall) != null ? _a : null;
|
|
10849
|
+
}
|
|
10850
|
+
function getCommonJs2FactoryCall(calls) {
|
|
10851
|
+
var _a;
|
|
10852
|
+
const cjs2ConditionalCall = calls.find((call) => {
|
|
10853
|
+
var _a2;
|
|
10854
|
+
return ((_a2 = call.condition) == null ? void 0 : _a2.operatorToken.kind) === ts91.SyntaxKind.AmpersandAmpersandToken && oneOfBinaryConditions(call.condition, (exp) => isTypeOf(exp, "exports", "module")) && ts91.isIdentifier(call.factoryCall.expression) && call.factoryCall.expression.text === "factory";
|
|
10855
|
+
});
|
|
10856
|
+
return (_a = cjs2ConditionalCall == null ? void 0 : cjs2ConditionalCall.factoryCall) != null ? _a : null;
|
|
10857
|
+
}
|
|
10858
|
+
function getGlobalFactoryCall(calls) {
|
|
10859
|
+
var _a;
|
|
10860
|
+
const globalConditionalCall = calls.find((call) => call.condition === null);
|
|
10861
|
+
return (_a = globalConditionalCall == null ? void 0 : globalConditionalCall.factoryCall) != null ? _a : null;
|
|
10862
|
+
}
|
|
10863
|
+
function oneOfBinaryConditions(node, test) {
|
|
10864
|
+
return test(node.left) || test(node.right);
|
|
10865
|
+
}
|
|
10866
|
+
function isTypeOf(node, ...types) {
|
|
10867
|
+
return ts91.isBinaryExpression(node) && ts91.isTypeOfExpression(node.left) && ts91.isIdentifier(node.left.expression) && types.includes(node.left.expression.text);
|
|
10868
|
+
}
|
|
10869
|
+
function getImportsOfUmdModule(umdModule) {
|
|
10870
|
+
const imports = [];
|
|
10871
|
+
const cjsFactoryCall = umdModule.factoryCalls.cjsCallForImports;
|
|
10872
|
+
const depStartIndex = cjsFactoryCall.arguments.findIndex((arg) => isRequireCall(arg));
|
|
10873
|
+
if (depStartIndex !== -1) {
|
|
10874
|
+
for (let i = depStartIndex; i < umdModule.factoryFn.parameters.length; i++) {
|
|
10875
|
+
imports.push({
|
|
10876
|
+
parameter: umdModule.factoryFn.parameters[i],
|
|
10877
|
+
path: getRequiredModulePath(cjsFactoryCall, i)
|
|
10878
|
+
});
|
|
10879
|
+
}
|
|
10880
|
+
}
|
|
10881
|
+
return imports;
|
|
10882
|
+
}
|
|
10883
|
+
function getRequiredModulePath(cjsFactoryCall, paramIndex) {
|
|
10884
|
+
const requireCall = cjsFactoryCall.arguments[paramIndex];
|
|
10885
|
+
if (requireCall !== void 0 && !isRequireCall(requireCall)) {
|
|
10886
|
+
throw new Error(`Argument at index ${paramIndex} of UMD factory call is not a \`require\` call with a single string argument:
|
|
10887
|
+
` + cjsFactoryCall.getText());
|
|
10888
|
+
}
|
|
10889
|
+
return requireCall.arguments[0].text;
|
|
10780
10890
|
}
|
|
10781
10891
|
function isExportsIdentifier(node) {
|
|
10782
|
-
return
|
|
10892
|
+
return ts91.isIdentifier(node) && node.text === "exports";
|
|
10783
10893
|
}
|
|
10784
10894
|
|
|
10785
10895
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/packages/entry_point.mjs
|
|
@@ -10823,11 +10933,11 @@ function sniffModuleFormat(fs5, sourceFilePath) {
|
|
|
10823
10933
|
if (resolvedPath === null) {
|
|
10824
10934
|
return void 0;
|
|
10825
10935
|
}
|
|
10826
|
-
const sourceFile =
|
|
10936
|
+
const sourceFile = ts92.createSourceFile(sourceFilePath, fs5.readFile(resolvedPath), ts92.ScriptTarget.ES5);
|
|
10827
10937
|
if (sourceFile.statements.length === 0) {
|
|
10828
10938
|
return void 0;
|
|
10829
10939
|
}
|
|
10830
|
-
if (
|
|
10940
|
+
if (ts92.isExternalModule(sourceFile)) {
|
|
10831
10941
|
return "esm5";
|
|
10832
10942
|
} else if (parseStatementForUmdModule(sourceFile.statements[0]) !== null) {
|
|
10833
10943
|
return "umd";
|
|
@@ -11063,7 +11173,7 @@ If you did intend to use this file, then you can hide this warning by providing
|
|
|
11063
11173
|
}
|
|
11064
11174
|
|
|
11065
11175
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/execution/create_compile_function.mjs
|
|
11066
|
-
import
|
|
11176
|
+
import ts107 from "typescript";
|
|
11067
11177
|
|
|
11068
11178
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/execution/tasks/api.mjs
|
|
11069
11179
|
var DtsProcessing;
|
|
@@ -11074,20 +11184,20 @@ var DtsProcessing;
|
|
|
11074
11184
|
})(DtsProcessing || (DtsProcessing = {}));
|
|
11075
11185
|
|
|
11076
11186
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/packages/bundle_program.mjs
|
|
11077
|
-
import
|
|
11187
|
+
import ts94 from "typescript";
|
|
11078
11188
|
|
|
11079
11189
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/packages/patch_ts_expando_initializer.mjs
|
|
11080
|
-
import
|
|
11190
|
+
import ts93 from "typescript";
|
|
11081
11191
|
function patchTsGetExpandoInitializer() {
|
|
11082
11192
|
if (isTs31778GetExpandoInitializerFixed()) {
|
|
11083
11193
|
return null;
|
|
11084
11194
|
}
|
|
11085
|
-
const originalGetExpandoInitializer =
|
|
11195
|
+
const originalGetExpandoInitializer = ts93.getExpandoInitializer;
|
|
11086
11196
|
if (originalGetExpandoInitializer === void 0) {
|
|
11087
11197
|
throw makeUnsupportedTypeScriptError();
|
|
11088
11198
|
}
|
|
11089
|
-
|
|
11090
|
-
if (
|
|
11199
|
+
ts93.getExpandoInitializer = (initializer, isPrototypeAssignment) => {
|
|
11200
|
+
if (ts93.isParenthesizedExpression(initializer) && ts93.isCallExpression(initializer.expression)) {
|
|
11091
11201
|
initializer = initializer.expression;
|
|
11092
11202
|
}
|
|
11093
11203
|
return originalGetExpandoInitializer(initializer, isPrototypeAssignment);
|
|
@@ -11096,7 +11206,7 @@ function patchTsGetExpandoInitializer() {
|
|
|
11096
11206
|
}
|
|
11097
11207
|
function restoreGetExpandoInitializer(originalGetExpandoInitializer) {
|
|
11098
11208
|
if (originalGetExpandoInitializer !== null) {
|
|
11099
|
-
|
|
11209
|
+
ts93.getExpandoInitializer = originalGetExpandoInitializer;
|
|
11100
11210
|
}
|
|
11101
11211
|
}
|
|
11102
11212
|
var ts31778FixedResult = null;
|
|
@@ -11127,7 +11237,7 @@ function checkIfExpandoPropertyIsPresent() {
|
|
|
11127
11237
|
}());
|
|
11128
11238
|
A.expando = true;
|
|
11129
11239
|
}());`;
|
|
11130
|
-
const sourceFile =
|
|
11240
|
+
const sourceFile = ts93.createSourceFile("test.js", sourceText, ts93.ScriptTarget.ES5, true, ts93.ScriptKind.JS);
|
|
11131
11241
|
const host = {
|
|
11132
11242
|
getSourceFile() {
|
|
11133
11243
|
return sourceFile;
|
|
@@ -11160,14 +11270,14 @@ function checkIfExpandoPropertyIsPresent() {
|
|
|
11160
11270
|
}
|
|
11161
11271
|
};
|
|
11162
11272
|
const options = { noResolve: true, noLib: true, noEmit: true, allowJs: true };
|
|
11163
|
-
const program =
|
|
11273
|
+
const program = ts93.createProgram(["test.js"], options, host);
|
|
11164
11274
|
function visitor(node) {
|
|
11165
|
-
if (
|
|
11275
|
+
if (ts93.isVariableDeclaration(node) && hasNameIdentifier(node) && node.name.text === "A") {
|
|
11166
11276
|
return node;
|
|
11167
11277
|
}
|
|
11168
|
-
return
|
|
11278
|
+
return ts93.forEachChild(node, visitor);
|
|
11169
11279
|
}
|
|
11170
|
-
const declaration =
|
|
11280
|
+
const declaration = ts93.forEachChild(sourceFile, visitor);
|
|
11171
11281
|
if (declaration === void 0) {
|
|
11172
11282
|
throw new Error("Unable to find declaration of outer A");
|
|
11173
11283
|
}
|
|
@@ -11186,7 +11296,7 @@ function makeBundleProgram(fs5, isCore, pkg, path7, r3FileName, options, host, a
|
|
|
11186
11296
|
const r3SymbolsPath = isCore ? findR3SymbolsPath(fs5, fs5.dirname(path7), r3FileName) : null;
|
|
11187
11297
|
let rootPaths = r3SymbolsPath ? [path7, r3SymbolsPath, ...additionalFiles] : [path7, ...additionalFiles];
|
|
11188
11298
|
const originalGetExpandoInitializer = patchTsGetExpandoInitializer();
|
|
11189
|
-
const program =
|
|
11299
|
+
const program = ts94.createProgram(rootPaths, options, host);
|
|
11190
11300
|
program.getTypeChecker();
|
|
11191
11301
|
restoreGetExpandoInitializer(originalGetExpandoInitializer);
|
|
11192
11302
|
const file = program.getSourceFile(path7);
|
|
@@ -11212,7 +11322,7 @@ function findR3SymbolsPath(fs5, directory, filename) {
|
|
|
11212
11322
|
}
|
|
11213
11323
|
|
|
11214
11324
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/packages/ngcc_compiler_host.mjs
|
|
11215
|
-
import
|
|
11325
|
+
import ts95 from "typescript";
|
|
11216
11326
|
var NgccSourcesCompilerHost = class extends NgtscCompilerHost {
|
|
11217
11327
|
constructor(fs5, options, cache, moduleResolutionCache, packagePath) {
|
|
11218
11328
|
super(fs5, options);
|
|
@@ -11225,14 +11335,14 @@ var NgccSourcesCompilerHost = class extends NgtscCompilerHost {
|
|
|
11225
11335
|
}
|
|
11226
11336
|
resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference) {
|
|
11227
11337
|
return moduleNames.map((moduleName) => {
|
|
11228
|
-
const { resolvedModule } =
|
|
11229
|
-
if ((resolvedModule == null ? void 0 : resolvedModule.extension) ===
|
|
11338
|
+
const { resolvedModule } = ts95.resolveModuleName(moduleName, containingFile, this.options, this, this.moduleResolutionCache, redirectedReference);
|
|
11339
|
+
if ((resolvedModule == null ? void 0 : resolvedModule.extension) === ts95.Extension.Dts && containingFile.endsWith(".js") && isRelativePath(moduleName)) {
|
|
11230
11340
|
const jsFile = resolvedModule.resolvedFileName.replace(/\.d\.ts$/, ".js");
|
|
11231
11341
|
if (this.fileExists(jsFile)) {
|
|
11232
|
-
return __spreadProps(__spreadValues({}, resolvedModule), { resolvedFileName: jsFile, extension:
|
|
11342
|
+
return __spreadProps(__spreadValues({}, resolvedModule), { resolvedFileName: jsFile, extension: ts95.Extension.Js });
|
|
11233
11343
|
}
|
|
11234
11344
|
}
|
|
11235
|
-
if ((resolvedModule == null ? void 0 : resolvedModule.extension) ===
|
|
11345
|
+
if ((resolvedModule == null ? void 0 : resolvedModule.extension) === ts95.Extension.Js && !isWithinPackage(this.packagePath, this.fs.resolve(resolvedModule.resolvedFileName))) {
|
|
11236
11346
|
return void 0;
|
|
11237
11347
|
}
|
|
11238
11348
|
return resolvedModule;
|
|
@@ -11250,14 +11360,14 @@ var NgccDtsCompilerHost = class extends NgtscCompilerHost {
|
|
|
11250
11360
|
}
|
|
11251
11361
|
resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference) {
|
|
11252
11362
|
return moduleNames.map((moduleName) => {
|
|
11253
|
-
const { resolvedModule } =
|
|
11363
|
+
const { resolvedModule } = ts95.resolveModuleName(moduleName, containingFile, this.options, this, this.moduleResolutionCache, redirectedReference);
|
|
11254
11364
|
return resolvedModule;
|
|
11255
11365
|
});
|
|
11256
11366
|
}
|
|
11257
11367
|
};
|
|
11258
11368
|
|
|
11259
11369
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/packages/source_file_cache.mjs
|
|
11260
|
-
import
|
|
11370
|
+
import ts96 from "typescript";
|
|
11261
11371
|
var SharedFileCache = class {
|
|
11262
11372
|
constructor(fs5) {
|
|
11263
11373
|
this.fs = fs5;
|
|
@@ -11279,7 +11389,7 @@ var SharedFileCache = class {
|
|
|
11279
11389
|
if (content === void 0) {
|
|
11280
11390
|
return void 0;
|
|
11281
11391
|
}
|
|
11282
|
-
const sf =
|
|
11392
|
+
const sf = ts96.createSourceFile(absPath, content, ts96.ScriptTarget.ES2015);
|
|
11283
11393
|
this.sfCache.set(absPath, sf);
|
|
11284
11394
|
}
|
|
11285
11395
|
return this.sfCache.get(absPath);
|
|
@@ -11290,7 +11400,7 @@ var SharedFileCache = class {
|
|
|
11290
11400
|
return void 0;
|
|
11291
11401
|
}
|
|
11292
11402
|
if (!this.sfCache.has(absPath) || this.sfCache.get(absPath).text !== content) {
|
|
11293
|
-
const sf =
|
|
11403
|
+
const sf = ts96.createSourceFile(absPath, content, ts96.ScriptTarget.ES2015);
|
|
11294
11404
|
this.sfCache.set(absPath, sf);
|
|
11295
11405
|
}
|
|
11296
11406
|
return this.sfCache.get(absPath);
|
|
@@ -11340,7 +11450,7 @@ var EntryPointFileCache = class {
|
|
|
11340
11450
|
if (content === void 0) {
|
|
11341
11451
|
return void 0;
|
|
11342
11452
|
}
|
|
11343
|
-
const sf =
|
|
11453
|
+
const sf = ts96.createSourceFile(fileName, content, languageVersion);
|
|
11344
11454
|
this.sfCache.set(absPath, sf);
|
|
11345
11455
|
return sf;
|
|
11346
11456
|
}
|
|
@@ -11352,7 +11462,7 @@ function readFile(absPath, fs5) {
|
|
|
11352
11462
|
return fs5.readFile(absPath);
|
|
11353
11463
|
}
|
|
11354
11464
|
function createModuleResolutionCache(fs5) {
|
|
11355
|
-
return
|
|
11465
|
+
return ts96.createModuleResolutionCache(fs5.pwd(), (fileName) => {
|
|
11356
11466
|
return fs5.isCaseSensitive() ? fileName : fileName.toLowerCase();
|
|
11357
11467
|
});
|
|
11358
11468
|
}
|
|
@@ -11399,13 +11509,13 @@ function computePotentialDtsFilesFromJsFiles(fs5, srcProgram, formatPath, typing
|
|
|
11399
11509
|
}
|
|
11400
11510
|
|
|
11401
11511
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/packages/transformer.mjs
|
|
11402
|
-
import
|
|
11512
|
+
import ts106 from "typescript";
|
|
11403
11513
|
|
|
11404
11514
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/analysis/decoration_analyzer.mjs
|
|
11405
11515
|
import { ConstantPool as ConstantPool2 } from "@angular/compiler";
|
|
11406
11516
|
|
|
11407
11517
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/migrations/utils.mjs
|
|
11408
|
-
import
|
|
11518
|
+
import ts97 from "typescript";
|
|
11409
11519
|
function isClassDeclaration(clazz) {
|
|
11410
11520
|
return isNamedClassDeclaration(clazz) || isNamedFunctionDeclaration(clazz) || isNamedVariableDeclaration(clazz);
|
|
11411
11521
|
}
|
|
@@ -11430,7 +11540,7 @@ function createDirectiveDecorator(clazz, metadata) {
|
|
|
11430
11540
|
if (metadata.exportAs !== null) {
|
|
11431
11541
|
metaArgs.push(property("exportAs", metadata.exportAs.join(", ")));
|
|
11432
11542
|
}
|
|
11433
|
-
args.push(reifySourceFile(
|
|
11543
|
+
args.push(reifySourceFile(ts97.createObjectLiteral(metaArgs)));
|
|
11434
11544
|
}
|
|
11435
11545
|
return {
|
|
11436
11546
|
name: "Directive",
|
|
@@ -11458,7 +11568,7 @@ function createComponentDecorator(clazz, metadata) {
|
|
|
11458
11568
|
node: null,
|
|
11459
11569
|
synthesizedFor: clazz.name,
|
|
11460
11570
|
args: [
|
|
11461
|
-
reifySourceFile(
|
|
11571
|
+
reifySourceFile(ts97.createObjectLiteral(metaArgs))
|
|
11462
11572
|
]
|
|
11463
11573
|
};
|
|
11464
11574
|
}
|
|
@@ -11473,16 +11583,16 @@ function createInjectableDecorator(clazz) {
|
|
|
11473
11583
|
};
|
|
11474
11584
|
}
|
|
11475
11585
|
function property(name, value) {
|
|
11476
|
-
return
|
|
11586
|
+
return ts97.createPropertyAssignment(name, ts97.createStringLiteral(value));
|
|
11477
11587
|
}
|
|
11478
|
-
var EMPTY_SF =
|
|
11588
|
+
var EMPTY_SF = ts97.createSourceFile("(empty)", "", ts97.ScriptTarget.Latest);
|
|
11479
11589
|
function reifySourceFile(expr) {
|
|
11480
|
-
const printer =
|
|
11481
|
-
const exprText = printer.printNode(
|
|
11482
|
-
const sf =
|
|
11590
|
+
const printer = ts97.createPrinter();
|
|
11591
|
+
const exprText = printer.printNode(ts97.EmitHint.Unspecified, expr, EMPTY_SF);
|
|
11592
|
+
const sf = ts97.createSourceFile("(synthetic)", `const expr = ${exprText};`, ts97.ScriptTarget.Latest, true, ts97.ScriptKind.JS);
|
|
11483
11593
|
const stmt = sf.statements[0];
|
|
11484
|
-
if (!
|
|
11485
|
-
throw new Error(`Expected VariableStatement, got ${
|
|
11594
|
+
if (!ts97.isVariableStatement(stmt)) {
|
|
11595
|
+
throw new Error(`Expected VariableStatement, got ${ts97.SyntaxKind[stmt.kind]}`);
|
|
11486
11596
|
}
|
|
11487
11597
|
return stmt.declarationList.declarations[0].initializer;
|
|
11488
11598
|
}
|
|
@@ -11661,7 +11771,7 @@ function determineBaseClass(clazz, host) {
|
|
|
11661
11771
|
}
|
|
11662
11772
|
|
|
11663
11773
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/analysis/migration_host.mjs
|
|
11664
|
-
import
|
|
11774
|
+
import ts98 from "typescript";
|
|
11665
11775
|
var DefaultMigrationHost = class {
|
|
11666
11776
|
constructor(reflectionHost, metadata, evaluator, compiler, entryPointPath) {
|
|
11667
11777
|
this.reflectionHost = reflectionHost;
|
|
@@ -11692,14 +11802,14 @@ function createMigrationDiagnostic(diagnostic, source, decorator) {
|
|
|
11692
11802
|
const clone = __spreadValues({}, diagnostic);
|
|
11693
11803
|
const chain = [{
|
|
11694
11804
|
messageText: `Occurs for @${decorator.name} decorator inserted by an automatic migration`,
|
|
11695
|
-
category:
|
|
11805
|
+
category: ts98.DiagnosticCategory.Message,
|
|
11696
11806
|
code: 0
|
|
11697
11807
|
}];
|
|
11698
11808
|
if (decorator.args !== null) {
|
|
11699
11809
|
const args = decorator.args.map((arg) => arg.getText()).join(", ");
|
|
11700
11810
|
chain.push({
|
|
11701
11811
|
messageText: `@${decorator.name}(${args})`,
|
|
11702
|
-
category:
|
|
11812
|
+
category: ts98.DiagnosticCategory.Message,
|
|
11703
11813
|
code: 0
|
|
11704
11814
|
});
|
|
11705
11815
|
}
|
|
@@ -11925,7 +12035,7 @@ var DecorationAnalyzer = class {
|
|
|
11925
12035
|
};
|
|
11926
12036
|
|
|
11927
12037
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/analysis/module_with_providers_analyzer.mjs
|
|
11928
|
-
import
|
|
12038
|
+
import ts99 from "typescript";
|
|
11929
12039
|
var ModuleWithProvidersAnalyses = Map;
|
|
11930
12040
|
var ModuleWithProvidersAnalyzer = class {
|
|
11931
12041
|
constructor(host, typeChecker, referencesRegistry, processDts) {
|
|
@@ -11947,7 +12057,7 @@ var ModuleWithProvidersAnalyzer = class {
|
|
|
11947
12057
|
if (this.processDts) {
|
|
11948
12058
|
const dtsFn = this.getDtsModuleWithProvidersFunction(fn);
|
|
11949
12059
|
const dtsFnType = dtsFn.declaration.type;
|
|
11950
|
-
const typeParam = dtsFnType &&
|
|
12060
|
+
const typeParam = dtsFnType && ts99.isTypeReferenceNode(dtsFnType) && dtsFnType.typeArguments && dtsFnType.typeArguments[0] || null;
|
|
11951
12061
|
if (!typeParam || isAnyKeyword(typeParam)) {
|
|
11952
12062
|
const dtsFile = dtsFn.declaration.getSourceFile();
|
|
11953
12063
|
const analysis = analyses.has(dtsFile) ? analyses.get(dtsFile) : [];
|
|
@@ -11992,7 +12102,7 @@ var ModuleWithProvidersAnalyzer = class {
|
|
|
11992
12102
|
return infos;
|
|
11993
12103
|
}
|
|
11994
12104
|
parseForModuleWithProviders(name, node, implementation = node, container = null) {
|
|
11995
|
-
if (implementation === null || !
|
|
12105
|
+
if (implementation === null || !ts99.isFunctionDeclaration(implementation) && !ts99.isMethodDeclaration(implementation) && !ts99.isFunctionExpression(implementation)) {
|
|
11996
12106
|
return null;
|
|
11997
12107
|
}
|
|
11998
12108
|
const declaration = implementation;
|
|
@@ -12005,7 +12115,7 @@ var ModuleWithProvidersAnalyzer = class {
|
|
|
12005
12115
|
return null;
|
|
12006
12116
|
}
|
|
12007
12117
|
const lastStatement = body[body.length - 1];
|
|
12008
|
-
if (!
|
|
12118
|
+
if (!ts99.isReturnStatement(lastStatement) || lastStatement.expression === void 0) {
|
|
12009
12119
|
return null;
|
|
12010
12120
|
}
|
|
12011
12121
|
const result = this.evaluator.evaluate(lastStatement.expression);
|
|
@@ -12027,7 +12137,7 @@ var ModuleWithProvidersAnalyzer = class {
|
|
|
12027
12137
|
const containerClass = fn.container && this.host.getClassSymbol(fn.container);
|
|
12028
12138
|
if (containerClass) {
|
|
12029
12139
|
const dtsClass = this.host.getDtsDeclaration(containerClass.declaration.valueDeclaration);
|
|
12030
|
-
dtsFn = dtsClass &&
|
|
12140
|
+
dtsFn = dtsClass && ts99.isClassDeclaration(dtsClass) ? dtsClass.members.find((member) => ts99.isMethodDeclaration(member) && ts99.isIdentifier(member.name) && member.name.text === fn.name) : null;
|
|
12031
12141
|
} else {
|
|
12032
12142
|
dtsFn = this.host.getDtsDeclaration(fn.declaration);
|
|
12033
12143
|
}
|
|
@@ -12057,10 +12167,10 @@ var ModuleWithProvidersAnalyzer = class {
|
|
|
12057
12167
|
}
|
|
12058
12168
|
};
|
|
12059
12169
|
function isFunctionOrMethod(declaration) {
|
|
12060
|
-
return
|
|
12170
|
+
return ts99.isFunctionDeclaration(declaration) || ts99.isMethodDeclaration(declaration);
|
|
12061
12171
|
}
|
|
12062
12172
|
function isAnyKeyword(typeParam) {
|
|
12063
|
-
return typeParam.kind ===
|
|
12173
|
+
return typeParam.kind === ts99.SyntaxKind.AnyKeyword;
|
|
12064
12174
|
}
|
|
12065
12175
|
|
|
12066
12176
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/analysis/ngcc_references_registry.mjs
|
|
@@ -12125,27 +12235,8 @@ var PrivateDeclarationsAnalyzer = class {
|
|
|
12125
12235
|
}
|
|
12126
12236
|
};
|
|
12127
12237
|
|
|
12128
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/analysis/switch_marker_analyzer.mjs
|
|
12129
|
-
var SwitchMarkerAnalyses = Map;
|
|
12130
|
-
var SwitchMarkerAnalyzer = class {
|
|
12131
|
-
constructor(host, packagePath) {
|
|
12132
|
-
this.host = host;
|
|
12133
|
-
this.packagePath = packagePath;
|
|
12134
|
-
}
|
|
12135
|
-
analyzeProgram(program) {
|
|
12136
|
-
const analyzedFiles = new SwitchMarkerAnalyses();
|
|
12137
|
-
program.getSourceFiles().filter((sourceFile) => isWithinPackage(this.packagePath, absoluteFromSourceFile(sourceFile))).forEach((sourceFile) => {
|
|
12138
|
-
const declarations = this.host.getSwitchableDeclarations(sourceFile);
|
|
12139
|
-
if (declarations.length) {
|
|
12140
|
-
analyzedFiles.set(sourceFile, { sourceFile, declarations });
|
|
12141
|
-
}
|
|
12142
|
-
});
|
|
12143
|
-
return analyzedFiles;
|
|
12144
|
-
}
|
|
12145
|
-
};
|
|
12146
|
-
|
|
12147
12238
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/host/commonjs_host.mjs
|
|
12148
|
-
import
|
|
12239
|
+
import ts100 from "typescript";
|
|
12149
12240
|
var CommonJsReflectionHost = class extends Esm5ReflectionHost {
|
|
12150
12241
|
constructor(logger, isCore, src, dts = null) {
|
|
12151
12242
|
super(logger, isCore, src, dts);
|
|
@@ -12219,7 +12310,7 @@ var CommonJsReflectionHost = class extends Esm5ReflectionHost {
|
|
|
12219
12310
|
}
|
|
12220
12311
|
extractCommonJsWildcardReexports(statement, containingFile) {
|
|
12221
12312
|
const reexportArg = statement.expression.arguments[0];
|
|
12222
|
-
const requireCall = isRequireCall(reexportArg) ? reexportArg :
|
|
12313
|
+
const requireCall = isRequireCall(reexportArg) ? reexportArg : ts100.isIdentifier(reexportArg) ? findRequireCallReference(reexportArg, this.checker) : null;
|
|
12223
12314
|
if (requireCall === null) {
|
|
12224
12315
|
return [];
|
|
12225
12316
|
}
|
|
@@ -12302,7 +12393,7 @@ var CommonJsReflectionHost = class extends Esm5ReflectionHost {
|
|
|
12302
12393
|
const moduleInfo = this.compilerHost.resolveModuleNames([moduleName], containingFile.fileName, void 0, void 0, this.program.getCompilerOptions())[0];
|
|
12303
12394
|
return moduleInfo && this.program.getSourceFile(absoluteFrom(moduleInfo.resolvedFileName));
|
|
12304
12395
|
} else {
|
|
12305
|
-
const moduleInfo =
|
|
12396
|
+
const moduleInfo = ts100.resolveModuleName(moduleName, containingFile.fileName, this.program.getCompilerOptions(), this.compilerHost);
|
|
12306
12397
|
return moduleInfo.resolvedModule && this.program.getSourceFile(absoluteFrom(moduleInfo.resolvedModule.resolvedFileName));
|
|
12307
12398
|
}
|
|
12308
12399
|
}
|
|
@@ -12418,9 +12509,6 @@ var DelegatingReflectionHost = class {
|
|
|
12418
12509
|
getDecoratorsOfSymbol(symbol) {
|
|
12419
12510
|
return this.ngccHost.getDecoratorsOfSymbol(symbol);
|
|
12420
12511
|
}
|
|
12421
|
-
getSwitchableDeclarations(module2) {
|
|
12422
|
-
return this.ngccHost.getSwitchableDeclarations(module2);
|
|
12423
|
-
}
|
|
12424
12512
|
getEndOfClass(classSymbol) {
|
|
12425
12513
|
return this.ngccHost.getEndOfClass(classSymbol);
|
|
12426
12514
|
}
|
|
@@ -12433,13 +12521,13 @@ var DelegatingReflectionHost = class {
|
|
|
12433
12521
|
};
|
|
12434
12522
|
|
|
12435
12523
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/rendering/commonjs_rendering_formatter.mjs
|
|
12436
|
-
import
|
|
12524
|
+
import ts103 from "typescript";
|
|
12437
12525
|
|
|
12438
12526
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/rendering/esm5_rendering_formatter.mjs
|
|
12439
|
-
import
|
|
12527
|
+
import ts102 from "typescript";
|
|
12440
12528
|
|
|
12441
12529
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/rendering/esm_rendering_formatter.mjs
|
|
12442
|
-
import
|
|
12530
|
+
import ts101 from "typescript";
|
|
12443
12531
|
|
|
12444
12532
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/rendering/ngcc_import_rewriter.mjs
|
|
12445
12533
|
var NgccFlatImportRewriter = class {
|
|
@@ -12482,7 +12570,7 @@ var EsmRenderingFormatter = class {
|
|
|
12482
12570
|
this.fs = fs5;
|
|
12483
12571
|
this.host = host;
|
|
12484
12572
|
this.isCore = isCore;
|
|
12485
|
-
this.printer =
|
|
12573
|
+
this.printer = ts101.createPrinter({ newLine: ts101.NewLineKind.LineFeed });
|
|
12486
12574
|
}
|
|
12487
12575
|
addImports(output, imports, sf) {
|
|
12488
12576
|
if (imports.length === 0) {
|
|
@@ -12542,14 +12630,14 @@ export {${e.symbolName} as ${e.asAlias}} from '${e.fromModule}';`;
|
|
|
12542
12630
|
}
|
|
12543
12631
|
removeDecorators(output, decoratorsToRemove) {
|
|
12544
12632
|
decoratorsToRemove.forEach((nodesToRemove, containerNode) => {
|
|
12545
|
-
if (
|
|
12633
|
+
if (ts101.isArrayLiteralExpression(containerNode)) {
|
|
12546
12634
|
const items = containerNode.elements;
|
|
12547
12635
|
if (items.length === nodesToRemove.length) {
|
|
12548
12636
|
const statement = findStatement(containerNode);
|
|
12549
12637
|
if (statement) {
|
|
12550
|
-
if (
|
|
12638
|
+
if (ts101.isExpressionStatement(statement)) {
|
|
12551
12639
|
output.remove(statement.getFullStart(), statement.getEnd());
|
|
12552
|
-
} else if (
|
|
12640
|
+
} else if (ts101.isReturnStatement(statement) && statement.expression && isAssignment2(statement.expression)) {
|
|
12553
12641
|
const startOfRemoval = statement.expression.left.getEnd();
|
|
12554
12642
|
const endOfRemoval = getEndExceptSemicolon(statement);
|
|
12555
12643
|
output.remove(startOfRemoval, endOfRemoval);
|
|
@@ -12572,14 +12660,6 @@ export {${e.symbolName} as ${e.asAlias}} from '${e.fromModule}';`;
|
|
|
12572
12660
|
}
|
|
12573
12661
|
});
|
|
12574
12662
|
}
|
|
12575
|
-
rewriteSwitchableDeclarations(outputText, sourceFile, declarations) {
|
|
12576
|
-
declarations.forEach((declaration) => {
|
|
12577
|
-
const start = declaration.initializer.getStart();
|
|
12578
|
-
const end = declaration.initializer.getEnd();
|
|
12579
|
-
const replacement = declaration.initializer.text.replace(PRE_R3_MARKER, POST_R3_MARKER);
|
|
12580
|
-
outputText.overwrite(start, end, replacement);
|
|
12581
|
-
});
|
|
12582
|
-
}
|
|
12583
12663
|
addModuleWithProvidersParams(outputText, moduleWithProviders, importManager) {
|
|
12584
12664
|
moduleWithProviders.forEach((info) => {
|
|
12585
12665
|
const ngModuleName = info.ngModule.node.name.text;
|
|
@@ -12590,7 +12670,7 @@ export {${e.symbolName} as ${e.asAlias}} from '${e.fromModule}';`;
|
|
|
12590
12670
|
const importPath = info.ngModule.ownedByModuleGuess || (declarationFile !== ngModuleFile ? stripExtension3(relativeImport) : null);
|
|
12591
12671
|
const ngModule = generateImportString(importManager, importPath, ngModuleName);
|
|
12592
12672
|
if (info.declaration.type) {
|
|
12593
|
-
const typeName = info.declaration.type &&
|
|
12673
|
+
const typeName = info.declaration.type && ts101.isTypeReferenceNode(info.declaration.type) ? info.declaration.type.typeName : null;
|
|
12594
12674
|
if (this.isCoreModuleWithProvidersType(typeName)) {
|
|
12595
12675
|
outputText.overwrite(info.declaration.type.getStart(), info.declaration.type.getEnd(), `ModuleWithProviders<${ngModule}>`);
|
|
12596
12676
|
} else {
|
|
@@ -12599,32 +12679,32 @@ export {${e.symbolName} as ${e.asAlias}} from '${e.fromModule}';`;
|
|
|
12599
12679
|
}
|
|
12600
12680
|
} else {
|
|
12601
12681
|
const lastToken = info.declaration.getLastToken();
|
|
12602
|
-
const insertPoint = lastToken && lastToken.kind ===
|
|
12682
|
+
const insertPoint = lastToken && lastToken.kind === ts101.SyntaxKind.SemicolonToken ? lastToken.getStart() : info.declaration.getEnd();
|
|
12603
12683
|
outputText.appendLeft(insertPoint, `: ${generateImportString(importManager, "@angular/core", "ModuleWithProviders")}<${ngModule}>`);
|
|
12604
12684
|
}
|
|
12605
12685
|
});
|
|
12606
12686
|
}
|
|
12607
12687
|
printStatement(stmt, sourceFile, importManager) {
|
|
12608
12688
|
const node = translateStatement(stmt, importManager);
|
|
12609
|
-
const code = this.printer.printNode(
|
|
12689
|
+
const code = this.printer.printNode(ts101.EmitHint.Unspecified, node, sourceFile);
|
|
12610
12690
|
return code;
|
|
12611
12691
|
}
|
|
12612
12692
|
findEndOfImports(sf) {
|
|
12613
12693
|
for (const stmt of sf.statements) {
|
|
12614
|
-
if (!
|
|
12694
|
+
if (!ts101.isImportDeclaration(stmt) && !ts101.isImportEqualsDeclaration(stmt) && !ts101.isNamespaceImport(stmt)) {
|
|
12615
12695
|
return stmt.getStart();
|
|
12616
12696
|
}
|
|
12617
12697
|
}
|
|
12618
12698
|
return 0;
|
|
12619
12699
|
}
|
|
12620
12700
|
isCoreModuleWithProvidersType(typeName) {
|
|
12621
|
-
const id = typeName &&
|
|
12701
|
+
const id = typeName && ts101.isIdentifier(typeName) ? this.host.getImportOfIdentifier(typeName) : null;
|
|
12622
12702
|
return id && id.name === "ModuleWithProviders" && (this.isCore || id.from === "@angular/core");
|
|
12623
12703
|
}
|
|
12624
12704
|
};
|
|
12625
12705
|
function findStatement(node) {
|
|
12626
12706
|
while (node) {
|
|
12627
|
-
if (
|
|
12707
|
+
if (ts101.isExpressionStatement(node) || ts101.isReturnStatement(node)) {
|
|
12628
12708
|
return node;
|
|
12629
12709
|
}
|
|
12630
12710
|
node = node.parent;
|
|
@@ -12641,7 +12721,7 @@ function getNextSiblingInArray(node, array) {
|
|
|
12641
12721
|
}
|
|
12642
12722
|
function getEndExceptSemicolon(statement) {
|
|
12643
12723
|
const lastToken = statement.getLastToken();
|
|
12644
|
-
return lastToken && lastToken.kind ===
|
|
12724
|
+
return lastToken && lastToken.kind === ts101.SyntaxKind.SemicolonToken ? statement.getEnd() - 1 : statement.getEnd();
|
|
12645
12725
|
}
|
|
12646
12726
|
|
|
12647
12727
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/rendering/esm5_rendering_formatter.mjs
|
|
@@ -12655,10 +12735,10 @@ Expected an ES5 IIFE wrapped function. But got:
|
|
|
12655
12735
|
}
|
|
12656
12736
|
const declarationStatement = getContainingStatement(classSymbol.implementation.valueDeclaration);
|
|
12657
12737
|
const iifeBody = declarationStatement.parent;
|
|
12658
|
-
if (!iifeBody || !
|
|
12738
|
+
if (!iifeBody || !ts102.isBlock(iifeBody)) {
|
|
12659
12739
|
throw new Error(`Compiled class declaration is not inside an IIFE: ${compiledClass.name} in ${compiledClass.declaration.getSourceFile().fileName}`);
|
|
12660
12740
|
}
|
|
12661
|
-
const returnStatement = iifeBody.statements.find(
|
|
12741
|
+
const returnStatement = iifeBody.statements.find(ts102.isReturnStatement);
|
|
12662
12742
|
if (!returnStatement) {
|
|
12663
12743
|
throw new Error(`Compiled class wrapper IIFE does not have a return statement: ${compiledClass.name} in ${compiledClass.declaration.getSourceFile().fileName}`);
|
|
12664
12744
|
}
|
|
@@ -12667,7 +12747,7 @@ Expected an ES5 IIFE wrapped function. But got:
|
|
|
12667
12747
|
}
|
|
12668
12748
|
printStatement(stmt, sourceFile, importManager) {
|
|
12669
12749
|
const node = translateStatement(stmt, importManager, { downlevelTaggedTemplates: true, downlevelVariableDeclarations: true });
|
|
12670
|
-
const code = this.printer.printNode(
|
|
12750
|
+
const code = this.printer.printNode(ts102.EmitHint.Unspecified, node, sourceFile);
|
|
12671
12751
|
return code;
|
|
12672
12752
|
}
|
|
12673
12753
|
};
|
|
@@ -12709,10 +12789,10 @@ exports.${e.asAlias} = ${importNamespace}${namedImport.symbol};`;
|
|
|
12709
12789
|
}
|
|
12710
12790
|
findEndOfImports(sf) {
|
|
12711
12791
|
for (const statement of sf.statements) {
|
|
12712
|
-
if (
|
|
12792
|
+
if (ts103.isExpressionStatement(statement) && isRequireCall(statement.expression)) {
|
|
12713
12793
|
continue;
|
|
12714
12794
|
}
|
|
12715
|
-
const declarations =
|
|
12795
|
+
const declarations = ts103.isVariableStatement(statement) ? Array.from(statement.declarationList.declarations) : [];
|
|
12716
12796
|
if (declarations.some((d) => !d.initializer || !isRequireCall(d.initializer))) {
|
|
12717
12797
|
return statement.getStart();
|
|
12718
12798
|
}
|
|
@@ -12723,7 +12803,7 @@ exports.${e.asAlias} = ${importNamespace}${namedImport.symbol};`;
|
|
|
12723
12803
|
|
|
12724
12804
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/rendering/dts_renderer.mjs
|
|
12725
12805
|
import MagicString from "magic-string";
|
|
12726
|
-
import
|
|
12806
|
+
import ts104 from "typescript";
|
|
12727
12807
|
|
|
12728
12808
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/constants.mjs
|
|
12729
12809
|
var IMPORT_PREFIX = "\u0275ngcc";
|
|
@@ -13195,14 +13275,14 @@ var DtsRenderer = class {
|
|
|
13195
13275
|
}
|
|
13196
13276
|
renderDtsFile(dtsFile, renderInfo) {
|
|
13197
13277
|
const outputText = new MagicString(dtsFile.text);
|
|
13198
|
-
const printer =
|
|
13278
|
+
const printer = ts104.createPrinter();
|
|
13199
13279
|
const importManager = new ImportManager(getImportRewriter(this.bundle.dts.r3SymbolsFile, this.bundle.isCore, false), IMPORT_PREFIX);
|
|
13200
13280
|
renderInfo.classInfo.forEach((dtsClass) => {
|
|
13201
13281
|
const endOfClass = dtsClass.dtsDeclaration.getEnd();
|
|
13202
13282
|
dtsClass.compilation.forEach((declaration) => {
|
|
13203
13283
|
const type = translateType(declaration.type, importManager);
|
|
13204
13284
|
markForEmitAsSingleLine2(type);
|
|
13205
|
-
const typeStr = printer.printNode(
|
|
13285
|
+
const typeStr = printer.printNode(ts104.EmitHint.Unspecified, type, dtsFile);
|
|
13206
13286
|
const newStatement = ` static ${declaration.name}: ${typeStr};
|
|
13207
13287
|
`;
|
|
13208
13288
|
outputText.appendRight(endOfClass - 1, newStatement);
|
|
@@ -13262,8 +13342,8 @@ The simplest fix for this is to ensure that this class is exported from the pack
|
|
|
13262
13342
|
}
|
|
13263
13343
|
};
|
|
13264
13344
|
function markForEmitAsSingleLine2(node) {
|
|
13265
|
-
|
|
13266
|
-
|
|
13345
|
+
ts104.setEmitFlags(node, ts104.EmitFlags.SingleLine);
|
|
13346
|
+
ts104.forEachChild(node, markForEmitAsSingleLine2);
|
|
13267
13347
|
}
|
|
13268
13348
|
|
|
13269
13349
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/rendering/renderer.mjs
|
|
@@ -13283,23 +13363,19 @@ var Renderer = class {
|
|
|
13283
13363
|
this.bundle = bundle;
|
|
13284
13364
|
this.tsConfig = tsConfig;
|
|
13285
13365
|
}
|
|
13286
|
-
renderProgram(decorationAnalyses,
|
|
13366
|
+
renderProgram(decorationAnalyses, privateDeclarationsAnalyses) {
|
|
13287
13367
|
const renderedFiles = [];
|
|
13288
13368
|
this.bundle.src.program.getSourceFiles().forEach((sourceFile) => {
|
|
13289
|
-
if (decorationAnalyses.has(sourceFile) ||
|
|
13369
|
+
if (decorationAnalyses.has(sourceFile) || sourceFile === this.bundle.src.file) {
|
|
13290
13370
|
const compiledFile = decorationAnalyses.get(sourceFile);
|
|
13291
|
-
|
|
13292
|
-
renderedFiles.push(...this.renderFile(sourceFile, compiledFile, switchMarkerAnalysis, privateDeclarationsAnalyses));
|
|
13371
|
+
renderedFiles.push(...this.renderFile(sourceFile, compiledFile, privateDeclarationsAnalyses));
|
|
13293
13372
|
}
|
|
13294
13373
|
});
|
|
13295
13374
|
return renderedFiles;
|
|
13296
13375
|
}
|
|
13297
|
-
renderFile(sourceFile, compiledFile,
|
|
13376
|
+
renderFile(sourceFile, compiledFile, privateDeclarationsAnalyses) {
|
|
13298
13377
|
const isEntryPoint = sourceFile === this.bundle.src.file;
|
|
13299
13378
|
const outputText = new MagicString2(sourceFile.text);
|
|
13300
|
-
if (switchMarkerAnalysis) {
|
|
13301
|
-
this.srcFormatter.rewriteSwitchableDeclarations(outputText, switchMarkerAnalysis.sourceFile, switchMarkerAnalysis.declarations);
|
|
13302
|
-
}
|
|
13303
13379
|
const importManager = new ImportManager(getImportRewriter(this.bundle.src.r3SymbolsFile, this.bundle.isCore, this.bundle.isFlatCore), IMPORT_PREFIX);
|
|
13304
13380
|
if (compiledFile) {
|
|
13305
13381
|
const decoratorsToRemove = this.computeDecoratorsToRemove(compiledFile.compiledClasses);
|
|
@@ -13323,7 +13399,7 @@ var Renderer = class {
|
|
|
13323
13399
|
if (isEntryPoint || compiledFile) {
|
|
13324
13400
|
this.srcFormatter.addImports(outputText, importManager.getAllImports(sourceFile.fileName), sourceFile);
|
|
13325
13401
|
}
|
|
13326
|
-
if (compiledFile ||
|
|
13402
|
+
if (compiledFile || isEntryPoint) {
|
|
13327
13403
|
return renderSourceAndMap(this.logger, this.fs, sourceFile, outputText);
|
|
13328
13404
|
} else {
|
|
13329
13405
|
return [];
|
|
@@ -13381,7 +13457,7 @@ function createAssignmentStatement(receiverName, propName, initializer, leadingC
|
|
|
13381
13457
|
}
|
|
13382
13458
|
|
|
13383
13459
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/rendering/umd_rendering_formatter.mjs
|
|
13384
|
-
import
|
|
13460
|
+
import ts105 from "typescript";
|
|
13385
13461
|
var UmdRenderingFormatter = class extends Esm5RenderingFormatter {
|
|
13386
13462
|
constructor(fs5, umdHost, isCore) {
|
|
13387
13463
|
super(fs5, umdHost, isCore);
|
|
@@ -13395,10 +13471,11 @@ var UmdRenderingFormatter = class extends Esm5RenderingFormatter {
|
|
|
13395
13471
|
if (!umdModule) {
|
|
13396
13472
|
return;
|
|
13397
13473
|
}
|
|
13398
|
-
const {
|
|
13399
|
-
renderCommonJsDependencies(output,
|
|
13400
|
-
|
|
13401
|
-
|
|
13474
|
+
const { factoryFn, factoryCalls } = umdModule;
|
|
13475
|
+
renderCommonJsDependencies(output, factoryCalls.commonJs, imports);
|
|
13476
|
+
renderCommonJsDependencies(output, factoryCalls.commonJs2, imports);
|
|
13477
|
+
renderAmdDependencies(output, factoryCalls.amdDefine, imports);
|
|
13478
|
+
renderGlobalDependencies(output, factoryCalls.global, imports);
|
|
13402
13479
|
renderFactoryParameters(output, factoryFn, imports);
|
|
13403
13480
|
}
|
|
13404
13481
|
addExports(output, entryPointBasePath, exports, importManager, file) {
|
|
@@ -13449,26 +13526,22 @@ exports.${e.asAlias} = ${importNamespace}${namedImport.symbol};`;
|
|
|
13449
13526
|
output.appendLeft(insertionPoint, "\n" + constants + "\n");
|
|
13450
13527
|
}
|
|
13451
13528
|
};
|
|
13452
|
-
function renderCommonJsDependencies(output,
|
|
13453
|
-
|
|
13454
|
-
if (!conditional) {
|
|
13529
|
+
function renderCommonJsDependencies(output, factoryCall, imports) {
|
|
13530
|
+
if (factoryCall === null) {
|
|
13455
13531
|
return;
|
|
13456
13532
|
}
|
|
13457
|
-
const factoryCall = conditional.whenTrue;
|
|
13458
13533
|
const injectionPoint = factoryCall.arguments.length > 0 ? factoryCall.arguments[0].getFullStart() : factoryCall.getEnd() - 1;
|
|
13459
13534
|
const importString = imports.map((i) => `require('${i.specifier}')`).join(",");
|
|
13460
13535
|
output.appendLeft(injectionPoint, importString + (factoryCall.arguments.length > 0 ? "," : ""));
|
|
13461
13536
|
}
|
|
13462
|
-
function renderAmdDependencies(output,
|
|
13463
|
-
|
|
13464
|
-
if (!conditional) {
|
|
13537
|
+
function renderAmdDependencies(output, amdDefineCall, imports) {
|
|
13538
|
+
if (amdDefineCall === null) {
|
|
13465
13539
|
return;
|
|
13466
13540
|
}
|
|
13467
|
-
const amdDefineCall = conditional.whenTrue;
|
|
13468
13541
|
const importString = imports.map((i) => `'${i.specifier}'`).join(",");
|
|
13469
13542
|
const factoryIndex = amdDefineCall.arguments.length - 1;
|
|
13470
13543
|
const dependencyArray = amdDefineCall.arguments[factoryIndex - 1];
|
|
13471
|
-
if (dependencyArray === void 0 || !
|
|
13544
|
+
if (dependencyArray === void 0 || !ts105.isArrayLiteralExpression(dependencyArray)) {
|
|
13472
13545
|
const injectionPoint = amdDefineCall.arguments[factoryIndex].getFullStart();
|
|
13473
13546
|
output.appendLeft(injectionPoint, `[${importString}],`);
|
|
13474
13547
|
} else {
|
|
@@ -13476,14 +13549,13 @@ function renderAmdDependencies(output, wrapperFunction, imports) {
|
|
|
13476
13549
|
output.appendLeft(injectionPoint, importString + (dependencyArray.elements.length > 0 ? "," : ""));
|
|
13477
13550
|
}
|
|
13478
13551
|
}
|
|
13479
|
-
function renderGlobalDependencies(output,
|
|
13480
|
-
|
|
13481
|
-
if (!globalFactoryCall) {
|
|
13552
|
+
function renderGlobalDependencies(output, factoryCall, imports) {
|
|
13553
|
+
if (factoryCall === null) {
|
|
13482
13554
|
return;
|
|
13483
13555
|
}
|
|
13484
|
-
const injectionPoint =
|
|
13556
|
+
const injectionPoint = factoryCall.arguments.length > 0 ? factoryCall.arguments[0].getFullStart() : factoryCall.getEnd() - 1;
|
|
13485
13557
|
const importString = imports.map((i) => `global.${getGlobalIdentifier(i)}`).join(",");
|
|
13486
|
-
output.appendLeft(injectionPoint, importString + (
|
|
13558
|
+
output.appendLeft(injectionPoint, importString + (factoryCall.arguments.length > 0 ? "," : ""));
|
|
13487
13559
|
}
|
|
13488
13560
|
function renderFactoryParameters(output, factoryFunction, imports) {
|
|
13489
13561
|
const parameters = factoryFunction.parameters;
|
|
@@ -13496,60 +13568,9 @@ function renderFactoryParameters(output, factoryFunction, imports) {
|
|
|
13496
13568
|
output.appendLeft(injectionPoint, parameterString);
|
|
13497
13569
|
}
|
|
13498
13570
|
}
|
|
13499
|
-
function isCommonJSConditional(value) {
|
|
13500
|
-
if (!ts107.isConditionalExpression(value)) {
|
|
13501
|
-
return false;
|
|
13502
|
-
}
|
|
13503
|
-
if (!ts107.isBinaryExpression(value.condition) || value.condition.operatorToken.kind !== ts107.SyntaxKind.AmpersandAmpersandToken) {
|
|
13504
|
-
return false;
|
|
13505
|
-
}
|
|
13506
|
-
if (!oneOfBinaryConditions(value.condition, (exp) => isTypeOf(exp, "exports", "module"))) {
|
|
13507
|
-
return false;
|
|
13508
|
-
}
|
|
13509
|
-
if (!ts107.isCallExpression(value.whenTrue) || !ts107.isIdentifier(value.whenTrue.expression)) {
|
|
13510
|
-
return false;
|
|
13511
|
-
}
|
|
13512
|
-
return value.whenTrue.expression.text === "factory";
|
|
13513
|
-
}
|
|
13514
|
-
function isAmdConditional(value) {
|
|
13515
|
-
if (!ts107.isConditionalExpression(value)) {
|
|
13516
|
-
return false;
|
|
13517
|
-
}
|
|
13518
|
-
if (!ts107.isBinaryExpression(value.condition) || value.condition.operatorToken.kind !== ts107.SyntaxKind.AmpersandAmpersandToken) {
|
|
13519
|
-
return false;
|
|
13520
|
-
}
|
|
13521
|
-
if (!oneOfBinaryConditions(value.condition, (exp) => isTypeOf(exp, "define"))) {
|
|
13522
|
-
return false;
|
|
13523
|
-
}
|
|
13524
|
-
if (!ts107.isCallExpression(value.whenTrue) || !ts107.isIdentifier(value.whenTrue.expression)) {
|
|
13525
|
-
return false;
|
|
13526
|
-
}
|
|
13527
|
-
return value.whenTrue.expression.text === "define";
|
|
13528
|
-
}
|
|
13529
|
-
function isGlobalFactoryCall(value) {
|
|
13530
|
-
if (ts107.isCallExpression(value) && !!value.parent) {
|
|
13531
|
-
value = isCommaExpression(value.parent) ? value.parent : value;
|
|
13532
|
-
value = ts107.isParenthesizedExpression(value.parent) ? value.parent : value;
|
|
13533
|
-
return !!value.parent && ts107.isConditionalExpression(value.parent) && value.parent.whenFalse === value;
|
|
13534
|
-
} else {
|
|
13535
|
-
return false;
|
|
13536
|
-
}
|
|
13537
|
-
}
|
|
13538
|
-
function isCommaExpression(value) {
|
|
13539
|
-
return ts107.isBinaryExpression(value) && value.operatorToken.kind === ts107.SyntaxKind.CommaToken;
|
|
13540
|
-
}
|
|
13541
13571
|
function getGlobalIdentifier(i) {
|
|
13542
13572
|
return i.specifier.replace(/^@angular\//, "ng.").replace(/^@/, "").replace(/\//g, ".").replace(/[-_]+(.?)/g, (_, c) => c.toUpperCase()).replace(/^./, (c) => c.toLowerCase());
|
|
13543
13573
|
}
|
|
13544
|
-
function find(node, test) {
|
|
13545
|
-
return test(node) ? node : node.forEachChild((child) => find(child, test));
|
|
13546
|
-
}
|
|
13547
|
-
function oneOfBinaryConditions(node, test) {
|
|
13548
|
-
return test(node.left) || test(node.right);
|
|
13549
|
-
}
|
|
13550
|
-
function isTypeOf(node, ...types) {
|
|
13551
|
-
return ts107.isBinaryExpression(node) && ts107.isTypeOfExpression(node.left) && ts107.isIdentifier(node.left.expression) && types.indexOf(node.left.expression.text) !== -1;
|
|
13552
|
-
}
|
|
13553
13574
|
|
|
13554
13575
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/packages/transformer.mjs
|
|
13555
13576
|
var Transformer = class {
|
|
@@ -13562,7 +13583,7 @@ var Transformer = class {
|
|
|
13562
13583
|
const ngccReflectionHost = this.getHost(bundle);
|
|
13563
13584
|
const tsReflectionHost = new TypeScriptReflectionHost(bundle.src.program.getTypeChecker());
|
|
13564
13585
|
const reflectionHost = new DelegatingReflectionHost(tsReflectionHost, ngccReflectionHost);
|
|
13565
|
-
const { decorationAnalyses,
|
|
13586
|
+
const { decorationAnalyses, privateDeclarationsAnalyses, moduleWithProvidersAnalyses, diagnostics } = this.analyzeProgram(reflectionHost, bundle);
|
|
13566
13587
|
if (hasErrors(diagnostics)) {
|
|
13567
13588
|
return { success: false, diagnostics };
|
|
13568
13589
|
}
|
|
@@ -13570,7 +13591,7 @@ var Transformer = class {
|
|
|
13570
13591
|
if (bundle.dtsProcessing !== DtsProcessing.Only) {
|
|
13571
13592
|
const srcFormatter = this.getRenderingFormatter(ngccReflectionHost, bundle);
|
|
13572
13593
|
const renderer = new Renderer(reflectionHost, srcFormatter, this.fs, this.logger, bundle, this.tsConfig);
|
|
13573
|
-
renderedFiles = renderer.renderProgram(decorationAnalyses,
|
|
13594
|
+
renderedFiles = renderer.renderProgram(decorationAnalyses, privateDeclarationsAnalyses);
|
|
13574
13595
|
}
|
|
13575
13596
|
if (bundle.dts) {
|
|
13576
13597
|
const dtsFormatter = new EsmRenderingFormatter(this.fs, reflectionHost, bundle.isCore);
|
|
@@ -13613,8 +13634,6 @@ var Transformer = class {
|
|
|
13613
13634
|
}
|
|
13614
13635
|
analyzeProgram(reflectionHost, bundle) {
|
|
13615
13636
|
const referencesRegistry = new NgccReferencesRegistry(reflectionHost);
|
|
13616
|
-
const switchMarkerAnalyzer = new SwitchMarkerAnalyzer(reflectionHost, bundle.entryPoint.packagePath);
|
|
13617
|
-
const switchMarkerAnalyses = switchMarkerAnalyzer.analyzeProgram(bundle.src.program);
|
|
13618
13637
|
const diagnostics = [];
|
|
13619
13638
|
const decorationAnalyzer = new DecorationAnalyzer(this.fs, bundle, reflectionHost, referencesRegistry, (diagnostic) => diagnostics.push(diagnostic), this.tsConfig);
|
|
13620
13639
|
const decorationAnalyses = decorationAnalyzer.analyzeProgram();
|
|
@@ -13624,7 +13643,6 @@ var Transformer = class {
|
|
|
13624
13643
|
const privateDeclarationsAnalyses = privateDeclarationsAnalyzer.analyzeProgram(bundle.src.program);
|
|
13625
13644
|
return {
|
|
13626
13645
|
decorationAnalyses,
|
|
13627
|
-
switchMarkerAnalyses,
|
|
13628
13646
|
privateDeclarationsAnalyses,
|
|
13629
13647
|
moduleWithProvidersAnalyses,
|
|
13630
13648
|
diagnostics
|
|
@@ -13632,7 +13650,7 @@ var Transformer = class {
|
|
|
13632
13650
|
}
|
|
13633
13651
|
};
|
|
13634
13652
|
function hasErrors(diagnostics) {
|
|
13635
|
-
return diagnostics.some((d) => d.category ===
|
|
13653
|
+
return diagnostics.some((d) => d.category === ts106.DiagnosticCategory.Error);
|
|
13636
13654
|
}
|
|
13637
13655
|
|
|
13638
13656
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/execution/create_compile_function.mjs
|
|
@@ -13656,7 +13674,7 @@ function getCreateCompileFn(fileSystem, logger, fileWriter, enableI18nLegacyMess
|
|
|
13656
13674
|
const result = transformer.transform(bundle);
|
|
13657
13675
|
if (result.success) {
|
|
13658
13676
|
if (result.diagnostics.length > 0) {
|
|
13659
|
-
logger.warn(replaceTsWithNgInErrors(
|
|
13677
|
+
logger.warn(replaceTsWithNgInErrors(ts107.formatDiagnosticsWithColorAndContext(result.diagnostics, bundle.src.host)));
|
|
13660
13678
|
}
|
|
13661
13679
|
const writeBundle = () => {
|
|
13662
13680
|
fileWriter.writeBundle(bundle, result.transformedFiles, formatPropertiesToMarkAsProcessed);
|
|
@@ -13666,7 +13684,7 @@ function getCreateCompileFn(fileSystem, logger, fileWriter, enableI18nLegacyMess
|
|
|
13666
13684
|
const beforeWritingResult = beforeWritingFiles(result.transformedFiles);
|
|
13667
13685
|
return beforeWritingResult instanceof Promise ? beforeWritingResult.then(writeBundle) : writeBundle();
|
|
13668
13686
|
} else {
|
|
13669
|
-
const errors = replaceTsWithNgInErrors(
|
|
13687
|
+
const errors = replaceTsWithNgInErrors(ts107.formatDiagnosticsWithColorAndContext(result.diagnostics, bundle.src.host));
|
|
13670
13688
|
onTaskCompleted(task, 1, `compilation errors:
|
|
13671
13689
|
${errors}`);
|
|
13672
13690
|
}
|