@unpackjs/core 1.7.5 → 1.7.6
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/compiled/css-loader/index.js +180 -178
- package/compiled/less-loader/index.js +11 -11
- package/compiled/line-diff/index.js +4 -4
- package/compiled/portfinder/index.js +37 -37
- package/compiled/postcss-loader/index.js +261 -256
- package/compiled/sass-loader/index.js +18 -18
- package/compiled/semver/index.js +188 -170
- package/compiled/semver/package.json +1 -1
- package/compiled/style-loader/index.js +13 -13
- package/compiled/webpack-bundle-analyzer/index.js +198 -198
- package/compiled/webpack-merge/index.js +29 -29
- package/dist/bundler-config/chunkSplit.cjs +169 -156
- package/dist/bundler-config/chunkSplit.d.ts +1 -1
- package/dist/bundler-config/chunkSplit.js +125 -134
- package/dist/bundler-config/css.cjs +181 -158
- package/dist/bundler-config/css.d.ts +1 -1
- package/dist/bundler-config/css.js +139 -151
- package/dist/bundler-config/experimentCss.cjs +203 -159
- package/dist/bundler-config/experimentCss.d.ts +1 -1
- package/dist/bundler-config/experimentCss.js +162 -152
- package/dist/bundler-config/helper.cjs +82 -78
- package/dist/bundler-config/helper.js +36 -55
- package/dist/bundler-config/index.cjs +260 -209
- package/dist/bundler-config/index.d.ts +1 -1
- package/dist/bundler-config/index.d.ts.map +1 -1
- package/dist/bundler-config/index.js +209 -182
- package/dist/bundler-config/jsMinify.cjs +114 -95
- package/dist/bundler-config/jsMinify.js +70 -73
- package/dist/colors.cjs +83 -56
- package/dist/colors.js +38 -37
- package/dist/config.cjs +107 -93
- package/dist/config.d.ts +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +64 -70
- package/dist/constants.cjs +62 -62
- package/dist/constants.js +20 -38
- package/dist/createUnpack.cjs +111 -104
- package/dist/createUnpack.js +67 -82
- package/dist/global.cjs +36 -0
- package/dist/global.d.ts +2 -0
- package/dist/global.d.ts.map +1 -0
- package/dist/global.js +4 -0
- package/dist/index.cjs +174 -51
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +33 -15
- package/dist/lightningcss/cache.cjs +40 -32
- package/dist/lightningcss/cache.js +10 -20
- package/dist/lightningcss/loader.cjs +56 -53
- package/dist/lightningcss/loader.d.ts +1 -1
- package/dist/lightningcss/loader.js +25 -34
- package/dist/lightningcss/minimizer.cjs +90 -109
- package/dist/lightningcss/minimizer.d.ts +1 -1
- package/dist/lightningcss/minimizer.js +59 -87
- package/dist/logger.cjs +104 -98
- package/dist/logger.d.ts +1 -1
- package/dist/logger.js +59 -76
- package/dist/openBrowser.cjs +104 -81
- package/dist/openBrowser.js +56 -52
- package/dist/plugin-progress/rspack.cjs +104 -79
- package/dist/plugin-progress/rspack.d.ts +1 -1
- package/dist/plugin-progress/rspack.js +59 -57
- package/dist/plugin-progress/webpack.cjs +111 -89
- package/dist/plugin-progress/webpack.d.ts +1 -1
- package/dist/plugin-progress/webpack.js +65 -67
- package/dist/plugin.cjs +38 -29
- package/dist/plugin.js +8 -17
- package/dist/prebundleDeps.cjs +327 -337
- package/dist/prebundleDeps.d.ts.map +1 -1
- package/dist/prebundleDeps.js +278 -324
- package/dist/progressBar.cjs +82 -65
- package/dist/progressBar.js +38 -43
- package/dist/reporter.cjs +135 -120
- package/dist/reporter.js +88 -98
- package/dist/run/build.cjs +68 -67
- package/dist/run/build.d.ts +1 -1
- package/dist/run/build.js +24 -45
- package/dist/run/dev.cjs +96 -83
- package/dist/run/dev.d.ts +1 -1
- package/dist/run/dev.d.ts.map +1 -1
- package/dist/run/dev.js +50 -61
- package/dist/run/index.cjs +74 -21
- package/dist/run/index.js +2 -9
- package/dist/typed-css-modules/loader.cjs +179 -188
- package/dist/typed-css-modules/loader.d.ts +1 -1
- package/dist/typed-css-modules/loader.js +118 -151
- package/dist/typed-css-modules/plugin.cjs +113 -88
- package/dist/typed-css-modules/plugin.d.ts +1 -1
- package/dist/typed-css-modules/plugin.js +68 -66
- package/dist/typed-css-modules/utils.cjs +43 -42
- package/dist/typed-css-modules/utils.d.ts +1 -1
- package/dist/typed-css-modules/utils.js +13 -30
- package/dist/types/chunkSplit.cjs +19 -15
- package/dist/types/chunkSplit.d.ts +2 -10
- package/dist/types/chunkSplit.d.ts.map +1 -1
- package/dist/types/chunkSplit.js +2 -9
- package/dist/types/config.cjs +19 -15
- package/dist/types/config.d.ts +1 -1
- package/dist/types/config.js +2 -9
- package/dist/types/index.cjs +101 -27
- package/dist/types/index.js +2 -9
- package/dist/types/lightningcss.cjs +19 -15
- package/dist/types/lightningcss.js +2 -9
- package/dist/types/logger.cjs +43 -34
- package/dist/types/logger.js +13 -22
- package/dist/types/plugin.cjs +19 -15
- package/dist/types/plugin.js +2 -9
- package/dist/utils.cjs +280 -304
- package/dist/utils.js +195 -241
- package/dist/watchFiles.cjs +73 -0
- package/dist/watchFiles.d.ts +3 -0
- package/dist/watchFiles.d.ts.map +1 -0
- package/dist/watchFiles.js +27 -0
- package/package.json +14 -17
- package/compiled/commander/index.d.ts +0 -1047
- package/compiled/commander/index.js +0 -2428
- package/compiled/commander/license +0 -22
- package/compiled/commander/package.json +0 -1
- package/dist/bundleRequire.cjs +0 -200
- package/dist/bundleRequire.d.ts +0 -5
- package/dist/bundleRequire.d.ts.map +0 -1
- package/dist/bundleRequire.js +0 -173
|
@@ -1,159 +1,150 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
var getFilename = () => fileURLToPath(import.meta.url);
|
|
7
|
-
var getDirname = () => path.dirname(getFilename());
|
|
8
|
-
var __dirname = /* @__PURE__ */ getDirname();
|
|
9
|
-
var __filename = /* @__PURE__ */ getFilename();
|
|
10
|
-
import assert from "node:assert";
|
|
11
|
-
import { NODE_MODULES_REGEX } from "../constants.js";
|
|
12
|
-
import { setValueByPath } from "../utils.js";
|
|
1
|
+
import __rslib_shim_module__ from 'module';
|
|
2
|
+
/*#__PURE__*/ import.meta.url;
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_assert_3e74d44e__ from "node:assert";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE__constants_js_59e7fa1b__ from "../constants.js";
|
|
5
|
+
import * as __WEBPACK_EXTERNAL_MODULE__utils_js_db66b9f7__ from "../utils.js";
|
|
13
6
|
function getForceSplittingGroups(forceSplitting) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
7
|
+
const cacheGroups = {};
|
|
8
|
+
const pairs = Array.isArray(forceSplitting) ? forceSplitting.map((regexp, index)=>[
|
|
9
|
+
`force-split-${index}`,
|
|
10
|
+
regexp
|
|
11
|
+
]) : Object.entries(forceSplitting);
|
|
12
|
+
for (const [key, regexp] of pairs)cacheGroups[key] = {
|
|
13
|
+
test: regexp,
|
|
14
|
+
name: key,
|
|
15
|
+
chunks: 'all',
|
|
16
|
+
priority: 0,
|
|
17
|
+
enforce: true
|
|
24
18
|
};
|
|
25
|
-
|
|
26
|
-
return cacheGroups;
|
|
19
|
+
return cacheGroups;
|
|
27
20
|
}
|
|
28
21
|
function splitByExperience(ctx) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
};
|
|
35
|
-
for (const [name, test] of Object.entries(packageRegExps)) {
|
|
36
|
-
const key = `lib-${name}`;
|
|
37
|
-
experienceCacheGroup[key] = {
|
|
38
|
-
test,
|
|
39
|
-
priority: 0,
|
|
40
|
-
name: key
|
|
22
|
+
const { defaultConfig, forceSplittingGroups } = ctx;
|
|
23
|
+
const experienceCacheGroup = {};
|
|
24
|
+
const packageRegExps = {
|
|
25
|
+
axios: /node_modules[\\/]axios(-.+)?[\\/]/,
|
|
26
|
+
polyfill: /node_modules[\\/](?:tslib|core-js|@swc[\\/]helpers)[\\/]/
|
|
41
27
|
};
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
28
|
+
for (const [name, test] of Object.entries(packageRegExps)){
|
|
29
|
+
const key = `lib-${name}`;
|
|
30
|
+
experienceCacheGroup[key] = {
|
|
31
|
+
test,
|
|
32
|
+
priority: 0,
|
|
33
|
+
name: key
|
|
34
|
+
};
|
|
49
35
|
}
|
|
50
|
-
|
|
36
|
+
return {
|
|
37
|
+
...defaultConfig,
|
|
38
|
+
cacheGroups: {
|
|
39
|
+
...defaultConfig.cacheGroups,
|
|
40
|
+
...experienceCacheGroup,
|
|
41
|
+
...forceSplittingGroups
|
|
42
|
+
}
|
|
43
|
+
};
|
|
51
44
|
}
|
|
52
45
|
function splitBySize(ctx) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
46
|
+
const { forceSplittingGroups, defaultConfig, chunkSplit } = ctx;
|
|
47
|
+
(0, __WEBPACK_EXTERNAL_MODULE_node_assert_3e74d44e__["default"])('split-by-size' === chunkSplit.strategy);
|
|
48
|
+
return {
|
|
49
|
+
...defaultConfig,
|
|
50
|
+
minSize: chunkSplit.minSize ?? 0,
|
|
51
|
+
maxSize: chunkSplit.maxSize ?? Number.POSITIVE_INFINITY,
|
|
52
|
+
cacheGroups: {
|
|
53
|
+
...defaultConfig.cacheGroups,
|
|
54
|
+
...forceSplittingGroups
|
|
55
|
+
}
|
|
56
|
+
};
|
|
64
57
|
}
|
|
65
58
|
const MODULE_PATH_REGEX = /.*[\\/]node_modules[\\/](?!\.pnpm[\\/])(?:(@[^\\/]+)[\\/])?([^\\/]+)/;
|
|
66
59
|
function getPackageNameFromModulePath(modulePath) {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
60
|
+
const handleModuleContext = null == modulePath ? void 0 : modulePath.match(MODULE_PATH_REGEX);
|
|
61
|
+
if (!handleModuleContext) return;
|
|
62
|
+
const [, scope, name] = handleModuleContext;
|
|
63
|
+
const packageName = [
|
|
64
|
+
'npm',
|
|
65
|
+
(scope ?? '').replace('@', ''),
|
|
66
|
+
name
|
|
67
|
+
].filter(Boolean).join('.');
|
|
68
|
+
return packageName;
|
|
74
69
|
}
|
|
75
70
|
function splitByModule(ctx) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
71
|
+
const { forceSplittingGroups, defaultConfig } = ctx;
|
|
72
|
+
return {
|
|
73
|
+
...defaultConfig,
|
|
74
|
+
minSize: 0,
|
|
75
|
+
maxInitialRequests: Number.POSITIVE_INFINITY,
|
|
76
|
+
cacheGroups: {
|
|
77
|
+
...defaultConfig.cacheGroups,
|
|
78
|
+
...forceSplittingGroups,
|
|
79
|
+
vendors: {
|
|
80
|
+
priority: -9,
|
|
81
|
+
test: __WEBPACK_EXTERNAL_MODULE__constants_js_59e7fa1b__.NODE_MODULES_REGEX,
|
|
82
|
+
name (module) {
|
|
83
|
+
return module ? getPackageNameFromModulePath(module.context) : void 0;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
89
86
|
}
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
};
|
|
87
|
+
};
|
|
93
88
|
}
|
|
94
89
|
function splitCustom(ctx) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
90
|
+
const { forceSplittingGroups, defaultConfig } = ctx;
|
|
91
|
+
return {
|
|
92
|
+
...defaultConfig,
|
|
93
|
+
cacheGroups: {
|
|
94
|
+
...defaultConfig.cacheGroups,
|
|
95
|
+
...forceSplittingGroups
|
|
96
|
+
}
|
|
97
|
+
};
|
|
103
98
|
}
|
|
104
99
|
function allInOne(_ctx) {
|
|
105
|
-
|
|
100
|
+
return false;
|
|
106
101
|
}
|
|
107
102
|
function singleVendor(ctx) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
103
|
+
const { defaultConfig, forceSplittingGroups } = ctx;
|
|
104
|
+
const singleVendorCacheGroup = {
|
|
105
|
+
singleVendor: {
|
|
106
|
+
test: __WEBPACK_EXTERNAL_MODULE__constants_js_59e7fa1b__.NODE_MODULES_REGEX,
|
|
107
|
+
priority: 0,
|
|
108
|
+
chunks: 'all',
|
|
109
|
+
name: 'vendor',
|
|
110
|
+
enforce: true
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
return {
|
|
114
|
+
...defaultConfig,
|
|
115
|
+
cacheGroups: {
|
|
116
|
+
...defaultConfig.cacheGroups,
|
|
117
|
+
...singleVendorCacheGroup,
|
|
118
|
+
...forceSplittingGroups
|
|
119
|
+
}
|
|
120
|
+
};
|
|
126
121
|
}
|
|
127
122
|
const SPLIT_STRATEGY_DISPATCHER = {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
123
|
+
'split-by-experience': splitByExperience,
|
|
124
|
+
'split-by-module': splitByModule,
|
|
125
|
+
'split-by-size': splitBySize,
|
|
126
|
+
custom: splitCustom,
|
|
127
|
+
'all-in-one': allInOne,
|
|
128
|
+
'single-vendor': singleVendor
|
|
134
129
|
};
|
|
135
|
-
const applyChunkSplitConfig = ({
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
130
|
+
const applyChunkSplitConfig = ({ config, unpackConfig })=>{
|
|
131
|
+
const { chunkSplit } = unpackConfig.performance || {};
|
|
132
|
+
if (null == chunkSplit ? void 0 : chunkSplit.strategy) {
|
|
133
|
+
let forceSplittingGroups = {};
|
|
134
|
+
if (null == chunkSplit ? void 0 : chunkSplit.forceSplitting) forceSplittingGroups = getForceSplittingGroups(chunkSplit.forceSplitting);
|
|
135
|
+
const defaultConfig = {
|
|
136
|
+
chunks: 'all'
|
|
137
|
+
};
|
|
138
|
+
const splitChunksOptions = SPLIT_STRATEGY_DISPATCHER[chunkSplit.strategy]({
|
|
139
|
+
defaultConfig,
|
|
140
|
+
forceSplittingGroups,
|
|
141
|
+
chunkSplit
|
|
142
|
+
});
|
|
143
|
+
(0, __WEBPACK_EXTERNAL_MODULE__utils_js_db66b9f7__.setValueByPath)(config, [
|
|
144
|
+
'optimization',
|
|
145
|
+
'splitChunks'
|
|
146
|
+
], splitChunksOptions);
|
|
144
147
|
}
|
|
145
|
-
|
|
146
|
-
chunks: "all"
|
|
147
|
-
};
|
|
148
|
-
const splitChunksOptions = SPLIT_STRATEGY_DISPATCHER[chunkSplit.strategy]({
|
|
149
|
-
defaultConfig,
|
|
150
|
-
forceSplittingGroups,
|
|
151
|
-
chunkSplit
|
|
152
|
-
});
|
|
153
|
-
setValueByPath(config, ["optimization", "splitChunks"], splitChunksOptions);
|
|
154
|
-
}
|
|
155
|
-
return config;
|
|
156
|
-
};
|
|
157
|
-
export {
|
|
158
|
-
applyChunkSplitConfig
|
|
148
|
+
return config;
|
|
159
149
|
};
|
|
150
|
+
export { applyChunkSplitConfig };
|
|
@@ -1,166 +1,189 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = function(module) {
|
|
5
|
+
var getter = module && module.__esModule ? function() {
|
|
6
|
+
return module['default'];
|
|
7
|
+
} : function() {
|
|
8
|
+
return module;
|
|
9
|
+
};
|
|
10
|
+
__webpack_require__.d(getter, {
|
|
11
|
+
a: getter
|
|
12
|
+
});
|
|
13
|
+
return getter;
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
(()=>{
|
|
17
|
+
__webpack_require__.d = function(exports1, definition) {
|
|
18
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: definition[key]
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
(()=>{
|
|
25
|
+
__webpack_require__.o = function(obj, prop) {
|
|
26
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
27
|
+
};
|
|
28
|
+
})();
|
|
29
|
+
(()=>{
|
|
30
|
+
__webpack_require__.r = function(exports1) {
|
|
31
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
32
|
+
value: 'Module'
|
|
33
|
+
});
|
|
34
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
35
|
+
value: true
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
})();
|
|
39
|
+
var __webpack_exports__ = {};
|
|
40
|
+
__webpack_require__.r(__webpack_exports__);
|
|
41
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
42
|
+
applyCssConfig: ()=>applyCssConfig
|
|
31
43
|
});
|
|
32
|
-
|
|
33
|
-
var
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
var
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
return import_constants.CSS_MODULES_REGEX.test(resourcePath);
|
|
56
|
-
if ((0, import_utils.isRegExp)(auto))
|
|
57
|
-
return auto.test(resourcePath);
|
|
58
|
-
if ((0, import_utils.isFunction)(auto))
|
|
59
|
-
return auto(resourcePath);
|
|
60
|
-
return import_constants.CSS_MODULES_REGEX.test(resourcePath);
|
|
44
|
+
const external_node_path_namespaceObject = require("node:path");
|
|
45
|
+
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
|
46
|
+
const core_namespaceObject = require("@rspack/core");
|
|
47
|
+
const external_mini_css_extract_plugin_namespaceObject = require("mini-css-extract-plugin");
|
|
48
|
+
var external_mini_css_extract_plugin_default = /*#__PURE__*/ __webpack_require__.n(external_mini_css_extract_plugin_namespaceObject);
|
|
49
|
+
const external_constants_cjs_namespaceObject = require("../constants.cjs");
|
|
50
|
+
const external_utils_cjs_namespaceObject = require("../utils.cjs");
|
|
51
|
+
const external_helper_cjs_namespaceObject = require("./helper.cjs");
|
|
52
|
+
function applyCssConfig({ config, unpackConfig }) {
|
|
53
|
+
var _unpackConfig_css, _unpackConfig_build, _unpackConfig_css1, _unpackConfig_css2, _config_module_rules, _config_module, _config_module_rules1, _config_module1, _unpackConfig_css3, _unpackConfig_css4, _config_module_rules2, _config_module2;
|
|
54
|
+
const MiniCssExtractPlugin = 'rspack' === unpackConfig.bundler ? core_namespaceObject.rspack.CssExtractRspackPlugin : external_mini_css_extract_plugin_default();
|
|
55
|
+
let modules = null === (_unpackConfig_css = unpackConfig.css) || void 0 === _unpackConfig_css ? void 0 : _unpackConfig_css.modules;
|
|
56
|
+
if (!(0, external_utils_cjs_namespaceObject.isPlainObject)(modules) && false !== modules) modules = {};
|
|
57
|
+
const getAutoOption = ()=>{
|
|
58
|
+
if (false === modules) return false;
|
|
59
|
+
const auto = modules.auto;
|
|
60
|
+
if (false === auto) return false;
|
|
61
|
+
return (resourcePath)=>{
|
|
62
|
+
if (resourcePath.includes('node_modules')) return external_constants_cjs_namespaceObject.CSS_MODULES_REGEX.test(resourcePath);
|
|
63
|
+
if ((0, external_utils_cjs_namespaceObject.isRegExp)(auto)) return auto.test(resourcePath);
|
|
64
|
+
if ((0, external_utils_cjs_namespaceObject.isFunction)(auto)) return auto(resourcePath);
|
|
65
|
+
return external_constants_cjs_namespaceObject.CSS_MODULES_REGEX.test(resourcePath);
|
|
66
|
+
};
|
|
61
67
|
};
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
loader: (0, import_utils.getCompiledPkgPath)("css-loader"),
|
|
80
|
-
options: {
|
|
81
|
-
importLoaders,
|
|
82
|
-
modules: {
|
|
83
|
-
auto: getAutoOption(),
|
|
84
|
-
localIdentName: modules !== false && (modules.localIdentName || import_constants.CSS_MODULES_LOCAL_IDENT_NAME),
|
|
85
|
-
exportLocalsConvention: import_constants.EXPORT_LOCALS_CONVENTION,
|
|
86
|
-
namedExport: import_constants.CSS_NAMED_EXPORT
|
|
87
|
-
},
|
|
88
|
-
sourceMap: unpackConfig.css?.sourceMap
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
].filter(Boolean);
|
|
92
|
-
if (!(0, import_utils.isDevServer)()) {
|
|
93
|
-
config.plugins.push(
|
|
94
|
-
new MiniCssExtractPlugin({
|
|
95
|
-
filename: (0, import_helper.getOutputFilename)({ type: "css", hash: unpackConfig.build?.filenameHash })
|
|
96
|
-
})
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
|
-
config.module?.rules?.push({
|
|
100
|
-
test: /\.less$/i,
|
|
101
|
-
use: [
|
|
102
|
-
...getCommonRules({ importLoaders: 1 }),
|
|
103
|
-
unpackConfig.build?.parallel && {
|
|
104
|
-
loader: require.resolve("thread-loader"),
|
|
105
|
-
options: import_constants.THREAD_OPTIONS
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
loader: (0, import_utils.getCompiledPkgPath)("less-loader"),
|
|
109
|
-
options: {
|
|
110
|
-
lessOptions: (0, import_utils.mergeConfig)(
|
|
68
|
+
const getCommonRules = ({ importLoaders })=>{
|
|
69
|
+
var _unpackConfig_css;
|
|
70
|
+
return [
|
|
71
|
+
(0, external_utils_cjs_namespaceObject.isDevServer)() ? {
|
|
72
|
+
loader: (0, external_utils_cjs_namespaceObject.getCompiledPkgPath)('style-loader')
|
|
73
|
+
} : {
|
|
74
|
+
loader: MiniCssExtractPlugin.loader,
|
|
75
|
+
options: {
|
|
76
|
+
defaultExport: true
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
(0, external_utils_cjs_namespaceObject.isDev)() && {
|
|
80
|
+
loader: external_node_path_default().resolve(__dirname, '../typed-css-modules/loader.cjs'),
|
|
81
|
+
options: {
|
|
82
|
+
modules
|
|
83
|
+
}
|
|
84
|
+
},
|
|
111
85
|
{
|
|
112
|
-
|
|
86
|
+
loader: (0, external_utils_cjs_namespaceObject.getCompiledPkgPath)('css-loader'),
|
|
87
|
+
options: {
|
|
88
|
+
importLoaders,
|
|
89
|
+
modules: {
|
|
90
|
+
auto: getAutoOption(),
|
|
91
|
+
localIdentName: false !== modules && (modules.localIdentName || external_constants_cjs_namespaceObject.CSS_MODULES_LOCAL_IDENT_NAME),
|
|
92
|
+
exportLocalsConvention: external_constants_cjs_namespaceObject.EXPORT_LOCALS_CONVENTION,
|
|
93
|
+
namedExport: external_constants_cjs_namespaceObject.CSS_NAMED_EXPORT
|
|
94
|
+
},
|
|
95
|
+
sourceMap: null === (_unpackConfig_css = unpackConfig.css) || void 0 === _unpackConfig_css ? void 0 : _unpackConfig_css.sourceMap
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
].filter(Boolean);
|
|
99
|
+
};
|
|
100
|
+
if (!(0, external_utils_cjs_namespaceObject.isDevServer)()) {
|
|
101
|
+
var _unpackConfig_build1;
|
|
102
|
+
config.plugins.push(new MiniCssExtractPlugin({
|
|
103
|
+
filename: (0, external_helper_cjs_namespaceObject.getOutputFilename)({
|
|
104
|
+
type: 'css',
|
|
105
|
+
hash: null === (_unpackConfig_build1 = unpackConfig.build) || void 0 === _unpackConfig_build1 ? void 0 : _unpackConfig_build1.filenameHash
|
|
106
|
+
})
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
109
|
+
null === (_config_module = config.module) || void 0 === _config_module || null === (_config_module_rules = _config_module.rules) || void 0 === _config_module_rules || _config_module_rules.push({
|
|
110
|
+
test: /\.less$/i,
|
|
111
|
+
use: [
|
|
112
|
+
...getCommonRules({
|
|
113
|
+
importLoaders: 1
|
|
114
|
+
}),
|
|
115
|
+
(null === (_unpackConfig_build = unpackConfig.build) || void 0 === _unpackConfig_build ? void 0 : _unpackConfig_build.parallel) && {
|
|
116
|
+
loader: require.resolve('thread-loader'),
|
|
117
|
+
options: external_constants_cjs_namespaceObject.THREAD_OPTIONS
|
|
113
118
|
},
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
119
|
+
{
|
|
120
|
+
loader: (0, external_utils_cjs_namespaceObject.getCompiledPkgPath)('less-loader'),
|
|
121
|
+
options: {
|
|
122
|
+
lessOptions: (0, external_utils_cjs_namespaceObject.mergeConfig)({
|
|
123
|
+
javascriptEnabled: true
|
|
124
|
+
}, (null === (_unpackConfig_css1 = unpackConfig.css) || void 0 === _unpackConfig_css1 ? void 0 : _unpackConfig_css1.less) || {}),
|
|
125
|
+
implementation: (0, external_utils_cjs_namespaceObject.getUserDepPath)(unpackConfig.root, 'less'),
|
|
126
|
+
sourceMap: null === (_unpackConfig_css2 = unpackConfig.css) || void 0 === _unpackConfig_css2 ? void 0 : _unpackConfig_css2.sourceMap
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
].filter(Boolean)
|
|
130
|
+
});
|
|
131
|
+
const getLightningcssLoader = ()=>{
|
|
132
|
+
var _unpackConfig_css, _unpackConfig_css1;
|
|
133
|
+
return {
|
|
134
|
+
loader: external_node_path_default().resolve(__dirname, '../lightningcss/loader.cjs'),
|
|
135
|
+
options: (0, external_utils_cjs_namespaceObject.mergeConfig)((null === (_unpackConfig_css = unpackConfig.css) || void 0 === _unpackConfig_css ? void 0 : _unpackConfig_css.lightningcss) || {}, {
|
|
136
|
+
sourceMap: null === (_unpackConfig_css1 = unpackConfig.css) || void 0 === _unpackConfig_css1 ? void 0 : _unpackConfig_css1.sourceMap
|
|
137
|
+
})
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
const getPostcssLoader = ()=>{
|
|
141
|
+
var _unpackConfig_css, _unpackConfig_css1;
|
|
142
|
+
return {
|
|
143
|
+
loader: (0, external_utils_cjs_namespaceObject.getCompiledPkgPath)('postcss-loader'),
|
|
144
|
+
options: {
|
|
145
|
+
postcssOptions: null === (_unpackConfig_css = unpackConfig.css) || void 0 === _unpackConfig_css ? void 0 : _unpackConfig_css.postcss,
|
|
146
|
+
sourceMap: null === (_unpackConfig_css1 = unpackConfig.css) || void 0 === _unpackConfig_css1 ? void 0 : _unpackConfig_css1.sourceMap
|
|
147
|
+
}
|
|
148
|
+
};
|
|
128
149
|
};
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
loader: (0, import_utils.getCompiledPkgPath)("postcss-loader"),
|
|
133
|
-
options: {
|
|
134
|
-
postcssOptions: unpackConfig.css?.postcss,
|
|
135
|
-
sourceMap: unpackConfig.css?.sourceMap
|
|
136
|
-
}
|
|
150
|
+
const getCssLoader = ()=>{
|
|
151
|
+
var _unpackConfig_css;
|
|
152
|
+
return (null === (_unpackConfig_css = unpackConfig.css) || void 0 === _unpackConfig_css ? void 0 : _unpackConfig_css.transformer) === 'lightningcss' ? getLightningcssLoader() : getPostcssLoader();
|
|
137
153
|
};
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
154
|
+
null === (_config_module1 = config.module) || void 0 === _config_module1 || null === (_config_module_rules1 = _config_module1.rules) || void 0 === _config_module_rules1 || _config_module_rules1.push({
|
|
155
|
+
test: /\.css$/i,
|
|
156
|
+
use: [
|
|
157
|
+
...getCommonRules({
|
|
158
|
+
importLoaders: 1
|
|
159
|
+
}),
|
|
160
|
+
getCssLoader()
|
|
161
|
+
]
|
|
162
|
+
});
|
|
163
|
+
null === (_config_module2 = config.module) || void 0 === _config_module2 || null === (_config_module_rules2 = _config_module2.rules) || void 0 === _config_module_rules2 || _config_module_rules2.push({
|
|
164
|
+
test: /\.s[ac]ss$/i,
|
|
165
|
+
use: [
|
|
166
|
+
...getCommonRules({
|
|
167
|
+
importLoaders: 1
|
|
168
|
+
}),
|
|
169
|
+
{
|
|
170
|
+
loader: (0, external_utils_cjs_namespaceObject.getCompiledPkgPath)('sass-loader'),
|
|
171
|
+
options: {
|
|
172
|
+
api: 'modern-compiler',
|
|
173
|
+
implementation: (0, external_utils_cjs_namespaceObject.getUserDepPath)(unpackConfig.root, [
|
|
174
|
+
'sass-embedded',
|
|
175
|
+
'sass'
|
|
176
|
+
]),
|
|
177
|
+
sassOptions: null === (_unpackConfig_css3 = unpackConfig.css) || void 0 === _unpackConfig_css3 ? void 0 : _unpackConfig_css3.sass,
|
|
178
|
+
sourceMap: null === (_unpackConfig_css4 = unpackConfig.css) || void 0 === _unpackConfig_css4 ? void 0 : _unpackConfig_css4.sourceMap
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
]
|
|
182
|
+
});
|
|
183
|
+
return config;
|
|
162
184
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
185
|
+
var __webpack_export_target__ = exports;
|
|
186
|
+
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
187
|
+
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
|
|
188
|
+
value: true
|
|
166
189
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BundlerConfiguration, UnpackConfig } from '
|
|
1
|
+
import type { BundlerConfiguration, UnpackConfig } from 'src/types/index';
|
|
2
2
|
export declare function applyCssConfig({ config, unpackConfig, }: {
|
|
3
3
|
config: BundlerConfiguration;
|
|
4
4
|
unpackConfig: UnpackConfig;
|