@angular/core 20.0.0-next.1 → 20.0.0-next.3

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.
Files changed (54) hide show
  1. package/fesm2022/core.mjs +770 -2144
  2. package/fesm2022/core.mjs.map +1 -1
  3. package/fesm2022/primitives/di.mjs +3 -2
  4. package/fesm2022/primitives/di.mjs.map +1 -1
  5. package/fesm2022/primitives/event-dispatch.mjs +2 -589
  6. package/fesm2022/primitives/event-dispatch.mjs.map +1 -1
  7. package/fesm2022/primitives/signals.mjs +44 -13
  8. package/fesm2022/primitives/signals.mjs.map +1 -1
  9. package/fesm2022/rxjs-interop.mjs +7 -39
  10. package/fesm2022/rxjs-interop.mjs.map +1 -1
  11. package/fesm2022/testing.mjs +116 -143
  12. package/fesm2022/testing.mjs.map +1 -1
  13. package/fesm2022/weak_ref-DrMdAIDh.mjs +12 -0
  14. package/fesm2022/weak_ref-DrMdAIDh.mjs.map +1 -0
  15. package/index.d.ts +14366 -15214
  16. package/navigation_types.d-u4EOrrdZ.d.ts +121 -0
  17. package/package.json +2 -2
  18. package/primitives/di/index.d.ts +66 -59
  19. package/primitives/event-dispatch/index.d.ts +205 -309
  20. package/primitives/signals/index.d.ts +161 -195
  21. package/rxjs-interop/index.d.ts +71 -100
  22. package/schematics/bundles/{apply_import_manager-e2a7fe5b.js → apply_import_manager-BXQEjo09.js} +15 -19
  23. package/schematics/bundles/{checker-af521da6.js → checker-BHb19MHt.js} +3695 -1175
  24. package/schematics/bundles/cleanup-unused-imports.js +56 -89
  25. package/schematics/bundles/{compiler_host-5a29293c.js → compiler_host-Bk3repE2.js} +19 -23
  26. package/schematics/bundles/control-flow-migration.js +81 -38
  27. package/schematics/bundles/{imports-047fbbc8.js → imports-CIX-JgAN.js} +9 -14
  28. package/schematics/bundles/{index-1bef3025.js → index-BL9kAIe5.js} +62 -66
  29. package/schematics/bundles/{program-a449f9bf.js → index-I8VbxQcO.js} +1508 -3178
  30. package/schematics/bundles/inject-flags.js +147 -0
  31. package/schematics/bundles/inject-migration.js +121 -127
  32. package/schematics/bundles/{leading_space-f8944434.js → leading_space-D9nQ8UQC.js} +1 -1
  33. package/schematics/bundles/{migrate_ts_type_references-2a3e9e6b.js → migrate_ts_type_references-KlOTWeDl.js} +121 -126
  34. package/schematics/bundles/{ng_decorators-b0d8b324.js → ng_decorators-DznZ5jMl.js} +4 -8
  35. package/schematics/bundles/{nodes-7758dbf6.js → nodes-B16H9JUd.js} +2 -6
  36. package/schematics/bundles/output-migration.js +94 -128
  37. package/schematics/bundles/{project_tsconfig_paths-b558633b.js → project_tsconfig_paths-CDVxT6Ov.js} +1 -1
  38. package/schematics/bundles/{property_name-ac18447e.js → property_name-BBwFuqMe.js} +3 -7
  39. package/schematics/bundles/route-lazy-loading.js +35 -41
  40. package/schematics/bundles/{project_paths-17dc204d.js → run_in_devkit-C0JPtK2u.js} +283 -216
  41. package/schematics/bundles/self-closing-tags-migration.js +55 -91
  42. package/schematics/bundles/signal-input-migration.js +121 -156
  43. package/schematics/bundles/signal-queries-migration.js +119 -154
  44. package/schematics/bundles/signals.js +12 -14
  45. package/schematics/bundles/standalone-migration.js +180 -200
  46. package/schematics/bundles/symbol-VPWguRxr.js +25 -0
  47. package/schematics/bundles/test-bed-get.js +98 -0
  48. package/schematics/migrations.json +8 -14
  49. package/testing/index.d.ts +289 -471
  50. package/weak_ref.d-ttyj86RV.d.ts +9 -0
  51. package/schematics/bundles/explicit-standalone-flag.js +0 -184
  52. package/schematics/bundles/index-ef1bffbb.js +0 -30
  53. package/schematics/bundles/pending-tasks.js +0 -103
  54. package/schematics/bundles/provide-initializer.js +0 -186
@@ -1,33 +1,27 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v20.0.0-next.1
3
+ * @license Angular v20.0.0-next.3
4
4
  * (c) 2010-2025 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
7
7
  'use strict';
8
8
 
9
- Object.defineProperty(exports, '__esModule', { value: true });
10
-
11
- var schematics = require('@angular-devkit/schematics');
12
- var project_tsconfig_paths = require('./project_tsconfig_paths-b558633b.js');
13
- var project_paths = require('./project_paths-17dc204d.js');
14
- require('os');
15
9
  var ts = require('typescript');
16
- var checker = require('./checker-af521da6.js');
17
- require('./program-a449f9bf.js');
10
+ require('os');
11
+ var checker = require('./checker-BHb19MHt.js');
12
+ require('./index-I8VbxQcO.js');
18
13
  require('path');
19
- var ng_decorators = require('./ng_decorators-b0d8b324.js');
20
- var property_name = require('./property_name-ac18447e.js');
14
+ var run_in_devkit = require('./run_in_devkit-C0JPtK2u.js');
15
+ var ng_decorators = require('./ng_decorators-DznZ5jMl.js');
16
+ var property_name = require('./property_name-BBwFuqMe.js');
21
17
  require('@angular-devkit/core');
22
18
  require('node:path/posix');
23
19
  require('fs');
24
20
  require('module');
25
21
  require('url');
26
- require('./imports-047fbbc8.js');
27
-
28
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
29
-
30
- var ts__default = /*#__PURE__*/_interopDefaultLegacy(ts);
22
+ require('@angular-devkit/schematics');
23
+ require('./project_tsconfig_paths-CDVxT6Ov.js');
24
+ require('./imports-CIX-JgAN.js');
31
25
 
32
26
  /**
33
27
  * Unwraps a given expression TypeScript node. Expressions can be wrapped within multiple
@@ -35,7 +29,7 @@ var ts__default = /*#__PURE__*/_interopDefaultLegacy(ts);
35
29
  * TypeScript node referring to the inner expression. e.g "exp".
36
30
  */
37
31
  function unwrapExpression(node) {
38
- if (ts__default["default"].isParenthesizedExpression(node) || ts__default["default"].isAsExpression(node)) {
32
+ if (ts.isParenthesizedExpression(node) || ts.isAsExpression(node)) {
39
33
  return unwrapExpression(node.expression);
40
34
  }
41
35
  else {
@@ -45,7 +39,7 @@ function unwrapExpression(node) {
45
39
 
46
40
  /** Extracts `@Directive` or `@Component` metadata from the given class. */
47
41
  function extractAngularClassMetadata(typeChecker, node) {
48
- const decorators = ts__default["default"].getDecorators(node);
42
+ const decorators = ts.getDecorators(node);
49
43
  if (!decorators || !decorators.length) {
50
44
  return null;
51
45
  }
@@ -64,7 +58,7 @@ function extractAngularClassMetadata(typeChecker, node) {
64
58
  }
65
59
  const metadata = unwrapExpression(decoratorCall.arguments[0]);
66
60
  // Ensure that the metadata is an object literal expression.
67
- if (!ts__default["default"].isObjectLiteralExpression(metadata)) {
61
+ if (!ts.isObjectLiteralExpression(metadata)) {
68
62
  return null;
69
63
  }
70
64
  return {
@@ -138,10 +132,10 @@ class NgComponentTemplateVisitor {
138
132
  this.typeChecker = typeChecker;
139
133
  }
140
134
  visitNode(node) {
141
- if (node.kind === ts__default["default"].SyntaxKind.ClassDeclaration) {
135
+ if (node.kind === ts.SyntaxKind.ClassDeclaration) {
142
136
  this.visitClassDeclaration(node);
143
137
  }
144
- ts__default["default"].forEachChild(node, (n) => this.visitNode(n));
138
+ ts.forEachChild(node, (n) => this.visitNode(n));
145
139
  }
146
140
  visitClassDeclaration(node) {
147
141
  const metadata = extractAngularClassMetadata(this.typeChecker, node);
@@ -153,13 +147,13 @@ class NgComponentTemplateVisitor {
153
147
  // Walk through all component metadata properties and determine the referenced
154
148
  // HTML templates (either external or inline)
155
149
  metadata.node.properties.forEach((property) => {
156
- if (!ts__default["default"].isPropertyAssignment(property)) {
150
+ if (!ts.isPropertyAssignment(property)) {
157
151
  return;
158
152
  }
159
153
  const propertyName = property_name.getPropertyNameText(property.name);
160
154
  // In case there is an inline template specified, ensure that the value is statically
161
155
  // analyzable by checking if the initializer is a string literal-like node.
162
- if (propertyName === 'template' && ts__default["default"].isStringLiteralLike(property.initializer)) {
156
+ if (propertyName === 'template' && ts.isStringLiteralLike(property.initializer)) {
163
157
  // Need to add an offset of one to the start because the template quotes are
164
158
  // not part of the template content.
165
159
  // The `getText()` method gives us the original raw text.
@@ -177,10 +171,10 @@ class NgComponentTemplateVisitor {
177
171
  content,
178
172
  inline: true,
179
173
  start: start,
180
- getCharacterAndLineOfPosition: (pos) => ts__default["default"].getLineAndCharacterOfPosition(sourceFile, pos + start),
174
+ getCharacterAndLineOfPosition: (pos) => ts.getLineAndCharacterOfPosition(sourceFile, pos + start),
181
175
  });
182
176
  }
183
- if (propertyName === 'templateUrl' && ts__default["default"].isStringLiteralLike(property.initializer)) {
177
+ if (propertyName === 'templateUrl' && ts.isStringLiteralLike(property.initializer)) {
184
178
  const absolutePath = this.fs.resolve(this.fs.dirname(sourceFileName), property.initializer.text);
185
179
  if (!this.fs.exists(absolutePath)) {
186
180
  return;
@@ -303,7 +297,7 @@ class AngularElementCollector extends checker.RecursiveVisitor {
303
297
  }
304
298
  }
305
299
 
306
- class SelfClosingTagsMigration extends project_paths.TsurgeFunnelMigration {
300
+ class SelfClosingTagsMigration extends run_in_devkit.TsurgeFunnelMigration {
307
301
  config;
308
302
  constructor(config = {}) {
309
303
  super();
@@ -314,12 +308,12 @@ class SelfClosingTagsMigration extends project_paths.TsurgeFunnelMigration {
314
308
  const typeChecker = program.getTypeChecker();
315
309
  const tagReplacements = [];
316
310
  for (const sf of sourceFiles) {
317
- ts__default["default"].forEachChild(sf, (node) => {
311
+ ts.forEachChild(sf, (node) => {
318
312
  // Skipping any non component declarations
319
- if (!ts__default["default"].isClassDeclaration(node)) {
313
+ if (!ts.isClassDeclaration(node)) {
320
314
  return;
321
315
  }
322
- const file = project_paths.projectFile(node.getSourceFile(), info);
316
+ const file = run_in_devkit.projectFile(node.getSourceFile(), info);
323
317
  if (this.config.shouldMigrate && this.config.shouldMigrate(file) === false) {
324
318
  return;
325
319
  }
@@ -332,7 +326,7 @@ class SelfClosingTagsMigration extends project_paths.TsurgeFunnelMigration {
332
326
  }
333
327
  const fileToMigrate = template.inline
334
328
  ? file
335
- : project_paths.projectFile(template.filePath, info);
329
+ : run_in_devkit.projectFile(template.filePath, info);
336
330
  const end = template.start + template.content.length;
337
331
  const replacements = [
338
332
  prepareTextReplacement(fileToMigrate, migrated, template.start, end),
@@ -348,20 +342,20 @@ class SelfClosingTagsMigration extends project_paths.TsurgeFunnelMigration {
348
342
  });
349
343
  });
350
344
  }
351
- return project_paths.confirmAsSerializable({ tagReplacements });
345
+ return run_in_devkit.confirmAsSerializable({ tagReplacements });
352
346
  }
353
347
  async combine(unitA, unitB) {
354
348
  const uniqueReplacements = removeDuplicateReplacements([
355
349
  ...unitA.tagReplacements,
356
350
  ...unitB.tagReplacements,
357
351
  ]);
358
- return project_paths.confirmAsSerializable({ tagReplacements: uniqueReplacements });
352
+ return run_in_devkit.confirmAsSerializable({ tagReplacements: uniqueReplacements });
359
353
  }
360
354
  async globalMeta(combinedData) {
361
355
  const globalMeta = {
362
356
  tagReplacements: combinedData.tagReplacements,
363
357
  };
364
- return project_paths.confirmAsSerializable(globalMeta);
358
+ return run_in_devkit.confirmAsSerializable(globalMeta);
365
359
  }
366
360
  async stats(globalMetadata) {
367
361
  const touchedFilesCount = globalMetadata.tagReplacements.length;
@@ -378,7 +372,7 @@ class SelfClosingTagsMigration extends project_paths.TsurgeFunnelMigration {
378
372
  }
379
373
  }
380
374
  function prepareTextReplacement(file, replacement, start, end) {
381
- return new project_paths.Replacement(file, new project_paths.TextUpdate({
375
+ return new run_in_devkit.Replacement(file, new run_in_devkit.TextUpdate({
382
376
  position: start,
383
377
  end: end,
384
378
  toInsert: replacement,
@@ -399,65 +393,35 @@ function removeDuplicateReplacements(replacements) {
399
393
 
400
394
  function migrate(options) {
401
395
  return async (tree, context) => {
402
- const { buildPaths, testPaths } = await project_tsconfig_paths.getProjectTsConfigPaths(tree);
403
- if (!buildPaths.length && !testPaths.length) {
404
- throw new schematics.SchematicsException('Could not find any tsconfig file. Cannot run self-closing tags migration.');
405
- }
406
- const fs = new project_paths.DevkitMigrationFilesystem(tree);
407
- checker.setFileSystem(fs);
408
- const migration = new SelfClosingTagsMigration({
409
- shouldMigrate: (file) => {
410
- return (file.rootRelativePath.startsWith(fs.normalize(options.path)) &&
411
- !/(^|\/)node_modules\//.test(file.rootRelativePath));
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.`);
412
423
  },
413
424
  });
414
- const unitResults = [];
415
- const programInfos = [...buildPaths, ...testPaths].map((tsconfigPath) => {
416
- context.logger.info(`Preparing analysis for: ${tsconfigPath}..`);
417
- const baseInfo = migration.createProgram(tsconfigPath, fs);
418
- const info = migration.prepareProgram(baseInfo);
419
- return { info, tsconfigPath };
420
- });
421
- // Analyze phase. Treat all projects as compilation units as
422
- // this allows us to support references between those.
423
- for (const { info, tsconfigPath } of programInfos) {
424
- context.logger.info(`Scanning for component tags: ${tsconfigPath}..`);
425
- unitResults.push(await migration.analyze(info));
426
- }
427
- context.logger.info(``);
428
- context.logger.info(`Processing analysis data between targets..`);
429
- context.logger.info(``);
430
- const combined = await project_paths.synchronouslyCombineUnitData(migration, unitResults);
431
- if (combined === null) {
432
- context.logger.error('Migration failed unexpectedly with no analysis data');
433
- return;
434
- }
435
- const globalMeta = await migration.globalMeta(combined);
436
- const replacementsPerFile = new Map();
437
- for (const { tsconfigPath } of programInfos) {
438
- context.logger.info(`Migrating: ${tsconfigPath}..`);
439
- const { replacements } = await migration.migrate(globalMeta);
440
- const changesPerFile = project_paths.groupReplacementsByFile(replacements);
441
- for (const [file, changes] of changesPerFile) {
442
- if (!replacementsPerFile.has(file)) {
443
- replacementsPerFile.set(file, changes);
444
- }
445
- }
446
- }
447
- context.logger.info(`Applying changes..`);
448
- for (const [file, changes] of replacementsPerFile) {
449
- const recorder = tree.beginUpdate(file);
450
- for (const c of changes) {
451
- recorder
452
- .remove(c.data.position, c.data.end - c.data.position)
453
- .insertLeft(c.data.position, c.data.toInsert);
454
- }
455
- tree.commitUpdate(recorder);
456
- }
457
- const { counters: { touchedFilesCount, replacementCount }, } = await migration.stats(globalMeta);
458
- context.logger.info('');
459
- context.logger.info(`Successfully migrated to self-closing tags 🎉`);
460
- context.logger.info(` -> Migrated ${replacementCount} components to self-closing tags in ${touchedFilesCount} component files.`);
461
425
  };
462
426
  }
463
427