arui-scripts 0.0.0-client-only-envs-20250408153713
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/.browserslistrc +5 -0
- package/.eslintignore +2 -0
- package/.eslintrc.js +17 -0
- package/.turbo/turbo-build.log +0 -0
- package/.turbo/turbo-test.log +23 -0
- package/CHANGELOG.md +1571 -0
- package/README.md +47 -0
- package/bin/build.sh +2 -0
- package/build/bin/index.d.ts +3 -0
- package/build/bin/index.js +29 -0
- package/build/commands/archive-build/index.d.ts +1 -0
- package/build/commands/archive-build/index.js +80 -0
- package/build/commands/build/build-wrapper.d.ts +8 -0
- package/build/commands/build/build-wrapper.js +42 -0
- package/build/commands/build/client.d.ts +1 -0
- package/build/commands/build/client.js +41 -0
- package/build/commands/build/index.d.ts +1 -0
- package/build/commands/build/index.js +15 -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 +40 -0
- package/build/commands/changelog/index.d.ts +5 -0
- package/build/commands/changelog/index.js +113 -0
- package/build/commands/docker-build/index.d.ts +1 -0
- package/build/commands/docker-build/index.js +73 -0
- package/build/commands/docker-build-compiled/index.d.ts +1 -0
- package/build/commands/docker-build-compiled/index.js +54 -0
- package/build/commands/ensure-yarn/index.d.ts +0 -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 +8 -0
- package/build/commands/start/index.d.ts +1 -0
- package/build/commands/start/index.js +17 -0
- package/build/commands/start/print-compiler-output.d.ts +1 -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 +8 -0
- package/build/commands/start-prod/client.d.ts +1 -0
- package/build/commands/start-prod/client.js +8 -0
- package/build/commands/start-prod/index.d.ts +1 -0
- package/build/commands/start-prod/index.js +17 -0
- package/build/commands/start-prod/server.d.ts +1 -0
- package/build/commands/start-prod/server.js +8 -0
- package/build/commands/test/get-config.d.ts +1 -0
- package/build/commands/test/get-config.js +104 -0
- package/build/commands/test/index.d.ts +1 -0
- package/build/commands/test/index.js +60 -0
- package/build/commands/util/client-assets-sizes.d.ts +26 -0
- package/build/commands/util/client-assets-sizes.js +82 -0
- package/build/commands/util/docker-build.d.ts +23 -0
- package/build/commands/util/docker-build.js +127 -0
- package/build/commands/util/exec.d.ts +2 -0
- package/build/commands/util/exec.js +20 -0
- package/build/commands/util/format-webpack-messages.d.ts +11 -0
- package/build/commands/util/format-webpack-messages.js +95 -0
- package/build/commands/util/make-tmp-dir.d.ts +6 -0
- package/build/commands/util/make-tmp-dir.js +29 -0
- package/build/commands/util/run-client-dev-server.d.ts +2 -0
- package/build/commands/util/run-client-dev-server.js +46 -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 +19 -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 +5 -0
- package/build/commands/util/yarn.js +55 -0
- package/build/configs/app-configs/calculate-dependent-config.d.ts +9 -0
- package/build/configs/app-configs/calculate-dependent-config.js +38 -0
- package/build/configs/app-configs/get-defaults.d.ts +5 -0
- package/build/configs/app-configs/get-defaults.js +139 -0
- package/build/configs/app-configs/index.d.ts +6 -0
- package/build/configs/app-configs/index.js +24 -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 +126 -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-settings-keys.d.ts +4 -0
- package/build/configs/app-configs/validate-settings-keys.js +13 -0
- package/build/configs/app-configs/warn-about-deprecations.d.ts +2 -0
- package/build/configs/app-configs/warn-about-deprecations.js +20 -0
- package/build/configs/babel-client.d.ts +32 -0
- package/build/configs/babel-client.js +72 -0
- package/build/configs/babel-dependencies.d.ts +14 -0
- package/build/configs/babel-dependencies.js +39 -0
- package/build/configs/babel-server.d.ts +27 -0
- package/build/configs/babel-server.js +48 -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 +73 -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 +16 -0
- package/build/configs/modules.js +149 -0
- package/build/configs/mq.css +22 -0
- package/build/configs/postcss.config.d.ts +36 -0
- package/build/configs/postcss.config.js +71 -0
- package/build/configs/postcss.d.ts +2 -0
- package/build/configs/postcss.js +11 -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 +21 -0
- package/build/configs/stats-options.d.ts +3 -0
- package/build/configs/stats-options.js +49 -0
- package/build/configs/supporting-browsers.d.ts +2 -0
- package/build/configs/supporting-browsers.js +8 -0
- package/build/configs/swc.d.ts +4 -0
- package/build/configs/swc.js +35 -0
- package/build/configs/util/apply-overrides.d.ts +76 -0
- package/build/configs/util/apply-overrides.js +52 -0
- package/build/configs/util/check-node-version.d.ts +2 -0
- package/build/configs/util/check-node-version.js +7 -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 +85 -0
- package/build/configs/util/find-plugin.js +22 -0
- package/build/configs/util/get-entry.d.ts +9 -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 +26 -0
- package/build/configs/util/get-webpack-cache-dependencies.d.ts +1 -0
- package/build/configs/util/get-webpack-cache-dependencies.js +18 -0
- package/build/configs/util/install-sourcemap-support.d.ts +1 -0
- package/build/configs/util/install-sourcemap-support.js +11 -0
- package/build/configs/util/node-assets-ignore.d.ts +0 -0
- package/build/configs/util/node-assets-ignore.js +33 -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 +0 -0
- package/build/configs/util/register-ts-node.js +18 -0
- package/build/configs/util/resolve.d.ts +12 -0
- package/build/configs/util/resolve.js +29 -0
- package/build/configs/webpack.client.d.ts +10 -0
- package/build/configs/webpack.client.dev.d.ts +2 -0
- package/build/configs/webpack.client.dev.js +15 -0
- package/build/configs/webpack.client.js +475 -0
- package/build/configs/webpack.client.prod.d.ts +2 -0
- package/build/configs/webpack.client.prod.js +15 -0
- package/build/configs/webpack.server.d.ts +2 -0
- package/build/configs/webpack.server.dev.d.ts +2 -0
- package/build/configs/webpack.server.dev.js +11 -0
- package/build/configs/webpack.server.js +256 -0
- package/build/configs/webpack.server.prod.d.ts +2 -0
- package/build/configs/webpack.server.prod.js +11 -0
- package/build/index.d.ts +5 -0
- package/build/index.js +9 -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 +62 -0
- package/build/plugins/reload-server-plugin.d.ts +10 -0
- package/build/plugins/reload-server-plugin.js +44 -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/base-nginx.conf.template.d.ts +2 -0
- package/build/templates/base-nginx.conf.template.js +61 -0
- package/build/templates/dockerfile-compiled.template.d.ts +2 -0
- package/build/templates/dockerfile-compiled.template.js +52 -0
- package/build/templates/dockerfile.template.d.ts +2 -0
- package/build/templates/dockerfile.template.js +41 -0
- package/build/templates/html.template.d.ts +1 -0
- package/build/templates/html.template.js +25 -0
- package/build/templates/nginx.conf.template.d.ts +2 -0
- package/build/templates/nginx.conf.template.js +39 -0
- package/build/templates/start.template.d.ts +2 -0
- package/build/templates/start.template.js +69 -0
- package/build/tsconfig-local.tsbuildinfo +1 -0
- package/docs/artifact.md +58 -0
- package/docs/caveats.md +41 -0
- package/docs/client-only.md +77 -0
- package/docs/commands.md +125 -0
- package/docs/compilers.md +18 -0
- package/docs/examples.md +100 -0
- package/docs/modules.md +780 -0
- package/docs/overrides.md +167 -0
- package/docs/presets.md +65 -0
- package/docs/settings.md +287 -0
- package/jest-preset.js +5 -0
- package/package.json +180 -0
- package/stylelint.config.js +11 -0
- package/tsconfig-local.json +16 -0
- package/tsconfig.eslint.json +5 -0
- package/tsconfig.json +71 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { DevTool } from '@rspack/core';
|
|
2
|
+
import { RspackDevServer } from '@rspack/dev-server';
|
|
3
|
+
/**
|
|
4
|
+
* Конфигурация arui-scripts, которая может быть переопределена приложением
|
|
5
|
+
*/
|
|
6
|
+
export type AppConfigs = {
|
|
7
|
+
clientServerPort: number;
|
|
8
|
+
serverPort: number;
|
|
9
|
+
debug: boolean;
|
|
10
|
+
devSourceMaps: DevTool;
|
|
11
|
+
devServerCors: boolean;
|
|
12
|
+
useServerHMR: boolean;
|
|
13
|
+
presets: string | null;
|
|
14
|
+
proxy: RspackDevServer['options']['proxy'];
|
|
15
|
+
clientOnly: boolean;
|
|
16
|
+
buildPath: string;
|
|
17
|
+
assetsPath: string;
|
|
18
|
+
additionalBuildPath: string[];
|
|
19
|
+
statsOutputFilename: string;
|
|
20
|
+
serverEntry: string | string[] | Record<string, string | string[]>;
|
|
21
|
+
serverOutput: string;
|
|
22
|
+
clientPolyfillsEntry: null | string | string[];
|
|
23
|
+
clientEntry: string | string[] | Record<string, string | string[]>;
|
|
24
|
+
dockerRegistry: string;
|
|
25
|
+
baseDockerImage: string;
|
|
26
|
+
nginxRootPath: string;
|
|
27
|
+
nginx: {
|
|
28
|
+
workerProcesses?: number;
|
|
29
|
+
workerRlimitNoFile?: number;
|
|
30
|
+
workerConnections?: number;
|
|
31
|
+
eventsUse?: string;
|
|
32
|
+
daemon?: string;
|
|
33
|
+
} | null;
|
|
34
|
+
runFromNonRootUser: boolean;
|
|
35
|
+
removeDevDependenciesDuringDockerBuild: boolean;
|
|
36
|
+
archiveName: string;
|
|
37
|
+
keepPropTypes: boolean;
|
|
38
|
+
codeLoader: 'babel' | 'tsc' | 'swc';
|
|
39
|
+
installServerSourceMaps: boolean;
|
|
40
|
+
disableDevWebpackTypecheck: boolean;
|
|
41
|
+
jestCodeTransformer: 'babel' | 'tsc' | 'swc';
|
|
42
|
+
collectCoverage: boolean;
|
|
43
|
+
dataUrlMaxSize?: number;
|
|
44
|
+
imageMinimizer?: {
|
|
45
|
+
svg?: {
|
|
46
|
+
enabled?: boolean;
|
|
47
|
+
};
|
|
48
|
+
gif?: {
|
|
49
|
+
enabled?: boolean;
|
|
50
|
+
optimizationLevel?: number;
|
|
51
|
+
};
|
|
52
|
+
jpg?: {
|
|
53
|
+
enabled?: boolean;
|
|
54
|
+
quality: number;
|
|
55
|
+
};
|
|
56
|
+
png?: {
|
|
57
|
+
enabled?: boolean;
|
|
58
|
+
optimizationLevel?: number;
|
|
59
|
+
bitDepthReduction?: boolean;
|
|
60
|
+
colorTypeReduction?: boolean;
|
|
61
|
+
paletteReduction?: boolean;
|
|
62
|
+
interlaced?: boolean;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
componentsTheme: string | null;
|
|
66
|
+
keepCssVars: boolean;
|
|
67
|
+
disableModulesSupport: boolean;
|
|
68
|
+
compatModules: {
|
|
69
|
+
shared?: {
|
|
70
|
+
[libraryName: string]: string;
|
|
71
|
+
};
|
|
72
|
+
exposes?: {
|
|
73
|
+
[moduleId: string]: CompatModuleConfigBase;
|
|
74
|
+
};
|
|
75
|
+
} | null;
|
|
76
|
+
modules: {
|
|
77
|
+
name?: string;
|
|
78
|
+
shared: any;
|
|
79
|
+
exposes?: Record<string, string>;
|
|
80
|
+
options?: ModuleConfigBase;
|
|
81
|
+
} | null;
|
|
82
|
+
};
|
|
83
|
+
export type ModuleConfigBase = {
|
|
84
|
+
cssPrefix?: false | string;
|
|
85
|
+
};
|
|
86
|
+
type CompatModuleConfigBase = ModuleConfigBase & {
|
|
87
|
+
entry: string;
|
|
88
|
+
externals?: Record<string, string>;
|
|
89
|
+
};
|
|
90
|
+
export type CompatModuleConfig = CompatModuleConfigBase & {
|
|
91
|
+
name: string;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Внутренний контекст arui-scripts
|
|
95
|
+
*/
|
|
96
|
+
export type AppContext = {
|
|
97
|
+
appPackage: any;
|
|
98
|
+
name: string;
|
|
99
|
+
normalizedName: string;
|
|
100
|
+
version: string;
|
|
101
|
+
cwd: string;
|
|
102
|
+
appSrc: string;
|
|
103
|
+
appNodeModules: string;
|
|
104
|
+
appNodeModulesBin: string;
|
|
105
|
+
babelRuntimeVersion: string;
|
|
106
|
+
useYarn: boolean;
|
|
107
|
+
tsconfig: string | null;
|
|
108
|
+
localNginxConf: string | null;
|
|
109
|
+
localNginxBaseConf: string | null;
|
|
110
|
+
localDockerfile: string | null;
|
|
111
|
+
localStartScript: string | null;
|
|
112
|
+
overridesPath: string[];
|
|
113
|
+
publicPath: string;
|
|
114
|
+
serverOutputPath: string;
|
|
115
|
+
clientOutputPath: string;
|
|
116
|
+
statsOutputPath: string;
|
|
117
|
+
watchIgnorePath: string[];
|
|
118
|
+
changelogPath: string;
|
|
119
|
+
changelogTmpPath: string;
|
|
120
|
+
changelogFeaturesPath: string;
|
|
121
|
+
changelogBugfixesPath: string;
|
|
122
|
+
changelogBreakingChangesPath: string;
|
|
123
|
+
};
|
|
124
|
+
export type AppContextWithConfigs = AppContext & AppConfigs;
|
|
125
|
+
export type PackageSettings = Partial<AppConfigs>;
|
|
126
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
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.updateWithConfigFile = updateWithConfigFile;
|
|
7
|
+
const lodash_merge_1 = __importDefault(require("lodash.merge"));
|
|
8
|
+
const read_config_file_1 = require("./read-config-file");
|
|
9
|
+
const validate_settings_keys_1 = require("./validate-settings-keys");
|
|
10
|
+
function updateWithConfigFile(config, context) {
|
|
11
|
+
const appSettings = (0, read_config_file_1.readConfigFile)(context.cwd);
|
|
12
|
+
if (appSettings) {
|
|
13
|
+
(0, validate_settings_keys_1.validateSettingsKeys)(config, appSettings, context.cwd);
|
|
14
|
+
return (0, lodash_merge_1.default)(config, appSettings);
|
|
15
|
+
}
|
|
16
|
+
return config;
|
|
17
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
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.updateWithEnv = updateWithEnv;
|
|
7
|
+
const lodash_merge_1 = __importDefault(require("lodash.merge"));
|
|
8
|
+
const validate_settings_keys_1 = require("./validate-settings-keys");
|
|
9
|
+
function updateWithEnv(config) {
|
|
10
|
+
if (!process.env.ARUI_SCRIPTS_CONFIG) {
|
|
11
|
+
return config;
|
|
12
|
+
}
|
|
13
|
+
try {
|
|
14
|
+
console.warn('Используйте ARUI_SCRIPTS_CONFIG только для отладки');
|
|
15
|
+
const envSettings = JSON.parse(process.env.ARUI_SCRIPTS_CONFIG);
|
|
16
|
+
(0, validate_settings_keys_1.validateSettingsKeys)(config, envSettings, 'ENV');
|
|
17
|
+
return (0, lodash_merge_1.default)(config, envSettings);
|
|
18
|
+
}
|
|
19
|
+
catch (e) {
|
|
20
|
+
console.error(e);
|
|
21
|
+
throw Error('Not valid JSON passed. Correct it. For example: ARUI_SCRIPTS_CONFIG="{"serverPort":3333}"');
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
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.updateWithPackage = updateWithPackage;
|
|
7
|
+
const lodash_merge_1 = __importDefault(require("lodash.merge"));
|
|
8
|
+
const validate_settings_keys_1 = require("./validate-settings-keys");
|
|
9
|
+
function updateWithPackage(config, context) {
|
|
10
|
+
const packageSettings = context.appPackage.aruiScripts || {};
|
|
11
|
+
(0, validate_settings_keys_1.validateSettingsKeys)(config, packageSettings, 'package.json');
|
|
12
|
+
return (0, lodash_merge_1.default)(config, packageSettings);
|
|
13
|
+
}
|
|
@@ -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.updateWithPresets = updateWithPresets;
|
|
7
|
+
exports.getPresetsConfigPath = getPresetsConfigPath;
|
|
8
|
+
// TODO: remove eslint-disable-next-line
|
|
9
|
+
const lodash_merge_1 = __importDefault(require("lodash.merge"));
|
|
10
|
+
const resolve_1 = require("../util/resolve");
|
|
11
|
+
const validate_settings_keys_1 = require("./validate-settings-keys");
|
|
12
|
+
function updateWithPresets(config, context) {
|
|
13
|
+
if (!config.presets) {
|
|
14
|
+
return config;
|
|
15
|
+
}
|
|
16
|
+
const presetsConfigPath = getPresetsConfigPath(config, context.cwd);
|
|
17
|
+
const presetsOverridesPath = (0, resolve_1.tryResolve)(`${config.presets}/arui-scripts.overrides`, {
|
|
18
|
+
paths: [context.cwd],
|
|
19
|
+
});
|
|
20
|
+
if (presetsConfigPath) {
|
|
21
|
+
// eslint-disable-next-line import/no-dynamic-require, @typescript-eslint/no-var-requires, global-require
|
|
22
|
+
let presetsSettings = require(presetsConfigPath);
|
|
23
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
24
|
+
if (presetsSettings.__esModule) {
|
|
25
|
+
// ts-node импортирует esModules, из них надо вытягивать default именно так
|
|
26
|
+
presetsSettings = presetsSettings.default;
|
|
27
|
+
}
|
|
28
|
+
(0, validate_settings_keys_1.validateSettingsKeys)(config, presetsSettings, presetsConfigPath);
|
|
29
|
+
// eslint-disable-next-line no-param-reassign
|
|
30
|
+
config = (0, lodash_merge_1.default)(config, presetsSettings);
|
|
31
|
+
}
|
|
32
|
+
if (presetsOverridesPath) {
|
|
33
|
+
context.overridesPath.unshift(presetsOverridesPath);
|
|
34
|
+
}
|
|
35
|
+
return config;
|
|
36
|
+
}
|
|
37
|
+
function getPresetsConfigPath(config, cwd) {
|
|
38
|
+
return (0, resolve_1.tryResolve)(`${config.presets}/arui-scripts.config`, {
|
|
39
|
+
paths: [cwd],
|
|
40
|
+
});
|
|
41
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateSettingsKeys = validateSettingsKeys;
|
|
4
|
+
/**
|
|
5
|
+
* Функция проверяет что все ключи объекта settingsObject есть в уже существующей конфигурации
|
|
6
|
+
*/
|
|
7
|
+
function validateSettingsKeys(existingConfig, settingsObject, source) {
|
|
8
|
+
Object.keys(settingsObject).forEach((setting) => {
|
|
9
|
+
if (typeof existingConfig[setting] === 'undefined') {
|
|
10
|
+
console.warn(`Неизвестная настройка "${setting}" в ${source || 'конфигурации'}`);
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.warnAboutDeprecations = warnAboutDeprecations;
|
|
4
|
+
function warnAboutDeprecations(config) {
|
|
5
|
+
if (!Array.isArray(config.proxy) && config.proxy) {
|
|
6
|
+
console.warn('Передача config.proxy как объекта больше не поддерживается. ', 'arui-scripts попробует привести конфигурацию к корректному виду, но это не всегда может работать корректно', 'Правильный формат конфигурации можно посмотреть в документации rspack: https://rspack.dev/guide/features/dev-server#proxy');
|
|
7
|
+
// eslint-disable-next-line no-param-reassign
|
|
8
|
+
config.proxy = convertObjectProxyConfigurationToArray(config.proxy);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
function convertObjectProxyConfigurationToArray(proxyConfiguration) {
|
|
12
|
+
const arrayProxy = [];
|
|
13
|
+
Object.keys(proxyConfiguration).forEach((context) => {
|
|
14
|
+
const itemConfig = proxyConfiguration[context];
|
|
15
|
+
arrayProxy.push(Object.assign({ context }, (typeof itemConfig === 'string' ? {
|
|
16
|
+
target: itemConfig,
|
|
17
|
+
} : itemConfig)));
|
|
18
|
+
});
|
|
19
|
+
return arrayProxy;
|
|
20
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
declare const babelClientConfig: {
|
|
2
|
+
presets: (string | false | (string | {
|
|
3
|
+
targets: string[];
|
|
4
|
+
loose: boolean;
|
|
5
|
+
useBuiltIns: string;
|
|
6
|
+
corejs: string;
|
|
7
|
+
exclude: string[];
|
|
8
|
+
})[])[];
|
|
9
|
+
plugins: (string | false | (string | {
|
|
10
|
+
legacy: boolean;
|
|
11
|
+
})[] | (string | {
|
|
12
|
+
loose: boolean;
|
|
13
|
+
})[] | (string | {
|
|
14
|
+
useBuiltIns: boolean;
|
|
15
|
+
})[] | (string | {
|
|
16
|
+
corejs: boolean;
|
|
17
|
+
helpers: boolean;
|
|
18
|
+
version: string;
|
|
19
|
+
regenerator: boolean;
|
|
20
|
+
})[])[];
|
|
21
|
+
env: {
|
|
22
|
+
production: {
|
|
23
|
+
plugins: (string | (string | {
|
|
24
|
+
removeImport: boolean;
|
|
25
|
+
})[])[];
|
|
26
|
+
};
|
|
27
|
+
test: {
|
|
28
|
+
plugins: string[];
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
export default babelClientConfig;
|
|
@@ -0,0 +1,72 @@
|
|
|
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
|
+
const apply_overrides_1 = __importDefault(require("./util/apply-overrides"));
|
|
7
|
+
const app_configs_1 = require("./app-configs");
|
|
8
|
+
const supporting_browsers_1 = __importDefault(require("./supporting-browsers"));
|
|
9
|
+
const babelClientConfig = (0, apply_overrides_1.default)(['babel', 'babelClient'], {
|
|
10
|
+
presets: [
|
|
11
|
+
[
|
|
12
|
+
require.resolve('@babel/preset-env'),
|
|
13
|
+
{
|
|
14
|
+
targets: supporting_browsers_1.default,
|
|
15
|
+
loose: true,
|
|
16
|
+
// Allow importing core-js in entrypoint and use browserlist to select polyfills
|
|
17
|
+
useBuiltIns: 'entry',
|
|
18
|
+
// Set the corejs version we are using to avoid warnings in console
|
|
19
|
+
corejs: '3.32',
|
|
20
|
+
// Exclude transforms that make all code slower
|
|
21
|
+
exclude: ['transform-typeof-symbol'],
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
app_configs_1.configs.tsconfig !== null &&
|
|
25
|
+
app_configs_1.configs.codeLoader !== 'tsc' &&
|
|
26
|
+
require.resolve('@babel/preset-typescript'),
|
|
27
|
+
require.resolve('@babel/preset-react'),
|
|
28
|
+
].filter(Boolean),
|
|
29
|
+
plugins: [
|
|
30
|
+
require.resolve('@babel/plugin-syntax-dynamic-import'),
|
|
31
|
+
require.resolve('@babel/plugin-transform-proto-to-assign'),
|
|
32
|
+
[require.resolve('@babel/plugin-proposal-decorators'), { legacy: true }],
|
|
33
|
+
[require.resolve('@babel/plugin-transform-class-properties'), { loose: true }],
|
|
34
|
+
[require.resolve('@babel/plugin-transform-private-methods'), { loose: true }],
|
|
35
|
+
[require.resolve('@babel/plugin-transform-private-property-in-object'), { loose: true }],
|
|
36
|
+
require.resolve('@babel/plugin-transform-numeric-separator'),
|
|
37
|
+
require.resolve('@babel/plugin-proposal-export-default-from'),
|
|
38
|
+
require.resolve('@babel/plugin-transform-export-namespace-from'),
|
|
39
|
+
[require.resolve('@babel/plugin-transform-object-rest-spread'), { useBuiltIns: true }],
|
|
40
|
+
[
|
|
41
|
+
require.resolve('@babel/plugin-transform-runtime'),
|
|
42
|
+
{
|
|
43
|
+
corejs: false,
|
|
44
|
+
helpers: true,
|
|
45
|
+
// By default, babel assumes babel/runtime version 7.0.0-beta.0,
|
|
46
|
+
// explicitly resolving to match the provided helper functions.
|
|
47
|
+
// https://github.com/babel/babel/issues/10261
|
|
48
|
+
version: app_configs_1.configs.babelRuntimeVersion,
|
|
49
|
+
regenerator: true,
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
require.resolve('@babel/plugin-transform-nullish-coalescing-operator'),
|
|
53
|
+
require.resolve('@babel/plugin-transform-optional-chaining'),
|
|
54
|
+
app_configs_1.configs.collectCoverage && require.resolve('babel-plugin-istanbul'),
|
|
55
|
+
].filter(Boolean),
|
|
56
|
+
env: {
|
|
57
|
+
production: {
|
|
58
|
+
plugins: [
|
|
59
|
+
require.resolve('@babel/plugin-transform-react-constant-elements'),
|
|
60
|
+
require.resolve('@babel/plugin-transform-react-inline-elements'),
|
|
61
|
+
[
|
|
62
|
+
require.resolve('babel-plugin-transform-react-remove-prop-types'),
|
|
63
|
+
{ removeImport: true },
|
|
64
|
+
],
|
|
65
|
+
],
|
|
66
|
+
},
|
|
67
|
+
test: {
|
|
68
|
+
plugins: [require.resolve('@babel/plugin-transform-modules-commonjs')],
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
exports.default = babelClientConfig;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const babelDependencies: {
|
|
2
|
+
sourceType: string;
|
|
3
|
+
presets: (string | {
|
|
4
|
+
useBuiltIns: string;
|
|
5
|
+
corejs: string;
|
|
6
|
+
exclude: string[];
|
|
7
|
+
})[][];
|
|
8
|
+
plugins: (string | {
|
|
9
|
+
corejs: boolean;
|
|
10
|
+
helpers: boolean;
|
|
11
|
+
version: string;
|
|
12
|
+
regenerator: boolean;
|
|
13
|
+
})[][];
|
|
14
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
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.babelDependencies = void 0;
|
|
7
|
+
const apply_overrides_1 = __importDefault(require("./util/apply-overrides"));
|
|
8
|
+
const app_configs_1 = __importDefault(require("./app-configs"));
|
|
9
|
+
exports.babelDependencies = (0, apply_overrides_1.default)('babelDependencies', {
|
|
10
|
+
sourceType: 'unambiguous',
|
|
11
|
+
presets: [
|
|
12
|
+
[
|
|
13
|
+
require.resolve('@babel/preset-env'),
|
|
14
|
+
{
|
|
15
|
+
// Allow importing core-js in entrypoint and use browserlist to select polyfills
|
|
16
|
+
useBuiltIns: 'entry',
|
|
17
|
+
// Set the corejs version we are using to avoid warnings in console
|
|
18
|
+
// This will need to change once we upgrade to corejs@3
|
|
19
|
+
corejs: '3.32',
|
|
20
|
+
// Exclude transforms that make all code slower
|
|
21
|
+
exclude: ['transform-typeof-symbol'],
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
],
|
|
25
|
+
plugins: [
|
|
26
|
+
[
|
|
27
|
+
require.resolve('@babel/plugin-transform-runtime'),
|
|
28
|
+
{
|
|
29
|
+
corejs: false,
|
|
30
|
+
helpers: true,
|
|
31
|
+
// By default, babel assumes babel/runtime version 7.0.0-beta.0,
|
|
32
|
+
// explicitly resolving to match the provided helper functions.
|
|
33
|
+
// https://github.com/babel/babel/issues/10261
|
|
34
|
+
version: app_configs_1.default.babelRuntimeVersion,
|
|
35
|
+
regenerator: true,
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
],
|
|
39
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
declare const config: {
|
|
2
|
+
presets: (string | false | (string | {
|
|
3
|
+
modules: boolean;
|
|
4
|
+
targets: {
|
|
5
|
+
node: string;
|
|
6
|
+
};
|
|
7
|
+
loose: boolean;
|
|
8
|
+
})[])[];
|
|
9
|
+
plugins: (string | false | (string | {
|
|
10
|
+
legacy: boolean;
|
|
11
|
+
})[] | (string | {
|
|
12
|
+
loose: boolean;
|
|
13
|
+
})[] | (string | {
|
|
14
|
+
useBuiltIns: boolean;
|
|
15
|
+
})[] | (string | {
|
|
16
|
+
helpers: boolean;
|
|
17
|
+
})[])[];
|
|
18
|
+
env: {
|
|
19
|
+
production: {
|
|
20
|
+
plugins: string[];
|
|
21
|
+
};
|
|
22
|
+
test: {
|
|
23
|
+
plugins: string[];
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export default config;
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
const apply_overrides_1 = __importDefault(require("./util/apply-overrides"));
|
|
7
|
+
const app_configs_1 = __importDefault(require("./app-configs"));
|
|
8
|
+
const config = (0, apply_overrides_1.default)(['babel', 'babelServer'], {
|
|
9
|
+
presets: [
|
|
10
|
+
[
|
|
11
|
+
require.resolve('@babel/preset-env'),
|
|
12
|
+
{ modules: false, targets: { node: 'current' }, loose: true },
|
|
13
|
+
],
|
|
14
|
+
app_configs_1.default.tsconfig !== null &&
|
|
15
|
+
app_configs_1.default.codeLoader !== 'tsc' &&
|
|
16
|
+
require.resolve('@babel/preset-typescript'),
|
|
17
|
+
require.resolve('@babel/preset-react'),
|
|
18
|
+
].filter(Boolean),
|
|
19
|
+
plugins: [
|
|
20
|
+
require.resolve('@babel/plugin-syntax-dynamic-import'),
|
|
21
|
+
require.resolve('@babel/plugin-transform-proto-to-assign'),
|
|
22
|
+
[require.resolve('@babel/plugin-proposal-decorators'), { legacy: true }],
|
|
23
|
+
[require.resolve('@babel/plugin-transform-class-properties'), { loose: true }],
|
|
24
|
+
[require.resolve('@babel/plugin-transform-private-methods'), { loose: true }],
|
|
25
|
+
[require.resolve('@babel/plugin-transform-private-property-in-object'), { loose: true }],
|
|
26
|
+
require.resolve('@babel/plugin-transform-numeric-separator'),
|
|
27
|
+
require.resolve('@babel/plugin-proposal-export-default-from'),
|
|
28
|
+
require.resolve('@babel/plugin-transform-export-namespace-from'),
|
|
29
|
+
[require.resolve('@babel/plugin-transform-object-rest-spread'), { useBuiltIns: true }],
|
|
30
|
+
[require.resolve('@babel/plugin-transform-runtime'), { helpers: false }],
|
|
31
|
+
require.resolve('@babel/plugin-transform-nullish-coalescing-operator'),
|
|
32
|
+
require.resolve('@babel/plugin-transform-optional-chaining'),
|
|
33
|
+
app_configs_1.default.collectCoverage && require.resolve('babel-plugin-istanbul'),
|
|
34
|
+
].filter(Boolean),
|
|
35
|
+
env: {
|
|
36
|
+
production: {
|
|
37
|
+
plugins: [
|
|
38
|
+
require.resolve('@babel/plugin-transform-react-constant-elements'),
|
|
39
|
+
require.resolve('@babel/plugin-transform-react-inline-elements'),
|
|
40
|
+
require.resolve('babel-plugin-transform-react-remove-prop-types'),
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
test: {
|
|
44
|
+
plugins: [require.resolve('@babel/plugin-transform-modules-commonjs')],
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
exports.default = config;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function addEnvToHtmlTemplate(html: string): string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addEnvToHtmlTemplate = addEnvToHtmlTemplate;
|
|
4
|
+
const get_env_config_1 = require("./get-env-config");
|
|
5
|
+
function addEnvToHtmlTemplate(html) {
|
|
6
|
+
return html.replace('<%= envConfig %>', (0, get_env_config_1.getEnvConfigContent)());
|
|
7
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ClientConfigPlugin = void 0;
|
|
4
|
+
const constants_1 = require("./constants");
|
|
5
|
+
const get_env_config_1 = require("./get-env-config");
|
|
6
|
+
class ClientConfigPlugin {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.cachedContent = null;
|
|
9
|
+
}
|
|
10
|
+
// eslint-disable-next-line class-methods-use-this
|
|
11
|
+
apply(compiler) {
|
|
12
|
+
const pluginName = ClientConfigPlugin.name;
|
|
13
|
+
const { webpack } = compiler;
|
|
14
|
+
compiler.hooks.thisCompilation.tap(pluginName, (compilation) => {
|
|
15
|
+
// Tapping to the assets processing pipeline on a specific stage.
|
|
16
|
+
compilation.hooks.processAssets.tap({
|
|
17
|
+
name: pluginName,
|
|
18
|
+
stage: webpack.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE,
|
|
19
|
+
}, () => {
|
|
20
|
+
const content = (0, get_env_config_1.getEnvConfigContent)();
|
|
21
|
+
compilation.emitAsset(`../${constants_1.ENV_CONFIG_FILENAME}`, new webpack.sources.RawSource(content));
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.ClientConfigPlugin = ClientConfigPlugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ENV_CONFIG_FILENAME = "env-config.json";
|
|
@@ -0,0 +1,28 @@
|
|
|
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.replaceTemplateVariables = replaceTemplateVariables;
|
|
7
|
+
exports.getEnvConfigContent = getEnvConfigContent;
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const app_configs_1 = require("../app-configs");
|
|
11
|
+
const constants_1 = require("./constants");
|
|
12
|
+
function replaceTemplateVariables(template, variables) {
|
|
13
|
+
return template.replace(/\$\{(\w+)}/g, (match, varName) => variables[varName] || '');
|
|
14
|
+
}
|
|
15
|
+
let cachedEnvConfig = null;
|
|
16
|
+
function getEnvConfigContent() {
|
|
17
|
+
if (cachedEnvConfig) {
|
|
18
|
+
return cachedEnvConfig;
|
|
19
|
+
}
|
|
20
|
+
const configTemplate = path_1.default.join(app_configs_1.configs.cwd, constants_1.ENV_CONFIG_FILENAME);
|
|
21
|
+
if (!fs_1.default.existsSync(configTemplate)) {
|
|
22
|
+
cachedEnvConfig = '{}';
|
|
23
|
+
return cachedEnvConfig;
|
|
24
|
+
}
|
|
25
|
+
const templateContent = fs_1.default.readFileSync(configTemplate, 'utf8');
|
|
26
|
+
cachedEnvConfig = replaceTemplateVariables(templateContent, process.env);
|
|
27
|
+
return cachedEnvConfig;
|
|
28
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addEnvToHtmlTemplate = exports.ClientConfigPlugin = exports.ENV_CONFIG_FILENAME = void 0;
|
|
4
|
+
var constants_1 = require("./constants");
|
|
5
|
+
Object.defineProperty(exports, "ENV_CONFIG_FILENAME", { enumerable: true, get: function () { return constants_1.ENV_CONFIG_FILENAME; } });
|
|
6
|
+
var client_config_plugin_1 = require("./client-config-plugin");
|
|
7
|
+
Object.defineProperty(exports, "ClientConfigPlugin", { enumerable: true, get: function () { return client_config_plugin_1.ClientConfigPlugin; } });
|
|
8
|
+
var add_env_to_html_template_1 = require("./add-env-to-html-template");
|
|
9
|
+
Object.defineProperty(exports, "addEnvToHtmlTemplate", { enumerable: true, get: function () { return add_env_to_html_template_1.addEnvToHtmlTemplate; } });
|