@ohos-npm-ports/pnpm 12.8.1-1

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 (448) hide show
  1. package/README.md +280 -0
  2. package/THIRD-PARTY-NOTICES.md +42 -0
  3. package/bin/pnpm.mjs +144 -0
  4. package/bin/pnpx.mjs +9 -0
  5. package/dist/node-gyp-bin/node-gyp +6 -0
  6. package/dist/node-gyp-bin/node-gyp.cmd +5 -0
  7. package/dist/node_modules/.bin/get-pnpm +88 -0
  8. package/dist/node_modules/.bin/node-gyp +88 -0
  9. package/dist/node_modules/.bin/node-which +88 -0
  10. package/dist/node_modules/.bin/nopt +88 -0
  11. package/dist/node_modules/.bin/semver +88 -0
  12. package/dist/node_modules/.pnpm-workspace-state-v1.json +348 -0
  13. package/dist/node_modules/@isaacs/fs-minipass/LICENSE +15 -0
  14. package/dist/node_modules/@isaacs/fs-minipass/dist/commonjs/index.js +430 -0
  15. package/dist/node_modules/@isaacs/fs-minipass/dist/commonjs/package.json +3 -0
  16. package/dist/node_modules/@isaacs/fs-minipass/dist/esm/index.js +420 -0
  17. package/dist/node_modules/@isaacs/fs-minipass/dist/esm/package.json +3 -0
  18. package/dist/node_modules/@isaacs/fs-minipass/package.json +72 -0
  19. package/dist/node_modules/abbrev/LICENSE +46 -0
  20. package/dist/node_modules/abbrev/lib/index.js +53 -0
  21. package/dist/node_modules/abbrev/package.json +41 -0
  22. package/dist/node_modules/chownr/dist/commonjs/index.js +93 -0
  23. package/dist/node_modules/chownr/dist/commonjs/package.json +3 -0
  24. package/dist/node_modules/chownr/dist/esm/index.js +85 -0
  25. package/dist/node_modules/chownr/dist/esm/package.json +3 -0
  26. package/dist/node_modules/chownr/package.json +69 -0
  27. package/dist/node_modules/env-paths/index.js +74 -0
  28. package/dist/node_modules/env-paths/license +9 -0
  29. package/dist/node_modules/env-paths/package.json +45 -0
  30. package/dist/node_modules/exponential-backoff/LICENSE +202 -0
  31. package/dist/node_modules/exponential-backoff/dist/backoff.js +124 -0
  32. package/dist/node_modules/exponential-backoff/dist/delay/always/always.delay.js +25 -0
  33. package/dist/node_modules/exponential-backoff/dist/delay/delay.base.js +45 -0
  34. package/dist/node_modules/exponential-backoff/dist/delay/delay.factory.js +17 -0
  35. package/dist/node_modules/exponential-backoff/dist/delay/delay.interface.js +3 -0
  36. package/dist/node_modules/exponential-backoff/dist/delay/skip-first/skip-first.delay.js +82 -0
  37. package/dist/node_modules/exponential-backoff/dist/jitter/full/full.jitter.js +8 -0
  38. package/dist/node_modules/exponential-backoff/dist/jitter/jitter.factory.js +15 -0
  39. package/dist/node_modules/exponential-backoff/dist/jitter/no/no.jitter.js +7 -0
  40. package/dist/node_modules/exponential-backoff/dist/options.js +31 -0
  41. package/dist/node_modules/exponential-backoff/package.json +62 -0
  42. package/dist/node_modules/fdir/LICENSE +7 -0
  43. package/dist/node_modules/fdir/dist/index.cjs +588 -0
  44. package/dist/node_modules/fdir/dist/index.d.cts +155 -0
  45. package/dist/node_modules/fdir/dist/index.d.mts +155 -0
  46. package/dist/node_modules/fdir/dist/index.mjs +570 -0
  47. package/dist/node_modules/fdir/package.json +103 -0
  48. package/dist/node_modules/get-pnpm/bin/get-pnpm.js +11 -0
  49. package/dist/node_modules/get-pnpm/lib/downloadExecutable.js +108 -0
  50. package/dist/node_modules/get-pnpm/lib/extractTarball.js +23 -0
  51. package/dist/node_modules/get-pnpm/lib/extractTarballMember.js +128 -0
  52. package/dist/node_modules/get-pnpm/lib/index.js +220 -0
  53. package/dist/node_modules/get-pnpm/lib/npmSigningKeys.js +23 -0
  54. package/dist/node_modules/get-pnpm/lib/platformPackageName.js +75 -0
  55. package/dist/node_modules/get-pnpm/lib/registry.js +163 -0
  56. package/dist/node_modules/get-pnpm/lib/resolveVersion.js +36 -0
  57. package/dist/node_modules/get-pnpm/lib/sameFileContents.js +45 -0
  58. package/dist/node_modules/get-pnpm/lib/verifySignature.js +51 -0
  59. package/dist/node_modules/get-pnpm/package.json +45 -0
  60. package/dist/node_modules/graceful-fs/LICENSE +15 -0
  61. package/dist/node_modules/graceful-fs/clone.js +23 -0
  62. package/dist/node_modules/graceful-fs/graceful-fs.js +448 -0
  63. package/dist/node_modules/graceful-fs/legacy-streams.js +118 -0
  64. package/dist/node_modules/graceful-fs/package.json +53 -0
  65. package/dist/node_modules/graceful-fs/polyfills.js +355 -0
  66. package/dist/node_modules/isexe/dist/commonjs/index.js +56 -0
  67. package/dist/node_modules/isexe/dist/commonjs/index.min.js +2 -0
  68. package/dist/node_modules/isexe/dist/commonjs/options.js +3 -0
  69. package/dist/node_modules/isexe/dist/commonjs/package.json +3 -0
  70. package/dist/node_modules/isexe/dist/commonjs/posix.js +67 -0
  71. package/dist/node_modules/isexe/dist/commonjs/win32.js +63 -0
  72. package/dist/node_modules/isexe/dist/esm/index.js +16 -0
  73. package/dist/node_modules/isexe/dist/esm/index.min.js +2 -0
  74. package/dist/node_modules/isexe/dist/esm/options.js +2 -0
  75. package/dist/node_modules/isexe/dist/esm/package.json +3 -0
  76. package/dist/node_modules/isexe/dist/esm/posix.js +62 -0
  77. package/dist/node_modules/isexe/dist/esm/win32.js +58 -0
  78. package/dist/node_modules/isexe/package.json +78 -0
  79. package/dist/node_modules/minipass/dist/commonjs/index.js +1038 -0
  80. package/dist/node_modules/minipass/dist/commonjs/package.json +3 -0
  81. package/dist/node_modules/minipass/dist/esm/index.js +1020 -0
  82. package/dist/node_modules/minipass/dist/esm/package.json +3 -0
  83. package/dist/node_modules/minipass/package.json +77 -0
  84. package/dist/node_modules/minizlib/LICENSE +26 -0
  85. package/dist/node_modules/minizlib/dist/commonjs/constants.js +123 -0
  86. package/dist/node_modules/minizlib/dist/commonjs/index.js +416 -0
  87. package/dist/node_modules/minizlib/dist/commonjs/package.json +3 -0
  88. package/dist/node_modules/minizlib/dist/esm/constants.js +117 -0
  89. package/dist/node_modules/minizlib/dist/esm/index.js +363 -0
  90. package/dist/node_modules/minizlib/dist/esm/package.json +3 -0
  91. package/dist/node_modules/minizlib/package.json +80 -0
  92. package/dist/node_modules/node-gyp/.release-please-manifest.json +3 -0
  93. package/dist/node_modules/node-gyp/LICENSE +24 -0
  94. package/dist/node_modules/node-gyp/addon.gypi +204 -0
  95. package/dist/node_modules/node-gyp/bin/node-gyp.js +145 -0
  96. package/dist/node_modules/node-gyp/eslint.config.js +3 -0
  97. package/dist/node_modules/node-gyp/gyp/.release-please-manifest.json +3 -0
  98. package/dist/node_modules/node-gyp/gyp/LICENSE +28 -0
  99. package/dist/node_modules/node-gyp/gyp/data/ninja/build.ninja +4 -0
  100. package/dist/node_modules/node-gyp/gyp/data/win/large-pdb-shim.cc +12 -0
  101. package/dist/node_modules/node-gyp/gyp/gyp +8 -0
  102. package/dist/node_modules/node-gyp/gyp/gyp.bat +5 -0
  103. package/dist/node_modules/node-gyp/gyp/gyp_main.py +45 -0
  104. package/dist/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py +365 -0
  105. package/dist/node_modules/node-gyp/gyp/pylib/gyp/MSVSProject.py +206 -0
  106. package/dist/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py +1283 -0
  107. package/dist/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py +1545 -0
  108. package/dist/node_modules/node-gyp/gyp/pylib/gyp/MSVSToolFile.py +59 -0
  109. package/dist/node_modules/node-gyp/gyp/pylib/gyp/MSVSUserFile.py +152 -0
  110. package/dist/node_modules/node-gyp/gyp/pylib/gyp/MSVSUtil.py +270 -0
  111. package/dist/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py +607 -0
  112. package/dist/node_modules/node-gyp/gyp/pylib/gyp/__init__.py +706 -0
  113. package/dist/node_modules/node-gyp/gyp/pylib/gyp/common.py +725 -0
  114. package/dist/node_modules/node-gyp/gyp/pylib/gyp/common_test.py +186 -0
  115. package/dist/node_modules/node-gyp/gyp/pylib/gyp/easy_xml.py +170 -0
  116. package/dist/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py +113 -0
  117. package/dist/node_modules/node-gyp/gyp/pylib/gyp/flock_tool.py +55 -0
  118. package/dist/node_modules/node-gyp/gyp/pylib/gyp/generator/__init__.py +0 -0
  119. package/dist/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py +805 -0
  120. package/dist/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py +1169 -0
  121. package/dist/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py +1316 -0
  122. package/dist/node_modules/node-gyp/gyp/pylib/gyp/generator/compile_commands_json.py +128 -0
  123. package/dist/node_modules/node-gyp/gyp/pylib/gyp/generator/dump_dependency_json.py +104 -0
  124. package/dist/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py +461 -0
  125. package/dist/node_modules/node-gyp/gyp/pylib/gyp/generator/gypd.py +88 -0
  126. package/dist/node_modules/node-gyp/gyp/pylib/gyp/generator/gypsh.py +55 -0
  127. package/dist/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py +2755 -0
  128. package/dist/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py +3970 -0
  129. package/dist/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs_test.py +44 -0
  130. package/dist/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py +2957 -0
  131. package/dist/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py +77 -0
  132. package/dist/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py +1389 -0
  133. package/dist/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode_test.py +26 -0
  134. package/dist/node_modules/node-gyp/gyp/pylib/gyp/input.py +3097 -0
  135. package/dist/node_modules/node-gyp/gyp/pylib/gyp/input_test.py +99 -0
  136. package/dist/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py +765 -0
  137. package/dist/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py +1255 -0
  138. package/dist/node_modules/node-gyp/gyp/pylib/gyp/ninja_syntax.py +174 -0
  139. package/dist/node_modules/node-gyp/gyp/pylib/gyp/simple_copy.py +61 -0
  140. package/dist/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py +371 -0
  141. package/dist/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py +1936 -0
  142. package/dist/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation_test.py +54 -0
  143. package/dist/node_modules/node-gyp/gyp/pylib/gyp/xcode_ninja.py +301 -0
  144. package/dist/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py +3180 -0
  145. package/dist/node_modules/node-gyp/gyp/pylib/gyp/xml_fix.py +64 -0
  146. package/dist/node_modules/node-gyp/gyp/pylib/packaging/LICENSE +3 -0
  147. package/dist/node_modules/node-gyp/gyp/pylib/packaging/LICENSE.APACHE +177 -0
  148. package/dist/node_modules/node-gyp/gyp/pylib/packaging/LICENSE.BSD +23 -0
  149. package/dist/node_modules/node-gyp/gyp/pylib/packaging/__init__.py +15 -0
  150. package/dist/node_modules/node-gyp/gyp/pylib/packaging/_elffile.py +107 -0
  151. package/dist/node_modules/node-gyp/gyp/pylib/packaging/_manylinux.py +252 -0
  152. package/dist/node_modules/node-gyp/gyp/pylib/packaging/_musllinux.py +83 -0
  153. package/dist/node_modules/node-gyp/gyp/pylib/packaging/_parser.py +359 -0
  154. package/dist/node_modules/node-gyp/gyp/pylib/packaging/_structures.py +61 -0
  155. package/dist/node_modules/node-gyp/gyp/pylib/packaging/_tokenizer.py +192 -0
  156. package/dist/node_modules/node-gyp/gyp/pylib/packaging/markers.py +251 -0
  157. package/dist/node_modules/node-gyp/gyp/pylib/packaging/metadata.py +807 -0
  158. package/dist/node_modules/node-gyp/gyp/pylib/packaging/py.typed +0 -0
  159. package/dist/node_modules/node-gyp/gyp/pylib/packaging/requirements.py +90 -0
  160. package/dist/node_modules/node-gyp/gyp/pylib/packaging/specifiers.py +1030 -0
  161. package/dist/node_modules/node-gyp/gyp/pylib/packaging/tags.py +541 -0
  162. package/dist/node_modules/node-gyp/gyp/pylib/packaging/utils.py +172 -0
  163. package/dist/node_modules/node-gyp/gyp/pylib/packaging/version.py +563 -0
  164. package/dist/node_modules/node-gyp/gyp/pyproject.toml +116 -0
  165. package/dist/node_modules/node-gyp/gyp/release-please-config.json +11 -0
  166. package/dist/node_modules/node-gyp/gyp/test_gyp.py +260 -0
  167. package/dist/node_modules/node-gyp/lib/Find-VisualStudio.cs +250 -0
  168. package/dist/node_modules/node-gyp/lib/build.js +230 -0
  169. package/dist/node_modules/node-gyp/lib/clean.js +15 -0
  170. package/dist/node_modules/node-gyp/lib/configure.js +328 -0
  171. package/dist/node_modules/node-gyp/lib/create-config-gypi.js +153 -0
  172. package/dist/node_modules/node-gyp/lib/download.js +86 -0
  173. package/dist/node_modules/node-gyp/lib/find-node-directory.js +63 -0
  174. package/dist/node_modules/node-gyp/lib/find-python.js +304 -0
  175. package/dist/node_modules/node-gyp/lib/find-visualstudio.js +606 -0
  176. package/dist/node_modules/node-gyp/lib/install.js +411 -0
  177. package/dist/node_modules/node-gyp/lib/list.js +26 -0
  178. package/dist/node_modules/node-gyp/lib/log.js +168 -0
  179. package/dist/node_modules/node-gyp/lib/node-gyp.js +199 -0
  180. package/dist/node_modules/node-gyp/lib/process-release.js +144 -0
  181. package/dist/node_modules/node-gyp/lib/rebuild.js +12 -0
  182. package/dist/node_modules/node-gyp/lib/remove.js +43 -0
  183. package/dist/node_modules/node-gyp/lib/util.js +81 -0
  184. package/dist/node_modules/node-gyp/macOS_Catalina_acid_test.sh +21 -0
  185. package/dist/node_modules/node-gyp/package.json +52 -0
  186. package/dist/node_modules/node-gyp/release-please-config.json +40 -0
  187. package/dist/node_modules/node-gyp/src/win_delay_load_hook.cc +41 -0
  188. package/dist/node_modules/nopt/LICENSE +15 -0
  189. package/dist/node_modules/nopt/bin/nopt.js +29 -0
  190. package/dist/node_modules/nopt/lib/debug.js +5 -0
  191. package/dist/node_modules/nopt/lib/nopt-lib.js +514 -0
  192. package/dist/node_modules/nopt/lib/nopt.js +34 -0
  193. package/dist/node_modules/nopt/lib/type-defs.js +91 -0
  194. package/dist/node_modules/nopt/package.json +52 -0
  195. package/dist/node_modules/picomatch/LICENSE +21 -0
  196. package/dist/node_modules/picomatch/index.js +17 -0
  197. package/dist/node_modules/picomatch/lib/constants.js +184 -0
  198. package/dist/node_modules/picomatch/lib/parse.js +1425 -0
  199. package/dist/node_modules/picomatch/lib/picomatch.js +361 -0
  200. package/dist/node_modules/picomatch/lib/scan.js +403 -0
  201. package/dist/node_modules/picomatch/lib/utils.js +72 -0
  202. package/dist/node_modules/picomatch/package.json +83 -0
  203. package/dist/node_modules/picomatch/posix.js +3 -0
  204. package/dist/node_modules/proc-log/LICENSE +15 -0
  205. package/dist/node_modules/proc-log/lib/index.js +158 -0
  206. package/dist/node_modules/proc-log/package.json +46 -0
  207. package/dist/node_modules/semver/LICENSE +15 -0
  208. package/dist/node_modules/semver/bin/semver.js +195 -0
  209. package/dist/node_modules/semver/classes/comparator.js +143 -0
  210. package/dist/node_modules/semver/classes/index.js +7 -0
  211. package/dist/node_modules/semver/classes/range.js +577 -0
  212. package/dist/node_modules/semver/classes/semver.js +350 -0
  213. package/dist/node_modules/semver/functions/clean.js +8 -0
  214. package/dist/node_modules/semver/functions/cmp.js +54 -0
  215. package/dist/node_modules/semver/functions/coerce.js +62 -0
  216. package/dist/node_modules/semver/functions/compare-build.js +9 -0
  217. package/dist/node_modules/semver/functions/compare-loose.js +5 -0
  218. package/dist/node_modules/semver/functions/compare.js +7 -0
  219. package/dist/node_modules/semver/functions/diff.js +60 -0
  220. package/dist/node_modules/semver/functions/eq.js +5 -0
  221. package/dist/node_modules/semver/functions/gt.js +5 -0
  222. package/dist/node_modules/semver/functions/gte.js +5 -0
  223. package/dist/node_modules/semver/functions/inc.js +21 -0
  224. package/dist/node_modules/semver/functions/lt.js +5 -0
  225. package/dist/node_modules/semver/functions/lte.js +5 -0
  226. package/dist/node_modules/semver/functions/major.js +5 -0
  227. package/dist/node_modules/semver/functions/minor.js +5 -0
  228. package/dist/node_modules/semver/functions/neq.js +5 -0
  229. package/dist/node_modules/semver/functions/parse.js +18 -0
  230. package/dist/node_modules/semver/functions/patch.js +5 -0
  231. package/dist/node_modules/semver/functions/prerelease.js +8 -0
  232. package/dist/node_modules/semver/functions/rcompare.js +5 -0
  233. package/dist/node_modules/semver/functions/rsort.js +5 -0
  234. package/dist/node_modules/semver/functions/satisfies.js +12 -0
  235. package/dist/node_modules/semver/functions/sort.js +5 -0
  236. package/dist/node_modules/semver/functions/truncate.js +48 -0
  237. package/dist/node_modules/semver/functions/valid.js +8 -0
  238. package/dist/node_modules/semver/index.js +93 -0
  239. package/dist/node_modules/semver/internal/constants.js +37 -0
  240. package/dist/node_modules/semver/internal/debug.js +11 -0
  241. package/dist/node_modules/semver/internal/identifiers.js +29 -0
  242. package/dist/node_modules/semver/internal/lrucache.js +42 -0
  243. package/dist/node_modules/semver/internal/parse-options.js +17 -0
  244. package/dist/node_modules/semver/internal/re.js +223 -0
  245. package/dist/node_modules/semver/package.json +78 -0
  246. package/dist/node_modules/semver/preload.js +4 -0
  247. package/dist/node_modules/semver/range.bnf +17 -0
  248. package/dist/node_modules/semver/ranges/gtr.js +6 -0
  249. package/dist/node_modules/semver/ranges/intersects.js +9 -0
  250. package/dist/node_modules/semver/ranges/ltr.js +6 -0
  251. package/dist/node_modules/semver/ranges/max-satisfying.js +27 -0
  252. package/dist/node_modules/semver/ranges/min-satisfying.js +26 -0
  253. package/dist/node_modules/semver/ranges/min-version.js +63 -0
  254. package/dist/node_modules/semver/ranges/outside.js +82 -0
  255. package/dist/node_modules/semver/ranges/simplify.js +49 -0
  256. package/dist/node_modules/semver/ranges/subset.js +249 -0
  257. package/dist/node_modules/semver/ranges/to-comparators.js +10 -0
  258. package/dist/node_modules/semver/ranges/valid.js +13 -0
  259. package/dist/node_modules/tar/dist/commonjs/create.js +82 -0
  260. package/dist/node_modules/tar/dist/commonjs/cwd-error.js +18 -0
  261. package/dist/node_modules/tar/dist/commonjs/extract.js +88 -0
  262. package/dist/node_modules/tar/dist/commonjs/get-write-flag.js +32 -0
  263. package/dist/node_modules/tar/dist/commonjs/header.js +348 -0
  264. package/dist/node_modules/tar/dist/commonjs/index.js +64 -0
  265. package/dist/node_modules/tar/dist/commonjs/index.min.js +4 -0
  266. package/dist/node_modules/tar/dist/commonjs/large-numbers.js +99 -0
  267. package/dist/node_modules/tar/dist/commonjs/list.js +153 -0
  268. package/dist/node_modules/tar/dist/commonjs/make-command.js +52 -0
  269. package/dist/node_modules/tar/dist/commonjs/mkdir.js +187 -0
  270. package/dist/node_modules/tar/dist/commonjs/mode-fix.js +29 -0
  271. package/dist/node_modules/tar/dist/commonjs/normalize-unicode.js +38 -0
  272. package/dist/node_modules/tar/dist/commonjs/normalize-windows-path.js +12 -0
  273. package/dist/node_modules/tar/dist/commonjs/options.js +66 -0
  274. package/dist/node_modules/tar/dist/commonjs/pack.js +544 -0
  275. package/dist/node_modules/tar/dist/commonjs/package.json +3 -0
  276. package/dist/node_modules/tar/dist/commonjs/parse.js +655 -0
  277. package/dist/node_modules/tar/dist/commonjs/path-reservations.js +170 -0
  278. package/dist/node_modules/tar/dist/commonjs/pax.js +182 -0
  279. package/dist/node_modules/tar/dist/commonjs/process-umask.js +7 -0
  280. package/dist/node_modules/tar/dist/commonjs/read-entry.js +136 -0
  281. package/dist/node_modules/tar/dist/commonjs/replace.js +227 -0
  282. package/dist/node_modules/tar/dist/commonjs/strip-absolute-path.js +29 -0
  283. package/dist/node_modules/tar/dist/commonjs/strip-trailing-slashes.js +18 -0
  284. package/dist/node_modules/tar/dist/commonjs/symlink-error.js +19 -0
  285. package/dist/node_modules/tar/dist/commonjs/types.js +70 -0
  286. package/dist/node_modules/tar/dist/commonjs/unpack.js +932 -0
  287. package/dist/node_modules/tar/dist/commonjs/update.js +33 -0
  288. package/dist/node_modules/tar/dist/commonjs/warn-method.js +31 -0
  289. package/dist/node_modules/tar/dist/commonjs/winchars.js +14 -0
  290. package/dist/node_modules/tar/dist/commonjs/write-entry.js +698 -0
  291. package/dist/node_modules/tar/dist/esm/create.js +76 -0
  292. package/dist/node_modules/tar/dist/esm/cwd-error.js +14 -0
  293. package/dist/node_modules/tar/dist/esm/extract.js +49 -0
  294. package/dist/node_modules/tar/dist/esm/get-write-flag.js +26 -0
  295. package/dist/node_modules/tar/dist/esm/header.js +311 -0
  296. package/dist/node_modules/tar/dist/esm/index.js +20 -0
  297. package/dist/node_modules/tar/dist/esm/index.min.js +4 -0
  298. package/dist/node_modules/tar/dist/esm/large-numbers.js +94 -0
  299. package/dist/node_modules/tar/dist/esm/list.js +113 -0
  300. package/dist/node_modules/tar/dist/esm/make-command.js +48 -0
  301. package/dist/node_modules/tar/dist/esm/mkdir.js +179 -0
  302. package/dist/node_modules/tar/dist/esm/mode-fix.js +25 -0
  303. package/dist/node_modules/tar/dist/esm/normalize-unicode.js +34 -0
  304. package/dist/node_modules/tar/dist/esm/normalize-windows-path.js +9 -0
  305. package/dist/node_modules/tar/dist/esm/options.js +54 -0
  306. package/dist/node_modules/tar/dist/esm/pack.js +502 -0
  307. package/dist/node_modules/tar/dist/esm/package.json +3 -0
  308. package/dist/node_modules/tar/dist/esm/parse.js +651 -0
  309. package/dist/node_modules/tar/dist/esm/path-reservations.js +166 -0
  310. package/dist/node_modules/tar/dist/esm/pax.js +178 -0
  311. package/dist/node_modules/tar/dist/esm/process-umask.js +3 -0
  312. package/dist/node_modules/tar/dist/esm/read-entry.js +132 -0
  313. package/dist/node_modules/tar/dist/esm/replace.js +221 -0
  314. package/dist/node_modules/tar/dist/esm/strip-absolute-path.js +25 -0
  315. package/dist/node_modules/tar/dist/esm/strip-trailing-slashes.js +14 -0
  316. package/dist/node_modules/tar/dist/esm/symlink-error.js +15 -0
  317. package/dist/node_modules/tar/dist/esm/types.js +65 -0
  318. package/dist/node_modules/tar/dist/esm/unpack.js +891 -0
  319. package/dist/node_modules/tar/dist/esm/update.js +30 -0
  320. package/dist/node_modules/tar/dist/esm/warn-method.js +27 -0
  321. package/dist/node_modules/tar/dist/esm/winchars.js +9 -0
  322. package/dist/node_modules/tar/dist/esm/write-entry.js +656 -0
  323. package/dist/node_modules/tar/package.json +298 -0
  324. package/dist/node_modules/tinyglobby/LICENSE +21 -0
  325. package/dist/node_modules/tinyglobby/dist/index.cjs +335 -0
  326. package/dist/node_modules/tinyglobby/dist/index.d.cts +148 -0
  327. package/dist/node_modules/tinyglobby/dist/index.d.mts +148 -0
  328. package/dist/node_modules/tinyglobby/dist/index.mjs +307 -0
  329. package/dist/node_modules/tinyglobby/package.json +70 -0
  330. package/dist/node_modules/undici/LICENSE +21 -0
  331. package/dist/node_modules/undici/index-fetch.js +35 -0
  332. package/dist/node_modules/undici/index.js +169 -0
  333. package/dist/node_modules/undici/lib/api/abort-signal.js +57 -0
  334. package/dist/node_modules/undici/lib/api/api-connect.js +108 -0
  335. package/dist/node_modules/undici/lib/api/api-pipeline.js +251 -0
  336. package/dist/node_modules/undici/lib/api/api-request.js +214 -0
  337. package/dist/node_modules/undici/lib/api/api-stream.js +220 -0
  338. package/dist/node_modules/undici/lib/api/api-upgrade.js +108 -0
  339. package/dist/node_modules/undici/lib/api/index.js +7 -0
  340. package/dist/node_modules/undici/lib/api/readable.js +385 -0
  341. package/dist/node_modules/undici/lib/api/util.js +93 -0
  342. package/dist/node_modules/undici/lib/core/connect.js +240 -0
  343. package/dist/node_modules/undici/lib/core/constants.js +118 -0
  344. package/dist/node_modules/undici/lib/core/diagnostics.js +202 -0
  345. package/dist/node_modules/undici/lib/core/errors.js +425 -0
  346. package/dist/node_modules/undici/lib/core/request.js +416 -0
  347. package/dist/node_modules/undici/lib/core/symbols.js +67 -0
  348. package/dist/node_modules/undici/lib/core/tree.js +152 -0
  349. package/dist/node_modules/undici/lib/core/util.js +719 -0
  350. package/dist/node_modules/undici/lib/dispatcher/agent.js +129 -0
  351. package/dist/node_modules/undici/lib/dispatcher/balanced-pool.js +209 -0
  352. package/dist/node_modules/undici/lib/dispatcher/client-h1.js +1504 -0
  353. package/dist/node_modules/undici/lib/dispatcher/client-h2.js +744 -0
  354. package/dist/node_modules/undici/lib/dispatcher/client.js +623 -0
  355. package/dist/node_modules/undici/lib/dispatcher/dispatcher-base.js +199 -0
  356. package/dist/node_modules/undici/lib/dispatcher/dispatcher.js +65 -0
  357. package/dist/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +160 -0
  358. package/dist/node_modules/undici/lib/dispatcher/fixed-queue.js +117 -0
  359. package/dist/node_modules/undici/lib/dispatcher/pool-base.js +194 -0
  360. package/dist/node_modules/undici/lib/dispatcher/pool-stats.js +34 -0
  361. package/dist/node_modules/undici/lib/dispatcher/pool.js +107 -0
  362. package/dist/node_modules/undici/lib/dispatcher/proxy-agent.js +274 -0
  363. package/dist/node_modules/undici/lib/dispatcher/retry-agent.js +35 -0
  364. package/dist/node_modules/undici/lib/global.js +32 -0
  365. package/dist/node_modules/undici/lib/handler/decorator-handler.js +44 -0
  366. package/dist/node_modules/undici/lib/handler/redirect-handler.js +232 -0
  367. package/dist/node_modules/undici/lib/handler/retry-handler.js +434 -0
  368. package/dist/node_modules/undici/lib/interceptor/dns.js +375 -0
  369. package/dist/node_modules/undici/lib/interceptor/dump.js +123 -0
  370. package/dist/node_modules/undici/lib/interceptor/redirect-interceptor.js +21 -0
  371. package/dist/node_modules/undici/lib/interceptor/redirect.js +24 -0
  372. package/dist/node_modules/undici/lib/interceptor/response-error.js +86 -0
  373. package/dist/node_modules/undici/lib/interceptor/retry.js +19 -0
  374. package/dist/node_modules/undici/lib/llhttp/.gitkeep +0 -0
  375. package/dist/node_modules/undici/lib/llhttp/constants.js +278 -0
  376. package/dist/node_modules/undici/lib/llhttp/llhttp-wasm.js +5 -0
  377. package/dist/node_modules/undici/lib/llhttp/llhttp_simd-wasm.js +5 -0
  378. package/dist/node_modules/undici/lib/llhttp/utils.js +15 -0
  379. package/dist/node_modules/undici/lib/mock/mock-agent.js +160 -0
  380. package/dist/node_modules/undici/lib/mock/mock-client.js +59 -0
  381. package/dist/node_modules/undici/lib/mock/mock-errors.js +28 -0
  382. package/dist/node_modules/undici/lib/mock/mock-interceptor.js +207 -0
  383. package/dist/node_modules/undici/lib/mock/mock-pool.js +59 -0
  384. package/dist/node_modules/undici/lib/mock/mock-symbols.js +23 -0
  385. package/dist/node_modules/undici/lib/mock/mock-utils.js +367 -0
  386. package/dist/node_modules/undici/lib/mock/pending-interceptors-formatter.js +43 -0
  387. package/dist/node_modules/undici/lib/mock/pluralizer.js +29 -0
  388. package/dist/node_modules/undici/lib/util/timers.js +423 -0
  389. package/dist/node_modules/undici/lib/web/cache/cache.js +859 -0
  390. package/dist/node_modules/undici/lib/web/cache/cachestorage.js +152 -0
  391. package/dist/node_modules/undici/lib/web/cache/symbols.js +5 -0
  392. package/dist/node_modules/undici/lib/web/cache/util.js +45 -0
  393. package/dist/node_modules/undici/lib/web/cookies/constants.js +12 -0
  394. package/dist/node_modules/undici/lib/web/cookies/index.js +184 -0
  395. package/dist/node_modules/undici/lib/web/cookies/parse.js +310 -0
  396. package/dist/node_modules/undici/lib/web/cookies/util.js +352 -0
  397. package/dist/node_modules/undici/lib/web/eventsource/eventsource-stream.js +493 -0
  398. package/dist/node_modules/undici/lib/web/eventsource/eventsource.js +480 -0
  399. package/dist/node_modules/undici/lib/web/eventsource/util.js +37 -0
  400. package/dist/node_modules/undici/lib/web/fetch/LICENSE +21 -0
  401. package/dist/node_modules/undici/lib/web/fetch/body.js +529 -0
  402. package/dist/node_modules/undici/lib/web/fetch/constants.js +124 -0
  403. package/dist/node_modules/undici/lib/web/fetch/data-url.js +744 -0
  404. package/dist/node_modules/undici/lib/web/fetch/dispatcher-weakref.js +46 -0
  405. package/dist/node_modules/undici/lib/web/fetch/file.js +126 -0
  406. package/dist/node_modules/undici/lib/web/fetch/formdata-parser.js +474 -0
  407. package/dist/node_modules/undici/lib/web/fetch/formdata.js +252 -0
  408. package/dist/node_modules/undici/lib/web/fetch/global.js +40 -0
  409. package/dist/node_modules/undici/lib/web/fetch/headers.js +687 -0
  410. package/dist/node_modules/undici/lib/web/fetch/index.js +2272 -0
  411. package/dist/node_modules/undici/lib/web/fetch/request.js +1037 -0
  412. package/dist/node_modules/undici/lib/web/fetch/response.js +610 -0
  413. package/dist/node_modules/undici/lib/web/fetch/symbols.js +9 -0
  414. package/dist/node_modules/undici/lib/web/fetch/util.js +1632 -0
  415. package/dist/node_modules/undici/lib/web/fetch/webidl.js +695 -0
  416. package/dist/node_modules/undici/lib/web/fileapi/encoding.js +290 -0
  417. package/dist/node_modules/undici/lib/web/fileapi/filereader.js +344 -0
  418. package/dist/node_modules/undici/lib/web/fileapi/progressevent.js +78 -0
  419. package/dist/node_modules/undici/lib/web/fileapi/symbols.js +10 -0
  420. package/dist/node_modules/undici/lib/web/fileapi/util.js +391 -0
  421. package/dist/node_modules/undici/lib/web/websocket/connection.js +371 -0
  422. package/dist/node_modules/undici/lib/web/websocket/constants.js +66 -0
  423. package/dist/node_modules/undici/lib/web/websocket/events.js +329 -0
  424. package/dist/node_modules/undici/lib/web/websocket/frame.js +96 -0
  425. package/dist/node_modules/undici/lib/web/websocket/permessage-deflate.js +105 -0
  426. package/dist/node_modules/undici/lib/web/websocket/receiver.js +513 -0
  427. package/dist/node_modules/undici/lib/web/websocket/sender.js +104 -0
  428. package/dist/node_modules/undici/lib/web/websocket/symbols.js +12 -0
  429. package/dist/node_modules/undici/lib/web/websocket/util.js +322 -0
  430. package/dist/node_modules/undici/lib/web/websocket/websocket.js +595 -0
  431. package/dist/node_modules/undici/package.json +160 -0
  432. package/dist/node_modules/undici/scripts/strip-comments.js +8 -0
  433. package/dist/node_modules/which/LICENSE +15 -0
  434. package/dist/node_modules/which/bin/which.js +52 -0
  435. package/dist/node_modules/which/lib/index.js +111 -0
  436. package/dist/node_modules/which/package.json +52 -0
  437. package/dist/node_modules/yallist/dist/commonjs/index.js +384 -0
  438. package/dist/node_modules/yallist/dist/commonjs/package.json +3 -0
  439. package/dist/node_modules/yallist/dist/esm/index.js +379 -0
  440. package/dist/node_modules/yallist/dist/esm/package.json +3 -0
  441. package/dist/node_modules/yallist/package.json +68 -0
  442. package/install.js +205 -0
  443. package/native-binary.mjs +192 -0
  444. package/package.json +70 -0
  445. package/pn +70 -0
  446. package/pnpm +90 -0
  447. package/pnpx +70 -0
  448. package/pnx +70 -0
@@ -0,0 +1,108 @@
1
+ import { randomBytes } from 'node:crypto';
2
+ import fs from 'node:fs';
3
+ import path from 'node:path';
4
+ import { extractTarballMember } from './extractTarballMember.js';
5
+ import { isMusl, platformPackageName } from './platformPackageName.js';
6
+ import { downloadTarball, fetchVersionMeta, normalizeRegistry, useProxyFromEnv } from './registry.js';
7
+ import { majorVersion } from './resolveVersion.js';
8
+ import { sameFileContents } from './sameFileContents.js';
9
+ import { verifyRegistrySignature } from './verifySignature.js';
10
+ /** Name the executable is published under inside its platform package. */
11
+ function executableName() {
12
+ return process.platform === 'win32' ? 'pnpm.exe' : 'pnpm';
13
+ }
14
+ /**
15
+ * Places the pnpm executable for this host at `destPath`, and nothing else.
16
+ *
17
+ * The narrow half of {@link downloadPnpm}, for a caller that already knows the
18
+ * exact version and already has whatever else it needs: no dist-tag lookup (so
19
+ * no packument download), no `dist/` tree, no directory to assemble. Corepack
20
+ * is the case it exists for — it unpacks the `pnpm` package itself but installs
21
+ * none of its dependencies, so the executable has to arrive separately.
22
+ *
23
+ * The download is checked against the checksum the registry published for it,
24
+ * and that checksum against npm's signature, exactly as {@link downloadPnpm}
25
+ * does; nothing is written to `destPath` until both pass. See
26
+ * {@link DownloadExecutableOptions.verifySignature} for the one waiver.
27
+ *
28
+ * Placement is atomic and tolerates losing a race: a concurrent call that got
29
+ * there first keeps its copy, since both placed the same verified bytes.
30
+ *
31
+ * @returns the package the executable came from.
32
+ */
33
+ export async function downloadPnpmExecutable(opts) {
34
+ const registry = normalizeRegistry(opts.registry);
35
+ const packageName = platformPackageName({
36
+ major: majorVersion(opts.version),
37
+ platform: process.platform,
38
+ arch: process.arch,
39
+ musl: isMusl(),
40
+ });
41
+ const restoreProxy = useProxyFromEnv();
42
+ try {
43
+ return await fetchExecutable({ ...opts, registry, packageName });
44
+ }
45
+ finally {
46
+ restoreProxy();
47
+ }
48
+ }
49
+ async function fetchExecutable(opts) {
50
+ const { version, destPath, registry, packageName } = opts;
51
+ const meta = await fetchVersionMeta(registry, packageName, version, opts.headers);
52
+ if (!meta.dist.integrity) {
53
+ throw new Error(`The npm registry published no checksum for ${packageName}@${version}, so it cannot be verified.`);
54
+ }
55
+ if (opts.verifySignature !== false) {
56
+ verifyRegistrySignature({
57
+ name: packageName,
58
+ version,
59
+ integrity: meta.dist.integrity,
60
+ signatures: meta.dist.signatures,
61
+ keys: opts.keys,
62
+ });
63
+ }
64
+ const scratch = `${destPath}.${randomBytes(6).toString('hex')}`;
65
+ const tarball = `${scratch}.tgz`;
66
+ const staged = `${scratch}.tmp`;
67
+ fs.mkdirSync(path.dirname(destPath), { recursive: true });
68
+ try {
69
+ await downloadTarball(meta, tarball, { registry, headers: opts.headers });
70
+ const member = `package/${executableName()}`;
71
+ if (!await extractTarballMember(tarball, member, staged, 0o755)) {
72
+ throw new Error(`The ${packageName}@${version} tarball contains no ${member}.`);
73
+ }
74
+ place(staged, destPath);
75
+ }
76
+ finally {
77
+ fs.rmSync(tarball, { force: true });
78
+ fs.rmSync(staged, { force: true });
79
+ }
80
+ return { packageName };
81
+ }
82
+ /**
83
+ * The codes Windows fails a rename with when the destination is held open —
84
+ * which is what a concurrent call executing the copy it just placed looks like.
85
+ * POSIX replaces the destination instead, so a failure there is a real one.
86
+ */
87
+ const DESTINATION_IN_USE = new Set(['EPERM', 'EACCES', 'EBUSY']);
88
+ /**
89
+ * Moves the verified executable into place, keeping the copy a concurrent call
90
+ * placed if that is what stops the rename.
91
+ *
92
+ * A lost race is not assumed from the failure alone: the copy already there has
93
+ * to hold the same bytes as the one just verified, or this call has no idea
94
+ * what it would be reporting success for. Anything else — no permission on the
95
+ * directory, a directory or an unrelated file at `destPath` — is a failure.
96
+ */
97
+ function place(staged, destPath) {
98
+ try {
99
+ fs.renameSync(staged, destPath);
100
+ }
101
+ catch (err) {
102
+ const code = err.code ?? '';
103
+ if (!DESTINATION_IN_USE.has(code))
104
+ throw err;
105
+ if (!sameFileContents(staged, destPath))
106
+ throw err;
107
+ }
108
+ }
@@ -0,0 +1,23 @@
1
+ import { spawnSync } from 'node:child_process';
2
+ import fs from 'node:fs';
3
+ /**
4
+ * Unpacks a package tarball into `dest`, leaving its `package/` root in place.
5
+ *
6
+ * Shells out to `tar`, which every supported host has: macOS and Linux ship it,
7
+ * and Windows has had bsdtar since Windows 10 1803. Member selection and
8
+ * `--strip-components` are avoided because busybox tar and bsdtar disagree
9
+ * about them.
10
+ */
11
+ export function extractTarball(tarball, dest) {
12
+ fs.mkdirSync(dest, { recursive: true });
13
+ const { error, status, stderr } = spawnSync('tar', ['-xzf', tarball, '-C', dest], { encoding: 'utf8' });
14
+ if (error != null) {
15
+ if (error.code === 'ENOENT') {
16
+ throw new Error('This installer needs the `tar` command, which was not found on your PATH.');
17
+ }
18
+ throw error;
19
+ }
20
+ if (status !== 0) {
21
+ throw new Error(`Could not extract ${tarball}: ${stderr.trim()}`);
22
+ }
23
+ }
@@ -0,0 +1,128 @@
1
+ import { createReadStream, createWriteStream } from 'node:fs';
2
+ import { pipeline } from 'node:stream/promises';
3
+ import { createGunzip } from 'node:zlib';
4
+ const BLOCK_SIZE = 512;
5
+ /** Regular file, in both the old (`\0`) and the ustar (`0`) spelling. */
6
+ const FILE_TYPES = new Set(['0', '\0']);
7
+ /**
8
+ * Writes one file out of a package tarball to `dest`, and nothing else.
9
+ *
10
+ * Reads the archive in-process rather than shelling out to `tar` the way
11
+ * {@link extractTarball} does: a caller that wants a single executable, in an
12
+ * environment it does not control (a Corepack cache in a minimal image), should
13
+ * not need a `tar` on the PATH for it. Only regular files are considered, which
14
+ * is all an npm tarball holds beyond directories, and the parse stays streaming
15
+ * so the archive never lands in memory.
16
+ *
17
+ * `dest` is created exclusively — an existing file, or a symlink planted at
18
+ * that path, fails the write rather than being followed.
19
+ *
20
+ * @param tarball Path to the gzipped archive.
21
+ * @param memberPath Path of the wanted file inside it, e.g. `package/pnpm`.
22
+ * @param dest Path to write it to.
23
+ * @param mode Permissions for `dest`.
24
+ * @returns whether the member was there.
25
+ */
26
+ export async function extractTarballMember(tarball, memberPath, dest, mode = 0o644) {
27
+ let found = false;
28
+ await pipeline(createReadStream(tarball), createGunzip(), async function (source) {
29
+ const reader = new BlockReader(source);
30
+ while (true) {
31
+ const header = await reader.read(BLOCK_SIZE);
32
+ // The archive ends with zero-filled blocks; one is enough to stop.
33
+ if (header == null || header[0] === 0)
34
+ return;
35
+ const entry = parseHeader(header);
36
+ if (FILE_TYPES.has(entry.type) && entry.path === memberPath) {
37
+ const written = await reader.pipe(entry.size, createWriteStream(dest, { flags: 'wx', mode }));
38
+ if (written !== entry.size) {
39
+ throw new Error(`${tarball} ends after ${written} of the ${entry.size} bytes it declares for ${memberPath}.`);
40
+ }
41
+ found = true;
42
+ // The rest of the archive holds nothing this caller asked for, and
43
+ // the checksum that vouches for it was checked before any of it was
44
+ // read.
45
+ return;
46
+ }
47
+ await reader.skip(Math.ceil(entry.size / BLOCK_SIZE) * BLOCK_SIZE);
48
+ }
49
+ });
50
+ return found;
51
+ }
52
+ function parseHeader(header) {
53
+ const name = readString(header, 0, 100);
54
+ const prefix = readString(header, 345, 155);
55
+ return {
56
+ path: prefix === '' ? name : `${prefix}/${name}`,
57
+ size: parseInt(readString(header, 124, 12).trim() || '0', 8),
58
+ type: String.fromCharCode(header[156]),
59
+ };
60
+ }
61
+ function readString(header, start, length) {
62
+ const field = header.subarray(start, start + length);
63
+ const end = field.indexOf(0);
64
+ return field.toString('utf8', 0, end === -1 ? field.length : end);
65
+ }
66
+ class BlockReader {
67
+ #iterator;
68
+ #buffered = [];
69
+ #buffedBytes = 0;
70
+ #done = false;
71
+ constructor(source) {
72
+ this.#iterator = source[Symbol.asyncIterator]();
73
+ }
74
+ /** The next `size` bytes, or `null` once the stream ends. */
75
+ async read(size) {
76
+ if (!await this.#fill(size))
77
+ return null;
78
+ return this.#take(size);
79
+ }
80
+ async skip(size) {
81
+ let left = size;
82
+ while (left > 0) {
83
+ if (!await this.#fill(1))
84
+ return;
85
+ left -= this.#take(Math.min(left, this.#buffedBytes)).length;
86
+ }
87
+ }
88
+ /**
89
+ * Hands the next `size` bytes to `destination`, without collecting them.
90
+ *
91
+ * @returns how many bytes there were, which is fewer than `size` only when
92
+ * the stream ended early.
93
+ */
94
+ async pipe(size, destination) {
95
+ const self = this;
96
+ let left = size;
97
+ await pipeline(async function* () {
98
+ while (left > 0) {
99
+ if (!await self.#fill(1))
100
+ return;
101
+ const chunk = self.#take(Math.min(left, self.#buffedBytes));
102
+ left -= chunk.length;
103
+ yield chunk;
104
+ }
105
+ }, destination);
106
+ return size - left;
107
+ }
108
+ /** Reads until at least `size` bytes are buffered, or the stream ends. */
109
+ async #fill(size) {
110
+ while (this.#buffedBytes < size && !this.#done) {
111
+ const { value, done } = await this.#iterator.next();
112
+ if (done === true) {
113
+ this.#done = true;
114
+ }
115
+ else {
116
+ this.#buffered.push(value);
117
+ this.#buffedBytes += value.length;
118
+ }
119
+ }
120
+ return this.#buffedBytes >= size;
121
+ }
122
+ #take(size) {
123
+ const joined = this.#buffered.length === 1 ? this.#buffered[0] : Buffer.concat(this.#buffered);
124
+ this.#buffered = joined.length > size ? [joined.subarray(size)] : [];
125
+ this.#buffedBytes = joined.length - size;
126
+ return joined.subarray(0, size);
127
+ }
128
+ }
@@ -0,0 +1,220 @@
1
+ import { spawnSync } from 'node:child_process';
2
+ import fs from 'node:fs';
3
+ import os from 'node:os';
4
+ import path from 'node:path';
5
+ import { extractTarball } from './extractTarball.js';
6
+ import { isMusl, platformPackageName } from './platformPackageName.js';
7
+ import { downloadTarball, fetchPackument, fetchVersionMeta, registryFromEnv, useProxyFromEnv } from './registry.js';
8
+ import { majorVersion, resolveVersion } from './resolveVersion.js';
9
+ import { verifyRegistrySignature } from './verifySignature.js';
10
+ export { downloadPnpmExecutable } from './downloadExecutable.js';
11
+ export { extractTarballMember } from './extractTarballMember.js';
12
+ export { isMusl, platformPackageName } from './platformPackageName.js';
13
+ export { DEFAULT_REGISTRY, registryFromEnv, useProxyFromEnv } from './registry.js';
14
+ export { majorVersion, resolveVersion } from './resolveVersion.js';
15
+ export { verifyRegistrySignature } from './verifySignature.js';
16
+ /**
17
+ * The package whose dist-tags name every pnpm release. `@pnpm/exe` carries the
18
+ * same versions today, but only `pnpm` is published from v12 onward, so its
19
+ * tags are the ones that cannot go stale.
20
+ */
21
+ const CLI_PKG_NAME = 'pnpm';
22
+ /** Holds the unpacked tarballs while the installation is assembled beside it. */
23
+ const UNPACK_DIR = '.unpack';
24
+ /** Where the `dist/` tree that ships beside the executable is published. */
25
+ function wrapperPackageName(major) {
26
+ return major >= 12 ? CLI_PKG_NAME : '@pnpm/exe';
27
+ }
28
+ const USAGE = `Usage: npx get-pnpm [version]
29
+
30
+ Installs pnpm as a standalone executable and adds it to your PATH.
31
+
32
+ Arguments:
33
+ version An exact version (11.20.0), a major (12), or a dist-tag
34
+ (latest, next-12). Defaults to $PNPM_VERSION, then "latest".
35
+
36
+ Environment variables:
37
+ PNPM_VERSION Version to install when no argument is given.
38
+ PNPM_HOME Directory to install pnpm into.
39
+ npm_config_registry Registry to download pnpm from.
40
+ HTTPS_PROXY Proxy to download through (HTTP_PROXY for an http://
41
+ registry); NO_PROXY names hosts to reach directly.
42
+ Node 24.14 or later.
43
+ `;
44
+ export async function runCli(argv) {
45
+ const positional = [];
46
+ for (const arg of argv) {
47
+ if (arg === '--help' || arg === '-h') {
48
+ console.log(USAGE);
49
+ return 0;
50
+ }
51
+ if (arg.startsWith('-')) {
52
+ throw new Error(`Unknown option "${arg}".\n\n${USAGE}`);
53
+ }
54
+ positional.push(arg);
55
+ }
56
+ if (positional.length > 1) {
57
+ throw new Error(`Expected at most one version, got ${positional.length}.\n\n${USAGE}`);
58
+ }
59
+ return installPnpm({
60
+ versionSpec: positional[0] ?? process.env.PNPM_VERSION ?? 'latest',
61
+ registry: registryFromEnv(),
62
+ });
63
+ }
64
+ /**
65
+ * Downloads the pnpm executable and hands over to `pnpm setup`, which installs
66
+ * it globally and puts it on the PATH.
67
+ *
68
+ * Every download is checked against the checksum the registry published for it,
69
+ * and that checksum against npm's signature — see `verifyRegistrySignature`.
70
+ *
71
+ * The temporary directory is assembled to look like the release tarball that
72
+ * https://get.pnpm.io/install.sh downloads — the executable next to its `dist/`
73
+ * tree — because `pnpm setup` installs that directory as-is.
74
+ *
75
+ * @returns the exit code of `pnpm setup`.
76
+ */
77
+ export async function installPnpm(opts) {
78
+ const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'pnpm-install-'));
79
+ const removeTmpDir = () => {
80
+ fs.rmSync(tmpDir, { recursive: true, force: true });
81
+ };
82
+ // Registered for the duration of the call and no longer: this is also a
83
+ // library function, and handlers left behind would accumulate and outlive the
84
+ // directory they exist to clean up.
85
+ const signals = ['SIGINT', 'SIGTERM', 'SIGHUP'];
86
+ const onSignal = () => {
87
+ removeTmpDir();
88
+ process.exit(1);
89
+ };
90
+ for (const signal of signals) {
91
+ process.once(signal, onSignal);
92
+ }
93
+ try {
94
+ const { binPath } = await downloadPnpm({ ...opts, dest: tmpDir });
95
+ const { error, status } = spawnSync(binPath, ['setup', '--force'], { stdio: 'inherit' });
96
+ if (error != null)
97
+ throw error;
98
+ return status ?? 1;
99
+ }
100
+ finally {
101
+ for (const signal of signals) {
102
+ process.off(signal, onSignal);
103
+ }
104
+ removeTmpDir();
105
+ }
106
+ }
107
+ /**
108
+ * Downloads the pnpm executable into `dest`, laid out the way the release
109
+ * tarball lays it out — the executable next to the `dist/` tree it loads.
110
+ *
111
+ * Every download is checked against the checksum the registry published for it,
112
+ * and that checksum against npm's signature; see `verifyRegistrySignature`.
113
+ * Nothing outside `dest` is touched, so a caller that manages its own PATH — a
114
+ * CI action, say — can use this without the global install `installPnpm` does.
115
+ *
116
+ * @returns the version installed and the path to the executable.
117
+ */
118
+ export async function downloadPnpm(opts) {
119
+ const restoreProxy = useProxyFromEnv();
120
+ try {
121
+ return await fetchPnpm(opts);
122
+ }
123
+ finally {
124
+ restoreProxy();
125
+ }
126
+ }
127
+ async function fetchPnpm(opts) {
128
+ const packument = await fetchPackument(opts.registry, CLI_PKG_NAME);
129
+ const version = resolveVersion(packument, opts.versionSpec);
130
+ const major = majorVersion(version);
131
+ const platformPkgName = platformPackageName({
132
+ major,
133
+ platform: process.platform,
134
+ arch: process.arch,
135
+ musl: isMusl(),
136
+ });
137
+ const { dest } = opts;
138
+ fs.mkdirSync(dest, { recursive: true });
139
+ try {
140
+ console.log(`==> Downloading pnpm ${version}`);
141
+ const executable = process.platform === 'win32' ? 'pnpm.exe' : 'pnpm';
142
+ const fetchPackage = verifiedPackageFetcher({ dir: dest, registry: opts.registry, version, keys: opts.keys });
143
+ // Settled, not `all`: a rejection there would leave the other fetch writing
144
+ // into the directory the `finally` below is about to remove.
145
+ const [platformResult, wrapperResult] = await Promise.allSettled([
146
+ fetchPackage(platformPkgName),
147
+ // v11 was the first release to keep files next to the executable; up to
148
+ // v10 the executable is self-contained and ships no `dist/`.
149
+ major >= 11 ? fetchPackage(wrapperPackageName(major)) : Promise.resolve(undefined),
150
+ ]);
151
+ if (platformResult.status === 'rejected')
152
+ throw platformResult.reason;
153
+ if (wrapperResult.status === 'rejected')
154
+ throw wrapperResult.reason;
155
+ const platformPkg = platformResult.value;
156
+ const wrapperPkg = wrapperResult.value;
157
+ const binPath = path.join(dest, executable);
158
+ fs.renameSync(path.join(platformPkg.dir, executable), binPath);
159
+ fs.chmodSync(binPath, 0o755);
160
+ if (wrapperPkg != null) {
161
+ fs.rmSync(path.join(dest, 'dist'), { recursive: true, force: true });
162
+ fs.renameSync(path.join(wrapperPkg.dir, 'dist'), path.join(dest, 'dist'));
163
+ writeManifest({ dest, executable, version, wrapperDir: wrapperPkg.dir, major });
164
+ }
165
+ return { version, binPath };
166
+ }
167
+ finally {
168
+ // `pnpm setup` installs this directory as a package, so nothing may be left
169
+ // in it that does not belong in the installation.
170
+ fs.rmSync(path.join(dest, UNPACK_DIR), { recursive: true, force: true });
171
+ }
172
+ }
173
+ /**
174
+ * `pnpm setup` installs the directory as a package, writing a minimal manifest
175
+ * when there is none — which is what the release tarball relies on. That
176
+ * tarball bundles the runtime dependencies inside `dist/`; the registry copy
177
+ * declares them instead, so up to v11 they have to be declared here or the
178
+ * install silently loses them (`@reflink/reflink`, and with it copy-on-write
179
+ * cloning). From v12 the `dist/` tree is self-contained again, so the manifest
180
+ * `setup` writes is left to it.
181
+ */
182
+ function writeManifest(opts) {
183
+ if (opts.major >= 12)
184
+ return;
185
+ const wrapper = JSON.parse(fs.readFileSync(path.join(opts.wrapperDir, 'package.json'), 'utf8'));
186
+ if (wrapper.dependencies == null)
187
+ return;
188
+ fs.writeFileSync(path.join(opts.dest, 'package.json'), JSON.stringify({
189
+ name: '@pnpm/exe',
190
+ version: opts.version,
191
+ type: 'module',
192
+ bin: { pnpm: opts.executable, pn: opts.executable },
193
+ dependencies: wrapper.dependencies,
194
+ }));
195
+ }
196
+ /** Downloads packages of one version into one directory, verifying each. */
197
+ function verifiedPackageFetcher(opts) {
198
+ return async function fetchPackage(pkgName) {
199
+ const meta = await fetchVersionMeta(opts.registry, pkgName, opts.version);
200
+ if (!meta.dist.integrity) {
201
+ throw new Error(`The npm registry published no checksum for ${pkgName}@${opts.version}, so it cannot be verified.`);
202
+ }
203
+ verifyRegistrySignature({
204
+ name: pkgName,
205
+ version: opts.version,
206
+ integrity: meta.dist.integrity,
207
+ signatures: meta.dist.signatures,
208
+ keys: opts.keys,
209
+ });
210
+ // Unpack away from the directory being assembled: `pnpm` is both a package
211
+ // name and the name of the executable that ends up beside it.
212
+ const unpackDir = path.join(opts.dir, UNPACK_DIR, pkgName.replaceAll('/', '-'));
213
+ const tarball = `${unpackDir}.tgz`;
214
+ fs.mkdirSync(path.dirname(tarball), { recursive: true });
215
+ await downloadTarball(meta, tarball, { registry: opts.registry });
216
+ extractTarball(tarball, unpackDir);
217
+ fs.rmSync(tarball);
218
+ return { dir: path.join(unpackDir, 'package') };
219
+ };
220
+ }
@@ -0,0 +1,23 @@
1
+ /* eslint-disable */
2
+ // GENERATED — npm's public registry signing keys, mirrored from
3
+ // https://registry.npmjs.org/-/npm/v1/keys
4
+ //
5
+ // Refresh with: node scripts/update-npm-keys.mjs --update
6
+ // A scheduled workflow runs the check, so a rotation arrives as a pull request
7
+ // rather than as a failed install.
8
+ export const NPM_SIGNING_KEYS = [
9
+ {
10
+ "expires": null,
11
+ "keyid": "SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U",
12
+ "keytype": "ecdsa-sha2-nistp256",
13
+ "scheme": "ecdsa-sha2-nistp256",
14
+ "key": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEY6Ya7W++7aUPzvMTrezH6Ycx3c+HOKYCcNGybJZSCJq/fd7Qa8uuAKtdIkUQtQiEKERhAmE5lMMJhP8OkDOa2g=="
15
+ },
16
+ {
17
+ "expires": "2025-01-29T00:00:00.000Z",
18
+ "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
19
+ "keytype": "ecdsa-sha2-nistp256",
20
+ "scheme": "ecdsa-sha2-nistp256",
21
+ "key": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE1Olb3zMAFFxXKHiIkQO5cJ3Yhl5i6UPp+IhuteBJbuHcA5UogKo0EWtlWwW6KSaKoTNEYL7JlCQiVnkhBktUgg=="
22
+ }
23
+ ];
@@ -0,0 +1,75 @@
1
+ const V12_ONLY_TARGETS = new Set([
2
+ 'android-arm64',
3
+ 'android-x64',
4
+ 'freebsd-x64',
5
+ 'linux-ppc64',
6
+ 'linux-riscv64',
7
+ 'linux-s390x',
8
+ ]);
9
+ /**
10
+ * Name of the npm package that carries the pnpm executable for `target`.
11
+ *
12
+ * pnpm ships the binary in a per-host package that `@pnpm/exe` lists as an
13
+ * optional dependency. The naming scheme changed with the Rust rewrite: v12
14
+ * publishes `@pnpm/exe.<process.platform>-<arch>[-musl]`, while v11 and older
15
+ * publish `@pnpm/<macos|win|linux|linuxstatic>-<arch>`.
16
+ *
17
+ * @throws if pnpm publishes no binary for the host — because the host is not
18
+ * built for at all, because the binary arrived in v12 and an older major was
19
+ * asked for, or because of the v11-only Intel macOS gap.
20
+ */
21
+ export function platformPackageName({ major, platform, arch, musl }) {
22
+ const target = `${platform}-${arch}`;
23
+ if (V12_ONLY_TARGETS.has(target)) {
24
+ if (major >= 12)
25
+ return `@pnpm/exe.${target}`;
26
+ throw new Error(`pnpm v${major} does not provide a pre-built binary for ${target}. pnpm 12 does:
27
+
28
+ npx get-pnpm 12`);
29
+ }
30
+ if ((arch !== 'x64' && arch !== 'arm64') ||
31
+ (platform !== 'darwin' && platform !== 'linux' && platform !== 'win32')) {
32
+ throw new Error(`Sorry! pnpm does not provide a pre-built binary for ${target}.`);
33
+ }
34
+ if (platform === 'darwin' && arch === 'x64' && major === 11) {
35
+ throw new Error(`pnpm v11 does not provide a working binary for Intel macOS (darwin-x64) due to an upstream Node.js SEA bug.
36
+
37
+ Install pnpm a different way instead:
38
+ npx get-pnpm 12 # pnpm v12 ships an Intel macOS binary
39
+ npm install -g pnpm # uses your system Node.js
40
+ brew install pnpm # via Homebrew
41
+
42
+ More context: https://github.com/pnpm/pnpm/issues/11423`);
43
+ }
44
+ const linuxMusl = platform === 'linux' && musl;
45
+ if (major >= 12) {
46
+ return `@pnpm/exe.${platform}-${arch}${linuxMusl ? '-musl' : ''}`;
47
+ }
48
+ return `@pnpm/${legacyOsSegment(platform, linuxMusl)}-${arch}`;
49
+ }
50
+ function legacyOsSegment(platform, isMusl) {
51
+ switch (platform) {
52
+ case 'darwin': return 'macos';
53
+ case 'win32': return 'win';
54
+ default: return isMusl ? 'linuxstatic' : 'linux';
55
+ }
56
+ }
57
+ /**
58
+ * Whether this host's libc is musl rather than glibc.
59
+ *
60
+ * Probed the way pnpm's own wrappers do it rather than through a dependency:
61
+ * glibc builds report a `glibcVersionRuntime`, musl builds leave it unset.
62
+ * Keeping this package dependency-free means `npx` fetches one thing before
63
+ * pnpm exists.
64
+ */
65
+ export function isMusl() {
66
+ if (process.platform !== 'linux')
67
+ return false;
68
+ try {
69
+ const report = process.report?.getReport();
70
+ return report?.header != null && !report.header.glibcVersionRuntime;
71
+ }
72
+ catch {
73
+ return false;
74
+ }
75
+ }