@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
package/dist/utils.js
CHANGED
|
@@ -1,254 +1,208 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const setNodeEnv = (env) => {
|
|
21
|
-
process.env.NODE_ENV = env;
|
|
22
|
-
};
|
|
23
|
-
const setDevServer = (isDevServer2) => {
|
|
24
|
-
process.env.DEV_SERVER = isDevServer2 ? "true" : "false";
|
|
25
|
-
};
|
|
26
|
-
const isDev = () => getNodeEnv() === "development";
|
|
27
|
-
const isDevServer = () => process.env.DEV_SERVER === "true";
|
|
28
|
-
const isWatch = () => isDev() && !isDevServer();
|
|
29
|
-
const isProd = () => getNodeEnv() === "production";
|
|
30
|
-
const isWin = () => process.platform === "win32";
|
|
31
|
-
const isString = (str) => typeof str === "string";
|
|
32
|
-
const isBoolean = (bool) => typeof bool === "boolean";
|
|
33
|
-
const isUndefined = (obj) => typeof obj === "undefined";
|
|
34
|
-
const isFunction = (func) => typeof func === "function";
|
|
35
|
-
const isObject = (obj) => obj !== null && typeof obj === "object";
|
|
36
|
-
const isPlainObject = (obj) => isObject(obj) && Object.prototype.toString.call(obj) === "[object Object]";
|
|
37
|
-
const isRegExp = (obj) => Object.prototype.toString.call(obj) === "[object RegExp]";
|
|
38
|
-
const prettyTime = (seconds) => {
|
|
39
|
-
const toFixed = (num, len) => {
|
|
40
|
-
const factor = 10 ** len;
|
|
41
|
-
return Math.floor(num * factor) / factor;
|
|
42
|
-
};
|
|
43
|
-
if (seconds < 1) {
|
|
44
|
-
return `${toFixed(seconds * 1e3, 0)}ms`;
|
|
45
|
-
}
|
|
46
|
-
if (seconds < 60) {
|
|
47
|
-
return `${toFixed(seconds, 1)}s`;
|
|
48
|
-
}
|
|
49
|
-
return `${toFixed(seconds / 60, 2)}m`;
|
|
50
|
-
};
|
|
51
|
-
const getValueByPath = (target, pathArray, defaultValue) => {
|
|
52
|
-
let current = target;
|
|
53
|
-
for (let i = 0; i < pathArray.length - 1; i++) {
|
|
54
|
-
const currKey = pathArray[i];
|
|
55
|
-
if (!current[currKey] || typeof current[currKey] !== "object") {
|
|
56
|
-
current[currKey] = typeof pathArray[i + 1] === "string" ? {} : [];
|
|
1
|
+
import __rslib_shim_module__ from 'module';
|
|
2
|
+
/*#__PURE__*/ import.meta.url;
|
|
3
|
+
import { fileURLToPath as __webpack_fileURLToPath__ } from "node:url";
|
|
4
|
+
import { dirname as __webpack_dirname__ } from "node:path";
|
|
5
|
+
import * as __WEBPACK_EXTERNAL_MODULE__home_runner_work_unpack_unpack_packages_core_compiled_portfinder_index_js_09b3c3f2__ from "/home/runner/work/unpack/unpack/packages/core/compiled/portfinder/index.js";
|
|
6
|
+
import * as __WEBPACK_EXTERNAL_MODULE__home_runner_work_unpack_unpack_packages_core_compiled_webpack_merge_index_js_67d3284f__ from "/home/runner/work/unpack/unpack/packages/core/compiled/webpack-merge/index.js";
|
|
7
|
+
import * as __WEBPACK_EXTERNAL_MODULE__colors_js_b738ede3__ from "./colors.js";
|
|
8
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__ from "node:fs";
|
|
9
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_net_0373943e__ from "node:net";
|
|
10
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_os_74b4b876__ from "node:os";
|
|
11
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
|
|
12
|
+
import * as __WEBPACK_EXTERNAL_MODULE__constants_js_e283b470__ from "./constants.js";
|
|
13
|
+
import * as __WEBPACK_EXTERNAL_MODULE__logger_js_c2be5186__ from "./logger.js";
|
|
14
|
+
var __webpack_modules__ = {
|
|
15
|
+
"compiled/portfinder/index.js": function(module) {
|
|
16
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__home_runner_work_unpack_unpack_packages_core_compiled_portfinder_index_js_09b3c3f2__;
|
|
17
|
+
},
|
|
18
|
+
"compiled/webpack-merge/index.js": function(module) {
|
|
19
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__home_runner_work_unpack_unpack_packages_core_compiled_webpack_merge_index_js_67d3284f__;
|
|
57
20
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
21
|
+
};
|
|
22
|
+
var __webpack_module_cache__ = {};
|
|
23
|
+
function __webpack_require__(moduleId) {
|
|
24
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
25
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
26
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
27
|
+
exports: {}
|
|
28
|
+
};
|
|
29
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
30
|
+
return module.exports;
|
|
31
|
+
}
|
|
32
|
+
var utils_rslib_entry_dirname = __webpack_dirname__(__webpack_fileURLToPath__(import.meta.url));
|
|
33
|
+
const portfinder = __webpack_require__("compiled/portfinder/index.js");
|
|
34
|
+
const { merge } = __webpack_require__("compiled/webpack-merge/index.js");
|
|
35
|
+
const getNodeEnv = ()=>process.env.NODE_ENV;
|
|
36
|
+
const setNodeEnv = (env)=>{
|
|
37
|
+
process.env.NODE_ENV = env;
|
|
38
|
+
};
|
|
39
|
+
const setDevServer = (isDevServer)=>{
|
|
40
|
+
process.env.DEV_SERVER = isDevServer ? 'true' : 'false';
|
|
41
|
+
};
|
|
42
|
+
const isDev = ()=>'development' === getNodeEnv();
|
|
43
|
+
const utils_rslib_entry_isDevServer = ()=>'true' === process.env.DEV_SERVER;
|
|
44
|
+
const isWatch = ()=>isDev() && !utils_rslib_entry_isDevServer();
|
|
45
|
+
const isProd = ()=>'production' === getNodeEnv();
|
|
46
|
+
const isWin = ()=>'win32' === process.platform;
|
|
47
|
+
const isString = (str)=>'string' == typeof str;
|
|
48
|
+
const isBoolean = (bool)=>'boolean' == typeof bool;
|
|
49
|
+
const isUndefined = (obj)=>void 0 === obj;
|
|
50
|
+
const isFunction = (func)=>'function' == typeof func;
|
|
51
|
+
const isObject = (obj)=>null !== obj && 'object' == typeof obj;
|
|
52
|
+
const isPlainObject = (obj)=>isObject(obj) && '[object Object]' === Object.prototype.toString.call(obj);
|
|
53
|
+
const isRegExp = (obj)=>'[object RegExp]' === Object.prototype.toString.call(obj);
|
|
54
|
+
const prettyTime = (seconds)=>{
|
|
55
|
+
const toFixed = (num, len)=>{
|
|
56
|
+
const factor = 10 ** len;
|
|
57
|
+
return Math.floor(num * factor) / factor;
|
|
58
|
+
};
|
|
59
|
+
if (seconds < 1) return `${toFixed(1000 * seconds, 0)}ms`;
|
|
60
|
+
if (seconds < 60) return `${toFixed(seconds, 1)}s`;
|
|
61
|
+
return `${toFixed(seconds / 60, 2)}m`;
|
|
62
|
+
};
|
|
63
|
+
const getValueByPath = (target, pathArray, defaultValue)=>{
|
|
64
|
+
let current = target;
|
|
65
|
+
for(let i = 0; i < pathArray.length - 1; i++){
|
|
66
|
+
const currKey = pathArray[i];
|
|
67
|
+
if (!current[currKey] || 'object' != typeof current[currKey]) current[currKey] = 'string' == typeof pathArray[i + 1] ? {} : [];
|
|
68
|
+
current = current[currKey];
|
|
69
|
+
}
|
|
70
|
+
const lastKey = pathArray.at(-1);
|
|
71
|
+
if (void 0 === current[lastKey]) current[lastKey] = defaultValue;
|
|
72
|
+
return current[lastKey];
|
|
73
|
+
};
|
|
74
|
+
const setValueByPath = (target, pathArray, value)=>{
|
|
75
|
+
let current = target;
|
|
76
|
+
for(let i = 0; i < pathArray.length - 1; i++){
|
|
77
|
+
const currKey = pathArray[i];
|
|
78
|
+
if (!current[currKey] || 'object' != typeof current[currKey]) current[currKey] = 'string' == typeof pathArray[i + 1] ? {} : [];
|
|
79
|
+
current = current[currKey];
|
|
72
80
|
}
|
|
73
|
-
current =
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
const getUserDepPath = (root, deps) => {
|
|
91
|
-
const dependencies = Array.isArray(deps) ? deps : [deps];
|
|
92
|
-
for (const dep of dependencies) {
|
|
93
|
-
const absPath = path2.resolve(root, "node_modules", dep);
|
|
94
|
-
if (fs.existsSync(absPath)) {
|
|
95
|
-
return absPath;
|
|
81
|
+
current[pathArray.at(-1)] = value;
|
|
82
|
+
};
|
|
83
|
+
const getPort = (startPort)=>new Promise((resolve)=>{
|
|
84
|
+
portfinder.getPort({
|
|
85
|
+
port: startPort
|
|
86
|
+
}, (_, port)=>{
|
|
87
|
+
resolve(port);
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
const getCompiledPkgPath = (packageName)=>__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(utils_rslib_entry_dirname, '../compiled', packageName);
|
|
91
|
+
const getUserDepPath = (root, deps)=>{
|
|
92
|
+
const dependencies = Array.isArray(deps) ? deps : [
|
|
93
|
+
deps
|
|
94
|
+
];
|
|
95
|
+
for (const dep of dependencies){
|
|
96
|
+
const absPath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(root, 'node_modules', dep);
|
|
97
|
+
if (__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].existsSync(absPath)) return absPath;
|
|
96
98
|
}
|
|
97
|
-
}
|
|
98
99
|
};
|
|
99
100
|
function getTime() {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
101
|
+
const now = new Date();
|
|
102
|
+
const hours = String(now.getHours()).padStart(2, '0');
|
|
103
|
+
const minutes = String(now.getMinutes()).padStart(2, '0');
|
|
104
|
+
const seconds = String(now.getSeconds()).padStart(2, '0');
|
|
105
|
+
return `${hours}:${minutes}:${seconds}`;
|
|
105
106
|
}
|
|
106
|
-
const debounce = (fn, delay)
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
};
|
|
115
|
-
const getIpv4Interfaces = ()
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
if (detail.family === familyV4Value && !ipv4Interfaces.has(detail.address)) {
|
|
122
|
-
ipv4Interfaces.set(detail.address, detail);
|
|
123
|
-
}
|
|
107
|
+
const debounce = (fn, delay)=>{
|
|
108
|
+
let timer = null;
|
|
109
|
+
return (...args)=>{
|
|
110
|
+
clearTimeout(timer);
|
|
111
|
+
timer = setTimeout(()=>{
|
|
112
|
+
fn(...args);
|
|
113
|
+
}, delay);
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
const getIpv4Interfaces = ()=>{
|
|
117
|
+
const interfaces = __WEBPACK_EXTERNAL_MODULE_node_os_74b4b876__["default"].networkInterfaces();
|
|
118
|
+
const ipv4Interfaces = new Map();
|
|
119
|
+
for (const key of Object.keys(interfaces))for (const detail of interfaces[key]){
|
|
120
|
+
const familyV4Value = 'string' == typeof detail.family ? 'IPv4' : 4;
|
|
121
|
+
if (detail.family === familyV4Value && !ipv4Interfaces.has(detail.address)) ipv4Interfaces.set(detail.address, detail);
|
|
124
122
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
if (net.isIPv6(host)) {
|
|
134
|
-
return host === "::" ? "[::1]" : `[${host}]`;
|
|
135
|
-
}
|
|
136
|
-
return host;
|
|
137
|
-
};
|
|
138
|
-
const concatUrl = ({
|
|
139
|
-
host,
|
|
140
|
-
port,
|
|
141
|
-
protocol
|
|
142
|
-
}) => `${protocol}://${host}:${port}/`;
|
|
143
|
-
const LOCAL_LABEL = "Local: ";
|
|
144
|
-
const NETWORK_LABEL = "Network: ";
|
|
145
|
-
const getAddressUrls = ({
|
|
146
|
-
protocol = "http",
|
|
147
|
-
port,
|
|
148
|
-
host
|
|
149
|
-
}) => {
|
|
150
|
-
if (host && host !== DEFAULT_DEV_HOST) {
|
|
151
|
-
return [
|
|
152
|
-
{
|
|
153
|
-
label: isLoopbackHost(host) ? LOCAL_LABEL : NETWORK_LABEL,
|
|
154
|
-
url: concatUrl({
|
|
155
|
-
port,
|
|
156
|
-
host: getHostInUrl(host),
|
|
157
|
-
protocol
|
|
158
|
-
})
|
|
159
|
-
}
|
|
123
|
+
return Array.from(ipv4Interfaces.values());
|
|
124
|
+
};
|
|
125
|
+
const isLoopbackHost = (host)=>{
|
|
126
|
+
const loopbackHosts = [
|
|
127
|
+
'localhost',
|
|
128
|
+
'127.0.0.1',
|
|
129
|
+
'::1',
|
|
130
|
+
'0000:0000:0000:0000:0000:0000:0000:0001'
|
|
160
131
|
];
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
132
|
+
return loopbackHosts.includes(host);
|
|
133
|
+
};
|
|
134
|
+
const getHostInUrl = (host)=>{
|
|
135
|
+
if (__WEBPACK_EXTERNAL_MODULE_node_net_0373943e__["default"].isIPv6(host)) return '::' === host ? '[::1]' : `[${host}]`;
|
|
136
|
+
return host;
|
|
137
|
+
};
|
|
138
|
+
const concatUrl = ({ host, port, protocol })=>`${protocol}://${host}:${port}/`;
|
|
139
|
+
const LOCAL_LABEL = 'Local: ';
|
|
140
|
+
const NETWORK_LABEL = 'Network: ';
|
|
141
|
+
const getAddressUrls = ({ protocol = 'http', port, host })=>{
|
|
142
|
+
if (host && host !== __WEBPACK_EXTERNAL_MODULE__constants_js_e283b470__.DEFAULT_DEV_HOST) return [
|
|
143
|
+
{
|
|
144
|
+
label: isLoopbackHost(host) ? LOCAL_LABEL : NETWORK_LABEL,
|
|
145
|
+
url: concatUrl({
|
|
146
|
+
port,
|
|
147
|
+
host: getHostInUrl(host),
|
|
148
|
+
protocol
|
|
149
|
+
})
|
|
150
|
+
}
|
|
151
|
+
];
|
|
152
|
+
const ipv4Interfaces = getIpv4Interfaces();
|
|
153
|
+
const addressUrls = [];
|
|
154
|
+
let hasLocalUrl = false;
|
|
155
|
+
for (const detail of ipv4Interfaces)if (isLoopbackHost(detail.address) || detail.internal) {
|
|
156
|
+
if (hasLocalUrl) continue;
|
|
157
|
+
addressUrls.push({
|
|
158
|
+
label: LOCAL_LABEL,
|
|
159
|
+
url: concatUrl({
|
|
160
|
+
host: 'localhost',
|
|
161
|
+
port,
|
|
162
|
+
protocol
|
|
163
|
+
})
|
|
164
|
+
});
|
|
165
|
+
hasLocalUrl = true;
|
|
166
|
+
} else addressUrls.push({
|
|
177
167
|
label: NETWORK_LABEL,
|
|
178
|
-
url: concatUrl({
|
|
179
|
-
|
|
168
|
+
url: concatUrl({
|
|
169
|
+
host: detail.address,
|
|
170
|
+
port,
|
|
171
|
+
protocol
|
|
172
|
+
})
|
|
173
|
+
});
|
|
174
|
+
return addressUrls;
|
|
175
|
+
};
|
|
176
|
+
const trackPerformance = (msg)=>{
|
|
177
|
+
const k = '__unpack_last_track_time';
|
|
178
|
+
if (!global[k]) {
|
|
179
|
+
global[k] = performance.now();
|
|
180
|
+
return;
|
|
180
181
|
}
|
|
181
|
-
|
|
182
|
-
return addressUrls;
|
|
183
|
-
};
|
|
184
|
-
const trackPerformance = (msg) => {
|
|
185
|
-
const k = "__unpack_last_track_time";
|
|
186
|
-
if (!global[k]) {
|
|
182
|
+
if (msg) __WEBPACK_EXTERNAL_MODULE__logger_js_c2be5186__.logger.wait(`${msg} ${__WEBPACK_EXTERNAL_MODULE__colors_js_b738ede3__["default"].dim('for')} ${__WEBPACK_EXTERNAL_MODULE__colors_js_b738ede3__["default"].bold(__WEBPACK_EXTERNAL_MODULE__colors_js_b738ede3__["default"].yellow(`${(performance.now() - global[k]).toFixed(2)}ms`))}`);
|
|
187
183
|
global[k] = performance.now();
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
if (msg) {
|
|
191
|
-
logger.wait(
|
|
192
|
-
`${msg} ${colors.dim("for")} ${colors.bold(colors.yellow(`${(performance.now() - global[k]).toFixed(2)}ms`))}`
|
|
193
|
-
);
|
|
194
|
-
}
|
|
195
|
-
global[k] = performance.now();
|
|
196
|
-
};
|
|
197
|
-
const getPathInJs = (absPath) => {
|
|
198
|
-
return JSON.stringify(absPath).slice(1, -1);
|
|
199
184
|
};
|
|
185
|
+
const getPathInJs = (absPath)=>JSON.stringify(absPath).slice(1, -1);
|
|
200
186
|
const mergeConfig = merge;
|
|
201
|
-
const getUserDepVersion = (root, dep)
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
};
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
debounce,
|
|
224
|
-
getAddressUrls,
|
|
225
|
-
getCompiledPkgPath,
|
|
226
|
-
getIpv4Interfaces,
|
|
227
|
-
getNodeEnv,
|
|
228
|
-
getPathInJs,
|
|
229
|
-
getPort,
|
|
230
|
-
getTime,
|
|
231
|
-
getUserDepPath,
|
|
232
|
-
getUserDepVersion,
|
|
233
|
-
getValueByPath,
|
|
234
|
-
isBoolean,
|
|
235
|
-
isDev,
|
|
236
|
-
isDevServer,
|
|
237
|
-
isFunction,
|
|
238
|
-
isObject,
|
|
239
|
-
isPlainObject,
|
|
240
|
-
isProd,
|
|
241
|
-
isRegExp,
|
|
242
|
-
isString,
|
|
243
|
-
isUndefined,
|
|
244
|
-
isWatch,
|
|
245
|
-
isWin,
|
|
246
|
-
logUpdate,
|
|
247
|
-
mergeConfig,
|
|
248
|
-
prettyTime,
|
|
249
|
-
removeDir,
|
|
250
|
-
setDevServer,
|
|
251
|
-
setNodeEnv,
|
|
252
|
-
setValueByPath,
|
|
253
|
-
trackPerformance
|
|
254
|
-
};
|
|
187
|
+
const getUserDepVersion = (root, dep)=>{
|
|
188
|
+
const depPath = getUserDepPath(root, dep);
|
|
189
|
+
if (!depPath) return;
|
|
190
|
+
const packageInfo = JSON.parse(__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].readFileSync(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].resolve(depPath, 'package.json'), 'utf-8'));
|
|
191
|
+
return packageInfo.version;
|
|
192
|
+
};
|
|
193
|
+
const clearLine = ()=>{
|
|
194
|
+
if (!process.stdout.isTTY) return;
|
|
195
|
+
process.stdout.clearLine(0);
|
|
196
|
+
process.stdout.cursorTo(0);
|
|
197
|
+
};
|
|
198
|
+
const logUpdate = (output)=>{
|
|
199
|
+
clearLine();
|
|
200
|
+
process.stdout.write(output);
|
|
201
|
+
};
|
|
202
|
+
const removeDir = (dir)=>{
|
|
203
|
+
__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].rmSync(dir, {
|
|
204
|
+
recursive: true,
|
|
205
|
+
force: true
|
|
206
|
+
});
|
|
207
|
+
};
|
|
208
|
+
export { clearLine, debounce, getAddressUrls, getCompiledPkgPath, getIpv4Interfaces, getNodeEnv, getPathInJs, getPort, getTime, getUserDepPath, getUserDepVersion, getValueByPath, isBoolean, isDev, utils_rslib_entry_isDevServer as isDevServer, isFunction, isObject, isPlainObject, isProd, isRegExp, isString, isUndefined, isWatch, isWin, logUpdate, mergeConfig, prettyTime, removeDir, setDevServer, setNodeEnv, setValueByPath, trackPerformance };
|
|
@@ -0,0 +1,73 @@
|
|
|
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
|
+
createChokidar: ()=>createChokidar
|
|
43
|
+
});
|
|
44
|
+
const external_chokidar_namespaceObject = require("chokidar");
|
|
45
|
+
var external_chokidar_default = /*#__PURE__*/ __webpack_require__.n(external_chokidar_namespaceObject);
|
|
46
|
+
const external_tinyglobby_namespaceObject = require("tinyglobby");
|
|
47
|
+
const GLOB_REGEX = /[*?{}[\]()!@+|]/;
|
|
48
|
+
const isGlob = (str)=>GLOB_REGEX.test(str);
|
|
49
|
+
async function createChokidar(pathOrGlobs, root, options) {
|
|
50
|
+
const watchFiles = new Set();
|
|
51
|
+
const globPatterns = pathOrGlobs.filter((pathOrGlob)=>{
|
|
52
|
+
if (isGlob(pathOrGlob)) return true;
|
|
53
|
+
watchFiles.add(pathOrGlob);
|
|
54
|
+
return false;
|
|
55
|
+
});
|
|
56
|
+
if (globPatterns.length) {
|
|
57
|
+
const files = await (0, external_tinyglobby_namespaceObject.glob)(globPatterns, {
|
|
58
|
+
cwd: root,
|
|
59
|
+
absolute: true
|
|
60
|
+
});
|
|
61
|
+
for (const file of files)watchFiles.add(file);
|
|
62
|
+
}
|
|
63
|
+
return external_chokidar_default().watch(Array.from(watchFiles), {
|
|
64
|
+
ignoreInitial: true,
|
|
65
|
+
ignorePermissionErrors: true,
|
|
66
|
+
...options
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
var __webpack_export_target__ = exports;
|
|
70
|
+
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
71
|
+
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
|
|
72
|
+
value: true
|
|
73
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watchFiles.d.ts","sourceRoot":"","sources":["../src/watchFiles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAW1D,wBAAsB,cAAc,CAClC,WAAW,EAAE,MAAM,EAAE,EACrB,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,SAAS,CAAC,CAyBpB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import __rslib_shim_module__ from 'module';
|
|
2
|
+
/*#__PURE__*/ import.meta.url;
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE_chokidar__ from "chokidar";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE_tinyglobby__ from "tinyglobby";
|
|
5
|
+
const GLOB_REGEX = /[*?{}[\]()!@+|]/;
|
|
6
|
+
const isGlob = (str)=>GLOB_REGEX.test(str);
|
|
7
|
+
async function createChokidar(pathOrGlobs, root, options) {
|
|
8
|
+
const watchFiles = new Set();
|
|
9
|
+
const globPatterns = pathOrGlobs.filter((pathOrGlob)=>{
|
|
10
|
+
if (isGlob(pathOrGlob)) return true;
|
|
11
|
+
watchFiles.add(pathOrGlob);
|
|
12
|
+
return false;
|
|
13
|
+
});
|
|
14
|
+
if (globPatterns.length) {
|
|
15
|
+
const files = await (0, __WEBPACK_EXTERNAL_MODULE_tinyglobby__.glob)(globPatterns, {
|
|
16
|
+
cwd: root,
|
|
17
|
+
absolute: true
|
|
18
|
+
});
|
|
19
|
+
for (const file of files)watchFiles.add(file);
|
|
20
|
+
}
|
|
21
|
+
return __WEBPACK_EXTERNAL_MODULE_chokidar__["default"].watch(Array.from(watchFiles), {
|
|
22
|
+
ignoreInitial: true,
|
|
23
|
+
ignorePermissionErrors: true,
|
|
24
|
+
...options
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
export { createChokidar };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unpackjs/core",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.6",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -37,10 +37,6 @@
|
|
|
37
37
|
"types": "./compiled/css-loader/index.d.ts",
|
|
38
38
|
"default": "./compiled/css-loader/index.js"
|
|
39
39
|
},
|
|
40
|
-
"./commander": {
|
|
41
|
-
"types": "./compiled/commander/index.d.ts",
|
|
42
|
-
"default": "./compiled/commander/index.js"
|
|
43
|
-
},
|
|
44
40
|
"./webpack-bundle-analyzer": {
|
|
45
41
|
"types": "./compiled/webpack-bundle-analyzer/index.d.ts",
|
|
46
42
|
"default": "./compiled/webpack-bundle-analyzer/index.js"
|
|
@@ -69,42 +65,43 @@
|
|
|
69
65
|
},
|
|
70
66
|
"devDependencies": {
|
|
71
67
|
"@types/sass-loader": "8.0.9",
|
|
72
|
-
"commander": "13.0.0",
|
|
73
68
|
"css-loader": "7.1.2",
|
|
74
69
|
"less-loader": "12.2.0",
|
|
75
70
|
"line-diff": "2.1.1",
|
|
76
71
|
"portfinder": "1.0.32",
|
|
77
72
|
"postcss-loader": "8.1.1",
|
|
78
73
|
"sass-loader": "16.0.4",
|
|
79
|
-
"semver": "7.
|
|
74
|
+
"semver": "7.7.1",
|
|
80
75
|
"style-loader": "4.0.0",
|
|
81
76
|
"webpack-bundle-analyzer": "4.10.2",
|
|
82
77
|
"webpack-merge": "6.0.1"
|
|
83
78
|
},
|
|
84
79
|
"dependencies": {
|
|
85
|
-
"@rspack/core": "1.
|
|
86
|
-
"@types/less": "3.0.
|
|
80
|
+
"@rspack/core": "1.2.2",
|
|
81
|
+
"@types/less": "3.0.8",
|
|
82
|
+
"chokidar": "4.0.3",
|
|
87
83
|
"copy-webpack-plugin": "12.0.2",
|
|
88
84
|
"cors": "2.8.5",
|
|
89
|
-
"esbuild": "0.
|
|
85
|
+
"esbuild": "0.25.0",
|
|
90
86
|
"express": "4.21.2",
|
|
91
87
|
"html-webpack-plugin": "5.6.3",
|
|
88
|
+
"jiti": "2.4.2",
|
|
92
89
|
"json5": "2.2.3",
|
|
93
|
-
"lightningcss": "1.
|
|
90
|
+
"lightningcss": "1.29.1",
|
|
94
91
|
"mini-css-extract-plugin": "2.9.2",
|
|
95
92
|
"open": "8.4.2",
|
|
96
93
|
"picocolors": "1.1.1",
|
|
97
|
-
"postcss": "8.
|
|
94
|
+
"postcss": "8.5.2",
|
|
95
|
+
"thread-loader": "4.0.4",
|
|
98
96
|
"tinyglobby": "0.2.10",
|
|
99
|
-
"ts-checker-rspack-plugin": "1.1.
|
|
97
|
+
"ts-checker-rspack-plugin": "1.1.1",
|
|
100
98
|
"typed-css-modules": "0.9.1",
|
|
101
99
|
"webpack": "5.97.1",
|
|
102
|
-
"webpack-dev-server": "5.2.0"
|
|
103
|
-
"thread-loader": "4.0.4"
|
|
100
|
+
"webpack-dev-server": "5.2.0"
|
|
104
101
|
},
|
|
105
102
|
"scripts": {
|
|
106
|
-
"dev": "
|
|
107
|
-
"build": "pnpm prebundle &&
|
|
103
|
+
"dev": "rslib build --watch",
|
|
104
|
+
"build": "pnpm prebundle && rslib build",
|
|
108
105
|
"prebundle": "prebundle && node ./scripts/afterPrebundle.js"
|
|
109
106
|
}
|
|
110
107
|
}
|