unrun 0.2.15 → 0.2.17
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/README.md +14 -10
- package/dist/index.mjs +1 -1
- package/dist/{src-Cy584dFT.mjs → src-cjoQe9CR.mjs} +38 -0
- package/dist/sync/worker.mjs +1 -1
- package/package.json +36 -35
package/README.md
CHANGED
|
@@ -4,13 +4,9 @@
|
|
|
4
4
|
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
5
5
|
[![Unit Test][unit-test-src]][unit-test-href]
|
|
6
6
|
|
|
7
|
-
unrun is a tool that enables running any module at runtime (TypeScript, ESM, CJS, JSX, etc.) by bundling it with [Rolldown](https://rolldown.rs/).
|
|
7
|
+
unrun is a tool that enables running and loading any module at runtime (TypeScript, ESM, CJS, JSX, etc.) by bundling it with [Rolldown](https://rolldown.rs/).
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
- [jiti](https://github.com/unjs/jiti)
|
|
12
|
-
- [bundle-require](https://github.com/egoist/bundle-require)
|
|
13
|
-
- [tsx](https://tsx.is/)
|
|
9
|
+
Check the [documentation](https://gugustinette.github.io/unrun/) for more details.
|
|
14
10
|
|
|
15
11
|
## Install
|
|
16
12
|
|
|
@@ -20,6 +16,12 @@ npm i unrun
|
|
|
20
16
|
|
|
21
17
|
## Usage
|
|
22
18
|
|
|
19
|
+
### CLI
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npx unrun ./path/to/file.ts
|
|
23
|
+
```
|
|
24
|
+
|
|
23
25
|
### Programmatic API
|
|
24
26
|
|
|
25
27
|
- Async
|
|
@@ -42,11 +44,13 @@ const { module } = unrunSync({
|
|
|
42
44
|
})
|
|
43
45
|
```
|
|
44
46
|
|
|
45
|
-
|
|
47
|
+
## Credits
|
|
46
48
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
`unrun` is highly inspired by tools like :
|
|
50
|
+
|
|
51
|
+
- [jiti](https://github.com/unjs/jiti)
|
|
52
|
+
- [bundle-require](https://github.com/egoist/bundle-require)
|
|
53
|
+
- [tsx](https://tsx.is/)
|
|
50
54
|
|
|
51
55
|
<!-- Badges -->
|
|
52
56
|
|
package/dist/index.mjs
CHANGED
|
@@ -614,10 +614,48 @@ function execModule(moduleUrl, args = []) {
|
|
|
614
614
|
"inherit",
|
|
615
615
|
"inherit"
|
|
616
616
|
] });
|
|
617
|
+
const lifecycleSignals = [
|
|
618
|
+
"SIGINT",
|
|
619
|
+
"SIGTERM",
|
|
620
|
+
"SIGQUIT"
|
|
621
|
+
];
|
|
622
|
+
const signalListeners = /* @__PURE__ */ new Map();
|
|
623
|
+
let exitListener;
|
|
624
|
+
const cleanupChildProcess = (signal) => {
|
|
625
|
+
if (childProcess.killed || childProcess.exitCode !== null) return;
|
|
626
|
+
try {
|
|
627
|
+
childProcess.kill(signal);
|
|
628
|
+
} catch {}
|
|
629
|
+
};
|
|
630
|
+
const removeLifecycleListeners = () => {
|
|
631
|
+
if (exitListener) {
|
|
632
|
+
process.removeListener("exit", exitListener);
|
|
633
|
+
exitListener = void 0;
|
|
634
|
+
}
|
|
635
|
+
for (const [signal, listener] of signalListeners) process.removeListener(signal, listener);
|
|
636
|
+
signalListeners.clear();
|
|
637
|
+
};
|
|
638
|
+
exitListener = () => {
|
|
639
|
+
cleanupChildProcess();
|
|
640
|
+
};
|
|
641
|
+
process.on("exit", exitListener);
|
|
642
|
+
for (const signal of lifecycleSignals) {
|
|
643
|
+
const listener = () => {
|
|
644
|
+
cleanupChildProcess(signal);
|
|
645
|
+
removeLifecycleListeners();
|
|
646
|
+
process.nextTick(() => {
|
|
647
|
+
process.kill(process.pid, signal);
|
|
648
|
+
});
|
|
649
|
+
};
|
|
650
|
+
signalListeners.set(signal, listener);
|
|
651
|
+
process.on(signal, listener);
|
|
652
|
+
}
|
|
617
653
|
childProcess.on("close", (exitCode) => {
|
|
654
|
+
removeLifecycleListeners();
|
|
618
655
|
resolve({ exitCode: exitCode ?? 0 });
|
|
619
656
|
});
|
|
620
657
|
childProcess.on("error", (error) => {
|
|
658
|
+
removeLifecycleListeners();
|
|
621
659
|
reject(/* @__PURE__ */ new Error(`[unrun]: Failed to start child process: ${error.message}`));
|
|
622
660
|
});
|
|
623
661
|
});
|
package/dist/sync/worker.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,35 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unrun",
|
|
3
|
-
"version": "0.2.15",
|
|
4
|
-
"description": "A tool to load and execute any JavaScript or TypeScript code at runtime.",
|
|
5
3
|
"type": "module",
|
|
4
|
+
"version": "0.2.17",
|
|
5
|
+
"description": "A tool to load and execute any JavaScript or TypeScript code at runtime.",
|
|
6
|
+
"author": "Augustin Mercier <gugustinette@proton.me>",
|
|
6
7
|
"license": "MIT",
|
|
8
|
+
"funding": "https://github.com/sponsors/Gugustinette",
|
|
7
9
|
"homepage": "https://gugustinette.github.io/unrun/",
|
|
8
|
-
"bugs": {
|
|
9
|
-
"url": "https://github.com/Gugustinette/unrun/issues"
|
|
10
|
-
},
|
|
11
10
|
"repository": {
|
|
12
11
|
"type": "git",
|
|
13
12
|
"url": "git+https://github.com/Gugustinette/unrun.git"
|
|
14
13
|
},
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"dist"
|
|
19
|
-
],
|
|
20
|
-
"main": "./dist/index.mjs",
|
|
21
|
-
"module": "./dist/index.mjs",
|
|
22
|
-
"types": "./dist/index.d.mts",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/Gugustinette/unrun/issues"
|
|
16
|
+
},
|
|
23
17
|
"exports": {
|
|
24
18
|
".": "./dist/index.mjs",
|
|
25
19
|
"./package.json": "./package.json"
|
|
26
20
|
},
|
|
21
|
+
"main": "./dist/index.mjs",
|
|
22
|
+
"module": "./dist/index.mjs",
|
|
23
|
+
"types": "./dist/index.d.mts",
|
|
27
24
|
"bin": {
|
|
28
25
|
"unrun": "./dist/cli.mjs"
|
|
29
26
|
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist"
|
|
29
|
+
],
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"access": "public"
|
|
32
32
|
},
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=20.19.0"
|
|
35
|
+
},
|
|
33
36
|
"peerDependencies": {
|
|
34
37
|
"synckit": "^0.11.11"
|
|
35
38
|
},
|
|
@@ -39,15 +42,16 @@
|
|
|
39
42
|
}
|
|
40
43
|
},
|
|
41
44
|
"dependencies": {
|
|
42
|
-
"@oxc-project/runtime": "^0.
|
|
43
|
-
"rolldown": "1.0.0-beta.
|
|
45
|
+
"@oxc-project/runtime": "^0.101.0",
|
|
46
|
+
"rolldown": "1.0.0-beta.53"
|
|
44
47
|
},
|
|
45
48
|
"devDependencies": {
|
|
46
|
-
"@sxzz/eslint-config": "^7.
|
|
49
|
+
"@sxzz/eslint-config": "^7.4.1",
|
|
47
50
|
"@sxzz/prettier-config": "^2.2.6",
|
|
48
51
|
"@types/node": "^24.10.1",
|
|
49
|
-
"@
|
|
50
|
-
"@vitest/browser
|
|
52
|
+
"@typescript/native-preview": "7.0.0-dev.20251203.1",
|
|
53
|
+
"@vitest/browser": "4.0.15",
|
|
54
|
+
"@vitest/browser-playwright": "^4.0.15",
|
|
51
55
|
"@webcontainer/api": "^1.6.1",
|
|
52
56
|
"acorn": "^8.15.0",
|
|
53
57
|
"bumpp": "^10.3.2",
|
|
@@ -56,7 +60,7 @@
|
|
|
56
60
|
"consola": "^3.4.2",
|
|
57
61
|
"defu": "^6.1.4",
|
|
58
62
|
"destr": "^2.0.5",
|
|
59
|
-
"esbuild": "^0.
|
|
63
|
+
"esbuild": "^0.27.1",
|
|
60
64
|
"eslint": "^9.39.1",
|
|
61
65
|
"estree-walker": "^3.0.3",
|
|
62
66
|
"etag": "^1.8.1",
|
|
@@ -68,34 +72,31 @@
|
|
|
68
72
|
"moment-timezone": "^0.6.0",
|
|
69
73
|
"nano-jsx": "^0.2.1",
|
|
70
74
|
"playwright": "^1.57.0",
|
|
71
|
-
"preact": "^10.
|
|
75
|
+
"preact": "^10.28.0",
|
|
72
76
|
"preact-render-to-string": "^6.6.3",
|
|
73
|
-
"prettier": "^3.7.
|
|
74
|
-
"react": "^19.2.
|
|
75
|
-
"react-dom": "^19.2.
|
|
77
|
+
"prettier": "^3.7.4",
|
|
78
|
+
"react": "^19.2.1",
|
|
79
|
+
"react-dom": "^19.2.1",
|
|
76
80
|
"reflect-metadata": "^0.2.2",
|
|
77
81
|
"synckit": "^0.11.11",
|
|
78
|
-
"test-ecosystem-ci": "^0.0.
|
|
82
|
+
"test-ecosystem-ci": "^0.0.2",
|
|
79
83
|
"tinyexec": "^1.0.2",
|
|
80
|
-
"tsdown": "^0.
|
|
81
|
-
"tsx": "^4.
|
|
82
|
-
"typedoc": "^0.28.
|
|
84
|
+
"tsdown": "^0.17.0",
|
|
85
|
+
"tsx": "^4.21.0",
|
|
86
|
+
"typedoc": "^0.28.15",
|
|
83
87
|
"typedoc-plugin-markdown": "^4.9.0",
|
|
84
88
|
"typedoc-vitepress-theme": "^1.1.2",
|
|
85
89
|
"typescript": "^5.9.3",
|
|
86
|
-
"unconfig": "^7.4.
|
|
87
|
-
"unplugin-vue": "^7.0
|
|
88
|
-
"vite": "^7.2.
|
|
90
|
+
"unconfig": "^7.4.2",
|
|
91
|
+
"unplugin-vue": "^7.1.0",
|
|
92
|
+
"vite": "^7.2.6",
|
|
89
93
|
"vitepress": "2.0.0-alpha.12",
|
|
90
94
|
"vitepress-plugin-group-icons": "^1.6.5",
|
|
91
|
-
"vitest": "4.0.
|
|
95
|
+
"vitest": "4.0.15",
|
|
92
96
|
"vue": "^3.5.25",
|
|
93
97
|
"vue-tsc": "^3.1.5",
|
|
94
98
|
"zod": "^4.1.13"
|
|
95
99
|
},
|
|
96
|
-
"engines": {
|
|
97
|
-
"node": ">=20.19.0"
|
|
98
|
-
},
|
|
99
100
|
"prettier": "@sxzz/prettier-config",
|
|
100
101
|
"scripts": {
|
|
101
102
|
"lint": "eslint --no-cache .",
|
|
@@ -114,7 +115,7 @@
|
|
|
114
115
|
"ecosystem-ci:force": "ecosystem-ci --force",
|
|
115
116
|
"test:update-fixtures": "node ./dist/cli.mjs ./scripts/update-fixtures.ts",
|
|
116
117
|
"benchmark": "tsdown -c benchmark/tsdown.config.ts && node ./benchmark/dist/benchmark.mjs",
|
|
117
|
-
"typecheck": "
|
|
118
|
+
"typecheck": "tsgo --noEmit",
|
|
118
119
|
"format": "prettier --cache --write .",
|
|
119
120
|
"release": "bumpp",
|
|
120
121
|
"docs:dev": "vitepress dev docs",
|