@pnpm/exe 12.9.1 → 12.10.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.
- package/dist/node_modules/.pnpm-workspace-state-v1.json +14 -13
- package/install.js +8 -4
- package/package.json +15 -15
- package/pn +76 -2
- package/pnpm +98 -2
- package/pnpx +76 -2
- package/pnx +76 -2
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
-
"lastValidatedTimestamp":
|
|
2
|
+
"lastValidatedTimestamp": 1791244929665,
|
|
3
3
|
"projects": {
|
|
4
4
|
"/home/runner/_work/pnpm/pnpm/pnpm/npm/pnpm/temp-deploy": {
|
|
5
5
|
"name": "pacquet",
|
|
6
|
-
"version": "12.
|
|
6
|
+
"version": "12.10.0",
|
|
7
7
|
"hasModulesDir": true
|
|
8
8
|
}
|
|
9
9
|
},
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@commitlint/config-conventional": "^21.2.3",
|
|
29
29
|
"@commitlint/prompt-cli": "^21.2.3",
|
|
30
30
|
"@cyclonedx/cyclonedx-library": "10.3.0",
|
|
31
|
-
"@emnapi/wasi-threads": "
|
|
31
|
+
"@emnapi/wasi-threads": "2.1.0",
|
|
32
32
|
"@eslint/js": "^10.0.1",
|
|
33
33
|
"@inquirer/prompts": "^8.7.2",
|
|
34
34
|
"@jest/globals": "30.4.1",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@pnpm/tabtab": "^0.5.4",
|
|
47
47
|
"@pnpm/tgz-fixtures": "0.0.0",
|
|
48
48
|
"@reflink/reflink": "0.1.19",
|
|
49
|
-
"@rushstack/worker-pool": "0.7.
|
|
49
|
+
"@rushstack/worker-pool": "0.7.29",
|
|
50
50
|
"@stylistic/eslint-plugin": "^5.10.0",
|
|
51
51
|
"@tybys/wasm-util": "0.10.4",
|
|
52
52
|
"@types/adm-zip": "^0.5.8",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"@types/semver": "7.8.0",
|
|
81
81
|
"@types/spdx-expression-parse": "4.0.0",
|
|
82
82
|
"@types/ssri": "^7.1.5",
|
|
83
|
-
"@types/tar-stream": "^3.1.
|
|
83
|
+
"@types/tar-stream": "^3.1.5",
|
|
84
84
|
"@types/touch": "^3.1.5",
|
|
85
85
|
"@types/validate-npm-package-name": "^4.0.2",
|
|
86
86
|
"@types/which": "^3.0.4",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"@types/yarnpkg__lockfile": "^1.1.9",
|
|
89
89
|
"@types/yauzl": "^3.4.0",
|
|
90
90
|
"@types/zkochan__table": "npm:@types/table@6.3.2",
|
|
91
|
-
"@typescript-eslint/utils": "^8.
|
|
91
|
+
"@typescript-eslint/utils": "^8.71.0",
|
|
92
92
|
"@typescript/native-preview": "7.0.0-dev.20260707.2",
|
|
93
93
|
"@webcontainer/api": "^1.6.4",
|
|
94
94
|
"@yarnpkg/core": "4.9.1",
|
|
@@ -111,7 +111,6 @@
|
|
|
111
111
|
"bin-links": "^6.0.2",
|
|
112
112
|
"bole": "^5.0.29",
|
|
113
113
|
"boxen": "npm:@zkochan/boxen@5.1.2",
|
|
114
|
-
"bz2": "1.0.1",
|
|
115
114
|
"c8": "^12.0.0",
|
|
116
115
|
"camelcase": "^9.0.0",
|
|
117
116
|
"camelcase-keys": "^10.0.3",
|
|
@@ -135,10 +134,10 @@
|
|
|
135
134
|
"empathic": "^2.1.0",
|
|
136
135
|
"esbuild": "^0.28.2",
|
|
137
136
|
"escape-string-regexp": "^5.0.0",
|
|
138
|
-
"eslint": "^10.
|
|
137
|
+
"eslint": "^10.12.0",
|
|
139
138
|
"eslint-plugin-import-x": "^4.17.1",
|
|
140
139
|
"eslint-plugin-jest": "^29.16.6",
|
|
141
|
-
"eslint-plugin-n": "^18.4.
|
|
140
|
+
"eslint-plugin-n": "^18.4.1",
|
|
142
141
|
"eslint-plugin-promise": "^7.3.0",
|
|
143
142
|
"eslint-plugin-regexp": "^3.1.1",
|
|
144
143
|
"eslint-plugin-simple-import-sort": "^14.0.0",
|
|
@@ -180,7 +179,7 @@
|
|
|
180
179
|
"lru-cache": "^11.5.3",
|
|
181
180
|
"make-empty-dir": "^4.0.0",
|
|
182
181
|
"mdast-util-to-string": "^4.0.0",
|
|
183
|
-
"memfs": "^4.
|
|
182
|
+
"memfs": "^4.80.0",
|
|
184
183
|
"memoize": "^11.0.0",
|
|
185
184
|
"micromatch": "^4.0.8",
|
|
186
185
|
"msgpackr": "2.1.0",
|
|
@@ -232,6 +231,7 @@
|
|
|
232
231
|
"safe-execa": "^0.3.0",
|
|
233
232
|
"safe-promise-defer": "^2.0.0",
|
|
234
233
|
"sanitize-filename": "^1.6.4",
|
|
234
|
+
"seek-bzip": "2.0.0",
|
|
235
235
|
"semver": "^7.8.5",
|
|
236
236
|
"semver-range-intersect": "^0.3.1",
|
|
237
237
|
"semver-utils": "^1.1.4",
|
|
@@ -252,7 +252,7 @@
|
|
|
252
252
|
"strip-comments-strings": "1.2.0",
|
|
253
253
|
"symlink-dir": "^10.0.3",
|
|
254
254
|
"tar": "^7.5.22",
|
|
255
|
-
"tar-stream": "^3.2.
|
|
255
|
+
"tar-stream": "^3.2.2",
|
|
256
256
|
"tempy": "3.0.0",
|
|
257
257
|
"terminal-link": "^5.0.0",
|
|
258
258
|
"tinyglobby": "^0.2.17",
|
|
@@ -260,7 +260,7 @@
|
|
|
260
260
|
"tree-kill": "^1.2.2",
|
|
261
261
|
"ts-jest-resolver": "2.0.1",
|
|
262
262
|
"typescript": "6.0.3",
|
|
263
|
-
"typescript-eslint": "^8.
|
|
263
|
+
"typescript-eslint": "^8.71.0",
|
|
264
264
|
"uid-number": "0.0.6",
|
|
265
265
|
"undici": "^7.29.1",
|
|
266
266
|
"unified": "^11.0.5",
|
|
@@ -336,7 +336,8 @@
|
|
|
336
336
|
"patchedDependencies": {
|
|
337
337
|
"@tybys/wasm-util@0.10.4": "../../../../__patches__/@tybys__wasm-util@0.10.4.patch",
|
|
338
338
|
"graceful-fs@4.2.11": "../../../../__patches__/graceful-fs@4.2.11.patch",
|
|
339
|
-
"normalize-registry-url@2.0.1": "../../../../__patches__/normalize-registry-url@2.0.1.patch"
|
|
339
|
+
"normalize-registry-url@2.0.1": "../../../../__patches__/normalize-registry-url@2.0.1.patch",
|
|
340
|
+
"unrs-resolver@1.12.2": "../../../../__patches__/unrs-resolver@1.12.2.patch"
|
|
340
341
|
},
|
|
341
342
|
"peersSuffixMaxLength": 1000,
|
|
342
343
|
"preferWorkspacePackages": false,
|
package/install.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// Native installs replace
|
|
3
|
-
//
|
|
4
|
-
//
|
|
2
|
+
// Native installs replace every bin with the host binary, so `pnpm` runs with
|
|
3
|
+
// no Node.js startup per call. The bins it replaces are shebang-less for the
|
|
4
|
+
// reason ./pnpm gives. npm's Windows shims still target the extensionless path
|
|
5
|
+
// after the `bin` rewrite, so postinstall asks npm to regenerate them against
|
|
6
|
+
// `pnpm.exe`. Installs that block lifecycle scripts keep the placeholders,
|
|
7
|
+
// which reach pnpm through Node.js wherever a shell runs them. Corepack runs no
|
|
8
|
+
// lifecycle scripts and enters through `bin/pnpm.mjs`.
|
|
5
9
|
import console from 'node:console'
|
|
6
10
|
import { spawnSync } from 'node:child_process'
|
|
7
11
|
import fs from 'node:fs'
|
|
@@ -32,7 +36,7 @@ function setup () {
|
|
|
32
36
|
return
|
|
33
37
|
}
|
|
34
38
|
|
|
35
|
-
// The
|
|
39
|
+
// The placeholders stay in place there and point to `@pnpm/wasm`.
|
|
36
40
|
if ('webcontainer' in process.versions) {
|
|
37
41
|
return
|
|
38
42
|
}
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"./dist/node_modules/node-gyp/gyp/gyp"
|
|
10
10
|
]
|
|
11
11
|
},
|
|
12
|
-
"version": "12.
|
|
12
|
+
"version": "12.10.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.
|
|
50
|
-
"@pnpm/exe.win32-arm64": "12.
|
|
51
|
-
"@pnpm/exe.darwin-x64": "12.
|
|
52
|
-
"@pnpm/exe.darwin-arm64": "12.
|
|
53
|
-
"@pnpm/exe.linux-x64": "12.
|
|
54
|
-
"@pnpm/exe.linux-arm64": "12.
|
|
55
|
-
"@pnpm/exe.linux-riscv64": "12.
|
|
56
|
-
"@pnpm/exe.linux-ppc64": "12.
|
|
57
|
-
"@pnpm/exe.linux-s390x": "12.
|
|
58
|
-
"@pnpm/exe.linux-x64-musl": "12.
|
|
59
|
-
"@pnpm/exe.linux-arm64-musl": "12.
|
|
60
|
-
"@pnpm/exe.freebsd-x64": "12.
|
|
61
|
-
"@pnpm/exe.android-arm64": "12.
|
|
62
|
-
"@pnpm/exe.android-x64": "12.
|
|
49
|
+
"@pnpm/exe.win32-x64": "12.10.0",
|
|
50
|
+
"@pnpm/exe.win32-arm64": "12.10.0",
|
|
51
|
+
"@pnpm/exe.darwin-x64": "12.10.0",
|
|
52
|
+
"@pnpm/exe.darwin-arm64": "12.10.0",
|
|
53
|
+
"@pnpm/exe.linux-x64": "12.10.0",
|
|
54
|
+
"@pnpm/exe.linux-arm64": "12.10.0",
|
|
55
|
+
"@pnpm/exe.linux-riscv64": "12.10.0",
|
|
56
|
+
"@pnpm/exe.linux-ppc64": "12.10.0",
|
|
57
|
+
"@pnpm/exe.linux-s390x": "12.10.0",
|
|
58
|
+
"@pnpm/exe.linux-x64-musl": "12.10.0",
|
|
59
|
+
"@pnpm/exe.linux-arm64-musl": "12.10.0",
|
|
60
|
+
"@pnpm/exe.freebsd-x64": "12.10.0",
|
|
61
|
+
"@pnpm/exe.android-arm64": "12.10.0",
|
|
62
|
+
"@pnpm/exe.android-x64": "12.10.0"
|
|
63
63
|
},
|
|
64
64
|
"scripts": {
|
|
65
65
|
"preinstall": "node install.js",
|
package/pn
CHANGED
|
@@ -1,2 +1,76 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
# Shebang-less for the reason ./pnpm gives: install.js puts the native binary
|
|
2
|
+
# at this path too.
|
|
3
|
+
#
|
|
4
|
+
# `pn` is `pnpm`. The pnpm it hands over to is the one installed alongside it,
|
|
5
|
+
# found relative to this file: a `PATH` lookup would run whatever other pnpm
|
|
6
|
+
# comes first there, and would find nothing at all when the directory holding
|
|
7
|
+
# these bins is not on `PATH`.
|
|
8
|
+
#
|
|
9
|
+
# $0 is whatever shim or symlink `pn` was launched through, so walk to the file
|
|
10
|
+
# itself first. The hop cap matches the kernel's ELOOP limit, so a cycle cannot
|
|
11
|
+
# hang the script. Directories come from `${self%/*}` and `readlink` runs through
|
|
12
|
+
# `command -p`, so the caller's `PATH` decides nothing here.
|
|
13
|
+
#
|
|
14
|
+
# A helper the default path lacks, as in a Nix build sandbox, comes from PATH
|
|
15
|
+
# instead, with node_modules and relative entries dropped from it.
|
|
16
|
+
caller_path_set=${PATH+set}
|
|
17
|
+
caller_path=${PATH-}
|
|
18
|
+
helper_path=
|
|
19
|
+
rest=$caller_path:
|
|
20
|
+
while [ -n "$rest" ]; do
|
|
21
|
+
dir=${rest%%:*}
|
|
22
|
+
rest=${rest#*:}
|
|
23
|
+
case "$dir" in
|
|
24
|
+
*/node_modules/*|*/node_modules) ;;
|
|
25
|
+
/*) helper_path=${helper_path:+$helper_path:}$dir ;;
|
|
26
|
+
esac
|
|
27
|
+
done
|
|
28
|
+
# An empty PATH searches the current directory.
|
|
29
|
+
PATH=${helper_path:-/}
|
|
30
|
+
# A helper comes from PATH only when the default path lacks it and PATH has it.
|
|
31
|
+
# The bash 3.2 that macOS ships as sh answers `command -p -v` from PATH.
|
|
32
|
+
run_helper() {
|
|
33
|
+
if command -p -v "$1" >/dev/null 2>&1 || ! command -v "$1" >/dev/null 2>&1; then command -p "$@"; else command "$@"; fi
|
|
34
|
+
}
|
|
35
|
+
self=$0
|
|
36
|
+
# MSYS and Cygwin can launch this with a native Windows path, which has no slash
|
|
37
|
+
# for `${self%/*}` to strip. Only a drive letter or a UNC prefix marks one; a
|
|
38
|
+
# backslash anywhere else is an ordinary character in a Unix file name, so the
|
|
39
|
+
# path is left alone. The separators are swapped in the shell rather than through
|
|
40
|
+
# `echo`, which mangles a `\t` or `\b` in a path under dash.
|
|
41
|
+
case $self in
|
|
42
|
+
[A-Za-z]:\\*|\\\\*)
|
|
43
|
+
while :; do
|
|
44
|
+
case $self in
|
|
45
|
+
*\\*) self=${self%%\\*}/${self#*\\} ;;
|
|
46
|
+
*) break ;;
|
|
47
|
+
esac
|
|
48
|
+
done
|
|
49
|
+
;;
|
|
50
|
+
esac
|
|
51
|
+
# `${self%/*}` needs a slash to strip. A bare name came from a `PATH` lookup and
|
|
52
|
+
# stands for a file in the current directory.
|
|
53
|
+
case $self in
|
|
54
|
+
*/*) ;;
|
|
55
|
+
*) self=./$self ;;
|
|
56
|
+
esac
|
|
57
|
+
hops=0
|
|
58
|
+
while [ -L "$self" ] && [ "$hops" -lt 40 ]; do
|
|
59
|
+
hops=$((hops + 1))
|
|
60
|
+
link=$(run_helper readlink "$self")
|
|
61
|
+
case $link in
|
|
62
|
+
/*) self=$link ;;
|
|
63
|
+
*) self=${self%/*}/$link ;;
|
|
64
|
+
esac
|
|
65
|
+
done
|
|
66
|
+
if [ -n "$caller_path_set" ]; then PATH=$caller_path; else unset PATH; fi
|
|
67
|
+
# The walk has to end at a regular file. Running out of hops leaves $self a
|
|
68
|
+
# symlink; a chain that changed under us can leave it dangling or a directory, and
|
|
69
|
+
# a failed readlink leaves a trailing slash. Each case would take `pnpm` from the
|
|
70
|
+
# wrong directory — the substitution this script exists to prevent.
|
|
71
|
+
if [ -L "$self" ] || [ ! -f "$self" ]; then
|
|
72
|
+
echo "pn: could not resolve $0 to a regular file within 40 symlink hops." >&2
|
|
73
|
+
exit 1
|
|
74
|
+
fi
|
|
75
|
+
|
|
76
|
+
exec "${self%/*}/pnpm" "$@"
|
package/pnpm
CHANGED
|
@@ -1,2 +1,98 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
# pnpm's native binary replaces this file during installation (see
|
|
2
|
+
# ./install.js). Until then this hands over to ./bin/pnpm.mjs, which finds the
|
|
3
|
+
# installed binary or downloads one and spawns it.
|
|
4
|
+
#
|
|
5
|
+
# Shebang-less on purpose, and therefore an `sh` script: a bin shim generated
|
|
6
|
+
# from a shebang records that interpreter, and keeps running the native binary
|
|
7
|
+
# through it once the binary takes this path. Every pnpm 11 release before
|
|
8
|
+
# 11.28.4 generates the shim first when it installs the pnpm that a
|
|
9
|
+
# `packageManager` field pins, and released versions cannot be fixed
|
|
10
|
+
# (https://github.com/pnpm/pnpm/issues/16594). test/install.test.mjs holds
|
|
11
|
+
# every bin to this.
|
|
12
|
+
#
|
|
13
|
+
# Something has to retry this file under a shell, because the kernel answers
|
|
14
|
+
# ENOEXEC for it. A bin shim and a shell both do, and so does glibc's `execvp`.
|
|
15
|
+
# Apple's libc does not, so on macOS a program that spawns this path itself gets
|
|
16
|
+
# ENOEXEC; Windows has neither and cannot reach it at all.
|
|
17
|
+
if ! command -v node > /dev/null 2>&1; then
|
|
18
|
+
echo "pnpm's native binary was not installed, and there is no Node.js to run pnpm without it." >&2
|
|
19
|
+
echo "Reinstall pnpm with build scripts enabled (allow-list pnpm's build under pnpm or Bun, or drop --ignore-scripts)." >&2
|
|
20
|
+
exit 1
|
|
21
|
+
fi
|
|
22
|
+
|
|
23
|
+
if [ -t 2 ]; then
|
|
24
|
+
echo "pnpm is running through Node.js because the script that installs its native binary was skipped." >&2
|
|
25
|
+
echo "Reinstall pnpm with its build scripts allowed to run the binary directly." >&2
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
# $0 is whatever shim or symlink pnpm was launched through; ./bin/pnpm.mjs is
|
|
29
|
+
# found relative to this file. The hop cap matches the kernel's ELOOP limit, so
|
|
30
|
+
# a cycle cannot hang the script.
|
|
31
|
+
#
|
|
32
|
+
# `readlink` runs through `command -p`, which searches the system default path,
|
|
33
|
+
# and directories come from `${self%/*}`, which runs nothing at all. The caller's
|
|
34
|
+
# PATH therefore decides only which `node` runs, which is what it is for.
|
|
35
|
+
#
|
|
36
|
+
# A helper the default path lacks, as in a Nix build sandbox, comes from PATH
|
|
37
|
+
# instead, with node_modules and relative entries dropped from it.
|
|
38
|
+
caller_path_set=${PATH+set}
|
|
39
|
+
caller_path=${PATH-}
|
|
40
|
+
helper_path=
|
|
41
|
+
rest=$caller_path:
|
|
42
|
+
while [ -n "$rest" ]; do
|
|
43
|
+
dir=${rest%%:*}
|
|
44
|
+
rest=${rest#*:}
|
|
45
|
+
case "$dir" in
|
|
46
|
+
*/node_modules/*|*/node_modules) ;;
|
|
47
|
+
/*) helper_path=${helper_path:+$helper_path:}$dir ;;
|
|
48
|
+
esac
|
|
49
|
+
done
|
|
50
|
+
# An empty PATH searches the current directory.
|
|
51
|
+
PATH=${helper_path:-/}
|
|
52
|
+
# A helper comes from PATH only when the default path lacks it and PATH has it.
|
|
53
|
+
# The bash 3.2 that macOS ships as sh answers `command -p -v` from PATH.
|
|
54
|
+
run_helper() {
|
|
55
|
+
if command -p -v "$1" >/dev/null 2>&1 || ! command -v "$1" >/dev/null 2>&1; then command -p "$@"; else command "$@"; fi
|
|
56
|
+
}
|
|
57
|
+
self=$0
|
|
58
|
+
# MSYS and Cygwin can launch this with a native Windows path, which has no slash
|
|
59
|
+
# for `${self%/*}` to strip. Only a drive letter or a UNC prefix marks one; a
|
|
60
|
+
# backslash anywhere else is an ordinary character in a Unix file name, so the
|
|
61
|
+
# path is left alone. The separators are swapped in the shell rather than through
|
|
62
|
+
# `echo`, which mangles a `\t` or `\b` in a path under dash.
|
|
63
|
+
case $self in
|
|
64
|
+
[A-Za-z]:\\*|\\\\*)
|
|
65
|
+
while :; do
|
|
66
|
+
case $self in
|
|
67
|
+
*\\*) self=${self%%\\*}/${self#*\\} ;;
|
|
68
|
+
*) break ;;
|
|
69
|
+
esac
|
|
70
|
+
done
|
|
71
|
+
;;
|
|
72
|
+
esac
|
|
73
|
+
# `${self%/*}` needs a slash to strip. A bare name came from a PATH lookup and
|
|
74
|
+
# stands for a file in the current directory.
|
|
75
|
+
case $self in
|
|
76
|
+
*/*) ;;
|
|
77
|
+
*) self=./$self ;;
|
|
78
|
+
esac
|
|
79
|
+
hops=0
|
|
80
|
+
while [ -L "$self" ] && [ "$hops" -lt 40 ]; do
|
|
81
|
+
hops=$((hops + 1))
|
|
82
|
+
link=$(run_helper readlink "$self")
|
|
83
|
+
case $link in
|
|
84
|
+
/*) self=$link ;;
|
|
85
|
+
*) self=${self%/*}/$link ;;
|
|
86
|
+
esac
|
|
87
|
+
done
|
|
88
|
+
if [ -n "$caller_path_set" ]; then PATH=$caller_path; else unset PATH; fi
|
|
89
|
+
# The walk has to end at a regular file. Running out of hops leaves $self a
|
|
90
|
+
# symlink; a chain that changed under us can leave it dangling or a directory, and
|
|
91
|
+
# a failed readlink leaves a trailing slash. Each case would take `bin/pnpm.mjs`
|
|
92
|
+
# from the wrong directory.
|
|
93
|
+
if [ -L "$self" ] || [ ! -f "$self" ]; then
|
|
94
|
+
echo "pnpm: could not resolve $0 to a regular file within 40 symlink hops." >&2
|
|
95
|
+
exit 1
|
|
96
|
+
fi
|
|
97
|
+
|
|
98
|
+
exec node "${self%/*}/bin/pnpm.mjs" "$@"
|
package/pnpx
CHANGED
|
@@ -1,2 +1,76 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
# Shebang-less for the reason ./pnpm gives: install.js puts the native binary
|
|
2
|
+
# at this path too.
|
|
3
|
+
#
|
|
4
|
+
# `pnpx` is `pnpm dlx`. The pnpm it hands over to is the one installed alongside
|
|
5
|
+
# it, found relative to this file: a `PATH` lookup would run whatever other pnpm
|
|
6
|
+
# comes first there, and would find nothing at all when the directory holding
|
|
7
|
+
# these bins is not on `PATH`.
|
|
8
|
+
#
|
|
9
|
+
# $0 is whatever shim or symlink `pnpx` was launched through, so walk to the file
|
|
10
|
+
# itself first. The hop cap matches the kernel's ELOOP limit, so a cycle cannot
|
|
11
|
+
# hang the script. Directories come from `${self%/*}` and `readlink` runs through
|
|
12
|
+
# `command -p`, so the caller's `PATH` decides nothing here.
|
|
13
|
+
#
|
|
14
|
+
# A helper the default path lacks, as in a Nix build sandbox, comes from PATH
|
|
15
|
+
# instead, with node_modules and relative entries dropped from it.
|
|
16
|
+
caller_path_set=${PATH+set}
|
|
17
|
+
caller_path=${PATH-}
|
|
18
|
+
helper_path=
|
|
19
|
+
rest=$caller_path:
|
|
20
|
+
while [ -n "$rest" ]; do
|
|
21
|
+
dir=${rest%%:*}
|
|
22
|
+
rest=${rest#*:}
|
|
23
|
+
case "$dir" in
|
|
24
|
+
*/node_modules/*|*/node_modules) ;;
|
|
25
|
+
/*) helper_path=${helper_path:+$helper_path:}$dir ;;
|
|
26
|
+
esac
|
|
27
|
+
done
|
|
28
|
+
# An empty PATH searches the current directory.
|
|
29
|
+
PATH=${helper_path:-/}
|
|
30
|
+
# A helper comes from PATH only when the default path lacks it and PATH has it.
|
|
31
|
+
# The bash 3.2 that macOS ships as sh answers `command -p -v` from PATH.
|
|
32
|
+
run_helper() {
|
|
33
|
+
if command -p -v "$1" >/dev/null 2>&1 || ! command -v "$1" >/dev/null 2>&1; then command -p "$@"; else command "$@"; fi
|
|
34
|
+
}
|
|
35
|
+
self=$0
|
|
36
|
+
# MSYS and Cygwin can launch this with a native Windows path, which has no slash
|
|
37
|
+
# for `${self%/*}` to strip. Only a drive letter or a UNC prefix marks one; a
|
|
38
|
+
# backslash anywhere else is an ordinary character in a Unix file name, so the
|
|
39
|
+
# path is left alone. The separators are swapped in the shell rather than through
|
|
40
|
+
# `echo`, which mangles a `\t` or `\b` in a path under dash.
|
|
41
|
+
case $self in
|
|
42
|
+
[A-Za-z]:\\*|\\\\*)
|
|
43
|
+
while :; do
|
|
44
|
+
case $self in
|
|
45
|
+
*\\*) self=${self%%\\*}/${self#*\\} ;;
|
|
46
|
+
*) break ;;
|
|
47
|
+
esac
|
|
48
|
+
done
|
|
49
|
+
;;
|
|
50
|
+
esac
|
|
51
|
+
# `${self%/*}` needs a slash to strip. A bare name came from a `PATH` lookup and
|
|
52
|
+
# stands for a file in the current directory.
|
|
53
|
+
case $self in
|
|
54
|
+
*/*) ;;
|
|
55
|
+
*) self=./$self ;;
|
|
56
|
+
esac
|
|
57
|
+
hops=0
|
|
58
|
+
while [ -L "$self" ] && [ "$hops" -lt 40 ]; do
|
|
59
|
+
hops=$((hops + 1))
|
|
60
|
+
link=$(run_helper readlink "$self")
|
|
61
|
+
case $link in
|
|
62
|
+
/*) self=$link ;;
|
|
63
|
+
*) self=${self%/*}/$link ;;
|
|
64
|
+
esac
|
|
65
|
+
done
|
|
66
|
+
if [ -n "$caller_path_set" ]; then PATH=$caller_path; else unset PATH; fi
|
|
67
|
+
# The walk has to end at a regular file. Running out of hops leaves $self a
|
|
68
|
+
# symlink; a chain that changed under us can leave it dangling or a directory, and
|
|
69
|
+
# a failed readlink leaves a trailing slash. Each case would take `pnpm` from the
|
|
70
|
+
# wrong directory — the substitution this script exists to prevent.
|
|
71
|
+
if [ -L "$self" ] || [ ! -f "$self" ]; then
|
|
72
|
+
echo "pnpx: could not resolve $0 to a regular file within 40 symlink hops." >&2
|
|
73
|
+
exit 1
|
|
74
|
+
fi
|
|
75
|
+
|
|
76
|
+
exec "${self%/*}/pnpm" dlx "$@"
|
package/pnx
CHANGED
|
@@ -1,2 +1,76 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
# Shebang-less for the reason ./pnpm gives: install.js puts the native binary
|
|
2
|
+
# at this path too.
|
|
3
|
+
#
|
|
4
|
+
# `pnx` is `pnpm dlx`. The pnpm it hands over to is the one installed alongside
|
|
5
|
+
# it, found relative to this file: a `PATH` lookup would run whatever other pnpm
|
|
6
|
+
# comes first there, and would find nothing at all when the directory holding
|
|
7
|
+
# these bins is not on `PATH`.
|
|
8
|
+
#
|
|
9
|
+
# $0 is whatever shim or symlink `pnx` was launched through, so walk to the file
|
|
10
|
+
# itself first. The hop cap matches the kernel's ELOOP limit, so a cycle cannot
|
|
11
|
+
# hang the script. Directories come from `${self%/*}` and `readlink` runs through
|
|
12
|
+
# `command -p`, so the caller's `PATH` decides nothing here.
|
|
13
|
+
#
|
|
14
|
+
# A helper the default path lacks, as in a Nix build sandbox, comes from PATH
|
|
15
|
+
# instead, with node_modules and relative entries dropped from it.
|
|
16
|
+
caller_path_set=${PATH+set}
|
|
17
|
+
caller_path=${PATH-}
|
|
18
|
+
helper_path=
|
|
19
|
+
rest=$caller_path:
|
|
20
|
+
while [ -n "$rest" ]; do
|
|
21
|
+
dir=${rest%%:*}
|
|
22
|
+
rest=${rest#*:}
|
|
23
|
+
case "$dir" in
|
|
24
|
+
*/node_modules/*|*/node_modules) ;;
|
|
25
|
+
/*) helper_path=${helper_path:+$helper_path:}$dir ;;
|
|
26
|
+
esac
|
|
27
|
+
done
|
|
28
|
+
# An empty PATH searches the current directory.
|
|
29
|
+
PATH=${helper_path:-/}
|
|
30
|
+
# A helper comes from PATH only when the default path lacks it and PATH has it.
|
|
31
|
+
# The bash 3.2 that macOS ships as sh answers `command -p -v` from PATH.
|
|
32
|
+
run_helper() {
|
|
33
|
+
if command -p -v "$1" >/dev/null 2>&1 || ! command -v "$1" >/dev/null 2>&1; then command -p "$@"; else command "$@"; fi
|
|
34
|
+
}
|
|
35
|
+
self=$0
|
|
36
|
+
# MSYS and Cygwin can launch this with a native Windows path, which has no slash
|
|
37
|
+
# for `${self%/*}` to strip. Only a drive letter or a UNC prefix marks one; a
|
|
38
|
+
# backslash anywhere else is an ordinary character in a Unix file name, so the
|
|
39
|
+
# path is left alone. The separators are swapped in the shell rather than through
|
|
40
|
+
# `echo`, which mangles a `\t` or `\b` in a path under dash.
|
|
41
|
+
case $self in
|
|
42
|
+
[A-Za-z]:\\*|\\\\*)
|
|
43
|
+
while :; do
|
|
44
|
+
case $self in
|
|
45
|
+
*\\*) self=${self%%\\*}/${self#*\\} ;;
|
|
46
|
+
*) break ;;
|
|
47
|
+
esac
|
|
48
|
+
done
|
|
49
|
+
;;
|
|
50
|
+
esac
|
|
51
|
+
# `${self%/*}` needs a slash to strip. A bare name came from a `PATH` lookup and
|
|
52
|
+
# stands for a file in the current directory.
|
|
53
|
+
case $self in
|
|
54
|
+
*/*) ;;
|
|
55
|
+
*) self=./$self ;;
|
|
56
|
+
esac
|
|
57
|
+
hops=0
|
|
58
|
+
while [ -L "$self" ] && [ "$hops" -lt 40 ]; do
|
|
59
|
+
hops=$((hops + 1))
|
|
60
|
+
link=$(run_helper readlink "$self")
|
|
61
|
+
case $link in
|
|
62
|
+
/*) self=$link ;;
|
|
63
|
+
*) self=${self%/*}/$link ;;
|
|
64
|
+
esac
|
|
65
|
+
done
|
|
66
|
+
if [ -n "$caller_path_set" ]; then PATH=$caller_path; else unset PATH; fi
|
|
67
|
+
# The walk has to end at a regular file. Running out of hops leaves $self a
|
|
68
|
+
# symlink; a chain that changed under us can leave it dangling or a directory, and
|
|
69
|
+
# a failed readlink leaves a trailing slash. Each case would take `pnpm` from the
|
|
70
|
+
# wrong directory — the substitution this script exists to prevent.
|
|
71
|
+
if [ -L "$self" ] || [ ! -f "$self" ]; then
|
|
72
|
+
echo "pnx: could not resolve $0 to a regular file within 40 symlink hops." >&2
|
|
73
|
+
exit 1
|
|
74
|
+
fi
|
|
75
|
+
|
|
76
|
+
exec "${self%/*}/pnpm" dlx "$@"
|