@angular/core 20.0.0-next.2 → 20.0.0-next.4
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/event_dispatcher.d-pVP0-wST.d.ts +345 -0
- package/fesm2022/core.mjs +614 -428
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/injector-BlLwZ2sr.mjs +24 -0
- package/fesm2022/injector-BlLwZ2sr.mjs.map +1 -0
- package/fesm2022/primitives/di.mjs +5 -18
- package/fesm2022/primitives/di.mjs.map +1 -1
- package/fesm2022/primitives/event-dispatch.mjs +1 -1
- package/fesm2022/primitives/signals.mjs +4 -589
- package/fesm2022/primitives/signals.mjs.map +1 -1
- package/fesm2022/rxjs-interop.mjs +1 -8
- package/fesm2022/rxjs-interop.mjs.map +1 -1
- package/fesm2022/testing.mjs +2 -10
- package/fesm2022/testing.mjs.map +1 -1
- package/fesm2022/untracked-DkcXpNb_.mjs +620 -0
- package/fesm2022/untracked-DkcXpNb_.mjs.map +1 -0
- package/index.d.ts +7589 -7510
- package/{navigation_types.d-u4EOrrdZ.d.ts → navigation_types.d-DgDrF5rp.d.ts} +2 -2
- package/package.json +2 -2
- package/primitives/di/index.d.ts +25 -10
- package/primitives/event-dispatch/index.d.ts +5 -340
- package/primitives/signals/index.d.ts +5 -208
- package/rxjs-interop/index.d.ts +1 -10
- package/schematics/bundles/{apply_import_manager-CyRT0UvU.js → apply_import_manager-CeNv8GIG.js} +6 -6
- package/schematics/bundles/{checker-DF8ZaFW5.js → checker-k591b6WQ.js} +856 -180
- package/schematics/bundles/cleanup-unused-imports.js +42 -69
- package/schematics/bundles/{compiler_host-Da636uJ8.js → compiler_host-DwM3ugW3.js} +2 -2
- package/schematics/bundles/control-flow-migration.js +34 -13
- package/schematics/bundles/imports-CIX-JgAN.js +1 -1
- package/schematics/bundles/{program-BZk27Ndu.js → index-B4OAlHh8.js} +2234 -2097
- package/schematics/bundles/{index-DnkWgagp.js → index-BhELUmYx.js} +11 -11
- package/schematics/bundles/inject-flags.js +18 -52
- package/schematics/bundles/inject-migration.js +3 -3
- package/schematics/bundles/leading_space-D9nQ8UQC.js +1 -1
- package/schematics/bundles/{migrate_ts_type_references-DtkOnnv0.js → migrate_ts_type_references-Be0TNYen.js} +20 -20
- package/schematics/bundles/ng_decorators-DznZ5jMl.js +1 -1
- package/schematics/bundles/nodes-B16H9JUd.js +1 -1
- package/schematics/bundles/output-migration.js +62 -90
- package/schematics/bundles/project_tsconfig_paths-CDVxT6Ov.js +1 -1
- package/schematics/bundles/property_name-BBwFuqMe.js +1 -1
- package/schematics/bundles/route-lazy-loading.js +3 -3
- package/schematics/bundles/{project_paths-Jtbi76Bs.js → run_in_devkit-CkvEksWP.js} +262 -197
- package/schematics/bundles/self-closing-tags-migration.js +41 -71
- package/schematics/bundles/signal-input-migration.js +69 -97
- package/schematics/bundles/signal-queries-migration.js +80 -108
- package/schematics/bundles/signals.js +11 -11
- package/schematics/bundles/standalone-migration.js +8 -22
- package/schematics/bundles/symbol-VPWguRxr.js +25 -0
- package/schematics/bundles/test-bed-get.js +98 -0
- package/schematics/migrations.json +5 -0
- package/testing/index.d.ts +2 -4
- package/weak_ref.d-BZ7gyRag.d.ts +216 -0
- package/fesm2022/weak_ref-DrMdAIDh.mjs +0 -12
- package/fesm2022/weak_ref-DrMdAIDh.mjs.map +0 -1
- package/schematics/bundles/index-vGJcp5M7.js +0 -30
- package/weak_ref.d-ttyj86RV.d.ts +0 -9
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v20.0.0-next.
|
|
3
|
+
* @license Angular v20.0.0-next.4
|
|
4
4
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
|
-
var schematics = require('@angular-devkit/schematics');
|
|
10
|
-
var project_tsconfig_paths = require('./project_tsconfig_paths-CDVxT6Ov.js');
|
|
11
|
-
var project_paths = require('./project_paths-Jtbi76Bs.js');
|
|
12
|
-
require('os');
|
|
13
9
|
var ts = require('typescript');
|
|
14
|
-
|
|
15
|
-
require('./
|
|
10
|
+
require('os');
|
|
11
|
+
var checker = require('./checker-k591b6WQ.js');
|
|
12
|
+
require('./index-B4OAlHh8.js');
|
|
16
13
|
require('path');
|
|
14
|
+
var run_in_devkit = require('./run_in_devkit-CkvEksWP.js');
|
|
17
15
|
var ng_decorators = require('./ng_decorators-DznZ5jMl.js');
|
|
18
16
|
var property_name = require('./property_name-BBwFuqMe.js');
|
|
19
17
|
require('@angular-devkit/core');
|
|
@@ -21,6 +19,8 @@ require('node:path/posix');
|
|
|
21
19
|
require('fs');
|
|
22
20
|
require('module');
|
|
23
21
|
require('url');
|
|
22
|
+
require('@angular-devkit/schematics');
|
|
23
|
+
require('./project_tsconfig_paths-CDVxT6Ov.js');
|
|
24
24
|
require('./imports-CIX-JgAN.js');
|
|
25
25
|
|
|
26
26
|
/**
|
|
@@ -297,7 +297,7 @@ class AngularElementCollector extends checker.RecursiveVisitor {
|
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
299
|
|
|
300
|
-
class SelfClosingTagsMigration extends
|
|
300
|
+
class SelfClosingTagsMigration extends run_in_devkit.TsurgeFunnelMigration {
|
|
301
301
|
config;
|
|
302
302
|
constructor(config = {}) {
|
|
303
303
|
super();
|
|
@@ -313,7 +313,7 @@ class SelfClosingTagsMigration extends project_paths.TsurgeFunnelMigration {
|
|
|
313
313
|
if (!ts.isClassDeclaration(node)) {
|
|
314
314
|
return;
|
|
315
315
|
}
|
|
316
|
-
const file =
|
|
316
|
+
const file = run_in_devkit.projectFile(node.getSourceFile(), info);
|
|
317
317
|
if (this.config.shouldMigrate && this.config.shouldMigrate(file) === false) {
|
|
318
318
|
return;
|
|
319
319
|
}
|
|
@@ -326,7 +326,7 @@ class SelfClosingTagsMigration extends project_paths.TsurgeFunnelMigration {
|
|
|
326
326
|
}
|
|
327
327
|
const fileToMigrate = template.inline
|
|
328
328
|
? file
|
|
329
|
-
:
|
|
329
|
+
: run_in_devkit.projectFile(template.filePath, info);
|
|
330
330
|
const end = template.start + template.content.length;
|
|
331
331
|
const replacements = [
|
|
332
332
|
prepareTextReplacement(fileToMigrate, migrated, template.start, end),
|
|
@@ -342,20 +342,20 @@ class SelfClosingTagsMigration extends project_paths.TsurgeFunnelMigration {
|
|
|
342
342
|
});
|
|
343
343
|
});
|
|
344
344
|
}
|
|
345
|
-
return
|
|
345
|
+
return run_in_devkit.confirmAsSerializable({ tagReplacements });
|
|
346
346
|
}
|
|
347
347
|
async combine(unitA, unitB) {
|
|
348
348
|
const uniqueReplacements = removeDuplicateReplacements([
|
|
349
349
|
...unitA.tagReplacements,
|
|
350
350
|
...unitB.tagReplacements,
|
|
351
351
|
]);
|
|
352
|
-
return
|
|
352
|
+
return run_in_devkit.confirmAsSerializable({ tagReplacements: uniqueReplacements });
|
|
353
353
|
}
|
|
354
354
|
async globalMeta(combinedData) {
|
|
355
355
|
const globalMeta = {
|
|
356
356
|
tagReplacements: combinedData.tagReplacements,
|
|
357
357
|
};
|
|
358
|
-
return
|
|
358
|
+
return run_in_devkit.confirmAsSerializable(globalMeta);
|
|
359
359
|
}
|
|
360
360
|
async stats(globalMetadata) {
|
|
361
361
|
const touchedFilesCount = globalMetadata.tagReplacements.length;
|
|
@@ -372,7 +372,7 @@ class SelfClosingTagsMigration extends project_paths.TsurgeFunnelMigration {
|
|
|
372
372
|
}
|
|
373
373
|
}
|
|
374
374
|
function prepareTextReplacement(file, replacement, start, end) {
|
|
375
|
-
return new
|
|
375
|
+
return new run_in_devkit.Replacement(file, new run_in_devkit.TextUpdate({
|
|
376
376
|
position: start,
|
|
377
377
|
end: end,
|
|
378
378
|
toInsert: replacement,
|
|
@@ -393,65 +393,35 @@ function removeDuplicateReplacements(replacements) {
|
|
|
393
393
|
|
|
394
394
|
function migrate(options) {
|
|
395
395
|
return async (tree, context) => {
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
396
|
+
await run_in_devkit.runMigrationInDevkit({
|
|
397
|
+
tree,
|
|
398
|
+
getMigration: (fs) => new SelfClosingTagsMigration({
|
|
399
|
+
shouldMigrate: (file) => {
|
|
400
|
+
return (file.rootRelativePath.startsWith(fs.normalize(options.path)) &&
|
|
401
|
+
!/(^|\/)node_modules\//.test(file.rootRelativePath));
|
|
402
|
+
},
|
|
403
|
+
}),
|
|
404
|
+
beforeProgramCreation: (tsconfigPath) => {
|
|
405
|
+
context.logger.info(`Preparing analysis for: ${tsconfigPath}...`);
|
|
406
|
+
},
|
|
407
|
+
beforeUnitAnalysis: (tsconfigPath) => {
|
|
408
|
+
context.logger.info(`Scanning for component tags: ${tsconfigPath}...`);
|
|
409
|
+
},
|
|
410
|
+
afterAllAnalyzed: () => {
|
|
411
|
+
context.logger.info(``);
|
|
412
|
+
context.logger.info(`Processing analysis data between targets...`);
|
|
413
|
+
context.logger.info(``);
|
|
414
|
+
},
|
|
415
|
+
afterAnalysisFailure: () => {
|
|
416
|
+
context.logger.error('Migration failed unexpectedly with no analysis data');
|
|
417
|
+
},
|
|
418
|
+
whenDone: ({ counters }) => {
|
|
419
|
+
const { touchedFilesCount, replacementCount } = counters;
|
|
420
|
+
context.logger.info('');
|
|
421
|
+
context.logger.info(`Successfully migrated to self-closing tags 🎉`);
|
|
422
|
+
context.logger.info(` -> Migrated ${replacementCount} components to self-closing tags in ${touchedFilesCount} component files.`);
|
|
406
423
|
},
|
|
407
424
|
});
|
|
408
|
-
const unitResults = [];
|
|
409
|
-
const programInfos = [...buildPaths, ...testPaths].map((tsconfigPath) => {
|
|
410
|
-
context.logger.info(`Preparing analysis for: ${tsconfigPath}..`);
|
|
411
|
-
const baseInfo = migration.createProgram(tsconfigPath, fs);
|
|
412
|
-
const info = migration.prepareProgram(baseInfo);
|
|
413
|
-
return { info, tsconfigPath };
|
|
414
|
-
});
|
|
415
|
-
// Analyze phase. Treat all projects as compilation units as
|
|
416
|
-
// this allows us to support references between those.
|
|
417
|
-
for (const { info, tsconfigPath } of programInfos) {
|
|
418
|
-
context.logger.info(`Scanning for component tags: ${tsconfigPath}..`);
|
|
419
|
-
unitResults.push(await migration.analyze(info));
|
|
420
|
-
}
|
|
421
|
-
context.logger.info(``);
|
|
422
|
-
context.logger.info(`Processing analysis data between targets..`);
|
|
423
|
-
context.logger.info(``);
|
|
424
|
-
const combined = await project_paths.synchronouslyCombineUnitData(migration, unitResults);
|
|
425
|
-
if (combined === null) {
|
|
426
|
-
context.logger.error('Migration failed unexpectedly with no analysis data');
|
|
427
|
-
return;
|
|
428
|
-
}
|
|
429
|
-
const globalMeta = await migration.globalMeta(combined);
|
|
430
|
-
const replacementsPerFile = new Map();
|
|
431
|
-
for (const { tsconfigPath } of programInfos) {
|
|
432
|
-
context.logger.info(`Migrating: ${tsconfigPath}..`);
|
|
433
|
-
const { replacements } = await migration.migrate(globalMeta);
|
|
434
|
-
const changesPerFile = project_paths.groupReplacementsByFile(replacements);
|
|
435
|
-
for (const [file, changes] of changesPerFile) {
|
|
436
|
-
if (!replacementsPerFile.has(file)) {
|
|
437
|
-
replacementsPerFile.set(file, changes);
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
context.logger.info(`Applying changes..`);
|
|
442
|
-
for (const [file, changes] of replacementsPerFile) {
|
|
443
|
-
const recorder = tree.beginUpdate(file);
|
|
444
|
-
for (const c of changes) {
|
|
445
|
-
recorder
|
|
446
|
-
.remove(c.data.position, c.data.end - c.data.position)
|
|
447
|
-
.insertLeft(c.data.position, c.data.toInsert);
|
|
448
|
-
}
|
|
449
|
-
tree.commitUpdate(recorder);
|
|
450
|
-
}
|
|
451
|
-
const { counters: { touchedFilesCount, replacementCount }, } = await migration.stats(globalMeta);
|
|
452
|
-
context.logger.info('');
|
|
453
|
-
context.logger.info(`Successfully migrated to self-closing tags 🎉`);
|
|
454
|
-
context.logger.info(` -> Migrated ${replacementCount} components to self-closing tags in ${touchedFilesCount} component files.`);
|
|
455
425
|
};
|
|
456
426
|
}
|
|
457
427
|
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v20.0.0-next.
|
|
3
|
+
* @license Angular v20.0.0-next.4
|
|
4
4
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
|
-
var
|
|
10
|
-
var migrate_ts_type_references = require('./migrate_ts_type_references-DtkOnnv0.js');
|
|
9
|
+
var migrate_ts_type_references = require('./migrate_ts_type_references-Be0TNYen.js');
|
|
11
10
|
var ts = require('typescript');
|
|
12
11
|
require('os');
|
|
13
|
-
var checker = require('./checker-
|
|
14
|
-
var
|
|
12
|
+
var checker = require('./checker-k591b6WQ.js');
|
|
13
|
+
var index$1 = require('./index-B4OAlHh8.js');
|
|
15
14
|
require('path');
|
|
16
|
-
var
|
|
17
|
-
var index = require('./index-
|
|
15
|
+
var run_in_devkit = require('./run_in_devkit-CkvEksWP.js');
|
|
16
|
+
var index = require('./index-BhELUmYx.js');
|
|
18
17
|
var assert = require('assert');
|
|
19
|
-
var apply_import_manager = require('./apply_import_manager-
|
|
20
|
-
|
|
18
|
+
var apply_import_manager = require('./apply_import_manager-CeNv8GIG.js');
|
|
19
|
+
require('@angular-devkit/core');
|
|
20
|
+
require('node:path/posix');
|
|
21
21
|
require('./leading_space-D9nQ8UQC.js');
|
|
22
22
|
require('fs');
|
|
23
23
|
require('module');
|
|
24
24
|
require('url');
|
|
25
|
-
require('@angular-devkit/
|
|
26
|
-
require('
|
|
25
|
+
require('@angular-devkit/schematics');
|
|
26
|
+
require('./project_tsconfig_paths-CDVxT6Ov.js');
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* Class that holds information about a given directive and its input fields.
|
|
@@ -102,7 +102,7 @@ function getInputDescriptor(hostOrInfo, node) {
|
|
|
102
102
|
className = node.parent.name?.text ?? '<anonymous>';
|
|
103
103
|
}
|
|
104
104
|
const info = hostOrInfo instanceof MigrationHost ? hostOrInfo.programInfo : hostOrInfo;
|
|
105
|
-
const file =
|
|
105
|
+
const file = run_in_devkit.projectFile(node.getSourceFile(), info);
|
|
106
106
|
// Inputs may be detected in `.d.ts` files. Ensure that if the file IDs
|
|
107
107
|
// match regardless of extension. E.g. `/google3/blaze-out/bin/my_file.ts` should
|
|
108
108
|
// have the same ID as `/google3/my_file.ts`.
|
|
@@ -181,7 +181,7 @@ class KnownInputs {
|
|
|
181
181
|
}
|
|
182
182
|
const directiveInfo = this._classToDirectiveInfo.get(data.node.parent);
|
|
183
183
|
const inputInfo = {
|
|
184
|
-
file:
|
|
184
|
+
file: run_in_devkit.projectFile(data.node.getSourceFile(), this.programInfo),
|
|
185
185
|
metadata: data.metadata,
|
|
186
186
|
descriptor: data.descriptor,
|
|
187
187
|
container: directiveInfo,
|
|
@@ -275,8 +275,8 @@ function prepareAnalysisInfo(userProgram, compiler, programAbsoluteRootPaths) {
|
|
|
275
275
|
}
|
|
276
276
|
const typeChecker = userProgram.getTypeChecker();
|
|
277
277
|
const reflector = new checker.TypeScriptReflectionHost(typeChecker);
|
|
278
|
-
const evaluator = new
|
|
279
|
-
const dtsMetadataReader = new
|
|
278
|
+
const evaluator = new index$1.PartialEvaluator(reflector, typeChecker, null);
|
|
279
|
+
const dtsMetadataReader = new index$1.DtsMetadataReader(typeChecker, reflector);
|
|
280
280
|
return {
|
|
281
281
|
metaRegistry: metaReader,
|
|
282
282
|
dtsMetadataReader,
|
|
@@ -1035,7 +1035,7 @@ function convertToSignalInput(node, { resolvedMetadata: metadata, resolvedType,
|
|
|
1035
1035
|
if (leadingTodoText !== null) {
|
|
1036
1036
|
replacements.push(migrate_ts_type_references.insertPrecedingLine(node, info, '// TODO: Notes from signal input migration:'), ...migrate_ts_type_references.cutStringToLineLimit(leadingTodoText, 70).map((line) => migrate_ts_type_references.insertPrecedingLine(node, info, `// ${line}`)));
|
|
1037
1037
|
}
|
|
1038
|
-
replacements.push(new
|
|
1038
|
+
replacements.push(new run_in_devkit.Replacement(run_in_devkit.projectFile(node.getSourceFile(), info), new run_in_devkit.TextUpdate({
|
|
1039
1039
|
position: node.getStart(),
|
|
1040
1040
|
end: node.getEnd(),
|
|
1041
1041
|
toInsert: newPropertyText,
|
|
@@ -1153,7 +1153,7 @@ function pass7__migrateTemplateReferences(host, references) {
|
|
|
1153
1153
|
const appendText = reference.from.isObjectShorthandExpression
|
|
1154
1154
|
? `: ${reference.from.read.name}()`
|
|
1155
1155
|
: `()`;
|
|
1156
|
-
host.replacements.push(new
|
|
1156
|
+
host.replacements.push(new run_in_devkit.Replacement(reference.from.templateFile, new run_in_devkit.TextUpdate({
|
|
1157
1157
|
position: reference.from.read.sourceSpan.end,
|
|
1158
1158
|
end: reference.from.read.sourceSpan.end,
|
|
1159
1159
|
toInsert: appendText,
|
|
@@ -1193,7 +1193,7 @@ function pass8__migrateHostBindings(host, references, info) {
|
|
|
1193
1193
|
const appendText = reference.from.isObjectShorthandExpression
|
|
1194
1194
|
? `: ${reference.from.read.name}()`
|
|
1195
1195
|
: `()`;
|
|
1196
|
-
host.replacements.push(new
|
|
1196
|
+
host.replacements.push(new run_in_devkit.Replacement(run_in_devkit.projectFile(bindingField.getSourceFile(), info), new run_in_devkit.TextUpdate({ position: readEndPos, end: readEndPos, toInsert: appendText })));
|
|
1197
1197
|
}
|
|
1198
1198
|
}
|
|
1199
1199
|
|
|
@@ -1256,7 +1256,7 @@ function filterIncompatibilitiesForBestEffortMode(knownInputs) {
|
|
|
1256
1256
|
* Tsurge migration for migrating Angular `@Input()` declarations to
|
|
1257
1257
|
* signal inputs, with support for batch execution.
|
|
1258
1258
|
*/
|
|
1259
|
-
class SignalInputMigration extends
|
|
1259
|
+
class SignalInputMigration extends run_in_devkit.TsurgeComplexMigration {
|
|
1260
1260
|
config;
|
|
1261
1261
|
upgradedAnalysisPhaseResults = null;
|
|
1262
1262
|
constructor(config = {}) {
|
|
@@ -1265,7 +1265,7 @@ class SignalInputMigration extends project_paths.TsurgeComplexMigration {
|
|
|
1265
1265
|
}
|
|
1266
1266
|
// Override the default program creation, to add extra flags.
|
|
1267
1267
|
createProgram(tsconfigAbsPath, fs) {
|
|
1268
|
-
return
|
|
1268
|
+
return run_in_devkit.createBaseProgramInfo(tsconfigAbsPath, fs, {
|
|
1269
1269
|
_compilePoisonedComponents: true,
|
|
1270
1270
|
// We want to migrate non-exported classes too.
|
|
1271
1271
|
compileNonExportedClasses: true,
|
|
@@ -1337,13 +1337,13 @@ class SignalInputMigration extends project_paths.TsurgeComplexMigration {
|
|
|
1337
1337
|
knownInputs,
|
|
1338
1338
|
};
|
|
1339
1339
|
}
|
|
1340
|
-
return
|
|
1340
|
+
return run_in_devkit.confirmAsSerializable(unitData);
|
|
1341
1341
|
}
|
|
1342
1342
|
async combine(unitA, unitB) {
|
|
1343
|
-
return
|
|
1343
|
+
return run_in_devkit.confirmAsSerializable(combineCompilationUnitData(unitA, unitB));
|
|
1344
1344
|
}
|
|
1345
1345
|
async globalMeta(combinedData) {
|
|
1346
|
-
return
|
|
1346
|
+
return run_in_devkit.confirmAsSerializable(convertToGlobalMeta(combinedData));
|
|
1347
1347
|
}
|
|
1348
1348
|
async migrate(globalMetadata, info, nonBatchData) {
|
|
1349
1349
|
const knownInputs = nonBatchData?.knownInputs ?? new KnownInputs(info, this.config);
|
|
@@ -1433,82 +1433,54 @@ function createMigrationHost(info, config) {
|
|
|
1433
1433
|
|
|
1434
1434
|
function migrate(options) {
|
|
1435
1435
|
return async (tree, context) => {
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1436
|
+
await run_in_devkit.runMigrationInDevkit({
|
|
1437
|
+
tree,
|
|
1438
|
+
getMigration: (fs) => new SignalInputMigration({
|
|
1439
|
+
bestEffortMode: options.bestEffortMode,
|
|
1440
|
+
insertTodosForSkippedFields: options.insertTodos,
|
|
1441
|
+
shouldMigrateInput: (input) => {
|
|
1442
|
+
return (input.file.rootRelativePath.startsWith(fs.normalize(options.path)) &&
|
|
1443
|
+
!/(^|\/)node_modules\//.test(input.file.rootRelativePath));
|
|
1444
|
+
},
|
|
1445
|
+
}),
|
|
1446
|
+
beforeProgramCreation: (tsconfigPath) => {
|
|
1447
|
+
context.logger.info(`Preparing analysis for: ${tsconfigPath}...`);
|
|
1448
1448
|
},
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
const info = migration.prepareProgram(baseInfo);
|
|
1456
|
-
// Support restricting the analysis to subfolders for larger projects.
|
|
1457
|
-
if (analysisPath !== '/') {
|
|
1458
|
-
info.sourceFiles = info.sourceFiles.filter((sf) => sf.fileName.startsWith(analysisPath));
|
|
1459
|
-
info.fullProgramSourceFiles = info.fullProgramSourceFiles.filter((sf) => sf.fileName.startsWith(analysisPath));
|
|
1460
|
-
}
|
|
1461
|
-
return { info, tsconfigPath };
|
|
1462
|
-
});
|
|
1463
|
-
// Analyze phase. Treat all projects as compilation units as
|
|
1464
|
-
// this allows us to support references between those.
|
|
1465
|
-
for (const { info, tsconfigPath } of programInfos) {
|
|
1466
|
-
context.logger.info(`Scanning for inputs: ${tsconfigPath}..`);
|
|
1467
|
-
unitResults.push(await migration.analyze(info));
|
|
1468
|
-
}
|
|
1469
|
-
context.logger.info(``);
|
|
1470
|
-
context.logger.info(`Processing analysis data between targets..`);
|
|
1471
|
-
context.logger.info(``);
|
|
1472
|
-
const combined = await project_paths.synchronouslyCombineUnitData(migration, unitResults);
|
|
1473
|
-
if (combined === null) {
|
|
1474
|
-
context.logger.error('Migration failed unexpectedly with no analysis data');
|
|
1475
|
-
return;
|
|
1476
|
-
}
|
|
1477
|
-
const globalMeta = await migration.globalMeta(combined);
|
|
1478
|
-
const replacementsPerFile = new Map();
|
|
1479
|
-
for (const { info, tsconfigPath } of programInfos) {
|
|
1480
|
-
context.logger.info(`Migrating: ${tsconfigPath}..`);
|
|
1481
|
-
const { replacements } = await migration.migrate(globalMeta, info);
|
|
1482
|
-
const changesPerFile = project_paths.groupReplacementsByFile(replacements);
|
|
1483
|
-
for (const [file, changes] of changesPerFile) {
|
|
1484
|
-
if (!replacementsPerFile.has(file)) {
|
|
1485
|
-
replacementsPerFile.set(file, changes);
|
|
1449
|
+
afterProgramCreation: (info, fs) => {
|
|
1450
|
+
const analysisPath = fs.resolve(options.analysisDir);
|
|
1451
|
+
// Support restricting the analysis to subfolders for larger projects.
|
|
1452
|
+
if (analysisPath !== '/') {
|
|
1453
|
+
info.sourceFiles = info.sourceFiles.filter((sf) => sf.fileName.startsWith(analysisPath));
|
|
1454
|
+
info.fullProgramSourceFiles = info.fullProgramSourceFiles.filter((sf) => sf.fileName.startsWith(analysisPath));
|
|
1486
1455
|
}
|
|
1487
|
-
}
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1456
|
+
},
|
|
1457
|
+
beforeUnitAnalysis: (tsconfigPath) => {
|
|
1458
|
+
context.logger.info(`Scanning for inputs: ${tsconfigPath}...`);
|
|
1459
|
+
},
|
|
1460
|
+
afterAllAnalyzed: () => {
|
|
1461
|
+
context.logger.info(``);
|
|
1462
|
+
context.logger.info(`Processing analysis data between targets...`);
|
|
1463
|
+
context.logger.info(``);
|
|
1464
|
+
},
|
|
1465
|
+
afterAnalysisFailure: () => {
|
|
1466
|
+
context.logger.error('Migration failed unexpectedly with no analysis data');
|
|
1467
|
+
},
|
|
1468
|
+
whenDone: ({ counters }) => {
|
|
1469
|
+
const { sourceInputs, incompatibleInputs } = counters;
|
|
1470
|
+
const migratedInputs = sourceInputs - incompatibleInputs;
|
|
1471
|
+
context.logger.info('');
|
|
1472
|
+
context.logger.info(`Successfully migrated to signal inputs 🎉`);
|
|
1473
|
+
context.logger.info(` -> Migrated ${migratedInputs}/${sourceInputs} inputs.`);
|
|
1474
|
+
if (incompatibleInputs > 0 && !options.insertTodos) {
|
|
1475
|
+
context.logger.warn(`To see why ${incompatibleInputs} inputs couldn't be migrated`);
|
|
1476
|
+
context.logger.warn(`consider re-running with "--insert-todos" or "--best-effort-mode".`);
|
|
1477
|
+
}
|
|
1478
|
+
if (options.bestEffortMode) {
|
|
1479
|
+
context.logger.warn(`You ran with best effort mode. Manually verify all code ` +
|
|
1480
|
+
`works as intended, and fix where necessary.`);
|
|
1481
|
+
}
|
|
1482
|
+
},
|
|
1483
|
+
});
|
|
1512
1484
|
};
|
|
1513
1485
|
}
|
|
1514
1486
|
|