@schematics/angular 19.2.0-next.0 → 19.2.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/app-shell/index.js +37 -58
- package/component/files/__name@dasherize@if-flat__/__name@dasherize__.__type@dasherize__.ts.template +1 -2
- package/library/index.js +3 -3
- package/migrations/update-ssr-imports/migration.js +4 -0
- package/package.json +3 -3
- package/server/files/application-builder/ngmodule-src/app/app.module.server.ts.template +2 -2
- package/server/files/application-builder/standalone-src/app/app.config.server.ts.template +2 -2
- package/ssr/files/application-builder/server.ts.template +1 -1
- package/ssr/files/application-builder-common-engine/server.ts.template +2 -0
- package/utility/latest-versions/package.json +1 -1
- package/utility/latest-versions.js +4 -4
package/app-shell/index.js
CHANGED
|
@@ -106,17 +106,6 @@ function validateProject(mainPath) {
|
|
|
106
106
|
}
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
|
-
function addRouterModule(mainPath) {
|
|
110
|
-
return (host) => {
|
|
111
|
-
const modulePath = (0, ng_ast_utils_1.getAppModulePath)(host, mainPath);
|
|
112
|
-
const moduleSource = getSourceFile(host, modulePath);
|
|
113
|
-
const changes = (0, ast_utils_1.addImportToModule)(moduleSource, modulePath, 'RouterModule', '@angular/router');
|
|
114
|
-
const recorder = host.beginUpdate(modulePath);
|
|
115
|
-
(0, change_1.applyToUpdateRecorder)(recorder, changes);
|
|
116
|
-
host.commitUpdate(recorder);
|
|
117
|
-
return host;
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
109
|
function getMetadataProperty(metadata, propertyName) {
|
|
121
110
|
const properties = metadata.properties;
|
|
122
111
|
const property = properties.filter(typescript_1.default.isPropertyAssignment).filter((prop) => {
|
|
@@ -202,7 +191,7 @@ function addStandaloneServerRoute(options) {
|
|
|
202
191
|
if (!host.exists(configFilePath)) {
|
|
203
192
|
throw new schematics_1.SchematicsException(`Cannot find "${configFilePath}".`);
|
|
204
193
|
}
|
|
205
|
-
|
|
194
|
+
const recorder = host.beginUpdate(configFilePath);
|
|
206
195
|
let configSourceFile = getSourceFile(host, configFilePath);
|
|
207
196
|
if (!(0, ast_utils_1.isImported)(configSourceFile, 'ROUTES', '@angular/router')) {
|
|
208
197
|
const routesChange = (0, ast_utils_1.insertImport)(configSourceFile, configFilePath, 'ROUTES', '@angular/router');
|
|
@@ -220,62 +209,48 @@ function addStandaloneServerRoute(options) {
|
|
|
220
209
|
const updatedProvidersString = [
|
|
221
210
|
...providersLiteral.elements.map((element) => ' ' + element.getText()),
|
|
222
211
|
` {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
212
|
+
provide: ROUTES,
|
|
213
|
+
multi: true,
|
|
214
|
+
useValue: [{
|
|
215
|
+
path: '${APP_SHELL_ROUTE}',
|
|
216
|
+
component: AppShellComponent
|
|
217
|
+
}]
|
|
218
|
+
}\n `,
|
|
230
219
|
];
|
|
231
220
|
recorder.insertRight(providersLiteral.getStart(), `[\n${updatedProvidersString.join(',\n')}]`);
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
const functionCall = (0, ast_utils_1.findNodes)(configSourceFile, typescript_1.default.isCallExpression).find((n) => typescript_1.default.isIdentifier(n.expression) && n.expression.getText() === 'provideServerRoutesConfig');
|
|
236
|
-
if (!functionCall) {
|
|
237
|
-
throw new schematics_1.SchematicsException(`Cannot find the "provideServerRoutesConfig" function call in "${configFilePath}".`);
|
|
238
|
-
}
|
|
239
|
-
recorder = host.beginUpdate(configFilePath);
|
|
240
|
-
recorder.insertLeft(functionCall.end - 1, `, { appShellRoute: '${APP_SHELL_ROUTE}' }`);
|
|
241
|
-
}
|
|
242
|
-
// Add AppShellComponent import
|
|
243
|
-
const appShellImportChange = (0, ast_utils_1.insertImport)(configSourceFile, configFilePath, 'AppShellComponent', './app-shell/app-shell.component');
|
|
244
|
-
(0, change_1.applyToUpdateRecorder)(recorder, [appShellImportChange]);
|
|
221
|
+
(0, change_1.applyToUpdateRecorder)(recorder, [
|
|
222
|
+
(0, ast_utils_1.insertImport)(configSourceFile, configFilePath, 'AppShellComponent', './app-shell/app-shell.component'),
|
|
223
|
+
]);
|
|
245
224
|
host.commitUpdate(recorder);
|
|
246
225
|
};
|
|
247
226
|
}
|
|
248
|
-
function addServerRoutingConfig(options) {
|
|
227
|
+
function addServerRoutingConfig(options, isStandalone) {
|
|
249
228
|
return async (host) => {
|
|
250
229
|
const workspace = await (0, workspace_1.getWorkspace)(host);
|
|
251
230
|
const project = workspace.projects.get(options.project);
|
|
252
231
|
if (!project) {
|
|
253
232
|
throw new schematics_1.SchematicsException(`Project name "${options.project}" doesn't not exist.`);
|
|
254
233
|
}
|
|
255
|
-
const configFilePath =
|
|
256
|
-
|
|
234
|
+
const configFilePath = isStandalone
|
|
235
|
+
? (0, posix_1.join)(project.sourceRoot ?? 'src', 'app/app.config.server.ts')
|
|
236
|
+
: getServerModulePath(host, project.sourceRoot || 'src', 'main.server.ts');
|
|
237
|
+
if (!configFilePath || !host.exists(configFilePath)) {
|
|
257
238
|
throw new schematics_1.SchematicsException(`Cannot find "${configFilePath}".`);
|
|
258
239
|
}
|
|
259
|
-
|
|
260
|
-
const
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
typescript_1.default.isArrayTypeNode(node.type) &&
|
|
267
|
-
node.type.getText().includes('ServerRoute'));
|
|
268
|
-
if (!serverRoutesNode) {
|
|
269
|
-
throw new schematics_1.SchematicsException(`Cannot find the "ServerRoute" configuration in "${configFilePath}".`);
|
|
240
|
+
let recorder = host.beginUpdate(configFilePath);
|
|
241
|
+
const configSourceFile = getSourceFile(host, configFilePath);
|
|
242
|
+
const functionCall = (0, ast_utils_1.findNodes)(configSourceFile, typescript_1.default.isCallExpression,
|
|
243
|
+
/** max */ undefined,
|
|
244
|
+
/** recursive */ true).find((n) => typescript_1.default.isIdentifier(n.expression) && n.expression.getText() === 'provideServerRouting');
|
|
245
|
+
if (!functionCall) {
|
|
246
|
+
throw new schematics_1.SchematicsException(`Cannot find the "provideServerRouting" function call in "${configFilePath}".`);
|
|
270
247
|
}
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
},\n`;
|
|
278
|
-
recorder.insertLeft(firstElementPosition, newRouteString);
|
|
248
|
+
recorder = host.beginUpdate(configFilePath);
|
|
249
|
+
recorder.insertLeft(functionCall.end - 1, `, withAppShell(AppShellComponent)`);
|
|
250
|
+
(0, change_1.applyToUpdateRecorder)(recorder, [
|
|
251
|
+
(0, ast_utils_1.insertImport)(configSourceFile, configFilePath, 'withAppShell', '@angular/ssr'),
|
|
252
|
+
(0, ast_utils_1.insertImport)(configSourceFile, configFilePath, 'AppShellComponent', './app-shell/app-shell.component'),
|
|
253
|
+
]);
|
|
279
254
|
host.commitUpdate(recorder);
|
|
280
255
|
};
|
|
281
256
|
}
|
|
@@ -286,10 +261,14 @@ function default_1(options) {
|
|
|
286
261
|
return (0, schematics_1.chain)([
|
|
287
262
|
validateProject(browserEntryPoint),
|
|
288
263
|
(0, schematics_1.schematic)('server', options),
|
|
289
|
-
...(
|
|
290
|
-
? [
|
|
291
|
-
:
|
|
292
|
-
|
|
264
|
+
...(options.serverRouting
|
|
265
|
+
? [(0, schematics_1.noop)()]
|
|
266
|
+
: isStandalone
|
|
267
|
+
? [addStandaloneServerRoute(options)]
|
|
268
|
+
: [addServerRoutes(options)]),
|
|
269
|
+
options.serverRouting
|
|
270
|
+
? addServerRoutingConfig(options, isStandalone)
|
|
271
|
+
: addAppShellConfigToWorkspace(options),
|
|
293
272
|
(0, schematics_1.schematic)('component', {
|
|
294
273
|
name: 'app-shell',
|
|
295
274
|
module: 'app.module.server.ts',
|
package/component/files/__name@dasherize@if-flat__/__name@dasherize__.__type@dasherize__.ts.template
CHANGED
|
@@ -3,8 +3,7 @@ import { <% if(changeDetection !== 'Default') { %>ChangeDetectionStrategy, <% }%
|
|
|
3
3
|
@Component({<% if(!skipSelector) {%>
|
|
4
4
|
selector: '<%= selector %>',<%}%><% if(standalone) {%>
|
|
5
5
|
imports: [],<%} else { %>
|
|
6
|
-
standalone: false
|
|
7
|
-
<% }%><% if(inlineTemplate) { %>
|
|
6
|
+
standalone: false,<% }%><% if(inlineTemplate) { %>
|
|
8
7
|
template: `
|
|
9
8
|
<p>
|
|
10
9
|
<%= dasherize(name) %> works!
|
package/library/index.js
CHANGED
|
@@ -38,8 +38,8 @@ function addDependenciesToPackageJson() {
|
|
|
38
38
|
},
|
|
39
39
|
{
|
|
40
40
|
type: dependencies_1.NodeDependencyType.Dev,
|
|
41
|
-
name: '@angular/build',
|
|
42
|
-
version: latest_versions_1.latestVersions.
|
|
41
|
+
name: '@angular-devkit/build-angular',
|
|
42
|
+
version: latest_versions_1.latestVersions.DevkitBuildAngular,
|
|
43
43
|
},
|
|
44
44
|
{
|
|
45
45
|
type: dependencies_1.NodeDependencyType.Dev,
|
|
@@ -70,7 +70,7 @@ function addLibToWorkspaceFile(options, projectRoot, projectName) {
|
|
|
70
70
|
prefix: options.prefix,
|
|
71
71
|
targets: {
|
|
72
72
|
build: {
|
|
73
|
-
builder: workspace_models_1.Builders.
|
|
73
|
+
builder: workspace_models_1.Builders.NgPackagr,
|
|
74
74
|
defaultConfiguration: 'production',
|
|
75
75
|
options: {
|
|
76
76
|
project: `${projectRoot}/ng-package.json`,
|
|
@@ -42,6 +42,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
42
42
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
43
|
exports.default = default_1;
|
|
44
44
|
const ts = __importStar(require("../../third_party/github.com/Microsoft/TypeScript/lib/typescript"));
|
|
45
|
+
const dependencies_1 = require("../../utility/dependencies");
|
|
45
46
|
function* visit(directory) {
|
|
46
47
|
for (const path of directory.subfiles) {
|
|
47
48
|
if (path.endsWith('.ts') && !path.endsWith('.d.ts')) {
|
|
@@ -70,6 +71,9 @@ function* visit(directory) {
|
|
|
70
71
|
*/
|
|
71
72
|
function default_1() {
|
|
72
73
|
return (tree) => {
|
|
74
|
+
if (!(0, dependencies_1.getPackageJsonDependency)(tree, '@angular/ssr')) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
73
77
|
for (const sourceFile of visit(tree.root)) {
|
|
74
78
|
let recorder;
|
|
75
79
|
const allImportDeclarations = sourceFile.statements.filter((n) => ts.isImportDeclaration(n));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@schematics/angular",
|
|
3
|
-
"version": "19.2.0-next.
|
|
3
|
+
"version": "19.2.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.2.0-next.
|
|
26
|
-
"@angular-devkit/schematics": "19.2.0-next.
|
|
25
|
+
"@angular-devkit/core": "19.2.0-next.2",
|
|
26
|
+
"@angular-devkit/schematics": "19.2.0-next.2",
|
|
27
27
|
"jsonc-parser": "3.3.1"
|
|
28
28
|
},
|
|
29
29
|
"repository": {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { NgModule } from '@angular/core';
|
|
2
2
|
import { ServerModule } from '@angular/platform-server';<% if(serverRouting) { %>
|
|
3
|
-
import {
|
|
3
|
+
import { provideServerRouting } from '@angular/ssr';<% } %>
|
|
4
4
|
import { AppComponent } from './app.component';
|
|
5
5
|
import { AppModule } from './app.module';<% if(serverRouting) { %>
|
|
6
6
|
import { serverRoutes } from './app.routes.server';<% } %>
|
|
7
7
|
|
|
8
8
|
@NgModule({
|
|
9
9
|
imports: [AppModule, ServerModule],<% if(serverRouting) { %>
|
|
10
|
-
providers: [
|
|
10
|
+
providers: [provideServerRouting(serverRoutes)],<% } %>
|
|
11
11
|
bootstrap: [AppComponent],
|
|
12
12
|
})
|
|
13
13
|
export class AppServerModule {}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { mergeApplicationConfig, ApplicationConfig } from '@angular/core';
|
|
2
2
|
import { provideServerRendering } from '@angular/platform-server';<% if(serverRouting) { %>
|
|
3
|
-
import {
|
|
3
|
+
import { provideServerRouting } from '@angular/ssr';<% } %>
|
|
4
4
|
import { appConfig } from './app.config';<% if(serverRouting) { %>
|
|
5
5
|
import { serverRoutes } from './app.routes.server';<% } %>
|
|
6
6
|
|
|
7
7
|
const serverConfig: ApplicationConfig = {
|
|
8
8
|
providers: [
|
|
9
9
|
provideServerRendering(),<% if(serverRouting) { %>
|
|
10
|
-
|
|
10
|
+
provideServerRouting(serverRoutes)<% } %>
|
|
11
11
|
]
|
|
12
12
|
};
|
|
13
13
|
|
|
@@ -61,6 +61,6 @@ if (isMainModule(import.meta.url)) {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
/**
|
|
64
|
-
*
|
|
64
|
+
* Request handler used by the Angular CLI (for dev-server and during build) or Firebase Cloud Functions.
|
|
65
65
|
*/
|
|
66
66
|
export const reqHandler = createNodeRequestHandler(app);
|
|
@@ -15,8 +15,8 @@ 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: '^19.2.0-next.0',
|
|
18
|
-
NgPackagr: '^19.
|
|
19
|
-
DevkitBuildAngular: '^19.2.0-next.
|
|
20
|
-
AngularBuild: '^19.2.0-next.
|
|
21
|
-
AngularSSR: '^19.2.0-next.
|
|
18
|
+
NgPackagr: '^19.2.0-next.0',
|
|
19
|
+
DevkitBuildAngular: '^19.2.0-next.2',
|
|
20
|
+
AngularBuild: '^19.2.0-next.2',
|
|
21
|
+
AngularSSR: '^19.2.0-next.2',
|
|
22
22
|
};
|