@angular/core 15.2.0-next.4 → 15.2.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/esm2020/src/di/interface/defs.mjs +4 -5
- package/esm2020/src/di/provider_collection.mjs +2 -2
- package/esm2020/src/metadata/directives.mjs +1 -1
- package/esm2020/src/version.mjs +1 -1
- package/esm2020/testing/src/logger.mjs +3 -3
- package/esm2020/testing/src/ng_zone_mock.mjs +3 -3
- package/fesm2015/core.mjs +5 -6
- package/fesm2015/core.mjs.map +1 -1
- package/fesm2015/testing.mjs +5 -6
- package/fesm2015/testing.mjs.map +1 -1
- package/fesm2020/core.mjs +5 -6
- package/fesm2020/core.mjs.map +1 -1
- package/fesm2020/testing.mjs +5 -6
- package/fesm2020/testing.mjs.map +1 -1
- package/index.d.ts +2 -2
- package/package.json +1 -1
- package/schematics/ng-generate/standalone-migration/bundle.js +401 -298
- package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
- package/testing/index.d.ts +1 -1
- package/esm2020/src/view/index.mjs +0 -9
|
@@ -16114,7 +16114,7 @@ function publishFacade(global2) {
|
|
|
16114
16114
|
}
|
|
16115
16115
|
|
|
16116
16116
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/version.mjs
|
|
16117
|
-
var VERSION2 = new Version("15.2.0
|
|
16117
|
+
var VERSION2 = new Version("15.2.0");
|
|
16118
16118
|
|
|
16119
16119
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/i18n/extractor_merger.mjs
|
|
16120
16120
|
var _I18N_ATTR = "i18n";
|
|
@@ -17429,7 +17429,7 @@ var MINIMUM_PARTIAL_LINKER_VERSION = "12.0.0";
|
|
|
17429
17429
|
function compileDeclareClassMetadata(metadata) {
|
|
17430
17430
|
const definitionMap = new DefinitionMap();
|
|
17431
17431
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
17432
|
-
definitionMap.set("version", literal("15.2.0
|
|
17432
|
+
definitionMap.set("version", literal("15.2.0"));
|
|
17433
17433
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
17434
17434
|
definitionMap.set("type", metadata.type);
|
|
17435
17435
|
definitionMap.set("decorators", metadata.decorators);
|
|
@@ -17498,7 +17498,7 @@ function createDirectiveDefinitionMap(meta) {
|
|
|
17498
17498
|
var _a;
|
|
17499
17499
|
const definitionMap = new DefinitionMap();
|
|
17500
17500
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION2));
|
|
17501
|
-
definitionMap.set("version", literal("15.2.0
|
|
17501
|
+
definitionMap.set("version", literal("15.2.0"));
|
|
17502
17502
|
definitionMap.set("type", meta.internalType);
|
|
17503
17503
|
if (meta.isStandalone) {
|
|
17504
17504
|
definitionMap.set("isStandalone", literal(meta.isStandalone));
|
|
@@ -17680,7 +17680,7 @@ var MINIMUM_PARTIAL_LINKER_VERSION3 = "12.0.0";
|
|
|
17680
17680
|
function compileDeclareFactoryFunction(meta) {
|
|
17681
17681
|
const definitionMap = new DefinitionMap();
|
|
17682
17682
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION3));
|
|
17683
|
-
definitionMap.set("version", literal("15.2.0
|
|
17683
|
+
definitionMap.set("version", literal("15.2.0"));
|
|
17684
17684
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
17685
17685
|
definitionMap.set("type", meta.internalType);
|
|
17686
17686
|
definitionMap.set("deps", compileDependencies(meta.deps));
|
|
@@ -17703,7 +17703,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
17703
17703
|
function createInjectableDefinitionMap(meta) {
|
|
17704
17704
|
const definitionMap = new DefinitionMap();
|
|
17705
17705
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION4));
|
|
17706
|
-
definitionMap.set("version", literal("15.2.0
|
|
17706
|
+
definitionMap.set("version", literal("15.2.0"));
|
|
17707
17707
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
17708
17708
|
definitionMap.set("type", meta.internalType);
|
|
17709
17709
|
if (meta.providedIn !== void 0) {
|
|
@@ -17741,7 +17741,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
17741
17741
|
function createInjectorDefinitionMap(meta) {
|
|
17742
17742
|
const definitionMap = new DefinitionMap();
|
|
17743
17743
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION5));
|
|
17744
|
-
definitionMap.set("version", literal("15.2.0
|
|
17744
|
+
definitionMap.set("version", literal("15.2.0"));
|
|
17745
17745
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
17746
17746
|
definitionMap.set("type", meta.internalType);
|
|
17747
17747
|
definitionMap.set("providers", meta.providers);
|
|
@@ -17762,7 +17762,7 @@ function compileDeclareNgModuleFromMetadata(meta) {
|
|
|
17762
17762
|
function createNgModuleDefinitionMap(meta) {
|
|
17763
17763
|
const definitionMap = new DefinitionMap();
|
|
17764
17764
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION6));
|
|
17765
|
-
definitionMap.set("version", literal("15.2.0
|
|
17765
|
+
definitionMap.set("version", literal("15.2.0"));
|
|
17766
17766
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
17767
17767
|
definitionMap.set("type", meta.internalType);
|
|
17768
17768
|
if (meta.bootstrap.length > 0) {
|
|
@@ -17797,7 +17797,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
17797
17797
|
function createPipeDefinitionMap(meta) {
|
|
17798
17798
|
const definitionMap = new DefinitionMap();
|
|
17799
17799
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION7));
|
|
17800
|
-
definitionMap.set("version", literal("15.2.0
|
|
17800
|
+
definitionMap.set("version", literal("15.2.0"));
|
|
17801
17801
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
17802
17802
|
definitionMap.set("type", meta.internalType);
|
|
17803
17803
|
if (meta.isStandalone) {
|
|
@@ -17814,7 +17814,7 @@ function createPipeDefinitionMap(meta) {
|
|
|
17814
17814
|
publishFacade(_global);
|
|
17815
17815
|
|
|
17816
17816
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/version.mjs
|
|
17817
|
-
var VERSION3 = new Version("15.2.0
|
|
17817
|
+
var VERSION3 = new Version("15.2.0");
|
|
17818
17818
|
|
|
17819
17819
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/transformers/api.mjs
|
|
17820
17820
|
var EmitFlags;
|
|
@@ -19228,8 +19228,42 @@ function validateAndRewriteCoreSymbol(name) {
|
|
|
19228
19228
|
return CORE_SUPPORTED_SYMBOLS.get(name);
|
|
19229
19229
|
}
|
|
19230
19230
|
|
|
19231
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/
|
|
19231
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/patch_alias_reference_resolution.mjs
|
|
19232
19232
|
var import_typescript14 = __toESM(require("typescript"), 1);
|
|
19233
|
+
var patchedReferencedAliasesSymbol = Symbol("patchedReferencedAliases");
|
|
19234
|
+
function loadIsReferencedAliasDeclarationPatch(context) {
|
|
19235
|
+
if (!isTransformationContextWithEmitResolver(context)) {
|
|
19236
|
+
throwIncompatibleTransformationContextError();
|
|
19237
|
+
}
|
|
19238
|
+
const emitResolver = context.getEmitResolver();
|
|
19239
|
+
const existingReferencedAliases = emitResolver[patchedReferencedAliasesSymbol];
|
|
19240
|
+
if (existingReferencedAliases !== void 0) {
|
|
19241
|
+
return existingReferencedAliases;
|
|
19242
|
+
}
|
|
19243
|
+
const originalIsReferencedAliasDeclaration = emitResolver.isReferencedAliasDeclaration;
|
|
19244
|
+
if (originalIsReferencedAliasDeclaration === void 0) {
|
|
19245
|
+
throwIncompatibleTransformationContextError();
|
|
19246
|
+
}
|
|
19247
|
+
const referencedAliases = /* @__PURE__ */ new Set();
|
|
19248
|
+
emitResolver.isReferencedAliasDeclaration = function(node, ...args) {
|
|
19249
|
+
if (isAliasImportDeclaration(node) && referencedAliases.has(node)) {
|
|
19250
|
+
return true;
|
|
19251
|
+
}
|
|
19252
|
+
return originalIsReferencedAliasDeclaration.call(emitResolver, node, ...args);
|
|
19253
|
+
};
|
|
19254
|
+
return emitResolver[patchedReferencedAliasesSymbol] = referencedAliases;
|
|
19255
|
+
}
|
|
19256
|
+
function isAliasImportDeclaration(node) {
|
|
19257
|
+
return import_typescript14.default.isImportSpecifier(node) || import_typescript14.default.isNamespaceImport(node) || import_typescript14.default.isImportClause(node);
|
|
19258
|
+
}
|
|
19259
|
+
function isTransformationContextWithEmitResolver(context) {
|
|
19260
|
+
return context.getEmitResolver !== void 0;
|
|
19261
|
+
}
|
|
19262
|
+
function throwIncompatibleTransformationContextError() {
|
|
19263
|
+
throw Error("Angular compiler is incompatible with this version of the TypeScript compiler.\n\nIf you recently updated TypeScript and this issue surfaces now, consider downgrading.\n\nPlease report an issue on the Angular repositories when this issue surfaces and you are using a supposedly compatible TypeScript version.");
|
|
19264
|
+
}
|
|
19265
|
+
|
|
19266
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/default.mjs
|
|
19233
19267
|
var DefaultImportDeclaration = Symbol("DefaultImportDeclaration");
|
|
19234
19268
|
function attachDefaultImportDeclaration(expr, importDecl) {
|
|
19235
19269
|
expr[DefaultImportDeclaration] = importDecl;
|
|
@@ -19243,34 +19277,31 @@ var DefaultImportTracker = class {
|
|
|
19243
19277
|
this.sourceFileToUsedImports = /* @__PURE__ */ new Map();
|
|
19244
19278
|
}
|
|
19245
19279
|
recordUsedImport(importDecl) {
|
|
19246
|
-
|
|
19247
|
-
|
|
19248
|
-
this.sourceFileToUsedImports.
|
|
19280
|
+
if (importDecl.importClause) {
|
|
19281
|
+
const sf = getSourceFile(importDecl);
|
|
19282
|
+
if (!this.sourceFileToUsedImports.has(sf.fileName)) {
|
|
19283
|
+
this.sourceFileToUsedImports.set(sf.fileName, /* @__PURE__ */ new Set());
|
|
19284
|
+
}
|
|
19285
|
+
this.sourceFileToUsedImports.get(sf.fileName).add(importDecl.importClause);
|
|
19249
19286
|
}
|
|
19250
|
-
this.sourceFileToUsedImports.get(sf).add(importDecl);
|
|
19251
19287
|
}
|
|
19252
19288
|
importPreservingTransformer() {
|
|
19253
19289
|
return (context) => {
|
|
19254
|
-
|
|
19255
|
-
|
|
19290
|
+
let clausesToPreserve = null;
|
|
19291
|
+
return (sourceFile) => {
|
|
19292
|
+
const clausesForFile = this.sourceFileToUsedImports.get(sourceFile.fileName);
|
|
19293
|
+
if (clausesForFile !== void 0) {
|
|
19294
|
+
for (const clause of clausesForFile) {
|
|
19295
|
+
if (clausesToPreserve === null) {
|
|
19296
|
+
clausesToPreserve = loadIsReferencedAliasDeclarationPatch(context);
|
|
19297
|
+
}
|
|
19298
|
+
clausesToPreserve.add(clause);
|
|
19299
|
+
}
|
|
19300
|
+
}
|
|
19301
|
+
return sourceFile;
|
|
19256
19302
|
};
|
|
19257
19303
|
};
|
|
19258
19304
|
}
|
|
19259
|
-
transformSourceFile(sf) {
|
|
19260
|
-
const originalSf = import_typescript14.default.getOriginalNode(sf);
|
|
19261
|
-
if (!this.sourceFileToUsedImports.has(originalSf)) {
|
|
19262
|
-
return sf;
|
|
19263
|
-
}
|
|
19264
|
-
const importsToPreserve = this.sourceFileToUsedImports.get(originalSf);
|
|
19265
|
-
const statements = sf.statements.map((stmt) => {
|
|
19266
|
-
if (import_typescript14.default.isImportDeclaration(stmt) && importsToPreserve.has(stmt)) {
|
|
19267
|
-
stmt = import_typescript14.default.getMutableClone(stmt);
|
|
19268
|
-
}
|
|
19269
|
-
return stmt;
|
|
19270
|
-
});
|
|
19271
|
-
this.sourceFileToUsedImports.delete(originalSf);
|
|
19272
|
-
return import_typescript14.default.factory.updateSourceFile(sf, statements);
|
|
19273
|
-
}
|
|
19274
19305
|
};
|
|
19275
19306
|
|
|
19276
19307
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/imports/src/references.mjs
|
|
@@ -34545,11 +34576,7 @@ var import_typescript99 = __toESM(require("typescript"), 1);
|
|
|
34545
34576
|
var import_typescript98 = __toESM(require("typescript"), 1);
|
|
34546
34577
|
|
|
34547
34578
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/transformers/downlevel_decorators_transform/downlevel_decorators_transform.mjs
|
|
34548
|
-
var import_typescript101 = __toESM(require("typescript"), 1);
|
|
34549
|
-
|
|
34550
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/transformers/downlevel_decorators_transform/patch_alias_reference_resolution.mjs
|
|
34551
34579
|
var import_typescript100 = __toESM(require("typescript"), 1);
|
|
34552
|
-
var patchedReferencedAliasesSymbol = Symbol("patchedReferencedAliases");
|
|
34553
34580
|
|
|
34554
34581
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/private/tooling.mjs
|
|
34555
34582
|
var GLOBAL_DEFS_FOR_TERSER = {
|
|
@@ -34584,7 +34611,7 @@ setFileSystem(new NodeJSFileSystem());
|
|
|
34584
34611
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/ng-generate/standalone-migration/index.mjs
|
|
34585
34612
|
var import_fs2 = require("fs");
|
|
34586
34613
|
var import_path8 = require("path");
|
|
34587
|
-
var
|
|
34614
|
+
var import_typescript112 = __toESM(require("typescript"), 1);
|
|
34588
34615
|
|
|
34589
34616
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/project_tsconfig_paths.mjs
|
|
34590
34617
|
var import_core13 = require("@angular-devkit/core");
|
|
@@ -34668,23 +34695,23 @@ function getWorkspace(tree) {
|
|
|
34668
34695
|
|
|
34669
34696
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/compiler_host.mjs
|
|
34670
34697
|
var import_path4 = require("path");
|
|
34671
|
-
var
|
|
34698
|
+
var import_typescript102 = __toESM(require("typescript"), 1);
|
|
34672
34699
|
|
|
34673
34700
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/parse_tsconfig.mjs
|
|
34674
34701
|
var path2 = __toESM(require("path"), 1);
|
|
34675
|
-
var
|
|
34702
|
+
var import_typescript101 = __toESM(require("typescript"), 1);
|
|
34676
34703
|
function parseTsconfigFile(tsconfigPath, basePath) {
|
|
34677
|
-
const { config } =
|
|
34704
|
+
const { config } = import_typescript101.default.readConfigFile(tsconfigPath, import_typescript101.default.sys.readFile);
|
|
34678
34705
|
const parseConfigHost = {
|
|
34679
|
-
useCaseSensitiveFileNames:
|
|
34680
|
-
fileExists:
|
|
34681
|
-
readDirectory:
|
|
34682
|
-
readFile:
|
|
34706
|
+
useCaseSensitiveFileNames: import_typescript101.default.sys.useCaseSensitiveFileNames,
|
|
34707
|
+
fileExists: import_typescript101.default.sys.fileExists,
|
|
34708
|
+
readDirectory: import_typescript101.default.sys.readDirectory,
|
|
34709
|
+
readFile: import_typescript101.default.sys.readFile
|
|
34683
34710
|
};
|
|
34684
34711
|
if (!path2.isAbsolute(basePath)) {
|
|
34685
34712
|
throw Error("Unexpected relative base path has been specified.");
|
|
34686
34713
|
}
|
|
34687
|
-
return
|
|
34714
|
+
return import_typescript101.default.parseJsonConfigFileContent(config, parseConfigHost, basePath, {});
|
|
34688
34715
|
}
|
|
34689
34716
|
|
|
34690
34717
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/compiler_host.mjs
|
|
@@ -34696,7 +34723,7 @@ function createProgramOptions(tree, tsconfigPath, basePath, fakeFileRead, additi
|
|
|
34696
34723
|
return { rootNames: parsed.fileNames.concat(additionalFiles || []), options, host };
|
|
34697
34724
|
}
|
|
34698
34725
|
function createMigrationCompilerHost(tree, options, basePath, fakeRead) {
|
|
34699
|
-
const host =
|
|
34726
|
+
const host = import_typescript102.default.createCompilerHost(options, true);
|
|
34700
34727
|
const defaultReadFile = host.readFile;
|
|
34701
34728
|
host.readFile = (fileName) => {
|
|
34702
34729
|
var _a;
|
|
@@ -34717,24 +34744,24 @@ function canMigrateFile(basePath, sourceFile, program) {
|
|
|
34717
34744
|
}
|
|
34718
34745
|
|
|
34719
34746
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/ng-generate/standalone-migration/prune-modules.mjs
|
|
34720
|
-
var
|
|
34747
|
+
var import_typescript108 = __toESM(require("typescript"), 1);
|
|
34721
34748
|
|
|
34722
34749
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/decorators.mjs
|
|
34723
|
-
var
|
|
34750
|
+
var import_typescript104 = __toESM(require("typescript"), 1);
|
|
34724
34751
|
|
|
34725
34752
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/imports.mjs
|
|
34726
|
-
var
|
|
34753
|
+
var import_typescript103 = __toESM(require("typescript"), 1);
|
|
34727
34754
|
function getImportOfIdentifier(typeChecker, node) {
|
|
34728
34755
|
const symbol = typeChecker.getSymbolAtLocation(node);
|
|
34729
34756
|
if (!symbol || symbol.declarations === void 0 || !symbol.declarations.length) {
|
|
34730
34757
|
return null;
|
|
34731
34758
|
}
|
|
34732
34759
|
const decl = symbol.declarations[0];
|
|
34733
|
-
if (!
|
|
34760
|
+
if (!import_typescript103.default.isImportSpecifier(decl)) {
|
|
34734
34761
|
return null;
|
|
34735
34762
|
}
|
|
34736
34763
|
const importDecl = decl.parent.parent.parent;
|
|
34737
|
-
if (!
|
|
34764
|
+
if (!import_typescript103.default.isStringLiteral(importDecl.moduleSpecifier)) {
|
|
34738
34765
|
return null;
|
|
34739
34766
|
}
|
|
34740
34767
|
return {
|
|
@@ -34746,10 +34773,10 @@ function getImportOfIdentifier(typeChecker, node) {
|
|
|
34746
34773
|
function getImportSpecifier(sourceFile, moduleName, specifierName) {
|
|
34747
34774
|
var _a;
|
|
34748
34775
|
for (const node of sourceFile.statements) {
|
|
34749
|
-
if (
|
|
34776
|
+
if (import_typescript103.default.isImportDeclaration(node) && import_typescript103.default.isStringLiteral(node.moduleSpecifier)) {
|
|
34750
34777
|
const isMatch = typeof moduleName === "string" ? node.moduleSpecifier.text === moduleName : moduleName.test(node.moduleSpecifier.text);
|
|
34751
34778
|
const namedBindings = (_a = node.importClause) == null ? void 0 : _a.namedBindings;
|
|
34752
|
-
if (isMatch && namedBindings &&
|
|
34779
|
+
if (isMatch && namedBindings && import_typescript103.default.isNamedImports(namedBindings)) {
|
|
34753
34780
|
const match = findImportSpecifier(namedBindings.elements, specifierName);
|
|
34754
34781
|
if (match) {
|
|
34755
34782
|
return match;
|
|
@@ -34768,7 +34795,7 @@ function findImportSpecifier(nodes, specifierName) {
|
|
|
34768
34795
|
|
|
34769
34796
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/decorators.mjs
|
|
34770
34797
|
function getCallDecoratorImport(typeChecker, decorator) {
|
|
34771
|
-
if (!
|
|
34798
|
+
if (!import_typescript104.default.isCallExpression(decorator.expression) || !import_typescript104.default.isIdentifier(decorator.expression.expression)) {
|
|
34772
34799
|
return null;
|
|
34773
34800
|
}
|
|
34774
34801
|
const identifier = decorator.expression.expression;
|
|
@@ -34786,10 +34813,10 @@ function getAngularDecorators(typeChecker, decorators) {
|
|
|
34786
34813
|
}
|
|
34787
34814
|
|
|
34788
34815
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/nodes.mjs
|
|
34789
|
-
var
|
|
34816
|
+
var import_typescript105 = __toESM(require("typescript"), 1);
|
|
34790
34817
|
function closestNode(node, predicate) {
|
|
34791
34818
|
let current = node.parent;
|
|
34792
|
-
while (current && !
|
|
34819
|
+
while (current && !import_typescript105.default.isSourceFile(current)) {
|
|
34793
34820
|
if (predicate(current)) {
|
|
34794
34821
|
return current;
|
|
34795
34822
|
}
|
|
@@ -34800,11 +34827,11 @@ function closestNode(node, predicate) {
|
|
|
34800
34827
|
|
|
34801
34828
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/ng-generate/standalone-migration/util.mjs
|
|
34802
34829
|
var import_path6 = require("path");
|
|
34803
|
-
var
|
|
34830
|
+
var import_typescript107 = __toESM(require("typescript"), 1);
|
|
34804
34831
|
|
|
34805
34832
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/import_manager.mjs
|
|
34806
34833
|
var import_path5 = require("path");
|
|
34807
|
-
var
|
|
34834
|
+
var import_typescript106 = __toESM(require("typescript"), 1);
|
|
34808
34835
|
var IS_AFTER_TS_492 = isAfterVersion2(4, 9);
|
|
34809
34836
|
var ImportManager2 = class {
|
|
34810
34837
|
constructor(getUpdateRecorder, printer) {
|
|
@@ -34826,7 +34853,7 @@ var ImportManager2 = class {
|
|
|
34826
34853
|
}
|
|
34827
34854
|
for (let i = sourceFile.statements.length - 1; i >= 0; i--) {
|
|
34828
34855
|
const statement = sourceFile.statements[i];
|
|
34829
|
-
if (!
|
|
34856
|
+
if (!import_typescript106.default.isImportDeclaration(statement) || !import_typescript106.default.isStringLiteral(statement.moduleSpecifier) || !statement.importClause) {
|
|
34830
34857
|
continue;
|
|
34831
34858
|
}
|
|
34832
34859
|
if (importStartIndex === 0) {
|
|
@@ -34838,9 +34865,9 @@ var ImportManager2 = class {
|
|
|
34838
34865
|
}
|
|
34839
34866
|
if (statement.importClause.namedBindings) {
|
|
34840
34867
|
const namedBindings = statement.importClause.namedBindings;
|
|
34841
|
-
if (
|
|
34842
|
-
return
|
|
34843
|
-
} else if (
|
|
34868
|
+
if (import_typescript106.default.isNamespaceImport(namedBindings) && !typeImport) {
|
|
34869
|
+
return import_typescript106.default.factory.createPropertyAccessExpression(import_typescript106.default.factory.createIdentifier(namedBindings.name.text), import_typescript106.default.factory.createIdentifier(alias || symbolName || "default"));
|
|
34870
|
+
} else if (import_typescript106.default.isNamedImports(namedBindings) && symbolName) {
|
|
34844
34871
|
const existingElement = namedBindings.elements.find((e) => {
|
|
34845
34872
|
if (alias) {
|
|
34846
34873
|
return e.propertyName && e.name.text === alias && e.propertyName.text === symbolName;
|
|
@@ -34848,12 +34875,12 @@ var ImportManager2 = class {
|
|
|
34848
34875
|
return e.propertyName ? e.propertyName.text === symbolName : e.name.text === symbolName;
|
|
34849
34876
|
});
|
|
34850
34877
|
if (existingElement) {
|
|
34851
|
-
return
|
|
34878
|
+
return import_typescript106.default.factory.createIdentifier(existingElement.name.text);
|
|
34852
34879
|
}
|
|
34853
34880
|
existingImport = statement;
|
|
34854
34881
|
}
|
|
34855
34882
|
} else if (statement.importClause.name && !symbolName) {
|
|
34856
|
-
return
|
|
34883
|
+
return import_typescript106.default.factory.createIdentifier(statement.importClause.name.text);
|
|
34857
34884
|
}
|
|
34858
34885
|
}
|
|
34859
34886
|
if (existingImport) {
|
|
@@ -34873,11 +34900,11 @@ var ImportManager2 = class {
|
|
|
34873
34900
|
if (symbolName) {
|
|
34874
34901
|
const { propertyName, name } = this._getImportParts(sourceFile, symbolName, alias);
|
|
34875
34902
|
const importMap = this.newImports.get(sourceFile).namedImports;
|
|
34876
|
-
identifier =
|
|
34903
|
+
identifier = name;
|
|
34877
34904
|
if (!importMap.has(moduleName)) {
|
|
34878
34905
|
importMap.set(moduleName, []);
|
|
34879
34906
|
}
|
|
34880
|
-
importMap.get(moduleName).push(
|
|
34907
|
+
importMap.get(moduleName).push(import_typescript106.default.factory.createImportSpecifier(false, propertyName, name));
|
|
34881
34908
|
} else {
|
|
34882
34909
|
const importMap = this.newImports.get(sourceFile).defaultImports;
|
|
34883
34910
|
identifier = this._getUniqueIdentifier(sourceFile, "defaultExport");
|
|
@@ -34891,19 +34918,19 @@ var ImportManager2 = class {
|
|
|
34891
34918
|
const sourceFile = importDecl.getSourceFile();
|
|
34892
34919
|
const recorder = this.getUpdateRecorder(sourceFile);
|
|
34893
34920
|
const namedBindings = importDecl.importClause.namedBindings;
|
|
34894
|
-
const newNamedBindings =
|
|
34895
|
-
const newNamedBindingsText = this.printer.printNode(
|
|
34921
|
+
const newNamedBindings = import_typescript106.default.factory.updateNamedImports(namedBindings, namedBindings.elements.concat(expressions.map(({ propertyName, importName }) => import_typescript106.default.factory.createImportSpecifier(false, propertyName, importName))));
|
|
34922
|
+
const newNamedBindingsText = this.printer.printNode(import_typescript106.default.EmitHint.Unspecified, newNamedBindings, sourceFile);
|
|
34896
34923
|
recorder.updateExistingImport(namedBindings, newNamedBindingsText);
|
|
34897
34924
|
});
|
|
34898
34925
|
this.newImports.forEach(({ importStartIndex, defaultImports, namedImports }, sourceFile) => {
|
|
34899
34926
|
const recorder = this.getUpdateRecorder(sourceFile);
|
|
34900
34927
|
const useSingleQuotes = this._getQuoteStyle(sourceFile) === 0;
|
|
34901
34928
|
defaultImports.forEach((identifier, moduleName) => {
|
|
34902
|
-
const newImport = createImportDeclaration2(void 0,
|
|
34929
|
+
const newImport = createImportDeclaration2(void 0, import_typescript106.default.factory.createImportClause(false, identifier, void 0), import_typescript106.default.factory.createStringLiteral(moduleName, useSingleQuotes));
|
|
34903
34930
|
recorder.addNewImport(importStartIndex, this._getNewImportText(importStartIndex, newImport, sourceFile));
|
|
34904
34931
|
});
|
|
34905
34932
|
namedImports.forEach((specifiers, moduleName) => {
|
|
34906
|
-
const newImport = createImportDeclaration2(void 0,
|
|
34933
|
+
const newImport = createImportDeclaration2(void 0, import_typescript106.default.factory.createImportClause(false, void 0, import_typescript106.default.factory.createNamedImports(specifiers)), import_typescript106.default.factory.createStringLiteral(moduleName, useSingleQuotes));
|
|
34907
34934
|
recorder.addNewImport(importStartIndex, this._getNewImportText(importStartIndex, newImport, sourceFile));
|
|
34908
34935
|
});
|
|
34909
34936
|
});
|
|
@@ -34911,7 +34938,7 @@ var ImportManager2 = class {
|
|
|
34911
34938
|
_getUniqueIdentifier(sourceFile, baseName) {
|
|
34912
34939
|
if (this.isUniqueIdentifierName(sourceFile, baseName)) {
|
|
34913
34940
|
this._recordUsedIdentifier(sourceFile, baseName);
|
|
34914
|
-
return
|
|
34941
|
+
return import_typescript106.default.factory.createIdentifier(baseName);
|
|
34915
34942
|
}
|
|
34916
34943
|
let name = null;
|
|
34917
34944
|
let counter = 1;
|
|
@@ -34919,7 +34946,7 @@ var ImportManager2 = class {
|
|
|
34919
34946
|
name = `${baseName}_${counter++}`;
|
|
34920
34947
|
} while (!this.isUniqueIdentifierName(sourceFile, name));
|
|
34921
34948
|
this._recordUsedIdentifier(sourceFile, name);
|
|
34922
|
-
return
|
|
34949
|
+
return import_typescript106.default.factory.createIdentifier(name);
|
|
34923
34950
|
}
|
|
34924
34951
|
isUniqueIdentifierName(sourceFile, name) {
|
|
34925
34952
|
if (this.usedIdentifierNames.has(sourceFile) && this.usedIdentifierNames.get(sourceFile).indexOf(name) !== -1) {
|
|
@@ -34928,7 +34955,7 @@ var ImportManager2 = class {
|
|
|
34928
34955
|
const nodeQueue = [sourceFile];
|
|
34929
34956
|
while (nodeQueue.length) {
|
|
34930
34957
|
const node = nodeQueue.shift();
|
|
34931
|
-
if (
|
|
34958
|
+
if (import_typescript106.default.isIdentifier(node) && node.text === name && (!import_typescript106.default.isImportSpecifier(node.parent) || node.parent.propertyName !== node)) {
|
|
34932
34959
|
return false;
|
|
34933
34960
|
}
|
|
34934
34961
|
nodeQueue.push(...node.getChildren());
|
|
@@ -34940,21 +34967,21 @@ var ImportManager2 = class {
|
|
|
34940
34967
|
}
|
|
34941
34968
|
_getEndPositionOfNode(node) {
|
|
34942
34969
|
const nodeEndPos = node.getEnd();
|
|
34943
|
-
const commentRanges =
|
|
34970
|
+
const commentRanges = import_typescript106.default.getTrailingCommentRanges(node.getSourceFile().text, nodeEndPos);
|
|
34944
34971
|
if (!commentRanges || !commentRanges.length) {
|
|
34945
34972
|
return nodeEndPos;
|
|
34946
34973
|
}
|
|
34947
34974
|
return commentRanges[commentRanges.length - 1].end;
|
|
34948
34975
|
}
|
|
34949
34976
|
_getNewImportText(importStartIndex, newImport, sourceFile) {
|
|
34950
|
-
const text = this.printer.printNode(
|
|
34977
|
+
const text = this.printer.printNode(import_typescript106.default.EmitHint.Unspecified, newImport, sourceFile);
|
|
34951
34978
|
return importStartIndex === 0 ? `${text}
|
|
34952
34979
|
` : `
|
|
34953
34980
|
${text}`;
|
|
34954
34981
|
}
|
|
34955
34982
|
_getImportParts(sourceFile, symbolName, alias) {
|
|
34956
|
-
const symbolIdentifier =
|
|
34957
|
-
const aliasIdentifier = alias ?
|
|
34983
|
+
const symbolIdentifier = import_typescript106.default.factory.createIdentifier(symbolName);
|
|
34984
|
+
const aliasIdentifier = alias ? import_typescript106.default.factory.createIdentifier(alias) : null;
|
|
34958
34985
|
const generatedUniqueIdentifier = this._getUniqueIdentifier(sourceFile, alias || symbolName);
|
|
34959
34986
|
const needsGeneratedUniqueName = generatedUniqueIdentifier.text !== (alias || symbolName);
|
|
34960
34987
|
let propertyName;
|
|
@@ -34974,7 +35001,7 @@ ${text}`;
|
|
|
34974
35001
|
if (!this.quoteStyles.hasOwnProperty(sourceFile.fileName)) {
|
|
34975
35002
|
let quoteStyle;
|
|
34976
35003
|
for (const statement of sourceFile.statements) {
|
|
34977
|
-
if (
|
|
35004
|
+
if (import_typescript106.default.isImportDeclaration(statement) && import_typescript106.default.isStringLiteralLike(statement.moduleSpecifier)) {
|
|
34978
35005
|
quoteStyle = statement.moduleSpecifier.getText().trim().startsWith('"') ? 1 : 0;
|
|
34979
35006
|
break;
|
|
34980
35007
|
}
|
|
@@ -34985,10 +35012,10 @@ ${text}`;
|
|
|
34985
35012
|
}
|
|
34986
35013
|
};
|
|
34987
35014
|
function createImportDeclaration2(modifiers, importClause, moduleSpecifier, assertClause) {
|
|
34988
|
-
return IS_AFTER_TS_492 ?
|
|
35015
|
+
return IS_AFTER_TS_492 ? import_typescript106.default.factory.createImportDeclaration(modifiers, importClause, moduleSpecifier, assertClause) : import_typescript106.default.factory.createImportDeclaration(void 0, modifiers, importClause, moduleSpecifier, assertClause);
|
|
34989
35016
|
}
|
|
34990
35017
|
function isAfterVersion2(targetMajor, targetMinor) {
|
|
34991
|
-
const [major, minor] =
|
|
35018
|
+
const [major, minor] = import_typescript106.default.versionMajorMinor.split(".").map((part) => parseInt(part));
|
|
34992
35019
|
if (major < targetMajor) {
|
|
34993
35020
|
return false;
|
|
34994
35021
|
}
|
|
@@ -35012,7 +35039,7 @@ var ChangeTracker = class {
|
|
|
35012
35039
|
replaceText(sourceFile, start, removeLength, text) {
|
|
35013
35040
|
this._trackChange(sourceFile, { start, removeLength, text });
|
|
35014
35041
|
}
|
|
35015
|
-
replaceNode(oldNode, newNode, emitHint =
|
|
35042
|
+
replaceNode(oldNode, newNode, emitHint = import_typescript107.default.EmitHint.Unspecified, sourceFileWhenPrinting) {
|
|
35016
35043
|
const sourceFile = oldNode.getSourceFile();
|
|
35017
35044
|
this.replaceText(sourceFile, oldNode.getStart(), oldNode.getWidth(), this._printer.printNode(emitHint, newNode, sourceFileWhenPrinting || sourceFile));
|
|
35018
35045
|
}
|
|
@@ -35060,21 +35087,96 @@ var UniqueItemTracker = class {
|
|
|
35060
35087
|
return this._nodes.entries();
|
|
35061
35088
|
}
|
|
35062
35089
|
};
|
|
35063
|
-
|
|
35064
|
-
|
|
35065
|
-
|
|
35066
|
-
|
|
35067
|
-
|
|
35068
|
-
|
|
35069
|
-
|
|
35070
|
-
|
|
35071
|
-
|
|
35072
|
-
|
|
35073
|
-
|
|
35074
|
-
|
|
35075
|
-
|
|
35076
|
-
|
|
35077
|
-
|
|
35090
|
+
var ReferenceResolver = class {
|
|
35091
|
+
constructor(_program, _host, _rootFileNames, _basePath, _excludedFiles) {
|
|
35092
|
+
this._program = _program;
|
|
35093
|
+
this._host = _host;
|
|
35094
|
+
this._rootFileNames = _rootFileNames;
|
|
35095
|
+
this._basePath = _basePath;
|
|
35096
|
+
this._excludedFiles = _excludedFiles;
|
|
35097
|
+
this._tempOnlyFile = null;
|
|
35098
|
+
}
|
|
35099
|
+
findReferencesInProject(node) {
|
|
35100
|
+
const languageService = this._getLanguageService();
|
|
35101
|
+
const fileName = node.getSourceFile().fileName;
|
|
35102
|
+
const start = node.getStart();
|
|
35103
|
+
let referencedSymbols;
|
|
35104
|
+
try {
|
|
35105
|
+
referencedSymbols = languageService.findReferences(fileName, start) || [];
|
|
35106
|
+
} catch (e) {
|
|
35107
|
+
console.error("Failed reference lookup for node " + node.getText(), e.message);
|
|
35108
|
+
referencedSymbols = [];
|
|
35109
|
+
}
|
|
35110
|
+
const results = /* @__PURE__ */ new Map();
|
|
35111
|
+
for (const symbol of referencedSymbols) {
|
|
35112
|
+
for (const ref of symbol.references) {
|
|
35113
|
+
if (!ref.isDefinition || symbol.definition.kind === import_typescript107.default.ScriptElementKind.alias) {
|
|
35114
|
+
if (!results.has(ref.fileName)) {
|
|
35115
|
+
results.set(ref.fileName, []);
|
|
35116
|
+
}
|
|
35117
|
+
results.get(ref.fileName).push([ref.textSpan.start, ref.textSpan.start + ref.textSpan.length]);
|
|
35118
|
+
}
|
|
35119
|
+
}
|
|
35120
|
+
}
|
|
35121
|
+
return results;
|
|
35122
|
+
}
|
|
35123
|
+
findSameFileReferences(node, fileName) {
|
|
35124
|
+
this._tempOnlyFile = fileName;
|
|
35125
|
+
const nodeStart = node.getStart();
|
|
35126
|
+
const results = [];
|
|
35127
|
+
let highlights;
|
|
35128
|
+
try {
|
|
35129
|
+
highlights = this._getLanguageService().getDocumentHighlights(fileName, nodeStart, [fileName]);
|
|
35130
|
+
} catch (e) {
|
|
35131
|
+
console.error("Failed reference lookup for node " + node.getText(), e.message);
|
|
35132
|
+
}
|
|
35133
|
+
if (highlights) {
|
|
35134
|
+
for (const file of highlights) {
|
|
35135
|
+
if (file.fileName === fileName) {
|
|
35136
|
+
for (const { textSpan: { start, length }, kind } of file.highlightSpans) {
|
|
35137
|
+
if (kind !== import_typescript107.default.HighlightSpanKind.none) {
|
|
35138
|
+
results.push([start, start + length]);
|
|
35139
|
+
}
|
|
35140
|
+
}
|
|
35141
|
+
}
|
|
35142
|
+
}
|
|
35143
|
+
}
|
|
35144
|
+
this._tempOnlyFile = null;
|
|
35145
|
+
return results;
|
|
35146
|
+
}
|
|
35147
|
+
_readFile(path3) {
|
|
35148
|
+
var _a;
|
|
35149
|
+
if (this._tempOnlyFile !== null && path3 !== this._tempOnlyFile || ((_a = this._excludedFiles) == null ? void 0 : _a.test(path3))) {
|
|
35150
|
+
return "";
|
|
35151
|
+
}
|
|
35152
|
+
return this._host.readFile(path3);
|
|
35153
|
+
}
|
|
35154
|
+
_getLanguageService() {
|
|
35155
|
+
if (!this._languageService) {
|
|
35156
|
+
const rootFileNames = this._rootFileNames.slice();
|
|
35157
|
+
this._program.getTsProgram().getSourceFiles().forEach(({ fileName }) => {
|
|
35158
|
+
var _a;
|
|
35159
|
+
if (!((_a = this._excludedFiles) == null ? void 0 : _a.test(fileName)) && !rootFileNames.includes(fileName)) {
|
|
35160
|
+
rootFileNames.push(fileName);
|
|
35161
|
+
}
|
|
35162
|
+
});
|
|
35163
|
+
this._languageService = import_typescript107.default.createLanguageService({
|
|
35164
|
+
getCompilationSettings: () => this._program.getTsProgram().getCompilerOptions(),
|
|
35165
|
+
getScriptFileNames: () => rootFileNames,
|
|
35166
|
+
getScriptVersion: () => "0",
|
|
35167
|
+
getScriptSnapshot: (path3) => {
|
|
35168
|
+
const content = this._readFile(path3);
|
|
35169
|
+
return content ? import_typescript107.default.ScriptSnapshot.fromString(content) : void 0;
|
|
35170
|
+
},
|
|
35171
|
+
getCurrentDirectory: () => this._basePath,
|
|
35172
|
+
getDefaultLibFileName: (options) => import_typescript107.default.getDefaultLibFilePath(options),
|
|
35173
|
+
readFile: (path3) => this._readFile(path3),
|
|
35174
|
+
fileExists: (path3) => this._host.fileExists(path3)
|
|
35175
|
+
}, import_typescript107.default.createDocumentRegistry(), import_typescript107.default.LanguageServiceMode.PartialSemantic);
|
|
35176
|
+
}
|
|
35177
|
+
return this._languageService;
|
|
35178
|
+
}
|
|
35179
|
+
};
|
|
35078
35180
|
function getNodeLookup(sourceFile) {
|
|
35079
35181
|
const lookup = /* @__PURE__ */ new Map();
|
|
35080
35182
|
sourceFile.forEachChild(function walk(node) {
|
|
@@ -35100,10 +35202,10 @@ function offsetsToNodes(lookup, offsets, results) {
|
|
|
35100
35202
|
}
|
|
35101
35203
|
function findClassDeclaration(reference, typeChecker) {
|
|
35102
35204
|
var _a, _b;
|
|
35103
|
-
return ((_b = (_a = typeChecker.getTypeAtLocation(reference).getSymbol()) == null ? void 0 : _a.declarations) == null ? void 0 : _b.find(
|
|
35205
|
+
return ((_b = (_a = typeChecker.getTypeAtLocation(reference).getSymbol()) == null ? void 0 : _a.declarations) == null ? void 0 : _b.find(import_typescript107.default.isClassDeclaration)) || null;
|
|
35104
35206
|
}
|
|
35105
35207
|
function findLiteralProperty(literal3, name) {
|
|
35106
|
-
return literal3.properties.find((prop) => prop.name &&
|
|
35208
|
+
return literal3.properties.find((prop) => prop.name && import_typescript107.default.isIdentifier(prop.name) && prop.name.text === name);
|
|
35107
35209
|
}
|
|
35108
35210
|
function getRelativeImportPath(fromFile, toFile) {
|
|
35109
35211
|
let path3 = (0, import_path6.relative)((0, import_path6.dirname)(fromFile), toFile).replace(/\.ts$/, "");
|
|
@@ -35115,13 +35217,33 @@ function getRelativeImportPath(fromFile, toFile) {
|
|
|
35115
35217
|
function normalizePath(path3) {
|
|
35116
35218
|
return path3.replace(/\\/g, "/");
|
|
35117
35219
|
}
|
|
35220
|
+
function knownInternalAliasRemapper(imports) {
|
|
35221
|
+
return imports.map((current) => current.moduleSpecifier === "@angular/common" && current.symbolName === "NgForOf" ? __spreadProps(__spreadValues({}, current), { symbolName: "NgFor" }) : current);
|
|
35222
|
+
}
|
|
35223
|
+
function closestOrSelf(node, predicate) {
|
|
35224
|
+
return predicate(node) ? node : closestNode(node, predicate);
|
|
35225
|
+
}
|
|
35226
|
+
function isClassReferenceInAngularModule(node, className, moduleName, typeChecker) {
|
|
35227
|
+
var _a;
|
|
35228
|
+
const symbol = typeChecker.getTypeAtLocation(node).getSymbol();
|
|
35229
|
+
const externalName = `@angular/${moduleName}`;
|
|
35230
|
+
const internalName = `angular2/rc/packages/${moduleName}`;
|
|
35231
|
+
return !!((_a = symbol == null ? void 0 : symbol.declarations) == null ? void 0 : _a.some((decl) => {
|
|
35232
|
+
const closestClass = closestOrSelf(decl, import_typescript107.default.isClassDeclaration);
|
|
35233
|
+
const closestClassFileName = closestClass == null ? void 0 : closestClass.getSourceFile().fileName;
|
|
35234
|
+
if (!closestClass || !closestClassFileName || !closestClass.name || !import_typescript107.default.isIdentifier(closestClass.name) || !closestClassFileName.includes(externalName) && !closestClassFileName.includes(internalName)) {
|
|
35235
|
+
return false;
|
|
35236
|
+
}
|
|
35237
|
+
return typeof className === "string" ? closestClass.name.text === className : className.test(closestClass.name.text);
|
|
35238
|
+
}));
|
|
35239
|
+
}
|
|
35118
35240
|
|
|
35119
35241
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/ng-generate/standalone-migration/prune-modules.mjs
|
|
35120
|
-
function pruneNgModules(program, host, basePath, rootFileNames, sourceFiles, printer, importRemapper) {
|
|
35242
|
+
function pruneNgModules(program, host, basePath, rootFileNames, sourceFiles, printer, importRemapper, referenceLookupExcludedFiles) {
|
|
35121
35243
|
const filesToRemove = /* @__PURE__ */ new Set();
|
|
35122
35244
|
const tracker = new ChangeTracker(printer, importRemapper);
|
|
35123
35245
|
const typeChecker = program.getTsProgram().getTypeChecker();
|
|
35124
|
-
const
|
|
35246
|
+
const referenceResolver = new ReferenceResolver(program, host, rootFileNames, basePath, referenceLookupExcludedFiles);
|
|
35125
35247
|
const removalLocations = {
|
|
35126
35248
|
arrays: new UniqueItemTracker(),
|
|
35127
35249
|
imports: new UniqueItemTracker(),
|
|
@@ -35130,8 +35252,8 @@ function pruneNgModules(program, host, basePath, rootFileNames, sourceFiles, pri
|
|
|
35130
35252
|
unknown: /* @__PURE__ */ new Set()
|
|
35131
35253
|
};
|
|
35132
35254
|
sourceFiles.forEach(function walk(node) {
|
|
35133
|
-
if (
|
|
35134
|
-
collectRemovalLocations(node, removalLocations,
|
|
35255
|
+
if (import_typescript108.default.isClassDeclaration(node) && canRemoveClass(node, typeChecker)) {
|
|
35256
|
+
collectRemovalLocations(node, removalLocations, referenceResolver, program);
|
|
35135
35257
|
removalLocations.classes.add(node);
|
|
35136
35258
|
}
|
|
35137
35259
|
node.forEachChild(walk);
|
|
@@ -35150,8 +35272,8 @@ function pruneNgModules(program, host, basePath, rootFileNames, sourceFiles, pri
|
|
|
35150
35272
|
}
|
|
35151
35273
|
return { pendingChanges: tracker.recordChanges(), filesToRemove };
|
|
35152
35274
|
}
|
|
35153
|
-
function collectRemovalLocations(ngModule, removalLocations,
|
|
35154
|
-
const refsByFile =
|
|
35275
|
+
function collectRemovalLocations(ngModule, removalLocations, referenceResolver, program) {
|
|
35276
|
+
const refsByFile = referenceResolver.findReferencesInProject(ngModule.name);
|
|
35155
35277
|
const tsProgram = program.getTsProgram();
|
|
35156
35278
|
const nodes = /* @__PURE__ */ new Set();
|
|
35157
35279
|
for (const [fileName, refs] of refsByFile) {
|
|
@@ -35161,17 +35283,17 @@ function collectRemovalLocations(ngModule, removalLocations, languageService, pr
|
|
|
35161
35283
|
}
|
|
35162
35284
|
}
|
|
35163
35285
|
for (const node of nodes) {
|
|
35164
|
-
const closestArray = closestNode(node,
|
|
35286
|
+
const closestArray = closestNode(node, import_typescript108.default.isArrayLiteralExpression);
|
|
35165
35287
|
if (closestArray) {
|
|
35166
35288
|
removalLocations.arrays.track(closestArray, node);
|
|
35167
35289
|
continue;
|
|
35168
35290
|
}
|
|
35169
|
-
const closestImport = closestNode(node,
|
|
35291
|
+
const closestImport = closestNode(node, import_typescript108.default.isNamedImports);
|
|
35170
35292
|
if (closestImport) {
|
|
35171
35293
|
removalLocations.imports.track(closestImport, node);
|
|
35172
35294
|
continue;
|
|
35173
35295
|
}
|
|
35174
|
-
const closestExport = closestNode(node,
|
|
35296
|
+
const closestExport = closestNode(node, import_typescript108.default.isNamedExports);
|
|
35175
35297
|
if (closestExport) {
|
|
35176
35298
|
removalLocations.exports.track(closestExport, node);
|
|
35177
35299
|
continue;
|
|
@@ -35182,24 +35304,24 @@ function collectRemovalLocations(ngModule, removalLocations, languageService, pr
|
|
|
35182
35304
|
function removeArrayReferences(locations, tracker) {
|
|
35183
35305
|
for (const [array, toRemove] of locations.getEntries()) {
|
|
35184
35306
|
const newElements = filterRemovedElements(array.elements, toRemove);
|
|
35185
|
-
tracker.replaceNode(array,
|
|
35307
|
+
tracker.replaceNode(array, import_typescript108.default.factory.updateArrayLiteralExpression(array, newElements));
|
|
35186
35308
|
}
|
|
35187
35309
|
}
|
|
35188
35310
|
function removeImportReferences(locations, tracker) {
|
|
35189
35311
|
for (const [namedImports, toRemove] of locations.getEntries()) {
|
|
35190
35312
|
const newElements = filterRemovedElements(namedImports.elements, toRemove);
|
|
35191
35313
|
if (newElements.length === 0) {
|
|
35192
|
-
const importClause = closestNode(namedImports,
|
|
35314
|
+
const importClause = closestNode(namedImports, import_typescript108.default.isImportClause);
|
|
35193
35315
|
if (importClause && importClause.name) {
|
|
35194
|
-
tracker.replaceNode(importClause,
|
|
35316
|
+
tracker.replaceNode(importClause, import_typescript108.default.factory.updateImportClause(importClause, importClause.isTypeOnly, importClause.name, void 0));
|
|
35195
35317
|
} else {
|
|
35196
|
-
const declaration = closestNode(namedImports,
|
|
35318
|
+
const declaration = closestNode(namedImports, import_typescript108.default.isImportDeclaration);
|
|
35197
35319
|
if (declaration) {
|
|
35198
35320
|
tracker.removeNode(declaration);
|
|
35199
35321
|
}
|
|
35200
35322
|
}
|
|
35201
35323
|
} else {
|
|
35202
|
-
tracker.replaceNode(namedImports,
|
|
35324
|
+
tracker.replaceNode(namedImports, import_typescript108.default.factory.updateNamedImports(namedImports, newElements));
|
|
35203
35325
|
}
|
|
35204
35326
|
}
|
|
35205
35327
|
}
|
|
@@ -35207,22 +35329,22 @@ function removeExportReferences(locations, tracker) {
|
|
|
35207
35329
|
for (const [namedExports, toRemove] of locations.getEntries()) {
|
|
35208
35330
|
const newElements = filterRemovedElements(namedExports.elements, toRemove);
|
|
35209
35331
|
if (newElements.length === 0) {
|
|
35210
|
-
const declaration = closestNode(namedExports,
|
|
35332
|
+
const declaration = closestNode(namedExports, import_typescript108.default.isExportDeclaration);
|
|
35211
35333
|
if (declaration) {
|
|
35212
35334
|
tracker.removeNode(declaration);
|
|
35213
35335
|
}
|
|
35214
35336
|
} else {
|
|
35215
|
-
tracker.replaceNode(namedExports,
|
|
35337
|
+
tracker.replaceNode(namedExports, import_typescript108.default.factory.updateNamedExports(namedExports, newElements));
|
|
35216
35338
|
}
|
|
35217
35339
|
}
|
|
35218
35340
|
}
|
|
35219
35341
|
function canRemoveClass(node, typeChecker) {
|
|
35220
35342
|
var _a;
|
|
35221
35343
|
const decorator = (_a = findNgModuleDecorator(node, typeChecker)) == null ? void 0 : _a.node;
|
|
35222
|
-
if (!decorator || !
|
|
35344
|
+
if (!decorator || !import_typescript108.default.isCallExpression(decorator.expression)) {
|
|
35223
35345
|
return false;
|
|
35224
35346
|
}
|
|
35225
|
-
if (decorator.expression.arguments.length > 0 && !
|
|
35347
|
+
if (decorator.expression.arguments.length > 0 && !import_typescript108.default.isObjectLiteralExpression(decorator.expression.arguments[0])) {
|
|
35226
35348
|
return false;
|
|
35227
35349
|
}
|
|
35228
35350
|
if (node.members.length > 0 && node.members.some((member) => !isEmptyConstructor(member))) {
|
|
@@ -35235,7 +35357,7 @@ function canRemoveClass(node, typeChecker) {
|
|
|
35235
35357
|
const imports = findLiteralProperty(literal3, "imports");
|
|
35236
35358
|
if (imports && isNonEmptyNgModuleProperty(imports)) {
|
|
35237
35359
|
for (const dep of imports.initializer.elements) {
|
|
35238
|
-
if (!
|
|
35360
|
+
if (!import_typescript108.default.isIdentifier(dep)) {
|
|
35239
35361
|
return false;
|
|
35240
35362
|
}
|
|
35241
35363
|
const depDeclaration = findClassDeclaration(dep, typeChecker);
|
|
@@ -35253,35 +35375,20 @@ function canRemoveClass(node, typeChecker) {
|
|
|
35253
35375
|
return true;
|
|
35254
35376
|
}
|
|
35255
35377
|
function isNonEmptyNgModuleProperty(node) {
|
|
35256
|
-
return
|
|
35378
|
+
return import_typescript108.default.isPropertyAssignment(node) && import_typescript108.default.isIdentifier(node.name) && import_typescript108.default.isArrayLiteralExpression(node.initializer) && node.initializer.elements.length > 0;
|
|
35257
35379
|
}
|
|
35258
35380
|
function canRemoveFile(sourceFile, classesToBeRemoved) {
|
|
35259
35381
|
var _a;
|
|
35260
35382
|
for (const node of sourceFile.statements) {
|
|
35261
|
-
if (
|
|
35383
|
+
if (import_typescript108.default.isImportDeclaration(node) || import_typescript108.default.isClassDeclaration(node) && classesToBeRemoved.has(node)) {
|
|
35262
35384
|
continue;
|
|
35263
35385
|
}
|
|
35264
|
-
if (
|
|
35386
|
+
if (import_typescript108.default.canHaveModifiers(node) && ((_a = import_typescript108.default.getModifiers(node)) == null ? void 0 : _a.some((m) => m.kind === import_typescript108.default.SyntaxKind.ExportKeyword))) {
|
|
35265
35387
|
return false;
|
|
35266
35388
|
}
|
|
35267
35389
|
}
|
|
35268
35390
|
return true;
|
|
35269
35391
|
}
|
|
35270
|
-
function extractReferences(node, languageService) {
|
|
35271
|
-
const result = /* @__PURE__ */ new Map();
|
|
35272
|
-
const referencedSymbols = languageService.findReferences(node.getSourceFile().fileName, node.name.getStart()) || [];
|
|
35273
|
-
for (const symbol of referencedSymbols) {
|
|
35274
|
-
for (const ref of symbol.references) {
|
|
35275
|
-
if (!ref.isDefinition || symbol.definition.kind === import_typescript109.default.ScriptElementKind.alias) {
|
|
35276
|
-
if (!result.has(ref.fileName)) {
|
|
35277
|
-
result.set(ref.fileName, []);
|
|
35278
|
-
}
|
|
35279
|
-
result.get(ref.fileName).push([ref.textSpan.start, ref.textSpan.start + ref.textSpan.length]);
|
|
35280
|
-
}
|
|
35281
|
-
}
|
|
35282
|
-
}
|
|
35283
|
-
return result;
|
|
35284
|
-
}
|
|
35285
35392
|
function contains(parent, child) {
|
|
35286
35393
|
return parent === child || parent.getSourceFile().fileName === child.getSourceFile().fileName && child.getStart() >= parent.getStart() && child.getStart() <= parent.getEnd();
|
|
35287
35394
|
}
|
|
@@ -35296,7 +35403,7 @@ function filterRemovedElements(elements, toRemove) {
|
|
|
35296
35403
|
});
|
|
35297
35404
|
}
|
|
35298
35405
|
function isEmptyConstructor(node) {
|
|
35299
|
-
return
|
|
35406
|
+
return import_typescript108.default.isConstructorDeclaration(node) && node.parameters.length === 0 && (node.body == null || node.body.statements.length === 0);
|
|
35300
35407
|
}
|
|
35301
35408
|
function addRemovalTodos(nodes, tracker) {
|
|
35302
35409
|
for (const node of nodes) {
|
|
@@ -35304,19 +35411,19 @@ function addRemovalTodos(nodes, tracker) {
|
|
|
35304
35411
|
}
|
|
35305
35412
|
}
|
|
35306
35413
|
function findNgModuleDecorator(node, typeChecker) {
|
|
35307
|
-
const decorators = getAngularDecorators(typeChecker,
|
|
35414
|
+
const decorators = getAngularDecorators(typeChecker, import_typescript108.default.getDecorators(node) || []);
|
|
35308
35415
|
return decorators.find((decorator) => decorator.name === "NgModule") || null;
|
|
35309
35416
|
}
|
|
35310
35417
|
|
|
35311
35418
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/ng-generate/standalone-migration/standalone-bootstrap.mjs
|
|
35312
35419
|
var import_path7 = require("path");
|
|
35313
|
-
var
|
|
35420
|
+
var import_typescript111 = __toESM(require("typescript"), 1);
|
|
35314
35421
|
|
|
35315
35422
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/ng-generate/standalone-migration/to-standalone.mjs
|
|
35316
|
-
var
|
|
35423
|
+
var import_typescript110 = __toESM(require("typescript"), 1);
|
|
35317
35424
|
|
|
35318
35425
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/typescript/symbol.mjs
|
|
35319
|
-
var
|
|
35426
|
+
var import_typescript109 = __toESM(require("typescript"), 1);
|
|
35320
35427
|
function isReferenceToImport(typeChecker, node, importSpecifier) {
|
|
35321
35428
|
var _a, _b;
|
|
35322
35429
|
const nodeSymbol = typeChecker.getTypeAtLocation(node).getSymbol();
|
|
@@ -35325,13 +35432,13 @@ function isReferenceToImport(typeChecker, node, importSpecifier) {
|
|
|
35325
35432
|
}
|
|
35326
35433
|
|
|
35327
35434
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/ng-generate/standalone-migration/to-standalone.mjs
|
|
35328
|
-
function toStandalone(sourceFiles, program, printer,
|
|
35435
|
+
function toStandalone(sourceFiles, program, printer, fileImportRemapper, componentImportRemapper) {
|
|
35329
35436
|
const templateTypeChecker = program.compiler.getTemplateTypeChecker();
|
|
35330
35437
|
const typeChecker = program.getTsProgram().getTypeChecker();
|
|
35331
35438
|
const modulesToMigrate = [];
|
|
35332
35439
|
const testObjectsToMigrate = [];
|
|
35333
35440
|
const declarations = [];
|
|
35334
|
-
const tracker = new ChangeTracker(printer,
|
|
35441
|
+
const tracker = new ChangeTracker(printer, fileImportRemapper);
|
|
35335
35442
|
for (const sourceFile of sourceFiles) {
|
|
35336
35443
|
const modules = findNgModuleClassesToMigrate(sourceFile, typeChecker);
|
|
35337
35444
|
const testObjects = findTestObjectsToMigrate(sourceFile, typeChecker);
|
|
@@ -35346,7 +35453,7 @@ function toStandalone(sourceFiles, program, printer, importRemapper) {
|
|
|
35346
35453
|
testObjectsToMigrate.push(...testObjects);
|
|
35347
35454
|
}
|
|
35348
35455
|
for (const declaration of declarations) {
|
|
35349
|
-
convertNgModuleDeclarationToStandalone(declaration, declarations, tracker, templateTypeChecker);
|
|
35456
|
+
convertNgModuleDeclarationToStandalone(declaration, declarations, tracker, templateTypeChecker, componentImportRemapper);
|
|
35350
35457
|
}
|
|
35351
35458
|
for (const node of modulesToMigrate) {
|
|
35352
35459
|
migrateNgModuleClass(node, declarations, tracker, typeChecker, templateTypeChecker);
|
|
@@ -35354,14 +35461,14 @@ function toStandalone(sourceFiles, program, printer, importRemapper) {
|
|
|
35354
35461
|
migrateTestDeclarations(testObjectsToMigrate, declarations, tracker, templateTypeChecker, typeChecker);
|
|
35355
35462
|
return tracker.recordChanges();
|
|
35356
35463
|
}
|
|
35357
|
-
function convertNgModuleDeclarationToStandalone(ref, allDeclarations, tracker, typeChecker) {
|
|
35464
|
+
function convertNgModuleDeclarationToStandalone(ref, allDeclarations, tracker, typeChecker, importRemapper) {
|
|
35358
35465
|
const directiveMeta = typeChecker.getDirectiveMetadata(ref.node);
|
|
35359
35466
|
if (directiveMeta && directiveMeta.decorator && !directiveMeta.isStandalone) {
|
|
35360
35467
|
let decorator = addStandaloneToDecorator(directiveMeta.decorator);
|
|
35361
35468
|
if (directiveMeta.isComponent) {
|
|
35362
|
-
const importsToAdd = getComponentImportExpressions(ref, allDeclarations, tracker, typeChecker);
|
|
35469
|
+
const importsToAdd = getComponentImportExpressions(ref, allDeclarations, tracker, typeChecker, importRemapper);
|
|
35363
35470
|
if (importsToAdd.length > 0) {
|
|
35364
|
-
decorator = addPropertyToAngularDecorator(decorator,
|
|
35471
|
+
decorator = addPropertyToAngularDecorator(decorator, import_typescript110.default.factory.createPropertyAssignment("imports", import_typescript110.default.factory.createArrayLiteralExpression(importsToAdd)));
|
|
35365
35472
|
}
|
|
35366
35473
|
}
|
|
35367
35474
|
tracker.replaceNode(directiveMeta.decorator, decorator);
|
|
@@ -35372,28 +35479,33 @@ function convertNgModuleDeclarationToStandalone(ref, allDeclarations, tracker, t
|
|
|
35372
35479
|
}
|
|
35373
35480
|
}
|
|
35374
35481
|
}
|
|
35375
|
-
function getComponentImportExpressions(ref, allDeclarations, tracker, typeChecker) {
|
|
35482
|
+
function getComponentImportExpressions(ref, allDeclarations, tracker, typeChecker, importRemapper) {
|
|
35376
35483
|
const templateDependencies = findTemplateDependencies(ref, typeChecker);
|
|
35377
35484
|
const usedDependenciesInMigration = new Set(templateDependencies.filter((dep) => allDeclarations.find((current) => current.node === dep.node)));
|
|
35378
35485
|
const imports = [];
|
|
35379
35486
|
const seenImports = /* @__PURE__ */ new Set();
|
|
35487
|
+
const resolvedDependencies = [];
|
|
35380
35488
|
for (const dep of templateDependencies) {
|
|
35381
35489
|
const importLocation = findImportLocation(dep, ref, usedDependenciesInMigration.has(dep) ? PotentialImportMode.ForceDirect : PotentialImportMode.Normal, typeChecker);
|
|
35382
35490
|
if (importLocation && !seenImports.has(importLocation.symbolName)) {
|
|
35383
|
-
|
|
35384
|
-
|
|
35385
|
-
|
|
35491
|
+
seenImports.add(importLocation.symbolName);
|
|
35492
|
+
resolvedDependencies.push(importLocation);
|
|
35493
|
+
}
|
|
35494
|
+
}
|
|
35495
|
+
const processedDependencies = importRemapper ? importRemapper(resolvedDependencies, ref) : resolvedDependencies;
|
|
35496
|
+
for (const importLocation of processedDependencies) {
|
|
35497
|
+
if (importLocation.moduleSpecifier) {
|
|
35498
|
+
const identifier = tracker.addImport(ref.node.getSourceFile(), importLocation.symbolName, importLocation.moduleSpecifier);
|
|
35499
|
+
imports.push(identifier);
|
|
35500
|
+
} else {
|
|
35501
|
+
const identifier = import_typescript110.default.factory.createIdentifier(importLocation.symbolName);
|
|
35502
|
+
if (importLocation.isForwardReference) {
|
|
35503
|
+
const forwardRefExpression = tracker.addImport(ref.node.getSourceFile(), "forwardRef", "@angular/core");
|
|
35504
|
+
const arrowFunction = import_typescript110.default.factory.createArrowFunction(void 0, void 0, [], void 0, void 0, identifier);
|
|
35505
|
+
imports.push(import_typescript110.default.factory.createCallExpression(forwardRefExpression, void 0, [arrowFunction]));
|
|
35386
35506
|
} else {
|
|
35387
|
-
|
|
35388
|
-
if (importLocation.isForwardReference) {
|
|
35389
|
-
const forwardRefExpression = tracker.addImport(ref.node.getSourceFile(), "forwardRef", "@angular/core");
|
|
35390
|
-
const arrowFunction = import_typescript111.default.factory.createArrowFunction(void 0, void 0, [], void 0, void 0, identifier);
|
|
35391
|
-
imports.push(import_typescript111.default.factory.createCallExpression(forwardRefExpression, void 0, [arrowFunction]));
|
|
35392
|
-
} else {
|
|
35393
|
-
imports.push(identifier);
|
|
35394
|
-
}
|
|
35507
|
+
imports.push(identifier);
|
|
35395
35508
|
}
|
|
35396
|
-
seenImports.add(importLocation.symbolName);
|
|
35397
35509
|
}
|
|
35398
35510
|
}
|
|
35399
35511
|
return imports;
|
|
@@ -35415,10 +35527,10 @@ function moveDeclarationsToImports(literal3, allDeclarations, typeChecker, templ
|
|
|
35415
35527
|
const declarationsToCopy = [];
|
|
35416
35528
|
const properties = [];
|
|
35417
35529
|
const importsProp = findLiteralProperty(literal3, "imports");
|
|
35418
|
-
if (
|
|
35419
|
-
if (
|
|
35530
|
+
if (import_typescript110.default.isPropertyAssignment(declarationsProp)) {
|
|
35531
|
+
if (import_typescript110.default.isArrayLiteralExpression(declarationsProp.initializer)) {
|
|
35420
35532
|
for (const el of declarationsProp.initializer.elements) {
|
|
35421
|
-
if (
|
|
35533
|
+
if (import_typescript110.default.isIdentifier(el)) {
|
|
35422
35534
|
const correspondingClass = findClassDeclaration(el, typeChecker);
|
|
35423
35535
|
if (!correspondingClass || isStandaloneDeclaration(correspondingClass, allDeclarations, templateTypeChecker)) {
|
|
35424
35536
|
declarationsToCopy.push(el);
|
|
@@ -35430,11 +35542,11 @@ function moveDeclarationsToImports(literal3, allDeclarations, typeChecker, templ
|
|
|
35430
35542
|
}
|
|
35431
35543
|
}
|
|
35432
35544
|
} else {
|
|
35433
|
-
declarationsToCopy.push(
|
|
35545
|
+
declarationsToCopy.push(import_typescript110.default.factory.createSpreadElement(declarationsProp.initializer));
|
|
35434
35546
|
}
|
|
35435
35547
|
}
|
|
35436
35548
|
if (!importsProp && declarationsToCopy.length > 0) {
|
|
35437
|
-
properties.push(
|
|
35549
|
+
properties.push(import_typescript110.default.factory.createPropertyAssignment("imports", import_typescript110.default.factory.createArrayLiteralExpression(declarationsToCopy)));
|
|
35438
35550
|
}
|
|
35439
35551
|
for (const prop of literal3.properties) {
|
|
35440
35552
|
if (!isNamedPropertyAssignment(prop)) {
|
|
@@ -35443,43 +35555,43 @@ function moveDeclarationsToImports(literal3, allDeclarations, typeChecker, templ
|
|
|
35443
35555
|
}
|
|
35444
35556
|
if (prop === declarationsProp) {
|
|
35445
35557
|
if (declarationsToPreserve.length > 0) {
|
|
35446
|
-
properties.push(
|
|
35558
|
+
properties.push(import_typescript110.default.factory.updatePropertyAssignment(prop, prop.name, import_typescript110.default.factory.createArrayLiteralExpression(declarationsToPreserve)));
|
|
35447
35559
|
}
|
|
35448
35560
|
continue;
|
|
35449
35561
|
}
|
|
35450
35562
|
if (prop === importsProp && declarationsToCopy.length > 0) {
|
|
35451
35563
|
let initializer;
|
|
35452
|
-
if (
|
|
35453
|
-
initializer =
|
|
35564
|
+
if (import_typescript110.default.isArrayLiteralExpression(prop.initializer)) {
|
|
35565
|
+
initializer = import_typescript110.default.factory.updateArrayLiteralExpression(prop.initializer, [...prop.initializer.elements, ...declarationsToCopy]);
|
|
35454
35566
|
} else {
|
|
35455
|
-
initializer =
|
|
35567
|
+
initializer = import_typescript110.default.factory.createArrayLiteralExpression([import_typescript110.default.factory.createSpreadElement(prop.initializer), ...declarationsToCopy]);
|
|
35456
35568
|
}
|
|
35457
|
-
properties.push(
|
|
35569
|
+
properties.push(import_typescript110.default.factory.updatePropertyAssignment(prop, prop.name, initializer));
|
|
35458
35570
|
continue;
|
|
35459
35571
|
}
|
|
35460
35572
|
properties.push(prop);
|
|
35461
35573
|
}
|
|
35462
|
-
tracker.replaceNode(literal3,
|
|
35574
|
+
tracker.replaceNode(literal3, import_typescript110.default.factory.updateObjectLiteralExpression(literal3, properties), import_typescript110.default.EmitHint.Expression);
|
|
35463
35575
|
}
|
|
35464
35576
|
function addStandaloneToDecorator(node) {
|
|
35465
|
-
return addPropertyToAngularDecorator(node,
|
|
35577
|
+
return addPropertyToAngularDecorator(node, import_typescript110.default.factory.createPropertyAssignment("standalone", import_typescript110.default.factory.createToken(import_typescript110.default.SyntaxKind.TrueKeyword)));
|
|
35466
35578
|
}
|
|
35467
35579
|
function addPropertyToAngularDecorator(node, property) {
|
|
35468
|
-
if (!
|
|
35580
|
+
if (!import_typescript110.default.isCallExpression(node.expression) || node.expression.arguments.length > 1) {
|
|
35469
35581
|
return node;
|
|
35470
35582
|
}
|
|
35471
35583
|
let literalProperties;
|
|
35472
35584
|
if (node.expression.arguments.length === 0) {
|
|
35473
35585
|
literalProperties = [property];
|
|
35474
|
-
} else if (
|
|
35586
|
+
} else if (import_typescript110.default.isObjectLiteralExpression(node.expression.arguments[0])) {
|
|
35475
35587
|
literalProperties = [...node.expression.arguments[0].properties, property];
|
|
35476
35588
|
} else {
|
|
35477
35589
|
return node;
|
|
35478
35590
|
}
|
|
35479
|
-
return
|
|
35591
|
+
return import_typescript110.default.factory.createDecorator(import_typescript110.default.factory.createCallExpression(node.expression.expression, node.expression.typeArguments, [import_typescript110.default.factory.createObjectLiteralExpression(literalProperties, literalProperties.length > 1)]));
|
|
35480
35592
|
}
|
|
35481
35593
|
function isNamedPropertyAssignment(node) {
|
|
35482
|
-
return
|
|
35594
|
+
return import_typescript110.default.isPropertyAssignment(node) && node.name && import_typescript110.default.isIdentifier(node.name);
|
|
35483
35595
|
}
|
|
35484
35596
|
function findImportLocation(target, inComponent, importMode, typeChecker) {
|
|
35485
35597
|
const importLocations = typeChecker.getPotentialImportsFor(target, inComponent.node, importMode);
|
|
@@ -35499,14 +35611,14 @@ function findImportLocation(target, inComponent, importMode, typeChecker) {
|
|
|
35499
35611
|
return firstSameFileImport || firstModuleImport || importLocations[0] || null;
|
|
35500
35612
|
}
|
|
35501
35613
|
function hasNgModuleMetadataElements(node) {
|
|
35502
|
-
return
|
|
35614
|
+
return import_typescript110.default.isPropertyAssignment(node) && (!import_typescript110.default.isArrayLiteralExpression(node.initializer) || node.initializer.elements.length > 0);
|
|
35503
35615
|
}
|
|
35504
35616
|
function findNgModuleClassesToMigrate(sourceFile, typeChecker) {
|
|
35505
35617
|
const modules = [];
|
|
35506
35618
|
if (getImportSpecifier(sourceFile, "@angular/core", "NgModule")) {
|
|
35507
35619
|
sourceFile.forEachChild(function walk(node) {
|
|
35508
|
-
if (
|
|
35509
|
-
const decorator = getAngularDecorators(typeChecker,
|
|
35620
|
+
if (import_typescript110.default.isClassDeclaration(node)) {
|
|
35621
|
+
const decorator = getAngularDecorators(typeChecker, import_typescript110.default.getDecorators(node) || []).find((current) => current.name === "NgModule");
|
|
35510
35622
|
const metadata = decorator ? extractMetadataLiteral(decorator.node) : null;
|
|
35511
35623
|
if (metadata) {
|
|
35512
35624
|
const declarations = findLiteralProperty(metadata, "declarations");
|
|
@@ -35526,8 +35638,8 @@ function findTestObjectsToMigrate(sourceFile, typeChecker) {
|
|
|
35526
35638
|
const catalystImport = getImportSpecifier(sourceFile, /testing\/catalyst$/, "setupModule");
|
|
35527
35639
|
if (testBedImport || catalystImport) {
|
|
35528
35640
|
sourceFile.forEachChild(function walk(node) {
|
|
35529
|
-
if (
|
|
35530
|
-
if (testBedImport &&
|
|
35641
|
+
if (import_typescript110.default.isCallExpression(node) && node.arguments.length > 0 && import_typescript110.default.isObjectLiteralExpression(node.arguments[0])) {
|
|
35642
|
+
if (testBedImport && import_typescript110.default.isPropertyAccessExpression(node.expression) && node.expression.name.text === "configureTestingModule" && isReferenceToImport(typeChecker, node.expression.expression, testBedImport) || catalystImport && import_typescript110.default.isIdentifier(node.expression) && isReferenceToImport(typeChecker, node.expression, catalystImport)) {
|
|
35531
35643
|
testObjects.push(node.arguments[0]);
|
|
35532
35644
|
}
|
|
35533
35645
|
}
|
|
@@ -35542,7 +35654,7 @@ function findTemplateDependencies(ref, typeChecker) {
|
|
|
35542
35654
|
const usedPipes = typeChecker.getUsedPipes(ref.node);
|
|
35543
35655
|
if (usedDirectives !== null) {
|
|
35544
35656
|
for (const dir of usedDirectives) {
|
|
35545
|
-
if (
|
|
35657
|
+
if (import_typescript110.default.isClassDeclaration(dir.ref.node)) {
|
|
35546
35658
|
results.push(dir.ref);
|
|
35547
35659
|
}
|
|
35548
35660
|
}
|
|
@@ -35550,7 +35662,7 @@ function findTemplateDependencies(ref, typeChecker) {
|
|
|
35550
35662
|
if (usedPipes !== null) {
|
|
35551
35663
|
const potentialPipes = typeChecker.getPotentialPipes(ref.node);
|
|
35552
35664
|
for (const pipe of potentialPipes) {
|
|
35553
|
-
if (
|
|
35665
|
+
if (import_typescript110.default.isClassDeclaration(pipe.ref.node) && usedPipes.some((current) => pipe.name === current)) {
|
|
35554
35666
|
results.push(pipe.ref);
|
|
35555
35667
|
}
|
|
35556
35668
|
}
|
|
@@ -35564,12 +35676,12 @@ function filterNonBootstrappedDeclarations(declarations, ngModule, templateTypeC
|
|
|
35564
35676
|
if (!bootstrapProp) {
|
|
35565
35677
|
return declarations;
|
|
35566
35678
|
}
|
|
35567
|
-
if (!
|
|
35679
|
+
if (!import_typescript110.default.isPropertyAssignment(bootstrapProp) || !import_typescript110.default.isArrayLiteralExpression(bootstrapProp.initializer)) {
|
|
35568
35680
|
return [];
|
|
35569
35681
|
}
|
|
35570
35682
|
const bootstrappedClasses = /* @__PURE__ */ new Set();
|
|
35571
35683
|
for (const el of bootstrapProp.initializer.elements) {
|
|
35572
|
-
const referencedClass =
|
|
35684
|
+
const referencedClass = import_typescript110.default.isIdentifier(el) ? findClassDeclaration(el, typeChecker) : null;
|
|
35573
35685
|
if (referencedClass) {
|
|
35574
35686
|
bootstrappedClasses.add(referencedClass);
|
|
35575
35687
|
} else {
|
|
@@ -35580,13 +35692,13 @@ function filterNonBootstrappedDeclarations(declarations, ngModule, templateTypeC
|
|
|
35580
35692
|
}
|
|
35581
35693
|
function extractDeclarationsFromModule(ngModule, templateTypeChecker) {
|
|
35582
35694
|
const metadata = templateTypeChecker.getNgModuleMetadata(ngModule);
|
|
35583
|
-
return metadata ? metadata.declarations.filter((decl) =>
|
|
35695
|
+
return metadata ? metadata.declarations.filter((decl) => import_typescript110.default.isClassDeclaration(decl.node)) : [];
|
|
35584
35696
|
}
|
|
35585
35697
|
function migrateTestDeclarations(testObjects, declarationsOutsideOfTestFiles, tracker, templateTypeChecker, typeChecker) {
|
|
35586
35698
|
const { decorators, componentImports } = analyzeTestingModules(testObjects, typeChecker);
|
|
35587
35699
|
const allDeclarations = declarationsOutsideOfTestFiles.map((ref) => ref.node);
|
|
35588
35700
|
for (const decorator of decorators) {
|
|
35589
|
-
const closestClass = closestNode(decorator.node,
|
|
35701
|
+
const closestClass = closestNode(decorator.node, import_typescript110.default.isClassDeclaration);
|
|
35590
35702
|
if (decorator.name === "Pipe" || decorator.name === "Directive") {
|
|
35591
35703
|
tracker.replaceNode(decorator.node, addStandaloneToDecorator(decorator.node));
|
|
35592
35704
|
if (closestClass) {
|
|
@@ -35599,7 +35711,7 @@ function migrateTestDeclarations(testObjects, declarationsOutsideOfTestFiles, tr
|
|
|
35599
35711
|
allDeclarations.push(closestClass);
|
|
35600
35712
|
}
|
|
35601
35713
|
if (importsToAdd && importsToAdd.size > 0) {
|
|
35602
|
-
tracker.replaceNode(decorator.node, addPropertyToAngularDecorator(newDecorator,
|
|
35714
|
+
tracker.replaceNode(decorator.node, addPropertyToAngularDecorator(newDecorator, import_typescript110.default.factory.createPropertyAssignment("imports", import_typescript110.default.factory.createArrayLiteralExpression(Array.from(importsToAdd)))));
|
|
35603
35715
|
} else {
|
|
35604
35716
|
tracker.replaceNode(decorator.node, newDecorator);
|
|
35605
35717
|
}
|
|
@@ -35619,12 +35731,14 @@ function analyzeTestingModules(testObjects, typeChecker) {
|
|
|
35619
35731
|
continue;
|
|
35620
35732
|
}
|
|
35621
35733
|
const importsProp = findLiteralProperty(obj, "imports");
|
|
35622
|
-
const importElements = importsProp && hasNgModuleMetadataElements(importsProp) ? importsProp.initializer.elements.filter((el) =>
|
|
35734
|
+
const importElements = importsProp && hasNgModuleMetadataElements(importsProp) ? importsProp.initializer.elements.filter((el) => {
|
|
35735
|
+
return !import_typescript110.default.isCallExpression(el) && !isClassReferenceInAngularModule(el, /^BrowserAnimationsModule|NoopAnimationsModule$/, "platform-browser/animations", typeChecker);
|
|
35736
|
+
}) : null;
|
|
35623
35737
|
for (const decl of declarations) {
|
|
35624
35738
|
if (seenDeclarations.has(decl)) {
|
|
35625
35739
|
continue;
|
|
35626
35740
|
}
|
|
35627
|
-
const [decorator] = getAngularDecorators(typeChecker,
|
|
35741
|
+
const [decorator] = getAngularDecorators(typeChecker, import_typescript110.default.getDecorators(decl) || []);
|
|
35628
35742
|
if (decorator) {
|
|
35629
35743
|
seenDeclarations.add(decl);
|
|
35630
35744
|
decorators.push(decorator);
|
|
@@ -35655,7 +35769,7 @@ function extractDeclarationsFromTestObject(obj, typeChecker) {
|
|
|
35655
35769
|
return results;
|
|
35656
35770
|
}
|
|
35657
35771
|
function extractMetadataLiteral(decorator) {
|
|
35658
|
-
return
|
|
35772
|
+
return import_typescript110.default.isCallExpression(decorator.expression) && decorator.expression.arguments.length === 1 && import_typescript110.default.isObjectLiteralExpression(decorator.expression.arguments[0]) ? decorator.expression.arguments[0] : null;
|
|
35659
35773
|
}
|
|
35660
35774
|
function isStandaloneDeclaration(node, declarationsInMigration, templateTypeChecker) {
|
|
35661
35775
|
if (declarationsInMigration.includes(node)) {
|
|
@@ -35666,17 +35780,17 @@ function isStandaloneDeclaration(node, declarationsInMigration, templateTypeChec
|
|
|
35666
35780
|
}
|
|
35667
35781
|
|
|
35668
35782
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/ng-generate/standalone-migration/standalone-bootstrap.mjs
|
|
35669
|
-
function toStandaloneBootstrap(program, host, basePath, rootFileNames, sourceFiles, printer, importRemapper) {
|
|
35783
|
+
function toStandaloneBootstrap(program, host, basePath, rootFileNames, sourceFiles, printer, importRemapper, referenceLookupExcludedFiles, componentImportRemapper) {
|
|
35670
35784
|
const tracker = new ChangeTracker(printer, importRemapper);
|
|
35671
35785
|
const typeChecker = program.getTsProgram().getTypeChecker();
|
|
35672
35786
|
const templateTypeChecker = program.compiler.getTemplateTypeChecker();
|
|
35673
|
-
const
|
|
35787
|
+
const referenceResolver = new ReferenceResolver(program, host, rootFileNames, basePath, referenceLookupExcludedFiles);
|
|
35674
35788
|
const bootstrapCalls = [];
|
|
35675
35789
|
const testObjects = [];
|
|
35676
35790
|
const allDeclarations = [];
|
|
35677
35791
|
for (const sourceFile of sourceFiles) {
|
|
35678
35792
|
sourceFile.forEachChild(function walk(node) {
|
|
35679
|
-
if (
|
|
35793
|
+
if (import_typescript111.default.isCallExpression(node) && import_typescript111.default.isPropertyAccessExpression(node.expression) && node.expression.name.text === "bootstrapModule" && isClassReferenceInAngularModule(node.expression, "PlatformRef", "core", typeChecker)) {
|
|
35680
35794
|
const call = analyzeBootstrapCall(node, typeChecker, templateTypeChecker);
|
|
35681
35795
|
if (call) {
|
|
35682
35796
|
bootstrapCalls.push(call);
|
|
@@ -35688,33 +35802,33 @@ function toStandaloneBootstrap(program, host, basePath, rootFileNames, sourceFil
|
|
|
35688
35802
|
}
|
|
35689
35803
|
for (const call of bootstrapCalls) {
|
|
35690
35804
|
allDeclarations.push(...call.declarations);
|
|
35691
|
-
migrateBootstrapCall(call, tracker,
|
|
35805
|
+
migrateBootstrapCall(call, tracker, referenceResolver, typeChecker, printer);
|
|
35692
35806
|
}
|
|
35693
35807
|
for (const declaration of allDeclarations) {
|
|
35694
|
-
convertNgModuleDeclarationToStandalone(declaration, allDeclarations, tracker, templateTypeChecker);
|
|
35808
|
+
convertNgModuleDeclarationToStandalone(declaration, allDeclarations, tracker, templateTypeChecker, componentImportRemapper);
|
|
35695
35809
|
}
|
|
35696
35810
|
migrateTestDeclarations(testObjects, allDeclarations, tracker, templateTypeChecker, typeChecker);
|
|
35697
35811
|
return tracker.recordChanges();
|
|
35698
35812
|
}
|
|
35699
35813
|
function analyzeBootstrapCall(call, typeChecker, templateTypeChecker) {
|
|
35700
|
-
if (call.arguments.length === 0 || !
|
|
35814
|
+
if (call.arguments.length === 0 || !import_typescript111.default.isIdentifier(call.arguments[0])) {
|
|
35701
35815
|
return null;
|
|
35702
35816
|
}
|
|
35703
35817
|
const declaration = findClassDeclaration(call.arguments[0], typeChecker);
|
|
35704
35818
|
if (!declaration) {
|
|
35705
35819
|
return null;
|
|
35706
35820
|
}
|
|
35707
|
-
const decorator = getAngularDecorators(typeChecker,
|
|
35708
|
-
if (!decorator || decorator.node.expression.arguments.length === 0 || !
|
|
35821
|
+
const decorator = getAngularDecorators(typeChecker, import_typescript111.default.getDecorators(declaration) || []).find((decorator2) => decorator2.name === "NgModule");
|
|
35822
|
+
if (!decorator || decorator.node.expression.arguments.length === 0 || !import_typescript111.default.isObjectLiteralExpression(decorator.node.expression.arguments[0])) {
|
|
35709
35823
|
return null;
|
|
35710
35824
|
}
|
|
35711
35825
|
const metadata = decorator.node.expression.arguments[0];
|
|
35712
35826
|
const bootstrapProp = findLiteralProperty(metadata, "bootstrap");
|
|
35713
|
-
if (!bootstrapProp || !
|
|
35827
|
+
if (!bootstrapProp || !import_typescript111.default.isPropertyAssignment(bootstrapProp) || !import_typescript111.default.isArrayLiteralExpression(bootstrapProp.initializer) || bootstrapProp.initializer.elements.length === 0 || !import_typescript111.default.isIdentifier(bootstrapProp.initializer.elements[0])) {
|
|
35714
35828
|
return null;
|
|
35715
35829
|
}
|
|
35716
35830
|
const component = findClassDeclaration(bootstrapProp.initializer.elements[0], typeChecker);
|
|
35717
|
-
if (component && component.name &&
|
|
35831
|
+
if (component && component.name && import_typescript111.default.isIdentifier(component.name)) {
|
|
35718
35832
|
return {
|
|
35719
35833
|
module: declaration,
|
|
35720
35834
|
metadata,
|
|
@@ -35725,7 +35839,7 @@ function analyzeBootstrapCall(call, typeChecker, templateTypeChecker) {
|
|
|
35725
35839
|
}
|
|
35726
35840
|
return null;
|
|
35727
35841
|
}
|
|
35728
|
-
function migrateBootstrapCall(analysis, tracker,
|
|
35842
|
+
function migrateBootstrapCall(analysis, tracker, referenceResolver, typeChecker, printer) {
|
|
35729
35843
|
const sourceFile = analysis.call.getSourceFile();
|
|
35730
35844
|
const moduleSourceFile = analysis.metadata.getSourceFile();
|
|
35731
35845
|
const providers = findLiteralProperty(analysis.metadata, "providers");
|
|
@@ -35734,20 +35848,20 @@ function migrateBootstrapCall(analysis, tracker, languageService, typeChecker, p
|
|
|
35734
35848
|
const providersInNewCall = [];
|
|
35735
35849
|
const moduleImportsInNewCall = [];
|
|
35736
35850
|
let nodeLookup = null;
|
|
35737
|
-
tracker.insertText(moduleSourceFile, analysis.metadata.getStart(),
|
|
35851
|
+
tracker.insertText(moduleSourceFile, analysis.metadata.getStart(), "/* TODO(standalone-migration): clean up removed NgModule class manually. \n");
|
|
35738
35852
|
tracker.insertText(moduleSourceFile, analysis.metadata.getEnd(), " */");
|
|
35739
|
-
if (providers &&
|
|
35853
|
+
if (providers && import_typescript111.default.isPropertyAssignment(providers)) {
|
|
35740
35854
|
nodeLookup = nodeLookup || getNodeLookup(moduleSourceFile);
|
|
35741
|
-
if (
|
|
35855
|
+
if (import_typescript111.default.isArrayLiteralExpression(providers.initializer)) {
|
|
35742
35856
|
providersInNewCall.push(...providers.initializer.elements);
|
|
35743
35857
|
} else {
|
|
35744
|
-
providersInNewCall.push(
|
|
35858
|
+
providersInNewCall.push(import_typescript111.default.factory.createSpreadElement(providers.initializer));
|
|
35745
35859
|
}
|
|
35746
|
-
addNodesToCopy(sourceFile, providers, nodeLookup, tracker, nodesToCopy,
|
|
35860
|
+
addNodesToCopy(sourceFile, providers, nodeLookup, tracker, nodesToCopy, referenceResolver);
|
|
35747
35861
|
}
|
|
35748
|
-
if (imports &&
|
|
35862
|
+
if (imports && import_typescript111.default.isPropertyAssignment(imports)) {
|
|
35749
35863
|
nodeLookup = nodeLookup || getNodeLookup(moduleSourceFile);
|
|
35750
|
-
migrateImportsForBootstrapCall(sourceFile, imports, nodeLookup, moduleImportsInNewCall, providersInNewCall, tracker, nodesToCopy,
|
|
35864
|
+
migrateImportsForBootstrapCall(sourceFile, imports, nodeLookup, moduleImportsInNewCall, providersInNewCall, tracker, nodesToCopy, referenceResolver, typeChecker);
|
|
35751
35865
|
}
|
|
35752
35866
|
if (nodesToCopy.size > 0) {
|
|
35753
35867
|
let text = "\n\n";
|
|
@@ -35756,7 +35870,7 @@ function migrateBootstrapCall(analysis, tracker, languageService, typeChecker, p
|
|
|
35756
35870
|
if (transformedNode === node) {
|
|
35757
35871
|
text += transformedNode.getText() + "\n";
|
|
35758
35872
|
} else {
|
|
35759
|
-
text += printer.printNode(
|
|
35873
|
+
text += printer.printNode(import_typescript111.default.EmitHint.Unspecified, transformedNode, node.getSourceFile());
|
|
35760
35874
|
}
|
|
35761
35875
|
});
|
|
35762
35876
|
text += "\n";
|
|
@@ -35773,60 +35887,69 @@ function replaceBootstrapCallExpression(analysis, providers, modules, tracker) {
|
|
|
35773
35887
|
const combinedProviders = [];
|
|
35774
35888
|
if (modules.length > 0) {
|
|
35775
35889
|
const importProvidersExpression = tracker.addImport(sourceFile, "importProvidersFrom", "@angular/core");
|
|
35776
|
-
combinedProviders.push(
|
|
35890
|
+
combinedProviders.push(import_typescript111.default.factory.createCallExpression(importProvidersExpression, [], modules));
|
|
35777
35891
|
}
|
|
35778
35892
|
combinedProviders.push(...providers);
|
|
35779
|
-
const initializer = remapDynamicImports(sourceFile.fileName,
|
|
35780
|
-
args.push(
|
|
35893
|
+
const initializer = remapDynamicImports(sourceFile.fileName, import_typescript111.default.factory.createArrayLiteralExpression(combinedProviders, combinedProviders.length > 1));
|
|
35894
|
+
args.push(import_typescript111.default.factory.createObjectLiteralExpression([import_typescript111.default.factory.createPropertyAssignment("providers", initializer)], true));
|
|
35781
35895
|
}
|
|
35782
35896
|
tracker.replaceNode(
|
|
35783
35897
|
analysis.call,
|
|
35784
|
-
|
|
35898
|
+
import_typescript111.default.factory.createCallExpression(bootstrapExpression, [], args),
|
|
35785
35899
|
void 0,
|
|
35786
35900
|
analysis.metadata.getSourceFile()
|
|
35787
35901
|
);
|
|
35788
35902
|
}
|
|
35789
|
-
function migrateImportsForBootstrapCall(sourceFile, imports, nodeLookup, importsForNewCall, providersInNewCall, tracker, nodesToCopy,
|
|
35790
|
-
if (!
|
|
35903
|
+
function migrateImportsForBootstrapCall(sourceFile, imports, nodeLookup, importsForNewCall, providersInNewCall, tracker, nodesToCopy, referenceResolver, typeChecker) {
|
|
35904
|
+
if (!import_typescript111.default.isArrayLiteralExpression(imports.initializer)) {
|
|
35791
35905
|
importsForNewCall.push(imports.initializer);
|
|
35792
35906
|
return;
|
|
35793
35907
|
}
|
|
35794
35908
|
for (const element of imports.initializer.elements) {
|
|
35795
|
-
if (
|
|
35909
|
+
if (import_typescript111.default.isCallExpression(element) && import_typescript111.default.isPropertyAccessExpression(element.expression) && element.arguments.length > 0 && element.expression.name.text === "forRoot" && isClassReferenceInAngularModule(element.expression.expression, "RouterModule", "router", typeChecker)) {
|
|
35796
35910
|
const options = element.arguments[1];
|
|
35797
35911
|
const features = options ? getRouterModuleForRootFeatures(sourceFile, options, tracker) : [];
|
|
35798
35912
|
if (features !== null) {
|
|
35799
|
-
providersInNewCall.push(
|
|
35800
|
-
addNodesToCopy(sourceFile, element.arguments[0], nodeLookup, tracker, nodesToCopy,
|
|
35913
|
+
providersInNewCall.push(import_typescript111.default.factory.createCallExpression(tracker.addImport(sourceFile, "provideRouter", "@angular/router"), [], [element.arguments[0], ...features]));
|
|
35914
|
+
addNodesToCopy(sourceFile, element.arguments[0], nodeLookup, tracker, nodesToCopy, referenceResolver);
|
|
35801
35915
|
if (options) {
|
|
35802
|
-
addNodesToCopy(sourceFile, options, nodeLookup, tracker, nodesToCopy,
|
|
35916
|
+
addNodesToCopy(sourceFile, options, nodeLookup, tracker, nodesToCopy, referenceResolver);
|
|
35803
35917
|
}
|
|
35804
35918
|
continue;
|
|
35805
35919
|
}
|
|
35806
35920
|
}
|
|
35807
|
-
if (
|
|
35921
|
+
if (import_typescript111.default.isIdentifier(element)) {
|
|
35808
35922
|
const animationsModule = "platform-browser/animations";
|
|
35809
35923
|
const animationsImport = `@angular/${animationsModule}`;
|
|
35810
35924
|
if (isClassReferenceInAngularModule(element, "BrowserAnimationsModule", animationsModule, typeChecker)) {
|
|
35811
|
-
providersInNewCall.push(
|
|
35925
|
+
providersInNewCall.push(import_typescript111.default.factory.createCallExpression(tracker.addImport(sourceFile, "provideAnimations", animationsImport), [], []));
|
|
35812
35926
|
continue;
|
|
35813
35927
|
}
|
|
35814
35928
|
if (isClassReferenceInAngularModule(element, "NoopAnimationsModule", animationsModule, typeChecker)) {
|
|
35815
|
-
providersInNewCall.push(
|
|
35929
|
+
providersInNewCall.push(import_typescript111.default.factory.createCallExpression(tracker.addImport(sourceFile, "provideNoopAnimations", animationsImport), [], []));
|
|
35930
|
+
continue;
|
|
35931
|
+
}
|
|
35932
|
+
const httpClientModule = "common/http";
|
|
35933
|
+
const httpClientImport = `@angular/${httpClientModule}`;
|
|
35934
|
+
if (isClassReferenceInAngularModule(element, "HttpClientModule", httpClientModule, typeChecker)) {
|
|
35935
|
+
const callArgs = [
|
|
35936
|
+
import_typescript111.default.factory.createCallExpression(tracker.addImport(sourceFile, "withInterceptorsFromDi", httpClientImport), [], [])
|
|
35937
|
+
];
|
|
35938
|
+
providersInNewCall.push(import_typescript111.default.factory.createCallExpression(tracker.addImport(sourceFile, "provideHttpClient", httpClientImport), [], callArgs));
|
|
35816
35939
|
continue;
|
|
35817
35940
|
}
|
|
35818
35941
|
}
|
|
35819
|
-
const target =
|
|
35942
|
+
const target = import_typescript111.default.isCallExpression(element) && import_typescript111.default.isPropertyAccessExpression(element.expression) ? element.expression.expression : element;
|
|
35820
35943
|
const classDeclaration = findClassDeclaration(target, typeChecker);
|
|
35821
|
-
const decorators = classDeclaration ? getAngularDecorators(typeChecker,
|
|
35944
|
+
const decorators = classDeclaration ? getAngularDecorators(typeChecker, import_typescript111.default.getDecorators(classDeclaration) || []) : void 0;
|
|
35822
35945
|
if (!decorators || decorators.length === 0 || decorators.every(({ name }) => name !== "Directive" && name !== "Component" && name !== "Pipe")) {
|
|
35823
35946
|
importsForNewCall.push(element);
|
|
35824
|
-
addNodesToCopy(sourceFile, element, nodeLookup, tracker, nodesToCopy,
|
|
35947
|
+
addNodesToCopy(sourceFile, element, nodeLookup, tracker, nodesToCopy, referenceResolver);
|
|
35825
35948
|
}
|
|
35826
35949
|
}
|
|
35827
35950
|
}
|
|
35828
35951
|
function getRouterModuleForRootFeatures(sourceFile, options, tracker) {
|
|
35829
|
-
if (!
|
|
35952
|
+
if (!import_typescript111.default.isObjectLiteralExpression(options)) {
|
|
35830
35953
|
return null;
|
|
35831
35954
|
}
|
|
35832
35955
|
const featureExpressions = [];
|
|
@@ -35834,7 +35957,7 @@ function getRouterModuleForRootFeatures(sourceFile, options, tracker) {
|
|
|
35834
35957
|
const inMemoryScrollingOptions = [];
|
|
35835
35958
|
const features = new UniqueItemTracker();
|
|
35836
35959
|
for (const prop of options.properties) {
|
|
35837
|
-
if (!
|
|
35960
|
+
if (!import_typescript111.default.isPropertyAssignment(prop) || !import_typescript111.default.isIdentifier(prop.name) && !import_typescript111.default.isStringLiteralLike(prop.name)) {
|
|
35838
35961
|
return null;
|
|
35839
35962
|
}
|
|
35840
35963
|
switch (prop.name.text) {
|
|
@@ -35842,12 +35965,12 @@ function getRouterModuleForRootFeatures(sourceFile, options, tracker) {
|
|
|
35842
35965
|
features.track("withPreloading", prop.initializer);
|
|
35843
35966
|
break;
|
|
35844
35967
|
case "enableTracing":
|
|
35845
|
-
if (prop.initializer.kind ===
|
|
35968
|
+
if (prop.initializer.kind === import_typescript111.default.SyntaxKind.TrueKeyword) {
|
|
35846
35969
|
features.track("withDebugTracing", null);
|
|
35847
35970
|
}
|
|
35848
35971
|
break;
|
|
35849
35972
|
case "initialNavigation":
|
|
35850
|
-
if (!
|
|
35973
|
+
if (!import_typescript111.default.isStringLiteralLike(prop.initializer)) {
|
|
35851
35974
|
return null;
|
|
35852
35975
|
}
|
|
35853
35976
|
if (prop.initializer.text === "enabledBlocking" || prop.initializer.text === "enabled") {
|
|
@@ -35857,7 +35980,7 @@ function getRouterModuleForRootFeatures(sourceFile, options, tracker) {
|
|
|
35857
35980
|
}
|
|
35858
35981
|
break;
|
|
35859
35982
|
case "useHash":
|
|
35860
|
-
if (prop.initializer.kind ===
|
|
35983
|
+
if (prop.initializer.kind === import_typescript111.default.SyntaxKind.TrueKeyword) {
|
|
35861
35984
|
features.track("withHashLocation", null);
|
|
35862
35985
|
}
|
|
35863
35986
|
break;
|
|
@@ -35874,10 +35997,10 @@ function getRouterModuleForRootFeatures(sourceFile, options, tracker) {
|
|
|
35874
35997
|
}
|
|
35875
35998
|
}
|
|
35876
35999
|
if (inMemoryScrollingOptions.length > 0) {
|
|
35877
|
-
features.track("withInMemoryScrolling",
|
|
36000
|
+
features.track("withInMemoryScrolling", import_typescript111.default.factory.createObjectLiteralExpression(inMemoryScrollingOptions));
|
|
35878
36001
|
}
|
|
35879
36002
|
if (configOptions.length > 0) {
|
|
35880
|
-
features.track("withRouterConfig",
|
|
36003
|
+
features.track("withRouterConfig", import_typescript111.default.factory.createObjectLiteralExpression(configOptions));
|
|
35881
36004
|
}
|
|
35882
36005
|
for (const [feature, featureArgs] of features.getEntries()) {
|
|
35883
36006
|
const callArgs = [];
|
|
@@ -35886,25 +36009,25 @@ function getRouterModuleForRootFeatures(sourceFile, options, tracker) {
|
|
|
35886
36009
|
callArgs.push(arg);
|
|
35887
36010
|
}
|
|
35888
36011
|
});
|
|
35889
|
-
featureExpressions.push(
|
|
36012
|
+
featureExpressions.push(import_typescript111.default.factory.createCallExpression(tracker.addImport(sourceFile, feature, "@angular/router"), [], callArgs));
|
|
35890
36013
|
}
|
|
35891
36014
|
return featureExpressions;
|
|
35892
36015
|
}
|
|
35893
|
-
function addNodesToCopy(targetFile, rootNode, nodeLookup, tracker, nodesToCopy,
|
|
35894
|
-
const refs = findAllSameFileReferences(rootNode, nodeLookup,
|
|
36016
|
+
function addNodesToCopy(targetFile, rootNode, nodeLookup, tracker, nodesToCopy, referenceResolver) {
|
|
36017
|
+
const refs = findAllSameFileReferences(rootNode, nodeLookup, referenceResolver);
|
|
35895
36018
|
for (const ref of refs) {
|
|
35896
|
-
const importSpecifier = closestOrSelf(ref,
|
|
35897
|
-
const importDeclaration = importSpecifier ? closestNode(importSpecifier,
|
|
35898
|
-
if (importDeclaration && importSpecifier &&
|
|
36019
|
+
const importSpecifier = closestOrSelf(ref, import_typescript111.default.isImportSpecifier);
|
|
36020
|
+
const importDeclaration = importSpecifier ? closestNode(importSpecifier, import_typescript111.default.isImportDeclaration) : null;
|
|
36021
|
+
if (importDeclaration && importSpecifier && import_typescript111.default.isStringLiteralLike(importDeclaration.moduleSpecifier)) {
|
|
35899
36022
|
const moduleName = importDeclaration.moduleSpecifier.text.startsWith(".") ? remapRelativeImport(targetFile.fileName, importDeclaration.moduleSpecifier) : importDeclaration.moduleSpecifier.text;
|
|
35900
36023
|
const symbolName = importSpecifier.propertyName ? importSpecifier.propertyName.text : importSpecifier.name.text;
|
|
35901
36024
|
const alias = importSpecifier.propertyName ? importSpecifier.name.text : null;
|
|
35902
36025
|
tracker.addImport(targetFile, symbolName, moduleName, alias);
|
|
35903
36026
|
continue;
|
|
35904
36027
|
}
|
|
35905
|
-
const variableDeclaration = closestOrSelf(ref,
|
|
35906
|
-
const variableStatement = variableDeclaration ? closestNode(variableDeclaration,
|
|
35907
|
-
if (variableDeclaration && variableStatement &&
|
|
36028
|
+
const variableDeclaration = closestOrSelf(ref, import_typescript111.default.isVariableDeclaration);
|
|
36029
|
+
const variableStatement = variableDeclaration ? closestNode(variableDeclaration, import_typescript111.default.isVariableStatement) : null;
|
|
36030
|
+
if (variableDeclaration && variableStatement && import_typescript111.default.isIdentifier(variableDeclaration.name)) {
|
|
35908
36031
|
if (isExported3(variableStatement)) {
|
|
35909
36032
|
tracker.addImport(targetFile, variableDeclaration.name.text, getRelativeImportPath(targetFile.fileName, ref.getSourceFile().fileName));
|
|
35910
36033
|
} else {
|
|
@@ -35922,8 +36045,9 @@ function addNodesToCopy(targetFile, rootNode, nodeLookup, tracker, nodesToCopy,
|
|
|
35922
36045
|
}
|
|
35923
36046
|
}
|
|
35924
36047
|
}
|
|
35925
|
-
function findAllSameFileReferences(rootNode, nodeLookup,
|
|
36048
|
+
function findAllSameFileReferences(rootNode, nodeLookup, referenceResolver) {
|
|
35926
36049
|
const results = /* @__PURE__ */ new Set();
|
|
36050
|
+
const traversedTopLevelNodes = /* @__PURE__ */ new Set();
|
|
35927
36051
|
const excludeStart = rootNode.getStart();
|
|
35928
36052
|
const excludeEnd = rootNode.getEnd();
|
|
35929
36053
|
(function walk(node) {
|
|
@@ -35931,7 +36055,7 @@ function findAllSameFileReferences(rootNode, nodeLookup, languageService) {
|
|
|
35931
36055
|
node.forEachChild(walk);
|
|
35932
36056
|
return;
|
|
35933
36057
|
}
|
|
35934
|
-
const refs = referencesToNodeWithinSameFile(node, nodeLookup, excludeStart, excludeEnd,
|
|
36058
|
+
const refs = referencesToNodeWithinSameFile(node, nodeLookup, excludeStart, excludeEnd, referenceResolver);
|
|
35935
36059
|
if (refs === null) {
|
|
35936
36060
|
return;
|
|
35937
36061
|
}
|
|
@@ -35939,36 +36063,25 @@ function findAllSameFileReferences(rootNode, nodeLookup, languageService) {
|
|
|
35939
36063
|
if (results.has(ref)) {
|
|
35940
36064
|
continue;
|
|
35941
36065
|
}
|
|
35942
|
-
const closestTopLevel = closestNode(ref, isTopLevelStatement);
|
|
35943
36066
|
results.add(ref);
|
|
35944
|
-
|
|
36067
|
+
const closestTopLevel = closestNode(ref, isTopLevelStatement);
|
|
36068
|
+
if (!closestTopLevel || traversedTopLevelNodes.has(closestTopLevel)) {
|
|
36069
|
+
continue;
|
|
36070
|
+
}
|
|
36071
|
+
if (!import_typescript111.default.isImportDeclaration(closestTopLevel) && isOutsideRange(excludeStart, excludeEnd, closestTopLevel.getStart(), closestTopLevel.getEnd())) {
|
|
36072
|
+
traversedTopLevelNodes.add(closestTopLevel);
|
|
35945
36073
|
walk(closestTopLevel);
|
|
35946
36074
|
}
|
|
35947
36075
|
}
|
|
35948
36076
|
})(rootNode);
|
|
35949
36077
|
return results;
|
|
35950
36078
|
}
|
|
35951
|
-
function referencesToNodeWithinSameFile(node, nodeLookup, excludeStart, excludeEnd,
|
|
35952
|
-
const
|
|
35953
|
-
|
|
35954
|
-
|
|
35955
|
-
|
|
35956
|
-
|
|
35957
|
-
for (const file of highlights) {
|
|
35958
|
-
if (file.fileName === fileName) {
|
|
35959
|
-
for (const { textSpan: { start, length }, kind } of file.highlightSpans) {
|
|
35960
|
-
const end = start + length;
|
|
35961
|
-
if (kind !== import_typescript112.default.HighlightSpanKind.none && isOutsideRange(excludeStart, excludeEnd, start, end)) {
|
|
35962
|
-
offsets.push([start, end]);
|
|
35963
|
-
}
|
|
35964
|
-
}
|
|
35965
|
-
}
|
|
35966
|
-
}
|
|
35967
|
-
if (offsets.length > 0) {
|
|
35968
|
-
const nodes = offsetsToNodes(nodeLookup, offsets, /* @__PURE__ */ new Set());
|
|
35969
|
-
if (nodes.size > 0) {
|
|
35970
|
-
return nodes;
|
|
35971
|
-
}
|
|
36079
|
+
function referencesToNodeWithinSameFile(node, nodeLookup, excludeStart, excludeEnd, referenceResolver) {
|
|
36080
|
+
const offsets = referenceResolver.findSameFileReferences(node, node.getSourceFile().fileName).filter(([start, end]) => isOutsideRange(excludeStart, excludeEnd, start, end));
|
|
36081
|
+
if (offsets.length > 0) {
|
|
36082
|
+
const nodes = offsetsToNodes(nodeLookup, offsets, /* @__PURE__ */ new Set());
|
|
36083
|
+
if (nodes.size > 0) {
|
|
36084
|
+
return nodes;
|
|
35972
36085
|
}
|
|
35973
36086
|
}
|
|
35974
36087
|
return null;
|
|
@@ -35976,25 +36089,25 @@ function referencesToNodeWithinSameFile(node, nodeLookup, excludeStart, excludeE
|
|
|
35976
36089
|
function remapDynamicImports(targetFileName, rootNode) {
|
|
35977
36090
|
let hasChanged = false;
|
|
35978
36091
|
const transformer = (context) => {
|
|
35979
|
-
return (sourceFile) =>
|
|
35980
|
-
if (
|
|
36092
|
+
return (sourceFile) => import_typescript111.default.visitNode(sourceFile, function walk(node) {
|
|
36093
|
+
if (import_typescript111.default.isCallExpression(node) && node.expression.kind === import_typescript111.default.SyntaxKind.ImportKeyword && node.arguments.length > 0 && import_typescript111.default.isStringLiteralLike(node.arguments[0]) && node.arguments[0].text.startsWith(".")) {
|
|
35981
36094
|
hasChanged = true;
|
|
35982
36095
|
return context.factory.updateCallExpression(node, node.expression, node.typeArguments, [
|
|
35983
36096
|
context.factory.createStringLiteral(remapRelativeImport(targetFileName, node.arguments[0])),
|
|
35984
36097
|
...node.arguments.slice(1)
|
|
35985
36098
|
]);
|
|
35986
36099
|
}
|
|
35987
|
-
return
|
|
36100
|
+
return import_typescript111.default.visitEachChild(node, walk, context);
|
|
35988
36101
|
});
|
|
35989
36102
|
};
|
|
35990
|
-
const result =
|
|
36103
|
+
const result = import_typescript111.default.transform(rootNode, [transformer]).transformed[0];
|
|
35991
36104
|
return hasChanged ? result : rootNode;
|
|
35992
36105
|
}
|
|
35993
36106
|
function isTopLevelStatement(node) {
|
|
35994
|
-
return node.parent != null &&
|
|
36107
|
+
return node.parent != null && import_typescript111.default.isSourceFile(node.parent);
|
|
35995
36108
|
}
|
|
35996
36109
|
function isReferenceIdentifier(node) {
|
|
35997
|
-
return
|
|
36110
|
+
return import_typescript111.default.isIdentifier(node) && (!import_typescript111.default.isPropertyAssignment(node.parent) && !import_typescript111.default.isParameter(node.parent) || node.parent.name !== node);
|
|
35998
36111
|
}
|
|
35999
36112
|
function isOutsideRange(excludeStart, excludeEnd, start, end) {
|
|
36000
36113
|
return start < excludeStart && end < excludeStart || start > excludeEnd;
|
|
@@ -36003,29 +36116,15 @@ function remapRelativeImport(targetFileName, specifier) {
|
|
|
36003
36116
|
return getRelativeImportPath(targetFileName, (0, import_path7.join)((0, import_path7.dirname)(specifier.getSourceFile().fileName), specifier.text));
|
|
36004
36117
|
}
|
|
36005
36118
|
function isExported3(node) {
|
|
36006
|
-
return
|
|
36007
|
-
}
|
|
36008
|
-
function closestOrSelf(node, predicate) {
|
|
36009
|
-
return predicate(node) ? node : closestNode(node, predicate);
|
|
36119
|
+
return import_typescript111.default.canHaveModifiers(node) && node.modifiers ? node.modifiers.some((modifier) => modifier.kind === import_typescript111.default.SyntaxKind.ExportKeyword) : false;
|
|
36010
36120
|
}
|
|
36011
36121
|
function isExportableDeclaration(node) {
|
|
36012
|
-
return
|
|
36013
|
-
}
|
|
36014
|
-
function isClassReferenceInAngularModule(node, className, moduleName, typeChecker) {
|
|
36015
|
-
var _a;
|
|
36016
|
-
const symbol = typeChecker.getTypeAtLocation(node).getSymbol();
|
|
36017
|
-
const externalName = `@angular/${moduleName}`;
|
|
36018
|
-
const internalName = `angular2/rc/packages/${moduleName}`;
|
|
36019
|
-
return !!((_a = symbol == null ? void 0 : symbol.declarations) == null ? void 0 : _a.some((decl) => {
|
|
36020
|
-
const closestClass = closestOrSelf(decl, import_typescript112.default.isClassDeclaration);
|
|
36021
|
-
const closestClassFileName = closestClass == null ? void 0 : closestClass.getSourceFile().fileName;
|
|
36022
|
-
return closestClass && closestClassFileName && closestClass.name && import_typescript112.default.isIdentifier(closestClass.name) && closestClass.name.text === className && (closestClassFileName.includes(externalName) || closestClassFileName.includes(internalName));
|
|
36023
|
-
}));
|
|
36122
|
+
return import_typescript111.default.isEnumDeclaration(node) || import_typescript111.default.isClassDeclaration(node) || import_typescript111.default.isFunctionDeclaration(node) || import_typescript111.default.isInterfaceDeclaration(node) || import_typescript111.default.isTypeAliasDeclaration(node);
|
|
36024
36123
|
}
|
|
36025
36124
|
function getLastImportEnd(sourceFile) {
|
|
36026
36125
|
let index = 0;
|
|
36027
36126
|
for (const statement of sourceFile.statements) {
|
|
36028
|
-
if (
|
|
36127
|
+
if (import_typescript111.default.isImportDeclaration(statement)) {
|
|
36029
36128
|
index = Math.max(index, statement.getEnd());
|
|
36030
36129
|
} else {
|
|
36031
36130
|
break;
|
|
@@ -36042,7 +36141,7 @@ var MigrationMode;
|
|
|
36042
36141
|
MigrationMode2["standaloneBootstrap"] = "standalone-bootstrap";
|
|
36043
36142
|
})(MigrationMode || (MigrationMode = {}));
|
|
36044
36143
|
function standalone_migration_default(options) {
|
|
36045
|
-
return (tree) => __async(this, null, function* () {
|
|
36144
|
+
return (tree, context) => __async(this, null, function* () {
|
|
36046
36145
|
const { buildPaths, testPaths } = yield getProjectTsConfigPaths(tree);
|
|
36047
36146
|
const basePath = process.cwd();
|
|
36048
36147
|
const allPaths = [...buildPaths, ...testPaths];
|
|
@@ -36057,9 +36156,11 @@ function standalone_migration_default(options) {
|
|
|
36057
36156
|
if (migratedFiles === 0) {
|
|
36058
36157
|
throw new import_schematics.SchematicsException(`Could not find any files to migrate under the path ${pathToMigrate}. Cannot run the standalone migration.`);
|
|
36059
36158
|
}
|
|
36159
|
+
context.logger.info("\u{1F389} Automated migration step has finished! \u{1F389}");
|
|
36160
|
+
context.logger.info("IMPORTANT! Please verify manually that your application builds and behaves as expected.");
|
|
36060
36161
|
});
|
|
36061
36162
|
}
|
|
36062
|
-
function standaloneMigration(tree, tsconfigPath, basePath, pathToMigrate, schematicOptions) {
|
|
36163
|
+
function standaloneMigration(tree, tsconfigPath, basePath, pathToMigrate, schematicOptions, oldProgram) {
|
|
36063
36164
|
if (schematicOptions.path.startsWith("..")) {
|
|
36064
36165
|
throw new import_schematics.SchematicsException("Cannot run standalone migration outside of the current project.");
|
|
36065
36166
|
}
|
|
@@ -36069,27 +36170,26 @@ function standaloneMigration(tree, tsconfigPath, basePath, pathToMigrate, schema
|
|
|
36069
36170
|
skipLibCheck: true,
|
|
36070
36171
|
skipDefaultLibCheck: true
|
|
36071
36172
|
});
|
|
36072
|
-
const
|
|
36073
|
-
const
|
|
36173
|
+
const referenceLookupExcludedFiles = /node_modules|\.ngtypecheck\.ts/;
|
|
36174
|
+
const program = createProgram({ rootNames, host, options, oldProgram });
|
|
36175
|
+
const printer = import_typescript112.default.createPrinter();
|
|
36074
36176
|
if ((0, import_fs2.existsSync)(pathToMigrate) && !(0, import_fs2.statSync)(pathToMigrate).isDirectory()) {
|
|
36075
36177
|
throw new import_schematics.SchematicsException(`Migration path ${pathToMigrate} has to be a directory. Cannot run the standalone migration.`);
|
|
36076
36178
|
}
|
|
36077
|
-
const sourceFiles = program.getTsProgram().getSourceFiles().filter((sourceFile) =>
|
|
36078
|
-
return sourceFile.fileName.startsWith(pathToMigrate) && canMigrateFile(basePath, sourceFile, program.getTsProgram());
|
|
36079
|
-
});
|
|
36179
|
+
const sourceFiles = program.getTsProgram().getSourceFiles().filter((sourceFile) => sourceFile.fileName.startsWith(pathToMigrate) && canMigrateFile(basePath, sourceFile, program.getTsProgram()));
|
|
36080
36180
|
if (sourceFiles.length === 0) {
|
|
36081
36181
|
return 0;
|
|
36082
36182
|
}
|
|
36083
36183
|
let pendingChanges;
|
|
36084
36184
|
let filesToRemove = null;
|
|
36085
36185
|
if (schematicOptions.mode === MigrationMode.pruneModules) {
|
|
36086
|
-
const result = pruneNgModules(program, host, basePath, rootNames, sourceFiles, printer);
|
|
36186
|
+
const result = pruneNgModules(program, host, basePath, rootNames, sourceFiles, printer, void 0, referenceLookupExcludedFiles);
|
|
36087
36187
|
pendingChanges = result.pendingChanges;
|
|
36088
36188
|
filesToRemove = result.filesToRemove;
|
|
36089
36189
|
} else if (schematicOptions.mode === MigrationMode.standaloneBootstrap) {
|
|
36090
|
-
pendingChanges = toStandaloneBootstrap(program, host, basePath, rootNames, sourceFiles, printer);
|
|
36190
|
+
pendingChanges = toStandaloneBootstrap(program, host, basePath, rootNames, sourceFiles, printer, void 0, referenceLookupExcludedFiles, knownInternalAliasRemapper);
|
|
36091
36191
|
} else {
|
|
36092
|
-
pendingChanges = toStandalone(sourceFiles, program, printer);
|
|
36192
|
+
pendingChanges = toStandalone(sourceFiles, program, printer, void 0, knownInternalAliasRemapper);
|
|
36093
36193
|
}
|
|
36094
36194
|
for (const [file, changes] of pendingChanges.entries()) {
|
|
36095
36195
|
if (filesToRemove == null ? void 0 : filesToRemove.has(file)) {
|
|
@@ -36109,6 +36209,9 @@ function standaloneMigration(tree, tsconfigPath, basePath, pathToMigrate, schema
|
|
|
36109
36209
|
tree.delete((0, import_path8.relative)(basePath, file.fileName));
|
|
36110
36210
|
}
|
|
36111
36211
|
}
|
|
36212
|
+
if (schematicOptions.mode === MigrationMode.standaloneBootstrap) {
|
|
36213
|
+
return standaloneMigration(tree, tsconfigPath, basePath, pathToMigrate, __spreadProps(__spreadValues({}, schematicOptions), { mode: MigrationMode.pruneModules }), program) + sourceFiles.length;
|
|
36214
|
+
}
|
|
36112
36215
|
return sourceFiles.length;
|
|
36113
36216
|
}
|
|
36114
36217
|
// Annotate the CommonJS export names for ESM import in node:
|