@angular/core 19.0.0-next.8 → 19.0.0-rc.0

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 (42) hide show
  1. package/fesm2022/core.mjs +21591 -19590
  2. package/fesm2022/core.mjs.map +1 -1
  3. package/fesm2022/primitives/event-dispatch.mjs +71 -47
  4. package/fesm2022/primitives/event-dispatch.mjs.map +1 -1
  5. package/fesm2022/primitives/signals.mjs +8 -6
  6. package/fesm2022/primitives/signals.mjs.map +1 -1
  7. package/fesm2022/rxjs-interop.mjs +90 -10
  8. package/fesm2022/rxjs-interop.mjs.map +1 -1
  9. package/fesm2022/testing.mjs +177 -114
  10. package/fesm2022/testing.mjs.map +1 -1
  11. package/index.d.ts +591 -101
  12. package/package.json +1 -1
  13. package/primitives/event-dispatch/index.d.ts +7 -4
  14. package/primitives/signals/index.d.ts +7 -1
  15. package/rxjs-interop/index.d.ts +35 -4
  16. package/schematics/bundles/{checker-e68dd7ce.js → checker-2451e7c5.js} +2464 -1132
  17. package/schematics/bundles/{group_replacements-472b2387.js → combine_units-c52492ab.js} +1964 -2207
  18. package/schematics/bundles/{compiler_host-9a4d0c2b.js → compiler_host-f54f8309.js} +2 -2
  19. package/schematics/bundles/control-flow-migration.js +3 -3
  20. package/schematics/bundles/explicit-standalone-flag.js +31 -11
  21. package/schematics/bundles/{imports-4ac08251.js → imports-44987700.js} +1 -1
  22. package/schematics/bundles/inject-migration.js +122 -48
  23. package/schematics/bundles/{leading_space-d190b83b.js → leading_space-6e7a8ec6.js} +1 -1
  24. package/schematics/bundles/migrate_ts_type_references-ab18a7c3.js +1463 -0
  25. package/schematics/bundles/{nodes-0e7d45ca.js → ng_decorators-3ad437d2.js} +2 -15
  26. package/schematics/bundles/nodes-ffdce442.js +27 -0
  27. package/schematics/bundles/output-migration.js +7450 -0
  28. package/schematics/bundles/pending-tasks.js +5 -5
  29. package/schematics/bundles/{program-105283c5.js → program-58424797.js} +1359 -455
  30. package/schematics/bundles/{project_tsconfig_paths-e9ccccbf.js → project_tsconfig_paths-6c9cde78.js} +1 -1
  31. package/schematics/bundles/provide-initializer.js +190 -0
  32. package/schematics/bundles/route-lazy-loading.js +4 -4
  33. package/schematics/bundles/signal-input-migration.js +197 -349
  34. package/schematics/bundles/signal-queries-migration.js +462 -185
  35. package/schematics/bundles/signals.js +54 -0
  36. package/schematics/bundles/standalone-migration.js +38 -20
  37. package/schematics/collection.json +11 -0
  38. package/schematics/migrations.json +7 -1
  39. package/schematics/ng-generate/output-migration/schema.json +19 -0
  40. package/schematics/ng-generate/signal-queries-migration/schema.json +11 -0
  41. package/schematics/ng-generate/signals/schema.json +65 -0
  42. package/testing/index.d.ts +3 -1
@@ -0,0 +1,54 @@
1
+ 'use strict';
2
+ /**
3
+ * @license Angular v19.0.0-rc.0
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 signalQueriesMigration = require('./signal-queries-migration.js');
13
+ var signalInputMigration = require('./signal-input-migration.js');
14
+ var outputMigration = require('./output-migration.js');
15
+ require('./project_tsconfig_paths-6c9cde78.js');
16
+ require('@angular-devkit/core');
17
+ require('./combine_units-c52492ab.js');
18
+ require('node:path/posix');
19
+ require('os');
20
+ require('typescript');
21
+ require('./checker-2451e7c5.js');
22
+ require('fs');
23
+ require('module');
24
+ require('path');
25
+ require('url');
26
+ require('./program-58424797.js');
27
+ require('assert');
28
+ require('./migrate_ts_type_references-ab18a7c3.js');
29
+ require('./leading_space-6e7a8ec6.js');
30
+
31
+ function migrate(options) {
32
+ // The migrations are independent so we can run them in any order, but we sort them here
33
+ // alphabetically so we get a consistent execution order in case of issue reports.
34
+ const migrations = options.migrations.slice().sort();
35
+ const rules = [];
36
+ for (const migration of migrations) {
37
+ switch (migration) {
38
+ case "inputs" /* SupportedMigrations.inputs */:
39
+ rules.push(signalInputMigration.migrate(options));
40
+ break;
41
+ case "outputs" /* SupportedMigrations.outputs */:
42
+ rules.push(outputMigration.migrate(options));
43
+ break;
44
+ case "queries" /* SupportedMigrations.queries */:
45
+ rules.push(signalQueriesMigration.migrate(options));
46
+ break;
47
+ default:
48
+ throw new schematics.SchematicsException(`Unsupported migration "${migration}"`);
49
+ }
50
+ }
51
+ return schematics.chain(rules);
52
+ }
53
+
54
+ exports.migrate = migrate;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v19.0.0-next.8
3
+ * @license Angular v19.0.0-rc.0
4
4
  * (c) 2010-2024 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
@@ -11,14 +11,15 @@ Object.defineProperty(exports, '__esModule', { value: true });
11
11
  var schematics = require('@angular-devkit/schematics');
12
12
  require('os');
13
13
  var ts = require('typescript');
14
- var checker = require('./checker-e68dd7ce.js');
14
+ var checker = require('./checker-2451e7c5.js');
15
+ var program = require('./program-58424797.js');
15
16
  var p = require('path');
16
- var program = require('./program-105283c5.js');
17
17
  var fs = require('fs');
18
- var compiler_host = require('./compiler_host-9a4d0c2b.js');
19
- var project_tsconfig_paths = require('./project_tsconfig_paths-e9ccccbf.js');
20
- var nodes = require('./nodes-0e7d45ca.js');
21
- var imports = require('./imports-4ac08251.js');
18
+ var compiler_host = require('./compiler_host-f54f8309.js');
19
+ var project_tsconfig_paths = require('./project_tsconfig_paths-6c9cde78.js');
20
+ var ng_decorators = require('./ng_decorators-3ad437d2.js');
21
+ var nodes = require('./nodes-ffdce442.js');
22
+ var imports = require('./imports-44987700.js');
22
23
  require('module');
23
24
  require('url');
24
25
  require('@angular-devkit/core');
@@ -32,7 +33,7 @@ var ts__default = /*#__PURE__*/_interopDefaultLegacy(ts);
32
33
  * @description
33
34
  * Entry point for all public APIs of the compiler-cli package.
34
35
  */
35
- new checker.Version('19.0.0-next.8');
36
+ new checker.Version('19.0.0-rc.0');
36
37
 
37
38
  function createProgram({ rootNames, options, host, oldProgram, }) {
38
39
  return new program.NgtscProgram(rootNames, options, host, oldProgram);
@@ -365,7 +366,7 @@ function toStandalone(sourceFiles, program, printer, fileImportRemapper, compone
365
366
  function convertNgModuleDeclarationToStandalone(decl, allDeclarations, tracker, typeChecker, importRemapper) {
366
367
  const directiveMeta = typeChecker.getDirectiveMetadata(decl);
367
368
  if (directiveMeta && directiveMeta.decorator && !directiveMeta.isStandalone) {
368
- let decorator = addStandaloneToDecorator(directiveMeta.decorator);
369
+ let decorator = markDecoratorAsStandalone(directiveMeta.decorator);
369
370
  if (directiveMeta.isComponent) {
370
371
  const importsToAdd = getComponentImportExpressions(decl, allDeclarations, tracker, typeChecker, importRemapper);
371
372
  if (importsToAdd.length > 0) {
@@ -381,7 +382,7 @@ function convertNgModuleDeclarationToStandalone(decl, allDeclarations, tracker,
381
382
  else {
382
383
  const pipeMeta = typeChecker.getPipeMetadata(decl);
383
384
  if (pipeMeta && pipeMeta.decorator && !pipeMeta.isStandalone) {
384
- tracker.replaceNode(pipeMeta.decorator, addStandaloneToDecorator(pipeMeta.decorator));
385
+ tracker.replaceNode(pipeMeta.decorator, markDecoratorAsStandalone(pipeMeta.decorator));
385
386
  }
386
387
  }
387
388
  }
@@ -540,9 +541,26 @@ function moveDeclarationsToImports(literal, allDeclarations, typeChecker, templa
540
541
  }
541
542
  tracker.replaceNode(literal, ts__default["default"].factory.updateObjectLiteralExpression(literal, ts__default["default"].factory.createNodeArray(properties, literal.properties.hasTrailingComma)), ts__default["default"].EmitHint.Expression);
542
543
  }
543
- /** Adds `standalone: true` to a decorator node. */
544
- function addStandaloneToDecorator(node) {
545
- return setPropertyOnAngularDecorator(node, 'standalone', ts__default["default"].factory.createToken(ts__default["default"].SyntaxKind.TrueKeyword));
544
+ /** Sets a decorator node to be standalone. */
545
+ function markDecoratorAsStandalone(node) {
546
+ const metadata = extractMetadataLiteral(node);
547
+ if (metadata === null || !ts__default["default"].isCallExpression(node.expression)) {
548
+ return node;
549
+ }
550
+ const standaloneProp = metadata.properties.find((prop) => {
551
+ return isNamedPropertyAssignment(prop) && prop.name.text === 'standalone';
552
+ });
553
+ // In v19 standalone is the default so don't do anything if there's no `standalone`
554
+ // property or it's initialized to anything other than `false`.
555
+ if (!standaloneProp || standaloneProp.initializer.kind !== ts__default["default"].SyntaxKind.FalseKeyword) {
556
+ return node;
557
+ }
558
+ const newProperties = metadata.properties.filter((element) => element !== standaloneProp);
559
+ // Use `createDecorator` instead of `updateDecorator`, because
560
+ // the latter ends up duplicating the node's leading comment.
561
+ return ts__default["default"].factory.createDecorator(ts__default["default"].factory.createCallExpression(node.expression.expression, node.expression.typeArguments, [
562
+ ts__default["default"].factory.createObjectLiteralExpression(ts__default["default"].factory.createNodeArray(newProperties, metadata.properties.hasTrailingComma), newProperties.length > 1),
563
+ ]));
546
564
  }
547
565
  /**
548
566
  * Sets a property on an Angular decorator node. If the property
@@ -635,7 +653,7 @@ function findNgModuleClassesToMigrate(sourceFile, typeChecker) {
635
653
  if (imports.getImportSpecifier(sourceFile, '@angular/core', 'NgModule')) {
636
654
  sourceFile.forEachChild(function walk(node) {
637
655
  if (ts__default["default"].isClassDeclaration(node)) {
638
- const decorator = nodes.getAngularDecorators(typeChecker, ts__default["default"].getDecorators(node) || []).find((current) => current.name === 'NgModule');
656
+ const decorator = ng_decorators.getAngularDecorators(typeChecker, ts__default["default"].getDecorators(node) || []).find((current) => current.name === 'NgModule');
639
657
  const metadata = decorator ? extractMetadataLiteral(decorator.node) : null;
640
658
  if (metadata) {
641
659
  const declarations = findLiteralProperty(metadata, 'declarations');
@@ -774,13 +792,13 @@ function migrateTestDeclarations(testObjects, declarationsOutsideOfTestFiles, tr
774
792
  for (const decorator of decorators) {
775
793
  const closestClass = nodes.closestNode(decorator.node, ts__default["default"].isClassDeclaration);
776
794
  if (decorator.name === 'Pipe' || decorator.name === 'Directive') {
777
- tracker.replaceNode(decorator.node, addStandaloneToDecorator(decorator.node));
795
+ tracker.replaceNode(decorator.node, markDecoratorAsStandalone(decorator.node));
778
796
  if (closestClass) {
779
797
  allDeclarations.add(closestClass);
780
798
  }
781
799
  }
782
800
  else if (decorator.name === 'Component') {
783
- const newDecorator = addStandaloneToDecorator(decorator.node);
801
+ const newDecorator = markDecoratorAsStandalone(decorator.node);
784
802
  const importsToAdd = componentImports.get(decorator.node);
785
803
  if (closestClass) {
786
804
  allDeclarations.add(closestClass);
@@ -832,7 +850,7 @@ function analyzeTestingModules(testObjects, typeChecker) {
832
850
  if (seenDeclarations.has(decl)) {
833
851
  continue;
834
852
  }
835
- const [decorator] = nodes.getAngularDecorators(typeChecker, ts__default["default"].getDecorators(decl) || []);
853
+ const [decorator] = ng_decorators.getAngularDecorators(typeChecker, ts__default["default"].getDecorators(decl) || []);
836
854
  if (decorator) {
837
855
  seenDeclarations.add(decl);
838
856
  decorators.push(decorator);
@@ -1306,7 +1324,7 @@ function addRemovalTodos(nodes, tracker) {
1306
1324
  }
1307
1325
  /** Finds the `NgModule` decorator in a class, if it exists. */
1308
1326
  function findNgModuleDecorator(node, typeChecker) {
1309
- const decorators = nodes.getAngularDecorators(typeChecker, ts__default["default"].getDecorators(node) || []);
1327
+ const decorators = ng_decorators.getAngularDecorators(typeChecker, ts__default["default"].getDecorators(node) || []);
1310
1328
  return decorators.find((decorator) => decorator.name === 'NgModule') || null;
1311
1329
  }
1312
1330
  /**
@@ -1382,7 +1400,7 @@ function analyzeBootstrapCall(call, typeChecker, templateTypeChecker) {
1382
1400
  if (!declaration) {
1383
1401
  return null;
1384
1402
  }
1385
- const decorator = nodes.getAngularDecorators(typeChecker, ts__default["default"].getDecorators(declaration) || []).find((decorator) => decorator.name === 'NgModule');
1403
+ const decorator = ng_decorators.getAngularDecorators(typeChecker, ts__default["default"].getDecorators(declaration) || []).find((decorator) => decorator.name === 'NgModule');
1386
1404
  if (!decorator ||
1387
1405
  decorator.node.expression.arguments.length === 0 ||
1388
1406
  !ts__default["default"].isObjectLiteralExpression(decorator.node.expression.arguments[0])) {
@@ -1571,7 +1589,7 @@ function migrateImportsForBootstrapCall(sourceFile, imports, nodeLookup, imports
1571
1589
  : element;
1572
1590
  const classDeclaration = findClassDeclaration(target, typeChecker);
1573
1591
  const decorators = classDeclaration
1574
- ? nodes.getAngularDecorators(typeChecker, ts__default["default"].getDecorators(classDeclaration) || [])
1592
+ ? ng_decorators.getAngularDecorators(typeChecker, ts__default["default"].getDecorators(classDeclaration) || [])
1575
1593
  : undefined;
1576
1594
  if (!decorators ||
1577
1595
  decorators.length === 0 ||
@@ -35,6 +35,17 @@
35
35
  "factory": "./bundles/signal-queries-migration#migrate",
36
36
  "schema": "./ng-generate/signal-queries-migration/schema.json",
37
37
  "aliases": ["signal-queries", "signal-query", "signal-query-migration"]
38
+ },
39
+ "output-migration": {
40
+ "description": "Updates @output declarations to the functional equivalent, while also migrating all relevant references.",
41
+ "factory": "./bundles/output-migration#migrate",
42
+ "schema": "./ng-generate/output-migration/schema.json",
43
+ "aliases": ["outputs"]
44
+ },
45
+ "signals": {
46
+ "description": "Combines all signals-related migrations into a single migration",
47
+ "factory": "./bundles/signals#migrate",
48
+ "schema": "./ng-generate/signals/schema.json"
38
49
  }
39
50
  }
40
51
  }
@@ -2,13 +2,19 @@
2
2
  "schematics": {
3
3
  "explicit-standalone-flag": {
4
4
  "version": "19.0.0",
5
- "description": "Updates non-standalone Directives, Component and Pipes to standalone:false",
5
+ "description": "Updates non-standalone Directives, Component and Pipes to 'standalone:false' and removes 'standalone:true' from those who are standalone",
6
6
  "factory": "./bundles/explicit-standalone-flag#migrate"
7
7
  },
8
8
  "pending-tasks": {
9
9
  "version": "19.0.0",
10
10
  "description": "Updates ExperimentalPendingTasks to PendingTasks",
11
11
  "factory": "./bundles/pending-tasks#migrate"
12
+ },
13
+ "provide-initializer": {
14
+ "version": "19.0.0",
15
+ "description": "Replaces `APP_INITIALIZER`, 'ENVIRONMENT_INITIALIZER' & 'PLATFORM_INITIALIZER' respectively with `provideAppInitializer`, `provideEnvironmentInitializer` & `providePlatormInitializer`.",
16
+ "factory": "./bundles/provide-initializer#migrate",
17
+ "optional": true
12
18
  }
13
19
  }
14
20
  }
@@ -0,0 +1,19 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "AngularOutputMigration",
4
+ "title": "Angular Output migration",
5
+ "type": "object",
6
+ "properties": {
7
+ "path": {
8
+ "type": "string",
9
+ "description": "Path to the directory where all outputs should be migrated.",
10
+ "x-prompt": "Which directory do you want to migrate?",
11
+ "default": "./"
12
+ },
13
+ "analysisDir": {
14
+ "type": "string",
15
+ "description": "Path to the directory that should be analyzed. References to migrated outputs are migrated based on this folder. Useful for larger projects if the analysis takes too long and the analysis scope can be narrowed.",
16
+ "default": "./"
17
+ }
18
+ }
19
+ }
@@ -14,6 +14,17 @@
14
14
  "type": "string",
15
15
  "description": "Path to the directory that should be analyzed. References to migrated queries are migrated based on this folder. Useful for larger projects if the analysis takes too long and the analysis scope can be narrowed.",
16
16
  "default": "./"
17
+ },
18
+ "bestEffortMode": {
19
+ "type": "boolean",
20
+ "description": "Whether to eagerly migrate as much as possible, ignoring problematic patterns that would otherwise prevent migration.",
21
+ "x-prompt": "Do you want to migrate as much as possible, even if it may break your build?",
22
+ "default": false
23
+ },
24
+ "insertTodos": {
25
+ "type": "boolean",
26
+ "description": "Whether the migration should add TODOs for queries that could not be migrated",
27
+ "default": false
17
28
  }
18
29
  }
19
30
  }
@@ -0,0 +1,65 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "AngularSignalMigration",
4
+ "title": "Angular Signals migration",
5
+ "type": "object",
6
+ "properties": {
7
+ "migrations": {
8
+ "type": "array",
9
+ "default": [
10
+ "inputs",
11
+ "queries"
12
+ ],
13
+ "items": {
14
+ "type": "string",
15
+ "enum": [
16
+ "inputs",
17
+ "outputs",
18
+ "queries"
19
+ ]
20
+ },
21
+ "description": "Signals-related migrations that should be run",
22
+ "x-prompt": {
23
+ "message": "Which migrations do you want to run?",
24
+ "type": "list",
25
+ "multiselect": true,
26
+ "items": [
27
+ {
28
+ "value": "inputs",
29
+ "label": "Convert `@Input` to the signal-based `input`"
30
+ },
31
+ {
32
+ "value": "outputs",
33
+ "label": "Convert `@Output` to the new `output` function"
34
+ },
35
+ {
36
+ "value": "queries",
37
+ "label": "Convert `@ViewChild`/`@ViewChildren` and `@ContentChild`/`@ContentChildren` to the signal-based `viewChild`/`viewChildren` and `contentChild`/`contentChildren`"
38
+ }
39
+ ]
40
+ }
41
+ },
42
+ "path": {
43
+ "type": "string",
44
+ "description": "Path to the directory that should be migrated.",
45
+ "x-prompt": "Which directory do you want to migrate?",
46
+ "default": "./"
47
+ },
48
+ "analysisDir": {
49
+ "type": "string",
50
+ "description": "Path to the directory that should be analyzed. Useful for larger projects if the analysis takes too long and the analysis scope can be narrowed.",
51
+ "default": "./"
52
+ },
53
+ "bestEffortMode": {
54
+ "type": "boolean",
55
+ "description": "Whether to eagerly migrate as much as possible, ignoring problematic patterns that would otherwise prevent migration.",
56
+ "x-prompt": "Do you want to migrate as much as possible, even if it may break your build?",
57
+ "default": false
58
+ },
59
+ "insertTodos": {
60
+ "type": "boolean",
61
+ "description": "Whether the migration should add TODOs for code that could not be migrated",
62
+ "default": false
63
+ }
64
+ }
65
+ }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v19.0.0-next.8
2
+ * @license Angular v19.0.0-rc.0
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -89,6 +89,8 @@ export declare class ComponentFixture<T> {
89
89
  * Set whether the fixture should autodetect changes.
90
90
  *
91
91
  * Also runs detectChanges once so that any existing change is detected.
92
+ *
93
+ * @param autoDetect Whether to autodetect changes. By default, `true`.
92
94
  */
93
95
  autoDetectChanges(autoDetect?: boolean): void;
94
96
  /**