unrun 0.2.2 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -83,7 +83,7 @@ async function runCLI() {
83
83
  ...parsedArguments.afterArgs
84
84
  ];
85
85
  try {
86
- const { unrunCli } = await import("./index.js");
86
+ const { unrunCli } = await import("./index.mjs");
87
87
  await unrunCli({
88
88
  path: parsedArguments.filePath,
89
89
  debug: parsedArguments.debug,
@@ -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
  */
@@ -1,3 +1,3 @@
1
- import { n as unrunCli, r as unrunSync, t as unrun } from "./src-CRcGnzTd.js";
1
+ import { n as unrunCli, r as unrunSync, t as unrun } from "./src-en4IVaeD.mjs";
2
2
 
3
3
  export { unrun, unrunCli, unrunSync };
@@ -373,7 +373,7 @@ async function bundle(options) {
373
373
  const inputOptions = {
374
374
  input: options.path,
375
375
  platform: "node",
376
- external: (id) => !id.startsWith(".") && !id.startsWith("/") && !id.startsWith("#"),
376
+ external: (id) => !id.startsWith(".") && !path.isAbsolute(id) && !id.startsWith("#"),
377
377
  plugins: [
378
378
  createMakeCjsWrapperAsyncFriendlyPlugin(),
379
379
  createRequireResolveFix(options),
@@ -413,8 +413,10 @@ async function bundle(options) {
413
413
  * Clean the module file at the given URL.
414
414
  * Deletes the file if it exists.
415
415
  * @param moduleUrl - The URL of the module file to be cleaned.
416
+ * @param options - Resolved options.
416
417
  */
417
- function cleanModule(moduleUrl) {
418
+ function cleanModule(moduleUrl, options) {
419
+ if (options.debug) return;
418
420
  try {
419
421
  if (moduleUrl.startsWith("file://")) {
420
422
  const filePath = new URL(moduleUrl);
@@ -523,7 +525,7 @@ async function loadModule(code, options) {
523
525
  try {
524
526
  _module = await import(moduleUrl);
525
527
  } finally {
526
- cleanModule(moduleUrl);
528
+ cleanModule(moduleUrl, options);
527
529
  }
528
530
  return _module;
529
531
  }
@@ -555,7 +557,7 @@ async function unrun(options) {
555
557
  * @returns The loaded module.
556
558
  */
557
559
  function unrunSync(options) {
558
- return createSyncFn(__require.resolve("./sync/worker"), { tsRunner: "node" })(options);
560
+ return createSyncFn(__require.resolve("./sync/worker.mjs"), { tsRunner: "node" })(options);
559
561
  }
560
562
  /**
561
563
  * Runs a given module with JIT transpilation based on the provided options.
@@ -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-CRcGnzTd.js";
1
+ import { t as unrun } from "../src-en4IVaeD.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.2",
3
+ "version": "0.2.4",
4
4
  "description": "A tool to load and execute any JavaScript or TypeScript code at runtime.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -17,22 +17,22 @@
17
17
  "files": [
18
18
  "dist"
19
19
  ],
20
- "main": "./dist/index.js",
21
- "module": "./dist/index.js",
22
- "types": "./dist/index.d.ts",
20
+ "main": "./dist/index.mjs",
21
+ "module": "./dist/index.mjs",
22
+ "types": "./dist/index.d.mts",
23
23
  "exports": {
24
- ".": "./dist/index.js",
24
+ ".": "./dist/index.mjs",
25
25
  "./package.json": "./package.json"
26
26
  },
27
27
  "bin": {
28
- "unrun": "./dist/cli.js"
28
+ "unrun": "./dist/cli.mjs"
29
29
  },
30
30
  "publishConfig": {
31
31
  "access": "public"
32
32
  },
33
33
  "dependencies": {
34
- "@oxc-project/runtime": "^0.95.0",
35
- "rolldown": "1.0.0-beta.46",
34
+ "@oxc-project/runtime": "^0.96.0",
35
+ "rolldown": "1.0.0-beta.47",
36
36
  "synckit": "^0.11.11"
37
37
  },
38
38
  "devDependencies": {
@@ -64,7 +64,7 @@
64
64
  "react-dom": "^19.1.1",
65
65
  "reflect-metadata": "^0.2.2",
66
66
  "tinyexec": "^1.0.1",
67
- "tsdown": "^0.15.9",
67
+ "tsdown": "^0.16.0",
68
68
  "tsx": "^4.20.6",
69
69
  "typedoc": "^0.28.14",
70
70
  "typedoc-plugin-markdown": "^4.9.0",
@@ -89,14 +89,14 @@
89
89
  "dev": "tsdown --watch",
90
90
  "test": "vitest",
91
91
  "test:run": "vitest run",
92
- "test:update-fixtures": "node ./dist/cli.js ./scripts/update-fixtures.ts",
93
- "benchmark": "tsdown -c benchmark/tsdown.config.ts && node ./benchmark/dist/benchmark.js",
92
+ "test:update-fixtures": "node ./dist/cli.mjs ./scripts/update-fixtures.ts",
93
+ "benchmark": "tsdown -c benchmark/tsdown.config.ts && node ./benchmark/dist/benchmark.mjs",
94
94
  "typecheck": "tsc --noEmit",
95
95
  "format": "prettier --cache --write .",
96
96
  "release": "bumpp && unotp pnpm publish",
97
97
  "docs:dev": "vitepress dev docs",
98
98
  "docs:build": "vitepress build docs",
99
99
  "docs:preview": "vitepress preview docs",
100
- "docs:generate-reference": "node ./dist/cli.js ./docs/.vitepress/scripts/generate-reference.ts"
100
+ "docs:generate-reference": "node ./dist/cli.mjs ./docs/.vitepress/scripts/generate-reference.ts"
101
101
  }
102
102
  }
File without changes
File without changes