@schematics/angular 19.0.0-rc.0 → 19.0.0-rc.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.
@@ -202,7 +202,7 @@ function addStandaloneServerRoute(options) {
202
202
  if (!host.exists(configFilePath)) {
203
203
  throw new schematics_1.SchematicsException(`Cannot find "${configFilePath}".`);
204
204
  }
205
- const recorder = host.beginUpdate(configFilePath);
205
+ let recorder = host.beginUpdate(configFilePath);
206
206
  let configSourceFile = getSourceFile(host, configFilePath);
207
207
  if (!(0, ast_utils_1.isImported)(configSourceFile, 'ROUTES', '@angular/router')) {
208
208
  const routesChange = (0, ast_utils_1.insertImport)(configSourceFile, configFilePath, 'ROUTES', '@angular/router');
@@ -229,6 +229,16 @@ function addStandaloneServerRoute(options) {
229
229
  }\n `,
230
230
  ];
231
231
  recorder.insertRight(providersLiteral.getStart(), `[\n${updatedProvidersString.join(',\n')}]`);
232
+ if (options.serverRouting) {
233
+ host.commitUpdate(recorder);
234
+ configSourceFile = getSourceFile(host, configFilePath);
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
+ }
232
242
  // Add AppShellComponent import
233
243
  const appShellImportChange = (0, ast_utils_1.insertImport)(configSourceFile, configFilePath, 'AppShellComponent', './app-shell/app-shell.component');
234
244
  (0, change_1.applyToUpdateRecorder)(recorder, [appShellImportChange]);
@@ -279,9 +289,7 @@ function default_1(options) {
279
289
  ...(isStandalone
280
290
  ? [addStandaloneServerRoute(options)]
281
291
  : [addRouterModule(browserEntryPoint), addServerRoutes(options)]),
282
- options.serverRouting
283
- ? addServerRoutingConfig(options)
284
- : addAppShellConfigToWorkspace(options),
292
+ options.serverRouting ? (0, schematics_1.noop)() : addAppShellConfigToWorkspace(options),
285
293
  (0, schematics_1.schematic)('component', {
286
294
  name: 'app-shell',
287
295
  module: 'app.module.server.ts',
@@ -1,6 +1,6 @@
1
1
  import { ComponentFixture, TestBed } from '@angular/core/testing';
2
2
 
3
- import { <%= classify(name) %><%= classify(type) %> } from './<%= dasherize(name) %><%= type ? '.' + dasherize(type): '' %>';
3
+ import <% if(!exportDefault) { %>{ <% }%><%= classify(name) %><%= classify(type) %> <% if(!exportDefault) {%>} <% }%>from './<%= dasherize(name) %><%= type ? '.' + dasherize(type): '' %>';
4
4
 
5
5
  describe('<%= classify(name) %><%= classify(type) %>', () => {
6
6
  let component: <%= classify(name) %><%= classify(type) %>;
@@ -5,6 +5,7 @@
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
+ "recommended": true,
8
9
  "documentation": "tools/cli/build-system-migration"
9
10
  },
10
11
  "update-workspace-config": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schematics/angular",
3
- "version": "19.0.0-rc.0",
3
+ "version": "19.0.0-rc.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-rc.0",
26
- "@angular-devkit/schematics": "19.0.0-rc.0",
25
+ "@angular-devkit/core": "19.0.0-rc.2",
26
+ "@angular-devkit/schematics": "19.0.0-rc.2",
27
27
  "jsonc-parser": "3.3.1"
28
28
  },
29
29
  "packageManager": "yarn@4.5.0",
@@ -29,26 +29,20 @@ const angularApp = new AngularNodeAppEngine();
29
29
  /**
30
30
  * Serve static files from /<%= browserDistDirectory %>
31
31
  */
32
- app.get(
33
- '**',
32
+ app.use(
34
33
  express.static(browserDistFolder, {
35
34
  maxAge: '1y',
36
- index: 'index.html',
37
- setHeaders: (res) => {
38
- const headers = angularApp.getPrerenderHeaders(res.req);
39
- for (const [key, value] of headers) {
40
- res.setHeader(key, value);
41
- }
42
- },
35
+ index: false,
36
+ redirect: false,
43
37
  }),
44
38
  );
45
39
 
46
40
  /**
47
41
  * Handle all other requests by rendering the Angular application.
48
42
  */
49
- app.get('**', (req, res, next) => {
43
+ app.use('/**', (req, res, next) => {
50
44
  angularApp
51
- .render(req)
45
+ .handle(req)
52
46
  .then((response) =>
53
47
  response ? writeResponseToNodeResponse(response, res) : next(),
54
48
  )
@@ -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-rc.0',
19
- AngularSSR: '^19.0.0-rc.0',
18
+ DevkitBuildAngular: '^19.0.0-rc.2',
19
+ AngularSSR: '^19.0.0-rc.2',
20
20
  };