arui-scripts 21.0.4 → 21.0.5

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 (24.143 s)
5
- PASS src/plugins/postcss-global-variables/utils/__tests__/add-global-variable.tests.ts (24.05 s)
4
+ PASS src/plugins/postcss-global-variables/utils/__tests__/add-global-variable.tests.ts (23.078 s)
6
5
  PASS src/configs/util/__tests__/create-watch-ignore-regex.tests.ts
7
6
  PASS src/configs/util/__tests__/apply-overrides.tests.ts
8
- PASS src/configs/app-configs/__tests__/update-with-env.tests.ts
7
+ PASS src/configs/app-configs/__tests__/update-with-presets.tests.ts (23.705 s)
9
8
  PASS src/configs/app-configs/__tests__/update-with-package.tests.ts
9
+ PASS src/configs/app-configs/__tests__/update-with-env.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
12
11
  PASS src/configs/util/__tests__/compress-with-dcb.test.ts
12
+ PASS src/plugins/postcss-global-variables/utils/__tests__/parse-variables.tests.ts
13
13
  PASS src/plugins/postcss-global-variables/utils/__tests__/get-media-query-name.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.924 s)
15
+ PASS src/configs/util/__tests__/find-plugin.tests.ts (26.801 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.769 s
20
+ Time: 27.649 s
21
21
  Ran all test suites.
package/CHANGELOG.md CHANGED
@@ -1,4 +1,10 @@
1
- # [15.3.0](https://github.com/core-ds/arui-scripts/compare/v15.2.0...v15.3.0) (2023-06-30)
1
+ # arui-scripts
2
+
3
+ ## 21.0.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [#480](https://github.com/core-ds/arui-scripts/pull/480) [`54ee0bf`](https://github.com/core-ds/arui-scripts/commit/54ee0bf09c5fae5ff329bdf7394044d2b0aab851) Thanks [@dmitrbrvsk](https://github.com/dmitrbrvsk)! - Отключен autoprefixer в cерверной конфигурации postcss, чтобы CSS modules в server сборке не генерировали предупреждения при таргете `current node`.
2
8
 
3
9
  ## 21.0.4
4
10
 
package/README.md CHANGED
@@ -27,9 +27,19 @@ npm install arui-scripts --save-dev
27
27
  2. Создайте необходимые файлы
28
28
  - `src/index.{js,jsx,ts,tsx}` - входная точка для клиентского приложения.
29
29
  - `src/server/index.{js,jsx,tsx}` - входная точка для серверного приложения.
30
- - `node_modules/arui-feather/polyfills` - полифилы для клиентского приложения.
30
+ Если нужен только клиент, смотреть [Режим clientOnly](./docs/client-only.md).
31
31
 
32
- При желании вы можете изменить эти пути с помощью настроек.
32
+ **Полифилы (опционально).**
33
+ Отдельный бандл полифилов не обязателен: по умолчанию [clientPolyfillsEntry](docs/settings.md#clientpolyfillsentry) не задан. Для большинства целей по браузерам (их можно сузить или расширить через overrides `supporting-browsers`, см. [Тонкая настройка](docs/overrides.md#тонкая-настройка)) можно не подключать отдельный файл полифилов.
34
+
35
+ Если полифилы все же нужны (старые браузеры или режим `entry` у SWC/Babel с `core-js`):
36
+
37
+ - добавьте в проект зависимость `core-js` (при необходимости)
38
+ - создайте файл, например `src/polyfills.ts`, с импортом `import 'core-js/stable';`
39
+ - укажите в [arui-scripts.config](docs/settings.md) или в `package.json` в секции `aruiScripts`: `clientPolyfillsEntry: './src/polyfills'`
40
+
41
+ Пути ко входным точкам и полифилам можно переопределить через настройки.
42
+ Полный список в [документации по настройкам](docs/settings.md).
33
43
 
34
44
  3. Используйте команды из `arui-scripts`!
35
45
 
@@ -1,9 +1,11 @@
1
1
  import { type PluginCreator } from 'postcss';
2
2
  type PostCssPluginName = string | PluginCreator<unknown>;
3
- type PostcssPlugin = string | [string, unknown] | {
3
+ export type PostcssPlugin = string | [string, unknown] | {
4
4
  name: string;
5
5
  plugin: PluginCreator<unknown>;
6
6
  options?: unknown;
7
+ } | {
8
+ postcssPlugin: string;
7
9
  };
8
10
  /**
9
11
  * Функция для создания конфигурационного файла postcss
@@ -1 +1,6 @@
1
- export declare const postcssConfig: (string | import("postcss").Processor | import("postcss").Plugin | [string, unknown])[];
1
+ export declare const postcssConfig: (string | import("postcss").Processor | [string, unknown] | {
2
+ postcssPlugin: string;
3
+ })[];
4
+ export declare const serverPostcssConfig: (string | import("postcss").Processor | [string, unknown] | {
5
+ postcssPlugin: string;
6
+ })[];
@@ -1,6 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.postcssConfig = void 0;
3
+ exports.serverPostcssConfig = exports.postcssConfig = void 0;
4
4
  const apply_overrides_1 = require("./util/apply-overrides");
5
5
  const postcss_config_1 = require("./postcss.config");
6
- exports.postcssConfig = (0, apply_overrides_1.applyOverrides)('postcss', (0, postcss_config_1.createPostcssConfig)(postcss_config_1.postcssPlugins, postcss_config_1.postcssPluginsOptions)).map((plugin) => typeof plugin === 'string' || Array.isArray(plugin) ? plugin : plugin.plugin(plugin.options));
6
+ const postcssConfigWithOverrides = (0, apply_overrides_1.applyOverrides)('postcss', (0, postcss_config_1.createPostcssConfig)(postcss_config_1.postcssPlugins, postcss_config_1.postcssPluginsOptions));
7
+ const isResolvedPostcssPlugin = (plugin) => typeof plugin === 'object' && !Array.isArray(plugin) && 'postcssPlugin' in plugin;
8
+ const resolvePostcssConfig = (plugins) => plugins.map((plugin) => typeof plugin === 'string' || Array.isArray(plugin) || isResolvedPostcssPlugin(plugin)
9
+ ? plugin
10
+ : plugin.plugin(plugin.options));
11
+ const isAutoprefixerPlugin = (plugin) => {
12
+ if (plugin === 'autoprefixer') {
13
+ return true;
14
+ }
15
+ if (Array.isArray(plugin)) {
16
+ return plugin[0] === 'autoprefixer';
17
+ }
18
+ return isResolvedPostcssPlugin(plugin) && plugin.postcssPlugin === 'autoprefixer';
19
+ };
20
+ exports.postcssConfig = resolvePostcssConfig(postcssConfigWithOverrides);
21
+ exports.serverPostcssConfig = resolvePostcssConfig(postcssConfigWithOverrides.filter((plugin) => !isAutoprefixerPlugin(plugin)));
@@ -117,7 +117,7 @@ const createServerConfig = (mode) => ({
117
117
  loader: require.resolve('postcss-loader'),
118
118
  options: {
119
119
  postcssOptions: {
120
- plugins: postcss_1.postcssConfig,
120
+ plugins: postcss_1.serverPostcssConfig,
121
121
  },
122
122
  },
123
123
  },
package/docs/presets.md CHANGED
@@ -17,8 +17,8 @@
17
17
  от папки, содержащей package.json. Так что это может быть как папка в проекте, так и пакет из node_modules).
18
18
 
19
19
  Сам пакет с пресетами может содержать два файла:
20
- - `arui-scirpts.config.js` (или `arui-scripts.config.ts`)
21
- - `arui-scripts.overrides.js` (или `arui-scirpts.overrides.ts`)
20
+ - `arui-scripts.config.js` (или `arui-scripts.config.ts`)
21
+ - `arui-scripts.overrides.js` (или `arui-scripts.overrides.ts`)
22
22
 
23
23
  ### arui-scripts.config (js | ts)
24
24
  С помощью этого файла можно задать любые ключи [конфигурации](settings.md).
package/docs/settings.md CHANGED
@@ -142,7 +142,9 @@ export default settings;
142
142
  Имя файла для компиляции сервера, по умолчанию `server.js`
143
143
 
144
144
  #### clientPolyfillsEntry
145
- Точка входа для полифилов. Будет подключаться до основной точки входа.
145
+ Точка входа для полифилов. Будет подключаться до основной клиентской точки входа (можно передать одну строку или массив путей или не задавать, тогда отдельный бандл полифилов не добавляется).
146
+
147
+ По умолчанию ключ не задан: для многих проектов отдельный файл не нужен. Если нужны полифилы при `codeLoader: 'swc'` или Babel с `useBuiltIns: 'entry'`, обычно создают файл с `import 'core-js/stable'` и указывают путь в этом поле (пакет `core-js` должен быть в зависимостях приложения). Пример для новых проектов см. в [README](../README.md).
146
148
 
147
149
  #### clientEntry
148
150
  Точка входа для клиентского приложения. По умолчанию `./src/index`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arui-scripts",
3
- "version": "21.0.4",
3
+ "version": "21.0.5",
4
4
  "main": "./build/index.js",
5
5
  "typings": "./build/index.d.ts",
6
6
  "license": "MPL-2.0",
@@ -76,7 +76,7 @@
76
76
  "mini-svg-data-uri": "^1.4.4",
77
77
  "null-loader": "0.1.1",
78
78
  "pnp-webpack-plugin": "1.7.0",
79
- "postcss": "^8.4.31",
79
+ "postcss": "^8.5.10",
80
80
  "postcss-calc": "^9.0.0",
81
81
  "postcss-color-function": "^4.0.0",
82
82
  "postcss-color-mod-function": "^3.0.0",