arui-scripts 21.0.2 → 21.0.4

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.
@@ -1,21 +1,21 @@
1
1
  ts-jest[versions] (WARN) Version 6.0.2 of typescript installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=4.3.0 <6.0.0-0). Please do not report issues in ts-jest if you are using unsupported versions.
2
2
  ts-jest[versions] (WARN) Version 6.0.2 of typescript installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=4.3.0 <6.0.0-0). Please do not report issues in ts-jest if you are using unsupported versions.
3
3
  ts-jest[versions] (WARN) Version 6.0.2 of typescript installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=4.3.0 <6.0.0-0). Please do not report issues in ts-jest if you are using unsupported versions.
4
- PASS src/configs/app-configs/__tests__/update-with-presets.tests.ts (23.693 s)
5
- PASS src/plugins/postcss-global-variables/utils/__tests__/add-global-variable.tests.ts (23.933 s)
4
+ PASS src/configs/app-configs/__tests__/update-with-presets.tests.ts (24.143 s)
5
+ PASS src/plugins/postcss-global-variables/utils/__tests__/add-global-variable.tests.ts (24.05 s)
6
6
  PASS src/configs/util/__tests__/create-watch-ignore-regex.tests.ts
7
- PASS src/configs/app-configs/__tests__/update-with-env.tests.ts
8
7
  PASS src/configs/util/__tests__/apply-overrides.tests.ts
8
+ PASS src/configs/app-configs/__tests__/update-with-env.tests.ts
9
9
  PASS src/configs/app-configs/__tests__/update-with-package.tests.ts
10
10
  PASS src/configs/util/__tests__/get-polyfills.tests.ts
11
+ PASS src/plugins/postcss-global-variables/utils/__tests__/parse-variables.tests.ts
11
12
  PASS src/configs/util/__tests__/compress-with-dcb.test.ts
12
13
  PASS src/plugins/postcss-global-variables/utils/__tests__/get-media-query-name.tests.ts
13
- PASS src/plugins/postcss-global-variables/utils/__tests__/parse-variables.tests.ts
14
14
  PASS src/configs/app-configs/__tests__/validate-settings-keys.tests.ts
15
- PASS src/configs/util/__tests__/find-plugin.tests.ts (26.988 s)
15
+ PASS src/configs/util/__tests__/find-plugin.tests.ts (26.924 s)
16
16
 
17
17
  Test Suites: 12 passed, 12 total
18
18
  Tests: 30 passed, 30 total
19
19
  Snapshots: 0 total
20
- Time: 27.817 s
20
+ Time: 27.769 s
21
21
  Ran all test suites.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # [15.3.0](https://github.com/core-ds/arui-scripts/compare/v15.2.0...v15.3.0) (2023-06-30)
2
2
 
3
+ ## 21.0.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#467](https://github.com/core-ds/arui-scripts/pull/467) [`e6d6a40`](https://github.com/core-ds/arui-scripts/commit/e6d6a40c5200fcb128850f44ddf0e676b144624b) Thanks [@Los-Santos1](https://github.com/Los-Santos1)! - Исправлен запуск Jest на Windows из-за абсолютных путей в import
8
+
9
+ ## 21.0.3
10
+
11
+ ### Patch Changes
12
+
13
+ - [#463](https://github.com/core-ds/arui-scripts/pull/463) [`b27ac8c`](https://github.com/core-ds/arui-scripts/commit/b27ac8c40420df53704a12d83163c31fa6943495) Thanks [@ngg-dev](https://github.com/ngg-dev)! - - удаление устаревшего пакета react-dev-utils для решение проблем с уязвимостями в пакете ajv
14
+ - добавление пакета get-port
15
+ - создание утилит getLocalIdent и printBuildError
16
+
3
17
  ## 21.0.2
4
18
 
5
19
  ### Patch Changes
@@ -13,11 +13,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  const chalk_1 = __importDefault(require("chalk"));
16
- const printBuildError_1 = __importDefault(require("react-dev-utils/printBuildError"));
17
16
  const build_wrapper_1 = __importDefault(require("./build-wrapper"));
18
17
  const client_assets_sizes_1 = require("../util/client-assets-sizes");
19
18
  const webpack_client_prod_1 = require("../../configs/webpack.client.prod");
20
19
  const load_browserslist_1 = require("../util/load-browserslist");
20
+ const print_build_error_1 = require("../util/print-build-error");
21
21
  (0, load_browserslist_1.loadBrowserslist)();
22
22
  console.log(chalk_1.default.magenta('Building client...'));
23
23
  function main() {
@@ -46,7 +46,7 @@ function main() {
46
46
  }
47
47
  catch (err) {
48
48
  console.log(chalk_1.default.red('Failed to compile client.\n'));
49
- (0, printBuildError_1.default)(err);
49
+ (0, print_build_error_1.printBuildError)(err);
50
50
  process.exit(1);
51
51
  }
52
52
  });
@@ -4,10 +4,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const chalk_1 = __importDefault(require("chalk"));
7
- const printBuildError_1 = __importDefault(require("react-dev-utils/printBuildError"));
8
7
  const build_wrapper_1 = __importDefault(require("./build-wrapper"));
9
8
  const webpack_server_prod_1 = require("../../configs/webpack.server.prod");
10
9
  const supporting_node_1 = require("../../configs/supporting-node");
10
+ const print_build_error_1 = require("../util/print-build-error");
11
11
  process.env.BROWSERSLIST = supporting_node_1.supportingNode.join(',');
12
12
  console.log(chalk_1.default.magenta('Building server...'));
13
13
  (0, build_wrapper_1.default)(webpack_server_prod_1.webpackServerConfig)
@@ -24,6 +24,6 @@ console.log(chalk_1.default.magenta('Building server...'));
24
24
  })
25
25
  .catch((err) => {
26
26
  console.log(chalk_1.default.red('Failed to compile server.\n'));
27
- (0, printBuildError_1.default)(err);
27
+ (0, print_build_error_1.printBuildError)(err);
28
28
  process.exit(1);
29
29
  });
@@ -26,6 +26,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.getJestConfig = void 0;
27
27
  const fs_1 = __importDefault(require("fs"));
28
28
  const path_1 = __importDefault(require("path"));
29
+ const url_1 = require("url");
29
30
  const jest_config_1 = require("jest-config");
30
31
  const jest_resolve_1 = __importDefault(require("jest-resolve"));
31
32
  const lodash_merge_1 = __importDefault(require("lodash.merge"));
@@ -48,7 +49,7 @@ function getAppJestConfig() {
48
49
  return __awaiter(this, void 0, void 0, function* () {
49
50
  const jestConfigPath = path_1.default.resolve(process.cwd(), 'jest.config.js');
50
51
  if (fs_1.default.existsSync(jestConfigPath)) {
51
- return (yield import(jestConfigPath)).default;
52
+ return (yield import((0, url_1.pathToFileURL)(jestConfigPath).href)).default;
52
53
  }
53
54
  if (app_configs_1.configs.appPackage.jest) {
54
55
  return app_configs_1.configs.appPackage.jest;
@@ -72,7 +73,8 @@ function getPresetConfig(presetPath) {
72
73
  if (!presetModule) {
73
74
  throw new Error(`Cannot find module '${normalizedPresetPath}'`);
74
75
  }
75
- const _a = (yield import(presetModule)).default, { preset: subPreset } = _a, preset = __rest(_a, ["preset"]);
76
+ const _a = (yield import((0, url_1.pathToFileURL)(presetModule).href))
77
+ .default, { preset: subPreset } = _a, preset = __rest(_a, ["preset"]);
76
78
  if (subPreset) {
77
79
  console.warn(`Jest can't handle preset chaining. Preset "${subPreset}" will be ignored.`);
78
80
  }
@@ -0,0 +1,6 @@
1
+ type CssLoaderContext = {
2
+ resourcePath: string;
3
+ rootContext: string;
4
+ };
5
+ export declare function getLocalIdent(context: CssLoaderContext, _localIdentName: string, localName: string): string;
6
+ export {};
@@ -0,0 +1,29 @@
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.getLocalIdent = getLocalIdent;
7
+ const crypto_1 = __importDefault(require("crypto"));
8
+ const path_1 = __importDefault(require("path"));
9
+ function getLocalIdent(context, _localIdentName, localName) {
10
+ const isIndexModule = /index\.module\.(css|scss|sass)$/.test(context.resourcePath);
11
+ const relativePath = path_1.default.posix.relative(context.rootContext, context.resourcePath);
12
+ const hash = crypto_1.default
13
+ .createHash('md5')
14
+ .update(relativePath + localName)
15
+ .digest('base64')
16
+ .slice(0, 5)
17
+ .replace(/\+/g, '_')
18
+ .replace(/\//g, '_')
19
+ .replace(/=/g, '');
20
+ let baseName;
21
+ if (isIndexModule) {
22
+ baseName = path_1.default.basename(path_1.default.dirname(context.resourcePath));
23
+ }
24
+ else {
25
+ baseName = path_1.default.basename(context.resourcePath, '.module.css');
26
+ }
27
+ const className = `${baseName}_${localName}__${hash}`;
28
+ return className.replace('.module_', '_').replace(/\./g, '_');
29
+ }
@@ -0,0 +1 @@
1
+ export declare function printBuildError(err: Error | null | undefined): void;
@@ -0,0 +1,32 @@
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.printBuildError = printBuildError;
7
+ const chalk_1 = __importDefault(require("chalk"));
8
+ function printBuildError(err) {
9
+ const message = err === null || err === void 0 ? void 0 : err.message;
10
+ const stack = err === null || err === void 0 ? void 0 : err.stack;
11
+ if (stack && typeof message === 'string' && message.includes('from Terser')) {
12
+ try {
13
+ const matched = /(.+)\[(.+):(.+),(.+)\]\[.+\]/.exec(stack);
14
+ if (!matched) {
15
+ throw new Error('Using errors for control flow is bad.');
16
+ }
17
+ const problemPath = matched[2];
18
+ const line = matched[3];
19
+ const column = matched[4];
20
+ const columnFormatted = column === '0' ? '' : `:${column}`;
21
+ console.log(`Failed to minify the code from this file: \n\n${chalk_1.default.yellow(`\t${problemPath}:${line}${columnFormatted}`)}\n`);
22
+ }
23
+ catch (ignored) {
24
+ console.log('Failed to minify the bundle.', err);
25
+ }
26
+ console.log('Read more here: https://cra.link/failed-to-minify');
27
+ }
28
+ else {
29
+ console.log(`${message || err}\n`);
30
+ }
31
+ console.log();
32
+ }
@@ -8,10 +8,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
11
14
  Object.defineProperty(exports, "__esModule", { value: true });
12
15
  exports.runClientDevServer = runClientDevServer;
13
16
  const util_1 = require("util");
14
- const WebpackDevServerUtils_1 = require("react-dev-utils/WebpackDevServerUtils");
17
+ const get_port_1 = __importDefault(require("get-port"));
15
18
  const core_1 = require("@rspack/core");
16
19
  const dev_server_1 = require("@rspack/dev-server");
17
20
  const dev_server_2 = require("../../configs/dev-server");
@@ -25,7 +28,10 @@ function runClientDevServer(configuration) {
25
28
  const DEFAULT_PORT = dev_server_2.devServerConfig.port;
26
29
  const HOST = '0.0.0.0';
27
30
  try {
28
- const port = yield (0, WebpackDevServerUtils_1.choosePort)(HOST, +(DEFAULT_PORT || 0));
31
+ const port = yield (0, get_port_1.default)({
32
+ port: +(DEFAULT_PORT || 0),
33
+ host: HOST,
34
+ });
29
35
  if (!port) {
30
36
  // We have not found a port.
31
37
  return;
@@ -39,7 +39,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.createClientWebpackConfig = exports.createSingleClientWebpackConfig = void 0;
40
40
  const path_1 = __importDefault(require("path"));
41
41
  const zlib = __importStar(require("zlib"));
42
- const getCSSModuleLocalIdent_1 = __importDefault(require("react-dev-utils/getCSSModuleLocalIdent"));
43
42
  const react_refresh_typescript_1 = __importDefault(require("react-refresh-typescript"));
44
43
  const core_1 = require("@rspack/core");
45
44
  const plugin_react_refresh_1 = __importDefault(require("@rspack/plugin-react-refresh"));
@@ -47,10 +46,11 @@ const assets_webpack_plugin_1 = __importDefault(require("assets-webpack-plugin")
47
46
  const case_sensitive_paths_webpack_plugin_1 = __importDefault(require("case-sensitive-paths-webpack-plugin"));
48
47
  const compression_webpack_plugin_1 = __importDefault(require("compression-webpack-plugin"));
49
48
  const css_minimizer_webpack_plugin_1 = __importDefault(require("css-minimizer-webpack-plugin"));
50
- const ts_checker_rspack_plugin_1 = require("ts-checker-rspack-plugin");
51
49
  const html_webpack_plugin_1 = __importDefault(require("html-webpack-plugin"));
52
50
  const rspack_manifest_plugin_1 = require("rspack-manifest-plugin");
51
+ const ts_checker_rspack_plugin_1 = require("ts-checker-rspack-plugin");
53
52
  const webpack_deduplication_plugin_1 = require("webpack-deduplication-plugin");
53
+ const get_local_ident_1 = require("../commands/util/get-local-ident");
54
54
  const arui_runtime_1 = require("../plugins/arui-runtime");
55
55
  const html_template_1 = require("../templates/html.template");
56
56
  const minimizers_1 = require("./config-extras/minimizers");
@@ -235,7 +235,7 @@ const createSingleClientWebpackConfig = (mode, entry, configName) => (Object.ass
235
235
  importLoaders: 1,
236
236
  sourceMap: mode === 'dev',
237
237
  modules: {
238
- getLocalIdent: getCSSModuleLocalIdent_1.default,
238
+ getLocalIdent: get_local_ident_1.getLocalIdent,
239
239
  },
240
240
  },
241
241
  },
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.createServerConfig = void 0;
7
7
  const fs_1 = __importDefault(require("fs"));
8
8
  const path_1 = __importDefault(require("path"));
9
- const getCSSModuleLocalIdent_1 = __importDefault(require("react-dev-utils/getCSSModuleLocalIdent"));
10
9
  const core_1 = require("@rspack/core");
11
10
  const case_sensitive_paths_webpack_plugin_1 = __importDefault(require("case-sensitive-paths-webpack-plugin"));
12
11
  const run_script_webpack_plugin_1 = require("run-script-webpack-plugin");
@@ -21,6 +20,7 @@ const babel_server_1 = require("./babel-server");
21
20
  const postcss_1 = require("./postcss");
22
21
  const server_externals_exemptions_1 = require("./server-externals-exemptions");
23
22
  const swc_1 = require("./swc");
23
+ const get_local_ident_1 = require("../commands/util/get-local-ident");
24
24
  const assetsIgnoreBanner = fs_1.default.readFileSync(require.resolve('./util/node-assets-ignore'), 'utf8');
25
25
  const sourceMapSupportBanner = fs_1.default.readFileSync(require.resolve('./util/install-sourcemap-support'), 'utf8');
26
26
  // style files regexes
@@ -109,7 +109,7 @@ const createServerConfig = (mode) => ({
109
109
  options: {
110
110
  modules: {
111
111
  exportOnlyLocals: true,
112
- getLocalIdent: getCSSModuleLocalIdent_1.default,
112
+ getLocalIdent: get_local_ident_1.getLocalIdent,
113
113
  },
114
114
  },
115
115
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arui-scripts",
3
- "version": "21.0.2",
3
+ "version": "21.0.4",
4
4
  "main": "./build/index.js",
5
5
  "typings": "./build/index.d.ts",
6
6
  "license": "MPL-2.0",
@@ -62,6 +62,7 @@
62
62
  "expose-loader": "3.1.0",
63
63
  "filesize": "^6.4.0",
64
64
  "fs-extra": "6.0.1",
65
+ "get-port": "7.2.0",
65
66
  "html-webpack-plugin": "^5.6.0",
66
67
  "image-minimizer-webpack-plugin": "^3.8.3",
67
68
  "imagemin": "^8.0.1",
@@ -95,7 +96,6 @@
95
96
  "postcss-remove-root": "^0.0.2",
96
97
  "postcss-strip-units": "^2.0.0",
97
98
  "postcss-url": "^10.0.0",
98
- "react-dev-utils": "12.0.1",
99
99
  "react-refresh": "0.10.0",
100
100
  "react-refresh-typescript": "2.0.2",
101
101
  "rimraf": "^2.7.1",
@@ -128,7 +128,6 @@
128
128
  "@types/lodash.merge": "^4.6.7",
129
129
  "@types/node": "18.19.121",
130
130
  "@types/postcss-media-query-parser": "0.2.4",
131
- "@types/react-dev-utils": "9.0.11",
132
131
  "@types/semver": "^7.5.0",
133
132
  "@types/serialize-javascript": "^5.0.4",
134
133
  "@types/shelljs": "^0.8.12",