@angular/compiler-cli 13.1.0-next.2 → 13.1.0-next.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/{chunk-S3QIIFH7.js → chunk-4EDYFHXN.js} +6 -3
- package/bundles/chunk-4EDYFHXN.js.map +6 -0
- package/bundles/{chunk-2DL256T3.js → chunk-7HBAJSZA.js} +403 -402
- package/bundles/chunk-7HBAJSZA.js.map +6 -0
- package/bundles/{chunk-BUHTODFL.js → chunk-7HVF6UHR.js} +2 -2
- package/bundles/{chunk-BUHTODFL.js.map → chunk-7HVF6UHR.js.map} +0 -0
- package/bundles/{chunk-VKIZ4TCJ.js → chunk-COAETSNP.js} +6227 -10693
- package/bundles/chunk-COAETSNP.js.map +6 -0
- package/bundles/{chunk-WYO7JO2T.js → chunk-HDZS2JG2.js} +6 -2
- package/bundles/chunk-HDZS2JG2.js.map +6 -0
- package/bundles/{chunk-MIQ5UCHZ.js → chunk-IESRH26X.js} +26 -5
- package/bundles/chunk-IESRH26X.js.map +6 -0
- package/bundles/{chunk-PBA67OV4.js → chunk-JJMLEEKA.js} +28 -4
- package/bundles/chunk-JJMLEEKA.js.map +6 -0
- package/bundles/{chunk-JNWO3JB2.js → chunk-MFCLQBFK.js} +4 -4
- package/bundles/{chunk-JNWO3JB2.js.map → chunk-MFCLQBFK.js.map} +1 -1
- package/bundles/{chunk-WOC6KEUY.js → chunk-UIKTHF6Z.js} +6 -6
- package/bundles/{chunk-WOC6KEUY.js.map → chunk-UIKTHF6Z.js.map} +1 -1
- package/bundles/index.js +6 -55
- package/bundles/index.js.map +1 -1
- package/bundles/linker/babel/index.js +2 -2
- package/bundles/linker/index.js +2 -2
- package/bundles/ngcc/index.js +6 -7
- package/bundles/ngcc/index.js.map +1 -1
- package/bundles/ngcc/main-ngcc.js +6 -7
- package/bundles/ngcc/main-ngcc.js.map +1 -1
- package/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js +5 -6
- package/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js.map +1 -1
- package/bundles/private/migrations.js +3 -3
- package/bundles/private/tooling.js +2 -3
- package/bundles/src/bin/ng_xi18n.js +5 -6
- package/bundles/src/bin/ng_xi18n.js.map +1 -1
- package/bundles/src/bin/ngc.js +5 -6
- package/bundles/src/bin/ngc.js.map +1 -1
- package/bundles_metadata.json +1 -1
- package/index.d.ts +0 -1
- package/ngcc/src/host/delegating_host.d.ts +1 -2
- package/ngcc/src/host/esm2015_host.d.ts +1 -8
- package/ngcc/src/host/ngcc_host.d.ts +0 -13
- package/ngcc/src/host/umd_host.d.ts +3 -0
- package/ngcc/src/packages/build_marker.d.ts +1 -1
- package/ngcc/src/packages/transformer.d.ts +0 -2
- package/ngcc/src/rendering/esm_rendering_formatter.d.ts +1 -5
- package/ngcc/src/rendering/renderer.d.ts +2 -3
- package/ngcc/src/rendering/rendering_formatter.d.ts +0 -2
- package/ngcc/src/utils.d.ts +0 -7
- package/package.json +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_driver/src/ts_create_program_driver.d.ts +2 -1
- package/src/ngtsc/reflection/src/host.d.ts +1 -1
- package/src/ngtsc/util/src/typescript.d.ts +10 -0
- package/src/transformers/compiler_host.d.ts +1 -97
- package/src/transformers/program.d.ts +0 -19
- package/src/transformers/util.d.ts +1 -18
- package/src/{diagnostics/typescript_version.d.ts → version_helpers.d.ts} +1 -1
- package/bundles/chunk-2DL256T3.js.map +0 -6
- package/bundles/chunk-ACINBTQB.js +0 -43
- package/bundles/chunk-ACINBTQB.js.map +0 -6
- package/bundles/chunk-MIQ5UCHZ.js.map +0 -6
- package/bundles/chunk-PBA67OV4.js.map +0 -6
- package/bundles/chunk-S3QIIFH7.js.map +0 -6
- package/bundles/chunk-VKIZ4TCJ.js.map +0 -6
- package/bundles/chunk-WYO7JO2T.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-COAETSNP.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-IESRH26X.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-4EDYFHXN.js";
|
|
48
48
|
import {
|
|
49
49
|
ConsoleLogger,
|
|
50
50
|
LogLevel
|
|
@@ -71,7 +71,7 @@ import {
|
|
|
71
71
|
translateStatement,
|
|
72
72
|
translateType,
|
|
73
73
|
validateAndRewriteCoreSymbol
|
|
74
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-HDZS2JG2.js";
|
|
75
75
|
import {
|
|
76
76
|
LogicalFileSystem,
|
|
77
77
|
NgtscCompilerHost,
|
|
@@ -93,13 +93,13 @@ import {
|
|
|
93
93
|
} from "./chunk-XA5IZLLC.js";
|
|
94
94
|
|
|
95
95
|
// bazel-out/k8-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/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/packages/entry_point.mjs
|
|
99
|
-
import
|
|
99
|
+
import ts7 from "typescript";
|
|
100
100
|
|
|
101
101
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/host/umd_host.mjs
|
|
102
|
-
import
|
|
102
|
+
import ts6 from "typescript";
|
|
103
103
|
|
|
104
104
|
// bazel-out/k8-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/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/host/esm2015_host.mjs
|
|
274
|
-
import
|
|
262
|
+
import ts4 from "typescript";
|
|
275
263
|
|
|
276
264
|
// bazel-out/k8-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/k8-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/k8-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/k8-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/k8-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/k8-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,176 @@ 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
|
}
|
|
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)
|
|
2245
|
+
});
|
|
2246
|
+
currentNode = currentNode.whenFalse;
|
|
2247
|
+
}
|
|
2248
|
+
factoryCalls.push({
|
|
2249
|
+
condition: null,
|
|
2250
|
+
factoryCall: getFunctionCallFromExpression(currentNode)
|
|
2251
|
+
});
|
|
2252
|
+
return factoryCalls;
|
|
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
|
+
}
|
|
2228
2328
|
function getImportsOfUmdModule(umdModule) {
|
|
2229
2329
|
const imports = [];
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2330
|
+
const cjsFactoryCall = umdModule.factoryCalls.cjsCallForImports;
|
|
2331
|
+
const depStartIndex = cjsFactoryCall.arguments.findIndex((arg) => isRequireCall(arg));
|
|
2332
|
+
if (depStartIndex !== -1) {
|
|
2333
|
+
for (let i = depStartIndex; i < umdModule.factoryFn.parameters.length; i++) {
|
|
2334
|
+
imports.push({
|
|
2335
|
+
parameter: umdModule.factoryFn.parameters[i],
|
|
2336
|
+
path: getRequiredModulePath(cjsFactoryCall, i)
|
|
2337
|
+
});
|
|
2338
|
+
}
|
|
2235
2339
|
}
|
|
2236
2340
|
return imports;
|
|
2237
2341
|
}
|
|
2238
|
-
function getRequiredModulePath(
|
|
2239
|
-
const
|
|
2240
|
-
if (!
|
|
2241
|
-
throw new Error(
|
|
2242
|
-
|
|
2243
|
-
const modulePaths = [];
|
|
2244
|
-
findModulePaths(statement.expression);
|
|
2245
|
-
return modulePaths[paramIndex - 1];
|
|
2246
|
-
function findModulePaths(node) {
|
|
2247
|
-
if (isRequireCall(node)) {
|
|
2248
|
-
const argument = node.arguments[0];
|
|
2249
|
-
if (ts7.isStringLiteral(argument)) {
|
|
2250
|
-
modulePaths.push(argument.text);
|
|
2251
|
-
}
|
|
2252
|
-
} else {
|
|
2253
|
-
node.forEachChild(findModulePaths);
|
|
2254
|
-
}
|
|
2342
|
+
function getRequiredModulePath(cjsFactoryCall, paramIndex) {
|
|
2343
|
+
const requireCall = cjsFactoryCall.arguments[paramIndex];
|
|
2344
|
+
if (requireCall !== void 0 && !isRequireCall(requireCall)) {
|
|
2345
|
+
throw new Error(`Argument at index ${paramIndex} of UMD factory call is not a \`require\` call with a single string argument:
|
|
2346
|
+
` + cjsFactoryCall.getText());
|
|
2255
2347
|
}
|
|
2348
|
+
return requireCall.arguments[0].text;
|
|
2256
2349
|
}
|
|
2257
2350
|
function isExportsIdentifier(node) {
|
|
2258
|
-
return
|
|
2351
|
+
return ts6.isIdentifier(node) && node.text === "exports";
|
|
2259
2352
|
}
|
|
2260
2353
|
|
|
2261
2354
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/packages/entry_point.mjs
|
|
@@ -2356,11 +2449,11 @@ function sniffModuleFormat(fs, sourceFilePath) {
|
|
|
2356
2449
|
if (resolvedPath === null) {
|
|
2357
2450
|
return void 0;
|
|
2358
2451
|
}
|
|
2359
|
-
const sourceFile =
|
|
2452
|
+
const sourceFile = ts7.createSourceFile(sourceFilePath, fs.readFile(resolvedPath), ts7.ScriptTarget.ES5);
|
|
2360
2453
|
if (sourceFile.statements.length === 0) {
|
|
2361
2454
|
return void 0;
|
|
2362
2455
|
}
|
|
2363
|
-
if (
|
|
2456
|
+
if (ts7.isExternalModule(sourceFile)) {
|
|
2364
2457
|
return "esm5";
|
|
2365
2458
|
} else if (parseStatementForUmdModule(sourceFile.statements[0]) !== null) {
|
|
2366
2459
|
return "umd";
|
|
@@ -2427,20 +2520,20 @@ var DtsProcessing;
|
|
|
2427
2520
|
var TaskDependencies = Map;
|
|
2428
2521
|
|
|
2429
2522
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/packages/bundle_program.mjs
|
|
2430
|
-
import
|
|
2523
|
+
import ts9 from "typescript";
|
|
2431
2524
|
|
|
2432
2525
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/packages/patch_ts_expando_initializer.mjs
|
|
2433
|
-
import
|
|
2526
|
+
import ts8 from "typescript";
|
|
2434
2527
|
function patchTsGetExpandoInitializer() {
|
|
2435
2528
|
if (isTs31778GetExpandoInitializerFixed()) {
|
|
2436
2529
|
return null;
|
|
2437
2530
|
}
|
|
2438
|
-
const originalGetExpandoInitializer =
|
|
2531
|
+
const originalGetExpandoInitializer = ts8.getExpandoInitializer;
|
|
2439
2532
|
if (originalGetExpandoInitializer === void 0) {
|
|
2440
2533
|
throw makeUnsupportedTypeScriptError();
|
|
2441
2534
|
}
|
|
2442
|
-
|
|
2443
|
-
if (
|
|
2535
|
+
ts8.getExpandoInitializer = (initializer, isPrototypeAssignment) => {
|
|
2536
|
+
if (ts8.isParenthesizedExpression(initializer) && ts8.isCallExpression(initializer.expression)) {
|
|
2444
2537
|
initializer = initializer.expression;
|
|
2445
2538
|
}
|
|
2446
2539
|
return originalGetExpandoInitializer(initializer, isPrototypeAssignment);
|
|
@@ -2449,7 +2542,7 @@ function patchTsGetExpandoInitializer() {
|
|
|
2449
2542
|
}
|
|
2450
2543
|
function restoreGetExpandoInitializer(originalGetExpandoInitializer) {
|
|
2451
2544
|
if (originalGetExpandoInitializer !== null) {
|
|
2452
|
-
|
|
2545
|
+
ts8.getExpandoInitializer = originalGetExpandoInitializer;
|
|
2453
2546
|
}
|
|
2454
2547
|
}
|
|
2455
2548
|
var ts31778FixedResult = null;
|
|
@@ -2480,7 +2573,7 @@ function checkIfExpandoPropertyIsPresent() {
|
|
|
2480
2573
|
}());
|
|
2481
2574
|
A.expando = true;
|
|
2482
2575
|
}());`;
|
|
2483
|
-
const sourceFile =
|
|
2576
|
+
const sourceFile = ts8.createSourceFile("test.js", sourceText, ts8.ScriptTarget.ES5, true, ts8.ScriptKind.JS);
|
|
2484
2577
|
const host = {
|
|
2485
2578
|
getSourceFile() {
|
|
2486
2579
|
return sourceFile;
|
|
@@ -2513,14 +2606,14 @@ function checkIfExpandoPropertyIsPresent() {
|
|
|
2513
2606
|
}
|
|
2514
2607
|
};
|
|
2515
2608
|
const options = { noResolve: true, noLib: true, noEmit: true, allowJs: true };
|
|
2516
|
-
const program =
|
|
2609
|
+
const program = ts8.createProgram(["test.js"], options, host);
|
|
2517
2610
|
function visitor(node) {
|
|
2518
|
-
if (
|
|
2611
|
+
if (ts8.isVariableDeclaration(node) && hasNameIdentifier(node) && node.name.text === "A") {
|
|
2519
2612
|
return node;
|
|
2520
2613
|
}
|
|
2521
|
-
return
|
|
2614
|
+
return ts8.forEachChild(node, visitor);
|
|
2522
2615
|
}
|
|
2523
|
-
const declaration =
|
|
2616
|
+
const declaration = ts8.forEachChild(sourceFile, visitor);
|
|
2524
2617
|
if (declaration === void 0) {
|
|
2525
2618
|
throw new Error("Unable to find declaration of outer A");
|
|
2526
2619
|
}
|
|
@@ -2539,7 +2632,7 @@ function makeBundleProgram(fs, isCore, pkg, path, r3FileName, options, host, add
|
|
|
2539
2632
|
const r3SymbolsPath = isCore ? findR3SymbolsPath(fs, fs.dirname(path), r3FileName) : null;
|
|
2540
2633
|
let rootPaths = r3SymbolsPath ? [path, r3SymbolsPath, ...additionalFiles] : [path, ...additionalFiles];
|
|
2541
2634
|
const originalGetExpandoInitializer = patchTsGetExpandoInitializer();
|
|
2542
|
-
const program =
|
|
2635
|
+
const program = ts9.createProgram(rootPaths, options, host);
|
|
2543
2636
|
program.getTypeChecker();
|
|
2544
2637
|
restoreGetExpandoInitializer(originalGetExpandoInitializer);
|
|
2545
2638
|
const file = program.getSourceFile(path);
|
|
@@ -2565,7 +2658,7 @@ function findR3SymbolsPath(fs, directory, filename) {
|
|
|
2565
2658
|
}
|
|
2566
2659
|
|
|
2567
2660
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/packages/ngcc_compiler_host.mjs
|
|
2568
|
-
import
|
|
2661
|
+
import ts10 from "typescript";
|
|
2569
2662
|
var NgccSourcesCompilerHost = class extends NgtscCompilerHost {
|
|
2570
2663
|
constructor(fs, options, cache, moduleResolutionCache, packagePath) {
|
|
2571
2664
|
super(fs, options);
|
|
@@ -2578,14 +2671,14 @@ var NgccSourcesCompilerHost = class extends NgtscCompilerHost {
|
|
|
2578
2671
|
}
|
|
2579
2672
|
resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference) {
|
|
2580
2673
|
return moduleNames.map((moduleName) => {
|
|
2581
|
-
const { resolvedModule } =
|
|
2582
|
-
if ((resolvedModule == null ? void 0 : resolvedModule.extension) ===
|
|
2674
|
+
const { resolvedModule } = ts10.resolveModuleName(moduleName, containingFile, this.options, this, this.moduleResolutionCache, redirectedReference);
|
|
2675
|
+
if ((resolvedModule == null ? void 0 : resolvedModule.extension) === ts10.Extension.Dts && containingFile.endsWith(".js") && isRelativePath(moduleName)) {
|
|
2583
2676
|
const jsFile = resolvedModule.resolvedFileName.replace(/\.d\.ts$/, ".js");
|
|
2584
2677
|
if (this.fileExists(jsFile)) {
|
|
2585
|
-
return __spreadProps(__spreadValues({}, resolvedModule), { resolvedFileName: jsFile, extension:
|
|
2678
|
+
return __spreadProps(__spreadValues({}, resolvedModule), { resolvedFileName: jsFile, extension: ts10.Extension.Js });
|
|
2586
2679
|
}
|
|
2587
2680
|
}
|
|
2588
|
-
if ((resolvedModule == null ? void 0 : resolvedModule.extension) ===
|
|
2681
|
+
if ((resolvedModule == null ? void 0 : resolvedModule.extension) === ts10.Extension.Js && !isWithinPackage(this.packagePath, this.fs.resolve(resolvedModule.resolvedFileName))) {
|
|
2589
2682
|
return void 0;
|
|
2590
2683
|
}
|
|
2591
2684
|
return resolvedModule;
|
|
@@ -2603,14 +2696,14 @@ var NgccDtsCompilerHost = class extends NgtscCompilerHost {
|
|
|
2603
2696
|
}
|
|
2604
2697
|
resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference) {
|
|
2605
2698
|
return moduleNames.map((moduleName) => {
|
|
2606
|
-
const { resolvedModule } =
|
|
2699
|
+
const { resolvedModule } = ts10.resolveModuleName(moduleName, containingFile, this.options, this, this.moduleResolutionCache, redirectedReference);
|
|
2607
2700
|
return resolvedModule;
|
|
2608
2701
|
});
|
|
2609
2702
|
}
|
|
2610
2703
|
};
|
|
2611
2704
|
|
|
2612
2705
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/packages/source_file_cache.mjs
|
|
2613
|
-
import
|
|
2706
|
+
import ts11 from "typescript";
|
|
2614
2707
|
var SharedFileCache = class {
|
|
2615
2708
|
constructor(fs) {
|
|
2616
2709
|
this.fs = fs;
|
|
@@ -2632,7 +2725,7 @@ var SharedFileCache = class {
|
|
|
2632
2725
|
if (content === void 0) {
|
|
2633
2726
|
return void 0;
|
|
2634
2727
|
}
|
|
2635
|
-
const sf =
|
|
2728
|
+
const sf = ts11.createSourceFile(absPath, content, ts11.ScriptTarget.ES2015);
|
|
2636
2729
|
this.sfCache.set(absPath, sf);
|
|
2637
2730
|
}
|
|
2638
2731
|
return this.sfCache.get(absPath);
|
|
@@ -2643,7 +2736,7 @@ var SharedFileCache = class {
|
|
|
2643
2736
|
return void 0;
|
|
2644
2737
|
}
|
|
2645
2738
|
if (!this.sfCache.has(absPath) || this.sfCache.get(absPath).text !== content) {
|
|
2646
|
-
const sf =
|
|
2739
|
+
const sf = ts11.createSourceFile(absPath, content, ts11.ScriptTarget.ES2015);
|
|
2647
2740
|
this.sfCache.set(absPath, sf);
|
|
2648
2741
|
}
|
|
2649
2742
|
return this.sfCache.get(absPath);
|
|
@@ -2693,7 +2786,7 @@ var EntryPointFileCache = class {
|
|
|
2693
2786
|
if (content === void 0) {
|
|
2694
2787
|
return void 0;
|
|
2695
2788
|
}
|
|
2696
|
-
const sf =
|
|
2789
|
+
const sf = ts11.createSourceFile(fileName, content, languageVersion);
|
|
2697
2790
|
this.sfCache.set(absPath, sf);
|
|
2698
2791
|
return sf;
|
|
2699
2792
|
}
|
|
@@ -2705,7 +2798,7 @@ function readFile(absPath, fs) {
|
|
|
2705
2798
|
return fs.readFile(absPath);
|
|
2706
2799
|
}
|
|
2707
2800
|
function createModuleResolutionCache(fs) {
|
|
2708
|
-
return
|
|
2801
|
+
return ts11.createModuleResolutionCache(fs.pwd(), (fileName) => {
|
|
2709
2802
|
return fs.isCaseSensitive() ? fileName : fileName.toLowerCase();
|
|
2710
2803
|
});
|
|
2711
2804
|
}
|
|
@@ -2752,13 +2845,13 @@ function computePotentialDtsFilesFromJsFiles(fs, srcProgram, formatPath, typings
|
|
|
2752
2845
|
}
|
|
2753
2846
|
|
|
2754
2847
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/packages/transformer.mjs
|
|
2755
|
-
import
|
|
2848
|
+
import ts21 from "typescript";
|
|
2756
2849
|
|
|
2757
2850
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/analysis/decoration_analyzer.mjs
|
|
2758
2851
|
import { ConstantPool } from "@angular/compiler";
|
|
2759
2852
|
|
|
2760
2853
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/migrations/utils.mjs
|
|
2761
|
-
import
|
|
2854
|
+
import ts12 from "typescript";
|
|
2762
2855
|
function isClassDeclaration(clazz) {
|
|
2763
2856
|
return isNamedClassDeclaration(clazz) || isNamedFunctionDeclaration(clazz) || isNamedVariableDeclaration(clazz);
|
|
2764
2857
|
}
|
|
@@ -2783,7 +2876,7 @@ function createDirectiveDecorator(clazz, metadata) {
|
|
|
2783
2876
|
if (metadata.exportAs !== null) {
|
|
2784
2877
|
metaArgs.push(property("exportAs", metadata.exportAs.join(", ")));
|
|
2785
2878
|
}
|
|
2786
|
-
args.push(reifySourceFile(
|
|
2879
|
+
args.push(reifySourceFile(ts12.createObjectLiteral(metaArgs)));
|
|
2787
2880
|
}
|
|
2788
2881
|
return {
|
|
2789
2882
|
name: "Directive",
|
|
@@ -2811,7 +2904,7 @@ function createComponentDecorator(clazz, metadata) {
|
|
|
2811
2904
|
node: null,
|
|
2812
2905
|
synthesizedFor: clazz.name,
|
|
2813
2906
|
args: [
|
|
2814
|
-
reifySourceFile(
|
|
2907
|
+
reifySourceFile(ts12.createObjectLiteral(metaArgs))
|
|
2815
2908
|
]
|
|
2816
2909
|
};
|
|
2817
2910
|
}
|
|
@@ -2826,16 +2919,16 @@ function createInjectableDecorator(clazz) {
|
|
|
2826
2919
|
};
|
|
2827
2920
|
}
|
|
2828
2921
|
function property(name, value) {
|
|
2829
|
-
return
|
|
2922
|
+
return ts12.createPropertyAssignment(name, ts12.createStringLiteral(value));
|
|
2830
2923
|
}
|
|
2831
|
-
var EMPTY_SF =
|
|
2924
|
+
var EMPTY_SF = ts12.createSourceFile("(empty)", "", ts12.ScriptTarget.Latest);
|
|
2832
2925
|
function reifySourceFile(expr) {
|
|
2833
|
-
const printer =
|
|
2834
|
-
const exprText = printer.printNode(
|
|
2835
|
-
const sf =
|
|
2926
|
+
const printer = ts12.createPrinter();
|
|
2927
|
+
const exprText = printer.printNode(ts12.EmitHint.Unspecified, expr, EMPTY_SF);
|
|
2928
|
+
const sf = ts12.createSourceFile("(synthetic)", `const expr = ${exprText};`, ts12.ScriptTarget.Latest, true, ts12.ScriptKind.JS);
|
|
2836
2929
|
const stmt = sf.statements[0];
|
|
2837
|
-
if (!
|
|
2838
|
-
throw new Error(`Expected VariableStatement, got ${
|
|
2930
|
+
if (!ts12.isVariableStatement(stmt)) {
|
|
2931
|
+
throw new Error(`Expected VariableStatement, got ${ts12.SyntaxKind[stmt.kind]}`);
|
|
2839
2932
|
}
|
|
2840
2933
|
return stmt.declarationList.declarations[0].initializer;
|
|
2841
2934
|
}
|
|
@@ -3014,7 +3107,7 @@ function determineBaseClass(clazz, host) {
|
|
|
3014
3107
|
}
|
|
3015
3108
|
|
|
3016
3109
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/analysis/migration_host.mjs
|
|
3017
|
-
import
|
|
3110
|
+
import ts13 from "typescript";
|
|
3018
3111
|
var DefaultMigrationHost = class {
|
|
3019
3112
|
constructor(reflectionHost, metadata, evaluator, compiler, entryPointPath) {
|
|
3020
3113
|
this.reflectionHost = reflectionHost;
|
|
@@ -3045,14 +3138,14 @@ function createMigrationDiagnostic(diagnostic, source, decorator) {
|
|
|
3045
3138
|
const clone = __spreadValues({}, diagnostic);
|
|
3046
3139
|
const chain = [{
|
|
3047
3140
|
messageText: `Occurs for @${decorator.name} decorator inserted by an automatic migration`,
|
|
3048
|
-
category:
|
|
3141
|
+
category: ts13.DiagnosticCategory.Message,
|
|
3049
3142
|
code: 0
|
|
3050
3143
|
}];
|
|
3051
3144
|
if (decorator.args !== null) {
|
|
3052
3145
|
const args = decorator.args.map((arg) => arg.getText()).join(", ");
|
|
3053
3146
|
chain.push({
|
|
3054
3147
|
messageText: `@${decorator.name}(${args})`,
|
|
3055
|
-
category:
|
|
3148
|
+
category: ts13.DiagnosticCategory.Message,
|
|
3056
3149
|
code: 0
|
|
3057
3150
|
});
|
|
3058
3151
|
}
|
|
@@ -3278,7 +3371,7 @@ var DecorationAnalyzer = class {
|
|
|
3278
3371
|
};
|
|
3279
3372
|
|
|
3280
3373
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/analysis/module_with_providers_analyzer.mjs
|
|
3281
|
-
import
|
|
3374
|
+
import ts14 from "typescript";
|
|
3282
3375
|
var ModuleWithProvidersAnalyses = Map;
|
|
3283
3376
|
var ModuleWithProvidersAnalyzer = class {
|
|
3284
3377
|
constructor(host, typeChecker, referencesRegistry, processDts) {
|
|
@@ -3300,7 +3393,7 @@ var ModuleWithProvidersAnalyzer = class {
|
|
|
3300
3393
|
if (this.processDts) {
|
|
3301
3394
|
const dtsFn = this.getDtsModuleWithProvidersFunction(fn);
|
|
3302
3395
|
const dtsFnType = dtsFn.declaration.type;
|
|
3303
|
-
const typeParam = dtsFnType &&
|
|
3396
|
+
const typeParam = dtsFnType && ts14.isTypeReferenceNode(dtsFnType) && dtsFnType.typeArguments && dtsFnType.typeArguments[0] || null;
|
|
3304
3397
|
if (!typeParam || isAnyKeyword(typeParam)) {
|
|
3305
3398
|
const dtsFile = dtsFn.declaration.getSourceFile();
|
|
3306
3399
|
const analysis = analyses.has(dtsFile) ? analyses.get(dtsFile) : [];
|
|
@@ -3345,7 +3438,7 @@ var ModuleWithProvidersAnalyzer = class {
|
|
|
3345
3438
|
return infos;
|
|
3346
3439
|
}
|
|
3347
3440
|
parseForModuleWithProviders(name, node, implementation = node, container = null) {
|
|
3348
|
-
if (implementation === null || !
|
|
3441
|
+
if (implementation === null || !ts14.isFunctionDeclaration(implementation) && !ts14.isMethodDeclaration(implementation) && !ts14.isFunctionExpression(implementation)) {
|
|
3349
3442
|
return null;
|
|
3350
3443
|
}
|
|
3351
3444
|
const declaration = implementation;
|
|
@@ -3358,7 +3451,7 @@ var ModuleWithProvidersAnalyzer = class {
|
|
|
3358
3451
|
return null;
|
|
3359
3452
|
}
|
|
3360
3453
|
const lastStatement = body[body.length - 1];
|
|
3361
|
-
if (!
|
|
3454
|
+
if (!ts14.isReturnStatement(lastStatement) || lastStatement.expression === void 0) {
|
|
3362
3455
|
return null;
|
|
3363
3456
|
}
|
|
3364
3457
|
const result = this.evaluator.evaluate(lastStatement.expression);
|
|
@@ -3380,7 +3473,7 @@ var ModuleWithProvidersAnalyzer = class {
|
|
|
3380
3473
|
const containerClass = fn.container && this.host.getClassSymbol(fn.container);
|
|
3381
3474
|
if (containerClass) {
|
|
3382
3475
|
const dtsClass = this.host.getDtsDeclaration(containerClass.declaration.valueDeclaration);
|
|
3383
|
-
dtsFn = dtsClass &&
|
|
3476
|
+
dtsFn = dtsClass && ts14.isClassDeclaration(dtsClass) ? dtsClass.members.find((member) => ts14.isMethodDeclaration(member) && ts14.isIdentifier(member.name) && member.name.text === fn.name) : null;
|
|
3384
3477
|
} else {
|
|
3385
3478
|
dtsFn = this.host.getDtsDeclaration(fn.declaration);
|
|
3386
3479
|
}
|
|
@@ -3410,10 +3503,10 @@ var ModuleWithProvidersAnalyzer = class {
|
|
|
3410
3503
|
}
|
|
3411
3504
|
};
|
|
3412
3505
|
function isFunctionOrMethod(declaration) {
|
|
3413
|
-
return
|
|
3506
|
+
return ts14.isFunctionDeclaration(declaration) || ts14.isMethodDeclaration(declaration);
|
|
3414
3507
|
}
|
|
3415
3508
|
function isAnyKeyword(typeParam) {
|
|
3416
|
-
return typeParam.kind ===
|
|
3509
|
+
return typeParam.kind === ts14.SyntaxKind.AnyKeyword;
|
|
3417
3510
|
}
|
|
3418
3511
|
|
|
3419
3512
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/analysis/ngcc_references_registry.mjs
|
|
@@ -3478,27 +3571,8 @@ var PrivateDeclarationsAnalyzer = class {
|
|
|
3478
3571
|
}
|
|
3479
3572
|
};
|
|
3480
3573
|
|
|
3481
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/analysis/switch_marker_analyzer.mjs
|
|
3482
|
-
var SwitchMarkerAnalyses = Map;
|
|
3483
|
-
var SwitchMarkerAnalyzer = class {
|
|
3484
|
-
constructor(host, packagePath) {
|
|
3485
|
-
this.host = host;
|
|
3486
|
-
this.packagePath = packagePath;
|
|
3487
|
-
}
|
|
3488
|
-
analyzeProgram(program) {
|
|
3489
|
-
const analyzedFiles = new SwitchMarkerAnalyses();
|
|
3490
|
-
program.getSourceFiles().filter((sourceFile) => isWithinPackage(this.packagePath, absoluteFromSourceFile(sourceFile))).forEach((sourceFile) => {
|
|
3491
|
-
const declarations = this.host.getSwitchableDeclarations(sourceFile);
|
|
3492
|
-
if (declarations.length) {
|
|
3493
|
-
analyzedFiles.set(sourceFile, { sourceFile, declarations });
|
|
3494
|
-
}
|
|
3495
|
-
});
|
|
3496
|
-
return analyzedFiles;
|
|
3497
|
-
}
|
|
3498
|
-
};
|
|
3499
|
-
|
|
3500
3574
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/host/commonjs_host.mjs
|
|
3501
|
-
import
|
|
3575
|
+
import ts15 from "typescript";
|
|
3502
3576
|
var CommonJsReflectionHost = class extends Esm5ReflectionHost {
|
|
3503
3577
|
constructor(logger, isCore, src, dts = null) {
|
|
3504
3578
|
super(logger, isCore, src, dts);
|
|
@@ -3572,7 +3646,7 @@ var CommonJsReflectionHost = class extends Esm5ReflectionHost {
|
|
|
3572
3646
|
}
|
|
3573
3647
|
extractCommonJsWildcardReexports(statement, containingFile) {
|
|
3574
3648
|
const reexportArg = statement.expression.arguments[0];
|
|
3575
|
-
const requireCall = isRequireCall(reexportArg) ? reexportArg :
|
|
3649
|
+
const requireCall = isRequireCall(reexportArg) ? reexportArg : ts15.isIdentifier(reexportArg) ? findRequireCallReference(reexportArg, this.checker) : null;
|
|
3576
3650
|
if (requireCall === null) {
|
|
3577
3651
|
return [];
|
|
3578
3652
|
}
|
|
@@ -3655,7 +3729,7 @@ var CommonJsReflectionHost = class extends Esm5ReflectionHost {
|
|
|
3655
3729
|
const moduleInfo = this.compilerHost.resolveModuleNames([moduleName], containingFile.fileName, void 0, void 0, this.program.getCompilerOptions())[0];
|
|
3656
3730
|
return moduleInfo && this.program.getSourceFile(absoluteFrom(moduleInfo.resolvedFileName));
|
|
3657
3731
|
} else {
|
|
3658
|
-
const moduleInfo =
|
|
3732
|
+
const moduleInfo = ts15.resolveModuleName(moduleName, containingFile.fileName, this.program.getCompilerOptions(), this.compilerHost);
|
|
3659
3733
|
return moduleInfo.resolvedModule && this.program.getSourceFile(absoluteFrom(moduleInfo.resolvedModule.resolvedFileName));
|
|
3660
3734
|
}
|
|
3661
3735
|
}
|
|
@@ -3771,9 +3845,6 @@ var DelegatingReflectionHost = class {
|
|
|
3771
3845
|
getDecoratorsOfSymbol(symbol) {
|
|
3772
3846
|
return this.ngccHost.getDecoratorsOfSymbol(symbol);
|
|
3773
3847
|
}
|
|
3774
|
-
getSwitchableDeclarations(module) {
|
|
3775
|
-
return this.ngccHost.getSwitchableDeclarations(module);
|
|
3776
|
-
}
|
|
3777
3848
|
getEndOfClass(classSymbol) {
|
|
3778
3849
|
return this.ngccHost.getEndOfClass(classSymbol);
|
|
3779
3850
|
}
|
|
@@ -3786,13 +3857,13 @@ var DelegatingReflectionHost = class {
|
|
|
3786
3857
|
};
|
|
3787
3858
|
|
|
3788
3859
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/rendering/commonjs_rendering_formatter.mjs
|
|
3789
|
-
import
|
|
3860
|
+
import ts18 from "typescript";
|
|
3790
3861
|
|
|
3791
3862
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/rendering/esm5_rendering_formatter.mjs
|
|
3792
|
-
import
|
|
3863
|
+
import ts17 from "typescript";
|
|
3793
3864
|
|
|
3794
3865
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/rendering/esm_rendering_formatter.mjs
|
|
3795
|
-
import
|
|
3866
|
+
import ts16 from "typescript";
|
|
3796
3867
|
|
|
3797
3868
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/rendering/ngcc_import_rewriter.mjs
|
|
3798
3869
|
var NgccFlatImportRewriter = class {
|
|
@@ -3835,7 +3906,7 @@ var EsmRenderingFormatter = class {
|
|
|
3835
3906
|
this.fs = fs;
|
|
3836
3907
|
this.host = host;
|
|
3837
3908
|
this.isCore = isCore;
|
|
3838
|
-
this.printer =
|
|
3909
|
+
this.printer = ts16.createPrinter({ newLine: ts16.NewLineKind.LineFeed });
|
|
3839
3910
|
}
|
|
3840
3911
|
addImports(output, imports, sf) {
|
|
3841
3912
|
if (imports.length === 0) {
|
|
@@ -3895,14 +3966,14 @@ export {${e.symbolName} as ${e.asAlias}} from '${e.fromModule}';`;
|
|
|
3895
3966
|
}
|
|
3896
3967
|
removeDecorators(output, decoratorsToRemove) {
|
|
3897
3968
|
decoratorsToRemove.forEach((nodesToRemove, containerNode) => {
|
|
3898
|
-
if (
|
|
3969
|
+
if (ts16.isArrayLiteralExpression(containerNode)) {
|
|
3899
3970
|
const items = containerNode.elements;
|
|
3900
3971
|
if (items.length === nodesToRemove.length) {
|
|
3901
3972
|
const statement = findStatement(containerNode);
|
|
3902
3973
|
if (statement) {
|
|
3903
|
-
if (
|
|
3974
|
+
if (ts16.isExpressionStatement(statement)) {
|
|
3904
3975
|
output.remove(statement.getFullStart(), statement.getEnd());
|
|
3905
|
-
} else if (
|
|
3976
|
+
} else if (ts16.isReturnStatement(statement) && statement.expression && isAssignment2(statement.expression)) {
|
|
3906
3977
|
const startOfRemoval = statement.expression.left.getEnd();
|
|
3907
3978
|
const endOfRemoval = getEndExceptSemicolon(statement);
|
|
3908
3979
|
output.remove(startOfRemoval, endOfRemoval);
|
|
@@ -3925,14 +3996,6 @@ export {${e.symbolName} as ${e.asAlias}} from '${e.fromModule}';`;
|
|
|
3925
3996
|
}
|
|
3926
3997
|
});
|
|
3927
3998
|
}
|
|
3928
|
-
rewriteSwitchableDeclarations(outputText, sourceFile, declarations) {
|
|
3929
|
-
declarations.forEach((declaration) => {
|
|
3930
|
-
const start = declaration.initializer.getStart();
|
|
3931
|
-
const end = declaration.initializer.getEnd();
|
|
3932
|
-
const replacement = declaration.initializer.text.replace(PRE_R3_MARKER, POST_R3_MARKER);
|
|
3933
|
-
outputText.overwrite(start, end, replacement);
|
|
3934
|
-
});
|
|
3935
|
-
}
|
|
3936
3999
|
addModuleWithProvidersParams(outputText, moduleWithProviders, importManager) {
|
|
3937
4000
|
moduleWithProviders.forEach((info) => {
|
|
3938
4001
|
const ngModuleName = info.ngModule.node.name.text;
|
|
@@ -3943,7 +4006,7 @@ export {${e.symbolName} as ${e.asAlias}} from '${e.fromModule}';`;
|
|
|
3943
4006
|
const importPath = info.ngModule.ownedByModuleGuess || (declarationFile !== ngModuleFile ? stripExtension2(relativeImport) : null);
|
|
3944
4007
|
const ngModule = generateImportString(importManager, importPath, ngModuleName);
|
|
3945
4008
|
if (info.declaration.type) {
|
|
3946
|
-
const typeName = info.declaration.type &&
|
|
4009
|
+
const typeName = info.declaration.type && ts16.isTypeReferenceNode(info.declaration.type) ? info.declaration.type.typeName : null;
|
|
3947
4010
|
if (this.isCoreModuleWithProvidersType(typeName)) {
|
|
3948
4011
|
outputText.overwrite(info.declaration.type.getStart(), info.declaration.type.getEnd(), `ModuleWithProviders<${ngModule}>`);
|
|
3949
4012
|
} else {
|
|
@@ -3952,32 +4015,32 @@ export {${e.symbolName} as ${e.asAlias}} from '${e.fromModule}';`;
|
|
|
3952
4015
|
}
|
|
3953
4016
|
} else {
|
|
3954
4017
|
const lastToken = info.declaration.getLastToken();
|
|
3955
|
-
const insertPoint = lastToken && lastToken.kind ===
|
|
4018
|
+
const insertPoint = lastToken && lastToken.kind === ts16.SyntaxKind.SemicolonToken ? lastToken.getStart() : info.declaration.getEnd();
|
|
3956
4019
|
outputText.appendLeft(insertPoint, `: ${generateImportString(importManager, "@angular/core", "ModuleWithProviders")}<${ngModule}>`);
|
|
3957
4020
|
}
|
|
3958
4021
|
});
|
|
3959
4022
|
}
|
|
3960
4023
|
printStatement(stmt, sourceFile, importManager) {
|
|
3961
4024
|
const node = translateStatement(stmt, importManager);
|
|
3962
|
-
const code = this.printer.printNode(
|
|
4025
|
+
const code = this.printer.printNode(ts16.EmitHint.Unspecified, node, sourceFile);
|
|
3963
4026
|
return code;
|
|
3964
4027
|
}
|
|
3965
4028
|
findEndOfImports(sf) {
|
|
3966
4029
|
for (const stmt of sf.statements) {
|
|
3967
|
-
if (!
|
|
4030
|
+
if (!ts16.isImportDeclaration(stmt) && !ts16.isImportEqualsDeclaration(stmt) && !ts16.isNamespaceImport(stmt)) {
|
|
3968
4031
|
return stmt.getStart();
|
|
3969
4032
|
}
|
|
3970
4033
|
}
|
|
3971
4034
|
return 0;
|
|
3972
4035
|
}
|
|
3973
4036
|
isCoreModuleWithProvidersType(typeName) {
|
|
3974
|
-
const id = typeName &&
|
|
4037
|
+
const id = typeName && ts16.isIdentifier(typeName) ? this.host.getImportOfIdentifier(typeName) : null;
|
|
3975
4038
|
return id && id.name === "ModuleWithProviders" && (this.isCore || id.from === "@angular/core");
|
|
3976
4039
|
}
|
|
3977
4040
|
};
|
|
3978
4041
|
function findStatement(node) {
|
|
3979
4042
|
while (node) {
|
|
3980
|
-
if (
|
|
4043
|
+
if (ts16.isExpressionStatement(node) || ts16.isReturnStatement(node)) {
|
|
3981
4044
|
return node;
|
|
3982
4045
|
}
|
|
3983
4046
|
node = node.parent;
|
|
@@ -3994,7 +4057,7 @@ function getNextSiblingInArray(node, array) {
|
|
|
3994
4057
|
}
|
|
3995
4058
|
function getEndExceptSemicolon(statement) {
|
|
3996
4059
|
const lastToken = statement.getLastToken();
|
|
3997
|
-
return lastToken && lastToken.kind ===
|
|
4060
|
+
return lastToken && lastToken.kind === ts16.SyntaxKind.SemicolonToken ? statement.getEnd() - 1 : statement.getEnd();
|
|
3998
4061
|
}
|
|
3999
4062
|
|
|
4000
4063
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/rendering/esm5_rendering_formatter.mjs
|
|
@@ -4008,10 +4071,10 @@ Expected an ES5 IIFE wrapped function. But got:
|
|
|
4008
4071
|
}
|
|
4009
4072
|
const declarationStatement = getContainingStatement(classSymbol.implementation.valueDeclaration);
|
|
4010
4073
|
const iifeBody = declarationStatement.parent;
|
|
4011
|
-
if (!iifeBody || !
|
|
4074
|
+
if (!iifeBody || !ts17.isBlock(iifeBody)) {
|
|
4012
4075
|
throw new Error(`Compiled class declaration is not inside an IIFE: ${compiledClass.name} in ${compiledClass.declaration.getSourceFile().fileName}`);
|
|
4013
4076
|
}
|
|
4014
|
-
const returnStatement = iifeBody.statements.find(
|
|
4077
|
+
const returnStatement = iifeBody.statements.find(ts17.isReturnStatement);
|
|
4015
4078
|
if (!returnStatement) {
|
|
4016
4079
|
throw new Error(`Compiled class wrapper IIFE does not have a return statement: ${compiledClass.name} in ${compiledClass.declaration.getSourceFile().fileName}`);
|
|
4017
4080
|
}
|
|
@@ -4020,7 +4083,7 @@ Expected an ES5 IIFE wrapped function. But got:
|
|
|
4020
4083
|
}
|
|
4021
4084
|
printStatement(stmt, sourceFile, importManager) {
|
|
4022
4085
|
const node = translateStatement(stmt, importManager, { downlevelTaggedTemplates: true, downlevelVariableDeclarations: true });
|
|
4023
|
-
const code = this.printer.printNode(
|
|
4086
|
+
const code = this.printer.printNode(ts17.EmitHint.Unspecified, node, sourceFile);
|
|
4024
4087
|
return code;
|
|
4025
4088
|
}
|
|
4026
4089
|
};
|
|
@@ -4062,10 +4125,10 @@ exports.${e.asAlias} = ${importNamespace}${namedImport.symbol};`;
|
|
|
4062
4125
|
}
|
|
4063
4126
|
findEndOfImports(sf) {
|
|
4064
4127
|
for (const statement of sf.statements) {
|
|
4065
|
-
if (
|
|
4128
|
+
if (ts18.isExpressionStatement(statement) && isRequireCall(statement.expression)) {
|
|
4066
4129
|
continue;
|
|
4067
4130
|
}
|
|
4068
|
-
const declarations =
|
|
4131
|
+
const declarations = ts18.isVariableStatement(statement) ? Array.from(statement.declarationList.declarations) : [];
|
|
4069
4132
|
if (declarations.some((d) => !d.initializer || !isRequireCall(d.initializer))) {
|
|
4070
4133
|
return statement.getStart();
|
|
4071
4134
|
}
|
|
@@ -4076,7 +4139,7 @@ exports.${e.asAlias} = ${importNamespace}${namedImport.symbol};`;
|
|
|
4076
4139
|
|
|
4077
4140
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/rendering/dts_renderer.mjs
|
|
4078
4141
|
import MagicString from "magic-string";
|
|
4079
|
-
import
|
|
4142
|
+
import ts19 from "typescript";
|
|
4080
4143
|
|
|
4081
4144
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/constants.mjs
|
|
4082
4145
|
var IMPORT_PREFIX = "\u0275ngcc";
|
|
@@ -4147,14 +4210,14 @@ var DtsRenderer = class {
|
|
|
4147
4210
|
}
|
|
4148
4211
|
renderDtsFile(dtsFile, renderInfo) {
|
|
4149
4212
|
const outputText = new MagicString(dtsFile.text);
|
|
4150
|
-
const printer =
|
|
4213
|
+
const printer = ts19.createPrinter();
|
|
4151
4214
|
const importManager = new ImportManager(getImportRewriter(this.bundle.dts.r3SymbolsFile, this.bundle.isCore, false), IMPORT_PREFIX);
|
|
4152
4215
|
renderInfo.classInfo.forEach((dtsClass) => {
|
|
4153
4216
|
const endOfClass = dtsClass.dtsDeclaration.getEnd();
|
|
4154
4217
|
dtsClass.compilation.forEach((declaration) => {
|
|
4155
4218
|
const type = translateType(declaration.type, importManager);
|
|
4156
4219
|
markForEmitAsSingleLine(type);
|
|
4157
|
-
const typeStr = printer.printNode(
|
|
4220
|
+
const typeStr = printer.printNode(ts19.EmitHint.Unspecified, type, dtsFile);
|
|
4158
4221
|
const newStatement = ` static ${declaration.name}: ${typeStr};
|
|
4159
4222
|
`;
|
|
4160
4223
|
outputText.appendRight(endOfClass - 1, newStatement);
|
|
@@ -4214,8 +4277,8 @@ The simplest fix for this is to ensure that this class is exported from the pack
|
|
|
4214
4277
|
}
|
|
4215
4278
|
};
|
|
4216
4279
|
function markForEmitAsSingleLine(node) {
|
|
4217
|
-
|
|
4218
|
-
|
|
4280
|
+
ts19.setEmitFlags(node, ts19.EmitFlags.SingleLine);
|
|
4281
|
+
ts19.forEachChild(node, markForEmitAsSingleLine);
|
|
4219
4282
|
}
|
|
4220
4283
|
|
|
4221
4284
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/rendering/renderer.mjs
|
|
@@ -4235,23 +4298,19 @@ var Renderer = class {
|
|
|
4235
4298
|
this.bundle = bundle;
|
|
4236
4299
|
this.tsConfig = tsConfig;
|
|
4237
4300
|
}
|
|
4238
|
-
renderProgram(decorationAnalyses,
|
|
4301
|
+
renderProgram(decorationAnalyses, privateDeclarationsAnalyses) {
|
|
4239
4302
|
const renderedFiles = [];
|
|
4240
4303
|
this.bundle.src.program.getSourceFiles().forEach((sourceFile) => {
|
|
4241
|
-
if (decorationAnalyses.has(sourceFile) ||
|
|
4304
|
+
if (decorationAnalyses.has(sourceFile) || sourceFile === this.bundle.src.file) {
|
|
4242
4305
|
const compiledFile = decorationAnalyses.get(sourceFile);
|
|
4243
|
-
|
|
4244
|
-
renderedFiles.push(...this.renderFile(sourceFile, compiledFile, switchMarkerAnalysis, privateDeclarationsAnalyses));
|
|
4306
|
+
renderedFiles.push(...this.renderFile(sourceFile, compiledFile, privateDeclarationsAnalyses));
|
|
4245
4307
|
}
|
|
4246
4308
|
});
|
|
4247
4309
|
return renderedFiles;
|
|
4248
4310
|
}
|
|
4249
|
-
renderFile(sourceFile, compiledFile,
|
|
4311
|
+
renderFile(sourceFile, compiledFile, privateDeclarationsAnalyses) {
|
|
4250
4312
|
const isEntryPoint2 = sourceFile === this.bundle.src.file;
|
|
4251
4313
|
const outputText = new MagicString2(sourceFile.text);
|
|
4252
|
-
if (switchMarkerAnalysis) {
|
|
4253
|
-
this.srcFormatter.rewriteSwitchableDeclarations(outputText, switchMarkerAnalysis.sourceFile, switchMarkerAnalysis.declarations);
|
|
4254
|
-
}
|
|
4255
4314
|
const importManager = new ImportManager(getImportRewriter(this.bundle.src.r3SymbolsFile, this.bundle.isCore, this.bundle.isFlatCore), IMPORT_PREFIX);
|
|
4256
4315
|
if (compiledFile) {
|
|
4257
4316
|
const decoratorsToRemove = this.computeDecoratorsToRemove(compiledFile.compiledClasses);
|
|
@@ -4275,7 +4334,7 @@ var Renderer = class {
|
|
|
4275
4334
|
if (isEntryPoint2 || compiledFile) {
|
|
4276
4335
|
this.srcFormatter.addImports(outputText, importManager.getAllImports(sourceFile.fileName), sourceFile);
|
|
4277
4336
|
}
|
|
4278
|
-
if (compiledFile ||
|
|
4337
|
+
if (compiledFile || isEntryPoint2) {
|
|
4279
4338
|
return renderSourceAndMap(this.logger, this.fs, sourceFile, outputText);
|
|
4280
4339
|
} else {
|
|
4281
4340
|
return [];
|
|
@@ -4333,7 +4392,7 @@ function createAssignmentStatement(receiverName, propName, initializer, leadingC
|
|
|
4333
4392
|
}
|
|
4334
4393
|
|
|
4335
4394
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/rendering/umd_rendering_formatter.mjs
|
|
4336
|
-
import
|
|
4395
|
+
import ts20 from "typescript";
|
|
4337
4396
|
var UmdRenderingFormatter = class extends Esm5RenderingFormatter {
|
|
4338
4397
|
constructor(fs, umdHost, isCore) {
|
|
4339
4398
|
super(fs, umdHost, isCore);
|
|
@@ -4347,10 +4406,11 @@ var UmdRenderingFormatter = class extends Esm5RenderingFormatter {
|
|
|
4347
4406
|
if (!umdModule) {
|
|
4348
4407
|
return;
|
|
4349
4408
|
}
|
|
4350
|
-
const {
|
|
4351
|
-
renderCommonJsDependencies(output,
|
|
4352
|
-
|
|
4353
|
-
|
|
4409
|
+
const { factoryFn, factoryCalls } = umdModule;
|
|
4410
|
+
renderCommonJsDependencies(output, factoryCalls.commonJs, imports);
|
|
4411
|
+
renderCommonJsDependencies(output, factoryCalls.commonJs2, imports);
|
|
4412
|
+
renderAmdDependencies(output, factoryCalls.amdDefine, imports);
|
|
4413
|
+
renderGlobalDependencies(output, factoryCalls.global, imports);
|
|
4354
4414
|
renderFactoryParameters(output, factoryFn, imports);
|
|
4355
4415
|
}
|
|
4356
4416
|
addExports(output, entryPointBasePath, exports, importManager, file) {
|
|
@@ -4401,26 +4461,22 @@ exports.${e.asAlias} = ${importNamespace}${namedImport.symbol};`;
|
|
|
4401
4461
|
output.appendLeft(insertionPoint, "\n" + constants + "\n");
|
|
4402
4462
|
}
|
|
4403
4463
|
};
|
|
4404
|
-
function renderCommonJsDependencies(output,
|
|
4405
|
-
|
|
4406
|
-
if (!conditional) {
|
|
4464
|
+
function renderCommonJsDependencies(output, factoryCall, imports) {
|
|
4465
|
+
if (factoryCall === null) {
|
|
4407
4466
|
return;
|
|
4408
4467
|
}
|
|
4409
|
-
const factoryCall = conditional.whenTrue;
|
|
4410
4468
|
const injectionPoint = factoryCall.arguments.length > 0 ? factoryCall.arguments[0].getFullStart() : factoryCall.getEnd() - 1;
|
|
4411
4469
|
const importString = imports.map((i) => `require('${i.specifier}')`).join(",");
|
|
4412
4470
|
output.appendLeft(injectionPoint, importString + (factoryCall.arguments.length > 0 ? "," : ""));
|
|
4413
4471
|
}
|
|
4414
|
-
function renderAmdDependencies(output,
|
|
4415
|
-
|
|
4416
|
-
if (!conditional) {
|
|
4472
|
+
function renderAmdDependencies(output, amdDefineCall, imports) {
|
|
4473
|
+
if (amdDefineCall === null) {
|
|
4417
4474
|
return;
|
|
4418
4475
|
}
|
|
4419
|
-
const amdDefineCall = conditional.whenTrue;
|
|
4420
4476
|
const importString = imports.map((i) => `'${i.specifier}'`).join(",");
|
|
4421
4477
|
const factoryIndex = amdDefineCall.arguments.length - 1;
|
|
4422
4478
|
const dependencyArray = amdDefineCall.arguments[factoryIndex - 1];
|
|
4423
|
-
if (dependencyArray === void 0 || !
|
|
4479
|
+
if (dependencyArray === void 0 || !ts20.isArrayLiteralExpression(dependencyArray)) {
|
|
4424
4480
|
const injectionPoint = amdDefineCall.arguments[factoryIndex].getFullStart();
|
|
4425
4481
|
output.appendLeft(injectionPoint, `[${importString}],`);
|
|
4426
4482
|
} else {
|
|
@@ -4428,14 +4484,13 @@ function renderAmdDependencies(output, wrapperFunction, imports) {
|
|
|
4428
4484
|
output.appendLeft(injectionPoint, importString + (dependencyArray.elements.length > 0 ? "," : ""));
|
|
4429
4485
|
}
|
|
4430
4486
|
}
|
|
4431
|
-
function renderGlobalDependencies(output,
|
|
4432
|
-
|
|
4433
|
-
if (!globalFactoryCall) {
|
|
4487
|
+
function renderGlobalDependencies(output, factoryCall, imports) {
|
|
4488
|
+
if (factoryCall === null) {
|
|
4434
4489
|
return;
|
|
4435
4490
|
}
|
|
4436
|
-
const injectionPoint =
|
|
4491
|
+
const injectionPoint = factoryCall.arguments.length > 0 ? factoryCall.arguments[0].getFullStart() : factoryCall.getEnd() - 1;
|
|
4437
4492
|
const importString = imports.map((i) => `global.${getGlobalIdentifier(i)}`).join(",");
|
|
4438
|
-
output.appendLeft(injectionPoint, importString + (
|
|
4493
|
+
output.appendLeft(injectionPoint, importString + (factoryCall.arguments.length > 0 ? "," : ""));
|
|
4439
4494
|
}
|
|
4440
4495
|
function renderFactoryParameters(output, factoryFunction, imports) {
|
|
4441
4496
|
const parameters = factoryFunction.parameters;
|
|
@@ -4448,60 +4503,9 @@ function renderFactoryParameters(output, factoryFunction, imports) {
|
|
|
4448
4503
|
output.appendLeft(injectionPoint, parameterString);
|
|
4449
4504
|
}
|
|
4450
4505
|
}
|
|
4451
|
-
function isCommonJSConditional(value) {
|
|
4452
|
-
if (!ts21.isConditionalExpression(value)) {
|
|
4453
|
-
return false;
|
|
4454
|
-
}
|
|
4455
|
-
if (!ts21.isBinaryExpression(value.condition) || value.condition.operatorToken.kind !== ts21.SyntaxKind.AmpersandAmpersandToken) {
|
|
4456
|
-
return false;
|
|
4457
|
-
}
|
|
4458
|
-
if (!oneOfBinaryConditions(value.condition, (exp) => isTypeOf(exp, "exports", "module"))) {
|
|
4459
|
-
return false;
|
|
4460
|
-
}
|
|
4461
|
-
if (!ts21.isCallExpression(value.whenTrue) || !ts21.isIdentifier(value.whenTrue.expression)) {
|
|
4462
|
-
return false;
|
|
4463
|
-
}
|
|
4464
|
-
return value.whenTrue.expression.text === "factory";
|
|
4465
|
-
}
|
|
4466
|
-
function isAmdConditional(value) {
|
|
4467
|
-
if (!ts21.isConditionalExpression(value)) {
|
|
4468
|
-
return false;
|
|
4469
|
-
}
|
|
4470
|
-
if (!ts21.isBinaryExpression(value.condition) || value.condition.operatorToken.kind !== ts21.SyntaxKind.AmpersandAmpersandToken) {
|
|
4471
|
-
return false;
|
|
4472
|
-
}
|
|
4473
|
-
if (!oneOfBinaryConditions(value.condition, (exp) => isTypeOf(exp, "define"))) {
|
|
4474
|
-
return false;
|
|
4475
|
-
}
|
|
4476
|
-
if (!ts21.isCallExpression(value.whenTrue) || !ts21.isIdentifier(value.whenTrue.expression)) {
|
|
4477
|
-
return false;
|
|
4478
|
-
}
|
|
4479
|
-
return value.whenTrue.expression.text === "define";
|
|
4480
|
-
}
|
|
4481
|
-
function isGlobalFactoryCall(value) {
|
|
4482
|
-
if (ts21.isCallExpression(value) && !!value.parent) {
|
|
4483
|
-
value = isCommaExpression(value.parent) ? value.parent : value;
|
|
4484
|
-
value = ts21.isParenthesizedExpression(value.parent) ? value.parent : value;
|
|
4485
|
-
return !!value.parent && ts21.isConditionalExpression(value.parent) && value.parent.whenFalse === value;
|
|
4486
|
-
} else {
|
|
4487
|
-
return false;
|
|
4488
|
-
}
|
|
4489
|
-
}
|
|
4490
|
-
function isCommaExpression(value) {
|
|
4491
|
-
return ts21.isBinaryExpression(value) && value.operatorToken.kind === ts21.SyntaxKind.CommaToken;
|
|
4492
|
-
}
|
|
4493
4506
|
function getGlobalIdentifier(i) {
|
|
4494
4507
|
return i.specifier.replace(/^@angular\//, "ng.").replace(/^@/, "").replace(/\//g, ".").replace(/[-_]+(.?)/g, (_, c) => c.toUpperCase()).replace(/^./, (c) => c.toLowerCase());
|
|
4495
4508
|
}
|
|
4496
|
-
function find(node, test) {
|
|
4497
|
-
return test(node) ? node : node.forEachChild((child) => find(child, test));
|
|
4498
|
-
}
|
|
4499
|
-
function oneOfBinaryConditions(node, test) {
|
|
4500
|
-
return test(node.left) || test(node.right);
|
|
4501
|
-
}
|
|
4502
|
-
function isTypeOf(node, ...types) {
|
|
4503
|
-
return ts21.isBinaryExpression(node) && ts21.isTypeOfExpression(node.left) && ts21.isIdentifier(node.left.expression) && types.indexOf(node.left.expression.text) !== -1;
|
|
4504
|
-
}
|
|
4505
4509
|
|
|
4506
4510
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/packages/transformer.mjs
|
|
4507
4511
|
var Transformer = class {
|
|
@@ -4514,7 +4518,7 @@ var Transformer = class {
|
|
|
4514
4518
|
const ngccReflectionHost = this.getHost(bundle);
|
|
4515
4519
|
const tsReflectionHost = new TypeScriptReflectionHost(bundle.src.program.getTypeChecker());
|
|
4516
4520
|
const reflectionHost = new DelegatingReflectionHost(tsReflectionHost, ngccReflectionHost);
|
|
4517
|
-
const { decorationAnalyses,
|
|
4521
|
+
const { decorationAnalyses, privateDeclarationsAnalyses, moduleWithProvidersAnalyses, diagnostics } = this.analyzeProgram(reflectionHost, bundle);
|
|
4518
4522
|
if (hasErrors(diagnostics)) {
|
|
4519
4523
|
return { success: false, diagnostics };
|
|
4520
4524
|
}
|
|
@@ -4522,7 +4526,7 @@ var Transformer = class {
|
|
|
4522
4526
|
if (bundle.dtsProcessing !== DtsProcessing.Only) {
|
|
4523
4527
|
const srcFormatter = this.getRenderingFormatter(ngccReflectionHost, bundle);
|
|
4524
4528
|
const renderer = new Renderer(reflectionHost, srcFormatter, this.fs, this.logger, bundle, this.tsConfig);
|
|
4525
|
-
renderedFiles = renderer.renderProgram(decorationAnalyses,
|
|
4529
|
+
renderedFiles = renderer.renderProgram(decorationAnalyses, privateDeclarationsAnalyses);
|
|
4526
4530
|
}
|
|
4527
4531
|
if (bundle.dts) {
|
|
4528
4532
|
const dtsFormatter = new EsmRenderingFormatter(this.fs, reflectionHost, bundle.isCore);
|
|
@@ -4565,8 +4569,6 @@ var Transformer = class {
|
|
|
4565
4569
|
}
|
|
4566
4570
|
analyzeProgram(reflectionHost, bundle) {
|
|
4567
4571
|
const referencesRegistry = new NgccReferencesRegistry(reflectionHost);
|
|
4568
|
-
const switchMarkerAnalyzer = new SwitchMarkerAnalyzer(reflectionHost, bundle.entryPoint.packagePath);
|
|
4569
|
-
const switchMarkerAnalyses = switchMarkerAnalyzer.analyzeProgram(bundle.src.program);
|
|
4570
4572
|
const diagnostics = [];
|
|
4571
4573
|
const decorationAnalyzer = new DecorationAnalyzer(this.fs, bundle, reflectionHost, referencesRegistry, (diagnostic) => diagnostics.push(diagnostic), this.tsConfig);
|
|
4572
4574
|
const decorationAnalyses = decorationAnalyzer.analyzeProgram();
|
|
@@ -4576,7 +4578,6 @@ var Transformer = class {
|
|
|
4576
4578
|
const privateDeclarationsAnalyses = privateDeclarationsAnalyzer.analyzeProgram(bundle.src.program);
|
|
4577
4579
|
return {
|
|
4578
4580
|
decorationAnalyses,
|
|
4579
|
-
switchMarkerAnalyses,
|
|
4580
4581
|
privateDeclarationsAnalyses,
|
|
4581
4582
|
moduleWithProvidersAnalyses,
|
|
4582
4583
|
diagnostics
|
|
@@ -4584,7 +4585,7 @@ var Transformer = class {
|
|
|
4584
4585
|
}
|
|
4585
4586
|
};
|
|
4586
4587
|
function hasErrors(diagnostics) {
|
|
4587
|
-
return diagnostics.some((d) => d.category ===
|
|
4588
|
+
return diagnostics.some((d) => d.category === ts21.DiagnosticCategory.Error);
|
|
4588
4589
|
}
|
|
4589
4590
|
|
|
4590
4591
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/ngcc/src/execution/create_compile_function.mjs
|
|
@@ -4608,7 +4609,7 @@ function getCreateCompileFn(fileSystem, logger, fileWriter, enableI18nLegacyMess
|
|
|
4608
4609
|
const result = transformer.transform(bundle);
|
|
4609
4610
|
if (result.success) {
|
|
4610
4611
|
if (result.diagnostics.length > 0) {
|
|
4611
|
-
logger.warn(replaceTsWithNgInErrors(
|
|
4612
|
+
logger.warn(replaceTsWithNgInErrors(ts22.formatDiagnosticsWithColorAndContext(result.diagnostics, bundle.src.host)));
|
|
4612
4613
|
}
|
|
4613
4614
|
const writeBundle = () => {
|
|
4614
4615
|
fileWriter.writeBundle(bundle, result.transformedFiles, formatPropertiesToMarkAsProcessed);
|
|
@@ -4618,7 +4619,7 @@ function getCreateCompileFn(fileSystem, logger, fileWriter, enableI18nLegacyMess
|
|
|
4618
4619
|
const beforeWritingResult = beforeWritingFiles(result.transformedFiles);
|
|
4619
4620
|
return beforeWritingResult instanceof Promise ? beforeWritingResult.then(writeBundle) : writeBundle();
|
|
4620
4621
|
} else {
|
|
4621
|
-
const errors = replaceTsWithNgInErrors(
|
|
4622
|
+
const errors = replaceTsWithNgInErrors(ts22.formatDiagnosticsWithColorAndContext(result.diagnostics, bundle.src.host));
|
|
4622
4623
|
onTaskCompleted(task, 1, `compilation errors:
|
|
4623
4624
|
${errors}`);
|
|
4624
4625
|
}
|
|
@@ -5102,4 +5103,4 @@ export {
|
|
|
5102
5103
|
* Use of this source code is governed by an MIT-style license that can be
|
|
5103
5104
|
* found in the LICENSE file at https://angular.io/license
|
|
5104
5105
|
*/
|
|
5105
|
-
//# sourceMappingURL=chunk-
|
|
5106
|
+
//# sourceMappingURL=chunk-7HBAJSZA.js.map
|