@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
|
@@ -1,79 +1,5 @@
|
|
|
1
1
|
import { type Configuration } from '@rspack/core';
|
|
2
|
-
import { type AngularRspackPluginOptions
|
|
3
|
-
export declare function _createConfig(options: AngularRspackPluginOptions, rspackConfigOverrides?: Partial<Configuration>): Promise<Configuration[]>;
|
|
4
|
-
export declare function handleConfigurations(defaultOptions: {
|
|
5
|
-
options: AngularRspackPluginOptions;
|
|
6
|
-
rspackConfigOverrides?: Partial<Configuration>;
|
|
7
|
-
}, configurations: Record<string, {
|
|
8
|
-
options: Partial<AngularRspackPluginOptions>;
|
|
9
|
-
rspackConfigOverrides?: Partial<Configuration>;
|
|
10
|
-
}>, configurationModes: string[]): {
|
|
11
|
-
mergedConfigurationBuildOptions: {
|
|
12
|
-
aot?: boolean;
|
|
13
|
-
assets?: import("../models").AssetElement[];
|
|
14
|
-
baseHref?: string;
|
|
15
|
-
browser?: string;
|
|
16
|
-
commonChunk?: boolean;
|
|
17
|
-
crossOrigin?: "none" | "anonymous" | "use-credentials";
|
|
18
|
-
define?: Record<string, string>;
|
|
19
|
-
deleteOutputPath?: boolean;
|
|
20
|
-
deployUrl?: string;
|
|
21
|
-
devServer?: import("../models").DevServerOptions;
|
|
22
|
-
externalDependencies?: string[];
|
|
23
|
-
extractLicenses?: boolean;
|
|
24
|
-
fileReplacements?: import("@nx/angular-rspack-compiler").FileReplacement[];
|
|
25
|
-
index?: import("../models").IndexElement;
|
|
26
|
-
inlineStyleLanguage?: import("@nx/angular-rspack-compiler").InlineStyleLanguage;
|
|
27
|
-
i18nMetadata?: import("../models").I18nProjectMetadata;
|
|
28
|
-
i18nMissingTranslation?: "warning" | "error" | "ignore";
|
|
29
|
-
i18nDuplicateTranslation?: "warning" | "error" | "ignore";
|
|
30
|
-
localize?: boolean | string[];
|
|
31
|
-
namedChunks?: boolean;
|
|
32
|
-
ngswConfigPath?: string;
|
|
33
|
-
optimization?: boolean | import("../models").OptimizationOptions;
|
|
34
|
-
outputHashing?: import("../models").OutputHashing;
|
|
35
|
-
outputPath?: string | (Required<Pick<import("../models").OutputPath, "base">> & Partial<import("../models").OutputPath>);
|
|
36
|
-
polyfills?: string[];
|
|
37
|
-
preserveSymlinks?: boolean;
|
|
38
|
-
root?: string;
|
|
39
|
-
scripts?: import("../models").ScriptOrStyleEntry[];
|
|
40
|
-
server?: string;
|
|
41
|
-
serviceWorker?: boolean;
|
|
42
|
-
skipTypeChecking?: boolean;
|
|
43
|
-
sourceMap?: boolean | Partial<SourceMap>;
|
|
44
|
-
ssr?: boolean | {
|
|
45
|
-
entry: string;
|
|
46
|
-
experimentalPlatform?: "node" | "neutral";
|
|
47
|
-
};
|
|
48
|
-
stylePreprocessorOptions?: import("@nx/angular-rspack-compiler").StylePreprocessorOptions;
|
|
49
|
-
styles?: import("../models").ScriptOrStyleEntry[];
|
|
50
|
-
subresourceIntegrity?: boolean;
|
|
51
|
-
tsConfig?: string;
|
|
52
|
-
useTsProjectReferences?: boolean;
|
|
53
|
-
vendorChunk?: boolean;
|
|
54
|
-
webWorkerTsConfig?: string;
|
|
55
|
-
security?: {
|
|
56
|
-
autoCsp?: boolean | {
|
|
57
|
-
unsafeEval?: boolean;
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
clearScreen?: boolean;
|
|
61
|
-
verbose?: boolean;
|
|
62
|
-
progress?: boolean;
|
|
63
|
-
watch?: boolean;
|
|
64
|
-
poll?: number;
|
|
65
|
-
statsJson?: boolean;
|
|
66
|
-
budgets?: import("../models/unsupported-options").BudgetEntry[];
|
|
67
|
-
allowedCommonJsDependencies?: string[];
|
|
68
|
-
prerender?: boolean | {
|
|
69
|
-
routesFile?: string;
|
|
70
|
-
discoverRoutes?: boolean;
|
|
71
|
-
};
|
|
72
|
-
appShell?: boolean;
|
|
73
|
-
outputMode?: "static" | "server";
|
|
74
|
-
};
|
|
75
|
-
mergedRspackConfigOverrides: Partial<import("@rspack/core").RspackOptions>;
|
|
76
|
-
};
|
|
2
|
+
import { type AngularRspackPluginOptions } from '../models';
|
|
77
3
|
export declare function createConfig(defaultOptions: {
|
|
78
4
|
options: AngularRspackPluginOptions;
|
|
79
5
|
rspackConfigOverrides?: Partial<Configuration>;
|
|
@@ -81,4 +7,5 @@ export declare function createConfig(defaultOptions: {
|
|
|
81
7
|
options: Partial<AngularRspackPluginOptions>;
|
|
82
8
|
rspackConfigOverrides?: Partial<Configuration>;
|
|
83
9
|
}>, configEnvVar?: string): Promise<Configuration[]>;
|
|
10
|
+
export declare function _createConfig(options: AngularRspackPluginOptions, rspackConfigOverrides?: Partial<Configuration>): Promise<Configuration[]>;
|
|
84
11
|
//# sourceMappingURL=create-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-config.d.ts","sourceRoot":"","sources":["../../../src/lib/config/create-config.ts"],"names":[],"mappings":"
|
|
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;AAc5D,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,CAa1B;AAED,wBAAsB,aAAa,CACjC,OAAO,EAAE,0BAA0B,EACnC,qBAAqB,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GAC7C,OAAO,CAAC,aAAa,EAAE,CAAC,CA8C1B"}
|
|
@@ -1,491 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports._createConfig = _createConfig;
|
|
4
|
-
exports.handleConfigurations = handleConfigurations;
|
|
5
3
|
exports.createConfig = createConfig;
|
|
6
|
-
|
|
7
|
-
const angular_rspack_compiler_1 = require("@nx/angular-rspack-compiler");
|
|
8
|
-
const core_1 = require("@rspack/core");
|
|
9
|
-
const deepmerge_1 = tslib_1.__importDefault(require("deepmerge"));
|
|
10
|
-
const path_1 = require("path");
|
|
4
|
+
exports._createConfig = _createConfig;
|
|
11
5
|
const webpack_merge_1 = require("webpack-merge");
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const sourceMapRules = [];
|
|
24
|
-
const sourceMapPlugins = [];
|
|
25
|
-
if (scripts || styles) {
|
|
26
|
-
const include = [];
|
|
27
|
-
if (scripts) {
|
|
28
|
-
include.push(/js$/);
|
|
29
|
-
}
|
|
30
|
-
if (styles) {
|
|
31
|
-
include.push(/css$/);
|
|
32
|
-
}
|
|
33
|
-
sourceMapPlugins.push(new dev_tools_ignore_plugin_1.DevToolsIgnorePlugin());
|
|
34
|
-
sourceMapPlugins.push(new core_1.SourceMapDevToolPlugin({
|
|
35
|
-
filename: '[file].map',
|
|
36
|
-
include,
|
|
37
|
-
// We want to set sourceRoot to `webpack:///` for non
|
|
38
|
-
// inline sourcemaps as otherwise paths to sourcemaps will be broken in browser
|
|
39
|
-
// `webpack:///` is needed for Visual Studio breakpoints to work properly as currently
|
|
40
|
-
// there is no way to set the 'webRoot'
|
|
41
|
-
sourceRoot: 'webpack:///',
|
|
42
|
-
moduleFilenameTemplate: '[resource-path]',
|
|
43
|
-
append: hidden ? false : undefined,
|
|
44
|
-
}));
|
|
45
|
-
sourceMapRules.push({
|
|
46
|
-
test: /\.[cm]?jsx?$/,
|
|
47
|
-
enforce: 'pre',
|
|
48
|
-
loader: require.resolve('source-map-loader'),
|
|
49
|
-
options: {
|
|
50
|
-
filterSourceMappingUrl: (_mapUri, resourcePath) => {
|
|
51
|
-
if (vendor) {
|
|
52
|
-
// Consume all sourcemaps when vendor option is enabled.
|
|
53
|
-
return true;
|
|
54
|
-
}
|
|
55
|
-
// Don't consume sourcemaps in node_modules when vendor is disabled.
|
|
56
|
-
// But, do consume local libraries sourcemaps.
|
|
57
|
-
return !resourcePath.includes('node_modules');
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
return { sourceMapRules, sourceMapPlugins };
|
|
6
|
+
const helpers_1 = require("./config-utils/helpers");
|
|
7
|
+
const common_config_1 = require("./config-utils/common-config");
|
|
8
|
+
const server_config_1 = require("./config-utils/server-config");
|
|
9
|
+
const browser_config_1 = require("./config-utils/browser-config");
|
|
10
|
+
const user_defined_config_helpers_1 = require("./config-utils/user-defined-config-helpers");
|
|
11
|
+
async function createConfig(defaultOptions, configurations = {}, configEnvVar = 'NGRS_CONFIG') {
|
|
12
|
+
const configurationMode = process.env[configEnvVar] ??
|
|
13
|
+
(process.env['WEBPACK_SERVE'] ? 'development' : 'production');
|
|
14
|
+
const configurationModes = (0, user_defined_config_helpers_1.parseConfigurationMode)(configurationMode);
|
|
15
|
+
const { mergedConfigurationBuildOptions, mergedRspackConfigOverrides } = (0, user_defined_config_helpers_1.handleConfigurations)(defaultOptions, configurations, configurationModes);
|
|
16
|
+
return _createConfig(mergedConfigurationBuildOptions, mergedRspackConfigOverrides);
|
|
63
17
|
}
|
|
64
|
-
const VENDORS_TEST = /[\\/]node_modules[\\/]/;
|
|
65
18
|
async function _createConfig(options, rspackConfigOverrides) {
|
|
66
|
-
const {
|
|
67
|
-
// Update file hashes to include translation file content
|
|
68
|
-
const i18nHash = i18n.shouldInline
|
|
69
|
-
? Object.values(i18n.locales).reduce((data, locale) => data + locale.files.map((file) => file.integrity || '').join('|'), '')
|
|
70
|
-
: () => {
|
|
71
|
-
// no-op as i18n is not inlined
|
|
72
|
-
};
|
|
73
|
-
const normalizedOptions = await (0, models_1.normalizeOptions)(_options);
|
|
74
|
-
const isProduction = process.env['NODE_ENV'] === 'production';
|
|
75
|
-
const isDevServer = process.env['WEBPACK_SERVE'];
|
|
19
|
+
const { i18n, i18nHash, normalizedOptions } = await (0, helpers_1.normalizeOptionWithI18n)(options);
|
|
76
20
|
const hashFormat = (0, helpers_1.getOutputHashFormat)(normalizedOptions.outputHashing);
|
|
77
|
-
const { root } = normalizedOptions;
|
|
78
21
|
if (options.deleteOutputPath) {
|
|
79
|
-
await (0, helpers_1.deleteOutputDir)(root, normalizedOptions.outputPath.base);
|
|
80
|
-
}
|
|
81
|
-
const { sourceMapRules, sourceMapPlugins } = configureSourceMap(normalizedOptions.sourceMap);
|
|
82
|
-
let crossOriginLoading = false;
|
|
83
|
-
if (normalizedOptions.subresourceIntegrity &&
|
|
84
|
-
normalizedOptions.crossOrigin === 'none') {
|
|
85
|
-
crossOriginLoading = 'anonymous';
|
|
86
|
-
}
|
|
87
|
-
else if (normalizedOptions.crossOrigin !== 'none') {
|
|
88
|
-
crossOriginLoading = normalizedOptions.crossOrigin;
|
|
22
|
+
await (0, helpers_1.deleteOutputDir)(normalizedOptions.root, normalizedOptions.outputPath.base);
|
|
89
23
|
}
|
|
90
|
-
const defaultConfig =
|
|
91
|
-
context: root,
|
|
92
|
-
mode: isProduction ? 'production' : 'development',
|
|
93
|
-
devtool: normalizedOptions.sourceMap.scripts ? 'source-map' : undefined,
|
|
94
|
-
output: {
|
|
95
|
-
uniqueName: normalizedOptions.projectName ?? 'rspack-angular',
|
|
96
|
-
publicPath: normalizedOptions.deployUrl ?? '',
|
|
97
|
-
clean: normalizedOptions.deleteOutputPath,
|
|
98
|
-
crossOriginLoading,
|
|
99
|
-
trustedTypes: { policyName: 'angular#bundler' },
|
|
100
|
-
sourceMapFilename: normalizedOptions.sourceMap.scripts
|
|
101
|
-
? '[file].map'
|
|
102
|
-
: undefined,
|
|
103
|
-
scriptType: 'module',
|
|
104
|
-
},
|
|
105
|
-
resolve: {
|
|
106
|
-
extensions: ['.ts', '.tsx', '.mjs', '.js'],
|
|
107
|
-
symlinks: !normalizedOptions.preserveSymlinks,
|
|
108
|
-
modules: ['node_modules'],
|
|
109
|
-
mainFields: ['es2020', 'es2015', 'browser', 'module', 'main'],
|
|
110
|
-
conditionNames: ['es2020', 'es2015', '...'],
|
|
111
|
-
tsConfig: {
|
|
112
|
-
configFile: normalizedOptions.tsConfig,
|
|
113
|
-
},
|
|
114
|
-
...(i18n.shouldInline && normalizedOptions.aot
|
|
115
|
-
? { alias: { '@angular/localize/init': false } }
|
|
116
|
-
: {}),
|
|
117
|
-
},
|
|
118
|
-
resolveLoader: {
|
|
119
|
-
symlinks: !normalizedOptions.preserveSymlinks,
|
|
120
|
-
},
|
|
121
|
-
watchOptions: {
|
|
122
|
-
followSymlinks: normalizedOptions.preserveSymlinks,
|
|
123
|
-
},
|
|
124
|
-
ignoreWarnings: [
|
|
125
|
-
// https://github.com/webpack-contrib/source-map-loader/blob/b2de4249c7431dd8432da607e08f0f65e9d64219/src/index.js#L83
|
|
126
|
-
/Failed to parse source map from/,
|
|
127
|
-
// https://github.com/webpack-contrib/postcss-loader/blob/bd261875fdf9c596af4ffb3a1a73fe3c549befda/src/index.js#L153-L158
|
|
128
|
-
/Add postcss as project dependency/,
|
|
129
|
-
// esbuild will issue a warning, while still hoists the @charset at the very top.
|
|
130
|
-
// This is caused by a bug in css-loader https://github.com/webpack-contrib/css-loader/issues/1212
|
|
131
|
-
/"@charset" must be the first rule in the file/,
|
|
132
|
-
],
|
|
133
|
-
module: {
|
|
134
|
-
parser: {
|
|
135
|
-
javascript: {
|
|
136
|
-
requireContext: false,
|
|
137
|
-
url: false,
|
|
138
|
-
},
|
|
139
|
-
},
|
|
140
|
-
rules: [
|
|
141
|
-
{
|
|
142
|
-
test: /\.?(svg|html)$/,
|
|
143
|
-
// Only process HTML and SVG which are known Angular component resources.
|
|
144
|
-
resourceQuery: /\?ngResource/,
|
|
145
|
-
type: 'asset/source',
|
|
146
|
-
},
|
|
147
|
-
...(await (0, style_config_utils_1.getStyleLoaders)(normalizedOptions)),
|
|
148
|
-
...sourceMapRules,
|
|
149
|
-
{ test: /[/\\]rxjs[/\\]add[/\\].+\.js$/, sideEffects: true },
|
|
150
|
-
{
|
|
151
|
-
test: angular_rspack_compiler_1.TS_ALL_EXT_REGEX,
|
|
152
|
-
use: [
|
|
153
|
-
{
|
|
154
|
-
loader: 'builtin:swc-loader',
|
|
155
|
-
options: {
|
|
156
|
-
jsc: {
|
|
157
|
-
parser: {
|
|
158
|
-
syntax: 'typescript',
|
|
159
|
-
},
|
|
160
|
-
target: 'es2022',
|
|
161
|
-
},
|
|
162
|
-
},
|
|
163
|
-
},
|
|
164
|
-
{
|
|
165
|
-
loader: require.resolve('@nx/angular-rspack/loaders/angular-loader'),
|
|
166
|
-
},
|
|
167
|
-
],
|
|
168
|
-
},
|
|
169
|
-
{
|
|
170
|
-
test: angular_rspack_compiler_1.JS_ALL_EXT_REGEX,
|
|
171
|
-
use: [
|
|
172
|
-
{
|
|
173
|
-
loader: require.resolve('@nx/angular-rspack/loaders/angular-partial-transform-loader'),
|
|
174
|
-
},
|
|
175
|
-
],
|
|
176
|
-
},
|
|
177
|
-
],
|
|
178
|
-
},
|
|
179
|
-
plugins: [
|
|
180
|
-
...sourceMapPlugins,
|
|
181
|
-
...(i18n.shouldInline
|
|
182
|
-
? [
|
|
183
|
-
{
|
|
184
|
-
apply(compiler) {
|
|
185
|
-
compiler.hooks.compilation.tap('AngularRspackPlugin', (compilation) => {
|
|
186
|
-
core_1.javascript.JavascriptModulesPlugin.getCompilationHooks(compilation).chunkHash.tap('AngularRspackPlugin', (_, hash) => {
|
|
187
|
-
hash.update(Buffer.from('$localize' + i18nHash));
|
|
188
|
-
});
|
|
189
|
-
});
|
|
190
|
-
},
|
|
191
|
-
},
|
|
192
|
-
]
|
|
193
|
-
: []),
|
|
194
|
-
new core_1.CssExtractRspackPlugin({
|
|
195
|
-
filename: `[name]${hashFormat.extract}.css`,
|
|
196
|
-
}),
|
|
197
|
-
],
|
|
198
|
-
};
|
|
24
|
+
const defaultConfig = await (0, common_config_1.getCommonConfig)(normalizedOptions, i18n, i18nHash, hashFormat);
|
|
199
25
|
const configs = [];
|
|
200
26
|
if (normalizedOptions.hasServer) {
|
|
201
|
-
const serverConfig =
|
|
202
|
-
...defaultConfig,
|
|
203
|
-
name: 'server',
|
|
204
|
-
target: 'node',
|
|
205
|
-
entry: {
|
|
206
|
-
server: {
|
|
207
|
-
import: [
|
|
208
|
-
...((0, misc_helpers_1.isPackageInstalled)(root, '@angular/platform-server')
|
|
209
|
-
? // This import must come before any imports (direct or transitive) that rely on DOM built-ins being
|
|
210
|
-
// available, such as `@angular/elements`.
|
|
211
|
-
['@angular/platform-server/init']
|
|
212
|
-
: []),
|
|
213
|
-
...(i18n.shouldInline ? ['@angular/localize/init'] : []),
|
|
214
|
-
normalizedOptions.ssr.entry,
|
|
215
|
-
],
|
|
216
|
-
},
|
|
217
|
-
},
|
|
218
|
-
output: {
|
|
219
|
-
...defaultConfig.output,
|
|
220
|
-
path: normalizedOptions.outputPath.server,
|
|
221
|
-
filename: '[name].js',
|
|
222
|
-
chunkFilename: '[name].js',
|
|
223
|
-
library: { type: 'commonjs' },
|
|
224
|
-
},
|
|
225
|
-
devServer: {
|
|
226
|
-
headers: {
|
|
227
|
-
'Access-Control-Allow-Origin': '*',
|
|
228
|
-
},
|
|
229
|
-
allowedHosts: (0, dev_server_config_utils_1.getAllowedHostsConfig)(normalizedOptions.devServer.allowedHosts, normalizedOptions.devServer.disableHostCheck),
|
|
230
|
-
client: {
|
|
231
|
-
webSocketURL: {
|
|
232
|
-
hostname: normalizedOptions.devServer.host,
|
|
233
|
-
port: normalizedOptions.devServer.port,
|
|
234
|
-
},
|
|
235
|
-
overlay: {
|
|
236
|
-
errors: true,
|
|
237
|
-
warnings: false,
|
|
238
|
-
runtimeErrors: true,
|
|
239
|
-
},
|
|
240
|
-
reconnect: true,
|
|
241
|
-
},
|
|
242
|
-
host: normalizedOptions.devServer.host,
|
|
243
|
-
port: normalizedOptions.devServer.port,
|
|
244
|
-
hot: false,
|
|
245
|
-
liveReload: true,
|
|
246
|
-
watchFiles: ['./src/**/*.*', './public/**/*.*'],
|
|
247
|
-
historyApiFallback: {
|
|
248
|
-
index: '/index.html',
|
|
249
|
-
rewrites: [{ from: /^\/$/, to: 'index.html' }],
|
|
250
|
-
},
|
|
251
|
-
devMiddleware: {
|
|
252
|
-
writeToDisk: (file) => !file.includes('.hot-update.'),
|
|
253
|
-
},
|
|
254
|
-
server: {
|
|
255
|
-
options: normalizedOptions.devServer.sslKey &&
|
|
256
|
-
normalizedOptions.devServer.sslCert
|
|
257
|
-
? {
|
|
258
|
-
key: (0, path_1.resolve)(root, normalizedOptions.devServer.sslKey),
|
|
259
|
-
cert: (0, path_1.resolve)(root, normalizedOptions.devServer.sslCert),
|
|
260
|
-
}
|
|
261
|
-
: {},
|
|
262
|
-
type: normalizedOptions.devServer.ssl ? 'https' : 'http',
|
|
263
|
-
},
|
|
264
|
-
proxy: await (0, dev_server_config_utils_1.getProxyConfig)(root, normalizedOptions.devServer.proxyConfig),
|
|
265
|
-
},
|
|
266
|
-
externals: normalizedOptions.externalDependencies,
|
|
267
|
-
optimization: {
|
|
268
|
-
chunkIds: normalizedOptions.namedChunks ? 'named' : 'deterministic',
|
|
269
|
-
moduleIds: 'deterministic',
|
|
270
|
-
runtimeChunk: false,
|
|
271
|
-
emitOnErrors: false,
|
|
272
|
-
minimizer: normalizedOptions.optimization
|
|
273
|
-
? [
|
|
274
|
-
new core_1.SwcJsMinimizerRspackPlugin({
|
|
275
|
-
minimizerOptions: {
|
|
276
|
-
minify: true,
|
|
277
|
-
compress: {
|
|
278
|
-
passes: 2,
|
|
279
|
-
},
|
|
280
|
-
format: {
|
|
281
|
-
comments: false,
|
|
282
|
-
},
|
|
283
|
-
},
|
|
284
|
-
}),
|
|
285
|
-
new core_1.LightningCssMinimizerRspackPlugin(),
|
|
286
|
-
]
|
|
287
|
-
: [],
|
|
288
|
-
splitChunks: {
|
|
289
|
-
chunks: 'async',
|
|
290
|
-
minChunks: 1,
|
|
291
|
-
minSize: 20000,
|
|
292
|
-
maxAsyncRequests: 30,
|
|
293
|
-
maxInitialRequests: 30,
|
|
294
|
-
cacheGroups: {
|
|
295
|
-
default: normalizedOptions.commonChunk && {
|
|
296
|
-
chunks: 'async',
|
|
297
|
-
minChunks: 2,
|
|
298
|
-
priority: 10,
|
|
299
|
-
},
|
|
300
|
-
common: normalizedOptions.commonChunk && {
|
|
301
|
-
name: 'common',
|
|
302
|
-
chunks: 'async',
|
|
303
|
-
minChunks: 2,
|
|
304
|
-
enforce: true,
|
|
305
|
-
priority: 5,
|
|
306
|
-
},
|
|
307
|
-
vendors: false,
|
|
308
|
-
defaultVendors: normalizedOptions.vendorChunk && {
|
|
309
|
-
name: 'vendor',
|
|
310
|
-
chunks: (chunk) => chunk.name === 'main',
|
|
311
|
-
enforce: true,
|
|
312
|
-
test: VENDORS_TEST,
|
|
313
|
-
},
|
|
314
|
-
},
|
|
315
|
-
},
|
|
316
|
-
},
|
|
317
|
-
plugins: [
|
|
318
|
-
...(defaultConfig.plugins ?? []),
|
|
319
|
-
// Fixes Critical dependency: the request of a dependency is an expression
|
|
320
|
-
new core_1.ContextReplacementPlugin(/@?hapi|express[\\/]/),
|
|
321
|
-
new ng_rspack_1.NgRspackPlugin(normalizedOptions, {
|
|
322
|
-
i18nOptions: i18n,
|
|
323
|
-
platform: 'server',
|
|
324
|
-
}),
|
|
325
|
-
],
|
|
326
|
-
};
|
|
27
|
+
const serverConfig = await (0, server_config_1.getServerConfig)(normalizedOptions, i18n, defaultConfig);
|
|
327
28
|
const mergedConfig = (0, webpack_merge_1.merge)(serverConfig, rspackConfigOverrides ?? {});
|
|
328
29
|
configs.push(mergedConfig);
|
|
329
30
|
}
|
|
330
|
-
const browserConfig =
|
|
331
|
-
...defaultConfig,
|
|
332
|
-
name: 'browser',
|
|
333
|
-
...(normalizedOptions.hasServer && isDevServer
|
|
334
|
-
? { dependencies: ['server'] }
|
|
335
|
-
: {}),
|
|
336
|
-
target: 'web',
|
|
337
|
-
entry: {
|
|
338
|
-
main: {
|
|
339
|
-
import: [
|
|
340
|
-
...(i18n.shouldInline ? ['@angular/localize/init'] : []),
|
|
341
|
-
normalizedOptions.browser,
|
|
342
|
-
],
|
|
343
|
-
},
|
|
344
|
-
...(0, entry_points_1.getPolyfillsEntry)(normalizedOptions.polyfills, normalizedOptions.aot),
|
|
345
|
-
...(0, entry_points_1.toRspackEntries)(normalizedOptions.globalStyles, normalizedOptions.root, 'ngGlobalStyles'),
|
|
346
|
-
...(0, entry_points_1.toRspackEntries)(normalizedOptions.globalScripts, normalizedOptions.root),
|
|
347
|
-
},
|
|
348
|
-
devServer: {
|
|
349
|
-
headers: {
|
|
350
|
-
'Access-Control-Allow-Origin': '*',
|
|
351
|
-
},
|
|
352
|
-
allowedHosts: (0, dev_server_config_utils_1.getAllowedHostsConfig)(normalizedOptions.devServer.allowedHosts, normalizedOptions.devServer.disableHostCheck),
|
|
353
|
-
client: {
|
|
354
|
-
webSocketURL: {
|
|
355
|
-
hostname: normalizedOptions.devServer.host,
|
|
356
|
-
port: normalizedOptions.devServer.port,
|
|
357
|
-
},
|
|
358
|
-
overlay: {
|
|
359
|
-
errors: true,
|
|
360
|
-
warnings: false,
|
|
361
|
-
runtimeErrors: true,
|
|
362
|
-
},
|
|
363
|
-
reconnect: true,
|
|
364
|
-
},
|
|
365
|
-
hot: false,
|
|
366
|
-
liveReload: true,
|
|
367
|
-
watchFiles: ['./src/**/*.*', './public/**/*.*'],
|
|
368
|
-
historyApiFallback: {
|
|
369
|
-
index: '/index.html',
|
|
370
|
-
rewrites: [{ from: /^\/$/, to: 'index.html' }],
|
|
371
|
-
},
|
|
372
|
-
devMiddleware: {
|
|
373
|
-
writeToDisk: (file) => !file.includes('.hot-update.'),
|
|
374
|
-
},
|
|
375
|
-
host: normalizedOptions.devServer.host,
|
|
376
|
-
port: normalizedOptions.devServer.port,
|
|
377
|
-
server: {
|
|
378
|
-
options: normalizedOptions.devServer.sslKey &&
|
|
379
|
-
normalizedOptions.devServer.sslCert
|
|
380
|
-
? {
|
|
381
|
-
key: (0, path_1.resolve)(root, normalizedOptions.devServer.sslKey),
|
|
382
|
-
cert: (0, path_1.resolve)(root, normalizedOptions.devServer.sslCert),
|
|
383
|
-
}
|
|
384
|
-
: {},
|
|
385
|
-
type: normalizedOptions.devServer.ssl ? 'https' : 'http',
|
|
386
|
-
},
|
|
387
|
-
proxy: await (0, dev_server_config_utils_1.getProxyConfig)(root, normalizedOptions.devServer.proxyConfig),
|
|
388
|
-
onListening: (devServer) => {
|
|
389
|
-
if (!devServer) {
|
|
390
|
-
throw new Error('@rspack/dev-server is not defined');
|
|
391
|
-
}
|
|
392
|
-
const port = devServer.server?.address()?.port ??
|
|
393
|
-
normalizedOptions.devServer.port;
|
|
394
|
-
console.log('Listening on port:', port);
|
|
395
|
-
},
|
|
396
|
-
},
|
|
397
|
-
output: {
|
|
398
|
-
...defaultConfig.output,
|
|
399
|
-
hashFunction: isProduction ? 'xxhash64' : undefined,
|
|
400
|
-
path: normalizedOptions.outputPath.browser,
|
|
401
|
-
cssFilename: `[name]${hashFormat.file}.css`,
|
|
402
|
-
filename: `[name]${hashFormat.chunk}.js`,
|
|
403
|
-
chunkFilename: `[name]${hashFormat.chunk}.js`,
|
|
404
|
-
scriptType: 'module',
|
|
405
|
-
module: true,
|
|
406
|
-
},
|
|
407
|
-
optimization: {
|
|
408
|
-
chunkIds: normalizedOptions.namedChunks ? 'named' : 'deterministic',
|
|
409
|
-
emitOnErrors: false,
|
|
410
|
-
moduleIds: 'deterministic',
|
|
411
|
-
runtimeChunk: 'single',
|
|
412
|
-
minimizer: normalizedOptions.optimization
|
|
413
|
-
? [
|
|
414
|
-
new core_1.SwcJsMinimizerRspackPlugin({
|
|
415
|
-
minimizerOptions: {
|
|
416
|
-
minify: true,
|
|
417
|
-
mangle: true,
|
|
418
|
-
compress: {
|
|
419
|
-
passes: 2,
|
|
420
|
-
},
|
|
421
|
-
format: {
|
|
422
|
-
comments: false,
|
|
423
|
-
},
|
|
424
|
-
},
|
|
425
|
-
}),
|
|
426
|
-
new core_1.LightningCssMinimizerRspackPlugin(),
|
|
427
|
-
]
|
|
428
|
-
: [],
|
|
429
|
-
splitChunks: {
|
|
430
|
-
chunks: 'all',
|
|
431
|
-
minChunks: 1,
|
|
432
|
-
minSize: 20000,
|
|
433
|
-
maxAsyncRequests: 30,
|
|
434
|
-
maxInitialRequests: 30,
|
|
435
|
-
cacheGroups: {
|
|
436
|
-
default: normalizedOptions.commonChunk && {
|
|
437
|
-
chunks: 'async',
|
|
438
|
-
minChunks: 2,
|
|
439
|
-
priority: 10,
|
|
440
|
-
},
|
|
441
|
-
common: normalizedOptions.commonChunk && {
|
|
442
|
-
name: 'common',
|
|
443
|
-
chunks: 'async',
|
|
444
|
-
minChunks: 2,
|
|
445
|
-
enforce: true,
|
|
446
|
-
priority: 5,
|
|
447
|
-
},
|
|
448
|
-
vendors: false,
|
|
449
|
-
defaultVendors: normalizedOptions.vendorChunk && {
|
|
450
|
-
name: 'vendor',
|
|
451
|
-
chunks: (chunk) => chunk.name === 'main',
|
|
452
|
-
enforce: true,
|
|
453
|
-
test: VENDORS_TEST,
|
|
454
|
-
},
|
|
455
|
-
},
|
|
456
|
-
},
|
|
457
|
-
},
|
|
458
|
-
plugins: [
|
|
459
|
-
...(defaultConfig.plugins ?? []),
|
|
460
|
-
new ng_rspack_1.NgRspackPlugin(normalizedOptions, {
|
|
461
|
-
i18nOptions: i18n,
|
|
462
|
-
platform: 'browser',
|
|
463
|
-
}),
|
|
464
|
-
],
|
|
465
|
-
};
|
|
31
|
+
const browserConfig = await (0, browser_config_1.getBrowserConfig)(normalizedOptions, i18n, hashFormat, defaultConfig);
|
|
466
32
|
const mergedConfig = (0, webpack_merge_1.merge)(browserConfig, rspackConfigOverrides ?? {});
|
|
467
33
|
configs.unshift(mergedConfig);
|
|
468
34
|
return configs;
|
|
469
35
|
}
|
|
470
|
-
function handleConfigurations(defaultOptions, configurations, configurationModes) {
|
|
471
|
-
let mergedConfigurationBuildOptions = { ...defaultOptions.options };
|
|
472
|
-
let mergedRspackConfigOverrides = defaultOptions.rspackConfigOverrides ?? {};
|
|
473
|
-
for (const configurationName of configurationModes) {
|
|
474
|
-
if (configurationName in configurations) {
|
|
475
|
-
mergedConfigurationBuildOptions = (0, deepmerge_1.default)(mergedConfigurationBuildOptions, configurations[configurationName].options ?? {});
|
|
476
|
-
if (configurations[configurationName].rspackConfigOverrides) {
|
|
477
|
-
mergedRspackConfigOverrides = (0, webpack_merge_1.merge)(mergedRspackConfigOverrides, configurations[configurationName].rspackConfigOverrides);
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
return { mergedConfigurationBuildOptions, mergedRspackConfigOverrides };
|
|
482
|
-
}
|
|
483
|
-
async function createConfig(defaultOptions, configurations = {}, configEnvVar = 'NGRS_CONFIG') {
|
|
484
|
-
const configurationMode = process.env[configEnvVar] ?? 'production';
|
|
485
|
-
const configurationModes = parseConfigurationMode(configurationMode);
|
|
486
|
-
const { mergedConfigurationBuildOptions, mergedRspackConfigOverrides } = handleConfigurations(defaultOptions, configurations, configurationModes);
|
|
487
|
-
return _createConfig(mergedConfigurationBuildOptions, mergedRspackConfigOverrides);
|
|
488
|
-
}
|
|
489
|
-
function parseConfigurationMode(configurationMode) {
|
|
490
|
-
return configurationMode.split(',').map((m) => m.trim());
|
|
491
|
-
}
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
export * from './config/create-config';
|
|
2
2
|
export * from './plugins/ng-rspack';
|
|
3
|
+
export { configureSourceMap } from './config/config-utils/sourcemap-utils';
|
|
4
|
+
export { getCrossOriginLoading } from './config/config-utils/helpers';
|
|
5
|
+
export { getOptimization } from './config/config-utils/optimization-config';
|
|
6
|
+
export { VENDORS_TEST } from './config/config-utils/optimization-config';
|
|
3
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC"}
|
package/dist/lib/index.js
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VENDORS_TEST = exports.getOptimization = exports.getCrossOriginLoading = exports.configureSourceMap = void 0;
|
|
3
4
|
const tslib_1 = require("tslib");
|
|
4
5
|
tslib_1.__exportStar(require("./config/create-config"), exports);
|
|
5
6
|
tslib_1.__exportStar(require("./plugins/ng-rspack"), exports);
|
|
7
|
+
var sourcemap_utils_1 = require("./config/config-utils/sourcemap-utils");
|
|
8
|
+
Object.defineProperty(exports, "configureSourceMap", { enumerable: true, get: function () { return sourcemap_utils_1.configureSourceMap; } });
|
|
9
|
+
var helpers_1 = require("./config/config-utils/helpers");
|
|
10
|
+
Object.defineProperty(exports, "getCrossOriginLoading", { enumerable: true, get: function () { return helpers_1.getCrossOriginLoading; } });
|
|
11
|
+
var optimization_config_1 = require("./config/config-utils/optimization-config");
|
|
12
|
+
Object.defineProperty(exports, "getOptimization", { enumerable: true, get: function () { return optimization_config_1.getOptimization; } });
|
|
13
|
+
var optimization_config_2 = require("./config/config-utils/optimization-config");
|
|
14
|
+
Object.defineProperty(exports, "VENDORS_TEST", { enumerable: true, get: function () { return optimization_config_2.VENDORS_TEST; } });
|