@antprofuse/veri-bubble 0.1.5 → 0.1.6

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/bin/vb ADDED
Binary file
package/bin/vb-runner ADDED
Binary file
package/bin/vb-runner.js CHANGED
@@ -1,24 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
-
4
3
  const { execFileSync } = require("child_process");
5
4
  const { resolveBinary } = require("../lib/resolve.js");
6
5
 
7
6
  const { binPath, pkgDir } = resolveBinary("vb-runner");
8
-
9
- // Set VB_HOME so vb can find mock binaries in lib/
10
- const env = Object.assign({}, process.env, {
11
- VB_HOME: pkgDir
12
- });
13
-
14
7
  try {
15
8
  execFileSync(binPath, process.argv.slice(2), {
16
9
  stdio: "inherit",
17
- env: env
10
+ env: { ...process.env, VB_HOME: pkgDir }
18
11
  });
19
12
  } catch (e) {
20
- if (e.status !== null) {
21
- process.exit(e.status);
22
- }
13
+ if (e.status != null) process.exit(e.status);
23
14
  throw e;
24
15
  }
16
+
package/bin/vb-scanner ADDED
Binary file
package/bin/vb-scanner.js CHANGED
@@ -1,24 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
-
4
3
  const { execFileSync } = require("child_process");
5
4
  const { resolveBinary } = require("../lib/resolve.js");
6
5
 
7
6
  const { binPath, pkgDir } = resolveBinary("vb-scanner");
8
-
9
- // Set VB_HOME so vb can find mock binaries in lib/
10
- const env = Object.assign({}, process.env, {
11
- VB_HOME: pkgDir
12
- });
13
-
14
7
  try {
15
8
  execFileSync(binPath, process.argv.slice(2), {
16
9
  stdio: "inherit",
17
- env: env
10
+ env: { ...process.env, VB_HOME: pkgDir }
18
11
  });
19
12
  } catch (e) {
20
- if (e.status !== null) {
21
- process.exit(e.status);
22
- }
13
+ if (e.status != null) process.exit(e.status);
23
14
  throw e;
24
15
  }
16
+
package/bin/vb.js CHANGED
@@ -1,24 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
-
4
3
  const { execFileSync } = require("child_process");
5
4
  const { resolveBinary } = require("../lib/resolve.js");
6
5
 
7
6
  const { binPath, pkgDir } = resolveBinary("vb");
8
-
9
- // Set VB_HOME so vb can find mock binaries in lib/
10
- const env = Object.assign({}, process.env, {
11
- VB_HOME: pkgDir
12
- });
13
-
14
7
  try {
15
8
  execFileSync(binPath, process.argv.slice(2), {
16
9
  stdio: "inherit",
17
- env: env
10
+ env: { ...process.env, VB_HOME: pkgDir }
18
11
  });
19
12
  } catch (e) {
20
- if (e.status !== null) {
21
- process.exit(e.status);
22
- }
13
+ if (e.status != null) process.exit(e.status);
23
14
  throw e;
24
15
  }
16
+
package/lib/resolve.js CHANGED
@@ -1,75 +1,25 @@
1
1
  "use strict";
2
2
 
3
3
  const path = require("path");
4
-
5
- const PLATFORM_MAP = {
6
- "linux-x64": "@antprofuse/vb-linux-x64-gnu"
7
- };
8
-
9
- function getPlatformPackage() {
10
- const key = `${process.platform}-${process.arch}`;
11
- const pkg = PLATFORM_MAP[key];
12
- if (!pkg) {
13
- throw new Error(
14
- `VeriBubble does not support ${process.platform}-${process.arch} yet.\n` +
15
- `Supported platforms: ${Object.keys(PLATFORM_MAP).join(", ")}`
16
- );
17
- }
18
- return pkg;
19
- }
4
+ const fs = require("fs");
20
5
 
21
6
  function resolveBinary(name) {
22
- const pkg = getPlatformPackage();
23
- let pkgDir;
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
- }
7
+ // All binaries are bundled in this package
8
+ const isMock = name.startsWith("vb-mock-");
9
+ const subdir = isMock ? "lib" : "bin";
10
+ const binPath = path.join(__dirname, "..", subdir, name);
58
11
 
59
- if (!pkgDir) {
12
+ if (!fs.existsSync(binPath)) {
60
13
  throw new Error(
61
- `Platform package ${pkg} is not installed.\n` +
62
- `Try: npm install @antprofuse/veri-bubble\n` +
63
- `(npm should auto-install the correct platform package)`
14
+ `Binary '${name}' not found at ${binPath}.\n` +
15
+ `Try reinstalling: npm install -g @antprofuse/veri-bubble`
64
16
  );
65
17
  }
66
18
 
67
- // Determine if binary is in bin/ or lib/
68
- const isMock = name.startsWith("vb-mock-");
69
- const subdir = isMock ? "lib" : "bin";
70
- const binPath = path.join(pkgDir, subdir, name);
71
-
19
+ // pkgDir is the package root (for VB_HOME)
20
+ const pkgDir = path.join(__dirname, "..");
72
21
  return { binPath, pkgDir };
73
22
  }
74
23
 
75
- module.exports = { resolveBinary, getPlatformPackage };
24
+ module.exports = { resolveBinary };
25
+
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,17 +1,16 @@
1
1
  {
2
2
  "name": "@antprofuse/veri-bubble",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "VeriBubble 🫧 - Black-box testing framework for Java applications with full network isolation and mock services",
5
5
  "license": "MIT",
6
+ "os": ["linux"],
7
+ "cpu": ["x64"],
6
8
  "bin": {
7
9
  "vb": "bin/vb.js",
8
10
  "vb-runner": "bin/vb-runner.js",
9
11
  "vb-scanner": "bin/vb-scanner.js"
10
12
  },
11
13
  "files": ["bin/", "lib/"],
12
- "optionalDependencies": {
13
- "@antprofuse/vb-linux-x64-gnu": "0.1.5"
14
- },
15
14
  "publishConfig": {
16
15
  "access": "public",
17
16
  "registry": "https://registry.npmjs.org/"
@@ -22,3 +21,4 @@
22
21
  "url": "https://github.com/antprofuse/veri-bubble"
23
22
  }
24
23
  }
24
+