@rolldown/browser 1.0.0-beta.37 → 1.0.0-beta.38
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/dist/cli.d.mts +1 -1
- package/dist/cli.mjs +82 -297
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +3 -3
- package/dist/experimental-index.browser.mjs +74 -30
- package/dist/experimental-index.d.mts +14 -4
- package/dist/experimental-index.mjs +74 -9
- package/dist/filter-index.d.mts +2 -2
- package/dist/index.browser.mjs +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/parallel-plugin-worker.d.mts +1 -1
- package/dist/parallel-plugin-worker.mjs +3 -3
- package/dist/parallel-plugin.d.mts +2 -2
- package/dist/parse-ast-index.d.mts +1 -1
- package/dist/parse-ast-index.mjs +1 -1
- package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
- package/dist/shared/{binding-Cjs27cfu.d.mts → binding-D6vpD1fz.d.mts} +9 -24
- package/dist/shared/{define-config-DzsPS4fI.d.mts → define-config-D-OneP9q.d.mts} +5 -3
- package/dist/shared/{load-config-efyGD8HY.mjs → load-config-BGatf3rT.mjs} +2 -2
- package/dist/shared/{parse-ast-index-C3TkGcEQ.mjs → parse-ast-index-CR2E9ZQS.mjs} +2 -2
- package/dist/shared/{src-kVjGhYdF.mjs → src-E1KQKxjT.mjs} +438 -622
- package/dist/{src-C2GHZXDs.js → src-DE1CLQYz.js} +160 -223
- package/package.json +5 -6
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { augmentCodeLocation, error, logCycleLoading, logDuplicateJsxConfig, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, parseAst } from "./parse-ast-index-
|
|
1
|
+
import { augmentCodeLocation, error, logCycleLoading, logDuplicateJsxConfig, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, parseAst } from "./parse-ast-index-CR2E9ZQS.mjs";
|
|
2
2
|
import { and, arraify, code, exclude, id, include, moduleType, noop, or, unimplemented, unreachable, unsupported } from "./dist-CHTC3-kR.mjs";
|
|
3
|
-
import { Worker } from "node:worker_threads";
|
|
4
|
-
import { BindingAttachDebugInfo, BindingBundler, BindingCallableBuiltinPlugin, BindingChunkModuleOrderBy, BindingJsx, BindingLogLevel, BindingPluginOrder, BindingPropertyReadSideEffects, BindingPropertyWriteSideEffects, BindingWatcher, ParallelJsPluginRegistry, shutdownAsyncRuntime, startAsyncRuntime } from "../rolldown-binding.wasi.
|
|
3
|
+
import { Worker, isMainThread } from "node:worker_threads";
|
|
4
|
+
import { BindingAttachDebugInfo, BindingBundler, BindingCallableBuiltinPlugin, BindingChunkModuleOrderBy, BindingJsx, BindingLogLevel, BindingPluginOrder, BindingPropertyReadSideEffects, BindingPropertyWriteSideEffects, BindingWatcher, ParallelJsPluginRegistry, initTraceSubscriber, shutdownAsyncRuntime, startAsyncRuntime } from "../rolldown-binding.wasi-browser.js";
|
|
5
5
|
import path from "node:path";
|
|
6
|
-
import { fileURLToPath } from "node:url";
|
|
7
6
|
import fsp from "node:fs/promises";
|
|
8
7
|
import os from "node:os";
|
|
9
8
|
|
|
@@ -32,9 +31,219 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
32
31
|
enumerable: true
|
|
33
32
|
}) : target, mod));
|
|
34
33
|
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
|
|
36
|
+
/**
|
|
37
|
+
* This is not the set of all possible signals.
|
|
38
|
+
*
|
|
39
|
+
* It IS, however, the set of all signals that trigger
|
|
40
|
+
* an exit on either Linux or BSD systems. Linux is a
|
|
41
|
+
* superset of the signal names supported on BSD, and
|
|
42
|
+
* the unknown signals just fail to register, so we can
|
|
43
|
+
* catch that easily enough.
|
|
44
|
+
*
|
|
45
|
+
* Windows signals are a different set, since there are
|
|
46
|
+
* signals that terminate Windows processes, but don't
|
|
47
|
+
* terminate (or don't even exist) on Posix systems.
|
|
48
|
+
*
|
|
49
|
+
* Don't bother with SIGKILL. It's uncatchable, which
|
|
50
|
+
* means that we can't fire any callbacks anyway.
|
|
51
|
+
*
|
|
52
|
+
* If a user does happen to register a handler on a non-
|
|
53
|
+
* fatal signal like SIGWINCH or something, and then
|
|
54
|
+
* exit, it'll end up firing `process.emit('exit')`, so
|
|
55
|
+
* the handler will be fired anyway.
|
|
56
|
+
*
|
|
57
|
+
* SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
|
|
58
|
+
* artificially, inherently leave the process in a
|
|
59
|
+
* state from which it is not safe to try and enter JS
|
|
60
|
+
* listeners.
|
|
61
|
+
*/
|
|
62
|
+
const signals = [];
|
|
63
|
+
signals.push("SIGHUP", "SIGINT", "SIGTERM");
|
|
64
|
+
if (process.platform !== "win32") signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
|
|
65
|
+
if (process.platform === "linux") signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
|
|
66
|
+
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
|
|
69
|
+
const processOk = (process$2) => !!process$2 && typeof process$2 === "object" && typeof process$2.removeListener === "function" && typeof process$2.emit === "function" && typeof process$2.reallyExit === "function" && typeof process$2.listeners === "function" && typeof process$2.kill === "function" && typeof process$2.pid === "number" && typeof process$2.on === "function";
|
|
70
|
+
const kExitEmitter = Symbol.for("signal-exit emitter");
|
|
71
|
+
const global = globalThis;
|
|
72
|
+
const ObjectDefineProperty = Object.defineProperty.bind(Object);
|
|
73
|
+
var Emitter = class {
|
|
74
|
+
emitted = {
|
|
75
|
+
afterExit: false,
|
|
76
|
+
exit: false
|
|
77
|
+
};
|
|
78
|
+
listeners = {
|
|
79
|
+
afterExit: [],
|
|
80
|
+
exit: []
|
|
81
|
+
};
|
|
82
|
+
count = 0;
|
|
83
|
+
id = Math.random();
|
|
84
|
+
constructor() {
|
|
85
|
+
if (global[kExitEmitter]) return global[kExitEmitter];
|
|
86
|
+
ObjectDefineProperty(global, kExitEmitter, {
|
|
87
|
+
value: this,
|
|
88
|
+
writable: false,
|
|
89
|
+
enumerable: false,
|
|
90
|
+
configurable: false
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
on(ev, fn) {
|
|
94
|
+
this.listeners[ev].push(fn);
|
|
95
|
+
}
|
|
96
|
+
removeListener(ev, fn) {
|
|
97
|
+
const list = this.listeners[ev];
|
|
98
|
+
const i$1 = list.indexOf(fn);
|
|
99
|
+
/* c8 ignore start */
|
|
100
|
+
if (i$1 === -1) return;
|
|
101
|
+
/* c8 ignore stop */
|
|
102
|
+
if (i$1 === 0 && list.length === 1) list.length = 0;
|
|
103
|
+
else list.splice(i$1, 1);
|
|
104
|
+
}
|
|
105
|
+
emit(ev, code$1, signal) {
|
|
106
|
+
if (this.emitted[ev]) return false;
|
|
107
|
+
this.emitted[ev] = true;
|
|
108
|
+
let ret = false;
|
|
109
|
+
for (const fn of this.listeners[ev]) ret = fn(code$1, signal) === true || ret;
|
|
110
|
+
if (ev === "exit") ret = this.emit("afterExit", code$1, signal) || ret;
|
|
111
|
+
return ret;
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
var SignalExitBase = class {};
|
|
115
|
+
const signalExitWrap = (handler) => {
|
|
116
|
+
return {
|
|
117
|
+
onExit(cb, opts) {
|
|
118
|
+
return handler.onExit(cb, opts);
|
|
119
|
+
},
|
|
120
|
+
load() {
|
|
121
|
+
return handler.load();
|
|
122
|
+
},
|
|
123
|
+
unload() {
|
|
124
|
+
return handler.unload();
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
var SignalExitFallback = class extends SignalExitBase {
|
|
129
|
+
onExit() {
|
|
130
|
+
return () => {};
|
|
131
|
+
}
|
|
132
|
+
load() {}
|
|
133
|
+
unload() {}
|
|
134
|
+
};
|
|
135
|
+
var SignalExit = class extends SignalExitBase {
|
|
136
|
+
/* c8 ignore start */
|
|
137
|
+
#hupSig = process$1.platform === "win32" ? "SIGINT" : "SIGHUP";
|
|
138
|
+
/* c8 ignore stop */
|
|
139
|
+
#emitter = new Emitter();
|
|
140
|
+
#process;
|
|
141
|
+
#originalProcessEmit;
|
|
142
|
+
#originalProcessReallyExit;
|
|
143
|
+
#sigListeners = {};
|
|
144
|
+
#loaded = false;
|
|
145
|
+
constructor(process$2) {
|
|
146
|
+
super();
|
|
147
|
+
this.#process = process$2;
|
|
148
|
+
this.#sigListeners = {};
|
|
149
|
+
for (const sig of signals) this.#sigListeners[sig] = () => {
|
|
150
|
+
const listeners = this.#process.listeners(sig);
|
|
151
|
+
let { count } = this.#emitter;
|
|
152
|
+
/* c8 ignore start */
|
|
153
|
+
const p$1 = process$2;
|
|
154
|
+
if (typeof p$1.__signal_exit_emitter__ === "object" && typeof p$1.__signal_exit_emitter__.count === "number") count += p$1.__signal_exit_emitter__.count;
|
|
155
|
+
/* c8 ignore stop */
|
|
156
|
+
if (listeners.length === count) {
|
|
157
|
+
this.unload();
|
|
158
|
+
const ret = this.#emitter.emit("exit", null, sig);
|
|
159
|
+
/* c8 ignore start */
|
|
160
|
+
const s$1 = sig === "SIGHUP" ? this.#hupSig : sig;
|
|
161
|
+
if (!ret) process$2.kill(process$2.pid, s$1);
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
this.#originalProcessReallyExit = process$2.reallyExit;
|
|
165
|
+
this.#originalProcessEmit = process$2.emit;
|
|
166
|
+
}
|
|
167
|
+
onExit(cb, opts) {
|
|
168
|
+
/* c8 ignore start */
|
|
169
|
+
if (!processOk(this.#process)) return () => {};
|
|
170
|
+
/* c8 ignore stop */
|
|
171
|
+
if (this.#loaded === false) this.load();
|
|
172
|
+
const ev = opts?.alwaysLast ? "afterExit" : "exit";
|
|
173
|
+
this.#emitter.on(ev, cb);
|
|
174
|
+
return () => {
|
|
175
|
+
this.#emitter.removeListener(ev, cb);
|
|
176
|
+
if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) this.unload();
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
load() {
|
|
180
|
+
if (this.#loaded) return;
|
|
181
|
+
this.#loaded = true;
|
|
182
|
+
this.#emitter.count += 1;
|
|
183
|
+
for (const sig of signals) try {
|
|
184
|
+
const fn = this.#sigListeners[sig];
|
|
185
|
+
if (fn) this.#process.on(sig, fn);
|
|
186
|
+
} catch (_) {}
|
|
187
|
+
this.#process.emit = (ev, ...a$2) => {
|
|
188
|
+
return this.#processEmit(ev, ...a$2);
|
|
189
|
+
};
|
|
190
|
+
this.#process.reallyExit = (code$1) => {
|
|
191
|
+
return this.#processReallyExit(code$1);
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
unload() {
|
|
195
|
+
if (!this.#loaded) return;
|
|
196
|
+
this.#loaded = false;
|
|
197
|
+
signals.forEach((sig) => {
|
|
198
|
+
const listener = this.#sigListeners[sig];
|
|
199
|
+
/* c8 ignore start */
|
|
200
|
+
if (!listener) throw new Error("Listener not defined for signal: " + sig);
|
|
201
|
+
/* c8 ignore stop */
|
|
202
|
+
try {
|
|
203
|
+
this.#process.removeListener(sig, listener);
|
|
204
|
+
} catch (_) {}
|
|
205
|
+
/* c8 ignore stop */
|
|
206
|
+
});
|
|
207
|
+
this.#process.emit = this.#originalProcessEmit;
|
|
208
|
+
this.#process.reallyExit = this.#originalProcessReallyExit;
|
|
209
|
+
this.#emitter.count -= 1;
|
|
210
|
+
}
|
|
211
|
+
#processReallyExit(code$1) {
|
|
212
|
+
/* c8 ignore start */
|
|
213
|
+
if (!processOk(this.#process)) return 0;
|
|
214
|
+
this.#process.exitCode = code$1 || 0;
|
|
215
|
+
/* c8 ignore stop */
|
|
216
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
217
|
+
return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
|
|
218
|
+
}
|
|
219
|
+
#processEmit(ev, ...args$1) {
|
|
220
|
+
const og = this.#originalProcessEmit;
|
|
221
|
+
if (ev === "exit" && processOk(this.#process)) {
|
|
222
|
+
if (typeof args$1[0] === "number") this.#process.exitCode = args$1[0];
|
|
223
|
+
/* c8 ignore start */
|
|
224
|
+
const ret = og.call(this.#process, ev, ...args$1);
|
|
225
|
+
/* c8 ignore start */
|
|
226
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
227
|
+
/* c8 ignore stop */
|
|
228
|
+
return ret;
|
|
229
|
+
} else return og.call(this.#process, ev, ...args$1);
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
const process$1 = globalThis.process;
|
|
233
|
+
const { onExit, load, unload } = signalExitWrap(processOk(process$1) ? new SignalExit(process$1) : new SignalExitFallback());
|
|
234
|
+
|
|
235
|
+
//#endregion
|
|
236
|
+
//#region src/setup.ts
|
|
237
|
+
if (isMainThread) {
|
|
238
|
+
const subscriberGuard = initTraceSubscriber();
|
|
239
|
+
onExit(() => {
|
|
240
|
+
subscriberGuard?.close();
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
|
|
35
244
|
//#endregion
|
|
36
245
|
//#region package.json
|
|
37
|
-
var version = "1.0.0-beta.
|
|
246
|
+
var version = "1.0.0-beta.38";
|
|
38
247
|
var description$1 = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
|
|
39
248
|
|
|
40
249
|
//#endregion
|
|
@@ -190,75 +399,6 @@ function normalizeHook(hook) {
|
|
|
190
399
|
unreachable("Invalid hook type");
|
|
191
400
|
}
|
|
192
401
|
|
|
193
|
-
//#endregion
|
|
194
|
-
//#region src/utils/normalize-string-or-regex.ts
|
|
195
|
-
function normalizedStringOrRegex(pattern) {
|
|
196
|
-
if (!pattern) return;
|
|
197
|
-
if (!isReadonlyArray(pattern)) return [pattern];
|
|
198
|
-
return pattern;
|
|
199
|
-
}
|
|
200
|
-
function isReadonlyArray(input) {
|
|
201
|
-
return Array.isArray(input);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
//#endregion
|
|
205
|
-
//#region src/builtin-plugin/constructors.ts
|
|
206
|
-
function modulePreloadPolyfillPlugin(config) {
|
|
207
|
-
return new BuiltinPlugin("builtin:module-preload-polyfill", config);
|
|
208
|
-
}
|
|
209
|
-
function dynamicImportVarsPlugin(config) {
|
|
210
|
-
if (config) {
|
|
211
|
-
config.include = normalizedStringOrRegex(config.include);
|
|
212
|
-
config.exclude = normalizedStringOrRegex(config.exclude);
|
|
213
|
-
}
|
|
214
|
-
return new BuiltinPlugin("builtin:dynamic-import-vars", config);
|
|
215
|
-
}
|
|
216
|
-
function importGlobPlugin(config) {
|
|
217
|
-
return new BuiltinPlugin("builtin:import-glob", config);
|
|
218
|
-
}
|
|
219
|
-
function reporterPlugin(config) {
|
|
220
|
-
return new BuiltinPlugin("builtin:reporter", config);
|
|
221
|
-
}
|
|
222
|
-
function manifestPlugin(config) {
|
|
223
|
-
return new BuiltinPlugin("builtin:manifest", config);
|
|
224
|
-
}
|
|
225
|
-
function wasmHelperPlugin(config) {
|
|
226
|
-
return new BuiltinPlugin("builtin:wasm-helper", config);
|
|
227
|
-
}
|
|
228
|
-
function wasmFallbackPlugin() {
|
|
229
|
-
const builtinPlugin = new BuiltinPlugin("builtin:wasm-fallback");
|
|
230
|
-
return makeBuiltinPluginCallable(builtinPlugin);
|
|
231
|
-
}
|
|
232
|
-
function loadFallbackPlugin() {
|
|
233
|
-
return new BuiltinPlugin("builtin:load-fallback");
|
|
234
|
-
}
|
|
235
|
-
function jsonPlugin(config) {
|
|
236
|
-
const builtinPlugin = new BuiltinPlugin("builtin:json", config);
|
|
237
|
-
return makeBuiltinPluginCallable(builtinPlugin);
|
|
238
|
-
}
|
|
239
|
-
function buildImportAnalysisPlugin(config) {
|
|
240
|
-
return new BuiltinPlugin("builtin:build-import-analysis", config);
|
|
241
|
-
}
|
|
242
|
-
function viteResolvePlugin(config) {
|
|
243
|
-
const builtinPlugin = new BuiltinPlugin("builtin:vite-resolve", config);
|
|
244
|
-
return makeBuiltinPluginCallable(builtinPlugin);
|
|
245
|
-
}
|
|
246
|
-
function isolatedDeclarationPlugin(config) {
|
|
247
|
-
return new BuiltinPlugin("builtin:isolated-declaration", config);
|
|
248
|
-
}
|
|
249
|
-
function assetPlugin(config) {
|
|
250
|
-
return new BuiltinPlugin("builtin:asset", config);
|
|
251
|
-
}
|
|
252
|
-
function webWorkerPostPlugin() {
|
|
253
|
-
return new BuiltinPlugin("builtin:web-worker-post");
|
|
254
|
-
}
|
|
255
|
-
function oxcRuntimePlugin(config) {
|
|
256
|
-
return new BuiltinPlugin("builtin:oxc-runtime", config);
|
|
257
|
-
}
|
|
258
|
-
function esmExternalRequirePlugin(config) {
|
|
259
|
-
return new BuiltinPlugin("builtin:esm-external-require", config);
|
|
260
|
-
}
|
|
261
|
-
|
|
262
402
|
//#endregion
|
|
263
403
|
//#region src/constants/plugin.ts
|
|
264
404
|
const ENUMERATED_INPUT_PLUGIN_HOOK_NAMES = [
|
|
@@ -357,7 +497,6 @@ function normalizePlugins(plugins, anonymousPrefix) {
|
|
|
357
497
|
}
|
|
358
498
|
const ANONYMOUS_PLUGIN_PREFIX = "at position ";
|
|
359
499
|
const ANONYMOUS_OUTPUT_PLUGIN_PREFIX = "at output position ";
|
|
360
|
-
const BUILTIN_PLUGINS = [oxcRuntimePlugin({ resolveBase: fileURLToPath(import.meta.url) })];
|
|
361
500
|
|
|
362
501
|
//#endregion
|
|
363
502
|
//#region src/plugin/minimal-plugin-context.ts
|
|
@@ -450,16 +589,127 @@ function getSortedPlugins(hookName, plugins) {
|
|
|
450
589
|
];
|
|
451
590
|
}
|
|
452
591
|
|
|
592
|
+
//#endregion
|
|
593
|
+
//#region ../../node_modules/.pnpm/ansis@4.1.0/node_modules/ansis/index.cjs
|
|
594
|
+
var require_ansis = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ansis@4.1.0/node_modules/ansis/index.cjs": ((exports, module) => {
|
|
595
|
+
let e$1, t$2, r, { defineProperty: n$1, setPrototypeOf: l, create: o, keys: s } = Object, i = "", { round: c, max: a$1 } = Math, p = (e$2) => {
|
|
596
|
+
let t$3 = /([a-f\d]{3,6})/i.exec(e$2)?.[1], r$1 = t$3?.length, n$2 = parseInt(6 ^ r$1 ? 3 ^ r$1 ? "0" : t$3[0] + t$3[0] + t$3[1] + t$3[1] + t$3[2] + t$3[2] : t$3, 16);
|
|
597
|
+
return [
|
|
598
|
+
n$2 >> 16 & 255,
|
|
599
|
+
n$2 >> 8 & 255,
|
|
600
|
+
255 & n$2
|
|
601
|
+
];
|
|
602
|
+
}, u = (e$2, t$3, r$1) => e$2 ^ t$3 || t$3 ^ r$1 ? 16 + 36 * c(e$2 / 51) + 6 * c(t$3 / 51) + c(r$1 / 51) : 8 > e$2 ? 16 : e$2 > 248 ? 231 : c(24 * (e$2 - 8) / 247) + 232, d = (e$2) => {
|
|
603
|
+
let t$3, r$1, n$2, l$1, o$1;
|
|
604
|
+
return 8 > e$2 ? 30 + e$2 : 16 > e$2 ? e$2 - 8 + 90 : (232 > e$2 ? (o$1 = (e$2 -= 16) % 36, t$3 = (e$2 / 36 | 0) / 5, r$1 = (o$1 / 6 | 0) / 5, n$2 = o$1 % 6 / 5) : t$3 = r$1 = n$2 = (10 * (e$2 - 232) + 8) / 255, l$1 = 2 * a$1(t$3, r$1, n$2), l$1 ? 30 + (c(n$2) << 2 | c(r$1) << 1 | c(t$3)) + (2 ^ l$1 ? 0 : 60) : 30);
|
|
605
|
+
}, g = (() => {
|
|
606
|
+
let r$1 = (e$2) => o$1.some(((t$3) => e$2.test(t$3))), n$2 = globalThis, l$1 = n$2.process ?? {}, o$1 = l$1.argv ?? [], i$1 = l$1.env ?? {}, c$1 = -1;
|
|
607
|
+
try {
|
|
608
|
+
e$1 = "," + s(i$1).join(",");
|
|
609
|
+
} catch (e$2) {
|
|
610
|
+
i$1 = {}, c$1 = 0;
|
|
611
|
+
}
|
|
612
|
+
let a$2 = "FORCE_COLOR", p$1 = {
|
|
613
|
+
false: 0,
|
|
614
|
+
0: 0,
|
|
615
|
+
1: 1,
|
|
616
|
+
2: 2,
|
|
617
|
+
3: 3
|
|
618
|
+
}[i$1[a$2]] ?? -1, u$1 = a$2 in i$1 && p$1 || r$1(/^--color=?(true|always)?$/);
|
|
619
|
+
return u$1 && (c$1 = p$1), ~c$1 || (c$1 = ((r$2, n$3, l$2) => (t$2 = r$2.TERM, {
|
|
620
|
+
"24bit": 3,
|
|
621
|
+
truecolor: 3,
|
|
622
|
+
ansi256: 2,
|
|
623
|
+
ansi: 1
|
|
624
|
+
}[r$2.COLORTERM] || (r$2.CI ? /,GITHUB/.test(e$1) ? 3 : 1 : n$3 && "dumb" !== t$2 ? l$2 ? 3 : /-256/.test(t$2) ? 2 : 1 : 0)))(i$1, !!i$1.PM2_HOME || i$1.NEXT_RUNTIME?.includes("edge") || !!l$1.stdout?.isTTY, "win32" === l$1.platform)), !p$1 || i$1.NO_COLOR || r$1(/^--(no-color|color=(false|never))$/) ? 0 : n$2.window?.chrome || u$1 && !c$1 ? 3 : c$1;
|
|
625
|
+
})(), f = {
|
|
626
|
+
open: i,
|
|
627
|
+
close: i
|
|
628
|
+
}, h = 39, b = 49, O = {}, m = ({ p: e$2 }, { open: t$3, close: n$2 }) => {
|
|
629
|
+
let o$1 = (e$3, ...r$1) => {
|
|
630
|
+
if (!e$3) {
|
|
631
|
+
if (t$3 && t$3 === n$2) return t$3;
|
|
632
|
+
if ((e$3 ?? i) === i) return i;
|
|
633
|
+
}
|
|
634
|
+
let l$1, s$2 = e$3.raw ? String.raw({ raw: e$3 }, ...r$1) : i + e$3, c$2 = o$1.p, a$2 = c$2.o, p$1 = c$2.c;
|
|
635
|
+
if (s$2.includes("\x1B")) for (; c$2; c$2 = c$2.p) {
|
|
636
|
+
let { open: e$4, close: t$4 } = c$2, r$2 = t$4.length, n$3 = i, o$2 = 0;
|
|
637
|
+
if (r$2) for (; ~(l$1 = s$2.indexOf(t$4, o$2)); o$2 = l$1 + r$2) n$3 += s$2.slice(o$2, l$1) + e$4;
|
|
638
|
+
s$2 = n$3 + s$2.slice(o$2);
|
|
639
|
+
}
|
|
640
|
+
return a$2 + (s$2.includes("\n") ? s$2.replace(/(\r?\n)/g, p$1 + "$1" + a$2) : s$2) + p$1;
|
|
641
|
+
}, s$1 = t$3, c$1 = n$2;
|
|
642
|
+
return e$2 && (s$1 = e$2.o + t$3, c$1 = n$2 + e$2.c), l(o$1, r), o$1.p = {
|
|
643
|
+
open: t$3,
|
|
644
|
+
close: n$2,
|
|
645
|
+
o: s$1,
|
|
646
|
+
c: c$1,
|
|
647
|
+
p: e$2
|
|
648
|
+
}, o$1.open = s$1, o$1.close = c$1, o$1;
|
|
649
|
+
};
|
|
650
|
+
const w = function(e$2 = g) {
|
|
651
|
+
let t$3 = {
|
|
652
|
+
Ansis: w,
|
|
653
|
+
level: e$2,
|
|
654
|
+
isSupported: () => s$1,
|
|
655
|
+
strip: (e$3) => e$3.replace(/[][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, i),
|
|
656
|
+
extend(e$3) {
|
|
657
|
+
for (let t$4 in e$3) {
|
|
658
|
+
let r$1 = e$3[t$4], l$1 = (typeof r$1)[0], o$1 = "s" === l$1 ? x(...p(r$1)) : r$1;
|
|
659
|
+
O[t$4] = "f" === l$1 ? { get() {
|
|
660
|
+
return (...e$4) => m(this, r$1(...e$4));
|
|
661
|
+
} } : { get() {
|
|
662
|
+
let e$4 = m(this, o$1);
|
|
663
|
+
return n$1(this, t$4, { value: e$4 }), e$4;
|
|
664
|
+
} };
|
|
665
|
+
}
|
|
666
|
+
return r = o({}, O), l(t$3, r), t$3;
|
|
667
|
+
}
|
|
668
|
+
}, s$1 = e$2 > 0, c$1 = (e$3, t$4) => s$1 ? {
|
|
669
|
+
open: `[${e$3}m`,
|
|
670
|
+
close: `[${t$4}m`
|
|
671
|
+
} : f, a$2 = (e$3) => (t$4) => e$3(...p(t$4)), y$1 = (e$3, t$4) => (r$1, n$2, l$1) => c$1(`${e$3}8;2;${r$1};${n$2};${l$1}`, t$4), R = (e$3, t$4) => (r$1, n$2, l$1) => c$1(((e$4, t$5, r$2) => d(u(e$4, t$5, r$2)))(r$1, n$2, l$1) + e$3, t$4), $ = (e$3) => (t$4, r$1, n$2) => e$3(u(t$4, r$1, n$2)), x = y$1(3, h), T = y$1(4, b), v = (e$3) => c$1("38;5;" + e$3, h), C = (e$3) => c$1("48;5;" + e$3, b);
|
|
672
|
+
2 === e$2 ? (x = $(v), T = $(C)) : 1 === e$2 && (x = R(0, h), T = R(10, b), v = (e$3) => c$1(d(e$3), h), C = (e$3) => c$1(d(e$3) + 10, b));
|
|
673
|
+
let E, M = {
|
|
674
|
+
fg: v,
|
|
675
|
+
bg: C,
|
|
676
|
+
rgb: x,
|
|
677
|
+
bgRgb: T,
|
|
678
|
+
hex: a$2(x),
|
|
679
|
+
bgHex: a$2(T),
|
|
680
|
+
visible: f,
|
|
681
|
+
reset: c$1(0, 0),
|
|
682
|
+
bold: c$1(1, 22),
|
|
683
|
+
dim: c$1(2, 22),
|
|
684
|
+
italic: c$1(3, 23),
|
|
685
|
+
underline: c$1(4, 24),
|
|
686
|
+
inverse: c$1(7, 27),
|
|
687
|
+
hidden: c$1(8, 28),
|
|
688
|
+
strikethrough: c$1(9, 29)
|
|
689
|
+
}, I = "Bright";
|
|
690
|
+
return "black,red,green,yellow,blue,magenta,cyan,white,gray".split(",").map(((e$3, t$4) => {
|
|
691
|
+
E = "bg" + e$3[0].toUpperCase() + e$3.slice(1), 8 > t$4 ? (M[e$3 + I] = c$1(90 + t$4, h), M[E + I] = c$1(100 + t$4, b)) : t$4 = 60, M[e$3] = c$1(30 + t$4, h), M[E] = c$1(40 + t$4, b);
|
|
692
|
+
})), t$3.extend(M);
|
|
693
|
+
}, y = new w();
|
|
694
|
+
module.exports = y, y.default = y;
|
|
695
|
+
}) });
|
|
696
|
+
|
|
697
|
+
//#endregion
|
|
698
|
+
//#region ../../node_modules/.pnpm/ansis@4.1.0/node_modules/ansis/index.mjs
|
|
699
|
+
var import_ansis = /* @__PURE__ */ __toESM(require_ansis(), 1);
|
|
700
|
+
var ansis_default = import_ansis.default;
|
|
701
|
+
const { Ansis, fg, bg, rgb, bgRgb, hex, bgHex, reset, inverse, hidden, visible, bold, dim, italic, underline, strikethrough, black, red, green, yellow, blue, magenta, cyan, white, gray, redBright, greenBright, yellowBright, blueBright, magentaBright, cyanBright, whiteBright, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bgGray, bgRedBright, bgGreenBright, bgYellowBright, bgBlueBright, bgMagentaBright, bgCyanBright, bgWhiteBright } = import_ansis.default;
|
|
702
|
+
|
|
453
703
|
//#endregion
|
|
454
704
|
//#region ../../node_modules/.pnpm/valibot@1.1.0_typescript@5.9.2/node_modules/valibot/dist/index.js
|
|
455
|
-
var store
|
|
705
|
+
var store;
|
|
456
706
|
/* @__NO_SIDE_EFFECTS__ */
|
|
457
707
|
function getGlobalConfig(config2) {
|
|
458
708
|
return {
|
|
459
|
-
lang: config2?.lang ?? store
|
|
709
|
+
lang: config2?.lang ?? store?.lang,
|
|
460
710
|
message: config2?.message,
|
|
461
|
-
abortEarly: config2?.abortEarly ?? store
|
|
462
|
-
abortPipeEarly: config2?.abortPipeEarly ?? store
|
|
711
|
+
abortEarly: config2?.abortEarly ?? store?.abortEarly,
|
|
712
|
+
abortPipeEarly: config2?.abortPipeEarly ?? store?.abortPipeEarly
|
|
463
713
|
};
|
|
464
714
|
}
|
|
465
715
|
var store2;
|
|
@@ -1440,508 +1690,70 @@ function safeParse(schema, input, config2) {
|
|
|
1440
1690
|
}
|
|
1441
1691
|
|
|
1442
1692
|
//#endregion
|
|
1443
|
-
//#region
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
if (
|
|
1454
|
-
|
|
1455
|
-
return
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
}
|
|
1459
|
-
/**
|
|
1460
|
-
* Throws an error or logs a warning based on the configuration.
|
|
1461
|
-
*
|
|
1462
|
-
* @param message The message to throw or log.
|
|
1463
|
-
* @param config The conversion configuration.
|
|
1464
|
-
*/
|
|
1465
|
-
function handleError(message, config) {
|
|
1466
|
-
switch (config?.errorMode) {
|
|
1467
|
-
case "ignore": break;
|
|
1468
|
-
case "warn":
|
|
1469
|
-
console.warn(message);
|
|
1470
|
-
break;
|
|
1471
|
-
default: throw new Error(message);
|
|
1472
|
-
}
|
|
1473
|
-
}
|
|
1474
|
-
/**
|
|
1475
|
-
* Converts any supported Valibot action to the JSON Schema format.
|
|
1476
|
-
*
|
|
1477
|
-
* @param jsonSchema The JSON Schema object.
|
|
1478
|
-
* @param valibotAction The Valibot action object.
|
|
1479
|
-
* @param config The conversion configuration.
|
|
1480
|
-
*
|
|
1481
|
-
* @returns The converted JSON Schema.
|
|
1482
|
-
*/
|
|
1483
|
-
function convertAction(jsonSchema, valibotAction, config) {
|
|
1484
|
-
if (config?.ignoreActions?.includes(valibotAction.type)) return jsonSchema;
|
|
1485
|
-
let errors;
|
|
1486
|
-
switch (valibotAction.type) {
|
|
1487
|
-
case "base64":
|
|
1488
|
-
jsonSchema.contentEncoding = "base64";
|
|
1489
|
-
break;
|
|
1490
|
-
case "bic":
|
|
1491
|
-
case "cuid2":
|
|
1492
|
-
case "decimal":
|
|
1493
|
-
case "digits":
|
|
1494
|
-
case "emoji":
|
|
1495
|
-
case "hexadecimal":
|
|
1496
|
-
case "hex_color":
|
|
1497
|
-
case "nanoid":
|
|
1498
|
-
case "octal":
|
|
1499
|
-
case "ulid":
|
|
1500
|
-
jsonSchema.pattern = valibotAction.requirement.source;
|
|
1501
|
-
break;
|
|
1502
|
-
case "description":
|
|
1503
|
-
jsonSchema.description = valibotAction.description;
|
|
1504
|
-
break;
|
|
1505
|
-
case "email":
|
|
1506
|
-
jsonSchema.format = "email";
|
|
1507
|
-
break;
|
|
1508
|
-
case "empty":
|
|
1509
|
-
if (jsonSchema.type === "array") jsonSchema.maxItems = 0;
|
|
1510
|
-
else {
|
|
1511
|
-
if (jsonSchema.type !== "string") errors = addError(errors, `The "${valibotAction.type}" action is not supported on type "${jsonSchema.type}".`);
|
|
1512
|
-
jsonSchema.maxLength = 0;
|
|
1513
|
-
}
|
|
1514
|
-
break;
|
|
1515
|
-
case "entries":
|
|
1516
|
-
jsonSchema.minProperties = valibotAction.requirement;
|
|
1517
|
-
jsonSchema.maxProperties = valibotAction.requirement;
|
|
1518
|
-
break;
|
|
1519
|
-
case "integer":
|
|
1520
|
-
jsonSchema.type = "integer";
|
|
1521
|
-
break;
|
|
1522
|
-
case "ipv4":
|
|
1523
|
-
jsonSchema.format = "ipv4";
|
|
1524
|
-
break;
|
|
1525
|
-
case "ipv6":
|
|
1526
|
-
jsonSchema.format = "ipv6";
|
|
1527
|
-
break;
|
|
1528
|
-
case "iso_date":
|
|
1529
|
-
jsonSchema.format = "date";
|
|
1530
|
-
break;
|
|
1531
|
-
case "iso_date_time":
|
|
1532
|
-
case "iso_timestamp":
|
|
1533
|
-
jsonSchema.format = "date-time";
|
|
1534
|
-
break;
|
|
1535
|
-
case "iso_time":
|
|
1536
|
-
jsonSchema.format = "time";
|
|
1537
|
-
break;
|
|
1538
|
-
case "length":
|
|
1539
|
-
if (jsonSchema.type === "array") {
|
|
1540
|
-
jsonSchema.minItems = valibotAction.requirement;
|
|
1541
|
-
jsonSchema.maxItems = valibotAction.requirement;
|
|
1542
|
-
} else {
|
|
1543
|
-
if (jsonSchema.type !== "string") errors = addError(errors, `The "${valibotAction.type}" action is not supported on type "${jsonSchema.type}".`);
|
|
1544
|
-
jsonSchema.minLength = valibotAction.requirement;
|
|
1545
|
-
jsonSchema.maxLength = valibotAction.requirement;
|
|
1546
|
-
}
|
|
1547
|
-
break;
|
|
1548
|
-
case "max_entries":
|
|
1549
|
-
jsonSchema.maxProperties = valibotAction.requirement;
|
|
1550
|
-
break;
|
|
1551
|
-
case "max_length":
|
|
1552
|
-
if (jsonSchema.type === "array") jsonSchema.maxItems = valibotAction.requirement;
|
|
1553
|
-
else {
|
|
1554
|
-
if (jsonSchema.type !== "string") errors = addError(errors, `The "${valibotAction.type}" action is not supported on type "${jsonSchema.type}".`);
|
|
1555
|
-
jsonSchema.maxLength = valibotAction.requirement;
|
|
1556
|
-
}
|
|
1557
|
-
break;
|
|
1558
|
-
case "max_value":
|
|
1559
|
-
if (jsonSchema.type !== "number") errors = addError(errors, `The "max_value" action is not supported on type "${jsonSchema.type}".`);
|
|
1560
|
-
jsonSchema.maximum = valibotAction.requirement;
|
|
1561
|
-
break;
|
|
1562
|
-
case "metadata":
|
|
1563
|
-
if (typeof valibotAction.metadata.title === "string") jsonSchema.title = valibotAction.metadata.title;
|
|
1564
|
-
if (typeof valibotAction.metadata.description === "string") jsonSchema.description = valibotAction.metadata.description;
|
|
1565
|
-
if (Array.isArray(valibotAction.metadata.examples)) jsonSchema.examples = valibotAction.metadata.examples;
|
|
1566
|
-
break;
|
|
1567
|
-
case "min_entries":
|
|
1568
|
-
jsonSchema.minProperties = valibotAction.requirement;
|
|
1569
|
-
break;
|
|
1570
|
-
case "min_length":
|
|
1571
|
-
if (jsonSchema.type === "array") jsonSchema.minItems = valibotAction.requirement;
|
|
1572
|
-
else {
|
|
1573
|
-
if (jsonSchema.type !== "string") errors = addError(errors, `The "${valibotAction.type}" action is not supported on type "${jsonSchema.type}".`);
|
|
1574
|
-
jsonSchema.minLength = valibotAction.requirement;
|
|
1575
|
-
}
|
|
1576
|
-
break;
|
|
1577
|
-
case "min_value":
|
|
1578
|
-
if (jsonSchema.type !== "number") errors = addError(errors, `The "min_value" action is not supported on type "${jsonSchema.type}".`);
|
|
1579
|
-
jsonSchema.minimum = valibotAction.requirement;
|
|
1580
|
-
break;
|
|
1581
|
-
case "multiple_of":
|
|
1582
|
-
jsonSchema.multipleOf = valibotAction.requirement;
|
|
1583
|
-
break;
|
|
1584
|
-
case "non_empty":
|
|
1585
|
-
if (jsonSchema.type === "array") jsonSchema.minItems = 1;
|
|
1586
|
-
else {
|
|
1587
|
-
if (jsonSchema.type !== "string") errors = addError(errors, `The "${valibotAction.type}" action is not supported on type "${jsonSchema.type}".`);
|
|
1588
|
-
jsonSchema.minLength = 1;
|
|
1589
|
-
}
|
|
1590
|
-
break;
|
|
1591
|
-
case "regex":
|
|
1592
|
-
if (valibotAction.requirement.flags) errors = addError(errors, "RegExp flags are not supported by JSON Schema.");
|
|
1593
|
-
jsonSchema.pattern = valibotAction.requirement.source;
|
|
1594
|
-
break;
|
|
1595
|
-
case "title":
|
|
1596
|
-
jsonSchema.title = valibotAction.title;
|
|
1597
|
-
break;
|
|
1598
|
-
case "url":
|
|
1599
|
-
jsonSchema.format = "uri";
|
|
1600
|
-
break;
|
|
1601
|
-
case "uuid":
|
|
1602
|
-
jsonSchema.format = "uuid";
|
|
1603
|
-
break;
|
|
1604
|
-
case "value":
|
|
1605
|
-
jsonSchema.const = valibotAction.requirement;
|
|
1606
|
-
break;
|
|
1607
|
-
default: errors = addError(errors, `The "${valibotAction.type}" action cannot be converted to JSON Schema.`);
|
|
1608
|
-
}
|
|
1609
|
-
if (config?.overrideAction) {
|
|
1610
|
-
const actionOverride = config.overrideAction({
|
|
1611
|
-
valibotAction,
|
|
1612
|
-
jsonSchema,
|
|
1613
|
-
errors
|
|
1614
|
-
});
|
|
1615
|
-
if (actionOverride) return { ...actionOverride };
|
|
1616
|
-
}
|
|
1617
|
-
if (errors) for (const message of errors) handleError(message, config);
|
|
1618
|
-
return jsonSchema;
|
|
1619
|
-
}
|
|
1620
|
-
/**
|
|
1621
|
-
* Flattens a Valibot pipe by recursively expanding nested pipes.
|
|
1622
|
-
*
|
|
1623
|
-
* @param pipe The pipeline to flatten.
|
|
1624
|
-
*
|
|
1625
|
-
* @returns A flat pipeline.
|
|
1626
|
-
*/
|
|
1627
|
-
function flattenPipe(pipe$1) {
|
|
1628
|
-
return pipe$1.flatMap((item) => "pipe" in item ? flattenPipe(item.pipe) : item);
|
|
1629
|
-
}
|
|
1630
|
-
let refCount = 0;
|
|
1631
|
-
/**
|
|
1632
|
-
* Converts any supported Valibot schema to the JSON Schema format.
|
|
1633
|
-
*
|
|
1634
|
-
* @param jsonSchema The JSON Schema object.
|
|
1635
|
-
* @param valibotSchema The Valibot schema object.
|
|
1636
|
-
* @param config The conversion configuration.
|
|
1637
|
-
* @param context The conversion context.
|
|
1638
|
-
* @param skipRef Whether to skip using a reference.
|
|
1639
|
-
*
|
|
1640
|
-
* @returns The converted JSON Schema.
|
|
1641
|
-
*/
|
|
1642
|
-
function convertSchema(jsonSchema, valibotSchema, config, context, skipRef = false) {
|
|
1643
|
-
if (!skipRef) {
|
|
1644
|
-
const referenceId = context.referenceMap.get(valibotSchema);
|
|
1645
|
-
if (referenceId) {
|
|
1646
|
-
jsonSchema.$ref = `#/$defs/${referenceId}`;
|
|
1647
|
-
if (config?.overrideRef) {
|
|
1648
|
-
const refOverride = config.overrideRef({
|
|
1649
|
-
...context,
|
|
1650
|
-
referenceId,
|
|
1651
|
-
valibotSchema,
|
|
1652
|
-
jsonSchema
|
|
1653
|
-
});
|
|
1654
|
-
if (refOverride) jsonSchema.$ref = refOverride;
|
|
1655
|
-
}
|
|
1656
|
-
return jsonSchema;
|
|
1657
|
-
}
|
|
1658
|
-
}
|
|
1659
|
-
if ("pipe" in valibotSchema) {
|
|
1660
|
-
const flatPipe = flattenPipe(valibotSchema.pipe);
|
|
1661
|
-
let startIndex = 0;
|
|
1662
|
-
let stopIndex = flatPipe.length - 1;
|
|
1663
|
-
if (config?.typeMode === "input") {
|
|
1664
|
-
const inputStopIndex = flatPipe.slice(1).findIndex((item) => item.kind === "schema" || item.kind === "transformation" && (item.type === "find_item" || item.type === "parse_json" || item.type === "raw_transform" || item.type === "reduce_items" || item.type === "stringify_json" || item.type === "transform"));
|
|
1665
|
-
if (inputStopIndex !== -1) stopIndex = inputStopIndex;
|
|
1666
|
-
} else if (config?.typeMode === "output") {
|
|
1667
|
-
const outputStartIndex = flatPipe.findLastIndex((item) => item.kind === "schema");
|
|
1668
|
-
if (outputStartIndex !== -1) startIndex = outputStartIndex;
|
|
1669
|
-
}
|
|
1670
|
-
for (let index = startIndex; index <= stopIndex; index++) {
|
|
1671
|
-
const valibotPipeItem = flatPipe[index];
|
|
1672
|
-
if (valibotPipeItem.kind === "schema") {
|
|
1673
|
-
if (index > startIndex) handleError("Set the \"typeMode\" config to \"input\" or \"output\" to convert pipelines with multiple schemas.", config);
|
|
1674
|
-
jsonSchema = convertSchema(jsonSchema, valibotPipeItem, config, context, true);
|
|
1675
|
-
} else jsonSchema = convertAction(jsonSchema, valibotPipeItem, config);
|
|
1676
|
-
}
|
|
1677
|
-
return jsonSchema;
|
|
1678
|
-
}
|
|
1679
|
-
let errors;
|
|
1680
|
-
switch (valibotSchema.type) {
|
|
1681
|
-
case "boolean":
|
|
1682
|
-
jsonSchema.type = "boolean";
|
|
1683
|
-
break;
|
|
1684
|
-
case "null":
|
|
1685
|
-
jsonSchema.type = "null";
|
|
1686
|
-
break;
|
|
1687
|
-
case "number":
|
|
1688
|
-
jsonSchema.type = "number";
|
|
1689
|
-
break;
|
|
1690
|
-
case "string":
|
|
1691
|
-
jsonSchema.type = "string";
|
|
1692
|
-
break;
|
|
1693
|
-
case "array":
|
|
1694
|
-
jsonSchema.type = "array";
|
|
1695
|
-
jsonSchema.items = convertSchema({}, valibotSchema.item, config, context);
|
|
1696
|
-
break;
|
|
1697
|
-
case "tuple":
|
|
1698
|
-
case "tuple_with_rest":
|
|
1699
|
-
case "loose_tuple":
|
|
1700
|
-
case "strict_tuple":
|
|
1701
|
-
jsonSchema.type = "array";
|
|
1702
|
-
jsonSchema.items = [];
|
|
1703
|
-
jsonSchema.minItems = valibotSchema.items.length;
|
|
1704
|
-
for (const item of valibotSchema.items) jsonSchema.items.push(convertSchema({}, item, config, context));
|
|
1705
|
-
if (valibotSchema.type === "tuple_with_rest") jsonSchema.additionalItems = convertSchema({}, valibotSchema.rest, config, context);
|
|
1706
|
-
else if (valibotSchema.type === "strict_tuple") jsonSchema.additionalItems = false;
|
|
1707
|
-
break;
|
|
1693
|
+
//#region src/utils/flatten-valibot-schema.ts
|
|
1694
|
+
function unwrapSchema(schema) {
|
|
1695
|
+
if (!schema) return schema;
|
|
1696
|
+
if (schema.type === "optional" && schema.wrapped) return unwrapSchema(schema.wrapped);
|
|
1697
|
+
if (schema.type === "nullable" && schema.wrapped) return unwrapSchema(schema.wrapped);
|
|
1698
|
+
if (schema.type === "nullish" && schema.wrapped) return unwrapSchema(schema.wrapped);
|
|
1699
|
+
return schema;
|
|
1700
|
+
}
|
|
1701
|
+
function getValibotSchemaType(schema) {
|
|
1702
|
+
if (!schema) return "any";
|
|
1703
|
+
if (schema.type) switch (schema.type) {
|
|
1704
|
+
case "string": return "string";
|
|
1705
|
+
case "number": return "number";
|
|
1706
|
+
case "boolean": return "boolean";
|
|
1707
|
+
case "array": return "array";
|
|
1708
1708
|
case "object":
|
|
1709
|
-
case "object_with_rest":
|
|
1710
|
-
case "loose_object":
|
|
1711
1709
|
case "strict_object":
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
case "
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
if (
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
case "variant":
|
|
1755
|
-
jsonSchema.anyOf = valibotSchema.options.map((option) => convertSchema({}, option, config, context));
|
|
1756
|
-
break;
|
|
1757
|
-
case "intersect":
|
|
1758
|
-
jsonSchema.allOf = valibotSchema.options.map((option) => convertSchema({}, option, config, context));
|
|
1759
|
-
break;
|
|
1760
|
-
case "lazy": {
|
|
1761
|
-
let wrappedValibotSchema = context.getterMap.get(valibotSchema.getter);
|
|
1762
|
-
if (!wrappedValibotSchema) {
|
|
1763
|
-
wrappedValibotSchema = valibotSchema.getter(void 0);
|
|
1764
|
-
context.getterMap.set(valibotSchema.getter, wrappedValibotSchema);
|
|
1765
|
-
}
|
|
1766
|
-
let referenceId = context.referenceMap.get(wrappedValibotSchema);
|
|
1767
|
-
if (!referenceId) {
|
|
1768
|
-
referenceId = `${refCount++}`;
|
|
1769
|
-
context.referenceMap.set(wrappedValibotSchema, referenceId);
|
|
1770
|
-
context.definitions[referenceId] = convertSchema({}, wrappedValibotSchema, config, context, true);
|
|
1771
|
-
}
|
|
1772
|
-
jsonSchema.$ref = `#/$defs/${referenceId}`;
|
|
1773
|
-
if (config?.overrideRef) {
|
|
1774
|
-
const refOverride = config.overrideRef({
|
|
1775
|
-
...context,
|
|
1776
|
-
referenceId,
|
|
1777
|
-
valibotSchema: wrappedValibotSchema,
|
|
1778
|
-
jsonSchema
|
|
1779
|
-
});
|
|
1780
|
-
if (refOverride) jsonSchema.$ref = refOverride;
|
|
1781
|
-
}
|
|
1782
|
-
break;
|
|
1710
|
+
case "loose_object": return "object";
|
|
1711
|
+
case "union": return "union";
|
|
1712
|
+
case "literal": return typeof schema.literal;
|
|
1713
|
+
case "record": return "object";
|
|
1714
|
+
case "optional": return getValibotSchemaType(schema.wrapped);
|
|
1715
|
+
case "nullable": return getValibotSchemaType(schema.wrapped);
|
|
1716
|
+
case "nullish": return getValibotSchemaType(schema.wrapped);
|
|
1717
|
+
case "never": return "never";
|
|
1718
|
+
case "any": return "any";
|
|
1719
|
+
case "custom": return "any";
|
|
1720
|
+
case "function": return "never";
|
|
1721
|
+
case "instance": return "object";
|
|
1722
|
+
default: return "any";
|
|
1723
|
+
}
|
|
1724
|
+
return "any";
|
|
1725
|
+
}
|
|
1726
|
+
function getValibotDescription(schema) {
|
|
1727
|
+
if (!schema) return void 0;
|
|
1728
|
+
if (schema.pipe && Array.isArray(schema.pipe)) {
|
|
1729
|
+
for (const action of schema.pipe) if (action.type === "description" && action.description) return action.description;
|
|
1730
|
+
}
|
|
1731
|
+
if (schema.type === "optional" && schema.wrapped) return getValibotDescription(schema.wrapped);
|
|
1732
|
+
}
|
|
1733
|
+
function flattenValibotSchema(schema, result = {}, prefix = "") {
|
|
1734
|
+
if (!schema || typeof schema !== "object") return result;
|
|
1735
|
+
if (schema.type === "strict_object" || schema.type === "object" || schema.type === "loose_object") {
|
|
1736
|
+
if (schema.entries && typeof schema.entries === "object") for (const [key, value] of Object.entries(schema.entries)) {
|
|
1737
|
+
const fullKey = prefix ? `${prefix}.${key}` : key;
|
|
1738
|
+
const valueSchema = value;
|
|
1739
|
+
const type = getValibotSchemaType(valueSchema);
|
|
1740
|
+
const description$2 = getValibotDescription(valueSchema);
|
|
1741
|
+
if (type === "object") {
|
|
1742
|
+
const unwrappedSchema = unwrapSchema(valueSchema);
|
|
1743
|
+
if (unwrappedSchema && unwrappedSchema.entries) flattenValibotSchema(unwrappedSchema, result, fullKey);
|
|
1744
|
+
else result[fullKey] = {
|
|
1745
|
+
type,
|
|
1746
|
+
description: description$2
|
|
1747
|
+
};
|
|
1748
|
+
} else result[fullKey] = {
|
|
1749
|
+
type,
|
|
1750
|
+
description: description$2
|
|
1751
|
+
};
|
|
1783
1752
|
}
|
|
1784
|
-
default: errors = addError(errors, `The "${valibotSchema.type}" schema cannot be converted to JSON Schema.`);
|
|
1785
|
-
}
|
|
1786
|
-
if (config?.overrideSchema) {
|
|
1787
|
-
const schemaOverride = config.overrideSchema({
|
|
1788
|
-
...context,
|
|
1789
|
-
referenceId: context.referenceMap.get(valibotSchema),
|
|
1790
|
-
valibotSchema,
|
|
1791
|
-
jsonSchema,
|
|
1792
|
-
errors
|
|
1793
|
-
});
|
|
1794
|
-
if (schemaOverride) return { ...schemaOverride };
|
|
1795
1753
|
}
|
|
1796
|
-
|
|
1797
|
-
return jsonSchema;
|
|
1798
|
-
}
|
|
1799
|
-
let store;
|
|
1800
|
-
/**
|
|
1801
|
-
* Returns the current global schema definitions.
|
|
1802
|
-
*
|
|
1803
|
-
* @returns The schema definitions.
|
|
1804
|
-
*
|
|
1805
|
-
* @beta
|
|
1806
|
-
*/
|
|
1807
|
-
function getGlobalDefs() {
|
|
1808
|
-
return store;
|
|
1809
|
-
}
|
|
1810
|
-
/**
|
|
1811
|
-
* Converts a Valibot schema to the JSON Schema format.
|
|
1812
|
-
*
|
|
1813
|
-
* @param schema The Valibot schema object.
|
|
1814
|
-
* @param config The JSON Schema configuration.
|
|
1815
|
-
*
|
|
1816
|
-
* @returns The converted JSON Schema.
|
|
1817
|
-
*/
|
|
1818
|
-
function toJsonSchema(schema, config) {
|
|
1819
|
-
const context = {
|
|
1820
|
-
definitions: {},
|
|
1821
|
-
referenceMap: /* @__PURE__ */ new Map(),
|
|
1822
|
-
getterMap: /* @__PURE__ */ new Map()
|
|
1823
|
-
};
|
|
1824
|
-
const definitions = config?.definitions ?? getGlobalDefs();
|
|
1825
|
-
if (definitions) {
|
|
1826
|
-
for (const key in definitions) context.referenceMap.set(definitions[key], key);
|
|
1827
|
-
for (const key in definitions) context.definitions[key] = convertSchema({}, definitions[key], config, context, true);
|
|
1828
|
-
}
|
|
1829
|
-
const jsonSchema = convertSchema({ $schema: "http://json-schema.org/draft-07/schema#" }, schema, config, context);
|
|
1830
|
-
if (context.referenceMap.size) jsonSchema.$defs = context.definitions;
|
|
1831
|
-
return jsonSchema;
|
|
1754
|
+
return result;
|
|
1832
1755
|
}
|
|
1833
1756
|
|
|
1834
|
-
//#endregion
|
|
1835
|
-
//#region ../../node_modules/.pnpm/ansis@4.1.0/node_modules/ansis/index.cjs
|
|
1836
|
-
var require_ansis = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ansis@4.1.0/node_modules/ansis/index.cjs": ((exports, module) => {
|
|
1837
|
-
let e$1, t$2, r, { defineProperty: n$1, setPrototypeOf: l, create: o, keys: s } = Object, i = "", { round: c, max: a$1 } = Math, p = (e$2) => {
|
|
1838
|
-
let t$3 = /([a-f\d]{3,6})/i.exec(e$2)?.[1], r$1 = t$3?.length, n$2 = parseInt(6 ^ r$1 ? 3 ^ r$1 ? "0" : t$3[0] + t$3[0] + t$3[1] + t$3[1] + t$3[2] + t$3[2] : t$3, 16);
|
|
1839
|
-
return [
|
|
1840
|
-
n$2 >> 16 & 255,
|
|
1841
|
-
n$2 >> 8 & 255,
|
|
1842
|
-
255 & n$2
|
|
1843
|
-
];
|
|
1844
|
-
}, u = (e$2, t$3, r$1) => e$2 ^ t$3 || t$3 ^ r$1 ? 16 + 36 * c(e$2 / 51) + 6 * c(t$3 / 51) + c(r$1 / 51) : 8 > e$2 ? 16 : e$2 > 248 ? 231 : c(24 * (e$2 - 8) / 247) + 232, d = (e$2) => {
|
|
1845
|
-
let t$3, r$1, n$2, l$1, o$1;
|
|
1846
|
-
return 8 > e$2 ? 30 + e$2 : 16 > e$2 ? e$2 - 8 + 90 : (232 > e$2 ? (o$1 = (e$2 -= 16) % 36, t$3 = (e$2 / 36 | 0) / 5, r$1 = (o$1 / 6 | 0) / 5, n$2 = o$1 % 6 / 5) : t$3 = r$1 = n$2 = (10 * (e$2 - 232) + 8) / 255, l$1 = 2 * a$1(t$3, r$1, n$2), l$1 ? 30 + (c(n$2) << 2 | c(r$1) << 1 | c(t$3)) + (2 ^ l$1 ? 0 : 60) : 30);
|
|
1847
|
-
}, g = (() => {
|
|
1848
|
-
let r$1 = (e$2) => o$1.some(((t$3) => e$2.test(t$3))), n$2 = globalThis, l$1 = n$2.process ?? {}, o$1 = l$1.argv ?? [], i$1 = l$1.env ?? {}, c$1 = -1;
|
|
1849
|
-
try {
|
|
1850
|
-
e$1 = "," + s(i$1).join(",");
|
|
1851
|
-
} catch (e$2) {
|
|
1852
|
-
i$1 = {}, c$1 = 0;
|
|
1853
|
-
}
|
|
1854
|
-
let a$2 = "FORCE_COLOR", p$1 = {
|
|
1855
|
-
false: 0,
|
|
1856
|
-
0: 0,
|
|
1857
|
-
1: 1,
|
|
1858
|
-
2: 2,
|
|
1859
|
-
3: 3
|
|
1860
|
-
}[i$1[a$2]] ?? -1, u$1 = a$2 in i$1 && p$1 || r$1(/^--color=?(true|always)?$/);
|
|
1861
|
-
return u$1 && (c$1 = p$1), ~c$1 || (c$1 = ((r$2, n$3, l$2) => (t$2 = r$2.TERM, {
|
|
1862
|
-
"24bit": 3,
|
|
1863
|
-
truecolor: 3,
|
|
1864
|
-
ansi256: 2,
|
|
1865
|
-
ansi: 1
|
|
1866
|
-
}[r$2.COLORTERM] || (r$2.CI ? /,GITHUB/.test(e$1) ? 3 : 1 : n$3 && "dumb" !== t$2 ? l$2 ? 3 : /-256/.test(t$2) ? 2 : 1 : 0)))(i$1, !!i$1.PM2_HOME || i$1.NEXT_RUNTIME?.includes("edge") || !!l$1.stdout?.isTTY, "win32" === l$1.platform)), !p$1 || i$1.NO_COLOR || r$1(/^--(no-color|color=(false|never))$/) ? 0 : n$2.window?.chrome || u$1 && !c$1 ? 3 : c$1;
|
|
1867
|
-
})(), f = {
|
|
1868
|
-
open: i,
|
|
1869
|
-
close: i
|
|
1870
|
-
}, h = 39, b = 49, O = {}, m = ({ p: e$2 }, { open: t$3, close: n$2 }) => {
|
|
1871
|
-
let o$1 = (e$3, ...r$1) => {
|
|
1872
|
-
if (!e$3) {
|
|
1873
|
-
if (t$3 && t$3 === n$2) return t$3;
|
|
1874
|
-
if ((e$3 ?? i) === i) return i;
|
|
1875
|
-
}
|
|
1876
|
-
let l$1, s$2 = e$3.raw ? String.raw({ raw: e$3 }, ...r$1) : i + e$3, c$2 = o$1.p, a$2 = c$2.o, p$1 = c$2.c;
|
|
1877
|
-
if (s$2.includes("\x1B")) for (; c$2; c$2 = c$2.p) {
|
|
1878
|
-
let { open: e$4, close: t$4 } = c$2, r$2 = t$4.length, n$3 = i, o$2 = 0;
|
|
1879
|
-
if (r$2) for (; ~(l$1 = s$2.indexOf(t$4, o$2)); o$2 = l$1 + r$2) n$3 += s$2.slice(o$2, l$1) + e$4;
|
|
1880
|
-
s$2 = n$3 + s$2.slice(o$2);
|
|
1881
|
-
}
|
|
1882
|
-
return a$2 + (s$2.includes("\n") ? s$2.replace(/(\r?\n)/g, p$1 + "$1" + a$2) : s$2) + p$1;
|
|
1883
|
-
}, s$1 = t$3, c$1 = n$2;
|
|
1884
|
-
return e$2 && (s$1 = e$2.o + t$3, c$1 = n$2 + e$2.c), l(o$1, r), o$1.p = {
|
|
1885
|
-
open: t$3,
|
|
1886
|
-
close: n$2,
|
|
1887
|
-
o: s$1,
|
|
1888
|
-
c: c$1,
|
|
1889
|
-
p: e$2
|
|
1890
|
-
}, o$1.open = s$1, o$1.close = c$1, o$1;
|
|
1891
|
-
};
|
|
1892
|
-
const w = function(e$2 = g) {
|
|
1893
|
-
let t$3 = {
|
|
1894
|
-
Ansis: w,
|
|
1895
|
-
level: e$2,
|
|
1896
|
-
isSupported: () => s$1,
|
|
1897
|
-
strip: (e$3) => e$3.replace(/[][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, i),
|
|
1898
|
-
extend(e$3) {
|
|
1899
|
-
for (let t$4 in e$3) {
|
|
1900
|
-
let r$1 = e$3[t$4], l$1 = (typeof r$1)[0], o$1 = "s" === l$1 ? x(...p(r$1)) : r$1;
|
|
1901
|
-
O[t$4] = "f" === l$1 ? { get() {
|
|
1902
|
-
return (...e$4) => m(this, r$1(...e$4));
|
|
1903
|
-
} } : { get() {
|
|
1904
|
-
let e$4 = m(this, o$1);
|
|
1905
|
-
return n$1(this, t$4, { value: e$4 }), e$4;
|
|
1906
|
-
} };
|
|
1907
|
-
}
|
|
1908
|
-
return r = o({}, O), l(t$3, r), t$3;
|
|
1909
|
-
}
|
|
1910
|
-
}, s$1 = e$2 > 0, c$1 = (e$3, t$4) => s$1 ? {
|
|
1911
|
-
open: `[${e$3}m`,
|
|
1912
|
-
close: `[${t$4}m`
|
|
1913
|
-
} : f, a$2 = (e$3) => (t$4) => e$3(...p(t$4)), y$1 = (e$3, t$4) => (r$1, n$2, l$1) => c$1(`${e$3}8;2;${r$1};${n$2};${l$1}`, t$4), R = (e$3, t$4) => (r$1, n$2, l$1) => c$1(((e$4, t$5, r$2) => d(u(e$4, t$5, r$2)))(r$1, n$2, l$1) + e$3, t$4), $ = (e$3) => (t$4, r$1, n$2) => e$3(u(t$4, r$1, n$2)), x = y$1(3, h), T = y$1(4, b), v = (e$3) => c$1("38;5;" + e$3, h), C = (e$3) => c$1("48;5;" + e$3, b);
|
|
1914
|
-
2 === e$2 ? (x = $(v), T = $(C)) : 1 === e$2 && (x = R(0, h), T = R(10, b), v = (e$3) => c$1(d(e$3), h), C = (e$3) => c$1(d(e$3) + 10, b));
|
|
1915
|
-
let E, M = {
|
|
1916
|
-
fg: v,
|
|
1917
|
-
bg: C,
|
|
1918
|
-
rgb: x,
|
|
1919
|
-
bgRgb: T,
|
|
1920
|
-
hex: a$2(x),
|
|
1921
|
-
bgHex: a$2(T),
|
|
1922
|
-
visible: f,
|
|
1923
|
-
reset: c$1(0, 0),
|
|
1924
|
-
bold: c$1(1, 22),
|
|
1925
|
-
dim: c$1(2, 22),
|
|
1926
|
-
italic: c$1(3, 23),
|
|
1927
|
-
underline: c$1(4, 24),
|
|
1928
|
-
inverse: c$1(7, 27),
|
|
1929
|
-
hidden: c$1(8, 28),
|
|
1930
|
-
strikethrough: c$1(9, 29)
|
|
1931
|
-
}, I = "Bright";
|
|
1932
|
-
return "black,red,green,yellow,blue,magenta,cyan,white,gray".split(",").map(((e$3, t$4) => {
|
|
1933
|
-
E = "bg" + e$3[0].toUpperCase() + e$3.slice(1), 8 > t$4 ? (M[e$3 + I] = c$1(90 + t$4, h), M[E + I] = c$1(100 + t$4, b)) : t$4 = 60, M[e$3] = c$1(30 + t$4, h), M[E] = c$1(40 + t$4, b);
|
|
1934
|
-
})), t$3.extend(M);
|
|
1935
|
-
}, y = new w();
|
|
1936
|
-
module.exports = y, y.default = y;
|
|
1937
|
-
}) });
|
|
1938
|
-
|
|
1939
|
-
//#endregion
|
|
1940
|
-
//#region ../../node_modules/.pnpm/ansis@4.1.0/node_modules/ansis/index.mjs
|
|
1941
|
-
var import_ansis = /* @__PURE__ */ __toESM(require_ansis(), 1);
|
|
1942
|
-
var ansis_default = import_ansis.default;
|
|
1943
|
-
const { Ansis, fg, bg, rgb, bgRgb, hex, bgHex, reset, inverse, hidden, visible, bold, dim, italic, underline, strikethrough, black, red, green, yellow, blue, magenta, cyan, white, gray, redBright, greenBright, yellowBright, blueBright, magentaBright, cyanBright, whiteBright, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bgGray, bgRedBright, bgGreenBright, bgYellowBright, bgBlueBright, bgMagentaBright, bgCyanBright, bgWhiteBright } = import_ansis.default;
|
|
1944
|
-
|
|
1945
1757
|
//#endregion
|
|
1946
1758
|
//#region src/utils/validator.ts
|
|
1947
1759
|
const StringOrRegExpSchema = union([string(), instance(RegExp)]);
|
|
@@ -1988,7 +1800,7 @@ const JsxOptionsSchema = strictObject({
|
|
|
1988
1800
|
throwIfNamespace: pipe(optional(string()), description("Toggles whether to throw an error when a tag name uses an XML namespace")),
|
|
1989
1801
|
importSource: pipe(optional(string()), description("Import the factory of element and fragment if mode is classic")),
|
|
1990
1802
|
pragma: pipe(optional(string()), description("Jsx element transformation")),
|
|
1991
|
-
|
|
1803
|
+
pragmaFrag: pipe(optional(string()), description("Jsx fragment transformation")),
|
|
1992
1804
|
refresh: pipe(optional(boolean()), description("Enable react fast refresh"))
|
|
1993
1805
|
});
|
|
1994
1806
|
const RollupJsxOptionsSchema = strictObject({
|
|
@@ -2107,7 +1919,11 @@ const MinifyOptionsSchema = strictObject({
|
|
|
2107
1919
|
codegen: optional(union([boolean(), CodegenOptionsSchema]))
|
|
2108
1920
|
});
|
|
2109
1921
|
const ResolveOptionsSchema = strictObject({
|
|
2110
|
-
alias: optional(record(string(), union([
|
|
1922
|
+
alias: optional(record(string(), union([
|
|
1923
|
+
literal(false),
|
|
1924
|
+
string(),
|
|
1925
|
+
array(string())
|
|
1926
|
+
]))),
|
|
2111
1927
|
aliasFields: optional(array(array(string()))),
|
|
2112
1928
|
conditionNames: optional(array(string())),
|
|
2113
1929
|
extensionAlias: optional(record(string(), array(string()))),
|
|
@@ -2225,7 +2041,7 @@ const InputCliOverrideSchema = strictObject({
|
|
|
2225
2041
|
literal("react-jsx"),
|
|
2226
2042
|
literal("preserve")
|
|
2227
2043
|
])), description("Jsx options preset")),
|
|
2228
|
-
preserveEntrySignatures: pipe(optional(
|
|
2044
|
+
preserveEntrySignatures: pipe(optional(literal(false)), description("Avoid facade chunks for entry points")),
|
|
2229
2045
|
context: pipe(optional(string()), description("The entity top-level `this` represents."))
|
|
2230
2046
|
});
|
|
2231
2047
|
const InputCliOptionsSchema = omit(strictObject({
|
|
@@ -2415,8 +2231,8 @@ function getInputCliKeys() {
|
|
|
2415
2231
|
function getOutputCliKeys() {
|
|
2416
2232
|
return keyof(OutputCliOptionsSchema).options;
|
|
2417
2233
|
}
|
|
2418
|
-
function
|
|
2419
|
-
return
|
|
2234
|
+
function getCliSchemaInfo() {
|
|
2235
|
+
return flattenValibotSchema(CliOptionsSchema);
|
|
2420
2236
|
}
|
|
2421
2237
|
|
|
2422
2238
|
//#endregion
|
|
@@ -2526,7 +2342,7 @@ function normalizeTransformHookSourcemap(id$1, originalCode, rawMap) {
|
|
|
2526
2342
|
}
|
|
2527
2343
|
|
|
2528
2344
|
//#endregion
|
|
2529
|
-
//#region ../../node_modules/.pnpm/remeda@2.
|
|
2345
|
+
//#region ../../node_modules/.pnpm/remeda@2.31.1/node_modules/remeda/dist/lazyDataLastImpl-BDhrIOwR.js
|
|
2530
2346
|
function e(e$2, t$3, n$2) {
|
|
2531
2347
|
let r$1 = (n$3) => e$2(n$3, ...t$3);
|
|
2532
2348
|
return n$2 === void 0 ? r$1 : Object.assign(r$1, {
|
|
@@ -2536,7 +2352,7 @@ function e(e$2, t$3, n$2) {
|
|
|
2536
2352
|
}
|
|
2537
2353
|
|
|
2538
2354
|
//#endregion
|
|
2539
|
-
//#region ../../node_modules/.pnpm/remeda@2.
|
|
2355
|
+
//#region ../../node_modules/.pnpm/remeda@2.31.1/node_modules/remeda/dist/purry-DH9cw9sy.js
|
|
2540
2356
|
function t(t$3, n$2, r$1) {
|
|
2541
2357
|
let i$1 = t$3.length - n$2.length;
|
|
2542
2358
|
if (i$1 === 0) return t$3(...n$2);
|
|
@@ -2545,7 +2361,7 @@ function t(t$3, n$2, r$1) {
|
|
|
2545
2361
|
}
|
|
2546
2362
|
|
|
2547
2363
|
//#endregion
|
|
2548
|
-
//#region ../../node_modules/.pnpm/remeda@2.
|
|
2364
|
+
//#region ../../node_modules/.pnpm/remeda@2.31.1/node_modules/remeda/dist/partition-DAu403JQ.js
|
|
2549
2365
|
function t$1(...t$3) {
|
|
2550
2366
|
return t(n, t$3);
|
|
2551
2367
|
}
|
|
@@ -3509,7 +3325,7 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
|
|
|
3509
3325
|
const { plugin: buildEnd, meta: buildEndMeta } = bindingifyBuildEnd(args$1);
|
|
3510
3326
|
const { plugin: transform, meta: transformMeta, filter: transformFilter } = bindingifyTransform(args$1);
|
|
3511
3327
|
const { plugin: moduleParsed, meta: moduleParsedMeta } = bindingifyModuleParsed(args$1);
|
|
3512
|
-
const { plugin: load, meta: loadMeta, filter: loadFilter } = bindingifyLoad(args$1);
|
|
3328
|
+
const { plugin: load$1, meta: loadMeta, filter: loadFilter } = bindingifyLoad(args$1);
|
|
3513
3329
|
const { plugin: renderChunk, meta: renderChunkMeta, filter: renderChunkFilter } = bindingifyRenderChunk(args$1);
|
|
3514
3330
|
const { plugin: augmentChunkHash, meta: augmentChunkHashMeta } = bindingifyAugmentChunkHash(args$1);
|
|
3515
3331
|
const { plugin: renderStart, meta: renderStartMeta } = bindingifyRenderStart(args$1);
|
|
@@ -3540,7 +3356,7 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
|
|
|
3540
3356
|
transformFilter,
|
|
3541
3357
|
moduleParsed,
|
|
3542
3358
|
moduleParsedMeta,
|
|
3543
|
-
load,
|
|
3359
|
+
load: load$1,
|
|
3544
3360
|
loadMeta,
|
|
3545
3361
|
loadFilter,
|
|
3546
3362
|
renderChunk,
|
|
@@ -3989,6 +3805,17 @@ var PluginContextData = class {
|
|
|
3989
3805
|
}
|
|
3990
3806
|
};
|
|
3991
3807
|
|
|
3808
|
+
//#endregion
|
|
3809
|
+
//#region src/utils/normalize-string-or-regex.ts
|
|
3810
|
+
function normalizedStringOrRegex(pattern) {
|
|
3811
|
+
if (!pattern) return;
|
|
3812
|
+
if (!isReadonlyArray(pattern)) return [pattern];
|
|
3813
|
+
return pattern;
|
|
3814
|
+
}
|
|
3815
|
+
function isReadonlyArray(input) {
|
|
3816
|
+
return Array.isArray(input);
|
|
3817
|
+
}
|
|
3818
|
+
|
|
3992
3819
|
//#endregion
|
|
3993
3820
|
//#region src/utils/bindingify-input-options.ts
|
|
3994
3821
|
function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel, watchMode) {
|
|
@@ -4061,13 +3888,7 @@ function bindingifyExternal(external) {
|
|
|
4061
3888
|
if (id$1.startsWith("\0")) return false;
|
|
4062
3889
|
return external(id$1, importer, isResolved) ?? false;
|
|
4063
3890
|
};
|
|
4064
|
-
|
|
4065
|
-
return (id$1, _importer, _isResolved) => {
|
|
4066
|
-
return externalArr.some((pat) => {
|
|
4067
|
-
if (pat instanceof RegExp) return pat.test(id$1);
|
|
4068
|
-
return id$1 === pat;
|
|
4069
|
-
});
|
|
4070
|
-
};
|
|
3891
|
+
return arraify(external);
|
|
4071
3892
|
}
|
|
4072
3893
|
}
|
|
4073
3894
|
function bindingifyExperimental(experimental) {
|
|
@@ -4101,7 +3922,7 @@ function bindingifyResolve(resolve) {
|
|
|
4101
3922
|
return {
|
|
4102
3923
|
alias: alias ? Object.entries(alias).map(([name, replacement]) => ({
|
|
4103
3924
|
find: name,
|
|
4104
|
-
replacements: arraify(replacement)
|
|
3925
|
+
replacements: replacement === false ? [void 0] : arraify(replacement)
|
|
4105
3926
|
})) : void 0,
|
|
4106
3927
|
extensionAlias: extensionAlias ? Object.entries(extensionAlias).map(([name, value]) => ({
|
|
4107
3928
|
target: name,
|
|
@@ -4332,11 +4153,7 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode) {
|
|
|
4332
4153
|
const onLog = getLogger(getObjectPlugins(inputPlugins), getOnLog(inputOptions, logLevel), logLevel, watchMode);
|
|
4333
4154
|
outputOptions = PluginDriver.callOutputOptionsHook([...inputPlugins, ...outputPlugins], outputOptions, onLog, logLevel, watchMode);
|
|
4334
4155
|
const normalizedOutputPlugins = await normalizePluginOption(outputOptions.plugins);
|
|
4335
|
-
let plugins = [
|
|
4336
|
-
...BUILTIN_PLUGINS,
|
|
4337
|
-
...normalizePlugins(inputPlugins, ANONYMOUS_PLUGIN_PREFIX),
|
|
4338
|
-
...checkOutputPluginOption(normalizePlugins(normalizedOutputPlugins, ANONYMOUS_OUTPUT_PLUGIN_PREFIX), onLog)
|
|
4339
|
-
];
|
|
4156
|
+
let plugins = [...normalizePlugins(inputPlugins, ANONYMOUS_PLUGIN_PREFIX), ...checkOutputPluginOption(normalizePlugins(normalizedOutputPlugins, ANONYMOUS_OUTPUT_PLUGIN_PREFIX), onLog)];
|
|
4340
4157
|
const parallelPluginInitResult = await initializeParallelPlugins(plugins);
|
|
4341
4158
|
try {
|
|
4342
4159
|
const bindingInputOptions = bindingifyInputOptions(plugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel, watchMode);
|
|
@@ -4357,27 +4174,6 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode) {
|
|
|
4357
4174
|
}
|
|
4358
4175
|
}
|
|
4359
4176
|
|
|
4360
|
-
//#endregion
|
|
4361
|
-
//#region src/utils/create-bundler.ts
|
|
4362
|
-
let asyncRuntimeShutdown = false;
|
|
4363
|
-
async function createBundlerImpl(bundler, inputOptions, outputOptions) {
|
|
4364
|
-
const option = await createBundlerOptions(inputOptions, outputOptions, false);
|
|
4365
|
-
if (asyncRuntimeShutdown) startAsyncRuntime();
|
|
4366
|
-
try {
|
|
4367
|
-
return {
|
|
4368
|
-
impl: bundler.createImpl(option.bundlerOptions),
|
|
4369
|
-
stopWorkers: option.stopWorkers,
|
|
4370
|
-
shutdown: () => {
|
|
4371
|
-
shutdownAsyncRuntime();
|
|
4372
|
-
asyncRuntimeShutdown = true;
|
|
4373
|
-
}
|
|
4374
|
-
};
|
|
4375
|
-
} catch (e$2) {
|
|
4376
|
-
await option.stopWorkers?.();
|
|
4377
|
-
throw e$2;
|
|
4378
|
-
}
|
|
4379
|
-
}
|
|
4380
|
-
|
|
4381
4177
|
//#endregion
|
|
4382
4178
|
//#region src/utils/transform-hmr-patch-output.ts
|
|
4383
4179
|
function transformHmrPatchOutput(output) {
|
|
@@ -4393,10 +4189,11 @@ function handleHmrPatchOutputErrors(output) {
|
|
|
4393
4189
|
//#endregion
|
|
4394
4190
|
//#region src/api/rolldown/rolldown-build.ts
|
|
4395
4191
|
Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose");
|
|
4396
|
-
var RolldownBuild = class {
|
|
4192
|
+
var RolldownBuild = class RolldownBuild {
|
|
4397
4193
|
#inputOptions;
|
|
4398
4194
|
#bundler;
|
|
4399
4195
|
#bundlerImpl;
|
|
4196
|
+
static asyncRuntimeShutdown = false;
|
|
4400
4197
|
constructor(inputOptions) {
|
|
4401
4198
|
this.#inputOptions = inputOptions;
|
|
4402
4199
|
this.#bundler = new BindingBundler();
|
|
@@ -4406,7 +4203,26 @@ var RolldownBuild = class {
|
|
|
4406
4203
|
}
|
|
4407
4204
|
async #getBundlerWithStopWorker(outputOptions) {
|
|
4408
4205
|
if (this.#bundlerImpl) await this.#bundlerImpl.stopWorkers?.();
|
|
4409
|
-
|
|
4206
|
+
const option = await createBundlerOptions(this.#inputOptions, outputOptions, false);
|
|
4207
|
+
if (RolldownBuild.asyncRuntimeShutdown) startAsyncRuntime();
|
|
4208
|
+
try {
|
|
4209
|
+
return this.#bundlerImpl = {
|
|
4210
|
+
impl: this.#bundler.createImpl(option.bundlerOptions),
|
|
4211
|
+
stopWorkers: option.stopWorkers,
|
|
4212
|
+
shutdown: () => {
|
|
4213
|
+
shutdownAsyncRuntime();
|
|
4214
|
+
RolldownBuild.asyncRuntimeShutdown = true;
|
|
4215
|
+
}
|
|
4216
|
+
};
|
|
4217
|
+
} catch (e$2) {
|
|
4218
|
+
await option.stopWorkers?.();
|
|
4219
|
+
throw e$2;
|
|
4220
|
+
}
|
|
4221
|
+
}
|
|
4222
|
+
async scan() {
|
|
4223
|
+
const { impl } = await this.#getBundlerWithStopWorker({});
|
|
4224
|
+
const output = await impl.scan();
|
|
4225
|
+
return handleOutputErrors(output);
|
|
4410
4226
|
}
|
|
4411
4227
|
async generate(outputOptions = {}) {
|
|
4412
4228
|
validateOption("output", outputOptions);
|
|
@@ -4614,4 +4430,4 @@ function defineConfig(config) {
|
|
|
4614
4430
|
const VERSION = version;
|
|
4615
4431
|
|
|
4616
4432
|
//#endregion
|
|
4617
|
-
export { BuiltinPlugin, PluginContextData, PluginDriver,
|
|
4433
|
+
export { BuiltinPlugin, PluginContextData, PluginDriver, RolldownBuild, VERSION, ansis_default, bindingifyPlugin, build, createBundlerOptions, defineConfig, description$1 as description, getCliSchemaInfo, getInputCliKeys, getOutputCliKeys, makeBuiltinPluginCallable, normalizedStringOrRegex, onExit, rolldown, validateCliOptions, version, watch };
|