@schematics/angular 20.2.0 → 21.0.0-next.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.
@@ -1,7 +1,7 @@
1
- Chrome >= 107
2
- ChromeAndroid >= 107
3
- Edge >= 107
4
- Firefox >= 104
5
- FirefoxAndroid >= 104
1
+ Chrome >= 110
2
+ ChromeAndroid >= 110
3
+ Edge >= 110
4
+ Firefox >= 110
5
+ FirefoxAndroid >= 110
6
6
  Safari >= 16
7
7
  iOS >= 16
@@ -1,27 +1,7 @@
1
1
  {
2
2
  "schematics": {
3
- "replace-provide-server-rendering-import": {
4
- "version": "20.0.0",
5
- "factory": "./replace-provide-server-rendering-import/migration",
6
- "description": "Migrate imports of 'provideServerRendering' from '@angular/platform-server' to '@angular/ssr'."
7
- },
8
- "replace-provide-server-routing": {
9
- "version": "20.0.0",
10
- "factory": "./replace-provide-server-routing/migration",
11
- "description": "Migrate 'provideServerRendering' to use 'withRoutes', and remove 'provideServerRouting' and 'provideServerRoutesConfig' from '@angular/ssr'."
12
- },
13
- "update-module-resolution": {
14
- "version": "20.0.0",
15
- "factory": "./update-module-resolution/migration",
16
- "description": "Update 'moduleResolution' to 'bundler' in TypeScript configurations. You can read more about this, here: https://www.typescriptlang.org/tsconfig/#moduleResolution"
17
- },
18
- "previous-style-guide": {
19
- "version": "20.0.0",
20
- "factory": "./previous-style-guide/migration",
21
- "description": "Update workspace generation defaults to maintain previous style guide behavior."
22
- },
23
3
  "use-application-builder": {
24
- "version": "20.0.0",
4
+ "version": "21.0.0",
25
5
  "factory": "./use-application-builder/migration",
26
6
  "description": "Migrate application projects to the new build system. Application projects that are using the '@angular-devkit/build-angular' package's 'browser' and/or 'browser-esbuild' builders will be migrated to use the new 'application' builder. You can read more about this, including known issues and limitations, here: https://angular.dev/tools/cli/build-system-migration",
27
7
  "optional": true,
@@ -29,7 +9,7 @@
29
9
  "documentation": "tools/cli/build-system-migration"
30
10
  },
31
11
  "remove-default-karma-config": {
32
- "version": "20.2.0",
12
+ "version": "21.0.0",
33
13
  "factory": "./karma/migration",
34
14
  "description": "Remove any karma configuration files that only contain the default content. The default configuration is automatically available without a specific project file."
35
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schematics/angular",
3
- "version": "20.2.0",
3
+ "version": "21.0.0-next.0",
4
4
  "description": "Schematics specific to Angular",
5
5
  "homepage": "https://github.com/angular/angular-cli",
6
6
  "keywords": [
@@ -22,15 +22,15 @@
22
22
  },
23
23
  "schematics": "./collection.json",
24
24
  "dependencies": {
25
- "@angular-devkit/core": "20.2.0",
26
- "@angular-devkit/schematics": "20.2.0",
25
+ "@angular-devkit/core": "21.0.0-next.0",
26
+ "@angular-devkit/schematics": "21.0.0-next.0",
27
27
  "jsonc-parser": "3.3.1"
28
28
  },
29
29
  "repository": {
30
30
  "type": "git",
31
31
  "url": "https://github.com/angular/angular-cli.git"
32
32
  },
33
- "packageManager": "pnpm@10.14.0",
33
+ "packageManager": "pnpm@10.15.0",
34
34
  "engines": {
35
35
  "node": "^20.19.0 || ^22.12.0 || >=24.0.0",
36
36
  "npm": "^6.11.0 || ^7.5.6 || >=8.0.0",
@@ -14,9 +14,9 @@ const dependencies = require('./latest-versions/package.json')['dependencies'];
14
14
  exports.latestVersions = {
15
15
  ...dependencies,
16
16
  // As Angular CLI works with same minor versions of Angular Framework, a tilde match for the current
17
- Angular: '^20.2.0',
18
- NgPackagr: '^20.2.0',
19
- DevkitBuildAngular: '^20.2.0',
20
- AngularBuild: '^20.2.0',
21
- AngularSSR: '^20.2.0',
17
+ Angular: '^21.0.0-next.0',
18
+ NgPackagr: '^21.0.0-next.0',
19
+ DevkitBuildAngular: '^21.0.0-next.0',
20
+ AngularBuild: '^21.0.0-next.0',
21
+ AngularSSR: '^21.0.0-next.0',
22
22
  };
@@ -1,9 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright Google LLC All Rights Reserved.
4
- *
5
- * Use of this source code is governed by an MIT-style license that can be
6
- * found in the LICENSE file at https://angular.dev/license
7
- */
8
- import type { Rule } from '@angular-devkit/schematics';
9
- export default function (): Rule;
@@ -1,42 +0,0 @@
1
- "use strict";
2
- /**
3
- * @license
4
- * Copyright Google LLC All Rights Reserved.
5
- *
6
- * Use of this source code is governed by an MIT-style license that can be
7
- * found in the LICENSE file at https://angular.dev/license
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.default = default_1;
11
- const workspace_1 = require("../../utility/workspace");
12
- const TYPE_SCHEMATICS = ['component', 'directive', 'service'];
13
- const SEPARATOR_SCHEMATICS = ['guard', 'interceptor', 'module', 'pipe', 'resolver'];
14
- function default_1() {
15
- return (0, workspace_1.updateWorkspace)((workspace) => {
16
- let schematicsDefaults = workspace.extensions['schematics'];
17
- // Ensure "schematics" field is an object
18
- if (!schematicsDefaults ||
19
- typeof schematicsDefaults !== 'object' ||
20
- Array.isArray(schematicsDefaults)) {
21
- schematicsDefaults = workspace.extensions['schematics'] = {};
22
- }
23
- // Add "type" value for each schematic to continue generating a type suffix.
24
- // New default is an empty type value.
25
- for (const schematicName of TYPE_SCHEMATICS) {
26
- const schematic = (schematicsDefaults[`@schematics/angular:${schematicName}`] ??= {});
27
- if (typeof schematic === 'object' && !Array.isArray(schematic) && !('type' in schematic)) {
28
- schematic['type'] = schematicName;
29
- }
30
- }
31
- // Add "typeSeparator" value for each schematic to continue generating "." before type.
32
- // New default is an "-" type value.
33
- for (const schematicName of SEPARATOR_SCHEMATICS) {
34
- const schematic = (schematicsDefaults[`@schematics/angular:${schematicName}`] ??= {});
35
- if (typeof schematic === 'object' &&
36
- !Array.isArray(schematic) &&
37
- !('typeSeparator' in schematic)) {
38
- schematic['typeSeparator'] = '.';
39
- }
40
- }
41
- });
42
- }
@@ -1,9 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright Google LLC All Rights Reserved.
4
- *
5
- * Use of this source code is governed by an MIT-style license that can be
6
- * found in the LICENSE file at https://angular.dev/license
7
- */
8
- import { Rule } from '@angular-devkit/schematics';
9
- export default function (): Rule;
@@ -1,98 +0,0 @@
1
- "use strict";
2
- /**
3
- * @license
4
- * Copyright Google LLC All Rights Reserved.
5
- *
6
- * Use of this source code is governed by an MIT-style license that can be
7
- * found in the LICENSE file at https://angular.dev/license
8
- */
9
- var __importDefault = (this && this.__importDefault) || function (mod) {
10
- return (mod && mod.__esModule) ? mod : { "default": mod };
11
- };
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.default = default_1;
14
- const typescript_1 = __importDefault(require("../../third_party/github.com/Microsoft/TypeScript/lib/typescript"));
15
- const dependency_1 = require("../../utility/dependency");
16
- const latest_versions_1 = require("../../utility/latest-versions");
17
- function* visit(directory) {
18
- for (const path of directory.subfiles) {
19
- if (path.endsWith('.ts') && !path.endsWith('.d.ts')) {
20
- const entry = directory.file(path);
21
- if (entry) {
22
- const content = entry.content;
23
- if (content.includes('provideServerRendering') &&
24
- content.includes('@angular/platform-server')) {
25
- // Only need to rename the import so we can just string replacements.
26
- yield [entry.path, content.toString()];
27
- }
28
- }
29
- }
30
- }
31
- for (const path of directory.subdirs) {
32
- if (path === 'node_modules' || path.startsWith('.')) {
33
- continue;
34
- }
35
- yield* visit(directory.dir(path));
36
- }
37
- }
38
- function default_1() {
39
- return async (tree) => {
40
- let rule;
41
- for (const [filePath, content] of visit(tree.root)) {
42
- let updatedContent = content;
43
- const ssrImports = new Set();
44
- const platformServerImports = new Set();
45
- const sourceFile = typescript_1.default.createSourceFile(filePath, content, typescript_1.default.ScriptTarget.Latest, true);
46
- sourceFile.forEachChild((node) => {
47
- if (typescript_1.default.isImportDeclaration(node)) {
48
- const moduleSpecifier = node.moduleSpecifier.getText(sourceFile);
49
- if (moduleSpecifier.includes('@angular/platform-server')) {
50
- const importClause = node.importClause;
51
- if (importClause &&
52
- importClause.namedBindings &&
53
- typescript_1.default.isNamedImports(importClause.namedBindings)) {
54
- const namedImports = importClause.namedBindings.elements.map((e) => e.getText(sourceFile));
55
- namedImports.forEach((importName) => {
56
- if (importName === 'provideServerRendering') {
57
- ssrImports.add(importName);
58
- }
59
- else {
60
- platformServerImports.add(importName);
61
- }
62
- });
63
- }
64
- updatedContent = updatedContent.replace(node.getFullText(sourceFile), '');
65
- }
66
- else if (moduleSpecifier.includes('@angular/ssr')) {
67
- const importClause = node.importClause;
68
- if (importClause &&
69
- importClause.namedBindings &&
70
- typescript_1.default.isNamedImports(importClause.namedBindings)) {
71
- importClause.namedBindings.elements.forEach((e) => {
72
- ssrImports.add(e.getText(sourceFile));
73
- });
74
- }
75
- updatedContent = updatedContent.replace(node.getFullText(sourceFile), '');
76
- }
77
- }
78
- });
79
- if (platformServerImports.size > 0) {
80
- updatedContent =
81
- `import { ${Array.from(platformServerImports).sort().join(', ')} } from '@angular/platform-server';\n` +
82
- updatedContent;
83
- }
84
- if (ssrImports.size > 0) {
85
- updatedContent =
86
- `import { ${Array.from(ssrImports).sort().join(', ')} } from '@angular/ssr';\n` +
87
- updatedContent;
88
- }
89
- if (content !== updatedContent) {
90
- tree.overwrite(filePath, updatedContent);
91
- if (rule === undefined) {
92
- rule = (0, dependency_1.addDependency)('@angular/ssr', latest_versions_1.latestVersions.AngularSSR);
93
- }
94
- }
95
- }
96
- return rule;
97
- };
98
- }
@@ -1,9 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright Google LLC All Rights Reserved.
4
- *
5
- * Use of this source code is governed by an MIT-style license that can be
6
- * found in the LICENSE file at https://angular.dev/license
7
- */
8
- import { Rule } from '@angular-devkit/schematics';
9
- export default function (): Rule;
@@ -1,125 +0,0 @@
1
- "use strict";
2
- /**
3
- * @license
4
- * Copyright Google LLC All Rights Reserved.
5
- *
6
- * Use of this source code is governed by an MIT-style license that can be
7
- * found in the LICENSE file at https://angular.dev/license
8
- */
9
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- var desc = Object.getOwnPropertyDescriptor(m, k);
12
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
- desc = { enumerable: true, get: function() { return m[k]; } };
14
- }
15
- Object.defineProperty(o, k2, desc);
16
- }) : (function(o, m, k, k2) {
17
- if (k2 === undefined) k2 = k;
18
- o[k2] = m[k];
19
- }));
20
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
- Object.defineProperty(o, "default", { enumerable: true, value: v });
22
- }) : function(o, v) {
23
- o["default"] = v;
24
- });
25
- var __importStar = (this && this.__importStar) || (function () {
26
- var ownKeys = function(o) {
27
- ownKeys = Object.getOwnPropertyNames || function (o) {
28
- var ar = [];
29
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
30
- return ar;
31
- };
32
- return ownKeys(o);
33
- };
34
- return function (mod) {
35
- if (mod && mod.__esModule) return mod;
36
- var result = {};
37
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
38
- __setModuleDefault(result, mod);
39
- return result;
40
- };
41
- })();
42
- Object.defineProperty(exports, "__esModule", { value: true });
43
- exports.default = default_1;
44
- const ts = __importStar(require("../../third_party/github.com/Microsoft/TypeScript/lib/typescript"));
45
- const dependencies_1 = require("../../utility/dependencies");
46
- function* visit(directory) {
47
- for (const path of directory.subfiles) {
48
- if (path.endsWith('.ts') && !path.endsWith('.d.ts')) {
49
- const entry = directory.file(path);
50
- if (entry) {
51
- const content = entry.content;
52
- if ((content.includes('provideServerRouting') ||
53
- content.includes('provideServerRoutesConfig')) &&
54
- content.includes('@angular/ssr')) {
55
- // Only need to rename the import so we can just string replacements.
56
- yield [entry.path, content.toString()];
57
- }
58
- }
59
- }
60
- }
61
- for (const path of directory.subdirs) {
62
- if (path === 'node_modules' || path.startsWith('.')) {
63
- continue;
64
- }
65
- yield* visit(directory.dir(path));
66
- }
67
- }
68
- function default_1() {
69
- return async (tree) => {
70
- if (!(0, dependencies_1.getPackageJsonDependency)(tree, '@angular/ssr')) {
71
- return;
72
- }
73
- for (const [filePath, content] of visit(tree.root)) {
74
- const recorder = tree.beginUpdate(filePath);
75
- const sourceFile = ts.createSourceFile(filePath, content, ts.ScriptTarget.Latest, true);
76
- function visit(node) {
77
- if (ts.isPropertyAssignment(node) &&
78
- ts.isIdentifier(node.name) &&
79
- node.name.text === 'providers' &&
80
- ts.isArrayLiteralExpression(node.initializer)) {
81
- const providersArray = node.initializer;
82
- const newProviders = providersArray.elements
83
- .filter((el) => {
84
- return !(ts.isCallExpression(el) &&
85
- ts.isIdentifier(el.expression) &&
86
- el.expression.text === 'provideServerRendering');
87
- })
88
- .map((el) => {
89
- if (ts.isCallExpression(el) &&
90
- ts.isIdentifier(el.expression) &&
91
- (el.expression.text === 'provideServerRouting' ||
92
- el.expression.text === 'provideServerRoutesConfig')) {
93
- const [withRouteVal, ...others] = el.arguments.map((arg) => arg.getText());
94
- return `provideServerRendering(withRoutes(${withRouteVal})${others.length ? ', ' + others.join(', ') : ''})`;
95
- }
96
- return el.getText();
97
- });
98
- // Update the 'providers' array in the source file
99
- recorder.remove(providersArray.getStart(), providersArray.getWidth());
100
- recorder.insertRight(providersArray.getStart(), `[${newProviders.join(', ')}]`);
101
- }
102
- ts.forEachChild(node, visit);
103
- }
104
- // Visit all nodes to update 'providers'
105
- visit(sourceFile);
106
- // Update imports by removing 'provideServerRouting'
107
- const importDecl = sourceFile.statements.find((stmt) => ts.isImportDeclaration(stmt) &&
108
- ts.isStringLiteral(stmt.moduleSpecifier) &&
109
- stmt.moduleSpecifier.text === '@angular/ssr');
110
- if (importDecl?.importClause?.namedBindings) {
111
- const namedBindings = importDecl?.importClause.namedBindings;
112
- if (ts.isNamedImports(namedBindings)) {
113
- const elements = namedBindings.elements;
114
- const updatedElements = elements
115
- .map((el) => el.getText())
116
- .filter((x) => x !== 'provideServerRouting' && x !== 'provideServerRoutesConfig');
117
- updatedElements.push('withRoutes');
118
- recorder.remove(namedBindings.getStart(), namedBindings.getWidth());
119
- recorder.insertLeft(namedBindings.getStart(), `{ ${updatedElements.sort().join(', ')} }`);
120
- }
121
- }
122
- tree.commitUpdate(recorder);
123
- }
124
- };
125
- }
@@ -1,9 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright Google LLC All Rights Reserved.
4
- *
5
- * Use of this source code is governed by an MIT-style license that can be
6
- * found in the LICENSE file at https://angular.dev/license
7
- */
8
- import { Rule } from '@angular-devkit/schematics';
9
- export default function (): Rule;
@@ -1,52 +0,0 @@
1
- "use strict";
2
- /**
3
- * @license
4
- * Copyright Google LLC All Rights Reserved.
5
- *
6
- * Use of this source code is governed by an MIT-style license that can be
7
- * found in the LICENSE file at https://angular.dev/license
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.default = default_1;
11
- const json_file_1 = require("../../utility/json-file");
12
- const workspace_1 = require("../../utility/workspace");
13
- function default_1() {
14
- return async (host) => {
15
- const uniqueTsConfigs = new Set();
16
- if (host.exists('tsconfig.json')) {
17
- // Workspace level tsconfig
18
- uniqueTsConfigs.add('tsconfig.json');
19
- }
20
- const workspace = await (0, workspace_1.getWorkspace)(host);
21
- for (const [, target] of (0, workspace_1.allWorkspaceTargets)(workspace)) {
22
- for (const [, opt] of (0, workspace_1.allTargetOptions)(target)) {
23
- if (typeof opt?.tsConfig === 'string') {
24
- uniqueTsConfigs.add(opt.tsConfig);
25
- }
26
- }
27
- }
28
- for (const tsConfig of uniqueTsConfigs) {
29
- if (host.exists(tsConfig)) {
30
- updateModuleResolution(host, tsConfig);
31
- }
32
- }
33
- };
34
- }
35
- function updateModuleResolution(host, tsConfigPath) {
36
- const json = new json_file_1.JSONFile(host, tsConfigPath);
37
- const jsonPath = ['compilerOptions'];
38
- const compilerOptions = json.get(jsonPath);
39
- if (compilerOptions && typeof compilerOptions === 'object') {
40
- const { moduleResolution, module } = compilerOptions;
41
- if (typeof moduleResolution !== 'string' || moduleResolution.toLowerCase() === 'bundler') {
42
- return;
43
- }
44
- if (typeof module === 'string' && module.toLowerCase() === 'preserve') {
45
- return;
46
- }
47
- json.modify(jsonPath, {
48
- ...compilerOptions,
49
- 'moduleResolution': 'bundler',
50
- });
51
- }
52
- }