@angular/core 17.3.0-rc.0 → 17.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/src/application/application_ref.mjs +14 -11
- package/esm2022/src/authoring/input/input.mjs +4 -1
- package/esm2022/src/authoring/output/output.mjs +2 -2
- package/esm2022/src/authoring/output/output_emitter_ref.mjs +14 -3
- package/esm2022/src/authoring/queries.mjs +7 -1
- package/esm2022/src/change_detection/scheduling/zoneless_scheduling.mjs +1 -1
- package/esm2022/src/change_detection/scheduling/zoneless_scheduling_impl.mjs +10 -4
- package/esm2022/src/core_private_export.mjs +2 -3
- package/esm2022/src/di/contextual.mjs +9 -3
- package/esm2022/src/event_emitter.mjs +6 -7
- package/esm2022/src/hydration/annotate.mjs +4 -2
- package/esm2022/src/hydration/api.mjs +27 -2
- package/esm2022/src/hydration/cleanup.mjs +18 -2
- package/esm2022/src/hydration/interfaces.mjs +1 -1
- package/esm2022/src/hydration/node_lookup_utils.mjs +59 -39
- package/esm2022/src/hydration/tokens.mjs +6 -1
- package/esm2022/src/i18n/utils.mjs +16 -0
- package/esm2022/src/render3/after_render_hooks.mjs +11 -8
- package/esm2022/src/render3/component_ref.mjs +1 -1
- package/esm2022/src/render3/i18n/i18n_apply.mjs +32 -7
- package/esm2022/src/render3/i18n/i18n_parse.mjs +50 -16
- package/esm2022/src/render3/instructions/control_flow.mjs +4 -2
- package/esm2022/src/render3/instructions/element.mjs +5 -3
- package/esm2022/src/render3/instructions/element_container.mjs +3 -2
- package/esm2022/src/render3/instructions/template.mjs +4 -2
- package/esm2022/src/render3/instructions/text.mjs +4 -2
- package/esm2022/src/render3/interfaces/i18n.mjs +1 -1
- package/esm2022/src/render3/node_manipulation.mjs +6 -2
- package/esm2022/src/render3/node_selector_matcher.mjs +37 -51
- package/esm2022/src/render3/queue_state_update.mjs +2 -4
- package/esm2022/src/render3/util/view_utils.mjs +2 -1
- package/esm2022/src/sanitization/html_sanitizer.mjs +54 -14
- package/esm2022/src/version.mjs +1 -1
- package/esm2022/testing/src/component_fixture.mjs +11 -66
- package/esm2022/testing/src/logger.mjs +3 -3
- package/fesm2022/core.mjs +629 -436
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/primitives/signals.mjs +1 -1
- package/fesm2022/rxjs-interop.mjs +1 -1
- package/fesm2022/testing.mjs +11 -66
- package/fesm2022/testing.mjs.map +1 -1
- package/index.d.ts +96 -12
- package/package.json +1 -1
- package/primitives/signals/index.d.ts +1 -1
- package/rxjs-interop/index.d.ts +1 -1
- package/schematics/migrations/block-template-entities/bundle.js +8 -2
- package/schematics/migrations/block-template-entities/bundle.js.map +2 -2
- package/schematics/migrations/invalid-two-way-bindings/bundle.js +8 -2
- package/schematics/migrations/invalid-two-way-bindings/bundle.js.map +2 -2
- package/schematics/ng-generate/control-flow-migration/bundle.js +8 -2
- package/schematics/ng-generate/control-flow-migration/bundle.js.map +2 -2
- package/schematics/ng-generate/standalone-migration/bundle.js +356 -294
- package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
- package/testing/index.d.ts +1 -1
- package/esm2022/src/is_internal.mjs +0 -15
|
@@ -22043,10 +22043,13 @@ function transformTwoWayBindingSet(job) {
|
|
|
22043
22043
|
}
|
|
22044
22044
|
}
|
|
22045
22045
|
function wrapSetOperation(target, value) {
|
|
22046
|
+
if (target instanceof ReadVariableExpr) {
|
|
22047
|
+
return twoWayBindingSet(target, value);
|
|
22048
|
+
}
|
|
22046
22049
|
return twoWayBindingSet(target, value).or(target.set(value));
|
|
22047
22050
|
}
|
|
22048
22051
|
function isReadExpression2(value) {
|
|
22049
|
-
return value instanceof ReadPropExpr || value instanceof ReadKeyExpr;
|
|
22052
|
+
return value instanceof ReadPropExpr || value instanceof ReadKeyExpr || value instanceof ReadVariableExpr;
|
|
22050
22053
|
}
|
|
22051
22054
|
function wrapAction(target, value) {
|
|
22052
22055
|
if (isReadExpression2(target)) {
|
|
@@ -24248,6 +24251,9 @@ function parseForLoopParameters(block, errors, bindingParser) {
|
|
|
24248
24251
|
errors.push(new ParseError(param.sourceSpan, '@for loop can only have one "track" expression'));
|
|
24249
24252
|
} else {
|
|
24250
24253
|
const expression = parseBlockParameterToBinding(param, bindingParser, trackMatch[1]);
|
|
24254
|
+
if (expression.ast instanceof EmptyExpr) {
|
|
24255
|
+
errors.push(new ParseError(param.sourceSpan, '@for loop must have a "track" expression'));
|
|
24256
|
+
}
|
|
24251
24257
|
const keywordSpan = new ParseSourceSpan(param.sourceSpan.start, param.sourceSpan.start.moveBy("track".length));
|
|
24252
24258
|
result.trackBy = { expression, keywordSpan };
|
|
24253
24259
|
}
|
|
@@ -29329,7 +29335,7 @@ function publishFacade(global) {
|
|
|
29329
29335
|
}
|
|
29330
29336
|
|
|
29331
29337
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/version.mjs
|
|
29332
|
-
var VERSION2 = new Version("17.3.0
|
|
29338
|
+
var VERSION2 = new Version("17.3.0");
|
|
29333
29339
|
|
|
29334
29340
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/i18n/extractor_merger.mjs
|
|
29335
29341
|
var _I18N_ATTR = "i18n";
|
|
@@ -30395,7 +30401,7 @@ var MINIMUM_PARTIAL_LINKER_VERSION = "12.0.0";
|
|
|
30395
30401
|
function compileDeclareClassMetadata(metadata) {
|
|
30396
30402
|
const definitionMap = new DefinitionMap();
|
|
30397
30403
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
30398
|
-
definitionMap.set("version", literal("17.3.0
|
|
30404
|
+
definitionMap.set("version", literal("17.3.0"));
|
|
30399
30405
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
30400
30406
|
definitionMap.set("type", metadata.type);
|
|
30401
30407
|
definitionMap.set("decorators", metadata.decorators);
|
|
@@ -30464,7 +30470,7 @@ function createDirectiveDefinitionMap(meta) {
|
|
|
30464
30470
|
const definitionMap = new DefinitionMap();
|
|
30465
30471
|
const minVersion = getMinimumVersionForPartialOutput(meta);
|
|
30466
30472
|
definitionMap.set("minVersion", literal(minVersion));
|
|
30467
|
-
definitionMap.set("version", literal("17.3.0
|
|
30473
|
+
definitionMap.set("version", literal("17.3.0"));
|
|
30468
30474
|
definitionMap.set("type", meta.type.value);
|
|
30469
30475
|
if (meta.isStandalone) {
|
|
30470
30476
|
definitionMap.set("isStandalone", literal(meta.isStandalone));
|
|
@@ -30763,7 +30769,7 @@ var MINIMUM_PARTIAL_LINKER_VERSION2 = "12.0.0";
|
|
|
30763
30769
|
function compileDeclareFactoryFunction(meta) {
|
|
30764
30770
|
const definitionMap = new DefinitionMap();
|
|
30765
30771
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION2));
|
|
30766
|
-
definitionMap.set("version", literal("17.3.0
|
|
30772
|
+
definitionMap.set("version", literal("17.3.0"));
|
|
30767
30773
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
30768
30774
|
definitionMap.set("type", meta.type.value);
|
|
30769
30775
|
definitionMap.set("deps", compileDependencies(meta.deps));
|
|
@@ -30786,7 +30792,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
30786
30792
|
function createInjectableDefinitionMap(meta) {
|
|
30787
30793
|
const definitionMap = new DefinitionMap();
|
|
30788
30794
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION3));
|
|
30789
|
-
definitionMap.set("version", literal("17.3.0
|
|
30795
|
+
definitionMap.set("version", literal("17.3.0"));
|
|
30790
30796
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
30791
30797
|
definitionMap.set("type", meta.type.value);
|
|
30792
30798
|
if (meta.providedIn !== void 0) {
|
|
@@ -30824,7 +30830,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
30824
30830
|
function createInjectorDefinitionMap(meta) {
|
|
30825
30831
|
const definitionMap = new DefinitionMap();
|
|
30826
30832
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION4));
|
|
30827
|
-
definitionMap.set("version", literal("17.3.0
|
|
30833
|
+
definitionMap.set("version", literal("17.3.0"));
|
|
30828
30834
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
30829
30835
|
definitionMap.set("type", meta.type.value);
|
|
30830
30836
|
definitionMap.set("providers", meta.providers);
|
|
@@ -30848,7 +30854,7 @@ function createNgModuleDefinitionMap(meta) {
|
|
|
30848
30854
|
throw new Error("Invalid path! Local compilation mode should not get into the partial compilation path");
|
|
30849
30855
|
}
|
|
30850
30856
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION5));
|
|
30851
|
-
definitionMap.set("version", literal("17.3.0
|
|
30857
|
+
definitionMap.set("version", literal("17.3.0"));
|
|
30852
30858
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
30853
30859
|
definitionMap.set("type", meta.type.value);
|
|
30854
30860
|
if (meta.bootstrap.length > 0) {
|
|
@@ -30883,7 +30889,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
30883
30889
|
function createPipeDefinitionMap(meta) {
|
|
30884
30890
|
const definitionMap = new DefinitionMap();
|
|
30885
30891
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION6));
|
|
30886
|
-
definitionMap.set("version", literal("17.3.0
|
|
30892
|
+
definitionMap.set("version", literal("17.3.0"));
|
|
30887
30893
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
30888
30894
|
definitionMap.set("type", meta.type.value);
|
|
30889
30895
|
if (meta.isStandalone) {
|
|
@@ -30900,7 +30906,7 @@ function createPipeDefinitionMap(meta) {
|
|
|
30900
30906
|
publishFacade(_global);
|
|
30901
30907
|
|
|
30902
30908
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/version.mjs
|
|
30903
|
-
var VERSION3 = new Version("17.3.0
|
|
30909
|
+
var VERSION3 = new Version("17.3.0");
|
|
30904
30910
|
|
|
30905
30911
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/emitter.mjs
|
|
30906
30912
|
var import_typescript5 = __toESM(require("typescript"), 1);
|
|
@@ -33362,7 +33368,7 @@ var DtsMetadataReader = class {
|
|
|
33362
33368
|
const inputs = ClassPropertyMapping.fromMappedObject(readInputsType(def.type.typeArguments[3]));
|
|
33363
33369
|
const outputs = ClassPropertyMapping.fromMappedObject(readMapType(def.type.typeArguments[4], readStringType));
|
|
33364
33370
|
const hostDirectives = def.type.typeArguments.length > 8 ? readHostDirectivesType(this.checker, def.type.typeArguments[8], ref.bestGuessOwningModule) : null;
|
|
33365
|
-
const
|
|
33371
|
+
const isSignal = def.type.typeArguments.length > 9 && ((_b2 = readBooleanType(def.type.typeArguments[9])) != null ? _b2 : false);
|
|
33366
33372
|
return __spreadProps(__spreadValues({
|
|
33367
33373
|
kind: MetaKind.Directive,
|
|
33368
33374
|
matchSource: MatchSource.Selector,
|
|
@@ -33382,7 +33388,7 @@ var DtsMetadataReader = class {
|
|
|
33382
33388
|
animationTriggerNames: null,
|
|
33383
33389
|
ngContentSelectors,
|
|
33384
33390
|
isStandalone,
|
|
33385
|
-
isSignal
|
|
33391
|
+
isSignal,
|
|
33386
33392
|
imports: null,
|
|
33387
33393
|
deferredImports: null,
|
|
33388
33394
|
schemas: null,
|
|
@@ -35298,7 +35304,7 @@ var TraitCompiler = class {
|
|
|
35298
35304
|
}
|
|
35299
35305
|
}
|
|
35300
35306
|
}
|
|
35301
|
-
|
|
35307
|
+
runAdditionalChecks(sf, check) {
|
|
35302
35308
|
if (this.compilationMode === CompilationMode.LOCAL) {
|
|
35303
35309
|
return [];
|
|
35304
35310
|
}
|
|
@@ -35313,10 +35319,10 @@ var TraitCompiler = class {
|
|
|
35313
35319
|
}
|
|
35314
35320
|
const record = this.classes.get(clazz);
|
|
35315
35321
|
for (const trait of record.traits) {
|
|
35316
|
-
|
|
35317
|
-
|
|
35322
|
+
const result = check(clazz, trait.handler);
|
|
35323
|
+
if (result !== null) {
|
|
35324
|
+
diagnostics.push(...result);
|
|
35318
35325
|
}
|
|
35319
|
-
diagnostics.push(...trait.handler.extendedTemplateCheck(clazz, extendedTemplateChecker));
|
|
35320
35326
|
}
|
|
35321
35327
|
}
|
|
35322
35328
|
return diagnostics;
|
|
@@ -38291,14 +38297,14 @@ function extractDirectiveMetadata(clazz, decorator, reflector, importTracker, ev
|
|
|
38291
38297
|
}
|
|
38292
38298
|
isStandalone = resolved;
|
|
38293
38299
|
}
|
|
38294
|
-
let
|
|
38300
|
+
let isSignal = false;
|
|
38295
38301
|
if (directive.has("signals")) {
|
|
38296
38302
|
const expr = directive.get("signals");
|
|
38297
38303
|
const resolved = evaluator.evaluate(expr);
|
|
38298
38304
|
if (typeof resolved !== "boolean") {
|
|
38299
38305
|
throw createValueHasWrongTypeError(expr, resolved, `signals flag must be a boolean`);
|
|
38300
38306
|
}
|
|
38301
|
-
|
|
38307
|
+
isSignal = resolved;
|
|
38302
38308
|
}
|
|
38303
38309
|
const usesInheritance = reflector.hasBaseClass(clazz);
|
|
38304
38310
|
const sourceFile = clazz.getSourceFile();
|
|
@@ -38335,7 +38341,7 @@ function extractDirectiveMetadata(clazz, decorator, reflector, importTracker, ev
|
|
|
38335
38341
|
exportAs,
|
|
38336
38342
|
providers,
|
|
38337
38343
|
isStandalone,
|
|
38338
|
-
isSignal
|
|
38344
|
+
isSignal,
|
|
38339
38345
|
hostDirectives: (hostDirectives == null ? void 0 : hostDirectives.map((hostDir) => toHostDirectiveMetadata(hostDir, sourceFile, refEmitter))) || null
|
|
38340
38346
|
};
|
|
38341
38347
|
return {
|
|
@@ -40882,6 +40888,9 @@ var ComponentDecoratorHandler = class {
|
|
|
40882
40888
|
extendedTemplateCheck(component, extendedTemplateChecker) {
|
|
40883
40889
|
return extendedTemplateChecker.getDiagnosticsForComponent(component);
|
|
40884
40890
|
}
|
|
40891
|
+
templateSemanticsCheck(component, templateSemanticsChecker) {
|
|
40892
|
+
return templateSemanticsChecker.getDiagnosticsForComponent(component);
|
|
40893
|
+
}
|
|
40885
40894
|
resolve(node, analysis, symbol) {
|
|
40886
40895
|
const metadata = analysis.meta;
|
|
40887
40896
|
const diagnostics = [];
|
|
@@ -41844,7 +41853,7 @@ var EmitFlags;
|
|
|
41844
41853
|
var import_typescript67 = __toESM(require("typescript"), 1);
|
|
41845
41854
|
|
|
41846
41855
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/program.mjs
|
|
41847
|
-
var
|
|
41856
|
+
var import_typescript116 = __toESM(require("typescript"), 1);
|
|
41848
41857
|
|
|
41849
41858
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/transformers/i18n.mjs
|
|
41850
41859
|
var path2 = __toESM(require("path"), 1);
|
|
@@ -41948,7 +41957,7 @@ function verifySupportedTypeScriptVersion() {
|
|
|
41948
41957
|
}
|
|
41949
41958
|
|
|
41950
41959
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/compiler.mjs
|
|
41951
|
-
var
|
|
41960
|
+
var import_typescript112 = __toESM(require("typescript"), 1);
|
|
41952
41961
|
|
|
41953
41962
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/cycles/src/analyzer.mjs
|
|
41954
41963
|
var CycleAnalyzer = class {
|
|
@@ -45126,8 +45135,8 @@ function constructTypeCtorParameter(env, meta, rawType) {
|
|
|
45126
45135
|
const plainKeys = [];
|
|
45127
45136
|
const coercedKeys = [];
|
|
45128
45137
|
const signalInputKeys = [];
|
|
45129
|
-
for (const { classPropertyName, transform: transform2, isSignal
|
|
45130
|
-
if (
|
|
45138
|
+
for (const { classPropertyName, transform: transform2, isSignal } of meta.fields.inputs) {
|
|
45139
|
+
if (isSignal) {
|
|
45131
45140
|
signalInputKeys.push(import_typescript95.default.factory.createLiteralTypeNode(import_typescript95.default.factory.createStringLiteral(classPropertyName)));
|
|
45132
45141
|
} else if (!meta.coercedInputFields.has(classPropertyName)) {
|
|
45133
45142
|
plainKeys.push(import_typescript95.default.factory.createLiteralTypeNode(import_typescript95.default.factory.createStringLiteral(classPropertyName)));
|
|
@@ -45317,21 +45326,6 @@ var OutOfBandDiagnosticRecorderImpl = class {
|
|
|
45317
45326
|
}
|
|
45318
45327
|
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan, import_typescript97.default.DiagnosticCategory.Error, ngErrorCode(ErrorCode.DEFERRED_DIRECTIVE_USED_EAGERLY), errorMsg));
|
|
45319
45328
|
}
|
|
45320
|
-
illegalAssignmentToTemplateVar(templateId, assignment, target) {
|
|
45321
|
-
var _a2, _b2;
|
|
45322
|
-
const mapping = this.resolver.getSourceMapping(templateId);
|
|
45323
|
-
const errorMsg = `Cannot use variable '${assignment.name}' as the left-hand side of an assignment expression. Template variables are read-only.`;
|
|
45324
|
-
const sourceSpan = this.resolver.toParseSourceSpan(templateId, assignment.sourceSpan);
|
|
45325
|
-
if (sourceSpan === null) {
|
|
45326
|
-
throw new Error(`Assertion failure: no SourceLocation found for property binding.`);
|
|
45327
|
-
}
|
|
45328
|
-
this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan, import_typescript97.default.DiagnosticCategory.Error, ngErrorCode(ErrorCode.WRITE_TO_READ_ONLY_VARIABLE), errorMsg, [{
|
|
45329
|
-
text: `The variable ${assignment.name} is declared here.`,
|
|
45330
|
-
start: ((_a2 = target.valueSpan) == null ? void 0 : _a2.start.offset) || target.sourceSpan.start.offset,
|
|
45331
|
-
end: ((_b2 = target.valueSpan) == null ? void 0 : _b2.end.offset) || target.sourceSpan.end.offset,
|
|
45332
|
-
sourceFile: mapping.node.getSourceFile()
|
|
45333
|
-
}]));
|
|
45334
|
-
}
|
|
45335
45329
|
duplicateTemplateVar(templateId, variable2, firstDecl) {
|
|
45336
45330
|
const mapping = this.resolver.getSourceMapping(templateId);
|
|
45337
45331
|
const errorMsg = `Cannot redeclare variable '${variable2.name}' as it was previously declared elsewhere for the same template.`;
|
|
@@ -45861,29 +45855,6 @@ var VeSafeLhsInferenceBugDetector = _VeSafeLhsInferenceBugDetector;
|
|
|
45861
45855
|
_VeSafeLhsInferenceBugDetector.SINGLETON = new _VeSafeLhsInferenceBugDetector();
|
|
45862
45856
|
})();
|
|
45863
45857
|
|
|
45864
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/template_semantics.mjs
|
|
45865
|
-
var ExpressionSemanticVisitor = class extends RecursiveAstVisitor2 {
|
|
45866
|
-
constructor(templateId, boundTarget, oob) {
|
|
45867
|
-
super();
|
|
45868
|
-
this.templateId = templateId;
|
|
45869
|
-
this.boundTarget = boundTarget;
|
|
45870
|
-
this.oob = oob;
|
|
45871
|
-
}
|
|
45872
|
-
visitPropertyWrite(ast, context) {
|
|
45873
|
-
super.visitPropertyWrite(ast, context);
|
|
45874
|
-
if (!(ast.receiver instanceof ImplicitReceiver)) {
|
|
45875
|
-
return;
|
|
45876
|
-
}
|
|
45877
|
-
const target = this.boundTarget.getExpressionTarget(ast);
|
|
45878
|
-
if (target instanceof Variable) {
|
|
45879
|
-
this.oob.illegalAssignmentToTemplateVar(this.templateId, ast, target);
|
|
45880
|
-
}
|
|
45881
|
-
}
|
|
45882
|
-
static visit(ast, id, boundTarget, oob) {
|
|
45883
|
-
ast.visit(new ExpressionSemanticVisitor(id, boundTarget, oob));
|
|
45884
|
-
}
|
|
45885
|
-
};
|
|
45886
|
-
|
|
45887
45858
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.mjs
|
|
45888
45859
|
var TcbGenericContextBehavior;
|
|
45889
45860
|
(function(TcbGenericContextBehavior2) {
|
|
@@ -46239,7 +46210,7 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
46239
46210
|
for (const attr of boundAttrs) {
|
|
46240
46211
|
const expr = widenBinding(translateInput(attr.attribute, this.tcb, this.scope), this.tcb);
|
|
46241
46212
|
let assignment = wrapForDiagnostics(expr);
|
|
46242
|
-
for (const { fieldName, required, transformType, isSignal
|
|
46213
|
+
for (const { fieldName, required, transformType, isSignal, isTwoWayBinding } of attr.inputs) {
|
|
46243
46214
|
let target;
|
|
46244
46215
|
if (required) {
|
|
46245
46216
|
seenRequiredInputs.add(fieldName);
|
|
@@ -46279,7 +46250,7 @@ var TcbDirectiveInputsOp = class extends TcbOp {
|
|
|
46279
46250
|
}
|
|
46280
46251
|
target = this.dir.stringLiteralInputFields.has(fieldName) ? import_typescript101.default.factory.createElementAccessExpression(dirId, import_typescript101.default.factory.createStringLiteral(fieldName)) : import_typescript101.default.factory.createPropertyAccessExpression(dirId, import_typescript101.default.factory.createIdentifier(fieldName));
|
|
46281
46252
|
}
|
|
46282
|
-
if (
|
|
46253
|
+
if (isSignal) {
|
|
46283
46254
|
const inputSignalBrandWriteSymbol = this.tcb.env.referenceExternalSymbol(Identifiers.InputSignalBrandWriteType.moduleName, Identifiers.InputSignalBrandWriteType.name);
|
|
46284
46255
|
if (!import_typescript101.default.isIdentifier(inputSignalBrandWriteSymbol) && !import_typescript101.default.isPropertyAccessExpression(inputSignalBrandWriteSymbol)) {
|
|
46285
46256
|
throw new Error(`Expected identifier or property access for reference to ${Identifiers.InputSignalBrandWriteType.name}`);
|
|
@@ -46523,7 +46494,6 @@ var TcbDirectiveOutputsOp = class extends TcbOp {
|
|
|
46523
46494
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 1);
|
|
46524
46495
|
this.scope.addStatement(import_typescript101.default.factory.createExpressionStatement(handler));
|
|
46525
46496
|
}
|
|
46526
|
-
ExpressionSemanticVisitor.visit(output.handler, this.tcb.id, this.tcb.boundTarget, this.tcb.oobRecorder);
|
|
46527
46497
|
}
|
|
46528
46498
|
return null;
|
|
46529
46499
|
}
|
|
@@ -46573,7 +46543,6 @@ var TcbUnclaimedOutputsOp = class extends TcbOp {
|
|
|
46573
46543
|
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 1);
|
|
46574
46544
|
this.scope.addStatement(import_typescript101.default.factory.createExpressionStatement(handler));
|
|
46575
46545
|
}
|
|
46576
|
-
ExpressionSemanticVisitor.visit(output.handler, this.tcb.id, this.tcb.boundTarget, this.tcb.oobRecorder);
|
|
46577
46546
|
}
|
|
46578
46547
|
return null;
|
|
46579
46548
|
}
|
|
@@ -48493,6 +48462,10 @@ var TemplateTypeCheckerImpl = class {
|
|
|
48493
48462
|
fileData.isComplete = false;
|
|
48494
48463
|
this.isComplete = false;
|
|
48495
48464
|
}
|
|
48465
|
+
getExpressionTarget(expression, clazz) {
|
|
48466
|
+
var _a2;
|
|
48467
|
+
return ((_a2 = this.getLatestComponentState(clazz).data) == null ? void 0 : _a2.boundTarget.getExpressionTarget(expression)) || null;
|
|
48468
|
+
}
|
|
48496
48469
|
makeTemplateDiagnostic(clazz, sourceSpan, category, errorCode, message, relatedInformation) {
|
|
48497
48470
|
const sfPath = absoluteFromSourceFile(clazz.getSourceFile());
|
|
48498
48471
|
const fileRecord = this.state.get(sfPath);
|
|
@@ -48978,8 +48951,25 @@ var SingleShimTypeCheckingHost = class extends SingleFileTypeCheckingHost {
|
|
|
48978
48951
|
}
|
|
48979
48952
|
};
|
|
48980
48953
|
|
|
48981
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/
|
|
48954
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/symbol_util.mjs
|
|
48982
48955
|
var import_typescript107 = __toESM(require("typescript"), 1);
|
|
48956
|
+
var SIGNAL_FNS = /* @__PURE__ */ new Set([
|
|
48957
|
+
"WritableSignal",
|
|
48958
|
+
"Signal",
|
|
48959
|
+
"InputSignal",
|
|
48960
|
+
"InputSignalWithTransform",
|
|
48961
|
+
"ModelSignal"
|
|
48962
|
+
]);
|
|
48963
|
+
function isSignalReference(symbol) {
|
|
48964
|
+
return (symbol.kind === SymbolKind.Expression || symbol.kind === SymbolKind.Variable) && (symbol.tsType.symbol !== void 0 && isSignalSymbol(symbol.tsType.symbol) || symbol.tsType.aliasSymbol !== void 0 && isSignalSymbol(symbol.tsType.aliasSymbol));
|
|
48965
|
+
}
|
|
48966
|
+
function isSignalSymbol(symbol) {
|
|
48967
|
+
const declarations = symbol.getDeclarations();
|
|
48968
|
+
return declarations !== void 0 && declarations.some((decl) => {
|
|
48969
|
+
const fileName = decl.getSourceFile().fileName;
|
|
48970
|
+
return (import_typescript107.default.isInterfaceDeclaration(decl) || import_typescript107.default.isTypeAliasDeclaration(decl)) && SIGNAL_FNS.has(decl.name.text) && (fileName.includes("@angular/core") || fileName.includes("angular2/rc/packages/core"));
|
|
48971
|
+
});
|
|
48972
|
+
}
|
|
48983
48973
|
|
|
48984
48974
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/api/api.mjs
|
|
48985
48975
|
var TemplateCheckWithVisitor = class {
|
|
@@ -49105,13 +49095,6 @@ var TemplateVisitor2 = class extends RecursiveAstVisitor2 {
|
|
|
49105
49095
|
};
|
|
49106
49096
|
|
|
49107
49097
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/interpolated_signal_not_invoked/index.mjs
|
|
49108
|
-
var SIGNAL_FNS = /* @__PURE__ */ new Set([
|
|
49109
|
-
"WritableSignal",
|
|
49110
|
-
"Signal",
|
|
49111
|
-
"InputSignal",
|
|
49112
|
-
"InputSignalWithTransform",
|
|
49113
|
-
"ModelSignal"
|
|
49114
|
-
]);
|
|
49115
49098
|
var SIGNAL_INSTANCE_PROPERTIES = /* @__PURE__ */ new Set(["set", "update", "asReadonly"]);
|
|
49116
49099
|
var FUNCTION_INSTANCE_PROPERTIES = /* @__PURE__ */ new Set(["name", "length", "prototype"]);
|
|
49117
49100
|
var InterpolatedSignalCheck = class extends TemplateCheckWithVisitor {
|
|
@@ -49126,13 +49109,6 @@ var InterpolatedSignalCheck = class extends TemplateCheckWithVisitor {
|
|
|
49126
49109
|
return [];
|
|
49127
49110
|
}
|
|
49128
49111
|
};
|
|
49129
|
-
function isSignal(symbol) {
|
|
49130
|
-
const declarations = symbol == null ? void 0 : symbol.getDeclarations();
|
|
49131
|
-
return declarations !== void 0 && declarations.some((decl) => {
|
|
49132
|
-
const fileName = decl.getSourceFile().fileName;
|
|
49133
|
-
return (import_typescript107.default.isInterfaceDeclaration(decl) || import_typescript107.default.isTypeAliasDeclaration(decl)) && SIGNAL_FNS.has(decl.name.text) && (fileName.includes("@angular/core") || fileName.includes("angular2/rc/packages/core"));
|
|
49134
|
-
});
|
|
49135
|
-
}
|
|
49136
49112
|
function isFunctionInstanceProperty(name) {
|
|
49137
49113
|
return FUNCTION_INSTANCE_PROPERTIES.has(name);
|
|
49138
49114
|
}
|
|
@@ -49141,14 +49117,14 @@ function isSignalInstanceProperty(name) {
|
|
|
49141
49117
|
}
|
|
49142
49118
|
function buildDiagnosticForSignal(ctx, node, component) {
|
|
49143
49119
|
const symbol = ctx.templateTypeChecker.getSymbolOfNode(node, component);
|
|
49144
|
-
if (
|
|
49120
|
+
if (symbol !== null && symbol.kind === SymbolKind.Expression && isSignalReference(symbol)) {
|
|
49145
49121
|
const templateMapping = ctx.templateTypeChecker.getTemplateMappingAtTcbLocation(symbol.tcbLocation);
|
|
49146
49122
|
const errorString = `${node.name} is a function and should be invoked: ${node.name}()`;
|
|
49147
49123
|
const diagnostic = ctx.makeTemplateDiagnostic(templateMapping.span, errorString);
|
|
49148
49124
|
return [diagnostic];
|
|
49149
49125
|
}
|
|
49150
49126
|
const symbolOfReceiver = ctx.templateTypeChecker.getSymbolOfNode(node.receiver, component);
|
|
49151
|
-
if ((isFunctionInstanceProperty(node.name) || isSignalInstanceProperty(node.name)) &&
|
|
49127
|
+
if ((isFunctionInstanceProperty(node.name) || isSignalInstanceProperty(node.name)) && symbolOfReceiver !== null && symbolOfReceiver.kind === SymbolKind.Expression && isSignalReference(symbolOfReceiver)) {
|
|
49152
49128
|
const templateMapping = ctx.templateTypeChecker.getTemplateMappingAtTcbLocation(symbolOfReceiver.tcbLocation);
|
|
49153
49129
|
const errorString = `${node.receiver.name} is a function and should be invoked: ${node.receiver.name}()`;
|
|
49154
49130
|
const diagnostic = ctx.makeTemplateDiagnostic(templateMapping.span, errorString);
|
|
@@ -49492,6 +49468,87 @@ var SUPPORTED_DIAGNOSTIC_NAMES = /* @__PURE__ */ new Set([
|
|
|
49492
49468
|
...ALL_DIAGNOSTIC_FACTORIES.map((factory9) => factory9.name)
|
|
49493
49469
|
]);
|
|
49494
49470
|
|
|
49471
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/template_semantics/src/template_semantics_checker.mjs
|
|
49472
|
+
var import_typescript111 = __toESM(require("typescript"), 1);
|
|
49473
|
+
var TemplateSemanticsCheckerImpl = class {
|
|
49474
|
+
constructor(templateTypeChecker) {
|
|
49475
|
+
this.templateTypeChecker = templateTypeChecker;
|
|
49476
|
+
}
|
|
49477
|
+
getDiagnosticsForComponent(component) {
|
|
49478
|
+
const template2 = this.templateTypeChecker.getTemplate(component);
|
|
49479
|
+
return template2 !== null ? TemplateSemanticsVisitor.visit(template2, component, this.templateTypeChecker) : [];
|
|
49480
|
+
}
|
|
49481
|
+
};
|
|
49482
|
+
var TemplateSemanticsVisitor = class extends RecursiveVisitor {
|
|
49483
|
+
constructor(expressionVisitor) {
|
|
49484
|
+
super();
|
|
49485
|
+
this.expressionVisitor = expressionVisitor;
|
|
49486
|
+
}
|
|
49487
|
+
static visit(nodes, component, templateTypeChecker) {
|
|
49488
|
+
const diagnostics = [];
|
|
49489
|
+
const expressionVisitor = new ExpressionsSemanticsVisitor(templateTypeChecker, component, diagnostics);
|
|
49490
|
+
const templateVisitor = new TemplateSemanticsVisitor(expressionVisitor);
|
|
49491
|
+
nodes.forEach((node) => node.visit(templateVisitor));
|
|
49492
|
+
return diagnostics;
|
|
49493
|
+
}
|
|
49494
|
+
visitBoundEvent(event) {
|
|
49495
|
+
super.visitBoundEvent(event);
|
|
49496
|
+
event.handler.visit(this.expressionVisitor, event);
|
|
49497
|
+
}
|
|
49498
|
+
};
|
|
49499
|
+
var ExpressionsSemanticsVisitor = class extends RecursiveAstVisitor2 {
|
|
49500
|
+
constructor(templateTypeChecker, component, diagnostics) {
|
|
49501
|
+
super();
|
|
49502
|
+
this.templateTypeChecker = templateTypeChecker;
|
|
49503
|
+
this.component = component;
|
|
49504
|
+
this.diagnostics = diagnostics;
|
|
49505
|
+
}
|
|
49506
|
+
visitPropertyWrite(ast, context) {
|
|
49507
|
+
super.visitPropertyWrite(ast, context);
|
|
49508
|
+
this.checkForIllegalWriteInEventBinding(ast, context);
|
|
49509
|
+
}
|
|
49510
|
+
visitPropertyRead(ast, context) {
|
|
49511
|
+
super.visitPropertyRead(ast, context);
|
|
49512
|
+
this.checkForIllegalWriteInTwoWayBinding(ast, context);
|
|
49513
|
+
}
|
|
49514
|
+
checkForIllegalWriteInEventBinding(ast, context) {
|
|
49515
|
+
if (!(context instanceof BoundEvent) || !(ast.receiver instanceof ImplicitReceiver)) {
|
|
49516
|
+
return;
|
|
49517
|
+
}
|
|
49518
|
+
const target = this.templateTypeChecker.getExpressionTarget(ast, this.component);
|
|
49519
|
+
if (target instanceof Variable) {
|
|
49520
|
+
const errorMessage = `Cannot use variable '${target.name}' as the left-hand side of an assignment expression. Template variables are read-only.`;
|
|
49521
|
+
this.diagnostics.push(this.makeIllegalTemplateVarDiagnostic(target, context, errorMessage));
|
|
49522
|
+
}
|
|
49523
|
+
}
|
|
49524
|
+
checkForIllegalWriteInTwoWayBinding(ast, context) {
|
|
49525
|
+
if (!(context instanceof BoundEvent) || context.type !== 2 || !(ast.receiver instanceof ImplicitReceiver) || ast !== unwrapAstWithSource(context.handler)) {
|
|
49526
|
+
return;
|
|
49527
|
+
}
|
|
49528
|
+
const target = this.templateTypeChecker.getExpressionTarget(ast, this.component);
|
|
49529
|
+
if (!(target instanceof Variable)) {
|
|
49530
|
+
return;
|
|
49531
|
+
}
|
|
49532
|
+
const symbol = this.templateTypeChecker.getSymbolOfNode(target, this.component);
|
|
49533
|
+
if (symbol !== null && !isSignalReference(symbol)) {
|
|
49534
|
+
const errorMessage = `Cannot use a non-signal variable '${target.name}' in a two-way binding expression. Template variables are read-only.`;
|
|
49535
|
+
this.diagnostics.push(this.makeIllegalTemplateVarDiagnostic(target, context, errorMessage));
|
|
49536
|
+
}
|
|
49537
|
+
}
|
|
49538
|
+
makeIllegalTemplateVarDiagnostic(target, expressionNode, errorMessage) {
|
|
49539
|
+
var _a2, _b2;
|
|
49540
|
+
return this.templateTypeChecker.makeTemplateDiagnostic(this.component, expressionNode.handlerSpan, import_typescript111.default.DiagnosticCategory.Error, ngErrorCode(ErrorCode.WRITE_TO_READ_ONLY_VARIABLE), errorMessage, [{
|
|
49541
|
+
text: `The variable ${target.name} is declared here.`,
|
|
49542
|
+
start: ((_a2 = target.valueSpan) == null ? void 0 : _a2.start.offset) || target.sourceSpan.start.offset,
|
|
49543
|
+
end: ((_b2 = target.valueSpan) == null ? void 0 : _b2.end.offset) || target.sourceSpan.end.offset,
|
|
49544
|
+
sourceFile: this.component.getSourceFile()
|
|
49545
|
+
}]);
|
|
49546
|
+
}
|
|
49547
|
+
};
|
|
49548
|
+
function unwrapAstWithSource(ast) {
|
|
49549
|
+
return ast instanceof ASTWithSource ? ast.ast : ast;
|
|
49550
|
+
}
|
|
49551
|
+
|
|
49495
49552
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/feature_detection.mjs
|
|
49496
49553
|
var import_semver = __toESM(require_semver2(), 1);
|
|
49497
49554
|
function coreVersionSupportsFeature(coreVersion, minVersion) {
|
|
@@ -49577,7 +49634,7 @@ var NgCompiler = class {
|
|
|
49577
49634
|
this.currentProgram = inputProgram;
|
|
49578
49635
|
this.closureCompilerEnabled = !!this.options.annotateForClosureCompiler;
|
|
49579
49636
|
this.entryPoint = adapter.entryPoint !== null ? getSourceFileOrNull(inputProgram, adapter.entryPoint) : null;
|
|
49580
|
-
const moduleResolutionCache =
|
|
49637
|
+
const moduleResolutionCache = import_typescript112.default.createModuleResolutionCache(
|
|
49581
49638
|
this.adapter.getCurrentDirectory(),
|
|
49582
49639
|
this.adapter.getCanonicalFileName.bind(this.adapter)
|
|
49583
49640
|
);
|
|
@@ -49621,7 +49678,7 @@ var NgCompiler = class {
|
|
|
49621
49678
|
}
|
|
49622
49679
|
for (const clazz of classesToUpdate) {
|
|
49623
49680
|
this.compilation.traitCompiler.updateResources(clazz);
|
|
49624
|
-
if (!
|
|
49681
|
+
if (!import_typescript112.default.isClassDeclaration(clazz)) {
|
|
49625
49682
|
continue;
|
|
49626
49683
|
}
|
|
49627
49684
|
this.compilation.templateTypeChecker.invalidateClass(clazz);
|
|
@@ -49637,10 +49694,7 @@ var NgCompiler = class {
|
|
|
49637
49694
|
...this.getNonTemplateDiagnostics()
|
|
49638
49695
|
];
|
|
49639
49696
|
try {
|
|
49640
|
-
diagnostics.push(...this.getTemplateDiagnostics());
|
|
49641
|
-
if (this.options.strictTemplates) {
|
|
49642
|
-
diagnostics.push(...this.getExtendedTemplateDiagnostics());
|
|
49643
|
-
}
|
|
49697
|
+
diagnostics.push(...this.getTemplateDiagnostics(), ...this.runAdditionalChecks());
|
|
49644
49698
|
} catch (err) {
|
|
49645
49699
|
if (!isFatalDiagnosticError(err)) {
|
|
49646
49700
|
throw err;
|
|
@@ -49652,10 +49706,7 @@ var NgCompiler = class {
|
|
|
49652
49706
|
getDiagnosticsForFile(file, optimizeFor) {
|
|
49653
49707
|
const diagnostics = [...this.getNonTemplateDiagnostics().filter((diag) => diag.file === file)];
|
|
49654
49708
|
try {
|
|
49655
|
-
diagnostics.push(...this.getTemplateDiagnosticsForFile(file, optimizeFor));
|
|
49656
|
-
if (this.options.strictTemplates) {
|
|
49657
|
-
diagnostics.push(...this.getExtendedTemplateDiagnostics(file));
|
|
49658
|
-
}
|
|
49709
|
+
diagnostics.push(...this.getTemplateDiagnosticsForFile(file, optimizeFor), ...this.runAdditionalChecks(file));
|
|
49659
49710
|
} catch (err) {
|
|
49660
49711
|
if (!isFatalDiagnosticError(err)) {
|
|
49661
49712
|
throw err;
|
|
@@ -49670,8 +49721,11 @@ var NgCompiler = class {
|
|
|
49670
49721
|
const diagnostics = [];
|
|
49671
49722
|
try {
|
|
49672
49723
|
diagnostics.push(...ttc.getDiagnosticsForComponent(component));
|
|
49673
|
-
const extendedTemplateChecker = compilation
|
|
49674
|
-
if (
|
|
49724
|
+
const { extendedTemplateChecker, templateSemanticsChecker } = compilation;
|
|
49725
|
+
if (templateSemanticsChecker !== null) {
|
|
49726
|
+
diagnostics.push(...templateSemanticsChecker.getDiagnosticsForComponent(component));
|
|
49727
|
+
}
|
|
49728
|
+
if (this.options.strictTemplates && extendedTemplateChecker !== null) {
|
|
49675
49729
|
diagnostics.push(...extendedTemplateChecker.getDiagnosticsForComponent(component));
|
|
49676
49730
|
}
|
|
49677
49731
|
} catch (err) {
|
|
@@ -49967,18 +50021,24 @@ var NgCompiler = class {
|
|
|
49967
50021
|
}
|
|
49968
50022
|
return this.nonTemplateDiagnostics;
|
|
49969
50023
|
}
|
|
49970
|
-
|
|
50024
|
+
runAdditionalChecks(sf) {
|
|
49971
50025
|
const diagnostics = [];
|
|
49972
50026
|
const compilation = this.ensureAnalyzed();
|
|
49973
|
-
const extendedTemplateChecker = compilation
|
|
49974
|
-
|
|
49975
|
-
|
|
49976
|
-
|
|
49977
|
-
|
|
49978
|
-
|
|
49979
|
-
|
|
49980
|
-
|
|
49981
|
-
|
|
50027
|
+
const { extendedTemplateChecker, templateSemanticsChecker } = compilation;
|
|
50028
|
+
const files = sf ? [sf] : this.inputProgram.getSourceFiles();
|
|
50029
|
+
for (const sf2 of files) {
|
|
50030
|
+
if (templateSemanticsChecker !== null) {
|
|
50031
|
+
diagnostics.push(...compilation.traitCompiler.runAdditionalChecks(sf2, (clazz, handler) => {
|
|
50032
|
+
var _a2;
|
|
50033
|
+
return ((_a2 = handler.templateSemanticsCheck) == null ? void 0 : _a2.call(handler, clazz, templateSemanticsChecker)) || null;
|
|
50034
|
+
}));
|
|
50035
|
+
}
|
|
50036
|
+
if (this.options.strictTemplates && extendedTemplateChecker !== null) {
|
|
50037
|
+
diagnostics.push(...compilation.traitCompiler.runAdditionalChecks(sf2, (clazz, handler) => {
|
|
50038
|
+
var _a2;
|
|
50039
|
+
return ((_a2 = handler.extendedTemplateCheck) == null ? void 0 : _a2.call(handler, clazz, extendedTemplateChecker)) || null;
|
|
50040
|
+
}));
|
|
50041
|
+
}
|
|
49982
50042
|
}
|
|
49983
50043
|
return diagnostics;
|
|
49984
50044
|
}
|
|
@@ -50087,6 +50147,7 @@ var NgCompiler = class {
|
|
|
50087
50147
|
});
|
|
50088
50148
|
const templateTypeChecker = new TemplateTypeCheckerImpl(this.inputProgram, notifyingDriver, traitCompiler, this.getTypeCheckingConfig(), refEmitter, reflector, this.adapter, this.incrementalCompilation, metaReader, localMetaReader, ngModuleIndex, scopeReader, typeCheckScopeRegistry, this.delegatingPerfRecorder);
|
|
50089
50149
|
const extendedTemplateChecker = this.constructionDiagnostics.length === 0 ? new ExtendedTemplateCheckerImpl(templateTypeChecker, checker, ALL_DIAGNOSTIC_FACTORIES, this.options) : null;
|
|
50150
|
+
const templateSemanticsChecker = this.constructionDiagnostics.length === 0 ? new TemplateSemanticsCheckerImpl(templateTypeChecker) : null;
|
|
50090
50151
|
return {
|
|
50091
50152
|
isCore,
|
|
50092
50153
|
traitCompiler,
|
|
@@ -50101,7 +50162,8 @@ var NgCompiler = class {
|
|
|
50101
50162
|
templateTypeChecker,
|
|
50102
50163
|
resourceRegistry,
|
|
50103
50164
|
extendedTemplateChecker,
|
|
50104
|
-
localCompilationExtraImportsTracker
|
|
50165
|
+
localCompilationExtraImportsTracker,
|
|
50166
|
+
templateSemanticsChecker
|
|
50105
50167
|
};
|
|
50106
50168
|
}
|
|
50107
50169
|
};
|
|
@@ -50111,18 +50173,18 @@ function isAngularCorePackage(program) {
|
|
|
50111
50173
|
return false;
|
|
50112
50174
|
}
|
|
50113
50175
|
return r3Symbols.statements.some((stmt) => {
|
|
50114
|
-
if (!
|
|
50176
|
+
if (!import_typescript112.default.isVariableStatement(stmt)) {
|
|
50115
50177
|
return false;
|
|
50116
50178
|
}
|
|
50117
|
-
const modifiers =
|
|
50118
|
-
if (modifiers === void 0 || !modifiers.some((mod) => mod.kind ===
|
|
50179
|
+
const modifiers = import_typescript112.default.getModifiers(stmt);
|
|
50180
|
+
if (modifiers === void 0 || !modifiers.some((mod) => mod.kind === import_typescript112.default.SyntaxKind.ExportKeyword)) {
|
|
50119
50181
|
return false;
|
|
50120
50182
|
}
|
|
50121
50183
|
return stmt.declarationList.declarations.some((decl) => {
|
|
50122
|
-
if (!
|
|
50184
|
+
if (!import_typescript112.default.isIdentifier(decl.name) || decl.name.text !== "ITS_JUST_ANGULAR") {
|
|
50123
50185
|
return false;
|
|
50124
50186
|
}
|
|
50125
|
-
if (decl.initializer === void 0 || decl.initializer.kind !==
|
|
50187
|
+
if (decl.initializer === void 0 || decl.initializer.kind !== import_typescript112.default.SyntaxKind.TrueKeyword) {
|
|
50126
50188
|
return false;
|
|
50127
50189
|
}
|
|
50128
50190
|
return true;
|
|
@@ -50136,7 +50198,7 @@ function* verifyCompatibleTypeCheckOptions(options) {
|
|
|
50136
50198
|
var _a2, _b2, _c2;
|
|
50137
50199
|
if (options.fullTemplateTypeCheck === false && options.strictTemplates === true) {
|
|
50138
50200
|
yield makeConfigDiagnostic({
|
|
50139
|
-
category:
|
|
50201
|
+
category: import_typescript112.default.DiagnosticCategory.Error,
|
|
50140
50202
|
code: ErrorCode.CONFIG_STRICT_TEMPLATES_IMPLIES_FULL_TEMPLATE_TYPECHECK,
|
|
50141
50203
|
messageText: `
|
|
50142
50204
|
Angular compiler option "strictTemplates" is enabled, however "fullTemplateTypeCheck" is disabled.
|
|
@@ -50155,7 +50217,7 @@ https://angular.io/guide/template-typecheck
|
|
|
50155
50217
|
}
|
|
50156
50218
|
if (options.extendedDiagnostics && options.strictTemplates === false) {
|
|
50157
50219
|
yield makeConfigDiagnostic({
|
|
50158
|
-
category:
|
|
50220
|
+
category: import_typescript112.default.DiagnosticCategory.Error,
|
|
50159
50221
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_IMPLIES_STRICT_TEMPLATES,
|
|
50160
50222
|
messageText: `
|
|
50161
50223
|
Angular compiler option "extendedDiagnostics" is configured, however "strictTemplates" is disabled.
|
|
@@ -50172,7 +50234,7 @@ One of the following actions is required:
|
|
|
50172
50234
|
const defaultCategory = (_a2 = options.extendedDiagnostics) == null ? void 0 : _a2.defaultCategory;
|
|
50173
50235
|
if (defaultCategory && !allowedCategoryLabels.includes(defaultCategory)) {
|
|
50174
50236
|
yield makeConfigDiagnostic({
|
|
50175
|
-
category:
|
|
50237
|
+
category: import_typescript112.default.DiagnosticCategory.Error,
|
|
50176
50238
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL,
|
|
50177
50239
|
messageText: `
|
|
50178
50240
|
Angular compiler option "extendedDiagnostics.defaultCategory" has an unknown diagnostic category: "${defaultCategory}".
|
|
@@ -50185,7 +50247,7 @@ ${allowedCategoryLabels.join("\n")}
|
|
|
50185
50247
|
for (const [checkName, category] of Object.entries((_c2 = (_b2 = options.extendedDiagnostics) == null ? void 0 : _b2.checks) != null ? _c2 : {})) {
|
|
50186
50248
|
if (!SUPPORTED_DIAGNOSTIC_NAMES.has(checkName)) {
|
|
50187
50249
|
yield makeConfigDiagnostic({
|
|
50188
|
-
category:
|
|
50250
|
+
category: import_typescript112.default.DiagnosticCategory.Error,
|
|
50189
50251
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CHECK,
|
|
50190
50252
|
messageText: `
|
|
50191
50253
|
Angular compiler option "extendedDiagnostics.checks" has an unknown check: "${checkName}".
|
|
@@ -50197,7 +50259,7 @@ ${Array.from(SUPPORTED_DIAGNOSTIC_NAMES).join("\n")}
|
|
|
50197
50259
|
}
|
|
50198
50260
|
if (!allowedCategoryLabels.includes(category)) {
|
|
50199
50261
|
yield makeConfigDiagnostic({
|
|
50200
|
-
category:
|
|
50262
|
+
category: import_typescript112.default.DiagnosticCategory.Error,
|
|
50201
50263
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL,
|
|
50202
50264
|
messageText: `
|
|
50203
50265
|
Angular compiler option "extendedDiagnostics.checks['${checkName}']" has an unknown diagnostic category: "${category}".
|
|
@@ -50227,7 +50289,7 @@ var ReferenceGraphAdapter = class {
|
|
|
50227
50289
|
for (const { node } of references) {
|
|
50228
50290
|
let sourceFile = node.getSourceFile();
|
|
50229
50291
|
if (sourceFile === void 0) {
|
|
50230
|
-
sourceFile =
|
|
50292
|
+
sourceFile = import_typescript112.default.getOriginalNode(node).getSourceFile();
|
|
50231
50293
|
}
|
|
50232
50294
|
if (sourceFile === void 0 || !isDtsPath(sourceFile.fileName)) {
|
|
50233
50295
|
this.graph.add(source, node);
|
|
@@ -50266,7 +50328,7 @@ function versionMapFromProgram(program, driver) {
|
|
|
50266
50328
|
}
|
|
50267
50329
|
|
|
50268
50330
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/host.mjs
|
|
50269
|
-
var
|
|
50331
|
+
var import_typescript114 = __toESM(require("typescript"), 1);
|
|
50270
50332
|
var DelegatingCompilerHost2 = class {
|
|
50271
50333
|
get jsDocParsingMode() {
|
|
50272
50334
|
return this.delegate.jsDocParsingMode;
|
|
@@ -50351,7 +50413,7 @@ var NgCompilerHost = class extends DelegatingCompilerHost2 {
|
|
|
50351
50413
|
entryPoint = findFlatIndexEntryPoint(normalizedTsInputFiles);
|
|
50352
50414
|
if (entryPoint === null) {
|
|
50353
50415
|
diagnostics.push({
|
|
50354
|
-
category:
|
|
50416
|
+
category: import_typescript114.default.DiagnosticCategory.Error,
|
|
50355
50417
|
code: ngErrorCode(ErrorCode.CONFIG_FLAT_MODULE_NO_INDEX),
|
|
50356
50418
|
file: void 0,
|
|
50357
50419
|
start: void 0,
|
|
@@ -50394,10 +50456,10 @@ var NgCompilerHost = class extends DelegatingCompilerHost2 {
|
|
|
50394
50456
|
return this.fileNameToModuleName !== void 0 ? this : null;
|
|
50395
50457
|
}
|
|
50396
50458
|
createCachedResolveModuleNamesFunction() {
|
|
50397
|
-
const moduleResolutionCache =
|
|
50459
|
+
const moduleResolutionCache = import_typescript114.default.createModuleResolutionCache(this.getCurrentDirectory(), this.getCanonicalFileName.bind(this));
|
|
50398
50460
|
return (moduleNames, containingFile, reusedNames, redirectedReference, options) => {
|
|
50399
50461
|
return moduleNames.map((moduleName) => {
|
|
50400
|
-
const module2 =
|
|
50462
|
+
const module2 = import_typescript114.default.resolveModuleName(moduleName, containingFile, options, this, moduleResolutionCache, redirectedReference);
|
|
50401
50463
|
return module2.resolvedModule;
|
|
50402
50464
|
});
|
|
50403
50465
|
};
|
|
@@ -50421,7 +50483,7 @@ var NgtscProgram = class {
|
|
|
50421
50483
|
if (reuseProgram !== void 0) {
|
|
50422
50484
|
retagAllTsFiles(reuseProgram);
|
|
50423
50485
|
}
|
|
50424
|
-
this.tsProgram = perfRecorder.inPhase(PerfPhase.TypeScriptProgramCreate, () =>
|
|
50486
|
+
this.tsProgram = perfRecorder.inPhase(PerfPhase.TypeScriptProgramCreate, () => import_typescript116.default.createProgram(this.host.inputFiles, options, this.host, reuseProgram));
|
|
50425
50487
|
perfRecorder.phase(PerfPhase.Unaccounted);
|
|
50426
50488
|
perfRecorder.memory(PerfCheckpoint.TypeScriptProgramCreate);
|
|
50427
50489
|
this.host.postProgramCreationCleanup();
|
|
@@ -50637,10 +50699,10 @@ function createProgram({ rootNames, options, host, oldProgram }) {
|
|
|
50637
50699
|
}
|
|
50638
50700
|
|
|
50639
50701
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/perform_compile.mjs
|
|
50640
|
-
var
|
|
50702
|
+
var import_typescript118 = __toESM(require("typescript"), 1);
|
|
50641
50703
|
|
|
50642
50704
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/transformers/util.mjs
|
|
50643
|
-
var
|
|
50705
|
+
var import_typescript117 = __toESM(require("typescript"), 1);
|
|
50644
50706
|
|
|
50645
50707
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/private/tooling.mjs
|
|
50646
50708
|
var GLOBAL_DEFS_FOR_TERSER = {
|
|
@@ -50675,14 +50737,14 @@ setFileSystem(new NodeJSFileSystem());
|
|
|
50675
50737
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/ng-generate/standalone-migration/index.mjs
|
|
50676
50738
|
var import_fs2 = require("fs");
|
|
50677
50739
|
var import_path8 = require("path");
|
|
50678
|
-
var
|
|
50740
|
+
var import_typescript131 = __toESM(require("typescript"), 1);
|
|
50679
50741
|
|
|
50680
50742
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/change_tracker.mjs
|
|
50681
|
-
var
|
|
50743
|
+
var import_typescript120 = __toESM(require("typescript"), 1);
|
|
50682
50744
|
|
|
50683
50745
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/import_manager.mjs
|
|
50684
50746
|
var import_path4 = require("path");
|
|
50685
|
-
var
|
|
50747
|
+
var import_typescript119 = __toESM(require("typescript"), 1);
|
|
50686
50748
|
var ImportManager2 = class {
|
|
50687
50749
|
constructor(getUpdateRecorder, printer) {
|
|
50688
50750
|
__publicField(this, "getUpdateRecorder");
|
|
@@ -50705,7 +50767,7 @@ var ImportManager2 = class {
|
|
|
50705
50767
|
}
|
|
50706
50768
|
for (let i = sourceFile.statements.length - 1; i >= 0; i--) {
|
|
50707
50769
|
const statement = sourceFile.statements[i];
|
|
50708
|
-
if (!
|
|
50770
|
+
if (!import_typescript119.default.isImportDeclaration(statement) || !import_typescript119.default.isStringLiteral(statement.moduleSpecifier) || !statement.importClause) {
|
|
50709
50771
|
continue;
|
|
50710
50772
|
}
|
|
50711
50773
|
if (importStartIndex === 0) {
|
|
@@ -50717,9 +50779,9 @@ var ImportManager2 = class {
|
|
|
50717
50779
|
}
|
|
50718
50780
|
if (statement.importClause.namedBindings) {
|
|
50719
50781
|
const namedBindings = statement.importClause.namedBindings;
|
|
50720
|
-
if (
|
|
50721
|
-
return
|
|
50722
|
-
} else if (
|
|
50782
|
+
if (import_typescript119.default.isNamespaceImport(namedBindings) && !typeImport) {
|
|
50783
|
+
return import_typescript119.default.factory.createPropertyAccessExpression(import_typescript119.default.factory.createIdentifier(namedBindings.name.text), import_typescript119.default.factory.createIdentifier(alias || symbolName || "default"));
|
|
50784
|
+
} else if (import_typescript119.default.isNamedImports(namedBindings) && symbolName) {
|
|
50723
50785
|
const existingElement = namedBindings.elements.find((e) => {
|
|
50724
50786
|
if (alias) {
|
|
50725
50787
|
return e.propertyName && e.name.text === alias && e.propertyName.text === symbolName;
|
|
@@ -50727,12 +50789,12 @@ var ImportManager2 = class {
|
|
|
50727
50789
|
return e.propertyName ? e.propertyName.text === symbolName : e.name.text === symbolName;
|
|
50728
50790
|
});
|
|
50729
50791
|
if (existingElement) {
|
|
50730
|
-
return
|
|
50792
|
+
return import_typescript119.default.factory.createIdentifier(existingElement.name.text);
|
|
50731
50793
|
}
|
|
50732
50794
|
existingImport = statement;
|
|
50733
50795
|
}
|
|
50734
50796
|
} else if (statement.importClause.name && !symbolName) {
|
|
50735
|
-
return
|
|
50797
|
+
return import_typescript119.default.factory.createIdentifier(statement.importClause.name.text);
|
|
50736
50798
|
}
|
|
50737
50799
|
}
|
|
50738
50800
|
if (existingImport) {
|
|
@@ -50756,7 +50818,7 @@ var ImportManager2 = class {
|
|
|
50756
50818
|
if (!importMap.has(moduleName)) {
|
|
50757
50819
|
importMap.set(moduleName, []);
|
|
50758
50820
|
}
|
|
50759
|
-
importMap.get(moduleName).push(
|
|
50821
|
+
importMap.get(moduleName).push(import_typescript119.default.factory.createImportSpecifier(false, propertyName, name));
|
|
50760
50822
|
} else {
|
|
50761
50823
|
const importMap = this.newImports.get(sourceFile).defaultImports;
|
|
50762
50824
|
identifier = this._getUniqueIdentifier(sourceFile, "defaultExport");
|
|
@@ -50770,19 +50832,19 @@ var ImportManager2 = class {
|
|
|
50770
50832
|
const sourceFile = importDecl.getSourceFile();
|
|
50771
50833
|
const recorder = this.getUpdateRecorder(sourceFile);
|
|
50772
50834
|
const namedBindings = importDecl.importClause.namedBindings;
|
|
50773
|
-
const newNamedBindings =
|
|
50774
|
-
const newNamedBindingsText = this.printer.printNode(
|
|
50835
|
+
const newNamedBindings = import_typescript119.default.factory.updateNamedImports(namedBindings, namedBindings.elements.concat(expressions.map(({ propertyName, importName }) => import_typescript119.default.factory.createImportSpecifier(false, propertyName, importName))));
|
|
50836
|
+
const newNamedBindingsText = this.printer.printNode(import_typescript119.default.EmitHint.Unspecified, newNamedBindings, sourceFile);
|
|
50775
50837
|
recorder.updateExistingImport(namedBindings, newNamedBindingsText);
|
|
50776
50838
|
});
|
|
50777
50839
|
this.newImports.forEach(({ importStartIndex, defaultImports, namedImports }, sourceFile) => {
|
|
50778
50840
|
const recorder = this.getUpdateRecorder(sourceFile);
|
|
50779
50841
|
const useSingleQuotes = this._getQuoteStyle(sourceFile) === 0;
|
|
50780
50842
|
defaultImports.forEach((identifier, moduleName) => {
|
|
50781
|
-
const newImport =
|
|
50843
|
+
const newImport = import_typescript119.default.factory.createImportDeclaration(void 0, import_typescript119.default.factory.createImportClause(false, identifier, void 0), import_typescript119.default.factory.createStringLiteral(moduleName, useSingleQuotes));
|
|
50782
50844
|
recorder.addNewImport(importStartIndex, this._getNewImportText(importStartIndex, newImport, sourceFile));
|
|
50783
50845
|
});
|
|
50784
50846
|
namedImports.forEach((specifiers, moduleName) => {
|
|
50785
|
-
const newImport =
|
|
50847
|
+
const newImport = import_typescript119.default.factory.createImportDeclaration(void 0, import_typescript119.default.factory.createImportClause(false, void 0, import_typescript119.default.factory.createNamedImports(specifiers)), import_typescript119.default.factory.createStringLiteral(moduleName, useSingleQuotes));
|
|
50786
50848
|
recorder.addNewImport(importStartIndex, this._getNewImportText(importStartIndex, newImport, sourceFile));
|
|
50787
50849
|
});
|
|
50788
50850
|
});
|
|
@@ -50790,7 +50852,7 @@ var ImportManager2 = class {
|
|
|
50790
50852
|
_getUniqueIdentifier(sourceFile, baseName) {
|
|
50791
50853
|
if (this.isUniqueIdentifierName(sourceFile, baseName)) {
|
|
50792
50854
|
this._recordUsedIdentifier(sourceFile, baseName);
|
|
50793
|
-
return
|
|
50855
|
+
return import_typescript119.default.factory.createIdentifier(baseName);
|
|
50794
50856
|
}
|
|
50795
50857
|
let name = null;
|
|
50796
50858
|
let counter = 1;
|
|
@@ -50798,7 +50860,7 @@ var ImportManager2 = class {
|
|
|
50798
50860
|
name = `${baseName}_${counter++}`;
|
|
50799
50861
|
} while (!this.isUniqueIdentifierName(sourceFile, name));
|
|
50800
50862
|
this._recordUsedIdentifier(sourceFile, name);
|
|
50801
|
-
return
|
|
50863
|
+
return import_typescript119.default.factory.createIdentifier(name);
|
|
50802
50864
|
}
|
|
50803
50865
|
isUniqueIdentifierName(sourceFile, name) {
|
|
50804
50866
|
if (this.usedIdentifierNames.has(sourceFile) && this.usedIdentifierNames.get(sourceFile).indexOf(name) !== -1) {
|
|
@@ -50807,7 +50869,7 @@ var ImportManager2 = class {
|
|
|
50807
50869
|
const nodeQueue = [sourceFile];
|
|
50808
50870
|
while (nodeQueue.length) {
|
|
50809
50871
|
const node = nodeQueue.shift();
|
|
50810
|
-
if (
|
|
50872
|
+
if (import_typescript119.default.isIdentifier(node) && node.text === name && (!import_typescript119.default.isImportSpecifier(node.parent) || node.parent.propertyName !== node)) {
|
|
50811
50873
|
return false;
|
|
50812
50874
|
}
|
|
50813
50875
|
nodeQueue.push(...node.getChildren());
|
|
@@ -50819,21 +50881,21 @@ var ImportManager2 = class {
|
|
|
50819
50881
|
}
|
|
50820
50882
|
_getEndPositionOfNode(node) {
|
|
50821
50883
|
const nodeEndPos = node.getEnd();
|
|
50822
|
-
const commentRanges =
|
|
50884
|
+
const commentRanges = import_typescript119.default.getTrailingCommentRanges(node.getSourceFile().text, nodeEndPos);
|
|
50823
50885
|
if (!commentRanges || !commentRanges.length) {
|
|
50824
50886
|
return nodeEndPos;
|
|
50825
50887
|
}
|
|
50826
50888
|
return commentRanges[commentRanges.length - 1].end;
|
|
50827
50889
|
}
|
|
50828
50890
|
_getNewImportText(importStartIndex, newImport, sourceFile) {
|
|
50829
|
-
const text2 = this.printer.printNode(
|
|
50891
|
+
const text2 = this.printer.printNode(import_typescript119.default.EmitHint.Unspecified, newImport, sourceFile);
|
|
50830
50892
|
return importStartIndex === 0 ? `${text2}
|
|
50831
50893
|
` : `
|
|
50832
50894
|
${text2}`;
|
|
50833
50895
|
}
|
|
50834
50896
|
_getImportParts(sourceFile, symbolName, alias, keepSymbolName) {
|
|
50835
|
-
const symbolIdentifier =
|
|
50836
|
-
const aliasIdentifier = alias ?
|
|
50897
|
+
const symbolIdentifier = import_typescript119.default.factory.createIdentifier(symbolName);
|
|
50898
|
+
const aliasIdentifier = alias ? import_typescript119.default.factory.createIdentifier(alias) : null;
|
|
50837
50899
|
const generatedUniqueIdentifier = this._getUniqueIdentifier(sourceFile, alias || symbolName);
|
|
50838
50900
|
const needsGeneratedUniqueName = generatedUniqueIdentifier.text !== (alias || symbolName);
|
|
50839
50901
|
let propertyName;
|
|
@@ -50853,7 +50915,7 @@ ${text2}`;
|
|
|
50853
50915
|
if (!this.quoteStyles.hasOwnProperty(sourceFile.fileName)) {
|
|
50854
50916
|
let quoteStyle;
|
|
50855
50917
|
for (const statement of sourceFile.statements) {
|
|
50856
|
-
if (
|
|
50918
|
+
if (import_typescript119.default.isImportDeclaration(statement) && import_typescript119.default.isStringLiteralLike(statement.moduleSpecifier)) {
|
|
50857
50919
|
quoteStyle = statement.moduleSpecifier.getText().trim().startsWith('"') ? 1 : 0;
|
|
50858
50920
|
break;
|
|
50859
50921
|
}
|
|
@@ -50884,7 +50946,7 @@ var ChangeTracker = class {
|
|
|
50884
50946
|
replaceText(sourceFile, start, removeLength, text2) {
|
|
50885
50947
|
this._trackChange(sourceFile, { start, removeLength, text: text2 });
|
|
50886
50948
|
}
|
|
50887
|
-
replaceNode(oldNode, newNode, emitHint =
|
|
50949
|
+
replaceNode(oldNode, newNode, emitHint = import_typescript120.default.EmitHint.Unspecified, sourceFileWhenPrinting) {
|
|
50888
50950
|
const sourceFile = oldNode.getSourceFile();
|
|
50889
50951
|
this.replaceText(sourceFile, oldNode.getStart(), oldNode.getWidth(), this._printer.printNode(emitHint, newNode, sourceFileWhenPrinting || sourceFile));
|
|
50890
50952
|
}
|
|
@@ -51005,23 +51067,23 @@ function getWorkspace(tree) {
|
|
|
51005
51067
|
|
|
51006
51068
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/compiler_host.mjs
|
|
51007
51069
|
var import_path5 = require("path");
|
|
51008
|
-
var
|
|
51070
|
+
var import_typescript122 = __toESM(require("typescript"), 1);
|
|
51009
51071
|
|
|
51010
51072
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/parse_tsconfig.mjs
|
|
51011
51073
|
var path3 = __toESM(require("path"), 1);
|
|
51012
|
-
var
|
|
51074
|
+
var import_typescript121 = __toESM(require("typescript"), 1);
|
|
51013
51075
|
function parseTsconfigFile(tsconfigPath, basePath) {
|
|
51014
|
-
const { config } =
|
|
51076
|
+
const { config } = import_typescript121.default.readConfigFile(tsconfigPath, import_typescript121.default.sys.readFile);
|
|
51015
51077
|
const parseConfigHost = {
|
|
51016
|
-
useCaseSensitiveFileNames:
|
|
51017
|
-
fileExists:
|
|
51018
|
-
readDirectory:
|
|
51019
|
-
readFile:
|
|
51078
|
+
useCaseSensitiveFileNames: import_typescript121.default.sys.useCaseSensitiveFileNames,
|
|
51079
|
+
fileExists: import_typescript121.default.sys.fileExists,
|
|
51080
|
+
readDirectory: import_typescript121.default.sys.readDirectory,
|
|
51081
|
+
readFile: import_typescript121.default.sys.readFile
|
|
51020
51082
|
};
|
|
51021
51083
|
if (!path3.isAbsolute(basePath)) {
|
|
51022
51084
|
throw Error("Unexpected relative base path has been specified.");
|
|
51023
51085
|
}
|
|
51024
|
-
return
|
|
51086
|
+
return import_typescript121.default.parseJsonConfigFileContent(config, parseConfigHost, basePath, {});
|
|
51025
51087
|
}
|
|
51026
51088
|
|
|
51027
51089
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/compiler_host.mjs
|
|
@@ -51033,7 +51095,7 @@ function createProgramOptions(tree, tsconfigPath, basePath, fakeFileRead, additi
|
|
|
51033
51095
|
return { rootNames: parsed.fileNames.concat(additionalFiles || []), options, host };
|
|
51034
51096
|
}
|
|
51035
51097
|
function createMigrationCompilerHost(tree, options, basePath, fakeRead) {
|
|
51036
|
-
const host =
|
|
51098
|
+
const host = import_typescript122.default.createCompilerHost(options, true);
|
|
51037
51099
|
const defaultReadFile = host.readFile;
|
|
51038
51100
|
host.readFile = (fileName) => {
|
|
51039
51101
|
var _a2;
|
|
@@ -51054,24 +51116,24 @@ function canMigrateFile(basePath, sourceFile, program) {
|
|
|
51054
51116
|
}
|
|
51055
51117
|
|
|
51056
51118
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/ng-generate/standalone-migration/prune-modules.mjs
|
|
51057
|
-
var
|
|
51119
|
+
var import_typescript127 = __toESM(require("typescript"), 1);
|
|
51058
51120
|
|
|
51059
51121
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/decorators.mjs
|
|
51060
|
-
var
|
|
51122
|
+
var import_typescript124 = __toESM(require("typescript"), 1);
|
|
51061
51123
|
|
|
51062
51124
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/imports.mjs
|
|
51063
|
-
var
|
|
51125
|
+
var import_typescript123 = __toESM(require("typescript"), 1);
|
|
51064
51126
|
function getImportOfIdentifier(typeChecker, node) {
|
|
51065
51127
|
const symbol = typeChecker.getSymbolAtLocation(node);
|
|
51066
51128
|
if (!symbol || symbol.declarations === void 0 || !symbol.declarations.length) {
|
|
51067
51129
|
return null;
|
|
51068
51130
|
}
|
|
51069
51131
|
const decl = symbol.declarations[0];
|
|
51070
|
-
if (!
|
|
51132
|
+
if (!import_typescript123.default.isImportSpecifier(decl)) {
|
|
51071
51133
|
return null;
|
|
51072
51134
|
}
|
|
51073
51135
|
const importDecl = decl.parent.parent.parent;
|
|
51074
|
-
if (!
|
|
51136
|
+
if (!import_typescript123.default.isStringLiteral(importDecl.moduleSpecifier)) {
|
|
51075
51137
|
return null;
|
|
51076
51138
|
}
|
|
51077
51139
|
return {
|
|
@@ -51088,10 +51150,10 @@ function getImportSpecifiers(sourceFile, moduleName, specifierNames) {
|
|
|
51088
51150
|
var _a2;
|
|
51089
51151
|
const matches = [];
|
|
51090
51152
|
for (const node of sourceFile.statements) {
|
|
51091
|
-
if (
|
|
51153
|
+
if (import_typescript123.default.isImportDeclaration(node) && import_typescript123.default.isStringLiteral(node.moduleSpecifier)) {
|
|
51092
51154
|
const isMatch = typeof moduleName === "string" ? node.moduleSpecifier.text === moduleName : moduleName.test(node.moduleSpecifier.text);
|
|
51093
51155
|
const namedBindings = (_a2 = node.importClause) == null ? void 0 : _a2.namedBindings;
|
|
51094
|
-
if (isMatch && namedBindings &&
|
|
51156
|
+
if (isMatch && namedBindings && import_typescript123.default.isNamedImports(namedBindings)) {
|
|
51095
51157
|
for (const specifierName of specifierNames) {
|
|
51096
51158
|
const match = findImportSpecifier(namedBindings.elements, specifierName);
|
|
51097
51159
|
if (match) {
|
|
@@ -51112,7 +51174,7 @@ function findImportSpecifier(nodes, specifierName) {
|
|
|
51112
51174
|
|
|
51113
51175
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/decorators.mjs
|
|
51114
51176
|
function getCallDecoratorImport(typeChecker, decorator) {
|
|
51115
|
-
if (!
|
|
51177
|
+
if (!import_typescript124.default.isCallExpression(decorator.expression) || !import_typescript124.default.isIdentifier(decorator.expression.expression)) {
|
|
51116
51178
|
return null;
|
|
51117
51179
|
}
|
|
51118
51180
|
const identifier = decorator.expression.expression;
|
|
@@ -51130,10 +51192,10 @@ function getAngularDecorators2(typeChecker, decorators) {
|
|
|
51130
51192
|
}
|
|
51131
51193
|
|
|
51132
51194
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/nodes.mjs
|
|
51133
|
-
var
|
|
51195
|
+
var import_typescript125 = __toESM(require("typescript"), 1);
|
|
51134
51196
|
function closestNode(node, predicate) {
|
|
51135
51197
|
let current = node.parent;
|
|
51136
|
-
while (current && !
|
|
51198
|
+
while (current && !import_typescript125.default.isSourceFile(current)) {
|
|
51137
51199
|
if (predicate(current)) {
|
|
51138
51200
|
return current;
|
|
51139
51201
|
}
|
|
@@ -51144,7 +51206,7 @@ function closestNode(node, predicate) {
|
|
|
51144
51206
|
|
|
51145
51207
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/ng-generate/standalone-migration/util.mjs
|
|
51146
51208
|
var import_path6 = require("path");
|
|
51147
|
-
var
|
|
51209
|
+
var import_typescript126 = __toESM(require("typescript"), 1);
|
|
51148
51210
|
var UniqueItemTracker = class {
|
|
51149
51211
|
constructor() {
|
|
51150
51212
|
__publicField(this, "_nodes", /* @__PURE__ */ new Map());
|
|
@@ -51193,7 +51255,7 @@ var ReferenceResolver = class {
|
|
|
51193
51255
|
const results = /* @__PURE__ */ new Map();
|
|
51194
51256
|
for (const symbol of referencedSymbols) {
|
|
51195
51257
|
for (const ref of symbol.references) {
|
|
51196
|
-
if (!ref.isDefinition || symbol.definition.kind ===
|
|
51258
|
+
if (!ref.isDefinition || symbol.definition.kind === import_typescript126.default.ScriptElementKind.alias) {
|
|
51197
51259
|
if (!results.has(ref.fileName)) {
|
|
51198
51260
|
results.set(ref.fileName, []);
|
|
51199
51261
|
}
|
|
@@ -51217,7 +51279,7 @@ var ReferenceResolver = class {
|
|
|
51217
51279
|
for (const file of highlights) {
|
|
51218
51280
|
if (file.fileName === fileName) {
|
|
51219
51281
|
for (const { textSpan: { start, length }, kind } of file.highlightSpans) {
|
|
51220
|
-
if (kind !==
|
|
51282
|
+
if (kind !== import_typescript126.default.HighlightSpanKind.none) {
|
|
51221
51283
|
results.push([start, start + length]);
|
|
51222
51284
|
}
|
|
51223
51285
|
}
|
|
@@ -51243,19 +51305,19 @@ var ReferenceResolver = class {
|
|
|
51243
51305
|
rootFileNames.push(fileName);
|
|
51244
51306
|
}
|
|
51245
51307
|
});
|
|
51246
|
-
this._languageService =
|
|
51308
|
+
this._languageService = import_typescript126.default.createLanguageService({
|
|
51247
51309
|
getCompilationSettings: () => this._program.getTsProgram().getCompilerOptions(),
|
|
51248
51310
|
getScriptFileNames: () => rootFileNames,
|
|
51249
51311
|
getScriptVersion: () => "0",
|
|
51250
51312
|
getScriptSnapshot: (path4) => {
|
|
51251
51313
|
const content = this._readFile(path4);
|
|
51252
|
-
return content ?
|
|
51314
|
+
return content ? import_typescript126.default.ScriptSnapshot.fromString(content) : void 0;
|
|
51253
51315
|
},
|
|
51254
51316
|
getCurrentDirectory: () => this._basePath,
|
|
51255
|
-
getDefaultLibFileName: (options) =>
|
|
51317
|
+
getDefaultLibFileName: (options) => import_typescript126.default.getDefaultLibFilePath(options),
|
|
51256
51318
|
readFile: (path4) => this._readFile(path4),
|
|
51257
51319
|
fileExists: (path4) => this._host.fileExists(path4)
|
|
51258
|
-
},
|
|
51320
|
+
}, import_typescript126.default.createDocumentRegistry(), import_typescript126.default.LanguageServiceMode.PartialSemantic);
|
|
51259
51321
|
}
|
|
51260
51322
|
return this._languageService;
|
|
51261
51323
|
}
|
|
@@ -51285,10 +51347,10 @@ function offsetsToNodes(lookup, offsets, results) {
|
|
|
51285
51347
|
}
|
|
51286
51348
|
function findClassDeclaration(reference2, typeChecker) {
|
|
51287
51349
|
var _a2, _b2;
|
|
51288
|
-
return ((_b2 = (_a2 = typeChecker.getTypeAtLocation(reference2).getSymbol()) == null ? void 0 : _a2.declarations) == null ? void 0 : _b2.find(
|
|
51350
|
+
return ((_b2 = (_a2 = typeChecker.getTypeAtLocation(reference2).getSymbol()) == null ? void 0 : _a2.declarations) == null ? void 0 : _b2.find(import_typescript126.default.isClassDeclaration)) || null;
|
|
51289
51351
|
}
|
|
51290
51352
|
function findLiteralProperty(literal3, name) {
|
|
51291
|
-
return literal3.properties.find((prop) => prop.name &&
|
|
51353
|
+
return literal3.properties.find((prop) => prop.name && import_typescript126.default.isIdentifier(prop.name) && prop.name.text === name);
|
|
51292
51354
|
}
|
|
51293
51355
|
function getRelativeImportPath(fromFile, toFile) {
|
|
51294
51356
|
let path4 = (0, import_path6.relative)((0, import_path6.dirname)(fromFile), toFile).replace(/\.ts$/, "");
|
|
@@ -51309,9 +51371,9 @@ function isClassReferenceInAngularModule(node, className, moduleName, typeChecke
|
|
|
51309
51371
|
const externalName = `@angular/${moduleName}`;
|
|
51310
51372
|
const internalName = `angular2/rc/packages/${moduleName}`;
|
|
51311
51373
|
return !!((_a2 = symbol == null ? void 0 : symbol.declarations) == null ? void 0 : _a2.some((decl) => {
|
|
51312
|
-
const closestClass = closestOrSelf(decl,
|
|
51374
|
+
const closestClass = closestOrSelf(decl, import_typescript126.default.isClassDeclaration);
|
|
51313
51375
|
const closestClassFileName = closestClass == null ? void 0 : closestClass.getSourceFile().fileName;
|
|
51314
|
-
if (!closestClass || !closestClassFileName || !closestClass.name || !
|
|
51376
|
+
if (!closestClass || !closestClassFileName || !closestClass.name || !import_typescript126.default.isIdentifier(closestClass.name) || !closestClassFileName.includes(externalName) && !closestClassFileName.includes(internalName)) {
|
|
51315
51377
|
return false;
|
|
51316
51378
|
}
|
|
51317
51379
|
return typeof className === "string" ? closestClass.name.text === className : className.test(closestClass.name.text);
|
|
@@ -51336,10 +51398,10 @@ function pruneNgModules(program, host, basePath, rootFileNames, sourceFiles, pri
|
|
|
51336
51398
|
const nodesToRemove = /* @__PURE__ */ new Set();
|
|
51337
51399
|
sourceFiles.forEach(function walk(node) {
|
|
51338
51400
|
var _a2, _b2;
|
|
51339
|
-
if (
|
|
51401
|
+
if (import_typescript127.default.isClassDeclaration(node) && canRemoveClass(node, typeChecker)) {
|
|
51340
51402
|
collectRemovalLocations(node, removalLocations, referenceResolver, program);
|
|
51341
51403
|
classesToRemove.add(node);
|
|
51342
|
-
} else if (
|
|
51404
|
+
} else if (import_typescript127.default.isExportDeclaration(node) && !node.exportClause && node.moduleSpecifier && import_typescript127.default.isStringLiteralLike(node.moduleSpecifier) && node.moduleSpecifier.text.startsWith(".")) {
|
|
51343
51405
|
const exportedSourceFile = (_b2 = (_a2 = typeChecker.getSymbolAtLocation(node.moduleSpecifier)) == null ? void 0 : _a2.valueDeclaration) == null ? void 0 : _b2.getSourceFile();
|
|
51344
51406
|
if (exportedSourceFile) {
|
|
51345
51407
|
barrelExports.track(exportedSourceFile, node);
|
|
@@ -51385,17 +51447,17 @@ function collectRemovalLocations(ngModule, removalLocations, referenceResolver,
|
|
|
51385
51447
|
}
|
|
51386
51448
|
}
|
|
51387
51449
|
for (const node of nodes) {
|
|
51388
|
-
const closestArray = closestNode(node,
|
|
51450
|
+
const closestArray = closestNode(node, import_typescript127.default.isArrayLiteralExpression);
|
|
51389
51451
|
if (closestArray) {
|
|
51390
51452
|
removalLocations.arrays.track(closestArray, node);
|
|
51391
51453
|
continue;
|
|
51392
51454
|
}
|
|
51393
|
-
const closestImport = closestNode(node,
|
|
51455
|
+
const closestImport = closestNode(node, import_typescript127.default.isNamedImports);
|
|
51394
51456
|
if (closestImport) {
|
|
51395
51457
|
removalLocations.imports.track(closestImport, node);
|
|
51396
51458
|
continue;
|
|
51397
51459
|
}
|
|
51398
|
-
const closestExport = closestNode(node,
|
|
51460
|
+
const closestExport = closestNode(node, import_typescript127.default.isNamedExports);
|
|
51399
51461
|
if (closestExport) {
|
|
51400
51462
|
removalLocations.exports.track(closestExport, node);
|
|
51401
51463
|
continue;
|
|
@@ -51406,24 +51468,24 @@ function collectRemovalLocations(ngModule, removalLocations, referenceResolver,
|
|
|
51406
51468
|
function removeArrayReferences(locations, tracker) {
|
|
51407
51469
|
for (const [array, toRemove] of locations.getEntries()) {
|
|
51408
51470
|
const newElements = filterRemovedElements(array.elements, toRemove);
|
|
51409
|
-
tracker.replaceNode(array,
|
|
51471
|
+
tracker.replaceNode(array, import_typescript127.default.factory.updateArrayLiteralExpression(array, import_typescript127.default.factory.createNodeArray(newElements, array.elements.hasTrailingComma)));
|
|
51410
51472
|
}
|
|
51411
51473
|
}
|
|
51412
51474
|
function removeImportReferences(locations, tracker) {
|
|
51413
51475
|
for (const [namedImports, toRemove] of locations.getEntries()) {
|
|
51414
51476
|
const newElements = filterRemovedElements(namedImports.elements, toRemove);
|
|
51415
51477
|
if (newElements.length === 0) {
|
|
51416
|
-
const importClause = closestNode(namedImports,
|
|
51478
|
+
const importClause = closestNode(namedImports, import_typescript127.default.isImportClause);
|
|
51417
51479
|
if (importClause && importClause.name) {
|
|
51418
|
-
tracker.replaceNode(importClause,
|
|
51480
|
+
tracker.replaceNode(importClause, import_typescript127.default.factory.updateImportClause(importClause, importClause.isTypeOnly, importClause.name, void 0));
|
|
51419
51481
|
} else {
|
|
51420
|
-
const declaration = closestNode(namedImports,
|
|
51482
|
+
const declaration = closestNode(namedImports, import_typescript127.default.isImportDeclaration);
|
|
51421
51483
|
if (declaration) {
|
|
51422
51484
|
tracker.removeNode(declaration);
|
|
51423
51485
|
}
|
|
51424
51486
|
}
|
|
51425
51487
|
} else {
|
|
51426
|
-
tracker.replaceNode(namedImports,
|
|
51488
|
+
tracker.replaceNode(namedImports, import_typescript127.default.factory.updateNamedImports(namedImports, newElements));
|
|
51427
51489
|
}
|
|
51428
51490
|
}
|
|
51429
51491
|
}
|
|
@@ -51431,22 +51493,22 @@ function removeExportReferences(locations, tracker) {
|
|
|
51431
51493
|
for (const [namedExports, toRemove] of locations.getEntries()) {
|
|
51432
51494
|
const newElements = filterRemovedElements(namedExports.elements, toRemove);
|
|
51433
51495
|
if (newElements.length === 0) {
|
|
51434
|
-
const declaration = closestNode(namedExports,
|
|
51496
|
+
const declaration = closestNode(namedExports, import_typescript127.default.isExportDeclaration);
|
|
51435
51497
|
if (declaration) {
|
|
51436
51498
|
tracker.removeNode(declaration);
|
|
51437
51499
|
}
|
|
51438
51500
|
} else {
|
|
51439
|
-
tracker.replaceNode(namedExports,
|
|
51501
|
+
tracker.replaceNode(namedExports, import_typescript127.default.factory.updateNamedExports(namedExports, newElements));
|
|
51440
51502
|
}
|
|
51441
51503
|
}
|
|
51442
51504
|
}
|
|
51443
51505
|
function canRemoveClass(node, typeChecker) {
|
|
51444
51506
|
var _a2;
|
|
51445
51507
|
const decorator = (_a2 = findNgModuleDecorator(node, typeChecker)) == null ? void 0 : _a2.node;
|
|
51446
|
-
if (!decorator || !
|
|
51508
|
+
if (!decorator || !import_typescript127.default.isCallExpression(decorator.expression)) {
|
|
51447
51509
|
return false;
|
|
51448
51510
|
}
|
|
51449
|
-
if (decorator.expression.arguments.length > 0 && !
|
|
51511
|
+
if (decorator.expression.arguments.length > 0 && !import_typescript127.default.isObjectLiteralExpression(decorator.expression.arguments[0])) {
|
|
51450
51512
|
return false;
|
|
51451
51513
|
}
|
|
51452
51514
|
if (node.members.length > 0 && node.members.some((member) => !isEmptyConstructor(member))) {
|
|
@@ -51459,7 +51521,7 @@ function canRemoveClass(node, typeChecker) {
|
|
|
51459
51521
|
const imports = findLiteralProperty(literal3, "imports");
|
|
51460
51522
|
if (imports && isNonEmptyNgModuleProperty(imports)) {
|
|
51461
51523
|
for (const dep of imports.initializer.elements) {
|
|
51462
|
-
if (!
|
|
51524
|
+
if (!import_typescript127.default.isIdentifier(dep)) {
|
|
51463
51525
|
return false;
|
|
51464
51526
|
}
|
|
51465
51527
|
const depDeclaration = findClassDeclaration(dep, typeChecker);
|
|
@@ -51477,15 +51539,15 @@ function canRemoveClass(node, typeChecker) {
|
|
|
51477
51539
|
return true;
|
|
51478
51540
|
}
|
|
51479
51541
|
function isNonEmptyNgModuleProperty(node) {
|
|
51480
|
-
return
|
|
51542
|
+
return import_typescript127.default.isPropertyAssignment(node) && import_typescript127.default.isIdentifier(node.name) && import_typescript127.default.isArrayLiteralExpression(node.initializer) && node.initializer.elements.length > 0;
|
|
51481
51543
|
}
|
|
51482
51544
|
function canRemoveFile(sourceFile, nodesToBeRemoved) {
|
|
51483
51545
|
var _a2;
|
|
51484
51546
|
for (const node of sourceFile.statements) {
|
|
51485
|
-
if (
|
|
51547
|
+
if (import_typescript127.default.isImportDeclaration(node) || nodesToBeRemoved.has(node)) {
|
|
51486
51548
|
continue;
|
|
51487
51549
|
}
|
|
51488
|
-
if (
|
|
51550
|
+
if (import_typescript127.default.isExportDeclaration(node) || import_typescript127.default.canHaveModifiers(node) && ((_a2 = import_typescript127.default.getModifiers(node)) == null ? void 0 : _a2.some((m) => m.kind === import_typescript127.default.SyntaxKind.ExportKeyword))) {
|
|
51489
51551
|
return false;
|
|
51490
51552
|
}
|
|
51491
51553
|
}
|
|
@@ -51505,7 +51567,7 @@ function filterRemovedElements(elements, toRemove) {
|
|
|
51505
51567
|
});
|
|
51506
51568
|
}
|
|
51507
51569
|
function isEmptyConstructor(node) {
|
|
51508
|
-
return
|
|
51570
|
+
return import_typescript127.default.isConstructorDeclaration(node) && node.parameters.length === 0 && (node.body == null || node.body.statements.length === 0);
|
|
51509
51571
|
}
|
|
51510
51572
|
function addRemovalTodos(nodes, tracker) {
|
|
51511
51573
|
for (const node of nodes) {
|
|
@@ -51513,19 +51575,19 @@ function addRemovalTodos(nodes, tracker) {
|
|
|
51513
51575
|
}
|
|
51514
51576
|
}
|
|
51515
51577
|
function findNgModuleDecorator(node, typeChecker) {
|
|
51516
|
-
const decorators = getAngularDecorators2(typeChecker,
|
|
51578
|
+
const decorators = getAngularDecorators2(typeChecker, import_typescript127.default.getDecorators(node) || []);
|
|
51517
51579
|
return decorators.find((decorator) => decorator.name === "NgModule") || null;
|
|
51518
51580
|
}
|
|
51519
51581
|
|
|
51520
51582
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/ng-generate/standalone-migration/standalone-bootstrap.mjs
|
|
51521
51583
|
var import_path7 = require("path");
|
|
51522
|
-
var
|
|
51584
|
+
var import_typescript130 = __toESM(require("typescript"), 1);
|
|
51523
51585
|
|
|
51524
51586
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/ng-generate/standalone-migration/to-standalone.mjs
|
|
51525
|
-
var
|
|
51587
|
+
var import_typescript129 = __toESM(require("typescript"), 1);
|
|
51526
51588
|
|
|
51527
51589
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/symbol.mjs
|
|
51528
|
-
var
|
|
51590
|
+
var import_typescript128 = __toESM(require("typescript"), 1);
|
|
51529
51591
|
function isReferenceToImport(typeChecker, node, importSpecifier) {
|
|
51530
51592
|
var _a2, _b2;
|
|
51531
51593
|
const nodeSymbol = typeChecker.getTypeAtLocation(node).getSymbol();
|
|
@@ -51572,8 +51634,8 @@ function convertNgModuleDeclarationToStandalone(decl, allDeclarations, tracker,
|
|
|
51572
51634
|
const importsToAdd = getComponentImportExpressions(decl, allDeclarations, tracker, typeChecker, importRemapper);
|
|
51573
51635
|
if (importsToAdd.length > 0) {
|
|
51574
51636
|
const hasTrailingComma = importsToAdd.length > 2 && !!((_a2 = extractMetadataLiteral(directiveMeta.decorator)) == null ? void 0 : _a2.properties.hasTrailingComma);
|
|
51575
|
-
decorator = addPropertyToAngularDecorator(decorator,
|
|
51576
|
-
|
|
51637
|
+
decorator = addPropertyToAngularDecorator(decorator, import_typescript129.default.factory.createPropertyAssignment("imports", import_typescript129.default.factory.createArrayLiteralExpression(
|
|
51638
|
+
import_typescript129.default.factory.createNodeArray(importsToAdd, hasTrailingComma),
|
|
51577
51639
|
hasTrailingComma
|
|
51578
51640
|
)));
|
|
51579
51641
|
}
|
|
@@ -51605,11 +51667,11 @@ function getComponentImportExpressions(decl, allDeclarations, tracker, typeCheck
|
|
|
51605
51667
|
const identifier = tracker.addImport(decl.getSourceFile(), importLocation.symbolName, importLocation.moduleSpecifier);
|
|
51606
51668
|
imports.push(identifier);
|
|
51607
51669
|
} else {
|
|
51608
|
-
const identifier =
|
|
51670
|
+
const identifier = import_typescript129.default.factory.createIdentifier(importLocation.symbolName);
|
|
51609
51671
|
if (importLocation.isForwardReference) {
|
|
51610
51672
|
const forwardRefExpression = tracker.addImport(decl.getSourceFile(), "forwardRef", "@angular/core");
|
|
51611
|
-
const arrowFunction =
|
|
51612
|
-
imports.push(
|
|
51673
|
+
const arrowFunction = import_typescript129.default.factory.createArrowFunction(void 0, void 0, [], void 0, void 0, identifier);
|
|
51674
|
+
imports.push(import_typescript129.default.factory.createCallExpression(forwardRefExpression, void 0, [arrowFunction]));
|
|
51613
51675
|
} else {
|
|
51614
51676
|
imports.push(identifier);
|
|
51615
51677
|
}
|
|
@@ -51634,11 +51696,11 @@ function moveDeclarationsToImports(literal3, allDeclarations, typeChecker, templ
|
|
|
51634
51696
|
const declarationsToCopy = [];
|
|
51635
51697
|
const properties = [];
|
|
51636
51698
|
const importsProp = findLiteralProperty(literal3, "imports");
|
|
51637
|
-
const hasAnyArrayTrailingComma = literal3.properties.some((prop) =>
|
|
51638
|
-
if (
|
|
51639
|
-
if (
|
|
51699
|
+
const hasAnyArrayTrailingComma = literal3.properties.some((prop) => import_typescript129.default.isPropertyAssignment(prop) && import_typescript129.default.isArrayLiteralExpression(prop.initializer) && prop.initializer.elements.hasTrailingComma);
|
|
51700
|
+
if (import_typescript129.default.isPropertyAssignment(declarationsProp)) {
|
|
51701
|
+
if (import_typescript129.default.isArrayLiteralExpression(declarationsProp.initializer)) {
|
|
51640
51702
|
for (const el of declarationsProp.initializer.elements) {
|
|
51641
|
-
if (
|
|
51703
|
+
if (import_typescript129.default.isIdentifier(el)) {
|
|
51642
51704
|
const correspondingClass = findClassDeclaration(el, typeChecker);
|
|
51643
51705
|
if (!correspondingClass || isStandaloneDeclaration(correspondingClass, allDeclarations, templateTypeChecker)) {
|
|
51644
51706
|
declarationsToCopy.push(el);
|
|
@@ -51650,11 +51712,11 @@ function moveDeclarationsToImports(literal3, allDeclarations, typeChecker, templ
|
|
|
51650
51712
|
}
|
|
51651
51713
|
}
|
|
51652
51714
|
} else {
|
|
51653
|
-
declarationsToCopy.push(
|
|
51715
|
+
declarationsToCopy.push(import_typescript129.default.factory.createSpreadElement(declarationsProp.initializer));
|
|
51654
51716
|
}
|
|
51655
51717
|
}
|
|
51656
51718
|
if (!importsProp && declarationsToCopy.length > 0) {
|
|
51657
|
-
properties.push(
|
|
51719
|
+
properties.push(import_typescript129.default.factory.createPropertyAssignment("imports", import_typescript129.default.factory.createArrayLiteralExpression(import_typescript129.default.factory.createNodeArray(declarationsToCopy, hasAnyArrayTrailingComma && declarationsToCopy.length > 2))));
|
|
51658
51720
|
}
|
|
51659
51721
|
for (const prop of literal3.properties) {
|
|
51660
51722
|
if (!isNamedPropertyAssignment(prop)) {
|
|
@@ -51663,49 +51725,49 @@ function moveDeclarationsToImports(literal3, allDeclarations, typeChecker, templ
|
|
|
51663
51725
|
}
|
|
51664
51726
|
if (prop === declarationsProp) {
|
|
51665
51727
|
if (declarationsToPreserve.length > 0) {
|
|
51666
|
-
const hasTrailingComma =
|
|
51667
|
-
properties.push(
|
|
51728
|
+
const hasTrailingComma = import_typescript129.default.isArrayLiteralExpression(prop.initializer) ? prop.initializer.elements.hasTrailingComma : hasAnyArrayTrailingComma;
|
|
51729
|
+
properties.push(import_typescript129.default.factory.updatePropertyAssignment(prop, prop.name, import_typescript129.default.factory.createArrayLiteralExpression(import_typescript129.default.factory.createNodeArray(declarationsToPreserve, hasTrailingComma && declarationsToPreserve.length > 2))));
|
|
51668
51730
|
}
|
|
51669
51731
|
continue;
|
|
51670
51732
|
}
|
|
51671
51733
|
if (prop === importsProp && declarationsToCopy.length > 0) {
|
|
51672
51734
|
let initializer;
|
|
51673
|
-
if (
|
|
51674
|
-
initializer =
|
|
51735
|
+
if (import_typescript129.default.isArrayLiteralExpression(prop.initializer)) {
|
|
51736
|
+
initializer = import_typescript129.default.factory.updateArrayLiteralExpression(prop.initializer, import_typescript129.default.factory.createNodeArray([...prop.initializer.elements, ...declarationsToCopy], prop.initializer.elements.hasTrailingComma));
|
|
51675
51737
|
} else {
|
|
51676
|
-
initializer =
|
|
51677
|
-
[
|
|
51738
|
+
initializer = import_typescript129.default.factory.createArrayLiteralExpression(import_typescript129.default.factory.createNodeArray(
|
|
51739
|
+
[import_typescript129.default.factory.createSpreadElement(prop.initializer), ...declarationsToCopy],
|
|
51678
51740
|
hasAnyArrayTrailingComma && declarationsToCopy.length > 1
|
|
51679
51741
|
));
|
|
51680
51742
|
}
|
|
51681
|
-
properties.push(
|
|
51743
|
+
properties.push(import_typescript129.default.factory.updatePropertyAssignment(prop, prop.name, initializer));
|
|
51682
51744
|
continue;
|
|
51683
51745
|
}
|
|
51684
51746
|
properties.push(prop);
|
|
51685
51747
|
}
|
|
51686
|
-
tracker.replaceNode(literal3,
|
|
51748
|
+
tracker.replaceNode(literal3, import_typescript129.default.factory.updateObjectLiteralExpression(literal3, import_typescript129.default.factory.createNodeArray(properties, literal3.properties.hasTrailingComma)), import_typescript129.default.EmitHint.Expression);
|
|
51687
51749
|
}
|
|
51688
51750
|
function addStandaloneToDecorator(node) {
|
|
51689
|
-
return addPropertyToAngularDecorator(node,
|
|
51751
|
+
return addPropertyToAngularDecorator(node, import_typescript129.default.factory.createPropertyAssignment("standalone", import_typescript129.default.factory.createToken(import_typescript129.default.SyntaxKind.TrueKeyword)));
|
|
51690
51752
|
}
|
|
51691
51753
|
function addPropertyToAngularDecorator(node, property2) {
|
|
51692
|
-
if (!
|
|
51754
|
+
if (!import_typescript129.default.isCallExpression(node.expression) || node.expression.arguments.length > 1) {
|
|
51693
51755
|
return node;
|
|
51694
51756
|
}
|
|
51695
51757
|
let literalProperties;
|
|
51696
51758
|
let hasTrailingComma = false;
|
|
51697
51759
|
if (node.expression.arguments.length === 0) {
|
|
51698
51760
|
literalProperties = [property2];
|
|
51699
|
-
} else if (
|
|
51761
|
+
} else if (import_typescript129.default.isObjectLiteralExpression(node.expression.arguments[0])) {
|
|
51700
51762
|
hasTrailingComma = node.expression.arguments[0].properties.hasTrailingComma;
|
|
51701
51763
|
literalProperties = [...node.expression.arguments[0].properties, property2];
|
|
51702
51764
|
} else {
|
|
51703
51765
|
return node;
|
|
51704
51766
|
}
|
|
51705
|
-
return
|
|
51767
|
+
return import_typescript129.default.factory.createDecorator(import_typescript129.default.factory.createCallExpression(node.expression.expression, node.expression.typeArguments, [import_typescript129.default.factory.createObjectLiteralExpression(import_typescript129.default.factory.createNodeArray(literalProperties, hasTrailingComma), literalProperties.length > 1)]));
|
|
51706
51768
|
}
|
|
51707
51769
|
function isNamedPropertyAssignment(node) {
|
|
51708
|
-
return
|
|
51770
|
+
return import_typescript129.default.isPropertyAssignment(node) && node.name && import_typescript129.default.isIdentifier(node.name);
|
|
51709
51771
|
}
|
|
51710
51772
|
function findImportLocation(target, inComponent, importMode, typeChecker) {
|
|
51711
51773
|
const importLocations = typeChecker.getPotentialImportsFor(target, inComponent, importMode);
|
|
@@ -51725,14 +51787,14 @@ function findImportLocation(target, inComponent, importMode, typeChecker) {
|
|
|
51725
51787
|
return firstSameFileImport || firstModuleImport || importLocations[0] || null;
|
|
51726
51788
|
}
|
|
51727
51789
|
function hasNgModuleMetadataElements(node) {
|
|
51728
|
-
return
|
|
51790
|
+
return import_typescript129.default.isPropertyAssignment(node) && (!import_typescript129.default.isArrayLiteralExpression(node.initializer) || node.initializer.elements.length > 0);
|
|
51729
51791
|
}
|
|
51730
51792
|
function findNgModuleClassesToMigrate(sourceFile, typeChecker) {
|
|
51731
51793
|
const modules = [];
|
|
51732
51794
|
if (getImportSpecifier(sourceFile, "@angular/core", "NgModule")) {
|
|
51733
51795
|
sourceFile.forEachChild(function walk(node) {
|
|
51734
|
-
if (
|
|
51735
|
-
const decorator = getAngularDecorators2(typeChecker,
|
|
51796
|
+
if (import_typescript129.default.isClassDeclaration(node)) {
|
|
51797
|
+
const decorator = getAngularDecorators2(typeChecker, import_typescript129.default.getDecorators(node) || []).find((current) => current.name === "NgModule");
|
|
51736
51798
|
const metadata = decorator ? extractMetadataLiteral(decorator.node) : null;
|
|
51737
51799
|
if (metadata) {
|
|
51738
51800
|
const declarations = findLiteralProperty(metadata, "declarations");
|
|
@@ -51752,13 +51814,13 @@ function findTestObjectsToMigrate(sourceFile, typeChecker) {
|
|
|
51752
51814
|
const catalystImport = getImportSpecifier(sourceFile, /testing\/catalyst$/, "setupModule");
|
|
51753
51815
|
if (testBedImport || catalystImport) {
|
|
51754
51816
|
sourceFile.forEachChild(function walk(node) {
|
|
51755
|
-
const isObjectLiteralCall =
|
|
51817
|
+
const isObjectLiteralCall = import_typescript129.default.isCallExpression(node) && node.arguments.length > 0 && import_typescript129.default.isObjectLiteralExpression(node.arguments[0]);
|
|
51756
51818
|
const config = isObjectLiteralCall ? node.arguments[0] : null;
|
|
51757
|
-
const isTestBedCall = isObjectLiteralCall && (testBedImport &&
|
|
51758
|
-
const isCatalystCall = isObjectLiteralCall && (catalystImport &&
|
|
51819
|
+
const isTestBedCall = isObjectLiteralCall && (testBedImport && import_typescript129.default.isPropertyAccessExpression(node.expression) && node.expression.name.text === "configureTestingModule" && isReferenceToImport(typeChecker, node.expression.expression, testBedImport));
|
|
51820
|
+
const isCatalystCall = isObjectLiteralCall && (catalystImport && import_typescript129.default.isIdentifier(node.expression) && isReferenceToImport(typeChecker, node.expression, catalystImport));
|
|
51759
51821
|
if ((isTestBedCall || isCatalystCall) && config) {
|
|
51760
51822
|
const declarations = findLiteralProperty(config, "declarations");
|
|
51761
|
-
if (declarations &&
|
|
51823
|
+
if (declarations && import_typescript129.default.isPropertyAssignment(declarations) && import_typescript129.default.isArrayLiteralExpression(declarations.initializer) && declarations.initializer.elements.length > 0) {
|
|
51762
51824
|
testObjects.push(config);
|
|
51763
51825
|
}
|
|
51764
51826
|
}
|
|
@@ -51773,7 +51835,7 @@ function findTemplateDependencies(decl, typeChecker) {
|
|
|
51773
51835
|
const usedPipes = typeChecker.getUsedPipes(decl);
|
|
51774
51836
|
if (usedDirectives !== null) {
|
|
51775
51837
|
for (const dir of usedDirectives) {
|
|
51776
|
-
if (
|
|
51838
|
+
if (import_typescript129.default.isClassDeclaration(dir.ref.node)) {
|
|
51777
51839
|
results.push(dir.ref);
|
|
51778
51840
|
}
|
|
51779
51841
|
}
|
|
@@ -51781,7 +51843,7 @@ function findTemplateDependencies(decl, typeChecker) {
|
|
|
51781
51843
|
if (usedPipes !== null) {
|
|
51782
51844
|
const potentialPipes = typeChecker.getPotentialPipes(decl);
|
|
51783
51845
|
for (const pipe2 of potentialPipes) {
|
|
51784
|
-
if (
|
|
51846
|
+
if (import_typescript129.default.isClassDeclaration(pipe2.ref.node) && usedPipes.some((current) => pipe2.name === current)) {
|
|
51785
51847
|
results.push(pipe2.ref);
|
|
51786
51848
|
}
|
|
51787
51849
|
}
|
|
@@ -51795,12 +51857,12 @@ function filterNonBootstrappedDeclarations(declarations, ngModule, templateTypeC
|
|
|
51795
51857
|
if (!bootstrapProp) {
|
|
51796
51858
|
return declarations;
|
|
51797
51859
|
}
|
|
51798
|
-
if (!
|
|
51860
|
+
if (!import_typescript129.default.isPropertyAssignment(bootstrapProp) || !import_typescript129.default.isArrayLiteralExpression(bootstrapProp.initializer)) {
|
|
51799
51861
|
return [];
|
|
51800
51862
|
}
|
|
51801
51863
|
const bootstrappedClasses = /* @__PURE__ */ new Set();
|
|
51802
51864
|
for (const el of bootstrapProp.initializer.elements) {
|
|
51803
|
-
const referencedClass =
|
|
51865
|
+
const referencedClass = import_typescript129.default.isIdentifier(el) ? findClassDeclaration(el, typeChecker) : null;
|
|
51804
51866
|
if (referencedClass) {
|
|
51805
51867
|
bootstrappedClasses.add(referencedClass);
|
|
51806
51868
|
} else {
|
|
@@ -51811,14 +51873,14 @@ function filterNonBootstrappedDeclarations(declarations, ngModule, templateTypeC
|
|
|
51811
51873
|
}
|
|
51812
51874
|
function extractDeclarationsFromModule(ngModule, templateTypeChecker) {
|
|
51813
51875
|
const metadata = templateTypeChecker.getNgModuleMetadata(ngModule);
|
|
51814
|
-
return metadata ? metadata.declarations.filter((decl) =>
|
|
51876
|
+
return metadata ? metadata.declarations.filter((decl) => import_typescript129.default.isClassDeclaration(decl.node)).map((decl) => decl.node) : [];
|
|
51815
51877
|
}
|
|
51816
51878
|
function migrateTestDeclarations(testObjects, declarationsOutsideOfTestFiles, tracker, templateTypeChecker, typeChecker) {
|
|
51817
51879
|
var _a2;
|
|
51818
51880
|
const { decorators, componentImports } = analyzeTestingModules(testObjects, typeChecker);
|
|
51819
51881
|
const allDeclarations = new Set(declarationsOutsideOfTestFiles);
|
|
51820
51882
|
for (const decorator of decorators) {
|
|
51821
|
-
const closestClass = closestNode(decorator.node,
|
|
51883
|
+
const closestClass = closestNode(decorator.node, import_typescript129.default.isClassDeclaration);
|
|
51822
51884
|
if (decorator.name === "Pipe" || decorator.name === "Directive") {
|
|
51823
51885
|
tracker.replaceNode(decorator.node, addStandaloneToDecorator(decorator.node));
|
|
51824
51886
|
if (closestClass) {
|
|
@@ -51832,8 +51894,8 @@ function migrateTestDeclarations(testObjects, declarationsOutsideOfTestFiles, tr
|
|
|
51832
51894
|
}
|
|
51833
51895
|
if (importsToAdd && importsToAdd.size > 0) {
|
|
51834
51896
|
const hasTrailingComma = importsToAdd.size > 2 && !!((_a2 = extractMetadataLiteral(decorator.node)) == null ? void 0 : _a2.properties.hasTrailingComma);
|
|
51835
|
-
const importsArray =
|
|
51836
|
-
tracker.replaceNode(decorator.node, addPropertyToAngularDecorator(newDecorator,
|
|
51897
|
+
const importsArray = import_typescript129.default.factory.createNodeArray(Array.from(importsToAdd), hasTrailingComma);
|
|
51898
|
+
tracker.replaceNode(decorator.node, addPropertyToAngularDecorator(newDecorator, import_typescript129.default.factory.createPropertyAssignment("imports", import_typescript129.default.factory.createArrayLiteralExpression(importsArray))));
|
|
51837
51899
|
} else {
|
|
51838
51900
|
tracker.replaceNode(decorator.node, newDecorator);
|
|
51839
51901
|
}
|
|
@@ -51854,13 +51916,13 @@ function analyzeTestingModules(testObjects, typeChecker) {
|
|
|
51854
51916
|
}
|
|
51855
51917
|
const importsProp = findLiteralProperty(obj, "imports");
|
|
51856
51918
|
const importElements = importsProp && hasNgModuleMetadataElements(importsProp) ? importsProp.initializer.elements.filter((el) => {
|
|
51857
|
-
return !
|
|
51919
|
+
return !import_typescript129.default.isCallExpression(el) && !isClassReferenceInAngularModule(el, /^BrowserAnimationsModule|NoopAnimationsModule$/, "platform-browser/animations", typeChecker);
|
|
51858
51920
|
}) : null;
|
|
51859
51921
|
for (const decl of declarations) {
|
|
51860
51922
|
if (seenDeclarations.has(decl)) {
|
|
51861
51923
|
continue;
|
|
51862
51924
|
}
|
|
51863
|
-
const [decorator] = getAngularDecorators2(typeChecker,
|
|
51925
|
+
const [decorator] = getAngularDecorators2(typeChecker, import_typescript129.default.getDecorators(decl) || []);
|
|
51864
51926
|
if (decorator) {
|
|
51865
51927
|
seenDeclarations.add(decl);
|
|
51866
51928
|
decorators.push(decorator);
|
|
@@ -51891,7 +51953,7 @@ function extractDeclarationsFromTestObject(obj, typeChecker) {
|
|
|
51891
51953
|
return results;
|
|
51892
51954
|
}
|
|
51893
51955
|
function extractMetadataLiteral(decorator) {
|
|
51894
|
-
return
|
|
51956
|
+
return import_typescript129.default.isCallExpression(decorator.expression) && decorator.expression.arguments.length === 1 && import_typescript129.default.isObjectLiteralExpression(decorator.expression.arguments[0]) ? decorator.expression.arguments[0] : null;
|
|
51895
51957
|
}
|
|
51896
51958
|
function isStandaloneDeclaration(node, declarationsInMigration, templateTypeChecker) {
|
|
51897
51959
|
if (declarationsInMigration.has(node)) {
|
|
@@ -51913,7 +51975,7 @@ function toStandaloneBootstrap(program, host, basePath, rootFileNames, sourceFil
|
|
|
51913
51975
|
const additionalProviders = hasImport(program, rootFileNames, "protractor") ? /* @__PURE__ */ new Map([["provideProtractorTestingSupport", "@angular/platform-browser"]]) : null;
|
|
51914
51976
|
for (const sourceFile of sourceFiles) {
|
|
51915
51977
|
sourceFile.forEachChild(function walk(node) {
|
|
51916
|
-
if (
|
|
51978
|
+
if (import_typescript130.default.isCallExpression(node) && import_typescript130.default.isPropertyAccessExpression(node.expression) && node.expression.name.text === "bootstrapModule" && isClassReferenceInAngularModule(node.expression, "PlatformRef", "core", typeChecker)) {
|
|
51917
51979
|
const call2 = analyzeBootstrapCall(node, typeChecker, templateTypeChecker);
|
|
51918
51980
|
if (call2) {
|
|
51919
51981
|
bootstrapCalls.push(call2);
|
|
@@ -51934,24 +51996,24 @@ function toStandaloneBootstrap(program, host, basePath, rootFileNames, sourceFil
|
|
|
51934
51996
|
return tracker.recordChanges();
|
|
51935
51997
|
}
|
|
51936
51998
|
function analyzeBootstrapCall(call2, typeChecker, templateTypeChecker) {
|
|
51937
|
-
if (call2.arguments.length === 0 || !
|
|
51999
|
+
if (call2.arguments.length === 0 || !import_typescript130.default.isIdentifier(call2.arguments[0])) {
|
|
51938
52000
|
return null;
|
|
51939
52001
|
}
|
|
51940
52002
|
const declaration = findClassDeclaration(call2.arguments[0], typeChecker);
|
|
51941
52003
|
if (!declaration) {
|
|
51942
52004
|
return null;
|
|
51943
52005
|
}
|
|
51944
|
-
const decorator = getAngularDecorators2(typeChecker,
|
|
51945
|
-
if (!decorator || decorator.node.expression.arguments.length === 0 || !
|
|
52006
|
+
const decorator = getAngularDecorators2(typeChecker, import_typescript130.default.getDecorators(declaration) || []).find((decorator2) => decorator2.name === "NgModule");
|
|
52007
|
+
if (!decorator || decorator.node.expression.arguments.length === 0 || !import_typescript130.default.isObjectLiteralExpression(decorator.node.expression.arguments[0])) {
|
|
51946
52008
|
return null;
|
|
51947
52009
|
}
|
|
51948
52010
|
const metadata = decorator.node.expression.arguments[0];
|
|
51949
52011
|
const bootstrapProp = findLiteralProperty(metadata, "bootstrap");
|
|
51950
|
-
if (!bootstrapProp || !
|
|
52012
|
+
if (!bootstrapProp || !import_typescript130.default.isPropertyAssignment(bootstrapProp) || !import_typescript130.default.isArrayLiteralExpression(bootstrapProp.initializer) || bootstrapProp.initializer.elements.length === 0 || !import_typescript130.default.isIdentifier(bootstrapProp.initializer.elements[0])) {
|
|
51951
52013
|
return null;
|
|
51952
52014
|
}
|
|
51953
52015
|
const component = findClassDeclaration(bootstrapProp.initializer.elements[0], typeChecker);
|
|
51954
|
-
if (component && component.name &&
|
|
52016
|
+
if (component && component.name && import_typescript130.default.isIdentifier(component.name)) {
|
|
51955
52017
|
return {
|
|
51956
52018
|
module: declaration,
|
|
51957
52019
|
metadata,
|
|
@@ -51973,22 +52035,22 @@ function migrateBootstrapCall(analysis, tracker, additionalProviders, referenceR
|
|
|
51973
52035
|
let nodeLookup = null;
|
|
51974
52036
|
tracker.insertText(moduleSourceFile, analysis.metadata.getStart(), "/* TODO(standalone-migration): clean up removed NgModule class manually. \n");
|
|
51975
52037
|
tracker.insertText(moduleSourceFile, analysis.metadata.getEnd(), " */");
|
|
51976
|
-
if (providers &&
|
|
52038
|
+
if (providers && import_typescript130.default.isPropertyAssignment(providers)) {
|
|
51977
52039
|
nodeLookup = nodeLookup || getNodeLookup(moduleSourceFile);
|
|
51978
|
-
if (
|
|
52040
|
+
if (import_typescript130.default.isArrayLiteralExpression(providers.initializer)) {
|
|
51979
52041
|
providersInNewCall.push(...providers.initializer.elements);
|
|
51980
52042
|
} else {
|
|
51981
|
-
providersInNewCall.push(
|
|
52043
|
+
providersInNewCall.push(import_typescript130.default.factory.createSpreadElement(providers.initializer));
|
|
51982
52044
|
}
|
|
51983
52045
|
addNodesToCopy(sourceFile, providers, nodeLookup, tracker, nodesToCopy, referenceResolver);
|
|
51984
52046
|
}
|
|
51985
|
-
if (imports &&
|
|
52047
|
+
if (imports && import_typescript130.default.isPropertyAssignment(imports)) {
|
|
51986
52048
|
nodeLookup = nodeLookup || getNodeLookup(moduleSourceFile);
|
|
51987
52049
|
migrateImportsForBootstrapCall(sourceFile, imports, nodeLookup, moduleImportsInNewCall, providersInNewCall, tracker, nodesToCopy, referenceResolver, typeChecker);
|
|
51988
52050
|
}
|
|
51989
52051
|
if (additionalProviders) {
|
|
51990
52052
|
additionalProviders.forEach((moduleSpecifier, name) => {
|
|
51991
|
-
providersInNewCall.push(
|
|
52053
|
+
providersInNewCall.push(import_typescript130.default.factory.createCallExpression(tracker.addImport(sourceFile, name, moduleSpecifier), void 0, void 0));
|
|
51992
52054
|
});
|
|
51993
52055
|
}
|
|
51994
52056
|
if (nodesToCopy.size > 0) {
|
|
@@ -51998,7 +52060,7 @@ function migrateBootstrapCall(analysis, tracker, additionalProviders, referenceR
|
|
|
51998
52060
|
if (transformedNode === node) {
|
|
51999
52061
|
text2 += transformedNode.getText() + "\n";
|
|
52000
52062
|
} else {
|
|
52001
|
-
text2 += printer.printNode(
|
|
52063
|
+
text2 += printer.printNode(import_typescript130.default.EmitHint.Unspecified, transformedNode, node.getSourceFile());
|
|
52002
52064
|
}
|
|
52003
52065
|
});
|
|
52004
52066
|
text2 += "\n";
|
|
@@ -52015,31 +52077,31 @@ function replaceBootstrapCallExpression(analysis, providers, modules, tracker) {
|
|
|
52015
52077
|
const combinedProviders = [];
|
|
52016
52078
|
if (modules.length > 0) {
|
|
52017
52079
|
const importProvidersExpression = tracker.addImport(sourceFile, "importProvidersFrom", "@angular/core");
|
|
52018
|
-
combinedProviders.push(
|
|
52080
|
+
combinedProviders.push(import_typescript130.default.factory.createCallExpression(importProvidersExpression, [], modules));
|
|
52019
52081
|
}
|
|
52020
52082
|
combinedProviders.push(...providers);
|
|
52021
|
-
const providersArray =
|
|
52022
|
-
const initializer = remapDynamicImports(sourceFile.fileName,
|
|
52023
|
-
args.push(
|
|
52083
|
+
const providersArray = import_typescript130.default.factory.createNodeArray(combinedProviders, analysis.metadata.properties.hasTrailingComma && combinedProviders.length > 2);
|
|
52084
|
+
const initializer = remapDynamicImports(sourceFile.fileName, import_typescript130.default.factory.createArrayLiteralExpression(providersArray, combinedProviders.length > 1));
|
|
52085
|
+
args.push(import_typescript130.default.factory.createObjectLiteralExpression([import_typescript130.default.factory.createPropertyAssignment("providers", initializer)], true));
|
|
52024
52086
|
}
|
|
52025
52087
|
tracker.replaceNode(
|
|
52026
52088
|
analysis.call,
|
|
52027
|
-
|
|
52089
|
+
import_typescript130.default.factory.createCallExpression(bootstrapExpression, [], args),
|
|
52028
52090
|
void 0,
|
|
52029
52091
|
analysis.metadata.getSourceFile()
|
|
52030
52092
|
);
|
|
52031
52093
|
}
|
|
52032
52094
|
function migrateImportsForBootstrapCall(sourceFile, imports, nodeLookup, importsForNewCall, providersInNewCall, tracker, nodesToCopy, referenceResolver, typeChecker) {
|
|
52033
|
-
if (!
|
|
52095
|
+
if (!import_typescript130.default.isArrayLiteralExpression(imports.initializer)) {
|
|
52034
52096
|
importsForNewCall.push(imports.initializer);
|
|
52035
52097
|
return;
|
|
52036
52098
|
}
|
|
52037
52099
|
for (const element2 of imports.initializer.elements) {
|
|
52038
|
-
if (
|
|
52100
|
+
if (import_typescript130.default.isCallExpression(element2) && import_typescript130.default.isPropertyAccessExpression(element2.expression) && element2.arguments.length > 0 && element2.expression.name.text === "forRoot" && isClassReferenceInAngularModule(element2.expression.expression, "RouterModule", "router", typeChecker)) {
|
|
52039
52101
|
const options = element2.arguments[1];
|
|
52040
52102
|
const features = options ? getRouterModuleForRootFeatures(sourceFile, options, tracker) : [];
|
|
52041
52103
|
if (features !== null) {
|
|
52042
|
-
providersInNewCall.push(
|
|
52104
|
+
providersInNewCall.push(import_typescript130.default.factory.createCallExpression(tracker.addImport(sourceFile, "provideRouter", "@angular/router"), [], [element2.arguments[0], ...features]));
|
|
52043
52105
|
addNodesToCopy(sourceFile, element2.arguments[0], nodeLookup, tracker, nodesToCopy, referenceResolver);
|
|
52044
52106
|
if (options) {
|
|
52045
52107
|
addNodesToCopy(sourceFile, options, nodeLookup, tracker, nodesToCopy, referenceResolver);
|
|
@@ -52047,30 +52109,30 @@ function migrateImportsForBootstrapCall(sourceFile, imports, nodeLookup, imports
|
|
|
52047
52109
|
continue;
|
|
52048
52110
|
}
|
|
52049
52111
|
}
|
|
52050
|
-
if (
|
|
52112
|
+
if (import_typescript130.default.isIdentifier(element2)) {
|
|
52051
52113
|
const animationsModule = "platform-browser/animations";
|
|
52052
52114
|
const animationsImport = `@angular/${animationsModule}`;
|
|
52053
52115
|
if (isClassReferenceInAngularModule(element2, "BrowserAnimationsModule", animationsModule, typeChecker)) {
|
|
52054
|
-
providersInNewCall.push(
|
|
52116
|
+
providersInNewCall.push(import_typescript130.default.factory.createCallExpression(tracker.addImport(sourceFile, "provideAnimations", animationsImport), [], []));
|
|
52055
52117
|
continue;
|
|
52056
52118
|
}
|
|
52057
52119
|
if (isClassReferenceInAngularModule(element2, "NoopAnimationsModule", animationsModule, typeChecker)) {
|
|
52058
|
-
providersInNewCall.push(
|
|
52120
|
+
providersInNewCall.push(import_typescript130.default.factory.createCallExpression(tracker.addImport(sourceFile, "provideNoopAnimations", animationsImport), [], []));
|
|
52059
52121
|
continue;
|
|
52060
52122
|
}
|
|
52061
52123
|
const httpClientModule = "common/http";
|
|
52062
52124
|
const httpClientImport = `@angular/${httpClientModule}`;
|
|
52063
52125
|
if (isClassReferenceInAngularModule(element2, "HttpClientModule", httpClientModule, typeChecker)) {
|
|
52064
52126
|
const callArgs = [
|
|
52065
|
-
|
|
52127
|
+
import_typescript130.default.factory.createCallExpression(tracker.addImport(sourceFile, "withInterceptorsFromDi", httpClientImport), [], [])
|
|
52066
52128
|
];
|
|
52067
|
-
providersInNewCall.push(
|
|
52129
|
+
providersInNewCall.push(import_typescript130.default.factory.createCallExpression(tracker.addImport(sourceFile, "provideHttpClient", httpClientImport), [], callArgs));
|
|
52068
52130
|
continue;
|
|
52069
52131
|
}
|
|
52070
52132
|
}
|
|
52071
|
-
const target =
|
|
52133
|
+
const target = import_typescript130.default.isCallExpression(element2) && import_typescript130.default.isPropertyAccessExpression(element2.expression) ? element2.expression.expression : element2;
|
|
52072
52134
|
const classDeclaration = findClassDeclaration(target, typeChecker);
|
|
52073
|
-
const decorators = classDeclaration ? getAngularDecorators2(typeChecker,
|
|
52135
|
+
const decorators = classDeclaration ? getAngularDecorators2(typeChecker, import_typescript130.default.getDecorators(classDeclaration) || []) : void 0;
|
|
52074
52136
|
if (!decorators || decorators.length === 0 || decorators.every(({ name }) => name !== "Directive" && name !== "Component" && name !== "Pipe")) {
|
|
52075
52137
|
importsForNewCall.push(element2);
|
|
52076
52138
|
addNodesToCopy(sourceFile, element2, nodeLookup, tracker, nodesToCopy, referenceResolver);
|
|
@@ -52078,7 +52140,7 @@ function migrateImportsForBootstrapCall(sourceFile, imports, nodeLookup, imports
|
|
|
52078
52140
|
}
|
|
52079
52141
|
}
|
|
52080
52142
|
function getRouterModuleForRootFeatures(sourceFile, options, tracker) {
|
|
52081
|
-
if (!
|
|
52143
|
+
if (!import_typescript130.default.isObjectLiteralExpression(options)) {
|
|
52082
52144
|
return null;
|
|
52083
52145
|
}
|
|
52084
52146
|
const featureExpressions = [];
|
|
@@ -52086,7 +52148,7 @@ function getRouterModuleForRootFeatures(sourceFile, options, tracker) {
|
|
|
52086
52148
|
const inMemoryScrollingOptions = [];
|
|
52087
52149
|
const features = new UniqueItemTracker();
|
|
52088
52150
|
for (const prop of options.properties) {
|
|
52089
|
-
if (!
|
|
52151
|
+
if (!import_typescript130.default.isPropertyAssignment(prop) || !import_typescript130.default.isIdentifier(prop.name) && !import_typescript130.default.isStringLiteralLike(prop.name)) {
|
|
52090
52152
|
return null;
|
|
52091
52153
|
}
|
|
52092
52154
|
switch (prop.name.text) {
|
|
@@ -52094,12 +52156,12 @@ function getRouterModuleForRootFeatures(sourceFile, options, tracker) {
|
|
|
52094
52156
|
features.track("withPreloading", prop.initializer);
|
|
52095
52157
|
break;
|
|
52096
52158
|
case "enableTracing":
|
|
52097
|
-
if (prop.initializer.kind ===
|
|
52159
|
+
if (prop.initializer.kind === import_typescript130.default.SyntaxKind.TrueKeyword) {
|
|
52098
52160
|
features.track("withDebugTracing", null);
|
|
52099
52161
|
}
|
|
52100
52162
|
break;
|
|
52101
52163
|
case "initialNavigation":
|
|
52102
|
-
if (!
|
|
52164
|
+
if (!import_typescript130.default.isStringLiteralLike(prop.initializer)) {
|
|
52103
52165
|
return null;
|
|
52104
52166
|
}
|
|
52105
52167
|
if (prop.initializer.text === "enabledBlocking" || prop.initializer.text === "enabled") {
|
|
@@ -52109,7 +52171,7 @@ function getRouterModuleForRootFeatures(sourceFile, options, tracker) {
|
|
|
52109
52171
|
}
|
|
52110
52172
|
break;
|
|
52111
52173
|
case "useHash":
|
|
52112
|
-
if (prop.initializer.kind ===
|
|
52174
|
+
if (prop.initializer.kind === import_typescript130.default.SyntaxKind.TrueKeyword) {
|
|
52113
52175
|
features.track("withHashLocation", null);
|
|
52114
52176
|
}
|
|
52115
52177
|
break;
|
|
@@ -52126,10 +52188,10 @@ function getRouterModuleForRootFeatures(sourceFile, options, tracker) {
|
|
|
52126
52188
|
}
|
|
52127
52189
|
}
|
|
52128
52190
|
if (inMemoryScrollingOptions.length > 0) {
|
|
52129
|
-
features.track("withInMemoryScrolling",
|
|
52191
|
+
features.track("withInMemoryScrolling", import_typescript130.default.factory.createObjectLiteralExpression(inMemoryScrollingOptions));
|
|
52130
52192
|
}
|
|
52131
52193
|
if (configOptions.length > 0) {
|
|
52132
|
-
features.track("withRouterConfig",
|
|
52194
|
+
features.track("withRouterConfig", import_typescript130.default.factory.createObjectLiteralExpression(configOptions));
|
|
52133
52195
|
}
|
|
52134
52196
|
for (const [feature, featureArgs] of features.getEntries()) {
|
|
52135
52197
|
const callArgs = [];
|
|
@@ -52138,25 +52200,25 @@ function getRouterModuleForRootFeatures(sourceFile, options, tracker) {
|
|
|
52138
52200
|
callArgs.push(arg);
|
|
52139
52201
|
}
|
|
52140
52202
|
});
|
|
52141
|
-
featureExpressions.push(
|
|
52203
|
+
featureExpressions.push(import_typescript130.default.factory.createCallExpression(tracker.addImport(sourceFile, feature, "@angular/router"), [], callArgs));
|
|
52142
52204
|
}
|
|
52143
52205
|
return featureExpressions;
|
|
52144
52206
|
}
|
|
52145
52207
|
function addNodesToCopy(targetFile, rootNode, nodeLookup, tracker, nodesToCopy, referenceResolver) {
|
|
52146
52208
|
const refs = findAllSameFileReferences(rootNode, nodeLookup, referenceResolver);
|
|
52147
52209
|
for (const ref of refs) {
|
|
52148
|
-
const importSpecifier = closestOrSelf(ref,
|
|
52149
|
-
const importDeclaration = importSpecifier ? closestNode(importSpecifier,
|
|
52150
|
-
if (importDeclaration && importSpecifier &&
|
|
52210
|
+
const importSpecifier = closestOrSelf(ref, import_typescript130.default.isImportSpecifier);
|
|
52211
|
+
const importDeclaration = importSpecifier ? closestNode(importSpecifier, import_typescript130.default.isImportDeclaration) : null;
|
|
52212
|
+
if (importDeclaration && importSpecifier && import_typescript130.default.isStringLiteralLike(importDeclaration.moduleSpecifier)) {
|
|
52151
52213
|
const moduleName = importDeclaration.moduleSpecifier.text.startsWith(".") ? remapRelativeImport(targetFile.fileName, importDeclaration.moduleSpecifier) : importDeclaration.moduleSpecifier.text;
|
|
52152
52214
|
const symbolName = importSpecifier.propertyName ? importSpecifier.propertyName.text : importSpecifier.name.text;
|
|
52153
52215
|
const alias = importSpecifier.propertyName ? importSpecifier.name.text : null;
|
|
52154
52216
|
tracker.addImport(targetFile, symbolName, moduleName, alias);
|
|
52155
52217
|
continue;
|
|
52156
52218
|
}
|
|
52157
|
-
const variableDeclaration = closestOrSelf(ref,
|
|
52158
|
-
const variableStatement = variableDeclaration ? closestNode(variableDeclaration,
|
|
52159
|
-
if (variableDeclaration && variableStatement &&
|
|
52219
|
+
const variableDeclaration = closestOrSelf(ref, import_typescript130.default.isVariableDeclaration);
|
|
52220
|
+
const variableStatement = variableDeclaration ? closestNode(variableDeclaration, import_typescript130.default.isVariableStatement) : null;
|
|
52221
|
+
if (variableDeclaration && variableStatement && import_typescript130.default.isIdentifier(variableDeclaration.name)) {
|
|
52160
52222
|
if (isExported(variableStatement)) {
|
|
52161
52223
|
tracker.addImport(targetFile, variableDeclaration.name.text, getRelativeImportPath(targetFile.fileName, ref.getSourceFile().fileName));
|
|
52162
52224
|
} else {
|
|
@@ -52197,7 +52259,7 @@ function findAllSameFileReferences(rootNode, nodeLookup, referenceResolver) {
|
|
|
52197
52259
|
if (!closestTopLevel || traversedTopLevelNodes.has(closestTopLevel)) {
|
|
52198
52260
|
continue;
|
|
52199
52261
|
}
|
|
52200
|
-
if (!
|
|
52262
|
+
if (!import_typescript130.default.isImportDeclaration(closestTopLevel) && isOutsideRange(excludeStart, excludeEnd, closestTopLevel.getStart(), closestTopLevel.getEnd())) {
|
|
52201
52263
|
traversedTopLevelNodes.add(closestTopLevel);
|
|
52202
52264
|
walk(closestTopLevel);
|
|
52203
52265
|
}
|
|
@@ -52218,25 +52280,25 @@ function referencesToNodeWithinSameFile(node, nodeLookup, excludeStart, excludeE
|
|
|
52218
52280
|
function remapDynamicImports(targetFileName, rootNode) {
|
|
52219
52281
|
let hasChanged = false;
|
|
52220
52282
|
const transformer = (context) => {
|
|
52221
|
-
return (sourceFile) =>
|
|
52222
|
-
if (
|
|
52283
|
+
return (sourceFile) => import_typescript130.default.visitNode(sourceFile, function walk(node) {
|
|
52284
|
+
if (import_typescript130.default.isCallExpression(node) && node.expression.kind === import_typescript130.default.SyntaxKind.ImportKeyword && node.arguments.length > 0 && import_typescript130.default.isStringLiteralLike(node.arguments[0]) && node.arguments[0].text.startsWith(".")) {
|
|
52223
52285
|
hasChanged = true;
|
|
52224
52286
|
return context.factory.updateCallExpression(node, node.expression, node.typeArguments, [
|
|
52225
52287
|
context.factory.createStringLiteral(remapRelativeImport(targetFileName, node.arguments[0])),
|
|
52226
52288
|
...node.arguments.slice(1)
|
|
52227
52289
|
]);
|
|
52228
52290
|
}
|
|
52229
|
-
return
|
|
52291
|
+
return import_typescript130.default.visitEachChild(node, walk, context);
|
|
52230
52292
|
});
|
|
52231
52293
|
};
|
|
52232
|
-
const result =
|
|
52294
|
+
const result = import_typescript130.default.transform(rootNode, [transformer]).transformed[0];
|
|
52233
52295
|
return hasChanged ? result : rootNode;
|
|
52234
52296
|
}
|
|
52235
52297
|
function isTopLevelStatement(node) {
|
|
52236
|
-
return node.parent != null &&
|
|
52298
|
+
return node.parent != null && import_typescript130.default.isSourceFile(node.parent);
|
|
52237
52299
|
}
|
|
52238
52300
|
function isReferenceIdentifier(node) {
|
|
52239
|
-
return
|
|
52301
|
+
return import_typescript130.default.isIdentifier(node) && (!import_typescript130.default.isPropertyAssignment(node.parent) && !import_typescript130.default.isParameter(node.parent) || node.parent.name !== node);
|
|
52240
52302
|
}
|
|
52241
52303
|
function isOutsideRange(excludeStart, excludeEnd, start, end) {
|
|
52242
52304
|
return start < excludeStart && end < excludeStart || start > excludeEnd;
|
|
@@ -52245,15 +52307,15 @@ function remapRelativeImport(targetFileName, specifier) {
|
|
|
52245
52307
|
return getRelativeImportPath(targetFileName, (0, import_path7.join)((0, import_path7.dirname)(specifier.getSourceFile().fileName), specifier.text));
|
|
52246
52308
|
}
|
|
52247
52309
|
function isExported(node) {
|
|
52248
|
-
return
|
|
52310
|
+
return import_typescript130.default.canHaveModifiers(node) && node.modifiers ? node.modifiers.some((modifier) => modifier.kind === import_typescript130.default.SyntaxKind.ExportKeyword) : false;
|
|
52249
52311
|
}
|
|
52250
52312
|
function isExportableDeclaration(node) {
|
|
52251
|
-
return
|
|
52313
|
+
return import_typescript130.default.isEnumDeclaration(node) || import_typescript130.default.isClassDeclaration(node) || import_typescript130.default.isFunctionDeclaration(node) || import_typescript130.default.isInterfaceDeclaration(node) || import_typescript130.default.isTypeAliasDeclaration(node);
|
|
52252
52314
|
}
|
|
52253
52315
|
function getLastImportEnd(sourceFile) {
|
|
52254
52316
|
let index = 0;
|
|
52255
52317
|
for (const statement of sourceFile.statements) {
|
|
52256
|
-
if (
|
|
52318
|
+
if (import_typescript130.default.isImportDeclaration(statement)) {
|
|
52257
52319
|
index = Math.max(index, statement.getEnd());
|
|
52258
52320
|
} else {
|
|
52259
52321
|
break;
|
|
@@ -52270,7 +52332,7 @@ function hasImport(program, rootFileNames, moduleName) {
|
|
|
52270
52332
|
continue;
|
|
52271
52333
|
}
|
|
52272
52334
|
for (const statement of sourceFile.statements) {
|
|
52273
|
-
if (
|
|
52335
|
+
if (import_typescript130.default.isImportDeclaration(statement) && import_typescript130.default.isStringLiteralLike(statement.moduleSpecifier) && (statement.moduleSpecifier.text === moduleName || statement.moduleSpecifier.text.startsWith(deepImportStart))) {
|
|
52274
52336
|
return true;
|
|
52275
52337
|
}
|
|
52276
52338
|
}
|
|
@@ -52318,7 +52380,7 @@ function standaloneMigration(tree, tsconfigPath, basePath, pathToMigrate, schema
|
|
|
52318
52380
|
});
|
|
52319
52381
|
const referenceLookupExcludedFiles = /node_modules|\.ngtypecheck\.ts/;
|
|
52320
52382
|
const program = createProgram({ rootNames, host, options, oldProgram });
|
|
52321
|
-
const printer =
|
|
52383
|
+
const printer = import_typescript131.default.createPrinter();
|
|
52322
52384
|
if ((0, import_fs2.existsSync)(pathToMigrate) && !(0, import_fs2.statSync)(pathToMigrate).isDirectory()) {
|
|
52323
52385
|
throw new import_schematics.SchematicsException(`Migration path ${pathToMigrate} has to be a directory. Cannot run the standalone migration.`);
|
|
52324
52386
|
}
|