arui-scripts 0.0.0-next-20230725145300

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 (170) hide show
  1. package/.browserslistrc +5 -0
  2. package/.turbo/turbo-build.log +0 -0
  3. package/.turbo/turbo-test.log +91 -0
  4. package/CHANGELOG.md +1032 -0
  5. package/README.md +716 -0
  6. package/bin/build.sh +2 -0
  7. package/build/bin/index.d.ts +3 -0
  8. package/build/bin/index.js +21 -0
  9. package/build/commands/archive-build/index.d.ts +1 -0
  10. package/build/commands/archive-build/index.js +80 -0
  11. package/build/commands/build/build-wrapper.d.ts +8 -0
  12. package/build/commands/build/build-wrapper.js +41 -0
  13. package/build/commands/build/client.d.ts +1 -0
  14. package/build/commands/build/client.js +41 -0
  15. package/build/commands/build/index.d.ts +1 -0
  16. package/build/commands/build/index.js +10 -0
  17. package/build/commands/build/server.d.ts +1 -0
  18. package/build/commands/build/server.js +29 -0
  19. package/build/commands/bundle-analyze/index.d.ts +1 -0
  20. package/build/commands/bundle-analyze/index.js +36 -0
  21. package/build/commands/changelog/index.d.ts +5 -0
  22. package/build/commands/changelog/index.js +116 -0
  23. package/build/commands/docker-build/index.d.ts +1 -0
  24. package/build/commands/docker-build/index.js +70 -0
  25. package/build/commands/docker-build-compiled/index.d.ts +1 -0
  26. package/build/commands/docker-build-compiled/index.js +52 -0
  27. package/build/commands/ensure-yarn/index.d.ts +0 -0
  28. package/build/commands/ensure-yarn/index.js +8 -0
  29. package/build/commands/start/client.d.ts +1 -0
  30. package/build/commands/start/client.js +8 -0
  31. package/build/commands/start/index.d.ts +1 -0
  32. package/build/commands/start/index.js +8 -0
  33. package/build/commands/start/print-compiler-output.d.ts +1 -0
  34. package/build/commands/start/print-compiler-output.js +15 -0
  35. package/build/commands/start/server.d.ts +1 -0
  36. package/build/commands/start/server.js +8 -0
  37. package/build/commands/start-prod/client.d.ts +1 -0
  38. package/build/commands/start-prod/client.js +8 -0
  39. package/build/commands/start-prod/index.d.ts +1 -0
  40. package/build/commands/start-prod/index.js +8 -0
  41. package/build/commands/start-prod/server.d.ts +1 -0
  42. package/build/commands/start-prod/server.js +8 -0
  43. package/build/commands/test/index.d.ts +3 -0
  44. package/build/commands/test/index.js +17 -0
  45. package/build/commands/util/check-required-files.d.ts +2 -0
  46. package/build/commands/util/check-required-files.js +67 -0
  47. package/build/commands/util/client-assets-sizes.d.ts +26 -0
  48. package/build/commands/util/client-assets-sizes.js +88 -0
  49. package/build/commands/util/docker-build.d.ts +21 -0
  50. package/build/commands/util/docker-build.js +89 -0
  51. package/build/commands/util/exec.d.ts +2 -0
  52. package/build/commands/util/exec.js +18 -0
  53. package/build/commands/util/format-webpack-messages.d.ts +11 -0
  54. package/build/commands/util/format-webpack-messages.js +93 -0
  55. package/build/commands/util/make-tmp-dir.d.ts +6 -0
  56. package/build/commands/util/make-tmp-dir.js +29 -0
  57. package/build/commands/util/run-client-dev-server.d.ts +2 -0
  58. package/build/commands/util/run-client-dev-server.js +47 -0
  59. package/build/commands/util/run-compilers.d.ts +1 -0
  60. package/build/commands/util/run-compilers.js +31 -0
  61. package/build/commands/util/run-server-watch-compiler.d.ts +2 -0
  62. package/build/commands/util/run-server-watch-compiler.js +21 -0
  63. package/build/commands/util/yarn.d.ts +5 -0
  64. package/build/commands/util/yarn.js +53 -0
  65. package/build/configs/app-configs/calculate-dependent-config.d.ts +76 -0
  66. package/build/configs/app-configs/calculate-dependent-config.js +37 -0
  67. package/build/configs/app-configs/get-defaults.d.ts +3 -0
  68. package/build/configs/app-configs/get-defaults.js +127 -0
  69. package/build/configs/app-configs/index.d.ts +6 -0
  70. package/build/configs/app-configs/index.js +22 -0
  71. package/build/configs/app-configs/types.d.ts +108 -0
  72. package/build/configs/app-configs/types.js +2 -0
  73. package/build/configs/app-configs/update-with-config-file.d.ts +2 -0
  74. package/build/configs/app-configs/update-with-config-file.js +23 -0
  75. package/build/configs/app-configs/update-with-env.d.ts +2 -0
  76. package/build/configs/app-configs/update-with-env.js +20 -0
  77. package/build/configs/app-configs/update-with-package.d.ts +2 -0
  78. package/build/configs/app-configs/update-with-package.js +10 -0
  79. package/build/configs/app-configs/update-with-presets.d.ts +2 -0
  80. package/build/configs/app-configs/update-with-presets.js +26 -0
  81. package/build/configs/app-configs/validate-settings-keys.d.ts +4 -0
  82. package/build/configs/app-configs/validate-settings-keys.js +14 -0
  83. package/build/configs/babel-client.d.ts +34 -0
  84. package/build/configs/babel-client.js +65 -0
  85. package/build/configs/babel-dependencies.d.ts +14 -0
  86. package/build/configs/babel-dependencies.js +39 -0
  87. package/build/configs/babel-server.d.ts +27 -0
  88. package/build/configs/babel-server.js +47 -0
  89. package/build/configs/config-extras/minimizers/imagemin/imagemin.d.ts +2 -0
  90. package/build/configs/config-extras/minimizers/imagemin/imagemin.js +42 -0
  91. package/build/configs/config-extras/minimizers/imagemin/index.d.ts +1 -0
  92. package/build/configs/config-extras/minimizers/imagemin/index.js +17 -0
  93. package/build/configs/config-extras/minimizers/index.d.ts +1 -0
  94. package/build/configs/config-extras/minimizers/index.js +17 -0
  95. package/build/configs/dev-server.d.ts +2 -0
  96. package/build/configs/dev-server.js +48 -0
  97. package/build/configs/jest/babel-transform.d.ts +2 -0
  98. package/build/configs/jest/babel-transform.js +4 -0
  99. package/build/configs/jest/css-mock.d.ts +1 -0
  100. package/build/configs/jest/css-mock.js +2 -0
  101. package/build/configs/jest/file-transform.d.ts +3 -0
  102. package/build/configs/jest/file-transform.js +9 -0
  103. package/build/configs/jest/index.d.ts +50 -0
  104. package/build/configs/jest/index.js +47 -0
  105. package/build/configs/modules.d.ts +16 -0
  106. package/build/configs/modules.js +101 -0
  107. package/build/configs/mq.css +22 -0
  108. package/build/configs/postcss.config.d.ts +25 -0
  109. package/build/configs/postcss.config.js +62 -0
  110. package/build/configs/postcss.d.ts +2 -0
  111. package/build/configs/postcss.js +9 -0
  112. package/build/configs/process-assets-plugin-output.d.ts +2 -0
  113. package/build/configs/process-assets-plugin-output.js +46 -0
  114. package/build/configs/server-externals-exemptions.d.ts +1 -0
  115. package/build/configs/server-externals-exemptions.js +21 -0
  116. package/build/configs/stats-options.d.ts +3 -0
  117. package/build/configs/stats-options.js +49 -0
  118. package/build/configs/supporting-browsers.d.ts +2 -0
  119. package/build/configs/supporting-browsers.js +13 -0
  120. package/build/configs/util/apply-overrides.d.ts +56 -0
  121. package/build/configs/util/apply-overrides.js +47 -0
  122. package/build/configs/util/check-node-version.d.ts +2 -0
  123. package/build/configs/util/check-node-version.js +7 -0
  124. package/build/configs/util/find-loader.d.ts +2 -0
  125. package/build/configs/util/find-loader.js +23 -0
  126. package/build/configs/util/get-entry.d.ts +9 -0
  127. package/build/configs/util/get-entry.js +22 -0
  128. package/build/configs/util/get-polyfills.d.ts +3 -0
  129. package/build/configs/util/get-polyfills.js +27 -0
  130. package/build/configs/util/install-sourcemap-support.d.ts +1 -0
  131. package/build/configs/util/install-sourcemap-support.js +7 -0
  132. package/build/configs/util/node-assets-ignore.d.ts +0 -0
  133. package/build/configs/util/node-assets-ignore.js +31 -0
  134. package/build/configs/util/noop.d.ts +1 -0
  135. package/build/configs/util/noop.js +2 -0
  136. package/build/configs/util/register-ts-node.d.ts +0 -0
  137. package/build/configs/util/register-ts-node.js +17 -0
  138. package/build/configs/util/resolve.d.ts +12 -0
  139. package/build/configs/util/resolve.js +30 -0
  140. package/build/configs/webpack.client.d.ts +10 -0
  141. package/build/configs/webpack.client.dev.d.ts +2 -0
  142. package/build/configs/webpack.client.dev.js +9 -0
  143. package/build/configs/webpack.client.js +402 -0
  144. package/build/configs/webpack.client.prod.d.ts +2 -0
  145. package/build/configs/webpack.client.prod.js +9 -0
  146. package/build/configs/webpack.server.d.ts +2 -0
  147. package/build/configs/webpack.server.dev.d.ts +2 -0
  148. package/build/configs/webpack.server.dev.js +9 -0
  149. package/build/configs/webpack.server.js +229 -0
  150. package/build/configs/webpack.server.prod.d.ts +2 -0
  151. package/build/configs/webpack.server.prod.js +9 -0
  152. package/build/index.d.ts +5 -0
  153. package/build/index.js +9 -0
  154. package/build/plugins/reload-server-webpack-plugin.d.ts +9 -0
  155. package/build/plugins/reload-server-webpack-plugin.js +42 -0
  156. package/build/templates/dockerfile-compiled.template.d.ts +2 -0
  157. package/build/templates/dockerfile-compiled.template.js +47 -0
  158. package/build/templates/dockerfile.template.d.ts +2 -0
  159. package/build/templates/dockerfile.template.js +32 -0
  160. package/build/templates/nginx.conf.template.d.ts +2 -0
  161. package/build/templates/nginx.conf.template.js +34 -0
  162. package/build/templates/start.template.d.ts +2 -0
  163. package/build/templates/start.template.js +37 -0
  164. package/build/tsconfig-local.tsbuildinfo +1 -0
  165. package/docs/modules.md +572 -0
  166. package/jest-preset.js +22 -0
  167. package/package.json +172 -0
  168. package/release.config.js +21 -0
  169. package/tsconfig-local.json +16 -0
  170. package/tsconfig.json +71 -0
@@ -0,0 +1,14 @@
1
+ export declare const babelDependencies: {
2
+ sourceType: string;
3
+ presets: (string | {
4
+ useBuiltIns: string;
5
+ corejs: number;
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,
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 | (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,47 @@
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 && !app_configs_1.default.useTscLoader) && 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-proposal-class-properties'), { loose: true }],
22
+ [require.resolve('@babel/plugin-proposal-private-methods'), { loose: true }],
23
+ [require.resolve('@babel/plugin-proposal-private-property-in-object'), { loose: true }],
24
+ require.resolve('@babel/plugin-proposal-numeric-separator'),
25
+ require.resolve('@babel/plugin-proposal-export-default-from'),
26
+ require.resolve('@babel/plugin-proposal-export-namespace-from'),
27
+ [require.resolve('@babel/plugin-proposal-object-rest-spread'), { useBuiltIns: true }],
28
+ [require.resolve('@babel/plugin-transform-runtime'), { helpers: false }],
29
+ require.resolve('@babel/plugin-proposal-nullish-coalescing-operator'),
30
+ require.resolve('@babel/plugin-proposal-optional-chaining')
31
+ ],
32
+ env: {
33
+ production: {
34
+ plugins: [
35
+ require.resolve('@babel/plugin-transform-react-constant-elements'),
36
+ require.resolve('@babel/plugin-transform-react-inline-elements'),
37
+ require.resolve('babel-plugin-transform-react-remove-prop-types')
38
+ ]
39
+ },
40
+ test: {
41
+ plugins: [
42
+ require.resolve('@babel/plugin-transform-modules-commonjs')
43
+ ]
44
+ }
45
+ }
46
+ });
47
+ exports.default = config;
@@ -0,0 +1,2 @@
1
+ import ImageMinimizerPlugin from "image-minimizer-webpack-plugin";
2
+ export declare const getImageMin: () => (false | ImageMinimizerPlugin<unknown, unknown> | undefined)[];
@@ -0,0 +1,42 @@
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.getImageMin = void 0;
7
+ const image_minimizer_webpack_plugin_1 = __importDefault(require("image-minimizer-webpack-plugin"));
8
+ const app_configs_1 = __importDefault(require("../../../app-configs"));
9
+ const getImageMin = () => {
10
+ var _a;
11
+ const { svg, gif, jpg, png } = (_a = app_configs_1.default.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
+ return [
14
+ doesAnyMinificationEnabled &&
15
+ new image_minimizer_webpack_plugin_1.default({
16
+ minimizer: {
17
+ implementation: image_minimizer_webpack_plugin_1.default.imageminMinify,
18
+ options: {
19
+ plugins: [
20
+ (jpg === null || jpg === void 0 ? void 0 : jpg.enabled) && ["mozjpeg", {
21
+ quality: jpg === null || jpg === void 0 ? void 0 : jpg.quality,
22
+ progressive: true
23
+ }],
24
+ (png === null || png === void 0 ? void 0 : png.enabled) && ["optipng", {
25
+ optimizationLevel: png === null || png === void 0 ? void 0 : png.optimizationLevel,
26
+ bitDepthReduction: png === null || png === void 0 ? void 0 : png.bitDepthReduction,
27
+ colorTypeReduction: png === null || png === void 0 ? void 0 : png.colorTypeReduction,
28
+ paletteReduction: png === null || png === void 0 ? void 0 : png.paletteReduction,
29
+ interlaced: png === null || png === void 0 ? void 0 : png.interlaced
30
+ }],
31
+ (svg === null || svg === void 0 ? void 0 : svg.enabled) && ["svgo"],
32
+ (gif === null || gif === void 0 ? void 0 : gif.enabled) && ["gifsicle", {
33
+ optimizationLevel: gif === null || gif === void 0 ? void 0 : gif.optimizationLevel,
34
+ interlaced: true
35
+ }],
36
+ ].filter(Boolean)
37
+ }
38
+ }
39
+ })
40
+ ];
41
+ };
42
+ exports.getImageMin = getImageMin;
@@ -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
+ declare const devServerConfig: import("webpack-dev-server").Configuration;
2
+ export default devServerConfig;
@@ -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 path_1 = __importDefault(require("path"));
7
+ const app_configs_1 = __importDefault(require("./app-configs"));
8
+ const apply_overrides_1 = __importDefault(require("./util/apply-overrides"));
9
+ const devServerConfig = (0, apply_overrides_1.default)('devServer', {
10
+ port: app_configs_1.default.clientServerPort,
11
+ liveReload: false,
12
+ client: {
13
+ overlay: {
14
+ errors: true,
15
+ warnings: false,
16
+ },
17
+ },
18
+ devMiddleware: {
19
+ publicPath: `/${app_configs_1.default.publicPath}`,
20
+ },
21
+ static: [app_configs_1.default.serverOutputPath],
22
+ proxy: Object.assign(app_configs_1.default.appPackage.proxy || {}, {
23
+ '/**': Object.assign({ target: `http://localhost:${app_configs_1.default.serverPort}`, bypass: (req) => {
24
+ var _a;
25
+ const assetsRoot = path_1.default.normalize(`/${app_configs_1.default.publicPath}`).replace(/\\/g, '/');
26
+ if ((_a = req === null || req === void 0 ? void 0 : req.url) === null || _a === void 0 ? void 0 : _a.startsWith(assetsRoot)) {
27
+ return req.url;
28
+ }
29
+ return null;
30
+ } }, (app_configs_1.default.devSourceMaps.includes('eval') ? {
31
+ onProxyRes: (proxyRes) => {
32
+ const cspHeader = proxyRes.headers['content-security-policy'];
33
+ if (typeof cspHeader === 'string' && !cspHeader.includes('unsafe-eval')) {
34
+ proxyRes.headers['content-security-policy'] = cspHeader
35
+ .replace(/script-src/, 'script-src \'unsafe-eval\'');
36
+ }
37
+ },
38
+ } : {})),
39
+ }),
40
+ headers: app_configs_1.default.devServerCors
41
+ ? {
42
+ 'Access-Control-Allow-Origin': '*',
43
+ 'Access-Control-Allow-Headers': '*',
44
+ 'Access-Control-Allow-Methods': '*',
45
+ }
46
+ : {},
47
+ });
48
+ exports.default = devServerConfig;
@@ -0,0 +1,2 @@
1
+ declare const _exports: import("@jest/transform").SyncTransformer<babel.TransformOptions>;
2
+ export = _exports;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ const babelJest = require('babel-jest');
3
+ const babelPresets = require('../babel-server');
4
+ module.exports = babelJest.createTransformer(babelPresets.default);
@@ -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,9 @@
1
+ "use strict";
2
+ const path = require('path');
3
+ // This is a custom Jest transformer turning file imports into filenames.
4
+ // http://facebook.github.io/jest/docs/en/webpack.html
5
+ module.exports = {
6
+ process(src, filename) {
7
+ return { code: `module.exports = ${JSON.stringify(path.basename(filename))};` };
8
+ },
9
+ };
@@ -0,0 +1,50 @@
1
+ export const testRegex: string;
2
+ export const moduleFileExtensions: string[];
3
+ export const collectCoverageFrom: string[];
4
+ export const transform: {
5
+ '^.+\\.jsx?$': string;
6
+ '^.+\\.tsx?$': string;
7
+ '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': string;
8
+ };
9
+ export const moduleNameMapper: {
10
+ '\\.css$': string;
11
+ };
12
+ export const snapshotSerializers: string[];
13
+ export const globals: {
14
+ 'ts-jest': {
15
+ tsconfig: string | null;
16
+ babelConfig: {
17
+ presets: (string | false | (string | {
18
+ targets: {
19
+ browsers: string[];
20
+ };
21
+ loose: boolean;
22
+ useBuiltIns: string;
23
+ corejs: number;
24
+ exclude: string[];
25
+ })[])[];
26
+ plugins: (string | (string | {
27
+ legacy: boolean;
28
+ })[] | (string | {
29
+ loose: boolean;
30
+ })[] | (string | {
31
+ useBuiltIns: boolean;
32
+ })[] | (string | {
33
+ corejs: boolean;
34
+ helpers: boolean;
35
+ version: string;
36
+ regenerator: boolean;
37
+ })[])[];
38
+ env: {
39
+ production: {
40
+ plugins: (string | (string | {
41
+ removeImport: boolean;
42
+ })[])[];
43
+ };
44
+ test: {
45
+ plugins: string[];
46
+ };
47
+ };
48
+ };
49
+ };
50
+ };
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ const fs = require('fs');
3
+ const { pathsToModuleNameMapper } = require('ts-jest');
4
+ const { parseConfigFileTextToJson } = require('typescript');
5
+ const merge = require('lodash.merge');
6
+ const configs = require('../app-configs').default;
7
+ const tsConfigPath = configs.tsconfig;
8
+ const tsConfigText = fs.readFileSync(configs.tsconfig, 'utf8');
9
+ const tsConfig = parseConfigFileTextToJson(tsConfigPath, tsConfigText);
10
+ const tsConfigPaths = tsConfig.config.compilerOptions.paths || {};
11
+ const defaultJestConfig = {
12
+ testRegex: '(^.*src).*(((\/__test__\/|\/__tests__\/).*)|(test|spec|tests))\.(jsx?|tsx?)$',
13
+ moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
14
+ collectCoverageFrom: [
15
+ 'src/**/*.{js,jsx,ts,tsx}'
16
+ ],
17
+ // transform project js and ts files using babel ant ts transformers
18
+ transform: {
19
+ '^.+\\.jsx?$': require.resolve('./babel-transform'),
20
+ '^.+\\.tsx?$': require.resolve('ts-jest'),
21
+ // transform other files to simple empty strings
22
+ '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': require.resolve('./file-transform')
23
+ },
24
+ moduleNameMapper: Object.assign({
25
+ // replace all css files with simple empty exports
26
+ '\\.css$': require.resolve('./css-mock') }, pathsToModuleNameMapper(tsConfigPaths, { prefix: '<rootDir>/' })),
27
+ snapshotSerializers: [
28
+ require.resolve('jest-snapshot-serializer-class-name-to-string')
29
+ ],
30
+ globals: {
31
+ 'ts-jest': {
32
+ tsconfig: configs.tsconfig,
33
+ babelConfig: require('../babel-client').default
34
+ }
35
+ }
36
+ };
37
+ let appJestConfig = {};
38
+ if (configs.appPackage.jest) {
39
+ appJestConfig = configs.appPackage.jest;
40
+ if (appJestConfig.preset) { // we don't need presets when using presets
41
+ if (appJestConfig.preset !== 'arui-scripts') {
42
+ console.warn('arui-scripts test command doesn\'t support jest preset config');
43
+ }
44
+ delete appJestConfig.preset;
45
+ }
46
+ }
47
+ module.exports = merge(defaultJestConfig, appJestConfig);
@@ -0,0 +1,16 @@
1
+ import webpack from 'webpack';
2
+ import { EmbeddedModuleConfig } from './app-configs/types';
3
+ export declare function haveExposedMfModules(): Record<string, string> | undefined;
4
+ export declare const MF_ENTRY_NAME = "remoteEntry.js";
5
+ export declare function patchMainWebpackConfigForModules(webpackConf: webpack.Configuration): webpack.Configuration;
6
+ export declare function getCssPrefixForModule(module: EmbeddedModuleConfig): string | undefined;
7
+ export declare function getExposeLoadersFormEmbeddedModules(): {
8
+ test: string;
9
+ use: {
10
+ loader: string;
11
+ options: {
12
+ exposes: string[];
13
+ };
14
+ }[];
15
+ }[];
16
+ export declare function patchWebpackConfigForEmbedded(module: EmbeddedModuleConfig, webpackConf: webpack.Configuration): webpack.Configuration;
@@ -0,0 +1,101 @@
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.patchWebpackConfigForEmbedded = exports.getExposeLoadersFormEmbeddedModules = exports.getCssPrefixForModule = exports.patchMainWebpackConfigForModules = exports.MF_ENTRY_NAME = exports.haveExposedMfModules = void 0;
7
+ const webpack_1 = __importDefault(require("webpack"));
8
+ const postcss_prefix_selector_1 = __importDefault(require("postcss-prefix-selector"));
9
+ const app_configs_1 = __importDefault(require("./app-configs"));
10
+ const find_loader_1 = require("./util/find-loader");
11
+ function haveExposedMfModules() {
12
+ var _a;
13
+ return (_a = app_configs_1.default.mfModules) === null || _a === void 0 ? void 0 : _a.exposes;
14
+ }
15
+ exports.haveExposedMfModules = haveExposedMfModules;
16
+ exports.MF_ENTRY_NAME = 'remoteEntry.js';
17
+ function patchMainWebpackConfigForModules(webpackConf) {
18
+ // Добавляем expose loader для библиотек, которые мы хотим вынести в глобальную область видимости
19
+ webpackConf.module.rules.unshift(...getExposeLoadersFormEmbeddedModules());
20
+ if (!app_configs_1.default.mfModules || !webpackConf.output || !webpackConf.plugins) {
21
+ return webpackConf;
22
+ }
23
+ webpackConf.output.publicPath = haveExposedMfModules()
24
+ ? 'auto' // Для того чтобы модули могли подключаться из разных мест, нам необходимо использовать auto. Для корректной работы в IE надо подключaть https://github.com/amiller-gh/currentScript-polyfill
25
+ : app_configs_1.default.publicPath;
26
+ webpackConf.plugins.push(new webpack_1.default.container.ModuleFederationPlugin({
27
+ name: app_configs_1.default.mfModules.name || app_configs_1.default.normalizedName,
28
+ filename: app_configs_1.default.mfModules.exposes ? exports.MF_ENTRY_NAME : undefined,
29
+ shared: app_configs_1.default.mfModules.shared,
30
+ exposes: app_configs_1.default.mfModules.exposes,
31
+ }));
32
+ return webpackConf;
33
+ }
34
+ exports.patchMainWebpackConfigForModules = patchMainWebpackConfigForModules;
35
+ function getCssPrefixForModule(module) {
36
+ if (module.cssPrefix) {
37
+ return module.cssPrefix;
38
+ }
39
+ if (module.cssPrefix === false) {
40
+ return undefined;
41
+ }
42
+ return `.module-${module.name}`;
43
+ }
44
+ exports.getCssPrefixForModule = getCssPrefixForModule;
45
+ function getExposeLoadersFormEmbeddedModules() {
46
+ var _a;
47
+ const shared = (_a = app_configs_1.default.embeddedModules) === null || _a === void 0 ? void 0 : _a.shared;
48
+ if (!shared) {
49
+ return [];
50
+ }
51
+ return Object.keys(shared).map((libraryName) => {
52
+ const globalVarName = shared[libraryName];
53
+ return {
54
+ test: require.resolve(libraryName),
55
+ use: [
56
+ {
57
+ loader: require.resolve('expose-loader'),
58
+ options: {
59
+ exposes: [globalVarName],
60
+ },
61
+ },
62
+ ],
63
+ };
64
+ });
65
+ }
66
+ exports.getExposeLoadersFormEmbeddedModules = getExposeLoadersFormEmbeddedModules;
67
+ function addPrefixCssRule(rule, prefix) {
68
+ if (!rule || !rule.use || !Array.isArray(rule.use)) {
69
+ return;
70
+ }
71
+ const postCssLoader = rule.use.find((loaderConfig) => {
72
+ var _a;
73
+ if (typeof loaderConfig === 'string' || typeof loaderConfig === 'function' || !loaderConfig) {
74
+ return false;
75
+ }
76
+ return ((_a = loaderConfig.loader) === null || _a === void 0 ? void 0 : _a.indexOf('postcss-loader')) !== -1;
77
+ });
78
+ if (!postCssLoader || typeof postCssLoader !== 'object' || !postCssLoader.options || typeof postCssLoader.options !== 'object') {
79
+ return;
80
+ }
81
+ postCssLoader.options.postcssOptions.plugins = [
82
+ ...postCssLoader.options.postcssOptions.plugins,
83
+ (0, postcss_prefix_selector_1.default)({ prefix }),
84
+ ];
85
+ }
86
+ function patchWebpackConfigForEmbedded(module, webpackConf) {
87
+ webpackConf.externals = Object.assign(Object.assign({}, (webpackConf.externals || {})), (module.embeddedConfig || {}));
88
+ // Название переменной вебпака, которую он будет использовать для загрузки чанков. Важно чтобы для разных модулей они отличались,
89
+ // иначе несколько модулей из одного приложения будут конфликтовать между собой
90
+ webpackConf.output.uniqueName = module.name;
91
+ const cssPrefix = getCssPrefixForModule(module);
92
+ if (cssPrefix) {
93
+ // Добавляем префикс для css-классов, чтобы изолировать стили модуля от стилей основного приложения
94
+ const cssRule = (0, find_loader_1.findLoader)(webpackConf, '/\\.css$/');
95
+ const cssModulesRule = (0, find_loader_1.findLoader)(webpackConf, '/\\.module\\.css$/');
96
+ addPrefixCssRule(cssRule, cssPrefix);
97
+ addPrefixCssRule(cssModulesRule, `:global(${cssPrefix})`);
98
+ }
99
+ return webpackConf;
100
+ }
101
+ exports.patchWebpackConfigForEmbedded = patchWebpackConfigForEmbedded;
@@ -0,0 +1,22 @@
1
+ @custom-media --small screen;
2
+ @custom-media --small-only screen and (max-width:47.9375em);
3
+ @custom-media --medium screen and (min-width:48em);
4
+ @custom-media --medium-only screen and (min-width:48em) and (max-width:63.9375em);
5
+ @custom-media --large screen and (min-width 64em);
6
+ @custom-media --large-only screen and (min-width:64em) and (max-width:89.9375em);
7
+ @custom-media --xlarge screen and (min-width 90em);
8
+ @custom-media --xlarge-only screen and (min-width:90em) and (max-width:119.9375em);
9
+ @custom-media --xxlarge screen and (min-width 120em);
10
+ @custom-media --xxlarge-only screen and (min-width:120em) and (max-width:99999999em);
11
+ @custom-media --mobile-s (min-width:320px);
12
+ @custom-media --mobile-m (min-width:375px);
13
+ @custom-media --mobile-l (min-width:412px);
14
+ @custom-media --mobile (max-width:599px);
15
+ @custom-media --tablet-s (min-width:600px);
16
+ @custom-media --tablet-m (min-width:768px);
17
+ @custom-media --tablet (min-width:600px) and (max-width:1023px);
18
+ @custom-media --desktop-s (min-width:1024px);
19
+ @custom-media --desktop-m (min-width:1280px);
20
+ @custom-media --desktop-l (min-width:1440px);
21
+ @custom-media --desktop-xl (min-width:1920px);
22
+ @custom-media --desktop (min-width:1024px);
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Функция для создания конфигурационного файла postcss
3
+ * @param {String[]} plugins список плагинов
4
+ * @param {Object} options коллекция конфигураций плагинов, где ключ - название плагина, а значение - аргумент для инициализации
5
+ * @returns {*}
6
+ */
7
+ export declare function createPostcssConfig(plugins: string[], options: Record<string, unknown>): string[] | unknown[];
8
+ export declare const postcssPlugins: string[];
9
+ export declare const postcssPluginsOptions: {
10
+ 'postcss-import': {
11
+ path: string[];
12
+ };
13
+ '@csstools/postcss-global-data': {
14
+ files: string[];
15
+ };
16
+ 'postcss-url': {
17
+ url: string;
18
+ };
19
+ 'postcss-color-mod-function': {
20
+ unresolved: string;
21
+ };
22
+ 'postcss-custom-properties': {
23
+ preserve: boolean;
24
+ };
25
+ };
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.postcssPluginsOptions = exports.postcssPlugins = exports.createPostcssConfig = void 0;
7
+ const app_configs_1 = __importDefault(require("./app-configs"));
8
+ const path_1 = __importDefault(require("path"));
9
+ /**
10
+ * Функция для создания конфигурационного файла postcss
11
+ * @param {String[]} plugins список плагинов
12
+ * @param {Object} options коллекция конфигураций плагинов, где ключ - название плагина, а значение - аргумент для инициализации
13
+ * @returns {*}
14
+ */
15
+ function createPostcssConfig(plugins, options) {
16
+ return plugins.map(pluginName => {
17
+ if (pluginName in options) {
18
+ return [pluginName, options[pluginName]];
19
+ }
20
+ return pluginName;
21
+ });
22
+ }
23
+ exports.createPostcssConfig = createPostcssConfig;
24
+ exports.postcssPlugins = [
25
+ 'postcss-omit-import-tilde',
26
+ 'postcss-import',
27
+ 'postcss-url',
28
+ 'postcss-mixins',
29
+ 'postcss-for',
30
+ 'postcss-each',
31
+ (app_configs_1.default.componentsTheme || app_configs_1.default.keepCssVars) && '@csstools/postcss-global-data',
32
+ app_configs_1.default.keepCssVars && 'postcss-custom-media',
33
+ app_configs_1.default.componentsTheme && 'postcss-custom-properties',
34
+ 'postcss-strip-units',
35
+ 'postcss-calc',
36
+ 'postcss-color-function',
37
+ 'postcss-color-mod-function',
38
+ 'postcss-nested',
39
+ 'autoprefixer',
40
+ 'postcss-inherit',
41
+ 'postcss-discard-comments',
42
+ ].filter(Boolean);
43
+ exports.postcssPluginsOptions = {
44
+ 'postcss-import': {
45
+ path: ['./src'],
46
+ },
47
+ '@csstools/postcss-global-data': {
48
+ files: [
49
+ app_configs_1.default.keepCssVars && path_1.default.join(__dirname, 'mq.css'),
50
+ app_configs_1.default.componentsTheme
51
+ ].filter(Boolean),
52
+ },
53
+ 'postcss-url': {
54
+ url: 'rebase',
55
+ },
56
+ 'postcss-color-mod-function': {
57
+ unresolved: 'warn',
58
+ },
59
+ 'postcss-custom-properties': {
60
+ preserve: false,
61
+ }
62
+ };
@@ -0,0 +1,2 @@
1
+ declare const postcssConfig: string[] | unknown[];
2
+ export default postcssConfig;
@@ -0,0 +1,9 @@
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 postcss_config_1 = require("./postcss.config");
8
+ const postcssConfig = (0, apply_overrides_1.default)('postcss', (0, postcss_config_1.createPostcssConfig)(postcss_config_1.postcssPlugins, postcss_config_1.postcssPluginsOptions));
9
+ exports.default = postcssConfig;