upgrade-rspeedy-canary 0.13.0-canary-20260105-12629a30 → 0.13.0-canary-20260105-ea78a1ca
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/upgrade-rspeedy.js +634 -717
- package/package.json +4 -4
package/dist/upgrade-rspeedy.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import node_os, { EOL } from "node:os";
|
|
3
|
-
import node_tty from "node:tty";
|
|
4
|
-
import { createRequire } from "node:module";
|
|
5
2
|
import * as __rspack_external_node_child_process_27f17141 from "node:child_process";
|
|
6
3
|
import * as __rspack_external_node_events_0a6aefe7 from "node:events";
|
|
7
4
|
import * as __rspack_external_node_fs_5ea92f0c from "node:fs";
|
|
5
|
+
import * as __rspack_external_node_module_ab9f2194 from "node:module";
|
|
6
|
+
import * as __rspack_external_node_os_74b4b876 from "node:os";
|
|
8
7
|
import * as __rspack_external_node_path_c5b9b54f from "node:path";
|
|
9
8
|
import * as __rspack_external_node_process_786449bf from "node:process";
|
|
10
|
-
|
|
9
|
+
import * as __rspack_external_node_tty_c64aab7e from "node:tty";
|
|
10
|
+
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
11
|
+
__webpack_require__.add({
|
|
11
12
|
"../../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js" (module) {
|
|
12
13
|
let p = process || {}, argv = p.argv || [], env = p.env || {};
|
|
13
14
|
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);
|
|
@@ -74,6 +75,99 @@ var __webpack_modules__ = {
|
|
|
74
75
|
module.exports = createColors();
|
|
75
76
|
module.exports.createColors = createColors;
|
|
76
77
|
},
|
|
78
|
+
"./src/install.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
79
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
80
|
+
a: ()=>install
|
|
81
|
+
});
|
|
82
|
+
var node_fs__rspack_import_0 = __webpack_require__("node:fs");
|
|
83
|
+
var node_os__rspack_import_1 = __webpack_require__("node:os");
|
|
84
|
+
var node_path__rspack_import_2 = __webpack_require__("node:path");
|
|
85
|
+
var detect_indent__rspack_import_6 = __webpack_require__("../../../node_modules/.pnpm/detect-indent@7.0.2/node_modules/detect-indent/index.js");
|
|
86
|
+
var picocolors__rspack_import_5 = __webpack_require__("../../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
87
|
+
var picocolors__rspack_import_5_default = /*#__PURE__*/ __webpack_require__.n(picocolors__rspack_import_5);
|
|
88
|
+
var rslog__rspack_import_3 = __webpack_require__("../../../node_modules/.pnpm/rslog@1.2.11/node_modules/rslog/dist/index.js");
|
|
89
|
+
var _version_js__rspack_import_4 = __webpack_require__("./src/version.ts");
|
|
90
|
+
const LYNX_RSPEEDY = '@lynx-js/rspeedy';
|
|
91
|
+
async function install(cwd) {
|
|
92
|
+
const packageJSONPath = node_path__rspack_import_2["default"].resolve(cwd, 'package.json');
|
|
93
|
+
if (!node_fs__rspack_import_0["default"].existsSync(packageJSONPath)) {
|
|
94
|
+
const message = `${picocolors__rspack_import_5_default().underline(picocolors__rspack_import_5_default().yellow(packageJSONPath))} not found. Please run ${picocolors__rspack_import_5_default().bold('upgrade-rspeedy')} in your Rspeedy project.`;
|
|
95
|
+
rslog__rspack_import_3.v.error(message);
|
|
96
|
+
throw new Error(message);
|
|
97
|
+
}
|
|
98
|
+
try {
|
|
99
|
+
const content = await node_fs__rspack_import_0["default"].promises.readFile(packageJSONPath, 'utf-8');
|
|
100
|
+
const pkg = JSON.parse(content);
|
|
101
|
+
if (pkg.dependencies?.[LYNX_RSPEEDY] === void 0 && pkg.devDependencies?.[LYNX_RSPEEDY] === void 0) throw new Error(`No ${picocolors__rspack_import_5_default().yellow(LYNX_RSPEEDY)} found in ${packageJSONPath}.
|
|
102
|
+
|
|
103
|
+
Please run ${picocolors__rspack_import_5_default().bold('upgrade-rspeedy')} in your Rspeedy project.`);
|
|
104
|
+
const { indent } = (0, detect_indent__rspack_import_6.A)(content);
|
|
105
|
+
console.info();
|
|
106
|
+
const dependenciesUpdated = updateDependencies(pkg, packageJSONPath, 'dependencies');
|
|
107
|
+
console.info();
|
|
108
|
+
const devDependenciesUpdated = updateDependencies(pkg, packageJSONPath, 'devDependencies');
|
|
109
|
+
console.info();
|
|
110
|
+
if (dependenciesUpdated || devDependenciesUpdated) {
|
|
111
|
+
await node_fs__rspack_import_0["default"].promises.writeFile(packageJSONPath, JSON.stringify(pkg, null, indent) + node_os__rspack_import_1.EOL, 'utf-8');
|
|
112
|
+
rslog__rspack_import_3.v.success(`${picocolors__rspack_import_5_default().yellow(packageJSONPath)} has been updated.`);
|
|
113
|
+
rslog__rspack_import_3.v.success("Please install the dependencies with your package manager.");
|
|
114
|
+
}
|
|
115
|
+
} catch (error) {
|
|
116
|
+
rslog__rspack_import_3.v.error(error);
|
|
117
|
+
throw error;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
function updateDependencies(pkg, packageJSONPath, name) {
|
|
121
|
+
const dependencies = pkg[name];
|
|
122
|
+
if (!dependencies) {
|
|
123
|
+
rslog__rspack_import_3.v.info(`No ${picocolors__rspack_import_5_default().yellow(name)} is found in ${picocolors__rspack_import_5_default().underline(packageJSONPath)}`);
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
const updatedDependencies = findDependencies(dependencies).filter(([, { original, target }])=>original !== target);
|
|
127
|
+
if (0 === updatedDependencies.length) {
|
|
128
|
+
rslog__rspack_import_3.v.info(`No ${picocolors__rspack_import_5_default().yellow(name)} need to be updated in ${picocolors__rspack_import_5_default().underline(packageJSONPath)}`);
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
{
|
|
132
|
+
const sep = '\n - ';
|
|
133
|
+
rslog__rspack_import_3.v.info(`Updated ${picocolors__rspack_import_5_default().yellow(name)}:\n${sep}${updatedDependencies.map(([name, { original, target }])=>`${picocolors__rspack_import_5_default().cyan(name)}: ${picocolors__rspack_import_5_default().dim(original)} -> ${picocolors__rspack_import_5_default().green(target)}`).join(sep)}`);
|
|
134
|
+
}
|
|
135
|
+
updatedDependencies.forEach(([dependency, { target }])=>{
|
|
136
|
+
dependencies[dependency] = target;
|
|
137
|
+
});
|
|
138
|
+
return true;
|
|
139
|
+
}
|
|
140
|
+
const targetDependencies = new Map(Object.entries(_version_js__rspack_import_4.r ?? {}));
|
|
141
|
+
function findDependencies(dependencies) {
|
|
142
|
+
return Object.entries(dependencies).map(([name, original])=>{
|
|
143
|
+
if (targetDependencies.has(name) && (name.startsWith('@lynx-js/') || name.includes('rsbuild'))) return [
|
|
144
|
+
name,
|
|
145
|
+
{
|
|
146
|
+
original,
|
|
147
|
+
target: targetDependencies.get(name)
|
|
148
|
+
}
|
|
149
|
+
];
|
|
150
|
+
return null;
|
|
151
|
+
}).filter((i)=>null !== i);
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
"./src/main.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
155
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
156
|
+
i: ()=>main
|
|
157
|
+
});
|
|
158
|
+
var commander__rspack_import_0 = __webpack_require__("../../../node_modules/.pnpm/commander@13.1.0/node_modules/commander/esm.mjs");
|
|
159
|
+
var rslog__rspack_import_1 = __webpack_require__("../../../node_modules/.pnpm/rslog@1.2.11/node_modules/rslog/dist/index.js");
|
|
160
|
+
var _install_js__rspack_import_2 = __webpack_require__("./src/install.ts");
|
|
161
|
+
var _version_js__rspack_import_3 = __webpack_require__("./src/version.ts");
|
|
162
|
+
async function main(cwd, argv) {
|
|
163
|
+
const program = new commander__rspack_import_0.uB('upgrade-rspeedy');
|
|
164
|
+
const { npm_execpath } = process.env;
|
|
165
|
+
if (!npm_execpath || npm_execpath.includes('npm-cli.js') || npm_execpath.includes('npx-cli.js')) console.info();
|
|
166
|
+
rslog__rspack_import_1.v.greet(`Upgrade Rspeedy v${_version_js__rspack_import_3.K}\n`);
|
|
167
|
+
program.helpCommand(false).description('Upgrade the Rspeedy-related packages').action(()=>(0, _install_js__rspack_import_2.a)(cwd ?? process.cwd()));
|
|
168
|
+
await program.parseAsync(argv);
|
|
169
|
+
}
|
|
170
|
+
},
|
|
77
171
|
"./src/upgrade-rspeedy.ts" (module, __webpack_exports__, __webpack_require__) {
|
|
78
172
|
__webpack_require__.a(module, async function(__rspack_load_async_deps, __rspack_async_done) {
|
|
79
173
|
try {
|
|
@@ -86,532 +180,127 @@ var __webpack_modules__ = {
|
|
|
86
180
|
}
|
|
87
181
|
}, 1);
|
|
88
182
|
},
|
|
89
|
-
"./src/
|
|
183
|
+
"./src/version.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
90
184
|
__webpack_require__.d(__webpack_exports__, {
|
|
91
|
-
|
|
185
|
+
K: ()=>version,
|
|
186
|
+
r: ()=>devDependencies
|
|
92
187
|
});
|
|
93
|
-
var
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
188
|
+
var node_module__rspack_import_0 = __webpack_require__("node:module");
|
|
189
|
+
const require = (0, node_module__rspack_import_0.createRequire)(import.meta.url);
|
|
190
|
+
const pkg = require('../package.json');
|
|
191
|
+
const version = pkg.version;
|
|
192
|
+
const devDependencies = pkg.devDependencies;
|
|
193
|
+
},
|
|
194
|
+
"node:child_process" (module) {
|
|
195
|
+
module.exports = __rspack_external_node_child_process_27f17141;
|
|
196
|
+
},
|
|
197
|
+
"node:events" (module) {
|
|
198
|
+
module.exports = __rspack_external_node_events_0a6aefe7;
|
|
199
|
+
},
|
|
200
|
+
"node:fs" (module) {
|
|
201
|
+
module.exports = __rspack_external_node_fs_5ea92f0c;
|
|
202
|
+
},
|
|
203
|
+
"node:module" (module) {
|
|
204
|
+
module.exports = __rspack_external_node_module_ab9f2194;
|
|
205
|
+
},
|
|
206
|
+
"node:os" (module) {
|
|
207
|
+
module.exports = __rspack_external_node_os_74b4b876;
|
|
208
|
+
},
|
|
209
|
+
"node:path" (module) {
|
|
210
|
+
module.exports = __rspack_external_node_path_c5b9b54f;
|
|
211
|
+
},
|
|
212
|
+
"node:process" (module) {
|
|
213
|
+
module.exports = __rspack_external_node_process_786449bf;
|
|
214
|
+
},
|
|
215
|
+
"node:tty" (module) {
|
|
216
|
+
module.exports = __rspack_external_node_tty_c64aab7e;
|
|
217
|
+
},
|
|
218
|
+
"../../../node_modules/.pnpm/commander@13.1.0/node_modules/commander/index.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
219
|
+
const { Argument } = __webpack_require__("../../../node_modules/.pnpm/commander@13.1.0/node_modules/commander/lib/argument.js");
|
|
220
|
+
const { Command } = __webpack_require__("../../../node_modules/.pnpm/commander@13.1.0/node_modules/commander/lib/command.js");
|
|
221
|
+
const { CommanderError, InvalidArgumentError } = __webpack_require__("../../../node_modules/.pnpm/commander@13.1.0/node_modules/commander/lib/error.js");
|
|
222
|
+
const { Help } = __webpack_require__("../../../node_modules/.pnpm/commander@13.1.0/node_modules/commander/lib/help.js");
|
|
223
|
+
const { Option } = __webpack_require__("../../../node_modules/.pnpm/commander@13.1.0/node_modules/commander/lib/option.js");
|
|
224
|
+
exports.program = new Command();
|
|
225
|
+
exports.createCommand = (name)=>new Command(name);
|
|
226
|
+
exports.createOption = (flags, description)=>new Option(flags, description);
|
|
227
|
+
exports.createArgument = (name, description)=>new Argument(name, description);
|
|
228
|
+
exports.Command = Command;
|
|
229
|
+
exports.Option = Option;
|
|
230
|
+
exports.Argument = Argument;
|
|
231
|
+
exports.Help = Help;
|
|
232
|
+
exports.CommanderError = CommanderError;
|
|
233
|
+
exports.InvalidArgumentError = InvalidArgumentError;
|
|
234
|
+
exports.InvalidOptionArgumentError = InvalidArgumentError;
|
|
235
|
+
},
|
|
236
|
+
"../../../node_modules/.pnpm/commander@13.1.0/node_modules/commander/lib/argument.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
237
|
+
const { InvalidArgumentError } = __webpack_require__("../../../node_modules/.pnpm/commander@13.1.0/node_modules/commander/lib/error.js");
|
|
238
|
+
class Argument {
|
|
239
|
+
constructor(name, description){
|
|
240
|
+
this.description = description || '';
|
|
241
|
+
this.variadic = false;
|
|
242
|
+
this.parseArg = void 0;
|
|
243
|
+
this.defaultValue = void 0;
|
|
244
|
+
this.defaultValueDescription = void 0;
|
|
245
|
+
this.argChoices = void 0;
|
|
246
|
+
switch(name[0]){
|
|
247
|
+
case '<':
|
|
248
|
+
this.required = true;
|
|
249
|
+
this._name = name.slice(1, -1);
|
|
250
|
+
break;
|
|
251
|
+
case '[':
|
|
252
|
+
this.required = false;
|
|
253
|
+
this._name = name.slice(1, -1);
|
|
254
|
+
break;
|
|
255
|
+
default:
|
|
256
|
+
this.required = true;
|
|
257
|
+
this._name = name;
|
|
258
|
+
break;
|
|
259
|
+
}
|
|
260
|
+
if (this._name.length > 3 && '...' === this._name.slice(-3)) {
|
|
261
|
+
this.variadic = true;
|
|
262
|
+
this._name = this._name.slice(0, -3);
|
|
263
|
+
}
|
|
137
264
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
const min = forceColor || 0;
|
|
141
|
-
if ('dumb' === env.TERM) return min;
|
|
142
|
-
if ('win32' === external_node_process_["default"].platform) {
|
|
143
|
-
const osRelease = node_os.release().split('.');
|
|
144
|
-
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
145
|
-
return 1;
|
|
265
|
+
name() {
|
|
266
|
+
return this._name;
|
|
146
267
|
}
|
|
147
|
-
|
|
148
|
-
if ([
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
].some((key)=>key in env)) return 3;
|
|
153
|
-
if ([
|
|
154
|
-
'TRAVIS',
|
|
155
|
-
'APPVEYOR',
|
|
156
|
-
'GITLAB_CI',
|
|
157
|
-
'BUILDKITE',
|
|
158
|
-
'DRONE'
|
|
159
|
-
].some((sign)=>sign in env) || 'codeship' === env.CI_NAME) return 1;
|
|
160
|
-
return min;
|
|
268
|
+
_concatValue(value, previous) {
|
|
269
|
+
if (previous === this.defaultValue || !Array.isArray(previous)) return [
|
|
270
|
+
value
|
|
271
|
+
];
|
|
272
|
+
return previous.concat(value);
|
|
161
273
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
274
|
+
default(value, description) {
|
|
275
|
+
this.defaultValue = value;
|
|
276
|
+
this.defaultValueDescription = description;
|
|
277
|
+
return this;
|
|
278
|
+
}
|
|
279
|
+
argParser(fn) {
|
|
280
|
+
this.parseArg = fn;
|
|
281
|
+
return this;
|
|
282
|
+
}
|
|
283
|
+
choices(values) {
|
|
284
|
+
this.argChoices = values.slice();
|
|
285
|
+
this.parseArg = (arg, previous)=>{
|
|
286
|
+
if (!this.argChoices.includes(arg)) throw new InvalidArgumentError(`Allowed choices are ${this.argChoices.join(', ')}.`);
|
|
287
|
+
if (this.variadic) return this._concatValue(arg, previous);
|
|
288
|
+
return arg;
|
|
289
|
+
};
|
|
290
|
+
return this;
|
|
291
|
+
}
|
|
292
|
+
argRequired() {
|
|
293
|
+
this.required = true;
|
|
294
|
+
return this;
|
|
295
|
+
}
|
|
296
|
+
argOptional() {
|
|
297
|
+
this.required = false;
|
|
298
|
+
return this;
|
|
174
299
|
}
|
|
175
|
-
if (/-256(color)?$/i.test(env.TERM)) return 2;
|
|
176
|
-
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) return 1;
|
|
177
|
-
if ('COLORTERM' in env) return 1;
|
|
178
|
-
return min;
|
|
179
300
|
}
|
|
180
|
-
function
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
...options
|
|
184
|
-
});
|
|
185
|
-
return translateLevel(level);
|
|
186
|
-
}
|
|
187
|
-
const supportsColor = {
|
|
188
|
-
stdout: createSupportsColor({
|
|
189
|
-
isTTY: node_tty.isatty(1)
|
|
190
|
-
}),
|
|
191
|
-
stderr: createSupportsColor({
|
|
192
|
-
isTTY: node_tty.isatty(2)
|
|
193
|
-
})
|
|
194
|
-
};
|
|
195
|
-
const supports_color = supportsColor;
|
|
196
|
-
const colorLevel = supports_color.stdout ? supports_color.stdout.level : 0;
|
|
197
|
-
let errorStackRegExp = /at\s.*:\d+:\d+[\s\)]*$/;
|
|
198
|
-
let anonymousErrorStackRegExp = /at\s.*\(<anonymous>\)$/;
|
|
199
|
-
let isErrorStackMessage = (message)=>errorStackRegExp.test(message) || anonymousErrorStackRegExp.test(message);
|
|
200
|
-
let formatter = (open, close, replace = open)=>colorLevel >= 2 ? (input)=>{
|
|
201
|
-
let string = '' + input;
|
|
202
|
-
let index = string.indexOf(close, open.length);
|
|
203
|
-
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
204
|
-
} : String;
|
|
205
|
-
let replaceClose = (string, close, replace, index)=>{
|
|
206
|
-
let start = string.substring(0, index) + replace;
|
|
207
|
-
let end = string.substring(index + close.length);
|
|
208
|
-
let nextIndex = end.indexOf(close);
|
|
209
|
-
return ~nextIndex ? start + replaceClose(end, close, replace, nextIndex) : start + end;
|
|
210
|
-
};
|
|
211
|
-
const bold = formatter('\x1b[1m', '\x1b[22m', '\x1b[22m\x1b[1m');
|
|
212
|
-
const red = formatter('\x1b[31m', '\x1b[39m');
|
|
213
|
-
const green = formatter('\x1b[32m', '\x1b[39m');
|
|
214
|
-
const yellow = formatter('\x1b[33m', '\x1b[39m');
|
|
215
|
-
const magenta = formatter('\x1b[35m', '\x1b[39m');
|
|
216
|
-
const cyan = formatter('\x1b[36m', '\x1b[39m');
|
|
217
|
-
const gray = formatter('\x1b[90m', '\x1b[39m');
|
|
218
|
-
let startColor = [
|
|
219
|
-
189,
|
|
220
|
-
255,
|
|
221
|
-
243
|
|
222
|
-
];
|
|
223
|
-
let endColor = [
|
|
224
|
-
74,
|
|
225
|
-
194,
|
|
226
|
-
154
|
|
227
|
-
];
|
|
228
|
-
let isWord = (char)=>!/[\s\n]/.test(char);
|
|
229
|
-
let gradient = (message)=>{
|
|
230
|
-
if (colorLevel < 3) return 2 === colorLevel ? bold(cyan(message)) : message;
|
|
231
|
-
let chars = [
|
|
232
|
-
...message
|
|
233
|
-
];
|
|
234
|
-
let steps = chars.filter(isWord).length;
|
|
235
|
-
let r = startColor[0];
|
|
236
|
-
let g = startColor[1];
|
|
237
|
-
let b = startColor[2];
|
|
238
|
-
let rStep = (endColor[0] - r) / steps;
|
|
239
|
-
let gStep = (endColor[1] - g) / steps;
|
|
240
|
-
let bStep = (endColor[2] - b) / steps;
|
|
241
|
-
let output = '';
|
|
242
|
-
for (let char of chars){
|
|
243
|
-
if (isWord(char)) {
|
|
244
|
-
r += rStep;
|
|
245
|
-
g += gStep;
|
|
246
|
-
b += bStep;
|
|
247
|
-
}
|
|
248
|
-
output += `\x1b[38;2;${Math.round(r)};${Math.round(g)};${Math.round(b)}m${char}\x1b[39m`;
|
|
249
|
-
}
|
|
250
|
-
return bold(output);
|
|
251
|
-
};
|
|
252
|
-
let LOG_LEVEL = {
|
|
253
|
-
silent: -1,
|
|
254
|
-
error: 0,
|
|
255
|
-
warn: 1,
|
|
256
|
-
info: 2,
|
|
257
|
-
log: 2,
|
|
258
|
-
verbose: 3
|
|
259
|
-
};
|
|
260
|
-
let LOG_TYPES = {
|
|
261
|
-
error: {
|
|
262
|
-
label: 'error',
|
|
263
|
-
level: 'error',
|
|
264
|
-
color: red
|
|
265
|
-
},
|
|
266
|
-
warn: {
|
|
267
|
-
label: 'warn',
|
|
268
|
-
level: 'warn',
|
|
269
|
-
color: yellow
|
|
270
|
-
},
|
|
271
|
-
info: {
|
|
272
|
-
label: 'info',
|
|
273
|
-
level: 'info',
|
|
274
|
-
color: cyan
|
|
275
|
-
},
|
|
276
|
-
start: {
|
|
277
|
-
label: 'start',
|
|
278
|
-
level: 'info',
|
|
279
|
-
color: cyan
|
|
280
|
-
},
|
|
281
|
-
ready: {
|
|
282
|
-
label: 'ready',
|
|
283
|
-
level: 'info',
|
|
284
|
-
color: green
|
|
285
|
-
},
|
|
286
|
-
success: {
|
|
287
|
-
label: 'success',
|
|
288
|
-
level: 'info',
|
|
289
|
-
color: green
|
|
290
|
-
},
|
|
291
|
-
log: {
|
|
292
|
-
level: 'info'
|
|
293
|
-
},
|
|
294
|
-
debug: {
|
|
295
|
-
label: 'debug',
|
|
296
|
-
level: 'verbose',
|
|
297
|
-
color: magenta
|
|
298
|
-
}
|
|
299
|
-
};
|
|
300
|
-
let createLogger = (options = {})=>{
|
|
301
|
-
let maxLevel = options.level || 'info';
|
|
302
|
-
let log = (type, message, ...args)=>{
|
|
303
|
-
if (LOG_LEVEL[LOG_TYPES[type].level] > LOG_LEVEL[maxLevel]) return;
|
|
304
|
-
if (null == message) return console.log();
|
|
305
|
-
let logType = LOG_TYPES[type];
|
|
306
|
-
let label = '';
|
|
307
|
-
let text = '';
|
|
308
|
-
if ('label' in logType) {
|
|
309
|
-
label = (logType.label || '').padEnd(7);
|
|
310
|
-
label = bold(logType.color ? logType.color(label) : label);
|
|
311
|
-
}
|
|
312
|
-
if (message instanceof Error) if (message.stack) {
|
|
313
|
-
let [name, ...rest] = message.stack.split('\n');
|
|
314
|
-
if (name.startsWith('Error: ')) name = name.slice(7);
|
|
315
|
-
text = `${name}\n${gray(rest.join('\n'))}`;
|
|
316
|
-
} else text = message.message;
|
|
317
|
-
else if ('error' === logType.level && 'string' == typeof message) {
|
|
318
|
-
let lines = message.split('\n');
|
|
319
|
-
text = lines.map((line)=>isErrorStackMessage(line) ? gray(line) : line).join('\n');
|
|
320
|
-
} else text = `${message}`;
|
|
321
|
-
console.log(label.length ? `${label} ${text}` : text, ...args);
|
|
322
|
-
};
|
|
323
|
-
let logger = {
|
|
324
|
-
greet: (message)=>log('log', gradient(message))
|
|
325
|
-
};
|
|
326
|
-
Object.keys(LOG_TYPES).forEach((key)=>{
|
|
327
|
-
logger[key] = (...args)=>log(key, ...args);
|
|
328
|
-
});
|
|
329
|
-
Object.defineProperty(logger, 'level', {
|
|
330
|
-
get: ()=>maxLevel,
|
|
331
|
-
set (val) {
|
|
332
|
-
maxLevel = val;
|
|
333
|
-
}
|
|
334
|
-
});
|
|
335
|
-
logger.override = (customLogger)=>{
|
|
336
|
-
Object.assign(logger, customLogger);
|
|
337
|
-
};
|
|
338
|
-
return logger;
|
|
339
|
-
};
|
|
340
|
-
let src_logger = createLogger();
|
|
341
|
-
var external_node_fs_ = __webpack_require__("node:fs");
|
|
342
|
-
var external_node_path_ = __webpack_require__("node:path");
|
|
343
|
-
const INDENT_REGEX = /^(?:( )+|\t+)/;
|
|
344
|
-
const INDENT_TYPE_SPACE = 'space';
|
|
345
|
-
const INDENT_TYPE_TAB = 'tab';
|
|
346
|
-
function shouldIgnoreSingleSpace(ignoreSingleSpaces, indentType, value) {
|
|
347
|
-
return ignoreSingleSpaces && indentType === INDENT_TYPE_SPACE && 1 === value;
|
|
348
|
-
}
|
|
349
|
-
function makeIndentsMap(string, ignoreSingleSpaces) {
|
|
350
|
-
const indents = new Map();
|
|
351
|
-
let previousSize = 0;
|
|
352
|
-
let previousIndentType;
|
|
353
|
-
let key;
|
|
354
|
-
for (const line of string.split(/\n/g)){
|
|
355
|
-
if (!line) continue;
|
|
356
|
-
const matches = line.match(INDENT_REGEX);
|
|
357
|
-
if (null === matches) {
|
|
358
|
-
previousSize = 0;
|
|
359
|
-
previousIndentType = '';
|
|
360
|
-
} else {
|
|
361
|
-
const indent = matches[0].length;
|
|
362
|
-
const indentType = matches[1] ? INDENT_TYPE_SPACE : INDENT_TYPE_TAB;
|
|
363
|
-
if (shouldIgnoreSingleSpace(ignoreSingleSpaces, indentType, indent)) continue;
|
|
364
|
-
if (indentType !== previousIndentType) previousSize = 0;
|
|
365
|
-
previousIndentType = indentType;
|
|
366
|
-
let use = 1;
|
|
367
|
-
let weight = 0;
|
|
368
|
-
const indentDifference = indent - previousSize;
|
|
369
|
-
previousSize = indent;
|
|
370
|
-
if (0 === indentDifference) {
|
|
371
|
-
use = 0;
|
|
372
|
-
weight = 1;
|
|
373
|
-
} else {
|
|
374
|
-
const absoluteIndentDifference = Math.abs(indentDifference);
|
|
375
|
-
if (shouldIgnoreSingleSpace(ignoreSingleSpaces, indentType, absoluteIndentDifference)) continue;
|
|
376
|
-
key = encodeIndentsKey(indentType, absoluteIndentDifference);
|
|
377
|
-
}
|
|
378
|
-
const entry = indents.get(key);
|
|
379
|
-
indents.set(key, void 0 === entry ? [
|
|
380
|
-
1,
|
|
381
|
-
0
|
|
382
|
-
] : [
|
|
383
|
-
entry[0] + use,
|
|
384
|
-
entry[1] + weight
|
|
385
|
-
]);
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
return indents;
|
|
389
|
-
}
|
|
390
|
-
function encodeIndentsKey(indentType, indentAmount) {
|
|
391
|
-
const typeCharacter = indentType === INDENT_TYPE_SPACE ? 's' : 't';
|
|
392
|
-
return typeCharacter + String(indentAmount);
|
|
393
|
-
}
|
|
394
|
-
function decodeIndentsKey(indentsKey) {
|
|
395
|
-
const keyHasTypeSpace = 's' === indentsKey[0];
|
|
396
|
-
const type = keyHasTypeSpace ? INDENT_TYPE_SPACE : INDENT_TYPE_TAB;
|
|
397
|
-
const amount = Number(indentsKey.slice(1));
|
|
398
|
-
return {
|
|
399
|
-
type,
|
|
400
|
-
amount
|
|
401
|
-
};
|
|
402
|
-
}
|
|
403
|
-
function getMostUsedKey(indents) {
|
|
404
|
-
let result;
|
|
405
|
-
let maxUsed = 0;
|
|
406
|
-
let maxWeight = 0;
|
|
407
|
-
for (const [key, [usedCount, weight]] of indents)if (usedCount > maxUsed || usedCount === maxUsed && weight > maxWeight) {
|
|
408
|
-
maxUsed = usedCount;
|
|
409
|
-
maxWeight = weight;
|
|
410
|
-
result = key;
|
|
411
|
-
}
|
|
412
|
-
return result;
|
|
413
|
-
}
|
|
414
|
-
function makeIndentString(type, amount) {
|
|
415
|
-
const indentCharacter = type === INDENT_TYPE_SPACE ? ' ' : '\t';
|
|
416
|
-
return indentCharacter.repeat(amount);
|
|
417
|
-
}
|
|
418
|
-
function detectIndent(string) {
|
|
419
|
-
if ('string' != typeof string) throw new TypeError('Expected a string');
|
|
420
|
-
let indents = makeIndentsMap(string, true);
|
|
421
|
-
if (0 === indents.size) indents = makeIndentsMap(string, false);
|
|
422
|
-
const keyOfMostUsedIndent = getMostUsedKey(indents);
|
|
423
|
-
let type;
|
|
424
|
-
let amount = 0;
|
|
425
|
-
let indent = '';
|
|
426
|
-
if (void 0 !== keyOfMostUsedIndent) {
|
|
427
|
-
({ type, amount } = decodeIndentsKey(keyOfMostUsedIndent));
|
|
428
|
-
indent = makeIndentString(type, amount);
|
|
429
|
-
}
|
|
430
|
-
return {
|
|
431
|
-
amount,
|
|
432
|
-
type,
|
|
433
|
-
indent
|
|
434
|
-
};
|
|
435
|
-
}
|
|
436
|
-
var picocolors = __webpack_require__("../../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
437
|
-
var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
|
|
438
|
-
const version_require = createRequire(import.meta.url);
|
|
439
|
-
const version_pkg = version_require('../package.json');
|
|
440
|
-
const version_version = version_pkg.version;
|
|
441
|
-
const devDependencies = version_pkg.devDependencies;
|
|
442
|
-
const LYNX_RSPEEDY = '@lynx-js/rspeedy';
|
|
443
|
-
async function install(cwd) {
|
|
444
|
-
const packageJSONPath = external_node_path_["default"].resolve(cwd, 'package.json');
|
|
445
|
-
if (!external_node_fs_["default"].existsSync(packageJSONPath)) {
|
|
446
|
-
const message = `${picocolors_default().underline(picocolors_default().yellow(packageJSONPath))} not found. Please run ${picocolors_default().bold('upgrade-rspeedy')} in your Rspeedy project.`;
|
|
447
|
-
src_logger.error(message);
|
|
448
|
-
throw new Error(message);
|
|
449
|
-
}
|
|
450
|
-
try {
|
|
451
|
-
const content = await external_node_fs_["default"].promises.readFile(packageJSONPath, 'utf-8');
|
|
452
|
-
const pkg = JSON.parse(content);
|
|
453
|
-
if (pkg.dependencies?.[LYNX_RSPEEDY] === void 0 && pkg.devDependencies?.[LYNX_RSPEEDY] === void 0) throw new Error(`No ${picocolors_default().yellow(LYNX_RSPEEDY)} found in ${packageJSONPath}.
|
|
454
|
-
|
|
455
|
-
Please run ${picocolors_default().bold('upgrade-rspeedy')} in your Rspeedy project.`);
|
|
456
|
-
const { indent } = detectIndent(content);
|
|
457
|
-
console.info();
|
|
458
|
-
const dependenciesUpdated = updateDependencies(pkg, packageJSONPath, 'dependencies');
|
|
459
|
-
console.info();
|
|
460
|
-
const devDependenciesUpdated = updateDependencies(pkg, packageJSONPath, 'devDependencies');
|
|
461
|
-
console.info();
|
|
462
|
-
if (dependenciesUpdated || devDependenciesUpdated) {
|
|
463
|
-
await external_node_fs_["default"].promises.writeFile(packageJSONPath, JSON.stringify(pkg, null, indent) + EOL, 'utf-8');
|
|
464
|
-
src_logger.success(`${picocolors_default().yellow(packageJSONPath)} has been updated.`);
|
|
465
|
-
src_logger.success("Please install the dependencies with your package manager.");
|
|
466
|
-
}
|
|
467
|
-
} catch (error) {
|
|
468
|
-
src_logger.error(error);
|
|
469
|
-
throw error;
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
function updateDependencies(pkg, packageJSONPath, name) {
|
|
473
|
-
const dependencies = pkg[name];
|
|
474
|
-
if (!dependencies) {
|
|
475
|
-
src_logger.info(`No ${picocolors_default().yellow(name)} is found in ${picocolors_default().underline(packageJSONPath)}`);
|
|
476
|
-
return false;
|
|
477
|
-
}
|
|
478
|
-
const updatedDependencies = findDependencies(dependencies).filter(([, { original, target }])=>original !== target);
|
|
479
|
-
if (0 === updatedDependencies.length) {
|
|
480
|
-
src_logger.info(`No ${picocolors_default().yellow(name)} need to be updated in ${picocolors_default().underline(packageJSONPath)}`);
|
|
481
|
-
return false;
|
|
482
|
-
}
|
|
483
|
-
{
|
|
484
|
-
const sep = '\n - ';
|
|
485
|
-
src_logger.info(`Updated ${picocolors_default().yellow(name)}:\n${sep}${updatedDependencies.map(([name, { original, target }])=>`${picocolors_default().cyan(name)}: ${picocolors_default().dim(original)} -> ${picocolors_default().green(target)}`).join(sep)}`);
|
|
486
|
-
}
|
|
487
|
-
updatedDependencies.forEach(([dependency, { target }])=>{
|
|
488
|
-
dependencies[dependency] = target;
|
|
489
|
-
});
|
|
490
|
-
return true;
|
|
491
|
-
}
|
|
492
|
-
const targetDependencies = new Map(Object.entries(devDependencies ?? {}));
|
|
493
|
-
function findDependencies(dependencies) {
|
|
494
|
-
return Object.entries(dependencies).map(([name, original])=>{
|
|
495
|
-
if (targetDependencies.has(name) && (name.startsWith('@lynx-js/') || name.includes('rsbuild'))) return [
|
|
496
|
-
name,
|
|
497
|
-
{
|
|
498
|
-
original,
|
|
499
|
-
target: targetDependencies.get(name)
|
|
500
|
-
}
|
|
501
|
-
];
|
|
502
|
-
return null;
|
|
503
|
-
}).filter((i)=>null !== i);
|
|
504
|
-
}
|
|
505
|
-
async function main(cwd, argv) {
|
|
506
|
-
const program = new Command('upgrade-rspeedy');
|
|
507
|
-
const { npm_execpath } = process.env;
|
|
508
|
-
if (!npm_execpath || npm_execpath.includes('npm-cli.js') || npm_execpath.includes('npx-cli.js')) console.info();
|
|
509
|
-
src_logger.greet(`Upgrade Rspeedy v${version_version}\n`);
|
|
510
|
-
program.helpCommand(false).description('Upgrade the Rspeedy-related packages').action(()=>install(cwd ?? process.cwd()));
|
|
511
|
-
await program.parseAsync(argv);
|
|
512
|
-
}
|
|
513
|
-
},
|
|
514
|
-
"node:child_process" (module) {
|
|
515
|
-
module.exports = __rspack_external_node_child_process_27f17141;
|
|
516
|
-
},
|
|
517
|
-
"node:events" (module) {
|
|
518
|
-
module.exports = __rspack_external_node_events_0a6aefe7;
|
|
519
|
-
},
|
|
520
|
-
"node:fs" (module) {
|
|
521
|
-
module.exports = __rspack_external_node_fs_5ea92f0c;
|
|
522
|
-
},
|
|
523
|
-
"node:path" (module) {
|
|
524
|
-
module.exports = __rspack_external_node_path_c5b9b54f;
|
|
525
|
-
},
|
|
526
|
-
"node:process" (module) {
|
|
527
|
-
module.exports = __rspack_external_node_process_786449bf;
|
|
528
|
-
},
|
|
529
|
-
"../../../node_modules/.pnpm/commander@13.1.0/node_modules/commander/index.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
530
|
-
const { Argument } = __webpack_require__("../../../node_modules/.pnpm/commander@13.1.0/node_modules/commander/lib/argument.js");
|
|
531
|
-
const { Command } = __webpack_require__("../../../node_modules/.pnpm/commander@13.1.0/node_modules/commander/lib/command.js");
|
|
532
|
-
const { CommanderError, InvalidArgumentError } = __webpack_require__("../../../node_modules/.pnpm/commander@13.1.0/node_modules/commander/lib/error.js");
|
|
533
|
-
const { Help } = __webpack_require__("../../../node_modules/.pnpm/commander@13.1.0/node_modules/commander/lib/help.js");
|
|
534
|
-
const { Option } = __webpack_require__("../../../node_modules/.pnpm/commander@13.1.0/node_modules/commander/lib/option.js");
|
|
535
|
-
exports.program = new Command();
|
|
536
|
-
exports.createCommand = (name)=>new Command(name);
|
|
537
|
-
exports.createOption = (flags, description)=>new Option(flags, description);
|
|
538
|
-
exports.createArgument = (name, description)=>new Argument(name, description);
|
|
539
|
-
exports.Command = Command;
|
|
540
|
-
exports.Option = Option;
|
|
541
|
-
exports.Argument = Argument;
|
|
542
|
-
exports.Help = Help;
|
|
543
|
-
exports.CommanderError = CommanderError;
|
|
544
|
-
exports.InvalidArgumentError = InvalidArgumentError;
|
|
545
|
-
exports.InvalidOptionArgumentError = InvalidArgumentError;
|
|
546
|
-
},
|
|
547
|
-
"../../../node_modules/.pnpm/commander@13.1.0/node_modules/commander/lib/argument.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
548
|
-
const { InvalidArgumentError } = __webpack_require__("../../../node_modules/.pnpm/commander@13.1.0/node_modules/commander/lib/error.js");
|
|
549
|
-
class Argument {
|
|
550
|
-
constructor(name, description){
|
|
551
|
-
this.description = description || '';
|
|
552
|
-
this.variadic = false;
|
|
553
|
-
this.parseArg = void 0;
|
|
554
|
-
this.defaultValue = void 0;
|
|
555
|
-
this.defaultValueDescription = void 0;
|
|
556
|
-
this.argChoices = void 0;
|
|
557
|
-
switch(name[0]){
|
|
558
|
-
case '<':
|
|
559
|
-
this.required = true;
|
|
560
|
-
this._name = name.slice(1, -1);
|
|
561
|
-
break;
|
|
562
|
-
case '[':
|
|
563
|
-
this.required = false;
|
|
564
|
-
this._name = name.slice(1, -1);
|
|
565
|
-
break;
|
|
566
|
-
default:
|
|
567
|
-
this.required = true;
|
|
568
|
-
this._name = name;
|
|
569
|
-
break;
|
|
570
|
-
}
|
|
571
|
-
if (this._name.length > 3 && '...' === this._name.slice(-3)) {
|
|
572
|
-
this.variadic = true;
|
|
573
|
-
this._name = this._name.slice(0, -3);
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
name() {
|
|
577
|
-
return this._name;
|
|
578
|
-
}
|
|
579
|
-
_concatValue(value, previous) {
|
|
580
|
-
if (previous === this.defaultValue || !Array.isArray(previous)) return [
|
|
581
|
-
value
|
|
582
|
-
];
|
|
583
|
-
return previous.concat(value);
|
|
584
|
-
}
|
|
585
|
-
default(value, description) {
|
|
586
|
-
this.defaultValue = value;
|
|
587
|
-
this.defaultValueDescription = description;
|
|
588
|
-
return this;
|
|
589
|
-
}
|
|
590
|
-
argParser(fn) {
|
|
591
|
-
this.parseArg = fn;
|
|
592
|
-
return this;
|
|
593
|
-
}
|
|
594
|
-
choices(values) {
|
|
595
|
-
this.argChoices = values.slice();
|
|
596
|
-
this.parseArg = (arg, previous)=>{
|
|
597
|
-
if (!this.argChoices.includes(arg)) throw new InvalidArgumentError(`Allowed choices are ${this.argChoices.join(', ')}.`);
|
|
598
|
-
if (this.variadic) return this._concatValue(arg, previous);
|
|
599
|
-
return arg;
|
|
600
|
-
};
|
|
601
|
-
return this;
|
|
602
|
-
}
|
|
603
|
-
argRequired() {
|
|
604
|
-
this.required = true;
|
|
605
|
-
return this;
|
|
606
|
-
}
|
|
607
|
-
argOptional() {
|
|
608
|
-
this.required = false;
|
|
609
|
-
return this;
|
|
610
|
-
}
|
|
611
|
-
}
|
|
612
|
-
function humanReadableArgName(arg) {
|
|
613
|
-
const nameOutput = arg.name() + (true === arg.variadic ? '...' : '');
|
|
614
|
-
return arg.required ? '<' + nameOutput + '>' : '[' + nameOutput + ']';
|
|
301
|
+
function humanReadableArgName(arg) {
|
|
302
|
+
const nameOutput = arg.name() + (true === arg.variadic ? '...' : '');
|
|
303
|
+
return arg.required ? '<' + nameOutput + '>' : '[' + nameOutput + ']';
|
|
615
304
|
}
|
|
616
305
|
exports.Argument = Argument;
|
|
617
306
|
exports.humanReadableArgName = humanReadableArgName;
|
|
@@ -2191,208 +1880,436 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2191
1880
|
shortFlag = longFlag;
|
|
2192
1881
|
longFlag = flagParts.shift();
|
|
2193
1882
|
}
|
|
2194
|
-
if (flagParts[0].startsWith('-')) {
|
|
2195
|
-
const unsupportedFlag = flagParts[0];
|
|
2196
|
-
const baseError = `option creation failed due to '${unsupportedFlag}' in option flags '${flags}'`;
|
|
2197
|
-
if (/^-[^-][^-]/.test(unsupportedFlag)) throw new Error(`${baseError}
|
|
2198
|
-
- a short flag is a single dash and a single character
|
|
2199
|
-
- either use a single dash and a single character (for a short flag)
|
|
2200
|
-
- or use a double dash for a long option (and can have two, like '--ws, --workspace')`);
|
|
2201
|
-
if (shortFlagExp.test(unsupportedFlag)) throw new Error(`${baseError}
|
|
2202
|
-
- too many short flags`);
|
|
2203
|
-
if (longFlagExp.test(unsupportedFlag)) throw new Error(`${baseError}
|
|
2204
|
-
- too many long flags`);
|
|
2205
|
-
throw new Error(`${baseError}
|
|
2206
|
-
- unrecognised flag format`);
|
|
1883
|
+
if (flagParts[0].startsWith('-')) {
|
|
1884
|
+
const unsupportedFlag = flagParts[0];
|
|
1885
|
+
const baseError = `option creation failed due to '${unsupportedFlag}' in option flags '${flags}'`;
|
|
1886
|
+
if (/^-[^-][^-]/.test(unsupportedFlag)) throw new Error(`${baseError}
|
|
1887
|
+
- a short flag is a single dash and a single character
|
|
1888
|
+
- either use a single dash and a single character (for a short flag)
|
|
1889
|
+
- or use a double dash for a long option (and can have two, like '--ws, --workspace')`);
|
|
1890
|
+
if (shortFlagExp.test(unsupportedFlag)) throw new Error(`${baseError}
|
|
1891
|
+
- too many short flags`);
|
|
1892
|
+
if (longFlagExp.test(unsupportedFlag)) throw new Error(`${baseError}
|
|
1893
|
+
- too many long flags`);
|
|
1894
|
+
throw new Error(`${baseError}
|
|
1895
|
+
- unrecognised flag format`);
|
|
1896
|
+
}
|
|
1897
|
+
if (void 0 === shortFlag && void 0 === longFlag) throw new Error(`option creation failed due to no flags found in '${flags}'.`);
|
|
1898
|
+
return {
|
|
1899
|
+
shortFlag,
|
|
1900
|
+
longFlag
|
|
1901
|
+
};
|
|
1902
|
+
}
|
|
1903
|
+
exports.Option = Option;
|
|
1904
|
+
exports.DualOptions = DualOptions;
|
|
1905
|
+
},
|
|
1906
|
+
"../../../node_modules/.pnpm/commander@13.1.0/node_modules/commander/lib/suggestSimilar.js" (__unused_rspack_module, exports) {
|
|
1907
|
+
const maxDistance = 3;
|
|
1908
|
+
function editDistance(a, b) {
|
|
1909
|
+
if (Math.abs(a.length - b.length) > maxDistance) return Math.max(a.length, b.length);
|
|
1910
|
+
const d = [];
|
|
1911
|
+
for(let i = 0; i <= a.length; i++)d[i] = [
|
|
1912
|
+
i
|
|
1913
|
+
];
|
|
1914
|
+
for(let j = 0; j <= b.length; j++)d[0][j] = j;
|
|
1915
|
+
for(let j = 1; j <= b.length; j++)for(let i = 1; i <= a.length; i++){
|
|
1916
|
+
let cost = 1;
|
|
1917
|
+
cost = a[i - 1] === b[j - 1] ? 0 : 1;
|
|
1918
|
+
d[i][j] = Math.min(d[i - 1][j] + 1, d[i][j - 1] + 1, d[i - 1][j - 1] + cost);
|
|
1919
|
+
if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) d[i][j] = Math.min(d[i][j], d[i - 2][j - 2] + 1);
|
|
1920
|
+
}
|
|
1921
|
+
return d[a.length][b.length];
|
|
1922
|
+
}
|
|
1923
|
+
function suggestSimilar(word, candidates) {
|
|
1924
|
+
if (!candidates || 0 === candidates.length) return '';
|
|
1925
|
+
candidates = Array.from(new Set(candidates));
|
|
1926
|
+
const searchingOptions = word.startsWith('--');
|
|
1927
|
+
if (searchingOptions) {
|
|
1928
|
+
word = word.slice(2);
|
|
1929
|
+
candidates = candidates.map((candidate)=>candidate.slice(2));
|
|
1930
|
+
}
|
|
1931
|
+
let similar = [];
|
|
1932
|
+
let bestDistance = maxDistance;
|
|
1933
|
+
const minSimilarity = 0.4;
|
|
1934
|
+
candidates.forEach((candidate)=>{
|
|
1935
|
+
if (candidate.length <= 1) return;
|
|
1936
|
+
const distance = editDistance(word, candidate);
|
|
1937
|
+
const length = Math.max(word.length, candidate.length);
|
|
1938
|
+
const similarity = (length - distance) / length;
|
|
1939
|
+
if (similarity > minSimilarity) {
|
|
1940
|
+
if (distance < bestDistance) {
|
|
1941
|
+
bestDistance = distance;
|
|
1942
|
+
similar = [
|
|
1943
|
+
candidate
|
|
1944
|
+
];
|
|
1945
|
+
} else if (distance === bestDistance) similar.push(candidate);
|
|
1946
|
+
}
|
|
1947
|
+
});
|
|
1948
|
+
similar.sort((a, b)=>a.localeCompare(b));
|
|
1949
|
+
if (searchingOptions) similar = similar.map((candidate)=>`--${candidate}`);
|
|
1950
|
+
if (similar.length > 1) return `\n(Did you mean one of ${similar.join(', ')}?)`;
|
|
1951
|
+
if (1 === similar.length) return `\n(Did you mean ${similar[0]}?)`;
|
|
1952
|
+
return '';
|
|
1953
|
+
}
|
|
1954
|
+
exports.suggestSimilar = suggestSimilar;
|
|
1955
|
+
},
|
|
1956
|
+
"../../../node_modules/.pnpm/commander@13.1.0/node_modules/commander/esm.mjs" (__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
1957
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
1958
|
+
uB: ()=>Command
|
|
1959
|
+
});
|
|
1960
|
+
var _index_js__rspack_import_0 = __webpack_require__("../../../node_modules/.pnpm/commander@13.1.0/node_modules/commander/index.js");
|
|
1961
|
+
const { program, createCommand, createArgument, createOption, CommanderError, InvalidArgumentError, InvalidOptionArgumentError, Command, Argument, Option, Help } = _index_js__rspack_import_0;
|
|
1962
|
+
},
|
|
1963
|
+
"../../../node_modules/.pnpm/detect-indent@7.0.2/node_modules/detect-indent/index.js" (__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
1964
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
1965
|
+
A: ()=>detectIndent
|
|
1966
|
+
});
|
|
1967
|
+
const INDENT_REGEX = /^(?:( )+|\t+)/;
|
|
1968
|
+
const INDENT_TYPE_SPACE = 'space';
|
|
1969
|
+
const INDENT_TYPE_TAB = 'tab';
|
|
1970
|
+
function shouldIgnoreSingleSpace(ignoreSingleSpaces, indentType, value) {
|
|
1971
|
+
return ignoreSingleSpaces && indentType === INDENT_TYPE_SPACE && 1 === value;
|
|
1972
|
+
}
|
|
1973
|
+
function makeIndentsMap(string, ignoreSingleSpaces) {
|
|
1974
|
+
const indents = new Map();
|
|
1975
|
+
let previousSize = 0;
|
|
1976
|
+
let previousIndentType;
|
|
1977
|
+
let key;
|
|
1978
|
+
for (const line of string.split(/\n/g)){
|
|
1979
|
+
if (!line) continue;
|
|
1980
|
+
const matches = line.match(INDENT_REGEX);
|
|
1981
|
+
if (null === matches) {
|
|
1982
|
+
previousSize = 0;
|
|
1983
|
+
previousIndentType = '';
|
|
1984
|
+
} else {
|
|
1985
|
+
const indent = matches[0].length;
|
|
1986
|
+
const indentType = matches[1] ? INDENT_TYPE_SPACE : INDENT_TYPE_TAB;
|
|
1987
|
+
if (shouldIgnoreSingleSpace(ignoreSingleSpaces, indentType, indent)) continue;
|
|
1988
|
+
if (indentType !== previousIndentType) previousSize = 0;
|
|
1989
|
+
previousIndentType = indentType;
|
|
1990
|
+
let use = 1;
|
|
1991
|
+
let weight = 0;
|
|
1992
|
+
const indentDifference = indent - previousSize;
|
|
1993
|
+
previousSize = indent;
|
|
1994
|
+
if (0 === indentDifference) {
|
|
1995
|
+
use = 0;
|
|
1996
|
+
weight = 1;
|
|
1997
|
+
} else {
|
|
1998
|
+
const absoluteIndentDifference = Math.abs(indentDifference);
|
|
1999
|
+
if (shouldIgnoreSingleSpace(ignoreSingleSpaces, indentType, absoluteIndentDifference)) continue;
|
|
2000
|
+
key = encodeIndentsKey(indentType, absoluteIndentDifference);
|
|
2001
|
+
}
|
|
2002
|
+
const entry = indents.get(key);
|
|
2003
|
+
indents.set(key, void 0 === entry ? [
|
|
2004
|
+
1,
|
|
2005
|
+
0
|
|
2006
|
+
] : [
|
|
2007
|
+
entry[0] + use,
|
|
2008
|
+
entry[1] + weight
|
|
2009
|
+
]);
|
|
2010
|
+
}
|
|
2011
|
+
}
|
|
2012
|
+
return indents;
|
|
2013
|
+
}
|
|
2014
|
+
function encodeIndentsKey(indentType, indentAmount) {
|
|
2015
|
+
const typeCharacter = indentType === INDENT_TYPE_SPACE ? 's' : 't';
|
|
2016
|
+
return typeCharacter + String(indentAmount);
|
|
2017
|
+
}
|
|
2018
|
+
function decodeIndentsKey(indentsKey) {
|
|
2019
|
+
const keyHasTypeSpace = 's' === indentsKey[0];
|
|
2020
|
+
const type = keyHasTypeSpace ? INDENT_TYPE_SPACE : INDENT_TYPE_TAB;
|
|
2021
|
+
const amount = Number(indentsKey.slice(1));
|
|
2022
|
+
return {
|
|
2023
|
+
type,
|
|
2024
|
+
amount
|
|
2025
|
+
};
|
|
2026
|
+
}
|
|
2027
|
+
function getMostUsedKey(indents) {
|
|
2028
|
+
let result;
|
|
2029
|
+
let maxUsed = 0;
|
|
2030
|
+
let maxWeight = 0;
|
|
2031
|
+
for (const [key, [usedCount, weight]] of indents)if (usedCount > maxUsed || usedCount === maxUsed && weight > maxWeight) {
|
|
2032
|
+
maxUsed = usedCount;
|
|
2033
|
+
maxWeight = weight;
|
|
2034
|
+
result = key;
|
|
2035
|
+
}
|
|
2036
|
+
return result;
|
|
2037
|
+
}
|
|
2038
|
+
function makeIndentString(type, amount) {
|
|
2039
|
+
const indentCharacter = type === INDENT_TYPE_SPACE ? ' ' : '\t';
|
|
2040
|
+
return indentCharacter.repeat(amount);
|
|
2041
|
+
}
|
|
2042
|
+
function detectIndent(string) {
|
|
2043
|
+
if ('string' != typeof string) throw new TypeError('Expected a string');
|
|
2044
|
+
let indents = makeIndentsMap(string, true);
|
|
2045
|
+
if (0 === indents.size) indents = makeIndentsMap(string, false);
|
|
2046
|
+
const keyOfMostUsedIndent = getMostUsedKey(indents);
|
|
2047
|
+
let type;
|
|
2048
|
+
let amount = 0;
|
|
2049
|
+
let indent = '';
|
|
2050
|
+
if (void 0 !== keyOfMostUsedIndent) {
|
|
2051
|
+
({ type, amount } = decodeIndentsKey(keyOfMostUsedIndent));
|
|
2052
|
+
indent = makeIndentString(type, amount);
|
|
2053
|
+
}
|
|
2054
|
+
return {
|
|
2055
|
+
amount,
|
|
2056
|
+
type,
|
|
2057
|
+
indent
|
|
2058
|
+
};
|
|
2059
|
+
}
|
|
2060
|
+
},
|
|
2061
|
+
"../../../node_modules/.pnpm/rslog@1.2.11/node_modules/rslog/dist/index.js" (__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
2062
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
2063
|
+
v: ()=>src_logger
|
|
2064
|
+
});
|
|
2065
|
+
var node_process__rspack_import_0 = __webpack_require__("node:process");
|
|
2066
|
+
var node_os__rspack_import_1 = __webpack_require__("node:os");
|
|
2067
|
+
var node_tty__rspack_import_2 = __webpack_require__("node:tty");
|
|
2068
|
+
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : node_process__rspack_import_0["default"].argv) {
|
|
2069
|
+
const prefix = flag.startsWith('-') ? '' : 1 === flag.length ? '-' : '--';
|
|
2070
|
+
const position = argv.indexOf(prefix + flag);
|
|
2071
|
+
const terminatorPosition = argv.indexOf('--');
|
|
2072
|
+
return -1 !== position && (-1 === terminatorPosition || position < terminatorPosition);
|
|
2073
|
+
}
|
|
2074
|
+
const { env } = node_process__rspack_import_0["default"];
|
|
2075
|
+
let flagForceColor;
|
|
2076
|
+
if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false') || hasFlag('color=never')) flagForceColor = 0;
|
|
2077
|
+
else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') || hasFlag('color=always')) flagForceColor = 1;
|
|
2078
|
+
function envForceColor() {
|
|
2079
|
+
if (!('FORCE_COLOR' in env)) return;
|
|
2080
|
+
if ('true' === env.FORCE_COLOR) return 1;
|
|
2081
|
+
if ('false' === env.FORCE_COLOR) return 0;
|
|
2082
|
+
if (0 === env.FORCE_COLOR.length) return 1;
|
|
2083
|
+
const level = Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
2084
|
+
if (![
|
|
2085
|
+
0,
|
|
2086
|
+
1,
|
|
2087
|
+
2,
|
|
2088
|
+
3
|
|
2089
|
+
].includes(level)) return;
|
|
2090
|
+
return level;
|
|
2091
|
+
}
|
|
2092
|
+
function translateLevel(level) {
|
|
2093
|
+
if (0 === level) return false;
|
|
2094
|
+
return {
|
|
2095
|
+
level,
|
|
2096
|
+
hasBasic: true,
|
|
2097
|
+
has256: level >= 2,
|
|
2098
|
+
has16m: level >= 3
|
|
2099
|
+
};
|
|
2100
|
+
}
|
|
2101
|
+
function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
2102
|
+
const noFlagForceColor = envForceColor();
|
|
2103
|
+
if (void 0 !== noFlagForceColor) flagForceColor = noFlagForceColor;
|
|
2104
|
+
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
2105
|
+
if (0 === forceColor) return 0;
|
|
2106
|
+
if (sniffFlags) {
|
|
2107
|
+
if (hasFlag('color=16m') || hasFlag('color=full') || hasFlag('color=truecolor')) return 3;
|
|
2108
|
+
if (hasFlag('color=256')) return 2;
|
|
2109
|
+
}
|
|
2110
|
+
if ('TF_BUILD' in env && 'AGENT_NAME' in env) return 1;
|
|
2111
|
+
if (haveStream && !streamIsTTY && void 0 === forceColor) return 0;
|
|
2112
|
+
const min = forceColor || 0;
|
|
2113
|
+
if ('dumb' === env.TERM) return min;
|
|
2114
|
+
if ('win32' === node_process__rspack_import_0["default"].platform) {
|
|
2115
|
+
const osRelease = node_os__rspack_import_1["default"].release().split('.');
|
|
2116
|
+
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
2117
|
+
return 1;
|
|
2118
|
+
}
|
|
2119
|
+
if ('CI' in env) {
|
|
2120
|
+
if ([
|
|
2121
|
+
'GITHUB_ACTIONS',
|
|
2122
|
+
'GITEA_ACTIONS',
|
|
2123
|
+
'CIRCLECI'
|
|
2124
|
+
].some((key)=>key in env)) return 3;
|
|
2125
|
+
if ([
|
|
2126
|
+
'TRAVIS',
|
|
2127
|
+
'APPVEYOR',
|
|
2128
|
+
'GITLAB_CI',
|
|
2129
|
+
'BUILDKITE',
|
|
2130
|
+
'DRONE'
|
|
2131
|
+
].some((sign)=>sign in env) || 'codeship' === env.CI_NAME) return 1;
|
|
2132
|
+
return min;
|
|
2133
|
+
}
|
|
2134
|
+
if ('TEAMCITY_VERSION' in env) return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
2135
|
+
if ('truecolor' === env.COLORTERM) return 3;
|
|
2136
|
+
if ('xterm-kitty' === env.TERM) return 3;
|
|
2137
|
+
if ('xterm-ghostty' === env.TERM) return 3;
|
|
2138
|
+
if ('TERM_PROGRAM' in env) {
|
|
2139
|
+
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
|
|
2140
|
+
switch(env.TERM_PROGRAM){
|
|
2141
|
+
case 'iTerm.app':
|
|
2142
|
+
return version >= 3 ? 3 : 2;
|
|
2143
|
+
case 'Apple_Terminal':
|
|
2144
|
+
return 2;
|
|
2145
|
+
}
|
|
2207
2146
|
}
|
|
2208
|
-
if (
|
|
2209
|
-
return
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
};
|
|
2147
|
+
if (/-256(color)?$/i.test(env.TERM)) return 2;
|
|
2148
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) return 1;
|
|
2149
|
+
if ('COLORTERM' in env) return 1;
|
|
2150
|
+
return min;
|
|
2213
2151
|
}
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2152
|
+
function createSupportsColor(stream, options = {}) {
|
|
2153
|
+
const level = _supportsColor(stream, {
|
|
2154
|
+
streamIsTTY: stream && stream.isTTY,
|
|
2155
|
+
...options
|
|
2156
|
+
});
|
|
2157
|
+
return translateLevel(level);
|
|
2158
|
+
}
|
|
2159
|
+
const supportsColor = {
|
|
2160
|
+
stdout: createSupportsColor({
|
|
2161
|
+
isTTY: node_tty__rspack_import_2["default"].isatty(1)
|
|
2162
|
+
}),
|
|
2163
|
+
stderr: createSupportsColor({
|
|
2164
|
+
isTTY: node_tty__rspack_import_2["default"].isatty(2)
|
|
2165
|
+
})
|
|
2166
|
+
};
|
|
2167
|
+
const supports_color = supportsColor;
|
|
2168
|
+
const colorLevel = supports_color.stdout ? supports_color.stdout.level : 0;
|
|
2169
|
+
let errorStackRegExp = /at\s.*:\d+:\d+[\s\)]*$/;
|
|
2170
|
+
let anonymousErrorStackRegExp = /at\s.*\(<anonymous>\)$/;
|
|
2171
|
+
let isErrorStackMessage = (message)=>errorStackRegExp.test(message) || anonymousErrorStackRegExp.test(message);
|
|
2172
|
+
let formatter = (open, close, replace = open)=>colorLevel >= 2 ? (input)=>{
|
|
2173
|
+
let string = '' + input;
|
|
2174
|
+
let index = string.indexOf(close, open.length);
|
|
2175
|
+
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
2176
|
+
} : String;
|
|
2177
|
+
let replaceClose = (string, close, replace, index)=>{
|
|
2178
|
+
let start = string.substring(0, index) + replace;
|
|
2179
|
+
let end = string.substring(index + close.length);
|
|
2180
|
+
let nextIndex = end.indexOf(close);
|
|
2181
|
+
return ~nextIndex ? start + replaceClose(end, close, replace, nextIndex) : start + end;
|
|
2182
|
+
};
|
|
2183
|
+
const bold = formatter('\x1b[1m', '\x1b[22m', '\x1b[22m\x1b[1m');
|
|
2184
|
+
const red = formatter('\x1b[31m', '\x1b[39m');
|
|
2185
|
+
const green = formatter('\x1b[32m', '\x1b[39m');
|
|
2186
|
+
const yellow = formatter('\x1b[33m', '\x1b[39m');
|
|
2187
|
+
const magenta = formatter('\x1b[35m', '\x1b[39m');
|
|
2188
|
+
const cyan = formatter('\x1b[36m', '\x1b[39m');
|
|
2189
|
+
const gray = formatter('\x1b[90m', '\x1b[39m');
|
|
2190
|
+
let startColor = [
|
|
2191
|
+
189,
|
|
2192
|
+
255,
|
|
2193
|
+
243
|
|
2194
|
+
];
|
|
2195
|
+
let endColor = [
|
|
2196
|
+
74,
|
|
2197
|
+
194,
|
|
2198
|
+
154
|
|
2199
|
+
];
|
|
2200
|
+
let isWord = (char)=>!/[\s\n]/.test(char);
|
|
2201
|
+
let gradient = (message)=>{
|
|
2202
|
+
if (colorLevel < 3) return 2 === colorLevel ? bold(cyan(message)) : message;
|
|
2203
|
+
let chars = [
|
|
2204
|
+
...message
|
|
2224
2205
|
];
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2206
|
+
let steps = chars.filter(isWord).length;
|
|
2207
|
+
let r = startColor[0];
|
|
2208
|
+
let g = startColor[1];
|
|
2209
|
+
let b = startColor[2];
|
|
2210
|
+
let rStep = (endColor[0] - r) / steps;
|
|
2211
|
+
let gStep = (endColor[1] - g) / steps;
|
|
2212
|
+
let bStep = (endColor[2] - b) / steps;
|
|
2213
|
+
let output = '';
|
|
2214
|
+
for (let char of chars){
|
|
2215
|
+
if (isWord(char)) {
|
|
2216
|
+
r += rStep;
|
|
2217
|
+
g += gStep;
|
|
2218
|
+
b += bStep;
|
|
2219
|
+
}
|
|
2220
|
+
output += `\x1b[38;2;${Math.round(r)};${Math.round(g)};${Math.round(b)}m${char}\x1b[39m`;
|
|
2231
2221
|
}
|
|
2232
|
-
return
|
|
2233
|
-
}
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2222
|
+
return bold(output);
|
|
2223
|
+
};
|
|
2224
|
+
let LOG_LEVEL = {
|
|
2225
|
+
silent: -1,
|
|
2226
|
+
error: 0,
|
|
2227
|
+
warn: 1,
|
|
2228
|
+
info: 2,
|
|
2229
|
+
log: 2,
|
|
2230
|
+
verbose: 3
|
|
2231
|
+
};
|
|
2232
|
+
let LOG_TYPES = {
|
|
2233
|
+
error: {
|
|
2234
|
+
label: 'error',
|
|
2235
|
+
level: 'error',
|
|
2236
|
+
color: red
|
|
2237
|
+
},
|
|
2238
|
+
warn: {
|
|
2239
|
+
label: 'warn',
|
|
2240
|
+
level: 'warn',
|
|
2241
|
+
color: yellow
|
|
2242
|
+
},
|
|
2243
|
+
info: {
|
|
2244
|
+
label: 'info',
|
|
2245
|
+
level: 'info',
|
|
2246
|
+
color: cyan
|
|
2247
|
+
},
|
|
2248
|
+
start: {
|
|
2249
|
+
label: 'start',
|
|
2250
|
+
level: 'info',
|
|
2251
|
+
color: cyan
|
|
2252
|
+
},
|
|
2253
|
+
ready: {
|
|
2254
|
+
label: 'ready',
|
|
2255
|
+
level: 'info',
|
|
2256
|
+
color: green
|
|
2257
|
+
},
|
|
2258
|
+
success: {
|
|
2259
|
+
label: 'success',
|
|
2260
|
+
level: 'info',
|
|
2261
|
+
color: green
|
|
2262
|
+
},
|
|
2263
|
+
log: {
|
|
2264
|
+
level: 'info'
|
|
2265
|
+
},
|
|
2266
|
+
debug: {
|
|
2267
|
+
label: 'debug',
|
|
2268
|
+
level: 'verbose',
|
|
2269
|
+
color: magenta
|
|
2241
2270
|
}
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
if (
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
candidate
|
|
2255
|
-
];
|
|
2256
|
-
} else if (distance === bestDistance) similar.push(candidate);
|
|
2271
|
+
};
|
|
2272
|
+
let createLogger = (options = {})=>{
|
|
2273
|
+
let maxLevel = options.level || 'info';
|
|
2274
|
+
let log = (type, message, ...args)=>{
|
|
2275
|
+
if (LOG_LEVEL[LOG_TYPES[type].level] > LOG_LEVEL[maxLevel]) return;
|
|
2276
|
+
if (null == message) return console.log();
|
|
2277
|
+
let logType = LOG_TYPES[type];
|
|
2278
|
+
let label = '';
|
|
2279
|
+
let text = '';
|
|
2280
|
+
if ('label' in logType) {
|
|
2281
|
+
label = (logType.label || '').padEnd(7);
|
|
2282
|
+
label = bold(logType.color ? logType.color(label) : label);
|
|
2257
2283
|
}
|
|
2284
|
+
if (message instanceof Error) if (message.stack) {
|
|
2285
|
+
let [name, ...rest] = message.stack.split('\n');
|
|
2286
|
+
if (name.startsWith('Error: ')) name = name.slice(7);
|
|
2287
|
+
text = `${name}\n${gray(rest.join('\n'))}`;
|
|
2288
|
+
} else text = message.message;
|
|
2289
|
+
else if ('error' === logType.level && 'string' == typeof message) {
|
|
2290
|
+
let lines = message.split('\n');
|
|
2291
|
+
text = lines.map((line)=>isErrorStackMessage(line) ? gray(line) : line).join('\n');
|
|
2292
|
+
} else text = `${message}`;
|
|
2293
|
+
console.log(label.length ? `${label} ${text}` : text, ...args);
|
|
2294
|
+
};
|
|
2295
|
+
let logger = {
|
|
2296
|
+
greet: (message)=>log('log', gradient(message))
|
|
2297
|
+
};
|
|
2298
|
+
Object.keys(LOG_TYPES).forEach((key)=>{
|
|
2299
|
+
logger[key] = (...args)=>log(key, ...args);
|
|
2258
2300
|
});
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
return '';
|
|
2264
|
-
}
|
|
2265
|
-
exports.suggestSimilar = suggestSimilar;
|
|
2266
|
-
}
|
|
2267
|
-
};
|
|
2268
|
-
var __webpack_module_cache__ = {};
|
|
2269
|
-
function __webpack_require__(moduleId) {
|
|
2270
|
-
var cachedModule = __webpack_module_cache__[moduleId];
|
|
2271
|
-
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
2272
|
-
var module = __webpack_module_cache__[moduleId] = {
|
|
2273
|
-
exports: {}
|
|
2274
|
-
};
|
|
2275
|
-
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
2276
|
-
return module.exports;
|
|
2277
|
-
}
|
|
2278
|
-
(()=>{
|
|
2279
|
-
var hasSymbol = "function" == typeof Symbol;
|
|
2280
|
-
var rspackQueues = hasSymbol ? Symbol("rspack queues") : "__rspack_queues";
|
|
2281
|
-
var rspackExports = __webpack_require__.aE = hasSymbol ? Symbol("rspack exports") : "__webpack_exports__";
|
|
2282
|
-
var rspackError = hasSymbol ? Symbol("rspack error") : "__rspack_error";
|
|
2283
|
-
var rspackDone = hasSymbol ? Symbol("rspack done") : "__rspack_done";
|
|
2284
|
-
var rspackDefer = __webpack_require__.zS = hasSymbol ? Symbol("rspack defer") : "__rspack_defer";
|
|
2285
|
-
var resolveQueue = (queue)=>{
|
|
2286
|
-
if (queue && queue.d < 1) {
|
|
2287
|
-
queue.d = 1;
|
|
2288
|
-
queue.forEach((fn)=>fn.r--);
|
|
2289
|
-
queue.forEach((fn)=>fn.r-- ? fn.r++ : fn());
|
|
2290
|
-
}
|
|
2291
|
-
};
|
|
2292
|
-
var wrapDeps = (deps)=>deps.map((dep)=>{
|
|
2293
|
-
if (null !== dep && "object" == typeof dep) {
|
|
2294
|
-
if (!dep[rspackQueues] && dep[rspackDefer]) {
|
|
2295
|
-
var asyncDeps = dep[rspackDefer];
|
|
2296
|
-
var hasUnresolvedAsyncSubgraph = asyncDeps.some((id)=>{
|
|
2297
|
-
var cache = __webpack_module_cache__[id];
|
|
2298
|
-
return !cache || false === cache[rspackDone];
|
|
2299
|
-
});
|
|
2300
|
-
if (!hasUnresolvedAsyncSubgraph) return dep;
|
|
2301
|
-
var d = dep;
|
|
2302
|
-
dep = {
|
|
2303
|
-
then (callback) {
|
|
2304
|
-
Promise.all(asyncDeps.map(__webpack_require__)).then(()=>callback(d));
|
|
2305
|
-
}
|
|
2306
|
-
};
|
|
2307
|
-
}
|
|
2308
|
-
if (dep[rspackQueues]) return dep;
|
|
2309
|
-
if (dep.then) {
|
|
2310
|
-
var queue = [];
|
|
2311
|
-
queue.d = 0;
|
|
2312
|
-
dep.then((r)=>{
|
|
2313
|
-
obj[rspackExports] = r;
|
|
2314
|
-
resolveQueue(queue);
|
|
2315
|
-
}, (e)=>{
|
|
2316
|
-
obj[rspackError] = e;
|
|
2317
|
-
resolveQueue(queue);
|
|
2318
|
-
});
|
|
2319
|
-
var obj = {};
|
|
2320
|
-
obj[rspackDefer] = false;
|
|
2321
|
-
obj[rspackQueues] = (fn)=>fn(queue);
|
|
2322
|
-
return obj;
|
|
2301
|
+
Object.defineProperty(logger, 'level', {
|
|
2302
|
+
get: ()=>maxLevel,
|
|
2303
|
+
set (val) {
|
|
2304
|
+
maxLevel = val;
|
|
2323
2305
|
}
|
|
2324
|
-
}
|
|
2325
|
-
var ret = {};
|
|
2326
|
-
ret[rspackQueues] = ()=>{};
|
|
2327
|
-
ret[rspackExports] = dep;
|
|
2328
|
-
return ret;
|
|
2329
|
-
});
|
|
2330
|
-
__webpack_require__.a = (module, body, hasAwait)=>{
|
|
2331
|
-
var queue;
|
|
2332
|
-
hasAwait && ((queue = []).d = -1);
|
|
2333
|
-
var depQueues = new Set();
|
|
2334
|
-
var exports = module.exports;
|
|
2335
|
-
var currentDeps;
|
|
2336
|
-
var outerResolve;
|
|
2337
|
-
var reject;
|
|
2338
|
-
var promise = new Promise((resolve, rej)=>{
|
|
2339
|
-
reject = rej;
|
|
2340
|
-
outerResolve = resolve;
|
|
2341
|
-
});
|
|
2342
|
-
promise[rspackExports] = exports;
|
|
2343
|
-
promise[rspackQueues] = (fn)=>{
|
|
2344
|
-
queue && fn(queue), depQueues.forEach(fn), promise["catch"](()=>{});
|
|
2345
|
-
};
|
|
2346
|
-
module.exports = promise;
|
|
2347
|
-
var handle = (deps)=>{
|
|
2348
|
-
currentDeps = wrapDeps(deps);
|
|
2349
|
-
var fn;
|
|
2350
|
-
var getResult = ()=>currentDeps.map((d)=>{
|
|
2351
|
-
if (d[rspackDefer]) return d;
|
|
2352
|
-
if (d[rspackError]) throw d[rspackError];
|
|
2353
|
-
return d[rspackExports];
|
|
2354
|
-
});
|
|
2355
|
-
var promise = new Promise((resolve)=>{
|
|
2356
|
-
fn = ()=>resolve(getResult);
|
|
2357
|
-
fn.r = 0;
|
|
2358
|
-
var fnQueue = (q)=>q !== queue && !depQueues.has(q) && (depQueues.add(q), q && !q.d && (fn.r++, q.push(fn)));
|
|
2359
|
-
currentDeps.map((dep)=>dep[rspackDefer] || dep[rspackQueues](fnQueue));
|
|
2360
2306
|
});
|
|
2361
|
-
|
|
2307
|
+
logger.override = (customLogger)=>{
|
|
2308
|
+
Object.assign(logger, customLogger);
|
|
2309
|
+
};
|
|
2310
|
+
return logger;
|
|
2362
2311
|
};
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
};
|
|
2367
|
-
})();
|
|
2368
|
-
(()=>{
|
|
2369
|
-
__webpack_require__.n = (module)=>{
|
|
2370
|
-
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
2371
|
-
__webpack_require__.d(getter, {
|
|
2372
|
-
a: getter
|
|
2373
|
-
});
|
|
2374
|
-
return getter;
|
|
2375
|
-
};
|
|
2376
|
-
})();
|
|
2377
|
-
(()=>{
|
|
2378
|
-
__webpack_require__.d = (exports, definition)=>{
|
|
2379
|
-
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, {
|
|
2380
|
-
enumerable: true,
|
|
2381
|
-
get: definition[key]
|
|
2382
|
-
});
|
|
2383
|
-
};
|
|
2384
|
-
})();
|
|
2385
|
-
(()=>{
|
|
2386
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
2387
|
-
})();
|
|
2388
|
-
(()=>{
|
|
2389
|
-
__webpack_require__.r = (exports)=>{
|
|
2390
|
-
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports, Symbol.toStringTag, {
|
|
2391
|
-
value: 'Module'
|
|
2392
|
-
});
|
|
2393
|
-
Object.defineProperty(exports, '__esModule', {
|
|
2394
|
-
value: true
|
|
2395
|
-
});
|
|
2396
|
-
};
|
|
2397
|
-
})();
|
|
2312
|
+
let src_logger = createLogger();
|
|
2313
|
+
}
|
|
2314
|
+
});
|
|
2398
2315
|
__webpack_require__("./src/upgrade-rspeedy.ts");
|