arui-scripts 20.3.0 → 20.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +3 -3
- package/.prettierignore +2 -0
- package/.turbo/turbo-test.log +6 -6
- package/CHANGELOG.md +12 -0
- package/build/commands/util/client-assets-sizes.d.ts +1 -1
- package/build/commands/util/client-assets-sizes.js +8 -6
- package/build/commands/util/format-webpack-messages.d.ts +1 -1
- package/build/commands/util/format-webpack-messages.js +2 -1
- package/build/commands/util/run-client-dev-server.d.ts +1 -1
- package/build/commands/util/run-server-watch-compiler.d.ts +1 -1
- package/build/configs/app-configs/calculate-dependent-config.d.ts +1 -1
- package/build/configs/app-configs/calculate-dependent-config.js +1 -2
- package/build/configs/app-configs/get-defaults.d.ts +1 -1
- package/build/configs/app-configs/index.d.ts +1 -1
- package/build/configs/app-configs/types.d.ts +2 -2
- package/build/configs/app-configs/update-with-config-file.d.ts +1 -1
- package/build/configs/app-configs/update-with-env.d.ts +1 -1
- package/build/configs/app-configs/update-with-package.d.ts +1 -1
- package/build/configs/app-configs/update-with-presets.d.ts +1 -1
- package/build/configs/app-configs/warn-about-deprecations.d.ts +1 -1
- package/build/configs/client-env-config/client-config-plugin.d.ts +1 -1
- package/build/configs/dev-server.d.ts +1 -1
- package/build/configs/dev-server.js +1 -0
- package/build/configs/modules.d.ts +1 -1
- package/build/configs/modules.js +1 -1
- package/build/configs/postcss.config.d.ts +1 -1
- package/build/configs/process-assets-plugin-output.d.ts +1 -1
- package/build/configs/server-externals-exemptions.js +1 -0
- package/build/configs/stats-options.d.ts +1 -1
- package/build/configs/swc.d.ts +1 -1
- package/build/configs/util/apply-overrides.d.ts +6 -6
- package/build/configs/util/compress-with-dcb.js +1 -5
- package/build/configs/util/compression-plugins-for-dictionaries.js +3 -6
- package/build/configs/util/dcb-compression-plugin.d.ts +3 -3
- package/build/configs/util/dcb-compression-plugin.js +12 -4
- package/build/configs/util/find-loader.d.ts +1 -1
- package/build/configs/util/find-plugin.d.ts +12 -12
- package/build/configs/util/get-polyfills.d.ts +1 -1
- package/build/configs/webpack.client.d.ts +2 -2
- package/build/configs/webpack.client.js +9 -12
- package/build/configs/webpack.server.d.ts +1 -1
- package/build/plugins/arui-runtime/index.d.ts +1 -1
- package/build/plugins/arui-runtime/index.js +1 -1
- package/build/plugins/postcss-global-variables/postcss-global-variables.d.ts +1 -1
- package/build/plugins/postcss-global-variables/utils/utils.d.ts +1 -1
- package/build/plugins/postcss-prefix-selector.d.ts +1 -1
- package/build/plugins/reload-server-plugin.d.ts +1 -1
- package/build/plugins/turn-off-split-remote-entry.d.ts +1 -1
- package/build/templates/nginx.conf.template.js +3 -1
- package/build/tsconfig-local.tsbuildinfo +1 -1
- package/package.json +6 -10
- package/tsconfig-local.json +1 -4
- package/tsconfig.json +2 -5
package/.eslintrc.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
root: true,
|
|
3
|
-
extends: ['
|
|
3
|
+
extends: [require.resolve('arui-presets-lint/eslint')],
|
|
4
4
|
parserOptions: {
|
|
5
5
|
tsconfigRootDir: __dirname,
|
|
6
6
|
project: ['./tsconfig.eslint.json'],
|
|
7
7
|
},
|
|
8
8
|
ignorePatterns: ['./src/templates/dockerfile-compiled.template.ts', '.turbo'],
|
|
9
9
|
rules: {
|
|
10
|
-
'import/no-default-export': 'warn',
|
|
11
|
-
'import/no-named-as-default': 'warn',
|
|
12
10
|
// чтобы могли использовать for и генераторы
|
|
13
11
|
'no-restricted-syntax': 'off',
|
|
14
12
|
// проект - cli-тулза, и она должна писать в консоль
|
|
15
13
|
'no-console': 'off',
|
|
14
|
+
'import/no-cycle': 'off', // TODO: 7 ошибок, возможно их можно убрать
|
|
15
|
+
'no-restricted-imports': 'off', // TODO: 5 ошибок с импортом lodash.merge. Убрать отдельным пр
|
|
16
16
|
},
|
|
17
17
|
};
|
package/.prettierignore
ADDED
package/.turbo/turbo-test.log
CHANGED
|
@@ -5,20 +5,20 @@ 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 (28.
|
|
8
|
+
PASS src/configs/app-configs/__tests__/update-with-presets.tests.ts (28.806 s)
|
|
9
9
|
PASS src/configs/util/__tests__/apply-overrides.tests.ts
|
|
10
|
+
PASS src/plugins/postcss-global-variables/utils/__tests__/add-global-variable.tests.ts (29.131 s)
|
|
10
11
|
PASS src/configs/app-configs/__tests__/update-with-env.tests.ts
|
|
11
|
-
PASS src/plugins/postcss-global-variables/utils/__tests__/add-global-variable.tests.ts (29.132 s)
|
|
12
12
|
PASS src/configs/app-configs/__tests__/update-with-package.tests.ts
|
|
13
|
-
PASS src/configs/util/__tests__/get-polyfills.tests.ts
|
|
14
13
|
PASS src/configs/util/__tests__/compress-with-dcb.test.ts
|
|
15
|
-
PASS src/
|
|
14
|
+
PASS src/configs/util/__tests__/get-polyfills.tests.ts
|
|
16
15
|
PASS src/plugins/postcss-global-variables/utils/__tests__/get-media-query-name.tests.ts
|
|
16
|
+
PASS src/plugins/postcss-global-variables/utils/__tests__/parse-variables.tests.ts
|
|
17
17
|
PASS src/configs/app-configs/__tests__/validate-settings-keys.tests.ts
|
|
18
|
-
PASS src/configs/util/__tests__/find-plugin.tests.ts (31.
|
|
18
|
+
PASS src/configs/util/__tests__/find-plugin.tests.ts (31.233 s)
|
|
19
19
|
|
|
20
20
|
Test Suites: 11 passed, 11 total
|
|
21
21
|
Tests: 25 passed, 25 total
|
|
22
22
|
Snapshots: 0 total
|
|
23
|
-
Time: 32.
|
|
23
|
+
Time: 32.164 s
|
|
24
24
|
Ran all test suites.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
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
|
+
## 20.4.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#364](https://github.com/core-ds/arui-scripts/pull/364) [`5df79df`](https://github.com/core-ds/arui-scripts/commit/5df79dff798ab4d3f9726a944ec35c09411b03ba) Thanks [@heymdall-legal](https://github.com/heymdall-legal)! - Включен devserver.historyApiFallback для clientOnly режима. Теперь в дев режиме в clientOnly запросы на неизвестные адреса будут открывать index.html
|
|
8
|
+
|
|
9
|
+
## 20.4.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#362](https://github.com/core-ds/arui-scripts/pull/362) [`96b1f59`](https://github.com/core-ds/arui-scripts/commit/96b1f59e152187f93d60d2c6a1fbf0ff3e5c5af3) Thanks [@TheDiamondDoge](https://github.com/TheDiamondDoge)! - Добавление пакета @alfa-bank/app-html в serverExternalsExemptions
|
|
14
|
+
|
|
3
15
|
## 20.3.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Stats } from '@rspack/core';
|
|
1
|
+
import { type Stats } from '@rspack/core';
|
|
2
2
|
export declare function printAssetsSizes(webpackStats: Stats): void;
|
|
@@ -9,12 +9,10 @@ const chalk_1 = __importDefault(require("chalk"));
|
|
|
9
9
|
const filesize_1 = __importDefault(require("filesize"));
|
|
10
10
|
const app_configs_1 = require("../../configs/app-configs");
|
|
11
11
|
function removeFileNameHash(fileName) {
|
|
12
|
-
const parts = fileName
|
|
13
|
-
.replace(/\\/g, '/')
|
|
14
|
-
.split('.');
|
|
12
|
+
const parts = fileName.replace(/\\/g, '/').split('.');
|
|
15
13
|
const id = parts[0];
|
|
16
14
|
const isChunk = fileName.includes('.chunk.');
|
|
17
|
-
const extension = parts.find(p => ['js', 'css'].includes(p));
|
|
15
|
+
const extension = parts.find((p) => ['js', 'css'].includes(p));
|
|
18
16
|
return `${id}${isChunk ? '.chunk' : ''}.${extension}`;
|
|
19
17
|
}
|
|
20
18
|
function printAssetsSizes(webpackStats) {
|
|
@@ -63,7 +61,11 @@ function printAssetsSizes(webpackStats) {
|
|
|
63
61
|
totalSizes.gzipSize += gzipSize;
|
|
64
62
|
totalSizes.brSize += brSize;
|
|
65
63
|
totalSizes.dcbSize += dcbSize;
|
|
66
|
-
console.log(` ${(0, filesize_1.default)(size)} (${(0, filesize_1.default)(gzipSize)} gzip, ${(0, filesize_1.default)(brSize)} br${app_configs_1.configs.dictionaryCompression.dictionaryPath.length > 0
|
|
64
|
+
console.log(` ${(0, filesize_1.default)(size)} (${(0, filesize_1.default)(gzipSize)} gzip, ${(0, filesize_1.default)(brSize)} br${app_configs_1.configs.dictionaryCompression.dictionaryPath.length > 0
|
|
65
|
+
? `, ${(0, filesize_1.default)(dcbSize)} dcb`
|
|
66
|
+
: ''}) ${chalk_1.default.cyan(assetName)}`);
|
|
67
67
|
});
|
|
68
|
-
console.log(`${chalk_1.default.blueBright('\nTotal size:\n')} ${(0, filesize_1.default)(totalSizes.size)} (${(0, filesize_1.default)(totalSizes.gzipSize)} gzip, ${(0, filesize_1.default)(totalSizes.brSize)} br${app_configs_1.configs.dictionaryCompression.dictionaryPath.length > 0
|
|
68
|
+
console.log(`${chalk_1.default.blueBright('\nTotal size:\n')} ${(0, filesize_1.default)(totalSizes.size)} (${(0, filesize_1.default)(totalSizes.gzipSize)} gzip, ${(0, filesize_1.default)(totalSizes.brSize)} br${app_configs_1.configs.dictionaryCompression.dictionaryPath.length > 0
|
|
69
|
+
? `, ${(0, filesize_1.default)(totalSizes.dcbSize)} dcb`
|
|
70
|
+
: ''})\n`);
|
|
69
71
|
}
|
|
@@ -20,6 +20,7 @@ function isLikelyASyntaxError(message) {
|
|
|
20
20
|
}
|
|
21
21
|
// Cleans up webpack error messages.
|
|
22
22
|
function formatMessage(message) {
|
|
23
|
+
var _a;
|
|
23
24
|
let newMessage = message;
|
|
24
25
|
if (typeof newMessage !== 'string') {
|
|
25
26
|
newMessage = newMessage.message;
|
|
@@ -62,7 +63,7 @@ function formatMessage(message) {
|
|
|
62
63
|
];
|
|
63
64
|
}
|
|
64
65
|
// Add helpful message for users trying to use Sass for the first time
|
|
65
|
-
if (lines[1]
|
|
66
|
+
if ((_a = lines[1]) === null || _a === void 0 ? void 0 : _a.match(/Cannot find module.+node-sass/)) {
|
|
66
67
|
lines[1] = 'To import Sass files, you first need to install node-sass.\n';
|
|
67
68
|
lines[1] += 'Run `npm install node-sass` or `yarn add node-sass` inside your workspace.';
|
|
68
69
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Configuration } from '@rspack/core';
|
|
1
|
+
import { type Configuration } from '@rspack/core';
|
|
2
2
|
export declare function runClientDevServer(configuration: Configuration | Configuration[]): Promise<void>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Configuration } from '@rspack/core';
|
|
1
|
+
import { type Configuration } from '@rspack/core';
|
|
2
2
|
export declare function runServerWatchCompiler(config: Configuration): void;
|
|
@@ -34,8 +34,7 @@ function calculateDependentContext(config, context) {
|
|
|
34
34
|
// eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
|
|
35
35
|
babelRuntimeVersion = require('@babel/runtime/package.json').version;
|
|
36
36
|
}
|
|
37
|
-
const allDictionaryPath = config.dictionaryCompression.dictionaryPath
|
|
38
|
-
.map((p) => {
|
|
37
|
+
const allDictionaryPath = config.dictionaryCompression.dictionaryPath.map((p) => {
|
|
39
38
|
if (!path_1.default.isAbsolute(p)) {
|
|
40
39
|
return path_1.default.join(process.cwd(), p);
|
|
41
40
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AppConfigs, AppContext } from './types';
|
|
1
|
+
import { type AppConfigs, type AppContext } from './types';
|
|
2
2
|
export declare const nginxConfigFileName = "nginx.conf";
|
|
3
3
|
export declare const baseNginxConfigFileName = "base-nginx.conf";
|
|
4
4
|
export declare function getDefaultAppConfig(): AppConfigs;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AppConfigs, AppContext, AppContextWithConfigs } from './types';
|
|
1
|
+
import { type AppConfigs, type AppContext, type AppContextWithConfigs } from './types';
|
|
2
2
|
import '../util/register-ts-node';
|
|
3
3
|
export declare const appContext: AppContext;
|
|
4
4
|
export declare const appConfigs: AppConfigs;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DevTool, Shared } from '@rspack/core';
|
|
2
|
-
import { RspackDevServer } from '@rspack/dev-server';
|
|
1
|
+
import { type DevTool, type Shared } from '@rspack/core';
|
|
2
|
+
import { type RspackDevServer } from '@rspack/dev-server';
|
|
3
3
|
/**
|
|
4
4
|
* Конфигурация arui-scripts, которая может быть переопределена приложением
|
|
5
5
|
*/
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { AppConfigs, AppContext } from './types';
|
|
1
|
+
import { type AppConfigs, type AppContext } from './types';
|
|
2
2
|
export declare function updateWithConfigFile(config: AppConfigs, context: AppContext): any;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { AppConfigs } from './types';
|
|
1
|
+
import { type AppConfigs } from './types';
|
|
2
2
|
export declare function updateWithEnv(config: AppConfigs): any;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { AppConfigs, AppContext } from './types';
|
|
1
|
+
import { type AppConfigs, type AppContext } from './types';
|
|
2
2
|
export declare function updateWithPackage(config: AppConfigs, context: AppContext): any;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { AppConfigs, AppContext } from './types';
|
|
1
|
+
import { type AppConfigs, type AppContext } from './types';
|
|
2
2
|
export declare function updateWithPresets(config: AppConfigs, context: AppContext): AppConfigs;
|
|
3
3
|
export declare function getPresetsConfigPath(config: AppConfigs, cwd: string): string | undefined;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { AppContextWithConfigs } from './types';
|
|
1
|
+
import { type AppContextWithConfigs } from './types';
|
|
2
2
|
export declare function warnAboutDeprecations(config: AppContextWithConfigs): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Configuration } from '@rspack/dev-server';
|
|
1
|
+
import { type Configuration } from '@rspack/dev-server';
|
|
2
2
|
export declare const devServerConfig: Configuration;
|
|
@@ -39,6 +39,7 @@ const serverProxyConfig = Object.assign({ context: ['/**'], target: `http://127.
|
|
|
39
39
|
exports.devServerConfig = (0, apply_overrides_1.applyOverrides)('devServer', {
|
|
40
40
|
port: app_configs_1.configs.clientServerPort,
|
|
41
41
|
liveReload: false,
|
|
42
|
+
historyApiFallback: app_configs_1.configs.clientOnly,
|
|
42
43
|
client: {
|
|
43
44
|
overlay: {
|
|
44
45
|
errors: true,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as rspack from '@rspack/core';
|
|
2
|
-
import { CompatModuleConfig } from './app-configs/types';
|
|
2
|
+
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 function patchMainWebpackConfigForModules(webpackConf: rspack.Configuration): rspack.RspackOptions;
|
package/build/configs/modules.js
CHANGED
|
@@ -112,7 +112,7 @@ function addCssPrefix(webpackConf, cssPrefix) {
|
|
|
112
112
|
addPrefixCssRule(cssModulesRule, `:global(${cssPrefix})`);
|
|
113
113
|
}
|
|
114
114
|
function addPrefixCssRule(rule, prefix) {
|
|
115
|
-
if (!rule ||
|
|
115
|
+
if (!(rule === null || rule === void 0 ? void 0 : rule.use) || !Array.isArray(rule.use)) {
|
|
116
116
|
return;
|
|
117
117
|
}
|
|
118
118
|
const postCssLoader = rule.use.find((loaderConfig) => {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Assets } from 'assets-webpack-plugin';
|
|
1
|
+
import { type Assets } from 'assets-webpack-plugin';
|
|
2
2
|
export declare function processAssetsPluginOutput(assets: Assets): string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type RspackOptionsNormalized } from '@rspack/core';
|
|
2
2
|
export declare const statsOptions: RspackOptionsNormalized['stats'];
|
package/build/configs/swc.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type * as rspack from '@rspack/core';
|
|
2
|
-
import type
|
|
3
|
-
import type
|
|
4
|
-
import { AppContextWithConfigs } from '../app-configs/types';
|
|
5
|
-
import { createSingleClientWebpackConfig } from '../webpack.client';
|
|
6
|
-
import { findLoader } from './find-loader';
|
|
7
|
-
import { findPlugin } from './find-plugin';
|
|
2
|
+
import { type Configuration as RspackDevServerConfiguration } from '@rspack/dev-server';
|
|
3
|
+
import { type Options as SwcOptions } from '@swc/core';
|
|
4
|
+
import { type AppContextWithConfigs } from '../app-configs/types';
|
|
5
|
+
import { type createSingleClientWebpackConfig } from '../webpack.client';
|
|
6
|
+
import { type findLoader } from './find-loader';
|
|
7
|
+
import { type findPlugin } from './find-plugin';
|
|
8
8
|
type Overrides = {
|
|
9
9
|
webpack: rspack.Configuration | rspack.Configuration[];
|
|
10
10
|
webpackClient: rspack.Configuration | rspack.Configuration[];
|
|
@@ -23,10 +23,6 @@ function compressWithDcb(inputFile, dictionaryData) {
|
|
|
23
23
|
const compressedData = yield (0, brotli_dict_1.compress)(inputFile, {
|
|
24
24
|
dictionary: dictionaryData,
|
|
25
25
|
});
|
|
26
|
-
return buffer_1.Buffer.concat([
|
|
27
|
-
magicNumberHeader,
|
|
28
|
-
dictionaryHash,
|
|
29
|
-
buffer_1.Buffer.from(compressedData),
|
|
30
|
-
]);
|
|
26
|
+
return buffer_1.Buffer.concat([magicNumberHeader, dictionaryHash, buffer_1.Buffer.from(compressedData)]);
|
|
31
27
|
});
|
|
32
28
|
}
|
|
@@ -34,7 +34,7 @@ function compressionPluginsForDictionaries() {
|
|
|
34
34
|
const dictionaries = fs_1.default.readdirSync(dictionaryPath);
|
|
35
35
|
const parsedDictionaries = dictionaries.reduce((map, current) => {
|
|
36
36
|
const parsed = parseFilename(current);
|
|
37
|
-
return
|
|
37
|
+
return Object.assign(Object.assign({}, map), { [`${parsed.stableName}.${parsed.ext}`]: parsed });
|
|
38
38
|
}, {});
|
|
39
39
|
return new dcb_compression_plugin_1.CustomCompressionPlugin({
|
|
40
40
|
test: /\.js$|\.css$/,
|
|
@@ -61,13 +61,10 @@ function compressionPluginsForDictionaries() {
|
|
|
61
61
|
catch (e) {
|
|
62
62
|
return input;
|
|
63
63
|
}
|
|
64
|
-
})
|
|
64
|
+
}),
|
|
65
65
|
});
|
|
66
66
|
});
|
|
67
|
-
return [
|
|
68
|
-
...predefinedPlugins,
|
|
69
|
-
...prevVersionPlugins,
|
|
70
|
-
];
|
|
67
|
+
return [...predefinedPlugins, ...prevVersionPlugins];
|
|
71
68
|
}
|
|
72
69
|
function parseFilename(filename) {
|
|
73
70
|
const parsedName = path_1.default.parse(filename);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Assets, Compilation, Compiler } from '@rspack/core';
|
|
2
|
-
import { PathData } from '@rspack/core/dist/Compilation';
|
|
3
|
-
import { Rules } from 'compression-webpack-plugin';
|
|
1
|
+
import { type Assets, type Compilation, type Compiler } from '@rspack/core';
|
|
2
|
+
import { type PathData } from '@rspack/core/dist/Compilation';
|
|
3
|
+
import { type Rules } from 'compression-webpack-plugin';
|
|
4
4
|
type DcbCompressionOptions = {
|
|
5
5
|
test?: Rules;
|
|
6
6
|
include?: Rules;
|
|
@@ -42,7 +42,8 @@ class CustomCompressionPlugin {
|
|
|
42
42
|
.createHash('md5')
|
|
43
43
|
.update((0, serialize_javascript_1.default)(this.options.filename))
|
|
44
44
|
.digest('hex')}`;
|
|
45
|
-
if (asset.info.related &&
|
|
45
|
+
if (asset.info.related &&
|
|
46
|
+
asset.info.related[relatedName]) {
|
|
46
47
|
return false;
|
|
47
48
|
}
|
|
48
49
|
const cacheItem = cache.getItemCache((0, serialize_javascript_1.default)({
|
|
@@ -69,7 +70,15 @@ class CustomCompressionPlugin {
|
|
|
69
70
|
return false;
|
|
70
71
|
}
|
|
71
72
|
}
|
|
72
|
-
return {
|
|
73
|
+
return {
|
|
74
|
+
name,
|
|
75
|
+
source: asset.source,
|
|
76
|
+
info: asset.info,
|
|
77
|
+
buffer,
|
|
78
|
+
output,
|
|
79
|
+
cacheItem,
|
|
80
|
+
relatedName,
|
|
81
|
+
};
|
|
73
82
|
})))).filter(Boolean);
|
|
74
83
|
const { RawSource } = compiler.webpack.sources;
|
|
75
84
|
const scheduledTasks = [];
|
|
@@ -89,8 +98,7 @@ class CustomCompressionPlugin {
|
|
|
89
98
|
return;
|
|
90
99
|
}
|
|
91
100
|
}
|
|
92
|
-
if (output.compressed.length / buffer.length >
|
|
93
|
-
this.options.minRatio) {
|
|
101
|
+
if (output.compressed.length / buffer.length > this.options.minRatio) {
|
|
94
102
|
yield cacheItem.storePromise({ compressed: output.compressed });
|
|
95
103
|
return;
|
|
96
104
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Configuration, type RuleSetRule } from '@rspack/core';
|
|
2
2
|
export declare function findLoader(config: Configuration, testRule: string): RuleSetRule | undefined;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { Worker } from 'cluster';
|
|
2
|
-
import { ReactRefreshPluginOptions } from '@pmmmwh/react-refresh-webpack-plugin/types/lib/types';
|
|
3
|
-
import { type
|
|
4
|
-
import { BannerPluginOptions } from '@rspack/core/dist/builtin-plugin/BannerPlugin';
|
|
5
|
-
import AssetsPlugin from 'assets-webpack-plugin';
|
|
6
|
-
import CaseSensitivePathsPlugin from 'case-sensitive-paths-webpack-plugin';
|
|
7
|
-
import CompressionPlugin from 'compression-webpack-plugin';
|
|
8
|
-
import { ForkTsCheckerWebpackPluginOptions } from 'fork-ts-checker-webpack-plugin/lib/ForkTsCheckerWebpackPluginOptions';
|
|
9
|
-
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
|
10
|
-
import { RunScriptWebpackPlugin } from 'run-script-webpack-plugin';
|
|
11
|
-
import { WebpackDeduplicationPlugin } from 'webpack-deduplication-plugin';
|
|
12
|
-
import { WebpackManifestPlugin } from 'webpack-manifest-plugin';
|
|
1
|
+
import { type Worker } from 'cluster';
|
|
2
|
+
import { type ReactRefreshPluginOptions } from '@pmmmwh/react-refresh-webpack-plugin/types/lib/types';
|
|
3
|
+
import { type Configuration, type CssExtractRspackPluginOptions, type DefinePlugin, type NormalModuleReplacementPlugin } from '@rspack/core';
|
|
4
|
+
import { type BannerPluginOptions } from '@rspack/core/dist/builtin-plugin/BannerPlugin';
|
|
5
|
+
import type AssetsPlugin from 'assets-webpack-plugin';
|
|
6
|
+
import type CaseSensitivePathsPlugin from 'case-sensitive-paths-webpack-plugin';
|
|
7
|
+
import type CompressionPlugin from 'compression-webpack-plugin';
|
|
8
|
+
import { type ForkTsCheckerWebpackPluginOptions } from 'fork-ts-checker-webpack-plugin/lib/ForkTsCheckerWebpackPluginOptions';
|
|
9
|
+
import type MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
|
10
|
+
import { type RunScriptWebpackPlugin } from 'run-script-webpack-plugin';
|
|
11
|
+
import { type WebpackDeduplicationPlugin } from 'webpack-deduplication-plugin';
|
|
12
|
+
import { type WebpackManifestPlugin } from 'webpack-manifest-plugin';
|
|
13
13
|
type PluginsListClient = {
|
|
14
14
|
AssetsWebpackPlugin: {
|
|
15
15
|
options: AssetsPlugin.Options;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { AppConfigs } from '../app-configs/types';
|
|
1
|
+
import { type AppConfigs } from '../app-configs/types';
|
|
2
2
|
export declare function getPolyfills(config: AppConfigs): string[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Configuration } from '@rspack/core';
|
|
2
|
-
import { Entry } from './util/get-entry';
|
|
1
|
+
import { type Configuration } from '@rspack/core';
|
|
2
|
+
import { type Entry } from './util/get-entry';
|
|
3
3
|
/**
|
|
4
4
|
* Создает конфигурацию для сборки клиентского кода. Может быть использована для создания дополнительных конфигураций.
|
|
5
5
|
* @param mode Режим сборки (dev или prod)
|
|
@@ -40,7 +40,6 @@ const css_minimizer_webpack_plugin_1 = __importDefault(require("css-minimizer-we
|
|
|
40
40
|
const fork_ts_checker_webpack_plugin_1 = __importDefault(require("fork-ts-checker-webpack-plugin"));
|
|
41
41
|
const html_webpack_plugin_1 = __importDefault(require("html-webpack-plugin"));
|
|
42
42
|
const rspack_manifest_plugin_1 = require("rspack-manifest-plugin");
|
|
43
|
-
const terser_webpack_plugin_1 = __importDefault(require("terser-webpack-plugin"));
|
|
44
43
|
const webpack_deduplication_plugin_1 = require("webpack-deduplication-plugin");
|
|
45
44
|
const arui_runtime_1 = require("../plugins/arui-runtime");
|
|
46
45
|
const html_template_1 = require("../templates/html.template");
|
|
@@ -81,10 +80,7 @@ function getMinimizeConfig(mode) {
|
|
|
81
80
|
if (mode === 'prod') {
|
|
82
81
|
return {
|
|
83
82
|
minimize: true,
|
|
84
|
-
minimizer: [
|
|
85
|
-
new terser_webpack_plugin_1.default(),
|
|
86
|
-
new css_minimizer_webpack_plugin_1.default(),
|
|
87
|
-
].filter(Boolean),
|
|
83
|
+
minimizer: [new core_1.SwcJsMinimizerRspackPlugin(), new css_minimizer_webpack_plugin_1.default()].filter(Boolean),
|
|
88
84
|
};
|
|
89
85
|
}
|
|
90
86
|
if (app_configs_1.configs.keepCssVars) {
|
|
@@ -321,9 +317,10 @@ const createSingleClientWebpackConfig = (mode, entry, configName) => (Object.ass
|
|
|
321
317
|
filename: '../index.html',
|
|
322
318
|
}),
|
|
323
319
|
mode === 'dev' && app_configs_1.configs.clientOnly && new client_env_config_1.ClientConfigPlugin(),
|
|
324
|
-
app_configs_1.configs.compressionPredefinedDictionaryPath &&
|
|
325
|
-
|
|
326
|
-
|
|
320
|
+
app_configs_1.configs.compressionPredefinedDictionaryPath &&
|
|
321
|
+
new core_1.CopyRspackPlugin({
|
|
322
|
+
patterns: app_configs_1.configs.compressionPredefinedDictionaryPath,
|
|
323
|
+
}),
|
|
327
324
|
// production plugins:
|
|
328
325
|
mode === 'prod' && new rspack_manifest_plugin_1.RspackManifestPlugin({}),
|
|
329
326
|
mode === 'prod' &&
|
|
@@ -342,7 +339,7 @@ const createSingleClientWebpackConfig = (mode, entry, configName) => (Object.ass
|
|
|
342
339
|
test: /\.(js|css|html|svg|dict)$/,
|
|
343
340
|
compressionOptions: {
|
|
344
341
|
params: {
|
|
345
|
-
[zlib.constants.BROTLI_PARAM_QUALITY]: 11
|
|
342
|
+
[zlib.constants.BROTLI_PARAM_QUALITY]: 11,
|
|
346
343
|
},
|
|
347
344
|
},
|
|
348
345
|
threshold: 10240,
|
|
@@ -356,9 +353,9 @@ const createSingleClientWebpackConfig = (mode, entry, configName) => (Object.ass
|
|
|
356
353
|
mode === 'prod' &&
|
|
357
354
|
!app_configs_1.configs.keepPropTypes &&
|
|
358
355
|
new core_1.NormalModuleReplacementPlugin(/^thrift-services\/proptypes/, noopPath),
|
|
359
|
-
]
|
|
360
|
-
...(mode === 'prod' ? (0, compression_plugins_for_dictionaries_1.compressionPluginsForDictionaries)() : [])
|
|
361
|
-
|
|
356
|
+
]
|
|
357
|
+
.concat([...(mode === 'prod' ? (0, compression_plugins_for_dictionaries_1.compressionPluginsForDictionaries)() : [])])
|
|
358
|
+
.filter(Boolean),
|
|
362
359
|
// Без этого комиляция трирегилась на изменение в node_modules и приводила к утечке памяти
|
|
363
360
|
watchOptions: {
|
|
364
361
|
ignored: new RegExp(app_configs_1.configs.watchIgnorePath.join('|')),
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Configuration } from '@rspack/core';
|
|
1
|
+
import { type Configuration } from '@rspack/core';
|
|
2
2
|
export declare const createServerConfig: (mode: "dev" | "prod") => Configuration;
|
|
@@ -26,7 +26,7 @@ exports.AruiRuntimePlugin = AruiRuntimePlugin;
|
|
|
26
26
|
function getInsertCssRuntimeMethod() {
|
|
27
27
|
/* eslint-disable no-var,vars-on-top,prefer-destructuring */
|
|
28
28
|
return function insertCssRuntime(linkTag) {
|
|
29
|
-
if (__webpack_require__
|
|
29
|
+
if (__webpack_require__ === null || __webpack_require__ === void 0 ? void 0 : __webpack_require__.$ARUI.scriptSource) {
|
|
30
30
|
var scriptSource = __webpack_require__.$ARUI.scriptSource;
|
|
31
31
|
var targetElementSelector = scriptSource.getAttribute('data-resources-target-selector');
|
|
32
32
|
if (targetElementSelector) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AtRule, Helpers, Root, Rule } from 'postcss';
|
|
1
|
+
import { type AtRule, type Helpers, type Root, Rule } from 'postcss';
|
|
2
2
|
export declare const getMediaQueryName: (rule: AtRule) => string;
|
|
3
3
|
export declare function parseImport(root: Root, postcssHelpers: Helpers, filePath: string): Root;
|
|
4
4
|
export declare const parseVariables: (importedFile: Root, parsedVariables: Record<string, string>) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Compiler, RspackPluginInstance } from '@rspack/core';
|
|
1
|
+
import { type Compiler, type RspackPluginInstance } from '@rspack/core';
|
|
2
2
|
/**
|
|
3
3
|
* Force remote entry not be affected by user's chunkSplit strategy,
|
|
4
4
|
* Otherwise, the remote chunk will not be loaded correctly.
|
|
@@ -8,7 +8,9 @@ const nginxTemplate = `client_max_body_size 20m;
|
|
|
8
8
|
server {
|
|
9
9
|
listen ${app_configs_1.configs.clientServerPort};
|
|
10
10
|
server_tokens off;
|
|
11
|
-
${app_configs_1.configs.dictionaryCompression.enablePreviousVersionHeaders
|
|
11
|
+
${app_configs_1.configs.dictionaryCompression.enablePreviousVersionHeaders
|
|
12
|
+
? 'brotli_auto_dictionary on;'
|
|
13
|
+
: ''}
|
|
12
14
|
|
|
13
15
|
${app_configs_1.configs.clientOnly
|
|
14
16
|
? `location / {
|