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,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 = __importDefault(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.default.modules) === null || _a === void 0 ? void 0 : _a.exposes) || {}).forEach((moduleName) => {
22
+ var _a, _b;
23
+ if ((_b = (_a = app_configs_1.default.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.default.publicPath, modules_1.MODULES_ENTRY_NAME),
29
+ };
30
+ });
31
+ const result = Object.assign(Object.assign({}, adjustedAssets), { __metadata__: {
32
+ version: app_configs_1.default.version,
33
+ name: app_configs_1.default.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.default.publicPath));
43
+ }
44
+ return assets.replace(/^auto\//, app_configs_1.default.publicPath);
45
+ }
@@ -0,0 +1 @@
1
+ export declare const serverExternalsExemptions: RegExp[];
@@ -0,0 +1,21 @@
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.serverExternalsExemptions = void 0;
7
+ const apply_overrides_1 = __importDefault(require("./util/apply-overrides"));
8
+ exports.serverExternalsExemptions = (0, apply_overrides_1.default)('serverExternalsExemptions', [
9
+ /^arui-feather/,
10
+ /^arui-ft-private/,
11
+ /^arui-private/,
12
+ /^alfaform-core-ui/,
13
+ /^@alfa-bank\/newclick-composite-components/,
14
+ /^#/,
15
+ /^@alfalab\/icons/,
16
+ /^@alfalab\/core-components/,
17
+ /^date-fns/,
18
+ /^@corp-front\//,
19
+ /^corp-sign-ui-react/,
20
+ /^@alfalab\/scripts-/,
21
+ ]);
@@ -0,0 +1,3 @@
1
+ import type { RspackOptionsNormalized } from '@rspack/core';
2
+ declare const statsOptions: RspackOptionsNormalized['stats'];
3
+ export default statsOptions;
@@ -0,0 +1,49 @@
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 statsOptions = (0, apply_overrides_1.default)('stats', {
8
+ // Add asset Information
9
+ assets: false,
10
+ // Add information about cached (not built) modules
11
+ cached: false,
12
+ // Show cached assets (setting this to `false` only shows emitted files)
13
+ cachedAssets: false,
14
+ // Add children information
15
+ children: false,
16
+ // Add chunk information (setting this to `false` allows for a less verbose output)
17
+ chunks: false,
18
+ // Add built modules information to chunk information
19
+ chunkModules: false,
20
+ // Add the origins of chunks and chunk merging info
21
+ chunkOrigins: false,
22
+ // `webpack --colors` equivalent
23
+ colors: true,
24
+ // Add errors
25
+ errors: true,
26
+ // Add details to errors (like resolving log)
27
+ errorDetails: true,
28
+ // Add the hash of the compilation
29
+ hash: false,
30
+ // Add built modules information
31
+ modules: true,
32
+ // Show dependencies and origin of warnings/errors (since webpack 2.5.0)
33
+ moduleTrace: true,
34
+ // Show performance hint when file size exceeds `performance.maxAssetSize`
35
+ performance: true,
36
+ // Add public path information
37
+ publicPath: false,
38
+ // Add information about the reasons why modules are included
39
+ reasons: false,
40
+ // Add timing information
41
+ timings: true,
42
+ // Add webpack version information
43
+ version: false,
44
+ // Add warnings
45
+ warnings: true,
46
+ // ignore warning from missing types
47
+ warningsFilter: /export .* was not found in/,
48
+ });
49
+ exports.default = statsOptions;
@@ -0,0 +1,2 @@
1
+ declare const supportingBrowsers: string[];
2
+ export default supportingBrowsers;
@@ -0,0 +1,8 @@
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 supportingBrowsers = (0, apply_overrides_1.default)(['browsers', 'supportingBrowsers'], ['last 2 versions', 'not dead', 'Android >= 6', 'iOS >= 14']);
8
+ exports.default = supportingBrowsers;
@@ -0,0 +1,4 @@
1
+ import type { Options } from '@swc/core';
2
+ export declare const swcClientConfig: Options;
3
+ export declare const swcServerConfig: Options;
4
+ export declare const swcJestConfig: Options;
@@ -0,0 +1,35 @@
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.swcJestConfig = exports.swcServerConfig = exports.swcClientConfig = void 0;
7
+ const apply_overrides_1 = __importDefault(require("./util/apply-overrides"));
8
+ const app_configs_1 = require("./app-configs");
9
+ const swcConfig = {
10
+ env: { coreJs: '3', mode: 'entry' },
11
+ jsc: {
12
+ parser: {
13
+ syntax: 'typescript',
14
+ tsx: true,
15
+ decorators: true,
16
+ },
17
+ loose: true,
18
+ transform: {
19
+ legacyDecorator: true,
20
+ react: {
21
+ runtime: 'automatic',
22
+ },
23
+ },
24
+ experimental: app_configs_1.configs.collectCoverage
25
+ ? {
26
+ plugins: [
27
+ ['swc-plugin-coverage-instrument', {}],
28
+ ],
29
+ }
30
+ : {},
31
+ },
32
+ };
33
+ exports.swcClientConfig = (0, apply_overrides_1.default)(['swc', 'swcClient'], swcConfig);
34
+ exports.swcServerConfig = (0, apply_overrides_1.default)(['swc', 'swcServer'], swcConfig);
35
+ exports.swcJestConfig = (0, apply_overrides_1.default)(['swc', 'swcJest'], swcConfig);
@@ -0,0 +1,76 @@
1
+ import type * as rspack from '@rspack/core';
2
+ import type { Options as SwcOptions } from '@swc/core';
3
+ import type { Configuration as WebpackDevServerConfiguration } from 'webpack-dev-server';
4
+ import { AppContextWithConfigs } from '../app-configs/types';
5
+ import { createSingleClientWebpackConfig } from '../webpack.client';
6
+ import { findLoader } from './find-loader';
7
+ import { findPlugin } 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: WebpackDevServerConfiguration;
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
+ Dockerfile: string;
32
+ DockerfileCompiled: string;
33
+ nginx: string;
34
+ nginxConf: string;
35
+ 'start.sh': string;
36
+ serverExternalsExemptions: Array<string | RegExp>;
37
+ html: string;
38
+ };
39
+ type OmitFirstArg<F> = F extends (x: any, ...args: infer P) => infer R ? (...args: P) => R : never;
40
+ type BoundCreateSingleClientWebpackConfig = OmitFirstArg<typeof createSingleClientWebpackConfig>;
41
+ type ClientWebpackAdditionalArgs = {
42
+ createSingleClientWebpackConfig: BoundCreateSingleClientWebpackConfig;
43
+ findLoader: typeof findLoader;
44
+ findPlugin: ReturnType<typeof findPlugin<'client'>>;
45
+ };
46
+ type ServerWebpackAdditionalArgs = {
47
+ findLoader: typeof findLoader;
48
+ findPlugin: ReturnType<typeof findPlugin<'server'>>;
49
+ };
50
+ /**
51
+ * Дополнительные аргументы, которые будут переданы в функцию оверрайда
52
+ */
53
+ type OverridesAdditionalArgs = {
54
+ webpack: ClientWebpackAdditionalArgs;
55
+ webpackClient: ClientWebpackAdditionalArgs;
56
+ webpackDev: ClientWebpackAdditionalArgs;
57
+ webpackClientDev: ClientWebpackAdditionalArgs;
58
+ webpackProd: ClientWebpackAdditionalArgs;
59
+ webpackClientProd: ClientWebpackAdditionalArgs;
60
+ webpackServer: ServerWebpackAdditionalArgs;
61
+ webpackServerDev: ServerWebpackAdditionalArgs;
62
+ webpackServerProd: ServerWebpackAdditionalArgs;
63
+ };
64
+ type OverrideFunction<K extends keyof Overrides, AdditionalArgs = K extends keyof OverridesAdditionalArgs ? OverridesAdditionalArgs[K] : undefined> = (config: Overrides[K], appConfig: AppContextWithConfigs, additionalArgs: AdditionalArgs) => Overrides[K];
65
+ export type OverrideFile = {
66
+ [K in keyof Overrides]?: OverrideFunction<K>;
67
+ };
68
+ /**
69
+ *
70
+ * @param {String|String[]} overridesKey Ключи оверрайда
71
+ * @param {Object} config Конфиг, к которому нужно применить оверрайды
72
+ * @param args Дополнительные аргументы, которые будут переданы в функцию оверрайда
73
+ * @returns {*}
74
+ */
75
+ 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;
76
+ export default applyOverrides;
@@ -0,0 +1,52 @@
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 app_configs_1 = __importDefault(require("../app-configs"));
7
+ let overrides = [];
8
+ overrides = app_configs_1.default.overridesPath.map((path) => {
9
+ try {
10
+ // eslint-disable-next-line import/no-dynamic-require, global-require, @typescript-eslint/no-var-requires
11
+ const requireResult = require(path);
12
+ // eslint-disable-next-line no-underscore-dangle
13
+ if (requireResult.__esModule) {
14
+ // ts-node импортирует esModules, из них надо вытягивать default именно так
15
+ return requireResult.default;
16
+ }
17
+ return requireResult;
18
+ }
19
+ catch (e) {
20
+ console.error(`Unable to process override file "${path}"`);
21
+ console.log(e);
22
+ return {};
23
+ }
24
+ });
25
+ /**
26
+ *
27
+ * @param {String|String[]} overridesKey Ключи оверрайда
28
+ * @param {Object} config Конфиг, к которому нужно применить оверрайды
29
+ * @param args Дополнительные аргументы, которые будут переданы в функцию оверрайда
30
+ * @returns {*}
31
+ */
32
+ function applyOverrides(overridesKey, config, args) {
33
+ if (typeof overridesKey === 'string') {
34
+ // eslint-disable-next-line no-param-reassign
35
+ overridesKey = [overridesKey];
36
+ }
37
+ overridesKey.forEach((key) => {
38
+ overrides.forEach((override) => {
39
+ // eslint-disable-next-line no-prototype-builtins
40
+ if (override.hasOwnProperty(key)) {
41
+ const overrideFn = override[key];
42
+ if (typeof overrideFn !== 'function') {
43
+ throw new TypeError(`Override ${key} must be a function`);
44
+ }
45
+ // eslint-disable-next-line no-param-reassign
46
+ config = overrideFn(config, app_configs_1.default, args);
47
+ }
48
+ });
49
+ });
50
+ return config;
51
+ }
52
+ exports.default = applyOverrides;
@@ -0,0 +1,2 @@
1
+ declare function checkNodeVersion(majorVersion: number): boolean;
2
+ export default checkNodeVersion;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function checkNodeVersion(majorVersion) {
4
+ const actualVersion = process.versions.node.split('.');
5
+ return parseInt(actualVersion[0], 10) >= majorVersion;
6
+ }
7
+ exports.default = checkNodeVersion;
@@ -0,0 +1,2 @@
1
+ import type { Configuration, RuleSetRule } from '@rspack/core';
2
+ export declare function findLoader(config: Configuration, testRule: string): RuleSetRule | undefined;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findLoader = findLoader;
4
+ function findLoader(config, testRule) {
5
+ var _a;
6
+ for (const rule of config.module.rules) {
7
+ if (rule === '...' || !rule) {
8
+ // Webpack имеет странный тип для rules, который позволяет в него положить строку '...'. Успокаиваем TS
9
+ // eslint-disable-next-line no-continue
10
+ continue;
11
+ }
12
+ if (rule.test && rule.test.toString() === testRule) {
13
+ return rule;
14
+ }
15
+ if (rule.oneOf) {
16
+ for (const oneOfRule of rule.oneOf) {
17
+ if (oneOfRule && oneOfRule.test && ((_a = oneOfRule === null || oneOfRule === void 0 ? void 0 : oneOfRule.test) === null || _a === void 0 ? void 0 : _a.toString()) === testRule) {
18
+ return oneOfRule;
19
+ }
20
+ }
21
+ }
22
+ }
23
+ return undefined;
24
+ }
@@ -0,0 +1,85 @@
1
+ import { Cluster } from 'cluster';
2
+ import { ReactRefreshPluginOptions } from '@pmmmwh/react-refresh-webpack-plugin/types/lib/types';
3
+ import { type CssExtractRspackPluginOptions, Configuration, DefinePlugin, NormalModuleReplacementPlugin } from '@rspack/core';
4
+ import { BannerPluginOptions } from '@rspack/core/dist/builtin-plugin/BannerPlugin';
5
+ import AssetsPlugin from 'assets-webpack-plugin';
6
+ import CaseSensitivePathsPlugin from 'case-sensitive-paths-webpack-plugin';
7
+ import CompressionPlugin from 'compression-webpack-plugin';
8
+ import { ForkTsCheckerWebpackPluginOptions } from 'fork-ts-checker-webpack-plugin/lib/ForkTsCheckerWebpackPluginOptions';
9
+ import MiniCssExtractPlugin from 'mini-css-extract-plugin';
10
+ import { RunScriptWebpackPlugin } from 'run-script-webpack-plugin';
11
+ import { WebpackDeduplicationPlugin } from 'webpack-deduplication-plugin';
12
+ import { WebpackManifestPlugin } from 'webpack-manifest-plugin';
13
+ type PluginsListClient = {
14
+ AssetsWebpackPlugin: {
15
+ options: AssetsPlugin.Options;
16
+ };
17
+ DefinePlugin: {
18
+ definitions: ConstructorParameters<typeof DefinePlugin>[number];
19
+ };
20
+ CssExtractRspackPlugin: {
21
+ options: CssExtractRspackPluginOptions;
22
+ };
23
+ MiniCssExtractPlugin: {
24
+ options: MiniCssExtractPlugin.PluginOptions;
25
+ runtimeOptions: MiniCssExtractPlugin.RuntimeOptions;
26
+ };
27
+ ForkTsCheckerWebpackPlugin: {
28
+ options: ForkTsCheckerWebpackPluginOptions;
29
+ };
30
+ IgnorePlugin: {
31
+ options: {
32
+ contextRegExp?: RegExp;
33
+ resourceRegExp: RegExp;
34
+ } | {
35
+ checkResource: (resource: string, context: string) => boolean;
36
+ };
37
+ };
38
+ WebpackDeduplicationPlugin: WebpackDeduplicationPlugin;
39
+ ReactRefreshPlugin: {
40
+ options: ReactRefreshPluginOptions;
41
+ };
42
+ CaseSensitivePathsPlugin: {
43
+ options: CaseSensitivePathsPlugin.Options;
44
+ logger: {
45
+ [K in keyof Console]: Console[K];
46
+ };
47
+ };
48
+ WebpackManifestPlugin: {
49
+ options: ConstructorParameters<typeof WebpackManifestPlugin>[number];
50
+ };
51
+ CompressionPlugin: {
52
+ options: ConstructorParameters<typeof CompressionPlugin>[number];
53
+ };
54
+ NormalModuleReplacementPlugin: NormalModuleReplacementPlugin;
55
+ };
56
+ type PluginsListServer = {
57
+ BannerPlugin: {
58
+ options: BannerPluginOptions;
59
+ };
60
+ RunScriptWebpackPlugin: {
61
+ options: ConstructorParameters<typeof RunScriptWebpackPlugin>[number];
62
+ };
63
+ ReloadServerPlugin: {
64
+ done: (...props: unknown[]) => unknown | null;
65
+ workers: Array<Cluster['Worker']>;
66
+ };
67
+ CaseSensitivePathsPlugin: {
68
+ options: CaseSensitivePathsPlugin.Options;
69
+ logger: {
70
+ [K in keyof Console]: Console[K];
71
+ };
72
+ };
73
+ WatchMissingNodeModulesPlugin: {
74
+ nodeModulesPath: string;
75
+ };
76
+ };
77
+ type SelectedPluginsList<Type extends 'client' | 'server'> = Type extends 'client' ? PluginsListClient : PluginsListServer;
78
+ /**
79
+ *
80
+ * @param config конфигурация webpack
81
+ * @param pluginName имя плагина
82
+ * @returns плагин или плагины, которые подошли под условие из testRule
83
+ */
84
+ export declare function findPlugin<Type extends 'client' | 'server'>(): <PluginName extends keyof SelectedPluginsList<Type>>(config: Configuration, pluginName: PluginName) => SelectedPluginsList<Type>[PluginName][];
85
+ export {};
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findPlugin = findPlugin;
4
+ /**
5
+ *
6
+ * @param config конфигурация webpack
7
+ * @param pluginName имя плагина
8
+ * @returns плагин или плагины, которые подошли под условие из testRule
9
+ */
10
+ function findPlugin() {
11
+ return (config, pluginName) => {
12
+ if (!config.plugins || !pluginName)
13
+ return [];
14
+ const result = [];
15
+ for (const plugin of config.plugins) {
16
+ if ((plugin === null || plugin === void 0 ? void 0 : plugin.constructor.name) === pluginName) {
17
+ result.push(plugin);
18
+ }
19
+ }
20
+ return result;
21
+ };
22
+ }
@@ -0,0 +1,9 @@
1
+ export type Entry = string | string[] | Record<string, string | string[]>;
2
+ /**
3
+ * @param {string|string[]|object} entryPoint Строка, массив строк или объект с энтрипоинтами
4
+ * @param {Function} getSingleEntry Функция, возвращающая конфигурацию для одного entryPoint
5
+ * @param args Дополнительные аргументы, которые будут переданы в getSingleEntry функцию
6
+ * @returns {*}
7
+ */
8
+ declare function getEntry<AdditionalArgs extends unknown[]>(entryPoint: Entry, getSingleEntry: (entry: string[], ...args: AdditionalArgs) => string[], ...args: AdditionalArgs): string[] | Record<string, string | string[]>;
9
+ export default getEntry;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ * @param {string|string[]|object} entryPoint Строка, массив строк или объект с энтрипоинтами
5
+ * @param {Function} getSingleEntry Функция, возвращающая конфигурацию для одного entryPoint
6
+ * @param args Дополнительные аргументы, которые будут переданы в getSingleEntry функцию
7
+ * @returns {*}
8
+ */
9
+ function getEntry(entryPoint, getSingleEntry, ...args) {
10
+ if (typeof entryPoint === 'string') {
11
+ return getSingleEntry([entryPoint], ...args);
12
+ }
13
+ if (Array.isArray(entryPoint)) {
14
+ return getSingleEntry(entryPoint, ...args);
15
+ }
16
+ // client entry also can be an object, so we must add hot loader to each entry point
17
+ return Object.keys(entryPoint).reduce((result, entryPointName) => {
18
+ const entry = getEntry(entryPoint[entryPointName], getSingleEntry, ...args);
19
+ return Object.assign(Object.assign({}, result), { [entryPointName]: entry });
20
+ }, {});
21
+ }
22
+ exports.default = getEntry;
@@ -0,0 +1,2 @@
1
+ import { AppConfigs } from '../app-configs/types';
2
+ export declare function getPolyfills(config: AppConfigs, requireResolve?: RequireResolve): string[];
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getPolyfills = getPolyfills;
4
+ // require.resolve вынесен как параметр функции для того, чтоб это можно было протестировать.
5
+ // на данный момент jest не дает возможности мокать require.resolve https://github.com/facebook/jest/issues/9543
6
+ function getPolyfills(config, requireResolve = require.resolve) {
7
+ const polyfills = [];
8
+ if (config.clientPolyfillsEntry && Array.isArray(config.clientPolyfillsEntry)) {
9
+ polyfills.push(...config.clientPolyfillsEntry);
10
+ }
11
+ else if (config.clientPolyfillsEntry) {
12
+ polyfills.push(config.clientPolyfillsEntry);
13
+ }
14
+ else {
15
+ // Для сохранения обратной совместимости нам надо добавлять полифилы из физера только тогда, когда пользователь
16
+ // не задал свои кастомные полифилы.
17
+ try {
18
+ const aruiPolyfills = requireResolve('arui-feather/polyfills');
19
+ polyfills.push(aruiPolyfills);
20
+ }
21
+ catch (error) {
22
+ // just ignore it
23
+ }
24
+ }
25
+ return polyfills;
26
+ }
@@ -0,0 +1 @@
1
+ export declare function getWebpackCacheDependencies(): Record<string, string[]>;
@@ -0,0 +1,18 @@
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.getWebpackCacheDependencies = getWebpackCacheDependencies;
7
+ const app_configs_1 = __importDefault(require("../app-configs"));
8
+ const read_config_file_1 = require("../app-configs/read-config-file");
9
+ const update_with_presets_1 = require("../app-configs/update-with-presets");
10
+ function getWebpackCacheDependencies() {
11
+ return {
12
+ overrides: app_configs_1.default.overridesPath,
13
+ appConfigs: [
14
+ (0, read_config_file_1.getConfigFilePath)(app_configs_1.default.cwd),
15
+ (0, update_with_presets_1.getPresetsConfigPath)(app_configs_1.default, app_configs_1.default.cwd),
16
+ ].filter(Boolean),
17
+ };
18
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ // TODO: remove eslint-disable or add override to .eslintrc.js
3
+ /* eslint-disable global-require */
4
+ /* eslint-disable import/no-extraneous-dependencies */
5
+ /* eslint-disable @typescript-eslint/no-var-requires */
6
+ try {
7
+ require('source-map-support').install();
8
+ }
9
+ catch (e) {
10
+ console.error('unable to install source map support. Please add `source-map-support` as a dependency.');
11
+ }
File without changes
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ // ignore attempts to require any types of assets
3
+ (() => {
4
+ // simply ignore css files, it wont cause any damage
5
+ const ignoreExtensions = ['.css'];
6
+ // warn about other requires, because it may lead to unexpected behaviour in production
7
+ const warnExtensions = [
8
+ '.gif',
9
+ '.jpeg',
10
+ '.jpg',
11
+ '.ico',
12
+ '.png',
13
+ '.xml',
14
+ '.svg',
15
+ '.mp4',
16
+ '.webm',
17
+ '.ogv',
18
+ '.aac',
19
+ '.mp3',
20
+ '.wav',
21
+ '.ogg',
22
+ ];
23
+ const noop = () => { };
24
+ const warn = (_, path) => console.warn(`\u001B[0;31mWARNING!
25
+ Trying to require ${path} in node.js.
26
+ Non-js files is ignored when required in node_modules\u001B[0m`);
27
+ ignoreExtensions.forEach((e) => {
28
+ require.extensions[e] = noop;
29
+ });
30
+ warnExtensions.forEach((e) => {
31
+ require.extensions[e] = warn;
32
+ });
33
+ })();
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ module.exports = {};
File without changes
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ // TODO: remove eslint-disable
3
+ /* eslint-disable @typescript-eslint/no-var-requires */
4
+ // Мы используем ts-node для работы c конфигами, описаными на ts
5
+ require('ts-node').register({
6
+ transpileOnly: true,
7
+ ignore: [],
8
+ compilerOptions: {
9
+ target: 'ES2016',
10
+ module: 'CommonJS',
11
+ skipLibCheck: true,
12
+ allowJs: false,
13
+ allowSyntheticDefaultImports: true,
14
+ moduleResolution: 'node',
15
+ esModuleInterop: true,
16
+ },
17
+ skipProject: true,
18
+ });
@@ -0,0 +1,12 @@
1
+ export declare function tryResolve(...args: Parameters<typeof require.resolve>): string | undefined;
2
+ /**
3
+ * Возвращает полный путь до модуля из node_modules относительно базового пути.
4
+ * Может быть полезно для определения пути до модуля, когда в проекте установлено сразу несколько модулей.
5
+ * /project
6
+ * --/node_modules
7
+ * ----/module1 // через эту функцию мы получим этот модуль
8
+ * ----/arui-scripts
9
+ * ------/node_modules
10
+ * --------/module1 // через require.resolve мы получим этот модуль
11
+ */
12
+ export declare function resolveNodeModuleRelativeTo(basePath: string, moduleName: string): string;