@schematics/angular 19.0.0-next.1 → 19.0.0-next.10
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/LICENSE +5 -5
- package/app-shell/index.js +48 -73
- package/component/files/__name@dasherize@if-flat__/__name@dasherize__.__type@dasherize__.ts.template +1 -1
- package/component/index.js +1 -0
- package/component/schema.d.ts +4 -0
- package/component/schema.json +5 -0
- package/config/files/karma.conf.js.template +0 -1
- package/directive/index.js +1 -0
- package/migrations/migration-collection.json +5 -0
- package/migrations/update-ssr-imports/migration.d.ts +15 -0
- package/migrations/update-ssr-imports/migration.js +93 -0
- package/package.json +4 -4
- package/server/files/application-builder/ngmodule-src/app/app.module.server.ts.template +13 -0
- package/server/files/application-builder/ngmodule-src/app/app.routes.server.ts.template +8 -0
- package/server/files/application-builder/standalone-src/app/app.config.server.ts.template +14 -0
- package/server/files/application-builder/standalone-src/app/app.routes.server.ts.template +8 -0
- package/server/files/server-builder/ngmodule-src/main.server.ts.template +1 -0
- package/server/files/server-builder/standalone-src/main.server.ts.template +7 -0
- package/server/index.js +17 -8
- package/service-worker/files/ngsw-config.json.template +1 -0
- package/ssr/files/application-builder/server.ts.template +36 -44
- package/ssr/files/server-builder/server.ts.template +2 -2
- package/ssr/index.js +17 -21
- package/third_party/github.com/Microsoft/TypeScript/lib/typescript.d.ts +244 -156
- package/third_party/github.com/Microsoft/TypeScript/lib/typescript.js +4617 -3454
- package/utility/latest-versions/package.json +2 -2
- package/utility/latest-versions.js +2 -2
- package/workspace/files/__dot__editorconfig.template +1 -0
- package/workspace/files/tsconfig.json.template +1 -5
- /package/server/files/{src → application-builder/ngmodule-src}/main.server.ts.template +0 -0
- /package/server/files/{standalone-src → application-builder/standalone-src}/main.server.ts.template +0 -0
- /package/server/files/{src → server-builder/ngmodule-src}/app/app.module.server.ts.template +0 -0
- /package/server/files/{root → server-builder/root}/tsconfig.server.json.template +0 -0
- /package/server/files/{standalone-src → server-builder/standalone-src}/app/app.config.server.ts.template +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
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';
|
|
8
|
-
import <% if (isStandalone) { %>bootstrap<% } else { %>AppServerModule<% } %> from './
|
|
8
|
+
import <% if (isStandalone) { %>bootstrap<% } else { %>AppServerModule<% } %> from './main.server';
|
|
9
9
|
|
|
10
10
|
// The Express app is exported so that it can be used by serverless Functions.
|
|
11
11
|
export function app(): express.Express {
|
package/ssr/index.js
CHANGED
|
@@ -108,15 +108,14 @@ function updateApplicationBuilderTsConfigRule(options) {
|
|
|
108
108
|
// No tsconfig path
|
|
109
109
|
return;
|
|
110
110
|
}
|
|
111
|
-
const
|
|
112
|
-
const
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
111
|
+
const json = new json_file_1.JSONFile(host, tsConfigPath);
|
|
112
|
+
const filesPath = ['files'];
|
|
113
|
+
const files = new Set(json.get(filesPath) ?? []);
|
|
114
|
+
files.add('src/server.ts');
|
|
115
|
+
json.modify(filesPath, [...files]);
|
|
117
116
|
};
|
|
118
117
|
}
|
|
119
|
-
function updateApplicationBuilderWorkspaceConfigRule(
|
|
118
|
+
function updateApplicationBuilderWorkspaceConfigRule(projectSourceRoot, options, { logger }) {
|
|
120
119
|
return (0, utility_1.updateWorkspace)((workspace) => {
|
|
121
120
|
const buildTarget = workspace.projects.get(options.project)?.targets.get('build');
|
|
122
121
|
if (!buildTarget) {
|
|
@@ -140,14 +139,14 @@ function updateApplicationBuilderWorkspaceConfigRule(projectRoot, options, { log
|
|
|
140
139
|
buildTarget.options = {
|
|
141
140
|
...buildTarget.options,
|
|
142
141
|
outputPath,
|
|
143
|
-
|
|
142
|
+
outputMode: 'server',
|
|
144
143
|
ssr: {
|
|
145
|
-
entry: (0, core_1.join)((0, core_1.normalize)(
|
|
144
|
+
entry: (0, core_1.join)((0, core_1.normalize)(projectSourceRoot), 'server.ts'),
|
|
146
145
|
},
|
|
147
146
|
};
|
|
148
147
|
});
|
|
149
148
|
}
|
|
150
|
-
function updateWebpackBuilderWorkspaceConfigRule(options) {
|
|
149
|
+
function updateWebpackBuilderWorkspaceConfigRule(projectSourceRoot, options) {
|
|
151
150
|
return (0, utility_1.updateWorkspace)((workspace) => {
|
|
152
151
|
const projectName = options.project;
|
|
153
152
|
const project = workspace.projects.get(projectName);
|
|
@@ -156,7 +155,7 @@ function updateWebpackBuilderWorkspaceConfigRule(options) {
|
|
|
156
155
|
}
|
|
157
156
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
158
157
|
const serverTarget = project.targets.get('server');
|
|
159
|
-
(serverTarget.options ??= {}).main =
|
|
158
|
+
(serverTarget.options ??= {}).main = node_path_1.posix.join(projectSourceRoot, 'server.ts');
|
|
160
159
|
const serveSSRTarget = project.targets.get(SERVE_SSR_TARGET_NAME);
|
|
161
160
|
if (serveSSRTarget) {
|
|
162
161
|
return;
|
|
@@ -216,7 +215,7 @@ function updateWebpackBuilderServerTsConfigRule(options) {
|
|
|
216
215
|
}
|
|
217
216
|
const tsConfig = new json_file_1.JSONFile(host, tsConfigPath);
|
|
218
217
|
const filesAstNode = tsConfig.get(['files']);
|
|
219
|
-
const serverFilePath = 'server.ts';
|
|
218
|
+
const serverFilePath = 'src/server.ts';
|
|
220
219
|
if (Array.isArray(filesAstNode) && !filesAstNode.some(({ text }) => text === serverFilePath)) {
|
|
221
220
|
tsConfig.modify(['files'], [...filesAstNode, serverFilePath]);
|
|
222
221
|
}
|
|
@@ -225,10 +224,6 @@ function updateWebpackBuilderServerTsConfigRule(options) {
|
|
|
225
224
|
function addDependencies({ skipInstall }, isUsingApplicationBuilder) {
|
|
226
225
|
const install = skipInstall ? utility_1.InstallBehavior.None : utility_1.InstallBehavior.Auto;
|
|
227
226
|
const rules = [
|
|
228
|
-
(0, utility_1.addDependency)('@angular/ssr', latest_versions_1.latestVersions.AngularSSR, {
|
|
229
|
-
type: utility_1.DependencyType.Default,
|
|
230
|
-
install,
|
|
231
|
-
}),
|
|
232
227
|
(0, utility_1.addDependency)('express', latest_versions_1.latestVersions['express'], {
|
|
233
228
|
type: utility_1.DependencyType.Default,
|
|
234
229
|
install,
|
|
@@ -246,7 +241,7 @@ function addDependencies({ skipInstall }, isUsingApplicationBuilder) {
|
|
|
246
241
|
}
|
|
247
242
|
return (0, schematics_1.chain)(rules);
|
|
248
243
|
}
|
|
249
|
-
function addServerFile(options, isStandalone) {
|
|
244
|
+
function addServerFile(projectSourceRoot, options, isStandalone) {
|
|
250
245
|
return async (host) => {
|
|
251
246
|
const projectName = options.project;
|
|
252
247
|
const workspace = await (0, utility_1.readWorkspace)(host);
|
|
@@ -265,7 +260,7 @@ function addServerFile(options, isStandalone) {
|
|
|
265
260
|
browserDistDirectory,
|
|
266
261
|
isStandalone,
|
|
267
262
|
}),
|
|
268
|
-
(0, schematics_1.move)(
|
|
263
|
+
(0, schematics_1.move)(projectSourceRoot),
|
|
269
264
|
]));
|
|
270
265
|
};
|
|
271
266
|
}
|
|
@@ -279,6 +274,7 @@ function default_1(options) {
|
|
|
279
274
|
throw (0, project_targets_1.targetBuildNotFoundError)();
|
|
280
275
|
}
|
|
281
276
|
const isUsingApplicationBuilder = usingApplicationBuilder(clientProject);
|
|
277
|
+
const sourceRoot = clientProject.sourceRoot ?? node_path_1.posix.join(clientProject.root, 'src');
|
|
282
278
|
return (0, schematics_1.chain)([
|
|
283
279
|
(0, schematics_1.schematic)('server', {
|
|
284
280
|
...options,
|
|
@@ -286,14 +282,14 @@ function default_1(options) {
|
|
|
286
282
|
}),
|
|
287
283
|
...(isUsingApplicationBuilder
|
|
288
284
|
? [
|
|
289
|
-
updateApplicationBuilderWorkspaceConfigRule(
|
|
285
|
+
updateApplicationBuilderWorkspaceConfigRule(sourceRoot, options, context),
|
|
290
286
|
updateApplicationBuilderTsConfigRule(options),
|
|
291
287
|
]
|
|
292
288
|
: [
|
|
293
289
|
updateWebpackBuilderServerTsConfigRule(options),
|
|
294
|
-
updateWebpackBuilderWorkspaceConfigRule(options),
|
|
290
|
+
updateWebpackBuilderWorkspaceConfigRule(sourceRoot, options),
|
|
295
291
|
]),
|
|
296
|
-
addServerFile(options, isStandalone),
|
|
292
|
+
addServerFile(sourceRoot, options, isStandalone),
|
|
297
293
|
addScriptsRule(options, isUsingApplicationBuilder),
|
|
298
294
|
addDependencies(options, isUsingApplicationBuilder),
|
|
299
295
|
]);
|