@lynx-js/rspeedy-canary 0.13.0-canary-20260105-ec1caf1a → 0.13.0-canary-20260105-03ea61ec
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/CHANGELOG.md +1 -1
- package/dist/{0~vendors-node_modules_pnpm_ipaddr_js_2_3_0_node_modules_ipaddr_js_lib_ipaddr_js.js → 0~node_modules_pnpm_ipaddr_js_2_3_0_node_modules_ipaddr_js_lib_ipaddr_js.js} +3 -6
- package/dist/0~src_cli_exit_ts.js +98 -108
- package/dist/0~src_config_output_dist-path_ts.js +2 -0
- package/dist/0~src_config_validate_ts.js +41917 -41925
- package/dist/0~src_plugins_api_plugin_ts.js +21 -31
- package/dist/0~src_plugins_chunkLoading_plugin_ts.js +10 -20
- package/dist/0~src_plugins_dev_plugin_ts.js +168 -179
- package/dist/0~src_plugins_emitOnErrors_plugin_ts.js +10 -20
- package/dist/0~src_plugins_index_ts.js +63 -51
- package/dist/0~src_plugins_inspect_plugin_ts.js +434 -39
- package/dist/0~src_plugins_minify_plugin_ts.js +66 -76
- package/dist/0~src_plugins_optimization_plugin_ts.js +14 -24
- package/dist/0~src_plugins_output_plugin_ts.js +29 -45
- package/dist/0~src_plugins_resolve_plugin_ts.js +10 -20
- package/dist/0~src_plugins_rsdoctor_plugin_ts.js +39 -49
- package/dist/0~src_plugins_sourcemap_plugin_ts.js +86 -96
- package/dist/0~src_plugins_swc_plugin_ts.js +20 -38
- package/dist/0~src_plugins_target_plugin_ts.js +21 -39
- package/dist/0~src_utils_getESVersionTarget_ts.js +4 -0
- package/dist/1~node_modules_pnpm_chokidar_4_0_3_node_modules_chokidar_esm_index_js.js +1422 -0
- package/dist/{1~vendors-node_modules_pnpm_commander_13_1_0_node_modules_commander_esm_mjs.js → 1~node_modules_pnpm_commander_13_1_0_node_modules_commander_esm_mjs.js} +17 -24
- package/dist/{1~vendors-node_modules_pnpm_ipaddr_js_2_3_0_node_modules_ipaddr_js_lib_ipaddr_js.js → 1~node_modules_pnpm_ipaddr_js_2_3_0_node_modules_ipaddr_js_lib_ipaddr_js.js} +3 -6
- package/dist/1~src_cli_build_ts.js +35 -424
- package/dist/1~src_cli_commands_ts.js +56 -74
- package/dist/1~src_cli_dev_ts.js +29 -410
- package/dist/1~src_cli_init_ts-src_create-rspeedy_ts.js +318 -0
- package/dist/1~src_cli_inspect_ts.js +18 -356
- package/dist/1~src_cli_preview_ts.js +23 -359
- package/dist/1~src_cli_watch_ts.js +39 -0
- package/dist/1~src_config_output_dist-path_ts.js +2 -0
- package/dist/1~src_config_validate_ts.js +41917 -41925
- package/dist/1~src_plugins_api_plugin_ts.js +22 -31
- package/dist/1~src_plugins_chunkLoading_plugin_ts.js +10 -20
- package/dist/1~src_plugins_dev_plugin_ts.js +170 -179
- package/dist/1~src_plugins_emitOnErrors_plugin_ts.js +10 -20
- package/dist/1~src_plugins_index_ts.js +63 -51
- package/dist/1~src_plugins_inspect_plugin_ts.js +436 -39
- package/dist/1~src_plugins_minify_plugin_ts.js +66 -76
- package/dist/1~src_plugins_optimization_plugin_ts.js +14 -24
- package/dist/1~src_plugins_output_plugin_ts.js +29 -45
- package/dist/1~src_plugins_resolve_plugin_ts.js +10 -20
- package/dist/1~src_plugins_rsdoctor_plugin_ts.js +37 -55
- package/dist/1~src_plugins_sourcemap_plugin_ts.js +86 -96
- package/dist/1~src_plugins_swc_plugin_ts.js +20 -38
- package/dist/1~src_plugins_target_plugin_ts.js +21 -39
- package/dist/1~src_utils_getESVersionTarget_ts.js +4 -0
- package/dist/1~src_utils_is-ci_ts.js +4 -0
- package/dist/1~src_version_ts.js +6 -18
- package/dist/cli/main.js +1 -357
- package/dist/cli/start.js +16 -130
- package/dist/index.js +1 -524
- package/dist/node_fs.js +7 -0
- package/dist/node_path.js +7 -0
- package/dist/node_url.js +1 -0
- package/dist/rslib-runtime.js +75 -0
- package/dist/src_cli_main_ts.js +149 -0
- package/dist/src_debug_ts.js +93 -0
- package/dist/src_index_ts.js +381 -0
- package/package.json +1 -1
- package/dist/0~vendors-node_modules_pnpm_javascript-stringify_2_1_0_node_modules_javascript-stringify_dist_i-562fbc.js +0 -417
- package/dist/1~events-fs-fs_promises-os-path-stream.js +0 -30
- package/dist/1~node_child_process-node_events-node_fs-node_path.js +0 -22
- package/dist/1~vendors-node_modules_pnpm_chokidar_4_0_3_node_modules_chokidar_esm_index_js.js +0 -1432
- package/dist/1~vendors-node_modules_pnpm_javascript-stringify_2_1_0_node_modules_javascript-stringify_dist_i-562fbc.js +0 -417
- /package/dist/{1~vendors-node_modules_pnpm_chokidar_4_0_3_node_modules_chokidar_esm_index_js.js.LICENSE.txt → 1~node_modules_pnpm_chokidar_4_0_3_node_modules_chokidar_esm_index_js.js.LICENSE.txt} +0 -0
package/dist/cli/main.js
CHANGED
|
@@ -1,357 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import * as __rspack_external_node_process_786449bf from "node:process";
|
|
3
|
-
var __webpack_modules__ = {
|
|
4
|
-
"../../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js" (module) {
|
|
5
|
-
let p = process || {}, argv = p.argv || [], env = p.env || {};
|
|
6
|
-
let isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || "win32" === p.platform || (p.stdout || {}).isTTY && "dumb" !== env.TERM || !!env.CI);
|
|
7
|
-
let formatter = (open, close, replace = open)=>(input)=>{
|
|
8
|
-
let string = "" + input, index = string.indexOf(close, open.length);
|
|
9
|
-
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
10
|
-
};
|
|
11
|
-
let replaceClose = (string, close, replace, index)=>{
|
|
12
|
-
let result = "", cursor = 0;
|
|
13
|
-
do {
|
|
14
|
-
result += string.substring(cursor, index) + replace;
|
|
15
|
-
cursor = index + close.length;
|
|
16
|
-
index = string.indexOf(close, cursor);
|
|
17
|
-
}while (~index);
|
|
18
|
-
return result + string.substring(cursor);
|
|
19
|
-
};
|
|
20
|
-
let createColors = (enabled = isColorSupported)=>{
|
|
21
|
-
let f = enabled ? formatter : ()=>String;
|
|
22
|
-
return {
|
|
23
|
-
isColorSupported: enabled,
|
|
24
|
-
reset: f("\x1b[0m", "\x1b[0m"),
|
|
25
|
-
bold: f("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m"),
|
|
26
|
-
dim: f("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m"),
|
|
27
|
-
italic: f("\x1b[3m", "\x1b[23m"),
|
|
28
|
-
underline: f("\x1b[4m", "\x1b[24m"),
|
|
29
|
-
inverse: f("\x1b[7m", "\x1b[27m"),
|
|
30
|
-
hidden: f("\x1b[8m", "\x1b[28m"),
|
|
31
|
-
strikethrough: f("\x1b[9m", "\x1b[29m"),
|
|
32
|
-
black: f("\x1b[30m", "\x1b[39m"),
|
|
33
|
-
red: f("\x1b[31m", "\x1b[39m"),
|
|
34
|
-
green: f("\x1b[32m", "\x1b[39m"),
|
|
35
|
-
yellow: f("\x1b[33m", "\x1b[39m"),
|
|
36
|
-
blue: f("\x1b[34m", "\x1b[39m"),
|
|
37
|
-
magenta: f("\x1b[35m", "\x1b[39m"),
|
|
38
|
-
cyan: f("\x1b[36m", "\x1b[39m"),
|
|
39
|
-
white: f("\x1b[37m", "\x1b[39m"),
|
|
40
|
-
gray: f("\x1b[90m", "\x1b[39m"),
|
|
41
|
-
bgBlack: f("\x1b[40m", "\x1b[49m"),
|
|
42
|
-
bgRed: f("\x1b[41m", "\x1b[49m"),
|
|
43
|
-
bgGreen: f("\x1b[42m", "\x1b[49m"),
|
|
44
|
-
bgYellow: f("\x1b[43m", "\x1b[49m"),
|
|
45
|
-
bgBlue: f("\x1b[44m", "\x1b[49m"),
|
|
46
|
-
bgMagenta: f("\x1b[45m", "\x1b[49m"),
|
|
47
|
-
bgCyan: f("\x1b[46m", "\x1b[49m"),
|
|
48
|
-
bgWhite: f("\x1b[47m", "\x1b[49m"),
|
|
49
|
-
blackBright: f("\x1b[90m", "\x1b[39m"),
|
|
50
|
-
redBright: f("\x1b[91m", "\x1b[39m"),
|
|
51
|
-
greenBright: f("\x1b[92m", "\x1b[39m"),
|
|
52
|
-
yellowBright: f("\x1b[93m", "\x1b[39m"),
|
|
53
|
-
blueBright: f("\x1b[94m", "\x1b[39m"),
|
|
54
|
-
magentaBright: f("\x1b[95m", "\x1b[39m"),
|
|
55
|
-
cyanBright: f("\x1b[96m", "\x1b[39m"),
|
|
56
|
-
whiteBright: f("\x1b[97m", "\x1b[39m"),
|
|
57
|
-
bgBlackBright: f("\x1b[100m", "\x1b[49m"),
|
|
58
|
-
bgRedBright: f("\x1b[101m", "\x1b[49m"),
|
|
59
|
-
bgGreenBright: f("\x1b[102m", "\x1b[49m"),
|
|
60
|
-
bgYellowBright: f("\x1b[103m", "\x1b[49m"),
|
|
61
|
-
bgBlueBright: f("\x1b[104m", "\x1b[49m"),
|
|
62
|
-
bgMagentaBright: f("\x1b[105m", "\x1b[49m"),
|
|
63
|
-
bgCyanBright: f("\x1b[106m", "\x1b[49m"),
|
|
64
|
-
bgWhiteBright: f("\x1b[107m", "\x1b[49m")
|
|
65
|
-
};
|
|
66
|
-
};
|
|
67
|
-
module.exports = createColors();
|
|
68
|
-
module.exports.createColors = createColors;
|
|
69
|
-
},
|
|
70
|
-
"./src/cli/exit.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
71
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
72
|
-
exit: ()=>exit_exit
|
|
73
|
-
});
|
|
74
|
-
var core_ = __webpack_require__("@rsbuild/core");
|
|
75
|
-
var external_node_process_ = __webpack_require__("node:process");
|
|
76
|
-
const asyncCallbacks = new Set();
|
|
77
|
-
const callbacks = new Set();
|
|
78
|
-
let isCalled = false;
|
|
79
|
-
let isRegistered = false;
|
|
80
|
-
async function exit(shouldManuallyExit, isSynchronous, signal) {
|
|
81
|
-
if (isCalled) return;
|
|
82
|
-
isCalled = true;
|
|
83
|
-
if (asyncCallbacks.size > 0 && isSynchronous) console.error("SYNCHRONOUS TERMINATION NOTICE: When explicitly exiting the process via process.exit or via a parent process, asynchronous tasks in your exitHooks will not run. Either remove these tasks, use gracefulExit() instead of process.exit(), or ensure your parent process sends a SIGINT to the process running this code.");
|
|
84
|
-
const exitCode = 128 + signal;
|
|
85
|
-
const done = (force = false)=>{
|
|
86
|
-
if (true === force || true === shouldManuallyExit) external_node_process_["default"].exit(exitCode);
|
|
87
|
-
};
|
|
88
|
-
for (const callback of callbacks)callback(exitCode);
|
|
89
|
-
if (isSynchronous) return void done();
|
|
90
|
-
const promises = [];
|
|
91
|
-
let forceAfter = 0;
|
|
92
|
-
for (const [callback, wait] of asyncCallbacks){
|
|
93
|
-
forceAfter = Math.max(forceAfter, wait);
|
|
94
|
-
promises.push(Promise.resolve(callback(exitCode)));
|
|
95
|
-
}
|
|
96
|
-
const asyncTimer = setTimeout(()=>{
|
|
97
|
-
done(true);
|
|
98
|
-
}, forceAfter);
|
|
99
|
-
await Promise.all(promises);
|
|
100
|
-
clearTimeout(asyncTimer);
|
|
101
|
-
done();
|
|
102
|
-
}
|
|
103
|
-
function addHook(options) {
|
|
104
|
-
const { onExit, wait, isSynchronous } = options;
|
|
105
|
-
const asyncCallbackConfig = [
|
|
106
|
-
onExit,
|
|
107
|
-
wait
|
|
108
|
-
];
|
|
109
|
-
if (isSynchronous) callbacks.add(onExit);
|
|
110
|
-
else asyncCallbacks.add(asyncCallbackConfig);
|
|
111
|
-
if (!isRegistered) {
|
|
112
|
-
isRegistered = true;
|
|
113
|
-
external_node_process_["default"].once('beforeExit', exit.bind(void 0, true, false, -128));
|
|
114
|
-
external_node_process_["default"].once('SIGINT', exit.bind(void 0, true, false, 2));
|
|
115
|
-
external_node_process_["default"].once('SIGTERM', exit.bind(void 0, true, false, 15));
|
|
116
|
-
external_node_process_["default"].once('exit', exit.bind(void 0, false, true, 0));
|
|
117
|
-
external_node_process_["default"].on('message', (message)=>{
|
|
118
|
-
if ('shutdown' === message) exit(true, true, -128);
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
return ()=>{
|
|
122
|
-
if (isSynchronous) callbacks.delete(onExit);
|
|
123
|
-
else asyncCallbacks.delete(asyncCallbackConfig);
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
function asyncExitHook(onExit, options = {}) {
|
|
127
|
-
if ('function' != typeof onExit) throw new TypeError('onExit must be a function');
|
|
128
|
-
if (!('number' == typeof options.wait && options.wait > 0)) throw new TypeError('wait must be set to a positive numeric value');
|
|
129
|
-
return addHook({
|
|
130
|
-
onExit,
|
|
131
|
-
wait: options.wait,
|
|
132
|
-
isSynchronous: false
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
function gracefulExit(signal = 0) {
|
|
136
|
-
exit(true, false, -128 + signal);
|
|
137
|
-
}
|
|
138
|
-
var picocolors = __webpack_require__("../../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
139
|
-
var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
|
|
140
|
-
var debug = __webpack_require__("./src/debug.ts");
|
|
141
|
-
const start = Date.now();
|
|
142
|
-
const exitPromises = [];
|
|
143
|
-
const unsubscribe = asyncExitHook(exit_onExit, {
|
|
144
|
-
wait: 1000
|
|
145
|
-
});
|
|
146
|
-
process.on('unhandledRejection', async (reason)=>{
|
|
147
|
-
core_.logger.error('Unhandled Rejection with reason:', reason instanceof Error ? reason : new Error(JSON.stringify(reason)));
|
|
148
|
-
unsubscribe();
|
|
149
|
-
await exit_onExit(1);
|
|
150
|
-
process.exit(1);
|
|
151
|
-
});
|
|
152
|
-
let interrupted = false;
|
|
153
|
-
process.on('SIGINT', ()=>{
|
|
154
|
-
if (interrupted) {
|
|
155
|
-
core_.logger.info("Force exiting Rspeedy.");
|
|
156
|
-
return process.exit(130);
|
|
157
|
-
}
|
|
158
|
-
interrupted = true;
|
|
159
|
-
core_.logger.info(`Gracefully shutting down. Please wait... (Press ${picocolors_default().cyan('Ctrl+C')} again to force exit)`);
|
|
160
|
-
exit_exit(130);
|
|
161
|
-
});
|
|
162
|
-
let previousSignal = null;
|
|
163
|
-
const exit_exit = (signal = 0)=>{
|
|
164
|
-
if (null !== previousSignal) (0, debug.Yz)(`graceful exit called multiple times, current: ${signal}, previous: ${previousSignal}`);
|
|
165
|
-
previousSignal = signal;
|
|
166
|
-
(0, debug.Yz)(`graceful exit process with signal: ${signal}`);
|
|
167
|
-
gracefulExit(signal);
|
|
168
|
-
};
|
|
169
|
-
async function exit_onExit(signal) {
|
|
170
|
-
const duration = Date.now() - start;
|
|
171
|
-
(0, debug.Yz)(`exit hook fired with signal: ${signal}, duration: ${duration}`);
|
|
172
|
-
(0, debug.Yz)(`awaiting exit promises(length: ${exitPromises.length})...`);
|
|
173
|
-
await Promise.allSettled(exitPromises);
|
|
174
|
-
}
|
|
175
|
-
},
|
|
176
|
-
"./src/debug.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
177
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
178
|
-
Iv: ()=>debugList,
|
|
179
|
-
Yz: ()=>debug,
|
|
180
|
-
_o: ()=>isDebug
|
|
181
|
-
});
|
|
182
|
-
var _rsbuild_core__rspack_import_0 = __webpack_require__("@rsbuild/core");
|
|
183
|
-
var picocolors__rspack_import_1 = __webpack_require__("../../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
184
|
-
var picocolors__rspack_import_1_default = /*#__PURE__*/ __webpack_require__.n(picocolors__rspack_import_1);
|
|
185
|
-
const isDebug = ()=>{
|
|
186
|
-
if (!process.env['DEBUG']) return false;
|
|
187
|
-
const values = process.env['DEBUG'].toLocaleLowerCase().split(',');
|
|
188
|
-
return [
|
|
189
|
-
'rsbuild',
|
|
190
|
-
'rspeedy',
|
|
191
|
-
'*'
|
|
192
|
-
].some((key)=>values.includes(key));
|
|
193
|
-
};
|
|
194
|
-
const label = picocolors__rspack_import_1_default().bgCyan('lynx');
|
|
195
|
-
const debug = (message)=>{
|
|
196
|
-
if (isDebug()) {
|
|
197
|
-
const result = 'string' == typeof message ? message : message();
|
|
198
|
-
_rsbuild_core__rspack_import_0.logger.level = 'verbose';
|
|
199
|
-
_rsbuild_core__rspack_import_0.logger.debug(`${label} ${result}`);
|
|
200
|
-
}
|
|
201
|
-
};
|
|
202
|
-
const debugList = (prefix, messages)=>debug(()=>`${prefix} ${[
|
|
203
|
-
''
|
|
204
|
-
].concat(messages).join('\n - ')}`);
|
|
205
|
-
},
|
|
206
|
-
"@rsbuild/core" (module) {
|
|
207
|
-
module.exports = __rspack_external__rsbuild_core_1b356efc;
|
|
208
|
-
},
|
|
209
|
-
"node:process" (module) {
|
|
210
|
-
module.exports = __rspack_external_node_process_786449bf;
|
|
211
|
-
}
|
|
212
|
-
};
|
|
213
|
-
var __webpack_module_cache__ = {};
|
|
214
|
-
function __webpack_require__(moduleId) {
|
|
215
|
-
var cachedModule = __webpack_module_cache__[moduleId];
|
|
216
|
-
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
217
|
-
var module = __webpack_module_cache__[moduleId] = {
|
|
218
|
-
exports: {}
|
|
219
|
-
};
|
|
220
|
-
__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
221
|
-
return module.exports;
|
|
222
|
-
}
|
|
223
|
-
__webpack_require__.m = __webpack_modules__;
|
|
224
|
-
(()=>{
|
|
225
|
-
__webpack_require__.n = (module)=>{
|
|
226
|
-
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
227
|
-
__webpack_require__.d(getter, {
|
|
228
|
-
a: getter
|
|
229
|
-
});
|
|
230
|
-
return getter;
|
|
231
|
-
};
|
|
232
|
-
})();
|
|
233
|
-
(()=>{
|
|
234
|
-
var getProto = Object.getPrototypeOf ? (obj)=>Object.getPrototypeOf(obj) : (obj)=>obj.__proto__;
|
|
235
|
-
var leafPrototypes;
|
|
236
|
-
__webpack_require__.t = function(value, mode) {
|
|
237
|
-
if (1 & mode) value = this(value);
|
|
238
|
-
if (8 & mode) return value;
|
|
239
|
-
if ('object' == typeof value && value) {
|
|
240
|
-
if (4 & mode && value.__esModule) return value;
|
|
241
|
-
if (16 & mode && 'function' == typeof value.then) return value;
|
|
242
|
-
}
|
|
243
|
-
var ns = Object.create(null);
|
|
244
|
-
__webpack_require__.r(ns);
|
|
245
|
-
var def = {};
|
|
246
|
-
leafPrototypes = leafPrototypes || [
|
|
247
|
-
null,
|
|
248
|
-
getProto({}),
|
|
249
|
-
getProto([]),
|
|
250
|
-
getProto(getProto)
|
|
251
|
-
];
|
|
252
|
-
for(var current = 2 & mode && value; ('object' == typeof current || 'function' == typeof current) && !~leafPrototypes.indexOf(current); current = getProto(current))Object.getOwnPropertyNames(current).forEach((key)=>{
|
|
253
|
-
def[key] = ()=>value[key];
|
|
254
|
-
});
|
|
255
|
-
def['default'] = ()=>value;
|
|
256
|
-
__webpack_require__.d(ns, def);
|
|
257
|
-
return ns;
|
|
258
|
-
};
|
|
259
|
-
})();
|
|
260
|
-
(()=>{
|
|
261
|
-
__webpack_require__.d = (exports, definition)=>{
|
|
262
|
-
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, {
|
|
263
|
-
enumerable: true,
|
|
264
|
-
get: definition[key]
|
|
265
|
-
});
|
|
266
|
-
};
|
|
267
|
-
})();
|
|
268
|
-
(()=>{
|
|
269
|
-
__webpack_require__.f = {};
|
|
270
|
-
__webpack_require__.e = (chunkId)=>Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key)=>{
|
|
271
|
-
__webpack_require__.f[key](chunkId, promises);
|
|
272
|
-
return promises;
|
|
273
|
-
}, []));
|
|
274
|
-
})();
|
|
275
|
-
(()=>{
|
|
276
|
-
__webpack_require__.u = (chunkId)=>"1~" + chunkId + ".js";
|
|
277
|
-
})();
|
|
278
|
-
(()=>{
|
|
279
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
280
|
-
})();
|
|
281
|
-
(()=>{
|
|
282
|
-
__webpack_require__.r = (exports)=>{
|
|
283
|
-
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports, Symbol.toStringTag, {
|
|
284
|
-
value: 'Module'
|
|
285
|
-
});
|
|
286
|
-
Object.defineProperty(exports, '__esModule', {
|
|
287
|
-
value: true
|
|
288
|
-
});
|
|
289
|
-
};
|
|
290
|
-
})();
|
|
291
|
-
(()=>{
|
|
292
|
-
var installedChunks = {
|
|
293
|
-
"cli/main": 0
|
|
294
|
-
};
|
|
295
|
-
var installChunk = (data)=>{
|
|
296
|
-
var __rspack_esm_ids = data.__rspack_esm_ids;
|
|
297
|
-
var __webpack_modules__ = data.__webpack_modules__;
|
|
298
|
-
var __rspack_esm_runtime = data.__rspack_esm_runtime;
|
|
299
|
-
var moduleId, chunkId, i = 0;
|
|
300
|
-
for(moduleId in __webpack_modules__)if (__webpack_require__.o(__webpack_modules__, moduleId)) __webpack_require__.m[moduleId] = __webpack_modules__[moduleId];
|
|
301
|
-
if (__rspack_esm_runtime) __rspack_esm_runtime(__webpack_require__);
|
|
302
|
-
for(; i < __rspack_esm_ids.length; i++){
|
|
303
|
-
chunkId = __rspack_esm_ids[i];
|
|
304
|
-
if (__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) installedChunks[chunkId][0]();
|
|
305
|
-
installedChunks[__rspack_esm_ids[i]] = 0;
|
|
306
|
-
}
|
|
307
|
-
};
|
|
308
|
-
__webpack_require__.f.j = function(chunkId, promises) {
|
|
309
|
-
var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : void 0;
|
|
310
|
-
if (0 !== installedChunkData) if (installedChunkData) promises.push(installedChunkData[1]);
|
|
311
|
-
else {
|
|
312
|
-
var promise = import("../" + __webpack_require__.u(chunkId)).then(installChunk, (e)=>{
|
|
313
|
-
if (0 !== installedChunks[chunkId]) installedChunks[chunkId] = void 0;
|
|
314
|
-
throw e;
|
|
315
|
-
});
|
|
316
|
-
var promise = Promise.race([
|
|
317
|
-
promise,
|
|
318
|
-
new Promise((resolve)=>{
|
|
319
|
-
installedChunkData = installedChunks[chunkId] = [
|
|
320
|
-
resolve
|
|
321
|
-
];
|
|
322
|
-
})
|
|
323
|
-
]);
|
|
324
|
-
promises.push(installedChunkData[1] = promise);
|
|
325
|
-
}
|
|
326
|
-
};
|
|
327
|
-
})();
|
|
328
|
-
var core_ = __webpack_require__("@rsbuild/core");
|
|
329
|
-
var exit = __webpack_require__("./src/cli/exit.ts");
|
|
330
|
-
var debug = __webpack_require__("./src/debug.ts");
|
|
331
|
-
function initNodeEnv(argv) {
|
|
332
|
-
if (!process.env['NODE_ENV']) {
|
|
333
|
-
const NODE_ENV = argv.includes('dev') || argv.includes('preview') ? 'development' : 'production';
|
|
334
|
-
process.env['NODE_ENV'] = NODE_ENV;
|
|
335
|
-
(0, debug.Yz)(`No NODE_ENV found, set to ${NODE_ENV}`);
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
async function main(argv) {
|
|
339
|
-
initNodeEnv(argv);
|
|
340
|
-
const { npm_execpath } = process.env;
|
|
341
|
-
if (!npm_execpath || npm_execpath.includes('npm-cli.js') || npm_execpath.includes('npx-cli.js')) console.log();
|
|
342
|
-
const { version, rsbuildVersion, rspackVersion } = await __webpack_require__.e("src_version_ts").then(__webpack_require__.bind(__webpack_require__, "./src/version.ts"));
|
|
343
|
-
core_.logger.greet(` Rspeedy v${version} (Rsbuild v${rsbuildVersion}, Rspack v${rspackVersion})\n`);
|
|
344
|
-
try {
|
|
345
|
-
const [{ Command }, { apply }] = await Promise.all([
|
|
346
|
-
Promise.all([
|
|
347
|
-
__webpack_require__.e("vendors-node_modules_pnpm_commander_13_1_0_node_modules_commander_esm_mjs"),
|
|
348
|
-
__webpack_require__.e("node_child_process-node_events-node_fs-node_path")
|
|
349
|
-
]).then(__webpack_require__.bind(__webpack_require__, "../../../node_modules/.pnpm/commander@13.1.0/node_modules/commander/esm.mjs")),
|
|
350
|
-
__webpack_require__.e("src_cli_commands_ts").then(__webpack_require__.bind(__webpack_require__, "./src/cli/commands.ts"))
|
|
351
|
-
]);
|
|
352
|
-
apply(new Command('rspeedy')).parse(argv);
|
|
353
|
-
} catch {
|
|
354
|
-
return (0, exit.exit)(1);
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
export { main };
|
|
1
|
+
export { main } from "../src_cli_main_ts.js";
|
package/dist/cli/start.js
CHANGED
|
@@ -1,127 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
let isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || "win32" === p.platform || (p.stdout || {}).isTTY && "dumb" !== env.TERM || !!env.CI);
|
|
9
|
-
let formatter = (open, close, replace = open)=>(input)=>{
|
|
10
|
-
let string = "" + input, index = string.indexOf(close, open.length);
|
|
11
|
-
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
12
|
-
};
|
|
13
|
-
let replaceClose = (string, close, replace, index)=>{
|
|
14
|
-
let result = "", cursor = 0;
|
|
15
|
-
do {
|
|
16
|
-
result += string.substring(cursor, index) + replace;
|
|
17
|
-
cursor = index + close.length;
|
|
18
|
-
index = string.indexOf(close, cursor);
|
|
19
|
-
}while (~index);
|
|
20
|
-
return result + string.substring(cursor);
|
|
21
|
-
};
|
|
22
|
-
let createColors = (enabled = isColorSupported)=>{
|
|
23
|
-
let f = enabled ? formatter : ()=>String;
|
|
24
|
-
return {
|
|
25
|
-
isColorSupported: enabled,
|
|
26
|
-
reset: f("\x1b[0m", "\x1b[0m"),
|
|
27
|
-
bold: f("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m"),
|
|
28
|
-
dim: f("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m"),
|
|
29
|
-
italic: f("\x1b[3m", "\x1b[23m"),
|
|
30
|
-
underline: f("\x1b[4m", "\x1b[24m"),
|
|
31
|
-
inverse: f("\x1b[7m", "\x1b[27m"),
|
|
32
|
-
hidden: f("\x1b[8m", "\x1b[28m"),
|
|
33
|
-
strikethrough: f("\x1b[9m", "\x1b[29m"),
|
|
34
|
-
black: f("\x1b[30m", "\x1b[39m"),
|
|
35
|
-
red: f("\x1b[31m", "\x1b[39m"),
|
|
36
|
-
green: f("\x1b[32m", "\x1b[39m"),
|
|
37
|
-
yellow: f("\x1b[33m", "\x1b[39m"),
|
|
38
|
-
blue: f("\x1b[34m", "\x1b[39m"),
|
|
39
|
-
magenta: f("\x1b[35m", "\x1b[39m"),
|
|
40
|
-
cyan: f("\x1b[36m", "\x1b[39m"),
|
|
41
|
-
white: f("\x1b[37m", "\x1b[39m"),
|
|
42
|
-
gray: f("\x1b[90m", "\x1b[39m"),
|
|
43
|
-
bgBlack: f("\x1b[40m", "\x1b[49m"),
|
|
44
|
-
bgRed: f("\x1b[41m", "\x1b[49m"),
|
|
45
|
-
bgGreen: f("\x1b[42m", "\x1b[49m"),
|
|
46
|
-
bgYellow: f("\x1b[43m", "\x1b[49m"),
|
|
47
|
-
bgBlue: f("\x1b[44m", "\x1b[49m"),
|
|
48
|
-
bgMagenta: f("\x1b[45m", "\x1b[49m"),
|
|
49
|
-
bgCyan: f("\x1b[46m", "\x1b[49m"),
|
|
50
|
-
bgWhite: f("\x1b[47m", "\x1b[49m"),
|
|
51
|
-
blackBright: f("\x1b[90m", "\x1b[39m"),
|
|
52
|
-
redBright: f("\x1b[91m", "\x1b[39m"),
|
|
53
|
-
greenBright: f("\x1b[92m", "\x1b[39m"),
|
|
54
|
-
yellowBright: f("\x1b[93m", "\x1b[39m"),
|
|
55
|
-
blueBright: f("\x1b[94m", "\x1b[39m"),
|
|
56
|
-
magentaBright: f("\x1b[95m", "\x1b[39m"),
|
|
57
|
-
cyanBright: f("\x1b[96m", "\x1b[39m"),
|
|
58
|
-
whiteBright: f("\x1b[97m", "\x1b[39m"),
|
|
59
|
-
bgBlackBright: f("\x1b[100m", "\x1b[49m"),
|
|
60
|
-
bgRedBright: f("\x1b[101m", "\x1b[49m"),
|
|
61
|
-
bgGreenBright: f("\x1b[102m", "\x1b[49m"),
|
|
62
|
-
bgYellowBright: f("\x1b[103m", "\x1b[49m"),
|
|
63
|
-
bgBlueBright: f("\x1b[104m", "\x1b[49m"),
|
|
64
|
-
bgMagentaBright: f("\x1b[105m", "\x1b[49m"),
|
|
65
|
-
bgCyanBright: f("\x1b[106m", "\x1b[49m"),
|
|
66
|
-
bgWhiteBright: f("\x1b[107m", "\x1b[49m")
|
|
67
|
-
};
|
|
68
|
-
};
|
|
69
|
-
module.exports = createColors();
|
|
70
|
-
module.exports.createColors = createColors;
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
var __webpack_module_cache__ = {};
|
|
74
|
-
function __webpack_require__(moduleId) {
|
|
75
|
-
var cachedModule = __webpack_module_cache__[moduleId];
|
|
76
|
-
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
77
|
-
var module = __webpack_module_cache__[moduleId] = {
|
|
78
|
-
exports: {}
|
|
79
|
-
};
|
|
80
|
-
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
81
|
-
return module.exports;
|
|
82
|
-
}
|
|
83
|
-
(()=>{
|
|
84
|
-
__webpack_require__.n = (module)=>{
|
|
85
|
-
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
86
|
-
__webpack_require__.d(getter, {
|
|
87
|
-
a: getter
|
|
88
|
-
});
|
|
89
|
-
return getter;
|
|
90
|
-
};
|
|
91
|
-
})();
|
|
92
|
-
(()=>{
|
|
93
|
-
__webpack_require__.d = (exports, definition)=>{
|
|
94
|
-
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, {
|
|
95
|
-
enumerable: true,
|
|
96
|
-
get: definition[key]
|
|
97
|
-
});
|
|
98
|
-
};
|
|
99
|
-
})();
|
|
100
|
-
(()=>{
|
|
101
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
102
|
-
})();
|
|
103
|
-
var picocolors = __webpack_require__("../../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
104
|
-
var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
|
|
105
|
-
const isDebug = ()=>{
|
|
106
|
-
if (!process.env['DEBUG']) return false;
|
|
107
|
-
const values = process.env['DEBUG'].toLocaleLowerCase().split(',');
|
|
108
|
-
return [
|
|
109
|
-
'rsbuild',
|
|
110
|
-
'rspeedy',
|
|
111
|
-
'*'
|
|
112
|
-
].some((key)=>values.includes(key));
|
|
113
|
-
};
|
|
114
|
-
const label = picocolors_default().bgCyan('lynx');
|
|
115
|
-
const debug = (message)=>{
|
|
116
|
-
if (isDebug()) {
|
|
117
|
-
const result = 'string' == typeof message ? message : message();
|
|
118
|
-
logger.level = 'verbose';
|
|
119
|
-
logger.debug(`${label} ${result}`);
|
|
120
|
-
}
|
|
121
|
-
};
|
|
1
|
+
import { __webpack_require__ } from "../rslib-runtime.js";
|
|
2
|
+
import "../node_fs.js";
|
|
3
|
+
import "../node_path.js";
|
|
4
|
+
import { pathToFileURL } from "../node_url.js";
|
|
5
|
+
import { debug, logger } from "../src_debug_ts.js";
|
|
6
|
+
const external_node_fs_ = __webpack_require__("node:fs");
|
|
7
|
+
const external_node_path_ = __webpack_require__("node:path");
|
|
122
8
|
function tryGetPackageFolderFor(resolvedFileOrFolderPath) {
|
|
123
|
-
if (existsSync(join(resolvedFileOrFolderPath, 'package.json'))) return resolvedFileOrFolderPath;
|
|
124
|
-
const parentFolder = dirname(resolvedFileOrFolderPath);
|
|
9
|
+
if (external_node_fs_.existsSync(external_node_path_.join(resolvedFileOrFolderPath, 'package.json'))) return resolvedFileOrFolderPath;
|
|
10
|
+
const parentFolder = external_node_path_.dirname(resolvedFileOrFolderPath);
|
|
125
11
|
if (!parentFolder || parentFolder === resolvedFileOrFolderPath) return;
|
|
126
12
|
return tryGetPackageFolderFor(parentFolder);
|
|
127
13
|
}
|
|
@@ -138,8 +24,8 @@ function tryStartLocalRspeedy(root = process.cwd()) {
|
|
|
138
24
|
let rspeedyEntryPoint;
|
|
139
25
|
let packageJson;
|
|
140
26
|
try {
|
|
141
|
-
const packageJsonPath = join(projectFolder, 'package.json');
|
|
142
|
-
const packageJsonContent = readFileSync(packageJsonPath).toString();
|
|
27
|
+
const packageJsonPath = external_node_path_.join(projectFolder, 'package.json');
|
|
28
|
+
const packageJsonContent = external_node_fs_.readFileSync(packageJsonPath).toString();
|
|
143
29
|
try {
|
|
144
30
|
packageJson = JSON.parse(packageJsonContent);
|
|
145
31
|
} catch (error) {
|
|
@@ -149,12 +35,12 @@ function tryStartLocalRspeedy(root = process.cwd()) {
|
|
|
149
35
|
debug('The project does not have a dependency on Rspeedy');
|
|
150
36
|
return false;
|
|
151
37
|
}
|
|
152
|
-
const rspeedyFolder = join(projectFolder, 'node_modules', ..."@lynx-js/rspeedy".split('/'));
|
|
153
|
-
rspeedyEntryPoint = join(rspeedyFolder, 'dist', 'cli', 'main.js');
|
|
154
|
-
if (!existsSync(rspeedyEntryPoint)) {
|
|
38
|
+
const rspeedyFolder = external_node_path_.join(projectFolder, 'node_modules', ..."@lynx-js/rspeedy".split('/'));
|
|
39
|
+
rspeedyEntryPoint = external_node_path_.join(rspeedyFolder, 'dist', 'cli', 'main.js');
|
|
40
|
+
if (!external_node_fs_.existsSync(rspeedyEntryPoint)) {
|
|
155
41
|
debug(`Unable to find rspeedy entry point: ${rspeedyEntryPoint}, trying the legacy location.`);
|
|
156
|
-
rspeedyEntryPoint = join(rspeedyFolder, 'lib', 'cli', 'main.js');
|
|
157
|
-
if (!existsSync(rspeedyEntryPoint)) {
|
|
42
|
+
rspeedyEntryPoint = external_node_path_.join(rspeedyFolder, 'lib', 'cli', 'main.js');
|
|
43
|
+
if (!external_node_fs_.existsSync(rspeedyEntryPoint)) {
|
|
158
44
|
debug(`Unable to find rspeedy entry point: ${rspeedyEntryPoint}, using the unmanaged version.`);
|
|
159
45
|
return false;
|
|
160
46
|
}
|