@antprofuse/veri-bubble 0.1.1 → 0.1.3
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/lib/resolve.js +36 -4
- package/package.json +2 -2
package/lib/resolve.js
CHANGED
|
@@ -21,10 +21,42 @@ function getPlatformPackage() {
|
|
|
21
21
|
function resolveBinary(name) {
|
|
22
22
|
const pkg = getPlatformPackage();
|
|
23
23
|
let pkgDir;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
|
|
25
|
+
// Try multiple strategies to find the platform package
|
|
26
|
+
// Strategy 1: require.resolve (works for local node_modules)
|
|
27
|
+
// Strategy 2: sibling directory (works for global install)
|
|
28
|
+
// Strategy 3: require.resolve with explicit paths
|
|
29
|
+
const fs = require("fs");
|
|
30
|
+
const strategies = [
|
|
31
|
+
// Strategy 1: normal require.resolve
|
|
32
|
+
() => path.dirname(require.resolve(`${pkg}/package.json`)),
|
|
33
|
+
// Strategy 2: sibling in global node_modules (e.g. /usr/local/lib/node_modules/@antprofuse/vb-linux-x64-gnu)
|
|
34
|
+
() => {
|
|
35
|
+
const candidate = path.resolve(__dirname, "..", "..", pkg.replace(/^@/, "").replace("/", path.sep));
|
|
36
|
+
// __dirname is .../node_modules/@antprofuse/veri-bubble/lib
|
|
37
|
+
// go up to node_modules, then into @antprofuse/vb-linux-x64-gnu
|
|
38
|
+
const candidate2 = path.resolve(__dirname, "..", "..", "..", pkg.split("/")[0], pkg.split("/")[1]);
|
|
39
|
+
if (fs.existsSync(path.join(candidate2, "package.json"))) return candidate2;
|
|
40
|
+
if (fs.existsSync(path.join(candidate, "package.json"))) return candidate;
|
|
41
|
+
throw new Error("not found");
|
|
42
|
+
},
|
|
43
|
+
// Strategy 3: require.resolve with global paths
|
|
44
|
+
() => {
|
|
45
|
+
const globalRoot = path.resolve(__dirname, "..", "..", "..");
|
|
46
|
+
return path.dirname(require.resolve(`${pkg}/package.json`, { paths: [globalRoot] }));
|
|
47
|
+
}
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
for (const strategy of strategies) {
|
|
51
|
+
try {
|
|
52
|
+
pkgDir = strategy();
|
|
53
|
+
if (pkgDir && fs.existsSync(path.join(pkgDir, "package.json"))) break;
|
|
54
|
+
} catch (e) {
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (!pkgDir) {
|
|
28
60
|
throw new Error(
|
|
29
61
|
`Platform package ${pkg} is not installed.\n` +
|
|
30
62
|
`Try: npm install @antprofuse/veri-bubble\n` +
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antprofuse/veri-bubble",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "VeriBubble 🫧 - Black-box testing framework for Java applications with full network isolation and mock services",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
},
|
|
11
11
|
"files": ["bin/", "lib/"],
|
|
12
12
|
"optionalDependencies": {
|
|
13
|
-
"@antprofuse/vb-linux-x64-gnu": "0.1.
|
|
13
|
+
"@antprofuse/vb-linux-x64-gnu": "0.1.3"
|
|
14
14
|
},
|
|
15
15
|
"publishConfig": {
|
|
16
16
|
"access": "public",
|