@quantracode/vibecheck 0.2.1 → 0.2.2
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.js +40 -24
- package/package.json +17 -18
package/dist/index.js
CHANGED
|
@@ -7905,7 +7905,7 @@ import { resolve as resolve2, join as join3 } from "path";
|
|
|
7905
7905
|
|
|
7906
7906
|
// src/utils/static-server.ts
|
|
7907
7907
|
import { createServer } from "http";
|
|
7908
|
-
import { existsSync, readFileSync as readFileSync2, statSync } from "fs";
|
|
7908
|
+
import { existsSync, readFileSync as readFileSync2, statSync, readdirSync } from "fs";
|
|
7909
7909
|
import { join, extname } from "path";
|
|
7910
7910
|
var MIME_TYPES = {
|
|
7911
7911
|
".html": "text/html; charset=utf-8",
|
|
@@ -7963,6 +7963,29 @@ function resolveFilePath(staticDir, urlPath) {
|
|
|
7963
7963
|
if (existsSync(filePath + ".html")) {
|
|
7964
7964
|
return filePath + ".html";
|
|
7965
7965
|
}
|
|
7966
|
+
const segments = decodedPath.split("/").filter(Boolean);
|
|
7967
|
+
if (segments.length >= 2) {
|
|
7968
|
+
const parentPath = segments.slice(0, -1).join("/");
|
|
7969
|
+
const parentDir = join(staticDir, parentPath);
|
|
7970
|
+
if (existsSync(parentDir) && statSync(parentDir).isDirectory()) {
|
|
7971
|
+
try {
|
|
7972
|
+
const files = readdirSync(parentDir);
|
|
7973
|
+
const htmlFile = files.find((f) => f.endsWith(".html"));
|
|
7974
|
+
if (htmlFile) {
|
|
7975
|
+
return join(parentDir, htmlFile);
|
|
7976
|
+
}
|
|
7977
|
+
} catch {
|
|
7978
|
+
}
|
|
7979
|
+
}
|
|
7980
|
+
const parentHtml = join(staticDir, parentPath + ".html");
|
|
7981
|
+
if (existsSync(parentHtml)) {
|
|
7982
|
+
return parentHtml;
|
|
7983
|
+
}
|
|
7984
|
+
const parentIndexHtml = join(staticDir, parentPath, "index.html");
|
|
7985
|
+
if (existsSync(parentIndexHtml)) {
|
|
7986
|
+
return parentIndexHtml;
|
|
7987
|
+
}
|
|
7988
|
+
}
|
|
7966
7989
|
const indexPath = join(staticDir, "index.html");
|
|
7967
7990
|
if (existsSync(indexPath)) {
|
|
7968
7991
|
return indexPath;
|
|
@@ -8182,32 +8205,25 @@ function clearViewerCache() {
|
|
|
8182
8205
|
}
|
|
8183
8206
|
|
|
8184
8207
|
// src/utils/open-browser.ts
|
|
8185
|
-
import { spawn } from "child_process";
|
|
8208
|
+
import { spawn, exec } from "child_process";
|
|
8186
8209
|
function openBrowser(url) {
|
|
8187
8210
|
const platform = process.platform;
|
|
8188
|
-
let command;
|
|
8189
|
-
let args;
|
|
8190
|
-
switch (platform) {
|
|
8191
|
-
case "win32":
|
|
8192
|
-
command = "cmd";
|
|
8193
|
-
args = ["/c", "start", "", url.replace(/&/g, "^&")];
|
|
8194
|
-
break;
|
|
8195
|
-
case "darwin":
|
|
8196
|
-
command = "open";
|
|
8197
|
-
args = [url];
|
|
8198
|
-
break;
|
|
8199
|
-
default:
|
|
8200
|
-
command = "xdg-open";
|
|
8201
|
-
args = [url];
|
|
8202
|
-
break;
|
|
8203
|
-
}
|
|
8204
8211
|
try {
|
|
8205
|
-
|
|
8206
|
-
|
|
8207
|
-
|
|
8208
|
-
|
|
8209
|
-
|
|
8210
|
-
|
|
8212
|
+
if (platform === "win32") {
|
|
8213
|
+
exec(`start "" "${url}"`);
|
|
8214
|
+
} else if (platform === "darwin") {
|
|
8215
|
+
const child = spawn("open", [url], {
|
|
8216
|
+
detached: true,
|
|
8217
|
+
stdio: "ignore"
|
|
8218
|
+
});
|
|
8219
|
+
child.unref();
|
|
8220
|
+
} else {
|
|
8221
|
+
const child = spawn("xdg-open", [url], {
|
|
8222
|
+
detached: true,
|
|
8223
|
+
stdio: "ignore"
|
|
8224
|
+
});
|
|
8225
|
+
child.unref();
|
|
8226
|
+
}
|
|
8211
8227
|
} catch {
|
|
8212
8228
|
console.log(`Could not automatically open browser.`);
|
|
8213
8229
|
console.log(`Please open ${url} manually.`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quantracode/vibecheck",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Security scanner for modern web applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -42,18 +42,6 @@
|
|
|
42
42
|
"engines": {
|
|
43
43
|
"node": ">=18.0.0"
|
|
44
44
|
},
|
|
45
|
-
"scripts": {
|
|
46
|
-
"build": "tsup",
|
|
47
|
-
"build:tsc": "tsc -p tsconfig.build.json",
|
|
48
|
-
"typecheck": "tsc --noEmit",
|
|
49
|
-
"dev": "tsup --watch",
|
|
50
|
-
"test": "vitest run",
|
|
51
|
-
"test:watch": "vitest",
|
|
52
|
-
"vibecheck": "node ./dist/index.js",
|
|
53
|
-
"smoke": "node scripts/smoke-test.mjs",
|
|
54
|
-
"pack:check": "node scripts/pack-check.mjs",
|
|
55
|
-
"prepublishOnly": "pnpm run build && pnpm run pack:check"
|
|
56
|
-
},
|
|
57
45
|
"dependencies": {
|
|
58
46
|
"chalk": "^5.4.1",
|
|
59
47
|
"commander": "^12.1.0",
|
|
@@ -64,13 +52,24 @@
|
|
|
64
52
|
"zod": "^3.24.1"
|
|
65
53
|
},
|
|
66
54
|
"devDependencies": {
|
|
67
|
-
"@vibecheck/license": "workspace:*",
|
|
68
55
|
"@types/micromatch": "^4.0.9",
|
|
69
56
|
"@types/node": "^22.10.2",
|
|
70
57
|
"@types/tar": "^6.1.13",
|
|
71
|
-
"@vibecheck/policy": "workspace:*",
|
|
72
|
-
"@vibecheck/schema": "workspace:*",
|
|
73
58
|
"tsup": "^8.5.1",
|
|
74
|
-
"vitest": "^2.1.8"
|
|
59
|
+
"vitest": "^2.1.8",
|
|
60
|
+
"@vibecheck/license": "0.0.1",
|
|
61
|
+
"@vibecheck/policy": "0.0.1",
|
|
62
|
+
"@vibecheck/schema": "0.0.1"
|
|
63
|
+
},
|
|
64
|
+
"scripts": {
|
|
65
|
+
"build": "tsup",
|
|
66
|
+
"build:tsc": "tsc -p tsconfig.build.json",
|
|
67
|
+
"typecheck": "tsc --noEmit",
|
|
68
|
+
"dev": "tsup --watch",
|
|
69
|
+
"test": "vitest run",
|
|
70
|
+
"test:watch": "vitest",
|
|
71
|
+
"vibecheck": "node ./dist/index.js",
|
|
72
|
+
"smoke": "node scripts/smoke-test.mjs",
|
|
73
|
+
"pack:check": "node scripts/pack-check.mjs"
|
|
75
74
|
}
|
|
76
|
-
}
|
|
75
|
+
}
|