eser 4.0.8 → 4.0.10

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.
Files changed (2) hide show
  1. package/eser.js +1243 -1206
  2. package/package.json +1 -1
package/eser.js CHANGED
@@ -215,91 +215,435 @@ var init_platform = __esm({
215
215
  }
216
216
  });
217
217
 
218
- // deno:https://jsr.io/@std/internal/1.0.12/_os.ts
219
- function checkWindows() {
220
- const global = globalThis;
221
- const os = global.Deno?.build?.os;
222
- return typeof os === "string" ? os === "windows" : global.navigator?.platform?.startsWith("Win") ?? global.process?.platform?.startsWith("win") ?? false;
223
- }
224
- var init_os = __esm({
225
- "deno:https://jsr.io/@std/internal/1.0.12/_os.ts"() {
226
- }
227
- });
228
-
229
- // deno:https://jsr.io/@std/internal/1.0.12/os.ts
230
- var isWindows;
231
- var init_os2 = __esm({
232
- "deno:https://jsr.io/@std/internal/1.0.12/os.ts"() {
233
- init_os();
234
- isWindows = checkWindows();
235
- }
236
- });
237
-
238
- // deno:https://jsr.io/@std/path/1.1.4/_common/assert_path.ts
239
- function assertPath(path) {
240
- if (typeof path !== "string") {
241
- throw new TypeError(`Path must be a string, received "${JSON.stringify(path)}"`);
242
- }
243
- }
244
- var init_assert_path = __esm({
245
- "deno:https://jsr.io/@std/path/1.1.4/_common/assert_path.ts"() {
218
+ // pkg/@eser/standards/runtime/polyfills/path.ts
219
+ var POSIX_SEP, POSIX_DELIMITER, normalizeSlashes, join, resolve, dirname, basename, extname, normalize, isAbsolute, relative, parse, format, posixPath;
220
+ var init_path = __esm({
221
+ "pkg/@eser/standards/runtime/polyfills/path.ts"() {
222
+ POSIX_SEP = "/";
223
+ POSIX_DELIMITER = ":";
224
+ normalizeSlashes = (path) => {
225
+ return path.replace(/\\/g, "/").replace(/\/+/g, "/");
226
+ };
227
+ join = (...paths) => {
228
+ if (paths.length === 0) return ".";
229
+ const joined = paths.filter((p) => p.length > 0).join(POSIX_SEP);
230
+ if (joined.length === 0) return ".";
231
+ return normalize(joined);
232
+ };
233
+ resolve = (...paths) => {
234
+ let resolvedPath = "";
235
+ let resolvedAbsolute = false;
236
+ for (let i = paths.length - 1; i >= 0 && !resolvedAbsolute; i--) {
237
+ const segment = paths[i];
238
+ if (segment === void 0 || segment.length === 0) continue;
239
+ resolvedPath = `${segment}/${resolvedPath}`;
240
+ resolvedAbsolute = isAbsolute(segment);
241
+ }
242
+ resolvedPath = normalizeSlashes(resolvedPath);
243
+ if (resolvedPath.length > 1 && resolvedPath.endsWith("/")) {
244
+ resolvedPath = resolvedPath.slice(0, -1);
245
+ }
246
+ return normalize(resolvedPath) ?? ".";
247
+ };
248
+ dirname = (path) => {
249
+ if (path.length === 0) return ".";
250
+ path = normalizeSlashes(path);
251
+ while (path.length > 1 && path.endsWith("/")) {
252
+ path = path.slice(0, -1);
253
+ }
254
+ const lastSlash = path.lastIndexOf("/");
255
+ if (lastSlash === -1) return ".";
256
+ if (lastSlash === 0) return "/";
257
+ return path.slice(0, lastSlash);
258
+ };
259
+ basename = (path, suffix) => {
260
+ if (path.length === 0) return "";
261
+ path = normalizeSlashes(path);
262
+ while (path.length > 1 && path.endsWith("/")) {
263
+ path = path.slice(0, -1);
264
+ }
265
+ const lastSlash = path.lastIndexOf("/");
266
+ let base = lastSlash === -1 ? path : path.slice(lastSlash + 1);
267
+ if (suffix && base.endsWith(suffix)) {
268
+ base = base.slice(0, -suffix.length);
269
+ }
270
+ return base;
271
+ };
272
+ extname = (path) => {
273
+ const base = basename(path);
274
+ const lastDot = base.lastIndexOf(".");
275
+ if (lastDot <= 0 || lastDot === base.length - 1) {
276
+ return "";
277
+ }
278
+ return base.slice(lastDot);
279
+ };
280
+ normalize = (path) => {
281
+ if (path.length === 0) return ".";
282
+ path = normalizeSlashes(path);
283
+ const isAbs = path.startsWith("/");
284
+ const trailingSlash = path.endsWith("/");
285
+ const segments = path.split("/").filter((s) => s.length > 0);
286
+ const result = [];
287
+ for (const segment of segments) {
288
+ if (segment === ".") {
289
+ continue;
290
+ }
291
+ if (segment === "..") {
292
+ if (result.length > 0 && result[result.length - 1] !== "..") {
293
+ result.pop();
294
+ } else if (!isAbs) {
295
+ result.push("..");
296
+ }
297
+ } else {
298
+ result.push(segment);
299
+ }
300
+ }
301
+ let normalized = result.join("/");
302
+ if (isAbs) {
303
+ normalized = `/${normalized}`;
304
+ }
305
+ if (trailingSlash && normalized.length > 1) {
306
+ normalized += "/";
307
+ }
308
+ return normalized ?? ".";
309
+ };
310
+ isAbsolute = (path) => {
311
+ if (path.length === 0) return false;
312
+ if (path.startsWith("/")) return true;
313
+ if (path.length >= 3 && /^[a-zA-Z]:[/\\]/.test(path)) {
314
+ return true;
315
+ }
316
+ return false;
317
+ };
318
+ relative = (from, to) => {
319
+ if (from === to) return "";
320
+ from = resolve(from);
321
+ to = resolve(to);
322
+ if (from === to) return "";
323
+ const fromParts = from.split("/").filter((p) => p.length > 0);
324
+ const toParts = to.split("/").filter((p) => p.length > 0);
325
+ let commonLength = 0;
326
+ const minLength = Math.min(fromParts.length, toParts.length);
327
+ for (let i = 0; i < minLength; i++) {
328
+ if (fromParts[i] !== toParts[i]) break;
329
+ commonLength++;
330
+ }
331
+ const upCount = fromParts.length - commonLength;
332
+ const remaining = toParts.slice(commonLength);
333
+ const result = [
334
+ ...Array(upCount).fill(".."),
335
+ ...remaining
336
+ ];
337
+ return result.join("/") ?? ".";
338
+ };
339
+ parse = (path) => {
340
+ if (path.length === 0) {
341
+ return {
342
+ root: "",
343
+ dir: "",
344
+ base: "",
345
+ ext: "",
346
+ name: ""
347
+ };
348
+ }
349
+ path = normalizeSlashes(path);
350
+ let root = "";
351
+ let dir = "";
352
+ const base = basename(path);
353
+ const ext = extname(path);
354
+ const name = ext ? base.slice(0, -ext.length) : base;
355
+ if (path.startsWith("/")) {
356
+ root = "/";
357
+ } else if (/^[a-zA-Z]:[/\\]/.test(path)) {
358
+ root = path.slice(0, 3);
359
+ }
360
+ dir = dirname(path);
361
+ if (dir === ".") {
362
+ dir = "";
363
+ }
364
+ return {
365
+ root,
366
+ dir,
367
+ base,
368
+ ext,
369
+ name
370
+ };
371
+ };
372
+ format = (pathObject) => {
373
+ const { root = "", dir, base, ext = "", name = "" } = pathObject;
374
+ const finalBase = base ?? name + ext;
375
+ if (dir) {
376
+ if (dir === root) {
377
+ return `${dir}${finalBase}`;
378
+ }
379
+ return `${dir}/${finalBase}`;
380
+ }
381
+ return `${root}${finalBase}`;
382
+ };
383
+ posixPath = {
384
+ join,
385
+ resolve,
386
+ dirname,
387
+ basename,
388
+ extname,
389
+ normalize,
390
+ isAbsolute,
391
+ relative,
392
+ parse,
393
+ format,
394
+ sep: POSIX_SEP,
395
+ delimiter: POSIX_DELIMITER
396
+ };
246
397
  }
247
398
  });
248
399
 
249
- // deno:https://jsr.io/@std/path/1.1.4/_common/basename.ts
250
- function stripSuffix(name, suffix) {
251
- if (suffix.length >= name.length) {
252
- return name;
253
- }
254
- const lenDiff = name.length - suffix.length;
255
- for (let i = suffix.length - 1; i >= 0; --i) {
256
- if (name.charCodeAt(lenDiff + i) !== suffix.charCodeAt(i)) {
257
- return name;
258
- }
259
- }
260
- return name.slice(0, -suffix.length);
261
- }
262
- function lastPathSegment(path, isSep, start = 0) {
263
- let matchedNonSeparator = false;
264
- let end = path.length;
265
- for (let i = path.length - 1; i >= start; --i) {
266
- if (isSep(path.charCodeAt(i))) {
267
- if (matchedNonSeparator) {
268
- start = i + 1;
269
- break;
400
+ // pkg/@eser/standards/runtime/file-search.ts
401
+ var searchFileHierarchy;
402
+ var init_file_search = __esm({
403
+ "pkg/@eser/standards/runtime/file-search.ts"() {
404
+ init_mod2();
405
+ searchFileHierarchy = async (startDir, filenames, options = {}) => {
406
+ const { searchParents = false } = options;
407
+ let dir = startDir;
408
+ while (true) {
409
+ for (const name of filenames) {
410
+ const filepath = runtime.path.join(dir, name);
411
+ const exists = await runtime.fs.exists(filepath);
412
+ if (exists) {
413
+ const stat3 = await runtime.fs.stat(filepath);
414
+ if (stat3.isFile) {
415
+ return filepath;
416
+ }
417
+ }
418
+ }
419
+ if (!searchParents) {
420
+ break;
421
+ }
422
+ const parent = runtime.path.dirname(dir);
423
+ if (parent === dir) {
424
+ break;
425
+ }
426
+ dir = parent;
270
427
  }
271
- } else if (!matchedNonSeparator) {
272
- matchedNonSeparator = true;
273
- end = i + 1;
274
- }
275
- }
276
- return path.slice(start, end);
277
- }
278
- function assertArgs(path, suffix) {
279
- assertPath(path);
280
- if (path.length === 0) return path;
281
- if (typeof suffix !== "string") {
282
- throw new TypeError(`Suffix must be a string, received "${JSON.stringify(suffix)}"`);
283
- }
284
- }
285
- var init_basename = __esm({
286
- "deno:https://jsr.io/@std/path/1.1.4/_common/basename.ts"() {
287
- init_assert_path();
428
+ return void 0;
429
+ };
288
430
  }
289
431
  });
290
432
 
291
- // deno:https://jsr.io/@std/path/1.1.4/_common/from_file_url.ts
292
- function assertArg(url) {
293
- url = url instanceof URL ? url : new URL(url);
294
- if (url.protocol !== "file:") {
295
- throw new TypeError(`URL must be a file URL: received "${url.protocol}"`);
296
- }
297
- return url;
298
- }
299
- var init_from_file_url = __esm({
300
- "deno:https://jsr.io/@std/path/1.1.4/_common/from_file_url.ts"() {
301
- }
302
- });
433
+ // pkg/@eser/standards/runtime/adapters/workerd.ts
434
+ var WORKERD_CAPABILITIES, createWorkerdFs, createWorkerdPath, createWorkerdExec, envStorage, createWorkerdEnv, populateEnvFromContext, clearEnv, createWorkerdProcess, createWorkerdRuntime;
435
+ var init_workerd = __esm({
436
+ "pkg/@eser/standards/runtime/adapters/workerd.ts"() {
437
+ init_types();
438
+ init_path();
439
+ WORKERD_CAPABILITIES = {
440
+ fs: false,
441
+ fsSync: false,
442
+ exec: false,
443
+ process: false,
444
+ env: true,
445
+ stdin: false,
446
+ stdout: false,
447
+ kv: true
448
+ };
449
+ createWorkerdFs = () => {
450
+ const throwNotAvailable = () => {
451
+ throw new RuntimeCapabilityError("fs", "workerd");
452
+ };
453
+ return {
454
+ readFile: throwNotAvailable,
455
+ readTextFile: throwNotAvailable,
456
+ writeFile: throwNotAvailable,
457
+ writeTextFile: throwNotAvailable,
458
+ exists: throwNotAvailable,
459
+ stat: throwNotAvailable,
460
+ lstat: throwNotAvailable,
461
+ mkdir: throwNotAvailable,
462
+ remove: throwNotAvailable,
463
+ readDir: () => {
464
+ throw new RuntimeCapabilityError("fs", "workerd");
465
+ },
466
+ copyFile: throwNotAvailable,
467
+ rename: throwNotAvailable,
468
+ makeTempDir: throwNotAvailable
469
+ };
470
+ };
471
+ createWorkerdPath = () => {
472
+ return posixPath;
473
+ };
474
+ createWorkerdExec = () => {
475
+ const throwNotAvailable = () => {
476
+ throw new RuntimeCapabilityError("exec", "workerd");
477
+ };
478
+ return {
479
+ spawn: throwNotAvailable,
480
+ exec: throwNotAvailable,
481
+ execJson: throwNotAvailable,
482
+ spawnChild: throwNotAvailable
483
+ };
484
+ };
485
+ envStorage = /* @__PURE__ */ new Map();
486
+ createWorkerdEnv = () => {
487
+ return {
488
+ get(key) {
489
+ return envStorage.get(key);
490
+ },
491
+ set(key, value2) {
492
+ envStorage.set(key, value2);
493
+ },
494
+ delete(key) {
495
+ envStorage.delete(key);
496
+ },
497
+ has(key) {
498
+ return envStorage.has(key);
499
+ },
500
+ toObject() {
501
+ return Object.fromEntries(envStorage);
502
+ }
503
+ };
504
+ };
505
+ populateEnvFromContext = (env) => {
506
+ for (const [key, value2] of Object.entries(env)) {
507
+ if (value2 !== null && value2 !== void 0 && value2.constructor === String) {
508
+ envStorage.set(key, value2);
509
+ }
510
+ }
511
+ };
512
+ clearEnv = () => {
513
+ envStorage.clear();
514
+ };
515
+ createWorkerdProcess = () => {
516
+ const throwNotAvailable = () => {
517
+ throw new RuntimeCapabilityError("process", "workerd");
518
+ };
519
+ return {
520
+ exit: throwNotAvailable,
521
+ cwd: throwNotAvailable,
522
+ chdir: throwNotAvailable,
523
+ hostname: throwNotAvailable,
524
+ execPath: throwNotAvailable,
525
+ get args() {
526
+ throw new RuntimeCapabilityError("process", "workerd");
527
+ },
528
+ get pid() {
529
+ throw new RuntimeCapabilityError("process", "workerd");
530
+ },
531
+ get stdin() {
532
+ throw new RuntimeCapabilityError("process", "workerd");
533
+ },
534
+ get stdout() {
535
+ throw new RuntimeCapabilityError("process", "workerd");
536
+ },
537
+ get stderr() {
538
+ throw new RuntimeCapabilityError("process", "workerd");
539
+ }
540
+ };
541
+ };
542
+ createWorkerdRuntime = () => {
543
+ const fs = createWorkerdFs();
544
+ const path = createWorkerdPath();
545
+ const exec2 = createWorkerdExec();
546
+ const env = createWorkerdEnv();
547
+ const process = createWorkerdProcess();
548
+ return {
549
+ name: "workerd",
550
+ version: "unknown",
551
+ capabilities: WORKERD_CAPABILITIES,
552
+ fs,
553
+ path,
554
+ exec: exec2,
555
+ env,
556
+ process
557
+ };
558
+ };
559
+ }
560
+ });
561
+
562
+ // deno:https://jsr.io/@std/internal/1.0.12/_os.ts
563
+ function checkWindows() {
564
+ const global = globalThis;
565
+ const os = global.Deno?.build?.os;
566
+ return typeof os === "string" ? os === "windows" : global.navigator?.platform?.startsWith("Win") ?? global.process?.platform?.startsWith("win") ?? false;
567
+ }
568
+ var init_os = __esm({
569
+ "deno:https://jsr.io/@std/internal/1.0.12/_os.ts"() {
570
+ }
571
+ });
572
+
573
+ // deno:https://jsr.io/@std/internal/1.0.12/os.ts
574
+ var isWindows;
575
+ var init_os2 = __esm({
576
+ "deno:https://jsr.io/@std/internal/1.0.12/os.ts"() {
577
+ init_os();
578
+ isWindows = checkWindows();
579
+ }
580
+ });
581
+
582
+ // deno:https://jsr.io/@std/path/1.1.4/_common/assert_path.ts
583
+ function assertPath(path) {
584
+ if (typeof path !== "string") {
585
+ throw new TypeError(`Path must be a string, received "${JSON.stringify(path)}"`);
586
+ }
587
+ }
588
+ var init_assert_path = __esm({
589
+ "deno:https://jsr.io/@std/path/1.1.4/_common/assert_path.ts"() {
590
+ }
591
+ });
592
+
593
+ // deno:https://jsr.io/@std/path/1.1.4/_common/basename.ts
594
+ function stripSuffix(name, suffix) {
595
+ if (suffix.length >= name.length) {
596
+ return name;
597
+ }
598
+ const lenDiff = name.length - suffix.length;
599
+ for (let i = suffix.length - 1; i >= 0; --i) {
600
+ if (name.charCodeAt(lenDiff + i) !== suffix.charCodeAt(i)) {
601
+ return name;
602
+ }
603
+ }
604
+ return name.slice(0, -suffix.length);
605
+ }
606
+ function lastPathSegment(path, isSep, start = 0) {
607
+ let matchedNonSeparator = false;
608
+ let end = path.length;
609
+ for (let i = path.length - 1; i >= start; --i) {
610
+ if (isSep(path.charCodeAt(i))) {
611
+ if (matchedNonSeparator) {
612
+ start = i + 1;
613
+ break;
614
+ }
615
+ } else if (!matchedNonSeparator) {
616
+ matchedNonSeparator = true;
617
+ end = i + 1;
618
+ }
619
+ }
620
+ return path.slice(start, end);
621
+ }
622
+ function assertArgs(path, suffix) {
623
+ assertPath(path);
624
+ if (path.length === 0) return path;
625
+ if (typeof suffix !== "string") {
626
+ throw new TypeError(`Suffix must be a string, received "${JSON.stringify(suffix)}"`);
627
+ }
628
+ }
629
+ var init_basename = __esm({
630
+ "deno:https://jsr.io/@std/path/1.1.4/_common/basename.ts"() {
631
+ init_assert_path();
632
+ }
633
+ });
634
+
635
+ // deno:https://jsr.io/@std/path/1.1.4/_common/from_file_url.ts
636
+ function assertArg(url) {
637
+ url = url instanceof URL ? url : new URL(url);
638
+ if (url.protocol !== "file:") {
639
+ throw new TypeError(`URL must be a file URL: received "${url.protocol}"`);
640
+ }
641
+ return url;
642
+ }
643
+ var init_from_file_url = __esm({
644
+ "deno:https://jsr.io/@std/path/1.1.4/_common/from_file_url.ts"() {
645
+ }
646
+ });
303
647
 
304
648
  // deno:https://jsr.io/@std/path/1.1.4/posix/from_file_url.ts
305
649
  function fromFileUrl(url) {
@@ -358,7 +702,7 @@ var init_util = __esm({
358
702
  });
359
703
 
360
704
  // deno:https://jsr.io/@std/path/1.1.4/posix/basename.ts
361
- function basename(path, suffix = "") {
705
+ function basename2(path, suffix = "") {
362
706
  if (path instanceof URL) {
363
707
  path = fromFileUrl(path);
364
708
  }
@@ -408,7 +752,7 @@ var init_from_file_url3 = __esm({
408
752
  });
409
753
 
410
754
  // deno:https://jsr.io/@std/path/1.1.4/windows/basename.ts
411
- function basename2(path, suffix = "") {
755
+ function basename3(path, suffix = "") {
412
756
  if (path instanceof URL) {
413
757
  path = fromFileUrl2(path);
414
758
  }
@@ -435,8 +779,8 @@ var init_basename3 = __esm({
435
779
  });
436
780
 
437
781
  // deno:https://jsr.io/@std/path/1.1.4/basename.ts
438
- function basename3(path, suffix = "") {
439
- return isWindows ? basename2(path, suffix) : basename(path, suffix);
782
+ function basename4(path, suffix = "") {
783
+ return isWindows ? basename3(path, suffix) : basename2(path, suffix);
440
784
  }
441
785
  var init_basename4 = __esm({
442
786
  "deno:https://jsr.io/@std/path/1.1.4/basename.ts"() {
@@ -469,7 +813,7 @@ var init_dirname = __esm({
469
813
  });
470
814
 
471
815
  // deno:https://jsr.io/@std/path/1.1.4/posix/dirname.ts
472
- function dirname(path) {
816
+ function dirname2(path) {
473
817
  if (path instanceof URL) {
474
818
  path = fromFileUrl(path);
475
819
  }
@@ -501,7 +845,7 @@ var init_dirname2 = __esm({
501
845
  });
502
846
 
503
847
  // deno:https://jsr.io/@std/path/1.1.4/windows/dirname.ts
504
- function dirname2(path) {
848
+ function dirname3(path) {
505
849
  if (path instanceof URL) {
506
850
  path = fromFileUrl2(path);
507
851
  }
@@ -578,8 +922,8 @@ var init_dirname3 = __esm({
578
922
  });
579
923
 
580
924
  // deno:https://jsr.io/@std/path/1.1.4/dirname.ts
581
- function dirname3(path) {
582
- return isWindows ? dirname2(path) : dirname(path);
925
+ function dirname4(path) {
926
+ return isWindows ? dirname3(path) : dirname2(path);
583
927
  }
584
928
  var init_dirname4 = __esm({
585
929
  "deno:https://jsr.io/@std/path/1.1.4/dirname.ts"() {
@@ -590,7 +934,7 @@ var init_dirname4 = __esm({
590
934
  });
591
935
 
592
936
  // deno:https://jsr.io/@std/path/1.1.4/posix/extname.ts
593
- function extname(path) {
937
+ function extname2(path) {
594
938
  if (path instanceof URL) {
595
939
  path = fromFileUrl(path);
596
940
  }
@@ -637,7 +981,7 @@ var init_extname = __esm({
637
981
  });
638
982
 
639
983
  // deno:https://jsr.io/@std/path/1.1.4/windows/extname.ts
640
- function extname2(path) {
984
+ function extname3(path) {
641
985
  if (path instanceof URL) {
642
986
  path = fromFileUrl2(path);
643
987
  }
@@ -688,8 +1032,8 @@ var init_extname2 = __esm({
688
1032
  });
689
1033
 
690
1034
  // deno:https://jsr.io/@std/path/1.1.4/extname.ts
691
- function extname3(path) {
692
- return isWindows ? extname2(path) : extname(path);
1035
+ function extname4(path) {
1036
+ return isWindows ? extname3(path) : extname2(path);
693
1037
  }
694
1038
  var init_extname3 = __esm({
695
1039
  "deno:https://jsr.io/@std/path/1.1.4/extname.ts"() {
@@ -719,7 +1063,7 @@ var init_format = __esm({
719
1063
  });
720
1064
 
721
1065
  // deno:https://jsr.io/@std/path/1.1.4/posix/format.ts
722
- function format(pathObject) {
1066
+ function format2(pathObject) {
723
1067
  assertArg3(pathObject);
724
1068
  return _format("/", pathObject);
725
1069
  }
@@ -730,7 +1074,7 @@ var init_format2 = __esm({
730
1074
  });
731
1075
 
732
1076
  // deno:https://jsr.io/@std/path/1.1.4/windows/format.ts
733
- function format2(pathObject) {
1077
+ function format3(pathObject) {
734
1078
  assertArg3(pathObject);
735
1079
  return _format("\\", pathObject);
736
1080
  }
@@ -741,8 +1085,8 @@ var init_format3 = __esm({
741
1085
  });
742
1086
 
743
1087
  // deno:https://jsr.io/@std/path/1.1.4/format.ts
744
- function format3(pathObject) {
745
- return isWindows ? format2(pathObject) : format(pathObject);
1088
+ function format4(pathObject) {
1089
+ return isWindows ? format3(pathObject) : format2(pathObject);
746
1090
  }
747
1091
  var init_format4 = __esm({
748
1092
  "deno:https://jsr.io/@std/path/1.1.4/format.ts"() {
@@ -765,7 +1109,7 @@ var init_from_file_url4 = __esm({
765
1109
  });
766
1110
 
767
1111
  // deno:https://jsr.io/@std/path/1.1.4/posix/is_absolute.ts
768
- function isAbsolute(path) {
1112
+ function isAbsolute2(path) {
769
1113
  assertPath(path);
770
1114
  return path.length > 0 && isPosixPathSeparator(path.charCodeAt(0));
771
1115
  }
@@ -777,7 +1121,7 @@ var init_is_absolute = __esm({
777
1121
  });
778
1122
 
779
1123
  // deno:https://jsr.io/@std/path/1.1.4/windows/is_absolute.ts
780
- function isAbsolute2(path) {
1124
+ function isAbsolute3(path) {
781
1125
  assertPath(path);
782
1126
  const len = path.length;
783
1127
  if (len === 0) return false;
@@ -800,8 +1144,8 @@ var init_is_absolute2 = __esm({
800
1144
  });
801
1145
 
802
1146
  // deno:https://jsr.io/@std/path/1.1.4/is_absolute.ts
803
- function isAbsolute3(path) {
804
- return isWindows ? isAbsolute2(path) : isAbsolute(path);
1147
+ function isAbsolute4(path) {
1148
+ return isWindows ? isAbsolute3(path) : isAbsolute2(path);
805
1149
  }
806
1150
  var init_is_absolute3 = __esm({
807
1151
  "deno:https://jsr.io/@std/path/1.1.4/is_absolute.ts"() {
@@ -884,7 +1228,7 @@ var init_normalize_string = __esm({
884
1228
  });
885
1229
 
886
1230
  // deno:https://jsr.io/@std/path/1.1.4/posix/normalize.ts
887
- function normalize(path) {
1231
+ function normalize2(path) {
888
1232
  if (path instanceof URL) {
889
1233
  path = fromFileUrl(path);
890
1234
  }
@@ -907,7 +1251,7 @@ var init_normalize2 = __esm({
907
1251
  });
908
1252
 
909
1253
  // deno:https://jsr.io/@std/path/1.1.4/posix/join.ts
910
- function join(path, ...paths) {
1254
+ function join2(path, ...paths) {
911
1255
  if (path === void 0) return ".";
912
1256
  if (path instanceof URL) {
913
1257
  path = fromFileUrl(path);
@@ -918,7 +1262,7 @@ function join(path, ...paths) {
918
1262
  ] : paths;
919
1263
  paths.forEach((path2) => assertPath(path2));
920
1264
  const joined = paths.filter((path2) => path2.length > 0).join("/");
921
- return joined === "" ? "." : normalize(joined);
1265
+ return joined === "" ? "." : normalize2(joined);
922
1266
  }
923
1267
  var init_join = __esm({
924
1268
  "deno:https://jsr.io/@std/path/1.1.4/posix/join.ts"() {
@@ -929,7 +1273,7 @@ var init_join = __esm({
929
1273
  });
930
1274
 
931
1275
  // deno:https://jsr.io/@std/path/1.1.4/windows/normalize.ts
932
- function normalize2(path) {
1276
+ function normalize3(path) {
933
1277
  if (path instanceof URL) {
934
1278
  path = fromFileUrl2(path);
935
1279
  }
@@ -1018,7 +1362,7 @@ var init_normalize3 = __esm({
1018
1362
  });
1019
1363
 
1020
1364
  // deno:https://jsr.io/@std/path/1.1.4/windows/join.ts
1021
- function join2(path, ...paths) {
1365
+ function join3(path, ...paths) {
1022
1366
  if (path instanceof URL) {
1023
1367
  path = fromFileUrl2(path);
1024
1368
  }
@@ -1054,7 +1398,7 @@ function join2(path, ...paths) {
1054
1398
  }
1055
1399
  if (slashCount >= 2) joined = `\\${joined.slice(slashCount)}`;
1056
1400
  }
1057
- return normalize2(joined);
1401
+ return normalize3(joined);
1058
1402
  }
1059
1403
  var init_join2 = __esm({
1060
1404
  "deno:https://jsr.io/@std/path/1.1.4/windows/join.ts"() {
@@ -1066,8 +1410,8 @@ var init_join2 = __esm({
1066
1410
  });
1067
1411
 
1068
1412
  // deno:https://jsr.io/@std/path/1.1.4/join.ts
1069
- function join3(path, ...paths) {
1070
- return isWindows ? join2(path, ...paths) : join(path, ...paths);
1413
+ function join4(path, ...paths) {
1414
+ return isWindows ? join3(path, ...paths) : join2(path, ...paths);
1071
1415
  }
1072
1416
  var init_join3 = __esm({
1073
1417
  "deno:https://jsr.io/@std/path/1.1.4/join.ts"() {
@@ -1078,8 +1422,8 @@ var init_join3 = __esm({
1078
1422
  });
1079
1423
 
1080
1424
  // deno:https://jsr.io/@std/path/1.1.4/normalize.ts
1081
- function normalize3(path) {
1082
- return isWindows ? normalize2(path) : normalize(path);
1425
+ function normalize4(path) {
1426
+ return isWindows ? normalize3(path) : normalize2(path);
1083
1427
  }
1084
1428
  var init_normalize4 = __esm({
1085
1429
  "deno:https://jsr.io/@std/path/1.1.4/normalize.ts"() {
@@ -1090,7 +1434,7 @@ var init_normalize4 = __esm({
1090
1434
  });
1091
1435
 
1092
1436
  // deno:https://jsr.io/@std/path/1.1.4/posix/parse.ts
1093
- function parse(path) {
1437
+ function parse2(path) {
1094
1438
  assertPath(path);
1095
1439
  const ret = {
1096
1440
  root: "",
@@ -1170,7 +1514,7 @@ var init_parse = __esm({
1170
1514
  });
1171
1515
 
1172
1516
  // deno:https://jsr.io/@std/path/1.1.4/windows/parse.ts
1173
- function parse2(path) {
1517
+ function parse3(path) {
1174
1518
  assertPath(path);
1175
1519
  const ret = {
1176
1520
  root: "",
@@ -1286,8 +1630,8 @@ var init_parse2 = __esm({
1286
1630
  });
1287
1631
 
1288
1632
  // deno:https://jsr.io/@std/path/1.1.4/parse.ts
1289
- function parse3(path) {
1290
- return isWindows ? parse2(path) : parse(path);
1633
+ function parse4(path) {
1634
+ return isWindows ? parse3(path) : parse2(path);
1291
1635
  }
1292
1636
  var init_parse3 = __esm({
1293
1637
  "deno:https://jsr.io/@std/path/1.1.4/parse.ts"() {
@@ -1298,7 +1642,7 @@ var init_parse3 = __esm({
1298
1642
  });
1299
1643
 
1300
1644
  // deno:https://jsr.io/@std/path/1.1.4/posix/resolve.ts
1301
- function resolve(...pathSegments) {
1645
+ function resolve2(...pathSegments) {
1302
1646
  let resolvedPath = "";
1303
1647
  let resolvedAbsolute = false;
1304
1648
  for (let i = pathSegments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
@@ -1346,10 +1690,10 @@ var init_relative = __esm({
1346
1690
  });
1347
1691
 
1348
1692
  // deno:https://jsr.io/@std/path/1.1.4/posix/relative.ts
1349
- function relative(from, to) {
1693
+ function relative2(from, to) {
1350
1694
  assertArgs2(from, to);
1351
- from = resolve(from);
1352
- to = resolve(to);
1695
+ from = resolve2(from);
1696
+ to = resolve2(to);
1353
1697
  if (from === to) return "";
1354
1698
  let fromStart = 1;
1355
1699
  const fromEnd = from.length;
@@ -1411,7 +1755,7 @@ var init_relative2 = __esm({
1411
1755
  });
1412
1756
 
1413
1757
  // deno:https://jsr.io/@std/path/1.1.4/windows/resolve.ts
1414
- function resolve2(...pathSegments) {
1758
+ function resolve3(...pathSegments) {
1415
1759
  let resolvedDevice = "";
1416
1760
  let resolvedTail = "";
1417
1761
  let resolvedAbsolute = false;
@@ -1514,10 +1858,10 @@ var init_resolve2 = __esm({
1514
1858
  });
1515
1859
 
1516
1860
  // deno:https://jsr.io/@std/path/1.1.4/windows/relative.ts
1517
- function relative2(from, to) {
1861
+ function relative3(from, to) {
1518
1862
  assertArgs2(from, to);
1519
- const fromOrig = resolve2(from);
1520
- const toOrig = resolve2(to);
1863
+ const fromOrig = resolve3(from);
1864
+ const toOrig = resolve3(to);
1521
1865
  if (fromOrig === toOrig) return "";
1522
1866
  from = fromOrig.toLowerCase();
1523
1867
  to = toOrig.toLowerCase();
@@ -1594,8 +1938,8 @@ var init_relative3 = __esm({
1594
1938
  });
1595
1939
 
1596
1940
  // deno:https://jsr.io/@std/path/1.1.4/relative.ts
1597
- function relative3(from, to) {
1598
- return isWindows ? relative2(from, to) : relative(from, to);
1941
+ function relative4(from, to) {
1942
+ return isWindows ? relative3(from, to) : relative2(from, to);
1599
1943
  }
1600
1944
  var init_relative4 = __esm({
1601
1945
  "deno:https://jsr.io/@std/path/1.1.4/relative.ts"() {
@@ -1606,8 +1950,8 @@ var init_relative4 = __esm({
1606
1950
  });
1607
1951
 
1608
1952
  // deno:https://jsr.io/@std/path/1.1.4/resolve.ts
1609
- function resolve3(...pathSegments) {
1610
- return isWindows ? resolve2(...pathSegments) : resolve(...pathSegments);
1953
+ function resolve4(...pathSegments) {
1954
+ return isWindows ? resolve3(...pathSegments) : resolve2(...pathSegments);
1611
1955
  }
1612
1956
  var init_resolve3 = __esm({
1613
1957
  "deno:https://jsr.io/@std/path/1.1.4/resolve.ts"() {
@@ -2002,11 +2346,11 @@ function normalizeGlob(glob, options = {}) {
2002
2346
  throw new Error(`Glob contains invalid characters: "${glob}"`);
2003
2347
  }
2004
2348
  if (!globstar) {
2005
- return normalize(glob);
2349
+ return normalize2(glob);
2006
2350
  }
2007
2351
  const s = SEPARATOR_PATTERN2.source;
2008
2352
  const badParentPattern = new RegExp(`(?<=(${s}|^)\\*\\*${s})\\.\\.(?=${s}|$)`, "g");
2009
- return normalize(glob.replace(badParentPattern, "\0")).replace(/\0/g, "..");
2353
+ return normalize2(glob.replace(badParentPattern, "\0")).replace(/\0/g, "..");
2010
2354
  }
2011
2355
  var init_normalize_glob = __esm({
2012
2356
  "deno:https://jsr.io/@std/path/1.1.4/posix/normalize_glob.ts"() {
@@ -2019,7 +2363,7 @@ var init_normalize_glob = __esm({
2019
2363
  function joinGlobs(globs, options = {}) {
2020
2364
  const { globstar = false } = options;
2021
2365
  if (!globstar || globs.length === 0) {
2022
- return join(...globs);
2366
+ return join2(...globs);
2023
2367
  }
2024
2368
  let joined;
2025
2369
  for (const glob of globs) {
@@ -2058,11 +2402,11 @@ function normalizeGlob2(glob, options = {}) {
2058
2402
  throw new Error(`Glob contains invalid characters: "${glob}"`);
2059
2403
  }
2060
2404
  if (!globstar) {
2061
- return normalize2(glob);
2405
+ return normalize3(glob);
2062
2406
  }
2063
2407
  const s = SEPARATOR_PATTERN3.source;
2064
2408
  const badParentPattern = new RegExp(`(?<=(${s}|^)\\*\\*${s})\\.\\.(?=${s}|$)`, "g");
2065
- return normalize2(glob.replace(badParentPattern, "\0")).replace(/\0/g, "..");
2409
+ return normalize3(glob.replace(badParentPattern, "\0")).replace(/\0/g, "..");
2066
2410
  }
2067
2411
  var init_normalize_glob2 = __esm({
2068
2412
  "deno:https://jsr.io/@std/path/1.1.4/windows/normalize_glob.ts"() {
@@ -2075,7 +2419,7 @@ var init_normalize_glob2 = __esm({
2075
2419
  function joinGlobs2(globs, options = {}) {
2076
2420
  const { globstar = false } = options;
2077
2421
  if (!globstar || globs.length === 0) {
2078
- return join2(...globs);
2422
+ return join3(...globs);
2079
2423
  }
2080
2424
  let joined;
2081
2425
  for (const glob of globs) {
@@ -2123,380 +2467,61 @@ var init_normalize_glob3 = __esm({
2123
2467
  var init_mod = __esm({
2124
2468
  "deno:https://jsr.io/@std/path/1.1.4/mod.ts"() {
2125
2469
  init_basename4();
2126
- init_constants2();
2127
- init_dirname4();
2128
- init_extname3();
2129
- init_format4();
2130
- init_from_file_url4();
2131
- init_is_absolute3();
2132
- init_join3();
2133
- init_normalize4();
2134
- init_parse3();
2135
- init_relative4();
2136
- init_resolve3();
2137
- init_to_file_url4();
2138
- init_to_namespaced_path3();
2139
- init_common2();
2140
- init_types2();
2141
- init_glob_to_regexp3();
2142
- init_is_glob();
2143
- init_join_globs3();
2144
- init_normalize_glob3();
2145
- }
2146
- });
2147
-
2148
- // pkg/@eser/standards/runtime/adapters/shared.ts
2149
- var mapStdioToNode, getStdioModes, getNodeStdioArray;
2150
- var init_shared = __esm({
2151
- "pkg/@eser/standards/runtime/adapters/shared.ts"() {
2152
- mapStdioToNode = (mode) => {
2153
- if (mode === "inherit") return "inherit";
2154
- if (mode === "piped") return "pipe";
2155
- return "ignore";
2156
- };
2157
- getStdioModes = (options) => ({
2158
- stdin: options?.stdin ?? "null",
2159
- stdout: options?.stdout ?? "piped",
2160
- stderr: options?.stderr ?? "piped"
2161
- });
2162
- getNodeStdioArray = (options) => {
2163
- const modes = getStdioModes(options);
2164
- return [
2165
- mapStdioToNode(modes.stdin),
2166
- mapStdioToNode(modes.stdout),
2167
- mapStdioToNode(modes.stderr)
2168
- ];
2169
- };
2170
- }
2171
- });
2172
-
2173
- // pkg/@eser/standards/runtime/adapters/deno.ts
2174
- var DENO_CAPABILITIES, createDenoFs, createDenoPath, createDenoExec, createDenoEnv, createDenoProcess, createDenoRuntime;
2175
- var init_deno = __esm({
2176
- "pkg/@eser/standards/runtime/adapters/deno.ts"() {
2177
- init_mod();
2178
- init_types();
2179
- init_shared();
2180
- DENO_CAPABILITIES = {
2181
- fs: true,
2182
- fsSync: true,
2183
- exec: true,
2184
- process: true,
2185
- env: true,
2186
- stdin: true,
2187
- stdout: true,
2188
- kv: true
2189
- };
2190
- createDenoFs = () => {
2191
- const mapFileInfo = (info) => ({
2192
- isFile: info.isFile,
2193
- isDirectory: info.isDirectory,
2194
- isSymlink: info.isSymlink,
2195
- size: info.size,
2196
- mtime: info.mtime,
2197
- atime: info.atime,
2198
- birthtime: info.birthtime
2199
- });
2200
- return {
2201
- async readFile(path, options) {
2202
- try {
2203
- return await Deno.readFile(path, {
2204
- signal: options?.signal
2205
- });
2206
- } catch (error) {
2207
- if (error instanceof Deno.errors.NotFound) {
2208
- throw new NotFoundError(path);
2209
- }
2210
- throw error;
2211
- }
2212
- },
2213
- async readTextFile(path, options) {
2214
- try {
2215
- return await Deno.readTextFile(path, {
2216
- signal: options?.signal
2217
- });
2218
- } catch (error) {
2219
- if (error instanceof Deno.errors.NotFound) {
2220
- throw new NotFoundError(path);
2221
- }
2222
- throw error;
2223
- }
2224
- },
2225
- async writeFile(path, data, options) {
2226
- await Deno.writeFile(path, data, {
2227
- signal: options?.signal,
2228
- mode: options?.mode,
2229
- create: options?.create ?? true,
2230
- append: options?.append ?? false
2231
- });
2232
- },
2233
- async writeTextFile(path, data, options) {
2234
- await Deno.writeTextFile(path, data, {
2235
- signal: options?.signal,
2236
- mode: options?.mode,
2237
- create: options?.create ?? true,
2238
- append: options?.append ?? false
2239
- });
2240
- },
2241
- async exists(path) {
2242
- try {
2243
- await Deno.stat(path);
2244
- return true;
2245
- } catch (error) {
2246
- if (error instanceof Deno.errors.NotFound) {
2247
- return false;
2248
- }
2249
- throw error;
2250
- }
2251
- },
2252
- async stat(path) {
2253
- try {
2254
- const info = await Deno.stat(path);
2255
- return mapFileInfo(info);
2256
- } catch (error) {
2257
- if (error instanceof Deno.errors.NotFound) {
2258
- throw new NotFoundError(path);
2259
- }
2260
- throw error;
2261
- }
2262
- },
2263
- async lstat(path) {
2264
- try {
2265
- const info = await Deno.lstat(path);
2266
- return mapFileInfo(info);
2267
- } catch (error) {
2268
- if (error instanceof Deno.errors.NotFound) {
2269
- throw new NotFoundError(path);
2270
- }
2271
- throw error;
2272
- }
2273
- },
2274
- async mkdir(path, options) {
2275
- await Deno.mkdir(path, {
2276
- recursive: options?.recursive ?? false,
2277
- mode: options?.mode
2278
- });
2279
- },
2280
- async remove(path, options) {
2281
- try {
2282
- await Deno.remove(path, {
2283
- recursive: options?.recursive ?? false
2284
- });
2285
- } catch (error) {
2286
- if (error instanceof Deno.errors.NotFound) {
2287
- throw new NotFoundError(path);
2288
- }
2289
- throw error;
2290
- }
2291
- },
2292
- async *readDir(path) {
2293
- try {
2294
- for await (const entry of Deno.readDir(path)) {
2295
- yield {
2296
- name: entry.name,
2297
- isFile: entry.isFile,
2298
- isDirectory: entry.isDirectory,
2299
- isSymlink: entry.isSymlink
2300
- };
2301
- }
2302
- } catch (error) {
2303
- if (error instanceof Deno.errors.NotFound) {
2304
- throw new NotFoundError(path);
2305
- }
2306
- throw error;
2307
- }
2308
- },
2309
- async copyFile(from, to) {
2310
- await Deno.copyFile(from, to);
2311
- },
2312
- async rename(from, to) {
2313
- await Deno.rename(from, to);
2314
- },
2315
- async makeTempDir(options) {
2316
- return await Deno.makeTempDir({
2317
- dir: options?.dir,
2318
- prefix: options?.prefix,
2319
- suffix: options?.suffix
2320
- });
2321
- }
2322
- };
2323
- };
2324
- createDenoPath = () => {
2325
- return {
2326
- join: join3,
2327
- resolve: resolve3,
2328
- dirname: dirname3,
2329
- basename: basename3,
2330
- extname: extname3,
2331
- normalize: normalize3,
2332
- isAbsolute: isAbsolute3,
2333
- relative: relative3,
2334
- parse: parse3,
2335
- format: format3,
2336
- sep: SEPARATOR,
2337
- delimiter: DELIMITER
2338
- };
2339
- };
2340
- createDenoExec = () => {
2341
- return {
2342
- async spawn(cmd, args = [], options) {
2343
- const modes = getStdioModes(options);
2344
- const command = new Deno.Command(cmd, {
2345
- args,
2346
- cwd: options?.cwd,
2347
- env: options?.env,
2348
- stdin: modes.stdin,
2349
- stdout: modes.stdout,
2350
- stderr: modes.stderr,
2351
- signal: options?.signal
2352
- });
2353
- const result = await command.output();
2354
- return {
2355
- success: result.success,
2356
- code: result.code,
2357
- stdout: modes.stdout === "piped" ? result.stdout : new Uint8Array(),
2358
- stderr: modes.stderr === "piped" ? result.stderr : new Uint8Array()
2359
- };
2360
- },
2361
- async exec(cmd, args = [], options) {
2362
- const result = await this.spawn(cmd, args, options);
2363
- if (!result.success) {
2364
- const stderr = new TextDecoder().decode(result.stderr);
2365
- throw new ProcessError(cmd, result.code, stderr);
2366
- }
2367
- return new TextDecoder().decode(result.stdout).trim();
2368
- },
2369
- async execJson(cmd, args = [], options) {
2370
- const output = await this.exec(cmd, args, options);
2371
- return JSON.parse(output);
2372
- },
2373
- spawnChild(cmd, args = [], options) {
2374
- const modes = getStdioModes(options);
2375
- const command = new Deno.Command(cmd, {
2376
- args,
2377
- cwd: options?.cwd,
2378
- env: options?.env,
2379
- stdin: modes.stdin,
2380
- stdout: modes.stdout,
2381
- stderr: modes.stderr,
2382
- signal: options?.signal
2383
- });
2384
- const process = command.spawn();
2385
- const collectStream = (stream, mode) => {
2386
- if (mode !== "piped" || !stream) {
2387
- return Promise.resolve(new Uint8Array());
2388
- }
2389
- return new Response(stream).arrayBuffer().then((b) => new Uint8Array(b));
2390
- };
2391
- return {
2392
- pid: process.pid,
2393
- stdin: modes.stdin === "piped" ? process.stdin : null,
2394
- stdout: modes.stdout === "piped" ? process.stdout : null,
2395
- stderr: modes.stderr === "piped" ? process.stderr : null,
2396
- status: process.status.then((status) => ({
2397
- success: status.success,
2398
- code: status.code,
2399
- signal: status.signal ?? void 0
2400
- })),
2401
- output: async () => {
2402
- const stdoutStream = modes.stdout === "piped" ? process.stdout : null;
2403
- const stderrStream = modes.stderr === "piped" ? process.stderr : null;
2404
- const [status, stdout, stderr] = await Promise.all([
2405
- process.status,
2406
- collectStream(stdoutStream, modes.stdout),
2407
- collectStream(stderrStream, modes.stderr)
2408
- ]);
2409
- return {
2410
- success: status.success,
2411
- code: status.code,
2412
- stdout,
2413
- stderr
2414
- };
2415
- },
2416
- kill: (signal) => {
2417
- process.kill(signal);
2418
- }
2419
- };
2420
- }
2421
- };
2422
- };
2423
- createDenoEnv = () => {
2424
- return {
2425
- get(key) {
2426
- return Deno.env.get(key);
2427
- },
2428
- set(key, value2) {
2429
- Deno.env.set(key, value2);
2430
- },
2431
- delete(key) {
2432
- Deno.env.delete(key);
2433
- },
2434
- has(key) {
2435
- return Deno.env.get(key) !== void 0;
2436
- },
2437
- toObject() {
2438
- return Deno.env.toObject();
2439
- }
2440
- };
2441
- };
2442
- createDenoProcess = () => {
2443
- return {
2444
- exit(code2) {
2445
- Deno.exit(code2);
2446
- },
2447
- cwd() {
2448
- return Deno.cwd();
2449
- },
2450
- chdir(path) {
2451
- Deno.chdir(path);
2452
- },
2453
- hostname() {
2454
- return Deno.hostname();
2455
- },
2456
- execPath() {
2457
- return Deno.execPath();
2458
- },
2459
- args: Deno.args,
2460
- pid: Deno.pid,
2461
- stdin: Deno.stdin.readable,
2462
- stdout: Deno.stdout.writable,
2463
- stderr: Deno.stderr.writable
2464
- };
2470
+ init_constants2();
2471
+ init_dirname4();
2472
+ init_extname3();
2473
+ init_format4();
2474
+ init_from_file_url4();
2475
+ init_is_absolute3();
2476
+ init_join3();
2477
+ init_normalize4();
2478
+ init_parse3();
2479
+ init_relative4();
2480
+ init_resolve3();
2481
+ init_to_file_url4();
2482
+ init_to_namespaced_path3();
2483
+ init_common2();
2484
+ init_types2();
2485
+ init_glob_to_regexp3();
2486
+ init_is_glob();
2487
+ init_join_globs3();
2488
+ init_normalize_glob3();
2489
+ }
2490
+ });
2491
+
2492
+ // pkg/@eser/standards/runtime/adapters/shared.ts
2493
+ var mapStdioToNode, getStdioModes, getNodeStdioArray;
2494
+ var init_shared = __esm({
2495
+ "pkg/@eser/standards/runtime/adapters/shared.ts"() {
2496
+ mapStdioToNode = (mode) => {
2497
+ if (mode === "inherit") return "inherit";
2498
+ if (mode === "piped") return "pipe";
2499
+ return "ignore";
2465
2500
  };
2466
- createDenoRuntime = () => {
2467
- const fs = createDenoFs();
2468
- const path = createDenoPath();
2469
- const exec2 = createDenoExec();
2470
- const env = createDenoEnv();
2471
- const process = createDenoProcess();
2472
- return {
2473
- name: "deno",
2474
- version: Deno.version.deno,
2475
- capabilities: DENO_CAPABILITIES,
2476
- fs,
2477
- path,
2478
- exec: exec2,
2479
- env,
2480
- process
2481
- };
2501
+ getStdioModes = (options) => ({
2502
+ stdin: options?.stdin ?? "null",
2503
+ stdout: options?.stdout ?? "piped",
2504
+ stderr: options?.stderr ?? "piped"
2505
+ });
2506
+ getNodeStdioArray = (options) => {
2507
+ const modes = getStdioModes(options);
2508
+ return [
2509
+ mapStdioToNode(modes.stdin),
2510
+ mapStdioToNode(modes.stdout),
2511
+ mapStdioToNode(modes.stderr)
2512
+ ];
2482
2513
  };
2483
2514
  }
2484
2515
  });
2485
2516
 
2486
- // pkg/@eser/standards/runtime/adapters/node.ts
2487
- import * as nodeFsPromises from "node:fs/promises";
2488
- import * as nodePath from "node:path";
2489
- import * as nodeOs from "node:os";
2490
- import * as nodeChildProcess from "node:child_process";
2491
- import nodeProcess from "node:process";
2492
- import { Buffer as Buffer2 } from "node:buffer";
2493
- import { Readable, Writable } from "node:stream";
2494
- var NODE_CAPABILITIES, createNodeFs, createNodePath, createNodeExec, createNodeEnv, createNodeProcess, createNodeRuntime;
2495
- var init_node = __esm({
2496
- "pkg/@eser/standards/runtime/adapters/node.ts"() {
2517
+ // pkg/@eser/standards/runtime/adapters/deno.ts
2518
+ var DENO_CAPABILITIES, createDenoFs, createDenoPath, createDenoExec, createDenoEnv, createDenoProcess, createDenoRuntime;
2519
+ var init_deno = __esm({
2520
+ "pkg/@eser/standards/runtime/adapters/deno.ts"() {
2521
+ init_mod();
2497
2522
  init_types();
2498
2523
  init_shared();
2499
- NODE_CAPABILITIES = {
2524
+ DENO_CAPABILITIES = {
2500
2525
  fs: true,
2501
2526
  fsSync: true,
2502
2527
  exec: true,
@@ -2504,182 +2529,178 @@ var init_node = __esm({
2504
2529
  env: true,
2505
2530
  stdin: true,
2506
2531
  stdout: true,
2507
- kv: false
2532
+ kv: true
2508
2533
  };
2509
- createNodeFs = () => {
2510
- const mapStats = (stats) => ({
2511
- isFile: stats.isFile(),
2512
- isDirectory: stats.isDirectory(),
2513
- isSymlink: stats.isSymbolicLink(),
2514
- size: stats.size,
2515
- mtime: stats.mtime,
2516
- atime: stats.atime,
2517
- birthtime: stats.birthtime
2534
+ createDenoFs = () => {
2535
+ const mapFileInfo = (info) => ({
2536
+ isFile: info.isFile,
2537
+ isDirectory: info.isDirectory,
2538
+ isSymlink: info.isSymlink,
2539
+ size: info.size,
2540
+ mtime: info.mtime,
2541
+ atime: info.atime,
2542
+ birthtime: info.birthtime
2518
2543
  });
2519
- const handleError = (error, path) => {
2520
- if (error instanceof Error && "code" in error && error.code === "ENOENT") {
2521
- throw new NotFoundError(path);
2522
- }
2523
- throw error;
2524
- };
2525
2544
  return {
2526
2545
  async readFile(path, options) {
2527
2546
  try {
2528
- const buffer = await nodeFsPromises.readFile(path, {
2547
+ return await Deno.readFile(path, {
2529
2548
  signal: options?.signal
2530
2549
  });
2531
- return new Uint8Array(buffer);
2532
2550
  } catch (error) {
2533
- return handleError(error, path);
2551
+ if (error instanceof Deno.errors.NotFound) {
2552
+ throw new NotFoundError(path);
2553
+ }
2554
+ throw error;
2534
2555
  }
2535
2556
  },
2536
2557
  async readTextFile(path, options) {
2537
2558
  try {
2538
- return await nodeFsPromises.readFile(path, {
2539
- encoding: "utf-8",
2559
+ return await Deno.readTextFile(path, {
2540
2560
  signal: options?.signal
2541
2561
  });
2542
2562
  } catch (error) {
2543
- return handleError(error, path);
2563
+ if (error instanceof Deno.errors.NotFound) {
2564
+ throw new NotFoundError(path);
2565
+ }
2566
+ throw error;
2544
2567
  }
2545
2568
  },
2546
2569
  async writeFile(path, data, options) {
2547
- const flag = options?.append ? "a" : "w";
2548
- await nodeFsPromises.writeFile(path, data, {
2570
+ await Deno.writeFile(path, data, {
2549
2571
  signal: options?.signal,
2550
2572
  mode: options?.mode,
2551
- flag
2573
+ create: options?.create ?? true,
2574
+ append: options?.append ?? false
2552
2575
  });
2553
2576
  },
2554
2577
  async writeTextFile(path, data, options) {
2555
- const flag = options?.append ? "a" : "w";
2556
- await nodeFsPromises.writeFile(path, data, {
2557
- encoding: "utf-8",
2578
+ await Deno.writeTextFile(path, data, {
2558
2579
  signal: options?.signal,
2559
2580
  mode: options?.mode,
2560
- flag
2581
+ create: options?.create ?? true,
2582
+ append: options?.append ?? false
2561
2583
  });
2562
2584
  },
2563
2585
  async exists(path) {
2564
2586
  try {
2565
- await nodeFsPromises.access(path);
2587
+ await Deno.stat(path);
2566
2588
  return true;
2567
- } catch {
2568
- return false;
2589
+ } catch (error) {
2590
+ if (error instanceof Deno.errors.NotFound) {
2591
+ return false;
2592
+ }
2593
+ throw error;
2569
2594
  }
2570
2595
  },
2571
2596
  async stat(path) {
2572
2597
  try {
2573
- const stats = await nodeFsPromises.stat(path);
2574
- return mapStats(stats);
2598
+ const info = await Deno.stat(path);
2599
+ return mapFileInfo(info);
2575
2600
  } catch (error) {
2576
- return handleError(error, path);
2601
+ if (error instanceof Deno.errors.NotFound) {
2602
+ throw new NotFoundError(path);
2603
+ }
2604
+ throw error;
2577
2605
  }
2578
2606
  },
2579
2607
  async lstat(path) {
2580
2608
  try {
2581
- const stats = await nodeFsPromises.lstat(path);
2582
- return mapStats(stats);
2609
+ const info = await Deno.lstat(path);
2610
+ return mapFileInfo(info);
2583
2611
  } catch (error) {
2584
- return handleError(error, path);
2612
+ if (error instanceof Deno.errors.NotFound) {
2613
+ throw new NotFoundError(path);
2614
+ }
2615
+ throw error;
2585
2616
  }
2586
2617
  },
2587
2618
  async mkdir(path, options) {
2588
- await nodeFsPromises.mkdir(path, {
2619
+ await Deno.mkdir(path, {
2589
2620
  recursive: options?.recursive ?? false,
2590
2621
  mode: options?.mode
2591
2622
  });
2592
2623
  },
2593
2624
  async remove(path, options) {
2594
2625
  try {
2595
- await nodeFsPromises.rm(path, {
2596
- recursive: options?.recursive ?? false,
2597
- force: false
2626
+ await Deno.remove(path, {
2627
+ recursive: options?.recursive ?? false
2598
2628
  });
2599
2629
  } catch (error) {
2600
- handleError(error, path);
2630
+ if (error instanceof Deno.errors.NotFound) {
2631
+ throw new NotFoundError(path);
2632
+ }
2633
+ throw error;
2601
2634
  }
2602
2635
  },
2603
2636
  async *readDir(path) {
2604
2637
  try {
2605
- const entries = await nodeFsPromises.readdir(path, {
2606
- withFileTypes: true
2607
- });
2608
- for (const entry of entries) {
2638
+ for await (const entry of Deno.readDir(path)) {
2609
2639
  yield {
2610
2640
  name: entry.name,
2611
- isFile: entry.isFile(),
2612
- isDirectory: entry.isDirectory(),
2613
- isSymlink: entry.isSymbolicLink()
2641
+ isFile: entry.isFile,
2642
+ isDirectory: entry.isDirectory,
2643
+ isSymlink: entry.isSymlink
2614
2644
  };
2615
2645
  }
2616
2646
  } catch (error) {
2617
- handleError(error, path);
2647
+ if (error instanceof Deno.errors.NotFound) {
2648
+ throw new NotFoundError(path);
2649
+ }
2650
+ throw error;
2618
2651
  }
2619
2652
  },
2620
2653
  async copyFile(from, to) {
2621
- await nodeFsPromises.copyFile(from, to);
2654
+ await Deno.copyFile(from, to);
2622
2655
  },
2623
2656
  async rename(from, to) {
2624
- await nodeFsPromises.rename(from, to);
2657
+ await Deno.rename(from, to);
2625
2658
  },
2626
2659
  async makeTempDir(options) {
2627
- const dir = options?.dir ?? nodeOs.tmpdir();
2628
- const prefix = options?.prefix ?? "";
2629
- const suffix = options?.suffix ?? "";
2630
- const tempPath = await nodeFsPromises.mkdtemp(nodePath.join(dir, prefix));
2631
- if (suffix) {
2632
- const newPath = tempPath + suffix;
2633
- await nodeFsPromises.rename(tempPath, newPath);
2634
- return newPath;
2635
- }
2636
- return tempPath;
2660
+ return await Deno.makeTempDir({
2661
+ dir: options?.dir,
2662
+ prefix: options?.prefix,
2663
+ suffix: options?.suffix
2664
+ });
2637
2665
  }
2638
2666
  };
2639
2667
  };
2640
- createNodePath = () => {
2668
+ createDenoPath = () => {
2641
2669
  return {
2642
- join: nodePath.join,
2643
- resolve: nodePath.resolve,
2644
- dirname: nodePath.dirname,
2645
- basename: nodePath.basename,
2646
- extname: nodePath.extname,
2647
- normalize: nodePath.normalize,
2648
- isAbsolute: nodePath.isAbsolute,
2649
- relative: nodePath.relative,
2650
- parse: nodePath.parse,
2651
- format: nodePath.format,
2652
- sep: nodePath.sep,
2653
- delimiter: nodePath.delimiter
2670
+ join: join4,
2671
+ resolve: resolve4,
2672
+ dirname: dirname4,
2673
+ basename: basename4,
2674
+ extname: extname4,
2675
+ normalize: normalize4,
2676
+ isAbsolute: isAbsolute4,
2677
+ relative: relative4,
2678
+ parse: parse4,
2679
+ format: format4,
2680
+ sep: SEPARATOR,
2681
+ delimiter: DELIMITER
2654
2682
  };
2655
2683
  };
2656
- createNodeExec = () => {
2684
+ createDenoExec = () => {
2657
2685
  return {
2658
- spawn(cmd, args = [], options) {
2659
- return new Promise((resolve7, reject) => {
2660
- const proc = nodeChildProcess.spawn(cmd, args, {
2661
- cwd: options?.cwd,
2662
- env: options?.env ? {
2663
- ...nodeProcess.env,
2664
- ...options.env
2665
- } : void 0,
2666
- stdio: getNodeStdioArray(options),
2667
- signal: options?.signal
2668
- });
2669
- const stdoutChunks = [];
2670
- const stderrChunks = [];
2671
- proc.stdout?.on("data", (chunk) => stdoutChunks.push(chunk));
2672
- proc.stderr?.on("data", (chunk) => stderrChunks.push(chunk));
2673
- proc.on("error", reject);
2674
- proc.on("close", (code2) => {
2675
- resolve7({
2676
- success: code2 === 0,
2677
- code: code2 ?? 1,
2678
- stdout: new Uint8Array(Buffer2.concat(stdoutChunks)),
2679
- stderr: new Uint8Array(Buffer2.concat(stderrChunks))
2680
- });
2681
- });
2686
+ async spawn(cmd, args = [], options) {
2687
+ const modes = getStdioModes(options);
2688
+ const command = new Deno.Command(cmd, {
2689
+ args,
2690
+ cwd: options?.cwd,
2691
+ env: options?.env,
2692
+ stdin: modes.stdin,
2693
+ stdout: modes.stdout,
2694
+ stderr: modes.stderr,
2695
+ signal: options?.signal
2682
2696
  });
2697
+ const result = await command.output();
2698
+ return {
2699
+ success: result.success,
2700
+ code: result.code,
2701
+ stdout: modes.stdout === "piped" ? result.stdout : new Uint8Array(),
2702
+ stderr: modes.stderr === "piped" ? result.stderr : new Uint8Array()
2703
+ };
2683
2704
  },
2684
2705
  async exec(cmd, args = [], options) {
2685
2706
  const result = await this.spawn(cmd, args, options);
@@ -2694,110 +2715,108 @@ var init_node = __esm({
2694
2715
  return JSON.parse(output);
2695
2716
  },
2696
2717
  spawnChild(cmd, args = [], options) {
2697
- const proc = nodeChildProcess.spawn(cmd, args, {
2718
+ const modes = getStdioModes(options);
2719
+ const command = new Deno.Command(cmd, {
2720
+ args,
2698
2721
  cwd: options?.cwd,
2699
- env: options?.env ? {
2700
- ...nodeProcess.env,
2701
- ...options.env
2702
- } : void 0,
2703
- stdio: getNodeStdioArray(options),
2722
+ env: options?.env,
2723
+ stdin: modes.stdin,
2724
+ stdout: modes.stdout,
2725
+ stderr: modes.stderr,
2704
2726
  signal: options?.signal
2705
2727
  });
2706
- const stdoutChunks = [];
2707
- const stderrChunks = [];
2708
- proc.stdout?.on("data", (chunk) => stdoutChunks.push(chunk));
2709
- proc.stderr?.on("data", (chunk) => stderrChunks.push(chunk));
2710
- const statusPromise = new Promise((resolve7, reject) => {
2711
- proc.on("error", reject);
2712
- proc.on("close", (code2, signal) => {
2713
- resolve7({
2714
- success: code2 === 0,
2715
- code: code2 ?? 1,
2716
- signal: signal ?? void 0
2717
- });
2718
- });
2719
- });
2728
+ const process = command.spawn();
2729
+ const collectStream = (stream, mode) => {
2730
+ if (mode !== "piped" || !stream) {
2731
+ return Promise.resolve(new Uint8Array());
2732
+ }
2733
+ return new Response(stream).arrayBuffer().then((b) => new Uint8Array(b));
2734
+ };
2720
2735
  return {
2721
- pid: proc.pid,
2722
- stdin: proc.stdin ? Writable.toWeb(proc.stdin) : null,
2723
- stdout: proc.stdout ? Readable.toWeb(proc.stdout) : null,
2724
- stderr: proc.stderr ? Readable.toWeb(proc.stderr) : null,
2725
- status: statusPromise,
2736
+ pid: process.pid,
2737
+ stdin: modes.stdin === "piped" ? process.stdin : null,
2738
+ stdout: modes.stdout === "piped" ? process.stdout : null,
2739
+ stderr: modes.stderr === "piped" ? process.stderr : null,
2740
+ status: process.status.then((status) => ({
2741
+ success: status.success,
2742
+ code: status.code,
2743
+ signal: status.signal ?? void 0
2744
+ })),
2726
2745
  output: async () => {
2727
- const status = await statusPromise;
2746
+ const stdoutStream = modes.stdout === "piped" ? process.stdout : null;
2747
+ const stderrStream = modes.stderr === "piped" ? process.stderr : null;
2748
+ const [status, stdout, stderr] = await Promise.all([
2749
+ process.status,
2750
+ collectStream(stdoutStream, modes.stdout),
2751
+ collectStream(stderrStream, modes.stderr)
2752
+ ]);
2728
2753
  return {
2729
2754
  success: status.success,
2730
2755
  code: status.code,
2731
- stdout: new Uint8Array(Buffer2.concat(stdoutChunks)),
2732
- stderr: new Uint8Array(Buffer2.concat(stderrChunks))
2756
+ stdout,
2757
+ stderr
2733
2758
  };
2734
2759
  },
2735
2760
  kill: (signal) => {
2736
- proc.kill(signal);
2761
+ process.kill(signal);
2737
2762
  }
2738
2763
  };
2739
2764
  }
2740
2765
  };
2741
2766
  };
2742
- createNodeEnv = () => {
2767
+ createDenoEnv = () => {
2743
2768
  return {
2744
2769
  get(key) {
2745
- return nodeProcess.env[key];
2770
+ return Deno.env.get(key);
2746
2771
  },
2747
2772
  set(key, value2) {
2748
- nodeProcess.env[key] = value2;
2773
+ Deno.env.set(key, value2);
2749
2774
  },
2750
2775
  delete(key) {
2751
- delete nodeProcess.env[key];
2776
+ Deno.env.delete(key);
2752
2777
  },
2753
2778
  has(key) {
2754
- return key in nodeProcess.env;
2779
+ return Deno.env.get(key) !== void 0;
2755
2780
  },
2756
2781
  toObject() {
2757
- const result = {};
2758
- for (const [key, value2] of Object.entries(nodeProcess.env)) {
2759
- if (value2 !== void 0) {
2760
- result[key] = value2;
2761
- }
2762
- }
2763
- return result;
2782
+ return Deno.env.toObject();
2764
2783
  }
2765
2784
  };
2766
2785
  };
2767
- createNodeProcess = () => {
2786
+ createDenoProcess = () => {
2768
2787
  return {
2769
2788
  exit(code2) {
2770
- nodeProcess.exit(code2);
2789
+ Deno.exit(code2);
2771
2790
  },
2772
2791
  cwd() {
2773
- return nodeProcess.cwd();
2792
+ return Deno.cwd();
2774
2793
  },
2775
2794
  chdir(path) {
2776
- nodeProcess.chdir(path);
2795
+ Deno.chdir(path);
2777
2796
  },
2778
2797
  hostname() {
2779
- return nodeOs.hostname();
2798
+ return Deno.hostname();
2780
2799
  },
2781
2800
  execPath() {
2782
- return nodeProcess.execPath;
2801
+ return Deno.execPath();
2783
2802
  },
2784
- args: nodeProcess.argv.slice(2),
2785
- pid: nodeProcess.pid,
2786
- stdin: Readable.toWeb(nodeProcess.stdin),
2787
- stdout: Writable.toWeb(nodeProcess.stdout),
2788
- stderr: Writable.toWeb(nodeProcess.stderr)
2803
+ args: Deno.args,
2804
+ pid: Deno.pid,
2805
+ stdin: Deno.stdin.readable,
2806
+ stdout: Deno.stdout.writable,
2807
+ stderr: Deno.stderr.writable
2789
2808
  };
2790
2809
  };
2791
- createNodeRuntime = () => {
2792
- const fs = createNodeFs();
2793
- const path = createNodePath();
2794
- const exec2 = createNodeExec();
2795
- const env = createNodeEnv();
2796
- const process = createNodeProcess();
2810
+ createDenoRuntime = () => {
2811
+ const fs = createDenoFs();
2812
+ const path = createDenoPath();
2813
+ const exec2 = createDenoExec();
2814
+ const env = createDenoEnv();
2815
+ const process = createDenoProcess();
2797
2816
  return {
2798
- name: "node",
2799
- version: nodeProcess.versions.node,
2800
- capabilities: NODE_CAPABILITIES,
2817
+ name: "deno",
2818
+ version: Deno.version.deno,
2819
+ capabilities: DENO_CAPABILITIES,
2801
2820
  fs,
2802
2821
  path,
2803
2822
  exec: exec2,
@@ -2808,18 +2827,20 @@ var init_node = __esm({
2808
2827
  }
2809
2828
  });
2810
2829
 
2811
- // pkg/@eser/standards/runtime/adapters/bun.ts
2812
- import * as nodeFsPromises2 from "node:fs/promises";
2813
- import * as nodePath2 from "node:path";
2814
- import * as nodeOs2 from "node:os";
2815
- import nodeProcess2 from "node:process";
2816
- import { Readable as Readable2, Writable as Writable2 } from "node:stream";
2817
- var BUN_CAPABILITIES, createBunFs, createBunPath, readStream, createBunExec, createBunEnv, createBunProcess, createBunRuntime;
2818
- var init_bun = __esm({
2819
- "pkg/@eser/standards/runtime/adapters/bun.ts"() {
2830
+ // pkg/@eser/standards/runtime/adapters/node.ts
2831
+ import * as nodeFsPromises from "node:fs/promises";
2832
+ import * as nodePath from "node:path";
2833
+ import * as nodeOs from "node:os";
2834
+ import * as nodeChildProcess from "node:child_process";
2835
+ import nodeProcess from "node:process";
2836
+ import { Buffer as Buffer2 } from "node:buffer";
2837
+ import { Readable, Writable } from "node:stream";
2838
+ var NODE_CAPABILITIES, createNodeFs, createNodePath, createNodeExec, createNodeEnv, createNodeProcess, createNodeRuntime;
2839
+ var init_node = __esm({
2840
+ "pkg/@eser/standards/runtime/adapters/node.ts"() {
2820
2841
  init_types();
2821
2842
  init_shared();
2822
- BUN_CAPABILITIES = {
2843
+ NODE_CAPABILITIES = {
2823
2844
  fs: true,
2824
2845
  fsSync: true,
2825
2846
  exec: true,
@@ -2829,7 +2850,7 @@ var init_bun = __esm({
2829
2850
  stdout: true,
2830
2851
  kv: false
2831
2852
  };
2832
- createBunFs = () => {
2853
+ createNodeFs = () => {
2833
2854
  const mapStats = (stats) => ({
2834
2855
  isFile: stats.isFile(),
2835
2856
  isDirectory: stats.isDirectory(),
@@ -2848,7 +2869,7 @@ var init_bun = __esm({
2848
2869
  return {
2849
2870
  async readFile(path, options) {
2850
2871
  try {
2851
- const buffer = await nodeFsPromises2.readFile(path, {
2872
+ const buffer = await nodeFsPromises.readFile(path, {
2852
2873
  signal: options?.signal
2853
2874
  });
2854
2875
  return new Uint8Array(buffer);
@@ -2858,7 +2879,7 @@ var init_bun = __esm({
2858
2879
  },
2859
2880
  async readTextFile(path, options) {
2860
2881
  try {
2861
- return await nodeFsPromises2.readFile(path, {
2882
+ return await nodeFsPromises.readFile(path, {
2862
2883
  encoding: "utf-8",
2863
2884
  signal: options?.signal
2864
2885
  });
@@ -2868,7 +2889,7 @@ var init_bun = __esm({
2868
2889
  },
2869
2890
  async writeFile(path, data, options) {
2870
2891
  const flag = options?.append ? "a" : "w";
2871
- await nodeFsPromises2.writeFile(path, data, {
2892
+ await nodeFsPromises.writeFile(path, data, {
2872
2893
  signal: options?.signal,
2873
2894
  mode: options?.mode,
2874
2895
  flag
@@ -2876,7 +2897,7 @@ var init_bun = __esm({
2876
2897
  },
2877
2898
  async writeTextFile(path, data, options) {
2878
2899
  const flag = options?.append ? "a" : "w";
2879
- await nodeFsPromises2.writeFile(path, data, {
2900
+ await nodeFsPromises.writeFile(path, data, {
2880
2901
  encoding: "utf-8",
2881
2902
  signal: options?.signal,
2882
2903
  mode: options?.mode,
@@ -2885,7 +2906,7 @@ var init_bun = __esm({
2885
2906
  },
2886
2907
  async exists(path) {
2887
2908
  try {
2888
- await nodeFsPromises2.access(path);
2909
+ await nodeFsPromises.access(path);
2889
2910
  return true;
2890
2911
  } catch {
2891
2912
  return false;
@@ -2893,7 +2914,7 @@ var init_bun = __esm({
2893
2914
  },
2894
2915
  async stat(path) {
2895
2916
  try {
2896
- const stats = await nodeFsPromises2.stat(path);
2917
+ const stats = await nodeFsPromises.stat(path);
2897
2918
  return mapStats(stats);
2898
2919
  } catch (error) {
2899
2920
  return handleError(error, path);
@@ -2901,21 +2922,21 @@ var init_bun = __esm({
2901
2922
  },
2902
2923
  async lstat(path) {
2903
2924
  try {
2904
- const stats = await nodeFsPromises2.lstat(path);
2925
+ const stats = await nodeFsPromises.lstat(path);
2905
2926
  return mapStats(stats);
2906
2927
  } catch (error) {
2907
2928
  return handleError(error, path);
2908
2929
  }
2909
2930
  },
2910
2931
  async mkdir(path, options) {
2911
- await nodeFsPromises2.mkdir(path, {
2932
+ await nodeFsPromises.mkdir(path, {
2912
2933
  recursive: options?.recursive ?? false,
2913
2934
  mode: options?.mode
2914
2935
  });
2915
2936
  },
2916
2937
  async remove(path, options) {
2917
2938
  try {
2918
- await nodeFsPromises2.rm(path, {
2939
+ await nodeFsPromises.rm(path, {
2919
2940
  recursive: options?.recursive ?? false,
2920
2941
  force: false
2921
2942
  });
@@ -2925,7 +2946,7 @@ var init_bun = __esm({
2925
2946
  },
2926
2947
  async *readDir(path) {
2927
2948
  try {
2928
- const entries = await nodeFsPromises2.readdir(path, {
2949
+ const entries = await nodeFsPromises.readdir(path, {
2929
2950
  withFileTypes: true
2930
2951
  });
2931
2952
  for (const entry of entries) {
@@ -2941,88 +2962,68 @@ var init_bun = __esm({
2941
2962
  }
2942
2963
  },
2943
2964
  async copyFile(from, to) {
2944
- await nodeFsPromises2.copyFile(from, to);
2965
+ await nodeFsPromises.copyFile(from, to);
2945
2966
  },
2946
2967
  async rename(from, to) {
2947
- await nodeFsPromises2.rename(from, to);
2968
+ await nodeFsPromises.rename(from, to);
2948
2969
  },
2949
2970
  async makeTempDir(options) {
2950
- const dir = options?.dir ?? nodeOs2.tmpdir();
2971
+ const dir = options?.dir ?? nodeOs.tmpdir();
2951
2972
  const prefix = options?.prefix ?? "";
2952
2973
  const suffix = options?.suffix ?? "";
2953
- const tempPath = await nodeFsPromises2.mkdtemp(nodePath2.join(dir, prefix));
2974
+ const tempPath = await nodeFsPromises.mkdtemp(nodePath.join(dir, prefix));
2954
2975
  if (suffix) {
2955
2976
  const newPath = tempPath + suffix;
2956
- await nodeFsPromises2.rename(tempPath, newPath);
2977
+ await nodeFsPromises.rename(tempPath, newPath);
2957
2978
  return newPath;
2958
2979
  }
2959
2980
  return tempPath;
2960
2981
  }
2961
2982
  };
2962
2983
  };
2963
- createBunPath = () => {
2984
+ createNodePath = () => {
2964
2985
  return {
2965
- join: nodePath2.join,
2966
- resolve: nodePath2.resolve,
2967
- dirname: nodePath2.dirname,
2968
- basename: nodePath2.basename,
2969
- extname: nodePath2.extname,
2970
- normalize: nodePath2.normalize,
2971
- isAbsolute: nodePath2.isAbsolute,
2972
- relative: nodePath2.relative,
2973
- parse: nodePath2.parse,
2974
- format: nodePath2.format,
2975
- sep: nodePath2.sep,
2976
- delimiter: nodePath2.delimiter
2986
+ join: nodePath.join,
2987
+ resolve: nodePath.resolve,
2988
+ dirname: nodePath.dirname,
2989
+ basename: nodePath.basename,
2990
+ extname: nodePath.extname,
2991
+ normalize: nodePath.normalize,
2992
+ isAbsolute: nodePath.isAbsolute,
2993
+ relative: nodePath.relative,
2994
+ parse: nodePath.parse,
2995
+ format: nodePath.format,
2996
+ sep: nodePath.sep,
2997
+ delimiter: nodePath.delimiter
2977
2998
  };
2978
2999
  };
2979
- readStream = async (stream) => {
2980
- if (!stream) return new Uint8Array(0);
2981
- const chunks = [];
2982
- const reader = stream.getReader();
2983
- try {
2984
- while (true) {
2985
- const { done, value: value2 } = await reader.read();
2986
- if (done) break;
2987
- chunks.push(value2);
2988
- }
2989
- } finally {
2990
- reader.releaseLock();
2991
- }
2992
- const totalLength = chunks.reduce((acc, chunk) => acc + chunk.length, 0);
2993
- const result = new Uint8Array(totalLength);
2994
- let offset = 0;
2995
- for (const chunk of chunks) {
2996
- result.set(chunk, offset);
2997
- offset += chunk.length;
2998
- }
2999
- return result;
3000
- };
3001
- createBunExec = () => {
3000
+ createNodeExec = () => {
3002
3001
  return {
3003
- async spawn(cmd, args = [], options) {
3004
- const [stdinMode, stdoutMode, stderrMode] = getNodeStdioArray(options);
3005
- const proc = Bun.spawn([
3006
- cmd,
3007
- ...args
3008
- ], {
3009
- cwd: options?.cwd,
3010
- env: options?.env,
3011
- stdin: stdinMode,
3012
- stdout: stdoutMode,
3013
- stderr: stderrMode
3002
+ spawn(cmd, args = [], options) {
3003
+ return new Promise((resolve7, reject) => {
3004
+ const proc = nodeChildProcess.spawn(cmd, args, {
3005
+ cwd: options?.cwd,
3006
+ env: options?.env ? {
3007
+ ...nodeProcess.env,
3008
+ ...options.env
3009
+ } : void 0,
3010
+ stdio: getNodeStdioArray(options),
3011
+ signal: options?.signal
3012
+ });
3013
+ const stdoutChunks = [];
3014
+ const stderrChunks = [];
3015
+ proc.stdout?.on("data", (chunk) => stdoutChunks.push(chunk));
3016
+ proc.stderr?.on("data", (chunk) => stderrChunks.push(chunk));
3017
+ proc.on("error", reject);
3018
+ proc.on("close", (code2) => {
3019
+ resolve7({
3020
+ success: code2 === 0,
3021
+ code: code2 ?? 1,
3022
+ stdout: new Uint8Array(Buffer2.concat(stdoutChunks)),
3023
+ stderr: new Uint8Array(Buffer2.concat(stderrChunks))
3024
+ });
3025
+ });
3014
3026
  });
3015
- const [exitCode, stdout, stderr] = await Promise.all([
3016
- proc.exited,
3017
- readStream(proc.stdout),
3018
- readStream(proc.stderr)
3019
- ]);
3020
- return {
3021
- success: exitCode === 0,
3022
- code: exitCode,
3023
- stdout,
3024
- stderr
3025
- };
3026
3027
  },
3027
3028
  async exec(cmd, args = [], options) {
3028
3029
  const result = await this.spawn(cmd, args, options);
@@ -3037,39 +3038,42 @@ var init_bun = __esm({
3037
3038
  return JSON.parse(output);
3038
3039
  },
3039
3040
  spawnChild(cmd, args = [], options) {
3040
- const [stdinMode, stdoutMode, stderrMode] = getNodeStdioArray(options);
3041
- const proc = Bun.spawn([
3042
- cmd,
3043
- ...args
3044
- ], {
3041
+ const proc = nodeChildProcess.spawn(cmd, args, {
3045
3042
  cwd: options?.cwd,
3046
- env: options?.env,
3047
- stdin: stdinMode,
3048
- stdout: stdoutMode,
3049
- stderr: stderrMode
3043
+ env: options?.env ? {
3044
+ ...nodeProcess.env,
3045
+ ...options.env
3046
+ } : void 0,
3047
+ stdio: getNodeStdioArray(options),
3048
+ signal: options?.signal
3049
+ });
3050
+ const stdoutChunks = [];
3051
+ const stderrChunks = [];
3052
+ proc.stdout?.on("data", (chunk) => stdoutChunks.push(chunk));
3053
+ proc.stderr?.on("data", (chunk) => stderrChunks.push(chunk));
3054
+ const statusPromise = new Promise((resolve7, reject) => {
3055
+ proc.on("error", reject);
3056
+ proc.on("close", (code2, signal) => {
3057
+ resolve7({
3058
+ success: code2 === 0,
3059
+ code: code2 ?? 1,
3060
+ signal: signal ?? void 0
3061
+ });
3062
+ });
3050
3063
  });
3051
- const statusPromise = proc.exited.then((code2) => ({
3052
- success: code2 === 0,
3053
- code: code2,
3054
- signal: void 0
3055
- }));
3056
3064
  return {
3057
3065
  pid: proc.pid,
3058
- stdin: proc.stdin,
3059
- stdout: proc.stdout,
3060
- stderr: proc.stderr,
3066
+ stdin: proc.stdin ? Writable.toWeb(proc.stdin) : null,
3067
+ stdout: proc.stdout ? Readable.toWeb(proc.stdout) : null,
3068
+ stderr: proc.stderr ? Readable.toWeb(proc.stderr) : null,
3061
3069
  status: statusPromise,
3062
3070
  output: async () => {
3063
- const [status, stdout, stderr] = await Promise.all([
3064
- statusPromise,
3065
- readStream(proc.stdout),
3066
- readStream(proc.stderr)
3067
- ]);
3071
+ const status = await statusPromise;
3068
3072
  return {
3069
3073
  success: status.success,
3070
3074
  code: status.code,
3071
- stdout,
3072
- stderr
3075
+ stdout: new Uint8Array(Buffer2.concat(stdoutChunks)),
3076
+ stderr: new Uint8Array(Buffer2.concat(stderrChunks))
3073
3077
  };
3074
3078
  },
3075
3079
  kill: (signal) => {
@@ -3079,23 +3083,23 @@ var init_bun = __esm({
3079
3083
  }
3080
3084
  };
3081
3085
  };
3082
- createBunEnv = () => {
3086
+ createNodeEnv = () => {
3083
3087
  return {
3084
3088
  get(key) {
3085
- return nodeProcess2.env[key];
3089
+ return nodeProcess.env[key];
3086
3090
  },
3087
3091
  set(key, value2) {
3088
- nodeProcess2.env[key] = value2;
3092
+ nodeProcess.env[key] = value2;
3089
3093
  },
3090
3094
  delete(key) {
3091
- delete nodeProcess2.env[key];
3095
+ delete nodeProcess.env[key];
3092
3096
  },
3093
3097
  has(key) {
3094
- return key in nodeProcess2.env;
3098
+ return key in nodeProcess.env;
3095
3099
  },
3096
3100
  toObject() {
3097
3101
  const result = {};
3098
- for (const [key, value2] of Object.entries(nodeProcess2.env)) {
3102
+ for (const [key, value2] of Object.entries(nodeProcess.env)) {
3099
3103
  if (value2 !== void 0) {
3100
3104
  result[key] = value2;
3101
3105
  }
@@ -3104,40 +3108,40 @@ var init_bun = __esm({
3104
3108
  }
3105
3109
  };
3106
3110
  };
3107
- createBunProcess = () => {
3111
+ createNodeProcess = () => {
3108
3112
  return {
3109
3113
  exit(code2) {
3110
- nodeProcess2.exit(code2);
3114
+ nodeProcess.exit(code2);
3111
3115
  },
3112
3116
  cwd() {
3113
- return nodeProcess2.cwd();
3117
+ return nodeProcess.cwd();
3114
3118
  },
3115
3119
  chdir(path) {
3116
- nodeProcess2.chdir(path);
3120
+ nodeProcess.chdir(path);
3117
3121
  },
3118
3122
  hostname() {
3119
- return nodeOs2.hostname();
3123
+ return nodeOs.hostname();
3120
3124
  },
3121
3125
  execPath() {
3122
- return nodeProcess2.execPath;
3126
+ return nodeProcess.execPath;
3123
3127
  },
3124
- args: nodeProcess2.argv.slice(2),
3125
- pid: nodeProcess2.pid,
3126
- stdin: Readable2.toWeb(nodeProcess2.stdin),
3127
- stdout: Writable2.toWeb(nodeProcess2.stdout),
3128
- stderr: Writable2.toWeb(nodeProcess2.stderr)
3128
+ args: nodeProcess.argv.slice(2),
3129
+ pid: nodeProcess.pid,
3130
+ stdin: Readable.toWeb(nodeProcess.stdin),
3131
+ stdout: Writable.toWeb(nodeProcess.stdout),
3132
+ stderr: Writable.toWeb(nodeProcess.stderr)
3129
3133
  };
3130
3134
  };
3131
- createBunRuntime = () => {
3132
- const fs = createBunFs();
3133
- const path = createBunPath();
3134
- const exec2 = createBunExec();
3135
- const env = createBunEnv();
3136
- const process = createBunProcess();
3135
+ createNodeRuntime = () => {
3136
+ const fs = createNodeFs();
3137
+ const path = createNodePath();
3138
+ const exec2 = createNodeExec();
3139
+ const env = createNodeEnv();
3140
+ const process = createNodeProcess();
3137
3141
  return {
3138
- name: "bun",
3139
- version: Bun.version,
3140
- capabilities: BUN_CAPABILITIES,
3142
+ name: "node",
3143
+ version: nodeProcess.versions.node,
3144
+ capabilities: NODE_CAPABILITIES,
3141
3145
  fs,
3142
3146
  path,
3143
3147
  exec: exec2,
@@ -3148,307 +3152,336 @@ var init_bun = __esm({
3148
3152
  }
3149
3153
  });
3150
3154
 
3151
- // pkg/@eser/standards/runtime/polyfills/path.ts
3152
- var POSIX_SEP, POSIX_DELIMITER, normalizeSlashes, join6, resolve6, dirname6, basename6, extname6, normalize6, isAbsolute6, relative6, parse6, format6, posixPath;
3153
- var init_path = __esm({
3154
- "pkg/@eser/standards/runtime/polyfills/path.ts"() {
3155
- POSIX_SEP = "/";
3156
- POSIX_DELIMITER = ":";
3157
- normalizeSlashes = (path) => {
3158
- return path.replace(/\\/g, "/").replace(/\/+/g, "/");
3159
- };
3160
- join6 = (...paths) => {
3161
- if (paths.length === 0) return ".";
3162
- const joined = paths.filter((p) => p.length > 0).join(POSIX_SEP);
3163
- if (joined.length === 0) return ".";
3164
- return normalize6(joined);
3165
- };
3166
- resolve6 = (...paths) => {
3167
- let resolvedPath = "";
3168
- let resolvedAbsolute = false;
3169
- for (let i = paths.length - 1; i >= 0 && !resolvedAbsolute; i--) {
3170
- const segment = paths[i];
3171
- if (segment === void 0 || segment.length === 0) continue;
3172
- resolvedPath = `${segment}/${resolvedPath}`;
3173
- resolvedAbsolute = isAbsolute6(segment);
3174
- }
3175
- resolvedPath = normalizeSlashes(resolvedPath);
3176
- if (resolvedPath.length > 1 && resolvedPath.endsWith("/")) {
3177
- resolvedPath = resolvedPath.slice(0, -1);
3178
- }
3179
- return normalize6(resolvedPath) ?? ".";
3180
- };
3181
- dirname6 = (path) => {
3182
- if (path.length === 0) return ".";
3183
- path = normalizeSlashes(path);
3184
- while (path.length > 1 && path.endsWith("/")) {
3185
- path = path.slice(0, -1);
3186
- }
3187
- const lastSlash = path.lastIndexOf("/");
3188
- if (lastSlash === -1) return ".";
3189
- if (lastSlash === 0) return "/";
3190
- return path.slice(0, lastSlash);
3191
- };
3192
- basename6 = (path, suffix) => {
3193
- if (path.length === 0) return "";
3194
- path = normalizeSlashes(path);
3195
- while (path.length > 1 && path.endsWith("/")) {
3196
- path = path.slice(0, -1);
3197
- }
3198
- const lastSlash = path.lastIndexOf("/");
3199
- let base = lastSlash === -1 ? path : path.slice(lastSlash + 1);
3200
- if (suffix && base.endsWith(suffix)) {
3201
- base = base.slice(0, -suffix.length);
3202
- }
3203
- return base;
3204
- };
3205
- extname6 = (path) => {
3206
- const base = basename6(path);
3207
- const lastDot = base.lastIndexOf(".");
3208
- if (lastDot <= 0 || lastDot === base.length - 1) {
3209
- return "";
3210
- }
3211
- return base.slice(lastDot);
3155
+ // pkg/@eser/standards/runtime/adapters/bun.ts
3156
+ import * as nodeFsPromises2 from "node:fs/promises";
3157
+ import * as nodePath2 from "node:path";
3158
+ import * as nodeOs2 from "node:os";
3159
+ import nodeProcess2 from "node:process";
3160
+ import { Readable as Readable2, Writable as Writable2 } from "node:stream";
3161
+ var BUN_CAPABILITIES, createBunFs, createBunPath, readStream, createBunExec, createBunEnv, createBunProcess, createBunRuntime;
3162
+ var init_bun = __esm({
3163
+ "pkg/@eser/standards/runtime/adapters/bun.ts"() {
3164
+ init_types();
3165
+ init_shared();
3166
+ BUN_CAPABILITIES = {
3167
+ fs: true,
3168
+ fsSync: true,
3169
+ exec: true,
3170
+ process: true,
3171
+ env: true,
3172
+ stdin: true,
3173
+ stdout: true,
3174
+ kv: false
3212
3175
  };
3213
- normalize6 = (path) => {
3214
- if (path.length === 0) return ".";
3215
- path = normalizeSlashes(path);
3216
- const isAbs = path.startsWith("/");
3217
- const trailingSlash = path.endsWith("/");
3218
- const segments = path.split("/").filter((s) => s.length > 0);
3219
- const result = [];
3220
- for (const segment of segments) {
3221
- if (segment === ".") {
3222
- continue;
3176
+ createBunFs = () => {
3177
+ const mapStats = (stats) => ({
3178
+ isFile: stats.isFile(),
3179
+ isDirectory: stats.isDirectory(),
3180
+ isSymlink: stats.isSymbolicLink(),
3181
+ size: stats.size,
3182
+ mtime: stats.mtime,
3183
+ atime: stats.atime,
3184
+ birthtime: stats.birthtime
3185
+ });
3186
+ const handleError = (error, path) => {
3187
+ if (error instanceof Error && "code" in error && error.code === "ENOENT") {
3188
+ throw new NotFoundError(path);
3223
3189
  }
3224
- if (segment === "..") {
3225
- if (result.length > 0 && result[result.length - 1] !== "..") {
3226
- result.pop();
3227
- } else if (!isAbs) {
3228
- result.push("..");
3190
+ throw error;
3191
+ };
3192
+ return {
3193
+ async readFile(path, options) {
3194
+ try {
3195
+ const buffer = await nodeFsPromises2.readFile(path, {
3196
+ signal: options?.signal
3197
+ });
3198
+ return new Uint8Array(buffer);
3199
+ } catch (error) {
3200
+ return handleError(error, path);
3201
+ }
3202
+ },
3203
+ async readTextFile(path, options) {
3204
+ try {
3205
+ return await nodeFsPromises2.readFile(path, {
3206
+ encoding: "utf-8",
3207
+ signal: options?.signal
3208
+ });
3209
+ } catch (error) {
3210
+ return handleError(error, path);
3211
+ }
3212
+ },
3213
+ async writeFile(path, data, options) {
3214
+ const flag = options?.append ? "a" : "w";
3215
+ await nodeFsPromises2.writeFile(path, data, {
3216
+ signal: options?.signal,
3217
+ mode: options?.mode,
3218
+ flag
3219
+ });
3220
+ },
3221
+ async writeTextFile(path, data, options) {
3222
+ const flag = options?.append ? "a" : "w";
3223
+ await nodeFsPromises2.writeFile(path, data, {
3224
+ encoding: "utf-8",
3225
+ signal: options?.signal,
3226
+ mode: options?.mode,
3227
+ flag
3228
+ });
3229
+ },
3230
+ async exists(path) {
3231
+ try {
3232
+ await nodeFsPromises2.access(path);
3233
+ return true;
3234
+ } catch {
3235
+ return false;
3229
3236
  }
3230
- } else {
3231
- result.push(segment);
3237
+ },
3238
+ async stat(path) {
3239
+ try {
3240
+ const stats = await nodeFsPromises2.stat(path);
3241
+ return mapStats(stats);
3242
+ } catch (error) {
3243
+ return handleError(error, path);
3244
+ }
3245
+ },
3246
+ async lstat(path) {
3247
+ try {
3248
+ const stats = await nodeFsPromises2.lstat(path);
3249
+ return mapStats(stats);
3250
+ } catch (error) {
3251
+ return handleError(error, path);
3252
+ }
3253
+ },
3254
+ async mkdir(path, options) {
3255
+ await nodeFsPromises2.mkdir(path, {
3256
+ recursive: options?.recursive ?? false,
3257
+ mode: options?.mode
3258
+ });
3259
+ },
3260
+ async remove(path, options) {
3261
+ try {
3262
+ await nodeFsPromises2.rm(path, {
3263
+ recursive: options?.recursive ?? false,
3264
+ force: false
3265
+ });
3266
+ } catch (error) {
3267
+ handleError(error, path);
3268
+ }
3269
+ },
3270
+ async *readDir(path) {
3271
+ try {
3272
+ const entries = await nodeFsPromises2.readdir(path, {
3273
+ withFileTypes: true
3274
+ });
3275
+ for (const entry of entries) {
3276
+ yield {
3277
+ name: entry.name,
3278
+ isFile: entry.isFile(),
3279
+ isDirectory: entry.isDirectory(),
3280
+ isSymlink: entry.isSymbolicLink()
3281
+ };
3282
+ }
3283
+ } catch (error) {
3284
+ handleError(error, path);
3285
+ }
3286
+ },
3287
+ async copyFile(from, to) {
3288
+ await nodeFsPromises2.copyFile(from, to);
3289
+ },
3290
+ async rename(from, to) {
3291
+ await nodeFsPromises2.rename(from, to);
3292
+ },
3293
+ async makeTempDir(options) {
3294
+ const dir = options?.dir ?? nodeOs2.tmpdir();
3295
+ const prefix = options?.prefix ?? "";
3296
+ const suffix = options?.suffix ?? "";
3297
+ const tempPath = await nodeFsPromises2.mkdtemp(nodePath2.join(dir, prefix));
3298
+ if (suffix) {
3299
+ const newPath = tempPath + suffix;
3300
+ await nodeFsPromises2.rename(tempPath, newPath);
3301
+ return newPath;
3302
+ }
3303
+ return tempPath;
3232
3304
  }
3233
- }
3234
- let normalized = result.join("/");
3235
- if (isAbs) {
3236
- normalized = `/${normalized}`;
3237
- }
3238
- if (trailingSlash && normalized.length > 1) {
3239
- normalized += "/";
3240
- }
3241
- return normalized ?? ".";
3242
- };
3243
- isAbsolute6 = (path) => {
3244
- if (path.length === 0) return false;
3245
- if (path.startsWith("/")) return true;
3246
- if (path.length >= 3 && /^[a-zA-Z]:[/\\]/.test(path)) {
3247
- return true;
3248
- }
3249
- return false;
3250
- };
3251
- relative6 = (from, to) => {
3252
- if (from === to) return "";
3253
- from = resolve6(from);
3254
- to = resolve6(to);
3255
- if (from === to) return "";
3256
- const fromParts = from.split("/").filter((p) => p.length > 0);
3257
- const toParts = to.split("/").filter((p) => p.length > 0);
3258
- let commonLength = 0;
3259
- const minLength = Math.min(fromParts.length, toParts.length);
3260
- for (let i = 0; i < minLength; i++) {
3261
- if (fromParts[i] !== toParts[i]) break;
3262
- commonLength++;
3263
- }
3264
- const upCount = fromParts.length - commonLength;
3265
- const remaining = toParts.slice(commonLength);
3266
- const result = [
3267
- ...Array(upCount).fill(".."),
3268
- ...remaining
3269
- ];
3270
- return result.join("/") ?? ".";
3305
+ };
3271
3306
  };
3272
- parse6 = (path) => {
3273
- if (path.length === 0) {
3274
- return {
3275
- root: "",
3276
- dir: "",
3277
- base: "",
3278
- ext: "",
3279
- name: ""
3280
- };
3281
- }
3282
- path = normalizeSlashes(path);
3283
- let root = "";
3284
- let dir = "";
3285
- const base = basename6(path);
3286
- const ext = extname6(path);
3287
- const name = ext ? base.slice(0, -ext.length) : base;
3288
- if (path.startsWith("/")) {
3289
- root = "/";
3290
- } else if (/^[a-zA-Z]:[/\\]/.test(path)) {
3291
- root = path.slice(0, 3);
3292
- }
3293
- dir = dirname6(path);
3294
- if (dir === ".") {
3295
- dir = "";
3296
- }
3307
+ createBunPath = () => {
3297
3308
  return {
3298
- root,
3299
- dir,
3300
- base,
3301
- ext,
3302
- name
3309
+ join: nodePath2.join,
3310
+ resolve: nodePath2.resolve,
3311
+ dirname: nodePath2.dirname,
3312
+ basename: nodePath2.basename,
3313
+ extname: nodePath2.extname,
3314
+ normalize: nodePath2.normalize,
3315
+ isAbsolute: nodePath2.isAbsolute,
3316
+ relative: nodePath2.relative,
3317
+ parse: nodePath2.parse,
3318
+ format: nodePath2.format,
3319
+ sep: nodePath2.sep,
3320
+ delimiter: nodePath2.delimiter
3303
3321
  };
3304
3322
  };
3305
- format6 = (pathObject) => {
3306
- const { root = "", dir, base, ext = "", name = "" } = pathObject;
3307
- const finalBase = base ?? name + ext;
3308
- if (dir) {
3309
- if (dir === root) {
3310
- return `${dir}${finalBase}`;
3323
+ readStream = async (stream) => {
3324
+ if (!stream) return new Uint8Array(0);
3325
+ const chunks = [];
3326
+ const reader = stream.getReader();
3327
+ try {
3328
+ while (true) {
3329
+ const { done, value: value2 } = await reader.read();
3330
+ if (done) break;
3331
+ chunks.push(value2);
3311
3332
  }
3312
- return `${dir}/${finalBase}`;
3333
+ } finally {
3334
+ reader.releaseLock();
3313
3335
  }
3314
- return `${root}${finalBase}`;
3315
- };
3316
- posixPath = {
3317
- join: join6,
3318
- resolve: resolve6,
3319
- dirname: dirname6,
3320
- basename: basename6,
3321
- extname: extname6,
3322
- normalize: normalize6,
3323
- isAbsolute: isAbsolute6,
3324
- relative: relative6,
3325
- parse: parse6,
3326
- format: format6,
3327
- sep: POSIX_SEP,
3328
- delimiter: POSIX_DELIMITER
3329
- };
3330
- }
3331
- });
3332
-
3333
- // pkg/@eser/standards/runtime/adapters/workerd.ts
3334
- var WORKERD_CAPABILITIES, createWorkerdFs, createWorkerdPath, createWorkerdExec, envStorage, createWorkerdEnv, populateEnvFromContext, clearEnv, createWorkerdProcess, createWorkerdRuntime;
3335
- var init_workerd = __esm({
3336
- "pkg/@eser/standards/runtime/adapters/workerd.ts"() {
3337
- init_types();
3338
- init_path();
3339
- WORKERD_CAPABILITIES = {
3340
- fs: false,
3341
- fsSync: false,
3342
- exec: false,
3343
- process: false,
3344
- env: true,
3345
- stdin: false,
3346
- stdout: false,
3347
- kv: true
3336
+ const totalLength = chunks.reduce((acc, chunk) => acc + chunk.length, 0);
3337
+ const result = new Uint8Array(totalLength);
3338
+ let offset = 0;
3339
+ for (const chunk of chunks) {
3340
+ result.set(chunk, offset);
3341
+ offset += chunk.length;
3342
+ }
3343
+ return result;
3348
3344
  };
3349
- createWorkerdFs = () => {
3350
- const throwNotAvailable = () => {
3351
- throw new RuntimeCapabilityError("fs", "workerd");
3352
- };
3345
+ createBunExec = () => {
3353
3346
  return {
3354
- readFile: throwNotAvailable,
3355
- readTextFile: throwNotAvailable,
3356
- writeFile: throwNotAvailable,
3357
- writeTextFile: throwNotAvailable,
3358
- exists: throwNotAvailable,
3359
- stat: throwNotAvailable,
3360
- lstat: throwNotAvailable,
3361
- mkdir: throwNotAvailable,
3362
- remove: throwNotAvailable,
3363
- readDir: () => {
3364
- throw new RuntimeCapabilityError("fs", "workerd");
3347
+ async spawn(cmd, args = [], options) {
3348
+ const [stdinMode, stdoutMode, stderrMode] = getNodeStdioArray(options);
3349
+ const proc = Bun.spawn([
3350
+ cmd,
3351
+ ...args
3352
+ ], {
3353
+ cwd: options?.cwd,
3354
+ env: options?.env,
3355
+ stdin: stdinMode,
3356
+ stdout: stdoutMode,
3357
+ stderr: stderrMode
3358
+ });
3359
+ const [exitCode, stdout, stderr] = await Promise.all([
3360
+ proc.exited,
3361
+ readStream(proc.stdout),
3362
+ readStream(proc.stderr)
3363
+ ]);
3364
+ return {
3365
+ success: exitCode === 0,
3366
+ code: exitCode,
3367
+ stdout,
3368
+ stderr
3369
+ };
3370
+ },
3371
+ async exec(cmd, args = [], options) {
3372
+ const result = await this.spawn(cmd, args, options);
3373
+ if (!result.success) {
3374
+ const stderr = new TextDecoder().decode(result.stderr);
3375
+ throw new ProcessError(cmd, result.code, stderr);
3376
+ }
3377
+ return new TextDecoder().decode(result.stdout).trim();
3378
+ },
3379
+ async execJson(cmd, args = [], options) {
3380
+ const output = await this.exec(cmd, args, options);
3381
+ return JSON.parse(output);
3365
3382
  },
3366
- copyFile: throwNotAvailable,
3367
- rename: throwNotAvailable,
3368
- makeTempDir: throwNotAvailable
3369
- };
3370
- };
3371
- createWorkerdPath = () => {
3372
- return posixPath;
3373
- };
3374
- createWorkerdExec = () => {
3375
- const throwNotAvailable = () => {
3376
- throw new RuntimeCapabilityError("exec", "workerd");
3377
- };
3378
- return {
3379
- spawn: throwNotAvailable,
3380
- exec: throwNotAvailable,
3381
- execJson: throwNotAvailable,
3382
- spawnChild: throwNotAvailable
3383
+ spawnChild(cmd, args = [], options) {
3384
+ const [stdinMode, stdoutMode, stderrMode] = getNodeStdioArray(options);
3385
+ const proc = Bun.spawn([
3386
+ cmd,
3387
+ ...args
3388
+ ], {
3389
+ cwd: options?.cwd,
3390
+ env: options?.env,
3391
+ stdin: stdinMode,
3392
+ stdout: stdoutMode,
3393
+ stderr: stderrMode
3394
+ });
3395
+ const statusPromise = proc.exited.then((code2) => ({
3396
+ success: code2 === 0,
3397
+ code: code2,
3398
+ signal: void 0
3399
+ }));
3400
+ return {
3401
+ pid: proc.pid,
3402
+ stdin: proc.stdin,
3403
+ stdout: proc.stdout,
3404
+ stderr: proc.stderr,
3405
+ status: statusPromise,
3406
+ output: async () => {
3407
+ const [status, stdout, stderr] = await Promise.all([
3408
+ statusPromise,
3409
+ readStream(proc.stdout),
3410
+ readStream(proc.stderr)
3411
+ ]);
3412
+ return {
3413
+ success: status.success,
3414
+ code: status.code,
3415
+ stdout,
3416
+ stderr
3417
+ };
3418
+ },
3419
+ kill: (signal) => {
3420
+ proc.kill(signal);
3421
+ }
3422
+ };
3423
+ }
3383
3424
  };
3384
3425
  };
3385
- envStorage = /* @__PURE__ */ new Map();
3386
- createWorkerdEnv = () => {
3426
+ createBunEnv = () => {
3387
3427
  return {
3388
3428
  get(key) {
3389
- return envStorage.get(key);
3429
+ return nodeProcess2.env[key];
3390
3430
  },
3391
3431
  set(key, value2) {
3392
- envStorage.set(key, value2);
3432
+ nodeProcess2.env[key] = value2;
3393
3433
  },
3394
3434
  delete(key) {
3395
- envStorage.delete(key);
3435
+ delete nodeProcess2.env[key];
3396
3436
  },
3397
3437
  has(key) {
3398
- return envStorage.has(key);
3438
+ return key in nodeProcess2.env;
3399
3439
  },
3400
3440
  toObject() {
3401
- return Object.fromEntries(envStorage);
3441
+ const result = {};
3442
+ for (const [key, value2] of Object.entries(nodeProcess2.env)) {
3443
+ if (value2 !== void 0) {
3444
+ result[key] = value2;
3445
+ }
3446
+ }
3447
+ return result;
3402
3448
  }
3403
3449
  };
3404
3450
  };
3405
- populateEnvFromContext = (env) => {
3406
- for (const [key, value2] of Object.entries(env)) {
3407
- if (value2 !== null && value2 !== void 0 && value2.constructor === String) {
3408
- envStorage.set(key, value2);
3409
- }
3410
- }
3411
- };
3412
- clearEnv = () => {
3413
- envStorage.clear();
3414
- };
3415
- createWorkerdProcess = () => {
3416
- const throwNotAvailable = () => {
3417
- throw new RuntimeCapabilityError("process", "workerd");
3418
- };
3451
+ createBunProcess = () => {
3419
3452
  return {
3420
- exit: throwNotAvailable,
3421
- cwd: throwNotAvailable,
3422
- chdir: throwNotAvailable,
3423
- hostname: throwNotAvailable,
3424
- execPath: throwNotAvailable,
3425
- get args() {
3426
- throw new RuntimeCapabilityError("process", "workerd");
3453
+ exit(code2) {
3454
+ nodeProcess2.exit(code2);
3427
3455
  },
3428
- get pid() {
3429
- throw new RuntimeCapabilityError("process", "workerd");
3456
+ cwd() {
3457
+ return nodeProcess2.cwd();
3430
3458
  },
3431
- get stdin() {
3432
- throw new RuntimeCapabilityError("process", "workerd");
3459
+ chdir(path) {
3460
+ nodeProcess2.chdir(path);
3433
3461
  },
3434
- get stdout() {
3435
- throw new RuntimeCapabilityError("process", "workerd");
3462
+ hostname() {
3463
+ return nodeOs2.hostname();
3436
3464
  },
3437
- get stderr() {
3438
- throw new RuntimeCapabilityError("process", "workerd");
3439
- }
3465
+ execPath() {
3466
+ return nodeProcess2.execPath;
3467
+ },
3468
+ args: nodeProcess2.argv.slice(2),
3469
+ pid: nodeProcess2.pid,
3470
+ stdin: Readable2.toWeb(nodeProcess2.stdin),
3471
+ stdout: Writable2.toWeb(nodeProcess2.stdout),
3472
+ stderr: Writable2.toWeb(nodeProcess2.stderr)
3440
3473
  };
3441
3474
  };
3442
- createWorkerdRuntime = () => {
3443
- const fs = createWorkerdFs();
3444
- const path = createWorkerdPath();
3445
- const exec2 = createWorkerdExec();
3446
- const env = createWorkerdEnv();
3447
- const process = createWorkerdProcess();
3475
+ createBunRuntime = () => {
3476
+ const fs = createBunFs();
3477
+ const path = createBunPath();
3478
+ const exec2 = createBunExec();
3479
+ const env = createBunEnv();
3480
+ const process = createBunProcess();
3448
3481
  return {
3449
- name: "workerd",
3450
- version: "unknown",
3451
- capabilities: WORKERD_CAPABILITIES,
3482
+ name: "bun",
3483
+ version: Bun.version,
3484
+ capabilities: BUN_CAPABILITIES,
3452
3485
  fs,
3453
3486
  path,
3454
3487
  exec: exec2,
@@ -3459,28 +3492,12 @@ var init_workerd = __esm({
3459
3492
  }
3460
3493
  });
3461
3494
 
3462
- // pkg/@eser/standards/runtime/capabilities.ts
3463
- var FULL_CAPABILITIES, BROWSER_CAPABILITIES, UNKNOWN_CAPABILITIES, getCapabilities, hasCapability;
3464
- var init_capabilities = __esm({
3465
- "pkg/@eser/standards/runtime/capabilities.ts"() {
3466
- init_deno();
3467
- init_node();
3468
- init_bun();
3469
- init_workerd();
3470
- init_deno();
3471
- init_node();
3472
- init_bun();
3473
- init_workerd();
3474
- FULL_CAPABILITIES = {
3475
- fs: true,
3476
- fsSync: true,
3477
- exec: true,
3478
- process: true,
3479
- env: true,
3480
- stdin: true,
3481
- stdout: true,
3482
- kv: false
3483
- };
3495
+ // pkg/@eser/standards/runtime/adapters/browser.ts
3496
+ var BROWSER_CAPABILITIES, createThrowFn, createBrowserFs, createBrowserExec, createBrowserProcess, createBrowserEnv, createBrowserRuntime;
3497
+ var init_browser = __esm({
3498
+ "pkg/@eser/standards/runtime/adapters/browser.ts"() {
3499
+ init_types();
3500
+ init_path();
3484
3501
  BROWSER_CAPABILITIES = {
3485
3502
  fs: false,
3486
3503
  fsSync: false,
@@ -3491,68 +3508,82 @@ var init_capabilities = __esm({
3491
3508
  stdout: false,
3492
3509
  kv: false
3493
3510
  };
3494
- UNKNOWN_CAPABILITIES = {
3495
- fs: false,
3496
- fsSync: false,
3497
- exec: false,
3498
- process: false,
3499
- env: false,
3500
- stdin: false,
3501
- stdout: false,
3502
- kv: false
3511
+ createThrowFn = (capability) => {
3512
+ return () => {
3513
+ throw new RuntimeCapabilityError(capability, "browser");
3514
+ };
3503
3515
  };
3504
- getCapabilities = (runtime2) => {
3505
- switch (runtime2) {
3506
- case "deno":
3507
- return DENO_CAPABILITIES;
3508
- case "node":
3509
- return NODE_CAPABILITIES;
3510
- case "bun":
3511
- return BUN_CAPABILITIES;
3512
- case "workerd":
3513
- return WORKERD_CAPABILITIES;
3514
- case "browser":
3515
- return BROWSER_CAPABILITIES;
3516
- default:
3517
- return UNKNOWN_CAPABILITIES;
3518
- }
3516
+ createBrowserFs = () => {
3517
+ const throwFs = createThrowFn("fs");
3518
+ return {
3519
+ readFile: throwFs,
3520
+ readTextFile: throwFs,
3521
+ writeFile: throwFs,
3522
+ writeTextFile: throwFs,
3523
+ exists: throwFs,
3524
+ stat: throwFs,
3525
+ lstat: throwFs,
3526
+ mkdir: throwFs,
3527
+ remove: throwFs,
3528
+ readDir: throwFs,
3529
+ copyFile: throwFs,
3530
+ rename: throwFs,
3531
+ makeTempDir: throwFs
3532
+ };
3519
3533
  };
3520
- hasCapability = (runtime2, capability) => {
3521
- return getCapabilities(runtime2)[capability];
3534
+ createBrowserExec = () => {
3535
+ const throwExec = createThrowFn("exec");
3536
+ return {
3537
+ spawn: throwExec,
3538
+ exec: throwExec,
3539
+ execJson: throwExec,
3540
+ spawnChild: throwExec
3541
+ };
3522
3542
  };
3523
- }
3524
- });
3525
-
3526
- // pkg/@eser/standards/runtime/file-search.ts
3527
- var searchFileHierarchy;
3528
- var init_file_search = __esm({
3529
- "pkg/@eser/standards/runtime/file-search.ts"() {
3530
- init_mod2();
3531
- searchFileHierarchy = async (startDir, filenames, options = {}) => {
3532
- const { searchParents = false } = options;
3533
- let dir = startDir;
3534
- while (true) {
3535
- for (const name of filenames) {
3536
- const filepath = runtime.path.join(dir, name);
3537
- const exists = await runtime.fs.exists(filepath);
3538
- if (exists) {
3539
- const stat3 = await runtime.fs.stat(filepath);
3540
- if (stat3.isFile) {
3541
- return filepath;
3542
- }
3543
- }
3544
- }
3545
- if (!searchParents) {
3546
- break;
3547
- }
3548
- const parent = runtime.path.dirname(dir);
3549
- if (parent === dir) {
3550
- break;
3543
+ createBrowserProcess = () => {
3544
+ const throwProcess = createThrowFn("process");
3545
+ return {
3546
+ exit: throwProcess,
3547
+ cwd: throwProcess,
3548
+ chdir: throwProcess,
3549
+ hostname: throwProcess,
3550
+ execPath: throwProcess,
3551
+ get args() {
3552
+ throw new RuntimeCapabilityError("process", "browser");
3553
+ },
3554
+ get pid() {
3555
+ throw new RuntimeCapabilityError("process", "browser");
3556
+ },
3557
+ get stdin() {
3558
+ throw new RuntimeCapabilityError("process", "browser");
3559
+ },
3560
+ get stdout() {
3561
+ throw new RuntimeCapabilityError("process", "browser");
3562
+ },
3563
+ get stderr() {
3564
+ throw new RuntimeCapabilityError("process", "browser");
3551
3565
  }
3552
- dir = parent;
3553
- }
3554
- return void 0;
3566
+ };
3555
3567
  };
3568
+ createBrowserEnv = () => ({
3569
+ get: () => void 0,
3570
+ set: () => {
3571
+ },
3572
+ delete: () => {
3573
+ },
3574
+ has: () => false,
3575
+ toObject: () => ({})
3576
+ });
3577
+ createBrowserRuntime = () => ({
3578
+ name: "browser",
3579
+ version: globalThis.navigator?.userAgent ?? "unknown",
3580
+ capabilities: BROWSER_CAPABILITIES,
3581
+ fs: createBrowserFs(),
3582
+ path: posixPath,
3583
+ exec: createBrowserExec(),
3584
+ env: createBrowserEnv(),
3585
+ process: createBrowserProcess()
3586
+ });
3556
3587
  }
3557
3588
  });
3558
3589
 
@@ -3560,27 +3591,18 @@ var init_file_search = __esm({
3560
3591
  var mod_exports2 = {};
3561
3592
  __export(mod_exports2, {
3562
3593
  AlreadyExistsError: () => AlreadyExistsError,
3563
- BROWSER_CAPABILITIES: () => BROWSER_CAPABILITIES,
3564
- BUN_CAPABILITIES: () => BUN_CAPABILITIES,
3565
- DENO_CAPABILITIES: () => DENO_CAPABILITIES,
3566
- FULL_CAPABILITIES: () => FULL_CAPABILITIES,
3567
- NODE_CAPABILITIES: () => NODE_CAPABILITIES,
3568
3594
  NotFoundError: () => NotFoundError,
3569
3595
  ProcessError: () => ProcessError,
3570
3596
  RuntimeCapabilityError: () => RuntimeCapabilityError,
3571
- UNKNOWN_CAPABILITIES: () => UNKNOWN_CAPABILITIES,
3572
- WORKERD_CAPABILITIES: () => WORKERD_CAPABILITIES,
3573
3597
  clearWorkerdEnv: () => clearEnv,
3574
3598
  createRuntime: () => createRuntime,
3575
3599
  detectRuntime: () => detectRuntime,
3576
3600
  getArch: () => getArch,
3577
- getCapabilities: () => getCapabilities,
3578
3601
  getHomedir: () => getHomedir,
3579
3602
  getPlatform: () => getPlatform,
3580
3603
  getPlatformInfo: () => getPlatformInfo,
3581
3604
  getRuntimeVersion: () => getRuntimeVersion,
3582
3605
  getTmpdir: () => getTmpdir,
3583
- hasCapability: () => hasCapability,
3584
3606
  isBrowser: () => isBrowser,
3585
3607
  isBun: () => isBun,
3586
3608
  isDeno: () => isDeno,
@@ -3593,31 +3615,30 @@ __export(mod_exports2, {
3593
3615
  runtime: () => runtime,
3594
3616
  searchFileHierarchy: () => searchFileHierarchy
3595
3617
  });
3596
- var createThrowFn, createStubFs, createStubExec, createStubProcess, createStubEnv, createMinimalRuntime, runtimeFactories, overrideKeys, hasOverrides, mergeRuntime, createRuntime, runtime;
3618
+ var createThrowFn2, createStubFs, createStubExec, createStubProcess, createStubEnv, createMinimalRuntime, runtimeFactories, overrideKeys, hasOverrides, mergeRuntime, createRuntime, runtime;
3597
3619
  var init_mod2 = __esm({
3598
3620
  "pkg/@eser/standards/runtime/mod.ts"() {
3599
3621
  init_types();
3600
3622
  init_detect();
3601
3623
  init_platform();
3602
- init_capabilities();
3603
3624
  init_path();
3604
3625
  init_file_search();
3605
3626
  init_workerd();
3606
3627
  init_types();
3607
3628
  init_detect();
3608
- init_capabilities();
3609
3629
  init_path();
3610
3630
  init_deno();
3611
3631
  init_node();
3612
3632
  init_bun();
3613
3633
  init_workerd();
3614
- createThrowFn = (capability, runtimeName) => {
3634
+ init_browser();
3635
+ createThrowFn2 = (capability, runtimeName) => {
3615
3636
  return () => {
3616
3637
  throw new RuntimeCapabilityError(capability, runtimeName);
3617
3638
  };
3618
3639
  };
3619
3640
  createStubFs = (runtimeName) => {
3620
- const throwFs = createThrowFn("fs", runtimeName);
3641
+ const throwFs = createThrowFn2("fs", runtimeName);
3621
3642
  return {
3622
3643
  readFile: throwFs,
3623
3644
  readTextFile: throwFs,
@@ -3635,7 +3656,7 @@ var init_mod2 = __esm({
3635
3656
  };
3636
3657
  };
3637
3658
  createStubExec = (runtimeName) => {
3638
- const throwExec = createThrowFn("exec", runtimeName);
3659
+ const throwExec = createThrowFn2("exec", runtimeName);
3639
3660
  return {
3640
3661
  spawn: throwExec,
3641
3662
  exec: throwExec,
@@ -3644,7 +3665,7 @@ var init_mod2 = __esm({
3644
3665
  };
3645
3666
  };
3646
3667
  createStubProcess = (runtimeName) => {
3647
- const throwProcess = createThrowFn("process", runtimeName);
3668
+ const throwProcess = createThrowFn2("process", runtimeName);
3648
3669
  return {
3649
3670
  exit: throwProcess,
3650
3671
  cwd: throwProcess,
@@ -3677,10 +3698,19 @@ var init_mod2 = __esm({
3677
3698
  has: () => false,
3678
3699
  toObject: () => ({})
3679
3700
  });
3680
- createMinimalRuntime = (name, capabilities = UNKNOWN_CAPABILITIES) => ({
3701
+ createMinimalRuntime = (name) => ({
3681
3702
  name,
3682
3703
  version: "unknown",
3683
- capabilities,
3704
+ capabilities: {
3705
+ fs: false,
3706
+ fsSync: false,
3707
+ exec: false,
3708
+ process: false,
3709
+ env: false,
3710
+ stdin: false,
3711
+ stdout: false,
3712
+ kv: false
3713
+ },
3684
3714
  fs: createStubFs(name),
3685
3715
  path: posixPath,
3686
3716
  exec: createStubExec(name),
@@ -3691,7 +3721,8 @@ var init_mod2 = __esm({
3691
3721
  deno: createDenoRuntime,
3692
3722
  node: createNodeRuntime,
3693
3723
  bun: createBunRuntime,
3694
- workerd: createWorkerdRuntime
3724
+ workerd: createWorkerdRuntime,
3725
+ browser: createBrowserRuntime
3695
3726
  };
3696
3727
  overrideKeys = [
3697
3728
  "fs",
@@ -3713,15 +3744,21 @@ var init_mod2 = __esm({
3713
3744
  });
3714
3745
  createRuntime = (options) => {
3715
3746
  const runtimeName = detectRuntime();
3716
- const capabilities = {
3717
- ...getCapabilities(runtimeName),
3718
- ...options?.capabilities
3719
- };
3720
3747
  const factory = runtimeFactories[runtimeName];
3721
- const baseRuntime = factory?.() ?? createMinimalRuntime(runtimeName, capabilities);
3748
+ const baseRuntime = factory?.() ?? createMinimalRuntime(runtimeName);
3749
+ const capabilities = options?.capabilities ? {
3750
+ ...baseRuntime.capabilities,
3751
+ ...options.capabilities
3752
+ } : baseRuntime.capabilities;
3722
3753
  if (options !== void 0 && hasOverrides(options)) {
3723
3754
  return mergeRuntime(baseRuntime, options, capabilities);
3724
3755
  }
3756
+ if (options?.capabilities) {
3757
+ return {
3758
+ ...baseRuntime,
3759
+ capabilities
3760
+ };
3761
+ }
3725
3762
  return baseRuntime;
3726
3763
  };
3727
3764
  runtime = createRuntime();
@@ -5881,8 +5918,8 @@ var init_to_path_string = __esm({
5881
5918
  // deno:https://jsr.io/@std/fs/1.0.21/_create_walk_entry.ts
5882
5919
  async function createWalkEntry(path) {
5883
5920
  path = toPathString(path);
5884
- path = normalize3(path);
5885
- const name = basename3(path);
5921
+ path = normalize4(path);
5922
+ const name = basename4(path);
5886
5923
  const info = await Deno.stat(path);
5887
5924
  return {
5888
5925
  path,
@@ -5929,7 +5966,7 @@ async function* walk(root, options) {
5929
5966
  return;
5930
5967
  }
5931
5968
  for await (const entry of Deno.readDir(root)) {
5932
- let path = join3(root, entry.name);
5969
+ let path = join4(root, entry.name);
5933
5970
  let { isSymlink, isDirectory } = entry;
5934
5971
  if (isSymlink) {
5935
5972
  if (!followSymlinks) {
@@ -7221,7 +7258,7 @@ var init_loader = __esm({
7221
7258
  }
7222
7259
  };
7223
7260
  getFileFormat = (filepath) => {
7224
- const ext = extname(filepath);
7261
+ const ext = extname2(filepath);
7225
7262
  if (ext === ".json") {
7226
7263
  return FileFormats.Json;
7227
7264
  }
@@ -7456,7 +7493,7 @@ var init_loader2 = __esm({
7456
7493
  findConfigFiles = async (baseDir, includeFiles) => {
7457
7494
  const results = [];
7458
7495
  for (const fileType of includeFiles) {
7459
- const filepath = join(baseDir, fileType);
7496
+ const filepath = join2(baseDir, fileType);
7460
7497
  const loaded = await tryLoadConfigFile(filepath, fileType);
7461
7498
  if (loaded) {
7462
7499
  results.push(loaded);
@@ -7516,14 +7553,14 @@ var init_loader2 = __esm({
7516
7553
  const { baseDir = ".", includeFiles = CONFIG_FILE_PRIORITY, fieldMappings, searchParents = false } = options;
7517
7554
  const mergedMappings = mergeFieldMappings(fieldMappings);
7518
7555
  const sortedFiles = sortByPriority(includeFiles);
7519
- let searchDir = resolve(baseDir);
7556
+ let searchDir = resolve2(baseDir);
7520
7557
  let loadedFiles = [];
7521
7558
  while (true) {
7522
7559
  loadedFiles = await findConfigFiles(searchDir, sortedFiles);
7523
7560
  if (loadedFiles.length > 0 || !searchParents) {
7524
7561
  break;
7525
7562
  }
7526
- const parent = dirname(searchDir);
7563
+ const parent = dirname2(searchDir);
7527
7564
  if (parent === searchDir) {
7528
7565
  break;
7529
7566
  }
@@ -7727,7 +7764,7 @@ var init_writer = __esm({
7727
7764
  function split(path) {
7728
7765
  const s = SEPARATOR_PATTERN.source;
7729
7766
  const segments = path.replace(new RegExp(`^${s}|${s}$`, "g"), "").split(SEPARATOR_PATTERN);
7730
- const isAbsolute_ = isAbsolute3(path);
7767
+ const isAbsolute_ = isAbsolute4(path);
7731
7768
  const split2 = {
7732
7769
  segments,
7733
7770
  isAbsolute: isAbsolute_,
@@ -7757,8 +7794,8 @@ async function* expandGlob(glob, options) {
7757
7794
  globstar,
7758
7795
  caseInsensitive
7759
7796
  };
7760
- const absRoot = isGlobAbsolute ? root : resolve3(root);
7761
- const resolveFromRoot = (path) => resolve3(absRoot, path);
7797
+ const absRoot = isGlobAbsolute ? root : resolve4(root);
7798
+ const resolveFromRoot = (path) => resolve4(absRoot, path);
7762
7799
  const excludePatterns = exclude.map(resolveFromRoot).map((s) => globToRegExp3(s, globOptions));
7763
7800
  const shouldInclude = (path) => !excludePatterns.some((p) => p.test(path));
7764
7801
  let fixedRoot = isGlobAbsolute ? winRoot ?? "/" : absRoot;
@@ -7881,7 +7918,7 @@ var init_workspace = __esm({
7881
7918
  });
7882
7919
  } catch (e) {
7883
7920
  if (e instanceof PackageLoadError) {
7884
- console.log(`No package config file found in ${resolve(path)}`);
7921
+ console.log(`No package config file found in ${resolve2(path)}`);
7885
7922
  runtime.process.exit(1);
7886
7923
  }
7887
7924
  throw e;
@@ -7890,7 +7927,7 @@ var init_workspace = __esm({
7890
7927
  expandWorkspacePaths = async (root, patterns) => {
7891
7928
  const paths = [];
7892
7929
  for (const pattern of patterns) {
7893
- const fullPattern = join(root, pattern);
7930
+ const fullPattern = join2(root, pattern);
7894
7931
  if (pattern.includes("*") || pattern.includes("?")) {
7895
7932
  for await (const entry of expandGlob(fullPattern, {
7896
7933
  includeDirs: true
@@ -7999,10 +8036,10 @@ var init_workspace_discovery = __esm({
7999
8036
  return [];
8000
8037
  };
8001
8038
  resolveModulePath = (specifier, basePath) => {
8002
- if (isAbsolute(specifier)) {
8039
+ if (isAbsolute2(specifier)) {
8003
8040
  return specifier;
8004
8041
  }
8005
- return resolve(basePath, specifier);
8042
+ return resolve2(basePath, specifier);
8006
8043
  };
8007
8044
  getPackageFiles = async (packagePath) => {
8008
8045
  const files = [];
@@ -8017,8 +8054,8 @@ var init_workspace_discovery = __esm({
8017
8054
  /\.git/
8018
8055
  ]
8019
8056
  })) {
8020
- const relativePath = relative(packagePath, entry.path);
8021
- const fileName = basename(relativePath);
8057
+ const relativePath = relative2(packagePath, entry.path);
8058
+ const fileName = basename2(relativePath);
8022
8059
  if (fileName.endsWith("_test.ts") || fileName.endsWith("_bench.ts")) {
8023
8060
  continue;
8024
8061
  }
@@ -8209,7 +8246,7 @@ var init_check_mod_exports = __esm({
8209
8246
  const packages = await discoverPackages(root);
8210
8247
  const missingExports = [];
8211
8248
  for (const pkg of packages) {
8212
- const modPath = join(pkg.path, "mod.ts");
8249
+ const modPath = join2(pkg.path, "mod.ts");
8213
8250
  let modContent;
8214
8251
  try {
8215
8252
  modContent = await runtime.fs.readTextFile(modPath);
@@ -8222,7 +8259,7 @@ var init_check_mod_exports = __esm({
8222
8259
  ].map((e) => normalizePath(e)));
8223
8260
  const files = await getPackageFiles(pkg.path);
8224
8261
  for (const file of files) {
8225
- const fileName = basename(file);
8262
+ const fileName = basename2(file);
8226
8263
  if (!shouldBeExported(fileName)) {
8227
8264
  continue;
8228
8265
  }
@@ -8308,7 +8345,7 @@ var init_check_export_names = __esm({
8308
8345
  if (cleanSegment.length === 0) {
8309
8346
  continue;
8310
8347
  }
8311
- const ext = extname(cleanSegment);
8348
+ const ext = extname2(cleanSegment);
8312
8349
  if (ext.length > 0) {
8313
8350
  cleanSegment = cleanSegment.slice(0, -ext.length);
8314
8351
  }
@@ -8584,7 +8621,7 @@ var init_check_licenses = __esm({
8584
8621
  validateLicenses = async (options = {}) => {
8585
8622
  const { fix = false } = options;
8586
8623
  const baseUrl = new URL(".", import.meta.url);
8587
- const defaultRoot = join(fromFileUrl(baseUrl.href), "..");
8624
+ const defaultRoot = join2(fromFileUrl(baseUrl.href), "..");
8588
8625
  const root = options.root ?? defaultRoot;
8589
8626
  const issues = [];
8590
8627
  let checked = 0;
@@ -9943,7 +9980,7 @@ var CONFIG_FILENAMES = [
9943
9980
  ];
9944
9981
  var loadProjectConfig = async (dir) => {
9945
9982
  for (const filename of CONFIG_FILENAMES) {
9946
- const filepath = join3(dir, filename);
9983
+ const filepath = join4(dir, filename);
9947
9984
  try {
9948
9985
  const content = await runtime.fs.readTextFile(filepath);
9949
9986
  const config = parse7(content);
@@ -10995,12 +11032,12 @@ var UntarStream = class {
10995
11032
  init_mod();
10996
11033
  var extractTarball = async (stream, targetDir, options = {}) => {
10997
11034
  const { stripComponents = 0, subpath } = options;
10998
- const normalizedSubpath = subpath !== void 0 ? normalize3(subpath).replace(/^\/+/, "") : void 0;
11035
+ const normalizedSubpath = subpath !== void 0 ? normalize4(subpath).replace(/^\/+/, "") : void 0;
10999
11036
  const decompressed = stream.pipeThrough(new DecompressionStream("gzip"));
11000
11037
  const untarStream = decompressed.pipeThrough(new UntarStream());
11001
11038
  for await (const entry of untarStream) {
11002
- const entryPath = normalize3(entry.path);
11003
- if (entryPath.startsWith("..") || isAbsolute3(entryPath)) {
11039
+ const entryPath = normalize4(entry.path);
11040
+ if (entryPath.startsWith("..") || isAbsolute4(entryPath)) {
11004
11041
  if (entry.readable !== void 0) {
11005
11042
  await entry.readable.cancel();
11006
11043
  }
@@ -11030,8 +11067,8 @@ var extractTarball = async (stream, targetDir, options = {}) => {
11030
11067
  continue;
11031
11068
  }
11032
11069
  }
11033
- const outputPath = normalizedSubpath !== void 0 ? join3(targetDir, strippedPath.slice(normalizedSubpath.length).replace(/^\/+/, "")) : join3(targetDir, strippedPath);
11034
- await ensureDir(dirname3(outputPath));
11070
+ const outputPath = normalizedSubpath !== void 0 ? join4(targetDir, strippedPath.slice(normalizedSubpath.length).replace(/^\/+/, "")) : join4(targetDir, strippedPath);
11071
+ await ensureDir(dirname4(outputPath));
11035
11072
  if (entry.readable !== void 0) {
11036
11073
  const file = await Deno.create(outputPath);
11037
11074
  await entry.readable.pipeTo(file.writable);
@@ -11154,7 +11191,7 @@ var CONFIG_FILENAMES2 = [
11154
11191
  ];
11155
11192
  var loadTemplateConfig = async (dir) => {
11156
11193
  for (const filename of CONFIG_FILENAMES2) {
11157
- const filepath = join3(dir, filename);
11194
+ const filepath = join4(dir, filename);
11158
11195
  try {
11159
11196
  const content = await runtime.fs.readTextFile(filepath);
11160
11197
  const config = parse7(content);
@@ -11236,7 +11273,7 @@ ${errors.join("\n")}`);
11236
11273
  };
11237
11274
  var getConfigFilePath = async (dir) => {
11238
11275
  for (const filename of CONFIG_FILENAMES2) {
11239
- const filepath = join3(dir, filename);
11276
+ const filepath = join4(dir, filename);
11240
11277
  try {
11241
11278
  await runtime.fs.stat(filepath);
11242
11279
  return filepath;
@@ -11289,7 +11326,7 @@ var BINARY_EXTENSIONS = /* @__PURE__ */ new Set([
11289
11326
  ".webm"
11290
11327
  ]);
11291
11328
  var isBinaryFile = (filepath) => {
11292
- const ext = extname3(filepath).toLowerCase();
11329
+ const ext = extname4(filepath).toLowerCase();
11293
11330
  return BINARY_EXTENSIONS.has(ext);
11294
11331
  };
11295
11332
  var shouldIgnore = (relativePath, ignorePatterns) => {
@@ -11332,7 +11369,7 @@ var processTemplate = async (dir, options) => {
11332
11369
  for await (const entry of walk(dir, {
11333
11370
  includeDirs: true
11334
11371
  })) {
11335
- const relativePath = relative3(dir, entry.path);
11372
+ const relativePath = relative4(dir, entry.path);
11336
11373
  if (relativePath === "") {
11337
11374
  continue;
11338
11375
  }
@@ -11348,8 +11385,8 @@ var processTemplate = async (dir, options) => {
11348
11385
  }
11349
11386
  }
11350
11387
  for (const filepath of filesToProcess) {
11351
- const filename = basename3(filepath);
11352
- const dirPath = dirname3(filepath);
11388
+ const filename = basename4(filepath);
11389
+ const dirPath = dirname4(filepath);
11353
11390
  if (!isBinaryFile(filepath)) {
11354
11391
  try {
11355
11392
  const content = await runtime.fs.readTextFile(filepath);
@@ -11365,7 +11402,7 @@ var processTemplate = async (dir, options) => {
11365
11402
  }
11366
11403
  if (hasVariables(filename)) {
11367
11404
  const newFilename = substituteVariables(filename, variables);
11368
- const newPath = join3(dirPath, newFilename);
11405
+ const newPath = join4(dirPath, newFilename);
11369
11406
  if (newPath !== filepath) {
11370
11407
  await Deno.rename(filepath, newPath);
11371
11408
  }
@@ -11373,10 +11410,10 @@ var processTemplate = async (dir, options) => {
11373
11410
  }
11374
11411
  dirsToRename.sort((a, b) => b.split(SEPARATOR).length - a.split(SEPARATOR).length);
11375
11412
  for (const dirPath of dirsToRename) {
11376
- const dirname7 = basename3(dirPath);
11377
- const parentDir = dirname3(dirPath);
11413
+ const dirname7 = basename4(dirPath);
11414
+ const parentDir = dirname4(dirPath);
11378
11415
  const newDirname = substituteVariables(dirname7, variables);
11379
- const newPath = join3(parentDir, newDirname);
11416
+ const newPath = join4(parentDir, newDirname);
11380
11417
  if (newPath !== dirPath) {
11381
11418
  await Deno.rename(dirPath, newPath);
11382
11419
  }
@@ -11395,7 +11432,7 @@ var removeConfigFile = async (filepath) => {
11395
11432
  // pkg/@eser/codebase/scaffolding/scaffold.ts
11396
11433
  var scaffold = async (options) => {
11397
11434
  const { specifier, targetDir, variables: providedVariables = {}, force = false, skipPostInstall = false, interactive = false } = options;
11398
- const absoluteTargetDir = isAbsolute3(targetDir) ? targetDir : join3(runtime.process.cwd(), targetDir);
11435
+ const absoluteTargetDir = isAbsolute4(targetDir) ? targetDir : join4(runtime.process.cwd(), targetDir);
11399
11436
  try {
11400
11437
  const entries = [];
11401
11438
  for await (const entry of Deno.readDir(absoluteTargetDir)) {
@@ -11803,22 +11840,22 @@ var getRcFilePath = (shell) => {
11803
11840
  const home = getHomeDir();
11804
11841
  switch (shell) {
11805
11842
  case "zsh":
11806
- return join3(home, ".zshrc");
11843
+ return join4(home, ".zshrc");
11807
11844
  case "bash":
11808
- return join3(home, ".bashrc");
11845
+ return join4(home, ".bashrc");
11809
11846
  case "fish":
11810
- return join3(home, ".config", "fish", "config.fish");
11847
+ return join4(home, ".config", "fish", "config.fish");
11811
11848
  }
11812
11849
  };
11813
11850
  var getCompletionsFilePath = (shell, appName) => {
11814
11851
  const home = getHomeDir();
11815
11852
  switch (shell) {
11816
11853
  case "zsh":
11817
- return join3(home, ".zshrc");
11854
+ return join4(home, ".zshrc");
11818
11855
  case "bash":
11819
- return join3(home, ".bashrc");
11856
+ return join4(home, ".bashrc");
11820
11857
  case "fish":
11821
- return join3(home, ".config", "fish", "completions", `${appName}.fish`);
11858
+ return join4(home, ".config", "fish", "completions", `${appName}.fish`);
11822
11859
  }
11823
11860
  };
11824
11861
  var getCompletionEvalLine = (shell, appName) => {
@@ -11876,7 +11913,7 @@ var addCompletions = async (shell) => {
11876
11913
  try {
11877
11914
  if (config.completionType === "file") {
11878
11915
  const fishPath = config.completionsFile;
11879
- const dir = dirname3(fishPath);
11916
+ const dir = dirname4(fishPath);
11880
11917
  try {
11881
11918
  await runtime2.fs.mkdir(dir, {
11882
11919
  recursive: true
@@ -12188,7 +12225,7 @@ var systemCommand = new Command("system").description("Commands related with thi
12188
12225
  // pkg/@eser/cli/package.json
12189
12226
  var package_default = {
12190
12227
  name: "@eser/cli",
12191
- version: "4.0.8",
12228
+ version: "4.0.10",
12192
12229
  type: "module",
12193
12230
  exports: "./main.ts",
12194
12231
  bin: {