arui-scripts 14.5.0-feat-modules.3 → 14.5.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.
Files changed (48) hide show
  1. package/CHANGELOG.md +4 -21
  2. package/README.md +0 -2
  3. package/build/commands/build/build-wrapper.d.ts +2 -2
  4. package/build/commands/build/client.js +3 -3
  5. package/build/commands/bundle-analyze/index.js +7 -5
  6. package/build/commands/changelog/index.js +2 -2
  7. package/build/commands/start/client.js +2 -2
  8. package/build/commands/start-prod/client.js +2 -2
  9. package/build/commands/util/{run-client-dev-derver.d.ts → run-client-dev-server.d.ts} +1 -1
  10. package/build/commands/util/{run-client-dev-derver.js → run-client-dev-server.js} +4 -1
  11. package/build/configs/app-configs/available-package-settings.d.ts +8 -0
  12. package/build/configs/app-configs/available-package-settings.js +32 -0
  13. package/build/configs/app-configs/calculate-dependent-config.d.ts +8 -49
  14. package/build/configs/app-configs/calculate-dependent-config.js +13 -11
  15. package/build/configs/app-configs/get-defaults.d.ts +2 -3
  16. package/build/configs/app-configs/get-defaults.js +34 -50
  17. package/build/configs/app-configs/index.d.ts +3 -5
  18. package/build/configs/app-configs/index.js +7 -13
  19. package/build/configs/app-configs/types.d.ts +26 -61
  20. package/build/configs/app-configs/update-with-config-file.d.ts +2 -2
  21. package/build/configs/app-configs/update-with-config-file.js +7 -5
  22. package/build/configs/app-configs/update-with-env.js +8 -3
  23. package/build/configs/app-configs/update-with-package.d.ts +2 -2
  24. package/build/configs/app-configs/update-with-package.js +10 -5
  25. package/build/configs/app-configs/update-with-presets.d.ts +2 -2
  26. package/build/configs/app-configs/update-with-presets.js +15 -8
  27. package/build/configs/app-configs/validate-settings-keys.d.ts +5 -2
  28. package/build/configs/app-configs/validate-settings-keys.js +7 -6
  29. package/build/configs/babel-client.d.ts +1 -33
  30. package/build/configs/babel-dependencies.d.ts +1 -14
  31. package/build/configs/babel-server.d.ts +1 -26
  32. package/build/configs/dev-server.js +4 -11
  33. package/build/configs/jest/index.d.ts +1 -33
  34. package/build/configs/postcss.config.d.ts +1 -1
  35. package/build/configs/server-externals-exemptions.d.ts +1 -1
  36. package/build/configs/server-externals-exemptions.js +0 -1
  37. package/build/configs/util/apply-overrides.d.ts +6 -6
  38. package/build/configs/util/get-entry.d.ts +1 -2
  39. package/build/configs/webpack.client.d.ts +2 -5
  40. package/build/configs/webpack.client.dev.d.ts +1 -1
  41. package/build/configs/webpack.client.js +17 -71
  42. package/build/configs/webpack.client.prod.d.ts +1 -1
  43. package/build/index.d.ts +1 -1
  44. package/build/tsconfig-local.tsbuildinfo +1 -1
  45. package/package.json +3 -4
  46. package/build/configs/modules.d.ts +0 -15
  47. package/build/configs/modules.js +0 -78
  48. package/docs/modules.md +0 -439
@@ -1,7 +1,12 @@
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.updateWithEnv = void 0;
4
- const validate_settings_keys_1 = require("./validate-settings-keys");
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");
5
10
  function updateWithEnv(config) {
6
11
  if (!process.env.ARUI_SCRIPTS_CONFIG) {
7
12
  return config;
@@ -9,8 +14,8 @@ function updateWithEnv(config) {
9
14
  try {
10
15
  console.warn('Используйте ARUI_SCRIPTS_CONFIG только для отладки');
11
16
  const envSettings = JSON.parse(process.env.ARUI_SCRIPTS_CONFIG);
12
- (0, validate_settings_keys_1.validateSettingsKeys)(config, envSettings, 'ENV');
13
- return Object.assign(Object.assign({}, config), envSettings);
17
+ (0, validate_settings_keys_1.default)(available_package_settings_1.availablePackageSettings, envSettings);
18
+ return (0, lodash_merge_1.default)(config, envSettings);
14
19
  }
15
20
  catch (e) {
16
21
  console.error(e);
@@ -1,2 +1,2 @@
1
- import { AppConfigs, AppContext } from './types';
2
- export declare function updateWithPackage(config: AppConfigs, context: AppContext): any;
1
+ import { AppConfigs } from './types';
2
+ export declare function updateWithPackage(config: AppConfigs): any;
@@ -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 validate_settings_keys_1 = require("./validate-settings-keys");
5
- function updateWithPackage(config, context) {
6
- const packageSettings = context.appPackage.aruiScripts || {};
7
- (0, validate_settings_keys_1.validateSettingsKeys)(config, packageSettings, 'package.json');
8
- return Object.assign(Object.assign({}, config), packageSettings);
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, AppContext } from './types';
2
- export declare function updateWithPresets(config: AppConfigs, context: AppContext): 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
- function updateWithPresets(config, context) {
7
- if (!config.presets) {
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)(`${config.presets}/arui-scripts.config`, { paths: [context.cwd] });
11
- const presetsOverridesPath = (0, resolve_1.tryResolve)(`${config.presets}/arui-scripts.overrides`, { paths: [context.cwd] });
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.validateSettingsKeys)(config, presetsSettings, presetsConfigPath);
19
- config = Object.assign(Object.assign({}, config), presetsSettings);
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
- context.overridesPath.unshift(presetsOverridesPath);
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
- export declare function validateSettingsKeys(existingConfig: Record<string, unknown>, settingsObject: Record<string, unknown>, source?: string): void;
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(existingConfig, settingsObject, source) {
8
+ function validateSettingsKeys(availableKeys, settingsObject) {
8
9
  Object.keys(settingsObject).forEach((setting) => {
9
- if (typeof existingConfig[setting] === 'undefined') {
10
- console.warn(`Неизвестная настройка "${setting}" в ${source || 'конфигурации'}`);
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.validateSettingsKeys = validateSettingsKeys;
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;
@@ -32,17 +32,10 @@ const devServerConfig = (0, apply_overrides_1.default)('devServer', {
32
32
  const cspHeader = proxyRes.headers['content-security-policy'];
33
33
  if (typeof cspHeader === 'string' && !cspHeader.includes('unsafe-eval')) {
34
34
  proxyRes.headers['content-security-policy'] = cspHeader
35
- .replace(/script-src/, 'script-src \'unsafe-eval\'');
35
+ .replace(/script-src/, "script-src 'unsafe-eval'");
36
36
  }
37
- },
38
- } : {})),
39
- }),
40
- headers: app_configs_1.default.devServerCors
41
- ? {
42
- 'Access-Control-Allow-Origin': '*',
43
- 'Access-Control-Allow-Headers': '*',
44
- 'Access-Control-Allow-Methods': '*',
45
- }
46
- : {},
37
+ }
38
+ } : {}))
39
+ })
47
40
  });
48
41
  exports.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
  };
@@ -9,7 +9,7 @@ export declare const postcssPlugins: string[];
9
9
  export declare const postcssPluginsOptions: {
10
10
  'postcss-custom-properties'?: {
11
11
  preserve: boolean;
12
- importFrom: string | null;
12
+ importFrom: string | undefined;
13
13
  } | undefined;
14
14
  'postcss-import': {
15
15
  path: string[];
@@ -1 +1 @@
1
- export declare const serverExternalsExemptions: RegExp[];
1
+ export declare const serverExternalsExemptions: (string | RegExp)[];
@@ -17,5 +17,4 @@ exports.serverExternalsExemptions = (0, apply_overrides_1.default)('serverExtern
17
17
  /^date-fns/,
18
18
  /^@corp-front\//,
19
19
  /^corp-sign-ui-react/,
20
- /^arui-sciprts-utils/,
21
20
  ]);
@@ -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 | WebpackConfiguration[];
6
- webpackClient: WebpackConfiguration | WebpackConfiguration[];
7
- webpackDev: WebpackConfiguration | WebpackConfiguration[];
8
- webpackClientDev: WebpackConfiguration | 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 | 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<T extends Overrides[Key], Key extends keyof Overrides>(overridesKey: Key | Key[], config: T): T;
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: Entry, getSingleEntry: (entry: string[], ...args: AdditionalArgs) => string[], ...args: AdditionalArgs): string[] | Record<string, string | string[]>;
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 webpack, { Configuration } from 'webpack';
2
- import { Entry } from './util/get-entry';
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 | 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 = exports.createSingleClientWebpackConfig = void 0;
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 postcss_prefix_selector_1 = __importDefault(require("postcss-prefix-selector"));
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
- // Нам важно шарить assets plugin между разными сборками, чтобы файл не перезаписывался
38
- const assetsPlugin = new assets_webpack_plugin_1.default({
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)(entry, getSingleEntry, mode),
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: (0, modules_1.haveExposedMfModules)()
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: (_, chunks, cacheGroupKey) => {
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
- assetsPlugin,
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
- // Выключаем performance hints, т.к. размеры бандлов контролируются не в рамках arui-scripts
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 | 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 { AppConfigs, PackageSettings } from './configs/app-configs/types';
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';