@angular/core 21.0.0-next.0 → 21.0.0-next.10
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/_attribute-chunk.mjs +12 -0
- package/fesm2022/_attribute-chunk.mjs.map +1 -0
- package/fesm2022/_debug_node-chunk.mjs +18469 -0
- package/fesm2022/_debug_node-chunk.mjs.map +1 -0
- package/fesm2022/_effect-chunk.mjs +423 -0
- package/fesm2022/_effect-chunk.mjs.map +1 -0
- package/fesm2022/_effect-chunk2.mjs +2951 -0
- package/fesm2022/_effect-chunk2.mjs.map +1 -0
- package/fesm2022/_not_found-chunk.mjs +39 -0
- package/fesm2022/_not_found-chunk.mjs.map +1 -0
- package/fesm2022/_resource-chunk.mjs +378 -0
- package/fesm2022/_resource-chunk.mjs.map +1 -0
- package/fesm2022/_untracked-chunk.mjs +96 -0
- package/fesm2022/_untracked-chunk.mjs.map +1 -0
- package/fesm2022/_weak_ref-chunk.mjs +10 -0
- package/fesm2022/_weak_ref-chunk.mjs.map +1 -0
- package/fesm2022/core.mjs +2499 -4185
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/primitives-di.mjs +23 -0
- package/fesm2022/primitives-di.mjs.map +1 -0
- package/fesm2022/primitives-event-dispatch.mjs +788 -0
- package/fesm2022/primitives-event-dispatch.mjs.map +1 -0
- package/fesm2022/primitives-signals.mjs +187 -0
- package/fesm2022/primitives-signals.mjs.map +1 -0
- package/fesm2022/rxjs-interop.mjs +210 -308
- package/fesm2022/rxjs-interop.mjs.map +1 -1
- package/fesm2022/testing.mjs +2309 -3170
- package/fesm2022/testing.mjs.map +1 -1
- package/package.json +18 -12
- package/resources/best-practices.md +56 -0
- package/schematics/bundles/add-bootstrap-context-to-server-main.cjs +117 -0
- package/schematics/bundles/application-config-core.cjs +84 -0
- package/schematics/bundles/{apply_import_manager-DR9xXCle.cjs → apply_import_manager-1Zs_gpB6.cjs} +4 -5
- package/schematics/bundles/bootstrap-options-migration.cjs +598 -0
- package/schematics/bundles/cleanup-unused-imports.cjs +9 -13
- package/schematics/bundles/common-to-standalone-migration.cjs +381 -0
- package/schematics/bundles/{compiler_host-BXBP7CE2.cjs → compiler_host-DBwYMlTo.cjs} +10 -11
- package/schematics/bundles/control-flow-migration.cjs +122 -119
- package/schematics/bundles/{imports-CIX-JgAN.cjs → imports-DP72APSx.cjs} +6 -1
- package/schematics/bundles/{index-CfTQUOiz.cjs → index-B7I9sIUx.cjs} +36 -39
- package/schematics/bundles/inject-migration.cjs +148 -70
- package/schematics/bundles/leading_space-D9nQ8UQC.cjs +1 -1
- package/schematics/bundles/{migrate_ts_type_references-6NtAj-Wk.cjs → migrate_ts_type_references-UGIUl7En.cjs} +500 -24
- package/schematics/bundles/ng_component_template-Dsuq1Lw7.cjs +185 -0
- package/schematics/bundles/{ng_decorators-B5HCqr20.cjs → ng_decorators-DSFlWYQY.cjs} +2 -2
- package/schematics/bundles/ngclass-to-class-migration.cjs +542 -0
- package/schematics/bundles/ngstyle-to-style-migration.cjs +487 -0
- package/schematics/bundles/nodes-B16H9JUd.cjs +1 -1
- package/schematics/bundles/output-migration.cjs +16 -19
- package/schematics/bundles/parse_html-8VLCL37B.cjs +132 -0
- package/schematics/bundles/{project_paths-DcaODbky.cjs → project_paths-DvD50ouC.cjs} +14 -247
- package/schematics/bundles/project_tsconfig_paths-CDVxT6Ov.cjs +90 -0
- package/schematics/bundles/property_name-BBwFuqMe.cjs +1 -1
- package/schematics/bundles/route-lazy-loading.cjs +54 -26
- package/schematics/bundles/router-current-navigation.cjs +7 -18
- package/schematics/bundles/router-last-successful-navigation.cjs +7 -18
- package/schematics/bundles/router-testing-module-migration.cjs +502 -0
- package/schematics/bundles/self-closing-tags-migration.cjs +17 -216
- package/schematics/bundles/signal-input-migration.cjs +93 -29
- package/schematics/bundles/signal-queries-migration.cjs +22 -25
- package/schematics/bundles/signals.cjs +10 -13
- package/schematics/bundles/standalone-migration.cjs +135 -102
- package/schematics/bundles/{symbol-VPWguRxr.cjs → symbol-BObKoqes.cjs} +3 -2
- package/schematics/collection.json +23 -0
- package/schematics/migrations/common-to-standalone-migration/schema.json +14 -0
- package/schematics/migrations/ngclass-to-class-migration/schema.json +20 -0
- package/schematics/migrations/ngstyle-to-style-migration/schema.json +20 -0
- package/schematics/migrations/router-testing-module-migration/schema.json +14 -0
- package/schematics/migrations.json +16 -2
- package/{api.d.d.ts → types/_api-chunk.d.ts} +9 -6
- package/{chrome_dev_tools_performance.d.d.ts → types/_chrome_dev_tools_performance-chunk.d.ts} +26 -31
- package/{discovery.d.d.ts → types/_discovery-chunk.d.ts} +135 -98
- package/{signal.d.d.ts → types/_effect-chunk.d.ts} +14 -5
- package/{event_dispatcher.d.d.ts → types/_event_dispatcher-chunk.d.ts} +2 -2
- package/{graph.d.d.ts → types/_formatter-chunk.d.ts} +40 -7
- package/{weak_ref.d.d.ts → types/_weak_ref-chunk.d.ts} +2 -2
- package/{index.d.ts → types/core.d.ts} +233 -305
- package/{primitives/di/index.d.ts → types/primitives-di.d.ts} +2 -2
- package/{primitives/event-dispatch/index.d.ts → types/primitives-event-dispatch.d.ts} +4 -4
- package/{primitives/signals/index.d.ts → types/primitives-signals.d.ts} +7 -8
- package/{rxjs-interop/index.d.ts → types/rxjs-interop.d.ts} +8 -6
- package/{testing/index.d.ts → types/testing.d.ts} +7 -7
- package/fesm2022/attribute.mjs +0 -24
- package/fesm2022/attribute.mjs.map +0 -1
- package/fesm2022/debug_node.mjs +0 -31833
- package/fesm2022/debug_node.mjs.map +0 -1
- package/fesm2022/not_found.mjs +0 -56
- package/fesm2022/not_found.mjs.map +0 -1
- package/fesm2022/primitives/di.mjs +0 -23
- package/fesm2022/primitives/di.mjs.map +0 -1
- package/fesm2022/primitives/event-dispatch.mjs +0 -1622
- package/fesm2022/primitives/event-dispatch.mjs.map +0 -1
- package/fesm2022/primitives/signals.mjs +0 -89
- package/fesm2022/primitives/signals.mjs.map +0 -1
- package/fesm2022/resource.mjs +0 -633
- package/fesm2022/resource.mjs.map +0 -1
- package/fesm2022/root_effect_scheduler.mjs +0 -4007
- package/fesm2022/root_effect_scheduler.mjs.map +0 -1
- package/fesm2022/signal.mjs +0 -560
- package/fesm2022/signal.mjs.map +0 -1
- package/fesm2022/untracked.mjs +0 -117
- package/fesm2022/untracked.mjs.map +0 -1
- package/fesm2022/weak_ref.mjs +0 -12
- package/fesm2022/weak_ref.mjs.map +0 -1
- package/schematics/bundles/index-esqfDjNB.cjs +0 -22074
- package/schematics/bundles/project_tsconfig_paths-CS-eSeHC.cjs +0 -51062
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/**
|
|
3
|
+
* @license Angular v21.0.0-next.10
|
|
4
|
+
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
|
+
* License: MIT
|
|
6
|
+
*/
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
var ts = require('typescript');
|
|
10
|
+
var compilerCli = require('@angular/compiler-cli');
|
|
11
|
+
var ng_decorators = require('./ng_decorators-DSFlWYQY.cjs');
|
|
12
|
+
var property_name = require('./property_name-BBwFuqMe.cjs');
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Unwraps a given expression TypeScript node. Expressions can be wrapped within multiple
|
|
16
|
+
* parentheses or as expression. e.g. "(((({exp}))))()". The function should return the
|
|
17
|
+
* TypeScript node referring to the inner expression. e.g "exp".
|
|
18
|
+
*/
|
|
19
|
+
function unwrapExpression(node) {
|
|
20
|
+
if (ts.isParenthesizedExpression(node) || ts.isAsExpression(node)) {
|
|
21
|
+
return unwrapExpression(node.expression);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
return node;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Extracts `@Directive` or `@Component` metadata from the given class. */
|
|
29
|
+
function extractAngularClassMetadata(typeChecker, node) {
|
|
30
|
+
const decorators = ts.getDecorators(node);
|
|
31
|
+
if (!decorators || !decorators.length) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
const ngDecorators = ng_decorators.getAngularDecorators(typeChecker, decorators);
|
|
35
|
+
const componentDecorator = ngDecorators.find((dec) => dec.name === 'Component');
|
|
36
|
+
const directiveDecorator = ngDecorators.find((dec) => dec.name === 'Directive');
|
|
37
|
+
const decorator = componentDecorator ?? directiveDecorator;
|
|
38
|
+
// In case no decorator could be found on the current class, skip.
|
|
39
|
+
if (!decorator) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
const decoratorCall = decorator.node.expression;
|
|
43
|
+
// In case the decorator call is not valid, skip this class declaration.
|
|
44
|
+
if (decoratorCall.arguments.length !== 1) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
const metadata = unwrapExpression(decoratorCall.arguments[0]);
|
|
48
|
+
// Ensure that the metadata is an object literal expression.
|
|
49
|
+
if (!ts.isObjectLiteralExpression(metadata)) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
type: componentDecorator ? 'component' : 'directive',
|
|
54
|
+
node: metadata,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const LF_CHAR = 10;
|
|
59
|
+
const CR_CHAR = 13;
|
|
60
|
+
const LINE_SEP_CHAR = 8232;
|
|
61
|
+
const PARAGRAPH_CHAR = 8233;
|
|
62
|
+
/** Gets the line and character for the given position from the line starts map. */
|
|
63
|
+
function getLineAndCharacterFromPosition(lineStartsMap, position) {
|
|
64
|
+
const lineIndex = findClosestLineStartPosition(lineStartsMap, position);
|
|
65
|
+
return { character: position - lineStartsMap[lineIndex], line: lineIndex };
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Computes the line start map of the given text. This can be used in order to
|
|
69
|
+
* retrieve the line and character of a given text position index.
|
|
70
|
+
*/
|
|
71
|
+
function computeLineStartsMap(text) {
|
|
72
|
+
const result = [0];
|
|
73
|
+
let pos = 0;
|
|
74
|
+
while (pos < text.length) {
|
|
75
|
+
const char = text.charCodeAt(pos++);
|
|
76
|
+
// Handles the "CRLF" line break. In that case we peek the character
|
|
77
|
+
// after the "CR" and check if it is a line feed.
|
|
78
|
+
if (char === CR_CHAR) {
|
|
79
|
+
if (text.charCodeAt(pos) === LF_CHAR) {
|
|
80
|
+
pos++;
|
|
81
|
+
}
|
|
82
|
+
result.push(pos);
|
|
83
|
+
}
|
|
84
|
+
else if (char === LF_CHAR || char === LINE_SEP_CHAR || char === PARAGRAPH_CHAR) {
|
|
85
|
+
result.push(pos);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
result.push(pos);
|
|
89
|
+
return result;
|
|
90
|
+
}
|
|
91
|
+
/** Finds the closest line start for the given position. */
|
|
92
|
+
function findClosestLineStartPosition(linesMap, position, low = 0, high = linesMap.length - 1) {
|
|
93
|
+
while (low <= high) {
|
|
94
|
+
const pivotIdx = Math.floor((low + high) / 2);
|
|
95
|
+
const pivotEl = linesMap[pivotIdx];
|
|
96
|
+
if (pivotEl === position) {
|
|
97
|
+
return pivotIdx;
|
|
98
|
+
}
|
|
99
|
+
else if (position > pivotEl) {
|
|
100
|
+
low = pivotIdx + 1;
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
high = pivotIdx - 1;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
// In case there was no exact match, return the closest "lower" line index. We also
|
|
107
|
+
// subtract the index by one because want the index of the previous line start.
|
|
108
|
+
return low - 1;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Visitor that can be used to determine Angular templates referenced within given
|
|
113
|
+
* TypeScript source files (inline templates or external referenced templates)
|
|
114
|
+
*/
|
|
115
|
+
class NgComponentTemplateVisitor {
|
|
116
|
+
typeChecker;
|
|
117
|
+
resolvedTemplates = [];
|
|
118
|
+
fs = compilerCli.getFileSystem();
|
|
119
|
+
constructor(typeChecker) {
|
|
120
|
+
this.typeChecker = typeChecker;
|
|
121
|
+
}
|
|
122
|
+
visitNode(node) {
|
|
123
|
+
if (node.kind === ts.SyntaxKind.ClassDeclaration) {
|
|
124
|
+
this.visitClassDeclaration(node);
|
|
125
|
+
}
|
|
126
|
+
ts.forEachChild(node, (n) => this.visitNode(n));
|
|
127
|
+
}
|
|
128
|
+
visitClassDeclaration(node) {
|
|
129
|
+
const metadata = extractAngularClassMetadata(this.typeChecker, node);
|
|
130
|
+
if (metadata === null || metadata.type !== 'component') {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
const sourceFile = node.getSourceFile();
|
|
134
|
+
const sourceFileName = sourceFile.fileName;
|
|
135
|
+
// Walk through all component metadata properties and determine the referenced
|
|
136
|
+
// HTML templates (either external or inline)
|
|
137
|
+
metadata.node.properties.forEach((property) => {
|
|
138
|
+
if (!ts.isPropertyAssignment(property)) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
const propertyName = property_name.getPropertyNameText(property.name);
|
|
142
|
+
// In case there is an inline template specified, ensure that the value is statically
|
|
143
|
+
// analyzable by checking if the initializer is a string literal-like node.
|
|
144
|
+
if (propertyName === 'template' && ts.isStringLiteralLike(property.initializer)) {
|
|
145
|
+
// Need to add an offset of one to the start because the template quotes are
|
|
146
|
+
// not part of the template content.
|
|
147
|
+
// The `getText()` method gives us the original raw text.
|
|
148
|
+
// We could have used the `text` property, but if the template is defined as a backtick
|
|
149
|
+
// string then the `text` property contains a "cooked" version of the string. Such cooked
|
|
150
|
+
// strings will have converted CRLF characters to only LF. This messes up string
|
|
151
|
+
// replacements in template migrations.
|
|
152
|
+
// The raw text returned by `getText()` includes the enclosing quotes so we change the
|
|
153
|
+
// `content` and `start` values accordingly.
|
|
154
|
+
const content = property.initializer.getText().slice(1, -1);
|
|
155
|
+
const start = property.initializer.getStart() + 1;
|
|
156
|
+
this.resolvedTemplates.push({
|
|
157
|
+
filePath: sourceFileName,
|
|
158
|
+
container: node,
|
|
159
|
+
content,
|
|
160
|
+
inline: true,
|
|
161
|
+
start: start,
|
|
162
|
+
getCharacterAndLineOfPosition: (pos) => ts.getLineAndCharacterOfPosition(sourceFile, pos + start),
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
if (propertyName === 'templateUrl' && ts.isStringLiteralLike(property.initializer)) {
|
|
166
|
+
const absolutePath = this.fs.resolve(this.fs.dirname(sourceFileName), property.initializer.text);
|
|
167
|
+
if (!this.fs.exists(absolutePath)) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
const fileContent = this.fs.readFile(absolutePath);
|
|
171
|
+
const lineStartsMap = computeLineStartsMap(fileContent);
|
|
172
|
+
this.resolvedTemplates.push({
|
|
173
|
+
filePath: absolutePath,
|
|
174
|
+
container: node,
|
|
175
|
+
content: fileContent,
|
|
176
|
+
inline: false,
|
|
177
|
+
start: 0,
|
|
178
|
+
getCharacterAndLineOfPosition: (pos) => getLineAndCharacterFromPosition(lineStartsMap, pos),
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
exports.NgComponentTemplateVisitor = NgComponentTemplateVisitor;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v21.0.0-next.
|
|
3
|
+
* @license Angular v21.0.0-next.10
|
|
4
4
|
* (c) 2010-2025 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-DP72APSx.cjs');
|
|
11
11
|
|
|
12
12
|
function getCallDecoratorImport(typeChecker, decorator) {
|
|
13
13
|
// Note that this does not cover the edge case where decorators are called from
|