@terrazzo/cli 2.0.0-alpha.2 → 2.0.0-alpha.4

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/index.js CHANGED
@@ -1,9 +1,17 @@
1
- import { createRequire } from "node:module";
1
+ import { builtinModules, createRequire } from "node:module";
2
2
  import { fileURLToPath, pathToFileURL } from "node:url";
3
3
  import { build, defineConfig as defineConfig$1, parse } from "@terrazzo/parser";
4
- import fs, { createReadStream, createWriteStream } from "node:fs";
5
- import path from "node:path";
4
+ import fs, { createReadStream, createWriteStream, existsSync, promises } from "node:fs";
5
+ import path, { dirname, resolve } from "node:path";
6
6
  import pc from "picocolors";
7
+ import { createServer, version } from "vite";
8
+ import process$1 from "node:process";
9
+ import { Buffer as Buffer$1 } from "node:buffer";
10
+ import { isatty } from "node:tty";
11
+ import { formatWithOptions, inspect } from "node:util";
12
+ import vm from "node:vm";
13
+ import assert from "node:assert";
14
+ import { performance as performance$1 } from "node:perf_hooks";
7
15
  import chokidar from "chokidar";
8
16
  import yamlToMomoa from "yaml-to-momoa";
9
17
  import { exec } from "node:child_process";
@@ -17,15 +25,1716 @@ import { Readable, Writable } from "node:stream";
17
25
  import { serve } from "@hono/node-server";
18
26
  import mime from "mime";
19
27
  import * as momoa from "@humanwhocodes/momoa";
20
- import { getObjMember, getObjMembers, traverseAsync } from "@terrazzo/json-schema-tools";
28
+ import { getObjMember, getObjMembers, traverse } from "@terrazzo/json-schema-tools";
21
29
 
30
+ //#region ../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
31
+ const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
32
+ function normalizeWindowsPath(input = "") {
33
+ if (!input) return input;
34
+ return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
35
+ }
36
+ const _UNC_REGEX = /^[/\\]{2}/;
37
+ const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
38
+ const _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
39
+ const _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/;
40
+ const _EXTNAME_RE = /.(\.[^./]+|\.)$/;
41
+ const normalize = function(path$1) {
42
+ if (path$1.length === 0) return ".";
43
+ path$1 = normalizeWindowsPath(path$1);
44
+ const isUNCPath = path$1.match(_UNC_REGEX);
45
+ const isPathAbsolute = isAbsolute(path$1);
46
+ const trailingSeparator = path$1[path$1.length - 1] === "/";
47
+ path$1 = normalizeString(path$1, !isPathAbsolute);
48
+ if (path$1.length === 0) {
49
+ if (isPathAbsolute) return "/";
50
+ return trailingSeparator ? "./" : ".";
51
+ }
52
+ if (trailingSeparator) path$1 += "/";
53
+ if (_DRIVE_LETTER_RE.test(path$1)) path$1 += "/";
54
+ if (isUNCPath) {
55
+ if (!isPathAbsolute) return `//./${path$1}`;
56
+ return `//${path$1}`;
57
+ }
58
+ return isPathAbsolute && !isAbsolute(path$1) ? `/${path$1}` : path$1;
59
+ };
60
+ const join = function(...segments) {
61
+ let path$1 = "";
62
+ for (const seg of segments) {
63
+ if (!seg) continue;
64
+ if (path$1.length > 0) {
65
+ const pathTrailing = path$1[path$1.length - 1] === "/";
66
+ const segLeading = seg[0] === "/";
67
+ if (pathTrailing && segLeading) path$1 += seg.slice(1);
68
+ else path$1 += pathTrailing || segLeading ? seg : `/${seg}`;
69
+ } else path$1 += seg;
70
+ }
71
+ return normalize(path$1);
72
+ };
73
+ function cwd$1() {
74
+ if (typeof process !== "undefined" && typeof process.cwd === "function") return process.cwd().replace(/\\/g, "/");
75
+ return "/";
76
+ }
77
+ const resolve$1 = function(...arguments_) {
78
+ arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
79
+ let resolvedPath = "";
80
+ let resolvedAbsolute = false;
81
+ for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
82
+ const path$1 = index >= 0 ? arguments_[index] : cwd$1();
83
+ if (!path$1 || path$1.length === 0) continue;
84
+ resolvedPath = `${path$1}/${resolvedPath}`;
85
+ resolvedAbsolute = isAbsolute(path$1);
86
+ }
87
+ resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
88
+ if (resolvedAbsolute && !isAbsolute(resolvedPath)) return `/${resolvedPath}`;
89
+ return resolvedPath.length > 0 ? resolvedPath : ".";
90
+ };
91
+ function normalizeString(path$1, allowAboveRoot) {
92
+ let res = "";
93
+ let lastSegmentLength = 0;
94
+ let lastSlash = -1;
95
+ let dots = 0;
96
+ let char = null;
97
+ for (let index = 0; index <= path$1.length; ++index) {
98
+ if (index < path$1.length) char = path$1[index];
99
+ else if (char === "/") break;
100
+ else char = "/";
101
+ if (char === "/") {
102
+ if (lastSlash === index - 1 || dots === 1);
103
+ else if (dots === 2) {
104
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
105
+ if (res.length > 2) {
106
+ const lastSlashIndex = res.lastIndexOf("/");
107
+ if (lastSlashIndex === -1) {
108
+ res = "";
109
+ lastSegmentLength = 0;
110
+ } else {
111
+ res = res.slice(0, lastSlashIndex);
112
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
113
+ }
114
+ lastSlash = index;
115
+ dots = 0;
116
+ continue;
117
+ } else if (res.length > 0) {
118
+ res = "";
119
+ lastSegmentLength = 0;
120
+ lastSlash = index;
121
+ dots = 0;
122
+ continue;
123
+ }
124
+ }
125
+ if (allowAboveRoot) {
126
+ res += res.length > 0 ? "/.." : "..";
127
+ lastSegmentLength = 2;
128
+ }
129
+ } else {
130
+ if (res.length > 0) res += `/${path$1.slice(lastSlash + 1, index)}`;
131
+ else res = path$1.slice(lastSlash + 1, index);
132
+ lastSegmentLength = index - lastSlash - 1;
133
+ }
134
+ lastSlash = index;
135
+ dots = 0;
136
+ } else if (char === "." && dots !== -1) ++dots;
137
+ else dots = -1;
138
+ }
139
+ return res;
140
+ }
141
+ const isAbsolute = function(p) {
142
+ return _IS_ABSOLUTE_RE.test(p);
143
+ };
144
+ const extname = function(p) {
145
+ if (p === "..") return "";
146
+ const match = _EXTNAME_RE.exec(normalizeWindowsPath(p));
147
+ return match && match[1] || "";
148
+ };
149
+ const relative = function(from, to) {
150
+ const _from = resolve$1(from).replace(_ROOT_FOLDER_RE, "$1").split("/");
151
+ const _to = resolve$1(to).replace(_ROOT_FOLDER_RE, "$1").split("/");
152
+ if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) return _to.join("/");
153
+ const _fromCopy = [..._from];
154
+ for (const segment of _fromCopy) {
155
+ if (_to[0] !== segment) break;
156
+ _from.shift();
157
+ _to.shift();
158
+ }
159
+ return [..._from.map(() => ".."), ..._to].join("/");
160
+ };
161
+ const dirname$1 = function(p) {
162
+ const segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);
163
+ if (segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0])) segments[0] += "/";
164
+ return segments.join("/") || (isAbsolute(p) ? "/" : ".");
165
+ };
166
+
167
+ //#endregion
168
+ //#region ../../node_modules/.pnpm/vite-node@5.2.0_@types+node@24.10.1_jiti@2.6.1_sass-embedded@1.85.1_yaml@2.8.1/node_modules/vite-node/dist/utils-ExLpYVUV.mjs
169
+ const isWindows = process$1.platform === "win32";
170
+ const drive = isWindows ? process$1.cwd()[0] : null;
171
+ const driveOpposite = drive ? drive === drive.toUpperCase() ? drive.toLowerCase() : drive.toUpperCase() : null;
172
+ const driveRegexp = drive ? /* @__PURE__ */ new RegExp(`(?:^|/@fs/)${drive}(\:[\\/])`) : null;
173
+ const driveOppositeRegext = driveOpposite ? /* @__PURE__ */ new RegExp(`(?:^|/@fs/)${driveOpposite}(\:[\\/])`) : null;
174
+ function slash(str) {
175
+ return str.replace(/\\/g, "/");
176
+ }
177
+ const bareImportRE = /^(?![a-z]:)[\w@](?!.*:\/\/)/i;
178
+ function isBareImport(id) {
179
+ return bareImportRE.test(id);
180
+ }
181
+ function normalizeRequestId(id, base) {
182
+ if (base && id.startsWith(withTrailingSlash(base))) id = `/${id.slice(base.length)}`;
183
+ if (driveRegexp && !driveRegexp?.test(id) && driveOppositeRegext?.test(id)) id = id.replace(driveOppositeRegext, `${drive}$1`);
184
+ if (id.startsWith("file://")) {
185
+ const { file, postfix } = splitFileAndPostfix(id);
186
+ return fileURLToPath(file) + postfix;
187
+ }
188
+ return id.replace(/^\/@id\/__x00__/, "\0").replace(/^\/@id\//, "").replace(/^__vite-browser-external:/, "").replace(/\?v=\w+/, "?").replace(/&v=\w+/, "").replace(/\?t=\w+/, "?").replace(/&t=\w+/, "").replace(/\?import/, "?").replace(/&import/, "").replace(/\?&/, "?").replace(/\?+$/, "");
189
+ }
190
+ const postfixRE = /[?#].*$/;
191
+ function cleanUrl(url) {
192
+ return url.replace(postfixRE, "");
193
+ }
194
+ function splitFileAndPostfix(path$1) {
195
+ const file = cleanUrl(path$1);
196
+ return {
197
+ file,
198
+ postfix: path$1.slice(file.length)
199
+ };
200
+ }
201
+ const internalRequestRegexp = /* @__PURE__ */ new RegExp(`^/?(?:${["@vite/client", "@vite/env"].join("|")})$`);
202
+ function isInternalRequest(id) {
203
+ return internalRequestRegexp.test(id);
204
+ }
205
+ const prefixedBuiltins = new Set([
206
+ "node:sea",
207
+ "node:sqlite",
208
+ "node:test",
209
+ "node:test/reporters"
210
+ ]);
211
+ const builtins = new Set([
212
+ ...builtinModules,
213
+ "assert/strict",
214
+ "diagnostics_channel",
215
+ "dns/promises",
216
+ "fs/promises",
217
+ "path/posix",
218
+ "path/win32",
219
+ "readline/promises",
220
+ "stream/consumers",
221
+ "stream/promises",
222
+ "stream/web",
223
+ "timers/promises",
224
+ "util/types",
225
+ "wasi"
226
+ ]);
227
+ function normalizeModuleId(id) {
228
+ if (prefixedBuiltins.has(id)) return id;
229
+ if (id.startsWith("file://")) return fileURLToPath(id);
230
+ return id.replace(/\\/g, "/").replace(/^\/@fs\//, isWindows ? "" : "/").replace(/^node:/, "").replace(/^\/+/, "/");
231
+ }
232
+ function isPrimitive(v) {
233
+ return v !== Object(v);
234
+ }
235
+ function toFilePath(id, root) {
236
+ let { absolute, exists } = (() => {
237
+ if (id.startsWith("/@fs/")) return {
238
+ absolute: id.slice(4),
239
+ exists: true
240
+ };
241
+ if (!id.startsWith(withTrailingSlash(root)) && id.startsWith("/")) {
242
+ const resolved = resolve$1(root, id.slice(1));
243
+ if (existsSync(cleanUrl(resolved))) return {
244
+ absolute: resolved,
245
+ exists: true
246
+ };
247
+ } else if (id.startsWith(withTrailingSlash(root)) && existsSync(cleanUrl(id))) return {
248
+ absolute: id,
249
+ exists: true
250
+ };
251
+ return {
252
+ absolute: id,
253
+ exists: false
254
+ };
255
+ })();
256
+ if (absolute.startsWith("//")) absolute = absolute.slice(1);
257
+ return {
258
+ path: isWindows && absolute.startsWith("/") ? slash(fileURLToPath(pathToFileURL(absolute.slice(1)).href)) : absolute,
259
+ exists
260
+ };
261
+ }
262
+ const NODE_BUILTIN_NAMESPACE = "node:";
263
+ function isNodeBuiltin(id) {
264
+ if (prefixedBuiltins.has(id)) return true;
265
+ return builtins.has(id.startsWith(NODE_BUILTIN_NAMESPACE) ? id.slice(5) : id);
266
+ }
267
+ /**
268
+ * Convert `Arrayable<T>` to `Array<T>`
269
+ *
270
+ * @category Array
271
+ */
272
+ function toArray(array) {
273
+ if (array === null || array === void 0) array = [];
274
+ if (Array.isArray(array)) return array;
275
+ return [array];
276
+ }
277
+ function getCachedData(cache, basedir, originalBasedir) {
278
+ const pkgData = cache.get(getFnpdCacheKey(basedir));
279
+ if (pkgData) {
280
+ traverseBetweenDirs(originalBasedir, basedir, (dir) => {
281
+ cache.set(getFnpdCacheKey(dir), pkgData);
282
+ });
283
+ return pkgData;
284
+ }
285
+ }
286
+ function setCacheData(cache, data, basedir, originalBasedir) {
287
+ cache.set(getFnpdCacheKey(basedir), data);
288
+ traverseBetweenDirs(originalBasedir, basedir, (dir) => {
289
+ cache.set(getFnpdCacheKey(dir), data);
290
+ });
291
+ }
292
+ function getFnpdCacheKey(basedir) {
293
+ return `fnpd_${basedir}`;
294
+ }
295
+ /**
296
+ * Traverse between `longerDir` (inclusive) and `shorterDir` (exclusive) and call `cb` for each dir.
297
+ * @param longerDir Longer dir path, e.g. `/User/foo/bar/baz`
298
+ * @param shorterDir Shorter dir path, e.g. `/User/foo`
299
+ */
300
+ function traverseBetweenDirs(longerDir, shorterDir, cb) {
301
+ while (longerDir !== shorterDir) {
302
+ cb(longerDir);
303
+ longerDir = dirname$1(longerDir);
304
+ }
305
+ }
306
+ function withTrailingSlash(path$1) {
307
+ if (path$1[path$1.length - 1] !== "/") return `${path$1}/`;
308
+ return path$1;
309
+ }
310
+ function createImportMetaEnvProxy() {
311
+ const booleanKeys = [
312
+ "DEV",
313
+ "PROD",
314
+ "SSR"
315
+ ];
316
+ return new Proxy(process$1.env, {
317
+ get(_, key) {
318
+ if (typeof key !== "string") return;
319
+ if (booleanKeys.includes(key)) return !!process$1.env[key];
320
+ return process$1.env[key];
321
+ },
322
+ set(_, key, value) {
323
+ if (typeof key !== "string") return true;
324
+ if (booleanKeys.includes(key)) process$1.env[key] = value ? "1" : "";
325
+ else process$1.env[key] = value;
326
+ return true;
327
+ }
328
+ });
329
+ }
330
+ const packageCache = /* @__PURE__ */ new Map();
331
+ async function findNearestPackageData(basedir) {
332
+ const originalBasedir = basedir;
333
+ while (basedir) {
334
+ const cached = getCachedData(packageCache, basedir, originalBasedir);
335
+ if (cached) return cached;
336
+ const pkgPath = join(basedir, "package.json");
337
+ if ((await promises.stat(pkgPath).catch(() => {}))?.isFile()) {
338
+ const pkgData = JSON.parse(await promises.readFile(pkgPath, "utf8"));
339
+ if (packageCache) setCacheData(packageCache, pkgData, basedir, originalBasedir);
340
+ return pkgData;
341
+ }
342
+ const nextBasedir = dirname$1(basedir);
343
+ if (nextBasedir === basedir) break;
344
+ basedir = nextBasedir;
345
+ }
346
+ return {};
347
+ }
348
+
349
+ //#endregion
350
+ //#region ../../node_modules/.pnpm/vite-node@5.2.0_@types+node@24.10.1_jiti@2.6.1_sass-embedded@1.85.1_yaml@2.8.1/node_modules/vite-node/dist/source-map-DQLD3K8K.mjs
351
+ var comma = ",".charCodeAt(0);
352
+ ";".charCodeAt(0);
353
+ var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
354
+ var intToChar = new Uint8Array(64);
355
+ var charToInt = new Uint8Array(128);
356
+ for (let i = 0; i < chars.length; i++) {
357
+ const c = chars.charCodeAt(i);
358
+ intToChar[i] = c;
359
+ charToInt[c] = i;
360
+ }
361
+ const fileContentsCache = {};
362
+ const reSourceMap = /^data:application\/json[^,]+base64,/;
363
+ let retrieveFileHandlers = [];
364
+ let retrieveMapHandlers = [];
365
+ function handlerExec(list) {
366
+ return function(arg) {
367
+ for (let i = 0; i < list.length; i++) {
368
+ const ret = list[i](arg);
369
+ if (ret) return ret;
370
+ }
371
+ return null;
372
+ };
373
+ }
374
+ let retrieveFile = handlerExec(retrieveFileHandlers);
375
+ retrieveFileHandlers.push((path$1) => {
376
+ path$1 = path$1.trim();
377
+ if (path$1.startsWith("file:")) path$1 = path$1.replace(/file:\/\/\/(\w:)?/, (protocol, drive$1) => {
378
+ return drive$1 ? "" : "/";
379
+ });
380
+ if (path$1 in fileContentsCache) return fileContentsCache[path$1];
381
+ let contents = "";
382
+ try {
383
+ if (fs.existsSync(path$1)) contents = fs.readFileSync(path$1, "utf8");
384
+ } catch {}
385
+ return fileContentsCache[path$1] = contents;
386
+ });
387
+ function supportRelativeURL(file, url) {
388
+ if (!file) return url;
389
+ const dir = path.dirname(file);
390
+ const match = /^\w+:\/\/[^/]*/.exec(dir);
391
+ let protocol = match ? match[0] : "";
392
+ const startPath = dir.slice(protocol.length);
393
+ if (protocol && /^\/\w:/.test(startPath)) {
394
+ protocol += "/";
395
+ return protocol + path.resolve(dir.slice(protocol.length), url).replace(/\\/g, "/");
396
+ }
397
+ return protocol + path.resolve(dir.slice(protocol.length), url);
398
+ }
399
+ function retrieveSourceMapURL(source) {
400
+ const fileData = retrieveFile(source);
401
+ if (!fileData) return null;
402
+ const re = /\/\/[@#]\s*sourceMappingURL=([^\s'"]+)\s*$|\/\*[@#]\s*sourceMappingURL=[^\s*'"]+\s*\*\/\s*$/gm;
403
+ let lastMatch, match;
404
+ while (match = re.exec(fileData)) lastMatch = match;
405
+ if (!lastMatch) return null;
406
+ return lastMatch[1];
407
+ }
408
+ let retrieveSourceMap = handlerExec(retrieveMapHandlers);
409
+ retrieveMapHandlers.push((source) => {
410
+ let sourceMappingURL = retrieveSourceMapURL(source);
411
+ if (!sourceMappingURL) return null;
412
+ let sourceMapData;
413
+ if (reSourceMap.test(sourceMappingURL)) {
414
+ const rawData = sourceMappingURL.slice(sourceMappingURL.indexOf(",") + 1);
415
+ sourceMapData = Buffer$1.from(rawData, "base64").toString();
416
+ sourceMappingURL = source;
417
+ } else {
418
+ sourceMappingURL = supportRelativeURL(source, sourceMappingURL);
419
+ sourceMapData = retrieveFile(sourceMappingURL);
420
+ }
421
+ if (!sourceMapData) return null;
422
+ return {
423
+ url: sourceMappingURL,
424
+ map: sourceMapData
425
+ };
426
+ });
427
+ retrieveFileHandlers.slice(0);
428
+ retrieveMapHandlers.slice(0);
429
+ let SOURCEMAPPING_URL = "sourceMa";
430
+ SOURCEMAPPING_URL += "ppingURL";
431
+ const VITE_NODE_SOURCEMAPPING_SOURCE = "//# sourceMappingSource=vite-node";
432
+ const VITE_NODE_SOURCEMAPPING_URL = `${SOURCEMAPPING_URL}=data:application/json;charset=utf-8`;
433
+ function withInlineSourcemap(result, options) {
434
+ const map = result.map;
435
+ let code = result.code;
436
+ if (!map || code.includes(VITE_NODE_SOURCEMAPPING_SOURCE)) return result;
437
+ if ("sources" in map) map.sources = map.sources?.map((source) => {
438
+ if (!source) return source;
439
+ if (isAbsolute(source)) {
440
+ const actualPath = !source.startsWith(withTrailingSlash(options.root)) && source.startsWith("/") ? resolve$1(options.root, source.slice(1)) : source;
441
+ return relative(dirname$1(options.filepath), actualPath);
442
+ }
443
+ return source;
444
+ });
445
+ const OTHER_SOURCE_MAP_REGEXP = new RegExp(`//# ${SOURCEMAPPING_URL}=data:application/json[^,]+base64,([A-Za-z0-9+/=]+)$`, "gm");
446
+ while (OTHER_SOURCE_MAP_REGEXP.test(code)) code = code.replace(OTHER_SOURCE_MAP_REGEXP, "");
447
+ if (!options.noFirstLineMapping && map.mappings.startsWith(";")) map.mappings = `AAAA,CAAA${map.mappings}`;
448
+ const sourceMap = Buffer$1.from(JSON.stringify(map), "utf-8").toString("base64");
449
+ result.code = `${code.trimEnd()}\n\n${VITE_NODE_SOURCEMAPPING_SOURCE}\n//# ${VITE_NODE_SOURCEMAPPING_URL};base64,${sourceMap}\n`;
450
+ return result;
451
+ }
452
+ function extractSourceMap(code) {
453
+ const regexp = new RegExp(`//# ${VITE_NODE_SOURCEMAPPING_URL};base64,(.+)`, "gm");
454
+ let lastMatch, match;
455
+ while (match = regexp.exec(code)) lastMatch = match;
456
+ if (lastMatch) return JSON.parse(Buffer$1.from(lastMatch[1], "base64").toString("utf-8"));
457
+ return null;
458
+ }
459
+
460
+ //#endregion
461
+ //#region ../../node_modules/.pnpm/obug@2.1.0/node_modules/obug/dist/core.js
462
+ function coerce(value) {
463
+ if (value instanceof Error) return value.stack || value.message;
464
+ return value;
465
+ }
466
+ function selectColor(colors$1, namespace) {
467
+ let hash = 0;
468
+ for (let i = 0; i < namespace.length; i++) {
469
+ hash = (hash << 5) - hash + namespace.charCodeAt(i);
470
+ hash |= 0;
471
+ }
472
+ return colors$1[Math.abs(hash) % colors$1.length];
473
+ }
474
+ function matchesTemplate(search, template) {
475
+ let searchIndex = 0;
476
+ let templateIndex = 0;
477
+ let starIndex = -1;
478
+ let matchIndex = 0;
479
+ while (searchIndex < search.length) if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) if (template[templateIndex] === "*") {
480
+ starIndex = templateIndex;
481
+ matchIndex = searchIndex;
482
+ templateIndex++;
483
+ } else {
484
+ searchIndex++;
485
+ templateIndex++;
486
+ }
487
+ else if (starIndex !== -1) {
488
+ templateIndex = starIndex + 1;
489
+ matchIndex++;
490
+ searchIndex = matchIndex;
491
+ } else return false;
492
+ while (templateIndex < template.length && template[templateIndex] === "*") templateIndex++;
493
+ return templateIndex === template.length;
494
+ }
495
+ function humanize(value) {
496
+ if (value >= 1e3) return `${(value / 1e3).toFixed(1)}s`;
497
+ return `${value}ms`;
498
+ }
499
+ let globalNamespaces = "";
500
+ function createDebug$1(namespace, options) {
501
+ let prevTime;
502
+ let enableOverride;
503
+ let namespacesCache;
504
+ let enabledCache;
505
+ const debug = (...args) => {
506
+ if (!debug.enabled) return;
507
+ const curr = Date.now();
508
+ const diff = curr - (prevTime || curr);
509
+ prevTime = curr;
510
+ args[0] = coerce(args[0]);
511
+ if (typeof args[0] !== "string") args.unshift("%O");
512
+ let index = 0;
513
+ args[0] = args[0].replace(/%([a-z%])/gi, (match, format) => {
514
+ if (match === "%%") return "%";
515
+ index++;
516
+ const formatter = options.formatters[format];
517
+ if (typeof formatter === "function") {
518
+ const value = args[index];
519
+ match = formatter.call(debug, value);
520
+ args.splice(index, 1);
521
+ index--;
522
+ }
523
+ return match;
524
+ });
525
+ options.formatArgs.call(debug, diff, args);
526
+ debug.log(...args);
527
+ };
528
+ debug.extend = function(namespace$1, delimiter = ":") {
529
+ return createDebug$1(this.namespace + delimiter + namespace$1, {
530
+ useColors: this.useColors,
531
+ color: this.color,
532
+ formatArgs: this.formatArgs,
533
+ formatters: this.formatters,
534
+ inspectOpts: this.inspectOpts,
535
+ log: this.log,
536
+ humanize: this.humanize
537
+ });
538
+ };
539
+ Object.assign(debug, options);
540
+ debug.namespace = namespace;
541
+ Object.defineProperty(debug, "enabled", {
542
+ enumerable: true,
543
+ configurable: false,
544
+ get: () => {
545
+ if (enableOverride != null) return enableOverride;
546
+ if (namespacesCache !== globalNamespaces) {
547
+ namespacesCache = globalNamespaces;
548
+ enabledCache = enabled(namespace);
549
+ }
550
+ return enabledCache;
551
+ },
552
+ set: (v) => {
553
+ enableOverride = v;
554
+ }
555
+ });
556
+ return debug;
557
+ }
558
+ let names = [];
559
+ let skips = [];
560
+ function enable(namespaces$1) {
561
+ globalNamespaces = namespaces$1;
562
+ names = [];
563
+ skips = [];
564
+ const split = globalNamespaces.trim().replace(/\s+/g, ",").split(",").filter(Boolean);
565
+ for (const ns of split) if (ns[0] === "-") skips.push(ns.slice(1));
566
+ else names.push(ns);
567
+ }
568
+ function enabled(name) {
569
+ for (const skip of skips) if (matchesTemplate(name, skip)) return false;
570
+ for (const ns of names) if (matchesTemplate(name, ns)) return true;
571
+ return false;
572
+ }
573
+
574
+ //#endregion
575
+ //#region ../../node_modules/.pnpm/obug@2.1.0/node_modules/obug/dist/node.js
576
+ const colors = process.stderr.getColorDepth && process.stderr.getColorDepth() > 2 ? [
577
+ 20,
578
+ 21,
579
+ 26,
580
+ 27,
581
+ 32,
582
+ 33,
583
+ 38,
584
+ 39,
585
+ 40,
586
+ 41,
587
+ 42,
588
+ 43,
589
+ 44,
590
+ 45,
591
+ 56,
592
+ 57,
593
+ 62,
594
+ 63,
595
+ 68,
596
+ 69,
597
+ 74,
598
+ 75,
599
+ 76,
600
+ 77,
601
+ 78,
602
+ 79,
603
+ 80,
604
+ 81,
605
+ 92,
606
+ 93,
607
+ 98,
608
+ 99,
609
+ 112,
610
+ 113,
611
+ 128,
612
+ 129,
613
+ 134,
614
+ 135,
615
+ 148,
616
+ 149,
617
+ 160,
618
+ 161,
619
+ 162,
620
+ 163,
621
+ 164,
622
+ 165,
623
+ 166,
624
+ 167,
625
+ 168,
626
+ 169,
627
+ 170,
628
+ 171,
629
+ 172,
630
+ 173,
631
+ 178,
632
+ 179,
633
+ 184,
634
+ 185,
635
+ 196,
636
+ 197,
637
+ 198,
638
+ 199,
639
+ 200,
640
+ 201,
641
+ 202,
642
+ 203,
643
+ 204,
644
+ 205,
645
+ 206,
646
+ 207,
647
+ 208,
648
+ 209,
649
+ 214,
650
+ 215,
651
+ 220,
652
+ 221
653
+ ] : [
654
+ 6,
655
+ 2,
656
+ 3,
657
+ 4,
658
+ 5,
659
+ 1
660
+ ];
661
+ const inspectOpts = Object.keys(process.env).filter((key) => /^debug_/i.test(key)).reduce((obj, key) => {
662
+ const prop = key.slice(6).toLowerCase().replace(/_([a-z])/g, (_, k) => k.toUpperCase());
663
+ let value = process.env[key];
664
+ if (value === "null") value = null;
665
+ else if (/^yes|on|true|enabled$/i.test(value)) value = true;
666
+ else if (/^no|off|false|disabled$/i.test(value)) value = false;
667
+ else value = Number(value);
668
+ obj[prop] = value;
669
+ return obj;
670
+ }, {});
671
+ function useColors() {
672
+ return "colors" in inspectOpts ? Boolean(inspectOpts.colors) : isatty(process.stderr.fd);
673
+ }
674
+ function getDate() {
675
+ if (inspectOpts.hideDate) return "";
676
+ return `${(/* @__PURE__ */ new Date()).toISOString()} `;
677
+ }
678
+ function formatArgs(diff, args) {
679
+ const { namespace: name, useColors: useColors$1 } = this;
680
+ if (useColors$1) {
681
+ const c = this.color;
682
+ const colorCode = `\u001B[3${c < 8 ? c : `8;5;${c}`}`;
683
+ const prefix = ` ${colorCode};1m${name} \u001B[0m`;
684
+ args[0] = prefix + args[0].split("\n").join(`\n${prefix}`);
685
+ args.push(`${colorCode}m+${this.humanize(diff)}\u001B[0m`);
686
+ } else args[0] = `${getDate()}${name} ${args[0]}`;
687
+ }
688
+ function log(...args) {
689
+ process.stderr.write(`${formatWithOptions(this.inspectOpts, ...args)}\n`);
690
+ }
691
+ const defaultOptions = {
692
+ useColors: useColors(),
693
+ formatArgs,
694
+ formatters: {
695
+ o(v) {
696
+ this.inspectOpts.colors = this.useColors;
697
+ return inspect(v, this.inspectOpts).split("\n").map((str) => str.trim()).join(" ");
698
+ },
699
+ O(v) {
700
+ this.inspectOpts.colors = this.useColors;
701
+ return inspect(v, this.inspectOpts);
702
+ }
703
+ },
704
+ inspectOpts,
705
+ log,
706
+ humanize
707
+ };
708
+ function createDebug(namespace, options) {
709
+ var _ref;
710
+ const color = (_ref = options && options.color) !== null && _ref !== void 0 ? _ref : selectColor(colors, namespace);
711
+ return createDebug$1(namespace, Object.assign(defaultOptions, { color }, options));
712
+ }
713
+ enable(process.env.DEBUG || "");
714
+
715
+ //#endregion
716
+ //#region ../../node_modules/.pnpm/vite-node@5.2.0_@types+node@24.10.1_jiti@2.6.1_sass-embedded@1.85.1_yaml@2.8.1/node_modules/vite-node/dist/client-CyS7w_FB.mjs
717
+ const { setTimeout: setTimeout$1, clearTimeout: clearTimeout$1 } = globalThis;
718
+ const debugExecute = createDebug("vite-node:client:execute");
719
+ const debugNative = createDebug("vite-node:client:native");
720
+ const clientStub = {
721
+ injectQuery: (id) => id,
722
+ createHotContext: () => {
723
+ return {
724
+ accept: () => {},
725
+ prune: () => {},
726
+ dispose: () => {},
727
+ decline: () => {},
728
+ invalidate: () => {},
729
+ on: () => {},
730
+ send: () => {}
731
+ };
732
+ },
733
+ updateStyle: () => {},
734
+ removeStyle: () => {}
735
+ };
736
+ const env = createImportMetaEnvProxy();
737
+ const DEFAULT_REQUEST_STUBS = {
738
+ "/@vite/client": clientStub,
739
+ "@vite/client": clientStub
740
+ };
741
+ var ModuleCacheMap = class extends Map {
742
+ normalizePath(fsPath) {
743
+ return normalizeModuleId(fsPath);
744
+ }
745
+ /**
746
+ * Assign partial data to the map
747
+ */
748
+ update(fsPath, mod) {
749
+ fsPath = this.normalizePath(fsPath);
750
+ if (!super.has(fsPath)) this.setByModuleId(fsPath, mod);
751
+ else Object.assign(super.get(fsPath), mod);
752
+ return this;
753
+ }
754
+ setByModuleId(modulePath, mod) {
755
+ return super.set(modulePath, mod);
756
+ }
757
+ set(fsPath, mod) {
758
+ return this.setByModuleId(this.normalizePath(fsPath), mod);
759
+ }
760
+ getByModuleId(modulePath) {
761
+ if (!super.has(modulePath)) this.setByModuleId(modulePath, {});
762
+ const mod = super.get(modulePath);
763
+ if (!mod.imports) Object.assign(mod, {
764
+ imports: /* @__PURE__ */ new Set(),
765
+ importers: /* @__PURE__ */ new Set()
766
+ });
767
+ return mod;
768
+ }
769
+ get(fsPath) {
770
+ return this.getByModuleId(this.normalizePath(fsPath));
771
+ }
772
+ deleteByModuleId(modulePath) {
773
+ return super.delete(modulePath);
774
+ }
775
+ delete(fsPath) {
776
+ return this.deleteByModuleId(this.normalizePath(fsPath));
777
+ }
778
+ invalidateModule(mod) {
779
+ delete mod.evaluated;
780
+ delete mod.resolving;
781
+ delete mod.promise;
782
+ delete mod.exports;
783
+ mod.importers?.clear();
784
+ mod.imports?.clear();
785
+ return true;
786
+ }
787
+ /**
788
+ * Invalidate modules that dependent on the given modules, up to the main entry
789
+ */
790
+ invalidateDepTree(ids, invalidated = /* @__PURE__ */ new Set()) {
791
+ for (const _id of ids) {
792
+ const id = this.normalizePath(_id);
793
+ if (invalidated.has(id)) continue;
794
+ invalidated.add(id);
795
+ const mod = super.get(id);
796
+ if (mod?.importers) this.invalidateDepTree(mod.importers, invalidated);
797
+ super.delete(id);
798
+ }
799
+ return invalidated;
800
+ }
801
+ /**
802
+ * Invalidate dependency modules of the given modules, down to the bottom-level dependencies
803
+ */
804
+ invalidateSubDepTree(ids, invalidated = /* @__PURE__ */ new Set()) {
805
+ for (const _id of ids) {
806
+ const id = this.normalizePath(_id);
807
+ if (invalidated.has(id)) continue;
808
+ invalidated.add(id);
809
+ const subIds = Array.from(super.entries()).filter(([, mod]) => mod.importers?.has(id)).map(([key]) => key);
810
+ if (subIds.length) this.invalidateSubDepTree(subIds, invalidated);
811
+ super.delete(id);
812
+ }
813
+ return invalidated;
814
+ }
815
+ /**
816
+ * Return parsed source map based on inlined source map of the module
817
+ */
818
+ getSourceMap(id) {
819
+ const cache = this.get(id);
820
+ if (cache.map) return cache.map;
821
+ const map = cache.code && extractSourceMap(cache.code);
822
+ if (map) {
823
+ cache.map = map;
824
+ return map;
825
+ }
826
+ return null;
827
+ }
828
+ };
829
+ var ViteNodeRunner = class {
830
+ root;
831
+ debug;
832
+ /**
833
+ * Holds the cache of modules
834
+ * Keys of the map are filepaths, or plain package names
835
+ */
836
+ moduleCache;
837
+ /**
838
+ * Tracks the stack of modules being executed for the purpose of calculating import self-time.
839
+ *
840
+ * Note that while in most cases, imports are a linear stack of modules,
841
+ * this is occasionally not the case, for example when you have parallel top-level dynamic imports like so:
842
+ *
843
+ * ```ts
844
+ * await Promise.all([
845
+ * import('./module1'),
846
+ * import('./module2'),
847
+ * ]);
848
+ * ```
849
+ *
850
+ * In this case, the self time will be reported incorrectly for one of the modules (could go negative).
851
+ * As top-level awaits with dynamic imports like this are uncommon, we don't handle this case specifically.
852
+ */
853
+ executionStack = [];
854
+ performanceNow = performance.now.bind(performance);
855
+ constructor(options) {
856
+ this.options = options;
857
+ this.root = options.root ?? process$1.cwd();
858
+ this.moduleCache = options.moduleCache ?? new ModuleCacheMap();
859
+ this.debug = options.debug ?? (typeof process$1 !== "undefined" ? !!process$1.env.VITE_NODE_DEBUG_RUNNER : false);
860
+ }
861
+ async executeFile(file) {
862
+ const url = `/@fs/${slash(resolve(file))}`;
863
+ return await this.cachedRequest(url, url, []);
864
+ }
865
+ async executeId(rawId) {
866
+ const [id, url] = await this.resolveUrl(rawId);
867
+ return await this.cachedRequest(id, url, []);
868
+ }
869
+ /** @internal */
870
+ async cachedRequest(id, fsPath, callstack) {
871
+ const importee = callstack[callstack.length - 1];
872
+ const mod = this.moduleCache.get(fsPath);
873
+ const { imports, importers } = mod;
874
+ if (importee) importers.add(importee);
875
+ const getStack = () => `stack:\n${[...callstack, fsPath].reverse().map((p) => ` - ${p}`).join("\n")}`;
876
+ if (callstack.includes(fsPath) || Array.from(imports.values()).some((i) => importers.has(i))) {
877
+ if (mod.exports) return mod.exports;
878
+ }
879
+ let debugTimer;
880
+ if (this.debug) debugTimer = setTimeout$1(() => console.warn(`[vite-node] module ${fsPath} takes over 2s to load.\n${getStack()}`), 2e3);
881
+ try {
882
+ if (mod.promise) return await mod.promise;
883
+ const promise = this.directRequest(id, fsPath, callstack);
884
+ Object.assign(mod, {
885
+ promise,
886
+ evaluated: false
887
+ });
888
+ return await promise;
889
+ } finally {
890
+ mod.evaluated = true;
891
+ if (debugTimer) clearTimeout$1(debugTimer);
892
+ }
893
+ }
894
+ shouldResolveId(id, _importee) {
895
+ return !isInternalRequest(id) && !isNodeBuiltin(id) && !id.startsWith("data:");
896
+ }
897
+ async _resolveUrl(id, importer) {
898
+ const dep = normalizeRequestId(id, this.options.base);
899
+ if (!this.shouldResolveId(dep)) return [dep, dep];
900
+ const { path: path$1, exists } = toFilePath(dep, this.root);
901
+ if (!this.options.resolveId || exists) return [dep, path$1];
902
+ const resolved = await this.options.resolveId(dep, importer);
903
+ if (resolved?.meta?.["vite:alias"]?.noResolved) {
904
+ const error = /* @__PURE__ */ new Error(`Cannot find module '${id}'${importer ? ` imported from '${importer}'` : ""}.
905
+
906
+ - If you rely on tsconfig.json's "paths" to resolve modules, please install "vite-tsconfig-paths" plugin to handle module resolution.
907
+ - Make sure you don't have relative aliases in your Vitest config. Use absolute paths instead. Read more: https://vitest.dev/guide/common-errors`);
908
+ Object.defineProperty(error, "code", {
909
+ value: "ERR_MODULE_NOT_FOUND",
910
+ enumerable: true
911
+ });
912
+ Object.defineProperty(error, Symbol.for("vitest.error.not_found.data"), {
913
+ value: {
914
+ id: dep,
915
+ importer
916
+ },
917
+ enumerable: false
918
+ });
919
+ throw error;
920
+ }
921
+ const resolvedId = resolved ? normalizeRequestId(resolved.id, this.options.base) : dep;
922
+ return [resolvedId, resolvedId];
923
+ }
924
+ async resolveUrl(id, importee) {
925
+ const resolveKey = `resolve:${id}`;
926
+ this.moduleCache.setByModuleId(resolveKey, { resolving: true });
927
+ try {
928
+ return await this._resolveUrl(id, importee);
929
+ } finally {
930
+ this.moduleCache.deleteByModuleId(resolveKey);
931
+ }
932
+ }
933
+ /** @internal */
934
+ async dependencyRequest(id, fsPath, callstack) {
935
+ return await this.cachedRequest(id, fsPath, callstack);
936
+ }
937
+ async _fetchModule(id, importer) {
938
+ try {
939
+ return await this.options.fetchModule(id);
940
+ } catch (cause) {
941
+ if (typeof cause === "object" && cause.code === "ERR_LOAD_URL" || typeof cause?.message === "string" && cause.message.includes("Failed to load url")) {
942
+ const error = new Error(`Cannot find ${isBareImport(id) ? "package" : "module"} '${id}'${importer ? ` imported from '${importer}'` : ""}`, { cause });
943
+ error.code = "ERR_MODULE_NOT_FOUND";
944
+ throw error;
945
+ }
946
+ throw cause;
947
+ }
948
+ }
949
+ /** @internal */
950
+ async directRequest(id, fsPath, _callstack) {
951
+ const moduleId = normalizeModuleId(fsPath);
952
+ const callstack = [..._callstack, moduleId];
953
+ const mod = this.moduleCache.getByModuleId(moduleId);
954
+ const request = async (dep) => {
955
+ const [id$1, depFsPath] = await this.resolveUrl(String(dep), fsPath);
956
+ this.moduleCache.getByModuleId(depFsPath).importers.add(moduleId);
957
+ mod.imports.add(depFsPath);
958
+ return this.dependencyRequest(id$1, depFsPath, callstack);
959
+ };
960
+ const requestStubs = this.options.requestStubs || DEFAULT_REQUEST_STUBS;
961
+ if (id in requestStubs) return requestStubs[id];
962
+ let { code: transformed, externalize } = await this._fetchModule(id, callstack[callstack.length - 2]);
963
+ if (externalize) {
964
+ debugNative(externalize);
965
+ const exports$1 = await this.interopedImport(externalize);
966
+ mod.exports = exports$1;
967
+ return exports$1;
968
+ }
969
+ if (transformed == null) throw new Error(`[vite-node] Failed to load "${id}" imported from ${callstack[callstack.length - 2]}`);
970
+ const { Object: Object$1, Reflect: Reflect$1, Symbol: Symbol$1 } = this.getContextPrimitives();
971
+ const modulePath = cleanUrl(moduleId);
972
+ const href = pathToFileURL(modulePath).href;
973
+ const __filename = fileURLToPath(href);
974
+ const __dirname = dirname(__filename);
975
+ const meta = {
976
+ url: href,
977
+ env,
978
+ filename: __filename,
979
+ dirname: __dirname
980
+ };
981
+ const exports = Object$1.create(null);
982
+ Object$1.defineProperty(exports, Symbol$1.toStringTag, {
983
+ value: "Module",
984
+ enumerable: false,
985
+ configurable: false
986
+ });
987
+ const SYMBOL_NOT_DEFINED = Symbol$1("not defined");
988
+ let moduleExports = SYMBOL_NOT_DEFINED;
989
+ const cjsExports = new Proxy(exports, {
990
+ get: (target, p, receiver) => {
991
+ if (Reflect$1.has(target, p)) return Reflect$1.get(target, p, receiver);
992
+ return Reflect$1.get(Object$1.prototype, p, receiver);
993
+ },
994
+ getPrototypeOf: () => Object$1.prototype,
995
+ set: (_, p, value) => {
996
+ if (p === "default" && this.shouldInterop(modulePath, { default: value }) && cjsExports !== value) {
997
+ exportAll(cjsExports, value);
998
+ exports.default = value;
999
+ return true;
1000
+ }
1001
+ if (!Reflect$1.has(exports, "default")) exports.default = {};
1002
+ if (moduleExports !== SYMBOL_NOT_DEFINED && isPrimitive(moduleExports)) {
1003
+ defineExport(exports, p, () => void 0);
1004
+ return true;
1005
+ }
1006
+ if (!isPrimitive(exports.default)) exports.default[p] = value;
1007
+ if (p !== "default") defineExport(exports, p, () => value);
1008
+ return true;
1009
+ }
1010
+ });
1011
+ Object$1.assign(mod, {
1012
+ code: transformed,
1013
+ exports
1014
+ });
1015
+ const moduleProxy = {
1016
+ set exports(value) {
1017
+ exportAll(cjsExports, value);
1018
+ exports.default = value;
1019
+ moduleExports = value;
1020
+ },
1021
+ get exports() {
1022
+ return cjsExports;
1023
+ }
1024
+ };
1025
+ let hotContext;
1026
+ if (this.options.createHotContext) Object$1.defineProperty(meta, "hot", {
1027
+ enumerable: true,
1028
+ get: () => {
1029
+ hotContext ||= this.options.createHotContext?.(this, moduleId);
1030
+ return hotContext;
1031
+ },
1032
+ set: (value) => {
1033
+ hotContext = value;
1034
+ }
1035
+ });
1036
+ const context = this.prepareContext({
1037
+ __vite_ssr_import__: request,
1038
+ __vite_ssr_dynamic_import__: request,
1039
+ __vite_ssr_exports__: exports,
1040
+ __vite_ssr_exportAll__: (obj) => exportAll(exports, obj),
1041
+ __vite_ssr_exportName__: (name, getter) => Object$1.defineProperty(exports, name, {
1042
+ enumerable: true,
1043
+ configurable: true,
1044
+ get: getter
1045
+ }),
1046
+ __vite_ssr_import_meta__: meta,
1047
+ require: createRequire(href),
1048
+ exports: cjsExports,
1049
+ module: moduleProxy,
1050
+ __filename,
1051
+ __dirname
1052
+ });
1053
+ debugExecute(__filename);
1054
+ if (transformed[0] === "#") transformed = transformed.replace(/^#!.*/, (s) => " ".repeat(s.length));
1055
+ await this.runModule(context, transformed);
1056
+ return exports;
1057
+ }
1058
+ getContextPrimitives() {
1059
+ return {
1060
+ Object,
1061
+ Reflect,
1062
+ Symbol
1063
+ };
1064
+ }
1065
+ async runModule(context, transformed) {
1066
+ const codeDefinition = `'use strict';async (${Object.keys(context).join(",")})=>{{`;
1067
+ const code = `${codeDefinition}${transformed}\n}}`;
1068
+ const options = {
1069
+ filename: context.__filename,
1070
+ lineOffset: 0,
1071
+ columnOffset: -codeDefinition.length
1072
+ };
1073
+ const finishModuleExecutionInfo = this.startCalculateModuleExecutionInfo(options.filename, codeDefinition.length);
1074
+ try {
1075
+ await vm.runInThisContext(code, options)(...Object.values(context));
1076
+ } finally {
1077
+ this.options.moduleExecutionInfo?.set(options.filename, finishModuleExecutionInfo());
1078
+ }
1079
+ }
1080
+ /**
1081
+ * Starts calculating the module execution info such as the total duration and self time spent on executing the module.
1082
+ * Returns a function to call once the module has finished executing.
1083
+ */
1084
+ startCalculateModuleExecutionInfo(filename, startOffset) {
1085
+ const startTime = this.performanceNow();
1086
+ this.executionStack.push({
1087
+ filename,
1088
+ startTime,
1089
+ subImportTime: 0
1090
+ });
1091
+ return () => {
1092
+ const duration = this.performanceNow() - startTime;
1093
+ const currentExecution = this.executionStack.pop();
1094
+ if (currentExecution == null) throw new Error("Execution stack is empty, this should never happen");
1095
+ const selfTime = duration - currentExecution.subImportTime;
1096
+ if (this.executionStack.length > 0) this.executionStack.at(-1).subImportTime += duration;
1097
+ return {
1098
+ startOffset,
1099
+ duration,
1100
+ selfTime
1101
+ };
1102
+ };
1103
+ }
1104
+ prepareContext(context) {
1105
+ return context;
1106
+ }
1107
+ /**
1108
+ * Define if a module should be interop-ed
1109
+ * This function mostly for the ability to override by subclass
1110
+ */
1111
+ shouldInterop(path$1, mod) {
1112
+ if (this.options.interopDefault === false) return false;
1113
+ return !path$1.endsWith(".mjs") && "default" in mod;
1114
+ }
1115
+ importExternalModule(path$1) {
1116
+ return import(
1117
+ /* @vite-ignore */
1118
+ path$1
1119
+ );
1120
+ }
1121
+ /**
1122
+ * Import a module and interop it
1123
+ */
1124
+ async interopedImport(path$1) {
1125
+ const importedModule = await this.importExternalModule(path$1);
1126
+ if (!this.shouldInterop(path$1, importedModule)) return importedModule;
1127
+ const { mod, defaultExport } = interopModule(importedModule);
1128
+ return new Proxy(mod, {
1129
+ get(mod$1, prop) {
1130
+ if (prop === "default") return defaultExport;
1131
+ return mod$1[prop] ?? defaultExport?.[prop];
1132
+ },
1133
+ has(mod$1, prop) {
1134
+ if (prop === "default") return defaultExport !== void 0;
1135
+ return prop in mod$1 || defaultExport && prop in defaultExport;
1136
+ },
1137
+ getOwnPropertyDescriptor(mod$1, prop) {
1138
+ const descriptor = Reflect.getOwnPropertyDescriptor(mod$1, prop);
1139
+ if (descriptor) return descriptor;
1140
+ if (prop === "default" && defaultExport !== void 0) return {
1141
+ value: defaultExport,
1142
+ enumerable: true,
1143
+ configurable: true
1144
+ };
1145
+ }
1146
+ });
1147
+ }
1148
+ };
1149
+ function interopModule(mod) {
1150
+ if (isPrimitive(mod)) return {
1151
+ mod: { default: mod },
1152
+ defaultExport: mod
1153
+ };
1154
+ let defaultExport = "default" in mod ? mod.default : mod;
1155
+ if (!isPrimitive(defaultExport) && "__esModule" in defaultExport) {
1156
+ mod = defaultExport;
1157
+ if ("default" in defaultExport) defaultExport = defaultExport.default;
1158
+ }
1159
+ return {
1160
+ mod,
1161
+ defaultExport
1162
+ };
1163
+ }
1164
+ function defineExport(exports, key, value) {
1165
+ Object.defineProperty(exports, key, {
1166
+ enumerable: true,
1167
+ configurable: true,
1168
+ get: value
1169
+ });
1170
+ }
1171
+ function exportAll(exports, sourceModule) {
1172
+ if (exports === sourceModule) return;
1173
+ if (isPrimitive(sourceModule) || Array.isArray(sourceModule) || sourceModule instanceof Promise) return;
1174
+ for (const key in sourceModule) if (key !== "default" && !(key in exports)) try {
1175
+ defineExport(exports, key, () => sourceModule[key]);
1176
+ } catch {}
1177
+ }
1178
+
1179
+ //#endregion
1180
+ //#region ../../node_modules/.pnpm/vite-node@5.2.0_@types+node@24.10.1_jiti@2.6.1_sass-embedded@1.85.1_yaml@2.8.1/node_modules/vite-node/dist/dist-B2ebky9O.mjs
1181
+ var d = {
1182
+ reset: [0, 0],
1183
+ bold: [
1184
+ 1,
1185
+ 22,
1186
+ "\x1B[22m\x1B[1m"
1187
+ ],
1188
+ dim: [
1189
+ 2,
1190
+ 22,
1191
+ "\x1B[22m\x1B[2m"
1192
+ ],
1193
+ italic: [3, 23],
1194
+ underline: [4, 24],
1195
+ inverse: [7, 27],
1196
+ hidden: [8, 28],
1197
+ strikethrough: [9, 29],
1198
+ black: [30, 39],
1199
+ red: [31, 39],
1200
+ green: [32, 39],
1201
+ yellow: [33, 39],
1202
+ blue: [34, 39],
1203
+ magenta: [35, 39],
1204
+ cyan: [36, 39],
1205
+ white: [37, 39],
1206
+ gray: [90, 39],
1207
+ bgBlack: [40, 49],
1208
+ bgRed: [41, 49],
1209
+ bgGreen: [42, 49],
1210
+ bgYellow: [43, 49],
1211
+ bgBlue: [44, 49],
1212
+ bgMagenta: [45, 49],
1213
+ bgCyan: [46, 49],
1214
+ bgWhite: [47, 49],
1215
+ blackBright: [90, 39],
1216
+ redBright: [91, 39],
1217
+ greenBright: [92, 39],
1218
+ yellowBright: [93, 39],
1219
+ blueBright: [94, 39],
1220
+ magentaBright: [95, 39],
1221
+ cyanBright: [96, 39],
1222
+ whiteBright: [97, 39],
1223
+ bgBlackBright: [100, 49],
1224
+ bgRedBright: [101, 49],
1225
+ bgGreenBright: [102, 49],
1226
+ bgYellowBright: [103, 49],
1227
+ bgBlueBright: [104, 49],
1228
+ bgMagentaBright: [105, 49],
1229
+ bgCyanBright: [106, 49],
1230
+ bgWhiteBright: [107, 49]
1231
+ };
1232
+ function g(e) {
1233
+ return String(e);
1234
+ }
1235
+ g.open = "";
1236
+ g.close = "";
1237
+ function h() {
1238
+ let e = typeof process != "undefined" ? process : void 0, n = (e == null ? void 0 : e.env) || {}, a = n.FORCE_TTY !== "false", i = (e == null ? void 0 : e.argv) || [];
1239
+ return !("NO_COLOR" in n || i.includes("--no-color")) && ("FORCE_COLOR" in n || i.includes("--color") || (e == null ? void 0 : e.platform) === "win32" || a && n.TERM !== "dumb" || "CI" in n) || typeof window != "undefined" && !!window.chrome;
1240
+ }
1241
+ function f() {
1242
+ let e = h(), n = (r, t, u, o) => {
1243
+ let l = "", s = 0;
1244
+ do
1245
+ l += r.substring(s, o) + u, s = o + t.length, o = r.indexOf(t, s);
1246
+ while (~o);
1247
+ return l + r.substring(s);
1248
+ }, a = (r, t, u = r) => {
1249
+ let o = (l) => {
1250
+ let s = String(l), b = s.indexOf(t, r.length);
1251
+ return ~b ? r + n(s, t, u, b) + t : r + s + t;
1252
+ };
1253
+ return o.open = r, o.close = t, o;
1254
+ }, i = { isColorSupported: e }, c = (r) => `\x1B[${r}m`;
1255
+ for (let r in d) {
1256
+ let t = d[r];
1257
+ i[r] = e ? a(c(t[0]), c(t[1]), t[2]) : g;
1258
+ }
1259
+ return i;
1260
+ }
1261
+ var C = f();
1262
+
1263
+ //#endregion
1264
+ //#region ../../node_modules/.pnpm/vite-node@5.2.0_@types+node@24.10.1_jiti@2.6.1_sass-embedded@1.85.1_yaml@2.8.1/node_modules/vite-node/dist/constants-DRkacFwN.mjs
1265
+ const KNOWN_ASSET_TYPES = [
1266
+ "apng",
1267
+ "bmp",
1268
+ "png",
1269
+ "jpe?g",
1270
+ "jfif",
1271
+ "pjpeg",
1272
+ "pjp",
1273
+ "gif",
1274
+ "svg",
1275
+ "ico",
1276
+ "webp",
1277
+ "avif",
1278
+ "mp4",
1279
+ "webm",
1280
+ "ogg",
1281
+ "mp3",
1282
+ "wav",
1283
+ "flac",
1284
+ "aac",
1285
+ "woff2?",
1286
+ "eot",
1287
+ "ttf",
1288
+ "otf",
1289
+ "webmanifest",
1290
+ "pdf",
1291
+ "txt"
1292
+ ];
1293
+ const KNOWN_ASSET_RE = /* @__PURE__ */ new RegExp(`\\.(${KNOWN_ASSET_TYPES.join("|")})$`);
1294
+
1295
+ //#endregion
1296
+ //#region ../../node_modules/.pnpm/es-module-lexer@1.7.0/node_modules/es-module-lexer/dist/lexer.js
1297
+ var ImportType;
1298
+ (function(A$1) {
1299
+ A$1[A$1.Static = 1] = "Static", A$1[A$1.Dynamic = 2] = "Dynamic", A$1[A$1.ImportMeta = 3] = "ImportMeta", A$1[A$1.StaticSourcePhase = 4] = "StaticSourcePhase", A$1[A$1.DynamicSourcePhase = 5] = "DynamicSourcePhase", A$1[A$1.StaticDeferPhase = 6] = "StaticDeferPhase", A$1[A$1.DynamicDeferPhase = 7] = "DynamicDeferPhase";
1300
+ })(ImportType || (ImportType = {}));
1301
+ const A = 1 === new Uint8Array(new Uint16Array([1]).buffer)[0];
1302
+ function parse$1(E$1, g$1 = "@") {
1303
+ if (!C$1) return init.then((() => parse$1(E$1)));
1304
+ const I = E$1.length + 1, w = (C$1.__heap_base.value || C$1.__heap_base) + 4 * I - C$1.memory.buffer.byteLength;
1305
+ w > 0 && C$1.memory.grow(Math.ceil(w / 65536));
1306
+ const K = C$1.sa(I - 1);
1307
+ if ((A ? B : Q)(E$1, new Uint16Array(C$1.memory.buffer, K, I)), !C$1.parse()) throw Object.assign(/* @__PURE__ */ new Error(`Parse error ${g$1}:${E$1.slice(0, C$1.e()).split("\n").length}:${C$1.e() - E$1.lastIndexOf("\n", C$1.e() - 1)}`), { idx: C$1.e() });
1308
+ const o = [], D = [];
1309
+ for (; C$1.ri();) {
1310
+ const A$1 = C$1.is(), Q$1 = C$1.ie(), B$1 = C$1.it(), g$2 = C$1.ai(), I$1 = C$1.id(), w$1 = C$1.ss(), K$1 = C$1.se();
1311
+ let D$1;
1312
+ C$1.ip() && (D$1 = k(E$1.slice(-1 === I$1 ? A$1 - 1 : A$1, -1 === I$1 ? Q$1 + 1 : Q$1))), o.push({
1313
+ n: D$1,
1314
+ t: B$1,
1315
+ s: A$1,
1316
+ e: Q$1,
1317
+ ss: w$1,
1318
+ se: K$1,
1319
+ d: I$1,
1320
+ a: g$2
1321
+ });
1322
+ }
1323
+ for (; C$1.re();) {
1324
+ const A$1 = C$1.es(), Q$1 = C$1.ee(), B$1 = C$1.els(), g$2 = C$1.ele(), I$1 = E$1.slice(A$1, Q$1), w$1 = I$1[0], K$1 = B$1 < 0 ? void 0 : E$1.slice(B$1, g$2), o$1 = K$1 ? K$1[0] : "";
1325
+ D.push({
1326
+ s: A$1,
1327
+ e: Q$1,
1328
+ ls: B$1,
1329
+ le: g$2,
1330
+ n: "\"" === w$1 || "'" === w$1 ? k(I$1) : I$1,
1331
+ ln: "\"" === o$1 || "'" === o$1 ? k(K$1) : K$1
1332
+ });
1333
+ }
1334
+ function k(A$1) {
1335
+ try {
1336
+ return (0, eval)(A$1);
1337
+ } catch (A$2) {}
1338
+ }
1339
+ return [
1340
+ o,
1341
+ D,
1342
+ !!C$1.f(),
1343
+ !!C$1.ms()
1344
+ ];
1345
+ }
1346
+ function Q(A$1, Q$1) {
1347
+ const B$1 = A$1.length;
1348
+ let C$2 = 0;
1349
+ for (; C$2 < B$1;) {
1350
+ const B$2 = A$1.charCodeAt(C$2);
1351
+ Q$1[C$2++] = (255 & B$2) << 8 | B$2 >>> 8;
1352
+ }
1353
+ }
1354
+ function B(A$1, Q$1) {
1355
+ const B$1 = A$1.length;
1356
+ let C$2 = 0;
1357
+ for (; C$2 < B$1;) Q$1[C$2] = A$1.charCodeAt(C$2++);
1358
+ }
1359
+ let C$1;
1360
+ const E = () => {
1361
+ return A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QB0AGEAbwB1AHIAYwBlAHIAbwBtAHUAbgBjAHQAaQBvAG4AcwBzAGUAcgB0AHYAbwB5AGkAZQBkAGUAbABlAGMAbwBuAHQAaQBuAGkAbgBzAHQAYQBuAHQAeQBiAHIAZQBhAHIAZQB0AHUAcgBkAGUAYgB1AGcAZwBlAGEAdwBhAGkAdABoAHIAdwBoAGkAbABlAGkAZgBjAGEAdABjAGYAaQBuAGEAbABsAGUAbABzAABB0AkLEAEAAAACAAAAAAQAAEA5AAA=", "undefined" != typeof Buffer ? Buffer.from(A$1, "base64") : Uint8Array.from(atob(A$1), ((A$2) => A$2.charCodeAt(0)));
1362
+ var A$1;
1363
+ };
1364
+ const init = WebAssembly.compile(E()).then(WebAssembly.instantiate).then((({ exports: A$1 }) => {
1365
+ C$1 = A$1;
1366
+ }));
1367
+
1368
+ //#endregion
1369
+ //#region ../../node_modules/.pnpm/vite-node@5.2.0_@types+node@24.10.1_jiti@2.6.1_sass-embedded@1.85.1_yaml@2.8.1/node_modules/vite-node/dist/server-BWywEVuB.mjs
1370
+ function hashCode(s) {
1371
+ return s.split("").reduce((a, b) => {
1372
+ a = (a << 5) - a + b.charCodeAt(0);
1373
+ return a & a;
1374
+ }, 0);
1375
+ }
1376
+ var Debugger = class {
1377
+ dumpDir;
1378
+ initPromise;
1379
+ externalizeMap = /* @__PURE__ */ new Map();
1380
+ constructor(root, options) {
1381
+ this.options = options;
1382
+ if (options.dumpModules) this.dumpDir = resolve$1(root, options.dumpModules === true ? ".vite-node/dump" : options.dumpModules);
1383
+ if (this.dumpDir) if (options.loadDumppedModules) console.info(C.gray(`[vite-node] [debug] load modules from ${this.dumpDir}`));
1384
+ else console.info(C.gray(`[vite-node] [debug] dump modules to ${this.dumpDir}`));
1385
+ this.initPromise = this.clearDump();
1386
+ }
1387
+ async clearDump() {
1388
+ if (!this.dumpDir) return;
1389
+ if (!this.options.loadDumppedModules && existsSync(this.dumpDir)) await promises.rm(this.dumpDir, {
1390
+ recursive: true,
1391
+ force: true
1392
+ });
1393
+ await promises.mkdir(this.dumpDir, { recursive: true });
1394
+ }
1395
+ encodeId(id) {
1396
+ return `${id.replace(/[^\w@\-]/g, "_").replace(/_+/g, "_")}-${hashCode(id)}.js`;
1397
+ }
1398
+ async recordExternalize(id, path$1) {
1399
+ if (!this.dumpDir) return;
1400
+ this.externalizeMap.set(id, path$1);
1401
+ await this.writeInfo();
1402
+ }
1403
+ async dumpFile(id, result) {
1404
+ if (!result || !this.dumpDir) return;
1405
+ await this.initPromise;
1406
+ const name = this.encodeId(id);
1407
+ return await promises.writeFile(join(this.dumpDir, name), `// ${id.replace(/\0/g, "\\0")}\n${result.code}`, "utf-8");
1408
+ }
1409
+ async loadDump(id) {
1410
+ if (!this.dumpDir) return null;
1411
+ await this.initPromise;
1412
+ const name = this.encodeId(id);
1413
+ const path$1 = join(this.dumpDir, name);
1414
+ if (!existsSync(path$1)) return null;
1415
+ return {
1416
+ code: (await promises.readFile(path$1, "utf-8")).replace(/^\/\/.*\n/, ""),
1417
+ map: void 0
1418
+ };
1419
+ }
1420
+ async writeInfo() {
1421
+ if (!this.dumpDir) return;
1422
+ const info = JSON.stringify({
1423
+ time: (/* @__PURE__ */ new Date()).toLocaleString(),
1424
+ externalize: Object.fromEntries(this.externalizeMap.entries())
1425
+ }, null, 2);
1426
+ return promises.writeFile(join(this.dumpDir, "info.json"), info, "utf-8");
1427
+ }
1428
+ };
1429
+ const BUILTIN_EXTENSIONS = new Set([
1430
+ ".mjs",
1431
+ ".cjs",
1432
+ ".node",
1433
+ ".wasm"
1434
+ ]);
1435
+ const ESM_EXT_RE = /\.(es|esm|esm-browser|esm-bundler|es6|module)\.js$/;
1436
+ const ESM_FOLDER_RE = /\/(es|esm)\/(.*\.js)$/;
1437
+ const defaultInline = [
1438
+ /virtual:/,
1439
+ /\.[mc]?ts$/,
1440
+ /[?&](init|raw|url|inline)\b/,
1441
+ KNOWN_ASSET_RE
1442
+ ];
1443
+ const depsExternal = [/\/node_modules\/.*\.cjs\.js$/, /\/node_modules\/.*\.mjs$/];
1444
+ function guessCJSversion(id) {
1445
+ if (id.match(ESM_EXT_RE)) {
1446
+ for (const i of [
1447
+ id.replace(ESM_EXT_RE, ".mjs"),
1448
+ id.replace(ESM_EXT_RE, ".umd.js"),
1449
+ id.replace(ESM_EXT_RE, ".cjs.js"),
1450
+ id.replace(ESM_EXT_RE, ".js")
1451
+ ]) if (existsSync(i)) return i;
1452
+ }
1453
+ if (id.match(ESM_FOLDER_RE)) {
1454
+ for (const i of [
1455
+ id.replace(ESM_FOLDER_RE, "/umd/$1"),
1456
+ id.replace(ESM_FOLDER_RE, "/cjs/$1"),
1457
+ id.replace(ESM_FOLDER_RE, "/lib/$1"),
1458
+ id.replace(ESM_FOLDER_RE, "/$1")
1459
+ ]) if (existsSync(i)) return i;
1460
+ }
1461
+ }
1462
+ async function isValidNodeImport(id) {
1463
+ const extension = extname(id);
1464
+ if (BUILTIN_EXTENSIONS.has(extension)) return true;
1465
+ if (extension !== ".js") return false;
1466
+ id = id.replace("file:///", "");
1467
+ if ((await findNearestPackageData(dirname$1(id))).type === "module") return true;
1468
+ if (/\.(?:\w+-)?esm?(?:-\w+)?\.js$|\/esm?\//.test(id)) return false;
1469
+ try {
1470
+ await init;
1471
+ const code = await promises.readFile(id, "utf8");
1472
+ const [, , , hasModuleSyntax] = parse$1(code);
1473
+ return !hasModuleSyntax;
1474
+ } catch {
1475
+ return false;
1476
+ }
1477
+ }
1478
+ const _defaultExternalizeCache = /* @__PURE__ */ new Map();
1479
+ async function shouldExternalize(id, options, cache = _defaultExternalizeCache) {
1480
+ if (!cache.has(id)) cache.set(id, _shouldExternalize(id, options));
1481
+ return cache.get(id);
1482
+ }
1483
+ async function _shouldExternalize(id, options) {
1484
+ if (isNodeBuiltin(id)) return id;
1485
+ if (id.startsWith("data:") || /^(?:https?:)?\/\//.test(id)) return id;
1486
+ id = patchWindowsImportPath(id);
1487
+ const moduleDirectories = options?.moduleDirectories || ["/node_modules/"];
1488
+ if (matchExternalizePattern(id, moduleDirectories, options?.inline)) return false;
1489
+ if (options?.inlineFiles && options?.inlineFiles.includes(id)) return false;
1490
+ if (matchExternalizePattern(id, moduleDirectories, options?.external)) return id;
1491
+ if (options?.cacheDir && id.includes(options.cacheDir)) return id;
1492
+ const isLibraryModule = moduleDirectories.some((dir) => id.includes(dir));
1493
+ id = isLibraryModule && options?.fallbackCJS ? guessCJSversion(id) || id : id;
1494
+ if (matchExternalizePattern(id, moduleDirectories, defaultInline)) return false;
1495
+ if (matchExternalizePattern(id, moduleDirectories, depsExternal)) return id;
1496
+ if (isLibraryModule && await isValidNodeImport(id)) return id;
1497
+ return false;
1498
+ }
1499
+ function matchExternalizePattern(id, moduleDirectories, patterns) {
1500
+ if (patterns == null) return false;
1501
+ if (patterns === true) return true;
1502
+ for (const ex of patterns) if (typeof ex === "string") {
1503
+ if (moduleDirectories.some((dir) => id.includes(join(dir, ex)))) return true;
1504
+ } else if (ex.test(id)) return true;
1505
+ return false;
1506
+ }
1507
+ function patchWindowsImportPath(path$1) {
1508
+ if (path$1.match(/^\w:\\/)) return `file:///${slash(path$1)}`;
1509
+ else if (path$1.match(/^\w:\//)) return `file:///${path$1}`;
1510
+ else return path$1;
1511
+ }
1512
+ const debugRequest = createDebug("vite-node:server:request");
1513
+ var ViteNodeServer = class {
1514
+ fetchPromiseMap = {
1515
+ ssr: /* @__PURE__ */ new Map(),
1516
+ web: /* @__PURE__ */ new Map()
1517
+ };
1518
+ transformPromiseMap = {
1519
+ ssr: /* @__PURE__ */ new Map(),
1520
+ web: /* @__PURE__ */ new Map()
1521
+ };
1522
+ durations = {
1523
+ ssr: /* @__PURE__ */ new Map(),
1524
+ web: /* @__PURE__ */ new Map()
1525
+ };
1526
+ existingOptimizedDeps = /* @__PURE__ */ new Set();
1527
+ fetchCaches = {
1528
+ ssr: /* @__PURE__ */ new Map(),
1529
+ web: /* @__PURE__ */ new Map()
1530
+ };
1531
+ fetchCache = /* @__PURE__ */ new Map();
1532
+ externalizeCache = /* @__PURE__ */ new Map();
1533
+ debugger;
1534
+ constructor(server, options = {}) {
1535
+ this.server = server;
1536
+ this.options = options;
1537
+ const ssrOptions = server.config.ssr;
1538
+ options.deps ??= {};
1539
+ options.deps.cacheDir = relative(server.config.root, options.deps.cacheDir || server.config.cacheDir);
1540
+ if (ssrOptions) {
1541
+ if (ssrOptions.noExternal === true) options.deps.inline ??= true;
1542
+ else if (options.deps.inline !== true) {
1543
+ options.deps.inline ??= [];
1544
+ const inline = options.deps.inline;
1545
+ options.deps.inline.push(...toArray(ssrOptions.noExternal).filter((dep) => !inline.includes(dep)));
1546
+ }
1547
+ }
1548
+ if (process$1.env.VITE_NODE_DEBUG_DUMP) options.debug = Object.assign({
1549
+ dumpModules: !!process$1.env.VITE_NODE_DEBUG_DUMP,
1550
+ loadDumppedModules: process$1.env.VITE_NODE_DEBUG_DUMP === "load"
1551
+ }, options.debug ?? {});
1552
+ if (options.debug) this.debugger = new Debugger(server.config.root, options.debug);
1553
+ if (options.deps.inlineFiles) options.deps.inlineFiles = options.deps.inlineFiles.flatMap((file) => {
1554
+ if (file.startsWith("file://")) return file;
1555
+ const resolvedId = resolve$1(file);
1556
+ return [resolvedId, pathToFileURL(resolvedId).href];
1557
+ });
1558
+ options.deps.moduleDirectories ??= [];
1559
+ const customModuleDirectories = (process$1.env.VITE_NODE_DEPS_MODULE_DIRECTORIES || process$1.env.npm_config_VITE_NODE_DEPS_MODULE_DIRECTORIES)?.split(",");
1560
+ if (customModuleDirectories) options.deps.moduleDirectories.push(...customModuleDirectories);
1561
+ options.deps.moduleDirectories = options.deps.moduleDirectories.map((dir) => {
1562
+ if (!dir.startsWith("/")) dir = `/${dir}`;
1563
+ if (!dir.endsWith("/")) dir += "/";
1564
+ return normalize(dir);
1565
+ });
1566
+ if (!options.deps.moduleDirectories.includes("/node_modules/")) options.deps.moduleDirectories.push("/node_modules/");
1567
+ }
1568
+ shouldExternalize(id) {
1569
+ return shouldExternalize(id, this.options.deps, this.externalizeCache);
1570
+ }
1571
+ getTotalDuration() {
1572
+ const ssrDurations = [...this.durations.ssr.values()].flat();
1573
+ const webDurations = [...this.durations.web.values()].flat();
1574
+ return [...ssrDurations, ...webDurations].reduce((a, b) => a + b, 0);
1575
+ }
1576
+ async ensureExists(id) {
1577
+ if (this.existingOptimizedDeps.has(id)) return true;
1578
+ if (existsSync(id)) {
1579
+ this.existingOptimizedDeps.add(id);
1580
+ return true;
1581
+ }
1582
+ return new Promise((resolve$1$1) => {
1583
+ setTimeout(() => {
1584
+ this.ensureExists(id).then(() => {
1585
+ resolve$1$1(true);
1586
+ });
1587
+ });
1588
+ });
1589
+ }
1590
+ async resolveId(id, importer, transformMode) {
1591
+ if (importer && !importer.startsWith(withTrailingSlash(this.server.config.root))) importer = resolve$1(this.server.config.root, importer);
1592
+ const mode = transformMode ?? (importer && this.getTransformMode(importer) || "ssr");
1593
+ return this.server.pluginContainer.resolveId(id, importer, { ssr: mode === "ssr" });
1594
+ }
1595
+ getSourceMap(source) {
1596
+ source = normalizeModuleId(source);
1597
+ const fetchResult = this.fetchCache.get(source)?.result;
1598
+ if (fetchResult?.map) return fetchResult.map;
1599
+ return (this.server.moduleGraph.getModuleById(source)?.ssrTransformResult)?.map || null;
1600
+ }
1601
+ assertMode(mode) {
1602
+ assert(mode === "web" || mode === "ssr", `"transformMode" can only be "web" or "ssr", received "${mode}".`);
1603
+ }
1604
+ async fetchModule(id, transformMode) {
1605
+ const mode = transformMode || this.getTransformMode(id);
1606
+ return this.fetchResult(id, mode).then((r) => {
1607
+ return this.options.sourcemap !== true ? {
1608
+ ...r,
1609
+ map: void 0
1610
+ } : r;
1611
+ });
1612
+ }
1613
+ async fetchResult(id, mode) {
1614
+ const moduleId = normalizeModuleId(id);
1615
+ this.assertMode(mode);
1616
+ const promiseMap = this.fetchPromiseMap[mode];
1617
+ if (!promiseMap.has(moduleId)) promiseMap.set(moduleId, this._fetchModule(moduleId, mode).finally(() => {
1618
+ promiseMap.delete(moduleId);
1619
+ }));
1620
+ return promiseMap.get(moduleId);
1621
+ }
1622
+ async transformRequest(id, filepath = id, transformMode) {
1623
+ const mode = transformMode || this.getTransformMode(id);
1624
+ this.assertMode(mode);
1625
+ const promiseMap = this.transformPromiseMap[mode];
1626
+ if (!promiseMap.has(id)) promiseMap.set(id, this._transformRequest(id, filepath, mode).finally(() => {
1627
+ promiseMap.delete(id);
1628
+ }));
1629
+ return promiseMap.get(id);
1630
+ }
1631
+ async transformModule(id, transformMode) {
1632
+ if (transformMode !== "web") throw new Error("`transformModule` only supports `transformMode: \"web\"`.");
1633
+ const normalizedId = normalizeModuleId(id);
1634
+ return { code: (this.server.moduleGraph.getModuleById(normalizedId)?.transformResult || await this.server.transformRequest(normalizedId))?.code };
1635
+ }
1636
+ getTransformMode(id) {
1637
+ const withoutQuery = id.split("?")[0];
1638
+ if (this.options.transformMode?.web?.some((r) => withoutQuery.match(r))) return "web";
1639
+ if (this.options.transformMode?.ssr?.some((r) => withoutQuery.match(r))) return "ssr";
1640
+ if (withoutQuery.match(/\.([cm]?[jt]sx?|json)$/)) return "ssr";
1641
+ return "web";
1642
+ }
1643
+ getChangedModule(id, file) {
1644
+ const module = this.server.moduleGraph.getModuleById(id) || this.server.moduleGraph.getModuleById(file);
1645
+ if (module) return module;
1646
+ const _modules = this.server.moduleGraph.getModulesByFile(file);
1647
+ if (!_modules || !_modules.size) return null;
1648
+ let mod = [..._modules][0];
1649
+ let latestMax = -1;
1650
+ for (const m of _modules) {
1651
+ const timestamp = Math.max(m.lastHMRTimestamp, m.lastInvalidationTimestamp);
1652
+ if (timestamp > latestMax) {
1653
+ latestMax = timestamp;
1654
+ mod = m;
1655
+ }
1656
+ }
1657
+ return mod;
1658
+ }
1659
+ async _fetchModule(id, transformMode) {
1660
+ let result;
1661
+ const cacheDir = this.options.deps?.cacheDir;
1662
+ if (cacheDir && id.includes(cacheDir)) {
1663
+ if (!id.startsWith(withTrailingSlash(this.server.config.root))) id = join(this.server.config.root, id);
1664
+ const timeout = setTimeout(() => {
1665
+ throw new Error(`ViteNodeServer: ${id} not found. This is a bug, please report it.`);
1666
+ }, 5e3);
1667
+ await this.ensureExists(id);
1668
+ clearTimeout(timeout);
1669
+ }
1670
+ const { path: filePath } = toFilePath(id, this.server.config.root);
1671
+ const moduleNode = this.getChangedModule(id, filePath);
1672
+ const cache = this.fetchCaches[transformMode].get(filePath);
1673
+ const timestamp = moduleNode ? Math.max(moduleNode.lastHMRTimestamp, moduleNode.lastInvalidationTimestamp) : 0;
1674
+ if (cache && (timestamp === 0 || cache.timestamp >= timestamp)) return cache.result;
1675
+ const time$1 = Date.now();
1676
+ const externalize = await this.shouldExternalize(filePath);
1677
+ let duration;
1678
+ if (externalize) {
1679
+ result = { externalize };
1680
+ this.debugger?.recordExternalize(id, externalize);
1681
+ } else {
1682
+ const start = performance$1.now();
1683
+ const r = await this._transformRequest(id, filePath, transformMode);
1684
+ duration = performance$1.now() - start;
1685
+ result = {
1686
+ code: r?.code,
1687
+ map: r?.map
1688
+ };
1689
+ }
1690
+ const cacheEntry = {
1691
+ duration,
1692
+ timestamp: time$1,
1693
+ result
1694
+ };
1695
+ const durations = this.durations[transformMode].get(filePath) || [];
1696
+ this.durations[transformMode].set(filePath, [...durations, duration ?? 0]);
1697
+ this.fetchCaches[transformMode].set(filePath, cacheEntry);
1698
+ this.fetchCache.set(filePath, cacheEntry);
1699
+ return result;
1700
+ }
1701
+ async processTransformResult(filepath, result) {
1702
+ return withInlineSourcemap(result, {
1703
+ filepath: this.server.moduleGraph.getModuleById(filepath)?.file || filepath,
1704
+ root: this.server.config.root,
1705
+ noFirstLineMapping: Number(version.split(".")[0]) >= 6
1706
+ });
1707
+ }
1708
+ async _transformRequest(id, filepath, transformMode) {
1709
+ debugRequest(id);
1710
+ let result = null;
1711
+ if (this.options.debug?.loadDumppedModules) {
1712
+ result = await this.debugger?.loadDump(id) ?? null;
1713
+ if (result) return result;
1714
+ }
1715
+ if (transformMode === "web") {
1716
+ result = await this.server.transformRequest(id);
1717
+ if (result) result = await this.server.ssrTransform(result.code, result.map, id);
1718
+ } else result = await this.server.transformRequest(id, { ssr: true });
1719
+ if ((this.options.sourcemap ?? "inline") === "inline" && result) result = await this.processTransformResult(filepath, result);
1720
+ if (this.options.debug?.dumpModules) await this.debugger?.dumpFile(id, result);
1721
+ return result;
1722
+ }
1723
+ };
1724
+
1725
+ //#endregion
22
1726
  //#region src/shared.ts
23
1727
  const cwd = new URL(`${pathToFileURL(process.cwd())}/`);
24
- const DEFAULT_CONFIG_PATH = new URL("./terrazzo.config.mjs", cwd);
1728
+ const DEFAULT_CONFIG_PATH = new URL("./terrazzo.config.ts", cwd);
25
1729
  const DEFAULT_TOKENS_PATH = new URL("./tokens.json", cwd);
26
1730
  const GREEN_CHECK = pc.green("✔");
27
1731
  /** Load config */
28
1732
  async function loadConfig({ cmd, flags, logger }) {
1733
+ /**
1734
+ * Vite server for loading .ts config files
1735
+ * TODO: remove me when Node 24 is the oldest-supported Node version
1736
+ */
1737
+ let viteServer;
29
1738
  try {
30
1739
  let config = {
31
1740
  tokens: [DEFAULT_TOKENS_PATH],
@@ -50,11 +1759,26 @@ async function loadConfig({ cmd, flags, logger }) {
50
1759
  process.exit(1);
51
1760
  }
52
1761
  configPath = resolveConfig(flags.config);
1762
+ if (!configPath) logger.error({
1763
+ group: "config",
1764
+ message: `Could not locate ${flags.config}`
1765
+ });
53
1766
  }
54
1767
  const resolvedConfigPath = resolveConfig(configPath);
55
1768
  if (resolvedConfigPath) try {
56
- const mod = await import(resolvedConfigPath);
57
- if (!mod.default) throw new Error(`No default export found in ${path.relative(cwd.href, resolvedConfigPath)}. See https://terrazzo.dev/docs/cli for instructions.`);
1769
+ viteServer = await createServer({ mode: "development" });
1770
+ const viteNodeServer = new ViteNodeServer(viteServer);
1771
+ const mod = await new ViteNodeRunner({
1772
+ root: viteServer.config.root,
1773
+ base: viteServer.config.base,
1774
+ fetchModule(...args) {
1775
+ return viteNodeServer.fetchModule(...args);
1776
+ },
1777
+ resolveId(...args) {
1778
+ return viteNodeServer.resolveId(...args);
1779
+ }
1780
+ }).executeFile(resolvedConfigPath);
1781
+ if (!mod.default) throw new Error(`No default export found in ${resolvedConfigPath}. See https://terrazzo.dev/docs for instructions.`);
58
1782
  config = defineConfig$1(mod.default, {
59
1783
  cwd,
60
1784
  logger
@@ -69,12 +1793,14 @@ async function loadConfig({ cmd, flags, logger }) {
69
1793
  group: "config",
70
1794
  message: "No config file found. Create one with `npx terrazzo init`."
71
1795
  });
1796
+ if (viteServer) await viteServer?.close();
72
1797
  return {
73
1798
  config,
74
1799
  configPath: resolvedConfigPath
75
1800
  };
76
1801
  } catch (err) {
77
1802
  printError(err.message);
1803
+ if (viteServer) await viteServer.close();
78
1804
  process.exit(1);
79
1805
  }
80
1806
  }
@@ -185,16 +1911,18 @@ function printSuccess(message, startTime) {
185
1911
  }
186
1912
  /** Resolve config */
187
1913
  function resolveConfig(filename) {
188
- if (filename) {
189
- const configPath = new URL(filename, cwd);
190
- if (fs.existsSync(configPath)) return configPath.href;
191
- return;
192
- }
193
- return [
1914
+ if (filename && fs.existsSync(new URL(filename, cwd))) return filename;
1915
+ for (const ext of [
1916
+ ".ts",
194
1917
  ".js",
1918
+ ".mts",
1919
+ ".cts",
195
1920
  ".mjs",
196
1921
  ".cjs"
197
- ].map((ext) => new URL(`./terrazzo.config${ext}`, cwd)).find((configPath) => fs.existsSync(configPath))?.href;
1922
+ ]) {
1923
+ const maybeFilename = `terrazzo.config${ext}`;
1924
+ if (fs.existsSync(maybeFilename)) return maybeFilename;
1925
+ }
198
1926
  }
199
1927
  /** Resolve tokens.json path (for lint command) */
200
1928
  function resolveTokenPath(filename, { logger }) {
@@ -223,7 +1951,7 @@ async function buildCmd({ config, configPath, flags, logger }) {
223
1951
  const startTime = performance.now();
224
1952
  if (!Array.isArray(config.plugins) || !config.plugins.length) logger.error({
225
1953
  group: "config",
226
- message: `No plugins defined! Add some in ${configPath || "terrazzo.config.js"}`
1954
+ message: `No plugins defined! Add some in ${configPath || "terrazzo.config.ts"}`
227
1955
  });
228
1956
  let rawSchemas = await loadTokens(config.tokens, { logger });
229
1957
  if (!rawSchemas) {
@@ -319,8 +2047,7 @@ function writeFiles(result, { config, logger }) {
319
2047
  async function checkCmd({ config, logger, positionals }) {
320
2048
  try {
321
2049
  const startTime = performance.now();
322
- const tokenPaths = positionals.slice(1).length ? positionals.slice(1).map((tokenPath) => resolveTokenPath(tokenPath, { logger })) : config.tokens;
323
- const sources = await loadTokens(tokenPaths, { logger });
2050
+ const sources = await loadTokens(positionals.slice(1).length ? positionals.slice(1).map((tokenPath) => resolveTokenPath(tokenPath, { logger })) : config.tokens, { logger });
324
2051
  if (!sources?.length) {
325
2052
  logger.error({
326
2053
  group: "config",
@@ -357,7 +2084,7 @@ function helpCmd() {
357
2084
 
358
2085
  [options]
359
2086
  --help Show this message
360
- --config, -c Path to config (default: ./terrazzo.config.js)
2087
+ --config, -c Path to config (default: ./terrazzo.config.ts)
361
2088
  --quiet Suppress warnings
362
2089
  `);
363
2090
  }
@@ -484,14 +2211,14 @@ async function initCmd({ logger }) {
484
2211
  const pluginCount = `${newPlugins.length} ${pluralize(newPlugins.length, "plugin", "plugins")}`;
485
2212
  const s = spinner();
486
2213
  s.start(`Installing ${pluginCount}`);
487
- await new Promise((resolve, reject) => {
2214
+ await new Promise((resolve$2, reject) => {
488
2215
  const subprocess = exec([
489
2216
  packageManager,
490
2217
  INSTALL_COMMAND[packageManager],
491
2218
  newPlugins.join(" ")
492
2219
  ].join(" "), { cwd });
493
2220
  subprocess.on("error", reject);
494
- subprocess.on("exit", resolve);
2221
+ subprocess.on("exit", resolve$2);
495
2222
  });
496
2223
  s.message("Updating config");
497
2224
  if (configPath) {
@@ -568,8 +2295,10 @@ export default defineConfig({
568
2295
  ],
569
2296
  outDir: './dist/',
570
2297
  lint: {
571
- /** @see https://terrazzo.app/docs/cli/lint */
572
- enabled: true,
2298
+ /** @see https://terrazzo.app/docs/linting */
2299
+ build: {
2300
+ enabled: true,
2301
+ },
573
2302
  rules: {
574
2303
  'core/valid-color': 'error',
575
2304
  'core/valid-dimension': 'error',
@@ -588,7 +2317,6 @@ export default defineConfig({
588
2317
  'core/valid-gradient': 'error',
589
2318
  'core/valid-typography': 'error',
590
2319
  'core/consistent-naming': 'warn',
591
- 'no-type-on-alias': 'warn',
592
2320
  },
593
2321
  },
594
2322
  });`);
@@ -644,8 +2372,8 @@ async function labCmd({ config, logger }) {
644
2372
  /**
645
2373
  * The cli entrypoint is going to manually exit the process after labCmd returns.
646
2374
  */
647
- await new Promise((resolve, reject) => {
648
- server.on("close", resolve);
2375
+ await new Promise((resolve$2, reject) => {
2376
+ server.on("close", resolve$2);
649
2377
  server.on("error", reject);
650
2378
  });
651
2379
  }
@@ -685,7 +2413,7 @@ async function normalizeCmd(filename, { logger, output }) {
685
2413
  } } }, { cwd }),
686
2414
  logger
687
2415
  });
688
- await traverseAsync(document, { async enter(node, _parent, nodePath) {
2416
+ traverse(document, { enter(node, _parent, nodePath) {
689
2417
  const token = tokens[nodePath.join(".")];
690
2418
  if (!token || token.aliasOf || node.type !== "Member" || node.value.type !== "Object") return;
691
2419
  const $valueI = node.value.members.findIndex(findMember("$value"));
@@ -767,8 +2495,8 @@ function normalizeTypography(node) {
767
2495
  //#endregion
768
2496
  //#region src/version.ts
769
2497
  function versionCmd() {
770
- const { version } = JSON.parse(fs.readFileSync(new URL("../package.json", import.meta.url), "utf8"));
771
- console.log(version);
2498
+ const { version: version$1 } = JSON.parse(fs.readFileSync(new URL("../package.json", import.meta.url), "utf8"));
2499
+ console.log(version$1);
772
2500
  }
773
2501
 
774
2502
  //#endregion