arui-scripts 15.4.1 → 15.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.
- package/.turbo/turbo-test.log +2 -2
- package/CHANGELOG.md +16 -0
- package/README.md +2 -0
- package/build/commands/bundle-analyze/index.js +6 -5
- package/build/configs/app-configs/calculate-dependent-config.d.ts +17 -0
- package/build/configs/app-configs/get-defaults.js +3 -0
- package/build/configs/app-configs/types.d.ts +22 -0
- package/build/configs/dev-server.d.ts +1 -15
- package/build/configs/dev-server.js +11 -4
- package/build/configs/modules.d.ts +16 -0
- package/build/configs/modules.js +101 -0
- package/build/configs/postcss.config.js +4 -4
- package/build/configs/process-assets-plugin-output.js +14 -0
- package/build/configs/server-externals-exemptions.js +1 -0
- package/build/configs/util/find-loader.d.ts +2 -0
- package/build/configs/util/find-loader.js +23 -0
- package/build/configs/webpack.client.d.ts +1 -1
- package/build/configs/webpack.client.dev.d.ts +1 -1
- package/build/configs/webpack.client.js +16 -1
- package/build/configs/webpack.client.prod.d.ts +1 -1
- package/build/tsconfig-local.tsbuildinfo +1 -1
- package/docs/modules.md +572 -0
- package/package.json +4 -2
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
PASS src/configs/app-configs/__tests__/update-with-presets.tests.ts (
|
|
1
|
+
PASS src/configs/app-configs/__tests__/update-with-presets.tests.ts (14.362 s)
|
|
2
2
|
PASS src/configs/util/__tests__/get-polyfills.tests.ts
|
|
3
3
|
PASS src/configs/util/__tests__/apply-overrides.tests.ts
|
|
4
4
|
PASS src/configs/app-configs/__tests__/update-with-env.tests.ts
|
|
@@ -87,5 +87,5 @@ PASS src/configs/app-configs/__tests__/validate-settings-keys.tests.ts
|
|
|
87
87
|
Test Suites: 6 passed, 6 total
|
|
88
88
|
Tests: 17 passed, 17 total
|
|
89
89
|
Snapshots: 0 total
|
|
90
|
-
Time:
|
|
90
|
+
Time: 15.75 s
|
|
91
91
|
Ran all test suites.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# [15.3.0](https://github.com/core-ds/arui-scripts/compare/v15.2.0...v15.3.0) (2023-06-30)
|
|
2
2
|
|
|
3
|
+
## 15.5.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#64](https://github.com/core-ds/arui-scripts/pull/64) [`82b0587`](https://github.com/core-ds/arui-scripts/commit/82b0587b9333193a6eaad3ed29b2d3a32745479c) Thanks [@heymdall-legal](https://github.com/heymdall-legal)! - Always load custom media variables, remove css vars when keepCssVars set to false
|
|
8
|
+
|
|
9
|
+
## 15.5.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#56](https://github.com/core-ds/arui-scripts/pull/56) [`1c64198`](https://github.com/core-ds/arui-scripts/commit/1c641989791c4ff1e7a20d05c115f8a1d7817e30) Thanks [@heymdall-legal](https://github.com/heymdall-legal)! - Add modules support and various tools to work with them correctly.
|
|
14
|
+
|
|
15
|
+
Modules provides a way to define reusable piece of code to consume from different applications.
|
|
16
|
+
Additional tooling provides a convenient way to consume this modules in applications.
|
|
17
|
+
Full documentation is available in [separate doc](https://github.com/core-ds/arui-scripts/blob/master/packages/arui-scripts/docs/modules.md).
|
|
18
|
+
|
|
3
19
|
## 15.4.1
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -95,6 +95,8 @@ npm install arui-scripts --save-dev
|
|
|
95
95
|
- `imageMinimizer.png.colorTypeReduction` - допускает изменение представления изображения (оттенки серого / прозрачность / пр.). По умолчанию `false`. [Подробнее](https://github.com/imagemin/imagemin-optipng#colortypereduction)
|
|
96
96
|
- `imageMinimizer.png.paletteReduction` - допускает уменьшение палитры изображения. По умолчанию `false`. [Подробнее](https://github.com/imagemin/imagemin-optipng#palettereduction)
|
|
97
97
|
- `imageMinimizer.png.interlaced` - потоковый порядок передачи изображение. По умолчанию этот параметр идентичен значению из входного изображения. [Подробнее](https://github.com/imagemin/imagemin-optipng#interlaced)
|
|
98
|
+
- `devServerCors` - включает добавление cors-заголовков в dev-server. Может быть полезным при локальном тестировании модулей.
|
|
99
|
+
- `modules`, `compatModules` - позволяет настраивать работу с модулями, подробнее в разделе [Модули](./docs/modules.md).
|
|
98
100
|
|
|
99
101
|
В целях отладки все эти настройки можно переопределить не изменяя package.json
|
|
100
102
|
Просто передайте необходимые настройки в environment переменной ARUI_SCRIPTS_CONFIG
|
|
@@ -16,19 +16,20 @@ const webpack_1 = __importDefault(require("webpack"));
|
|
|
16
16
|
const webpack_bundle_analyzer_1 = require("webpack-bundle-analyzer");
|
|
17
17
|
const make_tmp_dir_1 = __importDefault(require("../util/make-tmp-dir"));
|
|
18
18
|
const webpack_client_prod_1 = __importDefault(require("../../configs/webpack.client.prod"));
|
|
19
|
+
const app_configs_1 = __importDefault(require("../../configs/app-configs"));
|
|
19
20
|
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
21
|
let clientWebpackConfigs = Array.isArray(webpack_client_prod_1.default) ? webpack_client_prod_1.default : [webpack_client_prod_1.default];
|
|
21
|
-
const promises = clientWebpackConfigs.map((
|
|
22
|
+
const promises = clientWebpackConfigs.map((webpackConfig, i) => __awaiter(void 0, void 0, void 0, function* () {
|
|
22
23
|
const tmpDir = yield (0, make_tmp_dir_1.default)(i.toString());
|
|
23
|
-
|
|
24
|
-
...
|
|
24
|
+
webpackConfig.plugins = [
|
|
25
|
+
...(webpackConfig.plugins || []),
|
|
25
26
|
new webpack_bundle_analyzer_1.BundleAnalyzerPlugin({
|
|
26
27
|
generateStatsFile: true,
|
|
27
|
-
statsFilename:
|
|
28
|
+
statsFilename: app_configs_1.default.statsOutputPath,
|
|
28
29
|
analyzerPort: 'auto',
|
|
29
30
|
}),
|
|
30
31
|
];
|
|
31
|
-
|
|
32
|
+
webpackConfig.output = Object.assign(Object.assign({}, webpackConfig.output), { path: tmpDir });
|
|
32
33
|
}));
|
|
33
34
|
yield Promise.all(promises);
|
|
34
35
|
(0, webpack_1.default)(clientWebpackConfigs).run(() => { });
|
|
@@ -52,6 +52,23 @@ export declare function calculateDependentConfig(config: AppConfigs): {
|
|
|
52
52
|
} | undefined;
|
|
53
53
|
componentsTheme: string | null;
|
|
54
54
|
keepCssVars: boolean;
|
|
55
|
+
compatModules: {
|
|
56
|
+
shared?: {
|
|
57
|
+
[libraryName: string]: string;
|
|
58
|
+
} | undefined;
|
|
59
|
+
exposes?: {
|
|
60
|
+
[moduleId: string]: {
|
|
61
|
+
entry: string;
|
|
62
|
+
externals?: Record<string, string> | undefined;
|
|
63
|
+
cssPrefix?: string | false | undefined;
|
|
64
|
+
};
|
|
65
|
+
} | undefined;
|
|
66
|
+
} | null;
|
|
67
|
+
modules: {
|
|
68
|
+
name?: string | undefined;
|
|
69
|
+
shared: any;
|
|
70
|
+
exposes?: Record<string, string> | undefined;
|
|
71
|
+
} | null;
|
|
55
72
|
};
|
|
56
73
|
/**
|
|
57
74
|
* Обновление контекста в зависимости от ключей конфига
|
|
@@ -51,6 +51,27 @@ export type AppConfigs = {
|
|
|
51
51
|
};
|
|
52
52
|
componentsTheme: string | null;
|
|
53
53
|
keepCssVars: boolean;
|
|
54
|
+
compatModules: {
|
|
55
|
+
shared?: {
|
|
56
|
+
[libraryName: string]: string;
|
|
57
|
+
};
|
|
58
|
+
exposes?: {
|
|
59
|
+
[moduleId: string]: CompatModuleConfigBase;
|
|
60
|
+
};
|
|
61
|
+
} | null;
|
|
62
|
+
modules: {
|
|
63
|
+
name?: string;
|
|
64
|
+
shared: any;
|
|
65
|
+
exposes?: Record<string, string>;
|
|
66
|
+
} | null;
|
|
67
|
+
};
|
|
68
|
+
type CompatModuleConfigBase = {
|
|
69
|
+
entry: string;
|
|
70
|
+
externals?: Record<string, string>;
|
|
71
|
+
cssPrefix?: false | string;
|
|
72
|
+
};
|
|
73
|
+
export type CompatModuleConfig = CompatModuleConfigBase & {
|
|
74
|
+
name: string;
|
|
54
75
|
};
|
|
55
76
|
/**
|
|
56
77
|
* Внутренний контекст arui-scripts
|
|
@@ -84,3 +105,4 @@ export type AppContext = {
|
|
|
84
105
|
};
|
|
85
106
|
export type AppContextWithConfigs = AppContext & AppConfigs;
|
|
86
107
|
export type PackageSettings = Partial<AppConfigs>;
|
|
108
|
+
export {};
|
|
@@ -1,16 +1,2 @@
|
|
|
1
|
-
declare const devServerConfig:
|
|
2
|
-
port: number;
|
|
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
|
+
declare const devServerConfig: import("webpack-dev-server").Configuration;
|
|
16
2
|
export default devServerConfig;
|
|
@@ -32,10 +32,17 @@ 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/,
|
|
35
|
+
.replace(/script-src/, 'script-src \'unsafe-eval\'');
|
|
36
36
|
}
|
|
37
|
-
}
|
|
38
|
-
} : {}))
|
|
39
|
-
})
|
|
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
|
+
: {},
|
|
40
47
|
});
|
|
41
48
|
exports.default = devServerConfig;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import webpack from 'webpack';
|
|
2
|
+
import { CompatModuleConfig } from './app-configs/types';
|
|
3
|
+
export declare function haveExposedDefaultModules(): Record<string, string> | undefined;
|
|
4
|
+
export declare const MODULES_ENTRY_NAME = "remoteEntry.js";
|
|
5
|
+
export declare function patchMainWebpackConfigForModules(webpackConf: webpack.Configuration): webpack.Configuration;
|
|
6
|
+
export declare function getCssPrefixForModule(module: CompatModuleConfig): string | undefined;
|
|
7
|
+
export declare function getExposeLoadersFormCompatModules(): {
|
|
8
|
+
test: string;
|
|
9
|
+
use: {
|
|
10
|
+
loader: string;
|
|
11
|
+
options: {
|
|
12
|
+
exposes: string[];
|
|
13
|
+
};
|
|
14
|
+
}[];
|
|
15
|
+
}[];
|
|
16
|
+
export declare function patchWebpackConfigForCompat(module: CompatModuleConfig, webpackConf: webpack.Configuration): webpack.Configuration;
|
|
@@ -0,0 +1,101 @@
|
|
|
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.patchWebpackConfigForCompat = exports.getExposeLoadersFormCompatModules = exports.getCssPrefixForModule = exports.patchMainWebpackConfigForModules = exports.MODULES_ENTRY_NAME = exports.haveExposedDefaultModules = void 0;
|
|
7
|
+
const webpack_1 = __importDefault(require("webpack"));
|
|
8
|
+
const postcss_prefix_selector_1 = __importDefault(require("postcss-prefix-selector"));
|
|
9
|
+
const app_configs_1 = __importDefault(require("./app-configs"));
|
|
10
|
+
const find_loader_1 = require("./util/find-loader");
|
|
11
|
+
function haveExposedDefaultModules() {
|
|
12
|
+
var _a;
|
|
13
|
+
return (_a = app_configs_1.default.modules) === null || _a === void 0 ? void 0 : _a.exposes;
|
|
14
|
+
}
|
|
15
|
+
exports.haveExposedDefaultModules = haveExposedDefaultModules;
|
|
16
|
+
exports.MODULES_ENTRY_NAME = 'remoteEntry.js';
|
|
17
|
+
function patchMainWebpackConfigForModules(webpackConf) {
|
|
18
|
+
// Добавляем expose loader для библиотек, которые мы хотим вынести в глобальную область видимости
|
|
19
|
+
webpackConf.module.rules.unshift(...getExposeLoadersFormCompatModules());
|
|
20
|
+
if (!app_configs_1.default.modules || !webpackConf.output || !webpackConf.plugins) {
|
|
21
|
+
return webpackConf;
|
|
22
|
+
}
|
|
23
|
+
webpackConf.output.publicPath = haveExposedDefaultModules()
|
|
24
|
+
? 'auto' // Для того чтобы модули могли подключаться из разных мест, нам необходимо использовать auto. Для корректной работы в IE надо подключaть https://github.com/amiller-gh/currentScript-polyfill
|
|
25
|
+
: app_configs_1.default.publicPath;
|
|
26
|
+
webpackConf.plugins.push(new webpack_1.default.container.ModuleFederationPlugin({
|
|
27
|
+
name: app_configs_1.default.modules.name || app_configs_1.default.normalizedName,
|
|
28
|
+
filename: app_configs_1.default.modules.exposes ? exports.MODULES_ENTRY_NAME : undefined,
|
|
29
|
+
shared: app_configs_1.default.modules.shared,
|
|
30
|
+
exposes: app_configs_1.default.modules.exposes,
|
|
31
|
+
}));
|
|
32
|
+
return webpackConf;
|
|
33
|
+
}
|
|
34
|
+
exports.patchMainWebpackConfigForModules = patchMainWebpackConfigForModules;
|
|
35
|
+
function getCssPrefixForModule(module) {
|
|
36
|
+
if (module.cssPrefix) {
|
|
37
|
+
return module.cssPrefix;
|
|
38
|
+
}
|
|
39
|
+
if (module.cssPrefix === false) {
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
return `.module-${module.name}`;
|
|
43
|
+
}
|
|
44
|
+
exports.getCssPrefixForModule = getCssPrefixForModule;
|
|
45
|
+
function getExposeLoadersFormCompatModules() {
|
|
46
|
+
var _a;
|
|
47
|
+
const shared = (_a = app_configs_1.default.compatModules) === null || _a === void 0 ? void 0 : _a.shared;
|
|
48
|
+
if (!shared) {
|
|
49
|
+
return [];
|
|
50
|
+
}
|
|
51
|
+
return Object.keys(shared).map((libraryName) => {
|
|
52
|
+
const globalVarName = shared[libraryName];
|
|
53
|
+
return {
|
|
54
|
+
test: require.resolve(libraryName),
|
|
55
|
+
use: [
|
|
56
|
+
{
|
|
57
|
+
loader: require.resolve('expose-loader'),
|
|
58
|
+
options: {
|
|
59
|
+
exposes: [globalVarName],
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
};
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
exports.getExposeLoadersFormCompatModules = getExposeLoadersFormCompatModules;
|
|
67
|
+
function addPrefixCssRule(rule, prefix) {
|
|
68
|
+
if (!rule || !rule.use || !Array.isArray(rule.use)) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const postCssLoader = rule.use.find((loaderConfig) => {
|
|
72
|
+
var _a;
|
|
73
|
+
if (typeof loaderConfig === 'string' || typeof loaderConfig === 'function' || !loaderConfig) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
return ((_a = loaderConfig.loader) === null || _a === void 0 ? void 0 : _a.indexOf('postcss-loader')) !== -1;
|
|
77
|
+
});
|
|
78
|
+
if (!postCssLoader || typeof postCssLoader !== 'object' || !postCssLoader.options || typeof postCssLoader.options !== 'object') {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
postCssLoader.options.postcssOptions.plugins = [
|
|
82
|
+
...postCssLoader.options.postcssOptions.plugins,
|
|
83
|
+
(0, postcss_prefix_selector_1.default)({ prefix }),
|
|
84
|
+
];
|
|
85
|
+
}
|
|
86
|
+
function patchWebpackConfigForCompat(module, webpackConf) {
|
|
87
|
+
webpackConf.externals = Object.assign(Object.assign({}, (webpackConf.externals || {})), (module.externals || {}));
|
|
88
|
+
// Название переменной вебпака, которую он будет использовать для загрузки чанков. Важно чтобы для разных модулей они отличались,
|
|
89
|
+
// иначе несколько модулей из одного приложения будут конфликтовать между собой
|
|
90
|
+
webpackConf.output.uniqueName = module.name;
|
|
91
|
+
const cssPrefix = getCssPrefixForModule(module);
|
|
92
|
+
if (cssPrefix) {
|
|
93
|
+
// Добавляем префикс для css-классов, чтобы изолировать стили модуля от стилей основного приложения
|
|
94
|
+
const cssRule = (0, find_loader_1.findLoader)(webpackConf, '/\\.css$/');
|
|
95
|
+
const cssModulesRule = (0, find_loader_1.findLoader)(webpackConf, '/\\.module\\.css$/');
|
|
96
|
+
addPrefixCssRule(cssRule, cssPrefix);
|
|
97
|
+
addPrefixCssRule(cssModulesRule, `:global(${cssPrefix})`);
|
|
98
|
+
}
|
|
99
|
+
return webpackConf;
|
|
100
|
+
}
|
|
101
|
+
exports.patchWebpackConfigForCompat = patchWebpackConfigForCompat;
|
|
@@ -28,9 +28,9 @@ exports.postcssPlugins = [
|
|
|
28
28
|
'postcss-mixins',
|
|
29
29
|
'postcss-for',
|
|
30
30
|
'postcss-each',
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
app_configs_1.default.
|
|
31
|
+
'@csstools/postcss-global-data',
|
|
32
|
+
'postcss-custom-media',
|
|
33
|
+
!app_configs_1.default.keepCssVars && 'postcss-custom-properties',
|
|
34
34
|
'postcss-strip-units',
|
|
35
35
|
'postcss-calc',
|
|
36
36
|
'postcss-color-function',
|
|
@@ -46,7 +46,7 @@ exports.postcssPluginsOptions = {
|
|
|
46
46
|
},
|
|
47
47
|
'@csstools/postcss-global-data': {
|
|
48
48
|
files: [
|
|
49
|
-
|
|
49
|
+
path_1.default.join(__dirname, 'mq.css'),
|
|
50
50
|
app_configs_1.default.componentsTheme
|
|
51
51
|
].filter(Boolean),
|
|
52
52
|
},
|
|
@@ -4,8 +4,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.processAssetsPluginOutput = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
7
8
|
const app_configs_1 = __importDefault(require("./app-configs"));
|
|
9
|
+
const modules_1 = require("./modules");
|
|
8
10
|
function processAssetsPluginOutput(assets) {
|
|
11
|
+
var _a;
|
|
9
12
|
let adjustedAssets = assets;
|
|
10
13
|
Object.keys(adjustedAssets).forEach((key) => {
|
|
11
14
|
// заменяем путь к файлам на корректный в случае если в нем есть 'auto/'
|
|
@@ -14,6 +17,17 @@ function processAssetsPluginOutput(assets) {
|
|
|
14
17
|
js: replaceAutoPath(adjustedAssets[key].js),
|
|
15
18
|
};
|
|
16
19
|
});
|
|
20
|
+
// добавляем в манифест js-файлы для модулей
|
|
21
|
+
Object.keys(((_a = app_configs_1.default.modules) === null || _a === void 0 ? void 0 : _a.exposes) || {}).forEach((moduleName) => {
|
|
22
|
+
var _a, _b;
|
|
23
|
+
if ((_b = (_a = app_configs_1.default.compatModules) === null || _a === void 0 ? void 0 : _a.exposes) === null || _b === void 0 ? void 0 : _b[moduleName]) {
|
|
24
|
+
throw new Error(`Модуль ${moduleName} определен как module и как compat. Поменяйте название одного из модулей или удалите его`);
|
|
25
|
+
}
|
|
26
|
+
adjustedAssets[moduleName] = {
|
|
27
|
+
mode: 'default',
|
|
28
|
+
js: path_1.default.join(app_configs_1.default.publicPath, modules_1.MODULES_ENTRY_NAME),
|
|
29
|
+
};
|
|
30
|
+
});
|
|
17
31
|
const result = Object.assign(Object.assign({}, adjustedAssets), { __metadata__: {
|
|
18
32
|
version: app_configs_1.default.version,
|
|
19
33
|
name: app_configs_1.default.normalizedName,
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findLoader = void 0;
|
|
4
|
+
function findLoader(config, testRule) {
|
|
5
|
+
var _a;
|
|
6
|
+
for (const rule of config.module.rules) {
|
|
7
|
+
if (rule === '...' || !rule) {
|
|
8
|
+
// Webpack имеет странный тип для rules, который позволяет в него положить строку '...'. Успокаиваем TS
|
|
9
|
+
continue;
|
|
10
|
+
}
|
|
11
|
+
if (rule.test && rule.test.toString() === testRule) {
|
|
12
|
+
return rule;
|
|
13
|
+
}
|
|
14
|
+
if (rule.oneOf) {
|
|
15
|
+
for (const oneOfRule of rule.oneOf) {
|
|
16
|
+
if (oneOfRule && oneOfRule.test && ((_a = oneOfRule === null || oneOfRule === void 0 ? void 0 : oneOfRule.test) === null || _a === void 0 ? void 0 : _a.toString()) === testRule) {
|
|
17
|
+
return oneOfRule;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.findLoader = findLoader;
|
|
@@ -7,4 +7,4 @@ import { Entry } from './util/get-entry';
|
|
|
7
7
|
* @param configName Имя конфигурации, если не указано, то используется имя по умолчанию
|
|
8
8
|
*/
|
|
9
9
|
export declare const createSingleClientWebpackConfig: (mode: 'dev' | 'prod', entry: Entry, configName?: string) => Configuration;
|
|
10
|
-
export declare const createClientWebpackConfig: (mode: 'dev' | 'prod') => webpack.Configuration;
|
|
10
|
+
export declare const createClientWebpackConfig: (mode: 'dev' | 'prod') => webpack.Configuration | webpack.Configuration[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const config: import("webpack").Configuration;
|
|
1
|
+
declare const config: import("webpack").Configuration | import("webpack").Configuration[];
|
|
2
2
|
export default config;
|
|
@@ -27,6 +27,7 @@ const webpack_deduplication_plugin_1 = require("webpack-deduplication-plugin");
|
|
|
27
27
|
const minimizers_1 = require("./config-extras/minimizers");
|
|
28
28
|
const mini_svg_data_uri_1 = __importDefault(require("mini-svg-data-uri"));
|
|
29
29
|
const process_assets_plugin_output_1 = require("./process-assets-plugin-output");
|
|
30
|
+
const modules_1 = require("./modules");
|
|
30
31
|
const PnpWebpackPlugin = require('pnp-webpack-plugin');
|
|
31
32
|
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
|
|
32
33
|
const noopPath = require.resolve('./util/noop');
|
|
@@ -382,6 +383,20 @@ const createSingleClientWebpackConfig = (mode, entry, configName) => (Object.ass
|
|
|
382
383
|
} }));
|
|
383
384
|
exports.createSingleClientWebpackConfig = createSingleClientWebpackConfig;
|
|
384
385
|
const createClientWebpackConfig = (mode) => {
|
|
385
|
-
|
|
386
|
+
var _a;
|
|
387
|
+
const appWebpackConfig = (0, modules_1.patchMainWebpackConfigForModules)((0, exports.createSingleClientWebpackConfig)(mode, app_configs_1.default.clientEntry));
|
|
388
|
+
const exposedCompatModules = (_a = app_configs_1.default.compatModules) === null || _a === void 0 ? void 0 : _a.exposes;
|
|
389
|
+
if (!exposedCompatModules || Object.keys(exposedCompatModules).length === 0) {
|
|
390
|
+
return appWebpackConfig;
|
|
391
|
+
}
|
|
392
|
+
// Добавляем отдельные конфигурации для compat модулей
|
|
393
|
+
const modulesWebpackConfigs = Object.keys(exposedCompatModules).map((moduleName) => {
|
|
394
|
+
const module = Object.assign({ name: moduleName }, exposedCompatModules[moduleName]);
|
|
395
|
+
const config = (0, exports.createSingleClientWebpackConfig)(mode, {
|
|
396
|
+
[module.name]: module.entry,
|
|
397
|
+
}, module.name);
|
|
398
|
+
return (0, modules_1.patchWebpackConfigForCompat)(module, config);
|
|
399
|
+
});
|
|
400
|
+
return [appWebpackConfig, ...modulesWebpackConfigs];
|
|
386
401
|
};
|
|
387
402
|
exports.createClientWebpackConfig = createClientWebpackConfig;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const config: import("webpack").Configuration;
|
|
1
|
+
declare const config: import("webpack").Configuration | import("webpack").Configuration[];
|
|
2
2
|
export default config;
|