@pnpm/exe 12.6.0 → 12.7.0

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.
@@ -31,14 +31,19 @@ msys=""
31
31
 
32
32
  case `command -p uname -a` in
33
33
  *CYGWIN*|*MINGW*|*MSYS*)
34
- if command -v cygpath > /dev/null 2>&1; then
34
+ if converted=$(command -p cygpath -w "$basedir" 2>/dev/null) && [ -n "$converted" ]; then
35
+ basedir_win="$converted"
36
+ elif command -v cygpath > /dev/null 2>&1; then
35
37
  basedir_win=`cygpath -w "$basedir"`
36
38
  fi
37
39
  exe=".exe"
38
40
  msys="true"
39
41
  ;;
40
42
  *WSL2*)
41
- if command -v wslpath > /dev/null 2>&1; then
43
+ if converted=$(command -p wslpath -w "$basedir" 2>/dev/null) && [ -n "$converted" ]; then
44
+ basedir_win="$converted"
45
+ exe=".exe"
46
+ elif command -v wslpath > /dev/null 2>&1; then
42
47
  basedir_win="$(wslpath -w "$basedir" 2> /dev/null)"
43
48
  if [ $? -ne 0 ] || [ -z "$basedir_win" ]; then
44
49
  basedir_win="$basedir"
@@ -49,15 +54,16 @@ case `command -p uname -a` in
49
54
  ;;
50
55
  esac
51
56
 
57
+ basedir_abs=$(CDPATH= cd -P -- "$basedir" && pwd -P) || exit $?
52
58
  if [ -n "$exe" ] && [ -x "$basedir/node.exe" ]; then
53
59
  exec "$basedir/node.exe" "$basedir_win/../get-pnpm/bin/get-pnpm.js" "$@"
54
60
  elif [ -x "$basedir/node" ]; then
55
- exec "$basedir/node" "$basedir/../get-pnpm/bin/get-pnpm.js" "$@"
61
+ exec "$basedir/node" "$basedir_abs/../get-pnpm/bin/get-pnpm.js" "$@"
56
62
  elif command -v node >/dev/null 2>&1; then
57
- exec node "$basedir/../get-pnpm/bin/get-pnpm.js" "$@"
63
+ exec node "$basedir_abs/../get-pnpm/bin/get-pnpm.js" "$@"
58
64
  elif [ -n "$exe" ] && command -v node.exe >/dev/null 2>&1; then
59
65
  exec node.exe "$basedir_win/../get-pnpm/bin/get-pnpm.js" "$@"
60
66
  else
61
- exec node "$basedir/../get-pnpm/bin/get-pnpm.js" "$@"
67
+ exec node "$basedir_abs/../get-pnpm/bin/get-pnpm.js" "$@"
62
68
  fi
63
- # cmd-shim-target=/home/runner/_work/pnpm/pnpm/pnpm/npm/pnpm/temp-deploy/node_modules/get-pnpm/bin/get-pnpm.js
69
+ # cmd-shim-target=../get-pnpm/bin/get-pnpm.js
@@ -31,14 +31,19 @@ msys=""
31
31
 
32
32
  case `command -p uname -a` in
33
33
  *CYGWIN*|*MINGW*|*MSYS*)
34
- if command -v cygpath > /dev/null 2>&1; then
34
+ if converted=$(command -p cygpath -w "$basedir" 2>/dev/null) && [ -n "$converted" ]; then
35
+ basedir_win="$converted"
36
+ elif command -v cygpath > /dev/null 2>&1; then
35
37
  basedir_win=`cygpath -w "$basedir"`
36
38
  fi
37
39
  exe=".exe"
38
40
  msys="true"
39
41
  ;;
40
42
  *WSL2*)
41
- if command -v wslpath > /dev/null 2>&1; then
43
+ if converted=$(command -p wslpath -w "$basedir" 2>/dev/null) && [ -n "$converted" ]; then
44
+ basedir_win="$converted"
45
+ exe=".exe"
46
+ elif command -v wslpath > /dev/null 2>&1; then
42
47
  basedir_win="$(wslpath -w "$basedir" 2> /dev/null)"
43
48
  if [ $? -ne 0 ] || [ -z "$basedir_win" ]; then
44
49
  basedir_win="$basedir"
@@ -49,15 +54,16 @@ case `command -p uname -a` in
49
54
  ;;
50
55
  esac
51
56
 
57
+ basedir_abs=$(CDPATH= cd -P -- "$basedir" && pwd -P) || exit $?
52
58
  if [ -n "$exe" ] && [ -x "$basedir/node.exe" ]; then
53
59
  exec "$basedir/node.exe" "$basedir_win/../node-gyp/bin/node-gyp.js" "$@"
54
60
  elif [ -x "$basedir/node" ]; then
55
- exec "$basedir/node" "$basedir/../node-gyp/bin/node-gyp.js" "$@"
61
+ exec "$basedir/node" "$basedir_abs/../node-gyp/bin/node-gyp.js" "$@"
56
62
  elif command -v node >/dev/null 2>&1; then
57
- exec node "$basedir/../node-gyp/bin/node-gyp.js" "$@"
63
+ exec node "$basedir_abs/../node-gyp/bin/node-gyp.js" "$@"
58
64
  elif [ -n "$exe" ] && command -v node.exe >/dev/null 2>&1; then
59
65
  exec node.exe "$basedir_win/../node-gyp/bin/node-gyp.js" "$@"
60
66
  else
61
- exec node "$basedir/../node-gyp/bin/node-gyp.js" "$@"
67
+ exec node "$basedir_abs/../node-gyp/bin/node-gyp.js" "$@"
62
68
  fi
63
- # cmd-shim-target=/home/runner/_work/pnpm/pnpm/pnpm/npm/pnpm/temp-deploy/node_modules/node-gyp/./bin/node-gyp.js
69
+ # cmd-shim-target=../node-gyp/bin/node-gyp.js
@@ -31,14 +31,19 @@ msys=""
31
31
 
32
32
  case `command -p uname -a` in
33
33
  *CYGWIN*|*MINGW*|*MSYS*)
34
- if command -v cygpath > /dev/null 2>&1; then
34
+ if converted=$(command -p cygpath -w "$basedir" 2>/dev/null) && [ -n "$converted" ]; then
35
+ basedir_win="$converted"
36
+ elif command -v cygpath > /dev/null 2>&1; then
35
37
  basedir_win=`cygpath -w "$basedir"`
36
38
  fi
37
39
  exe=".exe"
38
40
  msys="true"
39
41
  ;;
40
42
  *WSL2*)
41
- if command -v wslpath > /dev/null 2>&1; then
43
+ if converted=$(command -p wslpath -w "$basedir" 2>/dev/null) && [ -n "$converted" ]; then
44
+ basedir_win="$converted"
45
+ exe=".exe"
46
+ elif command -v wslpath > /dev/null 2>&1; then
42
47
  basedir_win="$(wslpath -w "$basedir" 2> /dev/null)"
43
48
  if [ $? -ne 0 ] || [ -z "$basedir_win" ]; then
44
49
  basedir_win="$basedir"
@@ -49,15 +54,16 @@ case `command -p uname -a` in
49
54
  ;;
50
55
  esac
51
56
 
57
+ basedir_abs=$(CDPATH= cd -P -- "$basedir" && pwd -P) || exit $?
52
58
  if [ -n "$exe" ] && [ -x "$basedir/node.exe" ]; then
53
59
  exec "$basedir/node.exe" "$basedir_win/../which/bin/which.js" "$@"
54
60
  elif [ -x "$basedir/node" ]; then
55
- exec "$basedir/node" "$basedir/../which/bin/which.js" "$@"
61
+ exec "$basedir/node" "$basedir_abs/../which/bin/which.js" "$@"
56
62
  elif command -v node >/dev/null 2>&1; then
57
- exec node "$basedir/../which/bin/which.js" "$@"
63
+ exec node "$basedir_abs/../which/bin/which.js" "$@"
58
64
  elif [ -n "$exe" ] && command -v node.exe >/dev/null 2>&1; then
59
65
  exec node.exe "$basedir_win/../which/bin/which.js" "$@"
60
66
  else
61
- exec node "$basedir/../which/bin/which.js" "$@"
67
+ exec node "$basedir_abs/../which/bin/which.js" "$@"
62
68
  fi
63
- # cmd-shim-target=/home/runner/_work/pnpm/pnpm/pnpm/npm/pnpm/temp-deploy/node_modules/which/./bin/which.js
69
+ # cmd-shim-target=../which/bin/which.js
@@ -31,14 +31,19 @@ msys=""
31
31
 
32
32
  case `command -p uname -a` in
33
33
  *CYGWIN*|*MINGW*|*MSYS*)
34
- if command -v cygpath > /dev/null 2>&1; then
34
+ if converted=$(command -p cygpath -w "$basedir" 2>/dev/null) && [ -n "$converted" ]; then
35
+ basedir_win="$converted"
36
+ elif command -v cygpath > /dev/null 2>&1; then
35
37
  basedir_win=`cygpath -w "$basedir"`
36
38
  fi
37
39
  exe=".exe"
38
40
  msys="true"
39
41
  ;;
40
42
  *WSL2*)
41
- if command -v wslpath > /dev/null 2>&1; then
43
+ if converted=$(command -p wslpath -w "$basedir" 2>/dev/null) && [ -n "$converted" ]; then
44
+ basedir_win="$converted"
45
+ exe=".exe"
46
+ elif command -v wslpath > /dev/null 2>&1; then
42
47
  basedir_win="$(wslpath -w "$basedir" 2> /dev/null)"
43
48
  if [ $? -ne 0 ] || [ -z "$basedir_win" ]; then
44
49
  basedir_win="$basedir"
@@ -49,15 +54,16 @@ case `command -p uname -a` in
49
54
  ;;
50
55
  esac
51
56
 
57
+ basedir_abs=$(CDPATH= cd -P -- "$basedir" && pwd -P) || exit $?
52
58
  if [ -n "$exe" ] && [ -x "$basedir/node.exe" ]; then
53
59
  exec "$basedir/node.exe" "$basedir_win/../nopt/bin/nopt.js" "$@"
54
60
  elif [ -x "$basedir/node" ]; then
55
- exec "$basedir/node" "$basedir/../nopt/bin/nopt.js" "$@"
61
+ exec "$basedir/node" "$basedir_abs/../nopt/bin/nopt.js" "$@"
56
62
  elif command -v node >/dev/null 2>&1; then
57
- exec node "$basedir/../nopt/bin/nopt.js" "$@"
63
+ exec node "$basedir_abs/../nopt/bin/nopt.js" "$@"
58
64
  elif [ -n "$exe" ] && command -v node.exe >/dev/null 2>&1; then
59
65
  exec node.exe "$basedir_win/../nopt/bin/nopt.js" "$@"
60
66
  else
61
- exec node "$basedir/../nopt/bin/nopt.js" "$@"
67
+ exec node "$basedir_abs/../nopt/bin/nopt.js" "$@"
62
68
  fi
63
- # cmd-shim-target=/home/runner/_work/pnpm/pnpm/pnpm/npm/pnpm/temp-deploy/node_modules/nopt/bin/nopt.js
69
+ # cmd-shim-target=../nopt/bin/nopt.js
@@ -31,14 +31,19 @@ msys=""
31
31
 
32
32
  case `command -p uname -a` in
33
33
  *CYGWIN*|*MINGW*|*MSYS*)
34
- if command -v cygpath > /dev/null 2>&1; then
34
+ if converted=$(command -p cygpath -w "$basedir" 2>/dev/null) && [ -n "$converted" ]; then
35
+ basedir_win="$converted"
36
+ elif command -v cygpath > /dev/null 2>&1; then
35
37
  basedir_win=`cygpath -w "$basedir"`
36
38
  fi
37
39
  exe=".exe"
38
40
  msys="true"
39
41
  ;;
40
42
  *WSL2*)
41
- if command -v wslpath > /dev/null 2>&1; then
43
+ if converted=$(command -p wslpath -w "$basedir" 2>/dev/null) && [ -n "$converted" ]; then
44
+ basedir_win="$converted"
45
+ exe=".exe"
46
+ elif command -v wslpath > /dev/null 2>&1; then
42
47
  basedir_win="$(wslpath -w "$basedir" 2> /dev/null)"
43
48
  if [ $? -ne 0 ] || [ -z "$basedir_win" ]; then
44
49
  basedir_win="$basedir"
@@ -49,15 +54,16 @@ case `command -p uname -a` in
49
54
  ;;
50
55
  esac
51
56
 
57
+ basedir_abs=$(CDPATH= cd -P -- "$basedir" && pwd -P) || exit $?
52
58
  if [ -n "$exe" ] && [ -x "$basedir/node.exe" ]; then
53
59
  exec "$basedir/node.exe" "$basedir_win/../semver/bin/semver.js" "$@"
54
60
  elif [ -x "$basedir/node" ]; then
55
- exec "$basedir/node" "$basedir/../semver/bin/semver.js" "$@"
61
+ exec "$basedir/node" "$basedir_abs/../semver/bin/semver.js" "$@"
56
62
  elif command -v node >/dev/null 2>&1; then
57
- exec node "$basedir/../semver/bin/semver.js" "$@"
63
+ exec node "$basedir_abs/../semver/bin/semver.js" "$@"
58
64
  elif [ -n "$exe" ] && command -v node.exe >/dev/null 2>&1; then
59
65
  exec node.exe "$basedir_win/../semver/bin/semver.js" "$@"
60
66
  else
61
- exec node "$basedir/../semver/bin/semver.js" "$@"
67
+ exec node "$basedir_abs/../semver/bin/semver.js" "$@"
62
68
  fi
63
- # cmd-shim-target=/home/runner/_work/pnpm/pnpm/pnpm/npm/pnpm/temp-deploy/node_modules/semver/bin/semver.js
69
+ # cmd-shim-target=../semver/bin/semver.js
@@ -1,9 +1,9 @@
1
1
  {
2
- "lastValidatedTimestamp": 1790093961133,
2
+ "lastValidatedTimestamp": 1790330643831,
3
3
  "projects": {
4
4
  "/home/runner/_work/pnpm/pnpm/pnpm/npm/pnpm/temp-deploy": {
5
5
  "name": "pacquet",
6
- "version": "12.6.0"
6
+ "version": "12.7.0"
7
7
  }
8
8
  },
9
9
  "pnpmfiles": [],
@@ -47,7 +47,7 @@
47
47
  "@pnpm/tabtab": "^0.5.4",
48
48
  "@pnpm/tgz-fixtures": "0.0.0",
49
49
  "@reflink/reflink": "0.1.19",
50
- "@rushstack/worker-pool": "0.7.27",
50
+ "@rushstack/worker-pool": "0.7.28",
51
51
  "@stylistic/eslint-plugin": "^5.10.0",
52
52
  "@types/adm-zip": "^0.5.8",
53
53
  "@types/archy": "0.0.36",
@@ -87,7 +87,7 @@
87
87
  "@types/write-file-atomic": "^4.0.3",
88
88
  "@types/yarnpkg__lockfile": "^1.1.9",
89
89
  "@types/zkochan__table": "npm:@types/table@6.3.2",
90
- "@typescript-eslint/utils": "^8.70.0",
90
+ "@typescript-eslint/utils": "^8.70.1",
91
91
  "@typescript/native-preview": "7.0.0-dev.20260707.2",
92
92
  "@yarnpkg/core": "4.9.1",
93
93
  "@yarnpkg/extensions": "2.0.7",
@@ -100,13 +100,14 @@
100
100
  "@zkochan/rimraf": "^4.0.0",
101
101
  "@zkochan/table": "^2.0.1",
102
102
  "adm-zip": "^0.6.1",
103
- "amaro": "^1.2.0",
103
+ "amaro": "^1.2.1",
104
104
  "ansi-diff": "^1.2.0",
105
105
  "archy": "^1.0.0",
106
106
  "better-path-resolve": "2.0.0",
107
107
  "bin-links": "^6.0.2",
108
108
  "bole": "^5.0.29",
109
109
  "boxen": "npm:@zkochan/boxen@5.1.2",
110
+ "bz2": "1.0.1",
110
111
  "c8": "^12.0.0",
111
112
  "camelcase": "^9.0.0",
112
113
  "camelcase-keys": "^10.0.3",
@@ -141,7 +142,7 @@
141
142
  "exists-link": "2.0.0",
142
143
  "fast-deep-equal": "^3.1.3",
143
144
  "fast-glob": "^3.3.3",
144
- "fs-extra": "^11.4.0",
145
+ "fs-extra": "^11.4.1",
145
146
  "fuse-native": "^2.2.6",
146
147
  "get-pnpm": "^0.0.5",
147
148
  "get-port": "^7.2.0",
@@ -173,7 +174,7 @@
173
174
  "lru-cache": "^11.5.3",
174
175
  "make-empty-dir": "^4.0.0",
175
176
  "mdast-util-to-string": "^4.0.0",
176
- "memfs": "^4.78.1",
177
+ "memfs": "^4.79.0",
177
178
  "memoize": "^11.0.0",
178
179
  "micromatch": "^4.0.8",
179
180
  "msgpackr": "2.1.0",
@@ -228,6 +229,7 @@
228
229
  "semver-utils": "^1.1.4",
229
230
  "shlex": "^3.0.0",
230
231
  "shx": "^0.4.0",
232
+ "signal-exit": "^4.1.0",
231
233
  "socks": "^2.8.10",
232
234
  "sort-keys": "^6.0.1",
233
235
  "spdx-expression-parse": "5.0.0",
@@ -249,7 +251,7 @@
249
251
  "tree-kill": "^1.2.2",
250
252
  "ts-jest-resolver": "2.0.1",
251
253
  "typescript": "6.0.3",
252
- "typescript-eslint": "^8.70.0",
254
+ "typescript-eslint": "^8.70.1",
253
255
  "uid-number": "0.0.6",
254
256
  "undici": "^7.29.0",
255
257
  "unified": "^11.0.5",
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "./dist/node_modules/node-gyp/gyp/gyp"
10
10
  ]
11
11
  },
12
- "version": "12.6.0",
12
+ "version": "12.7.0",
13
13
  "description": "Fast, disk space efficient package manager",
14
14
  "keywords": [
15
15
  "pnpm",
@@ -46,20 +46,20 @@
46
46
  "THIRD-PARTY-NOTICES.md"
47
47
  ],
48
48
  "optionalDependencies": {
49
- "@pnpm/exe.win32-x64": "12.6.0",
50
- "@pnpm/exe.win32-arm64": "12.6.0",
51
- "@pnpm/exe.darwin-x64": "12.6.0",
52
- "@pnpm/exe.darwin-arm64": "12.6.0",
53
- "@pnpm/exe.linux-x64": "12.6.0",
54
- "@pnpm/exe.linux-arm64": "12.6.0",
55
- "@pnpm/exe.linux-riscv64": "12.6.0",
56
- "@pnpm/exe.linux-ppc64": "12.6.0",
57
- "@pnpm/exe.linux-s390x": "12.6.0",
58
- "@pnpm/exe.linux-x64-musl": "12.6.0",
59
- "@pnpm/exe.linux-arm64-musl": "12.6.0",
60
- "@pnpm/exe.freebsd-x64": "12.6.0",
61
- "@pnpm/exe.android-arm64": "12.6.0",
62
- "@pnpm/exe.android-x64": "12.6.0"
49
+ "@pnpm/exe.win32-x64": "12.7.0",
50
+ "@pnpm/exe.win32-arm64": "12.7.0",
51
+ "@pnpm/exe.darwin-x64": "12.7.0",
52
+ "@pnpm/exe.darwin-arm64": "12.7.0",
53
+ "@pnpm/exe.linux-x64": "12.7.0",
54
+ "@pnpm/exe.linux-arm64": "12.7.0",
55
+ "@pnpm/exe.linux-riscv64": "12.7.0",
56
+ "@pnpm/exe.linux-ppc64": "12.7.0",
57
+ "@pnpm/exe.linux-s390x": "12.7.0",
58
+ "@pnpm/exe.linux-x64-musl": "12.7.0",
59
+ "@pnpm/exe.linux-arm64-musl": "12.7.0",
60
+ "@pnpm/exe.freebsd-x64": "12.7.0",
61
+ "@pnpm/exe.android-arm64": "12.7.0",
62
+ "@pnpm/exe.android-x64": "12.7.0"
63
63
  },
64
64
  "scripts": {
65
65
  "preinstall": "node install.js",
package/pn CHANGED
@@ -8,6 +8,24 @@
8
8
  # itself first. The hop cap matches the kernel's ELOOP limit, so a cycle cannot
9
9
  # hang the script. Directories come from `${self%/*}` and `readlink` runs through
10
10
  # `command -p`, so the caller's `PATH` decides nothing here.
11
+ #
12
+ # Where no default path is compiled in, as on Nix, `command -p` searches PATH
13
+ # instead, so the helpers run with node_modules and relative entries dropped from
14
+ # PATH.
15
+ caller_path_set=${PATH+set}
16
+ caller_path=${PATH-}
17
+ helper_path=
18
+ rest=$caller_path:
19
+ while [ -n "$rest" ]; do
20
+ dir=${rest%%:*}
21
+ rest=${rest#*:}
22
+ case "$dir" in
23
+ */node_modules/*|*/node_modules) ;;
24
+ /*) helper_path=${helper_path:+$helper_path:}$dir ;;
25
+ esac
26
+ done
27
+ # An empty PATH searches the current directory.
28
+ PATH=${helper_path:-/}
11
29
  self=$0
12
30
  # MSYS and Cygwin can launch this with a native Windows path, which has no slash
13
31
  # for `${self%/*}` to strip. Only a drive letter or a UNC prefix marks one; a
@@ -39,6 +57,7 @@ while [ -L "$self" ] && [ "$hops" -lt 40 ]; do
39
57
  *) self=${self%/*}/$link ;;
40
58
  esac
41
59
  done
60
+ if [ -n "$caller_path_set" ]; then PATH=$caller_path; else unset PATH; fi
42
61
  # The walk has to end at a regular file. Running out of hops leaves $self a
43
62
  # symlink; a chain that changed under us can leave it dangling or a directory, and
44
63
  # a failed readlink leaves a trailing slash. Each case would take `pnpm` from the
package/pnpm CHANGED
@@ -28,6 +28,24 @@ fi
28
28
  # `readlink` runs through `command -p`, which searches the system default path,
29
29
  # and directories come from `${self%/*}`, which runs nothing at all. The caller's
30
30
  # PATH therefore decides only which `node` runs, which is what it is for.
31
+ #
32
+ # Where no default path is compiled in, as on Nix, `command -p` searches PATH
33
+ # instead, so the helpers run with node_modules and relative entries dropped from
34
+ # PATH.
35
+ caller_path_set=${PATH+set}
36
+ caller_path=${PATH-}
37
+ helper_path=
38
+ rest=$caller_path:
39
+ while [ -n "$rest" ]; do
40
+ dir=${rest%%:*}
41
+ rest=${rest#*:}
42
+ case "$dir" in
43
+ */node_modules/*|*/node_modules) ;;
44
+ /*) helper_path=${helper_path:+$helper_path:}$dir ;;
45
+ esac
46
+ done
47
+ # An empty PATH searches the current directory.
48
+ PATH=${helper_path:-/}
31
49
  self=$0
32
50
  # MSYS and Cygwin can launch this with a native Windows path, which has no slash
33
51
  # for `${self%/*}` to strip. Only a drive letter or a UNC prefix marks one; a
@@ -59,5 +77,14 @@ while [ -L "$self" ] && [ "$hops" -lt 40 ]; do
59
77
  *) self=${self%/*}/$link ;;
60
78
  esac
61
79
  done
80
+ if [ -n "$caller_path_set" ]; then PATH=$caller_path; else unset PATH; fi
81
+ # The walk has to end at a regular file. Running out of hops leaves $self a
82
+ # symlink; a chain that changed under us can leave it dangling or a directory, and
83
+ # a failed readlink leaves a trailing slash. Each case would take `bin/pnpm.mjs`
84
+ # from the wrong directory.
85
+ if [ -L "$self" ] || [ ! -f "$self" ]; then
86
+ echo "pnpm: could not resolve $0 to a regular file within 40 symlink hops." >&2
87
+ exit 1
88
+ fi
62
89
 
63
90
  exec node "${self%/*}/bin/pnpm.mjs" "$@"
package/pnpx CHANGED
@@ -8,6 +8,24 @@
8
8
  # itself first. The hop cap matches the kernel's ELOOP limit, so a cycle cannot
9
9
  # hang the script. Directories come from `${self%/*}` and `readlink` runs through
10
10
  # `command -p`, so the caller's `PATH` decides nothing here.
11
+ #
12
+ # Where no default path is compiled in, as on Nix, `command -p` searches PATH
13
+ # instead, so the helpers run with node_modules and relative entries dropped from
14
+ # PATH.
15
+ caller_path_set=${PATH+set}
16
+ caller_path=${PATH-}
17
+ helper_path=
18
+ rest=$caller_path:
19
+ while [ -n "$rest" ]; do
20
+ dir=${rest%%:*}
21
+ rest=${rest#*:}
22
+ case "$dir" in
23
+ */node_modules/*|*/node_modules) ;;
24
+ /*) helper_path=${helper_path:+$helper_path:}$dir ;;
25
+ esac
26
+ done
27
+ # An empty PATH searches the current directory.
28
+ PATH=${helper_path:-/}
11
29
  self=$0
12
30
  # MSYS and Cygwin can launch this with a native Windows path, which has no slash
13
31
  # for `${self%/*}` to strip. Only a drive letter or a UNC prefix marks one; a
@@ -39,6 +57,7 @@ while [ -L "$self" ] && [ "$hops" -lt 40 ]; do
39
57
  *) self=${self%/*}/$link ;;
40
58
  esac
41
59
  done
60
+ if [ -n "$caller_path_set" ]; then PATH=$caller_path; else unset PATH; fi
42
61
  # The walk has to end at a regular file. Running out of hops leaves $self a
43
62
  # symlink; a chain that changed under us can leave it dangling or a directory, and
44
63
  # a failed readlink leaves a trailing slash. Each case would take `pnpm` from the
package/pnx CHANGED
@@ -8,6 +8,24 @@
8
8
  # itself first. The hop cap matches the kernel's ELOOP limit, so a cycle cannot
9
9
  # hang the script. Directories come from `${self%/*}` and `readlink` runs through
10
10
  # `command -p`, so the caller's `PATH` decides nothing here.
11
+ #
12
+ # Where no default path is compiled in, as on Nix, `command -p` searches PATH
13
+ # instead, so the helpers run with node_modules and relative entries dropped from
14
+ # PATH.
15
+ caller_path_set=${PATH+set}
16
+ caller_path=${PATH-}
17
+ helper_path=
18
+ rest=$caller_path:
19
+ while [ -n "$rest" ]; do
20
+ dir=${rest%%:*}
21
+ rest=${rest#*:}
22
+ case "$dir" in
23
+ */node_modules/*|*/node_modules) ;;
24
+ /*) helper_path=${helper_path:+$helper_path:}$dir ;;
25
+ esac
26
+ done
27
+ # An empty PATH searches the current directory.
28
+ PATH=${helper_path:-/}
11
29
  self=$0
12
30
  # MSYS and Cygwin can launch this with a native Windows path, which has no slash
13
31
  # for `${self%/*}` to strip. Only a drive letter or a UNC prefix marks one; a
@@ -39,6 +57,7 @@ while [ -L "$self" ] && [ "$hops" -lt 40 ]; do
39
57
  *) self=${self%/*}/$link ;;
40
58
  esac
41
59
  done
60
+ if [ -n "$caller_path_set" ]; then PATH=$caller_path; else unset PATH; fi
42
61
  # The walk has to end at a regular file. Running out of hops leaves $self a
43
62
  # symlink; a chain that changed under us can leave it dangling or a directory, and
44
63
  # a failed readlink leaves a trailing slash. Each case would take `pnpm` from the