@angular/core 19.0.0-next.5 → 19.0.0-next.7
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/fesm2022/core.mjs +434 -136
- 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 +199 -94
- 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/{compiler_host-ca7ba733.js → checker-637eee78.js} +322 -426
- package/schematics/bundles/compiler_host-1e62b899.js +320 -0
- package/schematics/bundles/control-flow-migration.js +18 -17
- package/schematics/bundles/explicit-standalone-flag.js +25 -18
- package/schematics/bundles/{imports-4ac08251.js → imports-44987700.js} +1 -1
- package/schematics/bundles/inject-migration.js +10 -29
- package/schematics/bundles/leading_space-6e7a8ec6.js +30 -0
- package/schematics/bundles/{nodes-0e7d45ca.js → nodes-b12e919a.js} +2 -2
- package/schematics/bundles/pending-tasks.js +103 -0
- package/schematics/bundles/program-893e3fe7.js +20819 -0
- package/schematics/bundles/{project_tsconfig_paths-e9ccccbf.js → project_tsconfig_paths-6c9cde78.js} +1 -1
- package/schematics/bundles/route-lazy-loading.js +4 -3
- package/schematics/bundles/signal-input-migration.js +32976 -0
- package/schematics/bundles/standalone-migration.js +47 -20481
- package/schematics/collection.json +6 -0
- package/schematics/migrations.json +5 -0
- package/schematics/ng-generate/signal-input-migration/schema.json +30 -0
- package/testing/index.d.ts +3 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/**
|
|
3
|
+
* @license Angular v19.0.0-next.7
|
|
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.7
|
|
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-44987700.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.7
|
|
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-6c9cde78.js');
|
|
14
|
+
var compiler_host = require('./compiler_host-1e62b899.js');
|
|
15
|
+
var ts = require('typescript');
|
|
16
|
+
var imports = require('./imports-44987700.js');
|
|
17
|
+
require('@angular-devkit/core');
|
|
18
|
+
require('./checker-637eee78.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;
|