@nx/angular-rspack 23.1.0-rc.3 → 23.1.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/browser-config.d.ts +4 -1
- package/dist/lib/config/config-utils/browser-config.d.ts.map +1 -1
- package/dist/lib/config/config-utils/browser-config.js +5 -18
- package/dist/lib/config/config-utils/server-config.d.ts +4 -1
- package/dist/lib/config/config-utils/server-config.d.ts.map +1 -1
- package/dist/lib/config/config-utils/server-config.js +10 -18
- package/dist/lib/config/config-utils/swc-transpilation.d.ts +16 -0
- package/dist/lib/config/config-utils/swc-transpilation.d.ts.map +1 -0
- package/dist/lib/config/config-utils/swc-transpilation.js +50 -0
- package/dist/lib/config/create-config.d.ts.map +1 -1
- package/dist/lib/config/create-config.js +20 -2
- package/dist/lib/models/augmented-compilation.d.ts +6 -0
- package/dist/lib/models/augmented-compilation.d.ts.map +1 -1
- package/dist/lib/plugins/angular-rspack-plugin.d.ts +9 -0
- package/dist/lib/plugins/angular-rspack-plugin.d.ts.map +1 -1
- package/dist/lib/plugins/angular-rspack-plugin.js +245 -83
- package/dist/lib/plugins/extract-licenses-plugin.d.ts +78 -0
- package/dist/lib/plugins/extract-licenses-plugin.d.ts.map +1 -0
- package/dist/lib/plugins/extract-licenses-plugin.js +217 -0
- package/dist/lib/plugins/loaders/angular-partial-transform.loader.d.ts +2 -2
- package/dist/lib/plugins/loaders/angular-partial-transform.loader.d.ts.map +1 -1
- package/dist/lib/plugins/loaders/angular-partial-transform.loader.js +78 -16
- package/dist/lib/plugins/loaders/angular-transform.loader.d.ts.map +1 -1
- package/dist/lib/plugins/loaders/angular-transform.loader.js +49 -20
- package/dist/lib/plugins/loaders/inline-source-map.d.ts +34 -0
- package/dist/lib/plugins/loaders/inline-source-map.d.ts.map +1 -0
- package/dist/lib/plugins/loaders/inline-source-map.js +76 -0
- package/dist/lib/plugins/ng-rspack.d.ts +18 -0
- package/dist/lib/plugins/ng-rspack.d.ts.map +1 -1
- package/dist/lib/plugins/ng-rspack.js +43 -9
- package/dist/lib/plugins/prerender-plugin.d.ts.map +1 -1
- package/dist/lib/plugins/prerender-plugin.js +26 -3
- package/dist/lib/utils/postcss-cli-resources.d.ts.map +1 -1
- package/dist/lib/utils/postcss-cli-resources.js +8 -4
- package/package.json +5 -11
- package/LICENSE +0 -22
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import type { SwcTranspilationTransform } from '@nx/angular-rspack-compiler';
|
|
1
2
|
import type { Configuration } from '@rspack/core';
|
|
2
3
|
import type { HashFormat, I18nOptions, NormalizedAngularRspackPluginOptions } from '../../models';
|
|
3
|
-
|
|
4
|
+
import type { AngularRspackPlugin } from '../../plugins/angular-rspack-plugin';
|
|
5
|
+
import type { SharedLicenseInputs } from '../../plugins/extract-licenses-plugin';
|
|
6
|
+
export declare function getBrowserConfig(normalizedOptions: NormalizedAngularRspackPluginOptions, i18n: I18nOptions, hashFormat: HashFormat, defaultConfig: Configuration, swcTranspilationTransform: SwcTranspilationTransform, sharedLicenseInputs?: SharedLicenseInputs, sharedAngularPlugin?: AngularRspackPlugin): Promise<Configuration>;
|
|
4
7
|
//# sourceMappingURL=browser-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-config.d.ts","sourceRoot":"","sources":["../../../../src/lib/config/config-utils/browser-config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"browser-config.d.ts","sourceRoot":"","sources":["../../../../src/lib/config/config-utils/browser-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAC7E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAGlD,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,oCAAoC,EACrC,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAQjF,wBAAsB,gBAAgB,CACpC,iBAAiB,EAAE,oCAAoC,EACvD,IAAI,EAAE,WAAW,EACjB,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,aAAa,EAC5B,yBAAyB,EAAE,yBAAyB,EACpD,mBAAmB,CAAC,EAAE,mBAAmB,EACzC,mBAAmB,CAAC,EAAE,mBAAmB,GACxC,OAAO,CAAC,aAAa,CAAC,CAgFxB"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getBrowserConfig = getBrowserConfig;
|
|
4
|
-
const angular_rspack_compiler_1 = require("@nx/angular-rspack-compiler");
|
|
5
4
|
const rspack_version_1 = require("../../utils/rspack-version");
|
|
6
5
|
const rspack_serve_env_1 = require("../../utils/rspack-serve-env");
|
|
7
6
|
const ng_rspack_1 = require("../../plugins/ng-rspack");
|
|
8
7
|
const dev_server_config_utils_1 = require("./dev-server-config-utils");
|
|
9
8
|
const entry_points_1 = require("./entry-points");
|
|
10
9
|
const optimization_config_1 = require("./optimization-config");
|
|
10
|
+
const swc_transpilation_1 = require("./swc-transpilation");
|
|
11
11
|
const path_1 = require("path");
|
|
12
12
|
const hmr_accept_loader_1 = require("../../plugins/loaders/hmr-accept-loader");
|
|
13
|
-
async function getBrowserConfig(normalizedOptions, i18n, hashFormat, defaultConfig) {
|
|
13
|
+
async function getBrowserConfig(normalizedOptions, i18n, hashFormat, defaultConfig, swcTranspilationTransform, sharedLicenseInputs, sharedAngularPlugin) {
|
|
14
14
|
const isDevServer = (0, rspack_serve_env_1.isServeMode)();
|
|
15
15
|
const isProduction = process.env['NODE_ENV'] === 'production';
|
|
16
16
|
const { root } = normalizedOptions;
|
|
@@ -59,22 +59,7 @@ async function getBrowserConfig(normalizedOptions, i18n, hashFormat, defaultConf
|
|
|
59
59
|
module: {
|
|
60
60
|
...defaultConfig.module,
|
|
61
61
|
rules: [
|
|
62
|
-
|
|
63
|
-
test: angular_rspack_compiler_1.TS_ALL_EXT_REGEX,
|
|
64
|
-
use: [
|
|
65
|
-
{
|
|
66
|
-
loader: 'builtin:swc-loader',
|
|
67
|
-
options: {
|
|
68
|
-
jsc: {
|
|
69
|
-
parser: {
|
|
70
|
-
syntax: 'typescript',
|
|
71
|
-
},
|
|
72
|
-
target: 'es2022',
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
],
|
|
77
|
-
},
|
|
62
|
+
...(0, swc_transpilation_1.getSwcTranspilationRules)(swcTranspilationTransform),
|
|
78
63
|
...(normalizedOptions.devServer?.hmr
|
|
79
64
|
? [
|
|
80
65
|
{
|
|
@@ -91,6 +76,8 @@ async function getBrowserConfig(normalizedOptions, i18n, hashFormat, defaultConf
|
|
|
91
76
|
new ng_rspack_1.NgRspackPlugin(normalizedOptions, {
|
|
92
77
|
i18nOptions: i18n,
|
|
93
78
|
platform: 'browser',
|
|
79
|
+
sharedLicenseInputs,
|
|
80
|
+
sharedAngularPlugin,
|
|
94
81
|
}),
|
|
95
82
|
],
|
|
96
83
|
};
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import type { SwcTranspilationTransform } from '@nx/angular-rspack-compiler';
|
|
1
2
|
import { type Configuration } from '@rspack/core';
|
|
2
3
|
import type { I18nOptions, NormalizedAngularRspackPluginOptions } from '../../models';
|
|
3
|
-
|
|
4
|
+
import type { AngularRspackPlugin } from '../../plugins/angular-rspack-plugin';
|
|
5
|
+
import type { SharedLicenseInputs } from '../../plugins/extract-licenses-plugin';
|
|
6
|
+
export declare function getServerConfig(normalizedOptions: NormalizedAngularRspackPluginOptions, i18n: I18nOptions, defaultConfig: Configuration, swcTranspilationTransform: SwcTranspilationTransform, sharedLicenseInputs?: SharedLicenseInputs, sharedAngularPlugin?: AngularRspackPlugin): Promise<Configuration>;
|
|
4
7
|
//# sourceMappingURL=server-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-config.d.ts","sourceRoot":"","sources":["../../../../src/lib/config/config-utils/server-config.ts"],"names":[],"mappings":"
|
|
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,EACrC,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAQjF,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,CA6ExB"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getServerConfig = getServerConfig;
|
|
4
|
-
const angular_rspack_compiler_1 = require("@nx/angular-rspack-compiler");
|
|
5
4
|
const core_1 = require("@rspack/core");
|
|
6
5
|
const path_1 = require("path");
|
|
7
6
|
const ng_rspack_1 = require("../../plugins/ng-rspack");
|
|
@@ -9,8 +8,9 @@ const prerender_plugin_1 = require("../../plugins/prerender-plugin");
|
|
|
9
8
|
const misc_helpers_1 = require("../../utils/misc-helpers");
|
|
10
9
|
const dev_server_config_utils_1 = require("./dev-server-config-utils");
|
|
11
10
|
const optimization_config_1 = require("./optimization-config");
|
|
11
|
+
const swc_transpilation_1 = require("./swc-transpilation");
|
|
12
12
|
const rspack_serve_env_1 = require("../../utils/rspack-serve-env");
|
|
13
|
-
async function getServerConfig(normalizedOptions, i18n, defaultConfig) {
|
|
13
|
+
async function getServerConfig(normalizedOptions, i18n, defaultConfig, swcTranspilationTransform, sharedLicenseInputs, sharedAngularPlugin) {
|
|
14
14
|
const isDevServer = (0, rspack_serve_env_1.isServeMode)();
|
|
15
15
|
const { root } = normalizedOptions;
|
|
16
16
|
return {
|
|
@@ -48,22 +48,7 @@ async function getServerConfig(normalizedOptions, i18n, defaultConfig) {
|
|
|
48
48
|
module: {
|
|
49
49
|
...defaultConfig.module,
|
|
50
50
|
rules: [
|
|
51
|
-
|
|
52
|
-
test: angular_rspack_compiler_1.TS_ALL_EXT_REGEX,
|
|
53
|
-
use: [
|
|
54
|
-
{
|
|
55
|
-
loader: 'builtin:swc-loader',
|
|
56
|
-
options: {
|
|
57
|
-
jsc: {
|
|
58
|
-
parser: {
|
|
59
|
-
syntax: 'typescript',
|
|
60
|
-
},
|
|
61
|
-
target: 'es2022',
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
],
|
|
66
|
-
},
|
|
51
|
+
...(0, swc_transpilation_1.getSwcTranspilationRules)(swcTranspilationTransform),
|
|
67
52
|
{
|
|
68
53
|
// eslint-disable-next-line @nx/enforce-module-boundaries
|
|
69
54
|
loader: require.resolve('@nx/angular-rspack/loaders/platform-server-exports-loader'),
|
|
@@ -82,9 +67,16 @@ async function getServerConfig(normalizedOptions, i18n, defaultConfig) {
|
|
|
82
67
|
...(defaultConfig.plugins ?? []),
|
|
83
68
|
// Fixes Critical dependency: the request of a dependency is an expression
|
|
84
69
|
new core_1.ContextReplacementPlugin(/@?hapi|express[\\/]/),
|
|
70
|
+
// rspack inlines `import.meta.url` as the source file's URL, breaking
|
|
71
|
+
// the `isMainModule` listen gate; point it at the emitted bundle.
|
|
72
|
+
new core_1.DefinePlugin({
|
|
73
|
+
'import.meta.url': "require('node:url').pathToFileURL(__filename).href",
|
|
74
|
+
}),
|
|
85
75
|
new ng_rspack_1.NgRspackPlugin(normalizedOptions, {
|
|
86
76
|
i18nOptions: i18n,
|
|
87
77
|
platform: 'server',
|
|
78
|
+
sharedLicenseInputs,
|
|
79
|
+
sharedAngularPlugin,
|
|
88
80
|
}),
|
|
89
81
|
...(normalizedOptions.prerender ||
|
|
90
82
|
(normalizedOptions.appShell && !isDevServer)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type SwcTranspilationTransform } from '@nx/angular-rspack-compiler';
|
|
2
|
+
import type { RuleSetRule } from '@rspack/core';
|
|
3
|
+
/**
|
|
4
|
+
* The `jsc.transform` options for the swc rule, derived from the project's
|
|
5
|
+
* tsconfig with the standard decorator revision the installed rspack
|
|
6
|
+
* supports.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getSwcTranspilationTransform(tsConfig: string): SwcTranspilationTransform;
|
|
9
|
+
/**
|
|
10
|
+
* The swc module rules transpiling the TypeScript the Angular compilation
|
|
11
|
+
* emits (and raw sources). Split by extension: JSX parsing must only be
|
|
12
|
+
* enabled for `.tsx` sources because it steals the `<T>` cast syntax from
|
|
13
|
+
* plain TypeScript.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getSwcTranspilationRules(transform: SwcTranspilationTransform): RuleSetRule[];
|
|
16
|
+
//# sourceMappingURL=swc-transpilation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swc-transpilation.d.ts","sourceRoot":"","sources":["../../../../src/lib/config/config-utils/swc-transpilation.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,yBAAyB,EAC/B,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD;;;;GAIG;AACH,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,MAAM,GACf,yBAAyB,CAS3B;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,yBAAyB,GACnC,WAAW,EAAE,CAyBf"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSwcTranspilationTransform = getSwcTranspilationTransform;
|
|
4
|
+
exports.getSwcTranspilationRules = getSwcTranspilationRules;
|
|
5
|
+
const angular_rspack_compiler_1 = require("@nx/angular-rspack-compiler");
|
|
6
|
+
const rspack_version_1 = require("../../utils/rspack-version");
|
|
7
|
+
/**
|
|
8
|
+
* The `jsc.transform` options for the swc rule, derived from the project's
|
|
9
|
+
* tsconfig with the standard decorator revision the installed rspack
|
|
10
|
+
* supports.
|
|
11
|
+
*/
|
|
12
|
+
function getSwcTranspilationTransform(tsConfig) {
|
|
13
|
+
// '2023-11' matches TypeScript's standard decorator behavior, but only
|
|
14
|
+
// the swc bundled with rspack v2 implements it (older versions panic).
|
|
15
|
+
// The closest revision rspack v1 supports applies decorators in the older
|
|
16
|
+
// spec order and drops field addInitializer callbacks.
|
|
17
|
+
return (0, angular_rspack_compiler_1.resolveSwcTranspilationTransform)(tsConfig, (0, rspack_version_1.isRspackV2)() ? '2023-11' : '2022-03');
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The swc module rules transpiling the TypeScript the Angular compilation
|
|
21
|
+
* emits (and raw sources). Split by extension: JSX parsing must only be
|
|
22
|
+
* enabled for `.tsx` sources because it steals the `<T>` cast syntax from
|
|
23
|
+
* plain TypeScript.
|
|
24
|
+
*/
|
|
25
|
+
function getSwcTranspilationRules(transform) {
|
|
26
|
+
const rule = (test, tsx) => ({
|
|
27
|
+
test,
|
|
28
|
+
use: [
|
|
29
|
+
{
|
|
30
|
+
loader: 'builtin:swc-loader',
|
|
31
|
+
options: {
|
|
32
|
+
jsc: {
|
|
33
|
+
parser: {
|
|
34
|
+
syntax: 'typescript',
|
|
35
|
+
tsx,
|
|
36
|
+
// Angular's fast emit path can leave decorators in the
|
|
37
|
+
// output; parse them regardless of which semantics the
|
|
38
|
+
// transform applies.
|
|
39
|
+
decorators: true,
|
|
40
|
+
},
|
|
41
|
+
// Transpile with the semantics the type program assumed.
|
|
42
|
+
transform,
|
|
43
|
+
target: 'es2022',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
});
|
|
49
|
+
return [rule(angular_rspack_compiler_1.TS_EXT_REGEX, false), rule(angular_rspack_compiler_1.TSX_EXT_REGEX, true)];
|
|
50
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-config.d.ts","sourceRoot":"","sources":["../../../src/lib/config/create-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,EAAE,KAAK,0BAA0B,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"create-config.d.ts","sourceRoot":"","sources":["../../../src/lib/config/create-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,EAAE,KAAK,0BAA0B,EAAE,MAAM,WAAW,CAAC;AAmB5D,wBAAsB,YAAY,CAChC,cAAc,EAAE;IACd,OAAO,EAAE,0BAA0B,CAAC;IACpC,qBAAqB,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;CAChD,EACD,cAAc,GAAE,MAAM,CACpB,MAAM,EACN;IACE,OAAO,EAAE,OAAO,CAAC,0BAA0B,CAAC,CAAC;IAC7C,qBAAqB,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;CAChD,CACG,EACN,YAAY,SAAgB,GAC3B,OAAO,CAAC,aAAa,EAAE,CAAC,CAY1B;AAED,wBAAsB,aAAa,CACjC,OAAO,EAAE,0BAA0B,EACnC,qBAAqB,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GAC7C,OAAO,CAAC,aAAa,EAAE,CAAC,CAqE1B"}
|
|
@@ -7,9 +7,11 @@ const helpers_1 = require("./config-utils/helpers");
|
|
|
7
7
|
const common_config_1 = require("./config-utils/common-config");
|
|
8
8
|
const server_config_1 = require("./config-utils/server-config");
|
|
9
9
|
const browser_config_1 = require("./config-utils/browser-config");
|
|
10
|
+
const swc_transpilation_1 = require("./config-utils/swc-transpilation");
|
|
10
11
|
const user_defined_config_helpers_1 = require("./config-utils/user-defined-config-helpers");
|
|
11
12
|
const assert_supported_rspack_version_1 = require("../utils/assert-supported-rspack-version");
|
|
12
13
|
const rspack_serve_env_1 = require("../utils/rspack-serve-env");
|
|
14
|
+
const angular_rspack_plugin_1 = require("../plugins/angular-rspack-plugin");
|
|
13
15
|
async function createConfig(defaultOptions, configurations = {}, configEnvVar = 'NGRS_CONFIG') {
|
|
14
16
|
const configurationMode = process.env[configEnvVar] ?? ((0, rspack_serve_env_1.isServeMode)() ? 'development' : 'production');
|
|
15
17
|
const configurationModes = (0, user_defined_config_helpers_1.parseConfigurationMode)(configurationMode);
|
|
@@ -24,13 +26,29 @@ async function _createConfig(options, rspackConfigOverrides) {
|
|
|
24
26
|
await (0, helpers_1.deleteOutputDir)(normalizedOptions.root, normalizedOptions.outputPath.base);
|
|
25
27
|
}
|
|
26
28
|
const defaultConfig = await (0, common_config_1.getCommonConfig)(normalizedOptions, i18n, i18nHash, hashFormat);
|
|
29
|
+
// Overrides may point module resolution at a different tsconfig; derive
|
|
30
|
+
// the swc rule semantics from the one the bundler will actually use.
|
|
31
|
+
const overrideTsConfig = rspackConfigOverrides?.resolve?.tsConfig;
|
|
32
|
+
const swcTranspilationTransform = (0, swc_transpilation_1.getSwcTranspilationTransform)(typeof overrideTsConfig === 'string'
|
|
33
|
+
? overrideTsConfig
|
|
34
|
+
: (overrideTsConfig?.configFile ?? normalizedOptions.tsConfig));
|
|
35
|
+
// The browser and server compilers write the licenses file to the same
|
|
36
|
+
// location; sharing the collected inputs makes each emit the union.
|
|
37
|
+
const sharedLicenseInputs = normalizedOptions.hasServer ? new Map() : undefined;
|
|
38
|
+
// An SSR build's compilers also share one Angular compilation: the browser
|
|
39
|
+
// program already includes the server entry points, so the server compiler
|
|
40
|
+
// consumes the browser compilation's output instead of running a second
|
|
41
|
+
// compilation of the same program.
|
|
42
|
+
const sharedAngularPlugin = normalizedOptions.hasServer
|
|
43
|
+
? new angular_rspack_plugin_1.AngularRspackPlugin(normalizedOptions, i18n)
|
|
44
|
+
: undefined;
|
|
27
45
|
const configs = [];
|
|
28
46
|
if (normalizedOptions.hasServer) {
|
|
29
|
-
const serverConfig = await (0, server_config_1.getServerConfig)(normalizedOptions, i18n, defaultConfig);
|
|
47
|
+
const serverConfig = await (0, server_config_1.getServerConfig)(normalizedOptions, i18n, defaultConfig, swcTranspilationTransform, sharedLicenseInputs, sharedAngularPlugin);
|
|
30
48
|
const mergedConfig = (0, webpack_merge_1.merge)(serverConfig, rspackConfigOverrides ?? {});
|
|
31
49
|
configs.push(mergedConfig);
|
|
32
50
|
}
|
|
33
|
-
const browserConfig = await (0, browser_config_1.getBrowserConfig)(normalizedOptions, i18n, hashFormat, defaultConfig);
|
|
51
|
+
const browserConfig = await (0, browser_config_1.getBrowserConfig)(normalizedOptions, i18n, hashFormat, defaultConfig, swcTranspilationTransform, sharedLicenseInputs, sharedAngularPlugin);
|
|
34
52
|
const mergedConfig = (0, webpack_merge_1.merge)(browserConfig, rspackConfigOverrides ?? {});
|
|
35
53
|
configs.unshift(mergedConfig);
|
|
36
54
|
return configs;
|
|
@@ -5,7 +5,13 @@ export declare const NG_RSPACK_SYMBOL_NAME = "NG_RSPACK_BUILD";
|
|
|
5
5
|
export type NG_RSPACK_COMPILATION_STATE = {
|
|
6
6
|
javascriptTransformer: JavaScriptTransformer;
|
|
7
7
|
typescriptFileCache: SourceFileCache['typeScriptFileCache'];
|
|
8
|
+
babelFileCache: SourceFileCache['babelFileCache'];
|
|
9
|
+
useTypeScriptTranspilation: boolean;
|
|
8
10
|
angularCompilationFailed: boolean;
|
|
11
|
+
stylesheetMetafileInputs: Record<string, {
|
|
12
|
+
bytesInOutput: number;
|
|
13
|
+
}>;
|
|
14
|
+
resourceDependencies?: ReadonlyMap<string, readonly string[]>;
|
|
9
15
|
i18n?: I18nOptions;
|
|
10
16
|
};
|
|
11
17
|
export type NgRspackCompilation = Compilation & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"augmented-compilation.d.ts","sourceRoot":"","sources":["../../../src/lib/models/augmented-compilation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EACV,qBAAqB,EACrB,eAAe,EAChB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAErC,eAAO,MAAM,qBAAqB,oBAAoB,CAAC;AAEvD,MAAM,MAAM,2BAA2B,GAAG;IACxC,qBAAqB,EAAE,qBAAqB,CAAC;IAC7C,mBAAmB,EAAE,eAAe,CAAC,qBAAqB,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"augmented-compilation.d.ts","sourceRoot":"","sources":["../../../src/lib/models/augmented-compilation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EACV,qBAAqB,EACrB,eAAe,EAChB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAErC,eAAO,MAAM,qBAAqB,oBAAoB,CAAC;AAEvD,MAAM,MAAM,2BAA2B,GAAG;IACxC,qBAAqB,EAAE,qBAAqB,CAAC;IAC7C,mBAAmB,EAAE,eAAe,CAAC,qBAAqB,CAAC,CAAC;IAC5D,cAAc,EAAE,eAAe,CAAC,gBAAgB,CAAC,CAAC;IAGlD,0BAA0B,EAAE,OAAO,CAAC;IAGpC,wBAAwB,EAAE,OAAO,CAAC;IAGlC,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,aAAa,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAIpE,oBAAoB,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC;IAC9D,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB,CAAC;AACF,MAAM,MAAM,mBAAmB,GAAG,WAAW,GAAG;IAC9C,CAAC,qBAAqB,CAAC,EAAE,MAAM,2BAA2B,CAAC;CAC5D,CAAC"}
|
|
@@ -4,6 +4,15 @@ export declare class AngularRspackPlugin implements RspackPluginInstance {
|
|
|
4
4
|
#private;
|
|
5
5
|
constructor(options: NormalizedAngularRspackPluginOptions, i18nOptions?: I18nOptions);
|
|
6
6
|
apply(compiler: Compiler): void;
|
|
7
|
+
/**
|
|
8
|
+
* Wires a compiler to consume this plugin instance's compilation state
|
|
9
|
+
* without running an Angular compilation of its own. The server compiler
|
|
10
|
+
* of an SSR build runs after the browser compiler
|
|
11
|
+
* (`dependencies: ['browser']`), whose program already includes the server
|
|
12
|
+
* entry points, so its loaders read the emitted files straight from this
|
|
13
|
+
* instance's caches.
|
|
14
|
+
*/
|
|
15
|
+
applyToDependentCompiler(compiler: Compiler): void;
|
|
7
16
|
private setupCompilation;
|
|
8
17
|
private buildAndAnalyze;
|
|
9
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"angular-rspack-plugin.d.ts","sourceRoot":"","sources":["../../../src/lib/plugins/angular-rspack-plugin.ts"],"names":[],"mappings":"
|
|
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;YAwEhB,eAAe;CA2C9B"}
|