@angular/compiler-cli 13.1.0-next.0 → 13.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/{chunk-E64KJMKN.js → chunk-5NGMSHHH.js} +16 -16
- package/bundles/chunk-5NGMSHHH.js.map +6 -0
- package/bundles/{chunk-CRTDZEUV.js → chunk-5QEO6HSG.js} +6 -3
- package/bundles/chunk-5QEO6HSG.js.map +6 -0
- package/bundles/{chunk-AMD3PZ5E.js → chunk-BXWQHEIB.js} +412 -407
- package/bundles/chunk-BXWQHEIB.js.map +6 -0
- package/bundles/{chunk-QKLPWCHI.js → chunk-C2DR5MYL.js} +7 -3
- package/bundles/chunk-C2DR5MYL.js.map +6 -0
- package/bundles/{chunk-DDB2HQYR.js → chunk-FUXNWM54.js} +36 -15
- package/bundles/chunk-FUXNWM54.js.map +6 -0
- package/bundles/{chunk-QLSZVEIC.js → chunk-GX2C4BSM.js} +4585 -9131
- package/bundles/chunk-GX2C4BSM.js.map +6 -0
- package/bundles/{chunk-M7P4HAA4.js → chunk-GZLU7SCP.js} +28 -4
- package/bundles/chunk-GZLU7SCP.js.map +6 -0
- package/bundles/{chunk-XPUO7JIT.js → chunk-P2Q3CTKO.js} +11 -5
- package/bundles/chunk-P2Q3CTKO.js.map +6 -0
- package/bundles/{chunk-IG72ZKR7.js → chunk-PF3ZPGF5.js} +2 -2
- package/bundles/{chunk-IG72ZKR7.js.map → chunk-PF3ZPGF5.js.map} +0 -0
- package/bundles/{chunk-XKKOHZ3B.js → chunk-QFB4WK55.js} +2 -2
- package/bundles/{chunk-XKKOHZ3B.js.map → chunk-QFB4WK55.js.map} +0 -0
- package/bundles/{chunk-DLQQUCPJ.js → chunk-TI3THPMZ.js} +2 -2
- package/bundles/{chunk-DLQQUCPJ.js.map → chunk-TI3THPMZ.js.map} +0 -0
- package/bundles/{chunk-WOCQ7IIB.js → chunk-UAY4RXGC.js} +10 -8
- package/bundles/{chunk-WOCQ7IIB.js.map → chunk-UAY4RXGC.js.map} +1 -1
- package/bundles/{chunk-5VGHS4A4.js → chunk-XA5IZLLC.js} +1 -1
- package/bundles/{chunk-5VGHS4A4.js.map → chunk-XA5IZLLC.js.map} +0 -0
- package/bundles/index.js +8 -72
- package/bundles/index.js.map +2 -2
- package/bundles/linker/babel/index.js +5 -5
- package/bundles/linker/index.js +5 -5
- package/bundles/ngcc/index.js +9 -10
- package/bundles/ngcc/index.js.map +1 -1
- package/bundles/ngcc/main-ngcc.js +10 -11
- package/bundles/ngcc/main-ngcc.js.map +1 -1
- package/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js +9 -10
- package/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js.map +1 -1
- package/bundles/ngcc/src/locking/lock_file_with_child_process/ngcc_lock_unlocker.js +2 -2
- package/bundles/private/bazel.js +1 -1
- package/bundles/private/localize.js +3 -3
- package/bundles/private/migrations.js +5 -5
- package/bundles/private/tooling.js +3 -4
- package/bundles/src/bin/ng_xi18n.js +7 -8
- package/bundles/src/bin/ng_xi18n.js.map +1 -1
- package/bundles/src/bin/ngc.js +7 -8
- package/bundles/src/bin/ngc.js.map +1 -1
- package/bundles_metadata.json +1 -1
- package/index.d.ts +0 -3
- package/linker/src/file_linker/partial_linkers/util.d.ts +2 -2
- package/linker/src/file_linker/translator.d.ts +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/entry_point.d.ts +5 -0
- package/ngcc/src/packages/transformer.d.ts +0 -2
- package/ngcc/src/rendering/commonjs_rendering_formatter.d.ts +1 -1
- 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 +3 -3
- package/src/main.d.ts +3 -3
- package/src/ngtsc/core/src/host.d.ts +2 -1
- package/src/ngtsc/partial_evaluator/src/builtin.d.ts +5 -0
- package/src/ngtsc/program.d.ts +3 -6
- package/src/ngtsc/program_driver/src/ts_create_program_driver.d.ts +2 -1
- package/src/ngtsc/reflection/src/host.d.ts +1 -1
- package/src/ngtsc/typecheck/api/checker.d.ts +1 -1
- package/src/ngtsc/typecheck/src/tcb_util.d.ts +1 -1
- package/src/ngtsc/util/src/typescript.d.ts +10 -0
- package/src/perform_compile.d.ts +5 -10
- package/src/perform_watch.d.ts +4 -4
- package/src/transformers/api.d.ts +3 -30
- package/src/transformers/compiler_host.d.ts +1 -97
- package/src/transformers/program.d.ts +0 -19
- package/src/transformers/util.d.ts +1 -20
- package/src/{diagnostics/typescript_version.d.ts → version_helpers.d.ts} +1 -1
- package/bundles/chunk-AMD3PZ5E.js.map +0 -6
- package/bundles/chunk-CRTDZEUV.js.map +0 -6
- package/bundles/chunk-DDB2HQYR.js.map +0 -6
- package/bundles/chunk-E64KJMKN.js.map +0 -6
- package/bundles/chunk-GKA4YGOR.js +0 -43
- package/bundles/chunk-GKA4YGOR.js.map +0 -6
- package/bundles/chunk-M7P4HAA4.js.map +0 -6
- package/bundles/chunk-QKLPWCHI.js.map +0 -6
- package/bundles/chunk-QLSZVEIC.js.map +0 -6
- package/bundles/chunk-XPUO7JIT.js.map +0 -6
- package/ngcc/src/analysis/switch_marker_analyzer.d.ts +0 -35
- package/src/diagnostics/translate_diagnostics.d.ts +0 -18
- package/src/language_services.d.ts +0 -11
- package/src/metadata/bundle_index_host.d.ts +0 -16
- package/src/metadata/bundler.d.ts +0 -66
- package/src/metadata/collector.d.ts +0 -44
- package/src/metadata/evaluator.d.ts +0 -58
- package/src/metadata/index.d.ts +0 -11
- package/src/metadata/index_writer.d.ts +0 -10
- package/src/metadata/schema.d.ts +0 -182
- package/src/metadata/symbols.d.ts +0 -22
- package/src/ngtsc/switch/index.d.ts +0 -9
- package/src/ngtsc/switch/src/switch.d.ts +0 -10
- package/src/transformers/inline_resources.d.ts +0 -26
- package/src/transformers/lower_expressions.d.ts +0 -30
- package/src/transformers/metadata_cache.d.ts +0 -27
- package/src/transformers/metadata_reader.d.ts +0 -19
- package/src/transformers/node_emitter.d.ts +0 -105
- package/src/transformers/node_emitter_transform.d.ts +0 -19
- package/src/transformers/r3_metadata_transform.d.ts +0 -16
- package/src/transformers/r3_transform.d.ts +0 -16
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
MetadataDtsModuleScopeResolver,
|
|
11
11
|
TypeCheckScopeRegistry,
|
|
12
12
|
readConfiguration
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-GX2C4BSM.js";
|
|
14
14
|
import {
|
|
15
15
|
CompilationMode,
|
|
16
16
|
ComponentDecoratorHandler,
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
isFatalDiagnosticError,
|
|
34
34
|
readBaseClass,
|
|
35
35
|
replaceTsWithNgInErrors
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-FUXNWM54.js";
|
|
37
37
|
import {
|
|
38
38
|
ClassMemberKind,
|
|
39
39
|
KnownDeclaration,
|
|
@@ -44,7 +44,7 @@ import {
|
|
|
44
44
|
isNamedFunctionDeclaration,
|
|
45
45
|
isNamedVariableDeclaration,
|
|
46
46
|
reflectObjectLiteral
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-5QEO6HSG.js";
|
|
48
48
|
import {
|
|
49
49
|
ConsoleLogger,
|
|
50
50
|
LogLevel
|
|
@@ -52,7 +52,7 @@ import {
|
|
|
52
52
|
import {
|
|
53
53
|
ContentOrigin,
|
|
54
54
|
SourceFileLoader
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-PF3ZPGF5.js";
|
|
56
56
|
import {
|
|
57
57
|
AbsoluteModuleStrategy,
|
|
58
58
|
ImportManager,
|
|
@@ -71,7 +71,7 @@ import {
|
|
|
71
71
|
translateStatement,
|
|
72
72
|
translateType,
|
|
73
73
|
validateAndRewriteCoreSymbol
|
|
74
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-C2DR5MYL.js";
|
|
75
75
|
import {
|
|
76
76
|
LogicalFileSystem,
|
|
77
77
|
NgtscCompilerHost,
|
|
@@ -83,23 +83,23 @@ import {
|
|
|
83
83
|
isRooted,
|
|
84
84
|
relative,
|
|
85
85
|
toRelativeImport
|
|
86
|
-
} from "./chunk-
|
|
86
|
+
} from "./chunk-TI3THPMZ.js";
|
|
87
87
|
import {
|
|
88
88
|
NOOP_PERF_RECORDER
|
|
89
89
|
} from "./chunk-J6CW3T62.js";
|
|
90
90
|
import {
|
|
91
91
|
__spreadProps,
|
|
92
92
|
__spreadValues
|
|
93
|
-
} from "./chunk-
|
|
93
|
+
} from "./chunk-XA5IZLLC.js";
|
|
94
94
|
|
|
95
95
|
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/ngcc/src/execution/create_compile_function.mjs
|
|
96
|
-
import
|
|
96
|
+
import ts22 from "typescript";
|
|
97
97
|
|
|
98
98
|
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/ngcc/src/packages/entry_point.mjs
|
|
99
|
-
import
|
|
99
|
+
import ts7 from "typescript";
|
|
100
100
|
|
|
101
101
|
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/ngcc/src/host/umd_host.mjs
|
|
102
|
-
import
|
|
102
|
+
import ts6 from "typescript";
|
|
103
103
|
|
|
104
104
|
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/ngcc/src/utils.mjs
|
|
105
105
|
import ts from "typescript";
|
|
@@ -109,18 +109,6 @@ function isDefined(value) {
|
|
|
109
109
|
function getNameText(name) {
|
|
110
110
|
return ts.isIdentifier(name) || ts.isLiteralExpression(name) ? name.text : name.getText();
|
|
111
111
|
}
|
|
112
|
-
function findAll(node, test) {
|
|
113
|
-
const nodes = [];
|
|
114
|
-
findAllVisitor(node);
|
|
115
|
-
return nodes;
|
|
116
|
-
function findAllVisitor(n) {
|
|
117
|
-
if (test(n)) {
|
|
118
|
-
nodes.push(n);
|
|
119
|
-
} else {
|
|
120
|
-
n.forEachChild((child) => findAllVisitor(child));
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
112
|
function hasNameIdentifier(declaration) {
|
|
125
113
|
const namedDeclaration = declaration;
|
|
126
114
|
return namedDeclaration.name !== void 0 && ts.isIdentifier(namedDeclaration.name);
|
|
@@ -271,7 +259,7 @@ function skipAliases(node) {
|
|
|
271
259
|
}
|
|
272
260
|
|
|
273
261
|
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/ngcc/src/host/esm2015_host.mjs
|
|
274
|
-
import
|
|
262
|
+
import ts4 from "typescript";
|
|
275
263
|
|
|
276
264
|
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/ngcc/src/analysis/util.mjs
|
|
277
265
|
function isWithinPackage(packagePath, filePath) {
|
|
@@ -288,18 +276,10 @@ var NoopDependencyTracker = class {
|
|
|
288
276
|
};
|
|
289
277
|
var NOOP_DEPENDENCY_TRACKER = new NoopDependencyTracker();
|
|
290
278
|
|
|
291
|
-
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/ngcc/src/host/ngcc_host.mjs
|
|
292
|
-
import ts3 from "typescript";
|
|
293
|
-
var PRE_R3_MARKER = "__PRE_R3__";
|
|
294
|
-
var POST_R3_MARKER = "__POST_R3__";
|
|
295
|
-
function isSwitchableVariableDeclaration(node) {
|
|
296
|
-
return ts3.isVariableDeclaration(node) && !!node.initializer && ts3.isIdentifier(node.initializer) && node.initializer.text.endsWith(PRE_R3_MARKER);
|
|
297
|
-
}
|
|
298
|
-
|
|
299
279
|
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/ngcc/src/host/utils.mjs
|
|
300
|
-
import
|
|
280
|
+
import ts3 from "typescript";
|
|
301
281
|
function stripParentheses(node) {
|
|
302
|
-
return
|
|
282
|
+
return ts3.isParenthesizedExpression(node) ? node.expression : node;
|
|
303
283
|
}
|
|
304
284
|
|
|
305
285
|
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/ngcc/src/host/esm2015_host.mjs
|
|
@@ -402,7 +382,7 @@ ${declaration.getText()}`);
|
|
|
402
382
|
let declarationNode = superDeclaration.node;
|
|
403
383
|
if (isNamedVariableDeclaration(superDeclaration.node) && !isTopLevel(superDeclaration.node)) {
|
|
404
384
|
const variableValue = this.getVariableValue(superDeclaration.node);
|
|
405
|
-
if (variableValue !== null &&
|
|
385
|
+
if (variableValue !== null && ts4.isClassExpression(variableValue)) {
|
|
406
386
|
declarationNode = getContainingStatement(variableValue);
|
|
407
387
|
}
|
|
408
388
|
}
|
|
@@ -415,7 +395,7 @@ ${declaration.getText()}`);
|
|
|
415
395
|
if (aliasedIdentifier !== null) {
|
|
416
396
|
return this.getDeclarationOfIdentifier(aliasedIdentifier);
|
|
417
397
|
}
|
|
418
|
-
if (isConcreteDeclaration(declaration) &&
|
|
398
|
+
if (isConcreteDeclaration(declaration) && ts4.isVariableDeclaration(declaration.node)) {
|
|
419
399
|
const enumMembers = this.resolveEnumMembers(declaration.node);
|
|
420
400
|
if (enumMembers !== null) {
|
|
421
401
|
declaration.identity = { kind: 0, enumMembers };
|
|
@@ -430,9 +410,6 @@ ${declaration.getText()}`);
|
|
|
430
410
|
}
|
|
431
411
|
return Array.from(classDecorators);
|
|
432
412
|
}
|
|
433
|
-
getSwitchableDeclarations(module) {
|
|
434
|
-
return module.getText().indexOf(PRE_R3_MARKER) >= 0 ? findAll(module, isSwitchableVariableDeclaration) : [];
|
|
435
|
-
}
|
|
436
413
|
getVariableValue(declaration) {
|
|
437
414
|
const value = super.getVariableValue(declaration);
|
|
438
415
|
if (value) {
|
|
@@ -440,16 +417,16 @@ ${declaration.getText()}`);
|
|
|
440
417
|
}
|
|
441
418
|
const block = declaration.parent.parent.parent;
|
|
442
419
|
const symbol = this.checker.getSymbolAtLocation(declaration.name);
|
|
443
|
-
if (symbol && (
|
|
420
|
+
if (symbol && (ts4.isBlock(block) || ts4.isSourceFile(block))) {
|
|
444
421
|
const decorateCall = this.findDecoratedVariableValue(block, symbol);
|
|
445
422
|
const target = decorateCall && decorateCall.arguments[1];
|
|
446
|
-
if (target &&
|
|
423
|
+
if (target && ts4.isIdentifier(target)) {
|
|
447
424
|
const targetSymbol = this.checker.getSymbolAtLocation(target);
|
|
448
425
|
const targetDeclaration = targetSymbol && targetSymbol.valueDeclaration;
|
|
449
426
|
if (targetDeclaration) {
|
|
450
|
-
if (
|
|
427
|
+
if (ts4.isClassDeclaration(targetDeclaration) || ts4.isFunctionDeclaration(targetDeclaration)) {
|
|
451
428
|
return targetDeclaration.name || null;
|
|
452
|
-
} else if (
|
|
429
|
+
} else if (ts4.isVariableDeclaration(targetDeclaration)) {
|
|
453
430
|
let targetValue = targetDeclaration.initializer;
|
|
454
431
|
while (targetValue && isAssignment2(targetValue)) {
|
|
455
432
|
targetValue = targetValue.right;
|
|
@@ -470,7 +447,7 @@ ${declaration.getText()}`);
|
|
|
470
447
|
}
|
|
471
448
|
getGenericArityOfClass(clazz) {
|
|
472
449
|
const dtsDeclaration = this.getDtsDeclaration(clazz);
|
|
473
|
-
if (dtsDeclaration &&
|
|
450
|
+
if (dtsDeclaration && ts4.isClassDeclaration(dtsDeclaration)) {
|
|
474
451
|
return dtsDeclaration.typeParameters ? dtsDeclaration.typeParameters.length : 0;
|
|
475
452
|
}
|
|
476
453
|
return null;
|
|
@@ -507,13 +484,13 @@ ${declaration.getText()}`);
|
|
|
507
484
|
if (implementationStatement === null)
|
|
508
485
|
return last;
|
|
509
486
|
const container = implementationStatement.parent;
|
|
510
|
-
if (
|
|
511
|
-
const returnStatementIndex = container.statements.findIndex(
|
|
487
|
+
if (ts4.isBlock(container)) {
|
|
488
|
+
const returnStatementIndex = container.statements.findIndex(ts4.isReturnStatement);
|
|
512
489
|
if (returnStatementIndex === -1) {
|
|
513
490
|
throw new Error(`Compiled class wrapper IIFE does not have a return statement: ${classSymbol.name} in ${classSymbol.declaration.valueDeclaration.getSourceFile().fileName}`);
|
|
514
491
|
}
|
|
515
492
|
last = container.statements[returnStatementIndex - 1];
|
|
516
|
-
} else if (
|
|
493
|
+
} else if (ts4.isSourceFile(container)) {
|
|
517
494
|
if (implementation.exports !== void 0) {
|
|
518
495
|
implementation.exports.forEach((exportSymbol) => {
|
|
519
496
|
if (exportSymbol.valueDeclaration === void 0) {
|
|
@@ -542,14 +519,14 @@ ${declaration.getText()}`);
|
|
|
542
519
|
return decl;
|
|
543
520
|
}
|
|
544
521
|
addClassSymbolsFromStatement(classes, statement) {
|
|
545
|
-
if (
|
|
522
|
+
if (ts4.isVariableStatement(statement)) {
|
|
546
523
|
statement.declarationList.declarations.forEach((declaration) => {
|
|
547
524
|
const classSymbol = this.getClassSymbol(declaration);
|
|
548
525
|
if (classSymbol) {
|
|
549
526
|
classes.set(classSymbol.implementation, classSymbol);
|
|
550
527
|
}
|
|
551
528
|
});
|
|
552
|
-
} else if (
|
|
529
|
+
} else if (ts4.isClassDeclaration(statement)) {
|
|
553
530
|
const classSymbol = this.getClassSymbol(statement);
|
|
554
531
|
if (classSymbol) {
|
|
555
532
|
classes.set(classSymbol.implementation, classSymbol);
|
|
@@ -580,7 +557,7 @@ ${declaration.getText()}`);
|
|
|
580
557
|
}
|
|
581
558
|
getClassSymbolFromInnerDeclaration(declaration) {
|
|
582
559
|
let outerDeclaration = void 0;
|
|
583
|
-
if (
|
|
560
|
+
if (ts4.isClassExpression(declaration) && hasNameIdentifier(declaration)) {
|
|
584
561
|
outerDeclaration = getFarLeftHandSideOfAssignment(declaration);
|
|
585
562
|
if (outerDeclaration !== void 0 && !isTopLevel(outerDeclaration)) {
|
|
586
563
|
outerDeclaration = getContainingVariableDeclaration(outerDeclaration);
|
|
@@ -622,7 +599,7 @@ ${declaration.getText()}`);
|
|
|
622
599
|
return void 0;
|
|
623
600
|
}
|
|
624
601
|
const innerDeclaration = implementationSymbol.valueDeclaration;
|
|
625
|
-
if (!
|
|
602
|
+
if (!ts4.isClassExpression(innerDeclaration) && !ts4.isFunctionExpression(innerDeclaration)) {
|
|
626
603
|
return void 0;
|
|
627
604
|
}
|
|
628
605
|
const adjacentDeclaration = getFarLeftHandSideOfAssignment(innerDeclaration);
|
|
@@ -655,7 +632,7 @@ ${declaration.getText()}`);
|
|
|
655
632
|
}
|
|
656
633
|
}
|
|
657
634
|
preprocessStatement(statement) {
|
|
658
|
-
if (!
|
|
635
|
+
if (!ts4.isVariableStatement(statement)) {
|
|
659
636
|
return;
|
|
660
637
|
}
|
|
661
638
|
const declarations = statement.declarationList.declarations;
|
|
@@ -664,7 +641,7 @@ ${declaration.getText()}`);
|
|
|
664
641
|
}
|
|
665
642
|
const declaration = declarations[0];
|
|
666
643
|
const initializer = declaration.initializer;
|
|
667
|
-
if (!
|
|
644
|
+
if (!ts4.isIdentifier(declaration.name) || !initializer || !isAssignment2(initializer) || !ts4.isIdentifier(initializer.left) || !this.isClass(declaration)) {
|
|
668
645
|
return;
|
|
669
646
|
}
|
|
670
647
|
const aliasedIdentifier = initializer.left;
|
|
@@ -681,11 +658,11 @@ ${declaration.getText()}`);
|
|
|
681
658
|
if (!node) {
|
|
682
659
|
return null;
|
|
683
660
|
}
|
|
684
|
-
if (
|
|
661
|
+
if (ts4.isBinaryExpression(node) && node.operatorToken.kind === ts4.SyntaxKind.EqualsToken) {
|
|
685
662
|
const left = node.left;
|
|
686
663
|
const right = node.right;
|
|
687
|
-
if (
|
|
688
|
-
return
|
|
664
|
+
if (ts4.isIdentifier(left) && this.checker.getSymbolAtLocation(left) === symbol) {
|
|
665
|
+
return ts4.isCallExpression(right) && getCalleeName(right) === "__decorate" ? right : null;
|
|
689
666
|
}
|
|
690
667
|
return this.findDecoratedVariableValue(right, symbol);
|
|
691
668
|
}
|
|
@@ -731,7 +708,7 @@ ${declaration.getText()}`);
|
|
|
731
708
|
getClassDecoratorsFromStaticProperty(decoratorsSymbol) {
|
|
732
709
|
const decoratorsIdentifier = decoratorsSymbol.valueDeclaration;
|
|
733
710
|
if (decoratorsIdentifier && decoratorsIdentifier.parent) {
|
|
734
|
-
if (
|
|
711
|
+
if (ts4.isBinaryExpression(decoratorsIdentifier.parent) && decoratorsIdentifier.parent.operatorToken.kind === ts4.SyntaxKind.EqualsToken) {
|
|
735
712
|
const decoratorsArray = decoratorsIdentifier.parent.right;
|
|
736
713
|
return this.reflectDecorators(decoratorsArray).filter((decorator) => this.isFromCore(decorator));
|
|
737
714
|
}
|
|
@@ -762,7 +739,7 @@ ${declaration.getText()}`);
|
|
|
762
739
|
}
|
|
763
740
|
});
|
|
764
741
|
}
|
|
765
|
-
if (
|
|
742
|
+
if (ts4.isVariableDeclaration(symbol.declaration.valueDeclaration)) {
|
|
766
743
|
if (symbol.declaration.exports) {
|
|
767
744
|
symbol.declaration.exports.forEach((value, key) => {
|
|
768
745
|
const decorators = decoratorsMap.get(key);
|
|
@@ -775,7 +752,7 @@ ${declaration.getText()}`);
|
|
|
775
752
|
}
|
|
776
753
|
}
|
|
777
754
|
if (symbol.adjacent !== void 0) {
|
|
778
|
-
if (
|
|
755
|
+
if (ts4.isVariableDeclaration(symbol.adjacent.valueDeclaration)) {
|
|
779
756
|
if (symbol.adjacent.exports !== void 0) {
|
|
780
757
|
symbol.adjacent.exports.forEach((value, key) => {
|
|
781
758
|
const decorators = decoratorsMap.get(key);
|
|
@@ -806,7 +783,7 @@ ${declaration.getText()}`);
|
|
|
806
783
|
getMemberDecoratorsFromStaticProperty(decoratorsProperty) {
|
|
807
784
|
const memberDecorators = new Map();
|
|
808
785
|
const propDecoratorsMap = getPropertyValueFromSymbol(decoratorsProperty);
|
|
809
|
-
if (propDecoratorsMap &&
|
|
786
|
+
if (propDecoratorsMap && ts4.isObjectLiteralExpression(propDecoratorsMap)) {
|
|
810
787
|
const propertiesMap = reflectObjectLiteral(propDecoratorsMap);
|
|
811
788
|
propertiesMap.forEach((value, name) => {
|
|
812
789
|
const decorators = this.reflectDecorators(value).filter((decorator) => this.isFromCore(decorator));
|
|
@@ -877,18 +854,18 @@ ${declaration.getText()}`);
|
|
|
877
854
|
return { classDecorators, memberDecorators, constructorParamInfo };
|
|
878
855
|
}
|
|
879
856
|
reflectDecorateHelperEntry(expression) {
|
|
880
|
-
if (!
|
|
857
|
+
if (!ts4.isCallExpression(expression)) {
|
|
881
858
|
return null;
|
|
882
859
|
}
|
|
883
860
|
const call = expression;
|
|
884
861
|
const helperName = getCalleeName(call);
|
|
885
862
|
if (helperName === "__metadata") {
|
|
886
863
|
const key = call.arguments[0];
|
|
887
|
-
if (key === void 0 || !
|
|
864
|
+
if (key === void 0 || !ts4.isStringLiteral(key) || key.text !== "design:paramtypes") {
|
|
888
865
|
return null;
|
|
889
866
|
}
|
|
890
867
|
const value = call.arguments[1];
|
|
891
|
-
if (value === void 0 || !
|
|
868
|
+
if (value === void 0 || !ts4.isArrayLiteralExpression(value)) {
|
|
892
869
|
return null;
|
|
893
870
|
}
|
|
894
871
|
return {
|
|
@@ -898,12 +875,12 @@ ${declaration.getText()}`);
|
|
|
898
875
|
}
|
|
899
876
|
if (helperName === "__param") {
|
|
900
877
|
const indexArg = call.arguments[0];
|
|
901
|
-
const index = indexArg &&
|
|
878
|
+
const index = indexArg && ts4.isNumericLiteral(indexArg) ? parseInt(indexArg.text, 10) : NaN;
|
|
902
879
|
if (isNaN(index)) {
|
|
903
880
|
return null;
|
|
904
881
|
}
|
|
905
882
|
const decoratorCall = call.arguments[1];
|
|
906
|
-
if (decoratorCall === void 0 || !
|
|
883
|
+
if (decoratorCall === void 0 || !ts4.isCallExpression(decoratorCall)) {
|
|
907
884
|
return null;
|
|
908
885
|
}
|
|
909
886
|
const decorator2 = this.reflectDecoratorCall(decoratorCall);
|
|
@@ -930,7 +907,7 @@ ${declaration.getText()}`);
|
|
|
930
907
|
if (!isDecoratorIdentifier(decoratorExpression)) {
|
|
931
908
|
return null;
|
|
932
909
|
}
|
|
933
|
-
const decoratorIdentifier =
|
|
910
|
+
const decoratorIdentifier = ts4.isIdentifier(decoratorExpression) ? decoratorExpression : decoratorExpression.name;
|
|
934
911
|
return {
|
|
935
912
|
name: decoratorIdentifier.text,
|
|
936
913
|
identifier: decoratorExpression,
|
|
@@ -940,12 +917,12 @@ ${declaration.getText()}`);
|
|
|
940
917
|
};
|
|
941
918
|
}
|
|
942
919
|
getHelperCall(statement, helperNames) {
|
|
943
|
-
if ((
|
|
920
|
+
if ((ts4.isExpressionStatement(statement) || ts4.isReturnStatement(statement)) && statement.expression) {
|
|
944
921
|
let expression = statement.expression;
|
|
945
922
|
while (isAssignment2(expression)) {
|
|
946
923
|
expression = expression.right;
|
|
947
924
|
}
|
|
948
|
-
if (
|
|
925
|
+
if (ts4.isCallExpression(expression)) {
|
|
949
926
|
const calleeName = getCalleeName(expression);
|
|
950
927
|
if (calleeName !== null && helperNames.includes(calleeName)) {
|
|
951
928
|
return expression;
|
|
@@ -956,14 +933,14 @@ ${declaration.getText()}`);
|
|
|
956
933
|
}
|
|
957
934
|
reflectDecorators(decoratorsArray) {
|
|
958
935
|
const decorators = [];
|
|
959
|
-
if (
|
|
936
|
+
if (ts4.isArrayLiteralExpression(decoratorsArray)) {
|
|
960
937
|
decoratorsArray.elements.forEach((node) => {
|
|
961
|
-
if (
|
|
938
|
+
if (ts4.isObjectLiteralExpression(node)) {
|
|
962
939
|
const decorator = reflectObjectLiteral(node);
|
|
963
940
|
if (decorator.has("type")) {
|
|
964
941
|
let decoratorType = decorator.get("type");
|
|
965
942
|
if (isDecoratorIdentifier(decoratorType)) {
|
|
966
|
-
const decoratorIdentifier =
|
|
943
|
+
const decoratorIdentifier = ts4.isIdentifier(decoratorType) ? decoratorType : decoratorType.name;
|
|
967
944
|
decorators.push({
|
|
968
945
|
name: decoratorIdentifier.text,
|
|
969
946
|
identifier: decoratorType,
|
|
@@ -979,10 +956,10 @@ ${declaration.getText()}`);
|
|
|
979
956
|
return decorators;
|
|
980
957
|
}
|
|
981
958
|
reflectMembers(symbol, decorators, isStatic) {
|
|
982
|
-
if (symbol.flags &
|
|
959
|
+
if (symbol.flags & ts4.SymbolFlags.Accessor) {
|
|
983
960
|
const members = [];
|
|
984
|
-
const setter = symbol.declarations && symbol.declarations.find(
|
|
985
|
-
const getter = symbol.declarations && symbol.declarations.find(
|
|
961
|
+
const setter = symbol.declarations && symbol.declarations.find(ts4.isSetAccessor);
|
|
962
|
+
const getter = symbol.declarations && symbol.declarations.find(ts4.isGetAccessor);
|
|
986
963
|
const setterMember = setter && this.reflectMember(setter, ClassMemberKind.Setter, decorators, isStatic);
|
|
987
964
|
if (setterMember) {
|
|
988
965
|
members.push(setterMember);
|
|
@@ -995,9 +972,9 @@ ${declaration.getText()}`);
|
|
|
995
972
|
return members;
|
|
996
973
|
}
|
|
997
974
|
let kind = null;
|
|
998
|
-
if (symbol.flags &
|
|
975
|
+
if (symbol.flags & ts4.SymbolFlags.Method) {
|
|
999
976
|
kind = ClassMemberKind.Method;
|
|
1000
|
-
} else if (symbol.flags &
|
|
977
|
+
} else if (symbol.flags & ts4.SymbolFlags.Property) {
|
|
1001
978
|
kind = ClassMemberKind.Property;
|
|
1002
979
|
}
|
|
1003
980
|
const node = symbol.valueDeclaration || symbol.declarations && symbol.declarations[0];
|
|
@@ -1025,7 +1002,7 @@ ${declaration.getText()}`);
|
|
|
1025
1002
|
name = node.left.name.text;
|
|
1026
1003
|
value = node.right;
|
|
1027
1004
|
isStatic = false;
|
|
1028
|
-
} else if (
|
|
1005
|
+
} else if (ts4.isConstructorDeclaration(node)) {
|
|
1029
1006
|
kind = ClassMemberKind.Constructor;
|
|
1030
1007
|
name = "constructor";
|
|
1031
1008
|
isStatic = false;
|
|
@@ -1043,7 +1020,7 @@ ${declaration.getText()}`);
|
|
|
1043
1020
|
}
|
|
1044
1021
|
}
|
|
1045
1022
|
if (isStatic === void 0) {
|
|
1046
|
-
isStatic = node.modifiers !== void 0 && node.modifiers.some((mod) => mod.kind ===
|
|
1023
|
+
isStatic = node.modifiers !== void 0 && node.modifiers.some((mod) => mod.kind === ts4.SyntaxKind.StaticKeyword);
|
|
1047
1024
|
}
|
|
1048
1025
|
const type = node.type || null;
|
|
1049
1026
|
return {
|
|
@@ -1116,9 +1093,9 @@ ${declaration.getText()}`);
|
|
|
1116
1093
|
};
|
|
1117
1094
|
}
|
|
1118
1095
|
getImportOfExpression(expression) {
|
|
1119
|
-
if (
|
|
1096
|
+
if (ts4.isIdentifier(expression)) {
|
|
1120
1097
|
return this.getImportOfIdentifier(expression);
|
|
1121
|
-
} else if (
|
|
1098
|
+
} else if (ts4.isPropertyAccessExpression(expression) && ts4.isIdentifier(expression.name)) {
|
|
1122
1099
|
return this.getImportOfIdentifier(expression.name);
|
|
1123
1100
|
} else {
|
|
1124
1101
|
return null;
|
|
@@ -1127,10 +1104,10 @@ ${declaration.getText()}`);
|
|
|
1127
1104
|
getParamInfoFromStaticProperty(paramDecoratorsProperty) {
|
|
1128
1105
|
const paramDecorators = getPropertyValueFromSymbol(paramDecoratorsProperty);
|
|
1129
1106
|
if (paramDecorators) {
|
|
1130
|
-
const container =
|
|
1131
|
-
if (
|
|
1107
|
+
const container = ts4.isArrowFunction(paramDecorators) ? paramDecorators.body : paramDecorators;
|
|
1108
|
+
if (ts4.isArrayLiteralExpression(container)) {
|
|
1132
1109
|
const elements = container.elements;
|
|
1133
|
-
return elements.map((element) =>
|
|
1110
|
+
return elements.map((element) => ts4.isObjectLiteralExpression(element) ? reflectObjectLiteral(element) : null).map((paramInfo) => {
|
|
1134
1111
|
const typeExpression = paramInfo && paramInfo.has("type") ? paramInfo.get("type") : null;
|
|
1135
1112
|
const decoratorInfo = paramInfo && paramInfo.has("decorators") ? paramInfo.get("decorators") : null;
|
|
1136
1113
|
const decorators = decoratorInfo && this.reflectDecorators(decoratorInfo).filter((decorator) => this.isFromCore(decorator));
|
|
@@ -1151,7 +1128,7 @@ ${declaration.getText()}`);
|
|
|
1151
1128
|
return this.getModuleStatements(classNode.getSourceFile());
|
|
1152
1129
|
}
|
|
1153
1130
|
const statement = getContainingStatement(classNode);
|
|
1154
|
-
if (
|
|
1131
|
+
if (ts4.isBlock(statement.parent)) {
|
|
1155
1132
|
return Array.from(statement.parent.statements);
|
|
1156
1133
|
}
|
|
1157
1134
|
throw new Error(`Unable to find adjacent statements for ${classSymbol.name}`);
|
|
@@ -1192,7 +1169,7 @@ ${declaration.getText()}`);
|
|
|
1192
1169
|
if (moduleExports) {
|
|
1193
1170
|
moduleExports.forEach((exportedSymbol) => {
|
|
1194
1171
|
const name = exportedSymbol.name;
|
|
1195
|
-
if (exportedSymbol.flags &
|
|
1172
|
+
if (exportedSymbol.flags & ts4.SymbolFlags.Alias) {
|
|
1196
1173
|
exportedSymbol = checker.getAliasedSymbol(exportedSymbol);
|
|
1197
1174
|
}
|
|
1198
1175
|
const declaration = exportedSymbol.valueDeclaration;
|
|
@@ -1213,14 +1190,14 @@ ${declaration.getText()}`);
|
|
|
1213
1190
|
}
|
|
1214
1191
|
}
|
|
1215
1192
|
getDeclarationOfExpression(expression) {
|
|
1216
|
-
if (
|
|
1193
|
+
if (ts4.isIdentifier(expression)) {
|
|
1217
1194
|
return this.getDeclarationOfIdentifier(expression);
|
|
1218
1195
|
}
|
|
1219
|
-
if (!
|
|
1196
|
+
if (!ts4.isPropertyAccessExpression(expression) || !ts4.isIdentifier(expression.expression)) {
|
|
1220
1197
|
return null;
|
|
1221
1198
|
}
|
|
1222
1199
|
const namespaceDecl = this.getDeclarationOfIdentifier(expression.expression);
|
|
1223
|
-
if (!namespaceDecl || !
|
|
1200
|
+
if (!namespaceDecl || !ts4.isSourceFile(namespaceDecl.node)) {
|
|
1224
1201
|
return null;
|
|
1225
1202
|
}
|
|
1226
1203
|
const namespaceExports = this.getExportsOfModule(namespaceDecl.node);
|
|
@@ -1235,11 +1212,11 @@ ${declaration.getText()}`);
|
|
|
1235
1212
|
}
|
|
1236
1213
|
isJavaScriptObjectDeclaration(decl) {
|
|
1237
1214
|
const node = decl.node;
|
|
1238
|
-
if (!
|
|
1215
|
+
if (!ts4.isVariableDeclaration(node) || !ts4.isIdentifier(node.name) || node.name.text !== "Object" || node.type === void 0) {
|
|
1239
1216
|
return false;
|
|
1240
1217
|
}
|
|
1241
1218
|
const typeNode = node.type;
|
|
1242
|
-
if (!
|
|
1219
|
+
if (!ts4.isTypeReferenceNode(typeNode) || !ts4.isIdentifier(typeNode.typeName) || typeNode.typeName.text !== "ObjectConstructor") {
|
|
1243
1220
|
return false;
|
|
1244
1221
|
}
|
|
1245
1222
|
return this.src.program.isSourceFileDefaultLibrary(node.getSourceFile());
|
|
@@ -1248,22 +1225,22 @@ ${declaration.getText()}`);
|
|
|
1248
1225
|
if (declaration.initializer !== void 0)
|
|
1249
1226
|
return null;
|
|
1250
1227
|
const variableStmt = declaration.parent.parent;
|
|
1251
|
-
if (!
|
|
1228
|
+
if (!ts4.isVariableStatement(variableStmt))
|
|
1252
1229
|
return null;
|
|
1253
1230
|
const block = variableStmt.parent;
|
|
1254
|
-
if (!
|
|
1231
|
+
if (!ts4.isBlock(block) && !ts4.isSourceFile(block))
|
|
1255
1232
|
return null;
|
|
1256
1233
|
const declarationIndex = block.statements.findIndex((statement) => statement === variableStmt);
|
|
1257
1234
|
if (declarationIndex === -1 || declarationIndex === block.statements.length - 1)
|
|
1258
1235
|
return null;
|
|
1259
1236
|
const subsequentStmt = block.statements[declarationIndex + 1];
|
|
1260
|
-
if (!
|
|
1237
|
+
if (!ts4.isExpressionStatement(subsequentStmt))
|
|
1261
1238
|
return null;
|
|
1262
1239
|
const iife = stripParentheses(subsequentStmt.expression);
|
|
1263
|
-
if (!
|
|
1240
|
+
if (!ts4.isCallExpression(iife) || !isEnumDeclarationIife(iife))
|
|
1264
1241
|
return null;
|
|
1265
1242
|
const fn = stripParentheses(iife.expression);
|
|
1266
|
-
if (!
|
|
1243
|
+
if (!ts4.isFunctionExpression(fn))
|
|
1267
1244
|
return null;
|
|
1268
1245
|
return this.reflectEnumMembers(fn);
|
|
1269
1246
|
}
|
|
@@ -1271,7 +1248,7 @@ ${declaration.getText()}`);
|
|
|
1271
1248
|
if (fn.parameters.length !== 1)
|
|
1272
1249
|
return null;
|
|
1273
1250
|
const enumName = fn.parameters[0].name;
|
|
1274
|
-
if (!
|
|
1251
|
+
if (!ts4.isIdentifier(enumName))
|
|
1275
1252
|
return null;
|
|
1276
1253
|
const enumMembers = [];
|
|
1277
1254
|
for (const statement of fn.body.statements) {
|
|
@@ -1284,7 +1261,7 @@ ${declaration.getText()}`);
|
|
|
1284
1261
|
return enumMembers;
|
|
1285
1262
|
}
|
|
1286
1263
|
reflectEnumMember(enumName, statement) {
|
|
1287
|
-
if (!
|
|
1264
|
+
if (!ts4.isExpressionStatement(statement))
|
|
1288
1265
|
return null;
|
|
1289
1266
|
const expression = statement.expression;
|
|
1290
1267
|
if (!isEnumAssignment(enumName, expression)) {
|
|
@@ -1312,78 +1289,78 @@ function isEnumDeclarationIife(iife) {
|
|
|
1312
1289
|
if (iife.arguments.length !== 1)
|
|
1313
1290
|
return false;
|
|
1314
1291
|
const arg = iife.arguments[0];
|
|
1315
|
-
if (!
|
|
1292
|
+
if (!ts4.isBinaryExpression(arg) || arg.operatorToken.kind !== ts4.SyntaxKind.BarBarToken || !ts4.isParenthesizedExpression(arg.right)) {
|
|
1316
1293
|
return false;
|
|
1317
1294
|
}
|
|
1318
1295
|
const right = arg.right.expression;
|
|
1319
|
-
if (!
|
|
1296
|
+
if (!ts4.isBinaryExpression(right) || right.operatorToken.kind !== ts4.SyntaxKind.EqualsToken) {
|
|
1320
1297
|
return false;
|
|
1321
1298
|
}
|
|
1322
|
-
if (!
|
|
1299
|
+
if (!ts4.isObjectLiteralExpression(right.right) || right.right.properties.length !== 0) {
|
|
1323
1300
|
return false;
|
|
1324
1301
|
}
|
|
1325
1302
|
return true;
|
|
1326
1303
|
}
|
|
1327
1304
|
function isEnumAssignment(enumName, expression) {
|
|
1328
|
-
if (!
|
|
1305
|
+
if (!ts4.isBinaryExpression(expression) || expression.operatorToken.kind !== ts4.SyntaxKind.EqualsToken || !ts4.isElementAccessExpression(expression.left)) {
|
|
1329
1306
|
return false;
|
|
1330
1307
|
}
|
|
1331
1308
|
const enumIdentifier = expression.left.expression;
|
|
1332
|
-
return
|
|
1309
|
+
return ts4.isIdentifier(enumIdentifier) && enumIdentifier.text === enumName.text;
|
|
1333
1310
|
}
|
|
1334
1311
|
function reflectEnumAssignment(expression) {
|
|
1335
1312
|
const memberName = expression.left.argumentExpression;
|
|
1336
|
-
if (!
|
|
1313
|
+
if (!ts4.isPropertyName(memberName))
|
|
1337
1314
|
return null;
|
|
1338
1315
|
return { name: memberName, initializer: expression.right };
|
|
1339
1316
|
}
|
|
1340
1317
|
function isAssignmentStatement(statement) {
|
|
1341
|
-
return
|
|
1318
|
+
return ts4.isExpressionStatement(statement) && isAssignment2(statement.expression) && ts4.isIdentifier(statement.expression.left);
|
|
1342
1319
|
}
|
|
1343
1320
|
function getIifeBody(expression) {
|
|
1344
1321
|
const call = stripParentheses(expression);
|
|
1345
|
-
if (!
|
|
1322
|
+
if (!ts4.isCallExpression(call)) {
|
|
1346
1323
|
return void 0;
|
|
1347
1324
|
}
|
|
1348
1325
|
const fn = stripParentheses(call.expression);
|
|
1349
|
-
if (!
|
|
1326
|
+
if (!ts4.isFunctionExpression(fn) && !ts4.isArrowFunction(fn)) {
|
|
1350
1327
|
return void 0;
|
|
1351
1328
|
}
|
|
1352
1329
|
return fn.body;
|
|
1353
1330
|
}
|
|
1354
1331
|
function isAssignment2(node) {
|
|
1355
|
-
return
|
|
1332
|
+
return ts4.isBinaryExpression(node) && node.operatorToken.kind === ts4.SyntaxKind.EqualsToken;
|
|
1356
1333
|
}
|
|
1357
1334
|
function isClassDecorateCall(call, matches) {
|
|
1358
1335
|
const helperArgs = call.arguments[0];
|
|
1359
|
-
if (helperArgs === void 0 || !
|
|
1336
|
+
if (helperArgs === void 0 || !ts4.isArrayLiteralExpression(helperArgs)) {
|
|
1360
1337
|
return false;
|
|
1361
1338
|
}
|
|
1362
1339
|
const target = call.arguments[1];
|
|
1363
|
-
return target !== void 0 &&
|
|
1340
|
+
return target !== void 0 && ts4.isIdentifier(target) && matches(target);
|
|
1364
1341
|
}
|
|
1365
1342
|
function isMemberDecorateCall(call, matches) {
|
|
1366
1343
|
const helperArgs = call.arguments[0];
|
|
1367
|
-
if (helperArgs === void 0 || !
|
|
1344
|
+
if (helperArgs === void 0 || !ts4.isArrayLiteralExpression(helperArgs)) {
|
|
1368
1345
|
return false;
|
|
1369
1346
|
}
|
|
1370
1347
|
const target = call.arguments[1];
|
|
1371
|
-
if (target === void 0 || !
|
|
1348
|
+
if (target === void 0 || !ts4.isPropertyAccessExpression(target) || !ts4.isIdentifier(target.expression) || !matches(target.expression) || target.name.text !== "prototype") {
|
|
1372
1349
|
return false;
|
|
1373
1350
|
}
|
|
1374
1351
|
const memberName = call.arguments[2];
|
|
1375
|
-
return memberName !== void 0 &&
|
|
1352
|
+
return memberName !== void 0 && ts4.isStringLiteral(memberName);
|
|
1376
1353
|
}
|
|
1377
1354
|
function getPropertyValueFromSymbol(propSymbol) {
|
|
1378
1355
|
const propIdentifier = propSymbol.valueDeclaration;
|
|
1379
1356
|
const parent = propIdentifier && propIdentifier.parent;
|
|
1380
|
-
return parent &&
|
|
1357
|
+
return parent && ts4.isBinaryExpression(parent) ? parent.right : void 0;
|
|
1381
1358
|
}
|
|
1382
1359
|
function getCalleeName(call) {
|
|
1383
|
-
if (
|
|
1360
|
+
if (ts4.isIdentifier(call.expression)) {
|
|
1384
1361
|
return stripDollarSuffix(call.expression.text);
|
|
1385
1362
|
}
|
|
1386
|
-
if (
|
|
1363
|
+
if (ts4.isPropertyAccessExpression(call.expression)) {
|
|
1387
1364
|
return stripDollarSuffix(call.expression.name.text);
|
|
1388
1365
|
}
|
|
1389
1366
|
return null;
|
|
@@ -1399,25 +1376,25 @@ function skipClassAliases(node) {
|
|
|
1399
1376
|
return expression;
|
|
1400
1377
|
}
|
|
1401
1378
|
function getInnerClassDeclaration(expression) {
|
|
1402
|
-
if (
|
|
1379
|
+
if (ts4.isClassExpression(expression) && hasNameIdentifier(expression)) {
|
|
1403
1380
|
return expression;
|
|
1404
1381
|
}
|
|
1405
1382
|
const iifeBody = getIifeBody(expression);
|
|
1406
1383
|
if (iifeBody === void 0) {
|
|
1407
1384
|
return null;
|
|
1408
1385
|
}
|
|
1409
|
-
if (!
|
|
1410
|
-
return
|
|
1386
|
+
if (!ts4.isBlock(iifeBody)) {
|
|
1387
|
+
return ts4.isClassExpression(iifeBody) && isNamedDeclaration(iifeBody) ? iifeBody : null;
|
|
1411
1388
|
} else {
|
|
1412
1389
|
for (const statement of iifeBody.statements) {
|
|
1413
1390
|
if (isNamedClassDeclaration(statement) || isNamedFunctionDeclaration(statement)) {
|
|
1414
1391
|
return statement;
|
|
1415
1392
|
}
|
|
1416
|
-
if (
|
|
1393
|
+
if (ts4.isVariableStatement(statement)) {
|
|
1417
1394
|
for (const declaration of statement.declarationList.declarations) {
|
|
1418
1395
|
if (isInitializedVariableClassDeclaration(declaration)) {
|
|
1419
1396
|
const expression2 = skipClassAliases(declaration);
|
|
1420
|
-
if (
|
|
1397
|
+
if (ts4.isClassExpression(expression2) && hasNameIdentifier(expression2)) {
|
|
1421
1398
|
return expression2;
|
|
1422
1399
|
}
|
|
1423
1400
|
}
|
|
@@ -1428,29 +1405,29 @@ function getInnerClassDeclaration(expression) {
|
|
|
1428
1405
|
return null;
|
|
1429
1406
|
}
|
|
1430
1407
|
function getDecoratorArgs(node) {
|
|
1431
|
-
const argsProperty = node.properties.filter(
|
|
1408
|
+
const argsProperty = node.properties.filter(ts4.isPropertyAssignment).find((property2) => getNameText(property2.name) === "args");
|
|
1432
1409
|
const argsExpression = argsProperty && argsProperty.initializer;
|
|
1433
|
-
return argsExpression &&
|
|
1410
|
+
return argsExpression && ts4.isArrayLiteralExpression(argsExpression) ? Array.from(argsExpression.elements) : [];
|
|
1434
1411
|
}
|
|
1435
1412
|
function isPropertyAccess(node) {
|
|
1436
|
-
return !!node.parent &&
|
|
1413
|
+
return !!node.parent && ts4.isBinaryExpression(node.parent) && ts4.isPropertyAccessExpression(node);
|
|
1437
1414
|
}
|
|
1438
1415
|
function isThisAssignment(node) {
|
|
1439
|
-
return
|
|
1416
|
+
return ts4.isBinaryExpression(node) && ts4.isPropertyAccessExpression(node.left) && node.left.expression.kind === ts4.SyntaxKind.ThisKeyword;
|
|
1440
1417
|
}
|
|
1441
1418
|
function isNamedDeclaration(node) {
|
|
1442
1419
|
const anyNode = node;
|
|
1443
|
-
return !!anyNode.name &&
|
|
1420
|
+
return !!anyNode.name && ts4.isIdentifier(anyNode.name);
|
|
1444
1421
|
}
|
|
1445
1422
|
function isClassMemberType(node) {
|
|
1446
|
-
return (
|
|
1423
|
+
return (ts4.isClassElement(node) || isPropertyAccess(node) || ts4.isBinaryExpression(node)) && !ts4.isIndexSignatureDeclaration(node);
|
|
1447
1424
|
}
|
|
1448
1425
|
function getFarLeftHandSideOfAssignment(declaration) {
|
|
1449
1426
|
let node = declaration.parent;
|
|
1450
|
-
if (isAssignment2(node) &&
|
|
1427
|
+
if (isAssignment2(node) && ts4.isIdentifier(node.left)) {
|
|
1451
1428
|
node = node.parent;
|
|
1452
1429
|
}
|
|
1453
|
-
return
|
|
1430
|
+
return ts4.isVariableDeclaration(node) ? node : void 0;
|
|
1454
1431
|
}
|
|
1455
1432
|
function getContainingVariableDeclaration(node) {
|
|
1456
1433
|
node = node.parent;
|
|
@@ -1466,23 +1443,23 @@ function isSynthesizedConstructor(constructor) {
|
|
|
1466
1443
|
if (!constructor.body)
|
|
1467
1444
|
return false;
|
|
1468
1445
|
const firstStatement = constructor.body.statements[0];
|
|
1469
|
-
if (!firstStatement || !
|
|
1446
|
+
if (!firstStatement || !ts4.isExpressionStatement(firstStatement))
|
|
1470
1447
|
return false;
|
|
1471
1448
|
return isSynthesizedSuperCall(firstStatement.expression);
|
|
1472
1449
|
}
|
|
1473
1450
|
function isSynthesizedSuperCall(expression) {
|
|
1474
|
-
if (!
|
|
1451
|
+
if (!ts4.isCallExpression(expression))
|
|
1475
1452
|
return false;
|
|
1476
|
-
if (expression.expression.kind !==
|
|
1453
|
+
if (expression.expression.kind !== ts4.SyntaxKind.SuperKeyword)
|
|
1477
1454
|
return false;
|
|
1478
1455
|
if (expression.arguments.length !== 1)
|
|
1479
1456
|
return false;
|
|
1480
1457
|
const argument = expression.arguments[0];
|
|
1481
|
-
return
|
|
1458
|
+
return ts4.isSpreadElement(argument) && ts4.isIdentifier(argument.expression) && argument.expression.text === "arguments";
|
|
1482
1459
|
}
|
|
1483
1460
|
function getContainingStatement(node) {
|
|
1484
1461
|
while (node.parent) {
|
|
1485
|
-
if (
|
|
1462
|
+
if (ts4.isBlock(node.parent) || ts4.isSourceFile(node.parent)) {
|
|
1486
1463
|
break;
|
|
1487
1464
|
}
|
|
1488
1465
|
node = node.parent;
|
|
@@ -1502,30 +1479,30 @@ function getNonRootPackageFiles(bundle) {
|
|
|
1502
1479
|
}
|
|
1503
1480
|
function isTopLevel(node) {
|
|
1504
1481
|
while (node = node.parent) {
|
|
1505
|
-
if (
|
|
1482
|
+
if (ts4.isBlock(node)) {
|
|
1506
1483
|
return false;
|
|
1507
1484
|
}
|
|
1508
1485
|
}
|
|
1509
1486
|
return true;
|
|
1510
1487
|
}
|
|
1511
1488
|
function getOuterNodeFromInnerDeclaration(node) {
|
|
1512
|
-
if (!
|
|
1489
|
+
if (!ts4.isFunctionDeclaration(node) && !ts4.isClassDeclaration(node) && !ts4.isVariableStatement(node)) {
|
|
1513
1490
|
return null;
|
|
1514
1491
|
}
|
|
1515
1492
|
let outerNode = node.parent;
|
|
1516
|
-
if (!outerNode || !
|
|
1493
|
+
if (!outerNode || !ts4.isBlock(outerNode))
|
|
1517
1494
|
return null;
|
|
1518
1495
|
outerNode = outerNode.parent;
|
|
1519
|
-
if (!outerNode || !
|
|
1496
|
+
if (!outerNode || !ts4.isFunctionExpression(outerNode) && !ts4.isArrowFunction(outerNode)) {
|
|
1520
1497
|
return null;
|
|
1521
1498
|
}
|
|
1522
1499
|
outerNode = outerNode.parent;
|
|
1523
|
-
if (outerNode &&
|
|
1500
|
+
if (outerNode && ts4.isParenthesizedExpression(outerNode))
|
|
1524
1501
|
outerNode = outerNode.parent;
|
|
1525
|
-
if (!outerNode || !
|
|
1502
|
+
if (!outerNode || !ts4.isCallExpression(outerNode))
|
|
1526
1503
|
return null;
|
|
1527
1504
|
outerNode = outerNode.parent;
|
|
1528
|
-
if (outerNode &&
|
|
1505
|
+
if (outerNode && ts4.isParenthesizedExpression(outerNode))
|
|
1529
1506
|
outerNode = outerNode.parent;
|
|
1530
1507
|
while (isAssignment2(outerNode.parent)) {
|
|
1531
1508
|
outerNode = outerNode.parent;
|
|
@@ -1534,7 +1511,7 @@ function getOuterNodeFromInnerDeclaration(node) {
|
|
|
1534
1511
|
}
|
|
1535
1512
|
|
|
1536
1513
|
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/ngcc/src/host/esm5_host.mjs
|
|
1537
|
-
import
|
|
1514
|
+
import ts5 from "typescript";
|
|
1538
1515
|
var Esm5ReflectionHost = class extends Esm2015ReflectionHost {
|
|
1539
1516
|
getBaseClassExpression(clazz) {
|
|
1540
1517
|
const superBaseClassExpression = super.getBaseClassExpression(clazz);
|
|
@@ -1547,7 +1524,7 @@ var Esm5ReflectionHost = class extends Esm2015ReflectionHost {
|
|
|
1547
1524
|
if (iife.parameters.length !== 1 || !isSuperIdentifier(iife.parameters[0].name)) {
|
|
1548
1525
|
return null;
|
|
1549
1526
|
}
|
|
1550
|
-
if (!
|
|
1527
|
+
if (!ts5.isCallExpression(iife.parent)) {
|
|
1551
1528
|
return null;
|
|
1552
1529
|
}
|
|
1553
1530
|
return iife.parent.arguments[0];
|
|
@@ -1568,14 +1545,14 @@ var Esm5ReflectionHost = class extends Esm2015ReflectionHost {
|
|
|
1568
1545
|
if (declaration === null || declaration.node === null || declaration.known !== null) {
|
|
1569
1546
|
return declaration;
|
|
1570
1547
|
}
|
|
1571
|
-
if (!
|
|
1548
|
+
if (!ts5.isVariableDeclaration(declaration.node) || declaration.node.initializer !== void 0 || !ts5.isBlock(declaration.node.parent.parent.parent)) {
|
|
1572
1549
|
return declaration;
|
|
1573
1550
|
}
|
|
1574
1551
|
const block = declaration.node.parent.parent.parent;
|
|
1575
1552
|
const aliasSymbol = this.checker.getSymbolAtLocation(declaration.node.name);
|
|
1576
1553
|
for (let i = 0; i < block.statements.length; i++) {
|
|
1577
1554
|
const statement = block.statements[i];
|
|
1578
|
-
if (isAssignmentStatement(statement) &&
|
|
1555
|
+
if (isAssignmentStatement(statement) && ts5.isIdentifier(statement.expression.left) && ts5.isIdentifier(statement.expression.right) && this.checker.getSymbolAtLocation(statement.expression.left) === aliasSymbol) {
|
|
1579
1556
|
return this.getDeclarationOfIdentifier(statement.expression.right);
|
|
1580
1557
|
}
|
|
1581
1558
|
}
|
|
@@ -1619,7 +1596,7 @@ var Esm5ReflectionHost = class extends Esm2015ReflectionHost {
|
|
|
1619
1596
|
}
|
|
1620
1597
|
getConstructorParameterDeclarations(classSymbol) {
|
|
1621
1598
|
const constructor = classSymbol.implementation.valueDeclaration;
|
|
1622
|
-
if (!
|
|
1599
|
+
if (!ts5.isFunctionDeclaration(constructor))
|
|
1623
1600
|
return null;
|
|
1624
1601
|
if (constructor.parameters.length > 0) {
|
|
1625
1602
|
return Array.from(constructor.parameters);
|
|
@@ -1633,7 +1610,7 @@ var Esm5ReflectionHost = class extends Esm2015ReflectionHost {
|
|
|
1633
1610
|
const paramDecorators = getPropertyValueFromSymbol(paramDecoratorsProperty);
|
|
1634
1611
|
const returnStatement = getReturnStatement(paramDecorators);
|
|
1635
1612
|
const expression = returnStatement ? returnStatement.expression : paramDecorators;
|
|
1636
|
-
if (expression &&
|
|
1613
|
+
if (expression && ts5.isArrayLiteralExpression(expression)) {
|
|
1637
1614
|
const elements = expression.elements;
|
|
1638
1615
|
return elements.map(reflectArrayElement).map((paramInfo) => {
|
|
1639
1616
|
const typeExpression = paramInfo && paramInfo.has("type") ? paramInfo.get("type") : null;
|
|
@@ -1682,7 +1659,7 @@ var Esm5ReflectionHost = class extends Esm2015ReflectionHost {
|
|
|
1682
1659
|
}
|
|
1683
1660
|
const members = super.reflectMembers(symbol, decorators, isStatic);
|
|
1684
1661
|
members && members.forEach((member) => {
|
|
1685
|
-
if (member && member.kind === ClassMemberKind.Method && member.isStatic && member.node &&
|
|
1662
|
+
if (member && member.kind === ClassMemberKind.Method && member.isStatic && member.node && ts5.isPropertyAccessExpression(member.node) && member.node.parent && ts5.isBinaryExpression(member.node.parent) && ts5.isFunctionExpression(member.node.parent.right)) {
|
|
1686
1663
|
member.implementation = member.node.parent.right;
|
|
1687
1664
|
}
|
|
1688
1665
|
});
|
|
@@ -1690,7 +1667,7 @@ var Esm5ReflectionHost = class extends Esm2015ReflectionHost {
|
|
|
1690
1667
|
}
|
|
1691
1668
|
getStatementsForClass(classSymbol) {
|
|
1692
1669
|
const classDeclarationParent = classSymbol.implementation.valueDeclaration.parent;
|
|
1693
|
-
return
|
|
1670
|
+
return ts5.isBlock(classDeclarationParent) ? Array.from(classDeclarationParent.statements) : [];
|
|
1694
1671
|
}
|
|
1695
1672
|
isSynthesizedConstructor(constructor) {
|
|
1696
1673
|
if (!constructor.body)
|
|
@@ -1701,13 +1678,13 @@ var Esm5ReflectionHost = class extends Esm2015ReflectionHost {
|
|
|
1701
1678
|
return this.isSynthesizedSuperThisAssignment(firstStatement) || this.isSynthesizedSuperReturnStatement(firstStatement);
|
|
1702
1679
|
}
|
|
1703
1680
|
isSynthesizedSuperThisAssignment(statement) {
|
|
1704
|
-
if (!
|
|
1681
|
+
if (!ts5.isVariableStatement(statement))
|
|
1705
1682
|
return false;
|
|
1706
1683
|
const variableDeclarations = statement.declarationList.declarations;
|
|
1707
1684
|
if (variableDeclarations.length !== 1)
|
|
1708
1685
|
return false;
|
|
1709
1686
|
const variableDeclaration = variableDeclarations[0];
|
|
1710
|
-
if (!
|
|
1687
|
+
if (!ts5.isIdentifier(variableDeclaration.name) || !variableDeclaration.name.text.startsWith("_this"))
|
|
1711
1688
|
return false;
|
|
1712
1689
|
const initializer = variableDeclaration.initializer;
|
|
1713
1690
|
if (!initializer)
|
|
@@ -1715,7 +1692,7 @@ var Esm5ReflectionHost = class extends Esm2015ReflectionHost {
|
|
|
1715
1692
|
return this.isSynthesizedDefaultSuperCall(initializer);
|
|
1716
1693
|
}
|
|
1717
1694
|
isSynthesizedSuperReturnStatement(statement) {
|
|
1718
|
-
if (!
|
|
1695
|
+
if (!ts5.isReturnStatement(statement))
|
|
1719
1696
|
return false;
|
|
1720
1697
|
const expression = statement.expression;
|
|
1721
1698
|
if (!expression)
|
|
@@ -1723,29 +1700,29 @@ var Esm5ReflectionHost = class extends Esm2015ReflectionHost {
|
|
|
1723
1700
|
return this.isSynthesizedDefaultSuperCall(expression);
|
|
1724
1701
|
}
|
|
1725
1702
|
isSynthesizedDefaultSuperCall(expression) {
|
|
1726
|
-
if (!isBinaryExpr(expression,
|
|
1703
|
+
if (!isBinaryExpr(expression, ts5.SyntaxKind.BarBarToken))
|
|
1727
1704
|
return false;
|
|
1728
|
-
if (expression.right.kind !==
|
|
1705
|
+
if (expression.right.kind !== ts5.SyntaxKind.ThisKeyword)
|
|
1729
1706
|
return false;
|
|
1730
1707
|
const left = expression.left;
|
|
1731
|
-
if (isBinaryExpr(left,
|
|
1708
|
+
if (isBinaryExpr(left, ts5.SyntaxKind.AmpersandAmpersandToken)) {
|
|
1732
1709
|
return isSuperNotNull(left.left) && this.isSuperApplyCall(left.right);
|
|
1733
1710
|
} else {
|
|
1734
1711
|
return this.isSuperApplyCall(left);
|
|
1735
1712
|
}
|
|
1736
1713
|
}
|
|
1737
1714
|
isSuperApplyCall(expression) {
|
|
1738
|
-
if (!
|
|
1715
|
+
if (!ts5.isCallExpression(expression) || expression.arguments.length !== 2)
|
|
1739
1716
|
return false;
|
|
1740
1717
|
const targetFn = expression.expression;
|
|
1741
|
-
if (!
|
|
1718
|
+
if (!ts5.isPropertyAccessExpression(targetFn))
|
|
1742
1719
|
return false;
|
|
1743
1720
|
if (!isSuperIdentifier(targetFn.expression))
|
|
1744
1721
|
return false;
|
|
1745
1722
|
if (targetFn.name.text !== "apply")
|
|
1746
1723
|
return false;
|
|
1747
1724
|
const thisArgument = expression.arguments[0];
|
|
1748
|
-
if (thisArgument.kind !==
|
|
1725
|
+
if (thisArgument.kind !== ts5.SyntaxKind.ThisKeyword)
|
|
1749
1726
|
return false;
|
|
1750
1727
|
const argumentsExpr = expression.arguments[1];
|
|
1751
1728
|
if (isArgumentsIdentifier(argumentsExpr)) {
|
|
@@ -1765,7 +1742,7 @@ var Esm5ReflectionHost = class extends Esm2015ReflectionHost {
|
|
|
1765
1742
|
return false;
|
|
1766
1743
|
}
|
|
1767
1744
|
const firstArg = call.args[0];
|
|
1768
|
-
if (!
|
|
1745
|
+
if (!ts5.isArrayLiteralExpression(firstArg) || firstArg.elements.length !== 0) {
|
|
1769
1746
|
return false;
|
|
1770
1747
|
}
|
|
1771
1748
|
const secondArg = this.extractKnownHelperCall(call.args[1]);
|
|
@@ -1778,14 +1755,14 @@ var Esm5ReflectionHost = class extends Esm2015ReflectionHost {
|
|
|
1778
1755
|
}
|
|
1779
1756
|
}
|
|
1780
1757
|
extractKnownHelperCall(expression) {
|
|
1781
|
-
if (!
|
|
1758
|
+
if (!ts5.isCallExpression(expression)) {
|
|
1782
1759
|
return null;
|
|
1783
1760
|
}
|
|
1784
1761
|
const receiverExpr = expression.expression;
|
|
1785
1762
|
let receiver = null;
|
|
1786
|
-
if (
|
|
1763
|
+
if (ts5.isIdentifier(receiverExpr)) {
|
|
1787
1764
|
receiver = this.getDeclarationOfIdentifier(receiverExpr);
|
|
1788
|
-
} else if (
|
|
1765
|
+
} else if (ts5.isPropertyAccessExpression(receiverExpr) && ts5.isIdentifier(receiverExpr.name)) {
|
|
1789
1766
|
receiver = this.getDeclarationOfIdentifier(receiverExpr.name);
|
|
1790
1767
|
}
|
|
1791
1768
|
if (receiver === null || receiver.known === null) {
|
|
@@ -1798,13 +1775,13 @@ var Esm5ReflectionHost = class extends Esm2015ReflectionHost {
|
|
|
1798
1775
|
}
|
|
1799
1776
|
};
|
|
1800
1777
|
function getPropertyDefinition(node) {
|
|
1801
|
-
if (!
|
|
1778
|
+
if (!ts5.isCallExpression(node))
|
|
1802
1779
|
return null;
|
|
1803
1780
|
const fn = node.expression;
|
|
1804
|
-
if (!
|
|
1781
|
+
if (!ts5.isPropertyAccessExpression(fn) || !ts5.isIdentifier(fn.expression) || fn.expression.text !== "Object" || fn.name.text !== "defineProperty")
|
|
1805
1782
|
return null;
|
|
1806
1783
|
const descriptor = node.arguments[2];
|
|
1807
|
-
if (!descriptor || !
|
|
1784
|
+
if (!descriptor || !ts5.isObjectLiteralExpression(descriptor))
|
|
1808
1785
|
return null;
|
|
1809
1786
|
return {
|
|
1810
1787
|
setter: readPropertyFunctionExpression(descriptor, "set"),
|
|
@@ -1812,29 +1789,29 @@ function getPropertyDefinition(node) {
|
|
|
1812
1789
|
};
|
|
1813
1790
|
}
|
|
1814
1791
|
function readPropertyFunctionExpression(object, name) {
|
|
1815
|
-
const property2 = object.properties.find((p) =>
|
|
1816
|
-
return property2 &&
|
|
1792
|
+
const property2 = object.properties.find((p) => ts5.isPropertyAssignment(p) && ts5.isIdentifier(p.name) && p.name.text === name);
|
|
1793
|
+
return property2 && ts5.isFunctionExpression(property2.initializer) && property2.initializer || null;
|
|
1817
1794
|
}
|
|
1818
1795
|
function getReturnStatement(declaration) {
|
|
1819
|
-
return declaration &&
|
|
1796
|
+
return declaration && ts5.isFunctionExpression(declaration) ? declaration.body.statements.find(ts5.isReturnStatement) : void 0;
|
|
1820
1797
|
}
|
|
1821
1798
|
function reflectArrayElement(element) {
|
|
1822
|
-
return
|
|
1799
|
+
return ts5.isObjectLiteralExpression(element) ? reflectObjectLiteral(element) : null;
|
|
1823
1800
|
}
|
|
1824
1801
|
function isArgumentsIdentifier(expression) {
|
|
1825
|
-
return
|
|
1802
|
+
return ts5.isIdentifier(expression) && expression.text === "arguments";
|
|
1826
1803
|
}
|
|
1827
1804
|
function isSuperNotNull(expression) {
|
|
1828
|
-
return isBinaryExpr(expression,
|
|
1805
|
+
return isBinaryExpr(expression, ts5.SyntaxKind.ExclamationEqualsEqualsToken) && isSuperIdentifier(expression.left);
|
|
1829
1806
|
}
|
|
1830
1807
|
function isBinaryExpr(expression, operator) {
|
|
1831
|
-
return
|
|
1808
|
+
return ts5.isBinaryExpression(expression) && expression.operatorToken.kind === operator;
|
|
1832
1809
|
}
|
|
1833
1810
|
function isSuperIdentifier(node) {
|
|
1834
|
-
return
|
|
1811
|
+
return ts5.isIdentifier(node) && node.text.startsWith("_super");
|
|
1835
1812
|
}
|
|
1836
1813
|
function captureParamInitializer(statement, parameters) {
|
|
1837
|
-
if (
|
|
1814
|
+
if (ts5.isIfStatement(statement) && isUndefinedComparison(statement.expression) && ts5.isBlock(statement.thenStatement) && statement.thenStatement.statements.length === 1) {
|
|
1838
1815
|
const ifStatementComparison = statement.expression;
|
|
1839
1816
|
const thenStatement = statement.thenStatement.statements[0];
|
|
1840
1817
|
if (isAssignmentStatement(thenStatement)) {
|
|
@@ -1852,7 +1829,7 @@ function captureParamInitializer(statement, parameters) {
|
|
|
1852
1829
|
return false;
|
|
1853
1830
|
}
|
|
1854
1831
|
function isUndefinedComparison(expression) {
|
|
1855
|
-
return
|
|
1832
|
+
return ts5.isBinaryExpression(expression) && expression.operatorToken.kind === ts5.SyntaxKind.EqualsEqualsEqualsToken && ts5.isVoidExpression(expression.right) && ts5.isIdentifier(expression.left);
|
|
1856
1833
|
}
|
|
1857
1834
|
function getIifeFn(classSymbol) {
|
|
1858
1835
|
if (classSymbol === void 0) {
|
|
@@ -1860,11 +1837,11 @@ function getIifeFn(classSymbol) {
|
|
|
1860
1837
|
}
|
|
1861
1838
|
const innerDeclaration = classSymbol.implementation.valueDeclaration;
|
|
1862
1839
|
const iifeBody = innerDeclaration.parent;
|
|
1863
|
-
if (!
|
|
1840
|
+
if (!ts5.isBlock(iifeBody)) {
|
|
1864
1841
|
return null;
|
|
1865
1842
|
}
|
|
1866
1843
|
const iifeWrapper = iifeBody.parent;
|
|
1867
|
-
return iifeWrapper &&
|
|
1844
|
+
return iifeWrapper && ts5.isFunctionExpression(iifeWrapper) ? iifeWrapper : null;
|
|
1868
1845
|
}
|
|
1869
1846
|
|
|
1870
1847
|
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/ngcc/src/host/umd_host.mjs
|
|
@@ -1932,7 +1909,7 @@ var UmdReflectionHost = class extends Esm5ReflectionHost {
|
|
|
1932
1909
|
return void 0;
|
|
1933
1910
|
}
|
|
1934
1911
|
let initializer = skipAliases(declaration.parent.right);
|
|
1935
|
-
if (
|
|
1912
|
+
if (ts6.isIdentifier(initializer)) {
|
|
1936
1913
|
const implementation = this.getDeclarationOfIdentifier(initializer);
|
|
1937
1914
|
if (implementation !== null) {
|
|
1938
1915
|
const implementationSymbol = this.getClassSymbol(implementation.node);
|
|
@@ -1977,7 +1954,7 @@ var UmdReflectionHost = class extends Esm5ReflectionHost {
|
|
|
1977
1954
|
}
|
|
1978
1955
|
const declaration = statement.expression.left;
|
|
1979
1956
|
const initializer = statement.expression.right;
|
|
1980
|
-
if (!isAssignment2(initializer) || !
|
|
1957
|
+
if (!isAssignment2(initializer) || !ts6.isIdentifier(initializer.left) || !this.isClass(declaration)) {
|
|
1981
1958
|
return;
|
|
1982
1959
|
}
|
|
1983
1960
|
const aliasedIdentifier = initializer.left;
|
|
@@ -2048,11 +2025,11 @@ var UmdReflectionHost = class extends Esm5ReflectionHost {
|
|
|
2048
2025
|
}
|
|
2049
2026
|
extractUmdWildcardReexports(statement, containingFile) {
|
|
2050
2027
|
const reexportArg = statement.expression.arguments[0];
|
|
2051
|
-
const requireCall = isRequireCall(reexportArg) ? reexportArg :
|
|
2028
|
+
const requireCall = isRequireCall(reexportArg) ? reexportArg : ts6.isIdentifier(reexportArg) ? findRequireCallReference(reexportArg, this.checker) : null;
|
|
2052
2029
|
let importPath = null;
|
|
2053
2030
|
if (requireCall !== null) {
|
|
2054
2031
|
importPath = requireCall.arguments[0].text;
|
|
2055
|
-
} else if (
|
|
2032
|
+
} else if (ts6.isIdentifier(reexportArg)) {
|
|
2056
2033
|
const importParameter = this.findUmdImportParameter(reexportArg);
|
|
2057
2034
|
importPath = importParameter && this.getUmdImportPath(importParameter);
|
|
2058
2035
|
}
|
|
@@ -2097,7 +2074,7 @@ var UmdReflectionHost = class extends Esm5ReflectionHost {
|
|
|
2097
2074
|
findUmdImportParameter(id) {
|
|
2098
2075
|
const symbol = id && this.checker.getSymbolAtLocation(id) || null;
|
|
2099
2076
|
const declaration = symbol && symbol.valueDeclaration;
|
|
2100
|
-
return declaration &&
|
|
2077
|
+
return declaration && ts6.isParameter(declaration) ? declaration : null;
|
|
2101
2078
|
}
|
|
2102
2079
|
getUmdDeclaration(id) {
|
|
2103
2080
|
const nsIdentifier = findNamespaceOfIdentifier(id);
|
|
@@ -2106,7 +2083,7 @@ var UmdReflectionHost = class extends Esm5ReflectionHost {
|
|
|
2106
2083
|
}
|
|
2107
2084
|
if (nsIdentifier.parent.parent && isExportsAssignment(nsIdentifier.parent.parent)) {
|
|
2108
2085
|
const initializer = nsIdentifier.parent.parent.right;
|
|
2109
|
-
if (
|
|
2086
|
+
if (ts6.isIdentifier(initializer)) {
|
|
2110
2087
|
return this.getDeclarationOfIdentifier(initializer);
|
|
2111
2088
|
}
|
|
2112
2089
|
return this.detectKnownDeclaration({
|
|
@@ -2118,7 +2095,7 @@ var UmdReflectionHost = class extends Esm5ReflectionHost {
|
|
|
2118
2095
|
});
|
|
2119
2096
|
}
|
|
2120
2097
|
const moduleDeclaration = this.getUmdModuleDeclaration(nsIdentifier);
|
|
2121
|
-
if (moduleDeclaration === null || moduleDeclaration.node === null || !
|
|
2098
|
+
if (moduleDeclaration === null || moduleDeclaration.node === null || !ts6.isSourceFile(moduleDeclaration.node)) {
|
|
2122
2099
|
return null;
|
|
2123
2100
|
}
|
|
2124
2101
|
const moduleExports = this.getExportsOfModule(moduleDeclaration.node);
|
|
@@ -2136,8 +2113,8 @@ var UmdReflectionHost = class extends Esm5ReflectionHost {
|
|
|
2136
2113
|
if (!isExportsIdentifier(id)) {
|
|
2137
2114
|
return null;
|
|
2138
2115
|
}
|
|
2139
|
-
const exportsSymbol = this.checker.getSymbolsInScope(id,
|
|
2140
|
-
const node = (exportsSymbol == null ? void 0 : exportsSymbol.valueDeclaration) !== void 0 && !
|
|
2116
|
+
const exportsSymbol = this.checker.getSymbolsInScope(id, ts6.SymbolFlags.Variable).find((symbol) => symbol.name === "exports");
|
|
2117
|
+
const node = (exportsSymbol == null ? void 0 : exportsSymbol.valueDeclaration) !== void 0 && !ts6.isFunctionExpression(exportsSymbol.valueDeclaration.parent) ? exportsSymbol.valueDeclaration : id.getSourceFile();
|
|
2141
2118
|
return {
|
|
2142
2119
|
kind: 0,
|
|
2143
2120
|
node,
|
|
@@ -2193,7 +2170,7 @@ var UmdReflectionHost = class extends Esm5ReflectionHost {
|
|
|
2193
2170
|
const moduleInfo = this.compilerHost.resolveModuleNames([moduleName], containingFile.fileName, void 0, void 0, this.program.getCompilerOptions())[0];
|
|
2194
2171
|
return moduleInfo && this.program.getSourceFile(absoluteFrom(moduleInfo.resolvedFileName));
|
|
2195
2172
|
} else {
|
|
2196
|
-
const moduleInfo =
|
|
2173
|
+
const moduleInfo = ts6.resolveModuleName(moduleName, containingFile.fileName, this.program.getCompilerOptions(), this.compilerHost);
|
|
2197
2174
|
return moduleInfo.resolvedModule && this.program.getSourceFile(absoluteFrom(moduleInfo.resolvedModule.resolvedFileName));
|
|
2198
2175
|
}
|
|
2199
2176
|
}
|
|
@@ -2202,60 +2179,169 @@ function parseStatementForUmdModule(statement) {
|
|
|
2202
2179
|
const wrapper = getUmdWrapper(statement);
|
|
2203
2180
|
if (wrapper === null)
|
|
2204
2181
|
return null;
|
|
2205
|
-
const factoryFnParamIndex = wrapper.fn.parameters.findIndex((parameter) =>
|
|
2182
|
+
const factoryFnParamIndex = wrapper.fn.parameters.findIndex((parameter) => ts6.isIdentifier(parameter.name) && parameter.name.text === "factory");
|
|
2206
2183
|
if (factoryFnParamIndex === -1)
|
|
2207
2184
|
return null;
|
|
2208
2185
|
const factoryFn = stripParentheses(wrapper.call.arguments[factoryFnParamIndex]);
|
|
2209
|
-
if (!factoryFn || !
|
|
2186
|
+
if (!factoryFn || !ts6.isFunctionExpression(factoryFn))
|
|
2210
2187
|
return null;
|
|
2211
|
-
|
|
2188
|
+
let factoryCalls = null;
|
|
2189
|
+
return {
|
|
2190
|
+
wrapperFn: wrapper.fn,
|
|
2191
|
+
factoryFn,
|
|
2192
|
+
get factoryCalls() {
|
|
2193
|
+
if (factoryCalls === null) {
|
|
2194
|
+
factoryCalls = parseUmdWrapperFunction(this.wrapperFn);
|
|
2195
|
+
}
|
|
2196
|
+
return factoryCalls;
|
|
2197
|
+
}
|
|
2198
|
+
};
|
|
2212
2199
|
}
|
|
2213
2200
|
function getUmdWrapper(statement) {
|
|
2214
|
-
if (!
|
|
2201
|
+
if (!ts6.isExpressionStatement(statement))
|
|
2215
2202
|
return null;
|
|
2216
|
-
if (
|
|
2203
|
+
if (ts6.isParenthesizedExpression(statement.expression) && ts6.isCallExpression(statement.expression.expression) && ts6.isFunctionExpression(statement.expression.expression.expression)) {
|
|
2217
2204
|
const call = statement.expression.expression;
|
|
2218
2205
|
const fn = statement.expression.expression.expression;
|
|
2219
2206
|
return { call, fn };
|
|
2220
2207
|
}
|
|
2221
|
-
if (
|
|
2208
|
+
if (ts6.isCallExpression(statement.expression) && ts6.isParenthesizedExpression(statement.expression.expression) && ts6.isFunctionExpression(statement.expression.expression.expression)) {
|
|
2222
2209
|
const call = statement.expression;
|
|
2223
2210
|
const fn = statement.expression.expression.expression;
|
|
2224
2211
|
return { call, fn };
|
|
2225
2212
|
}
|
|
2226
2213
|
return null;
|
|
2227
2214
|
}
|
|
2228
|
-
function
|
|
2229
|
-
const
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2215
|
+
function parseUmdWrapperFunction(wrapperFn) {
|
|
2216
|
+
const stmt = wrapperFn.body.statements[0];
|
|
2217
|
+
let conditionalFactoryCalls;
|
|
2218
|
+
if (ts6.isExpressionStatement(stmt) && ts6.isConditionalExpression(stmt.expression)) {
|
|
2219
|
+
conditionalFactoryCalls = extractFactoryCallsFromConditionalExpression(stmt.expression);
|
|
2220
|
+
} else if (ts6.isIfStatement(stmt)) {
|
|
2221
|
+
conditionalFactoryCalls = extractFactoryCallsFromIfStatement(stmt);
|
|
2222
|
+
} else {
|
|
2223
|
+
throw new Error("UMD wrapper body is not in a supported format (expected a conditional expression or if statement):\n" + wrapperFn.body.getText());
|
|
2224
|
+
}
|
|
2225
|
+
const amdDefine = getAmdDefineCall(conditionalFactoryCalls);
|
|
2226
|
+
const commonJs = getCommonJsFactoryCall(conditionalFactoryCalls);
|
|
2227
|
+
const commonJs2 = getCommonJs2FactoryCall(conditionalFactoryCalls);
|
|
2228
|
+
const global = getGlobalFactoryCall(conditionalFactoryCalls);
|
|
2229
|
+
const cjsCallForImports = commonJs2 || commonJs;
|
|
2230
|
+
if (cjsCallForImports === null) {
|
|
2231
|
+
throw new Error("Unable to find a CommonJS or CommonJS2 factory call inside the UMD wrapper function:\n" + stmt.getText());
|
|
2232
|
+
}
|
|
2233
|
+
return { amdDefine, commonJs, commonJs2, global, cjsCallForImports };
|
|
2234
|
+
}
|
|
2235
|
+
function extractFactoryCallsFromConditionalExpression(node) {
|
|
2236
|
+
const factoryCalls = [];
|
|
2237
|
+
let currentNode = node;
|
|
2238
|
+
while (ts6.isConditionalExpression(currentNode)) {
|
|
2239
|
+
if (!ts6.isBinaryExpression(currentNode.condition)) {
|
|
2240
|
+
throw new Error("Condition inside UMD wrapper is not a binary expression:\n" + currentNode.condition.getText());
|
|
2241
|
+
}
|
|
2242
|
+
factoryCalls.push({
|
|
2243
|
+
condition: currentNode.condition,
|
|
2244
|
+
factoryCall: getFunctionCallFromExpression(currentNode.whenTrue)
|
|
2234
2245
|
});
|
|
2246
|
+
currentNode = currentNode.whenFalse;
|
|
2235
2247
|
}
|
|
2236
|
-
|
|
2248
|
+
factoryCalls.push({
|
|
2249
|
+
condition: null,
|
|
2250
|
+
factoryCall: getFunctionCallFromExpression(currentNode)
|
|
2251
|
+
});
|
|
2252
|
+
return factoryCalls;
|
|
2237
2253
|
}
|
|
2238
|
-
function
|
|
2239
|
-
const
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
+
function extractFactoryCallsFromIfStatement(node) {
|
|
2255
|
+
const factoryCalls = [];
|
|
2256
|
+
let currentNode = node;
|
|
2257
|
+
while (currentNode && ts6.isIfStatement(currentNode)) {
|
|
2258
|
+
if (!ts6.isBinaryExpression(currentNode.expression)) {
|
|
2259
|
+
throw new Error("Condition inside UMD wrapper is not a binary expression:\n" + currentNode.expression.getText());
|
|
2260
|
+
}
|
|
2261
|
+
if (!ts6.isExpressionStatement(currentNode.thenStatement)) {
|
|
2262
|
+
throw new Error("Then-statement inside UMD wrapper is not an expression statement:\n" + currentNode.thenStatement.getText());
|
|
2263
|
+
}
|
|
2264
|
+
factoryCalls.push({
|
|
2265
|
+
condition: currentNode.expression,
|
|
2266
|
+
factoryCall: getFunctionCallFromExpression(currentNode.thenStatement.expression)
|
|
2267
|
+
});
|
|
2268
|
+
currentNode = currentNode.elseStatement;
|
|
2269
|
+
}
|
|
2270
|
+
if (currentNode) {
|
|
2271
|
+
if (!ts6.isExpressionStatement(currentNode)) {
|
|
2272
|
+
throw new Error("Else-statement inside UMD wrapper is not an expression statement:\n" + currentNode.getText());
|
|
2273
|
+
}
|
|
2274
|
+
factoryCalls.push({
|
|
2275
|
+
condition: null,
|
|
2276
|
+
factoryCall: getFunctionCallFromExpression(currentNode.expression)
|
|
2277
|
+
});
|
|
2278
|
+
}
|
|
2279
|
+
return factoryCalls;
|
|
2280
|
+
}
|
|
2281
|
+
function getFunctionCallFromExpression(node) {
|
|
2282
|
+
if (ts6.isParenthesizedExpression(node)) {
|
|
2283
|
+
return getFunctionCallFromExpression(node.expression);
|
|
2284
|
+
}
|
|
2285
|
+
if (ts6.isBinaryExpression(node) && [ts6.SyntaxKind.CommaToken, ts6.SyntaxKind.EqualsToken].includes(node.operatorToken.kind)) {
|
|
2286
|
+
return getFunctionCallFromExpression(node.right);
|
|
2287
|
+
}
|
|
2288
|
+
if (!ts6.isCallExpression(node)) {
|
|
2289
|
+
throw new Error("Expression inside UMD wrapper is not a call expression:\n" + node.getText());
|
|
2290
|
+
}
|
|
2291
|
+
return node;
|
|
2292
|
+
}
|
|
2293
|
+
function getAmdDefineCall(calls) {
|
|
2294
|
+
var _a;
|
|
2295
|
+
const amdConditionalCall = calls.find((call) => {
|
|
2296
|
+
var _a2;
|
|
2297
|
+
return ((_a2 = call.condition) == null ? void 0 : _a2.operatorToken.kind) === ts6.SyntaxKind.AmpersandAmpersandToken && oneOfBinaryConditions(call.condition, (exp) => isTypeOf(exp, "define")) && ts6.isIdentifier(call.factoryCall.expression) && call.factoryCall.expression.text === "define";
|
|
2298
|
+
});
|
|
2299
|
+
return (_a = amdConditionalCall == null ? void 0 : amdConditionalCall.factoryCall) != null ? _a : null;
|
|
2300
|
+
}
|
|
2301
|
+
function getCommonJsFactoryCall(calls) {
|
|
2302
|
+
var _a;
|
|
2303
|
+
const cjsConditionalCall = calls.find((call) => {
|
|
2304
|
+
var _a2;
|
|
2305
|
+
return ((_a2 = call.condition) == null ? void 0 : _a2.operatorToken.kind) === ts6.SyntaxKind.EqualsEqualsEqualsToken && isTypeOf(call.condition, "exports") && ts6.isIdentifier(call.factoryCall.expression) && call.factoryCall.expression.text === "factory";
|
|
2306
|
+
});
|
|
2307
|
+
return (_a = cjsConditionalCall == null ? void 0 : cjsConditionalCall.factoryCall) != null ? _a : null;
|
|
2308
|
+
}
|
|
2309
|
+
function getCommonJs2FactoryCall(calls) {
|
|
2310
|
+
var _a;
|
|
2311
|
+
const cjs2ConditionalCall = calls.find((call) => {
|
|
2312
|
+
var _a2;
|
|
2313
|
+
return ((_a2 = call.condition) == null ? void 0 : _a2.operatorToken.kind) === ts6.SyntaxKind.AmpersandAmpersandToken && oneOfBinaryConditions(call.condition, (exp) => isTypeOf(exp, "exports", "module")) && ts6.isIdentifier(call.factoryCall.expression) && call.factoryCall.expression.text === "factory";
|
|
2314
|
+
});
|
|
2315
|
+
return (_a = cjs2ConditionalCall == null ? void 0 : cjs2ConditionalCall.factoryCall) != null ? _a : null;
|
|
2316
|
+
}
|
|
2317
|
+
function getGlobalFactoryCall(calls) {
|
|
2318
|
+
var _a;
|
|
2319
|
+
const globalConditionalCall = calls.find((call) => call.condition === null);
|
|
2320
|
+
return (_a = globalConditionalCall == null ? void 0 : globalConditionalCall.factoryCall) != null ? _a : null;
|
|
2321
|
+
}
|
|
2322
|
+
function oneOfBinaryConditions(node, test) {
|
|
2323
|
+
return test(node.left) || test(node.right);
|
|
2324
|
+
}
|
|
2325
|
+
function isTypeOf(node, ...types) {
|
|
2326
|
+
return ts6.isBinaryExpression(node) && ts6.isTypeOfExpression(node.left) && ts6.isIdentifier(node.left.expression) && types.includes(node.left.expression.text);
|
|
2327
|
+
}
|
|
2328
|
+
function getImportsOfUmdModule(umdModule) {
|
|
2329
|
+
const imports = [];
|
|
2330
|
+
const factoryFnParams = umdModule.factoryFn.parameters;
|
|
2331
|
+
const cjsFactoryCallArgs = umdModule.factoryCalls.cjsCallForImports.arguments;
|
|
2332
|
+
for (let i = 0; i < factoryFnParams.length; i++) {
|
|
2333
|
+
const arg = cjsFactoryCallArgs[i];
|
|
2334
|
+
if (arg !== void 0 && isRequireCall(arg)) {
|
|
2335
|
+
imports.push({
|
|
2336
|
+
parameter: factoryFnParams[i],
|
|
2337
|
+
path: arg.arguments[0].text
|
|
2338
|
+
});
|
|
2254
2339
|
}
|
|
2255
2340
|
}
|
|
2341
|
+
return imports;
|
|
2256
2342
|
}
|
|
2257
2343
|
function isExportsIdentifier(node) {
|
|
2258
|
-
return
|
|
2344
|
+
return ts6.isIdentifier(node) && node.text === "exports";
|
|
2259
2345
|
}
|
|
2260
2346
|
|
|
2261
2347
|
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/ngcc/src/packages/entry_point.mjs
|
|
@@ -2269,6 +2355,7 @@ function getEntryPointInfo(fs, config, logger, packagePath, entryPointPath) {
|
|
|
2269
2355
|
const loadedPackagePackageJson = loadPackageJson(fs, packagePackageJsonPath);
|
|
2270
2356
|
const loadedEntryPointPackageJson = packagePackageJsonPath === entryPointPackageJsonPath ? loadedPackagePackageJson : loadPackageJson(fs, entryPointPackageJsonPath);
|
|
2271
2357
|
const { packageName, packageVersion } = getPackageNameAndVersion(fs, packagePath, loadedPackagePackageJson, loadedEntryPointPackageJson);
|
|
2358
|
+
const repositoryUrl = getRepositoryUrl(loadedPackagePackageJson);
|
|
2272
2359
|
const packageConfig = config.getPackageConfig(packageName, packagePath, packageVersion);
|
|
2273
2360
|
const entryPointConfig = packageConfig.entryPoints.get(entryPointPath);
|
|
2274
2361
|
let entryPointPackageJson;
|
|
@@ -2297,6 +2384,7 @@ function getEntryPointInfo(fs, config, logger, packagePath, entryPointPath) {
|
|
|
2297
2384
|
path: entryPointPath,
|
|
2298
2385
|
packageName,
|
|
2299
2386
|
packagePath,
|
|
2387
|
+
repositoryUrl,
|
|
2300
2388
|
packageJson: entryPointPackageJson,
|
|
2301
2389
|
typings: fs.resolve(entryPointPath, typings),
|
|
2302
2390
|
compiledByAngular,
|
|
@@ -2354,11 +2442,11 @@ function sniffModuleFormat(fs, sourceFilePath) {
|
|
|
2354
2442
|
if (resolvedPath === null) {
|
|
2355
2443
|
return void 0;
|
|
2356
2444
|
}
|
|
2357
|
-
const sourceFile =
|
|
2445
|
+
const sourceFile = ts7.createSourceFile(sourceFilePath, fs.readFile(resolvedPath), ts7.ScriptTarget.ES5);
|
|
2358
2446
|
if (sourceFile.statements.length === 0) {
|
|
2359
2447
|
return void 0;
|
|
2360
2448
|
}
|
|
2361
|
-
if (
|
|
2449
|
+
if (ts7.isExternalModule(sourceFile)) {
|
|
2362
2450
|
return "esm5";
|
|
2363
2451
|
} else if (parseStatementForUmdModule(sourceFile.statements[0]) !== null) {
|
|
2364
2452
|
return "umd";
|
|
@@ -2405,6 +2493,15 @@ function getPackageNameAndVersion(fs, packagePath, packagePackageJson, entryPoin
|
|
|
2405
2493
|
packageVersion: (_a = packagePackageJson == null ? void 0 : packagePackageJson.version) != null ? _a : null
|
|
2406
2494
|
};
|
|
2407
2495
|
}
|
|
2496
|
+
function getRepositoryUrl(packageJson) {
|
|
2497
|
+
if ((packageJson == null ? void 0 : packageJson.repository) === void 0) {
|
|
2498
|
+
return "";
|
|
2499
|
+
}
|
|
2500
|
+
if (typeof packageJson.repository === "string") {
|
|
2501
|
+
return packageJson.repository;
|
|
2502
|
+
}
|
|
2503
|
+
return packageJson.repository.url;
|
|
2504
|
+
}
|
|
2408
2505
|
|
|
2409
2506
|
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/ngcc/src/execution/tasks/api.mjs
|
|
2410
2507
|
var DtsProcessing;
|
|
@@ -2416,20 +2513,20 @@ var DtsProcessing;
|
|
|
2416
2513
|
var TaskDependencies = Map;
|
|
2417
2514
|
|
|
2418
2515
|
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/ngcc/src/packages/bundle_program.mjs
|
|
2419
|
-
import
|
|
2516
|
+
import ts9 from "typescript";
|
|
2420
2517
|
|
|
2421
2518
|
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/ngcc/src/packages/patch_ts_expando_initializer.mjs
|
|
2422
|
-
import
|
|
2519
|
+
import ts8 from "typescript";
|
|
2423
2520
|
function patchTsGetExpandoInitializer() {
|
|
2424
2521
|
if (isTs31778GetExpandoInitializerFixed()) {
|
|
2425
2522
|
return null;
|
|
2426
2523
|
}
|
|
2427
|
-
const originalGetExpandoInitializer =
|
|
2524
|
+
const originalGetExpandoInitializer = ts8.getExpandoInitializer;
|
|
2428
2525
|
if (originalGetExpandoInitializer === void 0) {
|
|
2429
2526
|
throw makeUnsupportedTypeScriptError();
|
|
2430
2527
|
}
|
|
2431
|
-
|
|
2432
|
-
if (
|
|
2528
|
+
ts8.getExpandoInitializer = (initializer, isPrototypeAssignment) => {
|
|
2529
|
+
if (ts8.isParenthesizedExpression(initializer) && ts8.isCallExpression(initializer.expression)) {
|
|
2433
2530
|
initializer = initializer.expression;
|
|
2434
2531
|
}
|
|
2435
2532
|
return originalGetExpandoInitializer(initializer, isPrototypeAssignment);
|
|
@@ -2438,7 +2535,7 @@ function patchTsGetExpandoInitializer() {
|
|
|
2438
2535
|
}
|
|
2439
2536
|
function restoreGetExpandoInitializer(originalGetExpandoInitializer) {
|
|
2440
2537
|
if (originalGetExpandoInitializer !== null) {
|
|
2441
|
-
|
|
2538
|
+
ts8.getExpandoInitializer = originalGetExpandoInitializer;
|
|
2442
2539
|
}
|
|
2443
2540
|
}
|
|
2444
2541
|
var ts31778FixedResult = null;
|
|
@@ -2469,7 +2566,7 @@ function checkIfExpandoPropertyIsPresent() {
|
|
|
2469
2566
|
}());
|
|
2470
2567
|
A.expando = true;
|
|
2471
2568
|
}());`;
|
|
2472
|
-
const sourceFile =
|
|
2569
|
+
const sourceFile = ts8.createSourceFile("test.js", sourceText, ts8.ScriptTarget.ES5, true, ts8.ScriptKind.JS);
|
|
2473
2570
|
const host = {
|
|
2474
2571
|
getSourceFile() {
|
|
2475
2572
|
return sourceFile;
|
|
@@ -2502,14 +2599,14 @@ function checkIfExpandoPropertyIsPresent() {
|
|
|
2502
2599
|
}
|
|
2503
2600
|
};
|
|
2504
2601
|
const options = { noResolve: true, noLib: true, noEmit: true, allowJs: true };
|
|
2505
|
-
const program =
|
|
2602
|
+
const program = ts8.createProgram(["test.js"], options, host);
|
|
2506
2603
|
function visitor(node) {
|
|
2507
|
-
if (
|
|
2604
|
+
if (ts8.isVariableDeclaration(node) && hasNameIdentifier(node) && node.name.text === "A") {
|
|
2508
2605
|
return node;
|
|
2509
2606
|
}
|
|
2510
|
-
return
|
|
2607
|
+
return ts8.forEachChild(node, visitor);
|
|
2511
2608
|
}
|
|
2512
|
-
const declaration =
|
|
2609
|
+
const declaration = ts8.forEachChild(sourceFile, visitor);
|
|
2513
2610
|
if (declaration === void 0) {
|
|
2514
2611
|
throw new Error("Unable to find declaration of outer A");
|
|
2515
2612
|
}
|
|
@@ -2528,7 +2625,7 @@ function makeBundleProgram(fs, isCore, pkg, path, r3FileName, options, host, add
|
|
|
2528
2625
|
const r3SymbolsPath = isCore ? findR3SymbolsPath(fs, fs.dirname(path), r3FileName) : null;
|
|
2529
2626
|
let rootPaths = r3SymbolsPath ? [path, r3SymbolsPath, ...additionalFiles] : [path, ...additionalFiles];
|
|
2530
2627
|
const originalGetExpandoInitializer = patchTsGetExpandoInitializer();
|
|
2531
|
-
const program =
|
|
2628
|
+
const program = ts9.createProgram(rootPaths, options, host);
|
|
2532
2629
|
program.getTypeChecker();
|
|
2533
2630
|
restoreGetExpandoInitializer(originalGetExpandoInitializer);
|
|
2534
2631
|
const file = program.getSourceFile(path);
|
|
@@ -2554,7 +2651,7 @@ function findR3SymbolsPath(fs, directory, filename) {
|
|
|
2554
2651
|
}
|
|
2555
2652
|
|
|
2556
2653
|
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/ngcc/src/packages/ngcc_compiler_host.mjs
|
|
2557
|
-
import
|
|
2654
|
+
import ts10 from "typescript";
|
|
2558
2655
|
var NgccSourcesCompilerHost = class extends NgtscCompilerHost {
|
|
2559
2656
|
constructor(fs, options, cache, moduleResolutionCache, packagePath) {
|
|
2560
2657
|
super(fs, options);
|
|
@@ -2567,14 +2664,14 @@ var NgccSourcesCompilerHost = class extends NgtscCompilerHost {
|
|
|
2567
2664
|
}
|
|
2568
2665
|
resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference) {
|
|
2569
2666
|
return moduleNames.map((moduleName) => {
|
|
2570
|
-
const { resolvedModule } =
|
|
2571
|
-
if ((resolvedModule == null ? void 0 : resolvedModule.extension) ===
|
|
2667
|
+
const { resolvedModule } = ts10.resolveModuleName(moduleName, containingFile, this.options, this, this.moduleResolutionCache, redirectedReference);
|
|
2668
|
+
if ((resolvedModule == null ? void 0 : resolvedModule.extension) === ts10.Extension.Dts && containingFile.endsWith(".js") && isRelativePath(moduleName)) {
|
|
2572
2669
|
const jsFile = resolvedModule.resolvedFileName.replace(/\.d\.ts$/, ".js");
|
|
2573
2670
|
if (this.fileExists(jsFile)) {
|
|
2574
|
-
return __spreadProps(__spreadValues({}, resolvedModule), { resolvedFileName: jsFile, extension:
|
|
2671
|
+
return __spreadProps(__spreadValues({}, resolvedModule), { resolvedFileName: jsFile, extension: ts10.Extension.Js });
|
|
2575
2672
|
}
|
|
2576
2673
|
}
|
|
2577
|
-
if ((resolvedModule == null ? void 0 : resolvedModule.extension) ===
|
|
2674
|
+
if ((resolvedModule == null ? void 0 : resolvedModule.extension) === ts10.Extension.Js && !isWithinPackage(this.packagePath, this.fs.resolve(resolvedModule.resolvedFileName))) {
|
|
2578
2675
|
return void 0;
|
|
2579
2676
|
}
|
|
2580
2677
|
return resolvedModule;
|
|
@@ -2592,14 +2689,14 @@ var NgccDtsCompilerHost = class extends NgtscCompilerHost {
|
|
|
2592
2689
|
}
|
|
2593
2690
|
resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference) {
|
|
2594
2691
|
return moduleNames.map((moduleName) => {
|
|
2595
|
-
const { resolvedModule } =
|
|
2692
|
+
const { resolvedModule } = ts10.resolveModuleName(moduleName, containingFile, this.options, this, this.moduleResolutionCache, redirectedReference);
|
|
2596
2693
|
return resolvedModule;
|
|
2597
2694
|
});
|
|
2598
2695
|
}
|
|
2599
2696
|
};
|
|
2600
2697
|
|
|
2601
2698
|
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/ngcc/src/packages/source_file_cache.mjs
|
|
2602
|
-
import
|
|
2699
|
+
import ts11 from "typescript";
|
|
2603
2700
|
var SharedFileCache = class {
|
|
2604
2701
|
constructor(fs) {
|
|
2605
2702
|
this.fs = fs;
|
|
@@ -2621,7 +2718,7 @@ var SharedFileCache = class {
|
|
|
2621
2718
|
if (content === void 0) {
|
|
2622
2719
|
return void 0;
|
|
2623
2720
|
}
|
|
2624
|
-
const sf =
|
|
2721
|
+
const sf = ts11.createSourceFile(absPath, content, ts11.ScriptTarget.ES2015);
|
|
2625
2722
|
this.sfCache.set(absPath, sf);
|
|
2626
2723
|
}
|
|
2627
2724
|
return this.sfCache.get(absPath);
|
|
@@ -2632,7 +2729,7 @@ var SharedFileCache = class {
|
|
|
2632
2729
|
return void 0;
|
|
2633
2730
|
}
|
|
2634
2731
|
if (!this.sfCache.has(absPath) || this.sfCache.get(absPath).text !== content) {
|
|
2635
|
-
const sf =
|
|
2732
|
+
const sf = ts11.createSourceFile(absPath, content, ts11.ScriptTarget.ES2015);
|
|
2636
2733
|
this.sfCache.set(absPath, sf);
|
|
2637
2734
|
}
|
|
2638
2735
|
return this.sfCache.get(absPath);
|
|
@@ -2682,7 +2779,7 @@ var EntryPointFileCache = class {
|
|
|
2682
2779
|
if (content === void 0) {
|
|
2683
2780
|
return void 0;
|
|
2684
2781
|
}
|
|
2685
|
-
const sf =
|
|
2782
|
+
const sf = ts11.createSourceFile(fileName, content, languageVersion);
|
|
2686
2783
|
this.sfCache.set(absPath, sf);
|
|
2687
2784
|
return sf;
|
|
2688
2785
|
}
|
|
@@ -2694,7 +2791,7 @@ function readFile(absPath, fs) {
|
|
|
2694
2791
|
return fs.readFile(absPath);
|
|
2695
2792
|
}
|
|
2696
2793
|
function createModuleResolutionCache(fs) {
|
|
2697
|
-
return
|
|
2794
|
+
return ts11.createModuleResolutionCache(fs.pwd(), (fileName) => {
|
|
2698
2795
|
return fs.isCaseSensitive() ? fileName : fileName.toLowerCase();
|
|
2699
2796
|
});
|
|
2700
2797
|
}
|
|
@@ -2741,13 +2838,13 @@ function computePotentialDtsFilesFromJsFiles(fs, srcProgram, formatPath, typings
|
|
|
2741
2838
|
}
|
|
2742
2839
|
|
|
2743
2840
|
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/ngcc/src/packages/transformer.mjs
|
|
2744
|
-
import
|
|
2841
|
+
import ts21 from "typescript";
|
|
2745
2842
|
|
|
2746
2843
|
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/ngcc/src/analysis/decoration_analyzer.mjs
|
|
2747
2844
|
import { ConstantPool } from "@angular/compiler";
|
|
2748
2845
|
|
|
2749
2846
|
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/ngcc/src/migrations/utils.mjs
|
|
2750
|
-
import
|
|
2847
|
+
import ts12 from "typescript";
|
|
2751
2848
|
function isClassDeclaration(clazz) {
|
|
2752
2849
|
return isNamedClassDeclaration(clazz) || isNamedFunctionDeclaration(clazz) || isNamedVariableDeclaration(clazz);
|
|
2753
2850
|
}
|
|
@@ -2772,7 +2869,7 @@ function createDirectiveDecorator(clazz, metadata) {
|
|
|
2772
2869
|
if (metadata.exportAs !== null) {
|
|
2773
2870
|
metaArgs.push(property("exportAs", metadata.exportAs.join(", ")));
|
|
2774
2871
|
}
|
|
2775
|
-
args.push(reifySourceFile(
|
|
2872
|
+
args.push(reifySourceFile(ts12.createObjectLiteral(metaArgs)));
|
|
2776
2873
|
}
|
|
2777
2874
|
return {
|
|
2778
2875
|
name: "Directive",
|
|
@@ -2800,7 +2897,7 @@ function createComponentDecorator(clazz, metadata) {
|
|
|
2800
2897
|
node: null,
|
|
2801
2898
|
synthesizedFor: clazz.name,
|
|
2802
2899
|
args: [
|
|
2803
|
-
reifySourceFile(
|
|
2900
|
+
reifySourceFile(ts12.createObjectLiteral(metaArgs))
|
|
2804
2901
|
]
|
|
2805
2902
|
};
|
|
2806
2903
|
}
|
|
@@ -2815,16 +2912,16 @@ function createInjectableDecorator(clazz) {
|
|
|
2815
2912
|
};
|
|
2816
2913
|
}
|
|
2817
2914
|
function property(name, value) {
|
|
2818
|
-
return
|
|
2915
|
+
return ts12.createPropertyAssignment(name, ts12.createStringLiteral(value));
|
|
2819
2916
|
}
|
|
2820
|
-
var EMPTY_SF =
|
|
2917
|
+
var EMPTY_SF = ts12.createSourceFile("(empty)", "", ts12.ScriptTarget.Latest);
|
|
2821
2918
|
function reifySourceFile(expr) {
|
|
2822
|
-
const printer =
|
|
2823
|
-
const exprText = printer.printNode(
|
|
2824
|
-
const sf =
|
|
2919
|
+
const printer = ts12.createPrinter();
|
|
2920
|
+
const exprText = printer.printNode(ts12.EmitHint.Unspecified, expr, EMPTY_SF);
|
|
2921
|
+
const sf = ts12.createSourceFile("(synthetic)", `const expr = ${exprText};`, ts12.ScriptTarget.Latest, true, ts12.ScriptKind.JS);
|
|
2825
2922
|
const stmt = sf.statements[0];
|
|
2826
|
-
if (!
|
|
2827
|
-
throw new Error(`Expected VariableStatement, got ${
|
|
2923
|
+
if (!ts12.isVariableStatement(stmt)) {
|
|
2924
|
+
throw new Error(`Expected VariableStatement, got ${ts12.SyntaxKind[stmt.kind]}`);
|
|
2828
2925
|
}
|
|
2829
2926
|
return stmt.declarationList.declarations[0].initializer;
|
|
2830
2927
|
}
|
|
@@ -3003,7 +3100,7 @@ function determineBaseClass(clazz, host) {
|
|
|
3003
3100
|
}
|
|
3004
3101
|
|
|
3005
3102
|
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/ngcc/src/analysis/migration_host.mjs
|
|
3006
|
-
import
|
|
3103
|
+
import ts13 from "typescript";
|
|
3007
3104
|
var DefaultMigrationHost = class {
|
|
3008
3105
|
constructor(reflectionHost, metadata, evaluator, compiler, entryPointPath) {
|
|
3009
3106
|
this.reflectionHost = reflectionHost;
|
|
@@ -3034,14 +3131,14 @@ function createMigrationDiagnostic(diagnostic, source, decorator) {
|
|
|
3034
3131
|
const clone = __spreadValues({}, diagnostic);
|
|
3035
3132
|
const chain = [{
|
|
3036
3133
|
messageText: `Occurs for @${decorator.name} decorator inserted by an automatic migration`,
|
|
3037
|
-
category:
|
|
3134
|
+
category: ts13.DiagnosticCategory.Message,
|
|
3038
3135
|
code: 0
|
|
3039
3136
|
}];
|
|
3040
3137
|
if (decorator.args !== null) {
|
|
3041
3138
|
const args = decorator.args.map((arg) => arg.getText()).join(", ");
|
|
3042
3139
|
chain.push({
|
|
3043
3140
|
messageText: `@${decorator.name}(${args})`,
|
|
3044
|
-
category:
|
|
3141
|
+
category: ts13.DiagnosticCategory.Message,
|
|
3045
3142
|
code: 0
|
|
3046
3143
|
});
|
|
3047
3144
|
}
|
|
@@ -3267,7 +3364,7 @@ var DecorationAnalyzer = class {
|
|
|
3267
3364
|
};
|
|
3268
3365
|
|
|
3269
3366
|
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/ngcc/src/analysis/module_with_providers_analyzer.mjs
|
|
3270
|
-
import
|
|
3367
|
+
import ts14 from "typescript";
|
|
3271
3368
|
var ModuleWithProvidersAnalyses = Map;
|
|
3272
3369
|
var ModuleWithProvidersAnalyzer = class {
|
|
3273
3370
|
constructor(host, typeChecker, referencesRegistry, processDts) {
|
|
@@ -3289,7 +3386,7 @@ var ModuleWithProvidersAnalyzer = class {
|
|
|
3289
3386
|
if (this.processDts) {
|
|
3290
3387
|
const dtsFn = this.getDtsModuleWithProvidersFunction(fn);
|
|
3291
3388
|
const dtsFnType = dtsFn.declaration.type;
|
|
3292
|
-
const typeParam = dtsFnType &&
|
|
3389
|
+
const typeParam = dtsFnType && ts14.isTypeReferenceNode(dtsFnType) && dtsFnType.typeArguments && dtsFnType.typeArguments[0] || null;
|
|
3293
3390
|
if (!typeParam || isAnyKeyword(typeParam)) {
|
|
3294
3391
|
const dtsFile = dtsFn.declaration.getSourceFile();
|
|
3295
3392
|
const analysis = analyses.has(dtsFile) ? analyses.get(dtsFile) : [];
|
|
@@ -3334,7 +3431,7 @@ var ModuleWithProvidersAnalyzer = class {
|
|
|
3334
3431
|
return infos;
|
|
3335
3432
|
}
|
|
3336
3433
|
parseForModuleWithProviders(name, node, implementation = node, container = null) {
|
|
3337
|
-
if (implementation === null || !
|
|
3434
|
+
if (implementation === null || !ts14.isFunctionDeclaration(implementation) && !ts14.isMethodDeclaration(implementation) && !ts14.isFunctionExpression(implementation)) {
|
|
3338
3435
|
return null;
|
|
3339
3436
|
}
|
|
3340
3437
|
const declaration = implementation;
|
|
@@ -3347,7 +3444,7 @@ var ModuleWithProvidersAnalyzer = class {
|
|
|
3347
3444
|
return null;
|
|
3348
3445
|
}
|
|
3349
3446
|
const lastStatement = body[body.length - 1];
|
|
3350
|
-
if (!
|
|
3447
|
+
if (!ts14.isReturnStatement(lastStatement) || lastStatement.expression === void 0) {
|
|
3351
3448
|
return null;
|
|
3352
3449
|
}
|
|
3353
3450
|
const result = this.evaluator.evaluate(lastStatement.expression);
|
|
@@ -3369,7 +3466,7 @@ var ModuleWithProvidersAnalyzer = class {
|
|
|
3369
3466
|
const containerClass = fn.container && this.host.getClassSymbol(fn.container);
|
|
3370
3467
|
if (containerClass) {
|
|
3371
3468
|
const dtsClass = this.host.getDtsDeclaration(containerClass.declaration.valueDeclaration);
|
|
3372
|
-
dtsFn = dtsClass &&
|
|
3469
|
+
dtsFn = dtsClass && ts14.isClassDeclaration(dtsClass) ? dtsClass.members.find((member) => ts14.isMethodDeclaration(member) && ts14.isIdentifier(member.name) && member.name.text === fn.name) : null;
|
|
3373
3470
|
} else {
|
|
3374
3471
|
dtsFn = this.host.getDtsDeclaration(fn.declaration);
|
|
3375
3472
|
}
|
|
@@ -3399,10 +3496,10 @@ var ModuleWithProvidersAnalyzer = class {
|
|
|
3399
3496
|
}
|
|
3400
3497
|
};
|
|
3401
3498
|
function isFunctionOrMethod(declaration) {
|
|
3402
|
-
return
|
|
3499
|
+
return ts14.isFunctionDeclaration(declaration) || ts14.isMethodDeclaration(declaration);
|
|
3403
3500
|
}
|
|
3404
3501
|
function isAnyKeyword(typeParam) {
|
|
3405
|
-
return typeParam.kind ===
|
|
3502
|
+
return typeParam.kind === ts14.SyntaxKind.AnyKeyword;
|
|
3406
3503
|
}
|
|
3407
3504
|
|
|
3408
3505
|
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/ngcc/src/analysis/ngcc_references_registry.mjs
|
|
@@ -3467,27 +3564,8 @@ var PrivateDeclarationsAnalyzer = class {
|
|
|
3467
3564
|
}
|
|
3468
3565
|
};
|
|
3469
3566
|
|
|
3470
|
-
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/ngcc/src/analysis/switch_marker_analyzer.mjs
|
|
3471
|
-
var SwitchMarkerAnalyses = Map;
|
|
3472
|
-
var SwitchMarkerAnalyzer = class {
|
|
3473
|
-
constructor(host, packagePath) {
|
|
3474
|
-
this.host = host;
|
|
3475
|
-
this.packagePath = packagePath;
|
|
3476
|
-
}
|
|
3477
|
-
analyzeProgram(program) {
|
|
3478
|
-
const analyzedFiles = new SwitchMarkerAnalyses();
|
|
3479
|
-
program.getSourceFiles().filter((sourceFile) => isWithinPackage(this.packagePath, absoluteFromSourceFile(sourceFile))).forEach((sourceFile) => {
|
|
3480
|
-
const declarations = this.host.getSwitchableDeclarations(sourceFile);
|
|
3481
|
-
if (declarations.length) {
|
|
3482
|
-
analyzedFiles.set(sourceFile, { sourceFile, declarations });
|
|
3483
|
-
}
|
|
3484
|
-
});
|
|
3485
|
-
return analyzedFiles;
|
|
3486
|
-
}
|
|
3487
|
-
};
|
|
3488
|
-
|
|
3489
3567
|
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/ngcc/src/host/commonjs_host.mjs
|
|
3490
|
-
import
|
|
3568
|
+
import ts15 from "typescript";
|
|
3491
3569
|
var CommonJsReflectionHost = class extends Esm5ReflectionHost {
|
|
3492
3570
|
constructor(logger, isCore, src, dts = null) {
|
|
3493
3571
|
super(logger, isCore, src, dts);
|
|
@@ -3561,7 +3639,7 @@ var CommonJsReflectionHost = class extends Esm5ReflectionHost {
|
|
|
3561
3639
|
}
|
|
3562
3640
|
extractCommonJsWildcardReexports(statement, containingFile) {
|
|
3563
3641
|
const reexportArg = statement.expression.arguments[0];
|
|
3564
|
-
const requireCall = isRequireCall(reexportArg) ? reexportArg :
|
|
3642
|
+
const requireCall = isRequireCall(reexportArg) ? reexportArg : ts15.isIdentifier(reexportArg) ? findRequireCallReference(reexportArg, this.checker) : null;
|
|
3565
3643
|
if (requireCall === null) {
|
|
3566
3644
|
return [];
|
|
3567
3645
|
}
|
|
@@ -3644,7 +3722,7 @@ var CommonJsReflectionHost = class extends Esm5ReflectionHost {
|
|
|
3644
3722
|
const moduleInfo = this.compilerHost.resolveModuleNames([moduleName], containingFile.fileName, void 0, void 0, this.program.getCompilerOptions())[0];
|
|
3645
3723
|
return moduleInfo && this.program.getSourceFile(absoluteFrom(moduleInfo.resolvedFileName));
|
|
3646
3724
|
} else {
|
|
3647
|
-
const moduleInfo =
|
|
3725
|
+
const moduleInfo = ts15.resolveModuleName(moduleName, containingFile.fileName, this.program.getCompilerOptions(), this.compilerHost);
|
|
3648
3726
|
return moduleInfo.resolvedModule && this.program.getSourceFile(absoluteFrom(moduleInfo.resolvedModule.resolvedFileName));
|
|
3649
3727
|
}
|
|
3650
3728
|
}
|
|
@@ -3760,9 +3838,6 @@ var DelegatingReflectionHost = class {
|
|
|
3760
3838
|
getDecoratorsOfSymbol(symbol) {
|
|
3761
3839
|
return this.ngccHost.getDecoratorsOfSymbol(symbol);
|
|
3762
3840
|
}
|
|
3763
|
-
getSwitchableDeclarations(module) {
|
|
3764
|
-
return this.ngccHost.getSwitchableDeclarations(module);
|
|
3765
|
-
}
|
|
3766
3841
|
getEndOfClass(classSymbol) {
|
|
3767
3842
|
return this.ngccHost.getEndOfClass(classSymbol);
|
|
3768
3843
|
}
|
|
@@ -3775,13 +3850,13 @@ var DelegatingReflectionHost = class {
|
|
|
3775
3850
|
};
|
|
3776
3851
|
|
|
3777
3852
|
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/ngcc/src/rendering/commonjs_rendering_formatter.mjs
|
|
3778
|
-
import
|
|
3853
|
+
import ts18 from "typescript";
|
|
3779
3854
|
|
|
3780
3855
|
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/ngcc/src/rendering/esm5_rendering_formatter.mjs
|
|
3781
|
-
import
|
|
3856
|
+
import ts17 from "typescript";
|
|
3782
3857
|
|
|
3783
3858
|
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/ngcc/src/rendering/esm_rendering_formatter.mjs
|
|
3784
|
-
import
|
|
3859
|
+
import ts16 from "typescript";
|
|
3785
3860
|
|
|
3786
3861
|
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/ngcc/src/rendering/ngcc_import_rewriter.mjs
|
|
3787
3862
|
var NgccFlatImportRewriter = class {
|
|
@@ -3824,7 +3899,7 @@ var EsmRenderingFormatter = class {
|
|
|
3824
3899
|
this.fs = fs;
|
|
3825
3900
|
this.host = host;
|
|
3826
3901
|
this.isCore = isCore;
|
|
3827
|
-
this.printer =
|
|
3902
|
+
this.printer = ts16.createPrinter({ newLine: ts16.NewLineKind.LineFeed });
|
|
3828
3903
|
}
|
|
3829
3904
|
addImports(output, imports, sf) {
|
|
3830
3905
|
if (imports.length === 0) {
|
|
@@ -3884,14 +3959,14 @@ export {${e.symbolName} as ${e.asAlias}} from '${e.fromModule}';`;
|
|
|
3884
3959
|
}
|
|
3885
3960
|
removeDecorators(output, decoratorsToRemove) {
|
|
3886
3961
|
decoratorsToRemove.forEach((nodesToRemove, containerNode) => {
|
|
3887
|
-
if (
|
|
3962
|
+
if (ts16.isArrayLiteralExpression(containerNode)) {
|
|
3888
3963
|
const items = containerNode.elements;
|
|
3889
3964
|
if (items.length === nodesToRemove.length) {
|
|
3890
3965
|
const statement = findStatement(containerNode);
|
|
3891
3966
|
if (statement) {
|
|
3892
|
-
if (
|
|
3967
|
+
if (ts16.isExpressionStatement(statement)) {
|
|
3893
3968
|
output.remove(statement.getFullStart(), statement.getEnd());
|
|
3894
|
-
} else if (
|
|
3969
|
+
} else if (ts16.isReturnStatement(statement) && statement.expression && isAssignment2(statement.expression)) {
|
|
3895
3970
|
const startOfRemoval = statement.expression.left.getEnd();
|
|
3896
3971
|
const endOfRemoval = getEndExceptSemicolon(statement);
|
|
3897
3972
|
output.remove(startOfRemoval, endOfRemoval);
|
|
@@ -3914,14 +3989,6 @@ export {${e.symbolName} as ${e.asAlias}} from '${e.fromModule}';`;
|
|
|
3914
3989
|
}
|
|
3915
3990
|
});
|
|
3916
3991
|
}
|
|
3917
|
-
rewriteSwitchableDeclarations(outputText, sourceFile, declarations) {
|
|
3918
|
-
declarations.forEach((declaration) => {
|
|
3919
|
-
const start = declaration.initializer.getStart();
|
|
3920
|
-
const end = declaration.initializer.getEnd();
|
|
3921
|
-
const replacement = declaration.initializer.text.replace(PRE_R3_MARKER, POST_R3_MARKER);
|
|
3922
|
-
outputText.overwrite(start, end, replacement);
|
|
3923
|
-
});
|
|
3924
|
-
}
|
|
3925
3992
|
addModuleWithProvidersParams(outputText, moduleWithProviders, importManager) {
|
|
3926
3993
|
moduleWithProviders.forEach((info) => {
|
|
3927
3994
|
const ngModuleName = info.ngModule.node.name.text;
|
|
@@ -3932,7 +3999,7 @@ export {${e.symbolName} as ${e.asAlias}} from '${e.fromModule}';`;
|
|
|
3932
3999
|
const importPath = info.ngModule.ownedByModuleGuess || (declarationFile !== ngModuleFile ? stripExtension2(relativeImport) : null);
|
|
3933
4000
|
const ngModule = generateImportString(importManager, importPath, ngModuleName);
|
|
3934
4001
|
if (info.declaration.type) {
|
|
3935
|
-
const typeName = info.declaration.type &&
|
|
4002
|
+
const typeName = info.declaration.type && ts16.isTypeReferenceNode(info.declaration.type) ? info.declaration.type.typeName : null;
|
|
3936
4003
|
if (this.isCoreModuleWithProvidersType(typeName)) {
|
|
3937
4004
|
outputText.overwrite(info.declaration.type.getStart(), info.declaration.type.getEnd(), `ModuleWithProviders<${ngModule}>`);
|
|
3938
4005
|
} else {
|
|
@@ -3941,32 +4008,32 @@ export {${e.symbolName} as ${e.asAlias}} from '${e.fromModule}';`;
|
|
|
3941
4008
|
}
|
|
3942
4009
|
} else {
|
|
3943
4010
|
const lastToken = info.declaration.getLastToken();
|
|
3944
|
-
const insertPoint = lastToken && lastToken.kind ===
|
|
4011
|
+
const insertPoint = lastToken && lastToken.kind === ts16.SyntaxKind.SemicolonToken ? lastToken.getStart() : info.declaration.getEnd();
|
|
3945
4012
|
outputText.appendLeft(insertPoint, `: ${generateImportString(importManager, "@angular/core", "ModuleWithProviders")}<${ngModule}>`);
|
|
3946
4013
|
}
|
|
3947
4014
|
});
|
|
3948
4015
|
}
|
|
3949
4016
|
printStatement(stmt, sourceFile, importManager) {
|
|
3950
4017
|
const node = translateStatement(stmt, importManager);
|
|
3951
|
-
const code = this.printer.printNode(
|
|
4018
|
+
const code = this.printer.printNode(ts16.EmitHint.Unspecified, node, sourceFile);
|
|
3952
4019
|
return code;
|
|
3953
4020
|
}
|
|
3954
4021
|
findEndOfImports(sf) {
|
|
3955
4022
|
for (const stmt of sf.statements) {
|
|
3956
|
-
if (!
|
|
4023
|
+
if (!ts16.isImportDeclaration(stmt) && !ts16.isImportEqualsDeclaration(stmt) && !ts16.isNamespaceImport(stmt)) {
|
|
3957
4024
|
return stmt.getStart();
|
|
3958
4025
|
}
|
|
3959
4026
|
}
|
|
3960
4027
|
return 0;
|
|
3961
4028
|
}
|
|
3962
4029
|
isCoreModuleWithProvidersType(typeName) {
|
|
3963
|
-
const id = typeName &&
|
|
4030
|
+
const id = typeName && ts16.isIdentifier(typeName) ? this.host.getImportOfIdentifier(typeName) : null;
|
|
3964
4031
|
return id && id.name === "ModuleWithProviders" && (this.isCore || id.from === "@angular/core");
|
|
3965
4032
|
}
|
|
3966
4033
|
};
|
|
3967
4034
|
function findStatement(node) {
|
|
3968
4035
|
while (node) {
|
|
3969
|
-
if (
|
|
4036
|
+
if (ts16.isExpressionStatement(node) || ts16.isReturnStatement(node)) {
|
|
3970
4037
|
return node;
|
|
3971
4038
|
}
|
|
3972
4039
|
node = node.parent;
|
|
@@ -3983,7 +4050,7 @@ function getNextSiblingInArray(node, array) {
|
|
|
3983
4050
|
}
|
|
3984
4051
|
function getEndExceptSemicolon(statement) {
|
|
3985
4052
|
const lastToken = statement.getLastToken();
|
|
3986
|
-
return lastToken && lastToken.kind ===
|
|
4053
|
+
return lastToken && lastToken.kind === ts16.SyntaxKind.SemicolonToken ? statement.getEnd() - 1 : statement.getEnd();
|
|
3987
4054
|
}
|
|
3988
4055
|
|
|
3989
4056
|
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/ngcc/src/rendering/esm5_rendering_formatter.mjs
|
|
@@ -3997,10 +4064,10 @@ Expected an ES5 IIFE wrapped function. But got:
|
|
|
3997
4064
|
}
|
|
3998
4065
|
const declarationStatement = getContainingStatement(classSymbol.implementation.valueDeclaration);
|
|
3999
4066
|
const iifeBody = declarationStatement.parent;
|
|
4000
|
-
if (!iifeBody || !
|
|
4067
|
+
if (!iifeBody || !ts17.isBlock(iifeBody)) {
|
|
4001
4068
|
throw new Error(`Compiled class declaration is not inside an IIFE: ${compiledClass.name} in ${compiledClass.declaration.getSourceFile().fileName}`);
|
|
4002
4069
|
}
|
|
4003
|
-
const returnStatement = iifeBody.statements.find(
|
|
4070
|
+
const returnStatement = iifeBody.statements.find(ts17.isReturnStatement);
|
|
4004
4071
|
if (!returnStatement) {
|
|
4005
4072
|
throw new Error(`Compiled class wrapper IIFE does not have a return statement: ${compiledClass.name} in ${compiledClass.declaration.getSourceFile().fileName}`);
|
|
4006
4073
|
}
|
|
@@ -4009,7 +4076,7 @@ Expected an ES5 IIFE wrapped function. But got:
|
|
|
4009
4076
|
}
|
|
4010
4077
|
printStatement(stmt, sourceFile, importManager) {
|
|
4011
4078
|
const node = translateStatement(stmt, importManager, { downlevelTaggedTemplates: true, downlevelVariableDeclarations: true });
|
|
4012
|
-
const code = this.printer.printNode(
|
|
4079
|
+
const code = this.printer.printNode(ts17.EmitHint.Unspecified, node, sourceFile);
|
|
4013
4080
|
return code;
|
|
4014
4081
|
}
|
|
4015
4082
|
};
|
|
@@ -4051,10 +4118,10 @@ exports.${e.asAlias} = ${importNamespace}${namedImport.symbol};`;
|
|
|
4051
4118
|
}
|
|
4052
4119
|
findEndOfImports(sf) {
|
|
4053
4120
|
for (const statement of sf.statements) {
|
|
4054
|
-
if (
|
|
4121
|
+
if (ts18.isExpressionStatement(statement) && isRequireCall(statement.expression)) {
|
|
4055
4122
|
continue;
|
|
4056
4123
|
}
|
|
4057
|
-
const declarations =
|
|
4124
|
+
const declarations = ts18.isVariableStatement(statement) ? Array.from(statement.declarationList.declarations) : [];
|
|
4058
4125
|
if (declarations.some((d) => !d.initializer || !isRequireCall(d.initializer))) {
|
|
4059
4126
|
return statement.getStart();
|
|
4060
4127
|
}
|
|
@@ -4065,7 +4132,7 @@ exports.${e.asAlias} = ${importNamespace}${namedImport.symbol};`;
|
|
|
4065
4132
|
|
|
4066
4133
|
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/ngcc/src/rendering/dts_renderer.mjs
|
|
4067
4134
|
import MagicString from "magic-string";
|
|
4068
|
-
import
|
|
4135
|
+
import ts19 from "typescript";
|
|
4069
4136
|
|
|
4070
4137
|
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/ngcc/src/constants.mjs
|
|
4071
4138
|
var IMPORT_PREFIX = "\u0275ngcc";
|
|
@@ -4136,14 +4203,14 @@ var DtsRenderer = class {
|
|
|
4136
4203
|
}
|
|
4137
4204
|
renderDtsFile(dtsFile, renderInfo) {
|
|
4138
4205
|
const outputText = new MagicString(dtsFile.text);
|
|
4139
|
-
const printer =
|
|
4206
|
+
const printer = ts19.createPrinter();
|
|
4140
4207
|
const importManager = new ImportManager(getImportRewriter(this.bundle.dts.r3SymbolsFile, this.bundle.isCore, false), IMPORT_PREFIX);
|
|
4141
4208
|
renderInfo.classInfo.forEach((dtsClass) => {
|
|
4142
4209
|
const endOfClass = dtsClass.dtsDeclaration.getEnd();
|
|
4143
4210
|
dtsClass.compilation.forEach((declaration) => {
|
|
4144
4211
|
const type = translateType(declaration.type, importManager);
|
|
4145
4212
|
markForEmitAsSingleLine(type);
|
|
4146
|
-
const typeStr = printer.printNode(
|
|
4213
|
+
const typeStr = printer.printNode(ts19.EmitHint.Unspecified, type, dtsFile);
|
|
4147
4214
|
const newStatement = ` static ${declaration.name}: ${typeStr};
|
|
4148
4215
|
`;
|
|
4149
4216
|
outputText.appendRight(endOfClass - 1, newStatement);
|
|
@@ -4203,8 +4270,8 @@ The simplest fix for this is to ensure that this class is exported from the pack
|
|
|
4203
4270
|
}
|
|
4204
4271
|
};
|
|
4205
4272
|
function markForEmitAsSingleLine(node) {
|
|
4206
|
-
|
|
4207
|
-
|
|
4273
|
+
ts19.setEmitFlags(node, ts19.EmitFlags.SingleLine);
|
|
4274
|
+
ts19.forEachChild(node, markForEmitAsSingleLine);
|
|
4208
4275
|
}
|
|
4209
4276
|
|
|
4210
4277
|
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/ngcc/src/rendering/renderer.mjs
|
|
@@ -4224,23 +4291,19 @@ var Renderer = class {
|
|
|
4224
4291
|
this.bundle = bundle;
|
|
4225
4292
|
this.tsConfig = tsConfig;
|
|
4226
4293
|
}
|
|
4227
|
-
renderProgram(decorationAnalyses,
|
|
4294
|
+
renderProgram(decorationAnalyses, privateDeclarationsAnalyses) {
|
|
4228
4295
|
const renderedFiles = [];
|
|
4229
4296
|
this.bundle.src.program.getSourceFiles().forEach((sourceFile) => {
|
|
4230
|
-
if (decorationAnalyses.has(sourceFile) ||
|
|
4297
|
+
if (decorationAnalyses.has(sourceFile) || sourceFile === this.bundle.src.file) {
|
|
4231
4298
|
const compiledFile = decorationAnalyses.get(sourceFile);
|
|
4232
|
-
|
|
4233
|
-
renderedFiles.push(...this.renderFile(sourceFile, compiledFile, switchMarkerAnalysis, privateDeclarationsAnalyses));
|
|
4299
|
+
renderedFiles.push(...this.renderFile(sourceFile, compiledFile, privateDeclarationsAnalyses));
|
|
4234
4300
|
}
|
|
4235
4301
|
});
|
|
4236
4302
|
return renderedFiles;
|
|
4237
4303
|
}
|
|
4238
|
-
renderFile(sourceFile, compiledFile,
|
|
4304
|
+
renderFile(sourceFile, compiledFile, privateDeclarationsAnalyses) {
|
|
4239
4305
|
const isEntryPoint2 = sourceFile === this.bundle.src.file;
|
|
4240
4306
|
const outputText = new MagicString2(sourceFile.text);
|
|
4241
|
-
if (switchMarkerAnalysis) {
|
|
4242
|
-
this.srcFormatter.rewriteSwitchableDeclarations(outputText, switchMarkerAnalysis.sourceFile, switchMarkerAnalysis.declarations);
|
|
4243
|
-
}
|
|
4244
4307
|
const importManager = new ImportManager(getImportRewriter(this.bundle.src.r3SymbolsFile, this.bundle.isCore, this.bundle.isFlatCore), IMPORT_PREFIX);
|
|
4245
4308
|
if (compiledFile) {
|
|
4246
4309
|
const decoratorsToRemove = this.computeDecoratorsToRemove(compiledFile.compiledClasses);
|
|
@@ -4264,7 +4327,7 @@ var Renderer = class {
|
|
|
4264
4327
|
if (isEntryPoint2 || compiledFile) {
|
|
4265
4328
|
this.srcFormatter.addImports(outputText, importManager.getAllImports(sourceFile.fileName), sourceFile);
|
|
4266
4329
|
}
|
|
4267
|
-
if (compiledFile ||
|
|
4330
|
+
if (compiledFile || isEntryPoint2) {
|
|
4268
4331
|
return renderSourceAndMap(this.logger, this.fs, sourceFile, outputText);
|
|
4269
4332
|
} else {
|
|
4270
4333
|
return [];
|
|
@@ -4322,7 +4385,7 @@ function createAssignmentStatement(receiverName, propName, initializer, leadingC
|
|
|
4322
4385
|
}
|
|
4323
4386
|
|
|
4324
4387
|
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/ngcc/src/rendering/umd_rendering_formatter.mjs
|
|
4325
|
-
import
|
|
4388
|
+
import ts20 from "typescript";
|
|
4326
4389
|
var UmdRenderingFormatter = class extends Esm5RenderingFormatter {
|
|
4327
4390
|
constructor(fs, umdHost, isCore) {
|
|
4328
4391
|
super(fs, umdHost, isCore);
|
|
@@ -4336,10 +4399,11 @@ var UmdRenderingFormatter = class extends Esm5RenderingFormatter {
|
|
|
4336
4399
|
if (!umdModule) {
|
|
4337
4400
|
return;
|
|
4338
4401
|
}
|
|
4339
|
-
const {
|
|
4340
|
-
renderCommonJsDependencies(output,
|
|
4341
|
-
|
|
4342
|
-
|
|
4402
|
+
const { factoryFn, factoryCalls } = umdModule;
|
|
4403
|
+
renderCommonJsDependencies(output, factoryCalls.commonJs, imports);
|
|
4404
|
+
renderCommonJsDependencies(output, factoryCalls.commonJs2, imports);
|
|
4405
|
+
renderAmdDependencies(output, factoryCalls.amdDefine, imports);
|
|
4406
|
+
renderGlobalDependencies(output, factoryCalls.global, imports);
|
|
4343
4407
|
renderFactoryParameters(output, factoryFn, imports);
|
|
4344
4408
|
}
|
|
4345
4409
|
addExports(output, entryPointBasePath, exports, importManager, file) {
|
|
@@ -4390,26 +4454,22 @@ exports.${e.asAlias} = ${importNamespace}${namedImport.symbol};`;
|
|
|
4390
4454
|
output.appendLeft(insertionPoint, "\n" + constants + "\n");
|
|
4391
4455
|
}
|
|
4392
4456
|
};
|
|
4393
|
-
function renderCommonJsDependencies(output,
|
|
4394
|
-
|
|
4395
|
-
if (!conditional) {
|
|
4457
|
+
function renderCommonJsDependencies(output, factoryCall, imports) {
|
|
4458
|
+
if (factoryCall === null) {
|
|
4396
4459
|
return;
|
|
4397
4460
|
}
|
|
4398
|
-
const factoryCall = conditional.whenTrue;
|
|
4399
4461
|
const injectionPoint = factoryCall.arguments.length > 0 ? factoryCall.arguments[0].getFullStart() : factoryCall.getEnd() - 1;
|
|
4400
4462
|
const importString = imports.map((i) => `require('${i.specifier}')`).join(",");
|
|
4401
4463
|
output.appendLeft(injectionPoint, importString + (factoryCall.arguments.length > 0 ? "," : ""));
|
|
4402
4464
|
}
|
|
4403
|
-
function renderAmdDependencies(output,
|
|
4404
|
-
|
|
4405
|
-
if (!conditional) {
|
|
4465
|
+
function renderAmdDependencies(output, amdDefineCall, imports) {
|
|
4466
|
+
if (amdDefineCall === null) {
|
|
4406
4467
|
return;
|
|
4407
4468
|
}
|
|
4408
|
-
const amdDefineCall = conditional.whenTrue;
|
|
4409
4469
|
const importString = imports.map((i) => `'${i.specifier}'`).join(",");
|
|
4410
4470
|
const factoryIndex = amdDefineCall.arguments.length - 1;
|
|
4411
4471
|
const dependencyArray = amdDefineCall.arguments[factoryIndex - 1];
|
|
4412
|
-
if (dependencyArray === void 0 || !
|
|
4472
|
+
if (dependencyArray === void 0 || !ts20.isArrayLiteralExpression(dependencyArray)) {
|
|
4413
4473
|
const injectionPoint = amdDefineCall.arguments[factoryIndex].getFullStart();
|
|
4414
4474
|
output.appendLeft(injectionPoint, `[${importString}],`);
|
|
4415
4475
|
} else {
|
|
@@ -4417,14 +4477,13 @@ function renderAmdDependencies(output, wrapperFunction, imports) {
|
|
|
4417
4477
|
output.appendLeft(injectionPoint, importString + (dependencyArray.elements.length > 0 ? "," : ""));
|
|
4418
4478
|
}
|
|
4419
4479
|
}
|
|
4420
|
-
function renderGlobalDependencies(output,
|
|
4421
|
-
|
|
4422
|
-
if (!globalFactoryCall) {
|
|
4480
|
+
function renderGlobalDependencies(output, factoryCall, imports) {
|
|
4481
|
+
if (factoryCall === null) {
|
|
4423
4482
|
return;
|
|
4424
4483
|
}
|
|
4425
|
-
const injectionPoint =
|
|
4484
|
+
const injectionPoint = factoryCall.arguments.length > 0 ? factoryCall.arguments[0].getFullStart() : factoryCall.getEnd() - 1;
|
|
4426
4485
|
const importString = imports.map((i) => `global.${getGlobalIdentifier(i)}`).join(",");
|
|
4427
|
-
output.appendLeft(injectionPoint, importString + (
|
|
4486
|
+
output.appendLeft(injectionPoint, importString + (factoryCall.arguments.length > 0 ? "," : ""));
|
|
4428
4487
|
}
|
|
4429
4488
|
function renderFactoryParameters(output, factoryFunction, imports) {
|
|
4430
4489
|
const parameters = factoryFunction.parameters;
|
|
@@ -4437,60 +4496,9 @@ function renderFactoryParameters(output, factoryFunction, imports) {
|
|
|
4437
4496
|
output.appendLeft(injectionPoint, parameterString);
|
|
4438
4497
|
}
|
|
4439
4498
|
}
|
|
4440
|
-
function isCommonJSConditional(value) {
|
|
4441
|
-
if (!ts21.isConditionalExpression(value)) {
|
|
4442
|
-
return false;
|
|
4443
|
-
}
|
|
4444
|
-
if (!ts21.isBinaryExpression(value.condition) || value.condition.operatorToken.kind !== ts21.SyntaxKind.AmpersandAmpersandToken) {
|
|
4445
|
-
return false;
|
|
4446
|
-
}
|
|
4447
|
-
if (!oneOfBinaryConditions(value.condition, (exp) => isTypeOf(exp, "exports", "module"))) {
|
|
4448
|
-
return false;
|
|
4449
|
-
}
|
|
4450
|
-
if (!ts21.isCallExpression(value.whenTrue) || !ts21.isIdentifier(value.whenTrue.expression)) {
|
|
4451
|
-
return false;
|
|
4452
|
-
}
|
|
4453
|
-
return value.whenTrue.expression.text === "factory";
|
|
4454
|
-
}
|
|
4455
|
-
function isAmdConditional(value) {
|
|
4456
|
-
if (!ts21.isConditionalExpression(value)) {
|
|
4457
|
-
return false;
|
|
4458
|
-
}
|
|
4459
|
-
if (!ts21.isBinaryExpression(value.condition) || value.condition.operatorToken.kind !== ts21.SyntaxKind.AmpersandAmpersandToken) {
|
|
4460
|
-
return false;
|
|
4461
|
-
}
|
|
4462
|
-
if (!oneOfBinaryConditions(value.condition, (exp) => isTypeOf(exp, "define"))) {
|
|
4463
|
-
return false;
|
|
4464
|
-
}
|
|
4465
|
-
if (!ts21.isCallExpression(value.whenTrue) || !ts21.isIdentifier(value.whenTrue.expression)) {
|
|
4466
|
-
return false;
|
|
4467
|
-
}
|
|
4468
|
-
return value.whenTrue.expression.text === "define";
|
|
4469
|
-
}
|
|
4470
|
-
function isGlobalFactoryCall(value) {
|
|
4471
|
-
if (ts21.isCallExpression(value) && !!value.parent) {
|
|
4472
|
-
value = isCommaExpression(value.parent) ? value.parent : value;
|
|
4473
|
-
value = ts21.isParenthesizedExpression(value.parent) ? value.parent : value;
|
|
4474
|
-
return !!value.parent && ts21.isConditionalExpression(value.parent) && value.parent.whenFalse === value;
|
|
4475
|
-
} else {
|
|
4476
|
-
return false;
|
|
4477
|
-
}
|
|
4478
|
-
}
|
|
4479
|
-
function isCommaExpression(value) {
|
|
4480
|
-
return ts21.isBinaryExpression(value) && value.operatorToken.kind === ts21.SyntaxKind.CommaToken;
|
|
4481
|
-
}
|
|
4482
4499
|
function getGlobalIdentifier(i) {
|
|
4483
4500
|
return i.specifier.replace(/^@angular\//, "ng.").replace(/^@/, "").replace(/\//g, ".").replace(/[-_]+(.?)/g, (_, c) => c.toUpperCase()).replace(/^./, (c) => c.toLowerCase());
|
|
4484
4501
|
}
|
|
4485
|
-
function find(node, test) {
|
|
4486
|
-
return test(node) ? node : node.forEachChild((child) => find(child, test));
|
|
4487
|
-
}
|
|
4488
|
-
function oneOfBinaryConditions(node, test) {
|
|
4489
|
-
return test(node.left) || test(node.right);
|
|
4490
|
-
}
|
|
4491
|
-
function isTypeOf(node, ...types) {
|
|
4492
|
-
return ts21.isBinaryExpression(node) && ts21.isTypeOfExpression(node.left) && ts21.isIdentifier(node.left.expression) && types.indexOf(node.left.expression.text) !== -1;
|
|
4493
|
-
}
|
|
4494
4502
|
|
|
4495
4503
|
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/ngcc/src/packages/transformer.mjs
|
|
4496
4504
|
var Transformer = class {
|
|
@@ -4503,7 +4511,7 @@ var Transformer = class {
|
|
|
4503
4511
|
const ngccReflectionHost = this.getHost(bundle);
|
|
4504
4512
|
const tsReflectionHost = new TypeScriptReflectionHost(bundle.src.program.getTypeChecker());
|
|
4505
4513
|
const reflectionHost = new DelegatingReflectionHost(tsReflectionHost, ngccReflectionHost);
|
|
4506
|
-
const { decorationAnalyses,
|
|
4514
|
+
const { decorationAnalyses, privateDeclarationsAnalyses, moduleWithProvidersAnalyses, diagnostics } = this.analyzeProgram(reflectionHost, bundle);
|
|
4507
4515
|
if (hasErrors(diagnostics)) {
|
|
4508
4516
|
return { success: false, diagnostics };
|
|
4509
4517
|
}
|
|
@@ -4511,7 +4519,7 @@ var Transformer = class {
|
|
|
4511
4519
|
if (bundle.dtsProcessing !== DtsProcessing.Only) {
|
|
4512
4520
|
const srcFormatter = this.getRenderingFormatter(ngccReflectionHost, bundle);
|
|
4513
4521
|
const renderer = new Renderer(reflectionHost, srcFormatter, this.fs, this.logger, bundle, this.tsConfig);
|
|
4514
|
-
renderedFiles = renderer.renderProgram(decorationAnalyses,
|
|
4522
|
+
renderedFiles = renderer.renderProgram(decorationAnalyses, privateDeclarationsAnalyses);
|
|
4515
4523
|
}
|
|
4516
4524
|
if (bundle.dts) {
|
|
4517
4525
|
const dtsFormatter = new EsmRenderingFormatter(this.fs, reflectionHost, bundle.isCore);
|
|
@@ -4554,8 +4562,6 @@ var Transformer = class {
|
|
|
4554
4562
|
}
|
|
4555
4563
|
analyzeProgram(reflectionHost, bundle) {
|
|
4556
4564
|
const referencesRegistry = new NgccReferencesRegistry(reflectionHost);
|
|
4557
|
-
const switchMarkerAnalyzer = new SwitchMarkerAnalyzer(reflectionHost, bundle.entryPoint.packagePath);
|
|
4558
|
-
const switchMarkerAnalyses = switchMarkerAnalyzer.analyzeProgram(bundle.src.program);
|
|
4559
4565
|
const diagnostics = [];
|
|
4560
4566
|
const decorationAnalyzer = new DecorationAnalyzer(this.fs, bundle, reflectionHost, referencesRegistry, (diagnostic) => diagnostics.push(diagnostic), this.tsConfig);
|
|
4561
4567
|
const decorationAnalyses = decorationAnalyzer.analyzeProgram();
|
|
@@ -4565,7 +4571,6 @@ var Transformer = class {
|
|
|
4565
4571
|
const privateDeclarationsAnalyses = privateDeclarationsAnalyzer.analyzeProgram(bundle.src.program);
|
|
4566
4572
|
return {
|
|
4567
4573
|
decorationAnalyses,
|
|
4568
|
-
switchMarkerAnalyses,
|
|
4569
4574
|
privateDeclarationsAnalyses,
|
|
4570
4575
|
moduleWithProvidersAnalyses,
|
|
4571
4576
|
diagnostics
|
|
@@ -4573,7 +4578,7 @@ var Transformer = class {
|
|
|
4573
4578
|
}
|
|
4574
4579
|
};
|
|
4575
4580
|
function hasErrors(diagnostics) {
|
|
4576
|
-
return diagnostics.some((d) => d.category ===
|
|
4581
|
+
return diagnostics.some((d) => d.category === ts21.DiagnosticCategory.Error);
|
|
4577
4582
|
}
|
|
4578
4583
|
|
|
4579
4584
|
// bazel-out/darwin-fastbuild/bin/packages/compiler-cli/ngcc/src/execution/create_compile_function.mjs
|
|
@@ -4592,12 +4597,12 @@ function getCreateCompileFn(fileSystem, logger, fileWriter, enableI18nLegacyMess
|
|
|
4592
4597
|
onTaskCompleted(task, 1, `property \`${formatProperty}\` pointing to a missing or empty file: ${formatPath}`);
|
|
4593
4598
|
return;
|
|
4594
4599
|
}
|
|
4595
|
-
logger.info(
|
|
4600
|
+
logger.info(`- ${entryPoint.name} [${formatProperty}/${format}] (${entryPoint.repositoryUrl})`);
|
|
4596
4601
|
const bundle = makeEntryPointBundle(fileSystem, entryPoint, sharedFileCache, moduleResolutionCache, formatPath, isCore, format, processDts, pathMappings, true, enableI18nLegacyMessageIdFormat);
|
|
4597
4602
|
const result = transformer.transform(bundle);
|
|
4598
4603
|
if (result.success) {
|
|
4599
4604
|
if (result.diagnostics.length > 0) {
|
|
4600
|
-
logger.warn(replaceTsWithNgInErrors(
|
|
4605
|
+
logger.warn(replaceTsWithNgInErrors(ts22.formatDiagnosticsWithColorAndContext(result.diagnostics, bundle.src.host)));
|
|
4601
4606
|
}
|
|
4602
4607
|
const writeBundle = () => {
|
|
4603
4608
|
fileWriter.writeBundle(bundle, result.transformedFiles, formatPropertiesToMarkAsProcessed);
|
|
@@ -4607,7 +4612,7 @@ function getCreateCompileFn(fileSystem, logger, fileWriter, enableI18nLegacyMess
|
|
|
4607
4612
|
const beforeWritingResult = beforeWritingFiles(result.transformedFiles);
|
|
4608
4613
|
return beforeWritingResult instanceof Promise ? beforeWritingResult.then(writeBundle) : writeBundle();
|
|
4609
4614
|
} else {
|
|
4610
|
-
const errors = replaceTsWithNgInErrors(
|
|
4615
|
+
const errors = replaceTsWithNgInErrors(ts22.formatDiagnosticsWithColorAndContext(result.diagnostics, bundle.src.host));
|
|
4611
4616
|
onTaskCompleted(task, 1, `compilation errors:
|
|
4612
4617
|
${errors}`);
|
|
4613
4618
|
}
|
|
@@ -5091,4 +5096,4 @@ export {
|
|
|
5091
5096
|
* Use of this source code is governed by an MIT-style license that can be
|
|
5092
5097
|
* found in the LICENSE file at https://angular.io/license
|
|
5093
5098
|
*/
|
|
5094
|
-
//# sourceMappingURL=chunk-
|
|
5099
|
+
//# sourceMappingURL=chunk-BXWQHEIB.js.map
|