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.
Files changed (222) hide show
  1. package/.browserslistrc +5 -0
  2. package/.eslintignore +2 -0
  3. package/.eslintrc.js +17 -0
  4. package/.turbo/turbo-build.log +0 -0
  5. package/.turbo/turbo-test.log +23 -0
  6. package/CHANGELOG.md +1571 -0
  7. package/README.md +47 -0
  8. package/bin/build.sh +2 -0
  9. package/build/bin/index.d.ts +3 -0
  10. package/build/bin/index.js +29 -0
  11. package/build/commands/archive-build/index.d.ts +1 -0
  12. package/build/commands/archive-build/index.js +80 -0
  13. package/build/commands/build/build-wrapper.d.ts +8 -0
  14. package/build/commands/build/build-wrapper.js +42 -0
  15. package/build/commands/build/client.d.ts +1 -0
  16. package/build/commands/build/client.js +41 -0
  17. package/build/commands/build/index.d.ts +1 -0
  18. package/build/commands/build/index.js +15 -0
  19. package/build/commands/build/server.d.ts +1 -0
  20. package/build/commands/build/server.js +29 -0
  21. package/build/commands/bundle-analyze/index.d.ts +1 -0
  22. package/build/commands/bundle-analyze/index.js +40 -0
  23. package/build/commands/changelog/index.d.ts +5 -0
  24. package/build/commands/changelog/index.js +113 -0
  25. package/build/commands/docker-build/index.d.ts +1 -0
  26. package/build/commands/docker-build/index.js +73 -0
  27. package/build/commands/docker-build-compiled/index.d.ts +1 -0
  28. package/build/commands/docker-build-compiled/index.js +54 -0
  29. package/build/commands/ensure-yarn/index.d.ts +0 -0
  30. package/build/commands/ensure-yarn/index.js +8 -0
  31. package/build/commands/start/client.d.ts +1 -0
  32. package/build/commands/start/client.js +8 -0
  33. package/build/commands/start/index.d.ts +1 -0
  34. package/build/commands/start/index.js +17 -0
  35. package/build/commands/start/print-compiler-output.d.ts +1 -0
  36. package/build/commands/start/print-compiler-output.js +16 -0
  37. package/build/commands/start/server.d.ts +1 -0
  38. package/build/commands/start/server.js +8 -0
  39. package/build/commands/start-prod/client.d.ts +1 -0
  40. package/build/commands/start-prod/client.js +8 -0
  41. package/build/commands/start-prod/index.d.ts +1 -0
  42. package/build/commands/start-prod/index.js +17 -0
  43. package/build/commands/start-prod/server.d.ts +1 -0
  44. package/build/commands/start-prod/server.js +8 -0
  45. package/build/commands/test/get-config.d.ts +1 -0
  46. package/build/commands/test/get-config.js +104 -0
  47. package/build/commands/test/index.d.ts +1 -0
  48. package/build/commands/test/index.js +60 -0
  49. package/build/commands/util/client-assets-sizes.d.ts +26 -0
  50. package/build/commands/util/client-assets-sizes.js +82 -0
  51. package/build/commands/util/docker-build.d.ts +23 -0
  52. package/build/commands/util/docker-build.js +127 -0
  53. package/build/commands/util/exec.d.ts +2 -0
  54. package/build/commands/util/exec.js +20 -0
  55. package/build/commands/util/format-webpack-messages.d.ts +11 -0
  56. package/build/commands/util/format-webpack-messages.js +95 -0
  57. package/build/commands/util/make-tmp-dir.d.ts +6 -0
  58. package/build/commands/util/make-tmp-dir.js +29 -0
  59. package/build/commands/util/run-client-dev-server.d.ts +2 -0
  60. package/build/commands/util/run-client-dev-server.js +46 -0
  61. package/build/commands/util/run-compilers.d.ts +1 -0
  62. package/build/commands/util/run-compilers.js +37 -0
  63. package/build/commands/util/run-server-watch-compiler.d.ts +2 -0
  64. package/build/commands/util/run-server-watch-compiler.js +19 -0
  65. package/build/commands/util/tsc.d.ts +1 -0
  66. package/build/commands/util/tsc.js +13 -0
  67. package/build/commands/util/yarn.d.ts +5 -0
  68. package/build/commands/util/yarn.js +55 -0
  69. package/build/configs/app-configs/calculate-dependent-config.d.ts +9 -0
  70. package/build/configs/app-configs/calculate-dependent-config.js +38 -0
  71. package/build/configs/app-configs/get-defaults.d.ts +5 -0
  72. package/build/configs/app-configs/get-defaults.js +139 -0
  73. package/build/configs/app-configs/index.d.ts +6 -0
  74. package/build/configs/app-configs/index.js +24 -0
  75. package/build/configs/app-configs/read-config-file.d.ts +2 -0
  76. package/build/configs/app-configs/read-config-file.js +28 -0
  77. package/build/configs/app-configs/types.d.ts +126 -0
  78. package/build/configs/app-configs/types.js +2 -0
  79. package/build/configs/app-configs/update-with-config-file.d.ts +2 -0
  80. package/build/configs/app-configs/update-with-config-file.js +17 -0
  81. package/build/configs/app-configs/update-with-env.d.ts +2 -0
  82. package/build/configs/app-configs/update-with-env.js +23 -0
  83. package/build/configs/app-configs/update-with-package.d.ts +2 -0
  84. package/build/configs/app-configs/update-with-package.js +13 -0
  85. package/build/configs/app-configs/update-with-presets.d.ts +3 -0
  86. package/build/configs/app-configs/update-with-presets.js +41 -0
  87. package/build/configs/app-configs/validate-settings-keys.d.ts +4 -0
  88. package/build/configs/app-configs/validate-settings-keys.js +13 -0
  89. package/build/configs/app-configs/warn-about-deprecations.d.ts +2 -0
  90. package/build/configs/app-configs/warn-about-deprecations.js +20 -0
  91. package/build/configs/babel-client.d.ts +32 -0
  92. package/build/configs/babel-client.js +72 -0
  93. package/build/configs/babel-dependencies.d.ts +14 -0
  94. package/build/configs/babel-dependencies.js +39 -0
  95. package/build/configs/babel-server.d.ts +27 -0
  96. package/build/configs/babel-server.js +48 -0
  97. package/build/configs/client-env-config/add-env-to-html-template.d.ts +1 -0
  98. package/build/configs/client-env-config/add-env-to-html-template.js +7 -0
  99. package/build/configs/client-env-config/client-config-plugin.d.ts +5 -0
  100. package/build/configs/client-env-config/client-config-plugin.js +26 -0
  101. package/build/configs/client-env-config/constants.d.ts +1 -0
  102. package/build/configs/client-env-config/constants.js +4 -0
  103. package/build/configs/client-env-config/get-env-config.d.ts +2 -0
  104. package/build/configs/client-env-config/get-env-config.js +28 -0
  105. package/build/configs/client-env-config/index.d.ts +3 -0
  106. package/build/configs/client-env-config/index.js +9 -0
  107. package/build/configs/config-extras/minimizers/imagemin/imagemin.d.ts +28 -0
  108. package/build/configs/config-extras/minimizers/imagemin/imagemin.js +65 -0
  109. package/build/configs/config-extras/minimizers/imagemin/index.d.ts +1 -0
  110. package/build/configs/config-extras/minimizers/imagemin/index.js +17 -0
  111. package/build/configs/config-extras/minimizers/index.d.ts +1 -0
  112. package/build/configs/config-extras/minimizers/index.js +17 -0
  113. package/build/configs/dev-server.d.ts +2 -0
  114. package/build/configs/dev-server.js +73 -0
  115. package/build/configs/jest/babel-transform.d.ts +2 -0
  116. package/build/configs/jest/babel-transform.js +6 -0
  117. package/build/configs/jest/css-mock.d.ts +1 -0
  118. package/build/configs/jest/css-mock.js +2 -0
  119. package/build/configs/jest/file-transform.d.ts +3 -0
  120. package/build/configs/jest/file-transform.js +11 -0
  121. package/build/configs/jest/settings.d.ts +21 -0
  122. package/build/configs/jest/settings.js +58 -0
  123. package/build/configs/modules.d.ts +16 -0
  124. package/build/configs/modules.js +149 -0
  125. package/build/configs/mq.css +22 -0
  126. package/build/configs/postcss.config.d.ts +36 -0
  127. package/build/configs/postcss.config.js +71 -0
  128. package/build/configs/postcss.d.ts +2 -0
  129. package/build/configs/postcss.js +11 -0
  130. package/build/configs/process-assets-plugin-output.d.ts +2 -0
  131. package/build/configs/process-assets-plugin-output.js +45 -0
  132. package/build/configs/server-externals-exemptions.d.ts +1 -0
  133. package/build/configs/server-externals-exemptions.js +21 -0
  134. package/build/configs/stats-options.d.ts +3 -0
  135. package/build/configs/stats-options.js +49 -0
  136. package/build/configs/supporting-browsers.d.ts +2 -0
  137. package/build/configs/supporting-browsers.js +8 -0
  138. package/build/configs/swc.d.ts +4 -0
  139. package/build/configs/swc.js +35 -0
  140. package/build/configs/util/apply-overrides.d.ts +76 -0
  141. package/build/configs/util/apply-overrides.js +52 -0
  142. package/build/configs/util/check-node-version.d.ts +2 -0
  143. package/build/configs/util/check-node-version.js +7 -0
  144. package/build/configs/util/find-loader.d.ts +2 -0
  145. package/build/configs/util/find-loader.js +24 -0
  146. package/build/configs/util/find-plugin.d.ts +85 -0
  147. package/build/configs/util/find-plugin.js +22 -0
  148. package/build/configs/util/get-entry.d.ts +9 -0
  149. package/build/configs/util/get-entry.js +22 -0
  150. package/build/configs/util/get-polyfills.d.ts +2 -0
  151. package/build/configs/util/get-polyfills.js +26 -0
  152. package/build/configs/util/get-webpack-cache-dependencies.d.ts +1 -0
  153. package/build/configs/util/get-webpack-cache-dependencies.js +18 -0
  154. package/build/configs/util/install-sourcemap-support.d.ts +1 -0
  155. package/build/configs/util/install-sourcemap-support.js +11 -0
  156. package/build/configs/util/node-assets-ignore.d.ts +0 -0
  157. package/build/configs/util/node-assets-ignore.js +33 -0
  158. package/build/configs/util/noop.d.ts +1 -0
  159. package/build/configs/util/noop.js +2 -0
  160. package/build/configs/util/register-ts-node.d.ts +0 -0
  161. package/build/configs/util/register-ts-node.js +18 -0
  162. package/build/configs/util/resolve.d.ts +12 -0
  163. package/build/configs/util/resolve.js +29 -0
  164. package/build/configs/webpack.client.d.ts +10 -0
  165. package/build/configs/webpack.client.dev.d.ts +2 -0
  166. package/build/configs/webpack.client.dev.js +15 -0
  167. package/build/configs/webpack.client.js +475 -0
  168. package/build/configs/webpack.client.prod.d.ts +2 -0
  169. package/build/configs/webpack.client.prod.js +15 -0
  170. package/build/configs/webpack.server.d.ts +2 -0
  171. package/build/configs/webpack.server.dev.d.ts +2 -0
  172. package/build/configs/webpack.server.dev.js +11 -0
  173. package/build/configs/webpack.server.js +256 -0
  174. package/build/configs/webpack.server.prod.d.ts +2 -0
  175. package/build/configs/webpack.server.prod.js +11 -0
  176. package/build/index.d.ts +5 -0
  177. package/build/index.js +9 -0
  178. package/build/plugins/arui-runtime/arui-runtime-module.d.ts +7 -0
  179. package/build/plugins/arui-runtime/arui-runtime-module.js +20 -0
  180. package/build/plugins/arui-runtime/index.d.ts +11 -0
  181. package/build/plugins/arui-runtime/index.js +47 -0
  182. package/build/plugins/postcss-global-variables/postcss-global-variables.d.ts +6 -0
  183. package/build/plugins/postcss-global-variables/postcss-global-variables.js +38 -0
  184. package/build/plugins/postcss-global-variables/utils/utils.d.ts +7 -0
  185. package/build/plugins/postcss-global-variables/utils/utils.js +91 -0
  186. package/build/plugins/postcss-prefix-selector.d.ts +6 -0
  187. package/build/plugins/postcss-prefix-selector.js +62 -0
  188. package/build/plugins/reload-server-plugin.d.ts +10 -0
  189. package/build/plugins/reload-server-plugin.js +44 -0
  190. package/build/plugins/turn-off-split-remote-entry.d.ts +11 -0
  191. package/build/plugins/turn-off-split-remote-entry.js +71 -0
  192. package/build/plugins/watch-missing-node-modules-plugin.d.ts +6 -0
  193. package/build/plugins/watch-missing-node-modules-plugin.js +20 -0
  194. package/build/templates/base-nginx.conf.template.d.ts +2 -0
  195. package/build/templates/base-nginx.conf.template.js +61 -0
  196. package/build/templates/dockerfile-compiled.template.d.ts +2 -0
  197. package/build/templates/dockerfile-compiled.template.js +52 -0
  198. package/build/templates/dockerfile.template.d.ts +2 -0
  199. package/build/templates/dockerfile.template.js +41 -0
  200. package/build/templates/html.template.d.ts +1 -0
  201. package/build/templates/html.template.js +25 -0
  202. package/build/templates/nginx.conf.template.d.ts +2 -0
  203. package/build/templates/nginx.conf.template.js +39 -0
  204. package/build/templates/start.template.d.ts +2 -0
  205. package/build/templates/start.template.js +69 -0
  206. package/build/tsconfig-local.tsbuildinfo +1 -0
  207. package/docs/artifact.md +58 -0
  208. package/docs/caveats.md +41 -0
  209. package/docs/client-only.md +77 -0
  210. package/docs/commands.md +125 -0
  211. package/docs/compilers.md +18 -0
  212. package/docs/examples.md +100 -0
  213. package/docs/modules.md +780 -0
  214. package/docs/overrides.md +167 -0
  215. package/docs/presets.md +65 -0
  216. package/docs/settings.md +287 -0
  217. package/jest-preset.js +5 -0
  218. package/package.json +180 -0
  219. package/stylelint.config.js +11 -0
  220. package/tsconfig-local.json +16 -0
  221. package/tsconfig.eslint.json +5 -0
  222. 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,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ import { AppConfigs, AppContext } from './types';
2
+ export declare function updateWithConfigFile(config: AppConfigs, context: AppContext): any;
@@ -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,2 @@
1
+ import { AppConfigs } from './types';
2
+ export declare function updateWithEnv(config: AppConfigs): any;
@@ -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,2 @@
1
+ import { AppConfigs, AppContext } from './types';
2
+ export declare function updateWithPackage(config: AppConfigs, context: AppContext): any;
@@ -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,3 @@
1
+ import { AppConfigs, AppContext } from './types';
2
+ export declare function updateWithPresets(config: AppConfigs, context: AppContext): AppConfigs;
3
+ export declare function getPresetsConfigPath(config: AppConfigs, cwd: string): string | undefined;
@@ -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,4 @@
1
+ /**
2
+ * Функция проверяет что все ключи объекта settingsObject есть в уже существующей конфигурации
3
+ */
4
+ export declare function validateSettingsKeys(existingConfig: Record<string, unknown>, settingsObject: Record<string, unknown>, source?: string): void;
@@ -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,2 @@
1
+ import { AppContextWithConfigs } from './types';
2
+ export declare function warnAboutDeprecations(config: AppContextWithConfigs): void;
@@ -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,5 @@
1
+ import { Compiler } from '@rspack/core';
2
+ export declare class ClientConfigPlugin {
3
+ protected cachedContent: string | null;
4
+ apply(compiler: Compiler): void;
5
+ }
@@ -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,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ENV_CONFIG_FILENAME = void 0;
4
+ exports.ENV_CONFIG_FILENAME = 'env-config.json';
@@ -0,0 +1,2 @@
1
+ export declare function replaceTemplateVariables(template: string, variables: Record<string, string | undefined>): string;
2
+ export declare function getEnvConfigContent(): string;
@@ -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,3 @@
1
+ export { ENV_CONFIG_FILENAME } from './constants';
2
+ export { ClientConfigPlugin } from './client-config-plugin';
3
+ export { addEnvToHtmlTemplate } from './add-env-to-html-template';
@@ -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; } });