unrun 0.2.29 → 0.2.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.mjs CHANGED
@@ -1,6 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
  import process from "node:process";
3
-
4
3
  //#region src/cli.ts
5
4
  function parseCLIArguments(argv) {
6
5
  let debug = false;
@@ -100,6 +99,5 @@ runCLI().catch((error) => {
100
99
  console.error(error.message);
101
100
  process.exit(1);
102
101
  });
103
-
104
102
  //#endregion
105
- export { };
103
+ export {};
package/dist/index.mjs CHANGED
@@ -1,3 +1,2 @@
1
- import { n as unrunCli, r as unrunSync, t as unrun } from "./src-CS8hJStK.mjs";
2
-
3
- export { unrun, unrunCli, unrunSync };
1
+ import { n as unrunCli, r as unrunSync, t as unrun } from "./src-GU5PtktT.mjs";
2
+ export { unrun, unrunCli, unrunSync };
@@ -8,10 +8,8 @@ import { Buffer as Buffer$1 } from "node:buffer";
8
8
  import { spawn } from "node:child_process";
9
9
  import crypto from "node:crypto";
10
10
  import { tmpdir } from "node:os";
11
-
12
- //#region rolldown:runtime
11
+ //#region \0rolldown/runtime.js
13
12
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
14
-
15
13
  //#endregion
16
14
  //#region src/features/preset.ts
17
15
  /**
@@ -26,7 +24,6 @@ function preset(options, module) {
26
24
  if (module && typeof module === "object" && "default" in module) return module.default;
27
25
  return module;
28
26
  }
29
-
30
27
  //#endregion
31
28
  //#region src/utils/normalize-path.ts
32
29
  /**
@@ -54,7 +51,6 @@ function normalizePath(pathLike) {
54
51
  }
55
52
  return String(pathLike);
56
53
  }
57
-
58
54
  //#endregion
59
55
  //#region src/options.ts
60
56
  function resolveOptions(options = {}) {
@@ -73,7 +69,6 @@ function resolveOptions(options = {}) {
73
69
  ]).has(resolvedOptions.preset)) throw new Error(`[unrun] Invalid preset "${resolvedOptions.preset}" (expected: none | jiti | bundle-require)`);
74
70
  return resolvedOptions;
75
71
  }
76
-
77
72
  //#endregion
78
73
  //#region src/utils/module-resolution.ts
79
74
  /**
@@ -87,7 +82,6 @@ function isBuiltinModuleSpecifier(id) {
87
82
  if (!id) return false;
88
83
  return BUILTIN_MODULE_SPECIFIERS.has(id) || id.startsWith("node:");
89
84
  }
90
-
91
85
  //#endregion
92
86
  //#region src/features/external.ts
93
87
  /**
@@ -127,7 +121,6 @@ function getPackageName(specifier) {
127
121
  const [name] = specifier.split("/");
128
122
  return name || void 0;
129
123
  }
130
-
131
124
  //#endregion
132
125
  //#region src/plugins/console-output-customizer.ts
133
126
  const INSPECT_HELPER_SNIPPET = `(function(){
@@ -272,7 +265,6 @@ function insertAfterShebang(code, insertion) {
272
265
  if (nl === -1) return `${code}\n${insertion}`;
273
266
  return `${code.slice(0, nl + 1)}${insertion}${code.slice(nl + 1)}`;
274
267
  }
275
-
276
268
  //#endregion
277
269
  //#region src/plugins/json-loader.ts
278
270
  /**
@@ -322,7 +314,6 @@ function createJsonLoader() {
322
314
  }
323
315
  };
324
316
  }
325
-
326
317
  //#endregion
327
318
  //#region src/plugins/make-cjs-wrapper-async-friendly.ts
328
319
  /**
@@ -380,7 +371,6 @@ function createMakeCjsWrapperAsyncFriendlyPlugin() {
380
371
  } }
381
372
  };
382
373
  }
383
-
384
374
  //#endregion
385
375
  //#region src/plugins/require-resolve-fix.ts
386
376
  /**
@@ -416,7 +406,6 @@ function createRequireResolveFix(options) {
416
406
  } }
417
407
  };
418
408
  }
419
-
420
409
  //#endregion
421
410
  //#region src/plugins/require-typeof-fix.ts
422
411
  /**
@@ -431,7 +420,6 @@ function createRequireTypeofFix() {
431
420
  } }
432
421
  };
433
422
  }
434
-
435
423
  //#endregion
436
424
  //#region src/plugins/source-context-shims.ts
437
425
  /**
@@ -637,7 +625,6 @@ function createSourceContextShimsPlugin() {
637
625
  }
638
626
  };
639
627
  }
640
-
641
628
  //#endregion
642
629
  //#region src/utils/bundle.ts
643
630
  async function bundle(options) {
@@ -685,7 +672,6 @@ async function bundle(options) {
685
672
  dependencies: files
686
673
  };
687
674
  }
688
-
689
675
  //#endregion
690
676
  //#region src/utils/module/clean-module.ts
691
677
  /**
@@ -705,7 +691,6 @@ function cleanModule(moduleUrl, options) {
705
691
  if (error.code !== "ENOENT") throw error;
706
692
  }
707
693
  }
708
-
709
694
  //#endregion
710
695
  //#region src/utils/module/exec-module.ts
711
696
  /**
@@ -789,7 +774,6 @@ function execModule(moduleUrl, args = []) {
789
774
  });
790
775
  });
791
776
  }
792
-
793
777
  //#endregion
794
778
  //#region src/utils/module/write-module.ts
795
779
  function sanitize(name) {
@@ -826,7 +810,6 @@ function writeModule(code, options) {
826
810
  }
827
811
  return moduleUrl;
828
812
  }
829
-
830
813
  //#endregion
831
814
  //#region src/utils/module/load-module.ts
832
815
  /**
@@ -846,7 +829,6 @@ async function loadModule(code, options) {
846
829
  }
847
830
  return _module;
848
831
  }
849
-
850
832
  //#endregion
851
833
  //#region src/index.ts
852
834
  /**
@@ -862,7 +844,7 @@ async function unrun(options) {
862
844
  try {
863
845
  module = await loadModule(output.chunk.code, resolvedOptions);
864
846
  } catch (error) {
865
- throw new Error(`[unrun] Import failed (code length: ${output.chunk.code.length}): ${error.message}`);
847
+ throw new Error(`[unrun] Import failed (code length: ${output.chunk.code.length}): ${error.message}`, { cause: error });
866
848
  }
867
849
  return {
868
850
  module: preset(resolvedOptions, module),
@@ -896,11 +878,10 @@ async function unrunCli(options, args = []) {
896
878
  try {
897
879
  cliResult = await execModule(moduleUrl, args);
898
880
  } catch (error) {
899
- throw new Error(`[unrun] Run failed (code length: ${output.chunk.code.length}): ${error.message}`);
881
+ throw new Error(`[unrun] Run failed (code length: ${output.chunk.code.length}): ${error.message}`, { cause: error });
900
882
  }
901
883
  cleanModule(moduleUrl, resolvedOptions);
902
884
  return cliResult;
903
885
  }
904
-
905
886
  //#endregion
906
- export { unrunCli as n, unrunSync as r, unrun as t };
887
+ export { unrunCli as n, unrunSync as r, unrun as t };
@@ -1,6 +1,5 @@
1
- import { t as unrun } from "../src-CS8hJStK.mjs";
1
+ import { t as unrun } from "../src-GU5PtktT.mjs";
2
2
  import { runAsWorker } from "synckit";
3
-
4
3
  //#region src/sync/worker.ts
5
4
  function cloneForTransfer(value, seen = /* @__PURE__ */ new WeakMap()) {
6
5
  if (typeof value === "function") throw new TypeError("[unrun] unrunSync cannot return functions");
@@ -45,6 +44,5 @@ runAsWorker(async (...args) => {
45
44
  const options = args[0];
46
45
  return cloneForTransfer(await unrun(options));
47
46
  });
48
-
49
47
  //#endregion
50
- export { };
48
+ export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "unrun",
3
3
  "type": "module",
4
- "version": "0.2.29",
4
+ "version": "0.2.31",
5
5
  "description": "A tool to load and execute any JavaScript or TypeScript code at runtime.",
6
6
  "author": "Augustin Mercier <gugustinette@proton.me>",
7
7
  "license": "MIT",
@@ -42,25 +42,25 @@
42
42
  }
43
43
  },
44
44
  "dependencies": {
45
- "rolldown": "1.0.0-rc.6"
45
+ "rolldown": "1.0.0-rc.8"
46
46
  },
47
47
  "devDependencies": {
48
- "@sxzz/eslint-config": "^7.7.2",
48
+ "@sxzz/eslint-config": "^7.8.3",
49
49
  "@sxzz/prettier-config": "^2.3.1",
50
- "@types/node": "^25.2.3",
51
- "@typescript/native-preview": "7.0.0-dev.20260204.1",
50
+ "@types/node": "^25.3.5",
51
+ "@typescript/native-preview": "7.0.0-dev.20260308.1",
52
52
  "@vitest/browser": "4.0.18",
53
53
  "@vitest/browser-playwright": "4.0.18",
54
54
  "@webcontainer/api": "^1.6.1",
55
- "acorn": "^8.15.0",
55
+ "acorn": "^8.16.0",
56
56
  "bumpp": "^10.4.1",
57
57
  "bundle-require": "^5.1.0",
58
- "config": "^4.3.0",
58
+ "config": "^4.4.1",
59
59
  "consola": "^3.4.2",
60
60
  "defu": "^6.1.4",
61
61
  "destr": "^2.0.5",
62
62
  "esbuild": "^0.27.3",
63
- "eslint": "^9.39.2",
63
+ "eslint": "^10.0.3",
64
64
  "estree-walker": "^3.0.3",
65
65
  "etag": "^1.8.1",
66
66
  "fast-glob": "^3.3.3",
@@ -71,8 +71,8 @@
71
71
  "moment-timezone": "^0.6.0",
72
72
  "nano-jsx": "^0.2.1",
73
73
  "playwright": "^1.58.2",
74
- "preact": "^10.28.3",
75
- "preact-render-to-string": "^6.6.5",
74
+ "preact": "^10.28.4",
75
+ "preact-render-to-string": "^6.6.6",
76
76
  "prettier": "^3.8.1",
77
77
  "react": "^19.2.4",
78
78
  "react-dom": "^19.2.4",
@@ -80,20 +80,20 @@
80
80
  "synckit": "^0.11.12",
81
81
  "test-ecosystem-ci": "^0.0.3",
82
82
  "tinyexec": "^1.0.2",
83
- "tsdown": "0.20.1",
83
+ "tsdown": "0.21.0",
84
84
  "tsx": "^4.21.0",
85
- "typedoc": "^0.28.16",
85
+ "typedoc": "^0.28.17",
86
86
  "typedoc-plugin-markdown": "^4.10.0",
87
87
  "typedoc-vitepress-theme": "^1.1.2",
88
88
  "typescript": "^5.9.3",
89
- "unconfig": "^7.4.2",
89
+ "unconfig": "^7.5.0",
90
90
  "unplugin-vue": "^7.1.1",
91
91
  "vite": "^7.3.1",
92
92
  "vitepress": "2.0.0-alpha.12",
93
93
  "vitepress-plugin-group-icons": "^1.7.1",
94
94
  "vitest": "4.0.18",
95
- "vue": "^3.5.28",
96
- "vue-tsc": "^3.2.4",
95
+ "vue": "^3.5.29",
96
+ "vue-tsc": "^3.2.5",
97
97
  "zod": "^4.3.6"
98
98
  },
99
99
  "prettier": "@sxzz/prettier-config",