@nx/angular-rspack 20.8.2 → 20.9.0
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/browser-config.d.ts +4 -0
- package/dist/lib/config/config-utils/browser-config.d.ts.map +1 -0
- package/dist/lib/config/config-utils/browser-config.js +68 -0
- package/dist/lib/config/config-utils/common-config.d.ts +3 -0
- package/dist/lib/config/config-utils/common-config.d.ts.map +1 -0
- package/dist/lib/config/config-utils/common-config.js +111 -0
- package/dist/lib/config/config-utils/dev-server-config-utils.d.ts +4 -0
- package/dist/lib/config/config-utils/dev-server-config-utils.d.ts.map +1 -0
- package/dist/lib/config/config-utils/dev-server-config-utils.js +255 -0
- package/dist/lib/config/{entry-points.d.ts → config-utils/entry-points.d.ts} +1 -1
- package/dist/lib/config/config-utils/entry-points.d.ts.map +1 -0
- package/dist/lib/config/config-utils/helpers.d.ts +13 -0
- package/dist/lib/config/config-utils/helpers.d.ts.map +1 -0
- package/dist/lib/config/{helpers.js → config-utils/helpers.js} +33 -0
- package/dist/lib/config/config-utils/optimization-config.d.ts +5 -0
- package/dist/lib/config/config-utils/optimization-config.d.ts.map +1 -0
- package/dist/lib/config/config-utils/optimization-config.js +67 -0
- package/dist/lib/config/config-utils/server-config.d.ts +4 -0
- package/dist/lib/config/config-utils/server-config.d.ts.map +1 -0
- package/dist/lib/config/config-utils/server-config.js +87 -0
- package/dist/lib/config/config-utils/sourcemap-utils.d.ts +7 -0
- package/dist/lib/config/config-utils/sourcemap-utils.d.ts.map +1 -0
- package/dist/lib/config/config-utils/sourcemap-utils.js +48 -0
- package/dist/lib/config/config-utils/style-config-utils.d.ts +7 -0
- package/dist/lib/config/config-utils/style-config-utils.d.ts.map +1 -0
- package/dist/lib/config/config-utils/style-config-utils.js +353 -0
- package/dist/lib/config/config-utils/user-defined-config-helpers.d.ts +78 -0
- package/dist/lib/config/config-utils/user-defined-config-helpers.d.ts.map +1 -0
- package/dist/lib/config/config-utils/user-defined-config-helpers.js +23 -0
- package/dist/lib/config/create-config.d.ts +2 -75
- package/dist/lib/config/create-config.d.ts.map +1 -1
- package/dist/lib/config/create-config.js +17 -473
- package/dist/lib/index.d.ts +4 -0
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +9 -0
- package/dist/lib/models/angular-rspack-plugin-options.d.ts +41 -4
- package/dist/lib/models/angular-rspack-plugin-options.d.ts.map +1 -1
- package/dist/lib/models/normalize-options.d.ts.map +1 -1
- package/dist/lib/models/normalize-options.js +53 -54
- package/dist/lib/models/unsupported-options.d.ts +0 -7
- package/dist/lib/models/unsupported-options.d.ts.map +1 -1
- package/dist/lib/models/unsupported-options.js +0 -4
- package/dist/lib/plugins/angular-rspack-plugin.d.ts.map +1 -1
- package/dist/lib/plugins/angular-rspack-plugin.js +0 -7
- package/dist/lib/plugins/angular-ssr-dev-server.d.ts +2 -2
- package/dist/lib/plugins/angular-ssr-dev-server.d.ts.map +1 -1
- package/dist/lib/plugins/angular-ssr-dev-server.js +19 -9
- package/dist/lib/plugins/index-html-plugin.d.ts.map +1 -1
- package/dist/lib/plugins/index-html-plugin.js +2 -7
- package/dist/lib/plugins/loaders/platform-server-exports.loader.d.ts +5 -0
- package/dist/lib/plugins/loaders/platform-server-exports.loader.d.ts.map +1 -0
- package/dist/lib/plugins/loaders/platform-server-exports.loader.js +18 -0
- package/dist/lib/plugins/ng-rspack.d.ts.map +1 -1
- package/dist/lib/plugins/ng-rspack.js +3 -3
- package/dist/lib/plugins/prerender-plugin.d.ts +8 -0
- package/dist/lib/plugins/prerender-plugin.d.ts.map +1 -0
- package/dist/lib/plugins/prerender-plugin.js +154 -0
- package/dist/lib/plugins/tools/render-worker.d.ts +31 -0
- package/dist/lib/plugins/tools/render-worker.d.ts.map +1 -0
- package/dist/lib/plugins/tools/render-worker.js +103 -0
- package/dist/lib/plugins/tools/routes-extractor-worker.d.ts +21 -0
- package/dist/lib/plugins/tools/routes-extractor-worker.d.ts.map +1 -0
- package/dist/lib/plugins/tools/routes-extractor-worker.js +46 -0
- package/dist/lib/plugins/tools/worker-pool.d.ts +13 -0
- package/dist/lib/plugins/tools/worker-pool.d.ts.map +1 -0
- package/dist/lib/plugins/tools/worker-pool.js +26 -0
- package/dist/lib/utils/index-file/add-body-script.d.ts +2 -0
- package/dist/lib/utils/index-file/add-body-script.d.ts.map +1 -0
- package/dist/lib/utils/index-file/add-body-script.js +15 -0
- package/dist/lib/utils/index-file/get-index-output-file.d.ts +3 -0
- package/dist/lib/utils/index-file/get-index-output-file.d.ts.map +1 -0
- package/dist/lib/utils/index-file/get-index-output-file.js +10 -0
- package/dist/lib/utils/max-workers.d.ts +2 -0
- package/dist/lib/utils/max-workers.d.ts.map +1 -0
- package/dist/lib/utils/max-workers.js +21 -0
- package/dist/lib/utils/postcss-cli-resources.d.ts +22 -0
- package/dist/lib/utils/postcss-cli-resources.d.ts.map +1 -0
- package/dist/lib/utils/postcss-cli-resources.js +158 -0
- package/dist/lib/utils/postcss-configuration.d.ts +18 -0
- package/dist/lib/utils/postcss-configuration.d.ts.map +1 -0
- package/dist/lib/utils/postcss-configuration.js +89 -0
- package/package.json +19 -5
- package/dist/lib/config/dev-server-config-utils.d.ts +0 -4
- package/dist/lib/config/dev-server-config-utils.d.ts.map +0 -1
- package/dist/lib/config/dev-server-config-utils.js +0 -107
- package/dist/lib/config/entry-points.d.ts.map +0 -1
- package/dist/lib/config/helpers.d.ts +0 -14
- package/dist/lib/config/helpers.d.ts.map +0 -1
- package/dist/lib/config/style-config-utils.d.ts +0 -22
- package/dist/lib/config/style-config-utils.d.ts.map +0 -1
- package/dist/lib/config/style-config-utils.js +0 -202
- package/dist/lib/utils/tailwind.d.ts +0 -2
- package/dist/lib/utils/tailwind.d.ts.map +0 -1
- package/dist/lib/utils/tailwind.js +0 -31
- /package/dist/lib/config/{entry-points.js → config-utils/entry-points.js} +0 -0
|
@@ -10,9 +10,28 @@ export interface DevServerOptions extends DevServerUnsupportedOptions {
|
|
|
10
10
|
* Don't verify connected clients are part of allowed hosts.
|
|
11
11
|
*/
|
|
12
12
|
disableHostCheck?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Custom HTTP headers to be added to all responses.
|
|
15
|
+
*/
|
|
16
|
+
headers?: Record<string, string>;
|
|
13
17
|
host?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Whether to reload the page on change, using live-reload.
|
|
20
|
+
* @default true
|
|
21
|
+
*/
|
|
22
|
+
liveReload?: boolean;
|
|
14
23
|
port?: number;
|
|
15
24
|
proxyConfig?: string;
|
|
25
|
+
/**
|
|
26
|
+
* The URL that the browser client (or live-reload client, if enabled) should
|
|
27
|
+
* use to connect to the development server. Use for a complex dev server setup,
|
|
28
|
+
* such as one with reverse proxies.
|
|
29
|
+
*/
|
|
30
|
+
publicHost?: string;
|
|
31
|
+
/**
|
|
32
|
+
* The pathname where the application will be served.
|
|
33
|
+
*/
|
|
34
|
+
servePath?: string;
|
|
16
35
|
ssl?: boolean;
|
|
17
36
|
sslCert?: string;
|
|
18
37
|
sslKey?: string;
|
|
@@ -20,6 +39,7 @@ export interface DevServerOptions extends DevServerUnsupportedOptions {
|
|
|
20
39
|
export interface NormalizedDevServerOptions extends DevServerOptions {
|
|
21
40
|
allowedHosts: string[] | boolean;
|
|
22
41
|
host: string;
|
|
42
|
+
liveReload: boolean;
|
|
23
43
|
port: number;
|
|
24
44
|
}
|
|
25
45
|
export interface OptimizationOptions {
|
|
@@ -67,9 +87,9 @@ export type IndexExpandedDefinition = {
|
|
|
67
87
|
};
|
|
68
88
|
export type IndexElement = IndexExpandedDefinition | string | false;
|
|
69
89
|
export type IndexHtmlTransform = (content: string) => Promise<string>;
|
|
70
|
-
export type NormalizedIndexElement =
|
|
90
|
+
export type NormalizedIndexElement = IndexExpandedDefinition & {
|
|
71
91
|
transformer: IndexHtmlTransform | undefined;
|
|
72
|
-
}
|
|
92
|
+
};
|
|
73
93
|
export interface SourceMap {
|
|
74
94
|
scripts: boolean;
|
|
75
95
|
styles: boolean;
|
|
@@ -142,6 +162,23 @@ export interface AngularRspackPluginOptions extends PluginUnsupportedOptions {
|
|
|
142
162
|
outputHashing?: OutputHashing;
|
|
143
163
|
outputPath?: string | (Required<Pick<OutputPath, 'base'>> & Partial<OutputPath>);
|
|
144
164
|
polyfills?: string[];
|
|
165
|
+
/**
|
|
166
|
+
* Prerender (SSG) pages of your application during build time.
|
|
167
|
+
*/
|
|
168
|
+
prerender?: boolean | {
|
|
169
|
+
/**
|
|
170
|
+
* The routes to render.
|
|
171
|
+
*/
|
|
172
|
+
routes?: string[];
|
|
173
|
+
/**
|
|
174
|
+
* The path to a file that contains a list of all routes to prerender, separated by newlines. This option is useful if you want to prerender routes with parameterized URLs.
|
|
175
|
+
*/
|
|
176
|
+
routesFile?: string;
|
|
177
|
+
/**
|
|
178
|
+
* Whether the builder should process the Angular Router configuration to find all unparameterized routes and prerender them.
|
|
179
|
+
*/
|
|
180
|
+
discoverRoutes?: boolean;
|
|
181
|
+
};
|
|
145
182
|
/**
|
|
146
183
|
* Do not use the real path when resolving modules. If unset then will default to `true` if NodeJS option --preserve-symlinks is set.
|
|
147
184
|
*/
|
|
@@ -189,9 +226,9 @@ export interface NormalizedAngularRspackPluginOptions extends Omit<AngularRspack
|
|
|
189
226
|
fileReplacements: FileReplacement[];
|
|
190
227
|
globalScripts: GlobalEntry[];
|
|
191
228
|
globalStyles: GlobalEntry[];
|
|
192
|
-
index: NormalizedIndexElement | undefined;
|
|
193
|
-
inlineStyleLanguage: InlineStyleLanguage;
|
|
194
229
|
hasServer: boolean;
|
|
230
|
+
index: NormalizedIndexElement;
|
|
231
|
+
inlineStyleLanguage: InlineStyleLanguage;
|
|
195
232
|
namedChunks: boolean;
|
|
196
233
|
optimization: boolean | OptimizationOptions;
|
|
197
234
|
outputHashing: OutputHashing;
|
|
@@ -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,EACV,2BAA2B,EAC3B,wBAAwB,EACzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAE7C,MAAM,WAAW,gBAAiB,SAAQ,2BAA2B;IACnE;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAClC;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;
|
|
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,EACV,2BAA2B,EAC3B,wBAAwB,EACzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAE7C,MAAM,WAAW,gBAAiB,SAAQ,2BAA2B;IACnE;;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,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IAC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rC,OAAO,CAQT;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,0BAA0B,CAAC,KAAK,CAAC,QAmBjE;AAED,wBAAgB,oBAAoB,CAClC,YAAY,EAAE,0BAA0B,CAAC,cAAc,CAAC,QASzD;AA0BD,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,oCAAoC,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;AAmBnE,OAAO,KAAK,EACV,0BAA0B,EAI1B,oCAAoC,EAOrC,MAAM,iCAAiC,CAAC;AAMzC,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,GACrC,OAAO,CAQT;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,0BAA0B,CAAC,KAAK,CAAC,QAmBjE;AAED,wBAAgB,oBAAoB,CAClC,YAAY,EAAE,0BAA0B,CAAC,cAAc,CAAC,QASzD;AA0BD,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,oCAAoC,CAAC,CAuK/C"}
|
|
@@ -104,63 +104,58 @@ async function normalizeOptions(options) {
|
|
|
104
104
|
else if (!options.index) {
|
|
105
105
|
options.index = (0, node_path_1.join)(root, 'src/index.html');
|
|
106
106
|
}
|
|
107
|
-
let index;
|
|
108
107
|
// index can never have a value of `true` but in the schema it's of type `boolean`.
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
console.warn(`The "index.preloadInitial" option is not yet supported.`);
|
|
118
|
-
}
|
|
119
|
-
if (options.index.output) {
|
|
120
|
-
console.warn(`The "index.output" option is not yet supported.`);
|
|
121
|
-
}
|
|
122
|
-
indexOutput = options.index.output || 'index.html';
|
|
108
|
+
let indexOutput;
|
|
109
|
+
// The output file will be created within the configured output path
|
|
110
|
+
if (typeof options.index === 'string') {
|
|
111
|
+
indexOutput = options.index;
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
if (options.index.preloadInitial) {
|
|
115
|
+
console.warn(`The "index.preloadInitial" option is not yet supported.`);
|
|
123
116
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
* This is necessary because numerous server/cloud providers automatically serve the `index.html` as a static file
|
|
127
|
-
* if it exists (handling SSG).
|
|
128
|
-
*
|
|
129
|
-
* For instance, accessing `foo.com/` would lead to `foo.com/index.html` being served instead of hitting the server.
|
|
130
|
-
*
|
|
131
|
-
* This approach can also be applied to service workers, where the `index.csr.html` is served instead of the prerendered `index.html`.
|
|
132
|
-
*/
|
|
133
|
-
const indexBaseName = (0, node_path_1.basename)(indexOutput);
|
|
134
|
-
// @TODO: use this once we properly support SSR/SSG options
|
|
135
|
-
// (normalizedSsr || prerenderOptions) && indexBaseName === 'index.html'
|
|
136
|
-
// ? INDEX_HTML_CSR
|
|
137
|
-
// : indexBaseName;
|
|
138
|
-
indexOutput = indexBaseName;
|
|
139
|
-
const entryPoints = [
|
|
140
|
-
// TODO: this should be true when !!devServer?.hot (HMR is supported)
|
|
141
|
-
['runtime', false],
|
|
142
|
-
['polyfills', true],
|
|
143
|
-
...globalStyles.filter((s) => s.initial).map((s) => [s.name, false]),
|
|
144
|
-
...globalScripts
|
|
145
|
-
.filter((s) => s.initial)
|
|
146
|
-
.map((s) => [s.name, false]),
|
|
147
|
-
['vendor', true],
|
|
148
|
-
['main', true],
|
|
149
|
-
];
|
|
150
|
-
const duplicates = entryPoints.filter(([name]) => entryPoints[0].indexOf(name) !== entryPoints[0].lastIndexOf(name));
|
|
151
|
-
if (duplicates.length > 0) {
|
|
152
|
-
throw new Error(`Multiple bundles have been named the same: '${duplicates.join(`', '`)}'.`);
|
|
117
|
+
if (options.index.output) {
|
|
118
|
+
console.warn(`The "index.output" option is not yet supported.`);
|
|
153
119
|
}
|
|
154
|
-
|
|
155
|
-
input: (0, node_path_1.resolve)(root, typeof options.index === 'string' ? options.index : options.index.input),
|
|
156
|
-
output: indexOutput,
|
|
157
|
-
// @TODO: Add support for transformer
|
|
158
|
-
transformer: undefined,
|
|
159
|
-
// Preload initial defaults to true
|
|
160
|
-
preloadInitial: typeof options.index !== 'object' ||
|
|
161
|
-
(options.index.preloadInitial ?? true),
|
|
162
|
-
};
|
|
120
|
+
indexOutput = options.index.output || 'index.html';
|
|
163
121
|
}
|
|
122
|
+
/**
|
|
123
|
+
* If SSR is activated, create a distinct entry file for the `index.html`.
|
|
124
|
+
* This is necessary because numerous server/cloud providers automatically serve the `index.html` as a static file
|
|
125
|
+
* if it exists (handling SSG).
|
|
126
|
+
*
|
|
127
|
+
* For instance, accessing `foo.com/` would lead to `foo.com/index.html` being served instead of hitting the server.
|
|
128
|
+
*
|
|
129
|
+
* This approach can also be applied to service workers, where the `index.csr.html` is served instead of the prerendered `index.html`.
|
|
130
|
+
*/
|
|
131
|
+
const indexBaseName = (0, node_path_1.basename)(indexOutput);
|
|
132
|
+
// @TODO: use this once we properly support SSR/SSG options
|
|
133
|
+
// (normalizedSsr || prerenderOptions) && indexBaseName === 'index.html'
|
|
134
|
+
// ? INDEX_HTML_CSR
|
|
135
|
+
// : indexBaseName;
|
|
136
|
+
indexOutput = indexBaseName;
|
|
137
|
+
const entryPoints = [
|
|
138
|
+
// TODO: this should be true when !!devServer?.hot (HMR is supported)
|
|
139
|
+
['runtime', false],
|
|
140
|
+
['polyfills', true],
|
|
141
|
+
...globalStyles.filter((s) => s.initial).map((s) => [s.name, false]),
|
|
142
|
+
...globalScripts.filter((s) => s.initial).map((s) => [s.name, false]),
|
|
143
|
+
['vendor', true],
|
|
144
|
+
['main', true],
|
|
145
|
+
];
|
|
146
|
+
const duplicates = entryPoints.filter(([name]) => entryPoints[0].indexOf(name) !== entryPoints[0].lastIndexOf(name));
|
|
147
|
+
if (duplicates.length > 0) {
|
|
148
|
+
throw new Error(`Multiple bundles have been named the same: '${duplicates.join(`', '`)}'.`);
|
|
149
|
+
}
|
|
150
|
+
const index = {
|
|
151
|
+
input: (0, node_path_1.resolve)(root, typeof options.index === 'string' ? options.index : options.index.input),
|
|
152
|
+
output: indexOutput,
|
|
153
|
+
// @TODO: Add support for transformer
|
|
154
|
+
transformer: undefined,
|
|
155
|
+
// Preload initial defaults to true
|
|
156
|
+
preloadInitial: typeof options.index !== 'object' ||
|
|
157
|
+
(options.index.preloadInitial ?? true),
|
|
158
|
+
};
|
|
164
159
|
return {
|
|
165
160
|
advancedOptimizations,
|
|
166
161
|
assets,
|
|
@@ -182,18 +177,20 @@ async function normalizeOptions(options) {
|
|
|
182
177
|
index,
|
|
183
178
|
inlineStyleLanguage: options.inlineStyleLanguage ?? 'css',
|
|
184
179
|
namedChunks: options.namedChunks ?? false,
|
|
180
|
+
ngswConfigPath: options.ngswConfigPath,
|
|
185
181
|
optimization: normalizedOptimization,
|
|
186
182
|
outputHashing: options.outputHashing ?? 'none',
|
|
187
183
|
outputPath: normalizeOutputPath(root, options.outputPath),
|
|
188
184
|
polyfills: options.polyfills ?? [],
|
|
185
|
+
prerender: options.prerender ?? false,
|
|
189
186
|
projectName: project?.name ?? undefined,
|
|
190
187
|
root,
|
|
191
188
|
serviceWorker: options.serviceWorker,
|
|
192
|
-
ngswConfigPath: options.ngswConfigPath,
|
|
193
189
|
server,
|
|
194
190
|
skipTypeChecking: options.skipTypeChecking ?? false,
|
|
195
191
|
sourceMap: normalizeSourceMap(options.sourceMap),
|
|
196
192
|
ssr: normalizedSsr,
|
|
193
|
+
stylePreprocessorOptions: options.stylePreprocessorOptions,
|
|
197
194
|
subresourceIntegrity: options.subresourceIntegrity ?? false,
|
|
198
195
|
supportedBrowsers: (0, private_1.getSupportedBrowsers)(root, { warn: console.warn }),
|
|
199
196
|
tsConfig,
|
|
@@ -232,6 +229,7 @@ function normalizeDevServer(devServer) {
|
|
|
232
229
|
return {
|
|
233
230
|
allowedHosts: [],
|
|
234
231
|
host: defaultHost,
|
|
232
|
+
liveReload: true,
|
|
235
233
|
port: defaultPort,
|
|
236
234
|
};
|
|
237
235
|
}
|
|
@@ -239,6 +237,7 @@ function normalizeDevServer(devServer) {
|
|
|
239
237
|
...devServer,
|
|
240
238
|
allowedHosts: devServer.allowedHosts ?? [],
|
|
241
239
|
host: devServer.host ?? defaultHost,
|
|
240
|
+
liveReload: devServer.liveReload ?? true,
|
|
242
241
|
port: devServer.port ?? defaultPort,
|
|
243
242
|
};
|
|
244
243
|
}
|
|
@@ -10,10 +10,7 @@ export type BudgetEntry = {
|
|
|
10
10
|
error?: string;
|
|
11
11
|
};
|
|
12
12
|
export interface DevServerUnsupportedOptions {
|
|
13
|
-
headers?: Record<string, string>;
|
|
14
13
|
open?: boolean;
|
|
15
|
-
liveReload?: boolean;
|
|
16
|
-
servePath?: string;
|
|
17
14
|
hmr?: boolean;
|
|
18
15
|
inspect?: string | boolean;
|
|
19
16
|
prebundle?: boolean | {
|
|
@@ -34,10 +31,6 @@ export interface PluginUnsupportedOptions {
|
|
|
34
31
|
statsJson?: boolean;
|
|
35
32
|
budgets?: BudgetEntry[];
|
|
36
33
|
allowedCommonJsDependencies?: string[];
|
|
37
|
-
prerender?: boolean | {
|
|
38
|
-
routesFile?: string;
|
|
39
|
-
discoverRoutes?: boolean;
|
|
40
|
-
};
|
|
41
34
|
appShell?: boolean;
|
|
42
35
|
outputMode?: 'static' | 'server';
|
|
43
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unsupported-options.d.ts","sourceRoot":"","sources":["../../../src/lib/models/unsupported-options.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EACA,KAAK,GACL,WAAW,GACX,KAAK,GACL,WAAW,GACX,mBAAmB,GACnB,QAAQ,GACR,SAAS,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,WAAW,2BAA2B;IAC1C,
|
|
1
|
+
{"version":3,"file":"unsupported-options.d.ts","sourceRoot":"","sources":["../../../src/lib/models/unsupported-options.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EACA,KAAK,GACL,WAAW,GACX,KAAK,GACL,WAAW,GACX,mBAAmB,GACnB,QAAQ,GACR,SAAS,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,WAAW,2BAA2B;IAC1C,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC3B,SAAS,CAAC,EACN,OAAO,GACP;QACE,OAAO,EAAE,MAAM,EAAE,CAAC;KACnB,CAAC;CACP;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,EAAE;QACT,OAAO,CAAC,EACJ,OAAO,GACP;YACE,UAAU,CAAC,EAAE,OAAO,CAAC;SACtB,CAAC;KACP,CAAC;IACF,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,WAAW,EAAE,CAAC;IACxB,2BAA2B,CAAC,EAAE,MAAM,EAAE,CAAC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;CAClC;AAED,eAAO,MAAM,iCAAiC,UAY7C,CAAC;AAEF,eAAO,MAAM,kCAAkC,UAK9C,CAAC"}
|
|
@@ -11,15 +11,11 @@ exports.TOP_LEVEL_OPTIONS_PENDING_SUPPORT = [
|
|
|
11
11
|
'statsJson',
|
|
12
12
|
'budgets',
|
|
13
13
|
'allowedCommonJsDependencies',
|
|
14
|
-
'prerender',
|
|
15
14
|
'appShell',
|
|
16
15
|
'outputMode',
|
|
17
16
|
];
|
|
18
17
|
exports.DEV_SERVER_OPTIONS_PENDING_SUPPORT = [
|
|
19
|
-
'headers',
|
|
20
18
|
'open',
|
|
21
|
-
'liveReload',
|
|
22
|
-
'servePath',
|
|
23
19
|
'hmr',
|
|
24
20
|
'inspect',
|
|
25
21
|
'prebundle',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"angular-rspack-plugin.d.ts","sourceRoot":"","sources":["../../../src/lib/plugins/angular-rspack-plugin.ts"],"names":[],"mappings":"AASA,OAAO,EACL,KAAK,QAAQ,EAEb,KAAK,oBAAoB,EAE1B,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,KAAK,WAAW,EAGhB,KAAK,oCAAoC,EAC1C,MAAM,WAAW,CAAC;AASnB,qBAAa,mBAAoB,YAAW,oBAAoB;;gBAa5D,OAAO,EAAE,oCAAoC,EAC7C,WAAW,CAAC,EAAE,WAAW;IAuB3B,KAAK,CAAC,QAAQ,EAAE,QAAQ;
|
|
1
|
+
{"version":3,"file":"angular-rspack-plugin.d.ts","sourceRoot":"","sources":["../../../src/lib/plugins/angular-rspack-plugin.ts"],"names":[],"mappings":"AASA,OAAO,EACL,KAAK,QAAQ,EAEb,KAAK,oBAAoB,EAE1B,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,KAAK,WAAW,EAGhB,KAAK,oCAAoC,EAC1C,MAAM,WAAW,CAAC;AASnB,qBAAa,mBAAoB,YAAW,oBAAoB;;gBAa5D,OAAO,EAAE,oCAAoC,EAC7C,WAAW,CAAC,EAAE,WAAW;IAuB3B,KAAK,CAAC,QAAQ,EAAE,QAAQ;YA6MV,gBAAgB;CA0B/B"}
|
|
@@ -44,13 +44,6 @@ class AngularRspackPlugin {
|
|
|
44
44
|
await (0, angular_rspack_compiler_1.buildAndAnalyzeWithParallelCompilation)(this.#angularCompilation, this.#typescriptFileCache, this.#javascriptTransformer);
|
|
45
45
|
callback();
|
|
46
46
|
});
|
|
47
|
-
compiler.hooks.done.tap(PLUGIN_NAME, (stats) => {
|
|
48
|
-
if (stats.hasErrors() || stats.hasWarnings()) {
|
|
49
|
-
setTimeout(() => {
|
|
50
|
-
process.exit(stats.hasErrors() ? 1 : 0);
|
|
51
|
-
}, 1000);
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
47
|
callback();
|
|
55
48
|
});
|
|
56
49
|
compiler.hooks.watchRun.tapAsync(PLUGIN_NAME, async (compiler, callback) => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Compiler, RspackPluginInstance } from '@rspack/core';
|
|
2
|
-
import {
|
|
2
|
+
import { NormalizedAngularRspackPluginOptions } from '../models';
|
|
3
3
|
export declare class AngularSsrDevServer implements RspackPluginInstance {
|
|
4
4
|
#private;
|
|
5
|
-
constructor(
|
|
5
|
+
constructor(options: NormalizedAngularRspackPluginOptions);
|
|
6
6
|
apply(compiler: Compiler): void;
|
|
7
7
|
}
|
|
8
8
|
//# sourceMappingURL=angular-ssr-dev-server.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"angular-ssr-dev-server.d.ts","sourceRoot":"","sources":["../../../src/lib/plugins/angular-ssr-dev-server.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"angular-ssr-dev-server.d.ts","sourceRoot":"","sources":["../../../src/lib/plugins/angular-ssr-dev-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EACR,oBAAoB,EAErB,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,oCAAoC,EAAE,MAAM,WAAW,CAAC;AAQjE,qBAAa,mBAAoB,YAAW,oBAAoB;;gBAKlD,OAAO,EAAE,oCAAoC;IAKzD,KAAK,CAAC,QAAQ,EAAE,QAAQ;CA6DzB"}
|
|
@@ -1,33 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AngularSsrDevServer = void 0;
|
|
4
|
+
const core_1 = require("@rspack/core");
|
|
4
5
|
const child_process_1 = require("child_process");
|
|
5
6
|
const ssr_reload_server_1 = require("./server/ssr-reload-server");
|
|
6
7
|
const node_path_1 = require("node:path");
|
|
7
8
|
const node_fs_1 = require("node:fs");
|
|
9
|
+
const get_index_output_file_1 = require("../utils/index-file/get-index-output-file");
|
|
10
|
+
const add_body_script_1 = require("../utils/index-file/add-body-script");
|
|
8
11
|
const PLUGIN_NAME = 'AngularSsrDevServer';
|
|
9
12
|
class AngularSsrDevServer {
|
|
10
13
|
#devServerProcess;
|
|
11
14
|
#wsServer;
|
|
12
|
-
#
|
|
13
|
-
constructor(
|
|
14
|
-
this.#outputPath = outputPath;
|
|
15
|
+
#options;
|
|
16
|
+
constructor(options) {
|
|
15
17
|
this.#wsServer = new ssr_reload_server_1.SsrReloadServer();
|
|
18
|
+
this.#options = options;
|
|
16
19
|
}
|
|
17
20
|
apply(compiler) {
|
|
18
21
|
compiler.hooks.entryOption.tap(PLUGIN_NAME, (context, entry) => {
|
|
19
22
|
const keys = Object.keys(entry);
|
|
20
23
|
for (const key of keys) {
|
|
21
24
|
const entryValue = entry[key];
|
|
22
|
-
entryValue.import = [
|
|
23
|
-
...entryValue.import,
|
|
24
|
-
require.resolve(`${__dirname}/client/ssr-reload-client.js`),
|
|
25
|
-
];
|
|
25
|
+
entryValue.import = [...entryValue.import];
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
28
|
compiler.hooks.watchRun.tapAsync(PLUGIN_NAME, async (compiler, callback) => {
|
|
29
|
-
compiler.hooks.afterEmit.tapAsync(PLUGIN_NAME, async (
|
|
30
|
-
|
|
29
|
+
compiler.hooks.afterEmit.tapAsync(PLUGIN_NAME, async (compilation, callback) => {
|
|
30
|
+
await this.#attachSSRReloadClient(compilation);
|
|
31
|
+
const serverPath = (0, node_path_1.join)(this.#options.outputPath.server, 'server.js');
|
|
31
32
|
if (this.#devServerProcess) {
|
|
32
33
|
this.#devServerProcess.kill();
|
|
33
34
|
this.#devServerProcess = undefined;
|
|
@@ -45,5 +46,14 @@ class AngularSsrDevServer {
|
|
|
45
46
|
callback();
|
|
46
47
|
});
|
|
47
48
|
}
|
|
49
|
+
async #attachSSRReloadClient(compilation) {
|
|
50
|
+
const clientPath = require.resolve(`${__dirname}/client/ssr-reload-client.js`);
|
|
51
|
+
const pathToIndex = (0, node_path_1.join)(this.#options.outputPath.browser, (0, get_index_output_file_1.getIndexOutputFile)(this.#options.index));
|
|
52
|
+
const html = (0, node_fs_1.readFileSync)(pathToIndex, 'utf-8');
|
|
53
|
+
const updatedHtml = await (0, add_body_script_1.addBodyScript)(html, (0, node_fs_1.readFileSync)(clientPath, 'utf-8'));
|
|
54
|
+
const source = new core_1.sources.RawSource(updatedHtml);
|
|
55
|
+
const relativePathToIndex = pathToIndex.replace(this.#options.outputPath.browser, '');
|
|
56
|
+
compilation.emitAsset(relativePathToIndex, source);
|
|
57
|
+
}
|
|
48
58
|
}
|
|
49
59
|
exports.AngularSsrDevServer = AngularSsrDevServer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-html-plugin.d.ts","sourceRoot":"","sources":["../../../src/lib/plugins/index-html-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAElB,KAAK,yBAAyB,EAC/B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AAEhF,OAAO,KAAK,EAAE,WAAW,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index-html-plugin.d.ts","sourceRoot":"","sources":["../../../src/lib/plugins/index-html-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAElB,KAAK,yBAAyB,EAC/B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AAEhF,OAAO,KAAK,EAAE,WAAW,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAQtE,MAAM,WAAW,sBAAuB,SAAQ,yBAAyB;IACvE,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,EAAE,uBAAuB,CAAC;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB;AAID,qBAAa,eACX,SAAQ,kBACR,YAAW,oBAAoB;aAWD,OAAO,EAAE,sBAAsB;IAT7D,OAAO,CAAC,YAAY,CAA0B;IAC9C,IAAI,WAAW,IAAI,WAAW,CAM7B;gBAE6B,OAAO,EAAE,sBAAsB;IAI7D,KAAK,CAAC,QAAQ,EAAE,QAAQ;IAoET,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;cAM9B,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAsBjE,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;CAgBtD"}
|
|
@@ -9,6 +9,7 @@ const misc_helpers_1 = require("../utils/misc-helpers");
|
|
|
9
9
|
const i18n_1 = require("../utils/i18n");
|
|
10
10
|
const rspack_diagnostics_1 = require("../utils/rspack-diagnostics");
|
|
11
11
|
const url_join_1 = require("../utils/url-join");
|
|
12
|
+
const get_index_output_file_1 = require("../utils/index-file/get-index-output-file");
|
|
12
13
|
const PLUGIN_NAME = 'IndexHtmlPlugin';
|
|
13
14
|
class IndexHtmlPlugin extends private_1.IndexHtmlGenerator {
|
|
14
15
|
options;
|
|
@@ -59,7 +60,7 @@ class IndexHtmlPlugin extends private_1.IndexHtmlGenerator {
|
|
|
59
60
|
html = await (0, add_event_dispatch_contract_1.addEventDispatchContract)(csrContent);
|
|
60
61
|
}
|
|
61
62
|
const { RawSource } = compiler.rspack.sources;
|
|
62
|
-
compilation.emitAsset((0, node_path_1.join)(outputPath, getIndexOutputFile(this.options.index)), new RawSource(html));
|
|
63
|
+
compilation.emitAsset((0, node_path_1.join)(outputPath, (0, get_index_output_file_1.getIndexOutputFile)(this.options.index)), new RawSource(html));
|
|
63
64
|
warnings.forEach((msg) => (0, rspack_diagnostics_1.addWarning)(compilation, msg));
|
|
64
65
|
errors.forEach((msg) => (0, rspack_diagnostics_1.addError)(compilation, msg));
|
|
65
66
|
}
|
|
@@ -106,9 +107,3 @@ class IndexHtmlPlugin extends private_1.IndexHtmlGenerator {
|
|
|
106
107
|
}
|
|
107
108
|
}
|
|
108
109
|
exports.IndexHtmlPlugin = IndexHtmlPlugin;
|
|
109
|
-
function getIndexOutputFile(index) {
|
|
110
|
-
if (typeof index === 'string') {
|
|
111
|
-
return (0, node_path_1.basename)(index);
|
|
112
|
-
}
|
|
113
|
-
return index.output || 'index.html';
|
|
114
|
-
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type LoaderContext, type LoaderDefinitionFunction } from '@rspack/core';
|
|
2
|
+
export default function loader(this: LoaderContext<{
|
|
3
|
+
angularSSRInstalled: boolean;
|
|
4
|
+
}>, content: string, map: Parameters<LoaderDefinitionFunction>[1]): void;
|
|
5
|
+
//# sourceMappingURL=platform-server-exports.loader.d.ts.map
|
|
@@ -0,0 +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;AAEtB,MAAM,CAAC,OAAO,UAAU,MAAM,CAC5B,IAAI,EAAE,aAAa,CAAC;IAAE,mBAAmB,EAAE,OAAO,CAAA;CAAE,CAAC,EACrD,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,UAAU,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,QAmB7C"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = loader;
|
|
4
|
+
function loader(content, map) {
|
|
5
|
+
const { angularSSRInstalled } = this.getOptions();
|
|
6
|
+
let source = `${content}
|
|
7
|
+
|
|
8
|
+
// EXPORTS added by @nx/angular-rspack
|
|
9
|
+
export { renderApplication, renderModule, ɵSERVER_CONTEXT } from '@angular/platform-server';
|
|
10
|
+
`;
|
|
11
|
+
if (angularSSRInstalled) {
|
|
12
|
+
source += `
|
|
13
|
+
export { ɵgetRoutesFromAngularRouterConfig } from '@angular/ssr';
|
|
14
|
+
`;
|
|
15
|
+
}
|
|
16
|
+
this.callback(null, source, map);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-rspack.d.ts","sourceRoot":"","sources":["../../../src/lib/plugins/ng-rspack.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAIR,oBAAoB,EACrB,MAAM,cAAc,CAAC;AAGtB,OAAO,KAAK,EACV,WAAW,EACX,oCAAoC,
|
|
1
|
+
{"version":3,"file":"ng-rspack.d.ts","sourceRoot":"","sources":["../../../src/lib/plugins/ng-rspack.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAIR,oBAAoB,EACrB,MAAM,cAAc,CAAC;AAGtB,OAAO,KAAK,EACV,WAAW,EACX,oCAAoC,EACrC,MAAM,WAAW,CAAC;AAOnB,qBAAa,cAAe,YAAW,oBAAoB;IACzD,QAAQ,CAAC,aAAa,EAAE,oCAAoC,CAAC;IAC7D,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;IACnC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;gBAGzB,aAAa,EAAE,oCAAoC,EACnD,YAAY,EAAE;QACZ,QAAQ,EAAE,SAAS,GAAG,QAAQ,CAAC;QAC/B,WAAW,EAAE,WAAW,CAAC;KAC1B;IAOH,KAAK,CAAC,QAAQ,EAAE,QAAQ;CAkHzB"}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.NgRspackPlugin = void 0;
|
|
4
4
|
const core_1 = require("@rspack/core");
|
|
5
5
|
const node_path_1 = require("node:path");
|
|
6
|
-
const entry_points_1 = require("../config/entry-points");
|
|
6
|
+
const entry_points_1 = require("../config/config-utils/entry-points");
|
|
7
7
|
const angular_rspack_plugin_1 = require("./angular-rspack-plugin");
|
|
8
8
|
const angular_ssr_dev_server_1 = require("./angular-ssr-dev-server");
|
|
9
9
|
const i18n_inline_plugin_1 = require("./i18n-inline-plugin");
|
|
@@ -21,11 +21,11 @@ class NgRspackPlugin {
|
|
|
21
21
|
apply(compiler) {
|
|
22
22
|
const root = this.pluginOptions.root;
|
|
23
23
|
const isDevServer = process.env['WEBPACK_SERVE'];
|
|
24
|
-
if (
|
|
24
|
+
if (this.isPlatformServer && isDevServer) {
|
|
25
25
|
if (this.pluginOptions.ssr &&
|
|
26
26
|
typeof this.pluginOptions.ssr === 'object' &&
|
|
27
27
|
this.pluginOptions.ssr.entry !== undefined) {
|
|
28
|
-
new angular_ssr_dev_server_1.AngularSsrDevServer(this.pluginOptions
|
|
28
|
+
new angular_ssr_dev_server_1.AngularSsrDevServer(this.pluginOptions).apply(compiler);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
if (!isDevServer) {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Compiler, RspackPluginInstance } from '@rspack/core';
|
|
2
|
+
import { type I18nOptions, NormalizedAngularRspackPluginOptions } from '../models';
|
|
3
|
+
export declare class PrerenderPlugin implements RspackPluginInstance {
|
|
4
|
+
#private;
|
|
5
|
+
constructor(options: NormalizedAngularRspackPluginOptions, i18nOptions?: I18nOptions);
|
|
6
|
+
apply(compiler: Compiler): void;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=prerender-plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prerender-plugin.d.ts","sourceRoot":"","sources":["../../../src/lib/plugins/prerender-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,QAAQ,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAOhF,OAAO,EACL,KAAK,WAAW,EAEhB,oCAAoC,EACrC,MAAM,WAAW,CAAC;AAenB,qBAAa,eAAgB,YAAW,oBAAoB;;gBAKxD,OAAO,EAAE,oCAAoC,EAC7C,WAAW,CAAC,EAAE,WAAW;IAM3B,KAAK,CAAC,QAAQ,EAAE,QAAQ;CAmLzB"}
|