arui-scripts 15.8.0 → 15.8.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.
- package/.eslintignore +2 -0
- package/.eslintrc.js +13 -0
- package/.turbo/turbo-lint.log +260 -0
- package/.turbo/turbo-test.log +26 -26
- package/CHANGELOG.md +311 -305
- package/build/bin/index.js +9 -1
- package/build/commands/archive-build/index.js +4 -4
- package/build/commands/build/build-wrapper.js +3 -2
- package/build/commands/build/index.js +3 -5
- package/build/commands/bundle-analyze/index.js +5 -3
- package/build/commands/changelog/index.js +4 -2
- package/build/commands/docker-build/index.js +1 -1
- package/build/commands/docker-build-compiled/index.js +1 -1
- package/build/commands/start/index.js +8 -13
- package/build/commands/start/print-compiler-output.js +2 -1
- package/build/commands/start-prod/index.js +3 -5
- package/build/commands/test/index.js +10 -1
- package/build/commands/util/check-required-files.js +12 -8
- package/build/commands/util/client-assets-sizes.js +17 -22
- package/build/commands/util/docker-build.d.ts +1 -1
- package/build/commands/util/docker-build.js +12 -7
- package/build/commands/util/exec.js +2 -0
- package/build/commands/util/format-webpack-messages.js +9 -7
- package/build/commands/util/make-tmp-dir.js +3 -3
- package/build/commands/util/run-client-dev-server.js +1 -1
- package/build/commands/util/run-compilers.d.ts +1 -1
- package/build/commands/util/run-compilers.js +11 -11
- package/build/commands/util/run-server-watch-compiler.js +2 -3
- package/build/commands/util/yarn.js +1 -1
- package/build/configs/app-configs/calculate-dependent-config.js +2 -0
- package/build/configs/app-configs/get-defaults.js +4 -2
- package/build/configs/app-configs/index.d.ts +1 -1
- package/build/configs/app-configs/index.js +3 -3
- package/build/configs/app-configs/read-config-file.d.ts +1 -0
- package/build/configs/app-configs/read-config-file.js +25 -0
- package/build/configs/app-configs/types.d.ts +1 -1
- package/build/configs/app-configs/update-with-config-file.js +4 -10
- package/build/configs/app-configs/update-with-env.js +1 -1
- package/build/configs/app-configs/update-with-presets.js +11 -3
- package/build/configs/babel-client.js +21 -15
- package/build/configs/babel-dependencies.js +3 -3
- package/build/configs/babel-server.js +10 -10
- package/build/configs/config-extras/minimizers/imagemin/imagemin.d.ts +1 -1
- package/build/configs/config-extras/minimizers/imagemin/imagemin.js +23 -14
- package/build/configs/dev-server.js +20 -18
- package/build/configs/jest/babel-transform.js +2 -0
- package/build/configs/jest/file-transform.js +2 -0
- package/build/configs/jest/index.js +13 -13
- package/build/configs/modules.js +11 -4
- package/build/configs/mq.css +18 -18
- package/build/configs/postcss.config.js +3 -6
- package/build/configs/process-assets-plugin-output.js +1 -1
- package/build/configs/stats-options.js +1 -1
- package/build/configs/supporting-browsers.js +1 -6
- package/build/configs/util/apply-overrides.d.ts +2 -2
- package/build/configs/util/apply-overrides.js +7 -2
- package/build/configs/util/find-loader.d.ts +1 -1
- package/build/configs/util/find-loader.js +2 -0
- package/build/configs/util/install-sourcemap-support.js +4 -0
- package/build/configs/util/node-assets-ignore.js +8 -6
- package/build/configs/util/register-ts-node.js +3 -2
- package/build/configs/webpack.client.js +131 -95
- package/build/configs/webpack.server.js +74 -54
- package/build/plugins/postcss-prefix-selector.js +5 -3
- package/build/plugins/reload-server-webpack-plugin.js +8 -6
- package/build/plugins/watch-missing-node-modules-plugin.js +3 -3
- package/build/templates/dockerfile-compiled.template.js +4 -2
- package/build/templates/dockerfile.template.js +2 -2
- package/build/tsconfig-local.tsbuildinfo +1 -1
- package/jest-preset.js +8 -8
- package/package.json +12 -3
- package/release.config.js +8 -2
- package/stylelint.config.js +11 -0
- package/tsconfig.eslint.json +5 -0
|
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getInstallProductionCommand = exports.getPruningCommand = exports.getYarnVersion = void 0;
|
|
7
|
-
const app_configs_1 = __importDefault(require("../../configs/app-configs"));
|
|
8
7
|
const shelljs_1 = __importDefault(require("shelljs"));
|
|
8
|
+
const app_configs_1 = __importDefault(require("../../configs/app-configs"));
|
|
9
9
|
function getYarnVersion() {
|
|
10
10
|
if (app_configs_1.default.useYarn && shelljs_1.default.which('yarn')) {
|
|
11
11
|
const yarnVersion = shelljs_1.default.exec('yarn -v', { silent: true });
|
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.calculateDependentContext = exports.calculateDependentConfig = void 0;
|
|
7
|
+
// TODO: remove eslint-disable-next-line
|
|
7
8
|
const fs_1 = __importDefault(require("fs"));
|
|
8
9
|
const path_1 = __importDefault(require("path"));
|
|
9
10
|
const get_polyfills_1 = require("../util/get-polyfills");
|
|
@@ -30,6 +31,7 @@ function calculateDependentContext(config, context) {
|
|
|
30
31
|
babelRuntimeVersion = JSON.parse(fs_1.default.readFileSync(pathToProjectBabelRuntime, 'utf8')).version;
|
|
31
32
|
}
|
|
32
33
|
catch (e) {
|
|
34
|
+
// eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
|
|
33
35
|
babelRuntimeVersion = require('@babel/runtime/package.json').version;
|
|
34
36
|
}
|
|
35
37
|
return Object.assign(Object.assign({}, context), { publicPath: `${config.assetsPath}/`, serverOutputPath: path_1.default.resolve(context.cwd, config.buildPath), clientOutputPath: path_1.default.resolve(context.cwd, config.buildPath, config.assetsPath), statsOutputPath: path_1.default.resolve(context.cwd, config.buildPath, config.statsOutputFilename), watchIgnorePath: ['node_modules', config.buildPath], babelRuntimeVersion });
|
|
@@ -4,14 +4,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getDefaultAppContext = exports.getDefaultAppConfig = void 0;
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const resolve_1 = require("../util/resolve");
|
|
10
|
+
const read_config_file_1 = require("./read-config-file");
|
|
10
11
|
const CWD = process.cwd();
|
|
11
12
|
const absoluteSrcPath = path_1.default.resolve(CWD, 'src');
|
|
12
13
|
function getDefaultAppConfig() {
|
|
13
14
|
var _a;
|
|
14
15
|
const appPackage = getPackageJson();
|
|
16
|
+
const configFile = (0, read_config_file_1.readConfigFile)(CWD);
|
|
15
17
|
return {
|
|
16
18
|
/// general settings
|
|
17
19
|
clientServerPort: 8080,
|
|
@@ -20,7 +22,7 @@ function getDefaultAppConfig() {
|
|
|
20
22
|
devSourceMaps: 'eval',
|
|
21
23
|
devServerCors: false,
|
|
22
24
|
useServerHMR: false,
|
|
23
|
-
presets: ((_a = appPackage.aruiScripts) === null || _a === void 0 ? void 0 : _a.presets) || null,
|
|
25
|
+
presets: (configFile === null || configFile === void 0 ? void 0 : configFile.presets) || ((_a = appPackage === null || appPackage === void 0 ? void 0 : appPackage.aruiScripts) === null || _a === void 0 ? void 0 : _a.presets) || null,
|
|
24
26
|
proxy: appPackage.proxy || null,
|
|
25
27
|
// paths
|
|
26
28
|
buildPath: '.build',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import '../util/register-ts-node';
|
|
2
1
|
import { AppConfigs, AppContext, AppContextWithConfigs } from './types';
|
|
2
|
+
import '../util/register-ts-node';
|
|
3
3
|
export declare const appContext: AppContext;
|
|
4
4
|
export declare const appConfigs: AppConfigs;
|
|
5
5
|
export declare const configs: AppContextWithConfigs;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.configs = exports.appConfigs = exports.appContext = void 0;
|
|
4
|
-
require("
|
|
4
|
+
const calculate_dependent_config_1 = require("./calculate-dependent-config");
|
|
5
5
|
const get_defaults_1 = require("./get-defaults");
|
|
6
|
+
const update_with_config_file_1 = require("./update-with-config-file");
|
|
6
7
|
const update_with_env_1 = require("./update-with-env");
|
|
7
8
|
const update_with_package_1 = require("./update-with-package");
|
|
8
9
|
const update_with_presets_1 = require("./update-with-presets");
|
|
9
|
-
|
|
10
|
-
const update_with_config_file_1 = require("./update-with-config-file");
|
|
10
|
+
require("../util/register-ts-node");
|
|
11
11
|
let tmpConfig = (0, get_defaults_1.getDefaultAppConfig)();
|
|
12
12
|
let tmpContext = (0, get_defaults_1.getDefaultAppContext)();
|
|
13
13
|
tmpConfig = (0, update_with_presets_1.updateWithPresets)(tmpConfig, tmpContext);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function readConfigFile(cwd: string): any;
|
|
@@ -0,0 +1,25 @@
|
|
|
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.readConfigFile = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const resolve_1 = require("../util/resolve");
|
|
9
|
+
function readConfigFile(cwd) {
|
|
10
|
+
const appConfigPath = (0, resolve_1.tryResolve)(path_1.default.join(cwd, '/arui-scripts.config'));
|
|
11
|
+
if (appConfigPath) {
|
|
12
|
+
// Мы не можем использовать импорты, нам нужен именно require, потому что мы не знаем заранее не только путь до файла,
|
|
13
|
+
// но и то, на каком языке он написан
|
|
14
|
+
// eslint-disable-next-line import/no-dynamic-require, global-require, @typescript-eslint/no-var-requires
|
|
15
|
+
let appSettings = require(appConfigPath);
|
|
16
|
+
// ts-node импортирует esModules, из них надо вытягивать default именно так
|
|
17
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
18
|
+
if (appSettings.__esModule) {
|
|
19
|
+
appSettings = appSettings.default;
|
|
20
|
+
}
|
|
21
|
+
return appSettings;
|
|
22
|
+
}
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
exports.readConfigFile = readConfigFile;
|
|
@@ -4,19 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.updateWithConfigFile = void 0;
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
7
|
const lodash_merge_1 = __importDefault(require("lodash.merge"));
|
|
9
|
-
const
|
|
8
|
+
const read_config_file_1 = require("./read-config-file");
|
|
10
9
|
const validate_settings_keys_1 = require("./validate-settings-keys");
|
|
11
10
|
function updateWithConfigFile(config, context) {
|
|
12
|
-
const
|
|
13
|
-
if (
|
|
14
|
-
|
|
15
|
-
if (appSettings.__esModule) {
|
|
16
|
-
// ts-node импортирует esModules, из них надо вытягивать default именно так
|
|
17
|
-
appSettings = appSettings.default;
|
|
18
|
-
}
|
|
19
|
-
(0, validate_settings_keys_1.validateSettingsKeys)(config, appSettings, appConfigPath);
|
|
11
|
+
const appSettings = (0, read_config_file_1.readConfigFile)(context.cwd);
|
|
12
|
+
if (appSettings) {
|
|
13
|
+
(0, validate_settings_keys_1.validateSettingsKeys)(config, appSettings, context.cwd);
|
|
20
14
|
return (0, lodash_merge_1.default)(config, appSettings);
|
|
21
15
|
}
|
|
22
16
|
return config;
|
|
@@ -18,7 +18,7 @@ function updateWithEnv(config) {
|
|
|
18
18
|
}
|
|
19
19
|
catch (e) {
|
|
20
20
|
console.error(e);
|
|
21
|
-
throw Error('Not valid JSON passed. Correct it. For example: ARUI_SCRIPTS_CONFIG="{
|
|
21
|
+
throw Error('Not valid JSON passed. Correct it. For example: ARUI_SCRIPTS_CONFIG="{"serverPort":3333}"');
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
exports.updateWithEnv = updateWithEnv;
|
|
@@ -4,22 +4,30 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.updateWithPresets = void 0;
|
|
7
|
+
// TODO: remove eslint-disable-next-line
|
|
8
|
+
const lodash_merge_1 = __importDefault(require("lodash.merge"));
|
|
7
9
|
const resolve_1 = require("../util/resolve");
|
|
8
10
|
const validate_settings_keys_1 = require("./validate-settings-keys");
|
|
9
|
-
const lodash_merge_1 = __importDefault(require("lodash.merge"));
|
|
10
11
|
function updateWithPresets(config, context) {
|
|
11
12
|
if (!config.presets) {
|
|
12
13
|
return config;
|
|
13
14
|
}
|
|
14
|
-
const presetsConfigPath = (0, resolve_1.tryResolve)(`${config.presets}/arui-scripts.config`, {
|
|
15
|
-
|
|
15
|
+
const presetsConfigPath = (0, resolve_1.tryResolve)(`${config.presets}/arui-scripts.config`, {
|
|
16
|
+
paths: [context.cwd],
|
|
17
|
+
});
|
|
18
|
+
const presetsOverridesPath = (0, resolve_1.tryResolve)(`${config.presets}/arui-scripts.overrides`, {
|
|
19
|
+
paths: [context.cwd],
|
|
20
|
+
});
|
|
16
21
|
if (presetsConfigPath) {
|
|
22
|
+
// eslint-disable-next-line import/no-dynamic-require, @typescript-eslint/no-var-requires, global-require
|
|
17
23
|
let presetsSettings = require(presetsConfigPath);
|
|
24
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
18
25
|
if (presetsSettings.__esModule) {
|
|
19
26
|
// ts-node импортирует esModules, из них надо вытягивать default именно так
|
|
20
27
|
presetsSettings = presetsSettings.default;
|
|
21
28
|
}
|
|
22
29
|
(0, validate_settings_keys_1.validateSettingsKeys)(config, presetsSettings, presetsConfigPath);
|
|
30
|
+
// eslint-disable-next-line no-param-reassign
|
|
23
31
|
config = (0, lodash_merge_1.default)(config, presetsSettings);
|
|
24
32
|
}
|
|
25
33
|
if (presetsOverridesPath) {
|
|
@@ -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 supporting_browsers_1 = __importDefault(require("./supporting-browsers"));
|
|
7
|
-
const app_configs_1 = __importDefault(require("./app-configs"));
|
|
8
6
|
const apply_overrides_1 = __importDefault(require("./util/apply-overrides"));
|
|
7
|
+
const app_configs_1 = __importDefault(require("./app-configs"));
|
|
8
|
+
const supporting_browsers_1 = __importDefault(require("./supporting-browsers"));
|
|
9
9
|
const babelClientConfig = (0, apply_overrides_1.default)(['babel', 'babelClient'], {
|
|
10
10
|
presets: [
|
|
11
11
|
[
|
|
@@ -19,10 +19,12 @@ const babelClientConfig = (0, apply_overrides_1.default)(['babel', 'babelClient'
|
|
|
19
19
|
corejs: 3,
|
|
20
20
|
// Exclude transforms that make all code slower
|
|
21
21
|
exclude: ['transform-typeof-symbol'],
|
|
22
|
-
}
|
|
22
|
+
},
|
|
23
23
|
],
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
app_configs_1.default.tsconfig !== null &&
|
|
25
|
+
!app_configs_1.default.useTscLoader &&
|
|
26
|
+
require.resolve('@babel/preset-typescript'),
|
|
27
|
+
require.resolve('@babel/preset-react'),
|
|
26
28
|
].filter(Boolean),
|
|
27
29
|
plugins: [
|
|
28
30
|
require.resolve('@babel/plugin-syntax-dynamic-import'),
|
|
@@ -35,7 +37,9 @@ const babelClientConfig = (0, apply_overrides_1.default)(['babel', 'babelClient'
|
|
|
35
37
|
require.resolve('@babel/plugin-proposal-export-default-from'),
|
|
36
38
|
require.resolve('@babel/plugin-proposal-export-namespace-from'),
|
|
37
39
|
[require.resolve('@babel/plugin-proposal-object-rest-spread'), { useBuiltIns: true }],
|
|
38
|
-
[
|
|
40
|
+
[
|
|
41
|
+
require.resolve('@babel/plugin-transform-runtime'),
|
|
42
|
+
{
|
|
39
43
|
corejs: false,
|
|
40
44
|
helpers: true,
|
|
41
45
|
// By default, babel assumes babel/runtime version 7.0.0-beta.0,
|
|
@@ -43,23 +47,25 @@ const babelClientConfig = (0, apply_overrides_1.default)(['babel', 'babelClient'
|
|
|
43
47
|
// https://github.com/babel/babel/issues/10261
|
|
44
48
|
version: app_configs_1.default.babelRuntimeVersion,
|
|
45
49
|
regenerator: true,
|
|
46
|
-
}
|
|
50
|
+
},
|
|
51
|
+
],
|
|
47
52
|
require.resolve('@babel/plugin-proposal-nullish-coalescing-operator'),
|
|
48
|
-
require.resolve('@babel/plugin-proposal-optional-chaining')
|
|
53
|
+
require.resolve('@babel/plugin-proposal-optional-chaining'),
|
|
49
54
|
],
|
|
50
55
|
env: {
|
|
51
56
|
production: {
|
|
52
57
|
plugins: [
|
|
53
58
|
require.resolve('@babel/plugin-transform-react-constant-elements'),
|
|
54
59
|
require.resolve('@babel/plugin-transform-react-inline-elements'),
|
|
55
|
-
[
|
|
56
|
-
|
|
60
|
+
[
|
|
61
|
+
require.resolve('babel-plugin-transform-react-remove-prop-types'),
|
|
62
|
+
{ removeImport: true },
|
|
63
|
+
],
|
|
64
|
+
],
|
|
57
65
|
},
|
|
58
66
|
test: {
|
|
59
|
-
plugins: [
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
}
|
|
67
|
+
plugins: [require.resolve('@babel/plugin-transform-modules-commonjs')],
|
|
68
|
+
},
|
|
69
|
+
},
|
|
64
70
|
});
|
|
65
71
|
exports.default = babelClientConfig;
|
|
@@ -20,7 +20,7 @@ exports.babelDependencies = (0, apply_overrides_1.default)('babelDependencies',
|
|
|
20
20
|
// Exclude transforms that make all code slower
|
|
21
21
|
exclude: ['transform-typeof-symbol'],
|
|
22
22
|
},
|
|
23
|
-
]
|
|
23
|
+
],
|
|
24
24
|
],
|
|
25
25
|
plugins: [
|
|
26
26
|
[
|
|
@@ -34,6 +34,6 @@ exports.babelDependencies = (0, apply_overrides_1.default)('babelDependencies',
|
|
|
34
34
|
version: app_configs_1.default.babelRuntimeVersion,
|
|
35
35
|
regenerator: true,
|
|
36
36
|
},
|
|
37
|
-
]
|
|
38
|
-
]
|
|
37
|
+
],
|
|
38
|
+
],
|
|
39
39
|
});
|
|
@@ -9,9 +9,11 @@ const config = (0, apply_overrides_1.default)(['babel', 'babelServer'], {
|
|
|
9
9
|
presets: [
|
|
10
10
|
[
|
|
11
11
|
require.resolve('@babel/preset-env'),
|
|
12
|
-
{ modules: false, targets: { node: 'current' }, loose: true }
|
|
12
|
+
{ modules: false, targets: { node: 'current' }, loose: true },
|
|
13
13
|
],
|
|
14
|
-
|
|
14
|
+
app_configs_1.default.tsconfig !== null &&
|
|
15
|
+
!app_configs_1.default.useTscLoader &&
|
|
16
|
+
require.resolve('@babel/preset-typescript'),
|
|
15
17
|
require.resolve('@babel/preset-react'),
|
|
16
18
|
].filter(Boolean),
|
|
17
19
|
plugins: [
|
|
@@ -27,21 +29,19 @@ const config = (0, apply_overrides_1.default)(['babel', 'babelServer'], {
|
|
|
27
29
|
[require.resolve('@babel/plugin-proposal-object-rest-spread'), { useBuiltIns: true }],
|
|
28
30
|
[require.resolve('@babel/plugin-transform-runtime'), { helpers: false }],
|
|
29
31
|
require.resolve('@babel/plugin-proposal-nullish-coalescing-operator'),
|
|
30
|
-
require.resolve('@babel/plugin-proposal-optional-chaining')
|
|
32
|
+
require.resolve('@babel/plugin-proposal-optional-chaining'),
|
|
31
33
|
],
|
|
32
34
|
env: {
|
|
33
35
|
production: {
|
|
34
36
|
plugins: [
|
|
35
37
|
require.resolve('@babel/plugin-transform-react-constant-elements'),
|
|
36
38
|
require.resolve('@babel/plugin-transform-react-inline-elements'),
|
|
37
|
-
require.resolve('babel-plugin-transform-react-remove-prop-types')
|
|
38
|
-
]
|
|
39
|
+
require.resolve('babel-plugin-transform-react-remove-prop-types'),
|
|
40
|
+
],
|
|
39
41
|
},
|
|
40
42
|
test: {
|
|
41
|
-
plugins: [
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
}
|
|
43
|
+
plugins: [require.resolve('@babel/plugin-transform-modules-commonjs')],
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
46
|
});
|
|
47
47
|
exports.default = config;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import ImageMinimizerPlugin from
|
|
1
|
+
import ImageMinimizerPlugin from 'image-minimizer-webpack-plugin';
|
|
2
2
|
export declare const getImageMin: () => (false | ImageMinimizerPlugin<unknown, unknown> | undefined)[];
|
|
@@ -17,26 +17,35 @@ const getImageMin = () => {
|
|
|
17
17
|
implementation: image_minimizer_webpack_plugin_1.default.imageminMinify,
|
|
18
18
|
options: {
|
|
19
19
|
plugins: [
|
|
20
|
-
(jpg === null || jpg === void 0 ? void 0 : jpg.enabled) && [
|
|
20
|
+
(jpg === null || jpg === void 0 ? void 0 : jpg.enabled) && [
|
|
21
|
+
'mozjpeg',
|
|
22
|
+
{
|
|
21
23
|
quality: jpg === null || jpg === void 0 ? void 0 : jpg.quality,
|
|
22
|
-
progressive: true
|
|
23
|
-
}
|
|
24
|
-
|
|
24
|
+
progressive: true,
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
(png === null || png === void 0 ? void 0 : png.enabled) && [
|
|
28
|
+
'optipng',
|
|
29
|
+
{
|
|
25
30
|
optimizationLevel: png === null || png === void 0 ? void 0 : png.optimizationLevel,
|
|
26
31
|
bitDepthReduction: png === null || png === void 0 ? void 0 : png.bitDepthReduction,
|
|
27
32
|
colorTypeReduction: png === null || png === void 0 ? void 0 : png.colorTypeReduction,
|
|
28
33
|
paletteReduction: png === null || png === void 0 ? void 0 : png.paletteReduction,
|
|
29
|
-
interlaced: png === null || png === void 0 ? void 0 : png.interlaced
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
(
|
|
34
|
+
interlaced: png === null || png === void 0 ? void 0 : png.interlaced,
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
(svg === null || svg === void 0 ? void 0 : svg.enabled) && ['svgo'],
|
|
38
|
+
(gif === null || gif === void 0 ? void 0 : gif.enabled) && [
|
|
39
|
+
'gifsicle',
|
|
40
|
+
{
|
|
33
41
|
optimizationLevel: gif === null || gif === void 0 ? void 0 : gif.optimizationLevel,
|
|
34
|
-
interlaced: true
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
42
|
+
interlaced: true,
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
].filter(Boolean),
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
}),
|
|
40
49
|
];
|
|
41
50
|
};
|
|
42
51
|
exports.getImageMin = getImageMin;
|
|
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const path_1 = __importDefault(require("path"));
|
|
7
|
-
const app_configs_1 = __importDefault(require("./app-configs"));
|
|
8
7
|
const apply_overrides_1 = __importDefault(require("./util/apply-overrides"));
|
|
8
|
+
const app_configs_1 = __importDefault(require("./app-configs"));
|
|
9
9
|
const devServerConfig = (0, apply_overrides_1.default)('devServer', {
|
|
10
10
|
port: app_configs_1.default.clientServerPort,
|
|
11
11
|
liveReload: false,
|
|
@@ -27,24 +27,26 @@ const devServerConfig = (0, apply_overrides_1.default)('devServer', {
|
|
|
27
27
|
return req.url;
|
|
28
28
|
}
|
|
29
29
|
return null;
|
|
30
|
-
} }, (app_configs_1.default.devSourceMaps.includes('eval') || app_configs_1.default.devServerCors
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
.
|
|
30
|
+
} }, (app_configs_1.default.devSourceMaps.includes('eval') || app_configs_1.default.devServerCors
|
|
31
|
+
? {
|
|
32
|
+
onProxyRes: (proxyRes) => {
|
|
33
|
+
// Для дев режима, когда мы используем в качестве соурсмапов что-то, основанное на eval - нужно
|
|
34
|
+
// разрешить браузеру исполнять наш код, даже когда content-security-policy приложения не позволяет этого делать.
|
|
35
|
+
if (app_configs_1.default.devSourceMaps.includes('eval')) {
|
|
36
|
+
const cspHeader = proxyRes.headers['content-security-policy'];
|
|
37
|
+
if (typeof cspHeader === 'string' &&
|
|
38
|
+
!cspHeader.includes('unsafe-eval')) {
|
|
39
|
+
proxyRes.headers['content-security-policy'] = cspHeader.replace(/script-src/, "script-src 'unsafe-eval'");
|
|
40
|
+
}
|
|
39
41
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
42
|
+
// если включен devServerCors, то нужно принудительно менять статус ответа на 200, чтобы
|
|
43
|
+
// браузер не отклонял ответы с CORS
|
|
44
|
+
if (app_configs_1.default.devServerCors && proxyRes.method === 'OPTIONS') {
|
|
45
|
+
proxyRes.statusCode = 200;
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
}
|
|
49
|
+
: {})),
|
|
48
50
|
}),
|
|
49
51
|
headers: app_configs_1.default.devServerCors
|
|
50
52
|
? {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// TODO: remove eslint-disable-next-line
|
|
3
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
2
4
|
const babelJest = require('babel-jest');
|
|
3
5
|
const babelPresets = require('../babel-server');
|
|
4
6
|
module.exports = babelJest.createTransformer(babelPresets.default);
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// TODO: remove eslint-disable-next-line
|
|
3
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
2
4
|
const path = require('path');
|
|
3
5
|
// This is a custom Jest transformer turning file imports into filenames.
|
|
4
6
|
// http://facebook.github.io/jest/docs/en/webpack.html
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// TODO: remove eslint-disable
|
|
3
|
+
/* eslint-disable global-require */
|
|
4
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
2
5
|
const fs = require('fs');
|
|
3
6
|
const { pathsToModuleNameMapper } = require('ts-jest');
|
|
4
7
|
const { parseConfigFileTextToJson } = require('typescript');
|
|
@@ -9,37 +12,34 @@ const tsConfigText = fs.readFileSync(configs.tsconfig, 'utf8');
|
|
|
9
12
|
const tsConfig = parseConfigFileTextToJson(tsConfigPath, tsConfigText);
|
|
10
13
|
const tsConfigPaths = tsConfig.config.compilerOptions.paths || {};
|
|
11
14
|
const defaultJestConfig = {
|
|
12
|
-
testRegex: '(^.*src).*(((
|
|
15
|
+
testRegex: '(^.*src).*(((/__test__/|/__tests__/).*)|(test|spec|tests)).(jsx?|tsx?)$',
|
|
13
16
|
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
|
|
14
|
-
collectCoverageFrom: [
|
|
15
|
-
'src/**/*.{js,jsx,ts,tsx}'
|
|
16
|
-
],
|
|
17
|
+
collectCoverageFrom: ['src/**/*.{js,jsx,ts,tsx}'],
|
|
17
18
|
// transform project js and ts files using babel ant ts transformers
|
|
18
19
|
transform: {
|
|
19
20
|
'^.+\\.jsx?$': require.resolve('./babel-transform'),
|
|
20
21
|
'^.+\\.tsx?$': require.resolve('ts-jest'),
|
|
21
22
|
// transform other files to simple empty strings
|
|
22
|
-
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': require.resolve('./file-transform')
|
|
23
|
+
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': require.resolve('./file-transform'),
|
|
23
24
|
},
|
|
24
25
|
moduleNameMapper: Object.assign({
|
|
25
26
|
// replace all css files with simple empty exports
|
|
26
27
|
'\\.css$': require.resolve('./css-mock') }, pathsToModuleNameMapper(tsConfigPaths, { prefix: '<rootDir>/' })),
|
|
27
|
-
snapshotSerializers: [
|
|
28
|
-
require.resolve('jest-snapshot-serializer-class-name-to-string')
|
|
29
|
-
],
|
|
28
|
+
snapshotSerializers: [require.resolve('jest-snapshot-serializer-class-name-to-string')],
|
|
30
29
|
globals: {
|
|
31
30
|
'ts-jest': {
|
|
32
31
|
tsconfig: configs.tsconfig,
|
|
33
|
-
babelConfig: require('../babel-client').default
|
|
34
|
-
}
|
|
35
|
-
}
|
|
32
|
+
babelConfig: require('../babel-client').default,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
36
35
|
};
|
|
37
36
|
let appJestConfig = {};
|
|
38
37
|
if (configs.appPackage.jest) {
|
|
39
38
|
appJestConfig = configs.appPackage.jest;
|
|
40
|
-
if (appJestConfig.preset) {
|
|
39
|
+
if (appJestConfig.preset) {
|
|
40
|
+
// we don't need presets when using presets
|
|
41
41
|
if (appJestConfig.preset !== 'arui-scripts') {
|
|
42
|
-
console.warn(
|
|
42
|
+
console.warn("arui-scripts test command doesn't support jest preset config");
|
|
43
43
|
}
|
|
44
44
|
delete appJestConfig.preset;
|
|
45
45
|
}
|
package/build/configs/modules.js
CHANGED
|
@@ -4,10 +4,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.patchWebpackConfigForCompat = exports.getExposeLoadersFormCompatModules = exports.getCssPrefixForModule = exports.patchMainWebpackConfigForModules = exports.MODULES_ENTRY_NAME = exports.haveExposedDefaultModules = void 0;
|
|
7
|
+
// TODO: remove eslint-disable
|
|
8
|
+
/* eslint-disable no-param-reassign */
|
|
7
9
|
const webpack_1 = __importDefault(require("webpack"));
|
|
8
|
-
const app_configs_1 = __importDefault(require("./app-configs"));
|
|
9
|
-
const find_loader_1 = require("./util/find-loader");
|
|
10
10
|
const postcss_prefix_selector_1 = require("../plugins/postcss-prefix-selector");
|
|
11
|
+
const find_loader_1 = require("./util/find-loader");
|
|
12
|
+
const app_configs_1 = __importDefault(require("./app-configs"));
|
|
11
13
|
function haveExposedDefaultModules() {
|
|
12
14
|
var _a;
|
|
13
15
|
return (_a = app_configs_1.default.modules) === null || _a === void 0 ? void 0 : _a.exposes;
|
|
@@ -70,12 +72,17 @@ function addPrefixCssRule(rule, prefix) {
|
|
|
70
72
|
}
|
|
71
73
|
const postCssLoader = rule.use.find((loaderConfig) => {
|
|
72
74
|
var _a;
|
|
73
|
-
if (typeof loaderConfig === 'string' ||
|
|
75
|
+
if (typeof loaderConfig === 'string' ||
|
|
76
|
+
typeof loaderConfig === 'function' ||
|
|
77
|
+
!loaderConfig) {
|
|
74
78
|
return false;
|
|
75
79
|
}
|
|
76
80
|
return ((_a = loaderConfig.loader) === null || _a === void 0 ? void 0 : _a.indexOf('postcss-loader')) !== -1;
|
|
77
81
|
});
|
|
78
|
-
if (!postCssLoader ||
|
|
82
|
+
if (!postCssLoader ||
|
|
83
|
+
typeof postCssLoader !== 'object' ||
|
|
84
|
+
!postCssLoader.options ||
|
|
85
|
+
typeof postCssLoader.options !== 'object') {
|
|
79
86
|
return;
|
|
80
87
|
}
|
|
81
88
|
postCssLoader.options.postcssOptions.plugins = [
|
package/build/configs/mq.css
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
@custom-media --small screen;
|
|
2
|
-
@custom-media --small-only screen and (max-width:47.9375em);
|
|
3
|
-
@custom-media --medium screen and (min-width:48em);
|
|
4
|
-
@custom-media --medium-only screen and (min-width:48em) and (max-width:63.9375em);
|
|
2
|
+
@custom-media --small-only screen and (max-width: 47.9375em);
|
|
3
|
+
@custom-media --medium screen and (min-width: 48em);
|
|
4
|
+
@custom-media --medium-only screen and (min-width: 48em) and (max-width: 63.9375em);
|
|
5
5
|
@custom-media --large screen and (min-width 64em);
|
|
6
|
-
@custom-media --large-only screen and (min-width:64em) and (max-width:89.9375em);
|
|
6
|
+
@custom-media --large-only screen and (min-width: 64em) and (max-width: 89.9375em);
|
|
7
7
|
@custom-media --xlarge screen and (min-width 90em);
|
|
8
|
-
@custom-media --xlarge-only screen and (min-width:90em) and (max-width:119.9375em);
|
|
8
|
+
@custom-media --xlarge-only screen and (min-width: 90em) and (max-width: 119.9375em);
|
|
9
9
|
@custom-media --xxlarge screen and (min-width 120em);
|
|
10
|
-
@custom-media --xxlarge-only screen and (min-width:120em) and (max-width:99999999em);
|
|
11
|
-
@custom-media --mobile-s (min-width:320px);
|
|
12
|
-
@custom-media --mobile-m (min-width:375px);
|
|
13
|
-
@custom-media --mobile-l (min-width:412px);
|
|
14
|
-
@custom-media --mobile (max-width:599px);
|
|
15
|
-
@custom-media --tablet-s (min-width:600px);
|
|
16
|
-
@custom-media --tablet-m (min-width:768px);
|
|
17
|
-
@custom-media --tablet (min-width:600px) and (max-width:1023px);
|
|
18
|
-
@custom-media --desktop-s (min-width:1024px);
|
|
19
|
-
@custom-media --desktop-m (min-width:1280px);
|
|
20
|
-
@custom-media --desktop-l (min-width:1440px);
|
|
21
|
-
@custom-media --desktop-xl (min-width:1920px);
|
|
22
|
-
@custom-media --desktop (min-width:1024px);
|
|
10
|
+
@custom-media --xxlarge-only screen and (min-width: 120em) and (max-width: 99999999em);
|
|
11
|
+
@custom-media --mobile-s (min-width: 320px);
|
|
12
|
+
@custom-media --mobile-m (min-width: 375px);
|
|
13
|
+
@custom-media --mobile-l (min-width: 412px);
|
|
14
|
+
@custom-media --mobile (max-width: 599px);
|
|
15
|
+
@custom-media --tablet-s (min-width: 600px);
|
|
16
|
+
@custom-media --tablet-m (min-width: 768px);
|
|
17
|
+
@custom-media --tablet (min-width: 600px) and (max-width: 1023px);
|
|
18
|
+
@custom-media --desktop-s (min-width: 1024px);
|
|
19
|
+
@custom-media --desktop-m (min-width: 1280px);
|
|
20
|
+
@custom-media --desktop-l (min-width: 1440px);
|
|
21
|
+
@custom-media --desktop-xl (min-width: 1920px);
|
|
22
|
+
@custom-media --desktop (min-width: 1024px);
|
|
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.postcssPluginsOptions = exports.postcssPlugins = exports.createPostcssConfig = void 0;
|
|
7
|
-
const app_configs_1 = __importDefault(require("./app-configs"));
|
|
8
7
|
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const app_configs_1 = __importDefault(require("./app-configs"));
|
|
9
9
|
/**
|
|
10
10
|
* Функция для создания конфигурационного файла postcss
|
|
11
11
|
* @param {String[]} plugins список плагинов
|
|
@@ -13,7 +13,7 @@ const path_1 = __importDefault(require("path"));
|
|
|
13
13
|
* @returns {*}
|
|
14
14
|
*/
|
|
15
15
|
function createPostcssConfig(plugins, options) {
|
|
16
|
-
return plugins.map(pluginName => {
|
|
16
|
+
return plugins.map((pluginName) => {
|
|
17
17
|
if (pluginName in options) {
|
|
18
18
|
return [pluginName, options[pluginName]];
|
|
19
19
|
}
|
|
@@ -46,10 +46,7 @@ exports.postcssPluginsOptions = {
|
|
|
46
46
|
path: ['./src'],
|
|
47
47
|
},
|
|
48
48
|
'@csstools/postcss-global-data': {
|
|
49
|
-
files: [
|
|
50
|
-
path_1.default.join(__dirname, 'mq.css'),
|
|
51
|
-
app_configs_1.default.componentsTheme
|
|
52
|
-
].filter(Boolean),
|
|
49
|
+
files: [path_1.default.join(__dirname, 'mq.css'), app_configs_1.default.componentsTheme].filter(Boolean),
|
|
53
50
|
},
|
|
54
51
|
'postcss-url': {
|
|
55
52
|
url: 'rebase',
|
|
@@ -9,7 +9,7 @@ const app_configs_1 = __importDefault(require("./app-configs"));
|
|
|
9
9
|
const modules_1 = require("./modules");
|
|
10
10
|
function processAssetsPluginOutput(assets) {
|
|
11
11
|
var _a;
|
|
12
|
-
|
|
12
|
+
const adjustedAssets = assets;
|
|
13
13
|
Object.keys(adjustedAssets).forEach((key) => {
|
|
14
14
|
// заменяем путь к файлам на корректный в случае если в нем есть 'auto/'
|
|
15
15
|
adjustedAssets[key] = {
|