@nx/angular-rspack 0.0.0-pr-32422-a3285be
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +98 -0
- package/README.md__tpl__ +48 -0
- 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 +83 -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 +144 -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 +258 -0
- package/dist/lib/config/config-utils/entry-points.d.ts +9 -0
- package/dist/lib/config/config-utils/entry-points.d.ts.map +1 -0
- package/dist/lib/config/config-utils/entry-points.js +36 -0
- package/dist/lib/config/config-utils/get-stats-options.d.ts +3 -0
- package/dist/lib/config/config-utils/get-stats-options.d.ts.map +1 -0
- package/dist/lib/config/config-utils/get-stats-options.js +39 -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/config-utils/helpers.js +106 -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 +69 -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 +92 -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 +73 -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 +11 -0
- package/dist/lib/config/create-config.d.ts.map +1 -0
- package/dist/lib/config/create-config.js +35 -0
- package/dist/lib/config/i18n/create-i18n-options.d.ts +6 -0
- package/dist/lib/config/i18n/create-i18n-options.d.ts.map +1 -0
- package/dist/lib/config/i18n/create-i18n-options.js +124 -0
- package/dist/lib/index.d.ts +7 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +14 -0
- package/dist/lib/models/angular-rspack-plugin-options.d.ts +344 -0
- package/dist/lib/models/angular-rspack-plugin-options.d.ts.map +1 -0
- package/dist/lib/models/angular-rspack-plugin-options.js +2 -0
- package/dist/lib/models/augmented-compilation.d.ts +13 -0
- package/dist/lib/models/augmented-compilation.d.ts.map +1 -0
- package/dist/lib/models/augmented-compilation.js +4 -0
- package/dist/lib/models/i18n.d.ts +33 -0
- package/dist/lib/models/i18n.d.ts.map +1 -0
- package/dist/lib/models/i18n.js +41 -0
- package/dist/lib/models/index.d.ts +5 -0
- package/dist/lib/models/index.d.ts.map +1 -0
- package/dist/lib/models/index.js +7 -0
- package/dist/lib/models/normalize-options.d.ts +16 -0
- package/dist/lib/models/normalize-options.d.ts.map +1 -0
- package/dist/lib/models/normalize-options.js +424 -0
- package/dist/lib/plugins/angular-rspack-plugin.d.ts +9 -0
- package/dist/lib/plugins/angular-rspack-plugin.d.ts.map +1 -0
- package/dist/lib/plugins/angular-rspack-plugin.js +234 -0
- package/dist/lib/plugins/angular-ssr-dev-server.d.ts +8 -0
- package/dist/lib/plugins/angular-ssr-dev-server.d.ts.map +1 -0
- package/dist/lib/plugins/angular-ssr-dev-server.js +62 -0
- package/dist/lib/plugins/any-component-style-budget-checker-plugin.d.ts +19 -0
- package/dist/lib/plugins/any-component-style-budget-checker-plugin.d.ts.map +1 -0
- package/dist/lib/plugins/any-component-style-budget-checker-plugin.js +64 -0
- package/dist/lib/plugins/client/ssr-reload-client.d.ts +2 -0
- package/dist/lib/plugins/client/ssr-reload-client.d.ts.map +1 -0
- package/dist/lib/plugins/client/ssr-reload-client.js +15 -0
- package/dist/lib/plugins/i18n-inline-plugin.d.ts +8 -0
- package/dist/lib/plugins/i18n-inline-plugin.d.ts.map +1 -0
- package/dist/lib/plugins/i18n-inline-plugin.js +201 -0
- package/dist/lib/plugins/index-html-plugin.d.ts +21 -0
- package/dist/lib/plugins/index-html-plugin.d.ts.map +1 -0
- package/dist/lib/plugins/index-html-plugin.js +107 -0
- package/dist/lib/plugins/loaders/angular-partial-transform.loader.d.ts +3 -0
- package/dist/lib/plugins/loaders/angular-partial-transform.loader.d.ts.map +1 -0
- package/dist/lib/plugins/loaders/angular-partial-transform.loader.js +39 -0
- package/dist/lib/plugins/loaders/angular-transform.loader.d.ts +7 -0
- package/dist/lib/plugins/loaders/angular-transform.loader.d.ts.map +1 -0
- package/dist/lib/plugins/loaders/angular-transform.loader.js +40 -0
- package/dist/lib/plugins/loaders/hmr-accept-loader.d.ts +11 -0
- package/dist/lib/plugins/loaders/hmr-accept-loader.d.ts.map +1 -0
- package/dist/lib/plugins/loaders/hmr-accept-loader.js +24 -0
- package/dist/lib/plugins/loaders/hmr-accept.d.ts +9 -0
- package/dist/lib/plugins/loaders/hmr-accept.d.ts.map +1 -0
- package/dist/lib/plugins/loaders/hmr-accept.js +183 -0
- 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 +13 -0
- package/dist/lib/plugins/ng-rspack.d.ts.map +1 -0
- package/dist/lib/plugins/ng-rspack.js +134 -0
- 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 +216 -0
- package/dist/lib/plugins/progress-plugin.d.ts +12 -0
- package/dist/lib/plugins/progress-plugin.d.ts.map +1 -0
- package/dist/lib/plugins/progress-plugin.js +36 -0
- package/dist/lib/plugins/rxjs-esm-resolution.d.ts +5 -0
- package/dist/lib/plugins/rxjs-esm-resolution.d.ts.map +1 -0
- package/dist/lib/plugins/rxjs-esm-resolution.js +15 -0
- package/dist/lib/plugins/server/ssr-reload-server.d.ts +6 -0
- package/dist/lib/plugins/server/ssr-reload-server.d.ts.map +1 -0
- package/dist/lib/plugins/server/ssr-reload-server.js +21 -0
- package/dist/lib/plugins/stats-json-plugin.d.ts +14 -0
- package/dist/lib/plugins/stats-json-plugin.d.ts.map +1 -0
- package/dist/lib/plugins/stats-json-plugin.js +69 -0
- package/dist/lib/plugins/suppress-js-for-css-chunks-plugin.d.ts +5 -0
- package/dist/lib/plugins/suppress-js-for-css-chunks-plugin.d.ts.map +1 -0
- package/dist/lib/plugins/suppress-js-for-css-chunks-plugin.js +34 -0
- package/dist/lib/plugins/tools/dev-tools-ignore-plugin.d.ts +17 -0
- package/dist/lib/plugins/tools/dev-tools-ignore-plugin.d.ts.map +1 -0
- package/dist/lib/plugins/tools/dev-tools-ignore-plugin.js +57 -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 +105 -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 +48 -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 +23 -0
- package/dist/lib/plugins/transfer-size-plugin.d.ts +12 -0
- package/dist/lib/plugins/transfer-size-plugin.d.ts.map +1 -0
- package/dist/lib/plugins/transfer-size-plugin.js +49 -0
- package/dist/lib/plugins/watch-file-logs-plugin.d.ts +12 -0
- package/dist/lib/plugins/watch-file-logs-plugin.d.ts.map +1 -0
- package/dist/lib/plugins/watch-file-logs-plugin.js +27 -0
- package/dist/lib/utils/async-chunks.d.ts +17 -0
- package/dist/lib/utils/async-chunks.d.ts.map +1 -0
- package/dist/lib/utils/async-chunks.js +44 -0
- package/dist/lib/utils/color.d.ts +11 -0
- package/dist/lib/utils/color.d.ts.map +1 -0
- package/dist/lib/utils/color.js +41 -0
- package/dist/lib/utils/find-project-for-path.d.ts +16 -0
- package/dist/lib/utils/find-project-for-path.d.ts.map +1 -0
- package/dist/lib/utils/find-project-for-path.js +42 -0
- package/dist/lib/utils/get-locale-base-href.d.ts +3 -0
- package/dist/lib/utils/get-locale-base-href.d.ts.map +1 -0
- package/dist/lib/utils/get-locale-base-href.js +17 -0
- package/dist/lib/utils/graph.d.ts +3 -0
- package/dist/lib/utils/graph.d.ts.map +1 -0
- package/dist/lib/utils/graph.js +25 -0
- package/dist/lib/utils/i18n.d.ts +4 -0
- package/dist/lib/utils/i18n.d.ts.map +1 -0
- package/dist/lib/utils/i18n.js +25 -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/add-event-dispatch-contract.d.ts +9 -0
- package/dist/lib/utils/index-file/add-event-dispatch-contract.d.ts.map +1 -0
- package/dist/lib/utils/index-file/add-event-dispatch-contract.js +27 -0
- package/dist/lib/utils/index-file/get-index-input-file.d.ts +3 -0
- package/dist/lib/utils/index-file/get-index-input-file.d.ts.map +1 -0
- package/dist/lib/utils/index-file/get-index-input-file.js +9 -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/index-file/html-rewriting-stream.d.ts +16 -0
- package/dist/lib/utils/index-file/html-rewriting-stream.d.ts.map +1 -0
- package/dist/lib/utils/index-file/html-rewriting-stream.js +27 -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/misc-helpers.d.ts +7 -0
- package/dist/lib/utils/misc-helpers.d.ts.map +1 -0
- package/dist/lib/utils/misc-helpers.js +34 -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 +159 -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 +92 -0
- package/dist/lib/utils/rspack-diagnostics.d.ts +4 -0
- package/dist/lib/utils/rspack-diagnostics.d.ts.map +1 -0
- package/dist/lib/utils/rspack-diagnostics.js +22 -0
- package/dist/lib/utils/spinner.d.ts +21 -0
- package/dist/lib/utils/spinner.d.ts.map +1 -0
- package/dist/lib/utils/spinner.js +54 -0
- package/dist/lib/utils/stats.d.ts +35 -0
- package/dist/lib/utils/stats.d.ts.map +1 -0
- package/dist/lib/utils/stats.js +313 -0
- package/dist/lib/utils/tty.d.ts +9 -0
- package/dist/lib/utils/tty.d.ts.map +1 -0
- package/dist/lib/utils/tty.js +22 -0
- package/dist/lib/utils/url-join.d.ts +9 -0
- package/dist/lib/utils/url-join.d.ts.map +1 -0
- package/dist/lib/utils/url-join.js +17 -0
- package/package.json +150 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { RspackPluginInstance, RuleSetRule } from '@rspack/core';
|
|
2
|
+
import type { SourceMap } from '../../models';
|
|
3
|
+
export declare function configureSourceMap(sourceMap: SourceMap): {
|
|
4
|
+
sourceMapRules: RuleSetRule[];
|
|
5
|
+
sourceMapPlugins: RspackPluginInstance[];
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=sourcemap-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sourcemap-utils.d.ts","sourceRoot":"","sources":["../../../../src/lib/config/config-utils/sourcemap-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,WAAW,EAEZ,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAG9C,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,SAAS;;;EAoDtD"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.configureSourceMap = configureSourceMap;
|
|
4
|
+
const core_1 = require("@rspack/core");
|
|
5
|
+
const dev_tools_ignore_plugin_1 = require("../../plugins/tools/dev-tools-ignore-plugin");
|
|
6
|
+
function configureSourceMap(sourceMap) {
|
|
7
|
+
const { scripts, styles, hidden, vendor } = sourceMap;
|
|
8
|
+
const sourceMapRules = [];
|
|
9
|
+
const sourceMapPlugins = [];
|
|
10
|
+
if (scripts || styles) {
|
|
11
|
+
const include = [];
|
|
12
|
+
if (scripts) {
|
|
13
|
+
include.push(/js$/);
|
|
14
|
+
}
|
|
15
|
+
if (styles) {
|
|
16
|
+
include.push(/css$/);
|
|
17
|
+
}
|
|
18
|
+
sourceMapPlugins.push(new dev_tools_ignore_plugin_1.DevToolsIgnorePlugin());
|
|
19
|
+
sourceMapPlugins.push(new core_1.SourceMapDevToolPlugin({
|
|
20
|
+
filename: '[file].map',
|
|
21
|
+
include,
|
|
22
|
+
// We want to set sourceRoot to `webpack:///` for non
|
|
23
|
+
// inline sourcemaps as otherwise paths to sourcemaps will be broken in browser
|
|
24
|
+
// `webpack:///` is needed for Visual Studio breakpoints to work properly as currently
|
|
25
|
+
// there is no way to set the 'webRoot'
|
|
26
|
+
sourceRoot: 'webpack:///',
|
|
27
|
+
moduleFilenameTemplate: '[resource-path]',
|
|
28
|
+
append: hidden ? false : undefined,
|
|
29
|
+
}));
|
|
30
|
+
sourceMapRules.push({
|
|
31
|
+
test: /\.[cm]?jsx?$/,
|
|
32
|
+
enforce: 'pre',
|
|
33
|
+
loader: require.resolve('source-map-loader'),
|
|
34
|
+
options: {
|
|
35
|
+
filterSourceMappingUrl: (_mapUri, resourcePath) => {
|
|
36
|
+
if (vendor) {
|
|
37
|
+
// Consume all sourcemaps when vendor option is enabled.
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
// Don't consume sourcemaps in node_modules when vendor is disabled.
|
|
41
|
+
// But, do consume local libraries sourcemaps.
|
|
42
|
+
return !resourcePath.includes('node_modules');
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
return { sourceMapRules, sourceMapPlugins };
|
|
48
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Plugins, type RuleSetRules } from '@rspack/core';
|
|
2
|
+
import type { HashFormat, NormalizedAngularRspackPluginOptions } from '../../models';
|
|
3
|
+
export declare function getStylesConfig(buildOptions: NormalizedAngularRspackPluginOptions, hashFormat: HashFormat, platform: 'browser' | 'server'): Promise<{
|
|
4
|
+
loaderRules: RuleSetRules;
|
|
5
|
+
plugins: Plugins;
|
|
6
|
+
}>;
|
|
7
|
+
//# sourceMappingURL=style-config-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style-config-utils.d.ts","sourceRoot":"","sources":["../../../../src/lib/config/config-utils/style-config-utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,OAAO,EACZ,KAAK,YAAY,EAElB,MAAM,cAAc,CAAC;AAKtB,OAAO,KAAK,EACV,UAAU,EACV,oCAAoC,EACrC,MAAM,cAAc,CAAC;AAWtB,wBAAsB,eAAe,CACnC,YAAY,EAAE,oCAAoC,EAClD,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,SAAS,GAAG,QAAQ,GAC7B,OAAO,CAAC;IACT,WAAW,EAAE,YAAY,CAAC;IAC1B,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC,CA4PD"}
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getStylesConfig = getStylesConfig;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const core_1 = require("@rspack/core");
|
|
7
|
+
const node_module_1 = require("node:module");
|
|
8
|
+
const node_path_1 = require("node:path");
|
|
9
|
+
const node_url_1 = require("node:url");
|
|
10
|
+
const postcss_cli_resources_1 = tslib_1.__importDefault(require("../../utils/postcss-cli-resources"));
|
|
11
|
+
const postcss_configuration_1 = require("../../utils/postcss-configuration");
|
|
12
|
+
const any_component_style_budget_checker_plugin_1 = require("../../plugins/any-component-style-budget-checker-plugin");
|
|
13
|
+
const suppress_js_for_css_chunks_plugin_1 = require("../../plugins/suppress-js-for-css-chunks-plugin");
|
|
14
|
+
async function getStylesConfig(buildOptions, hashFormat, platform) {
|
|
15
|
+
const isDevServer = process.env['WEBPACK_SERVE'];
|
|
16
|
+
const extraPlugins = [];
|
|
17
|
+
extraPlugins.push(new any_component_style_budget_checker_plugin_1.AnyComponentStyleBudgetChecker(buildOptions.budgets));
|
|
18
|
+
if (!isDevServer || buildOptions.devServer?.hmr) {
|
|
19
|
+
extraPlugins.push(new suppress_js_for_css_chunks_plugin_1.SuppressJsForCssOnlyEntryPlugin());
|
|
20
|
+
}
|
|
21
|
+
const cssSourceMap = buildOptions.sourceMap.styles;
|
|
22
|
+
// use includePaths from appConfig
|
|
23
|
+
const includePaths = buildOptions.stylePreprocessorOptions?.includePaths?.map((p) => (0, node_path_1.resolve)(buildOptions.root, p)) ?? [];
|
|
24
|
+
const assetNameTemplate = assetNameTemplateFactory(hashFormat);
|
|
25
|
+
const extraPostcssPlugins = [];
|
|
26
|
+
// A configuration file can exist in the project or workspace root
|
|
27
|
+
const searchDirectories = await (0, postcss_configuration_1.generateSearchDirectories)([
|
|
28
|
+
buildOptions.root,
|
|
29
|
+
devkit_1.workspaceRoot,
|
|
30
|
+
]);
|
|
31
|
+
const postcssConfiguration = await (0, postcss_configuration_1.loadPostcssConfiguration)(searchDirectories);
|
|
32
|
+
if (postcssConfiguration) {
|
|
33
|
+
for (const [pluginName, pluginOptions] of postcssConfiguration.plugins) {
|
|
34
|
+
const { default: plugin } = await Promise.resolve(`${pluginName}`).then(s => tslib_1.__importStar(require(s)));
|
|
35
|
+
if (typeof plugin !== 'function' || plugin.postcss !== true) {
|
|
36
|
+
throw new Error(`Attempted to load invalid Postcss plugin: "${pluginName}"`);
|
|
37
|
+
}
|
|
38
|
+
extraPostcssPlugins.push(plugin(pluginOptions));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
const tailwindConfig = await getTailwindConfig(searchDirectories, devkit_1.workspaceRoot);
|
|
43
|
+
if (tailwindConfig) {
|
|
44
|
+
const tailwind = await Promise.resolve(`${tailwindConfig.package}`).then(s => tslib_1.__importStar(require(s)));
|
|
45
|
+
extraPostcssPlugins.push(tailwind.default({ config: tailwindConfig.file }));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const autoprefixer = require('autoprefixer');
|
|
49
|
+
const postcssOptionsCreator = (inlineSourcemaps, extracted) => {
|
|
50
|
+
const optionGenerator = (loader) => ({
|
|
51
|
+
map: inlineSourcemaps
|
|
52
|
+
? {
|
|
53
|
+
inline: true,
|
|
54
|
+
annotation: false,
|
|
55
|
+
}
|
|
56
|
+
: undefined,
|
|
57
|
+
plugins: [
|
|
58
|
+
(0, postcss_cli_resources_1.default)({
|
|
59
|
+
baseHref: buildOptions.baseHref,
|
|
60
|
+
deployUrl: buildOptions.deployUrl,
|
|
61
|
+
resourcesOutputPath: buildOptions.outputPath.media,
|
|
62
|
+
loader,
|
|
63
|
+
filename: assetNameTemplate,
|
|
64
|
+
emitFile: platform !== 'server',
|
|
65
|
+
extracted,
|
|
66
|
+
}),
|
|
67
|
+
...extraPostcssPlugins,
|
|
68
|
+
autoprefixer({
|
|
69
|
+
ignoreUnknownVersions: true,
|
|
70
|
+
overrideBrowserslist: buildOptions.supportedBrowsers,
|
|
71
|
+
}),
|
|
72
|
+
],
|
|
73
|
+
});
|
|
74
|
+
// postcss-loader fails when trying to determine configuration files for data URIs
|
|
75
|
+
optionGenerator.config = false;
|
|
76
|
+
return optionGenerator;
|
|
77
|
+
};
|
|
78
|
+
let componentsSourceMap = !!cssSourceMap;
|
|
79
|
+
if (cssSourceMap) {
|
|
80
|
+
if (buildOptions.optimization.styles.minify) {
|
|
81
|
+
// Never use component css sourcemap when style optimizations are on.
|
|
82
|
+
// It will just increase bundle size without offering good debug experience.
|
|
83
|
+
console.warn('Components styles sourcemaps are not generated when styles optimization is enabled.');
|
|
84
|
+
componentsSourceMap = false;
|
|
85
|
+
}
|
|
86
|
+
else if (buildOptions.sourceMap.hidden) {
|
|
87
|
+
// Inline all sourcemap types except hidden ones, which are the same as no sourcemaps
|
|
88
|
+
// for component css.
|
|
89
|
+
console.warn('Components styles sourcemaps are not generated when sourcemaps are hidden.');
|
|
90
|
+
componentsSourceMap = false;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
// extract global css from js files into own css file.
|
|
94
|
+
extraPlugins.push(new core_1.CssExtractRspackPlugin({ filename: `[name]${hashFormat.extract}.css` }));
|
|
95
|
+
const postCss = require('postcss');
|
|
96
|
+
const postCssLoaderPath = require.resolve('postcss-loader');
|
|
97
|
+
const componentStyleLoaders = [
|
|
98
|
+
{
|
|
99
|
+
loader: require.resolve('css-loader'),
|
|
100
|
+
options: {
|
|
101
|
+
url: false,
|
|
102
|
+
sourceMap: componentsSourceMap,
|
|
103
|
+
importLoaders: 1,
|
|
104
|
+
exportType: 'string',
|
|
105
|
+
esModule: false,
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
loader: postCssLoaderPath,
|
|
110
|
+
options: {
|
|
111
|
+
implementation: postCss,
|
|
112
|
+
postcssOptions: postcssOptionsCreator(componentsSourceMap, false),
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
];
|
|
116
|
+
const globalStyleLoaders = [
|
|
117
|
+
{
|
|
118
|
+
loader: core_1.CssExtractRspackPlugin.loader,
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
loader: require.resolve('css-loader'),
|
|
122
|
+
options: {
|
|
123
|
+
url: false,
|
|
124
|
+
sourceMap: !!cssSourceMap,
|
|
125
|
+
importLoaders: 1,
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
loader: postCssLoaderPath,
|
|
130
|
+
options: {
|
|
131
|
+
implementation: postCss,
|
|
132
|
+
postcssOptions: postcssOptionsCreator(false, true),
|
|
133
|
+
sourceMap: !!cssSourceMap,
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
];
|
|
137
|
+
const styleLanguages = [
|
|
138
|
+
{
|
|
139
|
+
extensions: ['css'],
|
|
140
|
+
use: [],
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
extensions: ['scss'],
|
|
144
|
+
use: [
|
|
145
|
+
{
|
|
146
|
+
loader: require.resolve('resolve-url-loader'),
|
|
147
|
+
options: {
|
|
148
|
+
sourceMap: cssSourceMap,
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
loader: require.resolve('sass-loader'),
|
|
153
|
+
options: getSassLoaderOptions(devkit_1.workspaceRoot, includePaths, false, !!buildOptions.verbose, !!buildOptions.preserveSymlinks, buildOptions.stylePreprocessorOptions?.sass),
|
|
154
|
+
},
|
|
155
|
+
],
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
extensions: ['sass'],
|
|
159
|
+
use: [
|
|
160
|
+
{
|
|
161
|
+
loader: require.resolve('resolve-url-loader'),
|
|
162
|
+
options: {
|
|
163
|
+
sourceMap: cssSourceMap,
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
loader: require.resolve('sass-loader'),
|
|
168
|
+
options: getSassLoaderOptions(devkit_1.workspaceRoot, includePaths, true, !!buildOptions.verbose, !!buildOptions.preserveSymlinks, buildOptions.stylePreprocessorOptions?.sass),
|
|
169
|
+
},
|
|
170
|
+
],
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
extensions: ['less'],
|
|
174
|
+
use: [
|
|
175
|
+
{
|
|
176
|
+
loader: require.resolve('less-loader'),
|
|
177
|
+
options: {
|
|
178
|
+
sourceMap: cssSourceMap,
|
|
179
|
+
lessOptions: {
|
|
180
|
+
javascriptEnabled: true,
|
|
181
|
+
paths: includePaths,
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
],
|
|
186
|
+
},
|
|
187
|
+
];
|
|
188
|
+
return {
|
|
189
|
+
loaderRules: styleLanguages.map(({ extensions, use }) => ({
|
|
190
|
+
test: new RegExp(`\\.(?:${extensions.join('|')})$`, 'i'),
|
|
191
|
+
rules: [
|
|
192
|
+
// Setup processing rules for global and component styles
|
|
193
|
+
{
|
|
194
|
+
oneOf: [
|
|
195
|
+
// Global styles are only defined global styles
|
|
196
|
+
{
|
|
197
|
+
use: globalStyleLoaders,
|
|
198
|
+
resourceQuery: /\?ngGlobalStyle/,
|
|
199
|
+
},
|
|
200
|
+
// Component styles are all styles except defined global styles
|
|
201
|
+
{
|
|
202
|
+
use: componentStyleLoaders,
|
|
203
|
+
resourceQuery: /\?ngResource/,
|
|
204
|
+
},
|
|
205
|
+
],
|
|
206
|
+
},
|
|
207
|
+
{ use },
|
|
208
|
+
],
|
|
209
|
+
})),
|
|
210
|
+
plugins: extraPlugins,
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
function assetNameTemplateFactory(hashFormat) {
|
|
214
|
+
const visitedFiles = new Map();
|
|
215
|
+
return (resourcePath) => {
|
|
216
|
+
if (hashFormat.file) {
|
|
217
|
+
// File names are hashed therefore we don't need to handle files with the same file name.
|
|
218
|
+
return `[name]${hashFormat.file}.[ext]`;
|
|
219
|
+
}
|
|
220
|
+
const filename = (0, node_path_1.basename)(resourcePath);
|
|
221
|
+
// Check if the file with the same name has already been processed.
|
|
222
|
+
const visited = visitedFiles.get(filename);
|
|
223
|
+
if (!visited) {
|
|
224
|
+
// Not visited.
|
|
225
|
+
visitedFiles.set(filename, resourcePath);
|
|
226
|
+
return filename;
|
|
227
|
+
}
|
|
228
|
+
else if (visited === resourcePath) {
|
|
229
|
+
// Same file.
|
|
230
|
+
return filename;
|
|
231
|
+
}
|
|
232
|
+
// File has the same name but it's in a different location.
|
|
233
|
+
return '[path][name].[ext]';
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
function getSassLoaderOptions(root, includePaths, indentedSyntax, verbose, preserveSymlinks, deprecationOptions) {
|
|
237
|
+
return {
|
|
238
|
+
api: 'modern-compiler',
|
|
239
|
+
sourceMap: true,
|
|
240
|
+
implementation: require.resolve('sass-embedded'),
|
|
241
|
+
// Webpack importer is only implemented in the legacy API and we have our own custom Webpack importer.
|
|
242
|
+
// See: https://github.com/webpack-contrib/sass-loader/blob/997f3eb41d86dd00d5fa49c395a1aeb41573108c/src/utils.js#L642-L651
|
|
243
|
+
webpackImporter: false,
|
|
244
|
+
sassOptions: (loaderContext) => ({
|
|
245
|
+
importers: [
|
|
246
|
+
getSassResolutionImporter(loaderContext, root, preserveSymlinks),
|
|
247
|
+
],
|
|
248
|
+
loadPaths: includePaths,
|
|
249
|
+
// Use expanded as otherwise sass will remove comments that are needed for autoprefixer
|
|
250
|
+
// Ex: /* autoprefixer grid: autoplace */
|
|
251
|
+
// See: https://github.com/webpack-contrib/sass-loader/blob/45ad0be17264ceada5f0b4fb87e9357abe85c4ff/src/getSassOptions.js#L68-L70
|
|
252
|
+
style: 'expanded',
|
|
253
|
+
// Silences compiler warnings from 3rd party stylesheets
|
|
254
|
+
quietDeps: !verbose,
|
|
255
|
+
verbose,
|
|
256
|
+
syntax: indentedSyntax ? 'indented' : 'scss',
|
|
257
|
+
sourceMapIncludeSources: true,
|
|
258
|
+
...(deprecationOptions || {}),
|
|
259
|
+
}),
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
function getSassResolutionImporter(loaderContext, root, preserveSymlinks) {
|
|
263
|
+
const commonResolverOptions = {
|
|
264
|
+
conditionNames: ['sass', 'style'],
|
|
265
|
+
mainFields: ['sass', 'style', 'main', '...'],
|
|
266
|
+
extensions: ['.scss', '.sass', '.css'],
|
|
267
|
+
restrictions: [/\.((sa|sc|c)ss)$/i],
|
|
268
|
+
preferRelative: true,
|
|
269
|
+
symlinks: !preserveSymlinks,
|
|
270
|
+
};
|
|
271
|
+
// Sass also supports import-only files. If you name a file <name>.import.scss, it will only be loaded for imports, not for @uses.
|
|
272
|
+
// See: https://sass-lang.com/documentation/at-rules/import#import-only-files
|
|
273
|
+
const resolveImport = loaderContext.getResolve({
|
|
274
|
+
byDependency: {
|
|
275
|
+
'sass-import': {
|
|
276
|
+
...commonResolverOptions,
|
|
277
|
+
mainFiles: ['_index.import', '_index', 'index.import', 'index', '...'],
|
|
278
|
+
},
|
|
279
|
+
},
|
|
280
|
+
});
|
|
281
|
+
const resolveModule = loaderContext.getResolve({
|
|
282
|
+
byDependency: {
|
|
283
|
+
'sass-module': {
|
|
284
|
+
...commonResolverOptions,
|
|
285
|
+
mainFiles: ['_index', 'index', '...'],
|
|
286
|
+
},
|
|
287
|
+
},
|
|
288
|
+
});
|
|
289
|
+
return {
|
|
290
|
+
findFileUrl: async (url, { fromImport, containingUrl }) => {
|
|
291
|
+
if (url.charAt(0) === '.') {
|
|
292
|
+
// Let Sass handle relative imports.
|
|
293
|
+
return null;
|
|
294
|
+
}
|
|
295
|
+
let resolveDir = root;
|
|
296
|
+
if (containingUrl) {
|
|
297
|
+
resolveDir = (0, node_path_1.dirname)((0, node_url_1.fileURLToPath)(containingUrl));
|
|
298
|
+
}
|
|
299
|
+
const resolve = fromImport ? resolveImport : resolveModule;
|
|
300
|
+
// Try to resolve from root of workspace
|
|
301
|
+
const result = await tryResolve(resolve, resolveDir, url);
|
|
302
|
+
return result ? (0, node_url_1.pathToFileURL)(result) : null;
|
|
303
|
+
},
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
async function tryResolve(resolve, root, url) {
|
|
307
|
+
const promisifiedResolve = (root, url) => new Promise((res, rej) => {
|
|
308
|
+
resolve(root, url, (err, result) => {
|
|
309
|
+
if (err) {
|
|
310
|
+
rej();
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
res(result);
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
});
|
|
317
|
+
try {
|
|
318
|
+
return await promisifiedResolve(root, url);
|
|
319
|
+
}
|
|
320
|
+
catch {
|
|
321
|
+
// Try to resolve a partial file
|
|
322
|
+
// @use '@material/button/button' as mdc-button;
|
|
323
|
+
// `@material/button/button` -> `@material/button/_button`
|
|
324
|
+
const lastSlashIndex = url.lastIndexOf('/');
|
|
325
|
+
const underscoreIndex = lastSlashIndex + 1;
|
|
326
|
+
if (underscoreIndex > 0 && url.charAt(underscoreIndex) !== '_') {
|
|
327
|
+
const partialFileUrl = `${url.slice(0, underscoreIndex)}_${url.slice(underscoreIndex)}`;
|
|
328
|
+
return promisifiedResolve(root, partialFileUrl).catch(() => undefined);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
return undefined;
|
|
332
|
+
}
|
|
333
|
+
async function getTailwindConfig(searchDirectories, workspaceRoot) {
|
|
334
|
+
const tailwindConfigurationPath = (0, postcss_configuration_1.findTailwindConfiguration)(searchDirectories);
|
|
335
|
+
if (!tailwindConfigurationPath) {
|
|
336
|
+
return undefined;
|
|
337
|
+
}
|
|
338
|
+
// Create a node resolver from the configuration file
|
|
339
|
+
const resolver = (0, node_module_1.createRequire)(tailwindConfigurationPath);
|
|
340
|
+
try {
|
|
341
|
+
return {
|
|
342
|
+
file: tailwindConfigurationPath,
|
|
343
|
+
package: resolver.resolve('tailwindcss'),
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
catch {
|
|
347
|
+
const relativeTailwindConfigPath = (0, node_path_1.relative)(workspaceRoot, tailwindConfigurationPath);
|
|
348
|
+
console.warn(`Tailwind CSS configuration file found (${relativeTailwindConfigPath})` +
|
|
349
|
+
` but the 'tailwindcss' package is not installed.` +
|
|
350
|
+
` To enable Tailwind CSS, please install the 'tailwindcss' package.`);
|
|
351
|
+
}
|
|
352
|
+
return undefined;
|
|
353
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { Configuration } from '@rspack/core';
|
|
2
|
+
import type { AngularRspackPluginOptions } from '../../models';
|
|
3
|
+
export declare function handleConfigurations(defaultOptions: {
|
|
4
|
+
options: AngularRspackPluginOptions;
|
|
5
|
+
rspackConfigOverrides?: Partial<Configuration>;
|
|
6
|
+
}, configurations: Record<string, {
|
|
7
|
+
options: Partial<AngularRspackPluginOptions>;
|
|
8
|
+
rspackConfigOverrides?: Partial<Configuration>;
|
|
9
|
+
}>, configurationModes: string[]): {
|
|
10
|
+
mergedConfigurationBuildOptions: {
|
|
11
|
+
allowedCommonJsDependencies?: string[];
|
|
12
|
+
appShell?: boolean;
|
|
13
|
+
aot?: boolean;
|
|
14
|
+
assets?: import("../../models").AssetElement[];
|
|
15
|
+
baseHref?: string;
|
|
16
|
+
browser?: string;
|
|
17
|
+
budgets?: (Omit<import("@angular/build/private").BudgetEntry, "type"> & {
|
|
18
|
+
type: "all" | "allScript" | "any" | "anyScript" | "anyComponentStyle" | "bundle" | "initial";
|
|
19
|
+
})[];
|
|
20
|
+
commonChunk?: boolean;
|
|
21
|
+
crossOrigin?: "none" | "anonymous" | "use-credentials";
|
|
22
|
+
define?: Record<string, string>;
|
|
23
|
+
deleteOutputPath?: boolean;
|
|
24
|
+
deployUrl?: string;
|
|
25
|
+
devServer?: import("../../models").DevServerOptions;
|
|
26
|
+
externalDependencies?: string[];
|
|
27
|
+
extractLicenses?: boolean;
|
|
28
|
+
fileReplacements?: import("@nx/angular-rspack-compiler").FileReplacement[];
|
|
29
|
+
index?: import("../../models").IndexElement;
|
|
30
|
+
inlineStyleLanguage?: import("@nx/angular-rspack-compiler").InlineStyleLanguage;
|
|
31
|
+
i18nMetadata?: import("../../models").I18nProjectMetadata;
|
|
32
|
+
i18nMissingTranslation?: "warning" | "error" | "ignore";
|
|
33
|
+
i18nDuplicateTranslation?: "warning" | "error" | "ignore";
|
|
34
|
+
localize?: boolean | string[];
|
|
35
|
+
namedChunks?: boolean;
|
|
36
|
+
ngswConfigPath?: string;
|
|
37
|
+
optimization?: boolean | import("../../models").OptimizationOptions;
|
|
38
|
+
outputHashing?: import("../../models").OutputHashing;
|
|
39
|
+
outputPath?: string | (Required<Pick<import("../../models").OutputPath, "base">> & Partial<import("../../models").OutputPath>);
|
|
40
|
+
poll?: number;
|
|
41
|
+
polyfills?: string[];
|
|
42
|
+
prerender?: boolean | {
|
|
43
|
+
routes?: string[];
|
|
44
|
+
routesFile?: string;
|
|
45
|
+
discoverRoutes?: boolean;
|
|
46
|
+
};
|
|
47
|
+
preserveSymlinks?: boolean;
|
|
48
|
+
progress?: boolean;
|
|
49
|
+
root?: string;
|
|
50
|
+
scripts?: import("../../models").ScriptOrStyleEntry[];
|
|
51
|
+
server?: string;
|
|
52
|
+
serviceWorker?: boolean;
|
|
53
|
+
skipTypeChecking?: boolean;
|
|
54
|
+
sourceMap?: boolean | Partial<import("../../models").SourceMap>;
|
|
55
|
+
ssr?: boolean | {
|
|
56
|
+
entry: string;
|
|
57
|
+
experimentalPlatform?: "node" | "neutral";
|
|
58
|
+
};
|
|
59
|
+
statsJson?: boolean;
|
|
60
|
+
stylePreprocessorOptions?: import("@nx/angular-rspack-compiler").StylePreprocessorOptions;
|
|
61
|
+
styles?: import("../../models").ScriptOrStyleEntry[];
|
|
62
|
+
subresourceIntegrity?: boolean;
|
|
63
|
+
tsConfig?: string;
|
|
64
|
+
useTsProjectReferences?: boolean;
|
|
65
|
+
vendorChunk?: boolean;
|
|
66
|
+
verbose?: boolean;
|
|
67
|
+
watch?: boolean;
|
|
68
|
+
webWorkerTsConfig?: string;
|
|
69
|
+
};
|
|
70
|
+
mergedRspackConfigOverrides: Partial<import("@rspack/core").RspackOptions>;
|
|
71
|
+
};
|
|
72
|
+
export declare function parseConfigurationMode(configurationMode: string): string[];
|
|
73
|
+
//# sourceMappingURL=user-defined-config-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-defined-config-helpers.d.ts","sourceRoot":"","sources":["../../../../src/lib/config/config-utils/user-defined-config-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAGlD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAE/D,wBAAgB,oBAAoB,CAClC,cAAc,EAAE;IACd,OAAO,EAAE,0BAA0B,CAAC;IACpC,qBAAqB,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;CAChD,EACD,cAAc,EAAE,MAAM,CACpB,MAAM,EACN;IACE,OAAO,EAAE,OAAO,CAAC,0BAA0B,CAAC,CAAC;IAC7C,qBAAqB,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;CAChD,CACF,EACD,kBAAkB,EAAE,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAwBu2K,CAAC;sBAA2O,CAAC;0BAA8L,CAAC;;;;;;;;;;;;gCAA+lB,CAAC;;;;;;;;;;;;;;EALh5M;AAED,wBAAgB,sBAAsB,CAAC,iBAAiB,EAAE,MAAM,YAE/D"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleConfigurations = handleConfigurations;
|
|
4
|
+
exports.parseConfigurationMode = parseConfigurationMode;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const webpack_merge_1 = require("webpack-merge");
|
|
7
|
+
const deepmerge_1 = tslib_1.__importDefault(require("deepmerge"));
|
|
8
|
+
function handleConfigurations(defaultOptions, configurations, configurationModes) {
|
|
9
|
+
let mergedConfigurationBuildOptions = { ...defaultOptions.options };
|
|
10
|
+
let mergedRspackConfigOverrides = defaultOptions.rspackConfigOverrides ?? {};
|
|
11
|
+
for (const configurationName of configurationModes) {
|
|
12
|
+
if (configurationName in configurations) {
|
|
13
|
+
mergedConfigurationBuildOptions = (0, deepmerge_1.default)(mergedConfigurationBuildOptions, configurations[configurationName].options ?? {});
|
|
14
|
+
if (configurations[configurationName].rspackConfigOverrides) {
|
|
15
|
+
mergedRspackConfigOverrides = (0, webpack_merge_1.merge)(mergedRspackConfigOverrides, configurations[configurationName].rspackConfigOverrides);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return { mergedConfigurationBuildOptions, mergedRspackConfigOverrides };
|
|
20
|
+
}
|
|
21
|
+
function parseConfigurationMode(configurationMode) {
|
|
22
|
+
return configurationMode.split(',').map((m) => m.trim());
|
|
23
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Configuration } from '@rspack/core';
|
|
2
|
+
import { type AngularRspackPluginOptions } from '../models';
|
|
3
|
+
export declare function createConfig(defaultOptions: {
|
|
4
|
+
options: AngularRspackPluginOptions;
|
|
5
|
+
rspackConfigOverrides?: Partial<Configuration>;
|
|
6
|
+
}, configurations?: Record<string, {
|
|
7
|
+
options: Partial<AngularRspackPluginOptions>;
|
|
8
|
+
rspackConfigOverrides?: Partial<Configuration>;
|
|
9
|
+
}>, configEnvVar?: string): Promise<Configuration[]>;
|
|
10
|
+
export declare function _createConfig(options: AngularRspackPluginOptions, rspackConfigOverrides?: Partial<Configuration>): Promise<Configuration[]>;
|
|
11
|
+
//# sourceMappingURL=create-config.d.ts.map
|
|
@@ -0,0 +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;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,CAwC1B"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createConfig = createConfig;
|
|
4
|
+
exports._createConfig = _createConfig;
|
|
5
|
+
const webpack_merge_1 = require("webpack-merge");
|
|
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);
|
|
17
|
+
}
|
|
18
|
+
async function _createConfig(options, rspackConfigOverrides) {
|
|
19
|
+
const { i18n, i18nHash, normalizedOptions } = await (0, helpers_1.normalizeOptionWithI18n)(options);
|
|
20
|
+
const hashFormat = (0, helpers_1.getOutputHashFormat)(normalizedOptions.outputHashing);
|
|
21
|
+
if (normalizedOptions.deleteOutputPath) {
|
|
22
|
+
await (0, helpers_1.deleteOutputDir)(normalizedOptions.root, normalizedOptions.outputPath.base);
|
|
23
|
+
}
|
|
24
|
+
const defaultConfig = await (0, common_config_1.getCommonConfig)(normalizedOptions, i18n, i18nHash, hashFormat);
|
|
25
|
+
const configs = [];
|
|
26
|
+
if (normalizedOptions.hasServer) {
|
|
27
|
+
const serverConfig = await (0, server_config_1.getServerConfig)(normalizedOptions, i18n, defaultConfig);
|
|
28
|
+
const mergedConfig = (0, webpack_merge_1.merge)(serverConfig, rspackConfigOverrides ?? {});
|
|
29
|
+
configs.push(mergedConfig);
|
|
30
|
+
}
|
|
31
|
+
const browserConfig = await (0, browser_config_1.getBrowserConfig)(normalizedOptions, i18n, hashFormat, defaultConfig);
|
|
32
|
+
const mergedConfig = (0, webpack_merge_1.merge)(browserConfig, rspackConfigOverrides ?? {});
|
|
33
|
+
configs.unshift(mergedConfig);
|
|
34
|
+
return configs;
|
|
35
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { AngularRspackPluginOptions } from '../../models';
|
|
2
|
+
export declare function configureI18n(projectRoot: string, options: AngularRspackPluginOptions): Promise<{
|
|
3
|
+
options: AngularRspackPluginOptions;
|
|
4
|
+
i18n: import("@angular/build/private").I18nOptions;
|
|
5
|
+
}>;
|
|
6
|
+
//# sourceMappingURL=create-i18n-options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-i18n-options.d.ts","sourceRoot":"","sources":["../../../../src/lib/config/i18n/create-i18n-options.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAgF/D,wBAAsB,aAAa,CACjC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,0BAA0B;;;GAmFpC"}
|