@unpackjs/core 1.7.5 → 1.7.7
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/line-diff/license +1 -1
- package/compiled/line-diff/package.json +1 -1
- package/compiled/portfinder/index.js +37 -37
- package/compiled/postcss-loader/index.js +261 -256
- package/compiled/sass-loader/index.js +24 -20
- package/compiled/sass-loader/package.json +1 -1
- 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.js +125 -134
- package/dist/bundler-config/css.cjs +181 -158
- package/dist/bundler-config/css.js +139 -151
- package/dist/bundler-config/experimentCss.cjs +203 -159
- 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.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.map +1 -1
- package/dist/config.js +64 -70
- package/dist/constants.cjs +65 -62
- package/dist/constants.d.ts +1 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +22 -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/loader.cjs +56 -53
- package/dist/lightningcss/loader.d.ts.map +1 -1
- package/dist/lightningcss/loader.js +25 -34
- package/dist/lightningcss/minimizer.cjs +90 -109
- package/dist/lightningcss/minimizer.d.ts.map +1 -1
- package/dist/lightningcss/minimizer.js +59 -87
- package/dist/logger.cjs +104 -98
- 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.js +59 -57
- package/dist/plugin-progress/webpack.cjs +111 -89
- 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 +149 -124
- package/dist/reporter.d.ts.map +1 -1
- package/dist/reporter.js +102 -102
- package/dist/run/build.cjs +68 -67
- package/dist/run/build.js +24 -45
- package/dist/run/dev.cjs +96 -83
- 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.js +118 -151
- package/dist/typed-css-modules/plugin.cjs +113 -88
- package/dist/typed-css-modules/plugin.js +68 -66
- package/dist/typed-css-modules/utils.cjs +43 -42
- 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.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 +18 -21
- 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/lightningcss/cache.cjs +0 -36
- package/dist/lightningcss/cache.d.ts +0 -2
- package/dist/lightningcss/cache.d.ts.map +0 -1
- package/dist/lightningcss/cache.js +0 -22
package/dist/utils.cjs
CHANGED
|
@@ -1,309 +1,285 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
var utils_exports = {};
|
|
29
|
-
__export(utils_exports, {
|
|
30
|
-
clearLine: () => clearLine,
|
|
31
|
-
debounce: () => debounce,
|
|
32
|
-
getAddressUrls: () => getAddressUrls,
|
|
33
|
-
getCompiledPkgPath: () => getCompiledPkgPath,
|
|
34
|
-
getIpv4Interfaces: () => getIpv4Interfaces,
|
|
35
|
-
getNodeEnv: () => getNodeEnv,
|
|
36
|
-
getPathInJs: () => getPathInJs,
|
|
37
|
-
getPort: () => getPort,
|
|
38
|
-
getTime: () => getTime,
|
|
39
|
-
getUserDepPath: () => getUserDepPath,
|
|
40
|
-
getUserDepVersion: () => getUserDepVersion,
|
|
41
|
-
getValueByPath: () => getValueByPath,
|
|
42
|
-
isBoolean: () => isBoolean,
|
|
43
|
-
isDev: () => isDev,
|
|
44
|
-
isDevServer: () => isDevServer,
|
|
45
|
-
isFunction: () => isFunction,
|
|
46
|
-
isObject: () => isObject,
|
|
47
|
-
isPlainObject: () => isPlainObject,
|
|
48
|
-
isProd: () => isProd,
|
|
49
|
-
isRegExp: () => isRegExp,
|
|
50
|
-
isString: () => isString,
|
|
51
|
-
isUndefined: () => isUndefined,
|
|
52
|
-
isWatch: () => isWatch,
|
|
53
|
-
isWin: () => isWin,
|
|
54
|
-
logUpdate: () => logUpdate,
|
|
55
|
-
mergeConfig: () => mergeConfig,
|
|
56
|
-
prettyTime: () => prettyTime,
|
|
57
|
-
removeDir: () => removeDir,
|
|
58
|
-
setDevServer: () => setDevServer,
|
|
59
|
-
setNodeEnv: () => setNodeEnv,
|
|
60
|
-
setValueByPath: () => setValueByPath,
|
|
61
|
-
trackPerformance: () => trackPerformance
|
|
62
|
-
});
|
|
63
|
-
module.exports = __toCommonJS(utils_exports);
|
|
64
|
-
var import_colors = __toESM(require("./colors.cjs"));
|
|
65
|
-
var import_node_fs = __toESM(require("node:fs"));
|
|
66
|
-
var import_node_net = __toESM(require("node:net"));
|
|
67
|
-
var import_node_os = __toESM(require("node:os"));
|
|
68
|
-
var import_node_path = __toESM(require("node:path"));
|
|
69
|
-
var import_constants = require("./constants.cjs");
|
|
70
|
-
var import_logger = require("./logger.cjs");
|
|
71
|
-
const portfinder = require("../compiled/portfinder/index.js");
|
|
72
|
-
const { merge } = require("../compiled/webpack-merge/index.js");
|
|
73
|
-
const getNodeEnv = () => process.env.NODE_ENV;
|
|
74
|
-
const setNodeEnv = (env) => {
|
|
75
|
-
process.env.NODE_ENV = env;
|
|
76
|
-
};
|
|
77
|
-
const setDevServer = (isDevServer2) => {
|
|
78
|
-
process.env.DEV_SERVER = isDevServer2 ? "true" : "false";
|
|
79
|
-
};
|
|
80
|
-
const isDev = () => getNodeEnv() === "development";
|
|
81
|
-
const isDevServer = () => process.env.DEV_SERVER === "true";
|
|
82
|
-
const isWatch = () => isDev() && !isDevServer();
|
|
83
|
-
const isProd = () => getNodeEnv() === "production";
|
|
84
|
-
const isWin = () => process.platform === "win32";
|
|
85
|
-
const isString = (str) => typeof str === "string";
|
|
86
|
-
const isBoolean = (bool) => typeof bool === "boolean";
|
|
87
|
-
const isUndefined = (obj) => typeof obj === "undefined";
|
|
88
|
-
const isFunction = (func) => typeof func === "function";
|
|
89
|
-
const isObject = (obj) => obj !== null && typeof obj === "object";
|
|
90
|
-
const isPlainObject = (obj) => isObject(obj) && Object.prototype.toString.call(obj) === "[object Object]";
|
|
91
|
-
const isRegExp = (obj) => Object.prototype.toString.call(obj) === "[object RegExp]";
|
|
92
|
-
const prettyTime = (seconds) => {
|
|
93
|
-
const toFixed = (num, len) => {
|
|
94
|
-
const factor = 10 ** len;
|
|
95
|
-
return Math.floor(num * factor) / factor;
|
|
96
|
-
};
|
|
97
|
-
if (seconds < 1) {
|
|
98
|
-
return `${toFixed(seconds * 1e3, 0)}ms`;
|
|
99
|
-
}
|
|
100
|
-
if (seconds < 60) {
|
|
101
|
-
return `${toFixed(seconds, 1)}s`;
|
|
102
|
-
}
|
|
103
|
-
return `${toFixed(seconds / 60, 2)}m`;
|
|
104
|
-
};
|
|
105
|
-
const getValueByPath = (target, pathArray, defaultValue) => {
|
|
106
|
-
let current = target;
|
|
107
|
-
for (let i = 0; i < pathArray.length - 1; i++) {
|
|
108
|
-
const currKey = pathArray[i];
|
|
109
|
-
if (!current[currKey] || typeof current[currKey] !== "object") {
|
|
110
|
-
current[currKey] = typeof pathArray[i + 1] === "string" ? {} : [];
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_modules__ = {
|
|
3
|
+
"compiled/portfinder/index.js": function(module) {
|
|
4
|
+
module.exports = require("/home/runner/work/unpack/unpack/packages/core/compiled/portfinder/index.js");
|
|
5
|
+
},
|
|
6
|
+
"compiled/webpack-merge/index.js": function(module) {
|
|
7
|
+
module.exports = require("/home/runner/work/unpack/unpack/packages/core/compiled/webpack-merge/index.js");
|
|
111
8
|
}
|
|
112
|
-
current = current[currKey];
|
|
113
|
-
}
|
|
114
|
-
const lastKey = pathArray.at(-1);
|
|
115
|
-
if (current[lastKey] === void 0) {
|
|
116
|
-
current[lastKey] = defaultValue;
|
|
117
|
-
}
|
|
118
|
-
return current[lastKey];
|
|
119
9
|
};
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
current[pathArray.at(-1)] = value;
|
|
130
|
-
};
|
|
131
|
-
const getPort = (startPort) => {
|
|
132
|
-
return new Promise((resolve) => {
|
|
133
|
-
portfinder.getPort(
|
|
134
|
-
{
|
|
135
|
-
port: startPort
|
|
136
|
-
},
|
|
137
|
-
(_, port) => {
|
|
138
|
-
resolve(port);
|
|
139
|
-
}
|
|
140
|
-
);
|
|
141
|
-
});
|
|
142
|
-
};
|
|
143
|
-
const getCompiledPkgPath = (packageName) => import_node_path.default.join(__dirname, "../compiled", packageName);
|
|
144
|
-
const getUserDepPath = (root, deps) => {
|
|
145
|
-
const dependencies = Array.isArray(deps) ? deps : [deps];
|
|
146
|
-
for (const dep of dependencies) {
|
|
147
|
-
const absPath = import_node_path.default.resolve(root, "node_modules", dep);
|
|
148
|
-
if (import_node_fs.default.existsSync(absPath)) {
|
|
149
|
-
return absPath;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
function getTime() {
|
|
154
|
-
const now = /* @__PURE__ */ new Date();
|
|
155
|
-
const hours = String(now.getHours()).padStart(2, "0");
|
|
156
|
-
const minutes = String(now.getMinutes()).padStart(2, "0");
|
|
157
|
-
const seconds = String(now.getSeconds()).padStart(2, "0");
|
|
158
|
-
return `${hours}:${minutes}:${seconds}`;
|
|
10
|
+
var __webpack_module_cache__ = {};
|
|
11
|
+
function __webpack_require__(moduleId) {
|
|
12
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
13
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
14
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
15
|
+
exports: {}
|
|
16
|
+
};
|
|
17
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
18
|
+
return module.exports;
|
|
159
19
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
20
|
+
(()=>{
|
|
21
|
+
__webpack_require__.n = function(module) {
|
|
22
|
+
var getter = module && module.__esModule ? function() {
|
|
23
|
+
return module['default'];
|
|
24
|
+
} : function() {
|
|
25
|
+
return module;
|
|
26
|
+
};
|
|
27
|
+
__webpack_require__.d(getter, {
|
|
28
|
+
a: getter
|
|
29
|
+
});
|
|
30
|
+
return getter;
|
|
31
|
+
};
|
|
32
|
+
})();
|
|
33
|
+
(()=>{
|
|
34
|
+
__webpack_require__.d = function(exports1, definition) {
|
|
35
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
36
|
+
enumerable: true,
|
|
37
|
+
get: definition[key]
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
(()=>{
|
|
42
|
+
__webpack_require__.o = function(obj, prop) {
|
|
43
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
44
|
+
};
|
|
45
|
+
})();
|
|
46
|
+
(()=>{
|
|
47
|
+
__webpack_require__.r = function(exports1) {
|
|
48
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
49
|
+
value: 'Module'
|
|
50
|
+
});
|
|
51
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
52
|
+
value: true
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
})();
|
|
56
|
+
var __webpack_exports__ = {};
|
|
57
|
+
(()=>{
|
|
58
|
+
__webpack_require__.r(__webpack_exports__);
|
|
59
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
60
|
+
getTime: ()=>getTime,
|
|
61
|
+
getValueByPath: ()=>getValueByPath,
|
|
62
|
+
getUserDepPath: ()=>getUserDepPath,
|
|
63
|
+
getNodeEnv: ()=>getNodeEnv,
|
|
64
|
+
isRegExp: ()=>isRegExp,
|
|
65
|
+
trackPerformance: ()=>trackPerformance,
|
|
66
|
+
isDev: ()=>isDev,
|
|
67
|
+
isPlainObject: ()=>isPlainObject,
|
|
68
|
+
isObject: ()=>isObject,
|
|
69
|
+
isDevServer: ()=>utils_rslib_entry_isDevServer,
|
|
70
|
+
getIpv4Interfaces: ()=>getIpv4Interfaces,
|
|
71
|
+
prettyTime: ()=>prettyTime,
|
|
72
|
+
getCompiledPkgPath: ()=>getCompiledPkgPath,
|
|
73
|
+
getPort: ()=>getPort,
|
|
74
|
+
logUpdate: ()=>logUpdate,
|
|
75
|
+
getAddressUrls: ()=>getAddressUrls,
|
|
76
|
+
getPathInJs: ()=>getPathInJs,
|
|
77
|
+
setDevServer: ()=>setDevServer,
|
|
78
|
+
debounce: ()=>debounce,
|
|
79
|
+
isFunction: ()=>isFunction,
|
|
80
|
+
isString: ()=>isString,
|
|
81
|
+
setNodeEnv: ()=>setNodeEnv,
|
|
82
|
+
getUserDepVersion: ()=>getUserDepVersion,
|
|
83
|
+
isWin: ()=>isWin,
|
|
84
|
+
isWatch: ()=>isWatch,
|
|
85
|
+
isProd: ()=>isProd,
|
|
86
|
+
removeDir: ()=>removeDir,
|
|
87
|
+
clearLine: ()=>clearLine,
|
|
88
|
+
isBoolean: ()=>isBoolean,
|
|
89
|
+
mergeConfig: ()=>mergeConfig,
|
|
90
|
+
setValueByPath: ()=>setValueByPath,
|
|
91
|
+
isUndefined: ()=>isUndefined
|
|
92
|
+
});
|
|
93
|
+
const external_colors_cjs_namespaceObject = require("./colors.cjs");
|
|
94
|
+
var external_colors_cjs_default = /*#__PURE__*/ __webpack_require__.n(external_colors_cjs_namespaceObject);
|
|
95
|
+
const external_node_fs_namespaceObject = require("node:fs");
|
|
96
|
+
var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
|
|
97
|
+
const external_node_net_namespaceObject = require("node:net");
|
|
98
|
+
var external_node_net_default = /*#__PURE__*/ __webpack_require__.n(external_node_net_namespaceObject);
|
|
99
|
+
const external_node_os_namespaceObject = require("node:os");
|
|
100
|
+
var external_node_os_default = /*#__PURE__*/ __webpack_require__.n(external_node_os_namespaceObject);
|
|
101
|
+
const external_node_path_namespaceObject = require("node:path");
|
|
102
|
+
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
|
103
|
+
const external_constants_cjs_namespaceObject = require("./constants.cjs");
|
|
104
|
+
const external_logger_cjs_namespaceObject = require("./logger.cjs");
|
|
105
|
+
const portfinder = __webpack_require__("compiled/portfinder/index.js");
|
|
106
|
+
const { merge } = __webpack_require__("compiled/webpack-merge/index.js");
|
|
107
|
+
const getNodeEnv = ()=>process.env.NODE_ENV;
|
|
108
|
+
const setNodeEnv = (env)=>{
|
|
109
|
+
process.env.NODE_ENV = env;
|
|
110
|
+
};
|
|
111
|
+
const setDevServer = (isDevServer)=>{
|
|
112
|
+
process.env.DEV_SERVER = isDevServer ? 'true' : 'false';
|
|
113
|
+
};
|
|
114
|
+
const isDev = ()=>'development' === getNodeEnv();
|
|
115
|
+
const utils_rslib_entry_isDevServer = ()=>'true' === process.env.DEV_SERVER;
|
|
116
|
+
const isWatch = ()=>isDev() && !utils_rslib_entry_isDevServer();
|
|
117
|
+
const isProd = ()=>'production' === getNodeEnv();
|
|
118
|
+
const isWin = ()=>'win32' === process.platform;
|
|
119
|
+
const isString = (str)=>'string' == typeof str;
|
|
120
|
+
const isBoolean = (bool)=>'boolean' == typeof bool;
|
|
121
|
+
const isUndefined = (obj)=>void 0 === obj;
|
|
122
|
+
const isFunction = (func)=>'function' == typeof func;
|
|
123
|
+
const isObject = (obj)=>null !== obj && 'object' == typeof obj;
|
|
124
|
+
const isPlainObject = (obj)=>isObject(obj) && '[object Object]' === Object.prototype.toString.call(obj);
|
|
125
|
+
const isRegExp = (obj)=>'[object RegExp]' === Object.prototype.toString.call(obj);
|
|
126
|
+
const prettyTime = (seconds)=>{
|
|
127
|
+
const toFixed = (num, len)=>{
|
|
128
|
+
const factor = 10 ** len;
|
|
129
|
+
return Math.floor(num * factor) / factor;
|
|
130
|
+
};
|
|
131
|
+
if (seconds < 1) return `${toFixed(1000 * seconds, 0)}ms`;
|
|
132
|
+
if (seconds < 60) return `${toFixed(seconds, 1)}s`;
|
|
133
|
+
return `${toFixed(seconds / 60, 2)}m`;
|
|
134
|
+
};
|
|
135
|
+
const getValueByPath = (target, pathArray, defaultValue)=>{
|
|
136
|
+
let current = target;
|
|
137
|
+
for(let i = 0; i < pathArray.length - 1; i++){
|
|
138
|
+
const currKey = pathArray[i];
|
|
139
|
+
if (!current[currKey] || 'object' != typeof current[currKey]) current[currKey] = 'string' == typeof pathArray[i + 1] ? {} : [];
|
|
140
|
+
current = current[currKey];
|
|
141
|
+
}
|
|
142
|
+
const lastKey = pathArray.at(-1);
|
|
143
|
+
if (void 0 === current[lastKey]) current[lastKey] = defaultValue;
|
|
144
|
+
return current[lastKey];
|
|
145
|
+
};
|
|
146
|
+
const setValueByPath = (target, pathArray, value)=>{
|
|
147
|
+
let current = target;
|
|
148
|
+
for(let i = 0; i < pathArray.length - 1; i++){
|
|
149
|
+
const currKey = pathArray[i];
|
|
150
|
+
if (!current[currKey] || 'object' != typeof current[currKey]) current[currKey] = 'string' == typeof pathArray[i + 1] ? {} : [];
|
|
151
|
+
current = current[currKey];
|
|
152
|
+
}
|
|
153
|
+
current[pathArray.at(-1)] = value;
|
|
154
|
+
};
|
|
155
|
+
const getPort = (startPort)=>new Promise((resolve)=>{
|
|
156
|
+
portfinder.getPort({
|
|
157
|
+
port: startPort
|
|
158
|
+
}, (_, port)=>{
|
|
159
|
+
resolve(port);
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
const getCompiledPkgPath = (packageName)=>external_node_path_default().join(__dirname, '../compiled', packageName);
|
|
163
|
+
const getUserDepPath = (root, deps)=>{
|
|
164
|
+
const dependencies = Array.isArray(deps) ? deps : [
|
|
165
|
+
deps
|
|
166
|
+
];
|
|
167
|
+
for (const dep of dependencies){
|
|
168
|
+
const absPath = external_node_path_default().resolve(root, 'node_modules', dep);
|
|
169
|
+
if (external_node_fs_default().existsSync(absPath)) return absPath;
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
function getTime() {
|
|
173
|
+
const now = new Date();
|
|
174
|
+
const hours = String(now.getHours()).padStart(2, '0');
|
|
175
|
+
const minutes = String(now.getMinutes()).padStart(2, '0');
|
|
176
|
+
const seconds = String(now.getSeconds()).padStart(2, '0');
|
|
177
|
+
return `${hours}:${minutes}:${seconds}`;
|
|
178
178
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
const
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
}
|
|
197
|
-
const
|
|
198
|
-
const
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
const
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
getTime,
|
|
286
|
-
getUserDepPath,
|
|
287
|
-
getUserDepVersion,
|
|
288
|
-
getValueByPath,
|
|
289
|
-
isBoolean,
|
|
290
|
-
isDev,
|
|
291
|
-
isDevServer,
|
|
292
|
-
isFunction,
|
|
293
|
-
isObject,
|
|
294
|
-
isPlainObject,
|
|
295
|
-
isProd,
|
|
296
|
-
isRegExp,
|
|
297
|
-
isString,
|
|
298
|
-
isUndefined,
|
|
299
|
-
isWatch,
|
|
300
|
-
isWin,
|
|
301
|
-
logUpdate,
|
|
302
|
-
mergeConfig,
|
|
303
|
-
prettyTime,
|
|
304
|
-
removeDir,
|
|
305
|
-
setDevServer,
|
|
306
|
-
setNodeEnv,
|
|
307
|
-
setValueByPath,
|
|
308
|
-
trackPerformance
|
|
179
|
+
const debounce = (fn, delay)=>{
|
|
180
|
+
let timer = null;
|
|
181
|
+
return (...args)=>{
|
|
182
|
+
clearTimeout(timer);
|
|
183
|
+
timer = setTimeout(()=>{
|
|
184
|
+
fn(...args);
|
|
185
|
+
}, delay);
|
|
186
|
+
};
|
|
187
|
+
};
|
|
188
|
+
const getIpv4Interfaces = ()=>{
|
|
189
|
+
const interfaces = external_node_os_default().networkInterfaces();
|
|
190
|
+
const ipv4Interfaces = new Map();
|
|
191
|
+
for (const key of Object.keys(interfaces))for (const detail of interfaces[key]){
|
|
192
|
+
const familyV4Value = 'string' == typeof detail.family ? 'IPv4' : 4;
|
|
193
|
+
if (detail.family === familyV4Value && !ipv4Interfaces.has(detail.address)) ipv4Interfaces.set(detail.address, detail);
|
|
194
|
+
}
|
|
195
|
+
return Array.from(ipv4Interfaces.values());
|
|
196
|
+
};
|
|
197
|
+
const isLoopbackHost = (host)=>{
|
|
198
|
+
const loopbackHosts = [
|
|
199
|
+
'localhost',
|
|
200
|
+
'127.0.0.1',
|
|
201
|
+
'::1',
|
|
202
|
+
'0000:0000:0000:0000:0000:0000:0000:0001'
|
|
203
|
+
];
|
|
204
|
+
return loopbackHosts.includes(host);
|
|
205
|
+
};
|
|
206
|
+
const getHostInUrl = (host)=>{
|
|
207
|
+
if (external_node_net_default().isIPv6(host)) return '::' === host ? '[::1]' : `[${host}]`;
|
|
208
|
+
return host;
|
|
209
|
+
};
|
|
210
|
+
const concatUrl = ({ host, port, protocol })=>`${protocol}://${host}:${port}/`;
|
|
211
|
+
const LOCAL_LABEL = 'Local: ';
|
|
212
|
+
const NETWORK_LABEL = 'Network: ';
|
|
213
|
+
const getAddressUrls = ({ protocol = 'http', port, host })=>{
|
|
214
|
+
if (host && host !== external_constants_cjs_namespaceObject.DEFAULT_DEV_HOST) return [
|
|
215
|
+
{
|
|
216
|
+
label: isLoopbackHost(host) ? LOCAL_LABEL : NETWORK_LABEL,
|
|
217
|
+
url: concatUrl({
|
|
218
|
+
port,
|
|
219
|
+
host: getHostInUrl(host),
|
|
220
|
+
protocol
|
|
221
|
+
})
|
|
222
|
+
}
|
|
223
|
+
];
|
|
224
|
+
const ipv4Interfaces = getIpv4Interfaces();
|
|
225
|
+
const addressUrls = [];
|
|
226
|
+
let hasLocalUrl = false;
|
|
227
|
+
for (const detail of ipv4Interfaces)if (isLoopbackHost(detail.address) || detail.internal) {
|
|
228
|
+
if (hasLocalUrl) continue;
|
|
229
|
+
addressUrls.push({
|
|
230
|
+
label: LOCAL_LABEL,
|
|
231
|
+
url: concatUrl({
|
|
232
|
+
host: 'localhost',
|
|
233
|
+
port,
|
|
234
|
+
protocol
|
|
235
|
+
})
|
|
236
|
+
});
|
|
237
|
+
hasLocalUrl = true;
|
|
238
|
+
} else addressUrls.push({
|
|
239
|
+
label: NETWORK_LABEL,
|
|
240
|
+
url: concatUrl({
|
|
241
|
+
host: detail.address,
|
|
242
|
+
port,
|
|
243
|
+
protocol
|
|
244
|
+
})
|
|
245
|
+
});
|
|
246
|
+
return addressUrls;
|
|
247
|
+
};
|
|
248
|
+
const trackPerformance = (msg)=>{
|
|
249
|
+
const k = '__unpack_last_track_time';
|
|
250
|
+
if (!global[k]) {
|
|
251
|
+
global[k] = performance.now();
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
if (msg) external_logger_cjs_namespaceObject.logger.wait(`${msg} ${external_colors_cjs_default().dim('for')} ${external_colors_cjs_default().bold(external_colors_cjs_default().yellow(`${(performance.now() - global[k]).toFixed(2)}ms`))}`);
|
|
255
|
+
global[k] = performance.now();
|
|
256
|
+
};
|
|
257
|
+
const getPathInJs = (absPath)=>JSON.stringify(absPath).slice(1, -1);
|
|
258
|
+
const mergeConfig = merge;
|
|
259
|
+
const getUserDepVersion = (root, dep)=>{
|
|
260
|
+
const depPath = getUserDepPath(root, dep);
|
|
261
|
+
if (!depPath) return;
|
|
262
|
+
const packageInfo = JSON.parse(external_node_fs_default().readFileSync(external_node_path_default().resolve(depPath, 'package.json'), 'utf-8'));
|
|
263
|
+
return packageInfo.version;
|
|
264
|
+
};
|
|
265
|
+
const clearLine = ()=>{
|
|
266
|
+
if (!process.stdout.isTTY) return;
|
|
267
|
+
process.stdout.clearLine(0);
|
|
268
|
+
process.stdout.cursorTo(0);
|
|
269
|
+
};
|
|
270
|
+
const logUpdate = (output)=>{
|
|
271
|
+
clearLine();
|
|
272
|
+
process.stdout.write(output);
|
|
273
|
+
};
|
|
274
|
+
const removeDir = (dir)=>{
|
|
275
|
+
external_node_fs_default().rmSync(dir, {
|
|
276
|
+
recursive: true,
|
|
277
|
+
force: true
|
|
278
|
+
});
|
|
279
|
+
};
|
|
280
|
+
})();
|
|
281
|
+
var __webpack_export_target__ = exports;
|
|
282
|
+
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
283
|
+
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
|
|
284
|
+
value: true
|
|
309
285
|
});
|