@lynx-js/rspeedy 0.8.7 → 0.9.0
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 +45 -0
- package/bin/rspeedy.js +2 -2
- package/dist/cli/main.js +414 -0
- package/dist/cli/start.js +171 -0
- package/dist/index.d.ts +2971 -0
- package/dist/index.js +39472 -0
- package/dist/register/hooks.js +552 -0
- package/dist/register/index.js +22 -0
- package/dist/src_cli_build_ts.js +47 -0
- package/dist/src_cli_commands_ts.js +60 -0
- package/dist/src_cli_dev_ts.js +87 -0
- package/dist/src_cli_exit_ts.js +111 -0
- package/dist/src_cli_inspect_ts.js +42 -0
- package/dist/src_cli_preview_ts.js +49 -0
- package/dist/src_config_loadConfig_ts-src_create-rspeedy_ts.js +39227 -0
- package/dist/src_plugins_api_plugin_ts.js +32 -0
- package/dist/src_plugins_chunkLoading_plugin_ts.js +35 -0
- package/dist/src_plugins_dev_plugin_ts.js +141 -0
- package/dist/src_plugins_index_ts.js +60 -0
- package/dist/src_plugins_inspect_plugin_ts.js +48 -0
- package/dist/src_plugins_minify_plugin_ts.js +85 -0
- package/dist/src_plugins_optimization_plugin_ts.js +25 -0
- package/dist/src_plugins_output_plugin_ts.js +46 -0
- package/dist/src_plugins_resolve_plugin_ts.js +21 -0
- package/dist/src_plugins_rsdoctor_plugin_ts.js +59 -0
- package/dist/src_plugins_sourcemap_plugin_ts.js +99 -0
- package/dist/src_plugins_stats_plugin_ts.js +26 -0
- package/dist/src_plugins_swc_plugin_ts.js +36 -0
- package/dist/src_plugins_target_plugin_ts.js +45 -0
- package/dist/src_version_ts.js +18 -0
- package/dist/vendors-node_modules_pnpm_chokidar_4_0_3_node_modules_chokidar_esm_index_js.js +1435 -0
- package/dist/vendors-node_modules_pnpm_chokidar_4_0_3_node_modules_chokidar_esm_index_js.js.LICENSE.txt +1 -0
- package/dist/vendors-node_modules_pnpm_commander_13_1_0_node_modules_commander_esm_mjs.js +1761 -0
- package/dist/vendors-node_modules_pnpm_ipaddr_js_2_2_0_node_modules_ipaddr_js_lib_ipaddr_js.js +1067 -0
- package/dist/vendors-node_modules_pnpm_javascript-stringify_2_1_0_node_modules_javascript-stringify_dist_i-b558be.js +416 -0
- package/package.json +36 -23
- package/LICENSE +0 -202
- package/lib/api.d.ts +0 -46
- package/lib/api.js +0 -2
- package/lib/cli/build.d.ts +0 -4
- package/lib/cli/build.js +0 -32
- package/lib/cli/commands.d.ts +0 -5
- package/lib/cli/commands.js +0 -45
- package/lib/cli/dev.d.ts +0 -4
- package/lib/cli/dev.js +0 -75
- package/lib/cli/exit.d.ts +0 -1
- package/lib/cli/exit.js +0 -51
- package/lib/cli/inspect.d.ts +0 -8
- package/lib/cli/inspect.js +0 -30
- package/lib/cli/main.d.ts +0 -1
- package/lib/cli/main.js +0 -39
- package/lib/cli/preview.d.ts +0 -4
- package/lib/cli/preview.js +0 -31
- package/lib/cli/start.d.ts +0 -6
- package/lib/cli/start.js +0 -88
- package/lib/config/defaults.d.ts +0 -2
- package/lib/config/defaults.js +0 -32
- package/lib/config/defineConfig.d.ts +0 -22
- package/lib/config/defineConfig.js +0 -24
- package/lib/config/dev/client.d.ts +0 -15
- package/lib/config/dev/client.js +0 -2
- package/lib/config/dev/index.d.ts +0 -173
- package/lib/config/dev/index.js +0 -2
- package/lib/config/index.d.ts +0 -172
- package/lib/config/index.js +0 -2
- package/lib/config/loadConfig.d.ts +0 -50
- package/lib/config/loadConfig.js +0 -98
- package/lib/config/mergeRspeedyConfig.d.ts +0 -36
- package/lib/config/mergeRspeedyConfig.js +0 -42
- package/lib/config/output/css-modules.d.ts +0 -84
- package/lib/config/output/css-modules.js +0 -2
- package/lib/config/output/dist-path.d.ts +0 -19
- package/lib/config/output/dist-path.js +0 -2
- package/lib/config/output/filename.d.ts +0 -167
- package/lib/config/output/filename.js +0 -2
- package/lib/config/output/index.d.ts +0 -324
- package/lib/config/output/index.js +0 -2
- package/lib/config/output/minify.d.ts +0 -80
- package/lib/config/output/minify.js +0 -2
- package/lib/config/output/source-map.d.ts +0 -68
- package/lib/config/output/source-map.js +0 -2
- package/lib/config/performance/chunk-split.d.ts +0 -192
- package/lib/config/performance/chunk-split.js +0 -2
- package/lib/config/performance/index.d.ts +0 -165
- package/lib/config/performance/index.js +0 -2
- package/lib/config/rsbuild/entry.d.ts +0 -3
- package/lib/config/rsbuild/entry.js +0 -31
- package/lib/config/rsbuild/index.d.ts +0 -4
- package/lib/config/rsbuild/index.js +0 -75
- package/lib/config/server/index.d.ts +0 -91
- package/lib/config/server/index.js +0 -2
- package/lib/config/source/decorators.d.ts +0 -43
- package/lib/config/source/decorators.js +0 -2
- package/lib/config/source/entry.d.ts +0 -84
- package/lib/config/source/entry.js +0 -2
- package/lib/config/source/index.d.ts +0 -474
- package/lib/config/source/index.js +0 -2
- package/lib/config/source/transformImport.d.ts +0 -106
- package/lib/config/source/transformImport.js +0 -2
- package/lib/config/tools/css-extract.d.ts +0 -72
- package/lib/config/tools/css-extract.js +0 -2
- package/lib/config/tools/css-loader.d.ts +0 -130
- package/lib/config/tools/css-loader.js +0 -2
- package/lib/config/tools/index.d.ts +0 -170
- package/lib/config/tools/index.js +0 -2
- package/lib/config/validate.d.ts +0 -4
- package/lib/config/validate.js +0 -28877
- package/lib/create-rspeedy.d.ts +0 -52
- package/lib/create-rspeedy.js +0 -49
- package/lib/debug.d.ts +0 -3
- package/lib/debug.js +0 -25
- package/lib/index.d.ts +0 -46
- package/lib/index.js +0 -11
- package/lib/plugins/api.plugin.d.ts +0 -3
- package/lib/plugins/api.plugin.js +0 -25
- package/lib/plugins/chunkLoading.plugin.d.ts +0 -2
- package/lib/plugins/chunkLoading.plugin.js +0 -43
- package/lib/plugins/dev.plugin.d.ts +0 -5
- package/lib/plugins/dev.plugin.js +0 -137
- package/lib/plugins/index.d.ts +0 -3
- package/lib/plugins/index.js +0 -49
- package/lib/plugins/inspect.plugin.d.ts +0 -4
- package/lib/plugins/inspect.plugin.js +0 -39
- package/lib/plugins/minify.plugin.d.ts +0 -3
- package/lib/plugins/minify.plugin.js +0 -89
- package/lib/plugins/optimization.plugin.d.ts +0 -2
- package/lib/plugins/optimization.plugin.js +0 -31
- package/lib/plugins/output.plugin.d.ts +0 -3
- package/lib/plugins/output.plugin.js +0 -34
- package/lib/plugins/resolve.plugin.d.ts +0 -2
- package/lib/plugins/resolve.plugin.js +0 -38
- package/lib/plugins/rsdoctor.plugin.d.ts +0 -3
- package/lib/plugins/rsdoctor.plugin.js +0 -48
- package/lib/plugins/sourcemap.plugin.d.ts +0 -2
- package/lib/plugins/sourcemap.plugin.js +0 -86
- package/lib/plugins/stats.plugin.d.ts +0 -2
- package/lib/plugins/stats.plugin.js +0 -20
- package/lib/plugins/swc.plugin.d.ts +0 -2
- package/lib/plugins/swc.plugin.js +0 -21
- package/lib/plugins/target.plugin.d.ts +0 -2
- package/lib/plugins/target.plugin.js +0 -22
- package/lib/utils/getESVersionTarget.d.ts +0 -1
- package/lib/utils/getESVersionTarget.js +0 -7
- package/lib/utils/is-ci.d.ts +0 -1
- package/lib/utils/is-ci.js +0 -7
- package/lib/utils/is-lynx.d.ts +0 -2
- package/lib/utils/is-lynx.js +0 -6
- package/lib/utils/is-web.d.ts +0 -2
- package/lib/utils/is-web.js +0 -6
- package/lib/version.d.ts +0 -4
- package/lib/version.js +0 -15
- package/lib/webpack/CompilationIdPlugin.d.ts +0 -4
- package/lib/webpack/CompilationIdPlugin.js +0 -20
- package/lib/webpack/EvalSourceMapDevToolPlugin.d.ts +0 -9
- package/lib/webpack/EvalSourceMapDevToolPlugin.js +0 -15
- package/lib/webpack/ProvidePlugin.d.ts +0 -9
- package/lib/webpack/ProvidePlugin.js +0 -15
- package/lib/webpack/SourceMapDevToolPlugin.d.ts +0 -9
- package/lib/webpack/SourceMapDevToolPlugin.js +0 -15
- package/register/data.d.ts +0 -9
- package/register/hooks.js +0 -146
- package/register/index.js +0 -47
- /package/{register → dist/register}/index.d.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,50 @@
|
|
|
1
1
|
# @lynx-js/rspeedy
|
|
2
2
|
|
|
3
|
+
## 0.9.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Bundle Rspeedy with Rslib for faster start-up times. ([#395](https://github.com/lynx-family/lynx-stack/pull/395))
|
|
8
|
+
|
|
9
|
+
This would be a **BREAKING CHANGE** for using [global version of Rspeedy](https://lynxjs.org/rspeedy/cli#using-the-global-rspeedy-version).
|
|
10
|
+
|
|
11
|
+
Please ensure that you update your globally installed version of Rspeedy:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install --global @lynx-js/rspeedy@latest
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
- Bump Rsbuild v1.3.2 with Rspack v1.3.1 ([#446](https://github.com/lynx-family/lynx-stack/pull/446))
|
|
18
|
+
|
|
19
|
+
- **BREAKING CHANGE**: Added explicit TypeScript peer dependency requirement of 5.1.6 - 5.8.x. ([#480](https://github.com/lynx-family/lynx-stack/pull/480))
|
|
20
|
+
|
|
21
|
+
This formalizes the existing TypeScript version requirement in `peerDependencies` (marked as optional since it is only needed for TypeScript configurations). The actual required TypeScript version has not changed.
|
|
22
|
+
|
|
23
|
+
Note: This may cause installation to fail if you have strict peer dependency checks enabled.
|
|
24
|
+
|
|
25
|
+
Node.js v22.7+ users can bypass TypeScript installation using `--experimental-transform-types` or `--experimental-strip-types` flags. Node.js v23.6+ users don't need any flags. See [Node.js - TypeScript](https://nodejs.org/api/typescript.html) for details.
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- Support cli flag `--base` to specify the base path of the server. ([#387](https://github.com/lynx-family/lynx-stack/pull/387))
|
|
30
|
+
|
|
31
|
+
- Support cli option `--environment` to specify the name of environment to build ([#462](https://github.com/lynx-family/lynx-stack/pull/462))
|
|
32
|
+
|
|
33
|
+
- Select the most appropriate network interface. ([#457](https://github.com/lynx-family/lynx-stack/pull/457))
|
|
34
|
+
|
|
35
|
+
This is a port of [webpack/webpack-dev-server#5411](https://github.com/webpack/webpack-dev-server/pull/5411).
|
|
36
|
+
|
|
37
|
+
- Support Node.js v23.6+ native TypeScript. ([#481](https://github.com/lynx-family/lynx-stack/pull/481))
|
|
38
|
+
|
|
39
|
+
See [Node.js - TypeScript](https://nodejs.org/api/typescript.html) for more details.
|
|
40
|
+
|
|
41
|
+
- Support cli option `--env-mode` to specify the env mode to load the `.env.[mode]` file. ([#453](https://github.com/lynx-family/lynx-stack/pull/453))
|
|
42
|
+
|
|
43
|
+
- Support `dev.hmr` and `dev.liveReload`. ([#458](https://github.com/lynx-family/lynx-stack/pull/458))
|
|
44
|
+
|
|
45
|
+
- Updated dependencies [[`df63722`](https://github.com/lynx-family/lynx-stack/commit/df637229e8dafda938aba73e10f3c8d95afc7dce), [`df63722`](https://github.com/lynx-family/lynx-stack/commit/df637229e8dafda938aba73e10f3c8d95afc7dce)]:
|
|
46
|
+
- @lynx-js/chunk-loading-webpack-plugin@0.2.0
|
|
47
|
+
|
|
3
48
|
## 0.8.7
|
|
4
49
|
|
|
5
50
|
### Patch Changes
|
package/bin/rspeedy.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// @ts-check
|
|
7
7
|
import nodeModule from 'node:module'
|
|
8
8
|
|
|
9
|
-
import { tryStartLocalRspeedy } from '../
|
|
9
|
+
import { tryStartLocalRspeedy } from '../dist/cli/start.js'
|
|
10
10
|
|
|
11
11
|
// See: https://nodejs.org/id/blog/release/v22.8.0
|
|
12
12
|
// eslint-disable-next-line n/no-unsupported-features/node-builtins
|
|
@@ -27,7 +27,7 @@ try {
|
|
|
27
27
|
|
|
28
28
|
if (tryStartLocalRspeedy() === false) {
|
|
29
29
|
// A project rspeedy dependency was not found, so launch the unmanaged version.
|
|
30
|
-
const { main } = await import('../
|
|
30
|
+
const { main } = await import('../dist/cli/main.js')
|
|
31
31
|
|
|
32
32
|
await main(process.argv)
|
|
33
33
|
}
|
package/dist/cli/main.js
ADDED
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE__lynx_js_chunk_loading_webpack_plugin_f5dc50b6__ from "@lynx-js/chunk-loading-webpack-plugin";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE__lynx_js_rspeedy_register_78d0d330__ from "@lynx-js/rspeedy/register";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__ from "@rsbuild/core";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE_events__ from "events";
|
|
5
|
+
import * as __WEBPACK_EXTERNAL_MODULE_fs__ from "fs";
|
|
6
|
+
import * as __WEBPACK_EXTERNAL_MODULE_fs_promises_400951f8__ from "fs/promises";
|
|
7
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_child_process_27f17141__ from "node:child_process";
|
|
8
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_events_0a6aefe7__ from "node:events";
|
|
9
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__ from "node:fs";
|
|
10
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__ from "node:fs/promises";
|
|
11
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__ from "node:module";
|
|
12
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
|
|
13
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_process_786449bf__ from "node:process";
|
|
14
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__ from "node:url";
|
|
15
|
+
import * as __WEBPACK_EXTERNAL_MODULE_os__ from "os";
|
|
16
|
+
import * as __WEBPACK_EXTERNAL_MODULE_path__ from "path";
|
|
17
|
+
import * as __WEBPACK_EXTERNAL_MODULE_stream__ from "stream";
|
|
18
|
+
var __webpack_modules__ = {
|
|
19
|
+
"../../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js": function(module) {
|
|
20
|
+
let p = process || {}, argv = p.argv || [], env = p.env || {};
|
|
21
|
+
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);
|
|
22
|
+
let formatter = (open, close, replace = open)=>(input)=>{
|
|
23
|
+
let string = "" + input, index = string.indexOf(close, open.length);
|
|
24
|
+
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
25
|
+
};
|
|
26
|
+
let replaceClose = (string, close, replace, index)=>{
|
|
27
|
+
let result = "", cursor = 0;
|
|
28
|
+
do {
|
|
29
|
+
result += string.substring(cursor, index) + replace;
|
|
30
|
+
cursor = index + close.length;
|
|
31
|
+
index = string.indexOf(close, cursor);
|
|
32
|
+
}while (~index);
|
|
33
|
+
return result + string.substring(cursor);
|
|
34
|
+
};
|
|
35
|
+
let createColors = (enabled = isColorSupported)=>{
|
|
36
|
+
let f = enabled ? formatter : ()=>String;
|
|
37
|
+
return {
|
|
38
|
+
isColorSupported: enabled,
|
|
39
|
+
reset: f("\x1b[0m", "\x1b[0m"),
|
|
40
|
+
bold: f("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m"),
|
|
41
|
+
dim: f("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m"),
|
|
42
|
+
italic: f("\x1b[3m", "\x1b[23m"),
|
|
43
|
+
underline: f("\x1b[4m", "\x1b[24m"),
|
|
44
|
+
inverse: f("\x1b[7m", "\x1b[27m"),
|
|
45
|
+
hidden: f("\x1b[8m", "\x1b[28m"),
|
|
46
|
+
strikethrough: f("\x1b[9m", "\x1b[29m"),
|
|
47
|
+
black: f("\x1b[30m", "\x1b[39m"),
|
|
48
|
+
red: f("\x1b[31m", "\x1b[39m"),
|
|
49
|
+
green: f("\x1b[32m", "\x1b[39m"),
|
|
50
|
+
yellow: f("\x1b[33m", "\x1b[39m"),
|
|
51
|
+
blue: f("\x1b[34m", "\x1b[39m"),
|
|
52
|
+
magenta: f("\x1b[35m", "\x1b[39m"),
|
|
53
|
+
cyan: f("\x1b[36m", "\x1b[39m"),
|
|
54
|
+
white: f("\x1b[37m", "\x1b[39m"),
|
|
55
|
+
gray: f("\x1b[90m", "\x1b[39m"),
|
|
56
|
+
bgBlack: f("\x1b[40m", "\x1b[49m"),
|
|
57
|
+
bgRed: f("\x1b[41m", "\x1b[49m"),
|
|
58
|
+
bgGreen: f("\x1b[42m", "\x1b[49m"),
|
|
59
|
+
bgYellow: f("\x1b[43m", "\x1b[49m"),
|
|
60
|
+
bgBlue: f("\x1b[44m", "\x1b[49m"),
|
|
61
|
+
bgMagenta: f("\x1b[45m", "\x1b[49m"),
|
|
62
|
+
bgCyan: f("\x1b[46m", "\x1b[49m"),
|
|
63
|
+
bgWhite: f("\x1b[47m", "\x1b[49m"),
|
|
64
|
+
blackBright: f("\x1b[90m", "\x1b[39m"),
|
|
65
|
+
redBright: f("\x1b[91m", "\x1b[39m"),
|
|
66
|
+
greenBright: f("\x1b[92m", "\x1b[39m"),
|
|
67
|
+
yellowBright: f("\x1b[93m", "\x1b[39m"),
|
|
68
|
+
blueBright: f("\x1b[94m", "\x1b[39m"),
|
|
69
|
+
magentaBright: f("\x1b[95m", "\x1b[39m"),
|
|
70
|
+
cyanBright: f("\x1b[96m", "\x1b[39m"),
|
|
71
|
+
whiteBright: f("\x1b[97m", "\x1b[39m"),
|
|
72
|
+
bgBlackBright: f("\x1b[100m", "\x1b[49m"),
|
|
73
|
+
bgRedBright: f("\x1b[101m", "\x1b[49m"),
|
|
74
|
+
bgGreenBright: f("\x1b[102m", "\x1b[49m"),
|
|
75
|
+
bgYellowBright: f("\x1b[103m", "\x1b[49m"),
|
|
76
|
+
bgBlueBright: f("\x1b[104m", "\x1b[49m"),
|
|
77
|
+
bgMagentaBright: f("\x1b[105m", "\x1b[49m"),
|
|
78
|
+
bgCyanBright: f("\x1b[106m", "\x1b[49m"),
|
|
79
|
+
bgWhiteBright: f("\x1b[107m", "\x1b[49m")
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
module.exports = createColors();
|
|
83
|
+
module.exports.createColors = createColors;
|
|
84
|
+
},
|
|
85
|
+
"./src/cli/exit.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
86
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
87
|
+
exit: ()=>exit_exit
|
|
88
|
+
});
|
|
89
|
+
var core_ = __webpack_require__("@rsbuild/core");
|
|
90
|
+
var external_node_process_ = __webpack_require__("node:process");
|
|
91
|
+
const asyncCallbacks = new Set();
|
|
92
|
+
const callbacks = new Set();
|
|
93
|
+
let isCalled = false;
|
|
94
|
+
let isRegistered = false;
|
|
95
|
+
async function exit(shouldManuallyExit, isSynchronous, signal) {
|
|
96
|
+
if (isCalled) return;
|
|
97
|
+
isCalled = true;
|
|
98
|
+
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.");
|
|
99
|
+
const exitCode = 128 + signal;
|
|
100
|
+
const done = (force = false)=>{
|
|
101
|
+
if (true === force || true === shouldManuallyExit) external_node_process_["default"].exit(exitCode);
|
|
102
|
+
};
|
|
103
|
+
for (const callback of callbacks)callback(exitCode);
|
|
104
|
+
if (isSynchronous) return void done();
|
|
105
|
+
const promises = [];
|
|
106
|
+
let forceAfter = 0;
|
|
107
|
+
for (const [callback, wait] of asyncCallbacks){
|
|
108
|
+
forceAfter = Math.max(forceAfter, wait);
|
|
109
|
+
promises.push(Promise.resolve(callback(exitCode)));
|
|
110
|
+
}
|
|
111
|
+
const asyncTimer = setTimeout(()=>{
|
|
112
|
+
done(true);
|
|
113
|
+
}, forceAfter);
|
|
114
|
+
await Promise.all(promises);
|
|
115
|
+
clearTimeout(asyncTimer);
|
|
116
|
+
done();
|
|
117
|
+
}
|
|
118
|
+
function addHook(options) {
|
|
119
|
+
const { onExit, wait, isSynchronous } = options;
|
|
120
|
+
const asyncCallbackConfig = [
|
|
121
|
+
onExit,
|
|
122
|
+
wait
|
|
123
|
+
];
|
|
124
|
+
if (isSynchronous) callbacks.add(onExit);
|
|
125
|
+
else asyncCallbacks.add(asyncCallbackConfig);
|
|
126
|
+
if (!isRegistered) {
|
|
127
|
+
isRegistered = true;
|
|
128
|
+
external_node_process_["default"].once('beforeExit', exit.bind(void 0, true, false, -128));
|
|
129
|
+
external_node_process_["default"].once('SIGINT', exit.bind(void 0, true, false, 2));
|
|
130
|
+
external_node_process_["default"].once('SIGTERM', exit.bind(void 0, true, false, 15));
|
|
131
|
+
external_node_process_["default"].once('exit', exit.bind(void 0, false, true, 0));
|
|
132
|
+
external_node_process_["default"].on('message', (message)=>{
|
|
133
|
+
if ('shutdown' === message) exit(true, true, -128);
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
return ()=>{
|
|
137
|
+
if (isSynchronous) callbacks.delete(onExit);
|
|
138
|
+
else asyncCallbacks.delete(asyncCallbackConfig);
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
function asyncExitHook(onExit, options = {}) {
|
|
142
|
+
if ('function' != typeof onExit) throw new TypeError('onExit must be a function');
|
|
143
|
+
if (!('number' == typeof options.wait && options.wait > 0)) throw new TypeError('wait must be set to a positive numeric value');
|
|
144
|
+
return addHook({
|
|
145
|
+
onExit,
|
|
146
|
+
wait: options.wait,
|
|
147
|
+
isSynchronous: false
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
function gracefulExit(signal = 0) {
|
|
151
|
+
exit(true, false, -128 + signal);
|
|
152
|
+
}
|
|
153
|
+
var picocolors = __webpack_require__("../../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
154
|
+
var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
|
|
155
|
+
var debug = __webpack_require__("./src/debug.ts");
|
|
156
|
+
const start = Date.now();
|
|
157
|
+
const exitPromises = [];
|
|
158
|
+
const unsubscribe = asyncExitHook(exit_onExit, {
|
|
159
|
+
wait: 1000
|
|
160
|
+
});
|
|
161
|
+
process.on('unhandledRejection', async (reason)=>{
|
|
162
|
+
core_.logger.error('Unhandled Rejection with reason:', reason instanceof Error ? reason : new Error(JSON.stringify(reason)));
|
|
163
|
+
unsubscribe();
|
|
164
|
+
await exit_onExit(1);
|
|
165
|
+
process.exit(1);
|
|
166
|
+
});
|
|
167
|
+
let interrupted = false;
|
|
168
|
+
process.on('SIGINT', ()=>{
|
|
169
|
+
if (interrupted) {
|
|
170
|
+
core_.logger.info("Force exiting Rspeedy.");
|
|
171
|
+
return process.exit(130);
|
|
172
|
+
}
|
|
173
|
+
interrupted = true;
|
|
174
|
+
core_.logger.info(`Gracefully shutting down. Please wait... (Press ${picocolors_default().cyan('Ctrl+C')} again to force exit)`);
|
|
175
|
+
exit_exit(130);
|
|
176
|
+
});
|
|
177
|
+
let previousSignal = null;
|
|
178
|
+
const exit_exit = (signal = 0)=>{
|
|
179
|
+
if (null !== previousSignal) (0, debug.fF)(`graceful exit called multiple times, current: ${signal}, previous: ${previousSignal}`);
|
|
180
|
+
previousSignal = signal;
|
|
181
|
+
(0, debug.fF)(`graceful exit process with signal: ${signal}`);
|
|
182
|
+
gracefulExit(signal);
|
|
183
|
+
};
|
|
184
|
+
async function exit_onExit(signal) {
|
|
185
|
+
const duration = Date.now() - start;
|
|
186
|
+
(0, debug.fF)(`exit hook fired with signal: ${signal}, duration: ${duration}`);
|
|
187
|
+
(0, debug.fF)(`awaiting exit promises(length: ${exitPromises.length})...`);
|
|
188
|
+
await Promise.allSettled(exitPromises);
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
"./src/debug.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
192
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
193
|
+
L1: ()=>isDebug,
|
|
194
|
+
NW: ()=>debugList,
|
|
195
|
+
fF: ()=>debug
|
|
196
|
+
});
|
|
197
|
+
var _rsbuild_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("@rsbuild/core");
|
|
198
|
+
var picocolors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
199
|
+
var picocolors__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/ __webpack_require__.n(picocolors__WEBPACK_IMPORTED_MODULE_1__);
|
|
200
|
+
const isDebug = ()=>{
|
|
201
|
+
if (!process.env['DEBUG']) return false;
|
|
202
|
+
const values = process.env['DEBUG'].toLocaleLowerCase().split(',');
|
|
203
|
+
return [
|
|
204
|
+
'rsbuild',
|
|
205
|
+
'rspeedy',
|
|
206
|
+
'*'
|
|
207
|
+
].some((key)=>values.includes(key));
|
|
208
|
+
};
|
|
209
|
+
const label = picocolors__WEBPACK_IMPORTED_MODULE_1___default().bgCyan('lynx');
|
|
210
|
+
const debug = (message)=>{
|
|
211
|
+
if (isDebug()) {
|
|
212
|
+
const result = 'string' == typeof message ? message : message();
|
|
213
|
+
_rsbuild_core__WEBPACK_IMPORTED_MODULE_0__.logger.level = 'verbose';
|
|
214
|
+
_rsbuild_core__WEBPACK_IMPORTED_MODULE_0__.logger.debug(`${label} ${result}`);
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
const debugList = (prefix, messages)=>debug(()=>`${prefix} ${[
|
|
218
|
+
''
|
|
219
|
+
].concat(messages).join('\n - ')}`);
|
|
220
|
+
},
|
|
221
|
+
"@lynx-js/chunk-loading-webpack-plugin": function(module) {
|
|
222
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__lynx_js_chunk_loading_webpack_plugin_f5dc50b6__;
|
|
223
|
+
},
|
|
224
|
+
"@lynx-js/rspeedy/register": function(module) {
|
|
225
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__lynx_js_rspeedy_register_78d0d330__;
|
|
226
|
+
},
|
|
227
|
+
"@rsbuild/core": function(module) {
|
|
228
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__;
|
|
229
|
+
},
|
|
230
|
+
events: function(module) {
|
|
231
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_events__;
|
|
232
|
+
},
|
|
233
|
+
fs: function(module) {
|
|
234
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_fs__;
|
|
235
|
+
},
|
|
236
|
+
"fs/promises": function(module) {
|
|
237
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_fs_promises_400951f8__;
|
|
238
|
+
},
|
|
239
|
+
"node:child_process": function(module) {
|
|
240
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_node_child_process_27f17141__;
|
|
241
|
+
},
|
|
242
|
+
"node:events": function(module) {
|
|
243
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_node_events_0a6aefe7__;
|
|
244
|
+
},
|
|
245
|
+
"node:fs": function(module) {
|
|
246
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__;
|
|
247
|
+
},
|
|
248
|
+
"node:fs/promises": function(module) {
|
|
249
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__;
|
|
250
|
+
},
|
|
251
|
+
"node:module": function(module) {
|
|
252
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__;
|
|
253
|
+
},
|
|
254
|
+
"node:path": function(module) {
|
|
255
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__;
|
|
256
|
+
},
|
|
257
|
+
"node:process": function(module) {
|
|
258
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_node_process_786449bf__;
|
|
259
|
+
},
|
|
260
|
+
"node:url": function(module) {
|
|
261
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__;
|
|
262
|
+
},
|
|
263
|
+
os: function(module) {
|
|
264
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_os__;
|
|
265
|
+
},
|
|
266
|
+
path: function(module) {
|
|
267
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_path__;
|
|
268
|
+
},
|
|
269
|
+
stream: function(module) {
|
|
270
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_stream__;
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
var __webpack_module_cache__ = {};
|
|
274
|
+
function __webpack_require__(moduleId) {
|
|
275
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
276
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
277
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
278
|
+
exports: {}
|
|
279
|
+
};
|
|
280
|
+
__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
281
|
+
return module.exports;
|
|
282
|
+
}
|
|
283
|
+
__webpack_require__.m = __webpack_modules__;
|
|
284
|
+
(()=>{
|
|
285
|
+
__webpack_require__.n = (module)=>{
|
|
286
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
287
|
+
__webpack_require__.d(getter, {
|
|
288
|
+
a: getter
|
|
289
|
+
});
|
|
290
|
+
return getter;
|
|
291
|
+
};
|
|
292
|
+
})();
|
|
293
|
+
(()=>{
|
|
294
|
+
var getProto = Object.getPrototypeOf ? (obj)=>Object.getPrototypeOf(obj) : (obj)=>obj.__proto__;
|
|
295
|
+
var leafPrototypes;
|
|
296
|
+
__webpack_require__.t = function(value, mode) {
|
|
297
|
+
if (1 & mode) value = this(value);
|
|
298
|
+
if (8 & mode) return value;
|
|
299
|
+
if ('object' == typeof value && value) {
|
|
300
|
+
if (4 & mode && value.__esModule) return value;
|
|
301
|
+
if (16 & mode && 'function' == typeof value.then) return value;
|
|
302
|
+
}
|
|
303
|
+
var ns = Object.create(null);
|
|
304
|
+
__webpack_require__.r(ns);
|
|
305
|
+
var def = {};
|
|
306
|
+
leafPrototypes = leafPrototypes || [
|
|
307
|
+
null,
|
|
308
|
+
getProto({}),
|
|
309
|
+
getProto([]),
|
|
310
|
+
getProto(getProto)
|
|
311
|
+
];
|
|
312
|
+
for(var current = 2 & mode && value; 'object' == typeof current && !~leafPrototypes.indexOf(current); current = getProto(current))Object.getOwnPropertyNames(current).forEach((key)=>{
|
|
313
|
+
def[key] = ()=>value[key];
|
|
314
|
+
});
|
|
315
|
+
def['default'] = ()=>value;
|
|
316
|
+
__webpack_require__.d(ns, def);
|
|
317
|
+
return ns;
|
|
318
|
+
};
|
|
319
|
+
})();
|
|
320
|
+
(()=>{
|
|
321
|
+
__webpack_require__.d = (exports, definition)=>{
|
|
322
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, {
|
|
323
|
+
enumerable: true,
|
|
324
|
+
get: definition[key]
|
|
325
|
+
});
|
|
326
|
+
};
|
|
327
|
+
})();
|
|
328
|
+
(()=>{
|
|
329
|
+
__webpack_require__.f = {};
|
|
330
|
+
__webpack_require__.e = (chunkId)=>Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key)=>{
|
|
331
|
+
__webpack_require__.f[key](chunkId, promises);
|
|
332
|
+
return promises;
|
|
333
|
+
}, []));
|
|
334
|
+
})();
|
|
335
|
+
(()=>{
|
|
336
|
+
__webpack_require__.u = (chunkId)=>"" + chunkId + ".js";
|
|
337
|
+
})();
|
|
338
|
+
(()=>{
|
|
339
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
340
|
+
})();
|
|
341
|
+
(()=>{
|
|
342
|
+
__webpack_require__.r = (exports)=>{
|
|
343
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports, Symbol.toStringTag, {
|
|
344
|
+
value: 'Module'
|
|
345
|
+
});
|
|
346
|
+
Object.defineProperty(exports, '__esModule', {
|
|
347
|
+
value: true
|
|
348
|
+
});
|
|
349
|
+
};
|
|
350
|
+
})();
|
|
351
|
+
(()=>{
|
|
352
|
+
var installedChunks = {
|
|
353
|
+
"cli/main": 0
|
|
354
|
+
};
|
|
355
|
+
var installChunk = (data)=>{
|
|
356
|
+
var __webpack_ids__ = data.__webpack_ids__;
|
|
357
|
+
var __webpack_modules__ = data.__webpack_modules__;
|
|
358
|
+
var __webpack_runtime__ = data.__webpack_runtime__;
|
|
359
|
+
var moduleId, chunkId, i = 0;
|
|
360
|
+
for(moduleId in __webpack_modules__)if (__webpack_require__.o(__webpack_modules__, moduleId)) __webpack_require__.m[moduleId] = __webpack_modules__[moduleId];
|
|
361
|
+
if (__webpack_runtime__) __webpack_runtime__(__webpack_require__);
|
|
362
|
+
for(; i < __webpack_ids__.length; i++){
|
|
363
|
+
chunkId = __webpack_ids__[i];
|
|
364
|
+
if (__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) installedChunks[chunkId][0]();
|
|
365
|
+
installedChunks[__webpack_ids__[i]] = 0;
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
__webpack_require__.f.j = function(chunkId, promises) {
|
|
369
|
+
var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : void 0;
|
|
370
|
+
if (0 !== installedChunkData) if (installedChunkData) promises.push(installedChunkData[1]);
|
|
371
|
+
else {
|
|
372
|
+
var promise = import("../" + __webpack_require__.u(chunkId)).then(installChunk, (e)=>{
|
|
373
|
+
if (0 !== installedChunks[chunkId]) installedChunks[chunkId] = void 0;
|
|
374
|
+
throw e;
|
|
375
|
+
});
|
|
376
|
+
var promise = Promise.race([
|
|
377
|
+
promise,
|
|
378
|
+
new Promise((resolve)=>{
|
|
379
|
+
installedChunkData = installedChunks[chunkId] = [
|
|
380
|
+
resolve
|
|
381
|
+
];
|
|
382
|
+
})
|
|
383
|
+
]);
|
|
384
|
+
promises.push(installedChunkData[1] = promise);
|
|
385
|
+
}
|
|
386
|
+
};
|
|
387
|
+
})();
|
|
388
|
+
var core_ = __webpack_require__("@rsbuild/core");
|
|
389
|
+
var exit = __webpack_require__("./src/cli/exit.ts");
|
|
390
|
+
var debug = __webpack_require__("./src/debug.ts");
|
|
391
|
+
function initNodeEnv(argv) {
|
|
392
|
+
if (!process.env['NODE_ENV']) {
|
|
393
|
+
const NODE_ENV = argv.includes('dev') || argv.includes('preview') ? 'development' : 'production';
|
|
394
|
+
process.env['NODE_ENV'] = NODE_ENV;
|
|
395
|
+
(0, debug.fF)(`No NODE_ENV found, set to ${NODE_ENV}`);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
async function main(argv) {
|
|
399
|
+
initNodeEnv(argv);
|
|
400
|
+
const { npm_execpath } = process.env;
|
|
401
|
+
if (!npm_execpath || npm_execpath.includes('npm-cli.js') || npm_execpath.includes('npx-cli.js')) console.log();
|
|
402
|
+
const { version, rsbuildVersion, rspackVersion } = await __webpack_require__.e("src_version_ts").then(__webpack_require__.bind(__webpack_require__, "./src/version.ts"));
|
|
403
|
+
core_.logger.greet(` Rspeedy v${version} (Rsbuild v${rsbuildVersion}, Rspack v${rspackVersion})\n`);
|
|
404
|
+
try {
|
|
405
|
+
const [{ Command }, { apply }] = await Promise.all([
|
|
406
|
+
__webpack_require__.e("vendors-node_modules_pnpm_commander_13_1_0_node_modules_commander_esm_mjs").then(__webpack_require__.bind(__webpack_require__, "../../../node_modules/.pnpm/commander@13.1.0/node_modules/commander/esm.mjs")),
|
|
407
|
+
__webpack_require__.e("src_cli_commands_ts").then(__webpack_require__.bind(__webpack_require__, "./src/cli/commands.ts"))
|
|
408
|
+
]);
|
|
409
|
+
apply(new Command('rspeedy')).parse(argv);
|
|
410
|
+
} catch {
|
|
411
|
+
return (0, exit.exit)(1);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
export { main };
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__ from "node:fs";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__ from "node:url";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__ from "@rsbuild/core";
|
|
5
|
+
var __webpack_modules__ = {
|
|
6
|
+
"../../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js": function(module) {
|
|
7
|
+
let p = process || {}, argv = p.argv || [], env = p.env || {};
|
|
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
|
+
__WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.logger.level = 'verbose';
|
|
119
|
+
__WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.logger.debug(`${label} ${result}`);
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
function tryGetPackageFolderFor(resolvedFileOrFolderPath) {
|
|
123
|
+
if (__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.existsSync(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join(resolvedFileOrFolderPath, 'package.json'))) return resolvedFileOrFolderPath;
|
|
124
|
+
const parentFolder = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.dirname(resolvedFileOrFolderPath);
|
|
125
|
+
if (!parentFolder || parentFolder === resolvedFileOrFolderPath) return;
|
|
126
|
+
return tryGetPackageFolderFor(parentFolder);
|
|
127
|
+
}
|
|
128
|
+
function tryStartLocalRspeedy(root = process.cwd()) {
|
|
129
|
+
if (process.argv.includes("--unmanaged")) {
|
|
130
|
+
__WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.logger.info(`Bypassing the Rspeedy version selector because ${JSON.stringify("--unmanaged")} was specified.`);
|
|
131
|
+
__WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.logger.info();
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
debug(`Searching for a locally installed version of Rspeedy. Use the ${JSON.stringify("--unmanaged")} flag if you want to avoid this.`);
|
|
135
|
+
const projectFolder = tryGetPackageFolderFor(root);
|
|
136
|
+
if (projectFolder) {
|
|
137
|
+
debug(`found project at ${projectFolder}`);
|
|
138
|
+
let rspeedyEntryPoint;
|
|
139
|
+
let packageJson;
|
|
140
|
+
try {
|
|
141
|
+
const packageJsonPath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join(projectFolder, 'package.json');
|
|
142
|
+
const packageJsonContent = __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.readFileSync(packageJsonPath).toString();
|
|
143
|
+
try {
|
|
144
|
+
packageJson = JSON.parse(packageJsonContent);
|
|
145
|
+
} catch (error) {
|
|
146
|
+
throw new Error(`Error parsing ${packageJsonPath}:${error.message}`);
|
|
147
|
+
}
|
|
148
|
+
if (!packageJson.dependencies?.["@lynx-js/rspeedy"] && !packageJson.devDependencies?.["@lynx-js/rspeedy"]) {
|
|
149
|
+
debug('The project does not have a dependency on Rspeedy');
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
const rspeedyFolder = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join(projectFolder, 'node_modules', ..."@lynx-js/rspeedy".split('/'));
|
|
153
|
+
rspeedyEntryPoint = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join(rspeedyFolder, 'dist', 'cli', 'main.js');
|
|
154
|
+
if (!__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.existsSync(rspeedyEntryPoint)) {
|
|
155
|
+
debug(`Unable to find rspeedy entry point: ${rspeedyEntryPoint}, trying the legacy location.`);
|
|
156
|
+
rspeedyEntryPoint = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join(rspeedyFolder, 'lib', 'cli', 'main.js');
|
|
157
|
+
if (!__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.existsSync(rspeedyEntryPoint)) {
|
|
158
|
+
debug(`Unable to find rspeedy entry point: ${rspeedyEntryPoint}, using the unmanaged version.`);
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
} catch (error) {
|
|
163
|
+
throw new Error(`Error probing for local rspeedy version: ${error.message}`);
|
|
164
|
+
}
|
|
165
|
+
debug(`found rspeedy entry point at ${rspeedyEntryPoint}`);
|
|
166
|
+
return import((0, __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__.pathToFileURL)(rspeedyEntryPoint).toString()).then(({ main })=>main(process.argv));
|
|
167
|
+
}
|
|
168
|
+
debug(`no project folder found from ${process.cwd()}`);
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
171
|
+
export { tryStartLocalRspeedy };
|