@nx/angular-rspack 23.2.1 → 23.3.0-beta.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.
- package/dist/lib/config/config-utils/common-config.d.ts.map +1 -1
- package/dist/lib/config/config-utils/common-config.js +4 -0
- package/dist/lib/config/config-utils/helpers.d.ts.map +1 -1
- package/dist/lib/config/config-utils/helpers.js +5 -0
- package/dist/lib/config/config-utils/server-config.d.ts.map +1 -1
- package/dist/lib/config/config-utils/server-config.js +120 -4
- package/dist/lib/config/config-utils/user-defined-config-helpers.d.ts +7 -0
- package/dist/lib/config/config-utils/user-defined-config-helpers.d.ts.map +1 -1
- package/dist/lib/models/angular-rspack-plugin-options.d.ts +31 -0
- package/dist/lib/models/angular-rspack-plugin-options.d.ts.map +1 -1
- package/dist/lib/models/normalize-options.d.ts +2 -1
- package/dist/lib/models/normalize-options.d.ts.map +1 -1
- package/dist/lib/models/normalize-options.js +72 -10
- package/dist/lib/plugins/angular-rspack-plugin.d.ts.map +1 -1
- package/dist/lib/plugins/angular-rspack-plugin.js +15 -7
- package/dist/lib/plugins/engine-manifest-plugin.d.ts +15 -0
- package/dist/lib/plugins/engine-manifest-plugin.d.ts.map +1 -0
- package/dist/lib/plugins/engine-manifest-plugin.js +24 -0
- package/dist/lib/plugins/loaders/angular-partial-transform.loader.d.ts +5 -1
- package/dist/lib/plugins/loaders/angular-partial-transform.loader.d.ts.map +1 -1
- package/dist/lib/plugins/loaders/angular-partial-transform.loader.js +7 -0
- package/dist/lib/plugins/loaders/engine-manifest.d.ts +42 -0
- package/dist/lib/plugins/loaders/engine-manifest.d.ts.map +1 -0
- package/dist/lib/plugins/loaders/engine-manifest.js +76 -0
- package/dist/lib/plugins/loaders/platform-server-exports.loader.d.ts +15 -2
- package/dist/lib/plugins/loaders/platform-server-exports.loader.d.ts.map +1 -1
- package/dist/lib/plugins/loaders/platform-server-exports.loader.js +59 -8
- package/dist/lib/plugins/tools/render-worker.d.ts.map +1 -1
- package/dist/lib/plugins/tools/render-worker.js +2 -1
- package/dist/lib/plugins/tools/routes-extractor-worker.d.ts.map +1 -1
- package/dist/lib/plugins/tools/routes-extractor-worker.js +3 -3
- package/dist/lib/ssr/server-assets.d.ts +24 -0
- package/dist/lib/ssr/server-assets.d.ts.map +1 -0
- package/dist/lib/ssr/server-assets.js +83 -0
- package/dist/lib/utils/misc-helpers.d.ts +1 -0
- package/dist/lib/utils/misc-helpers.d.ts.map +1 -1
- package/dist/lib/utils/misc-helpers.js +19 -0
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common-config.d.ts","sourceRoot":"","sources":["../../../../src/lib/config/config-utils/common-config.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,UAAU,EACV,WAAW,EACX,oCAAoC,EACrC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"common-config.d.ts","sourceRoot":"","sources":["../../../../src/lib/config/config-utils/common-config.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,UAAU,EACV,WAAW,EACX,oCAAoC,EACrC,MAAM,cAAc,CAAC;AAYtB,wBAAsB,eAAe,CACnC,iBAAiB,EAAE,oCAAoC,EACvD,IAAI,EAAE,WAAW,EACjB,QAAQ,EAAE,MAAM,GAAG,CAAC,MAAM,IAAI,CAAC,EAC/B,UAAU,EAAE,UAAU,iDAyLvB"}
|
|
@@ -12,6 +12,7 @@ const stats_json_plugin_1 = require("../../plugins/stats-json-plugin");
|
|
|
12
12
|
const watch_file_logs_plugin_1 = require("../../plugins/watch-file-logs-plugin");
|
|
13
13
|
const get_index_input_file_1 = require("../../utils/index-file/get-index-input-file");
|
|
14
14
|
const rspack_version_1 = require("../../utils/rspack-version");
|
|
15
|
+
const engine_manifest_1 = require("../../plugins/loaders/engine-manifest");
|
|
15
16
|
async function getCommonConfig(normalizedOptions, i18n, i18nHash, hashFormat) {
|
|
16
17
|
const isDevServer = (0, rspack_serve_env_1.isServeMode)();
|
|
17
18
|
const crossOriginLoading = (0, helpers_1.getCrossOriginLoading)(normalizedOptions);
|
|
@@ -126,6 +127,9 @@ async function getCommonConfig(normalizedOptions, i18n, i18nHash, hashFormat) {
|
|
|
126
127
|
loader:
|
|
127
128
|
// oxlint-disable-next-line @nx/enforce-module-boundaries
|
|
128
129
|
require.resolve('@nx/angular-rspack/loaders/angular-partial-transform-loader'),
|
|
130
|
+
options: {
|
|
131
|
+
engineManifestPath: (0, node_path_1.resolve)(normalizedOptions.root, engine_manifest_1.ENGINE_MANIFEST_VIRTUAL_NAME),
|
|
132
|
+
},
|
|
129
133
|
},
|
|
130
134
|
],
|
|
131
135
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../src/lib/config/config-utils/helpers.ts"],"names":[],"mappings":"AASA,OAAO,EACL,0BAA0B,EAC1B,UAAU,EACV,oCAAoC,EAEpC,aAAa,EACd,MAAM,cAAc,CAAC;AAItB;;GAEG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,EAClB,oBAAoB,CAAC,EAAE,MAAM,EAAE,GAC9B,OAAO,CAAC,IAAI,CAAC,CAqCf;AAED,wBAAgB,mBAAmB,CACjC,aAAa,GAAE,aAAsB,EACrC,MAAM,SAAI,GACT,UAAU,CAkCZ;AAED,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,0BAA0B;;;;
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../src/lib/config/config-utils/helpers.ts"],"names":[],"mappings":"AASA,OAAO,EACL,0BAA0B,EAC1B,UAAU,EACV,oCAAoC,EAEpC,aAAa,EACd,MAAM,cAAc,CAAC;AAItB;;GAEG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,EAClB,oBAAoB,CAAC,EAAE,MAAM,EAAE,GAC9B,OAAO,CAAC,IAAI,CAAC,CAqCf;AAED,wBAAgB,mBAAmB,CACjC,aAAa,GAAE,aAAsB,EACrC,MAAM,SAAI,GACT,UAAU,CAkCZ;AAED,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,0BAA0B;;;;GA0BpC;AAED,wBAAgB,qBAAqB,CACnC,iBAAiB,EAAE,oCAAoC,2CAcxD"}
|
|
@@ -91,6 +91,11 @@ async function normalizeOptionWithI18n(options) {
|
|
|
91
91
|
// no-op as i18n is not inlined
|
|
92
92
|
};
|
|
93
93
|
const normalizedOptions = await (0, models_1.normalizeOptions)(_options);
|
|
94
|
+
if (normalizedOptions.outputMode && i18n.shouldInline) {
|
|
95
|
+
// The engine manifests would need per-locale entry points, which the
|
|
96
|
+
// locale inlining pipeline does not produce yet.
|
|
97
|
+
throw new Error('Locale inlining ("localize") is not supported when "outputMode" is set. Please build each locale separately.');
|
|
98
|
+
}
|
|
94
99
|
return { i18n, i18nHash, normalizedOptions };
|
|
95
100
|
}
|
|
96
101
|
function getCrossOriginLoading(normalizedOptions) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-config.d.ts","sourceRoot":"","sources":["../../../../src/lib/config/config-utils/server-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAC7E,OAAO,EACL,KAAK,aAAa,EAGnB,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EACV,WAAW,EACX,oCAAoC,
|
|
1
|
+
{"version":3,"file":"server-config.d.ts","sourceRoot":"","sources":["../../../../src/lib/config/config-utils/server-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAC7E,OAAO,EACL,KAAK,aAAa,EAGnB,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EACV,WAAW,EACX,oCAAoC,EAErC,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAkBjF,wBAAsB,eAAe,CACnC,iBAAiB,EAAE,oCAAoC,EACvD,IAAI,EAAE,WAAW,EACjB,aAAa,EAAE,aAAa,EAC5B,yBAAyB,EAAE,yBAAyB,EACpD,mBAAmB,CAAC,EAAE,mBAAmB,EACzC,mBAAmB,CAAC,EAAE,mBAAmB,GACxC,OAAO,CAAC,aAAa,CAAC,CAkJxB"}
|
|
@@ -4,6 +4,8 @@ exports.getServerConfig = getServerConfig;
|
|
|
4
4
|
const core_1 = require("@rspack/core");
|
|
5
5
|
const path_1 = require("path");
|
|
6
6
|
const ng_rspack_1 = require("../../plugins/ng-rspack");
|
|
7
|
+
const engine_manifest_1 = require("../../plugins/loaders/engine-manifest");
|
|
8
|
+
const engine_manifest_plugin_1 = require("../../plugins/engine-manifest-plugin");
|
|
7
9
|
const prerender_plugin_1 = require("../../plugins/prerender-plugin");
|
|
8
10
|
const misc_helpers_1 = require("../../utils/misc-helpers");
|
|
9
11
|
const dev_server_config_utils_1 = require("./dev-server-config-utils");
|
|
@@ -13,6 +15,61 @@ const rspack_serve_env_1 = require("../../utils/rspack-serve-env");
|
|
|
13
15
|
async function getServerConfig(normalizedOptions, i18n, defaultConfig, swcTranspilationTransform, sharedLicenseInputs, sharedAngularPlugin) {
|
|
14
16
|
const isDevServer = (0, rspack_serve_env_1.isServeMode)();
|
|
15
17
|
const { root } = normalizedOptions;
|
|
18
|
+
const angularSSRInstalled = (0, misc_helpers_1.isPackageInstalled)(root, '@angular/ssr');
|
|
19
|
+
if (normalizedOptions.outputMode && !angularSSRInstalled) {
|
|
20
|
+
throw new Error('The "outputMode" option requires the "@angular/ssr" package to be installed.');
|
|
21
|
+
}
|
|
22
|
+
if (angularSSRInstalled && i18n.shouldInline) {
|
|
23
|
+
// outputMode with locale inlining is rejected during normalization, so
|
|
24
|
+
// this only fires for SSR builds without an output mode.
|
|
25
|
+
console.warn('Locale inlining ("localize") disables the "@angular/ssr" application engine wiring: the engine manifests are not registered, so a server entry using the application engine APIs will fail at startup.');
|
|
26
|
+
}
|
|
27
|
+
// Locale inlining is not wired up: the engine manifests would need
|
|
28
|
+
// per-locale entry points, which the inlining pipeline does not produce.
|
|
29
|
+
const engineWiring = angularSSRInstalled && !i18n.shouldInline
|
|
30
|
+
? {
|
|
31
|
+
mainServerEntry: (0, path_1.resolve)(root, normalizedOptions.server),
|
|
32
|
+
baseHref: normalizedOptions.baseHref ?? '/',
|
|
33
|
+
locale: i18n.hasDefinedSourceLocale ? i18n.sourceLocale : undefined,
|
|
34
|
+
inlineCriticalCss: !!normalizedOptions.optimization.styles.inlineCritical,
|
|
35
|
+
// Baked into the emitted bundle; posix separators keep it valid
|
|
36
|
+
// when the build and the server run on different platforms.
|
|
37
|
+
browserOutputRelativePath: (0, path_1.relative)(normalizedOptions.outputPath.server, normalizedOptions.outputPath.browser)
|
|
38
|
+
.split(path_1.sep)
|
|
39
|
+
.join(path_1.posix.sep),
|
|
40
|
+
indexOutputName: normalizedOptions.index?.output,
|
|
41
|
+
supportedLocales: { [i18n.sourceLocale]: '' },
|
|
42
|
+
// An empty allowlist matches no host: from @angular/ssr 22 the
|
|
43
|
+
// engine rejects every request, and the earlier versions that
|
|
44
|
+
// validate fall back to CSR. Serving must allow the dev-server
|
|
45
|
+
// hosts instead of the production allowlist.
|
|
46
|
+
allowedHosts: isDevServer
|
|
47
|
+
? getServeModeAllowedHosts(normalizedOptions.devServer)
|
|
48
|
+
: (normalizedOptions.security?.allowedHosts ?? []),
|
|
49
|
+
...(isDevServer &&
|
|
50
|
+
devServerDisablesHostCheck(normalizedOptions.devServer)
|
|
51
|
+
? { disableHostCheck: true }
|
|
52
|
+
: {}),
|
|
53
|
+
}
|
|
54
|
+
: undefined;
|
|
55
|
+
if (engineWiring?.disableHostCheck) {
|
|
56
|
+
warnIfEngineHostCheckNotDisableable(root);
|
|
57
|
+
}
|
|
58
|
+
let engineManifestPlugin;
|
|
59
|
+
// Virtual modules require rspack 1.5, probed on the workspace's own
|
|
60
|
+
// @rspack/core: the copy that runs the build, which can differ from this
|
|
61
|
+
// package's. Older versions inline the manifest registration into the
|
|
62
|
+
// entry instead, where it only runs before the user entry's own
|
|
63
|
+
// statements, not before its imports.
|
|
64
|
+
if (engineWiring && installedRspackSupportsVirtualModules(root)) {
|
|
65
|
+
engineWiring.manifestModuleRequest = (0, path_1.resolve)(root, engine_manifest_1.ENGINE_MANIFEST_VIRTUAL_NAME);
|
|
66
|
+
engineManifestPlugin = new engine_manifest_plugin_1.EngineManifestPlugin(engineWiring.manifestModuleRequest, (0, engine_manifest_1.generateEngineManifestSource)(engineWiring));
|
|
67
|
+
}
|
|
68
|
+
const platformServerExportsLoaderOptions = {
|
|
69
|
+
angularSSRInstalled,
|
|
70
|
+
isZoneJsInstalled: (0, misc_helpers_1.isPackageInstalled)(root, 'zone.js'),
|
|
71
|
+
...(engineWiring ? { engineWiring } : {}),
|
|
72
|
+
};
|
|
16
73
|
return {
|
|
17
74
|
...defaultConfig,
|
|
18
75
|
dependencies: ['browser'],
|
|
@@ -56,16 +113,14 @@ async function getServerConfig(normalizedOptions, i18n, defaultConfig, swcTransp
|
|
|
56
113
|
include: [
|
|
57
114
|
(0, path_1.resolve)(root, normalizedOptions.ssr.entry),
|
|
58
115
|
],
|
|
59
|
-
options:
|
|
60
|
-
angularSSRInstalled: (0, misc_helpers_1.isPackageInstalled)(root, '@angular/ssr'),
|
|
61
|
-
isZoneJsInstalled: (0, misc_helpers_1.isPackageInstalled)(root, 'zone.js'),
|
|
62
|
-
},
|
|
116
|
+
options: platformServerExportsLoaderOptions,
|
|
63
117
|
},
|
|
64
118
|
...(defaultConfig.module?.rules ?? []),
|
|
65
119
|
],
|
|
66
120
|
},
|
|
67
121
|
plugins: [
|
|
68
122
|
...(defaultConfig.plugins ?? []),
|
|
123
|
+
...(engineManifestPlugin ? [engineManifestPlugin] : []),
|
|
69
124
|
// Fixes Critical dependency: the request of a dependency is an expression
|
|
70
125
|
new core_1.ContextReplacementPlugin(/@?hapi|express[\\/]/),
|
|
71
126
|
// rspack inlines `import.meta.url` as the source file's URL, breaking
|
|
@@ -86,3 +141,64 @@ async function getServerConfig(normalizedOptions, i18n, defaultConfig, swcTransp
|
|
|
86
141
|
],
|
|
87
142
|
};
|
|
88
143
|
}
|
|
144
|
+
// TODO(v24): drop the probe and the loader's inline fallback once
|
|
145
|
+
// @rspack/core v1 is out of the support window.
|
|
146
|
+
function installedRspackSupportsVirtualModules(root) {
|
|
147
|
+
const version = (0, misc_helpers_1.getInstalledPackageVersionFromRoot)(root, '@rspack/core');
|
|
148
|
+
if (!version) {
|
|
149
|
+
return false;
|
|
150
|
+
}
|
|
151
|
+
const [major, minor] = version.split('.').map((part) => parseInt(part, 10));
|
|
152
|
+
return major > 1 || (major === 1 && minor >= 5);
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* The hosts the application engine accepts while serving. The forked server
|
|
156
|
+
* process is browsed directly, so the engine check is the only host check on
|
|
157
|
+
* the SSR dev path.
|
|
158
|
+
*/
|
|
159
|
+
function getServeModeAllowedHosts(devServer) {
|
|
160
|
+
// Kept even when the host check is disabled: the versions that cannot
|
|
161
|
+
// disable it still validate against this list.
|
|
162
|
+
const allowedHosts = Array.isArray(devServer.allowedHosts)
|
|
163
|
+
? // The dev server matches a leading-dot entry against the apex and
|
|
164
|
+
// its subdomains; the engine's '*.' form only matches subdomains,
|
|
165
|
+
// so emit both.
|
|
166
|
+
devServer.allowedHosts.flatMap((host) => host.startsWith('.') ? [host.slice(1), `*${host}`] : [host])
|
|
167
|
+
: [];
|
|
168
|
+
return Array.from(new Set([
|
|
169
|
+
...allowedHosts,
|
|
170
|
+
// The engine matcher has no implicit local set; seed the hosts the dev
|
|
171
|
+
// server accepts implicitly. Other IP literals cannot be enumerated;
|
|
172
|
+
// NG_ALLOWED_HOSTS covers those.
|
|
173
|
+
'localhost',
|
|
174
|
+
'*.localhost',
|
|
175
|
+
'127.0.0.1',
|
|
176
|
+
'[::1]',
|
|
177
|
+
// The engine matches against the request URL hostname, which brackets
|
|
178
|
+
// IPv6 literals: a `::` bind address arrives as `[::]`.
|
|
179
|
+
devServer.host.includes(':') && !devServer.host.startsWith('[')
|
|
180
|
+
? `[${devServer.host}]`
|
|
181
|
+
: devServer.host,
|
|
182
|
+
]));
|
|
183
|
+
}
|
|
184
|
+
function devServerDisablesHostCheck(devServer) {
|
|
185
|
+
return !!devServer.disableHostCheck || devServer.allowedHosts === true;
|
|
186
|
+
}
|
|
187
|
+
// Host validation exists from @angular/ssr 20.3.17 / 21.1.5 / 21.2.0, but
|
|
188
|
+
// the engine can only skip it from 20.3.25 / 21.2.1
|
|
189
|
+
// (`ɵdisableAllowedHostsCheck`): in between, no mechanism disables the check.
|
|
190
|
+
function warnIfEngineHostCheckNotDisableable(root) {
|
|
191
|
+
const version = (0, misc_helpers_1.getInstalledPackageVersionFromRoot)(root, '@angular/ssr');
|
|
192
|
+
if (!version) {
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
const [major, minor, patch] = version
|
|
196
|
+
.split('.')
|
|
197
|
+
.map((part) => parseInt(part, 10));
|
|
198
|
+
const cannotDisable = (major === 20 && minor === 3 && patch >= 17 && patch < 25) ||
|
|
199
|
+
(major === 21 && minor === 1 && patch >= 5) ||
|
|
200
|
+
(major === 21 && minor === 2 && patch === 0);
|
|
201
|
+
if (cannotDisable) {
|
|
202
|
+
console.warn(`The dev-server host check is disabled, but the installed "@angular/ssr" version (${version}) cannot disable the application engine host validation. Requests from hosts other than the dev-server host, the local hosts, those listed in "devServer.allowedHosts" and, when using AngularNodeAppEngine, those in "NG_ALLOWED_HOSTS" are rejected with a 400 response. Upgrade "@angular/ssr" to version 21.2.1 or greater, or 20.3.25 or greater within 20.3, to fully disable the check.`);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
@@ -36,6 +36,7 @@ export declare function handleConfigurations(defaultOptions: {
|
|
|
36
36
|
ngswConfigPath?: string;
|
|
37
37
|
optimization?: boolean | import("../../models").OptimizationOptions;
|
|
38
38
|
outputHashing?: import("../../models").OutputHashing;
|
|
39
|
+
outputMode?: 'server' | 'static';
|
|
39
40
|
outputPath?: string | (Required<Pick<import("../../models").OutputPath, 'base'>> & Partial<import("../../models").OutputPath>);
|
|
40
41
|
poll?: number;
|
|
41
42
|
polyfills?: string[];
|
|
@@ -48,6 +49,12 @@ export declare function handleConfigurations(defaultOptions: {
|
|
|
48
49
|
progress?: boolean;
|
|
49
50
|
root?: string;
|
|
50
51
|
scripts?: import("../../models").ScriptOrStyleEntry[];
|
|
52
|
+
security?: {
|
|
53
|
+
allowedHosts?: string[];
|
|
54
|
+
autoCsp?: boolean | {
|
|
55
|
+
unsafeEval?: boolean;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
51
58
|
server?: string;
|
|
52
59
|
serviceWorker?: boolean;
|
|
53
60
|
skipTypeChecking?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-defined-config-helpers.d.ts","sourceRoot":"","sources":["../../../../src/lib/config/config-utils/user-defined-config-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAGlD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAE/D,wBAAgB,oBAAoB,CAClC,cAAc,EAAE;IACd,OAAO,EAAE,0BAA0B,CAAC;IACpC,qBAAqB,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;CAChD,EACD,cAAc,EAAE,MAAM,CACpB,MAAM,EACN;IACE,OAAO,EAAE,OAAO,CAAC,0BAA0B,CAAC,CAAC;IAC7C,qBAAqB,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;CAChD,CACF,EACD,kBAAkB,EAAE,MAAM,EAAE
|
|
1
|
+
{"version":3,"file":"user-defined-config-helpers.d.ts","sourceRoot":"","sources":["../../../../src/lib/config/config-utils/user-defined-config-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAGlD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAE/D,wBAAgB,oBAAoB,CAClC,cAAc,EAAE;IACd,OAAO,EAAE,0BAA0B,CAAC;IACpC,qBAAqB,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;CAChD,EACD,cAAc,EAAE,MAAM,CACpB,MAAM,EACN;IACE,OAAO,EAAE,OAAO,CAAC,0BAA0B,CAAC,CAAC;IAC7C,qBAAqB,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;CAChD,CACF,EACD,kBAAkB,EAAE,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmB7B;AAED,wBAAgB,sBAAsB,CAAC,iBAAiB,EAAE,MAAM,YAE/D"}
|
|
@@ -232,6 +232,17 @@ export interface AngularRspackPluginOptions {
|
|
|
232
232
|
ngswConfigPath?: string;
|
|
233
233
|
optimization?: boolean | OptimizationOptions;
|
|
234
234
|
outputHashing?: OutputHashing;
|
|
235
|
+
/**
|
|
236
|
+
* Defines the build output target. Only 'server' is currently supported:
|
|
237
|
+
* it requires the `server` and `ssr.entry` options and the `@angular/ssr`
|
|
238
|
+
* package, and disables build-time prerendering (`prerender`/`appShell`).
|
|
239
|
+
* The `@angular/ssr` application engine wiring itself is active for any
|
|
240
|
+
* SSR build with `@angular/ssr` installed, with or without this option,
|
|
241
|
+
* except when locale inlining is enabled.
|
|
242
|
+
* 'static' (build-time prerendering of the full application) is not
|
|
243
|
+
* supported yet and is rejected.
|
|
244
|
+
*/
|
|
245
|
+
outputMode?: 'server' | 'static';
|
|
235
246
|
outputPath?: string | (Required<Pick<OutputPath, 'base'>> & Partial<OutputPath>);
|
|
236
247
|
/**
|
|
237
248
|
* Enable and define the file watching poll time period in milliseconds.
|
|
@@ -265,6 +276,25 @@ export interface AngularRspackPluginOptions {
|
|
|
265
276
|
progress?: boolean;
|
|
266
277
|
root?: string;
|
|
267
278
|
scripts?: ScriptOrStyleEntry[];
|
|
279
|
+
/**
|
|
280
|
+
* Security features to protect against XSS and other common attacks.
|
|
281
|
+
*/
|
|
282
|
+
security?: {
|
|
283
|
+
/**
|
|
284
|
+
* A list of hostnames that are allowed to access the server-side
|
|
285
|
+
* application. Requires `@angular/ssr` version 21.2.0 or greater (also
|
|
286
|
+
* backported to 20.3.17 and 21.1.5). For more information, see
|
|
287
|
+
* https://angular.dev/best-practices/security#preventing-server-side-request-forgery-ssrf.
|
|
288
|
+
*/
|
|
289
|
+
allowedHosts?: string[];
|
|
290
|
+
/**
|
|
291
|
+
* Automatic content security policy generation. Not supported yet;
|
|
292
|
+
* enabling it is rejected.
|
|
293
|
+
*/
|
|
294
|
+
autoCsp?: boolean | {
|
|
295
|
+
unsafeEval?: boolean;
|
|
296
|
+
};
|
|
297
|
+
};
|
|
268
298
|
server?: string;
|
|
269
299
|
/**
|
|
270
300
|
* Generates a service worker config for production builds.
|
|
@@ -333,6 +363,7 @@ export interface NormalizedAngularRspackPluginOptions extends Omit<AngularRspack
|
|
|
333
363
|
namedChunks: boolean;
|
|
334
364
|
optimization: NormalizedOptimizationOptions;
|
|
335
365
|
outputHashing: OutputHashing;
|
|
366
|
+
outputMode: 'server' | undefined;
|
|
336
367
|
outputPath: OutputPath;
|
|
337
368
|
polyfills: string[];
|
|
338
369
|
projectName: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"angular-rspack-plugin-options.d.ts","sourceRoot":"","sources":["../../../src/lib/models/angular-rspack-plugin-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACnB,wBAAwB,EACzB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAw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AClB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,kBAAkB,EAAE,CAAC;IAC9B,MAAM,EAAE,kBAAkB,EAAE,CAAC;IAC7B,SAAS,EAAE,SAAS,CAAC;IACrB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,QAAQ,EAAE,OAAO,CAAC;CACnB"}
|
|
1
|
+
{"version":3,"file":"angular-rspack-plugin-options.d.ts","sourceRoot":"","sources":["../../../src/lib/models/angular-rspack-plugin-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACnB,wBAAwB,EACzB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAE7C,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAClC;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC;;OAEG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;IACd;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC3B;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,IAA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W,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,QAAQ,EAAE,OAAO,CAAC;CACnB"}
|
|
@@ -9,8 +9,9 @@ export declare const INDEX_HTML_CSR = "index.csr.html";
|
|
|
9
9
|
* @returns Array of file replacements resolved against the root.
|
|
10
10
|
*/
|
|
11
11
|
export declare function resolveFileReplacements(fileReplacements: FileReplacement[], root: string): FileReplacement[];
|
|
12
|
-
export declare function getHasServer(root: string, server: string | undefined, ssr: AngularRspackPluginOptions['ssr']): boolean;
|
|
12
|
+
export declare function getHasServer(root: string, server: string | undefined, ssr: AngularRspackPluginOptions['ssr'], outputMode?: 'server' | undefined): boolean;
|
|
13
13
|
export declare function validateSsr(ssr: AngularRspackPluginOptions['ssr']): void;
|
|
14
|
+
export declare function validateOutputMode(outputMode: AngularRspackPluginOptions['outputMode'], server: string | undefined, ssr: AngularRspackPluginOptions['ssr']): asserts outputMode is 'server' | undefined;
|
|
14
15
|
export declare function normalizeOptions(options: AngularRspackPluginOptions): Promise<NormalizedAngularRspackPluginOptions>;
|
|
15
16
|
export declare function normalizeOptimization(optimization: AngularRspackPluginOptions['optimization']): NormalizedOptimizationOptions;
|
|
16
17
|
//# sourceMappingURL=normalize-options.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-options.d.ts","sourceRoot":"","sources":["../../../src/lib/models/normalize-options.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"normalize-options.d.ts","sourceRoot":"","sources":["../../../src/lib/models/normalize-options.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAoBnE,OAAO,KAAK,EACV,0BAA0B,EAI1B,oCAAoC,EAIpC,6BAA6B,EAI9B,MAAM,iCAAiC,CAAC;AAEzC,eAAO,MAAM,cAAc,mBAAmB,CAAC;AAE/C;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,gBAAgB,EAAE,eAAe,EAAE,EACnC,IAAI,EAAE,MAAM,GACX,eAAe,EAAE,CAKnB;AAED,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,GAAG,EAAE,0BAA0B,CAAC,KAAK,CAAC,EACtC,UAAU,CAAC,EAAE,QAAQ,GAAG,SAAS,GAChC,OAAO,CAmBT;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,0BAA0B,CAAC,KAAK,CAAC,QAmBjE;AAED,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,0BAA0B,CAAC,YAAY,CAAC,EACpD,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,GAAG,EAAE,0BAA0B,CAAC,KAAK,CAAC,GACrC,OAAO,CAAC,UAAU,IAAI,QAAQ,GAAG,SAAS,CAmB5C;AAED,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,oCAAoC,CAAC,CAyP/C;AAED,wBAAgB,qBAAqB,CACnC,YAAY,EAAE,0BAA0B,CAAC,cAAc,CAAC,GACvD,6BAA6B,CAiD/B"}
|
|
@@ -4,6 +4,7 @@ exports.INDEX_HTML_CSR = void 0;
|
|
|
4
4
|
exports.resolveFileReplacements = resolveFileReplacements;
|
|
5
5
|
exports.getHasServer = getHasServer;
|
|
6
6
|
exports.validateSsr = validateSsr;
|
|
7
|
+
exports.validateOutputMode = validateOutputMode;
|
|
7
8
|
exports.normalizeOptions = normalizeOptions;
|
|
8
9
|
exports.normalizeOptimization = normalizeOptimization;
|
|
9
10
|
const tslib_1 = require("tslib");
|
|
@@ -13,6 +14,7 @@ const node_assert_1 = tslib_1.__importDefault(require("node:assert"));
|
|
|
13
14
|
const node_fs_1 = require("node:fs");
|
|
14
15
|
const node_path_1 = require("node:path");
|
|
15
16
|
const find_project_for_path_1 = require("../utils/find-project-for-path");
|
|
17
|
+
const misc_helpers_1 = require("../utils/misc-helpers");
|
|
16
18
|
const graph_1 = require("../utils/graph");
|
|
17
19
|
exports.INDEX_HTML_CSR = 'index.csr.html';
|
|
18
20
|
/**
|
|
@@ -28,12 +30,21 @@ function resolveFileReplacements(fileReplacements, root) {
|
|
|
28
30
|
with: (0, node_path_1.resolve)(root, fileReplacement.with),
|
|
29
31
|
}));
|
|
30
32
|
}
|
|
31
|
-
function getHasServer(root, server, ssr) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
(0, node_fs_1.existsSync)((0, node_path_1.join)(root,
|
|
33
|
+
function getHasServer(root, server, ssr, outputMode) {
|
|
34
|
+
if (!server || !ssr || !ssr.entry) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
for (const file of [server, ssr.entry]) {
|
|
38
|
+
if (!(0, node_fs_1.existsSync)((0, node_path_1.join)(root, file))) {
|
|
39
|
+
// A missing file downgrades to a browser-only build; outputMode is an
|
|
40
|
+
// explicit request for a server build, so fail instead.
|
|
41
|
+
if (outputMode) {
|
|
42
|
+
throw new Error(`The "outputMode" option is set to "${outputMode}", but "${file}" does not exist.`);
|
|
43
|
+
}
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return true;
|
|
37
48
|
}
|
|
38
49
|
function validateSsr(ssr) {
|
|
39
50
|
if (!ssr) {
|
|
@@ -50,9 +61,24 @@ function validateSsr(ssr) {
|
|
|
50
61
|
console.warn('The "neutral" value for the "ssr.platform" option is not currently supported. Node will be used as the platform.');
|
|
51
62
|
}
|
|
52
63
|
}
|
|
64
|
+
function validateOutputMode(outputMode, server, ssr) {
|
|
65
|
+
if (outputMode === undefined) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if (outputMode !== 'server') {
|
|
69
|
+
throw new Error(`The "${outputMode}" value for the "outputMode" option is not supported. Only "server" is currently supported.`);
|
|
70
|
+
}
|
|
71
|
+
if (!server) {
|
|
72
|
+
throw new Error('The "server" option is required when "outputMode" is set to "server".');
|
|
73
|
+
}
|
|
74
|
+
if (typeof ssr !== 'object' || !ssr.entry) {
|
|
75
|
+
throw new Error('The "ssr.entry" option is required when "outputMode" is set to "server".');
|
|
76
|
+
}
|
|
77
|
+
}
|
|
53
78
|
async function normalizeOptions(options) {
|
|
54
|
-
const { fileReplacements = [], server, ssr, optimization } = options;
|
|
79
|
+
const { fileReplacements = [], server, ssr, optimization, outputMode, } = options;
|
|
55
80
|
validateSsr(ssr);
|
|
81
|
+
validateOutputMode(outputMode, server, ssr);
|
|
56
82
|
const normalizedSsr = !ssr
|
|
57
83
|
? false
|
|
58
84
|
: typeof ssr === 'object'
|
|
@@ -61,11 +87,45 @@ async function normalizeOptions(options) {
|
|
|
61
87
|
platform: 'node', // @TODO: Add support for neutral platform
|
|
62
88
|
}
|
|
63
89
|
: ssr;
|
|
90
|
+
if (options.security?.autoCsp) {
|
|
91
|
+
throw new Error('The "security.autoCsp" option is not supported by @nx/angular-rspack yet.');
|
|
92
|
+
}
|
|
93
|
+
let prerender = options.prerender ?? false;
|
|
94
|
+
let appShell = options.appShell ?? false;
|
|
95
|
+
if (outputMode) {
|
|
96
|
+
if (options.prerender !== undefined) {
|
|
97
|
+
console.warn('The "prerender" option is not considered when "outputMode" is specified.');
|
|
98
|
+
}
|
|
99
|
+
if (options.appShell !== undefined) {
|
|
100
|
+
console.warn('The "appShell" option is not considered when "outputMode" is specified.');
|
|
101
|
+
}
|
|
102
|
+
console.warn('Build-time prerendering of server routes is not supported by @nx/angular-rspack yet. Routes marked for prerendering are rendered at request time.');
|
|
103
|
+
prerender = false;
|
|
104
|
+
appShell = false;
|
|
105
|
+
}
|
|
64
106
|
const normalizedOptimization = normalizeOptimization(optimization);
|
|
65
107
|
const root = options.root ?? process.cwd();
|
|
66
108
|
const tsConfig = options.tsConfig
|
|
67
109
|
? (0, node_path_1.resolve)(root, options.tsConfig)
|
|
68
110
|
: (0, node_path_1.join)(root, 'tsconfig.app.json');
|
|
111
|
+
const hasServer = getHasServer(root, server, normalizedSsr, outputMode);
|
|
112
|
+
if (hasServer && options.security?.allowedHosts?.length) {
|
|
113
|
+
// The engine only reads the manifest's allowedHosts from @angular/ssr
|
|
114
|
+
// 21.2 (backported to 20.3.17 and 21.1.5); on older versions the option
|
|
115
|
+
// would be silently ignored.
|
|
116
|
+
const ssrVersion = (0, misc_helpers_1.getInstalledPackageVersionFromRoot)(root, '@angular/ssr');
|
|
117
|
+
if (ssrVersion) {
|
|
118
|
+
const [major, minor, patch] = ssrVersion
|
|
119
|
+
.split('.')
|
|
120
|
+
.map((part) => parseInt(part, 10));
|
|
121
|
+
const isSupported = major >= 22 ||
|
|
122
|
+
(major === 21 && (minor >= 2 || (minor === 1 && patch >= 5))) ||
|
|
123
|
+
(major === 20 && (minor > 3 || (minor === 3 && patch >= 17)));
|
|
124
|
+
if (!isSupported) {
|
|
125
|
+
throw new Error(`The "security.allowedHosts" option requires "@angular/ssr" version 21.2.0 or greater, 21.1.5 or greater within 21.1, or 20.3.17 or greater within 20.3. You are currently using version ${ssrVersion}.`);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
69
129
|
const aot = options.aot ?? true;
|
|
70
130
|
const advancedOptimizations = aot && normalizedOptimization.scripts;
|
|
71
131
|
const project = await getProject(root);
|
|
@@ -149,7 +209,7 @@ async function normalizeOptions(options) {
|
|
|
149
209
|
}
|
|
150
210
|
return {
|
|
151
211
|
advancedOptimizations,
|
|
152
|
-
appShell
|
|
212
|
+
appShell,
|
|
153
213
|
assets,
|
|
154
214
|
aot,
|
|
155
215
|
baseHref: options.baseHref,
|
|
@@ -166,21 +226,23 @@ async function normalizeOptions(options) {
|
|
|
166
226
|
fileReplacements: resolveFileReplacements(fileReplacements, root),
|
|
167
227
|
globalStyles,
|
|
168
228
|
globalScripts,
|
|
169
|
-
hasServer
|
|
229
|
+
hasServer,
|
|
170
230
|
index,
|
|
171
231
|
inlineStyleLanguage: options.inlineStyleLanguage ?? 'css',
|
|
172
232
|
namedChunks: options.namedChunks ?? false,
|
|
173
233
|
ngswConfigPath: options.ngswConfigPath,
|
|
174
234
|
optimization: normalizedOptimization,
|
|
175
235
|
outputHashing: options.outputHashing ?? 'none',
|
|
236
|
+
outputMode,
|
|
176
237
|
outputPath: normalizeOutputPath(root, options.outputPath),
|
|
177
238
|
poll: options.poll ?? undefined,
|
|
178
239
|
polyfills: options.polyfills ?? [],
|
|
179
|
-
prerender
|
|
240
|
+
prerender,
|
|
180
241
|
projectName: project?.name ?? undefined,
|
|
181
242
|
progress: options.progress ?? true,
|
|
182
243
|
root,
|
|
183
244
|
scripts: options.scripts ?? [],
|
|
245
|
+
security: options.security,
|
|
184
246
|
serviceWorker: options.serviceWorker,
|
|
185
247
|
server,
|
|
186
248
|
skipTypeChecking: options.skipTypeChecking ?? false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"angular-rspack-plugin.d.ts","sourceRoot":"","sources":["../../../src/lib/plugins/angular-rspack-plugin.ts"],"names":[],"mappings":"AAoBA,OAAO,EAEL,KAAK,QAAQ,EAEb,KAAK,oBAAoB,EAE1B,MAAM,cAAc,CAAC;AAUtB,OAAO,EACL,KAAK,WAAW,EAGhB,KAAK,oCAAoC,EAC1C,MAAM,WAAW,CAAC;AAgDnB,qBAAa,mBAAoB,YAAW,oBAAoB;;IAwB9D,YACE,OAAO,EAAE,oCAAoC,EAC7C,WAAW,CAAC,EAAE,WAAW,EA2B1B;IAED,KAAK,CAAC,QAAQ,EAAE,QAAQ,QA4XvB;IAED;;;;;;;OAOG;IACH,wBAAwB,CAAC,QAAQ,EAAE,QAAQ,QAgC1C;YA+Ea,gBAAgB;
|
|
1
|
+
{"version":3,"file":"angular-rspack-plugin.d.ts","sourceRoot":"","sources":["../../../src/lib/plugins/angular-rspack-plugin.ts"],"names":[],"mappings":"AAoBA,OAAO,EAEL,KAAK,QAAQ,EAEb,KAAK,oBAAoB,EAE1B,MAAM,cAAc,CAAC;AAUtB,OAAO,EACL,KAAK,WAAW,EAGhB,KAAK,oCAAoC,EAC1C,MAAM,WAAW,CAAC;AAgDnB,qBAAa,mBAAoB,YAAW,oBAAoB;;IAwB9D,YACE,OAAO,EAAE,oCAAoC,EAC7C,WAAW,CAAC,EAAE,WAAW,EA2B1B;IAED,KAAK,CAAC,QAAQ,EAAE,QAAQ,QA4XvB;IAED;;;;;;;OAOG;IACH,wBAAwB,CAAC,QAAQ,EAAE,QAAQ,QAgC1C;YA+Ea,gBAAgB;YAyFhB,eAAe;CAyC9B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _AngularRspackPlugin_instances, _AngularRspackPlugin__options, _AngularRspackPlugin_i18n, _AngularRspackPlugin_sourceFileCache, _AngularRspackPlugin_javascriptTransformer, _AngularRspackPlugin_angularCompilation, _AngularRspackPlugin_collectedStylesheetAssets, _AngularRspackPlugin_stylesheetMetafileInputsBySource, _AngularRspackPlugin_stylesheetMetafileInputs, _AngularRspackPlugin_collectedStylesheetMetafileInputs, _AngularRspackPlugin_useTypeScriptTranspilation, _AngularRspackPlugin_resourceDependencies, _AngularRspackPlugin_javascriptTransformerCache, _AngularRspackPlugin_diagnosticsPromise, _AngularRspackPlugin_initializationError, _AngularRspackPlugin_emitError, _AngularRspackPlugin_setupWarnings, _AngularRspackPlugin_applyBuildResultReporting, _AngularRspackPlugin_applyJitResourceResolution, _AngularRspackPlugin_exposeLoaderState,
|
|
2
|
+
var _AngularRspackPlugin_instances, _AngularRspackPlugin__options, _AngularRspackPlugin_i18n, _AngularRspackPlugin_sourceFileCache, _AngularRspackPlugin_javascriptTransformer, _AngularRspackPlugin_angularCompilation, _AngularRspackPlugin_collectedStylesheetAssets, _AngularRspackPlugin_stylesheetMetafileInputsBySource, _AngularRspackPlugin_stylesheetMetafileInputs, _AngularRspackPlugin_collectedStylesheetMetafileInputs, _AngularRspackPlugin_useTypeScriptTranspilation, _AngularRspackPlugin_resourceDependencies, _AngularRspackPlugin_javascriptTransformerCache, _AngularRspackPlugin_diagnosticsPromise, _AngularRspackPlugin_initializationError, _AngularRspackPlugin_emitError, _AngularRspackPlugin_setupWarnings, _AngularRspackPlugin_applyBuildResultReporting, _AngularRspackPlugin_applyJitResourceResolution, _AngularRspackPlugin_exposeLoaderState, _AngularRspackPlugin_createDiagnosticsPromise, _AngularRspackPlugin_mergeStylesheetMetafileInputs;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.AngularRspackPlugin = void 0;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
@@ -226,7 +226,7 @@ class AngularRspackPlugin {
|
|
|
226
226
|
try {
|
|
227
227
|
if (!tslib_1.__classPrivateFieldGet(this, _AngularRspackPlugin_initializationError, "f")) {
|
|
228
228
|
const { errors, warnings } = await (tslib_1.__classPrivateFieldGet(this, _AngularRspackPlugin_diagnosticsPromise, "f") ??
|
|
229
|
-
tslib_1.__classPrivateFieldGet(this,
|
|
229
|
+
tslib_1.__classPrivateFieldGet(this, _AngularRspackPlugin_instances, "m", _AngularRspackPlugin_createDiagnosticsPromise).call(this));
|
|
230
230
|
for (const error of errors ?? []) {
|
|
231
231
|
compilation.errors.push({
|
|
232
232
|
name: PLUGIN_NAME,
|
|
@@ -466,7 +466,7 @@ class AngularRspackPlugin {
|
|
|
466
466
|
// worker-based compilation it runs off the main thread and the emit hook
|
|
467
467
|
// only waits for what is left. Diagnostics still run after an emit
|
|
468
468
|
// failure since they usually carry the root cause.
|
|
469
|
-
const diagnosticsPromise = tslib_1.__classPrivateFieldGet(this,
|
|
469
|
+
const diagnosticsPromise = tslib_1.__classPrivateFieldGet(this, _AngularRspackPlugin_instances, "m", _AngularRspackPlugin_createDiagnosticsPromise).call(this);
|
|
470
470
|
// Failed builds skip the emit hook that reports the result; don't
|
|
471
471
|
// leave the rejection unhandled.
|
|
472
472
|
diagnosticsPromise.catch(() => { });
|
|
@@ -530,10 +530,18 @@ _AngularRspackPlugin__options = new WeakMap(), _AngularRspackPlugin_i18n = new W
|
|
|
530
530
|
i18n: tslib_1.__classPrivateFieldGet(this, _AngularRspackPlugin_i18n, "f"),
|
|
531
531
|
});
|
|
532
532
|
});
|
|
533
|
-
},
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
533
|
+
}, _AngularRspackPlugin_createDiagnosticsPromise = function _AngularRspackPlugin_createDiagnosticsPromise() {
|
|
534
|
+
if (!tslib_1.__classPrivateFieldGet(this, _AngularRspackPlugin__options, "f").skipTypeChecking) {
|
|
535
|
+
return tslib_1.__classPrivateFieldGet(this, _AngularRspackPlugin_angularCompilation, "f").diagnoseFiles(angular_rspack_compiler_1.DiagnosticModes.All);
|
|
536
|
+
}
|
|
537
|
+
// Surface everything except Semantic (type-checking) diagnostics.
|
|
538
|
+
const surfacedDiagnostics = tslib_1.__classPrivateFieldGet(this, _AngularRspackPlugin_angularCompilation, "f").diagnoseFiles((angular_rspack_compiler_1.DiagnosticModes.All & ~angular_rspack_compiler_1.DiagnosticModes.Semantic));
|
|
539
|
+
// Angular records state needed for incremental emission during semantic diagnostics.
|
|
540
|
+
// Start both calls together, but discard the semantic result or rejection.
|
|
541
|
+
const silentSemanticWarmup = tslib_1.__classPrivateFieldGet(this, _AngularRspackPlugin_angularCompilation, "f")
|
|
542
|
+
.diagnoseFiles(angular_rspack_compiler_1.DiagnosticModes.Semantic)
|
|
543
|
+
.then(() => undefined, () => undefined);
|
|
544
|
+
return Promise.all([surfacedDiagnostics, silentSemanticWarmup]).then(([result]) => result);
|
|
537
545
|
}, _AngularRspackPlugin_mergeStylesheetMetafileInputs = function _AngularRspackPlugin_mergeStylesheetMetafileInputs() {
|
|
538
546
|
for (const { source, inputs } of tslib_1.__classPrivateFieldGet(this, _AngularRspackPlugin_collectedStylesheetMetafileInputs, "f")) {
|
|
539
547
|
tslib_1.__classPrivateFieldGet(this, _AngularRspackPlugin_stylesheetMetafileInputsBySource, "f").set(source, inputs);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Compiler } from '@rspack/core';
|
|
2
|
+
/**
|
|
3
|
+
* Registers the engine manifest virtual module through the `@rspack/core`
|
|
4
|
+
* copy that created the compiler. Virtual files are tracked in state scoped
|
|
5
|
+
* to each `@rspack/core` copy, so an instance created from this package's
|
|
6
|
+
* own copy is invisible to a compiler constructed from a different one
|
|
7
|
+
* (e.g. with nested installs).
|
|
8
|
+
*/
|
|
9
|
+
export declare class EngineManifestPlugin {
|
|
10
|
+
private readonly path;
|
|
11
|
+
private readonly source;
|
|
12
|
+
constructor(path: string, source: string);
|
|
13
|
+
apply(compiler: Compiler): void;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=engine-manifest-plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine-manifest-plugin.d.ts","sourceRoot":"","sources":["../../../src/lib/plugins/engine-manifest-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C;;;;;;GAMG;AACH,qBAAa,oBAAoB;IAE7B,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAFzB,YACmB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EAC7B;IAEJ,KAAK,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAS9B;CACF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EngineManifestPlugin = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Registers the engine manifest virtual module through the `@rspack/core`
|
|
6
|
+
* copy that created the compiler. Virtual files are tracked in state scoped
|
|
7
|
+
* to each `@rspack/core` copy, so an instance created from this package's
|
|
8
|
+
* own copy is invisible to a compiler constructed from a different one
|
|
9
|
+
* (e.g. with nested installs).
|
|
10
|
+
*/
|
|
11
|
+
class EngineManifestPlugin {
|
|
12
|
+
constructor(path, source) {
|
|
13
|
+
this.path = path;
|
|
14
|
+
this.source = source;
|
|
15
|
+
}
|
|
16
|
+
apply(compiler) {
|
|
17
|
+
const VirtualModulesPlugin = compiler.rspack.experiments?.VirtualModulesPlugin;
|
|
18
|
+
if (!VirtualModulesPlugin) {
|
|
19
|
+
throw new Error('The "@angular/ssr" application engine wiring requires the "@rspack/core" copy running the build to support virtual modules (version 1.5.0 or greater).');
|
|
20
|
+
}
|
|
21
|
+
new VirtualModulesPlugin({ [this.path]: this.source }).apply(compiler);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.EngineManifestPlugin = EngineManifestPlugin;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import { LoaderContext, RawSourceMap } from '@rspack/core';
|
|
2
|
-
export
|
|
2
|
+
export interface AngularPartialTransformLoaderOptions {
|
|
3
|
+
/** Absolute path of the engine manifest virtual module. */
|
|
4
|
+
engineManifestPath: string;
|
|
5
|
+
}
|
|
6
|
+
export default function loader(this: LoaderContext<AngularPartialTransformLoaderOptions>, content: string, inputMap?: string | RawSourceMap): void;
|
|
3
7
|
//# sourceMappingURL=angular-partial-transform.loader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"angular-partial-transform.loader.d.ts","sourceRoot":"","sources":["../../../../src/lib/plugins/loaders/angular-partial-transform.loader.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAQ3D,MAAM,CAAC,OAAO,UAAU,MAAM,CAC5B,IAAI,EAAE,aAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"angular-partial-transform.loader.d.ts","sourceRoot":"","sources":["../../../../src/lib/plugins/loaders/angular-partial-transform.loader.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAQ3D,MAAM,WAAW,oCAAoC;IACnD,2DAA2D;IAC3D,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,CAAC,OAAO,UAAU,MAAM,CAC5B,IAAI,EAAE,aAAa,CAAC,oCAAoC,CAAC,EACzD,OAAO,EAAE,MAAM,EACf,QAAQ,CAAC,EAAE,MAAM,GAAG,YAAY,QA+IjC"}
|
|
@@ -31,6 +31,13 @@ function loader(content, inputMap) {
|
|
|
31
31
|
callback(null, content, chainMap);
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
|
+
// The engine manifest virtual module mentions '@angular' but needs no
|
|
35
|
+
// transform, and it has no on-disk file for the transformer worker to
|
|
36
|
+
// read.
|
|
37
|
+
if (request === this.getOptions().engineManifestPath) {
|
|
38
|
+
callback(null, content, chainMap);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
34
41
|
const normalizedRequest = (0, angular_rspack_compiler_1.toTypeScriptFileCacheKey)(request);
|
|
35
42
|
const cached = typescriptFileCache.get(normalizedRequest);
|
|
36
43
|
if (cached !== undefined) {
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File name of the virtual module carrying the engine manifest registration,
|
|
3
|
+
* resolved against the project root to form its absolute path.
|
|
4
|
+
*/
|
|
5
|
+
export declare const ENGINE_MANIFEST_VIRTUAL_NAME = "__ng-rspack-ssr-entry-manifest__.js";
|
|
6
|
+
export interface EngineWiringOptions {
|
|
7
|
+
/** Absolute path to the application's `main.server` entry. */
|
|
8
|
+
mainServerEntry: string;
|
|
9
|
+
baseHref: string;
|
|
10
|
+
locale: string | undefined;
|
|
11
|
+
inlineCriticalCss: boolean;
|
|
12
|
+
/** Path from the server output directory to the browser output. */
|
|
13
|
+
browserOutputRelativePath: string;
|
|
14
|
+
/** File name of the emitted index html within the browser output. */
|
|
15
|
+
indexOutputName: string | undefined;
|
|
16
|
+
supportedLocales: Record<string, string>;
|
|
17
|
+
allowedHosts: string[];
|
|
18
|
+
/**
|
|
19
|
+
* Skips the engine host validation while serving. Effective from
|
|
20
|
+
* `@angular/ssr` 20.3.25 / 21.2.1 (`ɵdisableAllowedHostsCheck`). The
|
|
21
|
+
* versions from the introduction of host validation (20.3.17 / 21.1.5) up
|
|
22
|
+
* to those have no disable mechanism and keep validating against
|
|
23
|
+
* `allowedHosts`.
|
|
24
|
+
*/
|
|
25
|
+
disableHostCheck?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Absolute path of the virtual module carrying the manifest registration.
|
|
28
|
+
* When set, the loader imports it instead of inlining the registration
|
|
29
|
+
* statements, so they run before the user entry's own imports evaluate.
|
|
30
|
+
* Absent when the installed rspack has no virtual modules support
|
|
31
|
+
* (< 1.5.0); the inlined statements then only run before the user entry's
|
|
32
|
+
* own statements.
|
|
33
|
+
*/
|
|
34
|
+
manifestModuleRequest?: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The module source registering the app and engine manifests. Emitted either
|
|
38
|
+
* as a virtual module the SSR entry imports first or inlined into the entry
|
|
39
|
+
* by the loader, depending on `manifestModuleRequest`.
|
|
40
|
+
*/
|
|
41
|
+
export declare function generateEngineManifestSource(engineWiring: EngineWiringOptions): string;
|
|
42
|
+
//# sourceMappingURL=engine-manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine-manifest.d.ts","sourceRoot":"","sources":["../../../../src/lib/plugins/loaders/engine-manifest.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,4BAA4B,wCACF,CAAC;AAExC,MAAM,WAAW,mBAAmB;IAClC,8DAA8D;IAC9D,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,mEAAmE;IACnE,yBAAyB,EAAE,MAAM,CAAC;IAClC,qEAAqE;IACrE,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;;;;;OAOG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAC1C,YAAY,EAAE,mBAAmB,GAChC,MAAM,CAmER"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ENGINE_MANIFEST_VIRTUAL_NAME = void 0;
|
|
4
|
+
exports.generateEngineManifestSource = generateEngineManifestSource;
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
/**
|
|
7
|
+
* File name of the virtual module carrying the engine manifest registration,
|
|
8
|
+
* resolved against the project root to form its absolute path.
|
|
9
|
+
*/
|
|
10
|
+
exports.ENGINE_MANIFEST_VIRTUAL_NAME = '__ng-rspack-ssr-entry-manifest__.js';
|
|
11
|
+
/**
|
|
12
|
+
* The module source registering the app and engine manifests. Emitted either
|
|
13
|
+
* as a virtual module the SSR entry imports first or inlined into the entry
|
|
14
|
+
* by the loader, depending on `manifestModuleRequest`.
|
|
15
|
+
*/
|
|
16
|
+
function generateEngineManifestSource(engineWiring) {
|
|
17
|
+
const mainServerRequest = JSON.stringify(engineWiring.mainServerEntry);
|
|
18
|
+
// The assets helper is bundled into the server output, keeping it off the
|
|
19
|
+
// package's public API surface. rspack resolves the extension.
|
|
20
|
+
const serverAssetsRequest = JSON.stringify((0, node_path_1.join)(__dirname, '../../ssr/server-assets'));
|
|
21
|
+
// The engine compares basePath against URL pathnames verbatim, but only in
|
|
22
|
+
// multi-locale setups; trim the trailing slash to match the base path the
|
|
23
|
+
// esbuild application builder emits.
|
|
24
|
+
let basePath = engineWiring.baseHref || '/';
|
|
25
|
+
if (basePath.length > 1 && basePath.endsWith('/')) {
|
|
26
|
+
basePath = basePath.slice(0, -1);
|
|
27
|
+
}
|
|
28
|
+
return `
|
|
29
|
+
import __ngRspackMainServerDefault from ${mainServerRequest};
|
|
30
|
+
import {
|
|
31
|
+
AngularAppEngine as __ngRspackAngularAppEngine,
|
|
32
|
+
ɵsetAngularAppManifest as __ngRspackSetAngularAppManifest,
|
|
33
|
+
ɵsetAngularAppEngineManifest as __ngRspackSetAngularAppEngineManifest,
|
|
34
|
+
ɵgetOrCreateAngularServerApp as __ngRspackGetOrCreateAngularServerApp,
|
|
35
|
+
ɵdestroyAngularServerApp as __ngRspackDestroyAngularServerApp,
|
|
36
|
+
} from '@angular/ssr';
|
|
37
|
+
import { createBrowserOutputServerAssets as __ngRspackCreateServerAssets } from ${serverAssetsRequest};
|
|
38
|
+
import { join as __ngRspackJoinPath } from 'node:path';
|
|
39
|
+
// MANIFESTS added by @nx/angular-rspack: an application engine cannot
|
|
40
|
+
// construct without them.
|
|
41
|
+
__ngRspackSetAngularAppManifest({
|
|
42
|
+
bootstrap: () => Promise.resolve(__ngRspackMainServerDefault),
|
|
43
|
+
inlineCriticalCss: ${JSON.stringify(engineWiring.inlineCriticalCss)},
|
|
44
|
+
baseHref: ${JSON.stringify(engineWiring.baseHref)},
|
|
45
|
+
locale: ${JSON.stringify(engineWiring.locale)},
|
|
46
|
+
assets: __ngRspackCreateServerAssets(
|
|
47
|
+
__ngRspackJoinPath(__dirname, ${JSON.stringify(engineWiring.browserOutputRelativePath)}),
|
|
48
|
+
${JSON.stringify(engineWiring.indexOutputName)},
|
|
49
|
+
${JSON.stringify(engineWiring.inlineCriticalCss)}
|
|
50
|
+
),
|
|
51
|
+
});
|
|
52
|
+
__ngRspackSetAngularAppEngineManifest({
|
|
53
|
+
basePath: ${JSON.stringify(basePath)},
|
|
54
|
+
supportedLocales: ${JSON.stringify(engineWiring.supportedLocales)},
|
|
55
|
+
allowedHosts: ${JSON.stringify(engineWiring.allowedHosts)},
|
|
56
|
+
// The bundle already contains the application and the manifest set
|
|
57
|
+
// above, so the entry point resolves in place instead of importing a
|
|
58
|
+
// separate main.server bundle.
|
|
59
|
+
entryPoints: {
|
|
60
|
+
'': () => Promise.resolve({
|
|
61
|
+
ɵgetOrCreateAngularServerApp: __ngRspackGetOrCreateAngularServerApp,
|
|
62
|
+
ɵdestroyAngularServerApp: __ngRspackDestroyAngularServerApp,
|
|
63
|
+
}),
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
// Build-time prerendering is not wired up; without this flag the engine
|
|
67
|
+
// refuses to render prerender-marked routes at request time, which 404s
|
|
68
|
+
// every route under the default server route configuration.
|
|
69
|
+
__ngRspackAngularAppEngine.ɵallowStaticRouteRender = true;
|
|
70
|
+
${engineWiring.disableHostCheck
|
|
71
|
+
? `// Skips validation on 20.3.25+ and 21.2.1+; an inert write on older
|
|
72
|
+
// versions, which have no disable mechanism.
|
|
73
|
+
__ngRspackAngularAppEngine.ɵdisableAllowedHostsCheck = true;`
|
|
74
|
+
: ''}
|
|
75
|
+
`;
|
|
76
|
+
}
|
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
import { type LoaderContext, type LoaderDefinitionFunction } from '@rspack/core';
|
|
2
|
-
|
|
2
|
+
import { type EngineWiringOptions } from './engine-manifest';
|
|
3
|
+
type LoaderSourceMap = Parameters<LoaderDefinitionFunction>[1];
|
|
4
|
+
export interface PlatformServerExportsLoaderOptions {
|
|
3
5
|
angularSSRInstalled: boolean;
|
|
4
6
|
isZoneJsInstalled: boolean;
|
|
5
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Wiring for the `@angular/ssr` application engine APIs. When set, the SSR
|
|
9
|
+
* entry registers the app and engine manifests and re-exports the engine
|
|
10
|
+
* entry points, mirroring the manifests the esbuild application builder
|
|
11
|
+
* injects. Without the manifests, `AngularAppEngine` and
|
|
12
|
+
* `AngularServerApp` throw at construction, so a server entry written
|
|
13
|
+
* against those APIs crashes at startup.
|
|
14
|
+
*/
|
|
15
|
+
engineWiring?: EngineWiringOptions;
|
|
16
|
+
}
|
|
17
|
+
export default function loader(this: LoaderContext<PlatformServerExportsLoaderOptions>, content: string, map: LoaderSourceMap): void;
|
|
18
|
+
export {};
|
|
6
19
|
//# sourceMappingURL=platform-server-exports.loader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform-server-exports.loader.d.ts","sourceRoot":"","sources":["../../../../src/lib/plugins/loaders/platform-server-exports.loader.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,wBAAwB,EAC9B,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"platform-server-exports.loader.d.ts","sourceRoot":"","sources":["../../../../src/lib/plugins/loaders/platform-server-exports.loader.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,wBAAwB,EAC9B,MAAM,cAAc,CAAC;AACtB,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,mBAAmB,CAAC;AAG3B,KAAK,eAAe,GAAG,UAAU,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,CAAC;AAE/D,MAAM,WAAW,kCAAkC;IACjD,mBAAmB,EAAE,OAAO,CAAC;IAC7B,iBAAiB,EAAE,OAAO,CAAC;IAC3B;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,mBAAmB,CAAC;CACpC;AAED,MAAM,CAAC,OAAO,UAAU,MAAM,CAC5B,IAAI,EAAE,aAAa,CAAC,kCAAkC,CAAC,EACvD,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,eAAe,QAmDrB"}
|
|
@@ -1,22 +1,73 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = loader;
|
|
4
|
+
const engine_manifest_1 = require("./engine-manifest");
|
|
5
|
+
const inline_source_map_1 = require("./inline-source-map");
|
|
4
6
|
function loader(content, map) {
|
|
5
|
-
const { angularSSRInstalled, isZoneJsInstalled } = this.getOptions();
|
|
6
|
-
let
|
|
7
|
-
|
|
7
|
+
const { angularSSRInstalled, isZoneJsInstalled, engineWiring } = this.getOptions();
|
|
8
|
+
let prologue;
|
|
9
|
+
let epilogue = `
|
|
8
10
|
// EXPORTS added by @nx/angular-rspack
|
|
9
11
|
export { renderApplication, renderModule, ɵSERVER_CONTEXT } from '@angular/platform-server';
|
|
10
12
|
`;
|
|
11
13
|
if (angularSSRInstalled) {
|
|
12
|
-
|
|
14
|
+
epilogue += `
|
|
13
15
|
export { ɵgetRoutesFromAngularRouterConfig } from '@angular/ssr';
|
|
14
16
|
`;
|
|
15
17
|
}
|
|
16
|
-
if (
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
if (angularSSRInstalled && engineWiring) {
|
|
19
|
+
prologue = engineWiring.manifestModuleRequest
|
|
20
|
+
? // A separate module evaluates before the user entry's own imports, so
|
|
21
|
+
// an engine constructed in an imported module's scope finds the
|
|
22
|
+
// manifests.
|
|
23
|
+
`import ${JSON.stringify(engineWiring.manifestModuleRequest)};`
|
|
24
|
+
: (0, engine_manifest_1.generateEngineManifestSource)(engineWiring);
|
|
25
|
+
epilogue += `
|
|
26
|
+
export {
|
|
27
|
+
ɵgetOrCreateAngularServerApp,
|
|
28
|
+
ɵextractRoutesAndCreateRouteTree,
|
|
29
|
+
ɵdestroyAngularServerApp,
|
|
30
|
+
} from '@angular/ssr';
|
|
31
|
+
export { default as __ngRspackMainServerBootstrap } from ${JSON.stringify(engineWiring.mainServerEntry)};
|
|
32
|
+
`;
|
|
19
33
|
}
|
|
20
|
-
|
|
34
|
+
const prefix = [
|
|
35
|
+
isZoneJsInstalled ? `import 'zone.js/node';` : undefined,
|
|
36
|
+
prologue,
|
|
37
|
+
]
|
|
38
|
+
.filter((section) => section !== undefined)
|
|
39
|
+
.map((section) => `${section}\n`)
|
|
40
|
+
.join('');
|
|
41
|
+
this.callback(null, `${prefix}${content}\n${epilogue}`, shiftSourceMap(map, prefix));
|
|
21
42
|
return;
|
|
22
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Moves every mapping down by the number of lines emitted before the original
|
|
46
|
+
* content. Source Map v3 `mappings` holds one `;`-separated group per
|
|
47
|
+
* generated line, so leading empty groups shift the lines and leave the
|
|
48
|
+
* columns untouched. A map that cannot be parsed or that rspack would reject
|
|
49
|
+
* is forwarded as it arrived.
|
|
50
|
+
*/
|
|
51
|
+
function shiftSourceMap(map, prefix) {
|
|
52
|
+
const lineCount = prefix.split('\n').length - 1;
|
|
53
|
+
if (map === undefined || lineCount === 0) {
|
|
54
|
+
return map;
|
|
55
|
+
}
|
|
56
|
+
let parsed = map;
|
|
57
|
+
if (typeof map === 'string') {
|
|
58
|
+
try {
|
|
59
|
+
parsed = JSON.parse(map);
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
return map;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
if (!(0, inline_source_map_1.isForwardableSourceMap)(parsed)) {
|
|
66
|
+
return map;
|
|
67
|
+
}
|
|
68
|
+
const shifted = {
|
|
69
|
+
...parsed,
|
|
70
|
+
mappings: `${';'.repeat(lineCount)}${parsed.mappings}`,
|
|
71
|
+
};
|
|
72
|
+
return typeof map === 'string' ? JSON.stringify(shifted) : shifted;
|
|
73
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-worker.d.ts","sourceRoot":"","sources":["../../../../src/lib/plugins/tools/render-worker.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAaH,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;
|
|
1
|
+
{"version":3,"file":"render-worker.d.ts","sourceRoot":"","sources":["../../../../src/lib/plugins/tools/render-worker.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAaH,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAqCD;;GAEG;AACH,iBAAe,MAAM,CAAC,EACpB,SAAS,EACT,SAAS,EACT,SAAS,EACT,UAAU,EACV,gBAAgB,EAChB,KAAK,EACL,iBAAiB,GAClB,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,CAsGvC;AAuBD;;;GAGG"}
|
|
@@ -27,7 +27,8 @@ async function render({ indexFile, deployUrl, minifyCss, outputPath, serverBundl
|
|
|
27
27
|
const outputIndexPath = path.join(outputFolderPath, 'index.html');
|
|
28
28
|
// rspack emits a CommonJS server bundle; load with `require` so its named
|
|
29
29
|
// exports resolve (a nodenext `import()` would leave them undefined).
|
|
30
|
-
const { ɵSERVER_CONTEXT, AppServerModule, renderModule, renderApplication, default:
|
|
30
|
+
const { ɵSERVER_CONTEXT, AppServerModule, renderModule, renderApplication, default: defaultExport, __ngRspackMainServerBootstrap, } = require(serverBundlePath);
|
|
31
|
+
const bootstrapAppFn = defaultExport ?? __ngRspackMainServerBootstrap;
|
|
31
32
|
(0, node_assert_1.default)(ɵSERVER_CONTEXT, `ɵSERVER_CONTEXT was not exported from: ${serverBundlePath}.`);
|
|
32
33
|
const indexBaseName = fs.existsSync(path.join(outputPath, 'index.original.html'))
|
|
33
34
|
? 'index.original.html'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes-extractor-worker.d.ts","sourceRoot":"","sources":["../../../../src/lib/plugins/tools/routes-extractor-worker.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AASH,MAAM,WAAW,yBAAyB;IACxC,WAAW,EAAE,MAAM,GAAG,KAAK,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;
|
|
1
|
+
{"version":3,"file":"routes-extractor-worker.d.ts","sourceRoot":"","sources":["../../../../src/lib/plugins/tools/routes-extractor-worker.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AASH,MAAM,WAAW,yBAAyB;IACxC,WAAW,EAAE,MAAM,GAAG,KAAK,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AA0BD,iBAAe,OAAO,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAkC1C;AAiBD;;;GAGG"}
|
|
@@ -16,11 +16,11 @@ const { zonePackage, serverBundlePath, outputPath, indexFile } = node_worker_thr
|
|
|
16
16
|
async function extract() {
|
|
17
17
|
// rspack emits a CommonJS server bundle; load with `require` so its named
|
|
18
18
|
// exports resolve (a nodenext `import()` would leave them undefined).
|
|
19
|
-
const { AppServerModule, ɵgetRoutesFromAngularRouterConfig: getRoutesFromAngularRouterConfig, default: bootstrapAppFn, } = require(serverBundlePath);
|
|
19
|
+
const { AppServerModule, ɵgetRoutesFromAngularRouterConfig: getRoutesFromAngularRouterConfig, default: bootstrapAppFn, __ngRspackMainServerBootstrap, } = require(serverBundlePath);
|
|
20
20
|
const browserIndexInputPath = path.join(outputPath, indexFile);
|
|
21
21
|
const document = await fs.promises.readFile(browserIndexInputPath, 'utf8');
|
|
22
|
-
const bootstrapAppFnOrModule = bootstrapAppFn || AppServerModule;
|
|
23
|
-
(0, node_assert_1.default)(bootstrapAppFnOrModule, `
|
|
22
|
+
const bootstrapAppFnOrModule = bootstrapAppFn || __ngRspackMainServerBootstrap || AppServerModule;
|
|
23
|
+
(0, node_assert_1.default)(bootstrapAppFnOrModule, `Neither an AppServerModule nor a bootstrapping function was exported from: ${serverBundlePath}.`);
|
|
24
24
|
const routes = [];
|
|
25
25
|
const { routes: extractRoutes } = await getRoutesFromAngularRouterConfig(bootstrapAppFnOrModule, document, new URL('http://localhost'));
|
|
26
26
|
for (const { route, redirectTo } of extractRoutes) {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
interface ServerAsset {
|
|
2
|
+
text: () => Promise<string>;
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Builds the `assets` table of the Angular app manifest from the browser
|
|
6
|
+
* output that sits next to the server bundle. The esbuild application
|
|
7
|
+
* builder inlines these assets into the server output at build time; here
|
|
8
|
+
* only the directory listing and file stats are read when the server process
|
|
9
|
+
* starts and contents are read lazily, so a restarted process always serves
|
|
10
|
+
* the current build output and rebuilds never have to invalidate the SSR
|
|
11
|
+
* entry module (whose injected code would otherwise embed stale index
|
|
12
|
+
* contents under output hashing).
|
|
13
|
+
*
|
|
14
|
+
* The table maps the emitted index html to the `index.server.html` and
|
|
15
|
+
* `index.csr.html` names the `@angular/ssr` render path looks up. Top-level
|
|
16
|
+
* stylesheets are included only when critical CSS inlining is enabled: the
|
|
17
|
+
* inliner, which fetches them by file name, is their only consumer.
|
|
18
|
+
*
|
|
19
|
+
* This module is bundled into the user's server bundle, so it must only
|
|
20
|
+
* import node builtins.
|
|
21
|
+
*/
|
|
22
|
+
export declare function createBrowserOutputServerAssets(browserOutputPath: string, indexOutputName: string | undefined, inlineCriticalCss: boolean): Record<string, ServerAsset>;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=server-assets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-assets.d.ts","sourceRoot":"","sources":["../../../src/lib/ssr/server-assets.ts"],"names":[],"mappings":"AAIA,UAAU,WAAW;IACnB,IAAI,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,+BAA+B,CAC7C,iBAAiB,EAAE,MAAM,EACzB,eAAe,EAAE,MAAM,GAAG,SAAS,EACnC,iBAAiB,EAAE,OAAO,GACzB,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAoC7B"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createBrowserOutputServerAssets = createBrowserOutputServerAssets;
|
|
4
|
+
const node_fs_1 = require("node:fs");
|
|
5
|
+
const promises_1 = require("node:fs/promises");
|
|
6
|
+
const node_path_1 = require("node:path");
|
|
7
|
+
/**
|
|
8
|
+
* Builds the `assets` table of the Angular app manifest from the browser
|
|
9
|
+
* output that sits next to the server bundle. The esbuild application
|
|
10
|
+
* builder inlines these assets into the server output at build time; here
|
|
11
|
+
* only the directory listing and file stats are read when the server process
|
|
12
|
+
* starts and contents are read lazily, so a restarted process always serves
|
|
13
|
+
* the current build output and rebuilds never have to invalidate the SSR
|
|
14
|
+
* entry module (whose injected code would otherwise embed stale index
|
|
15
|
+
* contents under output hashing).
|
|
16
|
+
*
|
|
17
|
+
* The table maps the emitted index html to the `index.server.html` and
|
|
18
|
+
* `index.csr.html` names the `@angular/ssr` render path looks up. Top-level
|
|
19
|
+
* stylesheets are included only when critical CSS inlining is enabled: the
|
|
20
|
+
* inliner, which fetches them by file name, is their only consumer.
|
|
21
|
+
*
|
|
22
|
+
* This module is bundled into the user's server bundle, so it must only
|
|
23
|
+
* import node builtins.
|
|
24
|
+
*/
|
|
25
|
+
function createBrowserOutputServerAssets(browserOutputPath, indexOutputName, inlineCriticalCss) {
|
|
26
|
+
const assets = {};
|
|
27
|
+
let entries;
|
|
28
|
+
try {
|
|
29
|
+
entries = (0, node_fs_1.readdirSync)(browserOutputPath);
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
if (error.code !== 'ENOENT') {
|
|
33
|
+
throw error;
|
|
34
|
+
}
|
|
35
|
+
// Without a browser output there is nothing to serve; rendering reports
|
|
36
|
+
// the missing asset.
|
|
37
|
+
return assets;
|
|
38
|
+
}
|
|
39
|
+
if (inlineCriticalCss) {
|
|
40
|
+
for (const entry of entries) {
|
|
41
|
+
if ((0, node_path_1.extname)(entry) === '.css') {
|
|
42
|
+
const asset = createDiskAsset((0, node_path_1.join)(browserOutputPath, entry));
|
|
43
|
+
if (asset) {
|
|
44
|
+
assets[entry] = asset;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (indexOutputName) {
|
|
50
|
+
const indexAsset = createDiskAsset((0, node_path_1.join)(browserOutputPath, indexOutputName));
|
|
51
|
+
if (indexAsset) {
|
|
52
|
+
// Never registered under its emitted name: the engine serves a table
|
|
53
|
+
// hit for a prerender-marked route as-is, so an `index.html` key would
|
|
54
|
+
// serve the un-rendered CSR shell for `/` instead of rendering it.
|
|
55
|
+
assets['index.server.html'] = indexAsset;
|
|
56
|
+
assets['index.csr.html'] = indexAsset;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return assets;
|
|
60
|
+
}
|
|
61
|
+
function createDiskAsset(filePath) {
|
|
62
|
+
try {
|
|
63
|
+
(0, node_fs_1.statSync)(filePath);
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
if (error.code !== 'ENOENT') {
|
|
67
|
+
throw error;
|
|
68
|
+
}
|
|
69
|
+
// Never emitted under this name, or removed by a concurrent rebuild;
|
|
70
|
+
// rendering reports the missing asset.
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
let text;
|
|
74
|
+
return {
|
|
75
|
+
// The engine reads assets per request; the output file is immutable for
|
|
76
|
+
// the process lifetime, so cache the content. Only a fulfilled read is
|
|
77
|
+
// kept: a memoized rejection would fail every later request.
|
|
78
|
+
text: () => (text ??= (0, promises_1.readFile)(filePath, 'utf-8').catch((error) => {
|
|
79
|
+
text = undefined;
|
|
80
|
+
throw error;
|
|
81
|
+
})),
|
|
82
|
+
};
|
|
83
|
+
}
|
|
@@ -3,5 +3,6 @@ export declare function assertIsError(value: unknown): asserts value is Error &
|
|
|
3
3
|
code?: string;
|
|
4
4
|
};
|
|
5
5
|
export declare function isPackageInstalled(root: string, name: string): boolean;
|
|
6
|
+
export declare function getInstalledPackageVersionFromRoot(root: string, name: string): string | null;
|
|
6
7
|
export declare function assertNever(input: never): never;
|
|
7
8
|
//# sourceMappingURL=misc-helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"misc-helpers.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/misc-helpers.ts"],"names":[],"mappings":"AAMA,wBAAgB,aAAa,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC,CAiBrE;AAYD,wBAAgB,aAAa,CAC3B,KAAK,EAAE,OAAO,GACb,OAAO,CAAC,KAAK,IAAI,KAAK,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAS5C;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAQtE;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAQ/C"}
|
|
1
|
+
{"version":3,"file":"misc-helpers.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/misc-helpers.ts"],"names":[],"mappings":"AAMA,wBAAgB,aAAa,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC,CAiBrE;AAYD,wBAAgB,aAAa,CAC3B,KAAK,EAAE,OAAO,GACb,OAAO,CAAC,KAAK,IAAI,KAAK,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAS5C;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAQtE;AAED,wBAAgB,kCAAkC,CAChD,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GACX,MAAM,GAAG,IAAI,CAmBf;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAQ/C"}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.loadEsmModule = loadEsmModule;
|
|
4
4
|
exports.assertIsError = assertIsError;
|
|
5
5
|
exports.isPackageInstalled = isPackageInstalled;
|
|
6
|
+
exports.getInstalledPackageVersionFromRoot = getInstalledPackageVersionFromRoot;
|
|
6
7
|
exports.assertNever = assertNever;
|
|
7
8
|
const tslib_1 = require("tslib");
|
|
8
9
|
const node_assert_1 = tslib_1.__importDefault(require("node:assert"));
|
|
@@ -47,6 +48,24 @@ function isPackageInstalled(root, name) {
|
|
|
47
48
|
return false;
|
|
48
49
|
}
|
|
49
50
|
}
|
|
51
|
+
function getInstalledPackageVersionFromRoot(root, name) {
|
|
52
|
+
try {
|
|
53
|
+
const packageJsonPath = require.resolve(`${name}/package.json`, {
|
|
54
|
+
paths: [root],
|
|
55
|
+
});
|
|
56
|
+
return require(packageJsonPath).version ?? null;
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
const code = error.code;
|
|
60
|
+
// Not installed, or the package does not export its package.json; the
|
|
61
|
+
// version is unknown either way.
|
|
62
|
+
if (code === 'MODULE_NOT_FOUND' ||
|
|
63
|
+
code === 'ERR_PACKAGE_PATH_NOT_EXPORTED') {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
throw error;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
50
69
|
function assertNever(input) {
|
|
51
70
|
throw new Error(`Unexpected call to assertNever() with input: ${JSON.stringify(input, null /* replacer */, 4 /* tabSize */)}`);
|
|
52
71
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/angular-rspack",
|
|
3
|
-
"version": "23.
|
|
3
|
+
"version": "23.3.0-beta.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -77,8 +77,8 @@
|
|
|
77
77
|
"tslib": "^2.3.0",
|
|
78
78
|
"webpack-merge": "^6.0.1",
|
|
79
79
|
"ws": "^8.18.0",
|
|
80
|
-
"@nx/angular-rspack-compiler": "23.
|
|
81
|
-
"@nx/devkit": "23.
|
|
80
|
+
"@nx/angular-rspack-compiler": "23.3.0-beta.1",
|
|
81
|
+
"@nx/devkit": "23.3.0-beta.1"
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
84
|
"jsonc-eslint-parser": "^2.4.0"
|