arui-scripts 18.6.1 → 19.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 +6 -10
- package/CHANGELOG.md +31 -0
- package/build/commands/build/build-wrapper.d.ts +3 -3
- package/build/commands/build/build-wrapper.js +2 -2
- package/build/commands/bundle-analyze/index.js +5 -3
- package/build/commands/util/client-assets-sizes.d.ts +1 -1
- package/build/commands/util/run-client-dev-server.d.ts +1 -1
- package/build/commands/util/run-client-dev-server.js +6 -6
- package/build/commands/util/run-server-watch-compiler.d.ts +2 -2
- package/build/commands/util/run-server-watch-compiler.js +2 -2
- package/build/configs/app-configs/calculate-dependent-config.js +1 -1
- package/build/configs/app-configs/get-defaults.js +4 -7
- package/build/configs/app-configs/types.d.ts +4 -17
- package/build/configs/app-configs/warn-about-deprecations.js +14 -5
- package/build/configs/babel-client.js +1 -1
- package/build/configs/babel-dependencies.js +1 -1
- package/build/configs/babel-server.js +1 -1
- package/build/configs/client-env-config/client-config-plugin.d.ts +1 -1
- package/build/configs/config-extras/minimizers/imagemin/imagemin.d.ts +27 -1
- package/build/configs/config-extras/minimizers/imagemin/imagemin.js +55 -41
- package/build/configs/dev-server.js +39 -30
- package/build/configs/modules.d.ts +3 -3
- package/build/configs/modules.js +25 -2
- package/build/configs/stats-options.d.ts +2 -2
- package/build/configs/util/apply-overrides.d.ts +12 -12
- package/build/configs/util/find-loader.d.ts +2 -2
- package/build/configs/util/find-plugin.d.ts +9 -6
- package/build/configs/webpack.client.d.ts +2 -2
- package/build/configs/webpack.client.dev.d.ts +1 -1
- package/build/configs/webpack.client.js +23 -55
- package/build/configs/webpack.client.prod.d.ts +1 -1
- package/build/configs/webpack.server.d.ts +1 -1
- package/build/configs/webpack.server.dev.d.ts +1 -1
- package/build/configs/webpack.server.js +13 -43
- package/build/configs/webpack.server.prod.d.ts +1 -1
- package/build/plugins/arui-runtime/arui-runtime-module.d.ts +2 -2
- package/build/plugins/arui-runtime/arui-runtime-module.js +5 -8
- package/build/plugins/arui-runtime/index.d.ts +2 -2
- package/build/plugins/arui-runtime/index.js +2 -5
- package/build/plugins/reload-server-plugin.d.ts +10 -0
- package/build/plugins/reload-server-plugin.js +44 -0
- package/build/plugins/watch-missing-node-modules-plugin.d.ts +5 -5
- package/build/plugins/watch-missing-node-modules-plugin.js +3 -1
- package/build/tsconfig-local.tsbuildinfo +1 -1
- package/docs/commands.md +1 -1
- package/docs/settings.md +10 -33
- package/package.json +8 -6
- package/build/plugins/reload-server-webpack-plugin.d.ts +0 -9
- package/build/plugins/reload-server-webpack-plugin.js +0 -44
package/.turbo/turbo-test.log
CHANGED
|
@@ -5,23 +5,19 @@ ts-jest[versions] (WARN) Version 29.7.0 of jest installed has not been tested wi
|
|
|
5
5
|
ts-jest[versions] (WARN) Version 5.6.3 of typescript installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=4.3.0 <5.0.0-0). Please do not report issues in ts-jest if you are using unsupported versions.
|
|
6
6
|
ts-jest[versions] (WARN) Version 5.6.3 of typescript installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=4.3.0 <5.0.0-0). Please do not report issues in ts-jest if you are using unsupported versions.
|
|
7
7
|
ts-jest[versions] (WARN) Version 5.6.3 of typescript installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=4.3.0 <5.0.0-0). Please do not report issues in ts-jest if you are using unsupported versions.
|
|
8
|
-
PASS src/configs/app-configs/__tests__/update-with-presets.tests.ts (
|
|
8
|
+
PASS src/configs/app-configs/__tests__/update-with-presets.tests.ts (26.447 s)
|
|
9
9
|
PASS src/configs/util/__tests__/get-polyfills.tests.ts
|
|
10
|
-
PASS src/plugins/postcss-global-variables/utils/__tests__/add-global-variable.tests.ts (24.93 s)
|
|
11
10
|
PASS src/configs/util/__tests__/apply-overrides.tests.ts
|
|
12
11
|
PASS src/configs/app-configs/__tests__/update-with-env.tests.ts
|
|
12
|
+
PASS src/plugins/postcss-global-variables/utils/__tests__/add-global-variable.tests.ts (27.198 s)
|
|
13
13
|
PASS src/configs/app-configs/__tests__/update-with-package.tests.ts
|
|
14
|
+
PASS src/configs/app-configs/__tests__/validate-settings-keys.tests.ts
|
|
14
15
|
PASS src/plugins/postcss-global-variables/utils/__tests__/parse-variables.tests.ts
|
|
15
16
|
PASS src/plugins/postcss-global-variables/utils/__tests__/get-media-query-name.tests.ts
|
|
16
|
-
PASS src/configs/
|
|
17
|
-
Failed to load /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/tsconfig.json: Missing baseUrl in compilerOptions
|
|
18
|
-
Failed to load /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/tsconfig.json: Missing baseUrl in compilerOptions
|
|
19
|
-
Failed to load /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/tsconfig.json: Missing baseUrl in compilerOptions
|
|
20
|
-
Failed to load /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/tsconfig.json: Missing baseUrl in compilerOptions
|
|
21
|
-
PASS src/configs/util/__tests__/find-plugin.tests.ts (26.783 s)
|
|
17
|
+
PASS src/configs/util/__tests__/find-plugin.tests.ts (28.961 s)
|
|
22
18
|
|
|
23
19
|
Test Suites: 10 passed, 10 total
|
|
24
|
-
Tests:
|
|
20
|
+
Tests: 26 passed, 26 total
|
|
25
21
|
Snapshots: 0 total
|
|
26
|
-
Time:
|
|
22
|
+
Time: 30.115 s
|
|
27
23
|
Ran all test suites.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# [15.3.0](https://github.com/core-ds/arui-scripts/compare/v15.2.0...v15.3.0) (2023-06-30)
|
|
2
2
|
|
|
3
|
+
## 19.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#279](https://github.com/core-ds/arui-scripts/pull/279) [`827742a`](https://github.com/core-ds/arui-scripts/commit/827742ade65d80f3b20d000349d443560fc57b35) Thanks [@heymdall-legal](https://github.com/heymdall-legal)! - - Теперь как основной сборочный инструмент используется rspack.
|
|
8
|
+
|
|
9
|
+
Для большинства проектов миграция должна пройти максимально незаметно, rspack сохраняет обратную совместимость с webpack
|
|
10
|
+
в большинстве случаев. Подробнее о несовместимых изменениях можно почитать в документации [rspack](https://rspack.dev/guide/migration/webpack).
|
|
11
|
+
Наибольший прирост в производительности можно получить при использовании `swc` как [codeLoader](https://github.com/core-ds/arui-scripts/blob/master/packages/arui-scripts/docs/settings.md#codeLoader).
|
|
12
|
+
|
|
13
|
+
- Изменен дефолт для настройки `codeLoader`. Теперь по умолчанию используется `swc`. Для возврата к предыдущему поведению используйте `babel`.
|
|
14
|
+
- Изменен дефолт для настройки `jestCodeTransformer`. Теперь по умолчанию используется `swc`.
|
|
15
|
+
- Удалена опция `jestUseTsJest`. Используйте настройку `jestCodeTransformer` со значением `tsc` как замену.
|
|
16
|
+
- Удалена опция `useTscLoader`. Используйте настройку `codeLoader` со значением `tsc` как замену.
|
|
17
|
+
- Изменен формат настройки [`proxy`](https://github.com/core-ds/arui-scripts/blob/master/packages/arui-scripts/docs/settings.md#proxy) - теперь она
|
|
18
|
+
принимает массив объектов, а не объект. arui-scripts попробует преобразовать конфигурацию старого формата в новый, но рекомендуется обновить конфигурацию самостоятельно.
|
|
19
|
+
- Удалена опция `webpack4Compatibility`.
|
|
20
|
+
- Если вы использовали `babel-plugin-istanbul` для сбора code coverage - с настройками по умолчанию это больше не будет работать из-за замены babel на swc.
|
|
21
|
+
Рекомендуется использовать настройку [collectCoverage](https://github.com/core-ds/arui-scripts/blob/master/packages/arui-scripts/docs/settings.md#collectcoverage).
|
|
22
|
+
- Команда [bundle-analyze](https://github.com/core-ds/arui-scripts/blob/master/packages/arui-scripts/docs/commands.md#bundle-analyze) теперь так же запускает [rsdoctor](https://rsdoctor.dev/).
|
|
23
|
+
- Изменен дефолт для `devSourceMaps`, теперь по умолчанию используется `inline-cheap-source-map`.
|
|
24
|
+
|
|
25
|
+
При активном использовании оверрайдов скорее всего вы столкнетесь с различиями в конфигурациях. Информацию о том, как
|
|
26
|
+
мигрировать с webpack на rspack, и о различиях в их конфигурациях можно найти в [документации rspack](https://rspack.dev/guide/migration/webpack).
|
|
27
|
+
|
|
28
|
+
## 18.7.0
|
|
29
|
+
|
|
30
|
+
### Minor Changes
|
|
31
|
+
|
|
32
|
+
- [#298](https://github.com/core-ds/arui-scripts/pull/298) [`d43df89`](https://github.com/core-ds/arui-scripts/commit/d43df89a749af4d8942c53dbfc0291ca45c18231) Thanks [@KalashnikovTV](https://github.com/KalashnikovTV)! - Убрана каретка у вебпака, зафиксирована версия 5.95.0
|
|
33
|
+
|
|
3
34
|
## 18.6.1
|
|
4
35
|
|
|
5
36
|
### Patch Changes
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Stats, MultiStats, Configuration } from '@rspack/core';
|
|
2
2
|
type BuildResult = {
|
|
3
|
-
stats:
|
|
3
|
+
stats: Stats | MultiStats;
|
|
4
4
|
warnings: string[];
|
|
5
5
|
previousFileSizes: unknown;
|
|
6
6
|
};
|
|
7
|
-
declare function build(config:
|
|
7
|
+
declare function build(config: Configuration | Configuration[], previousFileSizes?: unknown): Promise<BuildResult>;
|
|
8
8
|
export default build;
|
|
@@ -6,10 +6,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
6
6
|
};
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
8
|
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
-
const
|
|
9
|
+
const core_1 = require("@rspack/core");
|
|
10
10
|
const format_webpack_messages_1 = __importDefault(require("../util/format-webpack-messages"));
|
|
11
11
|
function build(config, previousFileSizes) {
|
|
12
|
-
let compiler = (0,
|
|
12
|
+
let compiler = (0, core_1.rspack)(config);
|
|
13
13
|
return new Promise((resolve, reject) => {
|
|
14
14
|
compiler.run((err, stats) => {
|
|
15
15
|
if (err) {
|
|
@@ -14,7 +14,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
// TODO: remove eslint-disable
|
|
16
16
|
/* eslint-disable no-param-reassign */
|
|
17
|
-
const
|
|
17
|
+
const rspack_plugin_1 = require("@rsdoctor/rspack-plugin");
|
|
18
|
+
const core_1 = require("@rspack/core");
|
|
18
19
|
const webpack_bundle_analyzer_1 = require("webpack-bundle-analyzer");
|
|
19
20
|
const app_configs_1 = require("../../configs/app-configs");
|
|
20
21
|
const webpack_client_prod_1 = __importDefault(require("../../configs/webpack.client.prod"));
|
|
@@ -29,10 +30,11 @@ const make_tmp_dir_1 = __importDefault(require("../util/make-tmp-dir"));
|
|
|
29
30
|
generateStatsFile: true,
|
|
30
31
|
statsFilename: app_configs_1.configs.statsOutputPath,
|
|
31
32
|
analyzerPort: 'auto',
|
|
32
|
-
}),
|
|
33
|
+
}), // webpack-bundle-analyzer has incorrect types
|
|
34
|
+
new rspack_plugin_1.RsdoctorRspackPlugin({}),
|
|
33
35
|
];
|
|
34
36
|
webpackConfig.output = Object.assign(Object.assign({}, webpackConfig.output), { path: tmpDir });
|
|
35
37
|
}));
|
|
36
38
|
yield Promise.all(promises);
|
|
37
|
-
(0,
|
|
39
|
+
(0, core_1.rspack)(clientWebpackConfigs).run(() => { });
|
|
38
40
|
}))();
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Configuration } from '
|
|
1
|
+
import { Configuration } from '@rspack/core';
|
|
2
2
|
export declare function runClientDevServer(configuration: Configuration | Configuration[]): Promise<void>;
|
|
@@ -14,17 +14,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.runClientDevServer = runClientDevServer;
|
|
16
16
|
const WebpackDevServerUtils_1 = require("react-dev-utils/WebpackDevServerUtils");
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
17
|
+
const core_1 = require("@rspack/core");
|
|
18
|
+
const dev_server_1 = require("@rspack/dev-server");
|
|
19
|
+
const dev_server_2 = __importDefault(require("../../configs/dev-server"));
|
|
20
20
|
const print_compiler_output_1 = __importDefault(require("../start/print-compiler-output"));
|
|
21
21
|
function runClientDevServer(configuration) {
|
|
22
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
const clientCompiler = (0,
|
|
24
|
-
const clientDevServer = new
|
|
23
|
+
const clientCompiler = (0, core_1.rspack)(configuration);
|
|
24
|
+
const clientDevServer = new dev_server_1.RspackDevServer(dev_server_2.default, clientCompiler);
|
|
25
25
|
clientCompiler.hooks.invalid.tap('client', () => console.log('Compiling client...'));
|
|
26
26
|
clientCompiler.hooks.done.tap('client', (stats) => (0, print_compiler_output_1.default)('Client', stats));
|
|
27
|
-
const DEFAULT_PORT =
|
|
27
|
+
const DEFAULT_PORT = dev_server_2.default.port;
|
|
28
28
|
const HOST = '0.0.0.0';
|
|
29
29
|
try {
|
|
30
30
|
const port = yield (0, WebpackDevServerUtils_1.choosePort)(HOST, +(DEFAULT_PORT || 0));
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
export declare function runServerWatchCompiler(config:
|
|
1
|
+
import { Configuration } from '@rspack/core';
|
|
2
|
+
export declare function runServerWatchCompiler(config: Configuration): void;
|
|
@@ -4,11 +4,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.runServerWatchCompiler = runServerWatchCompiler;
|
|
7
|
-
const
|
|
7
|
+
const core_1 = require("@rspack/core");
|
|
8
8
|
const app_configs_1 = __importDefault(require("../../configs/app-configs"));
|
|
9
9
|
const print_compiler_output_1 = __importDefault(require("../start/print-compiler-output"));
|
|
10
10
|
function runServerWatchCompiler(config) {
|
|
11
|
-
const serverCompiler = (0,
|
|
11
|
+
const serverCompiler = (0, core_1.rspack)(config);
|
|
12
12
|
serverCompiler.hooks.compile.tap('server', () => console.log('Compiling server...'));
|
|
13
13
|
serverCompiler.hooks.invalid.tap('server', () => console.log('Compiling server...'));
|
|
14
14
|
serverCompiler.hooks.done.tap('server', (stats) => (0, print_compiler_output_1.default)('Server', stats));
|
|
@@ -14,7 +14,7 @@ const resolve_1 = require("../util/resolve");
|
|
|
14
14
|
* Обновление ключей конфига, зависящих от других. Это нужно делать в самый последний момент
|
|
15
15
|
*/
|
|
16
16
|
function calculateDependentConfig(config) {
|
|
17
|
-
return Object.assign(Object.assign({}, config), {
|
|
17
|
+
return Object.assign(Object.assign({}, config), { clientPolyfillsEntry: (0, get_polyfills_1.getPolyfills)(config) });
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* Обновление контекста в зависимости от ключей конфига
|
|
@@ -23,11 +23,11 @@ function getDefaultAppConfig() {
|
|
|
23
23
|
clientServerPort: 8080,
|
|
24
24
|
serverPort: 3000,
|
|
25
25
|
debug: false,
|
|
26
|
-
devSourceMaps: '
|
|
26
|
+
devSourceMaps: 'inline-cheap-source-map', // так получаются нормальные сорсмапы, с eval - они не работают
|
|
27
27
|
devServerCors: false,
|
|
28
28
|
useServerHMR: false,
|
|
29
29
|
presets: (configFile === null || configFile === void 0 ? void 0 : configFile.presets) || ((_a = appPackage === null || appPackage === void 0 ? void 0 : appPackage.aruiScripts) === null || _a === void 0 ? void 0 : _a.presets) || null,
|
|
30
|
-
proxy: appPackage.proxy ||
|
|
30
|
+
proxy: appPackage.proxy || [],
|
|
31
31
|
clientOnly: false,
|
|
32
32
|
// paths
|
|
33
33
|
buildPath: '.build',
|
|
@@ -49,13 +49,10 @@ function getDefaultAppConfig() {
|
|
|
49
49
|
archiveName: 'build.tar',
|
|
50
50
|
// build tuning
|
|
51
51
|
keepPropTypes: false,
|
|
52
|
-
|
|
53
|
-
codeLoader: 'babel',
|
|
54
|
-
webpack4Compatibility: false,
|
|
52
|
+
codeLoader: 'swc',
|
|
55
53
|
installServerSourceMaps: false,
|
|
56
54
|
disableDevWebpackTypecheck: true,
|
|
57
|
-
|
|
58
|
-
jestCodeTransformer: 'babel',
|
|
55
|
+
jestCodeTransformer: 'swc',
|
|
59
56
|
collectCoverage: process.env.NODE_ENV === 'cypress' || process.env.USE_ISTANBUL === 'enabled',
|
|
60
57
|
// image processing
|
|
61
58
|
dataUrlMaxSize: 1536,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DevTool } from '@rspack/core';
|
|
2
|
+
import { RspackDevServer } from '@rspack/dev-server';
|
|
2
3
|
/**
|
|
3
4
|
* Конфигурация arui-scripts, которая может быть переопределена приложением
|
|
4
5
|
*/
|
|
@@ -6,13 +7,11 @@ export type AppConfigs = {
|
|
|
6
7
|
clientServerPort: number;
|
|
7
8
|
serverPort: number;
|
|
8
9
|
debug: boolean;
|
|
9
|
-
devSourceMaps:
|
|
10
|
+
devSourceMaps: DevTool;
|
|
10
11
|
devServerCors: boolean;
|
|
11
12
|
useServerHMR: boolean;
|
|
12
13
|
presets: string | null;
|
|
13
|
-
proxy:
|
|
14
|
-
[url: string]: ProxyConfigArrayItem;
|
|
15
|
-
};
|
|
14
|
+
proxy: RspackDevServer['options']['proxy'];
|
|
16
15
|
clientOnly: boolean;
|
|
17
16
|
buildPath: string;
|
|
18
17
|
assetsPath: string;
|
|
@@ -36,21 +35,9 @@ export type AppConfigs = {
|
|
|
36
35
|
removeDevDependenciesDuringDockerBuild: boolean;
|
|
37
36
|
archiveName: string;
|
|
38
37
|
keepPropTypes: boolean;
|
|
39
|
-
/**
|
|
40
|
-
* @deprecated использование ts-loader крайне не рекомендуется - он медленнее и не имеет преимуществ перед babel
|
|
41
|
-
*/
|
|
42
|
-
useTscLoader: boolean;
|
|
43
38
|
codeLoader: 'babel' | 'tsc' | 'swc';
|
|
44
|
-
/**
|
|
45
|
-
* @deprecated эта настройка будет удалена в будущих версиях скриптов
|
|
46
|
-
*/
|
|
47
|
-
webpack4Compatibility: boolean;
|
|
48
39
|
installServerSourceMaps: boolean;
|
|
49
40
|
disableDevWebpackTypecheck: boolean;
|
|
50
|
-
/**
|
|
51
|
-
* @deprecated используйте настройку jestCodeTransformer
|
|
52
|
-
*/
|
|
53
|
-
jestUseTsJest: boolean;
|
|
54
41
|
jestCodeTransformer: 'babel' | 'tsc' | 'swc';
|
|
55
42
|
collectCoverage: boolean;
|
|
56
43
|
dataUrlMaxSize?: number;
|
|
@@ -2,10 +2,19 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.warnAboutDeprecations = warnAboutDeprecations;
|
|
4
4
|
function warnAboutDeprecations(config) {
|
|
5
|
-
if (config.
|
|
6
|
-
console.warn('
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
console.warn('Опция `webpack4Compatibility` будет удалена в будущих версиях arui-scripts.', 'Обратитесь к issue в webpack https://github.com/webpack/webpack/issues/14580 для получения дополнительной информации');
|
|
5
|
+
if (!Array.isArray(config.proxy) && config.proxy) {
|
|
6
|
+
console.warn('Передача config.proxy как объекта больше не поддерживается. ', 'arui-scripts попробует привести конфигурацию к корректному виду, но это не всегда может работать корректно', 'Правильный формат конфигурации можно посмотреть в документации rspack: https://rspack.dev/guide/features/dev-server#proxy');
|
|
7
|
+
// eslint-disable-next-line no-param-reassign
|
|
8
|
+
config.proxy = convertObjectProxyConfigurationToArray(config.proxy);
|
|
10
9
|
}
|
|
11
10
|
}
|
|
11
|
+
function convertObjectProxyConfigurationToArray(proxyConfiguration) {
|
|
12
|
+
const arrayProxy = [];
|
|
13
|
+
Object.keys(proxyConfiguration).forEach((context) => {
|
|
14
|
+
const itemConfig = proxyConfiguration[context];
|
|
15
|
+
arrayProxy.push(Object.assign({ context }, (typeof itemConfig === 'string' ? {
|
|
16
|
+
target: itemConfig,
|
|
17
|
+
} : itemConfig)));
|
|
18
|
+
});
|
|
19
|
+
return arrayProxy;
|
|
20
|
+
}
|
|
@@ -22,7 +22,7 @@ const babelClientConfig = (0, apply_overrides_1.default)(['babel', 'babelClient'
|
|
|
22
22
|
},
|
|
23
23
|
],
|
|
24
24
|
app_configs_1.configs.tsconfig !== null &&
|
|
25
|
-
|
|
25
|
+
app_configs_1.configs.codeLoader !== 'tsc' &&
|
|
26
26
|
require.resolve('@babel/preset-typescript'),
|
|
27
27
|
require.resolve('@babel/preset-react'),
|
|
28
28
|
].filter(Boolean),
|
|
@@ -16,7 +16,7 @@ exports.babelDependencies = (0, apply_overrides_1.default)('babelDependencies',
|
|
|
16
16
|
useBuiltIns: 'entry',
|
|
17
17
|
// Set the corejs version we are using to avoid warnings in console
|
|
18
18
|
// This will need to change once we upgrade to corejs@3
|
|
19
|
-
corejs:
|
|
19
|
+
corejs: '3.32',
|
|
20
20
|
// Exclude transforms that make all code slower
|
|
21
21
|
exclude: ['transform-typeof-symbol'],
|
|
22
22
|
},
|
|
@@ -12,7 +12,7 @@ const config = (0, apply_overrides_1.default)(['babel', 'babelServer'], {
|
|
|
12
12
|
{ modules: false, targets: { node: 'current' }, loose: true },
|
|
13
13
|
],
|
|
14
14
|
app_configs_1.default.tsconfig !== null &&
|
|
15
|
-
|
|
15
|
+
app_configs_1.default.codeLoader !== 'tsc' &&
|
|
16
16
|
require.resolve('@babel/preset-typescript'),
|
|
17
17
|
require.resolve('@babel/preset-react'),
|
|
18
18
|
].filter(Boolean),
|
|
@@ -1,2 +1,28 @@
|
|
|
1
1
|
import ImageMinimizerPlugin from 'image-minimizer-webpack-plugin';
|
|
2
|
-
export declare
|
|
2
|
+
export declare function getImageMinLoader(): false | {
|
|
3
|
+
test: RegExp;
|
|
4
|
+
type: string;
|
|
5
|
+
use: {
|
|
6
|
+
loader: string;
|
|
7
|
+
options: {
|
|
8
|
+
minimizer: {
|
|
9
|
+
implementation: typeof ImageMinimizerPlugin.imageminMinify;
|
|
10
|
+
options: {
|
|
11
|
+
plugins: (false | (string | {
|
|
12
|
+
quality: number;
|
|
13
|
+
progressive: boolean;
|
|
14
|
+
})[] | (string | {
|
|
15
|
+
optimizationLevel: number | undefined;
|
|
16
|
+
bitDepthReduction: boolean | undefined;
|
|
17
|
+
colorTypeReduction: boolean | undefined;
|
|
18
|
+
paletteReduction: boolean | undefined;
|
|
19
|
+
interlaced: boolean | undefined;
|
|
20
|
+
})[] | (string | {
|
|
21
|
+
optimizationLevel: number | undefined;
|
|
22
|
+
interlaced: boolean;
|
|
23
|
+
})[] | undefined)[];
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
}[];
|
|
28
|
+
};
|
|
@@ -3,49 +3,63 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.getImageMinLoader = getImageMinLoader;
|
|
7
7
|
const image_minimizer_webpack_plugin_1 = __importDefault(require("image-minimizer-webpack-plugin"));
|
|
8
|
-
const app_configs_1 =
|
|
9
|
-
|
|
8
|
+
const app_configs_1 = require("../../../app-configs");
|
|
9
|
+
function getImageMinLoader() {
|
|
10
10
|
var _a;
|
|
11
|
-
const { svg, gif, jpg, png } = (_a = app_configs_1.
|
|
11
|
+
const { svg, gif, jpg, png } = (_a = app_configs_1.configs.imageMinimizer) !== null && _a !== void 0 ? _a : {};
|
|
12
12
|
const doesAnyMinificationEnabled = (svg === null || svg === void 0 ? void 0 : svg.enabled) || (gif === null || gif === void 0 ? void 0 : gif.enabled) || (jpg === null || jpg === void 0 ? void 0 : jpg.enabled) || (png === null || png === void 0 ? void 0 : png.enabled);
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
13
|
+
if (!doesAnyMinificationEnabled) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
const loaderExtensions = [
|
|
17
|
+
(svg === null || svg === void 0 ? void 0 : svg.enabled) && 'svg',
|
|
18
|
+
(gif === null || gif === void 0 ? void 0 : gif.enabled) && 'gif',
|
|
19
|
+
(jpg === null || jpg === void 0 ? void 0 : jpg.enabled) && 'jpe?g',
|
|
20
|
+
(png === null || png === void 0 ? void 0 : png.enabled) && 'png',
|
|
21
|
+
].filter(Boolean);
|
|
22
|
+
return {
|
|
23
|
+
test: new RegExp(`\\.(${loaderExtensions.join('|')})$`),
|
|
24
|
+
type: 'assets',
|
|
25
|
+
use: [
|
|
26
|
+
{
|
|
27
|
+
loader: image_minimizer_webpack_plugin_1.default.loader,
|
|
28
|
+
options: {
|
|
29
|
+
minimizer: {
|
|
30
|
+
implementation: image_minimizer_webpack_plugin_1.default.imageminMinify,
|
|
31
|
+
options: {
|
|
32
|
+
plugins: [
|
|
33
|
+
(jpg === null || jpg === void 0 ? void 0 : jpg.enabled) && [
|
|
34
|
+
'mozjpeg',
|
|
35
|
+
{
|
|
36
|
+
quality: jpg === null || jpg === void 0 ? void 0 : jpg.quality,
|
|
37
|
+
progressive: true,
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
(png === null || png === void 0 ? void 0 : png.enabled) && [
|
|
41
|
+
'optipng',
|
|
42
|
+
{
|
|
43
|
+
optimizationLevel: png === null || png === void 0 ? void 0 : png.optimizationLevel,
|
|
44
|
+
bitDepthReduction: png === null || png === void 0 ? void 0 : png.bitDepthReduction,
|
|
45
|
+
colorTypeReduction: png === null || png === void 0 ? void 0 : png.colorTypeReduction,
|
|
46
|
+
paletteReduction: png === null || png === void 0 ? void 0 : png.paletteReduction,
|
|
47
|
+
interlaced: png === null || png === void 0 ? void 0 : png.interlaced,
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
(svg === null || svg === void 0 ? void 0 : svg.enabled) && ['svgo'],
|
|
51
|
+
(gif === null || gif === void 0 ? void 0 : gif.enabled) && [
|
|
52
|
+
'gifsicle',
|
|
53
|
+
{
|
|
54
|
+
optimizationLevel: gif === null || gif === void 0 ? void 0 : gif.optimizationLevel,
|
|
55
|
+
interlaced: true,
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
].filter(Boolean),
|
|
59
|
+
},
|
|
46
60
|
},
|
|
47
61
|
},
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
};
|
|
51
|
-
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
};
|
|
65
|
+
}
|
|
@@ -7,35 +7,33 @@ const path_1 = __importDefault(require("path"));
|
|
|
7
7
|
const apply_overrides_1 = __importDefault(require("./util/apply-overrides"));
|
|
8
8
|
const app_configs_1 = require("./app-configs");
|
|
9
9
|
const client_env_config_1 = require("./client-env-config");
|
|
10
|
-
const serverProxyConfig = {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return req.url;
|
|
16
|
-
}
|
|
17
|
-
return null;
|
|
18
|
-
} }, (app_configs_1.configs.devSourceMaps.includes('eval') || app_configs_1.configs.devServerCors
|
|
19
|
-
? {
|
|
20
|
-
onProxyRes: (proxyRes) => {
|
|
21
|
-
// Для дев режима, когда мы используем в качестве соурсмапов что-то, основанное на eval - нужно
|
|
22
|
-
// разрешить браузеру исполнять наш код, даже когда content-security-policy приложения не позволяет этого делать.
|
|
23
|
-
if (app_configs_1.configs.devSourceMaps.includes('eval')) {
|
|
24
|
-
const cspHeader = proxyRes.headers['content-security-policy'];
|
|
25
|
-
if (typeof cspHeader === 'string' &&
|
|
26
|
-
!cspHeader.includes('unsafe-eval')) {
|
|
27
|
-
proxyRes.headers['content-security-policy'] = cspHeader.replace(/script-src/, "script-src 'unsafe-eval'");
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
// если включен devServerCors, то нужно принудительно менять статус ответа на 200, чтобы
|
|
31
|
-
// браузер не отклонял ответы с CORS
|
|
32
|
-
if (app_configs_1.configs.devServerCors && proxyRes.method === 'OPTIONS') {
|
|
33
|
-
proxyRes.statusCode = 200;
|
|
34
|
-
}
|
|
35
|
-
},
|
|
10
|
+
const serverProxyConfig = Object.assign({ context: ['/**'], target: `http://127.0.0.1:${app_configs_1.configs.serverPort}`, bypass: (req) => {
|
|
11
|
+
var _a;
|
|
12
|
+
const assetsRoot = path_1.default.normalize(`/${app_configs_1.configs.publicPath}`).replace(/\\/g, '/');
|
|
13
|
+
if ((_a = req === null || req === void 0 ? void 0 : req.url) === null || _a === void 0 ? void 0 : _a.startsWith(assetsRoot)) {
|
|
14
|
+
return req.url;
|
|
36
15
|
}
|
|
37
|
-
|
|
38
|
-
}
|
|
16
|
+
return null;
|
|
17
|
+
} }, (app_configs_1.configs.devSourceMaps && app_configs_1.configs.devSourceMaps.includes('eval') || app_configs_1.configs.devServerCors
|
|
18
|
+
? {
|
|
19
|
+
onProxyRes: (proxyRes) => {
|
|
20
|
+
// Для дев режима, когда мы используем в качестве соурсмапов что-то, основанное на eval - нужно
|
|
21
|
+
// разрешить браузеру исполнять наш код, даже когда content-security-policy приложения не позволяет этого делать.
|
|
22
|
+
if (app_configs_1.configs.devSourceMaps && app_configs_1.configs.devSourceMaps.includes('eval')) {
|
|
23
|
+
const cspHeader = proxyRes.headers['content-security-policy'];
|
|
24
|
+
if (typeof cspHeader === 'string' &&
|
|
25
|
+
!cspHeader.includes('unsafe-eval')) {
|
|
26
|
+
proxyRes.headers['content-security-policy'] = cspHeader.replace(/script-src/, "script-src 'unsafe-eval'");
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
// если включен devServerCors, то нужно принудительно менять статус ответа на 200, чтобы
|
|
30
|
+
// браузер не отклонял ответы с CORS
|
|
31
|
+
if (app_configs_1.configs.devServerCors && proxyRes.method === 'OPTIONS') {
|
|
32
|
+
proxyRes.statusCode = 200;
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
}
|
|
36
|
+
: {}));
|
|
39
37
|
const devServerConfig = (0, apply_overrides_1.default)('devServer', {
|
|
40
38
|
port: app_configs_1.configs.clientServerPort,
|
|
41
39
|
liveReload: false,
|
|
@@ -51,8 +49,8 @@ const devServerConfig = (0, apply_overrides_1.default)('devServer', {
|
|
|
51
49
|
// создаваемый для client-only режима как раз такой. Так же работает и env-config.json
|
|
52
50
|
writeToDisk: (filename) => filename.endsWith('.html') || filename.endsWith(client_env_config_1.ENV_CONFIG_FILENAME),
|
|
53
51
|
},
|
|
54
|
-
static: [app_configs_1.configs.serverOutputPath],
|
|
55
|
-
proxy:
|
|
52
|
+
static: [app_configs_1.configs.serverOutputPath, app_configs_1.configs.clientOutputPath],
|
|
53
|
+
proxy: getProxyConfig(),
|
|
56
54
|
headers: app_configs_1.configs.devServerCors
|
|
57
55
|
? {
|
|
58
56
|
'Access-Control-Allow-Origin': '*',
|
|
@@ -61,4 +59,15 @@ const devServerConfig = (0, apply_overrides_1.default)('devServer', {
|
|
|
61
59
|
}
|
|
62
60
|
: {},
|
|
63
61
|
});
|
|
62
|
+
function getProxyConfig() {
|
|
63
|
+
const proxyConfig = [];
|
|
64
|
+
const userProxyConfig = app_configs_1.configs.proxy;
|
|
65
|
+
if (!app_configs_1.configs.clientOnly) {
|
|
66
|
+
proxyConfig.push(serverProxyConfig);
|
|
67
|
+
}
|
|
68
|
+
if (Array.isArray(userProxyConfig)) {
|
|
69
|
+
proxyConfig.push(...userProxyConfig);
|
|
70
|
+
}
|
|
71
|
+
return proxyConfig;
|
|
72
|
+
}
|
|
64
73
|
exports.default = devServerConfig;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as rspack from '@rspack/core';
|
|
2
2
|
import { 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
|
-
export declare function patchMainWebpackConfigForModules(webpackConf:
|
|
5
|
+
export declare function patchMainWebpackConfigForModules(webpackConf: rspack.Configuration): rspack.RspackOptions;
|
|
6
6
|
export declare function getCssPrefixForModule(module: CompatModuleConfig): string | undefined;
|
|
7
7
|
export declare function getExposeLoadersFormCompatModules(): {
|
|
8
8
|
test: string;
|
|
@@ -13,4 +13,4 @@ export declare function getExposeLoadersFormCompatModules(): {
|
|
|
13
13
|
};
|
|
14
14
|
}[];
|
|
15
15
|
}[];
|
|
16
|
-
export declare function patchWebpackConfigForCompat(module: CompatModuleConfig, webpackConf:
|
|
16
|
+
export declare function patchWebpackConfigForCompat(module: CompatModuleConfig, webpackConf: rspack.Configuration): rspack.RspackOptions;
|