arui-scripts 15.8.0 → 15.8.2

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 (75) hide show
  1. package/.eslintignore +2 -0
  2. package/.eslintrc.js +13 -0
  3. package/.turbo/turbo-lint.log +260 -0
  4. package/.turbo/turbo-test.log +26 -26
  5. package/CHANGELOG.md +317 -305
  6. package/build/bin/index.js +9 -1
  7. package/build/commands/archive-build/index.js +4 -4
  8. package/build/commands/build/build-wrapper.js +3 -2
  9. package/build/commands/build/index.js +3 -5
  10. package/build/commands/bundle-analyze/index.js +5 -3
  11. package/build/commands/changelog/index.js +4 -2
  12. package/build/commands/docker-build/index.js +1 -1
  13. package/build/commands/docker-build-compiled/index.js +1 -1
  14. package/build/commands/start/index.js +8 -13
  15. package/build/commands/start/print-compiler-output.js +2 -1
  16. package/build/commands/start-prod/index.js +3 -5
  17. package/build/commands/test/index.js +10 -1
  18. package/build/commands/util/check-required-files.js +12 -8
  19. package/build/commands/util/client-assets-sizes.js +17 -22
  20. package/build/commands/util/docker-build.d.ts +1 -1
  21. package/build/commands/util/docker-build.js +12 -7
  22. package/build/commands/util/exec.js +2 -0
  23. package/build/commands/util/format-webpack-messages.js +9 -7
  24. package/build/commands/util/make-tmp-dir.js +3 -3
  25. package/build/commands/util/run-client-dev-server.js +1 -1
  26. package/build/commands/util/run-compilers.d.ts +1 -1
  27. package/build/commands/util/run-compilers.js +11 -11
  28. package/build/commands/util/run-server-watch-compiler.js +2 -3
  29. package/build/commands/util/yarn.js +1 -1
  30. package/build/configs/app-configs/calculate-dependent-config.js +2 -0
  31. package/build/configs/app-configs/get-defaults.js +4 -2
  32. package/build/configs/app-configs/index.d.ts +1 -1
  33. package/build/configs/app-configs/index.js +3 -3
  34. package/build/configs/app-configs/read-config-file.d.ts +1 -0
  35. package/build/configs/app-configs/read-config-file.js +25 -0
  36. package/build/configs/app-configs/types.d.ts +1 -1
  37. package/build/configs/app-configs/update-with-config-file.js +4 -10
  38. package/build/configs/app-configs/update-with-env.js +1 -1
  39. package/build/configs/app-configs/update-with-presets.js +11 -3
  40. package/build/configs/babel-client.js +21 -15
  41. package/build/configs/babel-dependencies.js +3 -3
  42. package/build/configs/babel-server.js +10 -10
  43. package/build/configs/config-extras/minimizers/imagemin/imagemin.d.ts +1 -1
  44. package/build/configs/config-extras/minimizers/imagemin/imagemin.js +23 -14
  45. package/build/configs/dev-server.js +20 -18
  46. package/build/configs/jest/babel-transform.js +2 -0
  47. package/build/configs/jest/file-transform.js +2 -0
  48. package/build/configs/jest/index.js +13 -13
  49. package/build/configs/modules.js +11 -4
  50. package/build/configs/mq.css +18 -18
  51. package/build/configs/postcss.config.js +3 -6
  52. package/build/configs/process-assets-plugin-output.js +1 -1
  53. package/build/configs/stats-options.js +1 -1
  54. package/build/configs/supporting-browsers.js +1 -6
  55. package/build/configs/util/apply-overrides.d.ts +2 -2
  56. package/build/configs/util/apply-overrides.js +7 -2
  57. package/build/configs/util/find-loader.d.ts +1 -1
  58. package/build/configs/util/find-loader.js +2 -0
  59. package/build/configs/util/install-sourcemap-support.js +4 -0
  60. package/build/configs/util/node-assets-ignore.js +8 -6
  61. package/build/configs/util/register-ts-node.js +3 -2
  62. package/build/configs/webpack.client.js +131 -95
  63. package/build/configs/webpack.server.js +74 -54
  64. package/build/plugins/postcss-prefix-selector.js +5 -3
  65. package/build/plugins/reload-server-webpack-plugin.js +8 -6
  66. package/build/plugins/watch-missing-node-modules-plugin.js +3 -3
  67. package/build/templates/dockerfile-compiled.template.js +4 -2
  68. package/build/templates/dockerfile.template.js +2 -2
  69. package/build/tsconfig-local.tsbuildinfo +1 -1
  70. package/docs/modules.md +429 -358
  71. package/jest-preset.js +8 -8
  72. package/package.json +12 -3
  73. package/release.config.js +8 -2
  74. package/stylelint.config.js +11 -0
  75. package/tsconfig.eslint.json +5 -0
@@ -4,20 +4,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.createServerConfig = void 0;
7
+ // TODO: remove eslint-disable
8
+ /* eslint-disable @typescript-eslint/no-var-requires */
7
9
  const fs_1 = __importDefault(require("fs"));
8
10
  const path_1 = __importDefault(require("path"));
11
+ const getCSSModuleLocalIdent_1 = __importDefault(require("react-dev-utils/getCSSModuleLocalIdent"));
12
+ const case_sensitive_paths_webpack_plugin_1 = __importDefault(require("case-sensitive-paths-webpack-plugin"));
13
+ const run_script_webpack_plugin_1 = require("run-script-webpack-plugin");
14
+ const tsconfig_paths_webpack_plugin_1 = __importDefault(require("tsconfig-paths-webpack-plugin"));
9
15
  const webpack_1 = __importDefault(require("webpack"));
10
16
  const webpack_node_externals_1 = __importDefault(require("webpack-node-externals"));
11
- const tsconfig_paths_webpack_plugin_1 = __importDefault(require("tsconfig-paths-webpack-plugin"));
12
- const getCSSModuleLocalIdent_1 = __importDefault(require("react-dev-utils/getCSSModuleLocalIdent"));
17
+ const get_entry_1 = __importDefault(require("./util/get-entry"));
13
18
  const app_configs_1 = __importDefault(require("./app-configs"));
19
+ const babel_dependencies_1 = require("./babel-dependencies");
14
20
  const babel_server_1 = __importDefault(require("./babel-server"));
15
21
  const postcss_1 = __importDefault(require("./postcss"));
16
- const get_entry_1 = __importDefault(require("./util/get-entry"));
17
- const babel_dependencies_1 = require("./babel-dependencies");
18
22
  const server_externals_exemptions_1 = require("./server-externals-exemptions");
19
- const run_script_webpack_plugin_1 = require("run-script-webpack-plugin");
20
- const case_sensitive_paths_webpack_plugin_1 = __importDefault(require("case-sensitive-paths-webpack-plugin"));
21
23
  const ReloadServerPlugin = require('../plugins/reload-server-webpack-plugin');
22
24
  const WatchMissingNodeModulesPlugin = require('../plugins/watch-missing-node-modules-plugin');
23
25
  const assetsIgnoreBanner = fs_1.default.readFileSync(require.resolve('./util/node-assets-ignore'), 'utf8');
@@ -26,7 +28,9 @@ const sourceMapSupportBanner = fs_1.default.readFileSync(require.resolve('./util
26
28
  const cssRegex = /\.css$/;
27
29
  const cssModuleRegex = /\.module\.css$/;
28
30
  function getSingleEntry(entryPoint, mode) {
29
- const prefix = (mode === 'dev' && app_configs_1.default.useServerHMR) ? [`${require.resolve('webpack/hot/poll')}?1000`] : [];
31
+ const prefix = mode === 'dev' && app_configs_1.default.useServerHMR
32
+ ? [`${require.resolve('webpack/hot/poll')}?1000`]
33
+ : [];
30
34
  return [...prefix, ...entryPoint];
31
35
  }
32
36
  // This is a function that wil return webpack configuration to build a server
@@ -38,7 +42,7 @@ const createServerConfig = (mode) => ({
38
42
  target: 'node',
39
43
  node: {
40
44
  __filename: true,
41
- __dirname: true
45
+ __dirname: true,
42
46
  },
43
47
  entry: (0, get_entry_1.default)(app_configs_1.default.serverEntry, getSingleEntry, mode),
44
48
  context: app_configs_1.default.cwd,
@@ -51,24 +55,26 @@ const createServerConfig = (mode) => ({
51
55
  filename: app_configs_1.default.serverOutput,
52
56
  chunkFilename: '[name].js',
53
57
  // Point sourcemap entries to original disk location (format as URL on Windows)
54
- devtoolModuleFilenameTemplate: (info) => path_1.default
55
- .relative(app_configs_1.default.appSrc, info.absoluteResourcePath)
56
- .replace(/\\/g, '/'),
58
+ devtoolModuleFilenameTemplate: (info) => path_1.default.relative(app_configs_1.default.appSrc, info.absoluteResourcePath).replace(/\\/g, '/'),
57
59
  },
58
- cache: mode === 'dev' ? {
59
- type: 'filesystem',
60
- name: 'server',
61
- buildDependencies: {
62
- config: [__filename],
63
- },
64
- } : false,
60
+ cache: mode === 'dev'
61
+ ? {
62
+ type: 'filesystem',
63
+ name: 'server',
64
+ buildDependencies: {
65
+ config: [__filename],
66
+ },
67
+ }
68
+ : false,
65
69
  externalsPresets: { node: true },
66
- externals: [(0, webpack_node_externals_1.default)({
70
+ externals: [
71
+ (0, webpack_node_externals_1.default)({
67
72
  allowlist: server_externals_exemptions_1.serverExternalsExemptions,
68
73
  // we cannot determine node_modules location before arui-scripts installation, so just load
69
74
  // dependencies list from package.json
70
75
  modulesFromFile: true,
71
- })],
76
+ }),
77
+ ],
72
78
  optimization: {
73
79
  minimize: false,
74
80
  nodeEnv: mode === 'dev' ? false : 'production',
@@ -86,12 +92,22 @@ const createServerConfig = (mode) => ({
86
92
  // `web` extension prefixes have been added for better support
87
93
  // for React Native Web.
88
94
  extensions: ['.web.js', '.mjs', '.js', '.json', '.web.jsx', '.jsx', '.ts', '.tsx'],
89
- plugins: ([
90
- (app_configs_1.default.tsconfig && new tsconfig_paths_webpack_plugin_1.default({
91
- configFile: app_configs_1.default.tsconfig,
92
- extensions: ['.web.js', '.mjs', '.js', '.json', '.web.jsx', '.jsx', '.ts', '.tsx']
93
- }))
94
- ].filter(Boolean)),
95
+ plugins: [
96
+ app_configs_1.default.tsconfig &&
97
+ new tsconfig_paths_webpack_plugin_1.default({
98
+ configFile: app_configs_1.default.tsconfig,
99
+ extensions: [
100
+ '.web.js',
101
+ '.mjs',
102
+ '.js',
103
+ '.json',
104
+ '.web.jsx',
105
+ '.jsx',
106
+ '.ts',
107
+ '.tsx',
108
+ ],
109
+ }),
110
+ ].filter(Boolean),
95
111
  },
96
112
  module: {
97
113
  // typescript interface will be removed from modules, and we will get an error on correct code
@@ -99,7 +115,7 @@ const createServerConfig = (mode) => ({
99
115
  strictExportPresence: !app_configs_1.default.tsconfig,
100
116
  rules: [
101
117
  {
102
- oneOf: ([
118
+ oneOf: [
103
119
  // Process JS with Babel.
104
120
  {
105
121
  test: app_configs_1.default.useTscLoader ? /\.(js|jsx|mjs)$/ : /\.(js|jsx|mjs|ts|tsx)$/,
@@ -111,17 +127,17 @@ const createServerConfig = (mode) => ({
111
127
  // directory for faster rebuilds.
112
128
  cacheDirectory: mode === 'dev' }),
113
129
  },
114
- (app_configs_1.default.tsconfig && app_configs_1.default.useTscLoader) && {
130
+ app_configs_1.default.tsconfig &&
131
+ app_configs_1.default.useTscLoader && {
115
132
  test: /\.tsx?$/,
116
133
  use: [
117
134
  {
118
135
  loader: require.resolve('babel-loader'),
119
- options: Object.assign({
136
+ options: Object.assign({
120
137
  // This is a feature of `babel-loader` for webpack (not Babel itself).
121
138
  // It enables caching results in ./node_modules/.cache/babel-loader/
122
139
  // directory for faster rebuilds.
123
- cacheDirectory: mode === 'dev'
124
- }, babel_server_1.default)
140
+ cacheDirectory: mode === 'dev' }, babel_server_1.default),
125
141
  },
126
142
  {
127
143
  loader: require.resolve('ts-loader'),
@@ -129,10 +145,10 @@ const createServerConfig = (mode) => ({
129
145
  onlyCompileBundledFiles: true,
130
146
  transpileOnly: true,
131
147
  happyPackMode: true,
132
- configFile: app_configs_1.default.tsconfig
133
- }
134
- }
135
- ]
148
+ configFile: app_configs_1.default.tsconfig,
149
+ },
150
+ },
151
+ ],
136
152
  },
137
153
  // Process any JS outside of the app with Babel.
138
154
  // Unlike the application JS, we only compile the standard ES features.
@@ -146,7 +162,7 @@ const createServerConfig = (mode) => ({
146
162
  {
147
163
  test: cssRegex,
148
164
  exclude: cssModuleRegex,
149
- loader: require.resolve('null-loader')
165
+ loader: require.resolve('null-loader'),
150
166
  },
151
167
  {
152
168
  test: cssModuleRegex,
@@ -156,7 +172,7 @@ const createServerConfig = (mode) => ({
156
172
  options: {
157
173
  modules: {
158
174
  exportOnlyLocals: true,
159
- getLocalIdent: getCSSModuleLocalIdent_1.default
175
+ getLocalIdent: getCSSModuleLocalIdent_1.default,
160
176
  },
161
177
  },
162
178
  },
@@ -165,7 +181,7 @@ const createServerConfig = (mode) => ({
165
181
  options: {
166
182
  postcssOptions: {
167
183
  plugins: postcss_1.default,
168
- }
184
+ },
169
185
  },
170
186
  },
171
187
  ],
@@ -176,29 +192,33 @@ const createServerConfig = (mode) => ({
176
192
  generator: {
177
193
  outputPath: app_configs_1.default.publicPath,
178
194
  publicPath: app_configs_1.default.publicPath,
179
- }
195
+ },
180
196
  },
181
- ].filter(Boolean)),
197
+ ].filter(Boolean),
182
198
  },
183
199
  ],
184
200
  },
185
- plugins: ([
201
+ plugins: [
186
202
  new webpack_1.default.BannerPlugin({
187
203
  banner: assetsIgnoreBanner,
188
204
  raw: true,
189
- entryOnly: false
190
- }),
191
- app_configs_1.default.installServerSourceMaps && new webpack_1.default.BannerPlugin({
192
- banner: sourceMapSupportBanner,
193
- raw: true,
194
- entryOnly: false
205
+ entryOnly: false,
195
206
  }),
207
+ app_configs_1.default.installServerSourceMaps &&
208
+ new webpack_1.default.BannerPlugin({
209
+ banner: sourceMapSupportBanner,
210
+ raw: true,
211
+ entryOnly: false,
212
+ }),
196
213
  // dev plugins:
197
- mode === 'dev' && (app_configs_1.default.useServerHMR
198
- ? new run_script_webpack_plugin_1.RunScriptWebpackPlugin({
199
- name: app_configs_1.default.serverOutput
200
- })
201
- : new ReloadServerPlugin({ script: path_1.default.join(app_configs_1.default.serverOutputPath, app_configs_1.default.serverOutput) })),
214
+ mode === 'dev' &&
215
+ (app_configs_1.default.useServerHMR
216
+ ? new run_script_webpack_plugin_1.RunScriptWebpackPlugin({
217
+ name: app_configs_1.default.serverOutput,
218
+ })
219
+ : new ReloadServerPlugin({
220
+ script: path_1.default.join(app_configs_1.default.serverOutputPath, app_configs_1.default.serverOutput),
221
+ })),
202
222
  mode === 'dev' && new webpack_1.default.NoEmitOnErrorsPlugin(),
203
223
  // Watcher doesn't work well if you mistype casing in a path so we use
204
224
  // a plugin that prints an error when you attempt to do this.
@@ -209,8 +229,8 @@ const createServerConfig = (mode) => ({
209
229
  // makes the discovery automatic so you don't have to restart.
210
230
  // See https://github.com/facebookincubator/create-react-app/issues/186
211
231
  mode === 'dev' && new WatchMissingNodeModulesPlugin(app_configs_1.default.appNodeModules),
212
- mode === 'dev' && app_configs_1.default.useServerHMR && new webpack_1.default.HotModuleReplacementPlugin()
213
- ].filter(Boolean)),
232
+ mode === 'dev' && app_configs_1.default.useServerHMR && new webpack_1.default.HotModuleReplacementPlugin(),
233
+ ].filter(Boolean),
214
234
  experiments: {
215
235
  backCompat: app_configs_1.default.webpack4Compatibility,
216
236
  },
@@ -4,7 +4,7 @@ exports.postCssPrefix = void 0;
4
4
  const VisitedRule = Symbol('VisitedRule');
5
5
  const postCssPrefix = (options) => {
6
6
  const prefix = (options === null || options === void 0 ? void 0 : options.prefix) || '.prefix ';
7
- return ({
7
+ return {
8
8
  postcssPlugin: '@alfalab/postcss-prefix-selector',
9
9
  RootExit(root) {
10
10
  if (root[VisitedRule]) {
@@ -12,7 +12,9 @@ const postCssPrefix = (options) => {
12
12
  }
13
13
  root[VisitedRule] = true;
14
14
  root.walkRules((rule) => {
15
- if (!rule.parent || rule.parent.type !== 'root' && (rule.parent.type !== 'atrule' || rule.parent.name !== 'media')) {
15
+ if (!rule.parent ||
16
+ (rule.parent.type !== 'root' &&
17
+ (rule.parent.type !== 'atrule' || rule.parent.name !== 'media'))) {
16
18
  return;
17
19
  }
18
20
  rule.selectors = rule.selectors.map((selector, index) => {
@@ -23,7 +25,7 @@ const postCssPrefix = (options) => {
23
25
  });
24
26
  });
25
27
  },
26
- });
28
+ };
27
29
  };
28
30
  exports.postCssPrefix = postCssPrefix;
29
31
  postCssPrefix.postcss = true;
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
- const cluster = require("cluster");
3
- const path = require("path");
2
+ // TODO: remove eslint-disable
3
+ /* eslint-disable @typescript-eslint/no-var-requires */
4
+ const cluster = require('cluster');
5
+ const path = require('path');
4
6
  const defaultOptions = {
5
- script: "server.js",
7
+ script: 'server.js',
6
8
  };
7
9
  module.exports = class ReloadServerPlugin {
8
10
  constructor({ script } = defaultOptions) {
@@ -11,7 +13,7 @@ module.exports = class ReloadServerPlugin {
11
13
  cluster.setupMaster({
12
14
  exec: path.resolve(process.cwd(), script),
13
15
  });
14
- cluster.on("online", (worker) => {
16
+ cluster.on('online', (worker) => {
15
17
  this.workers.push(worker);
16
18
  if (this.done) {
17
19
  this.done();
@@ -23,7 +25,7 @@ module.exports = class ReloadServerPlugin {
23
25
  this.done = callback;
24
26
  this.workers.forEach((worker) => {
25
27
  try {
26
- process.kill(worker.process.pid, "SIGTERM");
28
+ process.kill(worker.process.pid, 'SIGTERM');
27
29
  }
28
30
  catch (e) {
29
31
  console.warn(`Unable to kill process #${worker.process.pid}`);
@@ -36,7 +38,7 @@ module.exports = class ReloadServerPlugin {
36
38
  compiler.hooks.afterEmit.tapAsync('ReloadServerPlugin', afterEmit);
37
39
  }
38
40
  else {
39
- compiler.plugin("after-emit", afterEmit);
41
+ compiler.plugin('after-emit', afterEmit);
40
42
  }
41
43
  }
42
44
  };
@@ -4,9 +4,9 @@ class WatchMissingNodeModulesPlugin {
4
4
  this.nodeModulesPath = nodeModulesPath;
5
5
  }
6
6
  apply(compiler) {
7
- compiler.hooks.emit.tap("WatchMissingNodeModulesPlugin", (compilation) => {
8
- var missingDeps = Array.from(compilation.missingDependencies);
9
- var nodeModulesPath = this.nodeModulesPath;
7
+ compiler.hooks.emit.tap('WatchMissingNodeModulesPlugin', (compilation) => {
8
+ const missingDeps = Array.from(compilation.missingDependencies);
9
+ const { nodeModulesPath } = this;
10
10
  // If any missing files are expected to appear in node_modules...
11
11
  if (missingDeps.some((file) => file.includes(nodeModulesPath))) {
12
12
  // ...tell webpack to watch node_modules recursively until they appear.
@@ -3,9 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ const yarn_1 = require("../commands/util/yarn");
6
7
  const app_configs_1 = __importDefault(require("../configs/app-configs"));
7
8
  const apply_overrides_1 = __importDefault(require("../configs/util/apply-overrides"));
8
- const yarn_1 = require("../commands/util/yarn");
9
9
  const installProductionCommand = (0, yarn_1.getInstallProductionCommand)();
10
10
  const yarnVersion = (0, yarn_1.getYarnVersion)();
11
11
  // В зависимости от используемого мендежера зависимостей для их установки нужно копировать разный набор файлов
@@ -28,7 +28,9 @@ ADD $START_SH_LOCATION /src/start.sh
28
28
  ADD $NGINX_CONF_LOCATION /src/nginx.conf
29
29
 
30
30
  # Зависимости. При некоторой удаче могут кешироваться и соответственно кешировать установку зависимостей
31
- ${filesRequiredToInstallDependencies.map((file) => `ADD --chown=nginx:nginx ${file} /src/${file}`).join('\n')}
31
+ ${filesRequiredToInstallDependencies
32
+ .map((file) => `ADD --chown=nginx:nginx ${file} /src/${file}`)
33
+ .join('\n')}
32
34
 
33
35
  RUN ${installProductionCommand} && \\
34
36
  ${yarnVersion === 'unavailable' ? 'npm cache clean --force' : 'yarn cache clean'}
@@ -5,8 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const app_configs_1 = __importDefault(require("../configs/app-configs"));
7
7
  const apply_overrides_1 = __importDefault(require("../configs/util/apply-overrides"));
8
- const nginxNonRootPart = app_configs_1.default.runFromNonRootUser ?
9
- `RUN chown -R nginx:nginx /src && \\
8
+ const nginxNonRootPart = app_configs_1.default.runFromNonRootUser
9
+ ? `RUN chown -R nginx:nginx /src && \\
10
10
  mkdir -p /var/lib/nginx && \\
11
11
  chown -R nginx:nginx /var/lib/nginx && \\
12
12
  chown -R nginx:nginx /var/log/nginx && \\