arui-scripts 0.0.0-beta-20260824133302

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (247) hide show
  1. package/.eslintignore +2 -0
  2. package/.eslintrc.js +17 -0
  3. package/.prettierignore +2 -0
  4. package/.turbo/turbo-build.log +0 -0
  5. package/.turbo/turbo-test.log +23 -0
  6. package/CHANGELOG.md +1976 -0
  7. package/README.md +59 -0
  8. package/bin/build.sh +2 -0
  9. package/build/bin/index.d.ts +2 -0
  10. package/build/bin/index.js +26 -0
  11. package/build/commands/archive-build/index.d.ts +1 -0
  12. package/build/commands/archive-build/index.js +15 -0
  13. package/build/commands/build/build-wrapper.d.ts +8 -0
  14. package/build/commands/build/build-wrapper.js +40 -0
  15. package/build/commands/build/client.d.ts +1 -0
  16. package/build/commands/build/client.js +54 -0
  17. package/build/commands/build/index.d.ts +1 -0
  18. package/build/commands/build/index.js +11 -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 +62 -0
  23. package/build/commands/changelog/index.d.ts +5 -0
  24. package/build/commands/changelog/index.js +141 -0
  25. package/build/commands/docker-build/index.d.ts +1 -0
  26. package/build/commands/docker-build/index.js +15 -0
  27. package/build/commands/docker-build-compiled/index.d.ts +1 -0
  28. package/build/commands/docker-build-compiled/index.js +15 -0
  29. package/build/commands/ensure-yarn/index.d.ts +1 -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 +7 -0
  33. package/build/commands/start/index.d.ts +1 -0
  34. package/build/commands/start/index.js +13 -0
  35. package/build/commands/start/print-compiler-output.d.ts +2 -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 +7 -0
  39. package/build/commands/start-prod/client.d.ts +1 -0
  40. package/build/commands/start-prod/client.js +7 -0
  41. package/build/commands/start-prod/index.d.ts +1 -0
  42. package/build/commands/start-prod/index.js +13 -0
  43. package/build/commands/start-prod/server.d.ts +1 -0
  44. package/build/commands/start-prod/server.js +7 -0
  45. package/build/commands/test/get-config.d.ts +1 -0
  46. package/build/commands/test/get-config.js +83 -0
  47. package/build/commands/test/index.d.ts +1 -0
  48. package/build/commands/test/index.js +68 -0
  49. package/build/commands/test-vitest/index.d.ts +1 -0
  50. package/build/commands/test-vitest/index.js +15 -0
  51. package/build/commands/util/artifacts-config.d.ts +25 -0
  52. package/build/commands/util/artifacts-config.js +119 -0
  53. package/build/commands/util/artifacts-deprecations.d.ts +9 -0
  54. package/build/commands/util/artifacts-deprecations.js +65 -0
  55. package/build/commands/util/arui-scripts-artifacts.d.ts +16 -0
  56. package/build/commands/util/arui-scripts-artifacts.js +29 -0
  57. package/build/commands/util/client-assets-sizes.d.ts +2 -0
  58. package/build/commands/util/client-assets-sizes.js +71 -0
  59. package/build/commands/util/docker-build.d.ts +35 -0
  60. package/build/commands/util/docker-build.js +76 -0
  61. package/build/commands/util/exec.d.ts +1 -0
  62. package/build/commands/util/exec.js +6 -0
  63. package/build/commands/util/format-webpack-messages.d.ts +5 -0
  64. package/build/commands/util/format-webpack-messages.js +95 -0
  65. package/build/commands/util/get-local-ident.d.ts +6 -0
  66. package/build/commands/util/get-local-ident.js +29 -0
  67. package/build/commands/util/load-browserslist.d.ts +1 -0
  68. package/build/commands/util/load-browserslist.js +15 -0
  69. package/build/commands/util/make-tmp-dir.d.ts +5 -0
  70. package/build/commands/util/make-tmp-dir.js +29 -0
  71. package/build/commands/util/print-build-error.d.ts +1 -0
  72. package/build/commands/util/print-build-error.js +32 -0
  73. package/build/commands/util/run-artifacts-cli.d.ts +7 -0
  74. package/build/commands/util/run-artifacts-cli.js +60 -0
  75. package/build/commands/util/run-client-dev-server.d.ts +2 -0
  76. package/build/commands/util/run-client-dev-server.js +47 -0
  77. package/build/commands/util/run-compilers.d.ts +1 -0
  78. package/build/commands/util/run-compilers.js +37 -0
  79. package/build/commands/util/run-server-watch-compiler.d.ts +2 -0
  80. package/build/commands/util/run-server-watch-compiler.js +17 -0
  81. package/build/commands/util/run-vitest.d.ts +7 -0
  82. package/build/commands/util/run-vitest.js +41 -0
  83. package/build/commands/util/tsc.d.ts +1 -0
  84. package/build/commands/util/tsc.js +13 -0
  85. package/build/commands/util/yarn.d.ts +10 -0
  86. package/build/commands/util/yarn.js +25 -0
  87. package/build/configs/app-configs/calculate-dependent-config.d.ts +9 -0
  88. package/build/configs/app-configs/calculate-dependent-config.js +55 -0
  89. package/build/configs/app-configs/get-defaults.d.ts +5 -0
  90. package/build/configs/app-configs/get-defaults.js +151 -0
  91. package/build/configs/app-configs/index.d.ts +5 -0
  92. package/build/configs/app-configs/index.js +25 -0
  93. package/build/configs/app-configs/read-config-file.d.ts +2 -0
  94. package/build/configs/app-configs/read-config-file.js +28 -0
  95. package/build/configs/app-configs/types.d.ts +146 -0
  96. package/build/configs/app-configs/types.js +2 -0
  97. package/build/configs/app-configs/update-with-config-file.d.ts +2 -0
  98. package/build/configs/app-configs/update-with-config-file.js +17 -0
  99. package/build/configs/app-configs/update-with-env.d.ts +2 -0
  100. package/build/configs/app-configs/update-with-env.js +23 -0
  101. package/build/configs/app-configs/update-with-package.d.ts +2 -0
  102. package/build/configs/app-configs/update-with-package.js +13 -0
  103. package/build/configs/app-configs/update-with-presets.d.ts +3 -0
  104. package/build/configs/app-configs/update-with-presets.js +41 -0
  105. package/build/configs/app-configs/validate-config.d.ts +2 -0
  106. package/build/configs/app-configs/validate-config.js +8 -0
  107. package/build/configs/app-configs/validate-settings-keys.d.ts +7 -0
  108. package/build/configs/app-configs/validate-settings-keys.js +16 -0
  109. package/build/configs/app-configs/warn-about-deprecations.d.ts +2 -0
  110. package/build/configs/app-configs/warn-about-deprecations.js +22 -0
  111. package/build/configs/babel-client.d.ts +31 -0
  112. package/build/configs/babel-client.js +69 -0
  113. package/build/configs/babel-dependencies.d.ts +14 -0
  114. package/build/configs/babel-dependencies.js +36 -0
  115. package/build/configs/babel-server.d.ts +26 -0
  116. package/build/configs/babel-server.js +45 -0
  117. package/build/configs/client-env-config/add-env-to-html-template.d.ts +1 -0
  118. package/build/configs/client-env-config/add-env-to-html-template.js +7 -0
  119. package/build/configs/client-env-config/client-config-plugin.d.ts +5 -0
  120. package/build/configs/client-env-config/client-config-plugin.js +26 -0
  121. package/build/configs/client-env-config/constants.d.ts +1 -0
  122. package/build/configs/client-env-config/constants.js +4 -0
  123. package/build/configs/client-env-config/get-env-config.d.ts +2 -0
  124. package/build/configs/client-env-config/get-env-config.js +28 -0
  125. package/build/configs/client-env-config/index.d.ts +3 -0
  126. package/build/configs/client-env-config/index.js +9 -0
  127. package/build/configs/config-extras/minimizers/imagemin/imagemin.d.ts +28 -0
  128. package/build/configs/config-extras/minimizers/imagemin/imagemin.js +65 -0
  129. package/build/configs/config-extras/minimizers/imagemin/index.d.ts +1 -0
  130. package/build/configs/config-extras/minimizers/imagemin/index.js +17 -0
  131. package/build/configs/config-extras/minimizers/index.d.ts +1 -0
  132. package/build/configs/config-extras/minimizers/index.js +17 -0
  133. package/build/configs/dev-server.d.ts +2 -0
  134. package/build/configs/dev-server.js +78 -0
  135. package/build/configs/jest/babel-transform.d.ts +2 -0
  136. package/build/configs/jest/babel-transform.js +6 -0
  137. package/build/configs/jest/css-mock.d.ts +1 -0
  138. package/build/configs/jest/css-mock.js +2 -0
  139. package/build/configs/jest/file-transform.d.ts +3 -0
  140. package/build/configs/jest/file-transform.js +11 -0
  141. package/build/configs/jest/settings.d.ts +21 -0
  142. package/build/configs/jest/settings.js +58 -0
  143. package/build/configs/modules.d.ts +17 -0
  144. package/build/configs/modules.js +181 -0
  145. package/build/configs/mq.css +22 -0
  146. package/build/configs/postcss.config.d.ts +35 -0
  147. package/build/configs/postcss.config.js +65 -0
  148. package/build/configs/postcss.d.ts +6 -0
  149. package/build/configs/postcss.js +21 -0
  150. package/build/configs/process-assets-plugin-output.d.ts +2 -0
  151. package/build/configs/process-assets-plugin-output.js +45 -0
  152. package/build/configs/server-externals-exemptions.d.ts +1 -0
  153. package/build/configs/server-externals-exemptions.js +18 -0
  154. package/build/configs/stats-options.d.ts +2 -0
  155. package/build/configs/stats-options.js +46 -0
  156. package/build/configs/supporting-browsers.d.ts +1 -0
  157. package/build/configs/supporting-browsers.js +5 -0
  158. package/build/configs/supporting-node.d.ts +1 -0
  159. package/build/configs/supporting-node.js +5 -0
  160. package/build/configs/swc.d.ts +4 -0
  161. package/build/configs/swc.js +30 -0
  162. package/build/configs/util/apply-overrides.d.ts +87 -0
  163. package/build/configs/util/apply-overrides.js +56 -0
  164. package/build/configs/util/check-node-version.d.ts +1 -0
  165. package/build/configs/util/check-node-version.js +7 -0
  166. package/build/configs/util/compress-with-dcb.d.ts +2 -0
  167. package/build/configs/util/compress-with-dcb.js +28 -0
  168. package/build/configs/util/compression-plugins-for-dictionaries.d.ts +2 -0
  169. package/build/configs/util/compression-plugins-for-dictionaries.js +78 -0
  170. package/build/configs/util/create-watch-ignore-regex.d.ts +1 -0
  171. package/build/configs/util/create-watch-ignore-regex.js +16 -0
  172. package/build/configs/util/dcb-compression-plugin.d.ts +21 -0
  173. package/build/configs/util/dcb-compression-plugin.js +130 -0
  174. package/build/configs/util/find-loader.d.ts +2 -0
  175. package/build/configs/util/find-loader.js +24 -0
  176. package/build/configs/util/find-plugin.d.ts +78 -0
  177. package/build/configs/util/find-plugin.js +21 -0
  178. package/build/configs/util/get-entry.d.ts +8 -0
  179. package/build/configs/util/get-entry.js +22 -0
  180. package/build/configs/util/get-polyfills.d.ts +2 -0
  181. package/build/configs/util/get-polyfills.js +13 -0
  182. package/build/configs/util/get-webpack-cache-dependencies.d.ts +1 -0
  183. package/build/configs/util/get-webpack-cache-dependencies.js +15 -0
  184. package/build/configs/util/install-sourcemap-support.d.ts +1 -0
  185. package/build/configs/util/install-sourcemap-support.js +10 -0
  186. package/build/configs/util/node-assets-ignore.d.ts +1 -0
  187. package/build/configs/util/node-assets-ignore.js +34 -0
  188. package/build/configs/util/noop.d.ts +1 -0
  189. package/build/configs/util/noop.js +2 -0
  190. package/build/configs/util/register-ts-node.d.ts +1 -0
  191. package/build/configs/util/register-ts-node.js +18 -0
  192. package/build/configs/util/resolve.d.ts +14 -0
  193. package/build/configs/util/resolve.js +29 -0
  194. package/build/configs/vitest/config.d.ts +2 -0
  195. package/build/configs/vitest/config.js +5 -0
  196. package/build/configs/vitest/settings.d.ts +30 -0
  197. package/build/configs/vitest/settings.js +77 -0
  198. package/build/configs/webpack.client.d.ts +10 -0
  199. package/build/configs/webpack.client.dev.d.ts +1 -0
  200. package/build/configs/webpack.client.dev.js +12 -0
  201. package/build/configs/webpack.client.js +508 -0
  202. package/build/configs/webpack.client.prod.d.ts +1 -0
  203. package/build/configs/webpack.client.prod.js +12 -0
  204. package/build/configs/webpack.server.d.ts +2 -0
  205. package/build/configs/webpack.server.dev.d.ts +1 -0
  206. package/build/configs/webpack.server.dev.js +8 -0
  207. package/build/configs/webpack.server.js +283 -0
  208. package/build/configs/webpack.server.prod.d.ts +1 -0
  209. package/build/configs/webpack.server.prod.js +8 -0
  210. package/build/index.d.ts +19 -0
  211. package/build/index.js +35 -0
  212. package/build/plugins/arui-runtime/arui-runtime-module.d.ts +7 -0
  213. package/build/plugins/arui-runtime/arui-runtime-module.js +20 -0
  214. package/build/plugins/arui-runtime/index.d.ts +11 -0
  215. package/build/plugins/arui-runtime/index.js +47 -0
  216. package/build/plugins/postcss-global-variables/postcss-global-variables.d.ts +6 -0
  217. package/build/plugins/postcss-global-variables/postcss-global-variables.js +38 -0
  218. package/build/plugins/postcss-global-variables/utils/utils.d.ts +7 -0
  219. package/build/plugins/postcss-global-variables/utils/utils.js +91 -0
  220. package/build/plugins/postcss-prefix-selector.d.ts +6 -0
  221. package/build/plugins/postcss-prefix-selector.js +65 -0
  222. package/build/plugins/reload-server-plugin.d.ts +10 -0
  223. package/build/plugins/reload-server-plugin.js +46 -0
  224. package/build/plugins/turn-off-split-remote-entry.d.ts +11 -0
  225. package/build/plugins/turn-off-split-remote-entry.js +71 -0
  226. package/build/plugins/watch-missing-node-modules-plugin.d.ts +6 -0
  227. package/build/plugins/watch-missing-node-modules-plugin.js +20 -0
  228. package/build/templates/html.template.d.ts +1 -0
  229. package/build/templates/html.template.js +22 -0
  230. package/docs/artifact.md +62 -0
  231. package/docs/caveats.md +41 -0
  232. package/docs/client-only.md +77 -0
  233. package/docs/commands.md +159 -0
  234. package/docs/compilers.md +18 -0
  235. package/docs/compression-dictionary.md +130 -0
  236. package/docs/examples.md +100 -0
  237. package/docs/modules.md +834 -0
  238. package/docs/overrides.md +175 -0
  239. package/docs/presets.md +65 -0
  240. package/docs/settings.md +336 -0
  241. package/jest-preset.js +5 -0
  242. package/package.json +215 -0
  243. package/stylelint.config.js +11 -0
  244. package/tsconfig-local.json +17 -0
  245. package/tsconfig-local.tsbuildinfo +1 -0
  246. package/tsconfig.eslint.json +5 -0
  247. package/tsconfig.json +29 -0
@@ -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,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.babelDependencies = void 0;
4
+ const apply_overrides_1 = require("./util/apply-overrides");
5
+ const app_configs_1 = require("./app-configs");
6
+ exports.babelDependencies = (0, apply_overrides_1.applyOverrides)('babelDependencies', {
7
+ sourceType: 'unambiguous',
8
+ presets: [
9
+ [
10
+ require.resolve('@babel/preset-env'),
11
+ {
12
+ // Allow importing core-js in entrypoint and use browserlist to select polyfills
13
+ useBuiltIns: 'entry',
14
+ // Set the corejs version we are using to avoid warnings in console
15
+ // This will need to change once we upgrade to corejs@3
16
+ corejs: '3.32',
17
+ // Exclude transforms that make all code slower
18
+ exclude: ['transform-typeof-symbol'],
19
+ },
20
+ ],
21
+ ],
22
+ plugins: [
23
+ [
24
+ require.resolve('@babel/plugin-transform-runtime'),
25
+ {
26
+ corejs: false,
27
+ helpers: true,
28
+ // By default, babel assumes babel/runtime version 7.0.0-beta.0,
29
+ // explicitly resolving to match the provided helper functions.
30
+ // https://github.com/babel/babel/issues/10261
31
+ version: app_configs_1.configs.babelRuntimeVersion,
32
+ regenerator: true,
33
+ },
34
+ ],
35
+ ],
36
+ });
@@ -0,0 +1,26 @@
1
+ export 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
+ };
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.config = void 0;
4
+ const apply_overrides_1 = require("./util/apply-overrides");
5
+ const app_configs_1 = require("./app-configs");
6
+ exports.config = (0, apply_overrides_1.applyOverrides)(['babel', 'babelServer'], {
7
+ presets: [
8
+ [
9
+ require.resolve('@babel/preset-env'),
10
+ { modules: false, targets: { node: 'current' }, loose: true },
11
+ ],
12
+ app_configs_1.configs.tsconfig !== null &&
13
+ app_configs_1.configs.codeLoader !== 'tsc' &&
14
+ require.resolve('@babel/preset-typescript'),
15
+ require.resolve('@babel/preset-react'),
16
+ ].filter(Boolean),
17
+ plugins: [
18
+ require.resolve('@babel/plugin-syntax-dynamic-import'),
19
+ require.resolve('@babel/plugin-transform-proto-to-assign'),
20
+ [require.resolve('@babel/plugin-proposal-decorators'), { legacy: true }],
21
+ [require.resolve('@babel/plugin-transform-class-properties'), { loose: true }],
22
+ [require.resolve('@babel/plugin-transform-private-methods'), { loose: true }],
23
+ [require.resolve('@babel/plugin-transform-private-property-in-object'), { loose: true }],
24
+ require.resolve('@babel/plugin-transform-numeric-separator'),
25
+ require.resolve('@babel/plugin-proposal-export-default-from'),
26
+ require.resolve('@babel/plugin-transform-export-namespace-from'),
27
+ [require.resolve('@babel/plugin-transform-object-rest-spread'), { useBuiltIns: true }],
28
+ [require.resolve('@babel/plugin-transform-runtime'), { helpers: false }],
29
+ require.resolve('@babel/plugin-transform-nullish-coalescing-operator'),
30
+ require.resolve('@babel/plugin-transform-optional-chaining'),
31
+ app_configs_1.configs.collectCoverage && require.resolve('babel-plugin-istanbul'),
32
+ ].filter(Boolean),
33
+ env: {
34
+ production: {
35
+ plugins: [
36
+ require.resolve('@babel/plugin-transform-react-constant-elements'),
37
+ require.resolve('@babel/plugin-transform-react-inline-elements'),
38
+ require.resolve('babel-plugin-transform-react-remove-prop-types'),
39
+ ],
40
+ },
41
+ test: {
42
+ plugins: [require.resolve('@babel/plugin-transform-modules-commonjs')],
43
+ },
44
+ },
45
+ });
@@ -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 { type 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; } });
@@ -0,0 +1,28 @@
1
+ import ImageMinimizerPlugin from 'image-minimizer-webpack-plugin';
2
+ export declare function getImageMinLoader(): false | {
3
+ test: RegExp;
4
+ type: string;
5
+ use: {
6
+ loader: string;
7
+ options: {
8
+ minimizer: {
9
+ implementation: typeof ImageMinimizerPlugin.imageminMinify;
10
+ options: {
11
+ plugins: (false | (string | {
12
+ quality: number;
13
+ progressive: boolean;
14
+ })[] | (string | {
15
+ optimizationLevel: number | undefined;
16
+ bitDepthReduction: boolean | undefined;
17
+ colorTypeReduction: boolean | undefined;
18
+ paletteReduction: boolean | undefined;
19
+ interlaced: boolean | undefined;
20
+ })[] | (string | {
21
+ optimizationLevel: number | undefined;
22
+ interlaced: boolean;
23
+ })[] | undefined)[];
24
+ };
25
+ };
26
+ };
27
+ }[];
28
+ };
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getImageMinLoader = getImageMinLoader;
7
+ const image_minimizer_webpack_plugin_1 = __importDefault(require("image-minimizer-webpack-plugin"));
8
+ const app_configs_1 = require("../../../app-configs");
9
+ function getImageMinLoader() {
10
+ var _a;
11
+ const { svg, gif, jpg, png } = (_a = app_configs_1.configs.imageMinimizer) !== null && _a !== void 0 ? _a : {};
12
+ const doesAnyMinificationEnabled = (svg === null || svg === void 0 ? void 0 : svg.enabled) || (gif === null || gif === void 0 ? void 0 : gif.enabled) || (jpg === null || jpg === void 0 ? void 0 : jpg.enabled) || (png === null || png === void 0 ? void 0 : png.enabled);
13
+ if (!doesAnyMinificationEnabled) {
14
+ return false;
15
+ }
16
+ const loaderExtensions = [
17
+ (svg === null || svg === void 0 ? void 0 : svg.enabled) && 'svg',
18
+ (gif === null || gif === void 0 ? void 0 : gif.enabled) && 'gif',
19
+ (jpg === null || jpg === void 0 ? void 0 : jpg.enabled) && 'jpe?g',
20
+ (png === null || png === void 0 ? void 0 : png.enabled) && 'png',
21
+ ].filter(Boolean);
22
+ return {
23
+ test: new RegExp(`\\.(${loaderExtensions.join('|')})$`),
24
+ type: 'assets',
25
+ use: [
26
+ {
27
+ loader: image_minimizer_webpack_plugin_1.default.loader,
28
+ options: {
29
+ minimizer: {
30
+ implementation: image_minimizer_webpack_plugin_1.default.imageminMinify,
31
+ options: {
32
+ plugins: [
33
+ (jpg === null || jpg === void 0 ? void 0 : jpg.enabled) && [
34
+ 'mozjpeg',
35
+ {
36
+ quality: jpg === null || jpg === void 0 ? void 0 : jpg.quality,
37
+ progressive: true,
38
+ },
39
+ ],
40
+ (png === null || png === void 0 ? void 0 : png.enabled) && [
41
+ 'optipng',
42
+ {
43
+ optimizationLevel: png === null || png === void 0 ? void 0 : png.optimizationLevel,
44
+ bitDepthReduction: png === null || png === void 0 ? void 0 : png.bitDepthReduction,
45
+ colorTypeReduction: png === null || png === void 0 ? void 0 : png.colorTypeReduction,
46
+ paletteReduction: png === null || png === void 0 ? void 0 : png.paletteReduction,
47
+ interlaced: png === null || png === void 0 ? void 0 : png.interlaced,
48
+ },
49
+ ],
50
+ (svg === null || svg === void 0 ? void 0 : svg.enabled) && ['svgo'],
51
+ (gif === null || gif === void 0 ? void 0 : gif.enabled) && [
52
+ 'gifsicle',
53
+ {
54
+ optimizationLevel: gif === null || gif === void 0 ? void 0 : gif.optimizationLevel,
55
+ interlaced: true,
56
+ },
57
+ ],
58
+ ].filter(Boolean),
59
+ },
60
+ },
61
+ },
62
+ },
63
+ ],
64
+ };
65
+ }
@@ -0,0 +1 @@
1
+ export * from './imagemin';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./imagemin"), exports);
@@ -0,0 +1 @@
1
+ export * from './imagemin';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./imagemin"), exports);
@@ -0,0 +1,2 @@
1
+ import { type Configuration } from '@rspack/dev-server';
2
+ export declare const devServerConfig: Configuration;
@@ -0,0 +1,78 @@
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.devServerConfig = void 0;
7
+ const path_1 = __importDefault(require("path"));
8
+ const apply_overrides_1 = require("./util/apply-overrides");
9
+ const app_configs_1 = require("./app-configs");
10
+ const client_env_config_1 = require("./client-env-config");
11
+ function getServerToClientProxyConfig() {
12
+ const assetsRoot = path_1.default.normalize(`/${app_configs_1.configs.publicPath}`).replace(/\\/g, '/');
13
+ return Object.assign({ target: `http://127.0.0.1:${app_configs_1.configs.serverPort}`,
14
+ // В @rspack/dev-server v2 (http-proxy-middleware) опции bypass нет. Аналог pathFilter
15
+ // на бэкенд уходят только запросы, чей path не относится к клиентской статике (префикс publicPath).
16
+ pathFilter: (pathname) => !pathname.startsWith(assetsRoot) }, ((app_configs_1.configs.devSourceMaps && app_configs_1.configs.devSourceMaps.includes('eval')) ||
17
+ app_configs_1.configs.devServerCors
18
+ ? {
19
+ on: {
20
+ proxyRes: (proxyRes, req) => {
21
+ // Для дев режима, когда мы используем в качестве соурсмапов что-то, основанное на eval - нужно
22
+ // разрешить браузеру исполнять наш код, даже когда content-security-policy приложения не позволяет этого делать.
23
+ if (app_configs_1.configs.devSourceMaps && app_configs_1.configs.devSourceMaps.includes('eval')) {
24
+ const cspHeader = proxyRes.headers['content-security-policy'];
25
+ if (typeof cspHeader === 'string' &&
26
+ !cspHeader.includes('unsafe-eval')) {
27
+ // eslint-disable-next-line no-param-reassign
28
+ proxyRes.headers['content-security-policy'] = cspHeader.replace(/script-src/, "script-src 'unsafe-eval'");
29
+ }
30
+ }
31
+ // если включен devServerCors, то нужно принудительно менять статус ответа на 200, чтобы
32
+ // браузер не отклонял ответы с CORS
33
+ if (app_configs_1.configs.devServerCors && req.method === 'OPTIONS') {
34
+ // eslint-disable-next-line no-param-reassign
35
+ proxyRes.statusCode = 200;
36
+ }
37
+ },
38
+ },
39
+ }
40
+ : {}));
41
+ }
42
+ exports.devServerConfig = (0, apply_overrides_1.applyOverrides)('devServer', {
43
+ port: app_configs_1.configs.clientServerPort,
44
+ liveReload: false,
45
+ historyApiFallback: app_configs_1.configs.clientOnly,
46
+ client: {
47
+ overlay: {
48
+ errors: true,
49
+ warnings: false,
50
+ },
51
+ },
52
+ devMiddleware: {
53
+ publicPath: `/${app_configs_1.configs.publicPath}`,
54
+ // dev-сервер не может корректно обработать файлы, которые лежат на уровень выше чем publicPath, а html,
55
+ // создаваемый для client-only режима как раз такой. Так же работает и env-config.json
56
+ writeToDisk: (filename) => filename.endsWith('.html') || filename.endsWith(client_env_config_1.ENV_CONFIG_FILENAME),
57
+ },
58
+ static: [app_configs_1.configs.serverOutputPath, app_configs_1.configs.clientOutputPath],
59
+ proxy: getProxyConfig(),
60
+ headers: app_configs_1.configs.devServerCors
61
+ ? {
62
+ 'Access-Control-Allow-Origin': '*',
63
+ 'Access-Control-Allow-Headers': '*',
64
+ 'Access-Control-Allow-Methods': '*',
65
+ }
66
+ : {},
67
+ });
68
+ function getProxyConfig() {
69
+ const proxyConfig = [];
70
+ const userProxyConfig = app_configs_1.configs.proxy;
71
+ if (!app_configs_1.configs.clientOnly) {
72
+ proxyConfig.push(getServerToClientProxyConfig());
73
+ }
74
+ if (Array.isArray(userProxyConfig)) {
75
+ proxyConfig.unshift(...userProxyConfig);
76
+ }
77
+ return proxyConfig;
78
+ }
@@ -0,0 +1,2 @@
1
+ declare const _exports: import("@jest/transform").SyncTransformer<import("@babel/core").TransformOptions>;
2
+ export = _exports;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ // TODO: remove eslint-disable-next-line
3
+ /* eslint-disable @typescript-eslint/no-var-requires */
4
+ const babelJest = require('babel-jest');
5
+ const babelPresets = require('../babel-server');
6
+ module.exports = babelJest.createTransformer(babelPresets.config);
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ module.exports = {};
@@ -0,0 +1,3 @@
1
+ export function process(src: any, filename: any): {
2
+ code: string;
3
+ };
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ // TODO: remove eslint-disable-next-line
3
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
4
+ const path = require('path');
5
+ // This is a custom Jest transformer turning file imports into filenames.
6
+ // http://facebook.github.io/jest/docs/en/webpack.html
7
+ module.exports = {
8
+ process(src, filename) {
9
+ return { code: `module.exports = ${JSON.stringify(path.basename(filename))};` };
10
+ },
11
+ };
@@ -0,0 +1,21 @@
1
+ export let testRegex: string;
2
+ export let moduleFileExtensions: string[];
3
+ export let collectCoverageFrom: string[];
4
+ export namespace testEnvironmentOptions {
5
+ let url: string;
6
+ }
7
+ export let transform: {
8
+ '^.+\\.jsx?$': string | (string | import("@swc/types").Options)[];
9
+ '^.+\\.mjs$': string | (string | import("@swc/types").Options)[];
10
+ '^.+\\.tsx?$': string | (string | import("@swc/types").Options)[];
11
+ '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': string;
12
+ };
13
+ export let moduleNameMapper: {
14
+ '\\.css$': string;
15
+ };
16
+ export let snapshotSerializers: string[];
17
+ export let globals: {
18
+ 'ts-jest': {
19
+ tsconfig: string | null;
20
+ };
21
+ };
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ /* eslint-disable @typescript-eslint/no-var-requires */
3
+ // Мы используем эти настройки сразу в двух местах - в jest-presets и в настройках jest-а, которые мы загружаем в самих скриптах
4
+ // jest-presets могут использоваться внешними утилитами, которые используют разработчики, настройки в скриптах
5
+ // используются при запуске `arui-scripts test`. Посколько в jest жестко зафиксировано где именно должен лежать файл с пресетами
6
+ // нам приходится отвязывать его от основного кода скриптов
7
+ const fs = require('fs');
8
+ const { pathsToModuleNameMapper } = require('ts-jest');
9
+ const { parseConfigFileTextToJson } = require('typescript');
10
+ const { swcJestConfig } = require('../swc');
11
+ const { configs } = require('../app-configs');
12
+ module.exports = {
13
+ testRegex: 'src/.*(((/__test__/|/__tests__/).*)|(test|spec|tests)).(jsx?|tsx?)$',
14
+ moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
15
+ collectCoverageFrom: ['src/**/*.{js,jsx,ts,tsx}'],
16
+ testEnvironmentOptions: {
17
+ url: 'http://localhost',
18
+ },
19
+ transform: {
20
+ '^.+\\.jsx?$': getJsTransformer(),
21
+ '^.+\\.mjs$': getJsTransformer(),
22
+ '^.+\\.tsx?$': getTsTransformer(),
23
+ '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': require.resolve('./file-transform'),
24
+ },
25
+ moduleNameMapper: Object.assign({
26
+ // replace all css files with simple empty exports
27
+ '\\.css$': require.resolve('./css-mock') }, pathsToModuleNameMapper(getPathMapping(), { prefix: '<rootDir>/' })),
28
+ snapshotSerializers: [require.resolve('jest-snapshot-serializer-class-name-to-string')],
29
+ globals: {
30
+ 'ts-jest': {
31
+ tsconfig: configs.tsconfig,
32
+ },
33
+ },
34
+ };
35
+ function getPathMapping() {
36
+ var _a;
37
+ if (!configs.tsconfig) {
38
+ return {};
39
+ }
40
+ const tsConfigText = fs.readFileSync(configs.tsconfig, 'utf8');
41
+ const tsConfig = parseConfigFileTextToJson(configs.tsconfig, tsConfigText);
42
+ return ((_a = tsConfig.config.compilerOptions) === null || _a === void 0 ? void 0 : _a.paths) || {};
43
+ }
44
+ function getTsTransformer() {
45
+ if (configs.jestCodeTransformer === 'tsc') {
46
+ return require.resolve('ts-jest');
47
+ }
48
+ if (configs.jestCodeTransformer === 'swc') {
49
+ return [require.resolve('@swc/jest'), swcJestConfig];
50
+ }
51
+ return require.resolve('./babel-transform');
52
+ }
53
+ function getJsTransformer() {
54
+ if (configs.jestCodeTransformer === 'swc') {
55
+ return [require.resolve('@swc/jest'), swcJestConfig];
56
+ }
57
+ return require.resolve('./babel-transform');
58
+ }
@@ -0,0 +1,17 @@
1
+ import * as rspack from '@rspack/core';
2
+ import { type CompatModuleConfig } from './app-configs/types';
3
+ export declare function haveExposedDefaultModules(): Record<string, string> | undefined;
4
+ export declare const MODULES_ENTRY_NAME = "remoteEntry.js";
5
+ export declare const MODULES_SEPARATE_BUILD_NAME = "wmf";
6
+ export declare function patchMainWebpackConfigForModules(webpackConf: rspack.Configuration, mode: 'consumer' | 'provider' | 'both'): rspack.RspackOptions;
7
+ export declare function getCssPrefixForModule(module: CompatModuleConfig): string | undefined;
8
+ export declare function getExposeLoadersFormCompatModules(): {
9
+ test: string;
10
+ use: {
11
+ loader: string;
12
+ options: {
13
+ exposes: string[];
14
+ };
15
+ }[];
16
+ }[];
17
+ export declare function patchWebpackConfigForCompat(module: CompatModuleConfig, webpackConf: rspack.Configuration): rspack.RspackOptions;