arui-scripts 15.8.1 → 15.9.0

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.
package/.eslintrc.js CHANGED
@@ -9,5 +9,7 @@ module.exports = {
9
9
  rules: {
10
10
  'import/no-default-export': 'warn',
11
11
  'import/no-named-as-default': 'warn',
12
+ // чтобы могли использовать for и генераторы
13
+ 'no-restricted-syntax': 'off',
12
14
  },
13
15
  };
@@ -175,22 +175,27 @@
175
175
  /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/configs/supporting-browsers.ts
176
176
  8:8 warning Prefer named exports import/no-default-export
177
177
 
178
+ /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/configs/util/__tests__/find-plugin.tests.ts
179
+ 6:14 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
180
+ 8:26 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
181
+ 12:43 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
182
+
178
183
  /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/configs/util/__tests__/get-polyfills.tests.ts
179
184
  41:83 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
180
185
  53:83 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
181
186
 
182
187
  /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/configs/util/apply-overrides.ts
183
188
  5:8 warning Using exported name 'appConfigs' as identifier for default export import/no-named-as-default
184
- 24:12 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
185
- 25:18 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
189
+ 25:12 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
186
190
  26:18 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
187
- 27:24 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
188
- 29:14 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
189
- 40:38 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
190
- 88:9 warning Unexpected console statement no-console
191
- 89:9 warning Unexpected console statement no-console
192
- 107:48 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
193
- 130:8 warning Prefer named exports import/no-default-export
191
+ 27:18 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
192
+ 28:24 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
193
+ 30:14 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
194
+ 41:38 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
195
+ 97:9 warning Unexpected console statement no-console
196
+ 98:9 warning Unexpected console statement no-console
197
+ 116:48 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
198
+ 139:8 warning Prefer named exports import/no-default-export
194
199
 
195
200
  /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/configs/util/check-node-version.ts
196
201
  7:8 warning Prefer named exports import/no-default-export
@@ -199,6 +204,9 @@
199
204
  9:24 warning Forbidden non-null assertion @typescript-eslint/no-non-null-assertion
200
205
  9:24 warning Forbidden non-null assertion @typescript-eslint/no-non-null-assertion
201
206
 
207
+ /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/configs/util/find-plugin.ts
208
+ 112:39 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
209
+
202
210
  /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/configs/util/get-entry.ts
203
211
  32:8 warning Prefer named exports import/no-default-export
204
212
 
@@ -209,10 +217,10 @@
209
217
  24:9 warning Unexpected console statement no-console
210
218
 
211
219
  /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/configs/webpack.client.dev.ts
212
- 14:8 warning Prefer named exports import/no-default-export
220
+ 16:8 warning Prefer named exports import/no-default-export
213
221
 
214
222
  /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/configs/webpack.client.prod.ts
215
- 14:8 warning Prefer named exports import/no-default-export
223
+ 16:8 warning Prefer named exports import/no-default-export
216
224
 
217
225
  /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/configs/webpack.client.ts
218
226
  24:8 warning Using exported name 'configs' as identifier for default export import/no-named-as-default
@@ -220,10 +228,10 @@
220
228
  181:58 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
221
229
 
222
230
  /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/configs/webpack.server.dev.ts
223
- 11:8 warning Prefer named exports import/no-default-export
231
+ 12:8 warning Prefer named exports import/no-default-export
224
232
 
225
233
  /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/configs/webpack.server.prod.ts
226
- 11:8 warning Prefer named exports import/no-default-export
234
+ 12:8 warning Prefer named exports import/no-default-export
227
235
 
228
236
  /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/configs/webpack.server.ts
229
237
  14:8 warning Using exported name 'configs' as identifier for default export import/no-named-as-default
@@ -256,5 +264,5 @@
256
264
  /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/types.d.ts
257
265
  4:12 warning Prefer named exports import/no-default-export
258
266
 
259
- ✖ 143 problems (0 errors, 143 warnings)
267
+ ✖ 147 problems (0 errors, 147 warnings)
260
268
 
@@ -1,4 +1,9 @@
1
- PASS src/configs/app-configs/__tests__/update-with-presets.tests.ts (41.137 s)
1
+ Failed to load /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/tsconfig.json: Missing baseUrl in compilerOptions
2
+ Failed to load /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/tsconfig.json: Missing baseUrl in compilerOptions
3
+ Failed to load /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/tsconfig.json: Missing baseUrl in compilerOptions
4
+ Failed to load /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/tsconfig.json: Missing baseUrl in compilerOptions
5
+ PASS src/configs/util/__tests__/find-plugin.tests.ts (46.055 s)
6
+ PASS src/configs/app-configs/__tests__/update-with-presets.tests.ts
2
7
  PASS src/configs/util/__tests__/get-polyfills.tests.ts
3
8
  PASS src/configs/util/__tests__/apply-overrides.tests.ts
4
9
  PASS src/configs/app-configs/__tests__/update-with-env.tests.ts
@@ -84,8 +89,8 @@ PASS src/configs/app-configs/__tests__/validate-settings-keys.tests.ts
84
89
  at Object.<anonymous> (src/configs/app-configs/__tests__/validate-settings-keys.tests.ts:15:29)
85
90
 
86
91
 
87
- Test Suites: 6 passed, 6 total
88
- Tests: 17 passed, 17 total
92
+ Test Suites: 7 passed, 7 total
93
+ Tests: 21 passed, 21 total
89
94
  Snapshots: 0 total
90
- Time: 47.455 s
95
+ Time: 49.897 s
91
96
  Ran all test suites.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
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
+ ## 15.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#143](https://github.com/core-ds/arui-scripts/pull/143) [`1d94d1f`](https://github.com/core-ds/arui-scripts/commit/1d94d1fd57c1899966624b497c3506e0c818410e) Thanks [@Echzio](https://github.com/Echzio)! - добавление findPlugin хелпера для overrides-файла
8
+
9
+ ## 15.8.2
10
+
11
+ ### Patch Changes
12
+
13
+ - [#137](https://github.com/core-ds/arui-scripts/pull/137) [`6aa87a0`](https://github.com/core-ds/arui-scripts/commit/6aa87a046e7307847c55b95ed3bc7ba061b2de41) Thanks [@dependabot](https://github.com/apps/dependabot)! - Обновлен postcss для исправления уязвимостей
14
+
3
15
  ## 15.8.1
4
16
 
5
17
  ### Patch Changes
@@ -3,6 +3,7 @@ import type { Configuration as WebpackDevServerConfiguration } from 'webpack-dev
3
3
  import { AppContextWithConfigs } from '../app-configs/types';
4
4
  import { createSingleClientWebpackConfig } from '../webpack.client';
5
5
  import { findLoader } from './find-loader';
6
+ import { findPlugin } from './find-plugin';
6
7
  type Overrides = {
7
8
  webpack: WebpackConfiguration | WebpackConfiguration[];
8
9
  webpackClient: WebpackConfiguration | WebpackConfiguration[];
@@ -33,6 +34,11 @@ type BoundCreateSingleClientWebpackConfig = OmitFirstArg<typeof createSingleClie
33
34
  type ClientWebpackAdditionalArgs = {
34
35
  createSingleClientWebpackConfig: BoundCreateSingleClientWebpackConfig;
35
36
  findLoader: typeof findLoader;
37
+ findPlugin: ReturnType<typeof findPlugin<'client'>>;
38
+ };
39
+ type ServerWebpackAdditionalArgs = {
40
+ findLoader: typeof findLoader;
41
+ findPlugin: ReturnType<typeof findPlugin<'server'>>;
36
42
  };
37
43
  /**
38
44
  * Дополнительные аргументы, которые будут переданы в функцию оверрайда
@@ -42,6 +48,8 @@ type OverridesAdditionalArgs = {
42
48
  webpackClient: ClientWebpackAdditionalArgs;
43
49
  webpackDev: ClientWebpackAdditionalArgs;
44
50
  webpackClientDev: ClientWebpackAdditionalArgs;
51
+ webpackServer: ServerWebpackAdditionalArgs;
52
+ webpackServerDev: ServerWebpackAdditionalArgs;
45
53
  };
46
54
  type OverrideFunction<K extends keyof Overrides, AdditionalArgs = K extends keyof OverridesAdditionalArgs ? OverridesAdditionalArgs[K] : undefined> = (config: Overrides[K], appConfig: AppContextWithConfigs, additionalArgs: AdditionalArgs) => Overrides[K];
47
55
  export type OverrideFile = {
@@ -0,0 +1,83 @@
1
+ /// <reference types="node" />
2
+ import { Cluster } from 'cluster';
3
+ import { ReactRefreshPluginOptions } from '@pmmmwh/react-refresh-webpack-plugin/types/lib/types';
4
+ import AssetsPlugin from 'assets-webpack-plugin';
5
+ import CaseSensitivePathsPlugin from 'case-sensitive-paths-webpack-plugin';
6
+ import CompressionPlugin from 'compression-webpack-plugin';
7
+ import { ForkTsCheckerWebpackPluginOptions } from 'fork-ts-checker-webpack-plugin/lib/ForkTsCheckerWebpackPluginOptions';
8
+ import MiniCssExtractPlugin from 'mini-css-extract-plugin';
9
+ import { RunScriptWebpackPlugin } from 'run-script-webpack-plugin';
10
+ import webpack from 'webpack';
11
+ import { WebpackDeduplicationPlugin } from 'webpack-deduplication-plugin';
12
+ import { WebpackManifestPlugin } from 'webpack-manifest-plugin';
13
+ type PluginsListClient = {
14
+ AssetsWebpackPlugin: {
15
+ options: AssetsPlugin.Options;
16
+ };
17
+ DefinePlugin: {
18
+ definitions: ConstructorParameters<typeof webpack.DefinePlugin>[number];
19
+ };
20
+ MiniCssExtractPlugin: {
21
+ options: MiniCssExtractPlugin.PluginOptions;
22
+ runtimeOptions: MiniCssExtractPlugin.RuntimeOptions;
23
+ };
24
+ ForkTsCheckerWebpackPlugin: {
25
+ options: ForkTsCheckerWebpackPluginOptions;
26
+ };
27
+ IgnorePlugin: {
28
+ options: {
29
+ contextRegExp?: RegExp;
30
+ resourceRegExp: RegExp;
31
+ } | {
32
+ checkResource: (resource: string, context: string) => boolean;
33
+ };
34
+ checkIgnore: (resolveData: webpack.ResolveData) => undefined | false;
35
+ };
36
+ WebpackDeduplicationPlugin: WebpackDeduplicationPlugin;
37
+ ReactRefreshPlugin: {
38
+ options: ReactRefreshPluginOptions;
39
+ };
40
+ CaseSensitivePathsPlugin: {
41
+ options: CaseSensitivePathsPlugin.Options;
42
+ logger: {
43
+ [K in keyof Console]: Console[K];
44
+ };
45
+ };
46
+ WebpackManifestPlugin: {
47
+ options: ConstructorParameters<typeof WebpackManifestPlugin>[number];
48
+ };
49
+ CompressionPlugin: {
50
+ options: ConstructorParameters<typeof CompressionPlugin>[number];
51
+ };
52
+ NormalModuleReplacementPlugin: webpack.NormalModuleReplacementPlugin;
53
+ };
54
+ type PluginsListServer = {
55
+ BannerPlugin: {
56
+ options: webpack.BannerPlugin['options'];
57
+ };
58
+ RunScriptWebpackPlugin: {
59
+ options: ConstructorParameters<typeof RunScriptWebpackPlugin>[number];
60
+ };
61
+ ReloadServerPlugin: {
62
+ done: (...props: unknown[]) => unknown | null;
63
+ workers: Array<Cluster['Worker']>;
64
+ };
65
+ CaseSensitivePathsPlugin: {
66
+ options: CaseSensitivePathsPlugin.Options;
67
+ logger: {
68
+ [K in keyof Console]: Console[K];
69
+ };
70
+ };
71
+ WatchMissingNodeModulesPlugin: {
72
+ nodeModulesPath: string;
73
+ };
74
+ };
75
+ type SelectedPluginsList<Type extends 'client' | 'server'> = Type extends 'client' ? PluginsListClient : PluginsListServer;
76
+ /**
77
+ *
78
+ * @param config конфигурация webpack
79
+ * @param pluginName имя плагина
80
+ * @returns плагин или плагины, которые подошли под условие из testRule
81
+ */
82
+ export declare function findPlugin<Type extends 'client' | 'server'>(): <PluginName extends keyof SelectedPluginsList<Type>>(config: webpack.Configuration, pluginName: PluginName) => SelectedPluginsList<Type>[PluginName][];
83
+ export {};
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findPlugin = void 0;
4
+ /**
5
+ *
6
+ * @param config конфигурация webpack
7
+ * @param pluginName имя плагина
8
+ * @returns плагин или плагины, которые подошли под условие из testRule
9
+ */
10
+ function findPlugin() {
11
+ return (config, pluginName) => {
12
+ if (!config.plugins || !pluginName)
13
+ return [];
14
+ const result = [];
15
+ for (const plugin of config.plugins) {
16
+ if ((plugin === null || plugin === void 0 ? void 0 : plugin.constructor.name) === pluginName) {
17
+ result.push(plugin);
18
+ }
19
+ }
20
+ return result;
21
+ };
22
+ }
23
+ exports.findPlugin = findPlugin;
@@ -5,9 +5,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const apply_overrides_1 = __importDefault(require("./util/apply-overrides"));
7
7
  const find_loader_1 = require("./util/find-loader");
8
+ const find_plugin_1 = require("./util/find-plugin");
8
9
  const webpack_client_1 = require("./webpack.client");
9
10
  const config = (0, apply_overrides_1.default)(['webpack', 'webpackClient', 'webpackDev', 'webpackClientDev'], (0, webpack_client_1.createClientWebpackConfig)('dev'), {
10
11
  createSingleClientWebpackConfig: webpack_client_1.createSingleClientWebpackConfig.bind(null, 'dev'),
11
12
  findLoader: find_loader_1.findLoader,
13
+ findPlugin: (0, find_plugin_1.findPlugin)(),
12
14
  });
13
15
  exports.default = config;
@@ -5,9 +5,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const apply_overrides_1 = __importDefault(require("./util/apply-overrides"));
7
7
  const find_loader_1 = require("./util/find-loader");
8
+ const find_plugin_1 = require("./util/find-plugin");
8
9
  const webpack_client_1 = require("./webpack.client");
9
10
  const config = (0, apply_overrides_1.default)(['webpack', 'webpackClient', 'webpackProd', 'webpackClientProd'], (0, webpack_client_1.createClientWebpackConfig)('prod'), {
10
11
  createSingleClientWebpackConfig: webpack_client_1.createSingleClientWebpackConfig.bind(null, 'prod'),
11
12
  findLoader: find_loader_1.findLoader,
13
+ findPlugin: (0, find_plugin_1.findPlugin)(),
12
14
  });
13
15
  exports.default = config;
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const apply_overrides_1 = __importDefault(require("./util/apply-overrides"));
7
7
  const find_loader_1 = require("./util/find-loader");
8
+ const find_plugin_1 = require("./util/find-plugin");
8
9
  const webpack_server_1 = require("./webpack.server");
9
- const config = (0, apply_overrides_1.default)(['webpack', 'webpackServer', 'webpackDev', 'webpackServerDev'], (0, webpack_server_1.createServerConfig)('dev'), { findLoader: find_loader_1.findLoader });
10
+ const config = (0, apply_overrides_1.default)(['webpack', 'webpackServer', 'webpackDev', 'webpackServerDev'], (0, webpack_server_1.createServerConfig)('dev'), { findLoader: find_loader_1.findLoader, findPlugin: (0, find_plugin_1.findPlugin)() });
10
11
  exports.default = config;
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const apply_overrides_1 = __importDefault(require("./util/apply-overrides"));
7
7
  const find_loader_1 = require("./util/find-loader");
8
+ const find_plugin_1 = require("./util/find-plugin");
8
9
  const webpack_server_1 = require("./webpack.server");
9
- const config = (0, apply_overrides_1.default)(['webpack', 'webpackServer', 'webpackProd', 'webpackServerProd'], (0, webpack_server_1.createServerConfig)('prod'), { findLoader: find_loader_1.findLoader });
10
+ const config = (0, apply_overrides_1.default)(['webpack', 'webpackServer', 'webpackProd', 'webpackServerProd'], (0, webpack_server_1.createServerConfig)('prod'), { findLoader: find_loader_1.findLoader, findPlugin: (0, find_plugin_1.findPlugin)() });
10
11
  exports.default = config;