pnpm 11.28.2 → 11.28.4
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/CHANGELOG.md +159 -0
- package/dist/node_modules/.bin/node-gyp +14 -7
- package/dist/node_modules/.bin/node-which +14 -7
- package/dist/node_modules/.bin/nopt +14 -7
- package/dist/node_modules/.bin/semver +14 -7
- package/dist/node_modules/undici/lib/core/request.js +68 -2
- package/dist/node_modules/undici/lib/dispatcher/client-h1.js +18 -7
- package/dist/node_modules/undici/lib/dispatcher/client-h2.js +70 -18
- package/dist/node_modules/undici/lib/handler/retry-handler.js +4 -1
- package/dist/node_modules/undici/package.json +1 -1
- package/dist/pnpm.mjs +167140 -155775
- package/dist/worker.js +12212 -12001
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,164 @@
|
|
|
1
1
|
# pnpm
|
|
2
2
|
|
|
3
|
+
## 11.28.4
|
|
4
|
+
|
|
5
|
+
pnpm 11.28.4 fixes two ways credentials could leak, makes `pnpm install --frozen-lockfile` accept several lockfiles it rejected, warns when an optional dependency cannot be fetched, and stops `pnpm self-update` from installing a second pnpm next to a Homebrew one.
|
|
6
|
+
|
|
7
|
+
### Patch Changes
|
|
8
|
+
|
|
9
|
+
- `pnpm login` no longer forwards credentials in its request body to another origin during redirects.
|
|
10
|
+
|
|
11
|
+
- The error for a tarball that fails its integrity check no longer prints credentials, query strings, or fragments from the tarball URL.
|
|
12
|
+
|
|
13
|
+
#### Installing packages
|
|
14
|
+
|
|
15
|
+
- `pnpm install --frozen-lockfile` now succeeds in a project with no dependencies when `pnpm-lock.yaml` records only the pinned pnpm version. Other commands write such a lockfile when they run before the first install. A lockfile missing the `---` line after that section is accepted too [#16477](https://github.com/pnpm/pnpm/issues/16477).
|
|
16
|
+
|
|
17
|
+
- `pnpm install --frozen-lockfile` again succeeds when a workspace project recorded in `pnpm-lock.yaml` has no directory, such as a project left out of a Docker build context. It still fails if the project's directory exists without a `package.json` [#16453](https://github.com/pnpm/pnpm/issues/16453).
|
|
18
|
+
|
|
19
|
+
- `pnpm install --frozen-lockfile` no longer fails with `ERR_PNPM_OUTDATED_LOCKFILE` for a workspace project that declares `dependenciesMeta` and whose dependencies are all workspace links. pnpm now records that project's `dependenciesMeta` in `pnpm-lock.yaml` [#16457](https://github.com/pnpm/pnpm/issues/16457).
|
|
20
|
+
|
|
21
|
+
- Fixed frozen installs replacing a hoisted dependency with a workspace package of the same name. A later `pnpm dedupe` then removed the hoisted link [#16485](https://github.com/pnpm/pnpm/issues/16485).
|
|
22
|
+
|
|
23
|
+
- With `enableGlobalVirtualStore` on, scripts can run entry points that a CommonJS require hook loads again, such as `ts-node index.ts`. They failed with `ERR_UNKNOWN_FILE_EXTENSION` on Node.js versions without built-in TypeScript support [#16436](https://github.com/pnpm/pnpm/issues/16436).
|
|
24
|
+
|
|
25
|
+
#### Optional dependencies
|
|
26
|
+
|
|
27
|
+
- `pnpm install` now prints a warning with the error when an optional dependency cannot be fetched and is skipped. The skipped package is no longer linked into `node_modules` as a broken symlink or listed among the added dependencies. The `pnpm:skipped-optional-dependency` log reports the skip with the `fetch_failure` reason [#16514](https://github.com/pnpm/pnpm/issues/16514).
|
|
28
|
+
|
|
29
|
+
- When an optional dependency fails to build, pnpm now removes its link from `node_modules`. A repeat `pnpm install` then reports "Already up to date" and no longer reruns the failing build [#16468](https://github.com/pnpm/pnpm/issues/16468).
|
|
30
|
+
|
|
31
|
+
- Fixed frozen installs creating symlinks to the working directory for skipped optional dependencies and unresolved peer dependencies [#16454](https://github.com/pnpm/pnpm/issues/16454).
|
|
32
|
+
|
|
33
|
+
#### Hoisted node_modules
|
|
34
|
+
|
|
35
|
+
- With `nodeLinker: hoisted`, a filtered install now keeps the packages of the workspace projects an earlier install put in `node_modules`. This also covers the install that `pnpm --filter <selector> run` and `pnpm --filter <selector> exec` start before the command. Before, these installs removed every package that only the unselected projects needed [#16483](https://github.com/pnpm/pnpm/issues/16483).
|
|
36
|
+
|
|
37
|
+
A filtered install of a workspace project also no longer fails with `ERR_PNPM_LOCKFILE_MISSING_DEPENDENCY` after a filtered install of another project.
|
|
38
|
+
|
|
39
|
+
- `pnpm install` with `nodeLinker: hoisted` now refreshes directories supplied by custom fetchers when reinstalling.
|
|
40
|
+
|
|
41
|
+
#### Speed and network
|
|
42
|
+
|
|
43
|
+
- pnpm now revalidates cached registry metadata with a conditional request, so the registry can answer `304 Not Modified`. Before, pnpm downloaded the whole document again for registries whose responses forbid caching, such as `Cache-Control: no-store` [#16528](https://github.com/pnpm/pnpm/issues/16528), and for packages published within `minimumReleaseAge` [#16506](https://github.com/pnpm/pnpm/issues/16506).
|
|
44
|
+
|
|
45
|
+
- A fetch timeout while other downloads from the same host are still running now lowers concurrency for that host to one connection. Retries of that request, and later downloads from that host, use the lower concurrency. Other hosts keep the configured concurrency [#12791](https://github.com/pnpm/pnpm/issues/12791).
|
|
46
|
+
|
|
47
|
+
#### Running scripts
|
|
48
|
+
|
|
49
|
+
- Scripts run without a terminal no longer start a second `sh` each. One watchdog per pnpm command now ends every script's process group if pnpm is killed, so `pnpm -r run` across many projects starts half as many processes [#16489](https://github.com/pnpm/pnpm/issues/16489).
|
|
50
|
+
|
|
51
|
+
- `pnpm run` and `pnpm exec` now warn and run the command when the install that `verifyDepsBeforeRun` starts fails. This lets scripts run in sandboxes where pnpm cannot install, such as containers with a read-only store or no network [#15173](https://github.com/pnpm/pnpm/issues/15173).
|
|
52
|
+
|
|
53
|
+
- A filtered `pnpm run` or `pnpm exec` now finds dependencies out of date when a workspace dependency of a selected project has no `node_modules` directory, as after a filtered install. With `verifyDepsBeforeRun: install`, pnpm installs that dependency before running the command [pnpm/tasks#45](https://github.com/pnpm/tasks/issues/45).
|
|
54
|
+
|
|
55
|
+
- `pnpm rebuild` and `pnpm approve-builds` refresh command launchers when a build changes a command's interpreter or replaces it with a native executable. Dependent packages' build scripts use the refreshed launchers.
|
|
56
|
+
|
|
57
|
+
#### Updating pnpm
|
|
58
|
+
|
|
59
|
+
- `pnpm self-update` now fails for Homebrew-installed pnpm and prints the `brew upgrade` command for the installed formula, such as `brew upgrade pnpm` or `brew upgrade pnpm@11`. It used to install a second copy of pnpm that the Homebrew one kept shadowing [#16547](https://github.com/pnpm/pnpm/issues/16547).
|
|
60
|
+
|
|
61
|
+
- On Windows, `pnpm self-update` now replaces a `pnpm.exe` left in `PNPM_HOME` or in `PNPM_HOME\bin`. In `PNPM_HOME`, that executable kept running the old version after a successful update. In `PNPM_HOME\bin`, the update failed with `EPERM`. If the executable was in `PNPM_HOME`, `self-update` now asks you to run `pnpm setup` [#9094](https://github.com/pnpm/pnpm/issues/9094).
|
|
62
|
+
|
|
63
|
+
- pnpm can now switch to a `packageManager` version below 11 on x64 musl Linux, such as Alpine [#16467](https://github.com/pnpm/pnpm/issues/16467).
|
|
64
|
+
|
|
65
|
+
- A `devEngines.packageManager` range now records the running pnpm in `pnpm-lock.yaml` only if it meets `minimumReleaseAge`. Otherwise pnpm records the newest version in the range that meets it. If no version in the range does, pnpm still records the running pnpm [#16431](https://github.com/pnpm/pnpm/issues/16431).
|
|
66
|
+
|
|
67
|
+
#### Filtering, settings, and other commands
|
|
68
|
+
|
|
69
|
+
- The `[<since>]` filter selector works again with Git 2.24 through 2.27 [#16561](https://github.com/pnpm/pnpm/issues/16561). With Git older than 2.24, the selector now fails with an error that names the required Git version.
|
|
70
|
+
|
|
71
|
+
- Package-name filters now support `?` to match one character [#2817](https://github.com/pnpm/pnpm/issues/2817).
|
|
72
|
+
|
|
73
|
+
- `pnpm -r pkg get` now reports every selected project when several share a package name. Projects with the same name are keyed by their directory relative to the workspace root. Before, only one of them appeared in the output.
|
|
74
|
+
|
|
75
|
+
- pnpm now reports an `INVALID_SETTING` error when `allowUnusedPatches` in `pnpm-workspace.yaml` is not a boolean, or when `ignoredOptionalDependencies` or `requiredScripts` is not an array of strings. A quoted `allowUnusedPatches` value such as `"false"` was treated as `true`.
|
|
76
|
+
|
|
77
|
+
- `pnpm store path`, `pnpm store status`, and other commands that look up the default store no longer fail when the current directory is not writable. pnpm now uses the store in the pnpm home directory in that case [#16554](https://github.com/pnpm/pnpm/issues/16554).
|
|
78
|
+
|
|
79
|
+
## 11.28.3
|
|
80
|
+
|
|
81
|
+
pnpm 11.28.3 updates `undici` to clear a security advisory, fixes "database disk image is malformed" errors when several pnpm processes share a store, and makes packages, catalogs, projects, and commands named like `constructor` work.
|
|
82
|
+
|
|
83
|
+
### Patch Changes
|
|
84
|
+
|
|
85
|
+
#### Installing packages
|
|
86
|
+
|
|
87
|
+
- pnpm now ships `undici` 7.29.1, so security scans of pnpm no longer report [GHSA-3wwx-pv8p-q78v](https://github.com/advisories/GHSA-3wwx-pv8p-q78v).
|
|
88
|
+
|
|
89
|
+
- pnpm no longer fails with "database disk image is malformed" or reads stale store entries while another pnpm process writes to the same store.
|
|
90
|
+
|
|
91
|
+
- Names that match built-in JavaScript object properties, such as `constructor`, `toString`, or `__proto__`, now work like any other name. pnpm crashed, wrote a wrong lockfile, or silently skipped such names in:
|
|
92
|
+
|
|
93
|
+
- `pnpm add`, `pnpm install`, and `pnpm import`, for dependencies, peer dependencies, and `file:` dependencies that point to a directory named `constructor`.
|
|
94
|
+
- Catalog entries and catalog names. Pruning unused entries crashed, and a new catalog named `toString` was not written.
|
|
95
|
+
- Workspace projects, project directories, and files inside injected packages.
|
|
96
|
+
- Registry prefixes and override version references such as `$toString`.
|
|
97
|
+
- Hoisting, `pnpm list`, and `pnpm why`.
|
|
98
|
+
- Command names. `pnpm constructor` runs the `constructor` script like any other unknown command, and `pnpm help constructor` no longer crashes.
|
|
99
|
+
- Resolving through a pnpr server when a project lives in a directory named `constructor`.
|
|
100
|
+
|
|
101
|
+
- `pnpm install` no longer re-resolves an up-to-date lockfile on every run when a patched package is a peer in a peer cycle [#16418](https://github.com/pnpm/pnpm/issues/16418).
|
|
102
|
+
|
|
103
|
+
- POSIX bin shims and the `pnpm`, `pn`, `pnpx`, and `pnx` launchers now run inside a Nix build, where the system default path holds none of the utilities they call. Installing again replaces the shims already in `node_modules` [#16377](https://github.com/pnpm/pnpm/issues/16377).
|
|
104
|
+
|
|
105
|
+
- In a project that pins another pnpm version, pnpm now passes a command with an option it does not know to the pinned version. Before, `pnpm install --auto-dedupe` failed with "Unknown option" even though the pinned pnpm supports it [#16353](https://github.com/pnpm/pnpm/issues/16353).
|
|
106
|
+
|
|
107
|
+
- pnpm now fails with `ERR_PNPM_INVALID_ALLOW_BUILDS` when `allowBuilds` is not an object or one of its values is not `true`, `false`, or a string. Such values used to be ignored silently.
|
|
108
|
+
|
|
109
|
+
- Removing a dependency whose bins are declared through `directories.bin` no longer leaves broken shims in `node_modules/.bin`.
|
|
110
|
+
|
|
111
|
+
- A custom resolver's `shouldRefreshResolution` hook that rejects no longer crashes pnpm with an unhandled rejection when another hook has already asked for a refresh.
|
|
112
|
+
|
|
113
|
+
#### Updating dependencies
|
|
114
|
+
|
|
115
|
+
- When `minimumReleaseAge` hides the version that `latest` points to, pnpm now falls back to a prerelease of the same major before a stable version of an older major. A stable version of the same major is still preferred. For example, while a new `1.0.0` is too new, pnpm picks `1.0.0-beta.4` rather than an old `0.0.1` [#16388](https://github.com/pnpm/pnpm/issues/16388).
|
|
116
|
+
|
|
117
|
+
- `pnpm --filter <project> update <pkg>` now fails with `ERR_PNPM_NO_PACKAGE_IN_DEPENDENCIES` when the selected projects do not depend on `<pkg>`, also in a workspace with a shared lockfile and a root project. It used to exit successfully.
|
|
118
|
+
|
|
119
|
+
- `pnpm audit --fix` now updates vulnerable packages in a single project that sets `updateConfig.ignoreDependencies`. It used to leave them on the vulnerable version.
|
|
120
|
+
|
|
121
|
+
- `pnpm update --global` now removes hard-linked executables from `PNPM_HOME` when migrating packages from the old global layout [#16420](https://github.com/pnpm/pnpm/issues/16420).
|
|
122
|
+
|
|
123
|
+
- Updating a pinned GitHub Action now rewrites the version in its `# vX.Y.Z` comment even when the action name contains the same version text. The action name used to change while the comment kept the old version.
|
|
124
|
+
|
|
125
|
+
#### Workspaces and deploy
|
|
126
|
+
|
|
127
|
+
- `pnpm deploy` no longer fails with `ERR_PNPM_DEPLOY_AMBIGUOUS_PEER` in a workspace with `injectWorkspacePackages: true` when a workspace package also lists its peer dependency as a dev dependency [#16375](https://github.com/pnpm/pnpm/issues/16375).
|
|
128
|
+
|
|
129
|
+
- `pnpm deploy` no longer copies the workspace root's `packageManager` and `devEngines.packageManager` fields into the deployed `package.json` [#16403](https://github.com/pnpm/pnpm/issues/16403).
|
|
130
|
+
|
|
131
|
+
- `--filter` fixes:
|
|
132
|
+
|
|
133
|
+
- A `...pkg...` selector combined with another dependents selector, such as `--filter ...a --filter ...b...`, no longer adds the dependencies of the other selector's dependents.
|
|
134
|
+
- `--filter "[<since>]"` now detects changes in projects whose directory names contain non-ASCII characters. The change used to be credited to the parent project.
|
|
135
|
+
|
|
136
|
+
#### Running scripts
|
|
137
|
+
|
|
138
|
+
- After relaying a signal to a script, pnpm keeps waiting for a process in the script's process group whose main thread has exited while its other threads still run. Linux reports such a process as a zombie, so the wait used to end before those threads finished [pnpm/tasks#56](https://github.com/pnpm/tasks/issues/56).
|
|
139
|
+
|
|
140
|
+
- A lifecycle script run with `unsafePerm: false` now fails with an error when pnpm cannot create `node_modules/.tmp`. It used to hang.
|
|
141
|
+
|
|
142
|
+
- `pnpm run` with `verifyDepsBeforeRun` no longer crashes with an unhandled rejection when a lockfile it did not need to compare fails to load.
|
|
143
|
+
|
|
144
|
+
- `pnpm run -r` now closes the collapsible CI log section of a project whose script fails, so the output of later projects is no longer nested inside it.
|
|
145
|
+
|
|
146
|
+
- `pnpm run --resume-from` no longer crashes when a saved run state file contains `null`.
|
|
147
|
+
|
|
148
|
+
#### Store
|
|
149
|
+
|
|
150
|
+
- `pnpm store prune` now removes the packages that only expired `pnpm dlx` cache entries used, as long as the store still has another registered project. They used to stay until the next `pnpm store prune` [#16383](https://github.com/pnpm/pnpm/discussions/16383).
|
|
151
|
+
|
|
152
|
+
- `pnpm store prune` now stops with an error when it cannot read a project directory for a reason other than the directory missing, such as a permission error. It used to skip the directory.
|
|
153
|
+
|
|
154
|
+
#### Publishing and registry output
|
|
155
|
+
|
|
156
|
+
- `pnpm publish` now includes bare `README` files and README files with Markdown extensions such as `readme.markdown` in registry metadata [#12704](https://github.com/pnpm/pnpm/issues/12704).
|
|
157
|
+
|
|
158
|
+
- `pnpm pack-app` now accepts an entry file or output directory inside the project whose name starts with two dots, such as `..build/entry.cjs`. It used to fail with `ERR_PNPM_PACK_APP_ENTRY_OUTSIDE_PROJECT`.
|
|
159
|
+
|
|
160
|
+
- Registry error messages now always say "(response body truncated)" when pnpm cut the response body short. The marker was missing when the body was cut at exactly 64 KiB.
|
|
161
|
+
|
|
3
162
|
## 11.28.2
|
|
4
163
|
|
|
5
164
|
pnpm 11.28.2 fixes `pnpm install` skipping every workspace project whose common ancestor is the filesystem root, and stops `pnpm run` from reinstalling or installing when nothing needs it.
|
|
@@ -8,9 +8,8 @@
|
|
|
8
8
|
# the shim before it reaches its target. Directories come from `${link%/*}`,
|
|
9
9
|
# which needs no helper at all.
|
|
10
10
|
#
|
|
11
|
-
#
|
|
12
|
-
# instead,
|
|
13
|
-
# PATH.
|
|
11
|
+
# A helper the default path lacks, as in a Nix build sandbox, comes from PATH
|
|
12
|
+
# instead, with node_modules and relative entries dropped from it.
|
|
14
13
|
caller_path_set=${PATH+set}
|
|
15
14
|
caller_path=${PATH-}
|
|
16
15
|
helper_path=
|
|
@@ -25,6 +24,11 @@ while [ -n "$rest" ]; do
|
|
|
25
24
|
done
|
|
26
25
|
# An empty PATH searches the current directory.
|
|
27
26
|
PATH=${helper_path:-/}
|
|
27
|
+
# A helper comes from PATH only when the default path lacks it and PATH has it.
|
|
28
|
+
# The bash 3.2 that macOS ships as sh answers `command -p -v` from PATH.
|
|
29
|
+
run_helper() {
|
|
30
|
+
if command -p -v "$1" >/dev/null 2>&1 || ! command -v "$1" >/dev/null 2>&1; then command -p "$@"; else command "$@"; fi
|
|
31
|
+
}
|
|
28
32
|
link="$0"
|
|
29
33
|
# `${link%/*}` needs a separator to strip. A bare name came from a PATH lookup
|
|
30
34
|
# and stands for a file in the current directory.
|
|
@@ -35,19 +39,21 @@ esac
|
|
|
35
39
|
hops=0
|
|
36
40
|
while [ -L "$link" ] && [ "$hops" -lt 40 ]; do
|
|
37
41
|
hops=$((hops+1))
|
|
38
|
-
target=$(
|
|
42
|
+
target=$(run_helper readlink "$link")
|
|
39
43
|
case "$target" in
|
|
40
44
|
/*) link="$target" ;;
|
|
41
45
|
*) link="${link%/*}/$target" ;;
|
|
42
46
|
esac
|
|
43
47
|
done
|
|
44
|
-
basedir=$(
|
|
48
|
+
basedir=$(run_helper printf '%s\n' "$link" | run_helper sed -e 's,\\,/,g')
|
|
45
49
|
basedir="${basedir%/*}"
|
|
50
|
+
basedir_abs=$(CDPATH= cd -P -- "$basedir" && pwd -P) || exit $?
|
|
51
|
+
basedir="$basedir_abs"
|
|
46
52
|
basedir_win="$basedir"
|
|
47
53
|
exe=""
|
|
48
54
|
msys=""
|
|
49
55
|
|
|
50
|
-
case `
|
|
56
|
+
case `run_helper uname -a` in
|
|
51
57
|
*CYGWIN*|*MINGW*|*MSYS*)
|
|
52
58
|
if converted=$(command -p cygpath -w "$basedir" 2>/dev/null) && [ -n "$converted" ]; then
|
|
53
59
|
basedir_win="$converted"
|
|
@@ -73,11 +79,12 @@ case `command -p uname -a` in
|
|
|
73
79
|
esac
|
|
74
80
|
if [ -n "$caller_path_set" ]; then PATH=$caller_path; else unset PATH; fi
|
|
75
81
|
|
|
76
|
-
basedir_abs=$(CDPATH= cd -P -- "$basedir" && pwd -P) || exit $?
|
|
77
82
|
if [ -n "$exe" ] && [ -x "$basedir/node.exe" ]; then
|
|
78
83
|
exec "$basedir/node.exe" "$basedir_win/../node-gyp/bin/node-gyp.js" "$@"
|
|
79
84
|
elif [ -x "$basedir/node" ]; then
|
|
80
85
|
exec "$basedir/node" "$basedir_abs/../node-gyp/bin/node-gyp.js" "$@"
|
|
86
|
+
elif [ -n "$msys" ] && command -v node >/dev/null 2>&1; then
|
|
87
|
+
exec node "$basedir_win/../node-gyp/bin/node-gyp.js" "$@"
|
|
81
88
|
elif command -v node >/dev/null 2>&1; then
|
|
82
89
|
exec node "$basedir_abs/../node-gyp/bin/node-gyp.js" "$@"
|
|
83
90
|
elif [ -n "$exe" ] && command -v node.exe >/dev/null 2>&1; then
|
|
@@ -8,9 +8,8 @@
|
|
|
8
8
|
# the shim before it reaches its target. Directories come from `${link%/*}`,
|
|
9
9
|
# which needs no helper at all.
|
|
10
10
|
#
|
|
11
|
-
#
|
|
12
|
-
# instead,
|
|
13
|
-
# PATH.
|
|
11
|
+
# A helper the default path lacks, as in a Nix build sandbox, comes from PATH
|
|
12
|
+
# instead, with node_modules and relative entries dropped from it.
|
|
14
13
|
caller_path_set=${PATH+set}
|
|
15
14
|
caller_path=${PATH-}
|
|
16
15
|
helper_path=
|
|
@@ -25,6 +24,11 @@ while [ -n "$rest" ]; do
|
|
|
25
24
|
done
|
|
26
25
|
# An empty PATH searches the current directory.
|
|
27
26
|
PATH=${helper_path:-/}
|
|
27
|
+
# A helper comes from PATH only when the default path lacks it and PATH has it.
|
|
28
|
+
# The bash 3.2 that macOS ships as sh answers `command -p -v` from PATH.
|
|
29
|
+
run_helper() {
|
|
30
|
+
if command -p -v "$1" >/dev/null 2>&1 || ! command -v "$1" >/dev/null 2>&1; then command -p "$@"; else command "$@"; fi
|
|
31
|
+
}
|
|
28
32
|
link="$0"
|
|
29
33
|
# `${link%/*}` needs a separator to strip. A bare name came from a PATH lookup
|
|
30
34
|
# and stands for a file in the current directory.
|
|
@@ -35,19 +39,21 @@ esac
|
|
|
35
39
|
hops=0
|
|
36
40
|
while [ -L "$link" ] && [ "$hops" -lt 40 ]; do
|
|
37
41
|
hops=$((hops+1))
|
|
38
|
-
target=$(
|
|
42
|
+
target=$(run_helper readlink "$link")
|
|
39
43
|
case "$target" in
|
|
40
44
|
/*) link="$target" ;;
|
|
41
45
|
*) link="${link%/*}/$target" ;;
|
|
42
46
|
esac
|
|
43
47
|
done
|
|
44
|
-
basedir=$(
|
|
48
|
+
basedir=$(run_helper printf '%s\n' "$link" | run_helper sed -e 's,\\,/,g')
|
|
45
49
|
basedir="${basedir%/*}"
|
|
50
|
+
basedir_abs=$(CDPATH= cd -P -- "$basedir" && pwd -P) || exit $?
|
|
51
|
+
basedir="$basedir_abs"
|
|
46
52
|
basedir_win="$basedir"
|
|
47
53
|
exe=""
|
|
48
54
|
msys=""
|
|
49
55
|
|
|
50
|
-
case `
|
|
56
|
+
case `run_helper uname -a` in
|
|
51
57
|
*CYGWIN*|*MINGW*|*MSYS*)
|
|
52
58
|
if converted=$(command -p cygpath -w "$basedir" 2>/dev/null) && [ -n "$converted" ]; then
|
|
53
59
|
basedir_win="$converted"
|
|
@@ -73,11 +79,12 @@ case `command -p uname -a` in
|
|
|
73
79
|
esac
|
|
74
80
|
if [ -n "$caller_path_set" ]; then PATH=$caller_path; else unset PATH; fi
|
|
75
81
|
|
|
76
|
-
basedir_abs=$(CDPATH= cd -P -- "$basedir" && pwd -P) || exit $?
|
|
77
82
|
if [ -n "$exe" ] && [ -x "$basedir/node.exe" ]; then
|
|
78
83
|
exec "$basedir/node.exe" "$basedir_win/../which/bin/which.js" "$@"
|
|
79
84
|
elif [ -x "$basedir/node" ]; then
|
|
80
85
|
exec "$basedir/node" "$basedir_abs/../which/bin/which.js" "$@"
|
|
86
|
+
elif [ -n "$msys" ] && command -v node >/dev/null 2>&1; then
|
|
87
|
+
exec node "$basedir_win/../which/bin/which.js" "$@"
|
|
81
88
|
elif command -v node >/dev/null 2>&1; then
|
|
82
89
|
exec node "$basedir_abs/../which/bin/which.js" "$@"
|
|
83
90
|
elif [ -n "$exe" ] && command -v node.exe >/dev/null 2>&1; then
|
|
@@ -8,9 +8,8 @@
|
|
|
8
8
|
# the shim before it reaches its target. Directories come from `${link%/*}`,
|
|
9
9
|
# which needs no helper at all.
|
|
10
10
|
#
|
|
11
|
-
#
|
|
12
|
-
# instead,
|
|
13
|
-
# PATH.
|
|
11
|
+
# A helper the default path lacks, as in a Nix build sandbox, comes from PATH
|
|
12
|
+
# instead, with node_modules and relative entries dropped from it.
|
|
14
13
|
caller_path_set=${PATH+set}
|
|
15
14
|
caller_path=${PATH-}
|
|
16
15
|
helper_path=
|
|
@@ -25,6 +24,11 @@ while [ -n "$rest" ]; do
|
|
|
25
24
|
done
|
|
26
25
|
# An empty PATH searches the current directory.
|
|
27
26
|
PATH=${helper_path:-/}
|
|
27
|
+
# A helper comes from PATH only when the default path lacks it and PATH has it.
|
|
28
|
+
# The bash 3.2 that macOS ships as sh answers `command -p -v` from PATH.
|
|
29
|
+
run_helper() {
|
|
30
|
+
if command -p -v "$1" >/dev/null 2>&1 || ! command -v "$1" >/dev/null 2>&1; then command -p "$@"; else command "$@"; fi
|
|
31
|
+
}
|
|
28
32
|
link="$0"
|
|
29
33
|
# `${link%/*}` needs a separator to strip. A bare name came from a PATH lookup
|
|
30
34
|
# and stands for a file in the current directory.
|
|
@@ -35,19 +39,21 @@ esac
|
|
|
35
39
|
hops=0
|
|
36
40
|
while [ -L "$link" ] && [ "$hops" -lt 40 ]; do
|
|
37
41
|
hops=$((hops+1))
|
|
38
|
-
target=$(
|
|
42
|
+
target=$(run_helper readlink "$link")
|
|
39
43
|
case "$target" in
|
|
40
44
|
/*) link="$target" ;;
|
|
41
45
|
*) link="${link%/*}/$target" ;;
|
|
42
46
|
esac
|
|
43
47
|
done
|
|
44
|
-
basedir=$(
|
|
48
|
+
basedir=$(run_helper printf '%s\n' "$link" | run_helper sed -e 's,\\,/,g')
|
|
45
49
|
basedir="${basedir%/*}"
|
|
50
|
+
basedir_abs=$(CDPATH= cd -P -- "$basedir" && pwd -P) || exit $?
|
|
51
|
+
basedir="$basedir_abs"
|
|
46
52
|
basedir_win="$basedir"
|
|
47
53
|
exe=""
|
|
48
54
|
msys=""
|
|
49
55
|
|
|
50
|
-
case `
|
|
56
|
+
case `run_helper uname -a` in
|
|
51
57
|
*CYGWIN*|*MINGW*|*MSYS*)
|
|
52
58
|
if converted=$(command -p cygpath -w "$basedir" 2>/dev/null) && [ -n "$converted" ]; then
|
|
53
59
|
basedir_win="$converted"
|
|
@@ -73,11 +79,12 @@ case `command -p uname -a` in
|
|
|
73
79
|
esac
|
|
74
80
|
if [ -n "$caller_path_set" ]; then PATH=$caller_path; else unset PATH; fi
|
|
75
81
|
|
|
76
|
-
basedir_abs=$(CDPATH= cd -P -- "$basedir" && pwd -P) || exit $?
|
|
77
82
|
if [ -n "$exe" ] && [ -x "$basedir/node.exe" ]; then
|
|
78
83
|
exec "$basedir/node.exe" "$basedir_win/../nopt/bin/nopt.js" "$@"
|
|
79
84
|
elif [ -x "$basedir/node" ]; then
|
|
80
85
|
exec "$basedir/node" "$basedir_abs/../nopt/bin/nopt.js" "$@"
|
|
86
|
+
elif [ -n "$msys" ] && command -v node >/dev/null 2>&1; then
|
|
87
|
+
exec node "$basedir_win/../nopt/bin/nopt.js" "$@"
|
|
81
88
|
elif command -v node >/dev/null 2>&1; then
|
|
82
89
|
exec node "$basedir_abs/../nopt/bin/nopt.js" "$@"
|
|
83
90
|
elif [ -n "$exe" ] && command -v node.exe >/dev/null 2>&1; then
|
|
@@ -8,9 +8,8 @@
|
|
|
8
8
|
# the shim before it reaches its target. Directories come from `${link%/*}`,
|
|
9
9
|
# which needs no helper at all.
|
|
10
10
|
#
|
|
11
|
-
#
|
|
12
|
-
# instead,
|
|
13
|
-
# PATH.
|
|
11
|
+
# A helper the default path lacks, as in a Nix build sandbox, comes from PATH
|
|
12
|
+
# instead, with node_modules and relative entries dropped from it.
|
|
14
13
|
caller_path_set=${PATH+set}
|
|
15
14
|
caller_path=${PATH-}
|
|
16
15
|
helper_path=
|
|
@@ -25,6 +24,11 @@ while [ -n "$rest" ]; do
|
|
|
25
24
|
done
|
|
26
25
|
# An empty PATH searches the current directory.
|
|
27
26
|
PATH=${helper_path:-/}
|
|
27
|
+
# A helper comes from PATH only when the default path lacks it and PATH has it.
|
|
28
|
+
# The bash 3.2 that macOS ships as sh answers `command -p -v` from PATH.
|
|
29
|
+
run_helper() {
|
|
30
|
+
if command -p -v "$1" >/dev/null 2>&1 || ! command -v "$1" >/dev/null 2>&1; then command -p "$@"; else command "$@"; fi
|
|
31
|
+
}
|
|
28
32
|
link="$0"
|
|
29
33
|
# `${link%/*}` needs a separator to strip. A bare name came from a PATH lookup
|
|
30
34
|
# and stands for a file in the current directory.
|
|
@@ -35,19 +39,21 @@ esac
|
|
|
35
39
|
hops=0
|
|
36
40
|
while [ -L "$link" ] && [ "$hops" -lt 40 ]; do
|
|
37
41
|
hops=$((hops+1))
|
|
38
|
-
target=$(
|
|
42
|
+
target=$(run_helper readlink "$link")
|
|
39
43
|
case "$target" in
|
|
40
44
|
/*) link="$target" ;;
|
|
41
45
|
*) link="${link%/*}/$target" ;;
|
|
42
46
|
esac
|
|
43
47
|
done
|
|
44
|
-
basedir=$(
|
|
48
|
+
basedir=$(run_helper printf '%s\n' "$link" | run_helper sed -e 's,\\,/,g')
|
|
45
49
|
basedir="${basedir%/*}"
|
|
50
|
+
basedir_abs=$(CDPATH= cd -P -- "$basedir" && pwd -P) || exit $?
|
|
51
|
+
basedir="$basedir_abs"
|
|
46
52
|
basedir_win="$basedir"
|
|
47
53
|
exe=""
|
|
48
54
|
msys=""
|
|
49
55
|
|
|
50
|
-
case `
|
|
56
|
+
case `run_helper uname -a` in
|
|
51
57
|
*CYGWIN*|*MINGW*|*MSYS*)
|
|
52
58
|
if converted=$(command -p cygpath -w "$basedir" 2>/dev/null) && [ -n "$converted" ]; then
|
|
53
59
|
basedir_win="$converted"
|
|
@@ -73,11 +79,12 @@ case `command -p uname -a` in
|
|
|
73
79
|
esac
|
|
74
80
|
if [ -n "$caller_path_set" ]; then PATH=$caller_path; else unset PATH; fi
|
|
75
81
|
|
|
76
|
-
basedir_abs=$(CDPATH= cd -P -- "$basedir" && pwd -P) || exit $?
|
|
77
82
|
if [ -n "$exe" ] && [ -x "$basedir/node.exe" ]; then
|
|
78
83
|
exec "$basedir/node.exe" "$basedir_win/../semver/bin/semver.js" "$@"
|
|
79
84
|
elif [ -x "$basedir/node" ]; then
|
|
80
85
|
exec "$basedir/node" "$basedir_abs/../semver/bin/semver.js" "$@"
|
|
86
|
+
elif [ -n "$msys" ] && command -v node >/dev/null 2>&1; then
|
|
87
|
+
exec node "$basedir_win/../semver/bin/semver.js" "$@"
|
|
81
88
|
elif command -v node >/dev/null 2>&1; then
|
|
82
89
|
exec node "$basedir_abs/../semver/bin/semver.js" "$@"
|
|
83
90
|
elif [ -n "$exe" ] && command -v node.exe >/dev/null 2>&1; then
|
|
@@ -263,11 +263,77 @@ class Request {
|
|
|
263
263
|
}
|
|
264
264
|
}
|
|
265
265
|
|
|
266
|
-
|
|
266
|
+
/**
|
|
267
|
+
* @param {number|null} statusCode
|
|
268
|
+
* @param {Buffer[]|null} headers
|
|
269
|
+
* @param {import('node:stream').Duplex} socket
|
|
270
|
+
* @param {string} [statusText]
|
|
271
|
+
*/
|
|
272
|
+
onUpgrade (statusCode, headers, socket, statusText = '') {
|
|
273
|
+
this.onFinally()
|
|
274
|
+
|
|
267
275
|
assert(!this.aborted)
|
|
268
276
|
assert(!this.completed)
|
|
269
277
|
|
|
270
|
-
|
|
278
|
+
if (statusCode !== null) {
|
|
279
|
+
this.#publishUpgradeHeaders(statusCode, headers, statusText)
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
const result = this[kHandler].onUpgrade(statusCode, headers, socket)
|
|
283
|
+
|
|
284
|
+
if (!this.aborted) {
|
|
285
|
+
this.completed = true
|
|
286
|
+
if (statusCode !== null) {
|
|
287
|
+
this.#publishUpgradeTrailers()
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
return result
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* @param {number} statusCode
|
|
296
|
+
* @param {import('node:http2').IncomingHttpHeaders} headers
|
|
297
|
+
* @param {(headers: import('node:http2').IncomingHttpHeaders) => Buffer[]} parseHeaders
|
|
298
|
+
* @param {string} [statusText]
|
|
299
|
+
*/
|
|
300
|
+
onUpgradeResponse (statusCode, headers, parseHeaders, statusText = '') {
|
|
301
|
+
assert(!this.aborted)
|
|
302
|
+
assert(this.completed)
|
|
303
|
+
|
|
304
|
+
if (channels.headers.hasSubscribers) {
|
|
305
|
+
this.#publishUpgradeHeaders(statusCode, parseHeaders(headers), statusText)
|
|
306
|
+
}
|
|
307
|
+
this.#publishUpgradeTrailers()
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* @param {Error} error
|
|
312
|
+
*/
|
|
313
|
+
onUpgradeError (error) {
|
|
314
|
+
assert(!this.aborted)
|
|
315
|
+
assert(this.completed)
|
|
316
|
+
|
|
317
|
+
if (channels.error.hasSubscribers) {
|
|
318
|
+
channels.error.publish({ request: this, error })
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* @param {number} statusCode
|
|
324
|
+
* @param {Buffer[]} headers
|
|
325
|
+
* @param {string} statusText
|
|
326
|
+
*/
|
|
327
|
+
#publishUpgradeHeaders (statusCode, headers, statusText) {
|
|
328
|
+
if (channels.headers.hasSubscribers) {
|
|
329
|
+
channels.headers.publish({ request: this, response: { statusCode, headers, statusText } })
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
#publishUpgradeTrailers () {
|
|
334
|
+
if (channels.trailers.hasSubscribers) {
|
|
335
|
+
channels.trailers.publish({ request: this, trailers: [] })
|
|
336
|
+
}
|
|
271
337
|
}
|
|
272
338
|
|
|
273
339
|
onComplete (trailers) {
|
|
@@ -432,7 +432,7 @@ class Parser {
|
|
|
432
432
|
}
|
|
433
433
|
|
|
434
434
|
onUpgrade (head) {
|
|
435
|
-
const { upgrade, client, socket, headers, statusCode } = this
|
|
435
|
+
const { upgrade, client, socket, headers, statusCode, statusText } = this
|
|
436
436
|
|
|
437
437
|
assert(upgrade)
|
|
438
438
|
assert(client[kSocket] === socket)
|
|
@@ -467,9 +467,10 @@ class Parser {
|
|
|
467
467
|
client.emit('disconnect', client[kUrl], [client], new InformationalError('upgrade'))
|
|
468
468
|
|
|
469
469
|
try {
|
|
470
|
-
request.onUpgrade(statusCode, headers, socket)
|
|
471
|
-
} catch (
|
|
472
|
-
util.
|
|
470
|
+
request.onUpgrade(statusCode, headers, socket, statusText)
|
|
471
|
+
} catch (error) {
|
|
472
|
+
util.errorRequest(client, request, error)
|
|
473
|
+
util.destroy(socket, error)
|
|
473
474
|
}
|
|
474
475
|
|
|
475
476
|
client[kResume]()
|
|
@@ -1050,12 +1051,22 @@ function writeH1 (client, request) {
|
|
|
1050
1051
|
const socket = client[kSocket]
|
|
1051
1052
|
clearIdleSocketValidation(socket)
|
|
1052
1053
|
|
|
1053
|
-
|
|
1054
|
-
|
|
1054
|
+
/**
|
|
1055
|
+
* @param {Error} [error]
|
|
1056
|
+
*/
|
|
1057
|
+
const abort = (error) => {
|
|
1058
|
+
if (request.aborted) {
|
|
1059
|
+
return
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
if (request.completed) {
|
|
1063
|
+
if (request.upgrade || request.method === 'CONNECT') {
|
|
1064
|
+
util.destroy(socket, new InformationalError('aborted'))
|
|
1065
|
+
}
|
|
1055
1066
|
return
|
|
1056
1067
|
}
|
|
1057
1068
|
|
|
1058
|
-
util.errorRequest(client, request,
|
|
1069
|
+
util.errorRequest(client, request, error || new RequestAbortedError())
|
|
1059
1070
|
|
|
1060
1071
|
util.destroy(body)
|
|
1061
1072
|
util.destroy(socket, new InformationalError('aborted'))
|