@schematics/angular 19.0.0-next.0 → 19.0.0-next.2
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.
- package/application/index.js +2 -2
- package/component/files/__name@dasherize@if-flat__/__name@dasherize__.__type@dasherize__.ts.template +1 -1
- package/component/schema.d.ts +4 -0
- package/component/schema.json +5 -0
- package/migrations/migration-collection.json +11 -1
- package/migrations/update-ssr-imports/migration.d.ts +15 -0
- package/migrations/update-ssr-imports/migration.js +93 -0
- package/migrations/update-workspace-config/migration.d.ts +33 -0
- package/migrations/update-workspace-config/migration.js +77 -0
- package/package.json +3 -3
- package/server/index.js +5 -1
- package/ssr/files/application-builder/server.ts.template +1 -1
- package/ssr/files/server-builder/server.ts.template +1 -1
- package/ssr/index.js +0 -4
- package/utility/latest-versions/package.json +1 -1
- package/utility/latest-versions.js +2 -2
- package/utility/workspace-models.d.ts +1 -5
- package/workspace/files/tsconfig.json.template +0 -2
package/application/index.js
CHANGED
package/component/files/__name@dasherize@if-flat__/__name@dasherize__.__type@dasherize__.ts.template
CHANGED
|
@@ -19,6 +19,6 @@ import { <% if(changeDetection !== 'Default') { %>ChangeDetectionStrategy, <% }%
|
|
|
19
19
|
encapsulation: ViewEncapsulation.<%= viewEncapsulation %><% } if (changeDetection !== 'Default') { %>,
|
|
20
20
|
changeDetection: ChangeDetectionStrategy.<%= changeDetection %><% } %>
|
|
21
21
|
})
|
|
22
|
-
export class <%= classify(name) %><%= classify(type) %> {
|
|
22
|
+
export <% if(exportDefault) {%>default <%}%>class <%= classify(name) %><%= classify(type) %> {
|
|
23
23
|
|
|
24
24
|
}
|
package/component/schema.d.ts
CHANGED
|
@@ -14,6 +14,10 @@ export interface Schema {
|
|
|
14
14
|
* The declaring NgModule exports this component.
|
|
15
15
|
*/
|
|
16
16
|
export?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Use default export for the component instead of a named export.
|
|
19
|
+
*/
|
|
20
|
+
exportDefault?: boolean;
|
|
17
21
|
/**
|
|
18
22
|
* Create the new files at the top level of the current project.
|
|
19
23
|
*/
|
package/component/schema.json
CHANGED
|
@@ -130,6 +130,11 @@
|
|
|
130
130
|
"type": "boolean",
|
|
131
131
|
"default": false,
|
|
132
132
|
"description": "The declaring NgModule exports this component."
|
|
133
|
+
},
|
|
134
|
+
"exportDefault": {
|
|
135
|
+
"type": "boolean",
|
|
136
|
+
"default": false,
|
|
137
|
+
"description": "Use default export for the component instead of a named export."
|
|
133
138
|
}
|
|
134
139
|
},
|
|
135
140
|
"required": ["name", "project"]
|
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schematics": {
|
|
3
3
|
"use-application-builder": {
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "19.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
|
"documentation": "tools/cli/build-system-migration"
|
|
9
|
+
},
|
|
10
|
+
"update-workspace-config": {
|
|
11
|
+
"version": "19.0.0",
|
|
12
|
+
"factory": "./update-workspace-config/migration",
|
|
13
|
+
"description": "Update the workspace configuration by replacing deprecated options in 'angular.json' for compatibility with the latest Angular CLI changes."
|
|
14
|
+
},
|
|
15
|
+
"update-ssr-imports": {
|
|
16
|
+
"version": "19.0.0",
|
|
17
|
+
"factory": "./update-ssr-imports/migration",
|
|
18
|
+
"description": "Update '@angular/ssr' import paths to use the new '/node' entry point when 'CommonEngine' is detected."
|
|
9
19
|
}
|
|
10
20
|
}
|
|
11
21
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
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;
|
|
@@ -0,0 +1,93 @@
|
|
|
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 (mod) {
|
|
26
|
+
if (mod && mod.__esModule) return mod;
|
|
27
|
+
var result = {};
|
|
28
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
29
|
+
__setModuleDefault(result, mod);
|
|
30
|
+
return result;
|
|
31
|
+
};
|
|
32
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
+
exports.default = default_1;
|
|
34
|
+
const ts = __importStar(require("../../third_party/github.com/Microsoft/TypeScript/lib/typescript"));
|
|
35
|
+
function* visit(directory) {
|
|
36
|
+
for (const path of directory.subfiles) {
|
|
37
|
+
if (path.endsWith('.ts') && !path.endsWith('.d.ts')) {
|
|
38
|
+
const entry = directory.file(path);
|
|
39
|
+
if (entry) {
|
|
40
|
+
const content = entry.content;
|
|
41
|
+
if (content.includes('CommonEngine') && !content.includes('@angular/ssr/node')) {
|
|
42
|
+
const source = ts.createSourceFile(entry.path, content.toString().replace(/^\uFEFF/, ''), ts.ScriptTarget.Latest, true);
|
|
43
|
+
yield source;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
for (const path of directory.subdirs) {
|
|
49
|
+
if (path === 'node_modules' || path.startsWith('.')) {
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
yield* visit(directory.dir(path));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Schematics rule that identifies and updates import declarations in TypeScript files.
|
|
57
|
+
* Specifically, it modifies imports of '@angular/ssr' by appending '/node' if the
|
|
58
|
+
* `CommonEngine` is used from the old entry point.
|
|
59
|
+
*
|
|
60
|
+
*/
|
|
61
|
+
function default_1() {
|
|
62
|
+
return (tree) => {
|
|
63
|
+
for (const sourceFile of visit(tree.root)) {
|
|
64
|
+
let recorder;
|
|
65
|
+
const allImportDeclarations = sourceFile.statements.filter((n) => ts.isImportDeclaration(n));
|
|
66
|
+
if (allImportDeclarations.length === 0) {
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
const ssrImports = allImportDeclarations.filter((n) => ts.isStringLiteral(n.moduleSpecifier) && n.moduleSpecifier.text === '@angular/ssr');
|
|
70
|
+
for (const ssrImport of ssrImports) {
|
|
71
|
+
const ssrNamedBinding = getNamedImports(ssrImport);
|
|
72
|
+
if (ssrNamedBinding) {
|
|
73
|
+
const isUsingOldEntryPoint = ssrNamedBinding.elements.some((e) => e.name.text.startsWith('CommonEngine'));
|
|
74
|
+
if (!isUsingOldEntryPoint) {
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
recorder ??= tree.beginUpdate(sourceFile.fileName);
|
|
78
|
+
recorder.insertRight(ssrImport.moduleSpecifier.getEnd() - 1, '/node');
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (recorder) {
|
|
82
|
+
tree.commitUpdate(recorder);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
function getNamedImports(importDeclaration) {
|
|
88
|
+
const namedBindings = importDeclaration?.importClause?.namedBindings;
|
|
89
|
+
if (namedBindings && ts.isNamedImports(namedBindings)) {
|
|
90
|
+
return namedBindings;
|
|
91
|
+
}
|
|
92
|
+
return undefined;
|
|
93
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
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;
|
|
@@ -0,0 +1,77 @@
|
|
|
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
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@schematics/angular",
|
|
3
|
-
"version": "19.0.0-next.
|
|
3
|
+
"version": "19.0.0-next.2",
|
|
4
4
|
"description": "Schematics specific to Angular",
|
|
5
5
|
"homepage": "https://github.com/angular/angular-cli",
|
|
6
6
|
"keywords": [
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
},
|
|
23
23
|
"schematics": "./collection.json",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@angular-devkit/core": "19.0.0-next.
|
|
26
|
-
"@angular-devkit/schematics": "19.0.0-next.
|
|
25
|
+
"@angular-devkit/core": "19.0.0-next.2",
|
|
26
|
+
"@angular-devkit/schematics": "19.0.0-next.2",
|
|
27
27
|
"jsonc-parser": "3.3.1"
|
|
28
28
|
},
|
|
29
29
|
"packageManager": "yarn@4.4.0",
|
package/server/index.js
CHANGED
|
@@ -111,6 +111,10 @@ function addDependencies(skipInstall) {
|
|
|
111
111
|
}
|
|
112
112
|
const install = skipInstall ? utility_1.InstallBehavior.None : utility_1.InstallBehavior.Auto;
|
|
113
113
|
return (0, schematics_1.chain)([
|
|
114
|
+
(0, utility_1.addDependency)('@angular/ssr', latest_versions_1.latestVersions.AngularSSR, {
|
|
115
|
+
type: utility_1.DependencyType.Default,
|
|
116
|
+
install,
|
|
117
|
+
}),
|
|
114
118
|
(0, utility_1.addDependency)('@angular/platform-server', coreDep.version, {
|
|
115
119
|
type: utility_1.DependencyType.Default,
|
|
116
120
|
install,
|
|
@@ -123,7 +127,7 @@ function addDependencies(skipInstall) {
|
|
|
123
127
|
};
|
|
124
128
|
}
|
|
125
129
|
function default_1(options) {
|
|
126
|
-
return async (host
|
|
130
|
+
return async (host) => {
|
|
127
131
|
const workspace = await (0, workspace_1.getWorkspace)(host);
|
|
128
132
|
const clientProject = workspace.projects.get(options.project);
|
|
129
133
|
if (clientProject?.extensions.projectType !== 'application') {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { APP_BASE_HREF } from '@angular/common';
|
|
2
|
-
import { CommonEngine } from '@angular/ssr';
|
|
2
|
+
import { CommonEngine } from '@angular/ssr/node';
|
|
3
3
|
import express from 'express';
|
|
4
4
|
import { fileURLToPath } from 'node:url';
|
|
5
5
|
import { dirname, join, resolve } from 'node:path';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import 'zone.js/node';
|
|
2
2
|
|
|
3
3
|
import { APP_BASE_HREF } from '@angular/common';
|
|
4
|
-
import { CommonEngine } from '@angular/ssr';
|
|
4
|
+
import { CommonEngine } from '@angular/ssr/node';
|
|
5
5
|
import * as express from 'express';
|
|
6
6
|
import { existsSync } from 'node:fs';
|
|
7
7
|
import { join } from 'node:path';
|
package/ssr/index.js
CHANGED
|
@@ -225,10 +225,6 @@ function updateWebpackBuilderServerTsConfigRule(options) {
|
|
|
225
225
|
function addDependencies({ skipInstall }, isUsingApplicationBuilder) {
|
|
226
226
|
const install = skipInstall ? utility_1.InstallBehavior.None : utility_1.InstallBehavior.Auto;
|
|
227
227
|
const rules = [
|
|
228
|
-
(0, utility_1.addDependency)('@angular/ssr', latest_versions_1.latestVersions.AngularSSR, {
|
|
229
|
-
type: utility_1.DependencyType.Default,
|
|
230
|
-
install,
|
|
231
|
-
}),
|
|
232
228
|
(0, utility_1.addDependency)('express', latest_versions_1.latestVersions['express'], {
|
|
233
229
|
type: utility_1.DependencyType.Default,
|
|
234
230
|
install,
|
|
@@ -15,6 +15,6 @@ 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
17
|
Angular: dependencies['@angular/core'],
|
|
18
|
-
DevkitBuildAngular: '^19.0.0-next.
|
|
19
|
-
AngularSSR: '^19.0.0-next.
|
|
18
|
+
DevkitBuildAngular: '^19.0.0-next.2',
|
|
19
|
+
AngularSSR: '^19.0.0-next.2',
|
|
20
20
|
};
|
|
@@ -67,11 +67,7 @@ export interface BrowserBuilderOptions extends BrowserBuilderBaseOptions {
|
|
|
67
67
|
webWorkerTsConfig?: string;
|
|
68
68
|
}
|
|
69
69
|
export interface ServeBuilderOptions {
|
|
70
|
-
|
|
71
|
-
* @deprecated not used since version 17.0.0. Use the property "buildTarget" instead.
|
|
72
|
-
*/
|
|
73
|
-
browserTarget: string;
|
|
74
|
-
buildTarget?: string;
|
|
70
|
+
buildTarget: string;
|
|
75
71
|
}
|
|
76
72
|
export interface LibraryBuilderOptions {
|
|
77
73
|
tsConfig: string;
|