@angular/core 19.0.0-next.6 → 19.0.0-next.8
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/LICENSE +21 -0
- package/fesm2022/core.mjs +648 -273
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/primitives/event-dispatch.mjs +1 -1
- package/fesm2022/primitives/event-dispatch.mjs.map +1 -1
- package/fesm2022/primitives/signals.mjs +1 -1
- package/fesm2022/primitives/signals.mjs.map +1 -1
- package/fesm2022/rxjs-interop.mjs +25 -4
- package/fesm2022/rxjs-interop.mjs.map +1 -1
- package/fesm2022/testing.mjs +12 -11
- package/fesm2022/testing.mjs.map +1 -1
- package/index.d.ts +232 -148
- package/package.json +1 -1
- package/primitives/event-dispatch/index.d.ts +1 -1
- package/primitives/signals/index.d.ts +1 -1
- package/rxjs-interop/index.d.ts +3 -1
- package/schematics/bundles/{checker-dcf9a14e.js → checker-e68dd7ce.js} +34 -13
- package/schematics/bundles/{compiler_host-6026cdf8.js → compiler_host-9a4d0c2b.js} +2 -2
- package/schematics/bundles/control-flow-migration.js +3 -3
- package/schematics/bundles/explicit-standalone-flag.js +5 -5
- package/schematics/bundles/group_replacements-472b2387.js +31445 -0
- package/schematics/bundles/{imports-44987700.js → imports-4ac08251.js} +1 -1
- package/schematics/bundles/inject-migration.js +28 -32
- package/schematics/bundles/leading_space-d190b83b.js +30 -0
- package/schematics/bundles/{nodes-b12e919a.js → nodes-0e7d45ca.js} +2 -2
- package/schematics/bundles/pending-tasks.js +103 -0
- package/schematics/bundles/{program-4dc8c0fa.js → program-105283c5.js} +1865 -1489
- package/schematics/bundles/{project_tsconfig_paths-6c9cde78.js → project_tsconfig_paths-e9ccccbf.js} +1 -1
- package/schematics/bundles/route-lazy-loading.js +4 -4
- package/schematics/bundles/signal-input-migration.js +706 -31790
- package/schematics/bundles/signal-queries-migration.js +905 -0
- package/schematics/bundles/standalone-migration.js +12 -12
- package/schematics/collection.json +6 -0
- package/schematics/migrations.json +5 -0
- package/schematics/ng-generate/signal-input-migration/schema.json +5 -0
- package/schematics/ng-generate/signal-queries-migration/schema.json +19 -0
- package/testing/index.d.ts +3 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v19.0.0-next.
|
|
3
|
+
* @license Angular v19.0.0-next.8
|
|
4
4
|
* (c) 2010-2024 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -10,11 +10,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
10
10
|
|
|
11
11
|
var schematics = require('@angular-devkit/schematics');
|
|
12
12
|
var p = require('path');
|
|
13
|
-
var compiler_host = require('./compiler_host-
|
|
13
|
+
var compiler_host = require('./compiler_host-9a4d0c2b.js');
|
|
14
14
|
var ts = require('typescript');
|
|
15
|
-
var nodes = require('./nodes-
|
|
16
|
-
var imports = require('./imports-
|
|
17
|
-
require('./
|
|
15
|
+
var nodes = require('./nodes-0e7d45ca.js');
|
|
16
|
+
var imports = require('./imports-4ac08251.js');
|
|
17
|
+
var leading_space = require('./leading_space-d190b83b.js');
|
|
18
|
+
require('./checker-e68dd7ce.js');
|
|
18
19
|
require('os');
|
|
19
20
|
require('fs');
|
|
20
21
|
require('module');
|
|
@@ -29,7 +30,7 @@ var ts__default = /*#__PURE__*/_interopDefaultLegacy(ts);
|
|
|
29
30
|
* Copyright Google LLC All Rights Reserved.
|
|
30
31
|
*
|
|
31
32
|
* Use of this source code is governed by an MIT-style license that can be
|
|
32
|
-
* found in the LICENSE file at https://angular.
|
|
33
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
33
34
|
*/
|
|
34
35
|
/** Names of decorators that enable DI on a class declaration. */
|
|
35
36
|
const DECORATORS_SUPPORTING_DI = new Set([
|
|
@@ -206,27 +207,6 @@ function getSuperParameters(declaration, superCall, localTypeChecker) {
|
|
|
206
207
|
});
|
|
207
208
|
return usedParams;
|
|
208
209
|
}
|
|
209
|
-
/**
|
|
210
|
-
* Gets the indentation text of a node. Can be used to
|
|
211
|
-
* output text with the same level of indentation.
|
|
212
|
-
* @param node Node for which to get the indentation level.
|
|
213
|
-
*/
|
|
214
|
-
function getNodeIndentation(node) {
|
|
215
|
-
const fullText = node.getFullText();
|
|
216
|
-
const end = fullText.indexOf(node.getText());
|
|
217
|
-
let result = '';
|
|
218
|
-
for (let i = end - 1; i > -1; i--) {
|
|
219
|
-
// Note: LF line endings are `\n` while CRLF are `\r\n`. This logic should cover both, because
|
|
220
|
-
// we start from the beginning of the node and go backwards so will always hit `\n` first.
|
|
221
|
-
if (fullText[i] !== '\n') {
|
|
222
|
-
result = fullText[i] + result;
|
|
223
|
-
}
|
|
224
|
-
else {
|
|
225
|
-
break;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
return result;
|
|
229
|
-
}
|
|
230
210
|
/** Checks whether a parameter node declares a property on its class. */
|
|
231
211
|
function parameterDeclaresProperty(node) {
|
|
232
212
|
return !!node.modifiers?.some(({ kind }) => kind === ts__default["default"].SyntaxKind.PublicKeyword ||
|
|
@@ -284,7 +264,7 @@ function findSuperCall(root) {
|
|
|
284
264
|
* Copyright Google LLC All Rights Reserved.
|
|
285
265
|
*
|
|
286
266
|
* Use of this source code is governed by an MIT-style license that can be
|
|
287
|
-
* found in the LICENSE file at https://angular.
|
|
267
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
288
268
|
*/
|
|
289
269
|
/**
|
|
290
270
|
* Finds class property declarations without initializers whose constructor-based initialization
|
|
@@ -511,12 +491,12 @@ function migrateClass(node, constructor, superCall, options, removedStatements,
|
|
|
511
491
|
const superParameters = superCall
|
|
512
492
|
? getSuperParameters(constructor, superCall, localTypeChecker)
|
|
513
493
|
: null;
|
|
514
|
-
const memberIndentation =
|
|
494
|
+
const memberIndentation = leading_space.getLeadingLineWhitespaceOfNode(node.members[0]);
|
|
515
495
|
const removedStatementCount = removedStatements?.size || 0;
|
|
516
496
|
const innerReference = superCall ||
|
|
517
497
|
constructor.body?.statements.find((statement) => !removedStatements?.has(statement)) ||
|
|
518
498
|
constructor;
|
|
519
|
-
const innerIndentation =
|
|
499
|
+
const innerIndentation = leading_space.getLeadingLineWhitespaceOfNode(innerReference);
|
|
520
500
|
const propsToAdd = [];
|
|
521
501
|
const prependToConstructor = [];
|
|
522
502
|
const afterSuper = [];
|
|
@@ -534,8 +514,7 @@ function migrateClass(node, constructor, superCall, options, removedStatements,
|
|
|
534
514
|
tracker.replaceText(sourceFile, member.getFullStart(), member.getFullWidth(), '');
|
|
535
515
|
}
|
|
536
516
|
}
|
|
537
|
-
if (
|
|
538
|
-
(!constructor.body || constructor.body.statements.length - removedStatementCount === 0)) {
|
|
517
|
+
if (canRemoveConstructor(options, constructor, removedStatementCount, superCall)) {
|
|
539
518
|
// Drop the constructor if it was empty.
|
|
540
519
|
removedMembers.add(constructor);
|
|
541
520
|
tracker.replaceText(sourceFile, constructor.getFullStart(), constructor.getFullWidth(), '');
|
|
@@ -881,6 +860,23 @@ function cloneName(node) {
|
|
|
881
860
|
return node;
|
|
882
861
|
}
|
|
883
862
|
}
|
|
863
|
+
/**
|
|
864
|
+
* Determines whether it's safe to delete a class constructor.
|
|
865
|
+
* @param options Options used to configure the migration.
|
|
866
|
+
* @param constructor Node representing the constructor.
|
|
867
|
+
* @param removedStatementCount Number of statements that were removed by the migration.
|
|
868
|
+
* @param superCall Node representing the `super()` call within the constructor.
|
|
869
|
+
*/
|
|
870
|
+
function canRemoveConstructor(options, constructor, removedStatementCount, superCall) {
|
|
871
|
+
if (options.backwardsCompatibleConstructors) {
|
|
872
|
+
return false;
|
|
873
|
+
}
|
|
874
|
+
const statementCount = constructor.body
|
|
875
|
+
? constructor.body.statements.length - removedStatementCount
|
|
876
|
+
: 0;
|
|
877
|
+
return (statementCount === 0 ||
|
|
878
|
+
(statementCount === 1 && superCall !== null && superCall.arguments.length === 0));
|
|
879
|
+
}
|
|
884
880
|
|
|
885
881
|
function migrate(options) {
|
|
886
882
|
return async (tree) => {
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/**
|
|
3
|
+
* @license Angular v19.0.0-next.8
|
|
4
|
+
* (c) 2010-2024 Google LLC. https://angular.io/
|
|
5
|
+
* License: MIT
|
|
6
|
+
*/
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Gets the leading line whitespace of a given node.
|
|
11
|
+
*
|
|
12
|
+
* Useful for inserting e.g. TODOs without breaking indentation.
|
|
13
|
+
*/
|
|
14
|
+
function getLeadingLineWhitespaceOfNode(node) {
|
|
15
|
+
const fullText = node.getFullText().substring(0, node.getStart() - node.getFullStart());
|
|
16
|
+
let result = '';
|
|
17
|
+
for (let i = fullText.length - 1; i > -1; i--) {
|
|
18
|
+
// Note: LF line endings are `\n` while CRLF are `\r\n`. This logic should cover both, because
|
|
19
|
+
// we start from the beginning of the node and go backwards so will always hit `\n` first.
|
|
20
|
+
if (fullText[i] !== '\n') {
|
|
21
|
+
result = fullText[i] + result;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return result;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
exports.getLeadingLineWhitespaceOfNode = getLeadingLineWhitespaceOfNode;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v19.0.0-next.
|
|
3
|
+
* @license Angular v19.0.0-next.8
|
|
4
4
|
* (c) 2010-2024 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
9
|
var ts = require('typescript');
|
|
10
|
-
var imports = require('./imports-
|
|
10
|
+
var imports = require('./imports-4ac08251.js');
|
|
11
11
|
|
|
12
12
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
13
13
|
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/**
|
|
3
|
+
* @license Angular v19.0.0-next.8
|
|
4
|
+
* (c) 2010-2024 Google LLC. https://angular.io/
|
|
5
|
+
* License: MIT
|
|
6
|
+
*/
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
10
|
+
|
|
11
|
+
var schematics = require('@angular-devkit/schematics');
|
|
12
|
+
var p = require('path');
|
|
13
|
+
var project_tsconfig_paths = require('./project_tsconfig_paths-e9ccccbf.js');
|
|
14
|
+
var compiler_host = require('./compiler_host-9a4d0c2b.js');
|
|
15
|
+
var ts = require('typescript');
|
|
16
|
+
var imports = require('./imports-4ac08251.js');
|
|
17
|
+
require('@angular-devkit/core');
|
|
18
|
+
require('./checker-e68dd7ce.js');
|
|
19
|
+
require('os');
|
|
20
|
+
require('fs');
|
|
21
|
+
require('module');
|
|
22
|
+
require('url');
|
|
23
|
+
|
|
24
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
25
|
+
|
|
26
|
+
var ts__default = /*#__PURE__*/_interopDefaultLegacy(ts);
|
|
27
|
+
|
|
28
|
+
const CORE = '@angular/core';
|
|
29
|
+
const EXPERIMENTAL_PENDING_TASKS = 'ExperimentalPendingTasks';
|
|
30
|
+
function migrateFile(sourceFile, typeChecker, rewriteFn) {
|
|
31
|
+
const changeTracker = new compiler_host.ChangeTracker(ts__default["default"].createPrinter());
|
|
32
|
+
// Check if there are any imports of the `AfterRenderPhase` enum.
|
|
33
|
+
const coreImports = imports.getNamedImports(sourceFile, CORE);
|
|
34
|
+
if (!coreImports) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const importSpecifier = imports.getImportSpecifier(sourceFile, CORE, EXPERIMENTAL_PENDING_TASKS);
|
|
38
|
+
if (!importSpecifier) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const nodeToReplace = importSpecifier.propertyName ?? importSpecifier.name;
|
|
42
|
+
if (!ts__default["default"].isIdentifier(nodeToReplace)) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
changeTracker.replaceNode(nodeToReplace, ts__default["default"].factory.createIdentifier('PendingTasks'));
|
|
46
|
+
ts__default["default"].forEachChild(sourceFile, function visit(node) {
|
|
47
|
+
// import handled above
|
|
48
|
+
if (ts__default["default"].isImportDeclaration(node)) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (ts__default["default"].isIdentifier(node) &&
|
|
52
|
+
node.text === EXPERIMENTAL_PENDING_TASKS &&
|
|
53
|
+
imports.getImportOfIdentifier(typeChecker, node)?.name === EXPERIMENTAL_PENDING_TASKS) {
|
|
54
|
+
changeTracker.replaceNode(node, ts__default["default"].factory.createIdentifier('PendingTasks'));
|
|
55
|
+
}
|
|
56
|
+
ts__default["default"].forEachChild(node, visit);
|
|
57
|
+
});
|
|
58
|
+
// Write the changes.
|
|
59
|
+
for (const changesInFile of changeTracker.recordChanges().values()) {
|
|
60
|
+
for (const change of changesInFile) {
|
|
61
|
+
rewriteFn(change.start, change.removeLength ?? 0, change.text);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function migrate() {
|
|
67
|
+
return async (tree) => {
|
|
68
|
+
const { buildPaths, testPaths } = await project_tsconfig_paths.getProjectTsConfigPaths(tree);
|
|
69
|
+
const basePath = process.cwd();
|
|
70
|
+
const allPaths = [...buildPaths, ...testPaths];
|
|
71
|
+
if (!allPaths.length) {
|
|
72
|
+
throw new schematics.SchematicsException('Could not find any tsconfig file. Cannot run the afterRender phase migration.');
|
|
73
|
+
}
|
|
74
|
+
for (const tsconfigPath of allPaths) {
|
|
75
|
+
runMigration(tree, tsconfigPath, basePath);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
function runMigration(tree, tsconfigPath, basePath) {
|
|
80
|
+
const program = compiler_host.createMigrationProgram(tree, tsconfigPath, basePath);
|
|
81
|
+
const sourceFiles = program
|
|
82
|
+
.getSourceFiles()
|
|
83
|
+
.filter((sourceFile) => compiler_host.canMigrateFile(basePath, sourceFile, program));
|
|
84
|
+
for (const sourceFile of sourceFiles) {
|
|
85
|
+
let update = null;
|
|
86
|
+
const rewriter = (startPos, width, text) => {
|
|
87
|
+
if (update === null) {
|
|
88
|
+
// Lazily initialize update, because most files will not require migration.
|
|
89
|
+
update = tree.beginUpdate(p.relative(basePath, sourceFile.fileName));
|
|
90
|
+
}
|
|
91
|
+
update.remove(startPos, width);
|
|
92
|
+
if (text !== null) {
|
|
93
|
+
update.insertLeft(startPos, text);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
migrateFile(sourceFile, program.getTypeChecker(), rewriter);
|
|
97
|
+
if (update !== null) {
|
|
98
|
+
tree.commitUpdate(update);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
exports.migrate = migrate;
|