arui-scripts 23.9.3 → 25.0.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/.turbo/turbo-test.log +13 -11
- package/CHANGELOG.md +38 -0
- package/README.md +4 -1
- package/build/commands/build/build-wrapper.js +2 -2
- package/build/commands/build/client.js +26 -8
- package/build/commands/build/server.js +1 -1
- package/build/commands/bundle-analyze/index.js +10 -10
- package/build/commands/start/server.js +1 -1
- package/build/commands/start-prod/client.js +1 -1
- package/build/commands/start-prod/server.js +1 -1
- package/build/commands/util/build-size-budgets.d.ts +6 -0
- package/build/commands/util/build-size-budgets.js +158 -0
- package/build/commands/util/client-assets-sizes.d.ts +1 -1
- package/build/commands/util/client-assets-sizes.js +2 -2
- package/build/commands/util/{format-webpack-messages.d.ts → format-rspack-messages.d.ts} +1 -1
- package/build/commands/util/{format-webpack-messages.js → format-rspack-messages.js} +2 -2
- package/build/configs/app-configs/get-defaults.js +1 -0
- package/build/configs/app-configs/types.d.ts +14 -4
- package/build/configs/app-configs/types.js +3 -0
- package/build/configs/app-configs/validate-build-size-budgets.d.ts +1 -0
- package/build/configs/app-configs/validate-build-size-budgets.js +31 -0
- package/build/configs/app-configs/validate-config.js +2 -0
- package/build/configs/app-configs/warn-about-deprecations.js +0 -5
- package/build/configs/client-env-config/client-config-plugin.js +2 -3
- package/build/configs/config-extras/minimizers/imagemin/imagemin.d.ts +1 -10
- package/build/configs/config-extras/minimizers/imagemin/imagemin.js +2 -14
- package/build/configs/modules.d.ts +2 -4
- package/build/configs/modules.js +23 -25
- package/build/configs/postcss.d.ts +2 -2
- package/build/configs/rspack.client.d.ts +3 -3
- package/build/configs/rspack.client.dev.js +2 -2
- package/build/configs/rspack.client.js +15 -15
- package/build/configs/rspack.client.prod.d.ts +1 -1
- package/build/configs/rspack.client.prod.js +3 -3
- package/build/configs/rspack.server.dev.d.ts +1 -1
- package/build/configs/rspack.server.dev.js +2 -2
- package/build/configs/rspack.server.prod.d.ts +1 -1
- package/build/configs/rspack.server.prod.js +2 -2
- package/build/configs/util/apply-overrides.d.ts +4 -34
- package/build/configs/util/apply-overrides.js +2 -38
- package/build/configs/util/find-plugin.d.ts +1 -1
- package/build/configs/util/find-plugin.js +1 -1
- package/build/index.d.ts +1 -1
- package/build/index.js +1 -2
- package/docs/cli.md +2 -0
- package/docs/commands.md +5 -0
- package/docs/overrides.md +25 -25
- package/docs/settings.md +37 -2
- package/package.json +7 -5
- package/tsconfig-local.tsbuildinfo +1 -1
- package/build/configs/util/get-webpack-cache-dependencies.d.ts +0 -1
- package/build/configs/util/get-webpack-cache-dependencies.js +0 -15
|
@@ -53,20 +53,8 @@ function getImageMinLoader() {
|
|
|
53
53
|
interlaced: png === null || png === void 0 ? void 0 : png.interlaced,
|
|
54
54
|
},
|
|
55
55
|
],
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
{
|
|
59
|
-
plugins: [
|
|
60
|
-
{
|
|
61
|
-
name: 'preset-default',
|
|
62
|
-
params: {
|
|
63
|
-
// preset-default в svgo вырезает viewBox, без него svg перестают масштабироваться
|
|
64
|
-
overrides: { removeViewBox: false },
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
],
|
|
68
|
-
},
|
|
69
|
-
],
|
|
56
|
+
// imagemin-svgo использует svgo 4, его preset-default уже сохраняет viewBox
|
|
57
|
+
(svg === null || svg === void 0 ? void 0 : svg.enabled) && 'svgo',
|
|
70
58
|
(gif === null || gif === void 0 ? void 0 : gif.enabled) && [
|
|
71
59
|
'gifsicle',
|
|
72
60
|
{
|
|
@@ -3,9 +3,7 @@ import { type CompatModuleConfig } from './app-configs/types';
|
|
|
3
3
|
export declare function haveExposedDefaultModules(): Record<string, string> | undefined;
|
|
4
4
|
export declare const MODULES_ENTRY_NAME = "remoteEntry.js";
|
|
5
5
|
export declare const MODULES_SEPARATE_BUILD_NAME = "wmf";
|
|
6
|
-
export declare function patchMainRspackConfigForModules(
|
|
7
|
-
/** @deprecated используйте `patchMainRspackConfigForModules` */
|
|
8
|
-
export declare const patchMainWebpackConfigForModules: typeof patchMainRspackConfigForModules;
|
|
6
|
+
export declare function patchMainRspackConfigForModules(rspackConf: rspack.Configuration, mode: 'consumer' | 'provider' | 'both'): rspack.RspackOptions;
|
|
9
7
|
export declare function getCssPrefixForModule(module: CompatModuleConfig): string | undefined;
|
|
10
8
|
export declare function getExposeLoadersFormCompatModules(): {
|
|
11
9
|
test: string;
|
|
@@ -16,4 +14,4 @@ export declare function getExposeLoadersFormCompatModules(): {
|
|
|
16
14
|
};
|
|
17
15
|
}[];
|
|
18
16
|
}[];
|
|
19
|
-
export declare function
|
|
17
|
+
export declare function patchRspackConfigForCompat(module: CompatModuleConfig, rspackConf: rspack.Configuration): rspack.RspackOptions;
|
package/build/configs/modules.js
CHANGED
|
@@ -33,12 +33,12 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.
|
|
36
|
+
exports.MODULES_SEPARATE_BUILD_NAME = exports.MODULES_ENTRY_NAME = void 0;
|
|
37
37
|
exports.haveExposedDefaultModules = haveExposedDefaultModules;
|
|
38
38
|
exports.patchMainRspackConfigForModules = patchMainRspackConfigForModules;
|
|
39
39
|
exports.getCssPrefixForModule = getCssPrefixForModule;
|
|
40
40
|
exports.getExposeLoadersFormCompatModules = getExposeLoadersFormCompatModules;
|
|
41
|
-
exports.
|
|
41
|
+
exports.patchRspackConfigForCompat = patchRspackConfigForCompat;
|
|
42
42
|
const rspack = __importStar(require("@rspack/core"));
|
|
43
43
|
const attribute_module_css_1 = require("../plugins/attribute-module-css");
|
|
44
44
|
const postcss_prefix_selector_1 = require("../plugins/postcss-prefix-selector");
|
|
@@ -59,43 +59,43 @@ function getModuleFederationContainerName() {
|
|
|
59
59
|
function getSeparateBuildRuntimeName() {
|
|
60
60
|
return `${getModuleFederationContainerName().replace(/\W/g, '_')}_${exports.MODULES_SEPARATE_BUILD_NAME}`;
|
|
61
61
|
}
|
|
62
|
-
function patchMainRspackConfigForModules(
|
|
62
|
+
function patchMainRspackConfigForModules(rspackConf, mode) {
|
|
63
63
|
var _a, _b;
|
|
64
64
|
/* eslint-disable no-param-reassign */
|
|
65
65
|
const isConsumer = mode === 'consumer' || mode === 'both';
|
|
66
66
|
const isProvider = mode === 'provider' || mode === 'both';
|
|
67
67
|
if (app_configs_1.configs.disableModulesSupport) {
|
|
68
68
|
// проект хочет сам разбираться с WMF и прочими вещами, полностью отключаем обработку модулей на своей стороне
|
|
69
|
-
return
|
|
69
|
+
return rspackConf;
|
|
70
70
|
}
|
|
71
|
-
if (!((_a =
|
|
71
|
+
if (!((_a = rspackConf.module) === null || _a === void 0 ? void 0 : _a.rules) || !rspackConf.plugins) {
|
|
72
72
|
// делаем TS счастливым, на самом деле module и plugins у нас будут всегда
|
|
73
|
-
return
|
|
73
|
+
return rspackConf;
|
|
74
74
|
}
|
|
75
75
|
if (isConsumer) {
|
|
76
76
|
// Добавляем expose loader для библиотек, которые мы хотим вынести в глобальную область видимости
|
|
77
|
-
|
|
77
|
+
rspackConf.module.rules.unshift(...getExposeLoadersFormCompatModules());
|
|
78
78
|
}
|
|
79
|
-
if (!app_configs_1.configs.modules || !
|
|
79
|
+
if (!app_configs_1.configs.modules || !rspackConf.output || !rspackConf.plugins) {
|
|
80
80
|
if (isConsumer) {
|
|
81
81
|
// webpack по умолчанию всегда добавлял runtime для шаринга, даже когда модули не включены.
|
|
82
82
|
// Rspack этого больше не делает, поэтому добавляем плагин для рантайма самостоятельно
|
|
83
|
-
|
|
83
|
+
rspackConf.plugins.push(new rspack.sharing.ProvideSharedPlugin({ provides: {} }));
|
|
84
84
|
}
|
|
85
|
-
return
|
|
85
|
+
return rspackConf;
|
|
86
86
|
}
|
|
87
87
|
const { cssPrefix } = app_configs_1.configs.modules.options || {};
|
|
88
88
|
if (cssPrefix && isProvider) {
|
|
89
|
-
addCssPrefix(
|
|
89
|
+
addCssPrefix(rspackConf, cssPrefix);
|
|
90
90
|
}
|
|
91
|
-
|
|
91
|
+
rspackConf.output.publicPath = haveExposedDefaultModules()
|
|
92
92
|
? 'auto' // Для того чтобы модули могли подключаться из разных мест, нам необходимо использовать auto. Для корректной работы в IE надо подключaть https://github.com/amiller-gh/currentScript-polyfill
|
|
93
93
|
: app_configs_1.configs.publicPath;
|
|
94
94
|
if (mode === 'provider') {
|
|
95
95
|
const uniqueName = getSeparateBuildRuntimeName();
|
|
96
|
-
|
|
96
|
+
rspackConf.output = Object.assign(Object.assign({}, rspackConf.output), { uniqueName, chunkLoadingGlobal: `rspackChunk${uniqueName}` });
|
|
97
97
|
}
|
|
98
|
-
|
|
98
|
+
rspackConf.plugins.push(new rspack.container.ModuleFederationPlugin({
|
|
99
99
|
name: getModuleFederationContainerName(),
|
|
100
100
|
filename: isProvider && app_configs_1.configs.modules.exposes ? exports.MODULES_ENTRY_NAME : undefined,
|
|
101
101
|
shared: (mode === 'provider' && ((_b = app_configs_1.configs.modules.options) === null || _b === void 0 ? void 0 : _b.separateBuildShared)) ||
|
|
@@ -105,7 +105,7 @@ function patchMainRspackConfigForModules(webpackConf, mode) {
|
|
|
105
105
|
}), new turn_off_split_remote_entry_1.TurnOffSplitRemoteEntry(getModuleFederationContainerName()),
|
|
106
106
|
// на провайдере добавляем css чанки модулей в манифест
|
|
107
107
|
...getModuleCssPlugins(isProvider));
|
|
108
|
-
return
|
|
108
|
+
return rspackConf;
|
|
109
109
|
/* eslint-enable no-param-reassign */
|
|
110
110
|
}
|
|
111
111
|
function getModuleCssPlugins(isProvider) {
|
|
@@ -115,8 +115,6 @@ function getModuleCssPlugins(isProvider) {
|
|
|
115
115
|
}
|
|
116
116
|
return [new attribute_module_css_1.AttributeModuleCssPlugin(app_configs_1.configs.modules.exposes, modules_css_manifest_1.modulesCssManifest)];
|
|
117
117
|
}
|
|
118
|
-
/** @deprecated используйте `patchMainRspackConfigForModules` */
|
|
119
|
-
exports.patchMainWebpackConfigForModules = patchMainRspackConfigForModules;
|
|
120
118
|
function getCssPrefixForModule(module) {
|
|
121
119
|
if (module.cssPrefix) {
|
|
122
120
|
return module.cssPrefix;
|
|
@@ -147,9 +145,9 @@ function getExposeLoadersFormCompatModules() {
|
|
|
147
145
|
};
|
|
148
146
|
});
|
|
149
147
|
}
|
|
150
|
-
function addCssPrefix(
|
|
151
|
-
const cssRule = (0, find_loader_1.findLoader)(
|
|
152
|
-
const cssModulesRule = (0, find_loader_1.findLoader)(
|
|
148
|
+
function addCssPrefix(rspackConf, cssPrefix) {
|
|
149
|
+
const cssRule = (0, find_loader_1.findLoader)(rspackConf, '/\\.css$/');
|
|
150
|
+
const cssModulesRule = (0, find_loader_1.findLoader)(rspackConf, '/\\.module\\.css$/');
|
|
153
151
|
addPrefixCssRule(cssRule, cssPrefix);
|
|
154
152
|
addPrefixCssRule(cssModulesRule, `:global(${cssPrefix})`);
|
|
155
153
|
}
|
|
@@ -177,18 +175,18 @@ function addPrefixCssRule(rule, prefix) {
|
|
|
177
175
|
(0, postcss_prefix_selector_1.postCssPrefix)({ prefix: `${prefix} ` }),
|
|
178
176
|
];
|
|
179
177
|
}
|
|
180
|
-
function
|
|
178
|
+
function patchRspackConfigForCompat(module, rspackConf) {
|
|
181
179
|
/* eslint-disable no-param-reassign */
|
|
182
|
-
|
|
180
|
+
rspackConf.externals = Object.assign(Object.assign({}, (rspackConf.externals || {})), (module.externals || {}));
|
|
183
181
|
// Название переменной вебпака, которую он будет использовать для загрузки чанков. Важно чтобы для разных модулей они отличались,
|
|
184
182
|
// иначе несколько модулей из одного приложения будут конфликтовать между собой
|
|
185
183
|
const uniqueName = module.name;
|
|
186
184
|
// Для того чтобы модули могли подключаться из разных мест, нам необходимо использовать publicPath = auto. Для корректной работы в IE надо подключaть https://github.com/amiller-gh/currentScript-polyfill
|
|
187
|
-
|
|
185
|
+
rspackConf.output = Object.assign(Object.assign({}, rspackConf.output), { publicPath: 'auto', uniqueName });
|
|
188
186
|
const cssPrefix = getCssPrefixForModule(module);
|
|
189
187
|
if (cssPrefix) {
|
|
190
|
-
addCssPrefix(
|
|
188
|
+
addCssPrefix(rspackConf, cssPrefix);
|
|
191
189
|
}
|
|
192
|
-
return
|
|
190
|
+
return rspackConf;
|
|
193
191
|
/* eslint-enable no-param-reassign */
|
|
194
192
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export declare const postcssConfig: (string | import("postcss").Processor |
|
|
1
|
+
export declare const postcssConfig: (string | [string, unknown] | import("postcss").Processor | {
|
|
2
2
|
postcssPlugin: string;
|
|
3
3
|
})[];
|
|
4
|
-
export declare const serverPostcssConfig: (string | import("postcss").Processor |
|
|
4
|
+
export declare const serverPostcssConfig: (string | [string, unknown] | import("postcss").Processor | {
|
|
5
5
|
postcssPlugin: string;
|
|
6
6
|
})[];
|
|
@@ -3,8 +3,8 @@ import { type Entry } from './util/get-entry';
|
|
|
3
3
|
/**
|
|
4
4
|
* Создает конфигурацию для сборки клиентского кода. Может быть использована для создания дополнительных конфигураций.
|
|
5
5
|
* @param mode Режим сборки (dev или prod)
|
|
6
|
-
* @param entry Точка входа, любой валидный вход для
|
|
6
|
+
* @param entry Точка входа, любой валидный вход для rspack
|
|
7
7
|
* @param configName Имя конфигурации, если не указано, то используется имя по умолчанию
|
|
8
8
|
*/
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const
|
|
9
|
+
export declare const createSingleClientRspackConfig: (mode: "dev" | "prod", entry: Entry, configName?: string) => Configuration;
|
|
10
|
+
export declare const createClientRspackConfig: (mode: "dev" | "prod") => import("@rspack/core", { with: { "resolution-mode": "import" } }).RspackOptions | import("@rspack/core", { with: { "resolution-mode": "import" } }).RspackOptions[];
|
|
@@ -5,8 +5,8 @@ const apply_overrides_1 = require("./util/apply-overrides");
|
|
|
5
5
|
const find_loader_1 = require("./util/find-loader");
|
|
6
6
|
const find_plugin_1 = require("./util/find-plugin");
|
|
7
7
|
const rspack_client_1 = require("./rspack.client");
|
|
8
|
-
exports.config = (0, apply_overrides_1.applyOverrides)(['rspack', 'rspackClient', 'rspackDev', 'rspackClientDev'], (0, rspack_client_1.
|
|
9
|
-
|
|
8
|
+
exports.config = (0, apply_overrides_1.applyOverrides)(['rspack', 'rspackClient', 'rspackDev', 'rspackClientDev'], (0, rspack_client_1.createClientRspackConfig)('dev'), {
|
|
9
|
+
createSingleClientRspackConfig: rspack_client_1.createSingleClientRspackConfig.bind(null, 'dev'),
|
|
10
10
|
findLoader: find_loader_1.findLoader,
|
|
11
11
|
findPlugin: (0, find_plugin_1.createFindPluginFunction)(),
|
|
12
12
|
});
|
|
@@ -36,7 +36,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
39
|
+
exports.createClientRspackConfig = exports.createSingleClientRspackConfig = void 0;
|
|
40
40
|
const path_1 = __importDefault(require("path"));
|
|
41
41
|
const zlib = __importStar(require("zlib"));
|
|
42
42
|
const react_refresh_typescript_1 = __importDefault(require("react-refresh-typescript"));
|
|
@@ -120,11 +120,11 @@ function getMinimizeConfig(mode) {
|
|
|
120
120
|
/**
|
|
121
121
|
* Создает конфигурацию для сборки клиентского кода. Может быть использована для создания дополнительных конфигураций.
|
|
122
122
|
* @param mode Режим сборки (dev или prod)
|
|
123
|
-
* @param entry Точка входа, любой валидный вход для
|
|
123
|
+
* @param entry Точка входа, любой валидный вход для rspack
|
|
124
124
|
* @param configName Имя конфигурации, если не указано, то используется имя по умолчанию
|
|
125
125
|
*/
|
|
126
126
|
// eslint-disable-next-line complexity
|
|
127
|
-
const
|
|
127
|
+
const createSingleClientRspackConfig = (mode, entry, configName) => (Object.assign(Object.assign({}, (configName ? { name: configName } : {})), { target: 'browserslist', mode: mode === 'dev' ? 'development' : 'production', devtool: mode === 'dev' ? app_configs_1.configs.devSourceMaps : 'source-map', entry: (0, get_entry_1.getEntry)(entry, getSingleEntry, mode),
|
|
128
128
|
// in production mode we need to fail on first error
|
|
129
129
|
bail: mode === 'prod', context: app_configs_1.configs.cwd, experiments: {
|
|
130
130
|
css: false,
|
|
@@ -377,32 +377,32 @@ const createSingleClientWebpackConfig = (mode, entry, configName) => (Object.ass
|
|
|
377
377
|
performance: {
|
|
378
378
|
hints: false,
|
|
379
379
|
} }));
|
|
380
|
-
exports.
|
|
381
|
-
const
|
|
380
|
+
exports.createSingleClientRspackConfig = createSingleClientRspackConfig;
|
|
381
|
+
const createClientRspackConfig = (mode) => {
|
|
382
382
|
var _a, _b, _c;
|
|
383
|
-
const
|
|
383
|
+
const baseRspackConfig = [(0, exports.createSingleClientRspackConfig)(mode, app_configs_1.configs.clientEntry)];
|
|
384
384
|
if ((_b = (_a = app_configs_1.configs.modules) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.useSeparateBuild) {
|
|
385
|
-
|
|
386
|
-
|
|
385
|
+
baseRspackConfig[0] = (0, modules_1.patchMainRspackConfigForModules)(baseRspackConfig[0], 'consumer');
|
|
386
|
+
baseRspackConfig.push((0, modules_1.patchMainRspackConfigForModules)((0, exports.createSingleClientRspackConfig)(mode, {}, modules_1.MODULES_SEPARATE_BUILD_NAME), 'provider'));
|
|
387
387
|
}
|
|
388
388
|
else {
|
|
389
|
-
|
|
389
|
+
baseRspackConfig[0] = (0, modules_1.patchMainRspackConfigForModules)(baseRspackConfig[0], 'both');
|
|
390
390
|
}
|
|
391
391
|
const exposedCompatModules = (_c = app_configs_1.configs.compatModules) === null || _c === void 0 ? void 0 : _c.exposes;
|
|
392
392
|
if (!exposedCompatModules || Object.keys(exposedCompatModules).length === 0) {
|
|
393
|
-
return
|
|
393
|
+
return baseRspackConfig.length === 1 ? baseRspackConfig[0] : baseRspackConfig;
|
|
394
394
|
}
|
|
395
395
|
// Добавляем отдельные конфигурации для compat модулей
|
|
396
|
-
const
|
|
396
|
+
const modulesRspackConfigs = Object.keys(exposedCompatModules).map((moduleName) => {
|
|
397
397
|
const module = Object.assign({ name: moduleName }, exposedCompatModules[moduleName]);
|
|
398
|
-
const config = (0, exports.
|
|
398
|
+
const config = (0, exports.createSingleClientRspackConfig)(mode, {
|
|
399
399
|
[module.name]: module.entry,
|
|
400
400
|
}, module.name);
|
|
401
|
-
return (0, modules_1.
|
|
401
|
+
return (0, modules_1.patchRspackConfigForCompat)(module, config);
|
|
402
402
|
});
|
|
403
|
-
return [...
|
|
403
|
+
return [...baseRspackConfig, ...modulesRspackConfigs];
|
|
404
404
|
};
|
|
405
|
-
exports.
|
|
405
|
+
exports.createClientRspackConfig = createClientRspackConfig;
|
|
406
406
|
function getCodeLoader(mode) {
|
|
407
407
|
var _a, _b, _c;
|
|
408
408
|
if (app_configs_1.configs.codeLoader === 'swc') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const rspackClientConfig: import("@rspack/core", { with: { "resolution-mode": "import" } }).RspackOptions | import("@rspack/core", { with: { "resolution-mode": "import" } }).RspackOptions[];
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.rspackClientConfig = void 0;
|
|
4
4
|
const apply_overrides_1 = require("./util/apply-overrides");
|
|
5
5
|
const find_loader_1 = require("./util/find-loader");
|
|
6
6
|
const find_plugin_1 = require("./util/find-plugin");
|
|
7
7
|
const rspack_client_1 = require("./rspack.client");
|
|
8
|
-
exports.
|
|
9
|
-
|
|
8
|
+
exports.rspackClientConfig = (0, apply_overrides_1.applyOverrides)(['rspack', 'rspackClient', 'rspackProd', 'rspackClientProd'], (0, rspack_client_1.createClientRspackConfig)('prod'), {
|
|
9
|
+
createSingleClientRspackConfig: rspack_client_1.createSingleClientRspackConfig.bind(null, 'prod'),
|
|
10
10
|
findLoader: find_loader_1.findLoader,
|
|
11
11
|
findPlugin: (0, find_plugin_1.createFindPluginFunction)(),
|
|
12
12
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const rspackServerConfig: import("@rspack/core", { with: { "resolution-mode": "import" } }).RspackOptions;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.rspackServerConfig = void 0;
|
|
4
4
|
const apply_overrides_1 = require("./util/apply-overrides");
|
|
5
5
|
const find_loader_1 = require("./util/find-loader");
|
|
6
6
|
const find_plugin_1 = require("./util/find-plugin");
|
|
7
7
|
const rspack_server_1 = require("./rspack.server");
|
|
8
|
-
exports.
|
|
8
|
+
exports.rspackServerConfig = (0, apply_overrides_1.applyOverrides)(['rspack', 'rspackServer', 'rspackDev', 'rspackServerDev'], (0, rspack_server_1.createServerConfig)('dev'), { findLoader: find_loader_1.findLoader, findPlugin: (0, find_plugin_1.createFindPluginFunction)() });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const rspackServerConfig: import("@rspack/core", { with: { "resolution-mode": "import" } }).RspackOptions;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.rspackServerConfig = void 0;
|
|
4
4
|
const apply_overrides_1 = require("./util/apply-overrides");
|
|
5
5
|
const find_loader_1 = require("./util/find-loader");
|
|
6
6
|
const find_plugin_1 = require("./util/find-plugin");
|
|
7
7
|
const rspack_server_1 = require("./rspack.server");
|
|
8
|
-
exports.
|
|
8
|
+
exports.rspackServerConfig = (0, apply_overrides_1.applyOverrides)(['rspack', 'rspackServer', 'rspackProd', 'rspackServerProd'], (0, rspack_server_1.createServerConfig)('prod'), { findLoader: find_loader_1.findLoader, findPlugin: (0, find_plugin_1.createFindPluginFunction)() });
|
|
@@ -2,7 +2,7 @@ import type * as rspack from '@rspack/core';
|
|
|
2
2
|
import { type Configuration as RspackDevServerConfiguration } from '@rspack/dev-server';
|
|
3
3
|
import { type Options as SwcOptions } from '@swc/core';
|
|
4
4
|
import { type AppContextWithConfigs } from '../app-configs/types';
|
|
5
|
-
import { type
|
|
5
|
+
import { type createSingleClientRspackConfig } from '../rspack.client';
|
|
6
6
|
import { type findLoader } from './find-loader';
|
|
7
7
|
import { type createFindPluginFunction } from './find-plugin';
|
|
8
8
|
type Overrides = {
|
|
@@ -42,22 +42,10 @@ type Overrides = {
|
|
|
42
42
|
serverExternalsExemptions: Array<string | RegExp>;
|
|
43
43
|
html: string;
|
|
44
44
|
};
|
|
45
|
-
declare const DEPRECATED_OVERRIDE_KEYS: {
|
|
46
|
-
readonly webpack: "rspack";
|
|
47
|
-
readonly webpackClient: "rspackClient";
|
|
48
|
-
readonly webpackDev: "rspackDev";
|
|
49
|
-
readonly webpackClientDev: "rspackClientDev";
|
|
50
|
-
readonly webpackServer: "rspackServer";
|
|
51
|
-
readonly webpackServerDev: "rspackServerDev";
|
|
52
|
-
readonly webpackProd: "rspackProd";
|
|
53
|
-
readonly webpackClientProd: "rspackClientProd";
|
|
54
|
-
readonly webpackServerProd: "rspackServerProd";
|
|
55
|
-
};
|
|
56
|
-
type DeprecatedOverrideKey = keyof typeof DEPRECATED_OVERRIDE_KEYS;
|
|
57
45
|
type OmitFirstArg<F> = F extends (x: any, ...args: infer P) => infer R ? (...args: P) => R : never;
|
|
58
|
-
type
|
|
46
|
+
type BoundCreateSingleClientRspackConfig = OmitFirstArg<typeof createSingleClientRspackConfig>;
|
|
59
47
|
type ClientRspackAdditionalArgs = {
|
|
60
|
-
|
|
48
|
+
createSingleClientRspackConfig: BoundCreateSingleClientRspackConfig;
|
|
61
49
|
findLoader: typeof findLoader;
|
|
62
50
|
findPlugin: ReturnType<typeof createFindPluginFunction<'client'>>;
|
|
63
51
|
};
|
|
@@ -78,29 +66,11 @@ type OverridesAdditionalArgs = {
|
|
|
78
66
|
rspackServer: ServerRspackAdditionalArgs;
|
|
79
67
|
rspackServerDev: ServerRspackAdditionalArgs;
|
|
80
68
|
rspackServerProd: ServerRspackAdditionalArgs;
|
|
81
|
-
/** @deprecated используйте rspack */
|
|
82
|
-
webpack: ClientRspackAdditionalArgs;
|
|
83
|
-
/** @deprecated используйте rspackClient */
|
|
84
|
-
webpackClient: ClientRspackAdditionalArgs;
|
|
85
|
-
/** @deprecated используйте rspackDev */
|
|
86
|
-
webpackDev: ClientRspackAdditionalArgs;
|
|
87
|
-
/** @deprecated используйте rspackClientDev */
|
|
88
|
-
webpackClientDev: ClientRspackAdditionalArgs;
|
|
89
|
-
/** @deprecated используйте rspackProd */
|
|
90
|
-
webpackProd: ClientRspackAdditionalArgs;
|
|
91
|
-
/** @deprecated используйте rspackClientProd */
|
|
92
|
-
webpackClientProd: ClientRspackAdditionalArgs;
|
|
93
|
-
/** @deprecated используйте rspackServer */
|
|
94
|
-
webpackServer: ServerRspackAdditionalArgs;
|
|
95
|
-
/** @deprecated используйте rspackServerDev */
|
|
96
|
-
webpackServerDev: ServerRspackAdditionalArgs;
|
|
97
|
-
/** @deprecated используйте rspackServerProd */
|
|
98
|
-
webpackServerProd: ServerRspackAdditionalArgs;
|
|
99
69
|
};
|
|
100
70
|
type OverrideFunction<K extends keyof Overrides> = (config: Overrides[K], appConfig: AppContextWithConfigs, additionalArgs: K extends keyof OverridesAdditionalArgs ? OverridesAdditionalArgs[K] : undefined) => Overrides[K];
|
|
101
71
|
export type OverrideFile = {
|
|
102
72
|
[K in keyof Overrides]?: OverrideFunction<K>;
|
|
103
|
-
}
|
|
73
|
+
};
|
|
104
74
|
/**
|
|
105
75
|
* Объявлен ли оверрайд с таким ключом хоть в одном файле оверрайдов. Нужно, чтобы предупреждать об
|
|
106
76
|
* устаревших ключах только тем, кто ими действительно пользуется.
|
|
@@ -3,40 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.hasOverride = hasOverride;
|
|
4
4
|
exports.applyOverrides = applyOverrides;
|
|
5
5
|
const app_configs_1 = require("../app-configs");
|
|
6
|
-
// Маппинг устаревших webpack-ключей оверрайдов на актуальные ключи для rspack
|
|
7
|
-
// Поддержка webpack-ключей будет скоро удалена.
|
|
8
|
-
const DEPRECATED_OVERRIDE_KEYS = {
|
|
9
|
-
webpack: 'rspack',
|
|
10
|
-
webpackClient: 'rspackClient',
|
|
11
|
-
webpackDev: 'rspackDev',
|
|
12
|
-
webpackClientDev: 'rspackClientDev',
|
|
13
|
-
webpackServer: 'rspackServer',
|
|
14
|
-
webpackServerDev: 'rspackServerDev',
|
|
15
|
-
webpackProd: 'rspackProd',
|
|
16
|
-
webpackClientProd: 'rspackClientProd',
|
|
17
|
-
webpackServerProd: 'rspackServerProd',
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* Переносит устаревшие webpack-ключи оверрайдов на актуальные rspack-ключи и
|
|
21
|
-
* предупреждает о необходимости миграции. Если заданы оба ключа — приоритет у
|
|
22
|
-
* нового, устаревший игнорируется.
|
|
23
|
-
*/
|
|
24
|
-
function normalizeDeprecatedOverrideKeys(override) {
|
|
25
|
-
const result = Object.assign({}, override);
|
|
26
|
-
Object.keys(DEPRECATED_OVERRIDE_KEYS).forEach((deprecatedKey) => {
|
|
27
|
-
if (!Object.prototype.hasOwnProperty.call(result, deprecatedKey)) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
const newKey = DEPRECATED_OVERRIDE_KEYS[deprecatedKey];
|
|
31
|
-
console.warn(`[arui-scripts] Ключ оверрайда "${deprecatedKey}" устарел, используйте "${newKey}". ` +
|
|
32
|
-
`Поддержка "${deprecatedKey}" будет скоре удалена.`);
|
|
33
|
-
if (!Object.prototype.hasOwnProperty.call(result, newKey)) {
|
|
34
|
-
result[newKey] = result[deprecatedKey];
|
|
35
|
-
}
|
|
36
|
-
delete result[deprecatedKey];
|
|
37
|
-
});
|
|
38
|
-
return result;
|
|
39
|
-
}
|
|
40
6
|
let overrides = [];
|
|
41
7
|
overrides = app_configs_1.configs.overridesPath.map((path) => {
|
|
42
8
|
try {
|
|
@@ -45,9 +11,9 @@ overrides = app_configs_1.configs.overridesPath.map((path) => {
|
|
|
45
11
|
// eslint-disable-next-line no-underscore-dangle
|
|
46
12
|
if (requireResult.__esModule) {
|
|
47
13
|
// ts-node импортирует esModules, из них надо вытягивать default именно так
|
|
48
|
-
return
|
|
14
|
+
return requireResult.default;
|
|
49
15
|
}
|
|
50
|
-
return
|
|
16
|
+
return requireResult;
|
|
51
17
|
}
|
|
52
18
|
catch (e) {
|
|
53
19
|
console.error(`Unable to process override file "${path}"`);
|
|
@@ -82,8 +48,6 @@ function applyOverrides(overridesKey, config, args) {
|
|
|
82
48
|
throw new TypeError(`Override ${key} must be a function`);
|
|
83
49
|
}
|
|
84
50
|
// eslint-disable-next-line no-param-reassign
|
|
85
|
-
// @ts-expect-error Union type conflict between rspack and deprecated webpack keys - resolved at runtime
|
|
86
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any,no-param-reassign
|
|
87
51
|
config = overrideFn(config, app_configs_1.configs, args);
|
|
88
52
|
}
|
|
89
53
|
});
|
|
@@ -23,7 +23,7 @@ type PluginsListClient = {
|
|
|
23
23
|
options: MiniCssExtractPlugin.PluginOptions;
|
|
24
24
|
runtimeOptions: MiniCssExtractPlugin.RuntimeOptions;
|
|
25
25
|
};
|
|
26
|
-
|
|
26
|
+
TsCheckerRspackPlugin: {
|
|
27
27
|
options: TsCheckerRspackPluginOptions;
|
|
28
28
|
};
|
|
29
29
|
IgnorePlugin: {
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createFindPluginFunction = createFindPluginFunction;
|
|
4
4
|
function createFindPluginFunction() {
|
|
5
5
|
/**
|
|
6
|
-
* @param config конфигурация
|
|
6
|
+
* @param config конфигурация rspack
|
|
7
7
|
* @param pluginName имя плагина
|
|
8
8
|
* @returns плагин или плагины, которые подошли под условие из testRule
|
|
9
9
|
*/
|
package/build/index.d.ts
CHANGED
|
@@ -16,4 +16,4 @@ export { getDockerBuildCommand } from './commands/util/docker-build';
|
|
|
16
16
|
*/
|
|
17
17
|
export { getArtifactsOptions, getResolvedArtifactsConfig } from './commands/util/artifacts-config';
|
|
18
18
|
export { buildDockerImage, getBuildParams, renderBaseNginxConf, renderDockerfile, renderDockerfileCompiled, renderTemplates, renderNginxConf, renderStartScript, resolveArtifactsConfig, type ArtifactsOptions, type ArtifactTemplateOverrides, type ArtifactTemplates, type ResolvedArtifactsConfig, } from '@alfalab/arui-scripts-artifacts';
|
|
19
|
-
export { patchMainRspackConfigForModules
|
|
19
|
+
export { patchMainRspackConfigForModules } from './configs/modules';
|
package/build/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.patchMainRspackConfigForModules = exports.resolveArtifactsConfig = exports.renderStartScript = exports.renderNginxConf = exports.renderTemplates = exports.renderDockerfileCompiled = exports.renderDockerfile = exports.renderBaseNginxConf = exports.getBuildParams = exports.buildDockerImage = exports.getResolvedArtifactsConfig = exports.getArtifactsOptions = exports.getDockerBuildCommand = exports.getBuildParamsFromArgs = exports.prepareFilesForDocker = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Утилиты сборки docker-образа, привязанные к глобальному конфигу arui-scripts.
|
|
6
6
|
* @deprecated Используйте `@alfalab/arui-scripts-artifacts` — там те же функции принимают явный конфиг.
|
|
@@ -33,4 +33,3 @@ Object.defineProperty(exports, "renderStartScript", { enumerable: true, get: fun
|
|
|
33
33
|
Object.defineProperty(exports, "resolveArtifactsConfig", { enumerable: true, get: function () { return arui_scripts_artifacts_1.resolveArtifactsConfig; } });
|
|
34
34
|
var modules_1 = require("./configs/modules");
|
|
35
35
|
Object.defineProperty(exports, "patchMainRspackConfigForModules", { enumerable: true, get: function () { return modules_1.patchMainRspackConfigForModules; } });
|
|
36
|
-
Object.defineProperty(exports, "patchMainWebpackConfigForModules", { enumerable: true, get: function () { return modules_1.patchMainWebpackConfigForModules; } });
|
package/docs/cli.md
CHANGED
|
@@ -21,3 +21,5 @@ npx create-arui-scripts-app my-app
|
|
|
21
21
|
Полный список и описание — в [docs/commands.md](commands.md):
|
|
22
22
|
`start`, `start:prod`, `build`, `docker-build`, `docker-build:compiled`, `test`, `test:vitest`,
|
|
23
23
|
`archive-build`, `bundle-analyze`, `ensure-yarn`, `changelog`.
|
|
24
|
+
|
|
25
|
+
При production-сборке можно включить [проверку размера начального JS и CSS](settings.md#buildsizebudgets). Лимиты задаются через `buildSizeBudgets`; их превышение завершает сборку с ненулевым кодом.
|
package/docs/commands.md
CHANGED
|
@@ -33,6 +33,8 @@ arui-scripts start:prod
|
|
|
33
33
|
|
|
34
34
|
Собирает клиентский и серверный код в production-режиме.
|
|
35
35
|
|
|
36
|
+
Если заданы [buildSizeBudgets](settings.md#buildsizebudgets), после клиентской сборки проверяются лимиты начального JS и CSS. Превышение останавливает сборку с ненулевым кодом.
|
|
37
|
+
|
|
36
38
|
**Как запустить?**
|
|
37
39
|
|
|
38
40
|
```bash
|
|
@@ -76,6 +78,9 @@ arui-scripts test
|
|
|
76
78
|
|
|
77
79
|
Команда `arui-scripts test:vitest` запускает unit тесты через [Vitest](https://vitest.dev/).
|
|
78
80
|
|
|
81
|
+
Vitest требует Node.js 22.12 или новее. Ему также нужен `vite` (peer-зависимость), `arui-scripts` устанавливает его сам.
|
|
82
|
+
Если `vitest` подключен в проект напрямую и используется yarn, добавьте `vite` в `devDependencies` проекта (yarn не устанавливает peer-зависимости автоматически).
|
|
83
|
+
|
|
79
84
|
Если в корне проекта есть `vitest.config.ts` (или `.js`, `.mjs`, `.cjs`), то используется он.
|
|
80
85
|
Иначе применяется конфигурация arui-scripts.
|
|
81
86
|
|