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,181 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.MODULES_SEPARATE_BUILD_NAME = exports.MODULES_ENTRY_NAME = void 0;
|
|
37
|
+
exports.haveExposedDefaultModules = haveExposedDefaultModules;
|
|
38
|
+
exports.patchMainWebpackConfigForModules = patchMainWebpackConfigForModules;
|
|
39
|
+
exports.getCssPrefixForModule = getCssPrefixForModule;
|
|
40
|
+
exports.getExposeLoadersFormCompatModules = getExposeLoadersFormCompatModules;
|
|
41
|
+
exports.patchWebpackConfigForCompat = patchWebpackConfigForCompat;
|
|
42
|
+
const rspack = __importStar(require("@rspack/core"));
|
|
43
|
+
const postcss_prefix_selector_1 = require("../plugins/postcss-prefix-selector");
|
|
44
|
+
const turn_off_split_remote_entry_1 = require("../plugins/turn-off-split-remote-entry");
|
|
45
|
+
const find_loader_1 = require("./util/find-loader");
|
|
46
|
+
const app_configs_1 = require("./app-configs");
|
|
47
|
+
function haveExposedDefaultModules() {
|
|
48
|
+
var _a;
|
|
49
|
+
return (_a = app_configs_1.configs.modules) === null || _a === void 0 ? void 0 : _a.exposes;
|
|
50
|
+
}
|
|
51
|
+
exports.MODULES_ENTRY_NAME = 'remoteEntry.js';
|
|
52
|
+
exports.MODULES_SEPARATE_BUILD_NAME = 'wmf';
|
|
53
|
+
function getModuleFederationContainerName() {
|
|
54
|
+
var _a;
|
|
55
|
+
return ((_a = app_configs_1.configs.modules) === null || _a === void 0 ? void 0 : _a.name) || app_configs_1.configs.normalizedName;
|
|
56
|
+
}
|
|
57
|
+
function getSeparateBuildRuntimeName() {
|
|
58
|
+
return `${getModuleFederationContainerName().replace(/\W/g, '_')}_${exports.MODULES_SEPARATE_BUILD_NAME}`;
|
|
59
|
+
}
|
|
60
|
+
function patchMainWebpackConfigForModules(webpackConf, mode) {
|
|
61
|
+
var _a, _b;
|
|
62
|
+
/* eslint-disable no-param-reassign */
|
|
63
|
+
const isConsumer = mode === 'consumer' || mode === 'both';
|
|
64
|
+
const isProvider = mode === 'provider' || mode === 'both';
|
|
65
|
+
if (app_configs_1.configs.disableModulesSupport) {
|
|
66
|
+
// проект хочет сам разбираться с WMF и прочими вещами, полностью отключаем обработку модулей на своей стороне
|
|
67
|
+
return webpackConf;
|
|
68
|
+
}
|
|
69
|
+
if (!((_a = webpackConf.module) === null || _a === void 0 ? void 0 : _a.rules) || !webpackConf.plugins) {
|
|
70
|
+
// делаем TS счастливым, на самом деле module и plugins у нас будут всегда
|
|
71
|
+
return webpackConf;
|
|
72
|
+
}
|
|
73
|
+
if (isConsumer) {
|
|
74
|
+
// Добавляем expose loader для библиотек, которые мы хотим вынести в глобальную область видимости
|
|
75
|
+
webpackConf.module.rules.unshift(...getExposeLoadersFormCompatModules());
|
|
76
|
+
}
|
|
77
|
+
if (!app_configs_1.configs.modules || !webpackConf.output || !webpackConf.plugins) {
|
|
78
|
+
if (isConsumer) {
|
|
79
|
+
// webpack по умолчанию всегда добавлял runtime для шаринга, даже когда модули не включены.
|
|
80
|
+
// Rspack этого больше не делает, поэтому добавляем плагин для рантайма самостоятельно
|
|
81
|
+
webpackConf.plugins.push(new rspack.sharing.ProvideSharedPlugin({ provides: {} }));
|
|
82
|
+
}
|
|
83
|
+
return webpackConf;
|
|
84
|
+
}
|
|
85
|
+
const { cssPrefix } = app_configs_1.configs.modules.options || {};
|
|
86
|
+
if (cssPrefix && isProvider) {
|
|
87
|
+
addCssPrefix(webpackConf, cssPrefix);
|
|
88
|
+
}
|
|
89
|
+
webpackConf.output.publicPath = haveExposedDefaultModules()
|
|
90
|
+
? 'auto' // Для того чтобы модули могли подключаться из разных мест, нам необходимо использовать auto. Для корректной работы в IE надо подключaть https://github.com/amiller-gh/currentScript-polyfill
|
|
91
|
+
: app_configs_1.configs.publicPath;
|
|
92
|
+
if (mode === 'provider') {
|
|
93
|
+
const uniqueName = getSeparateBuildRuntimeName();
|
|
94
|
+
webpackConf.output = Object.assign(Object.assign({}, webpackConf.output), { uniqueName, chunkLoadingGlobal: `rspackChunk${uniqueName}` });
|
|
95
|
+
}
|
|
96
|
+
webpackConf.plugins.push(new rspack.container.ModuleFederationPlugin({
|
|
97
|
+
name: getModuleFederationContainerName(),
|
|
98
|
+
filename: isProvider && app_configs_1.configs.modules.exposes ? exports.MODULES_ENTRY_NAME : undefined,
|
|
99
|
+
shared: (mode === 'provider' && ((_b = app_configs_1.configs.modules.options) === null || _b === void 0 ? void 0 : _b.separateBuildShared)) ||
|
|
100
|
+
app_configs_1.configs.modules.shared,
|
|
101
|
+
exposes: isProvider ? app_configs_1.configs.modules.exposes : {},
|
|
102
|
+
shareScope: app_configs_1.configs.modules.shareScope,
|
|
103
|
+
}), new turn_off_split_remote_entry_1.TurnOffSplitRemoteEntry(getModuleFederationContainerName()));
|
|
104
|
+
return webpackConf;
|
|
105
|
+
/* eslint-enable no-param-reassign */
|
|
106
|
+
}
|
|
107
|
+
function getCssPrefixForModule(module) {
|
|
108
|
+
if (module.cssPrefix) {
|
|
109
|
+
return module.cssPrefix;
|
|
110
|
+
}
|
|
111
|
+
if (module.cssPrefix === false) {
|
|
112
|
+
return undefined;
|
|
113
|
+
}
|
|
114
|
+
return `.module-${module.name}`;
|
|
115
|
+
}
|
|
116
|
+
function getExposeLoadersFormCompatModules() {
|
|
117
|
+
var _a;
|
|
118
|
+
const shared = (_a = app_configs_1.configs.compatModules) === null || _a === void 0 ? void 0 : _a.shared;
|
|
119
|
+
if (!shared) {
|
|
120
|
+
return [];
|
|
121
|
+
}
|
|
122
|
+
return Object.keys(shared).map((libraryName) => {
|
|
123
|
+
const globalVarName = shared[libraryName];
|
|
124
|
+
return {
|
|
125
|
+
test: require.resolve(libraryName),
|
|
126
|
+
use: [
|
|
127
|
+
{
|
|
128
|
+
loader: require.resolve('expose-loader'),
|
|
129
|
+
options: {
|
|
130
|
+
exposes: [globalVarName],
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
],
|
|
134
|
+
};
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
function addCssPrefix(webpackConf, cssPrefix) {
|
|
138
|
+
const cssRule = (0, find_loader_1.findLoader)(webpackConf, '/\\.css$/');
|
|
139
|
+
const cssModulesRule = (0, find_loader_1.findLoader)(webpackConf, '/\\.module\\.css$/');
|
|
140
|
+
addPrefixCssRule(cssRule, cssPrefix);
|
|
141
|
+
addPrefixCssRule(cssModulesRule, `:global(${cssPrefix})`);
|
|
142
|
+
}
|
|
143
|
+
function addPrefixCssRule(rule, prefix) {
|
|
144
|
+
if (!(rule === null || rule === void 0 ? void 0 : rule.use) || !Array.isArray(rule.use)) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
const postCssLoader = rule.use.find((loaderConfig) => {
|
|
148
|
+
var _a;
|
|
149
|
+
if (typeof loaderConfig === 'string' ||
|
|
150
|
+
typeof loaderConfig === 'function' ||
|
|
151
|
+
!loaderConfig) {
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
return ((_a = loaderConfig.loader) === null || _a === void 0 ? void 0 : _a.indexOf('postcss-loader')) !== -1;
|
|
155
|
+
});
|
|
156
|
+
if (!postCssLoader ||
|
|
157
|
+
typeof postCssLoader !== 'object' ||
|
|
158
|
+
!postCssLoader.options ||
|
|
159
|
+
typeof postCssLoader.options !== 'object') {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
postCssLoader.options.postcssOptions.plugins = [
|
|
163
|
+
...postCssLoader.options.postcssOptions.plugins,
|
|
164
|
+
(0, postcss_prefix_selector_1.postCssPrefix)({ prefix: `${prefix} ` }),
|
|
165
|
+
];
|
|
166
|
+
}
|
|
167
|
+
function patchWebpackConfigForCompat(module, webpackConf) {
|
|
168
|
+
/* eslint-disable no-param-reassign */
|
|
169
|
+
webpackConf.externals = Object.assign(Object.assign({}, (webpackConf.externals || {})), (module.externals || {}));
|
|
170
|
+
// Название переменной вебпака, которую он будет использовать для загрузки чанков. Важно чтобы для разных модулей они отличались,
|
|
171
|
+
// иначе несколько модулей из одного приложения будут конфликтовать между собой
|
|
172
|
+
const uniqueName = module.name;
|
|
173
|
+
// Для того чтобы модули могли подключаться из разных мест, нам необходимо использовать publicPath = auto. Для корректной работы в IE надо подключaть https://github.com/amiller-gh/currentScript-polyfill
|
|
174
|
+
webpackConf.output = Object.assign(Object.assign({}, webpackConf.output), { publicPath: 'auto', uniqueName });
|
|
175
|
+
const cssPrefix = getCssPrefixForModule(module);
|
|
176
|
+
if (cssPrefix) {
|
|
177
|
+
addCssPrefix(webpackConf, cssPrefix);
|
|
178
|
+
}
|
|
179
|
+
return webpackConf;
|
|
180
|
+
/* eslint-enable no-param-reassign */
|
|
181
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
@custom-media --small screen;
|
|
2
|
+
@custom-media --small-only screen and (max-width: 47.9375em);
|
|
3
|
+
@custom-media --medium screen and (min-width: 48em);
|
|
4
|
+
@custom-media --medium-only screen and (min-width: 48em) and (max-width: 63.9375em);
|
|
5
|
+
@custom-media --large screen and (min-width 64em);
|
|
6
|
+
@custom-media --large-only screen and (min-width: 64em) and (max-width: 89.9375em);
|
|
7
|
+
@custom-media --xlarge screen and (min-width 90em);
|
|
8
|
+
@custom-media --xlarge-only screen and (min-width: 90em) and (max-width: 119.9375em);
|
|
9
|
+
@custom-media --xxlarge screen and (min-width 120em);
|
|
10
|
+
@custom-media --xxlarge-only screen and (min-width: 120em) and (max-width: 99999999em);
|
|
11
|
+
@custom-media --mobile-s (min-width: 320px);
|
|
12
|
+
@custom-media --mobile-m (min-width: 375px);
|
|
13
|
+
@custom-media --mobile-l (min-width: 412px);
|
|
14
|
+
@custom-media --mobile (max-width: 599px);
|
|
15
|
+
@custom-media --tablet-s (min-width: 600px);
|
|
16
|
+
@custom-media --tablet-m (min-width: 768px);
|
|
17
|
+
@custom-media --tablet (min-width: 600px) and (max-width: 1023px);
|
|
18
|
+
@custom-media --desktop-s (min-width: 1024px);
|
|
19
|
+
@custom-media --desktop-m (min-width: 1280px);
|
|
20
|
+
@custom-media --desktop-l (min-width: 1440px);
|
|
21
|
+
@custom-media --desktop-xl (min-width: 1920px);
|
|
22
|
+
@custom-media --desktop (min-width: 1024px);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type PluginCreator } from 'postcss';
|
|
2
|
+
type PostCssPluginName = string | PluginCreator<unknown>;
|
|
3
|
+
export type PostcssPlugin = string | [string, unknown] | {
|
|
4
|
+
name: string;
|
|
5
|
+
plugin: PluginCreator<unknown>;
|
|
6
|
+
options?: unknown;
|
|
7
|
+
} | {
|
|
8
|
+
postcssPlugin: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Функция для создания конфигурационного файла postcss
|
|
12
|
+
* @param {PostCssPluginName[]} plugins список плагинов
|
|
13
|
+
* @param {Object} options коллекция конфигураций плагинов, где ключ - название плагина, а значение - аргумент для инициализации
|
|
14
|
+
* @returns {*}
|
|
15
|
+
*/
|
|
16
|
+
export declare function createPostcssConfig(plugins: PostCssPluginName[], options: Record<string, unknown>): PostcssPlugin[];
|
|
17
|
+
export declare const postcssPlugins: PostCssPluginName[];
|
|
18
|
+
export declare const postcssPluginsOptions: {
|
|
19
|
+
'postcss-import': {
|
|
20
|
+
path: string[];
|
|
21
|
+
};
|
|
22
|
+
postCssGlobalVariables: {
|
|
23
|
+
files: string[];
|
|
24
|
+
};
|
|
25
|
+
'postcss-url': {
|
|
26
|
+
url: string;
|
|
27
|
+
};
|
|
28
|
+
'postcss-color-mod-function': {
|
|
29
|
+
unresolved: string;
|
|
30
|
+
};
|
|
31
|
+
'postcss-custom-properties': {
|
|
32
|
+
preserve: boolean;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,65 @@
|
|
|
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.postcssPluginsOptions = exports.postcssPlugins = void 0;
|
|
7
|
+
exports.createPostcssConfig = createPostcssConfig;
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const postcss_global_variables_1 = require("../plugins/postcss-global-variables/postcss-global-variables");
|
|
10
|
+
const app_configs_1 = require("./app-configs");
|
|
11
|
+
/**
|
|
12
|
+
* Функция для создания конфигурационного файла postcss
|
|
13
|
+
* @param {PostCssPluginName[]} plugins список плагинов
|
|
14
|
+
* @param {Object} options коллекция конфигураций плагинов, где ключ - название плагина, а значение - аргумент для инициализации
|
|
15
|
+
* @returns {*}
|
|
16
|
+
*/
|
|
17
|
+
function createPostcssConfig(plugins, options) {
|
|
18
|
+
return plugins.map((pluginName) => {
|
|
19
|
+
if (typeof pluginName === 'string') {
|
|
20
|
+
return pluginName in options ? [pluginName, options[pluginName]] : pluginName;
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
name: pluginName.name,
|
|
24
|
+
plugin: pluginName,
|
|
25
|
+
options: options[pluginName.name],
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
exports.postcssPlugins = [
|
|
30
|
+
'postcss-omit-import-tilde',
|
|
31
|
+
'postcss-import',
|
|
32
|
+
'postcss-url',
|
|
33
|
+
'postcss-mixins',
|
|
34
|
+
'postcss-for',
|
|
35
|
+
'postcss-each',
|
|
36
|
+
postcss_global_variables_1.postCssGlobalVariables,
|
|
37
|
+
'postcss-custom-media',
|
|
38
|
+
'postcss-color-mod-function',
|
|
39
|
+
!app_configs_1.configs.keepCssVars && 'postcss-custom-properties',
|
|
40
|
+
!app_configs_1.configs.keepCssVars && 'postcss-remove-root',
|
|
41
|
+
'postcss-strip-units',
|
|
42
|
+
'postcss-calc',
|
|
43
|
+
'postcss-color-function',
|
|
44
|
+
'postcss-nested',
|
|
45
|
+
'autoprefixer',
|
|
46
|
+
'postcss-inherit',
|
|
47
|
+
'postcss-discard-comments',
|
|
48
|
+
].filter(Boolean);
|
|
49
|
+
exports.postcssPluginsOptions = {
|
|
50
|
+
'postcss-import': {
|
|
51
|
+
path: ['./src'],
|
|
52
|
+
},
|
|
53
|
+
postCssGlobalVariables: {
|
|
54
|
+
files: [path_1.default.join(__dirname, 'mq.css'), app_configs_1.configs.componentsTheme].filter(Boolean),
|
|
55
|
+
},
|
|
56
|
+
'postcss-url': {
|
|
57
|
+
url: 'rebase',
|
|
58
|
+
},
|
|
59
|
+
'postcss-color-mod-function': {
|
|
60
|
+
unresolved: 'warn',
|
|
61
|
+
},
|
|
62
|
+
'postcss-custom-properties': {
|
|
63
|
+
preserve: false,
|
|
64
|
+
},
|
|
65
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.serverPostcssConfig = exports.postcssConfig = void 0;
|
|
4
|
+
const apply_overrides_1 = require("./util/apply-overrides");
|
|
5
|
+
const postcss_config_1 = require("./postcss.config");
|
|
6
|
+
const postcssConfigWithOverrides = (0, apply_overrides_1.applyOverrides)('postcss', (0, postcss_config_1.createPostcssConfig)(postcss_config_1.postcssPlugins, postcss_config_1.postcssPluginsOptions));
|
|
7
|
+
const isResolvedPostcssPlugin = (plugin) => typeof plugin === 'object' && !Array.isArray(plugin) && 'postcssPlugin' in plugin;
|
|
8
|
+
const resolvePostcssConfig = (plugins) => plugins.map((plugin) => typeof plugin === 'string' || Array.isArray(plugin) || isResolvedPostcssPlugin(plugin)
|
|
9
|
+
? plugin
|
|
10
|
+
: plugin.plugin(plugin.options));
|
|
11
|
+
const isAutoprefixerPlugin = (plugin) => {
|
|
12
|
+
if (plugin === 'autoprefixer') {
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
if (Array.isArray(plugin)) {
|
|
16
|
+
return plugin[0] === 'autoprefixer';
|
|
17
|
+
}
|
|
18
|
+
return isResolvedPostcssPlugin(plugin) && plugin.postcssPlugin === 'autoprefixer';
|
|
19
|
+
};
|
|
20
|
+
exports.postcssConfig = resolvePostcssConfig(postcssConfigWithOverrides);
|
|
21
|
+
exports.serverPostcssConfig = resolvePostcssConfig(postcssConfigWithOverrides.filter((plugin) => !isAutoprefixerPlugin(plugin)));
|
|
@@ -0,0 +1,45 @@
|
|
|
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.processAssetsPluginOutput = processAssetsPluginOutput;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const app_configs_1 = require("./app-configs");
|
|
9
|
+
const modules_1 = require("./modules");
|
|
10
|
+
function processAssetsPluginOutput(assets) {
|
|
11
|
+
var _a;
|
|
12
|
+
const adjustedAssets = assets;
|
|
13
|
+
Object.keys(adjustedAssets).forEach((key) => {
|
|
14
|
+
// заменяем путь к файлам на корректный в случае если в нем есть 'auto/'
|
|
15
|
+
adjustedAssets[key] = {
|
|
16
|
+
css: replaceAutoPath(adjustedAssets[key].css),
|
|
17
|
+
js: replaceAutoPath(adjustedAssets[key].js),
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
// добавляем в манифест js-файлы для модулей
|
|
21
|
+
Object.keys(((_a = app_configs_1.configs.modules) === null || _a === void 0 ? void 0 : _a.exposes) || {}).forEach((moduleName) => {
|
|
22
|
+
var _a, _b;
|
|
23
|
+
if ((_b = (_a = app_configs_1.configs.compatModules) === null || _a === void 0 ? void 0 : _a.exposes) === null || _b === void 0 ? void 0 : _b[moduleName]) {
|
|
24
|
+
throw new Error(`Модуль ${moduleName} определен как module и как compat. Поменяйте название одного из модулей или удалите его`);
|
|
25
|
+
}
|
|
26
|
+
adjustedAssets[moduleName] = {
|
|
27
|
+
mode: 'default',
|
|
28
|
+
js: path_1.default.join(app_configs_1.configs.publicPath, modules_1.MODULES_ENTRY_NAME),
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
const result = Object.assign(Object.assign({}, adjustedAssets), { __metadata__: {
|
|
32
|
+
version: app_configs_1.configs.version,
|
|
33
|
+
name: app_configs_1.configs.normalizedName,
|
|
34
|
+
} });
|
|
35
|
+
return JSON.stringify(result);
|
|
36
|
+
}
|
|
37
|
+
function replaceAutoPath(assets) {
|
|
38
|
+
if (!assets) {
|
|
39
|
+
return assets;
|
|
40
|
+
}
|
|
41
|
+
if (Array.isArray(assets)) {
|
|
42
|
+
return assets.map((asset) => asset.replace(/^auto\//, app_configs_1.configs.publicPath));
|
|
43
|
+
}
|
|
44
|
+
return assets.replace(/^auto\//, app_configs_1.configs.publicPath);
|
|
45
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const serverExternalsExemptions: RegExp[];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.serverExternalsExemptions = void 0;
|
|
4
|
+
const apply_overrides_1 = require("./util/apply-overrides");
|
|
5
|
+
exports.serverExternalsExemptions = (0, apply_overrides_1.applyOverrides)('serverExternalsExemptions', [
|
|
6
|
+
/^arui-ft-private/,
|
|
7
|
+
/^arui-private/,
|
|
8
|
+
/^alfaform-core-ui/,
|
|
9
|
+
/^@alfa-bank\/newclick-composite-components/,
|
|
10
|
+
/^@alfa-bank\/common-app-html/,
|
|
11
|
+
/^#/,
|
|
12
|
+
/^@alfalab\/icons/,
|
|
13
|
+
/^@alfalab\/core-components/,
|
|
14
|
+
/^date-fns/,
|
|
15
|
+
/^@corp-front\//,
|
|
16
|
+
/^corp-sign-ui-react/,
|
|
17
|
+
/^@alfalab\/scripts-/,
|
|
18
|
+
]);
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.statsOptions = void 0;
|
|
4
|
+
const apply_overrides_1 = require("./util/apply-overrides");
|
|
5
|
+
exports.statsOptions = (0, apply_overrides_1.applyOverrides)('stats', {
|
|
6
|
+
// Add asset Information
|
|
7
|
+
assets: false,
|
|
8
|
+
// Add information about cached (not built) modules
|
|
9
|
+
cached: false,
|
|
10
|
+
// Show cached assets (setting this to `false` only shows emitted files)
|
|
11
|
+
cachedAssets: false,
|
|
12
|
+
// Add children information
|
|
13
|
+
children: false,
|
|
14
|
+
// Add chunk information (setting this to `false` allows for a less verbose output)
|
|
15
|
+
chunks: false,
|
|
16
|
+
// Add built modules information to chunk information
|
|
17
|
+
chunkModules: false,
|
|
18
|
+
// Add the origins of chunks and chunk merging info
|
|
19
|
+
chunkOrigins: false,
|
|
20
|
+
// `webpack --colors` equivalent
|
|
21
|
+
colors: true,
|
|
22
|
+
// Add errors
|
|
23
|
+
errors: true,
|
|
24
|
+
// Add details to errors (like resolving log)
|
|
25
|
+
errorDetails: true,
|
|
26
|
+
// Add the hash of the compilation
|
|
27
|
+
hash: false,
|
|
28
|
+
// Add built modules information
|
|
29
|
+
modules: true,
|
|
30
|
+
// Show dependencies and origin of warnings/errors (since webpack 2.5.0)
|
|
31
|
+
moduleTrace: true,
|
|
32
|
+
// Show performance hint when file size exceeds `performance.maxAssetSize`
|
|
33
|
+
performance: true,
|
|
34
|
+
// Add public path information
|
|
35
|
+
publicPath: false,
|
|
36
|
+
// Add information about the reasons why modules are included
|
|
37
|
+
reasons: false,
|
|
38
|
+
// Add timing information
|
|
39
|
+
timings: true,
|
|
40
|
+
// Add webpack version information
|
|
41
|
+
version: false,
|
|
42
|
+
// Add warnings
|
|
43
|
+
warnings: true,
|
|
44
|
+
// ignore warning from missing types
|
|
45
|
+
warningsFilter: /export .* was not found in/,
|
|
46
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const supportingBrowsers: string[];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.supportingBrowsers = void 0;
|
|
4
|
+
const apply_overrides_1 = require("./util/apply-overrides");
|
|
5
|
+
exports.supportingBrowsers = (0, apply_overrides_1.applyOverrides)(['browsers', 'supportingBrowsers'], ['last 2 versions', 'not dead', 'Android >= 6', 'iOS >= 14']);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const supportingNode: string[];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.supportingNode = void 0;
|
|
4
|
+
const apply_overrides_1 = require("./util/apply-overrides");
|
|
5
|
+
exports.supportingNode = (0, apply_overrides_1.applyOverrides)(['supportingNode'], ['current node']);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.swcJestConfig = exports.swcServerConfig = exports.swcClientConfig = void 0;
|
|
4
|
+
const apply_overrides_1 = require("./util/apply-overrides");
|
|
5
|
+
const app_configs_1 = require("./app-configs");
|
|
6
|
+
const swcConfig = {
|
|
7
|
+
env: { coreJs: '3', mode: 'entry' },
|
|
8
|
+
jsc: {
|
|
9
|
+
parser: {
|
|
10
|
+
syntax: 'typescript',
|
|
11
|
+
tsx: true,
|
|
12
|
+
decorators: true,
|
|
13
|
+
},
|
|
14
|
+
loose: false,
|
|
15
|
+
transform: {
|
|
16
|
+
legacyDecorator: true,
|
|
17
|
+
react: {
|
|
18
|
+
runtime: 'automatic',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
experimental: app_configs_1.configs.collectCoverage
|
|
22
|
+
? {
|
|
23
|
+
plugins: [['swc-plugin-coverage-instrument', {}]],
|
|
24
|
+
}
|
|
25
|
+
: {},
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
exports.swcClientConfig = (0, apply_overrides_1.applyOverrides)(['swc', 'swcClient'], swcConfig);
|
|
29
|
+
exports.swcServerConfig = (0, apply_overrides_1.applyOverrides)(['swc', 'swcServer'], swcConfig);
|
|
30
|
+
exports.swcJestConfig = (0, apply_overrides_1.applyOverrides)(['swc', 'swcJest'], swcConfig);
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type * as rspack from '@rspack/core';
|
|
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 createFindPluginFunction } from './find-plugin';
|
|
8
|
+
type Overrides = {
|
|
9
|
+
webpack: rspack.Configuration | rspack.Configuration[];
|
|
10
|
+
webpackClient: rspack.Configuration | rspack.Configuration[];
|
|
11
|
+
webpackDev: rspack.Configuration | rspack.Configuration[];
|
|
12
|
+
webpackClientDev: rspack.Configuration | rspack.Configuration[];
|
|
13
|
+
webpackServer: rspack.Configuration;
|
|
14
|
+
webpackServerDev: rspack.Configuration;
|
|
15
|
+
webpackProd: rspack.Configuration;
|
|
16
|
+
webpackClientProd: rspack.Configuration | rspack.Configuration[];
|
|
17
|
+
webpackServerProd: rspack.Configuration;
|
|
18
|
+
devServer: RspackDevServerConfiguration;
|
|
19
|
+
stats: rspack.RspackOptionsNormalized['stats'];
|
|
20
|
+
babel: any;
|
|
21
|
+
babelClient: any;
|
|
22
|
+
babelServer: any;
|
|
23
|
+
babelDependencies: any;
|
|
24
|
+
swc: SwcOptions;
|
|
25
|
+
swcServer: SwcOptions;
|
|
26
|
+
swcClient: SwcOptions;
|
|
27
|
+
swcJest: SwcOptions;
|
|
28
|
+
postcss: any[];
|
|
29
|
+
browsers: string[];
|
|
30
|
+
supportingBrowsers: string[];
|
|
31
|
+
supportingNode: string[];
|
|
32
|
+
/** @deprecated Используйте `overrides.dockerfile` в конфиге @alfalab/arui-scripts-artifacts. */
|
|
33
|
+
Dockerfile: string;
|
|
34
|
+
/** @deprecated Используйте `overrides.dockerfileCompiled` в конфиге @alfalab/arui-scripts-artifacts. */
|
|
35
|
+
DockerfileCompiled: string;
|
|
36
|
+
/** @deprecated Используйте `overrides.nginxConf` в конфиге @alfalab/arui-scripts-artifacts. */
|
|
37
|
+
nginx: string;
|
|
38
|
+
/** @deprecated Используйте `overrides.baseNginxConf` в конфиге @alfalab/arui-scripts-artifacts. */
|
|
39
|
+
nginxConf: string;
|
|
40
|
+
/** @deprecated Используйте `overrides.startScript` в конфиге @alfalab/arui-scripts-artifacts. */
|
|
41
|
+
'start.sh': string;
|
|
42
|
+
serverExternalsExemptions: Array<string | RegExp>;
|
|
43
|
+
html: string;
|
|
44
|
+
};
|
|
45
|
+
type OmitFirstArg<F> = F extends (x: any, ...args: infer P) => infer R ? (...args: P) => R : never;
|
|
46
|
+
type BoundCreateSingleClientWebpackConfig = OmitFirstArg<typeof createSingleClientWebpackConfig>;
|
|
47
|
+
type ClientWebpackAdditionalArgs = {
|
|
48
|
+
createSingleClientWebpackConfig: BoundCreateSingleClientWebpackConfig;
|
|
49
|
+
findLoader: typeof findLoader;
|
|
50
|
+
findPlugin: ReturnType<typeof createFindPluginFunction<'client'>>;
|
|
51
|
+
};
|
|
52
|
+
type ServerWebpackAdditionalArgs = {
|
|
53
|
+
findLoader: typeof findLoader;
|
|
54
|
+
findPlugin: ReturnType<typeof createFindPluginFunction<'server'>>;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Дополнительные аргументы, которые будут переданы в функцию оверрайда
|
|
58
|
+
*/
|
|
59
|
+
type OverridesAdditionalArgs = {
|
|
60
|
+
webpack: ClientWebpackAdditionalArgs;
|
|
61
|
+
webpackClient: ClientWebpackAdditionalArgs;
|
|
62
|
+
webpackDev: ClientWebpackAdditionalArgs;
|
|
63
|
+
webpackClientDev: ClientWebpackAdditionalArgs;
|
|
64
|
+
webpackProd: ClientWebpackAdditionalArgs;
|
|
65
|
+
webpackClientProd: ClientWebpackAdditionalArgs;
|
|
66
|
+
webpackServer: ServerWebpackAdditionalArgs;
|
|
67
|
+
webpackServerDev: ServerWebpackAdditionalArgs;
|
|
68
|
+
webpackServerProd: ServerWebpackAdditionalArgs;
|
|
69
|
+
};
|
|
70
|
+
type OverrideFunction<K extends keyof Overrides, AdditionalArgs = K extends keyof OverridesAdditionalArgs ? OverridesAdditionalArgs[K] : undefined> = (config: Overrides[K], appConfig: AppContextWithConfigs, additionalArgs: AdditionalArgs) => Overrides[K];
|
|
71
|
+
export type OverrideFile = {
|
|
72
|
+
[K in keyof Overrides]?: OverrideFunction<K>;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Объявлен ли оверрайд с таким ключом хоть в одном файле оверрайдов. Нужно, чтобы предупреждать об
|
|
76
|
+
* устаревших ключах только тем, кто ими действительно пользуется.
|
|
77
|
+
*/
|
|
78
|
+
export declare function hasOverride(overridesKey: keyof Overrides): boolean;
|
|
79
|
+
/**
|
|
80
|
+
*
|
|
81
|
+
* @param {String|String[]} overridesKey Ключи оверрайда
|
|
82
|
+
* @param {Object} config Конфиг, к которому нужно применить оверрайды
|
|
83
|
+
* @param args Дополнительные аргументы, которые будут переданы в функцию оверрайда
|
|
84
|
+
* @returns {*}
|
|
85
|
+
*/
|
|
86
|
+
export declare function applyOverrides<T extends Overrides[Key], Key extends keyof Overrides, Args = Key extends keyof OverridesAdditionalArgs ? OverridesAdditionalArgs[Key] : undefined>(overridesKey: Key | Key[], config: T, args?: any): T;
|
|
87
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hasOverride = hasOverride;
|
|
4
|
+
exports.applyOverrides = applyOverrides;
|
|
5
|
+
const app_configs_1 = require("../app-configs");
|
|
6
|
+
let overrides = [];
|
|
7
|
+
overrides = app_configs_1.configs.overridesPath.map((path) => {
|
|
8
|
+
try {
|
|
9
|
+
// eslint-disable-next-line import/no-dynamic-require, global-require, @typescript-eslint/no-var-requires
|
|
10
|
+
const requireResult = require(path);
|
|
11
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
12
|
+
if (requireResult.__esModule) {
|
|
13
|
+
// ts-node импортирует esModules, из них надо вытягивать default именно так
|
|
14
|
+
return requireResult.default;
|
|
15
|
+
}
|
|
16
|
+
return requireResult;
|
|
17
|
+
}
|
|
18
|
+
catch (e) {
|
|
19
|
+
console.error(`Unable to process override file "${path}"`);
|
|
20
|
+
console.log(e);
|
|
21
|
+
return {};
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
/**
|
|
25
|
+
* Объявлен ли оверрайд с таким ключом хоть в одном файле оверрайдов. Нужно, чтобы предупреждать об
|
|
26
|
+
* устаревших ключах только тем, кто ими действительно пользуется.
|
|
27
|
+
*/
|
|
28
|
+
function hasOverride(overridesKey) {
|
|
29
|
+
return overrides.some((override) => Object.prototype.hasOwnProperty.call(override, overridesKey));
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
*
|
|
33
|
+
* @param {String|String[]} overridesKey Ключи оверрайда
|
|
34
|
+
* @param {Object} config Конфиг, к которому нужно применить оверрайды
|
|
35
|
+
* @param args Дополнительные аргументы, которые будут переданы в функцию оверрайда
|
|
36
|
+
* @returns {*}
|
|
37
|
+
*/
|
|
38
|
+
function applyOverrides(overridesKey, config, args) {
|
|
39
|
+
if (typeof overridesKey === 'string') {
|
|
40
|
+
// eslint-disable-next-line no-param-reassign
|
|
41
|
+
overridesKey = [overridesKey];
|
|
42
|
+
}
|
|
43
|
+
overridesKey.forEach((key) => {
|
|
44
|
+
overrides.forEach((override) => {
|
|
45
|
+
if (Object.prototype.hasOwnProperty.call(override, key)) {
|
|
46
|
+
const overrideFn = override[key];
|
|
47
|
+
if (typeof overrideFn !== 'function') {
|
|
48
|
+
throw new TypeError(`Override ${key} must be a function`);
|
|
49
|
+
}
|
|
50
|
+
// eslint-disable-next-line no-param-reassign
|
|
51
|
+
config = overrideFn(config, app_configs_1.configs, args);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
return config;
|
|
56
|
+
}
|