@adunne09/waldo 0.0.0-dev-202603160010 → 0.0.0-dev-202603160229

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.
Files changed (2) hide show
  1. package/bin/waldo +33 -0
  2. package/package.json +6 -6
package/bin/waldo CHANGED
@@ -6,8 +6,41 @@ import os from "node:os";
6
6
  import path from "node:path";
7
7
  import { fileURLToPath } from "node:url";
8
8
 
9
+ function findNodeModulesRoot(target) {
10
+ let current = path.dirname(target);
11
+
12
+ for (;;) {
13
+ if (path.basename(current) === "node_modules") {
14
+ return current;
15
+ }
16
+
17
+ const parent = path.dirname(current);
18
+ if (parent === current) {
19
+ return undefined;
20
+ }
21
+
22
+ current = parent;
23
+ }
24
+ }
25
+
26
+ function createRuntimeEnv(target) {
27
+ const nodeModulesRoot = findNodeModulesRoot(target);
28
+ if (!nodeModulesRoot) {
29
+ return process.env;
30
+ }
31
+
32
+ const existingNodePath = process.env.NODE_PATH;
33
+ return {
34
+ ...process.env,
35
+ NODE_PATH: existingNodePath
36
+ ? `${nodeModulesRoot}${path.delimiter}${existingNodePath}`
37
+ : nodeModulesRoot,
38
+ };
39
+ }
40
+
9
41
  function run(target) {
10
42
  const result = childProcess.spawnSync(target, process.argv.slice(2), {
43
+ env: createRuntimeEnv(target),
11
44
  stdio: "inherit",
12
45
  });
13
46
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adunne09/waldo",
3
- "version": "0.0.0-dev-202603160010",
3
+ "version": "0.0.0-dev-202603160229",
4
4
  "waldoReleaseTag": "dev",
5
5
  "type": "module",
6
6
  "bin": {
@@ -13,10 +13,10 @@
13
13
  "postinstall": "bun ./postinstall.mjs || node ./postinstall.mjs"
14
14
  },
15
15
  "optionalDependencies": {
16
- "@adunne09/waldo-darwin-arm64": "0.0.0-dev-202603160010",
17
- "@adunne09/waldo-darwin-x64": "0.0.0-dev-202603160010",
18
- "@adunne09/waldo-linux-arm64": "0.0.0-dev-202603160010",
19
- "@adunne09/waldo-linux-x64": "0.0.0-dev-202603160010",
20
- "@adunne09/waldo-windows-x64": "0.0.0-dev-202603160010"
16
+ "@adunne09/waldo-darwin-arm64": "0.0.0-dev-202603160229",
17
+ "@adunne09/waldo-darwin-x64": "0.0.0-dev-202603160229",
18
+ "@adunne09/waldo-linux-arm64": "0.0.0-dev-202603160229",
19
+ "@adunne09/waldo-linux-x64": "0.0.0-dev-202603160229",
20
+ "@adunne09/waldo-windows-x64": "0.0.0-dev-202603160229"
21
21
  }
22
22
  }