@schematics/angular 20.0.0-next.0 → 20.0.0-next.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.
@@ -9,7 +9,7 @@ import { Component } from '@angular/core';
9
9
  %><router-outlet /><%
10
10
  } %>
11
11
  `,<% } else { %>
12
- templateUrl: './app.component.html',<% } %>
12
+ templateUrl: './app.component.ng.html',<% } %>
13
13
  standalone: false,<% if(inlineStyle) { %>
14
14
  styles: []<% } else { %>
15
15
  styleUrl: './app.component.<%= style %>'<% } %>
@@ -11,7 +11,7 @@ import { RouterOutlet } from '@angular/router';<% } %>
11
11
  %><router-outlet /><%
12
12
  } %>
13
13
  `,<% } else { %>
14
- templateUrl: './app.component.html',<% } if(inlineStyle) { %>
14
+ templateUrl: './app.component.ng.html',<% } if(inlineStyle) { %>
15
15
  styles: [],<% } else { %>
16
16
  styleUrl: './app.component.<%= style %>'<% } %>
17
17
  })
@@ -63,7 +63,7 @@ function default_1(options) {
63
63
  ? (0, schematics_1.filter)((path) => !path.endsWith('tsconfig.spec.json.template'))
64
64
  : (0, schematics_1.noop)(),
65
65
  componentOptions.inlineTemplate
66
- ? (0, schematics_1.filter)((path) => !path.endsWith('component.html.template'))
66
+ ? (0, schematics_1.filter)((path) => !path.endsWith('.ng.html.template'))
67
67
  : (0, schematics_1.noop)(),
68
68
  (0, schematics_1.applyTemplates)({
69
69
  utils: schematics_1.strings,
@@ -9,7 +9,7 @@ import { <% if(changeDetection !== 'Default') { %>ChangeDetectionStrategy, <% }%
9
9
  <%= dasherize(name) %> works!
10
10
  </p>
11
11
  `<% } else { %>
12
- templateUrl: './<%= dasherize(name) %><%= type ? '.' + dasherize(type): '' %>.html'<% } if(inlineStyle) { %>,
12
+ templateUrl: './<%= dasherize(name) %><%= type ? '.' + dasherize(type): '' %><%= ngext %>.html'<% } if(inlineStyle) { %>,
13
13
  styles: `<% if(displayBlock){ %>
14
14
  :host {
15
15
  display: block;
@@ -51,6 +51,7 @@ function default_1(options) {
51
51
  (0, schematics_1.applyTemplates)({
52
52
  ...schematics_1.strings,
53
53
  'if-flat': (s) => (options.flat ? '' : s),
54
+ 'ngext': options.ngHtml ? '.ng' : '',
54
55
  ...options,
55
56
  }),
56
57
  !options.type
@@ -49,6 +49,11 @@ export type Schema = {
49
49
  * `my-component.component.css`.
50
50
  */
51
51
  name: string;
52
+ /**
53
+ * Generate component template files with an '.ng.html' file extension instead of '.html'.
54
+ * The '.ng.html' file extension is recommended by the Angular style guide.
55
+ */
56
+ ngHtml?: boolean;
52
57
  /**
53
58
  * The path where the component files should be created, relative to the current workspace.
54
59
  * If not provided, a folder with the same name as the component will be created in the
@@ -135,6 +135,11 @@
135
135
  "type": "boolean",
136
136
  "default": false,
137
137
  "description": "Use a default export for the component in its TypeScript file instead of a named export."
138
+ },
139
+ "ngHtml": {
140
+ "type": "boolean",
141
+ "default": true,
142
+ "description": "Generate component template files with an '.ng.html' file extension instead of '.html'. The '.ng.html' file extension is recommended by the Angular style guide."
138
143
  }
139
144
  },
140
145
  "required": ["name", "project"]
@@ -1,22 +1,12 @@
1
1
  {
2
2
  "schematics": {
3
3
  "use-application-builder": {
4
- "version": "19.0.0",
4
+ "version": "20.0.0",
5
5
  "factory": "./use-application-builder/migration",
6
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",
7
7
  "optional": true,
8
8
  "recommended": true,
9
9
  "documentation": "tools/cli/build-system-migration"
10
- },
11
- "update-workspace-config": {
12
- "version": "19.0.0",
13
- "factory": "./update-workspace-config/migration",
14
- "description": "Update the workspace configuration by replacing deprecated options in 'angular.json' for compatibility with the latest Angular CLI changes."
15
- },
16
- "update-ssr-imports": {
17
- "version": "19.0.0",
18
- "factory": "./update-ssr-imports/migration",
19
- "description": "Update '@angular/ssr' import paths to use the new '/node' entry point when 'CommonEngine' is detected."
20
10
  }
21
11
  }
22
12
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schematics/angular",
3
- "version": "20.0.0-next.0",
3
+ "version": "20.0.0-next.1",
4
4
  "description": "Schematics specific to Angular",
5
5
  "homepage": "https://github.com/angular/angular-cli",
6
6
  "keywords": [
@@ -22,14 +22,15 @@
22
22
  },
23
23
  "schematics": "./collection.json",
24
24
  "dependencies": {
25
- "@angular-devkit/core": "20.0.0-next.0",
26
- "@angular-devkit/schematics": "20.0.0-next.0",
25
+ "@angular-devkit/core": "20.0.0-next.1",
26
+ "@angular-devkit/schematics": "20.0.0-next.1",
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@9.15.6",
33
34
  "engines": {
34
35
  "node": "^20.11.1 || >=22.0.0",
35
36
  "npm": "^6.11.0 || ^7.5.6 || >=8.0.0",
@@ -16,7 +16,7 @@ exports.latestVersions = {
16
16
  // As Angular CLI works with same minor versions of Angular Framework, a tilde match for the current
17
17
  Angular: '^20.0.0-next.0',
18
18
  NgPackagr: '^20.0.0-next.0',
19
- DevkitBuildAngular: '^20.0.0-next.0',
20
- AngularBuild: '^20.0.0-next.0',
21
- AngularSSR: '^20.0.0-next.0',
19
+ DevkitBuildAngular: '^20.0.0-next.1',
20
+ AngularBuild: '^20.0.0-next.1',
21
+ AngularSSR: '^20.0.0-next.1',
22
22
  };
@@ -11,12 +11,10 @@
11
11
  "noFallthroughCasesInSwitch": true,<% } %>
12
12
  "skipLibCheck": true,
13
13
  "isolatedModules": true,
14
- "esModuleInterop": true,
15
14
  "experimentalDecorators": true,
16
- "moduleResolution": "bundler",
17
15
  "importHelpers": true,
18
16
  "target": "ES2022",
19
- "module": "ES2022"
17
+ "module": "preserve"
20
18
  },
21
19
  "angularCompilerOptions": {
22
20
  "enableI18nLegacyMessageIdFormat": false<% if (strict) { %>,
@@ -1,15 +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
- /**
10
- * Schematics rule that identifies and updates import declarations in TypeScript files.
11
- * Specifically, it modifies imports of '@angular/ssr' by appending '/node' if the
12
- * `CommonEngine` is used from the old entry point.
13
- *
14
- */
15
- export default function (): Rule;
@@ -1,107 +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('CommonEngine') && !content.includes('@angular/ssr/node')) {
53
- const source = ts.createSourceFile(entry.path, content.toString().replace(/^\uFEFF/, ''), ts.ScriptTarget.Latest, true);
54
- yield source;
55
- }
56
- }
57
- }
58
- }
59
- for (const path of directory.subdirs) {
60
- if (path === 'node_modules' || path.startsWith('.')) {
61
- continue;
62
- }
63
- yield* visit(directory.dir(path));
64
- }
65
- }
66
- /**
67
- * Schematics rule that identifies and updates import declarations in TypeScript files.
68
- * Specifically, it modifies imports of '@angular/ssr' by appending '/node' if the
69
- * `CommonEngine` is used from the old entry point.
70
- *
71
- */
72
- function default_1() {
73
- return (tree) => {
74
- if (!(0, dependencies_1.getPackageJsonDependency)(tree, '@angular/ssr')) {
75
- return;
76
- }
77
- for (const sourceFile of visit(tree.root)) {
78
- let recorder;
79
- const allImportDeclarations = sourceFile.statements.filter((n) => ts.isImportDeclaration(n));
80
- if (allImportDeclarations.length === 0) {
81
- continue;
82
- }
83
- const ssrImports = allImportDeclarations.filter((n) => ts.isStringLiteral(n.moduleSpecifier) && n.moduleSpecifier.text === '@angular/ssr');
84
- for (const ssrImport of ssrImports) {
85
- const ssrNamedBinding = getNamedImports(ssrImport);
86
- if (ssrNamedBinding) {
87
- const isUsingOldEntryPoint = ssrNamedBinding.elements.some((e) => e.name.text.startsWith('CommonEngine'));
88
- if (!isUsingOldEntryPoint) {
89
- continue;
90
- }
91
- recorder ??= tree.beginUpdate(sourceFile.fileName);
92
- recorder.insertRight(ssrImport.moduleSpecifier.getEnd() - 1, '/node');
93
- }
94
- }
95
- if (recorder) {
96
- tree.commitUpdate(recorder);
97
- }
98
- }
99
- };
100
- }
101
- function getNamedImports(importDeclaration) {
102
- const namedBindings = importDeclaration?.importClause?.namedBindings;
103
- if (namedBindings && ts.isNamedImports(namedBindings)) {
104
- return namedBindings;
105
- }
106
- return undefined;
107
- }
@@ -1,33 +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
- /**
10
- * Main entry point for the migration rule.
11
- *
12
- * This schematic migration performs updates to the Angular workspace configuration
13
- * to ensure that application projects are properly configured with polyfills
14
- * required for internationalization (`localize`).
15
- *
16
- * It specifically targets application projects that use either the `application`
17
- * or `browser-esbuild` builders.
18
- *
19
- * The migration process involves:
20
- *
21
- * 1. Iterating over all projects in the workspace.
22
- * 2. Checking each project to determine if it is an application-type project.
23
- * 3. For each application project, examining the associated build targets.
24
- * 4. If a build target's `localize` option is enabled but the polyfill
25
- * `@angular/localize/init` is missing from the `polyfills` array, the polyfill
26
- * is automatically added to ensure proper internationalization support.
27
- *
28
- * Additionally, this migration updates projects that use the `dev-server` or `extract-i18n`
29
- * builders to ensure that deprecated `browserTarget` options are migrated to the
30
- * newer `buildTarget` field.
31
- *
32
- */
33
- export default function (): Rule;
@@ -1,77 +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 workspace_models_1 = require("../../utility/workspace-models");
13
- /**
14
- * Main entry point for the migration rule.
15
- *
16
- * This schematic migration performs updates to the Angular workspace configuration
17
- * to ensure that application projects are properly configured with polyfills
18
- * required for internationalization (`localize`).
19
- *
20
- * It specifically targets application projects that use either the `application`
21
- * or `browser-esbuild` builders.
22
- *
23
- * The migration process involves:
24
- *
25
- * 1. Iterating over all projects in the workspace.
26
- * 2. Checking each project to determine if it is an application-type project.
27
- * 3. For each application project, examining the associated build targets.
28
- * 4. If a build target's `localize` option is enabled but the polyfill
29
- * `@angular/localize/init` is missing from the `polyfills` array, the polyfill
30
- * is automatically added to ensure proper internationalization support.
31
- *
32
- * Additionally, this migration updates projects that use the `dev-server` or `extract-i18n`
33
- * builders to ensure that deprecated `browserTarget` options are migrated to the
34
- * newer `buildTarget` field.
35
- *
36
- */
37
- function default_1() {
38
- return (0, workspace_1.updateWorkspace)((workspace) => {
39
- for (const project of workspace.projects.values()) {
40
- if (project.extensions.projectType !== workspace_models_1.ProjectType.Application) {
41
- continue;
42
- }
43
- for (const target of project.targets.values()) {
44
- if (target.builder === workspace_models_1.Builders.DevServer || target.builder === workspace_models_1.Builders.ExtractI18n) {
45
- // Migrate `browserTarget` to `buildTarget`
46
- for (const [, options] of (0, workspace_1.allTargetOptions)(target, false)) {
47
- if (options['browserTarget'] && !options['buildTarget']) {
48
- options['buildTarget'] = options['browserTarget'];
49
- }
50
- delete options['browserTarget'];
51
- }
52
- }
53
- // Check if the target uses application-related builders
54
- if (target.builder !== workspace_models_1.Builders.BuildApplication &&
55
- target.builder !== workspace_models_1.Builders.Application &&
56
- target.builder !== workspace_models_1.Builders.BrowserEsbuild) {
57
- continue;
58
- }
59
- // Check if polyfills include '@angular/localize/init'
60
- const polyfills = target.options?.['polyfills'];
61
- if (Array.isArray(polyfills) &&
62
- polyfills.some((polyfill) => typeof polyfill === 'string' && polyfill.startsWith('@angular/localize'))) {
63
- // Skip if the polyfill is already present
64
- continue;
65
- }
66
- // Add '@angular/localize/init' polyfill if localize option is enabled
67
- for (const [, options] of (0, workspace_1.allTargetOptions)(target, false)) {
68
- if (options['localize']) {
69
- target.options ??= {};
70
- (target.options['polyfills'] ??= []).push('@angular/localize/init');
71
- break;
72
- }
73
- }
74
- }
75
- }
76
- });
77
- }