arui-scripts 0.0.0-beta-20260824133302
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/.eslintignore +2 -0
- package/.eslintrc.js +17 -0
- package/.prettierignore +2 -0
- package/.turbo/turbo-build.log +0 -0
- package/.turbo/turbo-test.log +23 -0
- package/CHANGELOG.md +1976 -0
- package/README.md +59 -0
- package/bin/build.sh +2 -0
- package/build/bin/index.d.ts +2 -0
- package/build/bin/index.js +26 -0
- package/build/commands/archive-build/index.d.ts +1 -0
- package/build/commands/archive-build/index.js +15 -0
- package/build/commands/build/build-wrapper.d.ts +8 -0
- package/build/commands/build/build-wrapper.js +40 -0
- package/build/commands/build/client.d.ts +1 -0
- package/build/commands/build/client.js +54 -0
- package/build/commands/build/index.d.ts +1 -0
- package/build/commands/build/index.js +11 -0
- package/build/commands/build/server.d.ts +1 -0
- package/build/commands/build/server.js +29 -0
- package/build/commands/bundle-analyze/index.d.ts +1 -0
- package/build/commands/bundle-analyze/index.js +62 -0
- package/build/commands/changelog/index.d.ts +5 -0
- package/build/commands/changelog/index.js +141 -0
- package/build/commands/docker-build/index.d.ts +1 -0
- package/build/commands/docker-build/index.js +15 -0
- package/build/commands/docker-build-compiled/index.d.ts +1 -0
- package/build/commands/docker-build-compiled/index.js +15 -0
- package/build/commands/ensure-yarn/index.d.ts +1 -0
- package/build/commands/ensure-yarn/index.js +8 -0
- package/build/commands/start/client.d.ts +1 -0
- package/build/commands/start/client.js +7 -0
- package/build/commands/start/index.d.ts +1 -0
- package/build/commands/start/index.js +13 -0
- package/build/commands/start/print-compiler-output.d.ts +2 -0
- package/build/commands/start/print-compiler-output.js +16 -0
- package/build/commands/start/server.d.ts +1 -0
- package/build/commands/start/server.js +7 -0
- package/build/commands/start-prod/client.d.ts +1 -0
- package/build/commands/start-prod/client.js +7 -0
- package/build/commands/start-prod/index.d.ts +1 -0
- package/build/commands/start-prod/index.js +13 -0
- package/build/commands/start-prod/server.d.ts +1 -0
- package/build/commands/start-prod/server.js +7 -0
- package/build/commands/test/get-config.d.ts +1 -0
- package/build/commands/test/get-config.js +83 -0
- package/build/commands/test/index.d.ts +1 -0
- package/build/commands/test/index.js +68 -0
- package/build/commands/test-vitest/index.d.ts +1 -0
- package/build/commands/test-vitest/index.js +15 -0
- package/build/commands/util/artifacts-config.d.ts +25 -0
- package/build/commands/util/artifacts-config.js +119 -0
- package/build/commands/util/artifacts-deprecations.d.ts +9 -0
- package/build/commands/util/artifacts-deprecations.js +65 -0
- package/build/commands/util/arui-scripts-artifacts.d.ts +16 -0
- package/build/commands/util/arui-scripts-artifacts.js +29 -0
- package/build/commands/util/client-assets-sizes.d.ts +2 -0
- package/build/commands/util/client-assets-sizes.js +71 -0
- package/build/commands/util/docker-build.d.ts +35 -0
- package/build/commands/util/docker-build.js +76 -0
- package/build/commands/util/exec.d.ts +1 -0
- package/build/commands/util/exec.js +6 -0
- package/build/commands/util/format-webpack-messages.d.ts +5 -0
- package/build/commands/util/format-webpack-messages.js +95 -0
- package/build/commands/util/get-local-ident.d.ts +6 -0
- package/build/commands/util/get-local-ident.js +29 -0
- package/build/commands/util/load-browserslist.d.ts +1 -0
- package/build/commands/util/load-browserslist.js +15 -0
- package/build/commands/util/make-tmp-dir.d.ts +5 -0
- package/build/commands/util/make-tmp-dir.js +29 -0
- package/build/commands/util/print-build-error.d.ts +1 -0
- package/build/commands/util/print-build-error.js +32 -0
- package/build/commands/util/run-artifacts-cli.d.ts +7 -0
- package/build/commands/util/run-artifacts-cli.js +60 -0
- package/build/commands/util/run-client-dev-server.d.ts +2 -0
- package/build/commands/util/run-client-dev-server.js +47 -0
- package/build/commands/util/run-compilers.d.ts +1 -0
- package/build/commands/util/run-compilers.js +37 -0
- package/build/commands/util/run-server-watch-compiler.d.ts +2 -0
- package/build/commands/util/run-server-watch-compiler.js +17 -0
- package/build/commands/util/run-vitest.d.ts +7 -0
- package/build/commands/util/run-vitest.js +41 -0
- package/build/commands/util/tsc.d.ts +1 -0
- package/build/commands/util/tsc.js +13 -0
- package/build/commands/util/yarn.d.ts +10 -0
- package/build/commands/util/yarn.js +25 -0
- package/build/configs/app-configs/calculate-dependent-config.d.ts +9 -0
- package/build/configs/app-configs/calculate-dependent-config.js +55 -0
- package/build/configs/app-configs/get-defaults.d.ts +5 -0
- package/build/configs/app-configs/get-defaults.js +151 -0
- package/build/configs/app-configs/index.d.ts +5 -0
- package/build/configs/app-configs/index.js +25 -0
- package/build/configs/app-configs/read-config-file.d.ts +2 -0
- package/build/configs/app-configs/read-config-file.js +28 -0
- package/build/configs/app-configs/types.d.ts +146 -0
- package/build/configs/app-configs/types.js +2 -0
- package/build/configs/app-configs/update-with-config-file.d.ts +2 -0
- package/build/configs/app-configs/update-with-config-file.js +17 -0
- package/build/configs/app-configs/update-with-env.d.ts +2 -0
- package/build/configs/app-configs/update-with-env.js +23 -0
- package/build/configs/app-configs/update-with-package.d.ts +2 -0
- package/build/configs/app-configs/update-with-package.js +13 -0
- package/build/configs/app-configs/update-with-presets.d.ts +3 -0
- package/build/configs/app-configs/update-with-presets.js +41 -0
- package/build/configs/app-configs/validate-config.d.ts +2 -0
- package/build/configs/app-configs/validate-config.js +8 -0
- package/build/configs/app-configs/validate-settings-keys.d.ts +7 -0
- package/build/configs/app-configs/validate-settings-keys.js +16 -0
- package/build/configs/app-configs/warn-about-deprecations.d.ts +2 -0
- package/build/configs/app-configs/warn-about-deprecations.js +22 -0
- package/build/configs/babel-client.d.ts +31 -0
- package/build/configs/babel-client.js +69 -0
- package/build/configs/babel-dependencies.d.ts +14 -0
- package/build/configs/babel-dependencies.js +36 -0
- package/build/configs/babel-server.d.ts +26 -0
- package/build/configs/babel-server.js +45 -0
- package/build/configs/client-env-config/add-env-to-html-template.d.ts +1 -0
- package/build/configs/client-env-config/add-env-to-html-template.js +7 -0
- package/build/configs/client-env-config/client-config-plugin.d.ts +5 -0
- package/build/configs/client-env-config/client-config-plugin.js +26 -0
- package/build/configs/client-env-config/constants.d.ts +1 -0
- package/build/configs/client-env-config/constants.js +4 -0
- package/build/configs/client-env-config/get-env-config.d.ts +2 -0
- package/build/configs/client-env-config/get-env-config.js +28 -0
- package/build/configs/client-env-config/index.d.ts +3 -0
- package/build/configs/client-env-config/index.js +9 -0
- package/build/configs/config-extras/minimizers/imagemin/imagemin.d.ts +28 -0
- package/build/configs/config-extras/minimizers/imagemin/imagemin.js +65 -0
- package/build/configs/config-extras/minimizers/imagemin/index.d.ts +1 -0
- package/build/configs/config-extras/minimizers/imagemin/index.js +17 -0
- package/build/configs/config-extras/minimizers/index.d.ts +1 -0
- package/build/configs/config-extras/minimizers/index.js +17 -0
- package/build/configs/dev-server.d.ts +2 -0
- package/build/configs/dev-server.js +78 -0
- package/build/configs/jest/babel-transform.d.ts +2 -0
- package/build/configs/jest/babel-transform.js +6 -0
- package/build/configs/jest/css-mock.d.ts +1 -0
- package/build/configs/jest/css-mock.js +2 -0
- package/build/configs/jest/file-transform.d.ts +3 -0
- package/build/configs/jest/file-transform.js +11 -0
- package/build/configs/jest/settings.d.ts +21 -0
- package/build/configs/jest/settings.js +58 -0
- package/build/configs/modules.d.ts +17 -0
- package/build/configs/modules.js +181 -0
- package/build/configs/mq.css +22 -0
- package/build/configs/postcss.config.d.ts +35 -0
- package/build/configs/postcss.config.js +65 -0
- package/build/configs/postcss.d.ts +6 -0
- package/build/configs/postcss.js +21 -0
- package/build/configs/process-assets-plugin-output.d.ts +2 -0
- package/build/configs/process-assets-plugin-output.js +45 -0
- package/build/configs/server-externals-exemptions.d.ts +1 -0
- package/build/configs/server-externals-exemptions.js +18 -0
- package/build/configs/stats-options.d.ts +2 -0
- package/build/configs/stats-options.js +46 -0
- package/build/configs/supporting-browsers.d.ts +1 -0
- package/build/configs/supporting-browsers.js +5 -0
- package/build/configs/supporting-node.d.ts +1 -0
- package/build/configs/supporting-node.js +5 -0
- package/build/configs/swc.d.ts +4 -0
- package/build/configs/swc.js +30 -0
- package/build/configs/util/apply-overrides.d.ts +87 -0
- package/build/configs/util/apply-overrides.js +56 -0
- package/build/configs/util/check-node-version.d.ts +1 -0
- package/build/configs/util/check-node-version.js +7 -0
- package/build/configs/util/compress-with-dcb.d.ts +2 -0
- package/build/configs/util/compress-with-dcb.js +28 -0
- package/build/configs/util/compression-plugins-for-dictionaries.d.ts +2 -0
- package/build/configs/util/compression-plugins-for-dictionaries.js +78 -0
- package/build/configs/util/create-watch-ignore-regex.d.ts +1 -0
- package/build/configs/util/create-watch-ignore-regex.js +16 -0
- package/build/configs/util/dcb-compression-plugin.d.ts +21 -0
- package/build/configs/util/dcb-compression-plugin.js +130 -0
- package/build/configs/util/find-loader.d.ts +2 -0
- package/build/configs/util/find-loader.js +24 -0
- package/build/configs/util/find-plugin.d.ts +78 -0
- package/build/configs/util/find-plugin.js +21 -0
- package/build/configs/util/get-entry.d.ts +8 -0
- package/build/configs/util/get-entry.js +22 -0
- package/build/configs/util/get-polyfills.d.ts +2 -0
- package/build/configs/util/get-polyfills.js +13 -0
- package/build/configs/util/get-webpack-cache-dependencies.d.ts +1 -0
- package/build/configs/util/get-webpack-cache-dependencies.js +15 -0
- package/build/configs/util/install-sourcemap-support.d.ts +1 -0
- package/build/configs/util/install-sourcemap-support.js +10 -0
- package/build/configs/util/node-assets-ignore.d.ts +1 -0
- package/build/configs/util/node-assets-ignore.js +34 -0
- package/build/configs/util/noop.d.ts +1 -0
- package/build/configs/util/noop.js +2 -0
- package/build/configs/util/register-ts-node.d.ts +1 -0
- package/build/configs/util/register-ts-node.js +18 -0
- package/build/configs/util/resolve.d.ts +14 -0
- package/build/configs/util/resolve.js +29 -0
- package/build/configs/vitest/config.d.ts +2 -0
- package/build/configs/vitest/config.js +5 -0
- package/build/configs/vitest/settings.d.ts +30 -0
- package/build/configs/vitest/settings.js +77 -0
- package/build/configs/webpack.client.d.ts +10 -0
- package/build/configs/webpack.client.dev.d.ts +1 -0
- package/build/configs/webpack.client.dev.js +12 -0
- package/build/configs/webpack.client.js +508 -0
- package/build/configs/webpack.client.prod.d.ts +1 -0
- package/build/configs/webpack.client.prod.js +12 -0
- package/build/configs/webpack.server.d.ts +2 -0
- package/build/configs/webpack.server.dev.d.ts +1 -0
- package/build/configs/webpack.server.dev.js +8 -0
- package/build/configs/webpack.server.js +283 -0
- package/build/configs/webpack.server.prod.d.ts +1 -0
- package/build/configs/webpack.server.prod.js +8 -0
- package/build/index.d.ts +19 -0
- package/build/index.js +35 -0
- package/build/plugins/arui-runtime/arui-runtime-module.d.ts +7 -0
- package/build/plugins/arui-runtime/arui-runtime-module.js +20 -0
- package/build/plugins/arui-runtime/index.d.ts +11 -0
- package/build/plugins/arui-runtime/index.js +47 -0
- package/build/plugins/postcss-global-variables/postcss-global-variables.d.ts +6 -0
- package/build/plugins/postcss-global-variables/postcss-global-variables.js +38 -0
- package/build/plugins/postcss-global-variables/utils/utils.d.ts +7 -0
- package/build/plugins/postcss-global-variables/utils/utils.js +91 -0
- package/build/plugins/postcss-prefix-selector.d.ts +6 -0
- package/build/plugins/postcss-prefix-selector.js +65 -0
- package/build/plugins/reload-server-plugin.d.ts +10 -0
- package/build/plugins/reload-server-plugin.js +46 -0
- package/build/plugins/turn-off-split-remote-entry.d.ts +11 -0
- package/build/plugins/turn-off-split-remote-entry.js +71 -0
- package/build/plugins/watch-missing-node-modules-plugin.d.ts +6 -0
- package/build/plugins/watch-missing-node-modules-plugin.js +20 -0
- package/build/templates/html.template.d.ts +1 -0
- package/build/templates/html.template.js +22 -0
- package/docs/artifact.md +62 -0
- package/docs/caveats.md +41 -0
- package/docs/client-only.md +77 -0
- package/docs/commands.md +159 -0
- package/docs/compilers.md +18 -0
- package/docs/compression-dictionary.md +130 -0
- package/docs/examples.md +100 -0
- package/docs/modules.md +834 -0
- package/docs/overrides.md +175 -0
- package/docs/presets.md +65 -0
- package/docs/settings.md +336 -0
- package/jest-preset.js +5 -0
- package/package.json +215 -0
- package/stylelint.config.js +11 -0
- package/tsconfig-local.json +17 -0
- package/tsconfig-local.tsbuildinfo +1 -0
- package/tsconfig.eslint.json +5 -0
- package/tsconfig.json +29 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { exec, ExecError } from '@alfalab/arui-scripts-artifacts';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExecError = exports.exec = void 0;
|
|
4
|
+
var arui_scripts_artifacts_1 = require("@alfalab/arui-scripts-artifacts");
|
|
5
|
+
Object.defineProperty(exports, "exec", { enumerable: true, get: function () { return arui_scripts_artifacts_1.exec; } });
|
|
6
|
+
Object.defineProperty(exports, "ExecError", { enumerable: true, get: function () { return arui_scripts_artifacts_1.ExecError; } });
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatWebpackMessages = formatWebpackMessages;
|
|
4
|
+
/**
|
|
5
|
+
* Copyright (c) 2015-present, Facebook, Inc.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/
|
|
10
|
+
// WARNING: this code is untranspiled and is used in browser too.
|
|
11
|
+
// Please make sure any changes are in ES5 or contribute a Babel compile step.
|
|
12
|
+
// Some custom utilities to prettify Webpack output.
|
|
13
|
+
// This is quite hacky and hopefully won't be needed when Webpack fixes this.
|
|
14
|
+
// https://github.com/webpack/webpack/issues/2878
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
16
|
+
const chalk = require('chalk');
|
|
17
|
+
const friendlySyntaxErrorLabel = 'Syntax error:';
|
|
18
|
+
function isLikelyASyntaxError(message) {
|
|
19
|
+
return message.includes(friendlySyntaxErrorLabel);
|
|
20
|
+
}
|
|
21
|
+
// Cleans up webpack error messages.
|
|
22
|
+
function formatMessage(message) {
|
|
23
|
+
var _a;
|
|
24
|
+
let newMessage = message;
|
|
25
|
+
if (typeof newMessage !== 'string') {
|
|
26
|
+
newMessage = newMessage.message;
|
|
27
|
+
}
|
|
28
|
+
let lines = newMessage.split('\n');
|
|
29
|
+
// Strip webpack-added headers off errors/warnings
|
|
30
|
+
// https://github.com/webpack/webpack/blob/master/lib/ModuleError.js
|
|
31
|
+
lines = lines.filter((line) => !/Module [A-z ]+\(from/.test(line));
|
|
32
|
+
// Transform parsing error into syntax error
|
|
33
|
+
// TODO: move this to our ESLint formatter?
|
|
34
|
+
lines = lines.map((line) => {
|
|
35
|
+
const parsingError = /Line (\d+):(?:(\d+):)?\s*Parsing error: (.+)$/.exec(line);
|
|
36
|
+
if (!parsingError) {
|
|
37
|
+
return line;
|
|
38
|
+
}
|
|
39
|
+
const [, errorLine, errorColumn, errorMessage] = parsingError;
|
|
40
|
+
return `${friendlySyntaxErrorLabel} ${errorMessage} (${errorLine}:${errorColumn})`;
|
|
41
|
+
});
|
|
42
|
+
newMessage = lines.join('\n');
|
|
43
|
+
// Smoosh syntax errors (commonly found in CSS)
|
|
44
|
+
newMessage = newMessage.replace(/SyntaxError\s+\((\d+):(\d+)\)\s*(.+?)\n/g, `${friendlySyntaxErrorLabel} $3 ($1:$2)\n`);
|
|
45
|
+
// Clean up export errors
|
|
46
|
+
newMessage = newMessage.replace(/^.*export '(.+?)' was not found in '(.+?)'.*$/gm, "Attempted import error: '$1' is not exported from '$2'.");
|
|
47
|
+
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').");
|
|
48
|
+
newMessage = newMessage.replace(/^.*export '(.+?)' \(imported as '(.+?)'\) was not found in '(.+?)'.*$/gm, "Attempted import error: '$1' is not exported from '$3' (imported as '$2').");
|
|
49
|
+
lines = newMessage.split('\n');
|
|
50
|
+
// Remove leading newline
|
|
51
|
+
if (lines.length > 2 && lines[1].trim() === '') {
|
|
52
|
+
lines.splice(1, 1);
|
|
53
|
+
}
|
|
54
|
+
// Clean up file name
|
|
55
|
+
lines[0] = lines[0].replace(/^(.*) \d+:\d+-\d+$/, '$1');
|
|
56
|
+
// Cleans up verbose "module not found" messages for files and packages.
|
|
57
|
+
if (lines[1] && lines[1].indexOf('Module not found: ') === 0) {
|
|
58
|
+
lines = [
|
|
59
|
+
lines[0],
|
|
60
|
+
lines[1]
|
|
61
|
+
.replace('Error: ', '')
|
|
62
|
+
.replace('Module not found: Cannot find file:', 'Cannot find file:'),
|
|
63
|
+
];
|
|
64
|
+
}
|
|
65
|
+
// Add helpful message for users trying to use Sass for the first time
|
|
66
|
+
if ((_a = lines[1]) === null || _a === void 0 ? void 0 : _a.match(/Cannot find module.+node-sass/)) {
|
|
67
|
+
lines[1] = 'To import Sass files, you first need to install node-sass.\n';
|
|
68
|
+
lines[1] += 'Run `npm install node-sass` or `yarn add node-sass` inside your workspace.';
|
|
69
|
+
}
|
|
70
|
+
lines[0] = chalk.inverse(lines[0]);
|
|
71
|
+
newMessage = lines.join('\n');
|
|
72
|
+
// Internal stacks are generally useless so we strip them... with the
|
|
73
|
+
// exception of stacks containing `webpack:` because they're normally
|
|
74
|
+
// from user code generated by webpack. For more information see
|
|
75
|
+
// https://github.com/facebook/create-react-app/pull/1050
|
|
76
|
+
newMessage = newMessage.replace(/^\s*at\s((?!webpack:).)*:\d+:\d+[\s)]*(\n|$)/gm, ''); // at ... ...:x:y
|
|
77
|
+
newMessage = newMessage.replace(/^\s*at\s<anonymous>(\n|$)/gm, ''); // at <anonymous>
|
|
78
|
+
lines = newMessage.split('\n');
|
|
79
|
+
// Remove duplicated newlines
|
|
80
|
+
lines = lines.filter((line, index, arr) => index === 0 || line.trim() !== '' || line.trim() !== arr[index - 1].trim());
|
|
81
|
+
// Reassemble the message
|
|
82
|
+
newMessage = lines.join('\n');
|
|
83
|
+
return newMessage.trim();
|
|
84
|
+
}
|
|
85
|
+
function formatWebpackMessages(json) {
|
|
86
|
+
var _a, _b;
|
|
87
|
+
const formattedErrors = ((_a = json === null || json === void 0 ? void 0 : json.errors) === null || _a === void 0 ? void 0 : _a.map(formatMessage)) || [];
|
|
88
|
+
const formattedWarnings = ((_b = json === null || json === void 0 ? void 0 : json.warnings) === null || _b === void 0 ? void 0 : _b.map(formatMessage)) || [];
|
|
89
|
+
const result = { errors: formattedErrors, warnings: formattedWarnings };
|
|
90
|
+
if (result.errors.some(isLikelyASyntaxError)) {
|
|
91
|
+
// If there are any syntax errors, show just them.
|
|
92
|
+
result.errors = result.errors.filter(isLikelyASyntaxError);
|
|
93
|
+
}
|
|
94
|
+
return result;
|
|
95
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getLocalIdent = getLocalIdent;
|
|
7
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
function getLocalIdent(context, _localIdentName, localName) {
|
|
10
|
+
const isIndexModule = /index\.module\.(css|scss|sass)$/.test(context.resourcePath);
|
|
11
|
+
const relativePath = path_1.default.posix.relative(context.rootContext, context.resourcePath);
|
|
12
|
+
const hash = crypto_1.default
|
|
13
|
+
.createHash('md5')
|
|
14
|
+
.update(relativePath + localName)
|
|
15
|
+
.digest('base64')
|
|
16
|
+
.slice(0, 5)
|
|
17
|
+
.replace(/\+/g, '_')
|
|
18
|
+
.replace(/\//g, '_')
|
|
19
|
+
.replace(/=/g, '');
|
|
20
|
+
let baseName;
|
|
21
|
+
if (isIndexModule) {
|
|
22
|
+
baseName = path_1.default.basename(path_1.default.dirname(context.resourcePath));
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
baseName = path_1.default.basename(context.resourcePath, '.module.css');
|
|
26
|
+
}
|
|
27
|
+
const className = `${baseName}_${localName}__${hash}`;
|
|
28
|
+
return className.replace('.module_', '_').replace(/\./g, '_');
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function loadBrowserslist(): void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.loadBrowserslist = loadBrowserslist;
|
|
4
|
+
// это peer зависимость кучи других пакетов. Не будем добавлять её себе в прямые чтобы не ломать дерево
|
|
5
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
6
|
+
const browserslist_1 = require("browserslist");
|
|
7
|
+
const app_configs_1 = require("../../configs/app-configs");
|
|
8
|
+
const supporting_browsers_1 = require("../../configs/supporting-browsers");
|
|
9
|
+
function loadBrowserslist() {
|
|
10
|
+
if ((0, browserslist_1.loadConfig)({ path: app_configs_1.configs.cwd })) {
|
|
11
|
+
// если проект уже как то определяет список поддерживаемых браузеров - не делаем ничего
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
process.env.BROWSERSLIST = process.env.BROWSERSLIST || supporting_browsers_1.supportingBrowsers.join(',');
|
|
15
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.makeTmpDir = makeTmpDir;
|
|
16
|
+
const fs_1 = __importDefault(require("fs"));
|
|
17
|
+
const os_1 = __importDefault(require("os"));
|
|
18
|
+
const path_1 = __importDefault(require("path"));
|
|
19
|
+
const util_1 = __importDefault(require("util"));
|
|
20
|
+
const nodeMakeTmpDir = util_1.default.promisify(fs_1.default.mkdtemp);
|
|
21
|
+
/**
|
|
22
|
+
* Создает и возвращает временную папку
|
|
23
|
+
* @returns {Promise<string>}
|
|
24
|
+
*/
|
|
25
|
+
function makeTmpDir(prefix) {
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
return nodeMakeTmpDir(path_1.default.join(os_1.default.tmpdir(), prefix || ''));
|
|
28
|
+
});
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function printBuildError(err: Error | null | undefined): void;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.printBuildError = printBuildError;
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
function printBuildError(err) {
|
|
9
|
+
const message = err === null || err === void 0 ? void 0 : err.message;
|
|
10
|
+
const stack = err === null || err === void 0 ? void 0 : err.stack;
|
|
11
|
+
if (stack && typeof message === 'string' && message.includes('from Terser')) {
|
|
12
|
+
try {
|
|
13
|
+
const matched = /(.+)\[(.+):(.+),(.+)\]\[.+\]/.exec(stack);
|
|
14
|
+
if (!matched) {
|
|
15
|
+
throw new Error('Using errors for control flow is bad.');
|
|
16
|
+
}
|
|
17
|
+
const problemPath = matched[2];
|
|
18
|
+
const line = matched[3];
|
|
19
|
+
const column = matched[4];
|
|
20
|
+
const columnFormatted = column === '0' ? '' : `:${column}`;
|
|
21
|
+
console.log(`Failed to minify the code from this file: \n\n${chalk_1.default.yellow(`\t${problemPath}:${line}${columnFormatted}`)}\n`);
|
|
22
|
+
}
|
|
23
|
+
catch (ignored) {
|
|
24
|
+
console.log('Failed to minify the bundle.', err);
|
|
25
|
+
}
|
|
26
|
+
console.log('Read more here: https://cra.link/failed-to-minify');
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
console.log(`${message || err}\n`);
|
|
30
|
+
}
|
|
31
|
+
console.log();
|
|
32
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Запускает команду CLI @alfalab/arui-scripts-artifacts с конфигом arui-scripts.
|
|
3
|
+
*
|
|
4
|
+
* Позиционные аргументы (`name=...`, `version=...`, `registry=...`) прокидываются как есть — их
|
|
5
|
+
* разбирает сам CLI.
|
|
6
|
+
*/
|
|
7
|
+
export declare function runArtifactsCli(command: string): Promise<void>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.runArtifactsCli = runArtifactsCli;
|
|
16
|
+
const path_1 = __importDefault(require("path"));
|
|
17
|
+
const arui_scripts_artifacts_1 = require("@alfalab/arui-scripts-artifacts");
|
|
18
|
+
/**
|
|
19
|
+
* Конфиг едет вместе с arui-scripts — см. `arui-scripts-artifacts.ts`. `require.resolve` дает абсолютный
|
|
20
|
+
* путь до собранного файла и не выполняет его: конфиг исполнит уже CLI, в процессе сборки.
|
|
21
|
+
*/
|
|
22
|
+
const ARTIFACTS_CONFIG_PATH = require.resolve('./arui-scripts-artifacts');
|
|
23
|
+
/**
|
|
24
|
+
* Абсолютный путь до бинарника CLI @alfalab/arui-scripts-artifacts.
|
|
25
|
+
*
|
|
26
|
+
* Резолвим через package.json пакета, а не полагаемся на `node_modules/.bin` в PATH: команды
|
|
27
|
+
* arui-scripts запускают не только из yarn-скриптов.
|
|
28
|
+
*/
|
|
29
|
+
function getArtifactsCliPath() {
|
|
30
|
+
const packageJsonPath = require.resolve('@alfalab/arui-scripts-artifacts/package.json');
|
|
31
|
+
// eslint-disable-next-line global-require, import/no-dynamic-require, @typescript-eslint/no-var-requires
|
|
32
|
+
const { bin } = require(packageJsonPath);
|
|
33
|
+
return path_1.default.join(path_1.default.dirname(packageJsonPath), typeof bin === 'string' ? bin : bin['arui-scripts-artifacts']);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Запускает команду CLI @alfalab/arui-scripts-artifacts с конфигом arui-scripts.
|
|
37
|
+
*
|
|
38
|
+
* Позиционные аргументы (`name=...`, `version=...`, `registry=...`) прокидываются как есть — их
|
|
39
|
+
* разбирает сам CLI.
|
|
40
|
+
*/
|
|
41
|
+
function runArtifactsCli(command) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
const args = process.argv.slice(3);
|
|
44
|
+
const cliCommand = [
|
|
45
|
+
(0, arui_scripts_artifacts_1.shellQuote)(process.execPath),
|
|
46
|
+
(0, arui_scripts_artifacts_1.shellQuote)(getArtifactsCliPath()),
|
|
47
|
+
command,
|
|
48
|
+
'-c',
|
|
49
|
+
(0, arui_scripts_artifacts_1.shellQuote)(ARTIFACTS_CONFIG_PATH),
|
|
50
|
+
...args,
|
|
51
|
+
].join(' ');
|
|
52
|
+
try {
|
|
53
|
+
yield (0, arui_scripts_artifacts_1.exec)(cliCommand);
|
|
54
|
+
}
|
|
55
|
+
catch (_a) {
|
|
56
|
+
// CLI уже напечатал ошибку (и стек, если включен debug)
|
|
57
|
+
process.exit(1);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.runClientDevServer = runClientDevServer;
|
|
13
|
+
const util_1 = require("util");
|
|
14
|
+
const core_1 = require("@rspack/core");
|
|
15
|
+
const dev_server_1 = require("@rspack/dev-server");
|
|
16
|
+
const dev_server_2 = require("../../configs/dev-server");
|
|
17
|
+
const print_compiler_output_1 = require("../start/print-compiler-output");
|
|
18
|
+
function runClientDevServer(configuration) {
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
const clientCompiler = (0, core_1.rspack)(configuration);
|
|
21
|
+
const clientDevServer = new dev_server_1.RspackDevServer(dev_server_2.devServerConfig, clientCompiler);
|
|
22
|
+
clientCompiler.hooks.invalid.tap('client', () => console.log('Compiling client...'));
|
|
23
|
+
clientCompiler.hooks.done.tap('client', (stats) => (0, print_compiler_output_1.printCompilerOutput)('Client', stats));
|
|
24
|
+
const DEFAULT_PORT = dev_server_2.devServerConfig.port;
|
|
25
|
+
const HOST = '0.0.0.0';
|
|
26
|
+
try {
|
|
27
|
+
const { default: getPort } = yield import('get-port');
|
|
28
|
+
const port = yield getPort({
|
|
29
|
+
port: +(DEFAULT_PORT || 0),
|
|
30
|
+
host: HOST,
|
|
31
|
+
});
|
|
32
|
+
if (!port) {
|
|
33
|
+
// We have not found a port.
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
clientDevServer.startCallback(() => {
|
|
37
|
+
console.log(`Client dev server running at http://${HOST}:${port}...`);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
catch (err) {
|
|
41
|
+
if (util_1.types.isNativeError(err)) {
|
|
42
|
+
console.log(err.message);
|
|
43
|
+
}
|
|
44
|
+
process.exit(1);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function runCompilers(pathToCompilers: Array<string | string[]>): void;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.runCompilers = runCompilers;
|
|
7
|
+
const child_process_1 = require("child_process");
|
|
8
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
9
|
+
const app_configs_1 = require("../../configs/app-configs");
|
|
10
|
+
function runCompilers(pathToCompilers) {
|
|
11
|
+
if (fs_extra_1.default.pathExistsSync(app_configs_1.configs.serverOutputPath)) {
|
|
12
|
+
fs_extra_1.default.removeSync(app_configs_1.configs.serverOutputPath);
|
|
13
|
+
}
|
|
14
|
+
const compilers = pathToCompilers.map((pathToCompiler) => {
|
|
15
|
+
if (Array.isArray(pathToCompiler)) {
|
|
16
|
+
const compiler = (0, child_process_1.spawn)('node', pathToCompiler, {
|
|
17
|
+
stdio: 'inherit',
|
|
18
|
+
cwd: app_configs_1.configs.cwd,
|
|
19
|
+
});
|
|
20
|
+
compiler.on('error', onProcessExit);
|
|
21
|
+
compiler.on('close', onProcessExit);
|
|
22
|
+
return compiler;
|
|
23
|
+
}
|
|
24
|
+
const compiler = (0, child_process_1.spawn)('node', [pathToCompiler], {
|
|
25
|
+
stdio: 'inherit',
|
|
26
|
+
});
|
|
27
|
+
compiler.on('error', onProcessExit);
|
|
28
|
+
compiler.on('close', onProcessExit);
|
|
29
|
+
return compiler;
|
|
30
|
+
});
|
|
31
|
+
function onProcessExit(code) {
|
|
32
|
+
if (code !== 0) {
|
|
33
|
+
compilers.forEach((compiler) => compiler.kill());
|
|
34
|
+
process.exit(code);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runServerWatchCompiler = runServerWatchCompiler;
|
|
4
|
+
const core_1 = require("@rspack/core");
|
|
5
|
+
const app_configs_1 = require("../../configs/app-configs");
|
|
6
|
+
const create_watch_ignore_regex_1 = require("../../configs/util/create-watch-ignore-regex");
|
|
7
|
+
const print_compiler_output_1 = require("../start/print-compiler-output");
|
|
8
|
+
function runServerWatchCompiler(config) {
|
|
9
|
+
const serverCompiler = (0, core_1.rspack)(config);
|
|
10
|
+
serverCompiler.hooks.compile.tap('server', () => console.log('Compiling server...'));
|
|
11
|
+
serverCompiler.hooks.invalid.tap('server', () => console.log('Compiling server...'));
|
|
12
|
+
serverCompiler.hooks.done.tap('server', (stats) => (0, print_compiler_output_1.printCompilerOutput)('Server', stats));
|
|
13
|
+
serverCompiler.watch({
|
|
14
|
+
aggregateTimeout: 50, // Делаем это значение меньше чем у клиента, чтобы сервер пересобирался быстрее
|
|
15
|
+
ignored: (0, create_watch_ignore_regex_1.createWatchIgnoreRegex)(app_configs_1.configs.watchIgnorePath),
|
|
16
|
+
}, () => { });
|
|
17
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.hasProjectVitestConfig = hasProjectVitestConfig;
|
|
7
|
+
exports.runVitest = runVitest;
|
|
8
|
+
const child_process_1 = require("child_process");
|
|
9
|
+
const fs_1 = __importDefault(require("fs"));
|
|
10
|
+
const path_1 = __importDefault(require("path"));
|
|
11
|
+
const VITEST_CONFIG_FILES = [
|
|
12
|
+
'vitest.config.js',
|
|
13
|
+
'vitest.config.mjs',
|
|
14
|
+
'vitest.config.ts',
|
|
15
|
+
'vitest.config.cjs',
|
|
16
|
+
'vitest.config.mts',
|
|
17
|
+
'vitest.config.cts',
|
|
18
|
+
];
|
|
19
|
+
function hasProjectVitestConfig(cwd) {
|
|
20
|
+
return VITEST_CONFIG_FILES.some((file) => fs_1.default.existsSync(path_1.default.join(cwd, file)));
|
|
21
|
+
}
|
|
22
|
+
function runVitest({ args, cwd = process.cwd() }) {
|
|
23
|
+
const aruiVitestConfigPath = path_1.default.resolve(__dirname, '../../configs/vitest/config.js');
|
|
24
|
+
const vitestArgs = hasProjectVitestConfig(cwd)
|
|
25
|
+
? ['run', ...args]
|
|
26
|
+
: ['run', '--config', aruiVitestConfigPath, ...args];
|
|
27
|
+
const vitestDir = path_1.default.dirname(require.resolve('vitest/package.json'));
|
|
28
|
+
const vitestBin = path_1.default.join(vitestDir, 'vitest.mjs');
|
|
29
|
+
return new Promise((resolve, reject) => {
|
|
30
|
+
const vitestProcess = (0, child_process_1.spawn)(process.execPath, [vitestBin, ...vitestArgs], {
|
|
31
|
+
stdio: 'inherit',
|
|
32
|
+
shell: false,
|
|
33
|
+
});
|
|
34
|
+
vitestProcess.on('close', (code) => {
|
|
35
|
+
resolve(code !== null && code !== void 0 ? code : 0);
|
|
36
|
+
});
|
|
37
|
+
vitestProcess.on('error', (error) => {
|
|
38
|
+
reject(error);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getTscWatchCommand(tsconfig: string): string[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTscWatchCommand = getTscWatchCommand;
|
|
4
|
+
function getTscWatchCommand(tsconfig) {
|
|
5
|
+
return [
|
|
6
|
+
require.resolve('typescript/lib/tsc.js'),
|
|
7
|
+
'--watch',
|
|
8
|
+
'--noEmit',
|
|
9
|
+
'--project',
|
|
10
|
+
tsconfig,
|
|
11
|
+
'--skipLibCheck',
|
|
12
|
+
];
|
|
13
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type YarnVersion } from '@alfalab/arui-scripts-artifacts';
|
|
2
|
+
/**
|
|
3
|
+
* Совместимый слой поверх @alfalab/arui-scripts-artifacts: сохраняет исторические сигнатуры без аргументов,
|
|
4
|
+
* подставляя значения из глобального `configs`.
|
|
5
|
+
*
|
|
6
|
+
* @deprecated Используйте одноименные функции из `@alfalab/arui-scripts-artifacts`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getYarnVersion(): YarnVersion;
|
|
9
|
+
export declare function getPruningCommand(): string;
|
|
10
|
+
export declare function getInstallProductionCommand(): string;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getYarnVersion = getYarnVersion;
|
|
4
|
+
exports.getPruningCommand = getPruningCommand;
|
|
5
|
+
exports.getInstallProductionCommand = getInstallProductionCommand;
|
|
6
|
+
const arui_scripts_artifacts_1 = require("@alfalab/arui-scripts-artifacts");
|
|
7
|
+
const app_configs_1 = require("../../configs/app-configs");
|
|
8
|
+
/**
|
|
9
|
+
* Совместимый слой поверх @alfalab/arui-scripts-artifacts: сохраняет исторические сигнатуры без аргументов,
|
|
10
|
+
* подставляя значения из глобального `configs`.
|
|
11
|
+
*
|
|
12
|
+
* @deprecated Используйте одноименные функции из `@alfalab/arui-scripts-artifacts`.
|
|
13
|
+
*/
|
|
14
|
+
function getYarnVersion() {
|
|
15
|
+
return (0, arui_scripts_artifacts_1.getYarnVersion)({ useYarn: app_configs_1.configs.useYarn });
|
|
16
|
+
}
|
|
17
|
+
function getPruningCommand() {
|
|
18
|
+
return (0, arui_scripts_artifacts_1.getPruningCommand)({
|
|
19
|
+
yarnVersion: getYarnVersion(),
|
|
20
|
+
clientOnly: app_configs_1.configs.clientOnly,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function getInstallProductionCommand() {
|
|
24
|
+
return (0, arui_scripts_artifacts_1.getInstallProductionCommand)(getYarnVersion());
|
|
25
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type AppConfigs, type AppContext } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Обновление ключей конфига, зависящих от других. Это нужно делать в самый последний момент
|
|
4
|
+
*/
|
|
5
|
+
export declare function calculateDependentConfig(config: AppConfigs): AppConfigs;
|
|
6
|
+
/**
|
|
7
|
+
* Обновление контекста в зависимости от ключей конфига
|
|
8
|
+
*/
|
|
9
|
+
export declare function calculateDependentContext(config: AppConfigs, context: AppContext): AppContext;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.calculateDependentConfig = calculateDependentConfig;
|
|
7
|
+
exports.calculateDependentContext = calculateDependentContext;
|
|
8
|
+
// TODO: remove eslint-disable-next-line
|
|
9
|
+
const fs_1 = __importDefault(require("fs"));
|
|
10
|
+
const path_1 = __importDefault(require("path"));
|
|
11
|
+
const get_polyfills_1 = require("../util/get-polyfills");
|
|
12
|
+
const resolve_1 = require("../util/resolve");
|
|
13
|
+
/**
|
|
14
|
+
* Обновление ключей конфига, зависящих от других. Это нужно делать в самый последний момент
|
|
15
|
+
*/
|
|
16
|
+
function calculateDependentConfig(config) {
|
|
17
|
+
return Object.assign(Object.assign({}, config), { clientPolyfillsEntry: (0, get_polyfills_1.getPolyfills)(config) });
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Обновление контекста в зависимости от ключей конфига
|
|
21
|
+
*/
|
|
22
|
+
function calculateDependentContext(config, context) {
|
|
23
|
+
let babelRuntimeVersion;
|
|
24
|
+
try {
|
|
25
|
+
// В проекте может стоять babel/runtime отличный от того, что установлен как зависимость arui-scripts.
|
|
26
|
+
// При этом webpack будет резолвить babel/runtime относительно проекта, а не относительно arui-scripts.
|
|
27
|
+
// Поэтому мы читаем версию того babel/runtime, который установлен в проекте.
|
|
28
|
+
// Так же мы не можем использовать require для получения контента из babel/runtime/package.json,
|
|
29
|
+
// потому что webpack.cache будет ругаться на то, что мы пытаемся импортировать файлы НЕ из своего node_modules.
|
|
30
|
+
const pathToProjectBabelRuntime = (0, resolve_1.resolveNodeModuleRelativeTo)(context.cwd, '@babel/runtime/package.json');
|
|
31
|
+
babelRuntimeVersion = JSON.parse(fs_1.default.readFileSync(pathToProjectBabelRuntime, 'utf8')).version;
|
|
32
|
+
}
|
|
33
|
+
catch (e) {
|
|
34
|
+
// eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
|
|
35
|
+
babelRuntimeVersion = require('@babel/runtime/package.json').version;
|
|
36
|
+
}
|
|
37
|
+
const allDictionaryPath = config.dictionaryCompression.dictionaryPath.map((p) => {
|
|
38
|
+
if (!path_1.default.isAbsolute(p)) {
|
|
39
|
+
return path_1.default.join(process.cwd(), p);
|
|
40
|
+
}
|
|
41
|
+
return p;
|
|
42
|
+
});
|
|
43
|
+
const singleFilesDictionaries = [];
|
|
44
|
+
const previousVersionPath = [];
|
|
45
|
+
allDictionaryPath.forEach((p) => {
|
|
46
|
+
const statResult = fs_1.default.statSync(p);
|
|
47
|
+
if (statResult.isFile()) {
|
|
48
|
+
singleFilesDictionaries.push(p);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
previousVersionPath.push(p);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
return Object.assign(Object.assign({}, context), { publicPath: `${config.assetsPath}/`, serverOutputPath: path_1.default.resolve(context.cwd, config.buildPath), clientOutputPath: path_1.default.resolve(context.cwd, config.buildPath, config.assetsPath), statsOutputPath: path_1.default.resolve(context.cwd, config.buildPath, config.statsOutputFilename), watchIgnorePath: ['node_modules', config.buildPath], babelRuntimeVersion, compressionPredefinedDictionaryPath: singleFilesDictionaries, compressionPreviousVersionPath: previousVersionPath });
|
|
55
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type AppConfigs, type AppContext } from './types';
|
|
2
|
+
export declare const nginxConfigFileName = "nginx.conf";
|
|
3
|
+
export declare const baseNginxConfigFileName = "base-nginx.conf";
|
|
4
|
+
export declare function getDefaultAppConfig(): AppConfigs;
|
|
5
|
+
export declare function getDefaultAppContext(): AppContext;
|