arui-scripts 19.0.0 → 19.0.1

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.
@@ -5,19 +5,19 @@ ts-jest[versions] (WARN) Version 29.7.0 of jest installed has not been tested wi
5
5
  ts-jest[versions] (WARN) Version 5.6.3 of typescript installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=4.3.0 <5.0.0-0). Please do not report issues in ts-jest if you are using unsupported versions.
6
6
  ts-jest[versions] (WARN) Version 5.6.3 of typescript installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=4.3.0 <5.0.0-0). Please do not report issues in ts-jest if you are using unsupported versions.
7
7
  ts-jest[versions] (WARN) Version 5.6.3 of typescript installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=4.3.0 <5.0.0-0). Please do not report issues in ts-jest if you are using unsupported versions.
8
- PASS src/configs/app-configs/__tests__/update-with-presets.tests.ts (26.447 s)
8
+ PASS src/configs/app-configs/__tests__/update-with-presets.tests.ts (26.869 s)
9
+ PASS src/plugins/postcss-global-variables/utils/__tests__/add-global-variable.tests.ts (26.871 s)
9
10
  PASS src/configs/util/__tests__/get-polyfills.tests.ts
10
- PASS src/configs/util/__tests__/apply-overrides.tests.ts
11
11
  PASS src/configs/app-configs/__tests__/update-with-env.tests.ts
12
- PASS src/plugins/postcss-global-variables/utils/__tests__/add-global-variable.tests.ts (27.198 s)
12
+ PASS src/configs/util/__tests__/apply-overrides.tests.ts
13
13
  PASS src/configs/app-configs/__tests__/update-with-package.tests.ts
14
- PASS src/configs/app-configs/__tests__/validate-settings-keys.tests.ts
15
14
  PASS src/plugins/postcss-global-variables/utils/__tests__/parse-variables.tests.ts
15
+ PASS src/configs/app-configs/__tests__/validate-settings-keys.tests.ts
16
16
  PASS src/plugins/postcss-global-variables/utils/__tests__/get-media-query-name.tests.ts
17
- PASS src/configs/util/__tests__/find-plugin.tests.ts (28.961 s)
17
+ PASS src/configs/util/__tests__/find-plugin.tests.ts (29.164 s)
18
18
 
19
19
  Test Suites: 10 passed, 10 total
20
20
  Tests: 26 passed, 26 total
21
21
  Snapshots: 0 total
22
- Time: 30.115 s
22
+ Time: 30.106 s
23
23
  Ran all test suites.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
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
+ ## 19.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#303](https://github.com/core-ds/arui-scripts/pull/303) [`342c717`](https://github.com/core-ds/arui-scripts/commit/342c7171017056214e0ecc3cd7c866f7cce64e88) Thanks [@Echzio](https://github.com/Echzio)! - исправление парсинга postcss, в котором неправильно парсились @media
8
+
9
+ - [#301](https://github.com/core-ds/arui-scripts/pull/301) [`77bbf31`](https://github.com/core-ds/arui-scripts/commit/77bbf3108257192d056ebf779bc737800b60375c) Thanks [@heymdall-legal](https://github.com/heymdall-legal)! - Исправлена проблема при обработке маленьких svg (меньше, чем [config.dataUrlMaxSize](https://github.com/core-ds/arui-scripts/blob/master/packages/arui-scripts/docs/settings.md#dataurlmaxsize)): теперь они корректно преобразуются в data-url
10
+
3
11
  ## 19.0.0
4
12
 
5
13
  ### Major Changes
@@ -260,7 +260,7 @@ const createSingleClientWebpackConfig = (mode, entry, configName) => (Object.ass
260
260
  test: /\.svg/,
261
261
  type: 'asset',
262
262
  generator: {
263
- dataUrl: (content) => (0, mini_svg_data_uri_1.default)(content.toString()),
263
+ dataUrl: (file) => (0, mini_svg_data_uri_1.default)(file.content.toString()),
264
264
  },
265
265
  parser: {
266
266
  dataUrlCondition: {
@@ -9,6 +9,8 @@ exports.addGlobalVariable = addGlobalVariable;
9
9
  const fs_1 = __importDefault(require("fs"));
10
10
  const path_1 = __importDefault(require("path"));
11
11
  const postcss_1 = require("postcss");
12
+ // eslint-disable-next-line import/no-extraneous-dependencies
13
+ const postcss_media_query_parser_1 = __importDefault(require("postcss-media-query-parser"));
12
14
  const getMediaQueryName = (rule) => rule.params.split(' ')[0];
13
15
  exports.getMediaQueryName = getMediaQueryName;
14
16
  function parseImport(root, postcssHelpers, filePath) {
@@ -64,13 +66,25 @@ const insertParsedCss = (root, parsedVariables, parsedCustomMedia) => {
64
66
  addGlobalVariable(decl.value, rootRule, parsedVariables);
65
67
  });
66
68
  root.walkAtRules('media', (rule) => {
67
- const mediaFullName = (0, exports.getMediaQueryName)(rule);
68
- if (mediaFullName.startsWith('(--')) {
69
- const mediaName = mediaFullName.slice(1, -1);
70
- if (parsedCustomMedia[mediaName]) {
71
- root.append(parsedCustomMedia[mediaName]);
69
+ var _a;
70
+ // парсим параметры
71
+ const mediaParsed = (0, postcss_media_query_parser_1.default)(rule.params);
72
+ // регулярка для (--desktop), (--mobile), (--desktop-m) и тд
73
+ const parseRule = /--\w+-?\w+/gi;
74
+ (_a = mediaParsed.nodes) === null || _a === void 0 ? void 0 : _a.forEach(({ value }) => {
75
+ // value приходит в виде (--desktop); not screen and (--mobile) и тд
76
+ if (parseRule.test(value)) {
77
+ // берем все вхождения --desktop, --mobile
78
+ const mediaName = value.match(parseRule);
79
+ // итерируемся по [--desktop, --mobile]
80
+ mediaName === null || mediaName === void 0 ? void 0 : mediaName.forEach((rule) => {
81
+ // подставляем значения если у нас есть под это custom-media
82
+ if (parsedCustomMedia[rule]) {
83
+ root.append(parsedCustomMedia[rule]);
84
+ }
85
+ });
72
86
  }
73
- }
87
+ });
74
88
  });
75
89
  return rootRule;
76
90
  };