@angular/core 19.0.0-next.9 → 19.0.0-rc.1

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 +21183 -19410
  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 +174 -113
  10. package/fesm2022/testing.mjs.map +1 -1
  11. package/index.d.ts +524 -92
  12. package/package.json +1 -1
  13. package/primitives/event-dispatch/index.d.ts +7 -4
  14. package/primitives/signals/index.d.ts +3 -1
  15. package/rxjs-interop/index.d.ts +35 -4
  16. package/schematics/bundles/{checker-3b2ea20f.js → checker-9ca42e51.js} +2303 -1006
  17. package/schematics/bundles/combine_units-a16385aa.js +1634 -0
  18. package/schematics/bundles/{compiler_host-b4ba5a28.js → compiler_host-31afa4ed.js} +8 -5
  19. package/schematics/bundles/control-flow-migration.js +3 -3
  20. package/schematics/bundles/explicit-standalone-flag.js +29 -9
  21. package/schematics/bundles/imports-4ac08251.js +1 -1
  22. package/schematics/bundles/inject-migration.js +222 -54
  23. package/schematics/bundles/leading_space-d190b83b.js +1 -1
  24. package/schematics/bundles/migrate_ts_type_references-b2a28742.js +1463 -0
  25. package/schematics/bundles/nodes-0e7d45ca.js +1 -1
  26. package/schematics/bundles/output-migration.js +575 -0
  27. package/schematics/bundles/pending-tasks.js +3 -3
  28. package/schematics/bundles/{program-6534a30a.js → program-71beec0b.js} +1385 -460
  29. package/schematics/bundles/project_tsconfig_paths-e9ccccbf.js +1 -1
  30. package/schematics/bundles/provide-initializer.js +179 -0
  31. package/schematics/bundles/route-lazy-loading.js +9 -4
  32. package/schematics/bundles/signal-input-migration.js +183 -311
  33. package/schematics/bundles/signal-queries-migration.js +404 -146
  34. package/schematics/bundles/signals.js +54 -0
  35. package/schematics/bundles/standalone-migration.js +29 -12
  36. package/schematics/collection.json +11 -0
  37. package/schematics/migrations.json +7 -1
  38. package/schematics/ng-generate/output-migration/schema.json +19 -0
  39. package/schematics/ng-generate/signal-queries-migration/schema.json +11 -0
  40. package/schematics/ng-generate/signals/schema.json +65 -0
  41. package/testing/index.d.ts +1 -1
  42. package/schematics/bundles/group_replacements-e1b5cbf8.js +0 -31571
@@ -0,0 +1,54 @@
1
+ 'use strict';
2
+ /**
3
+ * @license Angular v19.0.0-rc.1
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-e9ccccbf.js');
16
+ require('@angular-devkit/core');
17
+ require('./combine_units-a16385aa.js');
18
+ require('node:path/posix');
19
+ require('os');
20
+ require('typescript');
21
+ require('./checker-9ca42e51.js');
22
+ require('fs');
23
+ require('module');
24
+ require('path');
25
+ require('url');
26
+ require('./program-71beec0b.js');
27
+ require('assert');
28
+ require('./migrate_ts_type_references-b2a28742.js');
29
+ require('./leading_space-d190b83b.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.9
3
+ * @license Angular v19.0.0-rc.1
4
4
  * (c) 2010-2024 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
@@ -11,11 +11,11 @@ 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-3b2ea20f.js');
14
+ var checker = require('./checker-9ca42e51.js');
15
+ var program = require('./program-71beec0b.js');
15
16
  var p = require('path');
16
- var program = require('./program-6534a30a.js');
17
17
  var fs = require('fs');
18
- var compiler_host = require('./compiler_host-b4ba5a28.js');
18
+ var compiler_host = require('./compiler_host-31afa4ed.js');
19
19
  var project_tsconfig_paths = require('./project_tsconfig_paths-e9ccccbf.js');
20
20
  var nodes = require('./nodes-0e7d45ca.js');
21
21
  var imports = require('./imports-4ac08251.js');
@@ -32,7 +32,7 @@ var ts__default = /*#__PURE__*/_interopDefaultLegacy(ts);
32
32
  * @description
33
33
  * Entry point for all public APIs of the compiler-cli package.
34
34
  */
35
- new checker.Version('19.0.0-next.9');
35
+ new checker.Version('19.0.0-rc.1');
36
36
 
37
37
  function createProgram({ rootNames, options, host, oldProgram, }) {
38
38
  return new program.NgtscProgram(rootNames, options, host, oldProgram);
@@ -365,7 +365,7 @@ function toStandalone(sourceFiles, program, printer, fileImportRemapper, compone
365
365
  function convertNgModuleDeclarationToStandalone(decl, allDeclarations, tracker, typeChecker, importRemapper) {
366
366
  const directiveMeta = typeChecker.getDirectiveMetadata(decl);
367
367
  if (directiveMeta && directiveMeta.decorator && !directiveMeta.isStandalone) {
368
- let decorator = addStandaloneToDecorator(directiveMeta.decorator);
368
+ let decorator = markDecoratorAsStandalone(directiveMeta.decorator);
369
369
  if (directiveMeta.isComponent) {
370
370
  const importsToAdd = getComponentImportExpressions(decl, allDeclarations, tracker, typeChecker, importRemapper);
371
371
  if (importsToAdd.length > 0) {
@@ -381,7 +381,7 @@ function convertNgModuleDeclarationToStandalone(decl, allDeclarations, tracker,
381
381
  else {
382
382
  const pipeMeta = typeChecker.getPipeMetadata(decl);
383
383
  if (pipeMeta && pipeMeta.decorator && !pipeMeta.isStandalone) {
384
- tracker.replaceNode(pipeMeta.decorator, addStandaloneToDecorator(pipeMeta.decorator));
384
+ tracker.replaceNode(pipeMeta.decorator, markDecoratorAsStandalone(pipeMeta.decorator));
385
385
  }
386
386
  }
387
387
  }
@@ -540,9 +540,26 @@ function moveDeclarationsToImports(literal, allDeclarations, typeChecker, templa
540
540
  }
541
541
  tracker.replaceNode(literal, ts__default["default"].factory.updateObjectLiteralExpression(literal, ts__default["default"].factory.createNodeArray(properties, literal.properties.hasTrailingComma)), ts__default["default"].EmitHint.Expression);
542
542
  }
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));
543
+ /** Sets a decorator node to be standalone. */
544
+ function markDecoratorAsStandalone(node) {
545
+ const metadata = extractMetadataLiteral(node);
546
+ if (metadata === null || !ts__default["default"].isCallExpression(node.expression)) {
547
+ return node;
548
+ }
549
+ const standaloneProp = metadata.properties.find((prop) => {
550
+ return isNamedPropertyAssignment(prop) && prop.name.text === 'standalone';
551
+ });
552
+ // In v19 standalone is the default so don't do anything if there's no `standalone`
553
+ // property or it's initialized to anything other than `false`.
554
+ if (!standaloneProp || standaloneProp.initializer.kind !== ts__default["default"].SyntaxKind.FalseKeyword) {
555
+ return node;
556
+ }
557
+ const newProperties = metadata.properties.filter((element) => element !== standaloneProp);
558
+ // Use `createDecorator` instead of `updateDecorator`, because
559
+ // the latter ends up duplicating the node's leading comment.
560
+ return ts__default["default"].factory.createDecorator(ts__default["default"].factory.createCallExpression(node.expression.expression, node.expression.typeArguments, [
561
+ ts__default["default"].factory.createObjectLiteralExpression(ts__default["default"].factory.createNodeArray(newProperties, metadata.properties.hasTrailingComma), newProperties.length > 1),
562
+ ]));
546
563
  }
547
564
  /**
548
565
  * Sets a property on an Angular decorator node. If the property
@@ -774,13 +791,13 @@ function migrateTestDeclarations(testObjects, declarationsOutsideOfTestFiles, tr
774
791
  for (const decorator of decorators) {
775
792
  const closestClass = nodes.closestNode(decorator.node, ts__default["default"].isClassDeclaration);
776
793
  if (decorator.name === 'Pipe' || decorator.name === 'Directive') {
777
- tracker.replaceNode(decorator.node, addStandaloneToDecorator(decorator.node));
794
+ tracker.replaceNode(decorator.node, markDecoratorAsStandalone(decorator.node));
778
795
  if (closestClass) {
779
796
  allDeclarations.add(closestClass);
780
797
  }
781
798
  }
782
799
  else if (decorator.name === 'Component') {
783
- const newDecorator = addStandaloneToDecorator(decorator.node);
800
+ const newDecorator = markDecoratorAsStandalone(decorator.node);
784
801
  const importsToAdd = componentImports.get(decorator.node);
785
802
  if (closestClass) {
786
803
  allDeclarations.add(closestClass);
@@ -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` & `providePlatformInitializer`.",
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.9
2
+ * @license Angular v19.0.0-rc.1
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */