@rolldown/browser 1.0.0-beta.36 → 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 +127 -1304
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +3 -3
- package/dist/experimental-index.browser.mjs +541 -13
- package/dist/experimental-index.d.mts +50 -5
- package/dist/experimental-index.mjs +100 -14
- package/dist/filter-index.d.mts +2 -2
- package/dist/index.browser.mjs +1 -1
- package/dist/index.d.mts +3 -3
- 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.wasi-browser.js +1 -0
- package/dist/rolldown-binding.wasi.cjs +1 -0
- package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
- package/dist/shared/{binding-wK0CRIMb.d.mts → binding-D6vpD1fz.d.mts} +9 -24
- package/dist/shared/{define-config-BcNhk996.d.mts → define-config-D-OneP9q.d.mts} +11 -9
- package/dist/shared/{load-config-M8Gvqt1X.mjs → load-config-BGatf3rT.mjs} +2 -2
- package/dist/shared/logger-CiCY7ucm.mjs +988 -0
- package/dist/shared/{parse-ast-index-C3TkGcEQ.mjs → parse-ast-index-CR2E9ZQS.mjs} +2 -2
- package/dist/shared/{src-Dc4fRARy.mjs → src-E1KQKxjT.mjs} +441 -633
- package/dist/{src-Cl6h35QH.js → src-DE1CLQYz.js} +163 -234
- package/package.json +5 -6
- /package/dist/shared/{prompt-DuG2i9ud.mjs → prompt-D2FxOcB5.mjs} +0 -0
|
@@ -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,27 +31,229 @@ 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
|
|
41
250
|
//#region src/builtin-plugin/utils.ts
|
|
42
|
-
const BuiltinClassSymbol = Symbol.for("__RolldownBuiltinPlugin__");
|
|
43
251
|
var BuiltinPlugin = class {
|
|
44
252
|
constructor(name, _options) {
|
|
45
253
|
this.name = name;
|
|
46
254
|
this._options = _options;
|
|
47
|
-
this[BuiltinClassSymbol] = true;
|
|
48
255
|
}
|
|
49
256
|
};
|
|
50
|
-
function isBuiltinPlugin(obj) {
|
|
51
|
-
return obj && obj[BuiltinClassSymbol] === true;
|
|
52
|
-
}
|
|
53
|
-
function createBuiltinPlugin(name, options) {
|
|
54
|
-
return new BuiltinPlugin(name, options);
|
|
55
|
-
}
|
|
56
257
|
function makeBuiltinPluginCallable(plugin) {
|
|
57
258
|
let callablePlugin = new BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
|
|
58
259
|
const wrappedPlugin = plugin;
|
|
@@ -198,75 +399,6 @@ function normalizeHook(hook) {
|
|
|
198
399
|
unreachable("Invalid hook type");
|
|
199
400
|
}
|
|
200
401
|
|
|
201
|
-
//#endregion
|
|
202
|
-
//#region src/utils/normalize-string-or-regex.ts
|
|
203
|
-
function normalizedStringOrRegex(pattern) {
|
|
204
|
-
if (!pattern) return;
|
|
205
|
-
if (!isReadonlyArray(pattern)) return [pattern];
|
|
206
|
-
return pattern;
|
|
207
|
-
}
|
|
208
|
-
function isReadonlyArray(input) {
|
|
209
|
-
return Array.isArray(input);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
//#endregion
|
|
213
|
-
//#region src/builtin-plugin/constructors.ts
|
|
214
|
-
function modulePreloadPolyfillPlugin(config) {
|
|
215
|
-
return createBuiltinPlugin("builtin:module-preload-polyfill", config);
|
|
216
|
-
}
|
|
217
|
-
function dynamicImportVarsPlugin(config) {
|
|
218
|
-
if (config) {
|
|
219
|
-
config.include = normalizedStringOrRegex(config.include);
|
|
220
|
-
config.exclude = normalizedStringOrRegex(config.exclude);
|
|
221
|
-
}
|
|
222
|
-
return createBuiltinPlugin("builtin:dynamic-import-vars", config);
|
|
223
|
-
}
|
|
224
|
-
function importGlobPlugin(config) {
|
|
225
|
-
return createBuiltinPlugin("builtin:import-glob", config);
|
|
226
|
-
}
|
|
227
|
-
function reporterPlugin(config) {
|
|
228
|
-
return createBuiltinPlugin("builtin:reporter", config);
|
|
229
|
-
}
|
|
230
|
-
function manifestPlugin(config) {
|
|
231
|
-
return createBuiltinPlugin("builtin:manifest", config);
|
|
232
|
-
}
|
|
233
|
-
function wasmHelperPlugin(config) {
|
|
234
|
-
return createBuiltinPlugin("builtin:wasm-helper", config);
|
|
235
|
-
}
|
|
236
|
-
function wasmFallbackPlugin() {
|
|
237
|
-
const builtinPlugin = createBuiltinPlugin("builtin:wasm-fallback");
|
|
238
|
-
return makeBuiltinPluginCallable(builtinPlugin);
|
|
239
|
-
}
|
|
240
|
-
function loadFallbackPlugin() {
|
|
241
|
-
return createBuiltinPlugin("builtin:load-fallback");
|
|
242
|
-
}
|
|
243
|
-
function jsonPlugin(config) {
|
|
244
|
-
const builtinPlugin = createBuiltinPlugin("builtin:json", config);
|
|
245
|
-
return makeBuiltinPluginCallable(builtinPlugin);
|
|
246
|
-
}
|
|
247
|
-
function buildImportAnalysisPlugin(config) {
|
|
248
|
-
return createBuiltinPlugin("builtin:build-import-analysis", config);
|
|
249
|
-
}
|
|
250
|
-
function viteResolvePlugin(config) {
|
|
251
|
-
const builtinPlugin = createBuiltinPlugin("builtin:vite-resolve", config);
|
|
252
|
-
return makeBuiltinPluginCallable(builtinPlugin);
|
|
253
|
-
}
|
|
254
|
-
function isolatedDeclarationPlugin(config) {
|
|
255
|
-
return createBuiltinPlugin("builtin:isolated-declaration", config);
|
|
256
|
-
}
|
|
257
|
-
function assetPlugin(config) {
|
|
258
|
-
return createBuiltinPlugin("builtin:asset", config);
|
|
259
|
-
}
|
|
260
|
-
function webWorkerPostPlugin() {
|
|
261
|
-
return createBuiltinPlugin("builtin:web-worker-post");
|
|
262
|
-
}
|
|
263
|
-
function oxcRuntimePlugin(config) {
|
|
264
|
-
return createBuiltinPlugin("builtin:oxc-runtime", config);
|
|
265
|
-
}
|
|
266
|
-
function esmExternalRequirePlugin(config) {
|
|
267
|
-
return createBuiltinPlugin("builtin:esm-external-require", config);
|
|
268
|
-
}
|
|
269
|
-
|
|
270
402
|
//#endregion
|
|
271
403
|
//#region src/constants/plugin.ts
|
|
272
404
|
const ENUMERATED_INPUT_PLUGIN_HOOK_NAMES = [
|
|
@@ -358,14 +490,13 @@ function checkOutputPluginOption(plugins, onLog) {
|
|
|
358
490
|
function normalizePlugins(plugins, anonymousPrefix) {
|
|
359
491
|
for (const [index, plugin] of plugins.entries()) {
|
|
360
492
|
if ("_parallel" in plugin) continue;
|
|
361
|
-
if (
|
|
493
|
+
if (plugin instanceof BuiltinPlugin) continue;
|
|
362
494
|
if (!plugin.name) plugin.name = `${anonymousPrefix}${index + 1}`;
|
|
363
495
|
}
|
|
364
496
|
return plugins;
|
|
365
497
|
}
|
|
366
498
|
const ANONYMOUS_PLUGIN_PREFIX = "at position ";
|
|
367
499
|
const ANONYMOUS_OUTPUT_PLUGIN_PREFIX = "at output position ";
|
|
368
|
-
const BUILTIN_PLUGINS = [oxcRuntimePlugin({ resolveBase: fileURLToPath(import.meta.url) })];
|
|
369
500
|
|
|
370
501
|
//#endregion
|
|
371
502
|
//#region src/plugin/minimal-plugin-context.ts
|
|
@@ -427,7 +558,7 @@ function getObjectPlugins(plugins) {
|
|
|
427
558
|
return plugins.filter((plugin) => {
|
|
428
559
|
if (!plugin) return;
|
|
429
560
|
if ("_parallel" in plugin) return;
|
|
430
|
-
if (
|
|
561
|
+
if (plugin instanceof BuiltinPlugin) return;
|
|
431
562
|
return plugin;
|
|
432
563
|
});
|
|
433
564
|
}
|
|
@@ -458,16 +589,127 @@ function getSortedPlugins(hookName, plugins) {
|
|
|
458
589
|
];
|
|
459
590
|
}
|
|
460
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
|
+
|
|
461
703
|
//#endregion
|
|
462
704
|
//#region ../../node_modules/.pnpm/valibot@1.1.0_typescript@5.9.2/node_modules/valibot/dist/index.js
|
|
463
|
-
var store
|
|
705
|
+
var store;
|
|
464
706
|
/* @__NO_SIDE_EFFECTS__ */
|
|
465
707
|
function getGlobalConfig(config2) {
|
|
466
708
|
return {
|
|
467
|
-
lang: config2?.lang ?? store
|
|
709
|
+
lang: config2?.lang ?? store?.lang,
|
|
468
710
|
message: config2?.message,
|
|
469
|
-
abortEarly: config2?.abortEarly ?? store
|
|
470
|
-
abortPipeEarly: config2?.abortPipeEarly ?? store
|
|
711
|
+
abortEarly: config2?.abortEarly ?? store?.abortEarly,
|
|
712
|
+
abortPipeEarly: config2?.abortPipeEarly ?? store?.abortPipeEarly
|
|
471
713
|
};
|
|
472
714
|
}
|
|
473
715
|
var store2;
|
|
@@ -1448,508 +1690,70 @@ function safeParse(schema, input, config2) {
|
|
|
1448
1690
|
}
|
|
1449
1691
|
|
|
1450
1692
|
//#endregion
|
|
1451
|
-
//#region
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
if (
|
|
1462
|
-
|
|
1463
|
-
return
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
}
|
|
1467
|
-
/**
|
|
1468
|
-
* Throws an error or logs a warning based on the configuration.
|
|
1469
|
-
*
|
|
1470
|
-
* @param message The message to throw or log.
|
|
1471
|
-
* @param config The conversion configuration.
|
|
1472
|
-
*/
|
|
1473
|
-
function handleError(message, config) {
|
|
1474
|
-
switch (config?.errorMode) {
|
|
1475
|
-
case "ignore": break;
|
|
1476
|
-
case "warn":
|
|
1477
|
-
console.warn(message);
|
|
1478
|
-
break;
|
|
1479
|
-
default: throw new Error(message);
|
|
1480
|
-
}
|
|
1481
|
-
}
|
|
1482
|
-
/**
|
|
1483
|
-
* Converts any supported Valibot action to the JSON Schema format.
|
|
1484
|
-
*
|
|
1485
|
-
* @param jsonSchema The JSON Schema object.
|
|
1486
|
-
* @param valibotAction The Valibot action object.
|
|
1487
|
-
* @param config The conversion configuration.
|
|
1488
|
-
*
|
|
1489
|
-
* @returns The converted JSON Schema.
|
|
1490
|
-
*/
|
|
1491
|
-
function convertAction(jsonSchema, valibotAction, config) {
|
|
1492
|
-
if (config?.ignoreActions?.includes(valibotAction.type)) return jsonSchema;
|
|
1493
|
-
let errors;
|
|
1494
|
-
switch (valibotAction.type) {
|
|
1495
|
-
case "base64":
|
|
1496
|
-
jsonSchema.contentEncoding = "base64";
|
|
1497
|
-
break;
|
|
1498
|
-
case "bic":
|
|
1499
|
-
case "cuid2":
|
|
1500
|
-
case "decimal":
|
|
1501
|
-
case "digits":
|
|
1502
|
-
case "emoji":
|
|
1503
|
-
case "hexadecimal":
|
|
1504
|
-
case "hex_color":
|
|
1505
|
-
case "nanoid":
|
|
1506
|
-
case "octal":
|
|
1507
|
-
case "ulid":
|
|
1508
|
-
jsonSchema.pattern = valibotAction.requirement.source;
|
|
1509
|
-
break;
|
|
1510
|
-
case "description":
|
|
1511
|
-
jsonSchema.description = valibotAction.description;
|
|
1512
|
-
break;
|
|
1513
|
-
case "email":
|
|
1514
|
-
jsonSchema.format = "email";
|
|
1515
|
-
break;
|
|
1516
|
-
case "empty":
|
|
1517
|
-
if (jsonSchema.type === "array") jsonSchema.maxItems = 0;
|
|
1518
|
-
else {
|
|
1519
|
-
if (jsonSchema.type !== "string") errors = addError(errors, `The "${valibotAction.type}" action is not supported on type "${jsonSchema.type}".`);
|
|
1520
|
-
jsonSchema.maxLength = 0;
|
|
1521
|
-
}
|
|
1522
|
-
break;
|
|
1523
|
-
case "entries":
|
|
1524
|
-
jsonSchema.minProperties = valibotAction.requirement;
|
|
1525
|
-
jsonSchema.maxProperties = valibotAction.requirement;
|
|
1526
|
-
break;
|
|
1527
|
-
case "integer":
|
|
1528
|
-
jsonSchema.type = "integer";
|
|
1529
|
-
break;
|
|
1530
|
-
case "ipv4":
|
|
1531
|
-
jsonSchema.format = "ipv4";
|
|
1532
|
-
break;
|
|
1533
|
-
case "ipv6":
|
|
1534
|
-
jsonSchema.format = "ipv6";
|
|
1535
|
-
break;
|
|
1536
|
-
case "iso_date":
|
|
1537
|
-
jsonSchema.format = "date";
|
|
1538
|
-
break;
|
|
1539
|
-
case "iso_date_time":
|
|
1540
|
-
case "iso_timestamp":
|
|
1541
|
-
jsonSchema.format = "date-time";
|
|
1542
|
-
break;
|
|
1543
|
-
case "iso_time":
|
|
1544
|
-
jsonSchema.format = "time";
|
|
1545
|
-
break;
|
|
1546
|
-
case "length":
|
|
1547
|
-
if (jsonSchema.type === "array") {
|
|
1548
|
-
jsonSchema.minItems = valibotAction.requirement;
|
|
1549
|
-
jsonSchema.maxItems = valibotAction.requirement;
|
|
1550
|
-
} else {
|
|
1551
|
-
if (jsonSchema.type !== "string") errors = addError(errors, `The "${valibotAction.type}" action is not supported on type "${jsonSchema.type}".`);
|
|
1552
|
-
jsonSchema.minLength = valibotAction.requirement;
|
|
1553
|
-
jsonSchema.maxLength = valibotAction.requirement;
|
|
1554
|
-
}
|
|
1555
|
-
break;
|
|
1556
|
-
case "max_entries":
|
|
1557
|
-
jsonSchema.maxProperties = valibotAction.requirement;
|
|
1558
|
-
break;
|
|
1559
|
-
case "max_length":
|
|
1560
|
-
if (jsonSchema.type === "array") jsonSchema.maxItems = valibotAction.requirement;
|
|
1561
|
-
else {
|
|
1562
|
-
if (jsonSchema.type !== "string") errors = addError(errors, `The "${valibotAction.type}" action is not supported on type "${jsonSchema.type}".`);
|
|
1563
|
-
jsonSchema.maxLength = valibotAction.requirement;
|
|
1564
|
-
}
|
|
1565
|
-
break;
|
|
1566
|
-
case "max_value":
|
|
1567
|
-
if (jsonSchema.type !== "number") errors = addError(errors, `The "max_value" action is not supported on type "${jsonSchema.type}".`);
|
|
1568
|
-
jsonSchema.maximum = valibotAction.requirement;
|
|
1569
|
-
break;
|
|
1570
|
-
case "metadata":
|
|
1571
|
-
if (typeof valibotAction.metadata.title === "string") jsonSchema.title = valibotAction.metadata.title;
|
|
1572
|
-
if (typeof valibotAction.metadata.description === "string") jsonSchema.description = valibotAction.metadata.description;
|
|
1573
|
-
if (Array.isArray(valibotAction.metadata.examples)) jsonSchema.examples = valibotAction.metadata.examples;
|
|
1574
|
-
break;
|
|
1575
|
-
case "min_entries":
|
|
1576
|
-
jsonSchema.minProperties = valibotAction.requirement;
|
|
1577
|
-
break;
|
|
1578
|
-
case "min_length":
|
|
1579
|
-
if (jsonSchema.type === "array") jsonSchema.minItems = valibotAction.requirement;
|
|
1580
|
-
else {
|
|
1581
|
-
if (jsonSchema.type !== "string") errors = addError(errors, `The "${valibotAction.type}" action is not supported on type "${jsonSchema.type}".`);
|
|
1582
|
-
jsonSchema.minLength = valibotAction.requirement;
|
|
1583
|
-
}
|
|
1584
|
-
break;
|
|
1585
|
-
case "min_value":
|
|
1586
|
-
if (jsonSchema.type !== "number") errors = addError(errors, `The "min_value" action is not supported on type "${jsonSchema.type}".`);
|
|
1587
|
-
jsonSchema.minimum = valibotAction.requirement;
|
|
1588
|
-
break;
|
|
1589
|
-
case "multiple_of":
|
|
1590
|
-
jsonSchema.multipleOf = valibotAction.requirement;
|
|
1591
|
-
break;
|
|
1592
|
-
case "non_empty":
|
|
1593
|
-
if (jsonSchema.type === "array") jsonSchema.minItems = 1;
|
|
1594
|
-
else {
|
|
1595
|
-
if (jsonSchema.type !== "string") errors = addError(errors, `The "${valibotAction.type}" action is not supported on type "${jsonSchema.type}".`);
|
|
1596
|
-
jsonSchema.minLength = 1;
|
|
1597
|
-
}
|
|
1598
|
-
break;
|
|
1599
|
-
case "regex":
|
|
1600
|
-
if (valibotAction.requirement.flags) errors = addError(errors, "RegExp flags are not supported by JSON Schema.");
|
|
1601
|
-
jsonSchema.pattern = valibotAction.requirement.source;
|
|
1602
|
-
break;
|
|
1603
|
-
case "title":
|
|
1604
|
-
jsonSchema.title = valibotAction.title;
|
|
1605
|
-
break;
|
|
1606
|
-
case "url":
|
|
1607
|
-
jsonSchema.format = "uri";
|
|
1608
|
-
break;
|
|
1609
|
-
case "uuid":
|
|
1610
|
-
jsonSchema.format = "uuid";
|
|
1611
|
-
break;
|
|
1612
|
-
case "value":
|
|
1613
|
-
jsonSchema.const = valibotAction.requirement;
|
|
1614
|
-
break;
|
|
1615
|
-
default: errors = addError(errors, `The "${valibotAction.type}" action cannot be converted to JSON Schema.`);
|
|
1616
|
-
}
|
|
1617
|
-
if (config?.overrideAction) {
|
|
1618
|
-
const actionOverride = config.overrideAction({
|
|
1619
|
-
valibotAction,
|
|
1620
|
-
jsonSchema,
|
|
1621
|
-
errors
|
|
1622
|
-
});
|
|
1623
|
-
if (actionOverride) return { ...actionOverride };
|
|
1624
|
-
}
|
|
1625
|
-
if (errors) for (const message of errors) handleError(message, config);
|
|
1626
|
-
return jsonSchema;
|
|
1627
|
-
}
|
|
1628
|
-
/**
|
|
1629
|
-
* Flattens a Valibot pipe by recursively expanding nested pipes.
|
|
1630
|
-
*
|
|
1631
|
-
* @param pipe The pipeline to flatten.
|
|
1632
|
-
*
|
|
1633
|
-
* @returns A flat pipeline.
|
|
1634
|
-
*/
|
|
1635
|
-
function flattenPipe(pipe$1) {
|
|
1636
|
-
return pipe$1.flatMap((item) => "pipe" in item ? flattenPipe(item.pipe) : item);
|
|
1637
|
-
}
|
|
1638
|
-
let refCount = 0;
|
|
1639
|
-
/**
|
|
1640
|
-
* Converts any supported Valibot schema to the JSON Schema format.
|
|
1641
|
-
*
|
|
1642
|
-
* @param jsonSchema The JSON Schema object.
|
|
1643
|
-
* @param valibotSchema The Valibot schema object.
|
|
1644
|
-
* @param config The conversion configuration.
|
|
1645
|
-
* @param context The conversion context.
|
|
1646
|
-
* @param skipRef Whether to skip using a reference.
|
|
1647
|
-
*
|
|
1648
|
-
* @returns The converted JSON Schema.
|
|
1649
|
-
*/
|
|
1650
|
-
function convertSchema(jsonSchema, valibotSchema, config, context, skipRef = false) {
|
|
1651
|
-
if (!skipRef) {
|
|
1652
|
-
const referenceId = context.referenceMap.get(valibotSchema);
|
|
1653
|
-
if (referenceId) {
|
|
1654
|
-
jsonSchema.$ref = `#/$defs/${referenceId}`;
|
|
1655
|
-
if (config?.overrideRef) {
|
|
1656
|
-
const refOverride = config.overrideRef({
|
|
1657
|
-
...context,
|
|
1658
|
-
referenceId,
|
|
1659
|
-
valibotSchema,
|
|
1660
|
-
jsonSchema
|
|
1661
|
-
});
|
|
1662
|
-
if (refOverride) jsonSchema.$ref = refOverride;
|
|
1663
|
-
}
|
|
1664
|
-
return jsonSchema;
|
|
1665
|
-
}
|
|
1666
|
-
}
|
|
1667
|
-
if ("pipe" in valibotSchema) {
|
|
1668
|
-
const flatPipe = flattenPipe(valibotSchema.pipe);
|
|
1669
|
-
let startIndex = 0;
|
|
1670
|
-
let stopIndex = flatPipe.length - 1;
|
|
1671
|
-
if (config?.typeMode === "input") {
|
|
1672
|
-
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"));
|
|
1673
|
-
if (inputStopIndex !== -1) stopIndex = inputStopIndex;
|
|
1674
|
-
} else if (config?.typeMode === "output") {
|
|
1675
|
-
const outputStartIndex = flatPipe.findLastIndex((item) => item.kind === "schema");
|
|
1676
|
-
if (outputStartIndex !== -1) startIndex = outputStartIndex;
|
|
1677
|
-
}
|
|
1678
|
-
for (let index = startIndex; index <= stopIndex; index++) {
|
|
1679
|
-
const valibotPipeItem = flatPipe[index];
|
|
1680
|
-
if (valibotPipeItem.kind === "schema") {
|
|
1681
|
-
if (index > startIndex) handleError("Set the \"typeMode\" config to \"input\" or \"output\" to convert pipelines with multiple schemas.", config);
|
|
1682
|
-
jsonSchema = convertSchema(jsonSchema, valibotPipeItem, config, context, true);
|
|
1683
|
-
} else jsonSchema = convertAction(jsonSchema, valibotPipeItem, config);
|
|
1684
|
-
}
|
|
1685
|
-
return jsonSchema;
|
|
1686
|
-
}
|
|
1687
|
-
let errors;
|
|
1688
|
-
switch (valibotSchema.type) {
|
|
1689
|
-
case "boolean":
|
|
1690
|
-
jsonSchema.type = "boolean";
|
|
1691
|
-
break;
|
|
1692
|
-
case "null":
|
|
1693
|
-
jsonSchema.type = "null";
|
|
1694
|
-
break;
|
|
1695
|
-
case "number":
|
|
1696
|
-
jsonSchema.type = "number";
|
|
1697
|
-
break;
|
|
1698
|
-
case "string":
|
|
1699
|
-
jsonSchema.type = "string";
|
|
1700
|
-
break;
|
|
1701
|
-
case "array":
|
|
1702
|
-
jsonSchema.type = "array";
|
|
1703
|
-
jsonSchema.items = convertSchema({}, valibotSchema.item, config, context);
|
|
1704
|
-
break;
|
|
1705
|
-
case "tuple":
|
|
1706
|
-
case "tuple_with_rest":
|
|
1707
|
-
case "loose_tuple":
|
|
1708
|
-
case "strict_tuple":
|
|
1709
|
-
jsonSchema.type = "array";
|
|
1710
|
-
jsonSchema.items = [];
|
|
1711
|
-
jsonSchema.minItems = valibotSchema.items.length;
|
|
1712
|
-
for (const item of valibotSchema.items) jsonSchema.items.push(convertSchema({}, item, config, context));
|
|
1713
|
-
if (valibotSchema.type === "tuple_with_rest") jsonSchema.additionalItems = convertSchema({}, valibotSchema.rest, config, context);
|
|
1714
|
-
else if (valibotSchema.type === "strict_tuple") jsonSchema.additionalItems = false;
|
|
1715
|
-
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";
|
|
1716
1708
|
case "object":
|
|
1717
|
-
case "object_with_rest":
|
|
1718
|
-
case "loose_object":
|
|
1719
1709
|
case "strict_object":
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
case "
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
if (
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
case "variant":
|
|
1763
|
-
jsonSchema.anyOf = valibotSchema.options.map((option) => convertSchema({}, option, config, context));
|
|
1764
|
-
break;
|
|
1765
|
-
case "intersect":
|
|
1766
|
-
jsonSchema.allOf = valibotSchema.options.map((option) => convertSchema({}, option, config, context));
|
|
1767
|
-
break;
|
|
1768
|
-
case "lazy": {
|
|
1769
|
-
let wrappedValibotSchema = context.getterMap.get(valibotSchema.getter);
|
|
1770
|
-
if (!wrappedValibotSchema) {
|
|
1771
|
-
wrappedValibotSchema = valibotSchema.getter(void 0);
|
|
1772
|
-
context.getterMap.set(valibotSchema.getter, wrappedValibotSchema);
|
|
1773
|
-
}
|
|
1774
|
-
let referenceId = context.referenceMap.get(wrappedValibotSchema);
|
|
1775
|
-
if (!referenceId) {
|
|
1776
|
-
referenceId = `${refCount++}`;
|
|
1777
|
-
context.referenceMap.set(wrappedValibotSchema, referenceId);
|
|
1778
|
-
context.definitions[referenceId] = convertSchema({}, wrappedValibotSchema, config, context, true);
|
|
1779
|
-
}
|
|
1780
|
-
jsonSchema.$ref = `#/$defs/${referenceId}`;
|
|
1781
|
-
if (config?.overrideRef) {
|
|
1782
|
-
const refOverride = config.overrideRef({
|
|
1783
|
-
...context,
|
|
1784
|
-
referenceId,
|
|
1785
|
-
valibotSchema: wrappedValibotSchema,
|
|
1786
|
-
jsonSchema
|
|
1787
|
-
});
|
|
1788
|
-
if (refOverride) jsonSchema.$ref = refOverride;
|
|
1789
|
-
}
|
|
1790
|
-
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
|
+
};
|
|
1791
1752
|
}
|
|
1792
|
-
default: errors = addError(errors, `The "${valibotSchema.type}" schema cannot be converted to JSON Schema.`);
|
|
1793
|
-
}
|
|
1794
|
-
if (config?.overrideSchema) {
|
|
1795
|
-
const schemaOverride = config.overrideSchema({
|
|
1796
|
-
...context,
|
|
1797
|
-
referenceId: context.referenceMap.get(valibotSchema),
|
|
1798
|
-
valibotSchema,
|
|
1799
|
-
jsonSchema,
|
|
1800
|
-
errors
|
|
1801
|
-
});
|
|
1802
|
-
if (schemaOverride) return { ...schemaOverride };
|
|
1803
1753
|
}
|
|
1804
|
-
|
|
1805
|
-
return jsonSchema;
|
|
1806
|
-
}
|
|
1807
|
-
let store;
|
|
1808
|
-
/**
|
|
1809
|
-
* Returns the current global schema definitions.
|
|
1810
|
-
*
|
|
1811
|
-
* @returns The schema definitions.
|
|
1812
|
-
*
|
|
1813
|
-
* @beta
|
|
1814
|
-
*/
|
|
1815
|
-
function getGlobalDefs() {
|
|
1816
|
-
return store;
|
|
1817
|
-
}
|
|
1818
|
-
/**
|
|
1819
|
-
* Converts a Valibot schema to the JSON Schema format.
|
|
1820
|
-
*
|
|
1821
|
-
* @param schema The Valibot schema object.
|
|
1822
|
-
* @param config The JSON Schema configuration.
|
|
1823
|
-
*
|
|
1824
|
-
* @returns The converted JSON Schema.
|
|
1825
|
-
*/
|
|
1826
|
-
function toJsonSchema(schema, config) {
|
|
1827
|
-
const context = {
|
|
1828
|
-
definitions: {},
|
|
1829
|
-
referenceMap: /* @__PURE__ */ new Map(),
|
|
1830
|
-
getterMap: /* @__PURE__ */ new Map()
|
|
1831
|
-
};
|
|
1832
|
-
const definitions = config?.definitions ?? getGlobalDefs();
|
|
1833
|
-
if (definitions) {
|
|
1834
|
-
for (const key in definitions) context.referenceMap.set(definitions[key], key);
|
|
1835
|
-
for (const key in definitions) context.definitions[key] = convertSchema({}, definitions[key], config, context, true);
|
|
1836
|
-
}
|
|
1837
|
-
const jsonSchema = convertSchema({ $schema: "http://json-schema.org/draft-07/schema#" }, schema, config, context);
|
|
1838
|
-
if (context.referenceMap.size) jsonSchema.$defs = context.definitions;
|
|
1839
|
-
return jsonSchema;
|
|
1754
|
+
return result;
|
|
1840
1755
|
}
|
|
1841
1756
|
|
|
1842
|
-
//#endregion
|
|
1843
|
-
//#region ../../node_modules/.pnpm/ansis@4.1.0/node_modules/ansis/index.cjs
|
|
1844
|
-
var require_ansis = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ansis@4.1.0/node_modules/ansis/index.cjs": ((exports, module) => {
|
|
1845
|
-
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) => {
|
|
1846
|
-
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);
|
|
1847
|
-
return [
|
|
1848
|
-
n$2 >> 16 & 255,
|
|
1849
|
-
n$2 >> 8 & 255,
|
|
1850
|
-
255 & n$2
|
|
1851
|
-
];
|
|
1852
|
-
}, 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) => {
|
|
1853
|
-
let t$3, r$1, n$2, l$1, o$1;
|
|
1854
|
-
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);
|
|
1855
|
-
}, g = (() => {
|
|
1856
|
-
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;
|
|
1857
|
-
try {
|
|
1858
|
-
e$1 = "," + s(i$1).join(",");
|
|
1859
|
-
} catch (e$2) {
|
|
1860
|
-
i$1 = {}, c$1 = 0;
|
|
1861
|
-
}
|
|
1862
|
-
let a$2 = "FORCE_COLOR", p$1 = {
|
|
1863
|
-
false: 0,
|
|
1864
|
-
0: 0,
|
|
1865
|
-
1: 1,
|
|
1866
|
-
2: 2,
|
|
1867
|
-
3: 3
|
|
1868
|
-
}[i$1[a$2]] ?? -1, u$1 = a$2 in i$1 && p$1 || r$1(/^--color=?(true|always)?$/);
|
|
1869
|
-
return u$1 && (c$1 = p$1), ~c$1 || (c$1 = ((r$2, n$3, l$2) => (t$2 = r$2.TERM, {
|
|
1870
|
-
"24bit": 3,
|
|
1871
|
-
truecolor: 3,
|
|
1872
|
-
ansi256: 2,
|
|
1873
|
-
ansi: 1
|
|
1874
|
-
}[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;
|
|
1875
|
-
})(), f = {
|
|
1876
|
-
open: i,
|
|
1877
|
-
close: i
|
|
1878
|
-
}, h = 39, b = 49, O = {}, m = ({ p: e$2 }, { open: t$3, close: n$2 }) => {
|
|
1879
|
-
let o$1 = (e$3, ...r$1) => {
|
|
1880
|
-
if (!e$3) {
|
|
1881
|
-
if (t$3 && t$3 === n$2) return t$3;
|
|
1882
|
-
if ((e$3 ?? i) === i) return i;
|
|
1883
|
-
}
|
|
1884
|
-
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;
|
|
1885
|
-
if (s$2.includes("\x1B")) for (; c$2; c$2 = c$2.p) {
|
|
1886
|
-
let { open: e$4, close: t$4 } = c$2, r$2 = t$4.length, n$3 = i, o$2 = 0;
|
|
1887
|
-
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;
|
|
1888
|
-
s$2 = n$3 + s$2.slice(o$2);
|
|
1889
|
-
}
|
|
1890
|
-
return a$2 + (s$2.includes("\n") ? s$2.replace(/(\r?\n)/g, p$1 + "$1" + a$2) : s$2) + p$1;
|
|
1891
|
-
}, s$1 = t$3, c$1 = n$2;
|
|
1892
|
-
return e$2 && (s$1 = e$2.o + t$3, c$1 = n$2 + e$2.c), l(o$1, r), o$1.p = {
|
|
1893
|
-
open: t$3,
|
|
1894
|
-
close: n$2,
|
|
1895
|
-
o: s$1,
|
|
1896
|
-
c: c$1,
|
|
1897
|
-
p: e$2
|
|
1898
|
-
}, o$1.open = s$1, o$1.close = c$1, o$1;
|
|
1899
|
-
};
|
|
1900
|
-
const w = function(e$2 = g) {
|
|
1901
|
-
let t$3 = {
|
|
1902
|
-
Ansis: w,
|
|
1903
|
-
level: e$2,
|
|
1904
|
-
isSupported: () => s$1,
|
|
1905
|
-
strip: (e$3) => e$3.replace(/[][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, i),
|
|
1906
|
-
extend(e$3) {
|
|
1907
|
-
for (let t$4 in e$3) {
|
|
1908
|
-
let r$1 = e$3[t$4], l$1 = (typeof r$1)[0], o$1 = "s" === l$1 ? x(...p(r$1)) : r$1;
|
|
1909
|
-
O[t$4] = "f" === l$1 ? { get() {
|
|
1910
|
-
return (...e$4) => m(this, r$1(...e$4));
|
|
1911
|
-
} } : { get() {
|
|
1912
|
-
let e$4 = m(this, o$1);
|
|
1913
|
-
return n$1(this, t$4, { value: e$4 }), e$4;
|
|
1914
|
-
} };
|
|
1915
|
-
}
|
|
1916
|
-
return r = o({}, O), l(t$3, r), t$3;
|
|
1917
|
-
}
|
|
1918
|
-
}, s$1 = e$2 > 0, c$1 = (e$3, t$4) => s$1 ? {
|
|
1919
|
-
open: `[${e$3}m`,
|
|
1920
|
-
close: `[${t$4}m`
|
|
1921
|
-
} : 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);
|
|
1922
|
-
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));
|
|
1923
|
-
let E, M = {
|
|
1924
|
-
fg: v,
|
|
1925
|
-
bg: C,
|
|
1926
|
-
rgb: x,
|
|
1927
|
-
bgRgb: T,
|
|
1928
|
-
hex: a$2(x),
|
|
1929
|
-
bgHex: a$2(T),
|
|
1930
|
-
visible: f,
|
|
1931
|
-
reset: c$1(0, 0),
|
|
1932
|
-
bold: c$1(1, 22),
|
|
1933
|
-
dim: c$1(2, 22),
|
|
1934
|
-
italic: c$1(3, 23),
|
|
1935
|
-
underline: c$1(4, 24),
|
|
1936
|
-
inverse: c$1(7, 27),
|
|
1937
|
-
hidden: c$1(8, 28),
|
|
1938
|
-
strikethrough: c$1(9, 29)
|
|
1939
|
-
}, I = "Bright";
|
|
1940
|
-
return "black,red,green,yellow,blue,magenta,cyan,white,gray".split(",").map(((e$3, t$4) => {
|
|
1941
|
-
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);
|
|
1942
|
-
})), t$3.extend(M);
|
|
1943
|
-
}, y = new w();
|
|
1944
|
-
module.exports = y, y.default = y;
|
|
1945
|
-
}) });
|
|
1946
|
-
|
|
1947
|
-
//#endregion
|
|
1948
|
-
//#region ../../node_modules/.pnpm/ansis@4.1.0/node_modules/ansis/index.mjs
|
|
1949
|
-
var import_ansis = /* @__PURE__ */ __toESM(require_ansis(), 1);
|
|
1950
|
-
var ansis_default = import_ansis.default;
|
|
1951
|
-
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;
|
|
1952
|
-
|
|
1953
1757
|
//#endregion
|
|
1954
1758
|
//#region src/utils/validator.ts
|
|
1955
1759
|
const StringOrRegExpSchema = union([string(), instance(RegExp)]);
|
|
@@ -1996,7 +1800,7 @@ const JsxOptionsSchema = strictObject({
|
|
|
1996
1800
|
throwIfNamespace: pipe(optional(string()), description("Toggles whether to throw an error when a tag name uses an XML namespace")),
|
|
1997
1801
|
importSource: pipe(optional(string()), description("Import the factory of element and fragment if mode is classic")),
|
|
1998
1802
|
pragma: pipe(optional(string()), description("Jsx element transformation")),
|
|
1999
|
-
|
|
1803
|
+
pragmaFrag: pipe(optional(string()), description("Jsx fragment transformation")),
|
|
2000
1804
|
refresh: pipe(optional(boolean()), description("Enable react fast refresh"))
|
|
2001
1805
|
});
|
|
2002
1806
|
const RollupJsxOptionsSchema = strictObject({
|
|
@@ -2115,7 +1919,11 @@ const MinifyOptionsSchema = strictObject({
|
|
|
2115
1919
|
codegen: optional(union([boolean(), CodegenOptionsSchema]))
|
|
2116
1920
|
});
|
|
2117
1921
|
const ResolveOptionsSchema = strictObject({
|
|
2118
|
-
alias: optional(record(string(), union([
|
|
1922
|
+
alias: optional(record(string(), union([
|
|
1923
|
+
literal(false),
|
|
1924
|
+
string(),
|
|
1925
|
+
array(string())
|
|
1926
|
+
]))),
|
|
2119
1927
|
aliasFields: optional(array(array(string()))),
|
|
2120
1928
|
conditionNames: optional(array(string())),
|
|
2121
1929
|
extensionAlias: optional(record(string(), array(string()))),
|
|
@@ -2233,7 +2041,7 @@ const InputCliOverrideSchema = strictObject({
|
|
|
2233
2041
|
literal("react-jsx"),
|
|
2234
2042
|
literal("preserve")
|
|
2235
2043
|
])), description("Jsx options preset")),
|
|
2236
|
-
preserveEntrySignatures: pipe(optional(
|
|
2044
|
+
preserveEntrySignatures: pipe(optional(literal(false)), description("Avoid facade chunks for entry points")),
|
|
2237
2045
|
context: pipe(optional(string()), description("The entity top-level `this` represents."))
|
|
2238
2046
|
});
|
|
2239
2047
|
const InputCliOptionsSchema = omit(strictObject({
|
|
@@ -2423,8 +2231,8 @@ function getInputCliKeys() {
|
|
|
2423
2231
|
function getOutputCliKeys() {
|
|
2424
2232
|
return keyof(OutputCliOptionsSchema).options;
|
|
2425
2233
|
}
|
|
2426
|
-
function
|
|
2427
|
-
return
|
|
2234
|
+
function getCliSchemaInfo() {
|
|
2235
|
+
return flattenValibotSchema(CliOptionsSchema);
|
|
2428
2236
|
}
|
|
2429
2237
|
|
|
2430
2238
|
//#endregion
|
|
@@ -2534,7 +2342,7 @@ function normalizeTransformHookSourcemap(id$1, originalCode, rawMap) {
|
|
|
2534
2342
|
}
|
|
2535
2343
|
|
|
2536
2344
|
//#endregion
|
|
2537
|
-
//#region ../../node_modules/.pnpm/remeda@2.
|
|
2345
|
+
//#region ../../node_modules/.pnpm/remeda@2.31.1/node_modules/remeda/dist/lazyDataLastImpl-BDhrIOwR.js
|
|
2538
2346
|
function e(e$2, t$3, n$2) {
|
|
2539
2347
|
let r$1 = (n$3) => e$2(n$3, ...t$3);
|
|
2540
2348
|
return n$2 === void 0 ? r$1 : Object.assign(r$1, {
|
|
@@ -2544,7 +2352,7 @@ function e(e$2, t$3, n$2) {
|
|
|
2544
2352
|
}
|
|
2545
2353
|
|
|
2546
2354
|
//#endregion
|
|
2547
|
-
//#region ../../node_modules/.pnpm/remeda@2.
|
|
2355
|
+
//#region ../../node_modules/.pnpm/remeda@2.31.1/node_modules/remeda/dist/purry-DH9cw9sy.js
|
|
2548
2356
|
function t(t$3, n$2, r$1) {
|
|
2549
2357
|
let i$1 = t$3.length - n$2.length;
|
|
2550
2358
|
if (i$1 === 0) return t$3(...n$2);
|
|
@@ -2553,7 +2361,7 @@ function t(t$3, n$2, r$1) {
|
|
|
2553
2361
|
}
|
|
2554
2362
|
|
|
2555
2363
|
//#endregion
|
|
2556
|
-
//#region ../../node_modules/.pnpm/remeda@2.
|
|
2364
|
+
//#region ../../node_modules/.pnpm/remeda@2.31.1/node_modules/remeda/dist/partition-DAu403JQ.js
|
|
2557
2365
|
function t$1(...t$3) {
|
|
2558
2366
|
return t(n, t$3);
|
|
2559
2367
|
}
|
|
@@ -3517,7 +3325,7 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
|
|
|
3517
3325
|
const { plugin: buildEnd, meta: buildEndMeta } = bindingifyBuildEnd(args$1);
|
|
3518
3326
|
const { plugin: transform, meta: transformMeta, filter: transformFilter } = bindingifyTransform(args$1);
|
|
3519
3327
|
const { plugin: moduleParsed, meta: moduleParsedMeta } = bindingifyModuleParsed(args$1);
|
|
3520
|
-
const { plugin: load, meta: loadMeta, filter: loadFilter } = bindingifyLoad(args$1);
|
|
3328
|
+
const { plugin: load$1, meta: loadMeta, filter: loadFilter } = bindingifyLoad(args$1);
|
|
3521
3329
|
const { plugin: renderChunk, meta: renderChunkMeta, filter: renderChunkFilter } = bindingifyRenderChunk(args$1);
|
|
3522
3330
|
const { plugin: augmentChunkHash, meta: augmentChunkHashMeta } = bindingifyAugmentChunkHash(args$1);
|
|
3523
3331
|
const { plugin: renderStart, meta: renderStartMeta } = bindingifyRenderStart(args$1);
|
|
@@ -3548,7 +3356,7 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
|
|
|
3548
3356
|
transformFilter,
|
|
3549
3357
|
moduleParsed,
|
|
3550
3358
|
moduleParsedMeta,
|
|
3551
|
-
load,
|
|
3359
|
+
load: load$1,
|
|
3552
3360
|
loadMeta,
|
|
3553
3361
|
loadFilter,
|
|
3554
3362
|
renderChunk,
|
|
@@ -3997,13 +3805,24 @@ var PluginContextData = class {
|
|
|
3997
3805
|
}
|
|
3998
3806
|
};
|
|
3999
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
|
+
|
|
4000
3819
|
//#endregion
|
|
4001
3820
|
//#region src/utils/bindingify-input-options.ts
|
|
4002
3821
|
function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel, watchMode) {
|
|
4003
3822
|
const pluginContextData = new PluginContextData(onLog, outputOptions, normalizedOutputPlugins);
|
|
4004
3823
|
const plugins = rawPlugins.map((plugin) => {
|
|
4005
3824
|
if ("_parallel" in plugin) return;
|
|
4006
|
-
if (
|
|
3825
|
+
if (plugin instanceof BuiltinPlugin) return bindingifyBuiltInPlugin(plugin);
|
|
4007
3826
|
return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode);
|
|
4008
3827
|
});
|
|
4009
3828
|
const { jsx, transform } = bindingifyJsx(onLog, inputOptions.jsx, inputOptions.transform);
|
|
@@ -4069,13 +3888,7 @@ function bindingifyExternal(external) {
|
|
|
4069
3888
|
if (id$1.startsWith("\0")) return false;
|
|
4070
3889
|
return external(id$1, importer, isResolved) ?? false;
|
|
4071
3890
|
};
|
|
4072
|
-
|
|
4073
|
-
return (id$1, _importer, _isResolved) => {
|
|
4074
|
-
return externalArr.some((pat) => {
|
|
4075
|
-
if (pat instanceof RegExp) return pat.test(id$1);
|
|
4076
|
-
return id$1 === pat;
|
|
4077
|
-
});
|
|
4078
|
-
};
|
|
3891
|
+
return arraify(external);
|
|
4079
3892
|
}
|
|
4080
3893
|
}
|
|
4081
3894
|
function bindingifyExperimental(experimental) {
|
|
@@ -4109,7 +3922,7 @@ function bindingifyResolve(resolve) {
|
|
|
4109
3922
|
return {
|
|
4110
3923
|
alias: alias ? Object.entries(alias).map(([name, replacement]) => ({
|
|
4111
3924
|
find: name,
|
|
4112
|
-
replacements: arraify(replacement)
|
|
3925
|
+
replacements: replacement === false ? [void 0] : arraify(replacement)
|
|
4113
3926
|
})) : void 0,
|
|
4114
3927
|
extensionAlias: extensionAlias ? Object.entries(extensionAlias).map(([name, value]) => ({
|
|
4115
3928
|
target: name,
|
|
@@ -4340,11 +4153,7 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode) {
|
|
|
4340
4153
|
const onLog = getLogger(getObjectPlugins(inputPlugins), getOnLog(inputOptions, logLevel), logLevel, watchMode);
|
|
4341
4154
|
outputOptions = PluginDriver.callOutputOptionsHook([...inputPlugins, ...outputPlugins], outputOptions, onLog, logLevel, watchMode);
|
|
4342
4155
|
const normalizedOutputPlugins = await normalizePluginOption(outputOptions.plugins);
|
|
4343
|
-
let plugins = [
|
|
4344
|
-
...BUILTIN_PLUGINS,
|
|
4345
|
-
...normalizePlugins(inputPlugins, ANONYMOUS_PLUGIN_PREFIX),
|
|
4346
|
-
...checkOutputPluginOption(normalizePlugins(normalizedOutputPlugins, ANONYMOUS_OUTPUT_PLUGIN_PREFIX), onLog)
|
|
4347
|
-
];
|
|
4156
|
+
let plugins = [...normalizePlugins(inputPlugins, ANONYMOUS_PLUGIN_PREFIX), ...checkOutputPluginOption(normalizePlugins(normalizedOutputPlugins, ANONYMOUS_OUTPUT_PLUGIN_PREFIX), onLog)];
|
|
4348
4157
|
const parallelPluginInitResult = await initializeParallelPlugins(plugins);
|
|
4349
4158
|
try {
|
|
4350
4159
|
const bindingInputOptions = bindingifyInputOptions(plugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel, watchMode);
|
|
@@ -4365,27 +4174,6 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode) {
|
|
|
4365
4174
|
}
|
|
4366
4175
|
}
|
|
4367
4176
|
|
|
4368
|
-
//#endregion
|
|
4369
|
-
//#region src/utils/create-bundler.ts
|
|
4370
|
-
let asyncRuntimeShutdown = false;
|
|
4371
|
-
async function createBundlerImpl(bundler, inputOptions, outputOptions) {
|
|
4372
|
-
const option = await createBundlerOptions(inputOptions, outputOptions, false);
|
|
4373
|
-
if (asyncRuntimeShutdown) startAsyncRuntime();
|
|
4374
|
-
try {
|
|
4375
|
-
return {
|
|
4376
|
-
impl: bundler.createImpl(option.bundlerOptions),
|
|
4377
|
-
stopWorkers: option.stopWorkers,
|
|
4378
|
-
shutdown: () => {
|
|
4379
|
-
shutdownAsyncRuntime();
|
|
4380
|
-
asyncRuntimeShutdown = true;
|
|
4381
|
-
}
|
|
4382
|
-
};
|
|
4383
|
-
} catch (e$2) {
|
|
4384
|
-
await option.stopWorkers?.();
|
|
4385
|
-
throw e$2;
|
|
4386
|
-
}
|
|
4387
|
-
}
|
|
4388
|
-
|
|
4389
4177
|
//#endregion
|
|
4390
4178
|
//#region src/utils/transform-hmr-patch-output.ts
|
|
4391
4179
|
function transformHmrPatchOutput(output) {
|
|
@@ -4401,10 +4189,11 @@ function handleHmrPatchOutputErrors(output) {
|
|
|
4401
4189
|
//#endregion
|
|
4402
4190
|
//#region src/api/rolldown/rolldown-build.ts
|
|
4403
4191
|
Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose");
|
|
4404
|
-
var RolldownBuild = class {
|
|
4192
|
+
var RolldownBuild = class RolldownBuild {
|
|
4405
4193
|
#inputOptions;
|
|
4406
4194
|
#bundler;
|
|
4407
4195
|
#bundlerImpl;
|
|
4196
|
+
static asyncRuntimeShutdown = false;
|
|
4408
4197
|
constructor(inputOptions) {
|
|
4409
4198
|
this.#inputOptions = inputOptions;
|
|
4410
4199
|
this.#bundler = new BindingBundler();
|
|
@@ -4414,7 +4203,26 @@ var RolldownBuild = class {
|
|
|
4414
4203
|
}
|
|
4415
4204
|
async #getBundlerWithStopWorker(outputOptions) {
|
|
4416
4205
|
if (this.#bundlerImpl) await this.#bundlerImpl.stopWorkers?.();
|
|
4417
|
-
|
|
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);
|
|
4418
4226
|
}
|
|
4419
4227
|
async generate(outputOptions = {}) {
|
|
4420
4228
|
validateOption("output", outputOptions);
|
|
@@ -4622,4 +4430,4 @@ function defineConfig(config) {
|
|
|
4622
4430
|
const VERSION = version;
|
|
4623
4431
|
|
|
4624
4432
|
//#endregion
|
|
4625
|
-
export { 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 };
|