arui-scripts 19.0.8 → 20.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 +7 -7
- package/CHANGELOG.md +23 -0
- package/README.md +1 -1
- package/build/bin/index.js +0 -5
- package/build/commands/archive-build/index.js +18 -18
- package/build/commands/build/build-wrapper.js +3 -5
- package/build/commands/build/client.js +5 -7
- package/build/commands/build/index.js +1 -3
- package/build/commands/build/server.js +2 -4
- package/build/commands/bundle-analyze/index.js +7 -9
- package/build/commands/changelog/index.js +27 -9
- package/build/commands/docker-build/index.js +18 -18
- package/build/commands/docker-build-compiled/index.js +14 -14
- package/build/commands/ensure-yarn/index.js +0 -1
- package/build/commands/start/client.js +2 -5
- package/build/commands/start/index.js +1 -3
- package/build/commands/start/print-compiler-output.d.ts +2 -1
- package/build/commands/start/print-compiler-output.js +3 -3
- package/build/commands/start/server.js +2 -5
- package/build/commands/start-prod/client.js +2 -5
- package/build/commands/start-prod/index.js +1 -3
- package/build/commands/start-prod/server.js +2 -5
- package/build/commands/test/index.js +0 -2
- package/build/commands/util/client-assets-sizes.js +0 -1
- package/build/commands/util/docker-build.js +14 -14
- package/build/commands/util/exec.d.ts +1 -2
- package/build/commands/util/exec.js +2 -4
- package/build/commands/util/format-webpack-messages.d.ts +4 -10
- package/build/commands/util/format-webpack-messages.js +21 -22
- package/build/commands/util/make-tmp-dir.d.ts +1 -2
- package/build/commands/util/make-tmp-dir.js +1 -1
- package/build/commands/util/run-client-dev-server.js +7 -9
- package/build/commands/util/run-server-watch-compiler.js +4 -7
- package/build/configs/app-configs/index.d.ts +0 -1
- package/build/configs/app-configs/index.js +0 -1
- package/build/configs/app-configs/types.d.ts +2 -2
- package/build/configs/app-configs/warn-about-deprecations.js +5 -3
- package/build/configs/babel-client.d.ts +1 -2
- package/build/configs/babel-client.js +5 -8
- package/build/configs/babel-dependencies.js +4 -7
- package/build/configs/babel-server.d.ts +1 -2
- package/build/configs/babel-server.js +7 -10
- package/build/configs/dev-server.d.ts +1 -2
- package/build/configs/dev-server.js +7 -6
- package/build/configs/jest/babel-transform.js +1 -1
- package/build/configs/jest/settings.js +1 -1
- package/build/configs/modules.js +5 -3
- package/build/configs/postcss.config.d.ts +2 -2
- package/build/configs/postcss.config.js +9 -11
- package/build/configs/postcss.d.ts +1 -2
- package/build/configs/postcss.js +3 -8
- package/build/configs/process-assets-plugin-output.js +8 -8
- package/build/configs/server-externals-exemptions.js +2 -6
- package/build/configs/stats-options.d.ts +1 -2
- package/build/configs/stats-options.js +3 -6
- package/build/configs/supporting-browsers.d.ts +1 -2
- package/build/configs/supporting-browsers.js +3 -6
- package/build/configs/swc.js +5 -10
- package/build/configs/util/apply-overrides.d.ts +2 -2
- package/build/configs/util/apply-overrides.js +5 -9
- package/build/configs/util/check-node-version.d.ts +1 -2
- package/build/configs/util/check-node-version.js +1 -1
- package/build/configs/util/find-loader.js +3 -3
- package/build/configs/util/get-entry.d.ts +1 -2
- package/build/configs/util/get-entry.js +1 -1
- package/build/configs/util/get-polyfills.d.ts +1 -1
- package/build/configs/util/get-polyfills.js +1 -14
- package/build/configs/util/get-webpack-cache-dependencies.js +4 -7
- package/build/configs/util/install-sourcemap-support.js +0 -1
- package/build/configs/util/register-ts-node.js +0 -1
- package/build/configs/webpack.client.dev.d.ts +1 -2
- package/build/configs/webpack.client.dev.js +3 -6
- package/build/configs/webpack.client.js +23 -71
- package/build/configs/webpack.client.prod.d.ts +1 -2
- package/build/configs/webpack.client.prod.js +3 -6
- package/build/configs/webpack.server.dev.d.ts +1 -2
- package/build/configs/webpack.server.dev.js +3 -6
- package/build/configs/webpack.server.js +35 -39
- package/build/configs/webpack.server.prod.d.ts +1 -2
- package/build/configs/webpack.server.prod.js +3 -6
- package/build/plugins/arui-runtime/index.js +2 -2
- package/build/plugins/postcss-global-variables/utils/utils.js +4 -4
- package/build/plugins/postcss-prefix-selector.js +5 -2
- package/build/templates/base-nginx.conf.template.d.ts +1 -2
- package/build/templates/base-nginx.conf.template.js +3 -5
- package/build/templates/dockerfile-compiled.template.d.ts +1 -2
- package/build/templates/dockerfile-compiled.template.js +7 -9
- package/build/templates/dockerfile.template.d.ts +1 -2
- package/build/templates/dockerfile.template.js +10 -8
- package/build/templates/html.template.js +2 -5
- package/build/templates/nginx.conf.template.d.ts +1 -2
- package/build/templates/nginx.conf.template.js +3 -5
- package/build/templates/start.template.d.ts +1 -2
- package/build/templates/start.template.js +3 -5
- package/build/tsconfig-local.tsbuildinfo +1 -1
- package/docs/modules.md +1 -2
- package/docs/settings.md +1 -1
- package/package.json +2 -2
- package/tsconfig.json +2 -1
|
@@ -20,12 +20,12 @@ const path_1 = __importDefault(require("path"));
|
|
|
20
20
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
21
21
|
const satisfies_1 = __importDefault(require("semver/functions/satisfies"));
|
|
22
22
|
const shelljs_1 = __importDefault(require("shelljs"));
|
|
23
|
-
const app_configs_1 =
|
|
23
|
+
const app_configs_1 = require("../../configs/app-configs");
|
|
24
24
|
const get_defaults_1 = require("../../configs/app-configs/get-defaults");
|
|
25
25
|
function getBuildParamsFromArgs() {
|
|
26
|
-
let imageVersion = app_configs_1.
|
|
27
|
-
let imageName = app_configs_1.
|
|
28
|
-
let { dockerRegistry } = app_configs_1.
|
|
26
|
+
let imageVersion = app_configs_1.configs.version;
|
|
27
|
+
let imageName = app_configs_1.configs.name;
|
|
28
|
+
let { dockerRegistry } = app_configs_1.configs;
|
|
29
29
|
const commandLineArguments = process.argv.slice(3);
|
|
30
30
|
commandLineArguments.forEach((arg) => {
|
|
31
31
|
let [argName, argValue] = arg.split('=');
|
|
@@ -46,7 +46,7 @@ function getBuildParamsFromArgs() {
|
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
48
|
const tempDirName = '.docker-build';
|
|
49
|
-
const pathToTempDir = path_1.default.join(app_configs_1.
|
|
49
|
+
const pathToTempDir = path_1.default.join(app_configs_1.configs.cwd, tempDirName);
|
|
50
50
|
const imageFullName = `${dockerRegistry ? `${dockerRegistry}/` : ''}${imageName}:${imageVersion}`;
|
|
51
51
|
return {
|
|
52
52
|
pathToTempDir,
|
|
@@ -58,19 +58,19 @@ function prepareFilesForDocker(_a) {
|
|
|
58
58
|
return __awaiter(this, arguments, void 0, function* ({ dockerfileTemplate, nginxConfTemplate, nginxBaseConfTemplate, startScriptTemplate, pathToTempDir, allowLocalDockerfile, allowLocalStartScript, addNodeModulesToDockerIgnore, }) {
|
|
59
59
|
yield fs_extra_1.default.emptyDir(pathToTempDir);
|
|
60
60
|
let nginxBaseConf = '';
|
|
61
|
-
if (app_configs_1.
|
|
62
|
-
nginxBaseConf = app_configs_1.
|
|
63
|
-
? yield fs_extra_1.default.readFile(app_configs_1.
|
|
61
|
+
if (app_configs_1.configs.nginx) {
|
|
62
|
+
nginxBaseConf = app_configs_1.configs.localNginxBaseConf
|
|
63
|
+
? yield fs_extra_1.default.readFile(app_configs_1.configs.localNginxBaseConf, 'utf8')
|
|
64
64
|
: nginxBaseConfTemplate;
|
|
65
65
|
}
|
|
66
|
-
const nginxConf = app_configs_1.
|
|
67
|
-
? yield fs_extra_1.default.readFile(app_configs_1.
|
|
66
|
+
const nginxConf = app_configs_1.configs.localNginxConf
|
|
67
|
+
? yield fs_extra_1.default.readFile(app_configs_1.configs.localNginxConf, 'utf8')
|
|
68
68
|
: nginxConfTemplate;
|
|
69
|
-
const dockerfile = app_configs_1.
|
|
70
|
-
? yield fs_extra_1.default.readFile(app_configs_1.
|
|
69
|
+
const dockerfile = app_configs_1.configs.localDockerfile && allowLocalDockerfile
|
|
70
|
+
? yield fs_extra_1.default.readFile(app_configs_1.configs.localDockerfile, 'utf8')
|
|
71
71
|
: dockerfileTemplate;
|
|
72
|
-
const startScript = app_configs_1.
|
|
73
|
-
? yield fs_extra_1.default.readFile(app_configs_1.
|
|
72
|
+
const startScript = app_configs_1.configs.localStartScript && allowLocalStartScript
|
|
73
|
+
? yield fs_extra_1.default.readFile(app_configs_1.configs.localStartScript, 'utf8')
|
|
74
74
|
: startScriptTemplate;
|
|
75
75
|
const dockerIgnoreFilePath = path_1.default.join(process.cwd(), '.dockerignore');
|
|
76
76
|
const dockerIgnoreFileContent = addNodeModulesToDockerIgnore &&
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
declare function exec(command: string): Promise<unknown>;
|
|
2
|
-
export default exec;
|
|
1
|
+
export declare function exec(command: string): Promise<unknown>;
|
|
@@ -3,18 +3,16 @@ 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
|
-
|
|
6
|
+
exports.exec = exec;
|
|
7
7
|
const shelljs_1 = __importDefault(require("shelljs"));
|
|
8
8
|
function exec(command) {
|
|
9
9
|
return new Promise((resolve, reject) => {
|
|
10
10
|
console.log(`Executing command: ${command}`);
|
|
11
|
-
// eslint-disable-next-line consistent-return
|
|
12
11
|
shelljs_1.default.exec(command, (code) => {
|
|
13
12
|
if (code === 0) {
|
|
14
13
|
return resolve(code);
|
|
15
14
|
}
|
|
16
|
-
reject(code);
|
|
15
|
+
return reject(code);
|
|
17
16
|
});
|
|
18
17
|
});
|
|
19
18
|
}
|
|
20
|
-
exports.default = exec;
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
declare function formatWebpackMessages(json: any): {
|
|
8
|
-
errors: any;
|
|
9
|
-
warnings: any;
|
|
1
|
+
import { StatsCompilation } from '@rspack/core';
|
|
2
|
+
export declare function formatWebpackMessages(json: StatsCompilation | undefined): {
|
|
3
|
+
errors: string[];
|
|
4
|
+
warnings: string[];
|
|
10
5
|
};
|
|
11
|
-
export default formatWebpackMessages;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatWebpackMessages = formatWebpackMessages;
|
|
4
4
|
/**
|
|
5
5
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
9
|
*/
|
|
10
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
10
|
// WARNING: this code is untranspiled and is used in browser too.
|
|
12
11
|
// Please make sure any changes are in ES5 or contribute a Babel compile step.
|
|
13
12
|
// Some custom utilities to prettify Webpack output.
|
|
@@ -20,12 +19,12 @@ function isLikelyASyntaxError(message) {
|
|
|
20
19
|
return message.includes(friendlySyntaxErrorLabel);
|
|
21
20
|
}
|
|
22
21
|
// Cleans up webpack error messages.
|
|
23
|
-
// eslint-disable-next-line no-unused-vars
|
|
24
22
|
function formatMessage(message) {
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
let newMessage = message;
|
|
24
|
+
if (typeof newMessage !== 'string') {
|
|
25
|
+
newMessage = newMessage.message;
|
|
27
26
|
}
|
|
28
|
-
let lines =
|
|
27
|
+
let lines = newMessage.split('\n');
|
|
29
28
|
// Strip webpack-added headers off errors/warnings
|
|
30
29
|
// https://github.com/webpack/webpack/blob/master/lib/ModuleError.js
|
|
31
30
|
lines = lines.filter((line) => !/Module [A-z ]+\(from/.test(line));
|
|
@@ -39,14 +38,14 @@ function formatMessage(message) {
|
|
|
39
38
|
const [, errorLine, errorColumn, errorMessage] = parsingError;
|
|
40
39
|
return `${friendlySyntaxErrorLabel} ${errorMessage} (${errorLine}:${errorColumn})`;
|
|
41
40
|
});
|
|
42
|
-
|
|
41
|
+
newMessage = lines.join('\n');
|
|
43
42
|
// Smoosh syntax errors (commonly found in CSS)
|
|
44
|
-
|
|
43
|
+
newMessage = newMessage.replace(/SyntaxError\s+\((\d+):(\d+)\)\s*(.+?)\n/g, `${friendlySyntaxErrorLabel} $3 ($1:$2)\n`);
|
|
45
44
|
// Clean up export errors
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
lines =
|
|
45
|
+
newMessage = newMessage.replace(/^.*export '(.+?)' was not found in '(.+?)'.*$/gm, "Attempted import error: '$1' is not exported from '$2'.");
|
|
46
|
+
newMessage = newMessage.replace(/^.*export 'default' \(imported as '(.+?)'\) was not found in '(.+?)'.*$/gm, "Attempted import error: '$2' does not contain a default export (imported as '$1').");
|
|
47
|
+
newMessage = newMessage.replace(/^.*export '(.+?)' \(imported as '(.+?)'\) was not found in '(.+?)'.*$/gm, "Attempted import error: '$1' is not exported from '$3' (imported as '$2').");
|
|
48
|
+
lines = newMessage.split('\n');
|
|
50
49
|
// Remove leading newline
|
|
51
50
|
if (lines.length > 2 && lines[1].trim() === '') {
|
|
52
51
|
lines.splice(1, 1);
|
|
@@ -68,23 +67,24 @@ function formatMessage(message) {
|
|
|
68
67
|
lines[1] += 'Run `npm install node-sass` or `yarn add node-sass` inside your workspace.';
|
|
69
68
|
}
|
|
70
69
|
lines[0] = chalk.inverse(lines[0]);
|
|
71
|
-
|
|
70
|
+
newMessage = lines.join('\n');
|
|
72
71
|
// Internal stacks are generally useless so we strip them... with the
|
|
73
72
|
// exception of stacks containing `webpack:` because they're normally
|
|
74
73
|
// from user code generated by webpack. For more information see
|
|
75
74
|
// https://github.com/facebook/create-react-app/pull/1050
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
lines =
|
|
75
|
+
newMessage = newMessage.replace(/^\s*at\s((?!webpack:).)*:\d+:\d+[\s)]*(\n|$)/gm, ''); // at ... ...:x:y
|
|
76
|
+
newMessage = newMessage.replace(/^\s*at\s<anonymous>(\n|$)/gm, ''); // at <anonymous>
|
|
77
|
+
lines = newMessage.split('\n');
|
|
79
78
|
// Remove duplicated newlines
|
|
80
79
|
lines = lines.filter((line, index, arr) => index === 0 || line.trim() !== '' || line.trim() !== arr[index - 1].trim());
|
|
81
80
|
// Reassemble the message
|
|
82
|
-
|
|
83
|
-
return
|
|
81
|
+
newMessage = lines.join('\n');
|
|
82
|
+
return newMessage.trim();
|
|
84
83
|
}
|
|
85
84
|
function formatWebpackMessages(json) {
|
|
86
|
-
|
|
87
|
-
const
|
|
85
|
+
var _a, _b;
|
|
86
|
+
const formattedErrors = ((_a = json === null || json === void 0 ? void 0 : json.errors) === null || _a === void 0 ? void 0 : _a.map(formatMessage)) || [];
|
|
87
|
+
const formattedWarnings = ((_b = json === null || json === void 0 ? void 0 : json.warnings) === null || _b === void 0 ? void 0 : _b.map(formatMessage)) || [];
|
|
88
88
|
const result = { errors: formattedErrors, warnings: formattedWarnings };
|
|
89
89
|
if (result.errors.some(isLikelyASyntaxError)) {
|
|
90
90
|
// If there are any syntax errors, show just them.
|
|
@@ -92,4 +92,3 @@ function formatWebpackMessages(json) {
|
|
|
92
92
|
}
|
|
93
93
|
return result;
|
|
94
94
|
}
|
|
95
|
-
exports.default = formatWebpackMessages;
|
|
@@ -12,6 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.makeTmpDir = makeTmpDir;
|
|
15
16
|
const fs_1 = __importDefault(require("fs"));
|
|
16
17
|
const os_1 = __importDefault(require("os"));
|
|
17
18
|
const path_1 = __importDefault(require("path"));
|
|
@@ -26,4 +27,3 @@ function makeTmpDir(prefix) {
|
|
|
26
27
|
return nodeMakeTmpDir(path_1.default.join(os_1.default.tmpdir(), prefix || ''));
|
|
27
28
|
});
|
|
28
29
|
}
|
|
29
|
-
exports.default = makeTmpDir;
|
|
@@ -8,23 +8,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
12
|
exports.runClientDevServer = runClientDevServer;
|
|
13
|
+
const util_1 = require("util");
|
|
16
14
|
const WebpackDevServerUtils_1 = require("react-dev-utils/WebpackDevServerUtils");
|
|
17
15
|
const core_1 = require("@rspack/core");
|
|
18
16
|
const dev_server_1 = require("@rspack/dev-server");
|
|
19
|
-
const dev_server_2 =
|
|
20
|
-
const print_compiler_output_1 =
|
|
17
|
+
const dev_server_2 = require("../../configs/dev-server");
|
|
18
|
+
const print_compiler_output_1 = require("../start/print-compiler-output");
|
|
21
19
|
function runClientDevServer(configuration) {
|
|
22
20
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
21
|
const clientCompiler = (0, core_1.rspack)(configuration);
|
|
24
|
-
const clientDevServer = new dev_server_1.RspackDevServer(dev_server_2.
|
|
22
|
+
const clientDevServer = new dev_server_1.RspackDevServer(dev_server_2.devServerConfig, clientCompiler);
|
|
25
23
|
clientCompiler.hooks.invalid.tap('client', () => console.log('Compiling client...'));
|
|
26
|
-
clientCompiler.hooks.done.tap('client', (stats) => (0, print_compiler_output_1.
|
|
27
|
-
const DEFAULT_PORT = dev_server_2.
|
|
24
|
+
clientCompiler.hooks.done.tap('client', (stats) => (0, print_compiler_output_1.printCompilerOutput)('Client', stats));
|
|
25
|
+
const DEFAULT_PORT = dev_server_2.devServerConfig.port;
|
|
28
26
|
const HOST = '0.0.0.0';
|
|
29
27
|
try {
|
|
30
28
|
const port = yield (0, WebpackDevServerUtils_1.choosePort)(HOST, +(DEFAULT_PORT || 0));
|
|
@@ -37,7 +35,7 @@ function runClientDevServer(configuration) {
|
|
|
37
35
|
});
|
|
38
36
|
}
|
|
39
37
|
catch (err) {
|
|
40
|
-
if (err
|
|
38
|
+
if (util_1.types.isNativeError(err)) {
|
|
41
39
|
console.log(err.message);
|
|
42
40
|
}
|
|
43
41
|
process.exit(1);
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.runServerWatchCompiler = runServerWatchCompiler;
|
|
7
4
|
const core_1 = require("@rspack/core");
|
|
8
|
-
const app_configs_1 =
|
|
9
|
-
const print_compiler_output_1 =
|
|
5
|
+
const app_configs_1 = require("../../configs/app-configs");
|
|
6
|
+
const print_compiler_output_1 = require("../start/print-compiler-output");
|
|
10
7
|
function runServerWatchCompiler(config) {
|
|
11
8
|
const serverCompiler = (0, core_1.rspack)(config);
|
|
12
9
|
serverCompiler.hooks.compile.tap('server', () => console.log('Compiling server...'));
|
|
13
10
|
serverCompiler.hooks.invalid.tap('server', () => console.log('Compiling server...'));
|
|
14
|
-
serverCompiler.hooks.done.tap('server', (stats) => (0, print_compiler_output_1.
|
|
11
|
+
serverCompiler.hooks.done.tap('server', (stats) => (0, print_compiler_output_1.printCompilerOutput)('Server', stats));
|
|
15
12
|
serverCompiler.watch({
|
|
16
13
|
aggregateTimeout: 50, // Делаем это значение меньше чем у клиента, чтобы сервер пересобирался быстрее
|
|
17
|
-
ignored: new RegExp(app_configs_1.
|
|
14
|
+
ignored: new RegExp(app_configs_1.configs.watchIgnorePath.join('|')),
|
|
18
15
|
}, () => { });
|
|
19
16
|
}
|
|
@@ -21,4 +21,3 @@ exports.appContext = tmpContext;
|
|
|
21
21
|
exports.appConfigs = tmpConfig;
|
|
22
22
|
exports.configs = Object.assign(Object.assign({}, exports.appConfigs), exports.appContext);
|
|
23
23
|
(0, warn_about_deprecations_1.warnAboutDeprecations)(exports.configs);
|
|
24
|
-
exports.default = exports.configs;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DevTool } from '@rspack/core';
|
|
1
|
+
import { DevTool, Shared } from '@rspack/core';
|
|
2
2
|
import { RspackDevServer } from '@rspack/dev-server';
|
|
3
3
|
/**
|
|
4
4
|
* Конфигурация arui-scripts, которая может быть переопределена приложением
|
|
@@ -75,7 +75,7 @@ export type AppConfigs = {
|
|
|
75
75
|
} | null;
|
|
76
76
|
modules: {
|
|
77
77
|
name?: string;
|
|
78
|
-
shared:
|
|
78
|
+
shared: Shared;
|
|
79
79
|
exposes?: Record<string, string>;
|
|
80
80
|
options?: ModuleConfigBase;
|
|
81
81
|
shareScope?: string;
|
|
@@ -12,9 +12,11 @@ function convertObjectProxyConfigurationToArray(proxyConfiguration) {
|
|
|
12
12
|
const arrayProxy = [];
|
|
13
13
|
Object.keys(proxyConfiguration).forEach((context) => {
|
|
14
14
|
const itemConfig = proxyConfiguration[context];
|
|
15
|
-
arrayProxy.push(Object.assign({ context }, (typeof itemConfig === 'string'
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
arrayProxy.push(Object.assign({ context }, (typeof itemConfig === 'string'
|
|
16
|
+
? {
|
|
17
|
+
target: itemConfig,
|
|
18
|
+
}
|
|
19
|
+
: itemConfig)));
|
|
18
20
|
});
|
|
19
21
|
return arrayProxy;
|
|
20
22
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const babelClientConfig: {
|
|
1
|
+
export declare const babelClientConfig: {
|
|
2
2
|
presets: (string | false | (string | {
|
|
3
3
|
targets: string[];
|
|
4
4
|
loose: boolean;
|
|
@@ -29,4 +29,3 @@ declare const babelClientConfig: {
|
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
31
|
};
|
|
32
|
-
export default babelClientConfig;
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
3
|
+
exports.babelClientConfig = void 0;
|
|
4
|
+
const apply_overrides_1 = require("./util/apply-overrides");
|
|
7
5
|
const app_configs_1 = require("./app-configs");
|
|
8
|
-
const supporting_browsers_1 =
|
|
9
|
-
|
|
6
|
+
const supporting_browsers_1 = require("./supporting-browsers");
|
|
7
|
+
exports.babelClientConfig = (0, apply_overrides_1.applyOverrides)(['babel', 'babelClient'], {
|
|
10
8
|
presets: [
|
|
11
9
|
[
|
|
12
10
|
require.resolve('@babel/preset-env'),
|
|
13
11
|
{
|
|
14
|
-
targets: supporting_browsers_1.
|
|
12
|
+
targets: supporting_browsers_1.supportingBrowsers,
|
|
15
13
|
loose: true,
|
|
16
14
|
// Allow importing core-js in entrypoint and use browserlist to select polyfills
|
|
17
15
|
useBuiltIns: 'entry',
|
|
@@ -69,4 +67,3 @@ const babelClientConfig = (0, apply_overrides_1.default)(['babel', 'babelClient'
|
|
|
69
67
|
},
|
|
70
68
|
},
|
|
71
69
|
});
|
|
72
|
-
exports.default = babelClientConfig;
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.babelDependencies = void 0;
|
|
7
|
-
const apply_overrides_1 =
|
|
8
|
-
const app_configs_1 =
|
|
9
|
-
exports.babelDependencies = (0, apply_overrides_1.
|
|
4
|
+
const apply_overrides_1 = require("./util/apply-overrides");
|
|
5
|
+
const app_configs_1 = require("./app-configs");
|
|
6
|
+
exports.babelDependencies = (0, apply_overrides_1.applyOverrides)('babelDependencies', {
|
|
10
7
|
sourceType: 'unambiguous',
|
|
11
8
|
presets: [
|
|
12
9
|
[
|
|
@@ -31,7 +28,7 @@ exports.babelDependencies = (0, apply_overrides_1.default)('babelDependencies',
|
|
|
31
28
|
// By default, babel assumes babel/runtime version 7.0.0-beta.0,
|
|
32
29
|
// explicitly resolving to match the provided helper functions.
|
|
33
30
|
// https://github.com/babel/babel/issues/10261
|
|
34
|
-
version: app_configs_1.
|
|
31
|
+
version: app_configs_1.configs.babelRuntimeVersion,
|
|
35
32
|
regenerator: true,
|
|
36
33
|
},
|
|
37
34
|
],
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const
|
|
3
|
+
exports.config = void 0;
|
|
4
|
+
const apply_overrides_1 = require("./util/apply-overrides");
|
|
5
|
+
const app_configs_1 = require("./app-configs");
|
|
6
|
+
exports.config = (0, apply_overrides_1.applyOverrides)(['babel', 'babelServer'], {
|
|
9
7
|
presets: [
|
|
10
8
|
[
|
|
11
9
|
require.resolve('@babel/preset-env'),
|
|
12
10
|
{ modules: false, targets: { node: 'current' }, loose: true },
|
|
13
11
|
],
|
|
14
|
-
app_configs_1.
|
|
15
|
-
app_configs_1.
|
|
12
|
+
app_configs_1.configs.tsconfig !== null &&
|
|
13
|
+
app_configs_1.configs.codeLoader !== 'tsc' &&
|
|
16
14
|
require.resolve('@babel/preset-typescript'),
|
|
17
15
|
require.resolve('@babel/preset-react'),
|
|
18
16
|
].filter(Boolean),
|
|
@@ -30,7 +28,7 @@ const config = (0, apply_overrides_1.default)(['babel', 'babelServer'], {
|
|
|
30
28
|
[require.resolve('@babel/plugin-transform-runtime'), { helpers: false }],
|
|
31
29
|
require.resolve('@babel/plugin-transform-nullish-coalescing-operator'),
|
|
32
30
|
require.resolve('@babel/plugin-transform-optional-chaining'),
|
|
33
|
-
app_configs_1.
|
|
31
|
+
app_configs_1.configs.collectCoverage && require.resolve('babel-plugin-istanbul'),
|
|
34
32
|
].filter(Boolean),
|
|
35
33
|
env: {
|
|
36
34
|
production: {
|
|
@@ -45,4 +43,3 @@ const config = (0, apply_overrides_1.default)(['babel', 'babelServer'], {
|
|
|
45
43
|
},
|
|
46
44
|
},
|
|
47
45
|
});
|
|
48
|
-
exports.default = config;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
declare const devServerConfig: import("webpack-dev-server").Configuration;
|
|
2
|
-
export default devServerConfig;
|
|
1
|
+
export declare const devServerConfig: import("webpack-dev-server").Configuration;
|
|
@@ -3,8 +3,9 @@ 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.devServerConfig = void 0;
|
|
6
7
|
const path_1 = __importDefault(require("path"));
|
|
7
|
-
const apply_overrides_1 =
|
|
8
|
+
const apply_overrides_1 = require("./util/apply-overrides");
|
|
8
9
|
const app_configs_1 = require("./app-configs");
|
|
9
10
|
const client_env_config_1 = require("./client-env-config");
|
|
10
11
|
const serverProxyConfig = Object.assign({ context: ['/**'], target: `http://127.0.0.1:${app_configs_1.configs.serverPort}`, bypass: (req) => {
|
|
@@ -14,27 +15,28 @@ const serverProxyConfig = Object.assign({ context: ['/**'], target: `http://127.
|
|
|
14
15
|
return req.url;
|
|
15
16
|
}
|
|
16
17
|
return null;
|
|
17
|
-
} }, (app_configs_1.configs.devSourceMaps && app_configs_1.configs.devSourceMaps.includes('eval') || app_configs_1.configs.devServerCors
|
|
18
|
+
} }, ((app_configs_1.configs.devSourceMaps && app_configs_1.configs.devSourceMaps.includes('eval')) || app_configs_1.configs.devServerCors
|
|
18
19
|
? {
|
|
19
20
|
onProxyRes: (proxyRes) => {
|
|
20
21
|
// Для дев режима, когда мы используем в качестве соурсмапов что-то, основанное на eval - нужно
|
|
21
22
|
// разрешить браузеру исполнять наш код, даже когда content-security-policy приложения не позволяет этого делать.
|
|
22
23
|
if (app_configs_1.configs.devSourceMaps && app_configs_1.configs.devSourceMaps.includes('eval')) {
|
|
23
24
|
const cspHeader = proxyRes.headers['content-security-policy'];
|
|
24
|
-
if (typeof cspHeader === 'string' &&
|
|
25
|
-
|
|
25
|
+
if (typeof cspHeader === 'string' && !cspHeader.includes('unsafe-eval')) {
|
|
26
|
+
// eslint-disable-next-line no-param-reassign
|
|
26
27
|
proxyRes.headers['content-security-policy'] = cspHeader.replace(/script-src/, "script-src 'unsafe-eval'");
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
30
|
// если включен devServerCors, то нужно принудительно менять статус ответа на 200, чтобы
|
|
30
31
|
// браузер не отклонял ответы с CORS
|
|
31
32
|
if (app_configs_1.configs.devServerCors && proxyRes.method === 'OPTIONS') {
|
|
33
|
+
// eslint-disable-next-line no-param-reassign
|
|
32
34
|
proxyRes.statusCode = 200;
|
|
33
35
|
}
|
|
34
36
|
},
|
|
35
37
|
}
|
|
36
38
|
: {}));
|
|
37
|
-
|
|
39
|
+
exports.devServerConfig = (0, apply_overrides_1.applyOverrides)('devServer', {
|
|
38
40
|
port: app_configs_1.configs.clientServerPort,
|
|
39
41
|
liveReload: false,
|
|
40
42
|
client: {
|
|
@@ -70,4 +72,3 @@ function getProxyConfig() {
|
|
|
70
72
|
}
|
|
71
73
|
return proxyConfig;
|
|
72
74
|
}
|
|
73
|
-
exports.default = devServerConfig;
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
4
4
|
const babelJest = require('babel-jest');
|
|
5
5
|
const babelPresets = require('../babel-server');
|
|
6
|
-
module.exports = babelJest.createTransformer(babelPresets.
|
|
6
|
+
module.exports = babelJest.createTransformer(babelPresets.config);
|
|
@@ -8,7 +8,7 @@ const fs = require('fs');
|
|
|
8
8
|
const { pathsToModuleNameMapper } = require('ts-jest');
|
|
9
9
|
const { parseConfigFileTextToJson } = require('typescript');
|
|
10
10
|
const { swcJestConfig } = require('../swc');
|
|
11
|
-
const configs = require('../app-configs')
|
|
11
|
+
const { configs } = require('../app-configs');
|
|
12
12
|
module.exports = {
|
|
13
13
|
testRegex: 'src/.*(((/__test__/|/__tests__/).*)|(test|spec|tests)).(jsx?|tsx?)$',
|
|
14
14
|
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
|
package/build/configs/modules.js
CHANGED
|
@@ -29,8 +29,6 @@ exports.patchMainWebpackConfigForModules = patchMainWebpackConfigForModules;
|
|
|
29
29
|
exports.getCssPrefixForModule = getCssPrefixForModule;
|
|
30
30
|
exports.getExposeLoadersFormCompatModules = getExposeLoadersFormCompatModules;
|
|
31
31
|
exports.patchWebpackConfigForCompat = patchWebpackConfigForCompat;
|
|
32
|
-
// TODO: remove eslint-disable
|
|
33
|
-
/* eslint-disable no-param-reassign */
|
|
34
32
|
const rspack = __importStar(require("@rspack/core"));
|
|
35
33
|
const postcss_prefix_selector_1 = require("../plugins/postcss-prefix-selector");
|
|
36
34
|
const turn_off_split_remote_entry_1 = require("../plugins/turn-off-split-remote-entry");
|
|
@@ -43,6 +41,7 @@ function haveExposedDefaultModules() {
|
|
|
43
41
|
exports.MODULES_ENTRY_NAME = 'remoteEntry.js';
|
|
44
42
|
function patchMainWebpackConfigForModules(webpackConf) {
|
|
45
43
|
var _a;
|
|
44
|
+
/* eslint-disable no-param-reassign */
|
|
46
45
|
if (app_configs_1.configs.disableModulesSupport) {
|
|
47
46
|
// проект хочет сам разбираться с WMF и прочими вещами, полностью отключаем обработку модулей на своей стороне
|
|
48
47
|
return webpackConf;
|
|
@@ -71,9 +70,10 @@ function patchMainWebpackConfigForModules(webpackConf) {
|
|
|
71
70
|
filename: app_configs_1.configs.modules.exposes ? exports.MODULES_ENTRY_NAME : undefined,
|
|
72
71
|
shared: app_configs_1.configs.modules.shared,
|
|
73
72
|
exposes: app_configs_1.configs.modules.exposes,
|
|
74
|
-
shareScope: app_configs_1.configs.modules.shareScope
|
|
73
|
+
shareScope: app_configs_1.configs.modules.shareScope,
|
|
75
74
|
}), new turn_off_split_remote_entry_1.TurnOffSplitRemoteEntry(app_configs_1.configs.modules.name || app_configs_1.configs.normalizedName));
|
|
76
75
|
return webpackConf;
|
|
76
|
+
/* eslint-enable no-param-reassign */
|
|
77
77
|
}
|
|
78
78
|
function getCssPrefixForModule(module) {
|
|
79
79
|
if (module.cssPrefix) {
|
|
@@ -136,6 +136,7 @@ function addPrefixCssRule(rule, prefix) {
|
|
|
136
136
|
];
|
|
137
137
|
}
|
|
138
138
|
function patchWebpackConfigForCompat(module, webpackConf) {
|
|
139
|
+
/* eslint-disable no-param-reassign */
|
|
139
140
|
webpackConf.externals = Object.assign(Object.assign({}, (webpackConf.externals || {})), (module.externals || {}));
|
|
140
141
|
// Название переменной вебпака, которую он будет использовать для загрузки чанков. Важно чтобы для разных модулей они отличались,
|
|
141
142
|
// иначе несколько модулей из одного приложения будут конфликтовать между собой
|
|
@@ -147,4 +148,5 @@ function patchWebpackConfigForCompat(module, webpackConf) {
|
|
|
147
148
|
addCssPrefix(webpackConf, cssPrefix);
|
|
148
149
|
}
|
|
149
150
|
return webpackConf;
|
|
151
|
+
/* eslint-enable no-param-reassign */
|
|
150
152
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { PluginCreator } from 'postcss';
|
|
2
|
-
type PostCssPluginName = string | PluginCreator<
|
|
2
|
+
type PostCssPluginName = string | PluginCreator<unknown>;
|
|
3
3
|
type PostcssPlugin = string | [string, unknown] | {
|
|
4
4
|
name: string;
|
|
5
|
-
plugin: PluginCreator<
|
|
5
|
+
plugin: PluginCreator<unknown>;
|
|
6
6
|
options?: unknown;
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
@@ -7,8 +7,8 @@ exports.postcssPluginsOptions = exports.postcssPlugins = void 0;
|
|
|
7
7
|
exports.createPostcssConfig = createPostcssConfig;
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const postcss_global_variables_1 = require("../plugins/postcss-global-variables/postcss-global-variables");
|
|
10
|
-
const app_configs_1 =
|
|
11
|
-
const supporting_browsers_1 =
|
|
10
|
+
const app_configs_1 = require("./app-configs");
|
|
11
|
+
const supporting_browsers_1 = require("./supporting-browsers");
|
|
12
12
|
/**
|
|
13
13
|
* Функция для создания конфигурационного файла postcss
|
|
14
14
|
* @param {PostCssPluginName[]} plugins список плагинов
|
|
@@ -18,14 +18,12 @@ const supporting_browsers_1 = __importDefault(require("./supporting-browsers"));
|
|
|
18
18
|
function createPostcssConfig(plugins, options) {
|
|
19
19
|
return plugins.map((pluginName) => {
|
|
20
20
|
if (typeof pluginName === 'string') {
|
|
21
|
-
return pluginName in options
|
|
22
|
-
? [pluginName, options[pluginName]]
|
|
23
|
-
: pluginName;
|
|
21
|
+
return pluginName in options ? [pluginName, options[pluginName]] : pluginName;
|
|
24
22
|
}
|
|
25
23
|
return {
|
|
26
24
|
name: pluginName.name,
|
|
27
25
|
plugin: pluginName,
|
|
28
|
-
options: options[pluginName.name]
|
|
26
|
+
options: options[pluginName.name],
|
|
29
27
|
};
|
|
30
28
|
});
|
|
31
29
|
}
|
|
@@ -39,8 +37,8 @@ exports.postcssPlugins = [
|
|
|
39
37
|
postcss_global_variables_1.postCssGlobalVariables,
|
|
40
38
|
'postcss-custom-media',
|
|
41
39
|
'postcss-color-mod-function',
|
|
42
|
-
!app_configs_1.
|
|
43
|
-
!app_configs_1.
|
|
40
|
+
!app_configs_1.configs.keepCssVars && 'postcss-custom-properties',
|
|
41
|
+
!app_configs_1.configs.keepCssVars && 'postcss-remove-root',
|
|
44
42
|
'postcss-strip-units',
|
|
45
43
|
'postcss-calc',
|
|
46
44
|
'postcss-color-function',
|
|
@@ -53,8 +51,8 @@ exports.postcssPluginsOptions = {
|
|
|
53
51
|
'postcss-import': {
|
|
54
52
|
path: ['./src'],
|
|
55
53
|
},
|
|
56
|
-
|
|
57
|
-
files: [path_1.default.join(__dirname, 'mq.css'), app_configs_1.
|
|
54
|
+
postCssGlobalVariables: {
|
|
55
|
+
files: [path_1.default.join(__dirname, 'mq.css'), app_configs_1.configs.componentsTheme].filter(Boolean),
|
|
58
56
|
},
|
|
59
57
|
'postcss-url': {
|
|
60
58
|
url: 'rebase',
|
|
@@ -66,6 +64,6 @@ exports.postcssPluginsOptions = {
|
|
|
66
64
|
preserve: false,
|
|
67
65
|
},
|
|
68
66
|
autoprefixer: {
|
|
69
|
-
overrideBrowserslist: supporting_browsers_1.
|
|
67
|
+
overrideBrowserslist: supporting_browsers_1.supportingBrowsers,
|
|
70
68
|
},
|
|
71
69
|
};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
declare const postcssConfig: (string | import("postcss").Processor | import("postcss").Plugin | [string, unknown])[];
|
|
2
|
-
export default postcssConfig;
|
|
1
|
+
export declare const postcssConfig: (string | import("postcss").Processor | import("postcss").Plugin | [string, unknown])[];
|