unrun 0.2.12 → 0.2.14
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 +2 -1
- package/dist/index.mjs +1 -1
- package/dist/{src-BMOFH46e.mjs → src-BTV7EkfY.mjs} +20 -7
- package/dist/sync/worker.mjs +1 -1
- package/package.json +15 -9
package/dist/cli.mjs
CHANGED
|
@@ -84,11 +84,12 @@ async function runCLI() {
|
|
|
84
84
|
];
|
|
85
85
|
try {
|
|
86
86
|
const { unrunCli } = await import("./index.mjs");
|
|
87
|
-
await unrunCli({
|
|
87
|
+
const cliResult = await unrunCli({
|
|
88
88
|
path: parsedArguments.filePath,
|
|
89
89
|
debug: parsedArguments.debug,
|
|
90
90
|
preset: parsedArguments.preset
|
|
91
91
|
}, parsedArguments.afterArgs);
|
|
92
|
+
process.exit(cliResult.exitCode);
|
|
92
93
|
} catch (error) {
|
|
93
94
|
console.error(error.message);
|
|
94
95
|
process.exit(1);
|
package/dist/index.mjs
CHANGED
|
@@ -112,14 +112,17 @@ function isPathWithinDirectory(parent, child) {
|
|
|
112
112
|
*/
|
|
113
113
|
function createExternalResolver(options) {
|
|
114
114
|
const entryDir = path.dirname(options.path);
|
|
115
|
-
const entryRequire = createRequire(options.path);
|
|
116
115
|
const canResolveFromEntry = (specifier) => {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
return
|
|
116
|
+
const packageName = getPackageName(specifier);
|
|
117
|
+
if (!packageName) return false;
|
|
118
|
+
let currentDir = entryDir;
|
|
119
|
+
while (true) {
|
|
120
|
+
if (existsSync(path.join(currentDir, "node_modules", packageName))) return true;
|
|
121
|
+
const parentDir = path.dirname(currentDir);
|
|
122
|
+
if (parentDir === currentDir) break;
|
|
123
|
+
currentDir = parentDir;
|
|
122
124
|
}
|
|
125
|
+
return false;
|
|
123
126
|
};
|
|
124
127
|
return function external(id, importer) {
|
|
125
128
|
if (!id || id.startsWith("\0")) return false;
|
|
@@ -133,11 +136,21 @@ function createExternalResolver(options) {
|
|
|
133
136
|
const ownerInsideEntry = isPathWithinDirectory(entryDir, ownerDir);
|
|
134
137
|
const entryInsideOwner = isPathWithinDirectory(ownerDir, entryDir);
|
|
135
138
|
if (ownerInsideEntry && !entryInsideOwner) return false;
|
|
136
|
-
if (!canResolveFromEntry(id)) return false;
|
|
137
139
|
} catch {}
|
|
140
|
+
if (!canResolveFromEntry(id)) return false;
|
|
138
141
|
return true;
|
|
139
142
|
};
|
|
140
143
|
}
|
|
144
|
+
function getPackageName(specifier) {
|
|
145
|
+
if (!specifier) return void 0;
|
|
146
|
+
if (specifier.startsWith("@")) {
|
|
147
|
+
const segments = specifier.split("/");
|
|
148
|
+
if (segments.length >= 2) return `${segments[0]}/${segments[1]}`;
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
const [name] = specifier.split("/");
|
|
152
|
+
return name || void 0;
|
|
153
|
+
}
|
|
141
154
|
function findContainingNodeModules(filePath) {
|
|
142
155
|
let current = path.dirname(filePath);
|
|
143
156
|
const { root } = path.parse(current);
|
package/dist/sync/worker.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unrun",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.14",
|
|
4
4
|
"description": "A tool to load and execute any JavaScript or TypeScript code at runtime.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -44,10 +44,13 @@
|
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@sxzz/eslint-config": "^7.3.2",
|
|
47
|
-
"@sxzz/prettier-config": "^2.2.
|
|
47
|
+
"@sxzz/prettier-config": "^2.2.6",
|
|
48
48
|
"@types/node": "^24.10.1",
|
|
49
|
+
"@vitest/browser": "4.0.14",
|
|
50
|
+
"@vitest/browser-playwright": "^4.0.14",
|
|
51
|
+
"@webcontainer/api": "^1.6.1",
|
|
49
52
|
"acorn": "^8.15.0",
|
|
50
|
-
"bumpp": "^10.3.
|
|
53
|
+
"bumpp": "^10.3.2",
|
|
51
54
|
"bundle-require": "^5.1.0",
|
|
52
55
|
"config": "^4.1.1",
|
|
53
56
|
"consola": "^3.4.2",
|
|
@@ -64,16 +67,17 @@
|
|
|
64
67
|
"mime": "^4.1.0",
|
|
65
68
|
"moment-timezone": "^0.6.0",
|
|
66
69
|
"nano-jsx": "^0.2.1",
|
|
70
|
+
"playwright": "^1.57.0",
|
|
67
71
|
"preact": "^10.27.2",
|
|
68
72
|
"preact-render-to-string": "^6.6.3",
|
|
69
|
-
"prettier": "^3.
|
|
73
|
+
"prettier": "^3.7.1",
|
|
70
74
|
"react": "^19.2.0",
|
|
71
75
|
"react-dom": "^19.2.0",
|
|
72
76
|
"reflect-metadata": "^0.2.2",
|
|
73
77
|
"synckit": "^0.11.11",
|
|
74
78
|
"test-ecosystem-ci": "^0.0.1",
|
|
75
79
|
"tinyexec": "^1.0.2",
|
|
76
|
-
"tsdown": "^0.16.
|
|
80
|
+
"tsdown": "^0.16.8",
|
|
77
81
|
"tsx": "^4.20.6",
|
|
78
82
|
"typedoc": "^0.28.14",
|
|
79
83
|
"typedoc-plugin-markdown": "^4.9.0",
|
|
@@ -84,7 +88,7 @@
|
|
|
84
88
|
"vite": "^7.2.4",
|
|
85
89
|
"vitepress": "2.0.0-alpha.12",
|
|
86
90
|
"vitepress-plugin-group-icons": "^1.6.5",
|
|
87
|
-
"vitest": "4.0.
|
|
91
|
+
"vitest": "4.0.14",
|
|
88
92
|
"vue": "^3.5.25",
|
|
89
93
|
"vue-tsc": "^3.1.5",
|
|
90
94
|
"zod": "^4.1.13"
|
|
@@ -94,14 +98,16 @@
|
|
|
94
98
|
},
|
|
95
99
|
"prettier": "@sxzz/prettier-config",
|
|
96
100
|
"scripts": {
|
|
97
|
-
"lint": "eslint --cache .",
|
|
101
|
+
"lint": "eslint --no-cache .",
|
|
98
102
|
"lint:fix": "pnpm run lint --fix",
|
|
99
103
|
"build": "tsdown",
|
|
100
104
|
"dev": "tsdown --watch",
|
|
101
|
-
"pretest": "node ./scripts/manage-pnpm-override.mjs add",
|
|
105
|
+
"pretest": "pnpm run build && node ./scripts/manage-pnpm-override.mjs add",
|
|
102
106
|
"test": "vitest",
|
|
107
|
+
"pretest:browser": "pnpm run build",
|
|
108
|
+
"test:browser": "vitest run --browser --config vitest.browser.config.ts",
|
|
103
109
|
"posttest": "node ./scripts/manage-pnpm-override.mjs remove",
|
|
104
|
-
"pretest:run": "node ./scripts/manage-pnpm-override.mjs add",
|
|
110
|
+
"pretest:run": "pnpm run build && node ./scripts/manage-pnpm-override.mjs add",
|
|
105
111
|
"test:run": "vitest run",
|
|
106
112
|
"posttest:run": "node ./scripts/manage-pnpm-override.mjs remove",
|
|
107
113
|
"ecosystem-ci": "ecosystem-ci",
|