@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.
Files changed (116) hide show
  1. package/compiled/css-loader/index.js +180 -178
  2. package/compiled/less-loader/index.js +11 -11
  3. package/compiled/line-diff/index.js +4 -4
  4. package/compiled/line-diff/license +1 -1
  5. package/compiled/line-diff/package.json +1 -1
  6. package/compiled/portfinder/index.js +37 -37
  7. package/compiled/postcss-loader/index.js +261 -256
  8. package/compiled/sass-loader/index.js +24 -20
  9. package/compiled/sass-loader/package.json +1 -1
  10. package/compiled/semver/index.js +188 -170
  11. package/compiled/semver/package.json +1 -1
  12. package/compiled/style-loader/index.js +13 -13
  13. package/compiled/webpack-bundle-analyzer/index.js +198 -198
  14. package/compiled/webpack-merge/index.js +29 -29
  15. package/dist/bundler-config/chunkSplit.cjs +169 -156
  16. package/dist/bundler-config/chunkSplit.js +125 -134
  17. package/dist/bundler-config/css.cjs +181 -158
  18. package/dist/bundler-config/css.js +139 -151
  19. package/dist/bundler-config/experimentCss.cjs +203 -159
  20. package/dist/bundler-config/experimentCss.js +162 -152
  21. package/dist/bundler-config/helper.cjs +82 -78
  22. package/dist/bundler-config/helper.js +36 -55
  23. package/dist/bundler-config/index.cjs +260 -209
  24. package/dist/bundler-config/index.d.ts.map +1 -1
  25. package/dist/bundler-config/index.js +209 -182
  26. package/dist/bundler-config/jsMinify.cjs +114 -95
  27. package/dist/bundler-config/jsMinify.js +70 -73
  28. package/dist/colors.cjs +83 -56
  29. package/dist/colors.js +38 -37
  30. package/dist/config.cjs +107 -93
  31. package/dist/config.d.ts.map +1 -1
  32. package/dist/config.js +64 -70
  33. package/dist/constants.cjs +65 -62
  34. package/dist/constants.d.ts +1 -0
  35. package/dist/constants.d.ts.map +1 -1
  36. package/dist/constants.js +22 -38
  37. package/dist/createUnpack.cjs +111 -104
  38. package/dist/createUnpack.js +67 -82
  39. package/dist/global.cjs +36 -0
  40. package/dist/global.d.ts +2 -0
  41. package/dist/global.d.ts.map +1 -0
  42. package/dist/global.js +4 -0
  43. package/dist/index.cjs +174 -51
  44. package/dist/index.d.ts +2 -0
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.js +33 -15
  47. package/dist/lightningcss/loader.cjs +56 -53
  48. package/dist/lightningcss/loader.d.ts.map +1 -1
  49. package/dist/lightningcss/loader.js +25 -34
  50. package/dist/lightningcss/minimizer.cjs +90 -109
  51. package/dist/lightningcss/minimizer.d.ts.map +1 -1
  52. package/dist/lightningcss/minimizer.js +59 -87
  53. package/dist/logger.cjs +104 -98
  54. package/dist/logger.js +59 -76
  55. package/dist/openBrowser.cjs +104 -81
  56. package/dist/openBrowser.js +56 -52
  57. package/dist/plugin-progress/rspack.cjs +104 -79
  58. package/dist/plugin-progress/rspack.js +59 -57
  59. package/dist/plugin-progress/webpack.cjs +111 -89
  60. package/dist/plugin-progress/webpack.js +65 -67
  61. package/dist/plugin.cjs +38 -29
  62. package/dist/plugin.js +8 -17
  63. package/dist/prebundleDeps.cjs +327 -337
  64. package/dist/prebundleDeps.d.ts.map +1 -1
  65. package/dist/prebundleDeps.js +278 -324
  66. package/dist/progressBar.cjs +82 -65
  67. package/dist/progressBar.js +38 -43
  68. package/dist/reporter.cjs +149 -124
  69. package/dist/reporter.d.ts.map +1 -1
  70. package/dist/reporter.js +102 -102
  71. package/dist/run/build.cjs +68 -67
  72. package/dist/run/build.js +24 -45
  73. package/dist/run/dev.cjs +96 -83
  74. package/dist/run/dev.d.ts.map +1 -1
  75. package/dist/run/dev.js +50 -61
  76. package/dist/run/index.cjs +74 -21
  77. package/dist/run/index.js +2 -9
  78. package/dist/typed-css-modules/loader.cjs +179 -188
  79. package/dist/typed-css-modules/loader.js +118 -151
  80. package/dist/typed-css-modules/plugin.cjs +113 -88
  81. package/dist/typed-css-modules/plugin.js +68 -66
  82. package/dist/typed-css-modules/utils.cjs +43 -42
  83. package/dist/typed-css-modules/utils.js +13 -30
  84. package/dist/types/chunkSplit.cjs +19 -15
  85. package/dist/types/chunkSplit.d.ts +2 -10
  86. package/dist/types/chunkSplit.d.ts.map +1 -1
  87. package/dist/types/chunkSplit.js +2 -9
  88. package/dist/types/config.cjs +19 -15
  89. package/dist/types/config.js +2 -9
  90. package/dist/types/index.cjs +101 -27
  91. package/dist/types/index.js +2 -9
  92. package/dist/types/lightningcss.cjs +19 -15
  93. package/dist/types/lightningcss.js +2 -9
  94. package/dist/types/logger.cjs +43 -34
  95. package/dist/types/logger.js +13 -22
  96. package/dist/types/plugin.cjs +19 -15
  97. package/dist/types/plugin.js +2 -9
  98. package/dist/utils.cjs +280 -304
  99. package/dist/utils.js +195 -241
  100. package/dist/watchFiles.cjs +73 -0
  101. package/dist/watchFiles.d.ts +3 -0
  102. package/dist/watchFiles.d.ts.map +1 -0
  103. package/dist/watchFiles.js +27 -0
  104. package/package.json +18 -21
  105. package/compiled/commander/index.d.ts +0 -1047
  106. package/compiled/commander/index.js +0 -2428
  107. package/compiled/commander/license +0 -22
  108. package/compiled/commander/package.json +0 -1
  109. package/dist/bundleRequire.cjs +0 -200
  110. package/dist/bundleRequire.d.ts +0 -5
  111. package/dist/bundleRequire.d.ts.map +0 -1
  112. package/dist/bundleRequire.js +0 -173
  113. package/dist/lightningcss/cache.cjs +0 -36
  114. package/dist/lightningcss/cache.d.ts +0 -2
  115. package/dist/lightningcss/cache.d.ts.map +0 -1
  116. package/dist/lightningcss/cache.js +0 -22
package/dist/utils.js CHANGED
@@ -1,254 +1,208 @@
1
- import { createRequire } from 'node:module';
2
- var require = createRequire(import.meta['url']);
3
-
4
- import path from "path";
5
- import { fileURLToPath } from "url";
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 colors from "./colors.js";
11
- const portfinder = require("../compiled/portfinder/index.js");
12
- import fs from "node:fs";
13
- import net from "node:net";
14
- import os from "node:os";
15
- import path2 from "node:path";
16
- import { DEFAULT_DEV_HOST } from "./constants.js";
17
- import { logger } from "./logger.js";
18
- const { merge } = require("../compiled/webpack-merge/index.js");
19
- const getNodeEnv = () => process.env.NODE_ENV;
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
- current = current[currKey];
59
- }
60
- const lastKey = pathArray.at(-1);
61
- if (current[lastKey] === void 0) {
62
- current[lastKey] = defaultValue;
63
- }
64
- return current[lastKey];
65
- };
66
- const setValueByPath = (target, pathArray, value) => {
67
- let current = target;
68
- for (let i = 0; i < pathArray.length - 1; i++) {
69
- const currKey = pathArray[i];
70
- if (!current[currKey] || typeof current[currKey] !== "object") {
71
- current[currKey] = typeof pathArray[i + 1] === "string" ? {} : [];
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 = current[currKey];
74
- }
75
- current[pathArray.at(-1)] = value;
76
- };
77
- const getPort = (startPort) => {
78
- return new Promise((resolve) => {
79
- portfinder.getPort(
80
- {
81
- port: startPort
82
- },
83
- (_, port) => {
84
- resolve(port);
85
- }
86
- );
87
- });
88
- };
89
- const getCompiledPkgPath = (packageName) => path2.join(__dirname, "../compiled", packageName);
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
- const now = /* @__PURE__ */ new Date();
101
- const hours = String(now.getHours()).padStart(2, "0");
102
- const minutes = String(now.getMinutes()).padStart(2, "0");
103
- const seconds = String(now.getSeconds()).padStart(2, "0");
104
- return `${hours}:${minutes}:${seconds}`;
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
- let timer = null;
108
- return (...args) => {
109
- clearTimeout(timer);
110
- timer = setTimeout(() => {
111
- fn(...args);
112
- }, delay);
113
- };
114
- };
115
- const getIpv4Interfaces = () => {
116
- const interfaces = os.networkInterfaces();
117
- const ipv4Interfaces = /* @__PURE__ */ new Map();
118
- for (const key of Object.keys(interfaces)) {
119
- for (const detail of interfaces[key]) {
120
- const familyV4Value = typeof detail.family === "string" ? "IPv4" : 4;
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
- return Array.from(ipv4Interfaces.values());
127
- };
128
- const isLoopbackHost = (host) => {
129
- const loopbackHosts = ["localhost", "127.0.0.1", "::1", "0000:0000:0000:0000:0000:0000:0000:0001"];
130
- return loopbackHosts.includes(host);
131
- };
132
- const getHostInUrl = (host) => {
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
- const ipv4Interfaces = getIpv4Interfaces();
163
- const addressUrls = [];
164
- let hasLocalUrl = false;
165
- for (const detail of ipv4Interfaces) {
166
- if (isLoopbackHost(detail.address) || detail.internal) {
167
- if (hasLocalUrl) {
168
- continue;
169
- }
170
- addressUrls.push({
171
- label: LOCAL_LABEL,
172
- url: concatUrl({ host: "localhost", port, protocol })
173
- });
174
- hasLocalUrl = true;
175
- } else {
176
- addressUrls.push({
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({ host: detail.address, port, protocol })
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
- const depPath = getUserDepPath(root, dep);
203
- if (!depPath)
204
- return;
205
- const packageInfo = JSON.parse(fs.readFileSync(path2.resolve(depPath, "package.json"), "utf-8"));
206
- return packageInfo.version;
207
- };
208
- const clearLine = () => {
209
- if (!process.stdout.isTTY)
210
- return;
211
- process.stdout.clearLine(0);
212
- process.stdout.cursorTo(0);
213
- };
214
- const logUpdate = (output) => {
215
- clearLine();
216
- process.stdout.write(output);
217
- };
218
- const removeDir = (dir) => {
219
- fs.rmSync(dir, { recursive: true, force: true });
220
- };
221
- export {
222
- clearLine,
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,3 @@
1
+ import type { ChokidarOptions, FSWatcher } from 'chokidar';
2
+ export declare function createChokidar(pathOrGlobs: string[], root: string, options?: ChokidarOptions): Promise<FSWatcher>;
3
+ //# sourceMappingURL=watchFiles.d.ts.map
@@ -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.5",
3
+ "version": "1.7.7",
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
- "line-diff": "2.1.1",
70
+ "line-diff": "2.1.2",
76
71
  "portfinder": "1.0.32",
77
72
  "postcss-loader": "8.1.1",
78
- "sass-loader": "16.0.4",
79
- "semver": "7.6.3",
73
+ "sass-loader": "16.0.5",
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.1.8",
86
- "@types/less": "3.0.7",
80
+ "@rspack/core": "1.2.6",
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.24.2",
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.28.2",
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.4.49",
98
- "tinyglobby": "0.2.10",
99
- "ts-checker-rspack-plugin": "1.1.0",
94
+ "postcss": "8.5.3",
95
+ "thread-loader": "4.0.4",
96
+ "tinyglobby": "0.2.12",
97
+ "ts-checker-rspack-plugin": "1.1.1",
100
98
  "typed-css-modules": "0.9.1",
101
- "webpack": "5.97.1",
102
- "webpack-dev-server": "5.2.0",
103
- "thread-loader": "4.0.4"
99
+ "webpack": "5.98.0",
100
+ "webpack-dev-server": "5.2.0"
104
101
  },
105
102
  "scripts": {
106
- "dev": "modern build --watch",
107
- "build": "pnpm prebundle && modern build",
103
+ "dev": "rslib build --watch",
104
+ "build": "pnpm prebundle && rslib build",
108
105
  "prebundle": "prebundle && node ./scripts/afterPrebundle.js"
109
106
  }
110
107
  }