unrun 0.2.3 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -10,7 +10,7 @@ interface Options {
10
10
  /**
11
11
  * Debug mode.
12
12
  * Wether or not to keep temporary files to help with debugging.
13
- * Temporary files are stored in `node_modules/.cache/unrun/` if possible,
13
+ * Temporary files are stored in `node_modules/.unrun/` if possible,
14
14
  * otherwise in the OS temporary directory.
15
15
  * @default false
16
16
  */
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { n as unrunCli, r as unrunSync, t as unrun } from "./src-Ci6YaVK-.mjs";
1
+ import { n as unrunCli, r as unrunSync, t as unrun } from "./src-Cy5isIwp.mjs";
2
2
 
3
3
  export { unrun, unrunCli, unrunSync };
@@ -1,6 +1,5 @@
1
1
  import { createRequire } from "node:module";
2
2
  import process from "node:process";
3
- import { createSyncFn } from "synckit";
4
3
  import path from "node:path";
5
4
  import fs, { existsSync } from "node:fs";
6
5
  import { fileURLToPath, pathToFileURL } from "node:url";
@@ -373,7 +372,7 @@ async function bundle(options) {
373
372
  const inputOptions = {
374
373
  input: options.path,
375
374
  platform: "node",
376
- external: (id) => !id.startsWith(".") && !id.startsWith("/") && !id.startsWith("#"),
375
+ external: (id) => !id.startsWith(".") && !path.isAbsolute(id) && !id.startsWith("#"),
377
376
  plugins: [
378
377
  createMakeCjsWrapperAsyncFriendlyPlugin(),
379
378
  createRequireResolveFix(options),
@@ -413,8 +412,10 @@ async function bundle(options) {
413
412
  * Clean the module file at the given URL.
414
413
  * Deletes the file if it exists.
415
414
  * @param moduleUrl - The URL of the module file to be cleaned.
415
+ * @param options - Resolved options.
416
416
  */
417
- function cleanModule(moduleUrl) {
417
+ function cleanModule(moduleUrl, options) {
418
+ if (options.debug) return;
418
419
  try {
419
420
  if (moduleUrl.startsWith("file://")) {
420
421
  const filePath = new URL(moduleUrl);
@@ -523,7 +524,7 @@ async function loadModule(code, options) {
523
524
  try {
524
525
  _module = await import(moduleUrl);
525
526
  } finally {
526
- cleanModule(moduleUrl);
527
+ cleanModule(moduleUrl, options);
527
528
  }
528
529
  return _module;
529
530
  }
@@ -555,6 +556,7 @@ async function unrun(options) {
555
556
  * @returns The loaded module.
556
557
  */
557
558
  function unrunSync(options) {
559
+ const { createSyncFn } = __require("synckit");
558
560
  return createSyncFn(__require.resolve("./sync/worker.mjs"), { tsRunner: "node" })(options);
559
561
  }
560
562
  /**
@@ -575,7 +577,7 @@ async function unrunCli(options, args = []) {
575
577
  } catch (error) {
576
578
  throw new Error(`[unrun] Run failed (code length: ${outputChunk.code.length}): ${error.message}`);
577
579
  }
578
- cleanModule(moduleUrl);
580
+ cleanModule(moduleUrl, resolvedOptions);
579
581
  return cliResult;
580
582
  }
581
583
 
@@ -1,4 +1,4 @@
1
- import { t as unrun } from "../src-Ci6YaVK-.mjs";
1
+ import { t as unrun } from "../src-Cy5isIwp.mjs";
2
2
  import { runAsWorker } from "synckit";
3
3
 
4
4
  //#region src/sync/worker.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unrun",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "A tool to load and execute any JavaScript or TypeScript code at runtime.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -30,24 +30,31 @@
30
30
  "publishConfig": {
31
31
  "access": "public"
32
32
  },
33
+ "peerDependencies": {
34
+ "synckit": "^0.11.11"
35
+ },
36
+ "peerDependenciesMeta": {
37
+ "synckit": {
38
+ "optional": true
39
+ }
40
+ },
33
41
  "dependencies": {
34
42
  "@oxc-project/runtime": "^0.96.0",
35
- "rolldown": "1.0.0-beta.47",
36
- "synckit": "^0.11.11"
43
+ "rolldown": "1.0.0-beta.47"
37
44
  },
38
45
  "devDependencies": {
39
- "@sxzz/eslint-config": "^7.1.4",
46
+ "@sxzz/eslint-config": "^7.2.8",
40
47
  "@sxzz/prettier-config": "^2.2.4",
41
- "@types/node": "^24.3.0",
48
+ "@types/node": "^24.10.0",
42
49
  "acorn": "^8.15.0",
43
- "bumpp": "^10.2.3",
50
+ "bumpp": "^10.3.1",
44
51
  "bundle-require": "^5.1.0",
45
52
  "config": "^4.1.1",
46
53
  "consola": "^3.4.2",
47
54
  "defu": "^6.1.4",
48
55
  "destr": "^2.0.5",
49
- "esbuild": "^0.25.10",
50
- "eslint": "^9.34.0",
56
+ "esbuild": "^0.25.12",
57
+ "eslint": "^9.39.1",
51
58
  "estree-walker": "^3.0.3",
52
59
  "etag": "^1.8.1",
53
60
  "fast-glob": "^3.3.3",
@@ -58,12 +65,13 @@
58
65
  "moment-timezone": "^0.6.0",
59
66
  "nano-jsx": "^0.2.0",
60
67
  "preact": "^10.27.2",
61
- "preact-render-to-string": "^6.6.1",
68
+ "preact-render-to-string": "^6.6.3",
62
69
  "prettier": "^3.6.2",
63
- "react": "^19.1.1",
64
- "react-dom": "^19.1.1",
70
+ "react": "^19.2.0",
71
+ "react-dom": "^19.2.0",
65
72
  "reflect-metadata": "^0.2.2",
66
- "tinyexec": "^1.0.1",
73
+ "synckit": "^0.11.11",
74
+ "tinyexec": "^1.0.2",
67
75
  "tsdown": "^0.16.0",
68
76
  "tsx": "^4.20.6",
69
77
  "typedoc": "^0.28.14",
@@ -71,12 +79,12 @@
71
79
  "typedoc-vitepress-theme": "^1.1.2",
72
80
  "typescript": "^5.9.3",
73
81
  "unconfig": "^7.3.3",
74
- "vite": "^7.1.7",
82
+ "vite": "^7.2.2",
75
83
  "vitepress": "2.0.0-alpha.12",
76
84
  "vitepress-plugin-group-icons": "^1.6.5",
77
- "vitest": "4.0.2",
78
- "vue": "^3.5.22",
79
- "zod": "^4.1.8"
85
+ "vitest": "4.0.8",
86
+ "vue": "^3.5.24",
87
+ "zod": "^4.1.12"
80
88
  },
81
89
  "engines": {
82
90
  "node": ">=20.19.0"
@@ -93,7 +101,7 @@
93
101
  "benchmark": "tsdown -c benchmark/tsdown.config.ts && node ./benchmark/dist/benchmark.mjs",
94
102
  "typecheck": "tsc --noEmit",
95
103
  "format": "prettier --cache --write .",
96
- "release": "bumpp && unotp pnpm publish",
104
+ "release": "bumpp",
97
105
  "docs:dev": "vitepress dev docs",
98
106
  "docs:build": "vitepress build docs",
99
107
  "docs:preview": "vitepress preview docs",