arui-scripts 14.5.0-feat-modules.1 → 14.5.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/CHANGELOG.md +1 -10
- package/build/commands/build/build-wrapper.d.ts +2 -2
- package/build/commands/build/client.js +3 -3
- package/build/commands/bundle-analyze/index.js +7 -5
- package/build/commands/changelog/index.js +2 -2
- package/build/commands/start/client.js +2 -2
- package/build/commands/start-prod/client.js +2 -2
- package/build/commands/util/{run-client-dev-derver.d.ts → run-client-dev-server.d.ts} +1 -1
- package/build/commands/util/{run-client-dev-derver.js → run-client-dev-server.js} +4 -1
- package/build/configs/app-configs/available-package-settings.d.ts +8 -0
- package/build/configs/app-configs/available-package-settings.js +32 -0
- package/build/configs/app-configs/calculate-dependent-config.d.ts +8 -48
- package/build/configs/app-configs/calculate-dependent-config.js +13 -11
- package/build/configs/app-configs/get-defaults.d.ts +2 -3
- package/build/configs/app-configs/get-defaults.js +34 -49
- package/build/configs/app-configs/index.d.ts +3 -5
- package/build/configs/app-configs/index.js +7 -13
- package/build/configs/app-configs/types.d.ts +26 -60
- package/build/configs/app-configs/update-with-config-file.d.ts +2 -2
- package/build/configs/app-configs/update-with-config-file.js +7 -5
- package/build/configs/app-configs/update-with-env.js +8 -3
- package/build/configs/app-configs/update-with-package.d.ts +2 -2
- package/build/configs/app-configs/update-with-package.js +10 -5
- package/build/configs/app-configs/update-with-presets.d.ts +2 -2
- package/build/configs/app-configs/update-with-presets.js +15 -8
- package/build/configs/app-configs/validate-settings-keys.d.ts +5 -2
- package/build/configs/app-configs/validate-settings-keys.js +7 -6
- package/build/configs/babel-client.d.ts +1 -33
- package/build/configs/babel-dependencies.d.ts +1 -14
- package/build/configs/babel-server.d.ts +1 -26
- package/build/configs/dev-server.d.ts +2 -15
- package/build/configs/jest/index.d.ts +1 -33
- package/build/configs/server-externals-exemptions.d.ts +1 -1
- package/build/configs/server-externals-exemptions.js +0 -1
- package/build/configs/util/apply-overrides.d.ts +6 -6
- package/build/configs/util/get-entry.d.ts +1 -2
- package/build/configs/webpack.client.d.ts +2 -5
- package/build/configs/webpack.client.dev.d.ts +1 -1
- package/build/configs/webpack.client.js +17 -71
- package/build/configs/webpack.client.prod.d.ts +1 -1
- package/build/index.d.ts +1 -1
- package/build/tsconfig-local.tsbuildinfo +1 -1
- package/package.json +3 -4
- package/build/configs/modules.d.ts +0 -15
- package/build/configs/modules.js +0 -78
- package/docs/modules.md +0 -423
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.updateWithPackage = void 0;
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const lodash_merge_1 = __importDefault(require("lodash.merge"));
|
|
8
|
+
const validate_settings_keys_1 = __importDefault(require("./validate-settings-keys"));
|
|
9
|
+
const available_package_settings_1 = require("./available-package-settings");
|
|
10
|
+
function updateWithPackage(config) {
|
|
11
|
+
const packageSettings = config.appPackage.aruiScripts || {};
|
|
12
|
+
(0, validate_settings_keys_1.default)(available_package_settings_1.availablePackageSettings, packageSettings);
|
|
13
|
+
return (0, lodash_merge_1.default)(config, packageSettings);
|
|
9
14
|
}
|
|
10
15
|
exports.updateWithPackage = updateWithPackage;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { AppConfigs
|
|
2
|
-
export declare function updateWithPresets(config: AppConfigs
|
|
1
|
+
import { AppConfigs } from './types';
|
|
2
|
+
export declare function updateWithPresets(config: AppConfigs): AppConfigs;
|
|
@@ -1,26 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.updateWithPresets = void 0;
|
|
7
|
+
const lodash_merge_1 = __importDefault(require("lodash.merge"));
|
|
4
8
|
const resolve_1 = require("../util/resolve");
|
|
5
|
-
const validate_settings_keys_1 = require("./validate-settings-keys");
|
|
6
|
-
|
|
7
|
-
|
|
9
|
+
const validate_settings_keys_1 = __importDefault(require("./validate-settings-keys"));
|
|
10
|
+
const available_package_settings_1 = require("./available-package-settings");
|
|
11
|
+
function updateWithPresets(config) {
|
|
12
|
+
const packageSettings = config.appPackage.aruiScripts || {};
|
|
13
|
+
if (!packageSettings.presets) {
|
|
8
14
|
return config;
|
|
9
15
|
}
|
|
10
|
-
const presetsConfigPath = (0, resolve_1.tryResolve)(`${
|
|
11
|
-
const presetsOverridesPath = (0, resolve_1.tryResolve)(`${
|
|
16
|
+
const presetsConfigPath = (0, resolve_1.tryResolve)(`${packageSettings.presets}/arui-scripts.config`, { paths: [config.cwd] });
|
|
17
|
+
const presetsOverridesPath = (0, resolve_1.tryResolve)(`${packageSettings.presets}/arui-scripts.overrides`, { paths: [config.cwd] });
|
|
12
18
|
if (presetsConfigPath) {
|
|
13
19
|
let presetsSettings = require(presetsConfigPath);
|
|
14
20
|
if (presetsSettings.__esModule) {
|
|
15
21
|
// ts-node импортирует esModules, из них надо вытягивать default именно так
|
|
16
22
|
presetsSettings = presetsSettings.default;
|
|
17
23
|
}
|
|
18
|
-
(0, validate_settings_keys_1.
|
|
19
|
-
config =
|
|
24
|
+
(0, validate_settings_keys_1.default)(available_package_settings_1.availablePackageSettings, presetsSettings);
|
|
25
|
+
config = (0, lodash_merge_1.default)(config, presetsSettings);
|
|
20
26
|
}
|
|
21
27
|
if (presetsOverridesPath) {
|
|
22
|
-
|
|
28
|
+
config.overridesPath.unshift(presetsOverridesPath);
|
|
23
29
|
}
|
|
30
|
+
delete packageSettings.presets;
|
|
24
31
|
return config;
|
|
25
32
|
}
|
|
26
33
|
exports.updateWithPresets = updateWithPresets;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Функция проверяет что все ключи объекта settingsObject есть в
|
|
2
|
+
* Функция проверяет что все ключи объекта settingsObject есть в массиве availableKeys
|
|
3
|
+
* @param {string[]} availableKeys Массив допустимых настроек
|
|
4
|
+
* @param settingsObject Объект с настройками
|
|
3
5
|
*/
|
|
4
|
-
|
|
6
|
+
declare function validateSettingsKeys(availableKeys: ReadonlyArray<string>, settingsObject: Record<string, unknown>): void;
|
|
7
|
+
export default validateSettingsKeys;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateSettingsKeys = void 0;
|
|
4
3
|
/**
|
|
5
|
-
* Функция проверяет что все ключи объекта settingsObject есть в
|
|
4
|
+
* Функция проверяет что все ключи объекта settingsObject есть в массиве availableKeys
|
|
5
|
+
* @param {string[]} availableKeys Массив допустимых настроек
|
|
6
|
+
* @param settingsObject Объект с настройками
|
|
6
7
|
*/
|
|
7
|
-
function validateSettingsKeys(
|
|
8
|
+
function validateSettingsKeys(availableKeys, settingsObject) {
|
|
8
9
|
Object.keys(settingsObject).forEach((setting) => {
|
|
9
|
-
if (
|
|
10
|
-
console.warn(
|
|
10
|
+
if (!availableKeys.includes(setting)) {
|
|
11
|
+
console.warn('\x1b[33m', `Setting`, '\x1b[31m', setting, '\x1b[33m', 'is not supported!');
|
|
11
12
|
}
|
|
12
13
|
});
|
|
13
14
|
}
|
|
14
|
-
exports.
|
|
15
|
+
exports.default = validateSettingsKeys;
|
|
@@ -1,34 +1,2 @@
|
|
|
1
|
-
declare const babelClientConfig:
|
|
2
|
-
presets: (string | false | (string | {
|
|
3
|
-
targets: {
|
|
4
|
-
browsers: string[];
|
|
5
|
-
};
|
|
6
|
-
loose: boolean;
|
|
7
|
-
useBuiltIns: string;
|
|
8
|
-
corejs: number;
|
|
9
|
-
exclude: string[];
|
|
10
|
-
})[])[];
|
|
11
|
-
plugins: (string | (string | {
|
|
12
|
-
legacy: boolean;
|
|
13
|
-
})[] | (string | {
|
|
14
|
-
loose: boolean;
|
|
15
|
-
})[] | (string | {
|
|
16
|
-
useBuiltIns: boolean;
|
|
17
|
-
})[] | (string | {
|
|
18
|
-
corejs: boolean;
|
|
19
|
-
helpers: boolean;
|
|
20
|
-
version: string;
|
|
21
|
-
regenerator: boolean;
|
|
22
|
-
})[])[];
|
|
23
|
-
env: {
|
|
24
|
-
production: {
|
|
25
|
-
plugins: (string | (string | {
|
|
26
|
-
removeImport: boolean;
|
|
27
|
-
})[])[];
|
|
28
|
-
};
|
|
29
|
-
test: {
|
|
30
|
-
plugins: string[];
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
};
|
|
1
|
+
declare const babelClientConfig: any;
|
|
34
2
|
export default babelClientConfig;
|
|
@@ -1,14 +1 @@
|
|
|
1
|
-
export declare const babelDependencies:
|
|
2
|
-
sourceType: string;
|
|
3
|
-
presets: (string | {
|
|
4
|
-
useBuiltIns: string;
|
|
5
|
-
corejs: number;
|
|
6
|
-
exclude: string[];
|
|
7
|
-
})[][];
|
|
8
|
-
plugins: (string | {
|
|
9
|
-
corejs: boolean;
|
|
10
|
-
helpers: boolean;
|
|
11
|
-
version: string;
|
|
12
|
-
regenerator: boolean;
|
|
13
|
-
})[][];
|
|
14
|
-
};
|
|
1
|
+
export declare const babelDependencies: any;
|
|
@@ -1,27 +1,2 @@
|
|
|
1
|
-
declare const config:
|
|
2
|
-
presets: (string | false | (string | {
|
|
3
|
-
modules: boolean;
|
|
4
|
-
targets: {
|
|
5
|
-
node: string;
|
|
6
|
-
};
|
|
7
|
-
loose: boolean;
|
|
8
|
-
})[])[];
|
|
9
|
-
plugins: (string | (string | {
|
|
10
|
-
legacy: boolean;
|
|
11
|
-
})[] | (string | {
|
|
12
|
-
loose: boolean;
|
|
13
|
-
})[] | (string | {
|
|
14
|
-
useBuiltIns: boolean;
|
|
15
|
-
})[] | (string | {
|
|
16
|
-
helpers: boolean;
|
|
17
|
-
})[])[];
|
|
18
|
-
env: {
|
|
19
|
-
production: {
|
|
20
|
-
plugins: string[];
|
|
21
|
-
};
|
|
22
|
-
test: {
|
|
23
|
-
plugins: string[];
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
};
|
|
1
|
+
declare const config: any;
|
|
27
2
|
export default config;
|
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
liveReload: boolean;
|
|
4
|
-
client: {
|
|
5
|
-
overlay: {
|
|
6
|
-
errors: boolean;
|
|
7
|
-
warnings: boolean;
|
|
8
|
-
};
|
|
9
|
-
};
|
|
10
|
-
devMiddleware: {
|
|
11
|
-
publicPath: string;
|
|
12
|
-
};
|
|
13
|
-
static: string[];
|
|
14
|
-
proxy: any;
|
|
15
|
-
};
|
|
1
|
+
/// <reference types="webpack-dev-server" />
|
|
2
|
+
declare const devServerConfig: import("webpack-dev-server").Configuration;
|
|
16
3
|
export default devServerConfig;
|
|
@@ -14,38 +14,6 @@ export const snapshotSerializers: string[];
|
|
|
14
14
|
export const globals: {
|
|
15
15
|
'ts-jest': {
|
|
16
16
|
tsconfig: string | null;
|
|
17
|
-
babelConfig:
|
|
18
|
-
presets: (string | false | (string | {
|
|
19
|
-
targets: {
|
|
20
|
-
browsers: string[];
|
|
21
|
-
};
|
|
22
|
-
loose: boolean;
|
|
23
|
-
useBuiltIns: string;
|
|
24
|
-
corejs: number;
|
|
25
|
-
exclude: string[];
|
|
26
|
-
})[])[];
|
|
27
|
-
plugins: (string | (string | {
|
|
28
|
-
legacy: boolean;
|
|
29
|
-
})[] | (string | {
|
|
30
|
-
loose: boolean;
|
|
31
|
-
})[] | (string | {
|
|
32
|
-
useBuiltIns: boolean;
|
|
33
|
-
})[] | (string | {
|
|
34
|
-
corejs: boolean;
|
|
35
|
-
helpers: boolean;
|
|
36
|
-
version: string;
|
|
37
|
-
regenerator: boolean;
|
|
38
|
-
})[])[];
|
|
39
|
-
env: {
|
|
40
|
-
production: {
|
|
41
|
-
plugins: (string | (string | {
|
|
42
|
-
removeImport: boolean;
|
|
43
|
-
})[])[];
|
|
44
|
-
};
|
|
45
|
-
test: {
|
|
46
|
-
plugins: string[];
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
};
|
|
17
|
+
babelConfig: any;
|
|
50
18
|
};
|
|
51
19
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const serverExternalsExemptions: RegExp[];
|
|
1
|
+
export declare const serverExternalsExemptions: (string | RegExp)[];
|
|
@@ -2,14 +2,14 @@ import type { Configuration as WebpackConfiguration, WebpackOptionsNormalized }
|
|
|
2
2
|
import type { Configuration as WebpackDevServerConfiguration } from 'webpack-dev-server';
|
|
3
3
|
import { AppConfigs } from '../app-configs/types';
|
|
4
4
|
type Overrides = {
|
|
5
|
-
webpack: WebpackConfiguration
|
|
6
|
-
webpackClient: WebpackConfiguration
|
|
7
|
-
webpackDev: WebpackConfiguration
|
|
8
|
-
webpackClientDev: WebpackConfiguration
|
|
5
|
+
webpack: WebpackConfiguration;
|
|
6
|
+
webpackClient: WebpackConfiguration;
|
|
7
|
+
webpackDev: WebpackConfiguration;
|
|
8
|
+
webpackClientDev: WebpackConfiguration;
|
|
9
9
|
webpackServer: WebpackConfiguration;
|
|
10
10
|
webpackServerDev: WebpackConfiguration;
|
|
11
11
|
webpackProd: WebpackConfiguration;
|
|
12
|
-
webpackClientProd: WebpackConfiguration
|
|
12
|
+
webpackClientProd: WebpackConfiguration;
|
|
13
13
|
webpackServerProd: WebpackConfiguration;
|
|
14
14
|
devServer: WebpackDevServerConfiguration;
|
|
15
15
|
stats: WebpackOptionsNormalized['stats'];
|
|
@@ -36,5 +36,5 @@ export type OverrideFile = {
|
|
|
36
36
|
* @param {Object} config Конфиг, к которому нужно применить оверрайды
|
|
37
37
|
* @returns {*}
|
|
38
38
|
*/
|
|
39
|
-
declare function applyOverrides<
|
|
39
|
+
declare function applyOverrides<Key extends keyof Overrides>(overridesKey: Key | Key[], config: Overrides[Key]): Overrides[Key];
|
|
40
40
|
export default applyOverrides;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
export type Entry = string | string[] | Record<string, string | string[]>;
|
|
2
1
|
/**
|
|
3
2
|
* @param {string|string[]|object} entryPoint Строка, массив строк или объект с энтрипоинтами
|
|
4
3
|
* @param {Function} getSingleEntry Функция, возвращающая конфигурацию для одного entryPoint
|
|
5
4
|
* @param args Дополнительные аргументы, которые будут переданы в getSingleEntry функцию
|
|
6
5
|
* @returns {*}
|
|
7
6
|
*/
|
|
8
|
-
declare function getEntry<AdditionalArgs extends unknown[]>(entryPoint:
|
|
7
|
+
declare function getEntry<AdditionalArgs extends unknown[]>(entryPoint: string | string[] | Record<string, string | string[]>, getSingleEntry: (entry: string[], ...args: AdditionalArgs) => string[], ...args: AdditionalArgs): string[] | Record<string, string | string[]>;
|
|
9
8
|
export default getEntry;
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import { EmbeddedModuleConfig } from './app-configs/types';
|
|
4
|
-
export declare const createSingleClientWebpackConfig: (mode: 'dev' | 'prod', entry: Entry, module?: EmbeddedModuleConfig) => Configuration;
|
|
5
|
-
export declare const createClientWebpackConfig: (mode: 'dev' | 'prod') => webpack.Configuration | webpack.Configuration[];
|
|
1
|
+
import { Configuration } from 'webpack';
|
|
2
|
+
export declare const createClientWebpackConfig: (mode: 'dev' | 'prod') => Configuration;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const config: import("webpack").Configuration
|
|
1
|
+
declare const config: import("webpack").Configuration;
|
|
2
2
|
export default config;
|
|
@@ -3,7 +3,7 @@ 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
|
-
exports.createClientWebpackConfig =
|
|
6
|
+
exports.createClientWebpackConfig = void 0;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const webpack_1 = __importDefault(require("webpack"));
|
|
9
9
|
const webpack_manifest_plugin_1 = require("webpack-manifest-plugin");
|
|
@@ -14,7 +14,7 @@ const compression_webpack_plugin_1 = __importDefault(require("compression-webpac
|
|
|
14
14
|
const assets_webpack_plugin_1 = __importDefault(require("assets-webpack-plugin"));
|
|
15
15
|
const tsconfig_paths_webpack_plugin_1 = __importDefault(require("tsconfig-paths-webpack-plugin"));
|
|
16
16
|
const getCSSModuleLocalIdent_1 = __importDefault(require("react-dev-utils/getCSSModuleLocalIdent"));
|
|
17
|
-
const
|
|
17
|
+
const PnpWebpackPlugin = require('pnp-webpack-plugin');
|
|
18
18
|
const get_entry_1 = __importDefault(require("./util/get-entry"));
|
|
19
19
|
const app_configs_1 = __importDefault(require("./app-configs"));
|
|
20
20
|
const babel_client_1 = __importDefault(require("./babel-client"));
|
|
@@ -24,32 +24,21 @@ const babel_dependencies_1 = require("./babel-dependencies");
|
|
|
24
24
|
const react_refresh_typescript_1 = __importDefault(require("react-refresh-typescript"));
|
|
25
25
|
const react_refresh_webpack_plugin_1 = __importDefault(require("@pmmmwh/react-refresh-webpack-plugin"));
|
|
26
26
|
const case_sensitive_paths_webpack_plugin_1 = __importDefault(require("case-sensitive-paths-webpack-plugin"));
|
|
27
|
-
const modules_1 = require("./modules");
|
|
28
|
-
const PnpWebpackPlugin = require('pnp-webpack-plugin');
|
|
29
27
|
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
|
|
30
28
|
const noopPath = require.resolve('./util/noop');
|
|
31
29
|
function getSingleEntry(entryPoint, mode) {
|
|
32
30
|
return [
|
|
33
31
|
...(Array.isArray(app_configs_1.default.clientPolyfillsEntry) ? app_configs_1.default.clientPolyfillsEntry : [app_configs_1.default.clientPolyfillsEntry]),
|
|
32
|
+
mode === 'dev' ? require.resolve('webpack/hot/dev-server') : false,
|
|
34
33
|
...entryPoint
|
|
35
34
|
].filter(Boolean);
|
|
36
35
|
}
|
|
37
|
-
//
|
|
38
|
-
const
|
|
39
|
-
path: app_configs_1.default.serverOutputPath,
|
|
40
|
-
processOutput: modules_1.processAssetsPluginOutput,
|
|
41
|
-
});
|
|
42
|
-
// Этот плагин нужен для того, чтобы клиентский код так же могу получить информацию о сборке.
|
|
43
|
-
// Это позволяет нам делать виджеты, работающие только на клиенте
|
|
44
|
-
const clientAssetsPlugin = new assets_webpack_plugin_1.default({
|
|
45
|
-
path: app_configs_1.default.clientOutputPath,
|
|
46
|
-
processOutput: modules_1.processAssetsPluginOutput,
|
|
47
|
-
});
|
|
48
|
-
const createSingleClientWebpackConfig = (mode, entry, module) => ({
|
|
36
|
+
// This is the production configuration.
|
|
37
|
+
const createClientWebpackConfig = (mode) => ({
|
|
49
38
|
target: 'web',
|
|
50
39
|
mode: mode === 'dev' ? 'development' : 'production',
|
|
51
40
|
devtool: mode === 'dev' ? app_configs_1.default.devSourceMaps : 'source-map',
|
|
52
|
-
entry: (0, get_entry_1.default)(
|
|
41
|
+
entry: (0, get_entry_1.default)(app_configs_1.default.clientEntry, getSingleEntry, mode),
|
|
53
42
|
// in production mode we need to fail on first error
|
|
54
43
|
bail: mode === 'prod',
|
|
55
44
|
context: app_configs_1.default.cwd,
|
|
@@ -57,21 +46,14 @@ const createSingleClientWebpackConfig = (mode, entry, module) => ({
|
|
|
57
46
|
// Add /* filename */ comments to generated require()s in the output.
|
|
58
47
|
pathinfo: mode === 'dev',
|
|
59
48
|
path: app_configs_1.default.clientOutputPath,
|
|
60
|
-
publicPath:
|
|
61
|
-
? 'auto' // Для того чтобы модули могли подключаться из разных мест, нам необходимо использовать auto. Для корректной работы в IE надо подключaть https://github.com/amiller-gh/currentScript-polyfill
|
|
62
|
-
: app_configs_1.default.publicPath,
|
|
49
|
+
publicPath: app_configs_1.default.publicPath,
|
|
63
50
|
filename: mode === 'dev' ? '[name].js' : '[name].[chunkhash:8].js',
|
|
64
|
-
chunkFilename: mode === 'dev'
|
|
65
|
-
? `${(0, modules_1.getChunkNamePrefix)(module)}[name].js`
|
|
66
|
-
: `${(0, modules_1.getChunkNamePrefix)(module)}[name].[chunkhash:8].chunk.js`,
|
|
51
|
+
chunkFilename: mode === 'dev' ? '[name].js' : '[name].[chunkhash:8].chunk.js',
|
|
67
52
|
// Point sourcemap entries to original disk location (format as URL on Windows)
|
|
68
53
|
devtoolModuleFilenameTemplate: (info) => path_1.default
|
|
69
54
|
.relative(app_configs_1.default.appSrc, info.absoluteResourcePath)
|
|
70
55
|
.replace(/\\/g, '/'),
|
|
71
|
-
// для модулей нам надо переопределять глобальную переменную webpack, чтобы несколько модулей из одного бандла могли работать в одном окружении
|
|
72
|
-
uniqueName: module ? module.name : undefined
|
|
73
56
|
},
|
|
74
|
-
externals: Object.assign({}, ((module === null || module === void 0 ? void 0 : module.embeddedConfig) ? module.embeddedConfig : {})),
|
|
75
57
|
optimization: {
|
|
76
58
|
splitChunks: mode === 'prod'
|
|
77
59
|
? {
|
|
@@ -86,14 +68,7 @@ const createSingleClientWebpackConfig = (mode, entry, module) => ({
|
|
|
86
68
|
vendor: {
|
|
87
69
|
test: /node_modules/,
|
|
88
70
|
chunks: "initial",
|
|
89
|
-
name:
|
|
90
|
-
if (!module) {
|
|
91
|
-
return 'vendor';
|
|
92
|
-
}
|
|
93
|
-
// Нам нужно сделать так, чтобы у модулей vendor файл назывался иначе, чем просто vendor
|
|
94
|
-
const allChunksNames = chunks.map((item) => item.name).join('~');
|
|
95
|
-
return `${cacheGroupKey}-${allChunksNames}`;
|
|
96
|
-
},
|
|
71
|
+
name: "vendor",
|
|
97
72
|
priority: 10,
|
|
98
73
|
enforce: true
|
|
99
74
|
}
|
|
@@ -186,7 +161,6 @@ const createSingleClientWebpackConfig = (mode, entry, module) => ({
|
|
|
186
161
|
// see https://github.com/webpack/webpack/issues/7378
|
|
187
162
|
strictExportPresence: !app_configs_1.default.tsconfig,
|
|
188
163
|
rules: [
|
|
189
|
-
...(0, modules_1.getExposeLoadersFormEmbeddedModules)(module),
|
|
190
164
|
{
|
|
191
165
|
// "oneOf" will traverse all following loaders until one will
|
|
192
166
|
// match the requirements. When no loader matches it will fall
|
|
@@ -277,11 +251,7 @@ const createSingleClientWebpackConfig = (mode, entry, module) => ({
|
|
|
277
251
|
// Necessary for external CSS imports to work
|
|
278
252
|
// https://github.com/facebookincubator/create-react-app/issues/2677
|
|
279
253
|
ident: 'postcss',
|
|
280
|
-
plugins: () =>
|
|
281
|
-
const prefix = module ? (0, modules_1.getCssPrefixForModule)(module) : undefined;
|
|
282
|
-
return [...postcss_1.default]
|
|
283
|
-
.concat(prefix ? (0, postcss_prefix_selector_1.default)({ prefix }) : []);
|
|
284
|
-
},
|
|
254
|
+
plugins: () => postcss_1.default,
|
|
285
255
|
},
|
|
286
256
|
},
|
|
287
257
|
],
|
|
@@ -310,11 +280,7 @@ const createSingleClientWebpackConfig = (mode, entry, module) => ({
|
|
|
310
280
|
// Necessary for external CSS imports to work
|
|
311
281
|
// https://github.com/facebookincubator/create-react-app/issues/2677
|
|
312
282
|
ident: 'postcss',
|
|
313
|
-
plugins: () =>
|
|
314
|
-
const prefix = module ? (0, modules_1.getCssPrefixForModule)(module) : undefined;
|
|
315
|
-
return [...postcss_1.default]
|
|
316
|
-
.concat(prefix ? (0, postcss_prefix_selector_1.default)({ prefix: `:global(${prefix})` }) : []);
|
|
317
|
-
},
|
|
283
|
+
plugins: () => postcss_1.default,
|
|
318
284
|
},
|
|
319
285
|
},
|
|
320
286
|
],
|
|
@@ -342,8 +308,7 @@ const createSingleClientWebpackConfig = (mode, entry, module) => ({
|
|
|
342
308
|
],
|
|
343
309
|
},
|
|
344
310
|
plugins: ([
|
|
345
|
-
|
|
346
|
-
clientAssetsPlugin,
|
|
311
|
+
new assets_webpack_plugin_1.default({ path: app_configs_1.default.serverOutputPath }),
|
|
347
312
|
new webpack_1.default.DefinePlugin(Object.assign({
|
|
348
313
|
// Tell Webpack to provide empty mocks for process.env.
|
|
349
314
|
'process.env': '{}' }, (mode === 'dev'
|
|
@@ -384,13 +349,7 @@ const createSingleClientWebpackConfig = (mode, entry, module) => ({
|
|
|
384
349
|
// Ignore prop-types packages in production mode
|
|
385
350
|
// This should works fine, since proptypes usage should be eliminated in production mode
|
|
386
351
|
mode === 'prod' && !app_configs_1.default.keepPropTypes && new webpack_1.default.NormalModuleReplacementPlugin(/^react-style-proptype$/, noopPath),
|
|
387
|
-
mode === 'prod' && !app_configs_1.default.keepPropTypes && new webpack_1.default.NormalModuleReplacementPlugin(/^thrift-services\/proptypes/, noopPath)
|
|
388
|
-
app_configs_1.default.mfModules && !module && new webpack_1.default.container.ModuleFederationPlugin({
|
|
389
|
-
name: app_configs_1.default.mfModules.name || app_configs_1.default.normalizedName,
|
|
390
|
-
filename: app_configs_1.default.mfModules.exposes ? 'remoteEntry.js' : undefined,
|
|
391
|
-
shared: app_configs_1.default.mfModules.shared,
|
|
392
|
-
exposes: app_configs_1.default.mfModules.exposes,
|
|
393
|
-
}),
|
|
352
|
+
mode === 'prod' && !app_configs_1.default.keepPropTypes && new webpack_1.default.NormalModuleReplacementPlugin(/^thrift-services\/proptypes/, noopPath)
|
|
394
353
|
].filter(Boolean)),
|
|
395
354
|
experiments: {
|
|
396
355
|
backCompat: app_configs_1.default.webpack4Compatibility,
|
|
@@ -400,24 +359,11 @@ const createSingleClientWebpackConfig = (mode, entry, module) => ({
|
|
|
400
359
|
ignored: new RegExp(app_configs_1.default.watchIgnorePath.join('|')),
|
|
401
360
|
aggregateTimeout: 100,
|
|
402
361
|
},
|
|
403
|
-
//
|
|
362
|
+
// Turn off performance hints during development because we don't do any
|
|
363
|
+
// splitting or minification in interest of speed. These warnings become
|
|
364
|
+
// cumbersome.
|
|
404
365
|
performance: {
|
|
405
|
-
hints: false,
|
|
366
|
+
hints: mode === 'dev' ? false : 'warning',
|
|
406
367
|
},
|
|
407
368
|
});
|
|
408
|
-
exports.createSingleClientWebpackConfig = createSingleClientWebpackConfig;
|
|
409
|
-
const createClientWebpackConfig = (mode) => {
|
|
410
|
-
var _a;
|
|
411
|
-
const appWebpackConfig = (0, exports.createSingleClientWebpackConfig)(mode, app_configs_1.default.clientEntry);
|
|
412
|
-
const exposedModules = (_a = app_configs_1.default.embeddedModules) === null || _a === void 0 ? void 0 : _a.exposes;
|
|
413
|
-
if (!exposedModules || Object.keys(exposedModules).length === 0) {
|
|
414
|
-
return appWebpackConfig;
|
|
415
|
-
}
|
|
416
|
-
const modulesWebpackConfigs = Object.keys(exposedModules).map((moduleId) => {
|
|
417
|
-
return (0, exports.createSingleClientWebpackConfig)(mode, {
|
|
418
|
-
[moduleId]: exposedModules[moduleId].entry,
|
|
419
|
-
}, Object.assign({ name: moduleId }, exposedModules[moduleId]));
|
|
420
|
-
});
|
|
421
|
-
return [appWebpackConfig, ...modulesWebpackConfigs];
|
|
422
|
-
};
|
|
423
369
|
exports.createClientWebpackConfig = createClientWebpackConfig;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const config: import("webpack").Configuration
|
|
1
|
+
declare const config: import("webpack").Configuration;
|
|
2
2
|
export default config;
|
package/build/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { OverrideFile } from './configs/util/apply-overrides';
|
|
2
|
-
export type {
|
|
2
|
+
export type { PackageSettings } from './configs/app-configs/available-package-settings';
|
|
3
3
|
export { prepareFilesForDocker } from './commands/util/docker-build';
|
|
4
4
|
export { getBuildParamsFromArgs } from './commands/util/docker-build';
|
|
5
5
|
export { getDockerBuildCommand } from './commands/util/docker-build';
|