nitro 3.0.1-alpha.2 → 3.0.260415-beta

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 (297) hide show
  1. package/LICENSE +6 -0
  2. package/README.md +2 -2
  3. package/dist/THIRD-PARTY-LICENSES.md +1646 -0
  4. package/dist/_build/common.mjs +7261 -3812
  5. package/dist/_build/rolldown.mjs +32 -42
  6. package/dist/_build/rollup.mjs +28 -48
  7. package/dist/_build/vite.build.mjs +10 -10
  8. package/dist/_chunks/nitro.mjs +102 -327
  9. package/dist/_chunks/nitro2.mjs +8 -9
  10. package/dist/_chunks/nitro3.mjs +136 -0
  11. package/dist/_chunks/nitro4.mjs +127 -0
  12. package/dist/_chunks/utils.mjs +40 -29
  13. package/dist/_common.mjs +13 -25
  14. package/dist/_dev.d.mts +0 -3
  15. package/dist/{_chunks/dev.mjs → _dev.mjs} +132 -330
  16. package/dist/_libs/_.mjs +2 -0
  17. package/dist/_libs/_2.mjs +2 -0
  18. package/dist/_libs/_3.mjs +2 -0
  19. package/dist/_libs/_4.mjs +2 -0
  20. package/dist/_libs/_5.mjs +2 -0
  21. package/dist/_libs/_6.mjs +2 -0
  22. package/dist/_libs/_7.mjs +2 -0
  23. package/dist/_libs/c12+rc9.mjs +814 -0
  24. package/dist/_libs/{c12+giget+readdirp+chokidar.d.mts → c12+readdirp+chokidar.d.mts} +49 -40
  25. package/dist/_libs/citty.mjs +142 -41
  26. package/dist/_libs/commondir+is-reference.mjs +60 -56
  27. package/dist/_libs/compatx.d.mts +0 -2
  28. package/dist/_libs/compatx.mjs +1 -4
  29. package/dist/_libs/esbuild.d.mts +0 -1
  30. package/dist/_libs/escape-string-regexp.mjs +1 -4
  31. package/dist/_libs/{pluginutils+plugin-commonjs.d.mts → estree+pluginutils.d.mts} +0 -5
  32. package/dist/_libs/estree-walker.mjs +4 -92
  33. package/dist/_libs/exsolve.d.mts +1 -0
  34. package/dist/_libs/hasown+resolve+deepmerge.mjs +160 -246
  35. package/dist/_libs/httpxy.d.mts +20 -13
  36. package/dist/_libs/httpxy.mjs +519 -95
  37. package/dist/_libs/js-tokens.d.mts +1 -0
  38. package/dist/_libs/klona.mjs +1 -4
  39. package/dist/_libs/magic-string.d.mts +0 -2
  40. package/dist/_libs/mlly.d.mts +0 -2
  41. package/dist/_libs/nypm+tinyexec.mjs +822 -0
  42. package/dist/_libs/perfect-debounce.mjs +68 -0
  43. package/dist/_libs/pkg-types.d.mts +0 -3
  44. package/dist/_libs/plugin-alias.mjs +1 -5
  45. package/dist/_libs/plugin-inject.mjs +1 -7
  46. package/dist/_libs/plugin-json.mjs +1 -5
  47. package/dist/_libs/pluginutils.mjs +3 -35
  48. package/dist/_libs/readdirp+chokidar.mjs +187 -365
  49. package/dist/_libs/remapping.mjs +1 -5
  50. package/dist/_libs/resolve-uri+gen-mapping.mjs +15 -53
  51. package/dist/_libs/rou3.d.mts +1 -4
  52. package/dist/_libs/rou3.mjs +223 -78
  53. package/dist/_libs/std-env.d.mts +8 -2
  54. package/dist/_libs/strip-literal.d.mts +1 -0
  55. package/dist/_libs/tsconfck.mjs +21 -334
  56. package/dist/_libs/ultrahtml.mjs +3 -16
  57. package/dist/_libs/unimport+unplugin.mjs +244 -388
  58. package/dist/_libs/unplugin+unimport.d.mts +5 -15
  59. package/dist/_libs/unwasm.d.mts +0 -3
  60. package/dist/_presets.mjs +576 -488
  61. package/dist/builder.d.mts +5 -25
  62. package/dist/builder.mjs +3 -8
  63. package/dist/cli/_chunks/build.mjs +22 -25
  64. package/dist/cli/_chunks/common.mjs +1 -4
  65. package/dist/cli/_chunks/deploy.mjs +37 -0
  66. package/dist/cli/_chunks/dev.mjs +6 -11
  67. package/dist/cli/_chunks/docs.mjs +28 -0
  68. package/dist/cli/_chunks/list.mjs +4 -8
  69. package/dist/cli/_chunks/prepare.mjs +2 -6
  70. package/dist/cli/_chunks/preview.mjs +48 -0
  71. package/dist/cli/_chunks/run.mjs +7 -11
  72. package/dist/cli/_chunks/task.mjs +1 -5
  73. package/dist/cli/index.mjs +5 -6
  74. package/dist/docs/0.docs/0.index/index.md +56 -0
  75. package/dist/docs/0.docs/1.quick-start.md +110 -0
  76. package/dist/docs/0.docs/10.lifecycle.md +204 -0
  77. package/dist/docs/0.docs/11.openapi.md +291 -0
  78. package/dist/docs/0.docs/12.plugins.md +164 -0
  79. package/dist/docs/0.docs/13.tasks.md +277 -0
  80. package/dist/docs/0.docs/14.websocket.md +386 -0
  81. package/dist/docs/0.docs/15.migration.md +213 -0
  82. package/dist/docs/0.docs/16.nightly.md +31 -0
  83. package/dist/docs/0.docs/2.renderer.md +322 -0
  84. package/dist/docs/0.docs/3.routing.md +711 -0
  85. package/dist/docs/0.docs/4.server-entry.md +239 -0
  86. package/dist/docs/0.docs/5.cache.md +408 -0
  87. package/dist/docs/0.docs/6.storage.md +261 -0
  88. package/dist/docs/0.docs/7.assets.md +166 -0
  89. package/dist/docs/0.docs/8.configuration.md +256 -0
  90. package/dist/docs/0.docs/9.database.md +185 -0
  91. package/dist/docs/1.deploy/0.index/index.md +64 -0
  92. package/dist/docs/1.deploy/1.runtimes/0.node.md +63 -0
  93. package/dist/docs/1.deploy/1.runtimes/1.bun.md +15 -0
  94. package/dist/docs/1.deploy/1.runtimes/2.deno.md +19 -0
  95. package/dist/docs/1.deploy/2.providers/0.alwaysdata.md +50 -0
  96. package/dist/docs/1.deploy/2.providers/1.aws.md +47 -0
  97. package/dist/docs/1.deploy/2.providers/10.flightcontrol.md +67 -0
  98. package/dist/docs/1.deploy/2.providers/11.genezio.md +67 -0
  99. package/dist/docs/1.deploy/2.providers/12.github-pages.md +68 -0
  100. package/dist/docs/1.deploy/2.providers/13.gitlab-pages.md +37 -0
  101. package/dist/docs/1.deploy/2.providers/14.heroku.md +84 -0
  102. package/dist/docs/1.deploy/2.providers/15.iis.md +38 -0
  103. package/dist/docs/1.deploy/2.providers/16.koyeb.md +109 -0
  104. package/dist/docs/1.deploy/2.providers/17.netlify.md +47 -0
  105. package/dist/docs/1.deploy/2.providers/18.platform-sh.md +37 -0
  106. package/dist/docs/1.deploy/2.providers/19.render.md +37 -0
  107. package/dist/docs/1.deploy/2.providers/2.aws-amplify.md +81 -0
  108. package/dist/docs/1.deploy/2.providers/20.stormkit.md +24 -0
  109. package/dist/docs/1.deploy/2.providers/21.vercel.md +270 -0
  110. package/dist/docs/1.deploy/2.providers/22.zeabur.md +19 -0
  111. package/dist/docs/1.deploy/2.providers/23.zephyr.md +99 -0
  112. package/dist/docs/1.deploy/2.providers/24.zerops.md +102 -0
  113. package/dist/docs/1.deploy/2.providers/3.azure.md +72 -0
  114. package/dist/docs/1.deploy/2.providers/4.cleavr.md +33 -0
  115. package/dist/docs/1.deploy/2.providers/5.cloudflare.md +369 -0
  116. package/dist/docs/1.deploy/2.providers/6.deno-deploy.md +66 -0
  117. package/dist/docs/1.deploy/2.providers/7.digitalocean.md +46 -0
  118. package/dist/docs/1.deploy/2.providers/8.edgeone.md +20 -0
  119. package/dist/docs/1.deploy/2.providers/9.firebase.md +32 -0
  120. package/dist/docs/2.config/0.index/index.md +1221 -0
  121. package/dist/docs/3.examples/0.index/index.md +3 -0
  122. package/dist/docs/3.examples/1.api-routes.md +145 -0
  123. package/dist/docs/3.examples/10.hono.md +74 -0
  124. package/dist/docs/3.examples/11.import-alias.md +97 -0
  125. package/dist/docs/3.examples/12.middleware.md +91 -0
  126. package/dist/docs/3.examples/13.mono-jsx.md +68 -0
  127. package/dist/docs/3.examples/14.nano-jsx.md +70 -0
  128. package/dist/docs/3.examples/15.plugins.md +91 -0
  129. package/dist/docs/3.examples/16.renderer.md +113 -0
  130. package/dist/docs/3.examples/17.runtime-config.md +97 -0
  131. package/dist/docs/3.examples/18.server-fetch.md +87 -0
  132. package/dist/docs/3.examples/19.shiki.md +198 -0
  133. package/dist/docs/3.examples/2.auto-imports.md +92 -0
  134. package/dist/docs/3.examples/20.virtual-routes.md +74 -0
  135. package/dist/docs/3.examples/21.vite-nitro-plugin.md +79 -0
  136. package/dist/docs/3.examples/22.vite-rsc.md +1041 -0
  137. package/dist/docs/3.examples/23.vite-ssr-html.md +217 -0
  138. package/dist/docs/3.examples/24.vite-ssr-preact.md +247 -0
  139. package/dist/docs/3.examples/25.vite-ssr-react.md +226 -0
  140. package/dist/docs/3.examples/26.vite-ssr-solid.md +256 -0
  141. package/dist/docs/3.examples/27.vite-ssr-tsr-react.md +442 -0
  142. package/dist/docs/3.examples/28.vite-ssr-tss-react.md +444 -0
  143. package/dist/docs/3.examples/29.vite-ssr-vue-router.md +617 -0
  144. package/dist/docs/3.examples/3.cached-handler.md +81 -0
  145. package/dist/docs/3.examples/30.vite-trpc.md +335 -0
  146. package/dist/docs/3.examples/31.websocket.md +282 -0
  147. package/dist/docs/3.examples/4.custom-error-handler.md +98 -0
  148. package/dist/docs/3.examples/5.database.md +157 -0
  149. package/dist/docs/3.examples/6.elysia.md +70 -0
  150. package/dist/docs/3.examples/7.express.md +78 -0
  151. package/dist/docs/3.examples/8.fastify.md +79 -0
  152. package/dist/docs/3.examples/9.hello-world.md +68 -0
  153. package/dist/docs/README.md +86 -0
  154. package/dist/docs/index.md +121 -0
  155. package/dist/node_modules/@poppinss/dumper/build/formatters/html/main.js +8 -0
  156. package/dist/node_modules/@poppinss/dumper/package.json +1 -1
  157. package/dist/node_modules/@speed-highlight/core/dist/index.js +4 -4
  158. package/dist/node_modules/@speed-highlight/core/dist/terminal.js +2 -2
  159. package/dist/node_modules/@speed-highlight/core/package.json +1 -1
  160. package/dist/node_modules/cookie-es/dist/index.mjs +299 -250
  161. package/dist/node_modules/cookie-es/package.json +26 -23
  162. package/dist/node_modules/croner/dist/croner.js +1 -1
  163. package/dist/node_modules/croner/package.json +11 -1
  164. package/dist/node_modules/defu/dist/defu.mjs +2 -2
  165. package/dist/node_modules/defu/package.json +33 -28
  166. package/dist/node_modules/rendu/dist/_chunks/libs/cookie-es.mjs +151 -0
  167. package/dist/node_modules/rendu/dist/index.mjs +5 -112
  168. package/dist/node_modules/rendu/package.json +25 -24
  169. package/dist/node_modules/youch/build/helpers-B9BQYaS6.js +23 -0
  170. package/dist/node_modules/youch/build/index.js +204 -351
  171. package/dist/node_modules/youch/build/public/error_info/script.js +1 -1
  172. package/dist/node_modules/youch/build/public_dir-C5bujZKB.js +25 -0
  173. package/dist/node_modules/youch/build/src/templates/error_cause/main.js +44 -0
  174. package/dist/node_modules/youch/build/src/templates/error_info/main.js +72 -0
  175. package/dist/node_modules/youch/build/src/templates/error_metadata/main.js +65 -0
  176. package/dist/node_modules/youch/build/src/templates/error_stack/main.js +152 -0
  177. package/dist/node_modules/youch/build/src/templates/error_stack_source/main.js +46 -0
  178. package/dist/node_modules/youch/build/src/templates/header/main.js +24 -0
  179. package/dist/node_modules/youch/build/src/templates/layout/main.js +27 -0
  180. package/dist/node_modules/youch/package.json +35 -32
  181. package/dist/presets/_nitro/runtime/nitro-dev.mjs +12 -57
  182. package/dist/presets/_nitro/runtime/nitro-prerenderer.mjs +1 -0
  183. package/dist/presets/_nitro/runtime/service-worker.mjs +1 -2
  184. package/dist/presets/aws-lambda/runtime/_utils.mjs +6 -6
  185. package/dist/presets/aws-lambda/runtime/aws-lambda-streaming.mjs +3 -1
  186. package/dist/presets/azure/runtime/_utils.mjs +5 -5
  187. package/dist/presets/azure/runtime/azure-swa.mjs +5 -5
  188. package/dist/presets/bun/runtime/bun.mjs +9 -6
  189. package/dist/presets/cloudflare/runtime/_module-handler.mjs +1 -1
  190. package/dist/presets/cloudflare/runtime/cloudflare-durable.mjs +4 -4
  191. package/dist/presets/cloudflare/runtime/cloudflare-module.mjs +3 -3
  192. package/dist/presets/cloudflare/runtime/cloudflare-pages.mjs +2 -2
  193. package/dist/presets/cloudflare/runtime/plugin.dev.mjs +10 -21
  194. package/dist/presets/deno/runtime/deno-deploy.mjs +4 -4
  195. package/dist/presets/deno/runtime/deno-server.mjs +9 -6
  196. package/dist/presets/edgeone/runtime/edgeone.mjs +10 -0
  197. package/dist/presets/netlify/runtime/netlify-edge.mjs +2 -3
  198. package/dist/presets/netlify/runtime/netlify.mjs +1 -1
  199. package/dist/presets/node/runtime/node-cluster.mjs +5 -4
  200. package/dist/presets/node/runtime/node-middleware.mjs +1 -1
  201. package/dist/presets/node/runtime/node-server.mjs +8 -5
  202. package/dist/presets/stormkit/runtime/stormkit.mjs +1 -2
  203. package/dist/presets/vercel/runtime/cron-handler.mjs +25 -0
  204. package/dist/presets/vercel/runtime/queue-handler.mjs +21 -0
  205. package/dist/presets/vercel/runtime/vercel.node.mjs +3 -3
  206. package/dist/presets/vercel/runtime/vercel.web.mjs +3 -5
  207. package/dist/presets/winterjs/runtime/winterjs.mjs +10 -10
  208. package/dist/presets/zephyr/runtime/server.mjs +3 -0
  209. package/dist/runtime/internal/app.mjs +12 -11
  210. package/dist/runtime/internal/cache.d.mts +0 -4
  211. package/dist/runtime/internal/cache.mjs +32 -256
  212. package/dist/runtime/internal/context.d.mts +3 -1
  213. package/dist/runtime/internal/context.mjs +1 -9
  214. package/dist/runtime/internal/error/dev.d.mts +5 -4
  215. package/dist/runtime/internal/error/dev.mjs +47 -49
  216. package/dist/runtime/internal/error/hooks.d.mts +1 -1
  217. package/dist/runtime/internal/error/prod.d.mts +2 -5
  218. package/dist/runtime/internal/error/prod.mjs +19 -33
  219. package/dist/runtime/internal/error/utils.d.mts +4 -4
  220. package/dist/runtime/internal/meta.d.mts +1 -1
  221. package/dist/runtime/internal/plugin.d.mts +2 -2
  222. package/dist/runtime/internal/route-rules.d.mts +11 -4
  223. package/dist/runtime/internal/route-rules.mjs +15 -5
  224. package/dist/runtime/internal/routes/dev-tasks.d.mts +3 -2
  225. package/dist/runtime/internal/routes/dev-tasks.mjs +15 -10
  226. package/dist/runtime/internal/routes/openapi.mjs +2 -2
  227. package/dist/runtime/internal/routes/renderer-template.d.mts +1 -1
  228. package/dist/runtime/internal/routes/renderer-template.dev.d.mts +2 -1
  229. package/dist/runtime/internal/routes/scalar.mjs +3 -3
  230. package/dist/runtime/internal/routes/swagger.mjs +7 -4
  231. package/dist/runtime/internal/runtime-config.d.mts +1 -1
  232. package/dist/runtime/internal/runtime-config.mjs +2 -2
  233. package/dist/runtime/internal/static.mjs +5 -4
  234. package/dist/runtime/internal/task.d.mts +3 -1
  235. package/dist/runtime/internal/task.mjs +7 -7
  236. package/dist/runtime/internal/vite/dev-entry.mjs +6 -3
  237. package/dist/runtime/internal/vite/dev-worker.mjs +264 -0
  238. package/dist/runtime/meta.d.mts +1 -0
  239. package/dist/runtime/meta.mjs +2 -0
  240. package/dist/runtime/nitro.d.mts +2 -0
  241. package/dist/runtime/nitro.mjs +4 -2
  242. package/dist/runtime/virtual/error-handler.mjs +1 -1
  243. package/dist/runtime/virtual/renderer-template.mjs +1 -1
  244. package/dist/runtime/virtual/server-assets.d.mts +2 -1
  245. package/dist/runtime/virtual/tracing.d.mts +5 -0
  246. package/dist/runtime/virtual/tracing.mjs +1 -0
  247. package/dist/runtime/vite.d.mts +1 -1
  248. package/dist/types/index.d.mts +215 -195
  249. package/dist/types/index.mjs +1 -11
  250. package/dist/vite.d.mts +3 -8
  251. package/dist/vite.mjs +285 -253
  252. package/lib/tsconfig.json +3 -5
  253. package/package.json +97 -80
  254. package/dist/_libs/confbox.mjs +0 -2509
  255. package/dist/_libs/nypm+giget+tinyexec.mjs +0 -3603
  256. package/dist/_libs/rc9+c12+dotenv.mjs +0 -972
  257. package/dist/node_modules/hookable/dist/index.mjs +0 -266
  258. package/dist/node_modules/hookable/package.json +0 -52
  259. package/dist/node_modules/youch/build/chunk-4L7RY2JA.js +0 -42
  260. package/dist/node_modules/youch/build/chunk-7QV3D5YX.js +0 -83
  261. package/dist/node_modules/youch/build/chunk-AUGPHE32.js +0 -39
  262. package/dist/node_modules/youch/build/chunk-CM7DWJNZ.js +0 -44
  263. package/dist/node_modules/youch/build/chunk-EJH674NB.js +0 -223
  264. package/dist/node_modules/youch/build/chunk-OIJ3WD7L.js +0 -81
  265. package/dist/node_modules/youch/build/chunk-P36L72PL.js +0 -87
  266. package/dist/node_modules/youch/build/chunk-PE3GG3TN.js +0 -65
  267. package/dist/node_modules/youch/build/chunk-X53OIOJH.js +0 -70
  268. package/dist/presets/_nitro/runtime/nitro-dev.d.mts +0 -2
  269. package/dist/presets/_nitro/runtime/nitro-prerenderer.d.mts +0 -3
  270. package/dist/presets/_nitro/runtime/service-worker.d.mts +0 -2
  271. package/dist/presets/aws-amplify/runtime/aws-amplify.d.mts +0 -2
  272. package/dist/presets/aws-lambda/runtime/_utils.d.mts +0 -8
  273. package/dist/presets/aws-lambda/runtime/aws-lambda-streaming.d.mts +0 -2
  274. package/dist/presets/aws-lambda/runtime/aws-lambda.d.mts +0 -3
  275. package/dist/presets/azure/runtime/_utils.d.mts +0 -2
  276. package/dist/presets/azure/runtime/azure-swa.d.mts +0 -5
  277. package/dist/presets/bun/runtime/bun.d.mts +0 -3
  278. package/dist/presets/cloudflare/runtime/_module-handler.d.mts +0 -16
  279. package/dist/presets/cloudflare/runtime/cloudflare-durable.d.mts +0 -11
  280. package/dist/presets/cloudflare/runtime/cloudflare-module.d.mts +0 -3
  281. package/dist/presets/cloudflare/runtime/cloudflare-pages.d.mts +0 -20
  282. package/dist/presets/cloudflare/runtime/plugin.dev.d.mts +0 -3
  283. package/dist/presets/deno/runtime/deno-deploy.d.mts +0 -5
  284. package/dist/presets/deno/runtime/deno-server.d.mts +0 -3
  285. package/dist/presets/netlify/runtime/netlify-edge.d.mts +0 -3
  286. package/dist/presets/netlify/runtime/netlify.d.mts +0 -4
  287. package/dist/presets/node/runtime/node-cluster.d.mts +0 -3
  288. package/dist/presets/node/runtime/node-middleware.d.mts +0 -3
  289. package/dist/presets/node/runtime/node-server.d.mts +0 -3
  290. package/dist/presets/standard/runtime/server.d.mts +0 -3
  291. package/dist/presets/stormkit/runtime/stormkit.d.mts +0 -21
  292. package/dist/presets/vercel/runtime/isr.d.mts +0 -2
  293. package/dist/presets/vercel/runtime/vercel.node.d.mts +0 -3
  294. package/dist/presets/vercel/runtime/vercel.web.d.mts +0 -8
  295. package/dist/presets/winterjs/runtime/winterjs.d.mts +0 -2
  296. package/dist/presets/zeabur/runtime/zeabur.d.mts +0 -3
  297. package/dist/runtime/internal/vite/node-runner.mjs +0 -359
@@ -1,3603 +0,0 @@
1
- import { n as __exportAll } from "../_common.mjs";
2
- import { at as join$2, ct as resolve$2, nt as dirname$2, ot as normalize$2, tt as basename$2 } from "../_build/common.mjs";
3
- import { createRequire } from "node:module";
4
- import { createWriteStream, existsSync, readdirSync, renameSync } from "node:fs";
5
- import nativeFs from "fs";
6
- import path from "path";
7
- import Ds from "crypto";
8
- import { mkdir, readFile, rm, writeFile } from "node:fs/promises";
9
- import { homedir, tmpdir } from "node:os";
10
- import { delimiter, dirname as dirname$1, join as join$1, normalize as normalize$1, resolve as resolve$1 } from "node:path";
11
- import { cwd } from "node:process";
12
- import { promisify } from "node:util";
13
- import { defu } from "defu";
14
- import { createRequire as createRequire$1 } from "module";
15
- import { PassThrough, pipeline } from "node:stream";
16
- import { spawn } from "node:child_process";
17
- import j$1 from "assert";
18
- import nt from "events";
19
- import ot from "stream";
20
- import ht from "string_decoder";
21
- import P from "buffer";
22
- import O$2 from "zlib";
23
- import nt$1 from "process";
24
- import a$a from "util";
25
- import c from "node:readline";
26
-
27
- //#region node_modules/.pnpm/tinyexec@1.0.2/node_modules/tinyexec/dist/main.js
28
- var l$2 = Object.create;
29
- var u$5 = Object.defineProperty;
30
- var d = Object.getOwnPropertyDescriptor;
31
- var f$4 = Object.getOwnPropertyNames;
32
- var p$1 = Object.getPrototypeOf;
33
- var m$3 = Object.prototype.hasOwnProperty;
34
- var h$1 = (e$7, t$7) => () => (t$7 || e$7((t$7 = { exports: {} }).exports, t$7), t$7.exports);
35
- var g = (e$7, t$7, n$4, r) => {
36
- if (t$7 && typeof t$7 === "object" || typeof t$7 === "function") for (var i$8 = f$4(t$7), a$11 = 0, o$6 = i$8.length, s$8; a$11 < o$6; a$11++) {
37
- s$8 = i$8[a$11];
38
- if (!m$3.call(e$7, s$8) && s$8 !== n$4) u$5(e$7, s$8, {
39
- get: ((e$8) => t$7[e$8]).bind(null, s$8),
40
- enumerable: !(r = d(t$7, s$8)) || r.enumerable
41
- });
42
- }
43
- return e$7;
44
- };
45
- var _$1 = (e$7, t$7, n$4) => (n$4 = e$7 != null ? l$2(p$1(e$7)) : {}, g(t$7 || !e$7 || !e$7.__esModule ? u$5(n$4, "default", {
46
- value: e$7,
47
- enumerable: true
48
- }) : n$4, e$7));
49
- var v$2 = /* @__PURE__ */ createRequire$1(import.meta.url);
50
- const y$3 = /^path$/i;
51
- const b = {
52
- key: "PATH",
53
- value: ""
54
- };
55
- function x(e$7) {
56
- for (const t$7 in e$7) {
57
- if (!Object.prototype.hasOwnProperty.call(e$7, t$7) || !y$3.test(t$7)) continue;
58
- const n$4 = e$7[t$7];
59
- if (!n$4) return b;
60
- return {
61
- key: t$7,
62
- value: n$4
63
- };
64
- }
65
- return b;
66
- }
67
- function S$1(e$7, t$7) {
68
- const i$8 = t$7.value.split(delimiter);
69
- let o$6 = e$7;
70
- let s$8;
71
- do {
72
- i$8.push(resolve$1(o$6, "node_modules", ".bin"));
73
- s$8 = o$6;
74
- o$6 = dirname$1(o$6);
75
- } while (o$6 !== s$8);
76
- return {
77
- key: t$7.key,
78
- value: i$8.join(delimiter)
79
- };
80
- }
81
- function C$1(e$7, t$7) {
82
- const n$4 = {
83
- ...process.env,
84
- ...t$7
85
- };
86
- const r = S$1(e$7, x(n$4));
87
- n$4[r.key] = r.value;
88
- return n$4;
89
- }
90
- const w$2 = (e$7) => {
91
- let t$7 = e$7.length;
92
- const n$4 = new PassThrough();
93
- const r = () => {
94
- if (--t$7 === 0) n$4.emit("end");
95
- };
96
- for (const t$8 of e$7) {
97
- t$8.pipe(n$4, { end: false });
98
- t$8.on("end", r);
99
- }
100
- return n$4;
101
- };
102
- var T$1 = h$1((exports, t$7) => {
103
- t$7.exports = a$11;
104
- a$11.sync = o$6;
105
- var n$4 = v$2("fs");
106
- function r(e$7, t$8) {
107
- var n$5 = t$8.pathExt !== void 0 ? t$8.pathExt : process.env.PATHEXT;
108
- if (!n$5) return true;
109
- n$5 = n$5.split(";");
110
- if (n$5.indexOf("") !== -1) return true;
111
- for (var r$3 = 0; r$3 < n$5.length; r$3++) {
112
- var i$9 = n$5[r$3].toLowerCase();
113
- if (i$9 && e$7.substr(-i$9.length).toLowerCase() === i$9) return true;
114
- }
115
- return false;
116
- }
117
- function i$8(e$7, t$8, n$5) {
118
- if (!e$7.isSymbolicLink() && !e$7.isFile()) return false;
119
- return r(t$8, n$5);
120
- }
121
- function a$11(e$7, t$8, r$3) {
122
- n$4.stat(e$7, function(n$5, a$12) {
123
- r$3(n$5, n$5 ? false : i$8(a$12, e$7, t$8));
124
- });
125
- }
126
- function o$6(e$7, t$8) {
127
- return i$8(n$4.statSync(e$7), e$7, t$8);
128
- }
129
- });
130
- var E$1 = h$1((exports, t$7) => {
131
- t$7.exports = r;
132
- r.sync = i$8;
133
- var n$4 = v$2("fs");
134
- function r(e$7, t$8, r$3) {
135
- n$4.stat(e$7, function(e$8, n$5) {
136
- r$3(e$8, e$8 ? false : a$11(n$5, t$8));
137
- });
138
- }
139
- function i$8(e$7, t$8) {
140
- return a$11(n$4.statSync(e$7), t$8);
141
- }
142
- function a$11(e$7, t$8) {
143
- return e$7.isFile() && o$6(e$7, t$8);
144
- }
145
- function o$6(e$7, t$8) {
146
- var n$5 = e$7.mode;
147
- var r$3 = e$7.uid;
148
- var i$9 = e$7.gid;
149
- var a$12 = t$8.uid !== void 0 ? t$8.uid : process.getuid && process.getuid();
150
- var o$7 = t$8.gid !== void 0 ? t$8.gid : process.getgid && process.getgid();
151
- var s$8 = parseInt("100", 8);
152
- var c$6 = parseInt("010", 8);
153
- var l$3 = parseInt("001", 8);
154
- var u$6 = s$8 | c$6;
155
- return n$5 & l$3 || n$5 & c$6 && i$9 === o$7 || n$5 & s$8 && r$3 === a$12 || n$5 & u$6 && a$12 === 0;
156
- }
157
- });
158
- var D = h$1((exports, t$7) => {
159
- v$2("fs");
160
- var r;
161
- if (process.platform === "win32" || global.TESTING_WINDOWS) r = T$1();
162
- else r = E$1();
163
- t$7.exports = i$8;
164
- i$8.sync = a$11;
165
- function i$8(e$7, t$8, n$4) {
166
- if (typeof t$8 === "function") {
167
- n$4 = t$8;
168
- t$8 = {};
169
- }
170
- if (!n$4) {
171
- if (typeof Promise !== "function") throw new TypeError("callback not provided");
172
- return new Promise(function(n$5, r$3) {
173
- i$8(e$7, t$8 || {}, function(e$8, t$9) {
174
- if (e$8) r$3(e$8);
175
- else n$5(t$9);
176
- });
177
- });
178
- }
179
- r(e$7, t$8 || {}, function(e$8, r$3) {
180
- if (e$8) {
181
- if (e$8.code === "EACCES" || t$8 && t$8.ignoreErrors) {
182
- e$8 = null;
183
- r$3 = false;
184
- }
185
- }
186
- n$4(e$8, r$3);
187
- });
188
- }
189
- function a$11(e$7, t$8) {
190
- try {
191
- return r.sync(e$7, t$8 || {});
192
- } catch (e$8) {
193
- if (t$8 && t$8.ignoreErrors || e$8.code === "EACCES") return false;
194
- else throw e$8;
195
- }
196
- }
197
- });
198
- var O$3 = h$1((exports, t$7) => {
199
- const n$4 = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
200
- const r = v$2("path");
201
- const i$8 = n$4 ? ";" : ":";
202
- const a$11 = D();
203
- const o$6 = (e$7) => Object.assign(/* @__PURE__ */ new Error(`not found: ${e$7}`), { code: "ENOENT" });
204
- const s$8 = (e$7, t$8) => {
205
- const r$3 = t$8.colon || i$8;
206
- const a$12 = e$7.match(/\//) || n$4 && e$7.match(/\\/) ? [""] : [...n$4 ? [process.cwd()] : [], ...(t$8.path || process.env.PATH || "").split(r$3)];
207
- const o$7 = n$4 ? t$8.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
208
- const s$9 = n$4 ? o$7.split(r$3) : [""];
209
- if (n$4) {
210
- if (e$7.indexOf(".") !== -1 && s$9[0] !== "") s$9.unshift("");
211
- }
212
- return {
213
- pathEnv: a$12,
214
- pathExt: s$9,
215
- pathExtExe: o$7
216
- };
217
- };
218
- const c$6 = (e$7, t$8, n$5) => {
219
- if (typeof t$8 === "function") {
220
- n$5 = t$8;
221
- t$8 = {};
222
- }
223
- if (!t$8) t$8 = {};
224
- const { pathEnv: i$9, pathExt: c$7, pathExtExe: l$4 } = s$8(e$7, t$8);
225
- const u$6 = [];
226
- const d = (n$6) => new Promise((a$12, s$9) => {
227
- if (n$6 === i$9.length) return t$8.all && u$6.length ? a$12(u$6) : s$9(o$6(e$7));
228
- const c$8 = i$9[n$6];
229
- const l$5 = /^".*"$/.test(c$8) ? c$8.slice(1, -1) : c$8;
230
- const d$1 = r.join(l$5, e$7);
231
- a$12(f$5(!l$5 && /^\.[\\\/]/.test(e$7) ? e$7.slice(0, 2) + d$1 : d$1, n$6, 0));
232
- });
233
- const f$5 = (e$8, n$6, r$3) => new Promise((i$10, o$7) => {
234
- if (r$3 === c$7.length) return i$10(d(n$6 + 1));
235
- const s$9 = c$7[r$3];
236
- a$11(e$8 + s$9, { pathExt: l$4 }, (a$12, o$8) => {
237
- if (!a$12 && o$8) if (t$8.all) u$6.push(e$8 + s$9);
238
- else return i$10(e$8 + s$9);
239
- return i$10(f$5(e$8, n$6, r$3 + 1));
240
- });
241
- });
242
- return n$5 ? d(0).then((e$8) => n$5(null, e$8), n$5) : d(0);
243
- };
244
- const l$3 = (e$7, t$8) => {
245
- t$8 = t$8 || {};
246
- const { pathEnv: n$5, pathExt: i$9, pathExtExe: c$7 } = s$8(e$7, t$8);
247
- const l$4 = [];
248
- for (let o$7 = 0; o$7 < n$5.length; o$7++) {
249
- const s$9 = n$5[o$7];
250
- const u$6 = /^".*"$/.test(s$9) ? s$9.slice(1, -1) : s$9;
251
- const d = r.join(u$6, e$7);
252
- const f$5 = !u$6 && /^\.[\\\/]/.test(e$7) ? e$7.slice(0, 2) + d : d;
253
- for (let e$8 = 0; e$8 < i$9.length; e$8++) {
254
- const n$6 = f$5 + i$9[e$8];
255
- try {
256
- if (a$11.sync(n$6, { pathExt: c$7 })) if (t$8.all) l$4.push(n$6);
257
- else return n$6;
258
- } catch (e$9) {}
259
- }
260
- }
261
- if (t$8.all && l$4.length) return l$4;
262
- if (t$8.nothrow) return null;
263
- throw o$6(e$7);
264
- };
265
- t$7.exports = c$6;
266
- c$6.sync = l$3;
267
- });
268
- var k$1 = h$1((exports, t$7) => {
269
- const n$4 = (e$7 = {}) => {
270
- const t$8 = e$7.env || process.env;
271
- if ((e$7.platform || process.platform) !== "win32") return "PATH";
272
- return Object.keys(t$8).reverse().find((e$8) => e$8.toUpperCase() === "PATH") || "Path";
273
- };
274
- t$7.exports = n$4;
275
- t$7.exports.default = n$4;
276
- });
277
- var A = h$1((exports, t$7) => {
278
- const n$4 = v$2("path");
279
- const r = O$3();
280
- const i$8 = k$1();
281
- function a$11(e$7, t$8) {
282
- const a$12 = e$7.options.env || process.env;
283
- const o$7 = process.cwd();
284
- const s$8 = e$7.options.cwd != null;
285
- const c$6 = s$8 && process.chdir !== void 0 && !process.chdir.disabled;
286
- if (c$6) try {
287
- process.chdir(e$7.options.cwd);
288
- } catch (e$8) {}
289
- let l$3;
290
- try {
291
- l$3 = r.sync(e$7.command, {
292
- path: a$12[i$8({ env: a$12 })],
293
- pathExt: t$8 ? n$4.delimiter : void 0
294
- });
295
- } catch (e$8) {} finally {
296
- if (c$6) process.chdir(o$7);
297
- }
298
- if (l$3) l$3 = n$4.resolve(s$8 ? e$7.options.cwd : "", l$3);
299
- return l$3;
300
- }
301
- function o$6(e$7) {
302
- return a$11(e$7) || a$11(e$7, true);
303
- }
304
- t$7.exports = o$6;
305
- });
306
- var j$2 = h$1((exports, t$7) => {
307
- const n$4 = /([()\][%!^"`<>&|;, *?])/g;
308
- function r(e$7) {
309
- e$7 = e$7.replace(n$4, "^$1");
310
- return e$7;
311
- }
312
- function i$8(e$7, t$8) {
313
- e$7 = `${e$7}`;
314
- e$7 = e$7.replace(/(\\*)"/g, "$1$1\\\"");
315
- e$7 = e$7.replace(/(\\*)$/, "$1$1");
316
- e$7 = `"${e$7}"`;
317
- e$7 = e$7.replace(n$4, "^$1");
318
- if (t$8) e$7 = e$7.replace(n$4, "^$1");
319
- return e$7;
320
- }
321
- t$7.exports.command = r;
322
- t$7.exports.argument = i$8;
323
- });
324
- var M = h$1((exports, t$7) => {
325
- t$7.exports = /^#!(.*)/;
326
- });
327
- var N = h$1((exports, t$7) => {
328
- const n$4 = M();
329
- t$7.exports = (e$7 = "") => {
330
- const t$8 = e$7.match(n$4);
331
- if (!t$8) return null;
332
- const [r, i$8] = t$8[0].replace(/#! ?/, "").split(" ");
333
- const a$11 = r.split("/").pop();
334
- if (a$11 === "env") return i$8;
335
- return i$8 ? `${a$11} ${i$8}` : a$11;
336
- };
337
- });
338
- var P$1 = h$1((exports, t$7) => {
339
- const n$4 = v$2("fs");
340
- const r = N();
341
- function i$8(e$7) {
342
- const t$8 = 150;
343
- const i$9 = Buffer.alloc(t$8);
344
- let a$11;
345
- try {
346
- a$11 = n$4.openSync(e$7, "r");
347
- n$4.readSync(a$11, i$9, 0, t$8, 0);
348
- n$4.closeSync(a$11);
349
- } catch (e$8) {}
350
- return r(i$9.toString());
351
- }
352
- t$7.exports = i$8;
353
- });
354
- var F$3 = h$1((exports, t$7) => {
355
- const n$4 = v$2("path");
356
- const r = A();
357
- const i$8 = j$2();
358
- const a$11 = P$1();
359
- const o$6 = process.platform === "win32";
360
- const s$8 = /\.(?:com|exe)$/i;
361
- const c$6 = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
362
- function l$3(e$7) {
363
- e$7.file = r(e$7);
364
- const t$8 = e$7.file && a$11(e$7.file);
365
- if (t$8) {
366
- e$7.args.unshift(e$7.file);
367
- e$7.command = t$8;
368
- return r(e$7);
369
- }
370
- return e$7.file;
371
- }
372
- function u$6(e$7) {
373
- if (!o$6) return e$7;
374
- const t$8 = l$3(e$7);
375
- const r$3 = !s$8.test(t$8);
376
- if (e$7.options.forceShell || r$3) {
377
- const r$4 = c$6.test(t$8);
378
- e$7.command = n$4.normalize(e$7.command);
379
- e$7.command = i$8.command(e$7.command);
380
- e$7.args = e$7.args.map((e$8) => i$8.argument(e$8, r$4));
381
- e$7.args = [
382
- "/d",
383
- "/s",
384
- "/c",
385
- `"${[e$7.command].concat(e$7.args).join(" ")}"`
386
- ];
387
- e$7.command = process.env.comspec || "cmd.exe";
388
- e$7.options.windowsVerbatimArguments = true;
389
- }
390
- return e$7;
391
- }
392
- function d(e$7, t$8, n$5) {
393
- if (t$8 && !Array.isArray(t$8)) {
394
- n$5 = t$8;
395
- t$8 = null;
396
- }
397
- t$8 = t$8 ? t$8.slice(0) : [];
398
- n$5 = Object.assign({}, n$5);
399
- const r$3 = {
400
- command: e$7,
401
- args: t$8,
402
- options: n$5,
403
- file: void 0,
404
- original: {
405
- command: e$7,
406
- args: t$8
407
- }
408
- };
409
- return n$5.shell ? r$3 : u$6(r$3);
410
- }
411
- t$7.exports = d;
412
- });
413
- var I = h$1((exports, t$7) => {
414
- const n$4 = process.platform === "win32";
415
- function r(e$7, t$8) {
416
- return Object.assign(/* @__PURE__ */ new Error(`${t$8} ${e$7.command} ENOENT`), {
417
- code: "ENOENT",
418
- errno: "ENOENT",
419
- syscall: `${t$8} ${e$7.command}`,
420
- path: e$7.command,
421
- spawnargs: e$7.args
422
- });
423
- }
424
- function i$8(e$7, t$8) {
425
- if (!n$4) return;
426
- const r$3 = e$7.emit;
427
- e$7.emit = function(n$5, i$9) {
428
- if (n$5 === "exit") {
429
- const n$6 = a$11(i$9, t$8, "spawn");
430
- if (n$6) return r$3.call(e$7, "error", n$6);
431
- }
432
- return r$3.apply(e$7, arguments);
433
- };
434
- }
435
- function a$11(e$7, t$8) {
436
- if (n$4 && e$7 === 1 && !t$8.file) return r(t$8.original, "spawn");
437
- return null;
438
- }
439
- function o$6(e$7, t$8) {
440
- if (n$4 && e$7 === 1 && !t$8.file) return r(t$8.original, "spawnSync");
441
- return null;
442
- }
443
- t$7.exports = {
444
- hookChildProcess: i$8,
445
- verifyENOENT: a$11,
446
- verifyENOENTSync: o$6,
447
- notFoundError: r
448
- };
449
- });
450
- var R$2 = _$1(h$1((exports, t$7) => {
451
- const n$4 = v$2("child_process");
452
- const r = F$3();
453
- const i$8 = I();
454
- function a$11(e$7, t$8, a$12) {
455
- const o$7 = r(e$7, t$8, a$12);
456
- const s$8 = n$4.spawn(o$7.command, o$7.args, o$7.options);
457
- i$8.hookChildProcess(s$8, o$7);
458
- return s$8;
459
- }
460
- function o$6(e$7, t$8, a$12) {
461
- const o$7 = r(e$7, t$8, a$12);
462
- const s$8 = n$4.spawnSync(o$7.command, o$7.args, o$7.options);
463
- s$8.error = s$8.error || i$8.verifyENOENTSync(s$8.status, o$7);
464
- return s$8;
465
- }
466
- t$7.exports = a$11;
467
- t$7.exports.spawn = a$11;
468
- t$7.exports.sync = o$6;
469
- t$7.exports._parse = r;
470
- t$7.exports._enoent = i$8;
471
- })(), 1);
472
- var z$1 = class extends Error {
473
- result;
474
- output;
475
- get exitCode() {
476
- if (this.result.exitCode !== null) return this.result.exitCode;
477
- }
478
- constructor(e$7, t$7) {
479
- super(`Process exited with non-zero status (${e$7.exitCode})`);
480
- this.result = e$7;
481
- this.output = t$7;
482
- }
483
- };
484
- const B = {
485
- timeout: void 0,
486
- persist: false
487
- };
488
- const V = { windowsHide: true };
489
- function H$2(e$7, t$7) {
490
- return {
491
- command: normalize$1(e$7),
492
- args: t$7 ?? []
493
- };
494
- }
495
- function U(e$7) {
496
- const t$7 = new AbortController();
497
- for (const n$4 of e$7) {
498
- if (n$4.aborted) {
499
- t$7.abort();
500
- return n$4;
501
- }
502
- const e$8 = () => {
503
- t$7.abort(n$4.reason);
504
- };
505
- n$4.addEventListener("abort", e$8, { signal: t$7.signal });
506
- }
507
- return t$7.signal;
508
- }
509
- async function W(e$7) {
510
- let t$7 = "";
511
- for await (const n$4 of e$7) t$7 += n$4.toString();
512
- return t$7;
513
- }
514
- var G$1 = class {
515
- _process;
516
- _aborted = false;
517
- _options;
518
- _command;
519
- _args;
520
- _resolveClose;
521
- _processClosed;
522
- _thrownError;
523
- get process() {
524
- return this._process;
525
- }
526
- get pid() {
527
- return this._process?.pid;
528
- }
529
- get exitCode() {
530
- if (this._process && this._process.exitCode !== null) return this._process.exitCode;
531
- }
532
- constructor(e$7, t$7, n$4) {
533
- this._options = {
534
- ...B,
535
- ...n$4
536
- };
537
- this._command = e$7;
538
- this._args = t$7 ?? [];
539
- this._processClosed = new Promise((e$8) => {
540
- this._resolveClose = e$8;
541
- });
542
- }
543
- kill(e$7) {
544
- return this._process?.kill(e$7) === true;
545
- }
546
- get aborted() {
547
- return this._aborted;
548
- }
549
- get killed() {
550
- return this._process?.killed === true;
551
- }
552
- pipe(e$7, t$7, n$4) {
553
- return q$1(e$7, t$7, {
554
- ...n$4,
555
- stdin: this
556
- });
557
- }
558
- async *[Symbol.asyncIterator]() {
559
- const e$7 = this._process;
560
- if (!e$7) return;
561
- const t$7 = [];
562
- if (this._streamErr) t$7.push(this._streamErr);
563
- if (this._streamOut) t$7.push(this._streamOut);
564
- const n$4 = w$2(t$7);
565
- const r = c.createInterface({ input: n$4 });
566
- for await (const e$8 of r) yield e$8.toString();
567
- await this._processClosed;
568
- e$7.removeAllListeners();
569
- if (this._thrownError) throw this._thrownError;
570
- if (this._options?.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new z$1(this);
571
- }
572
- async _waitForOutput() {
573
- const e$7 = this._process;
574
- if (!e$7) throw new Error("No process was started");
575
- const [t$7, n$4] = await Promise.all([this._streamOut ? W(this._streamOut) : "", this._streamErr ? W(this._streamErr) : ""]);
576
- await this._processClosed;
577
- if (this._options?.stdin) await this._options.stdin;
578
- e$7.removeAllListeners();
579
- if (this._thrownError) throw this._thrownError;
580
- const r = {
581
- stderr: n$4,
582
- stdout: t$7,
583
- exitCode: this.exitCode
584
- };
585
- if (this._options.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new z$1(this, r);
586
- return r;
587
- }
588
- then(e$7, t$7) {
589
- return this._waitForOutput().then(e$7, t$7);
590
- }
591
- _streamOut;
592
- _streamErr;
593
- spawn() {
594
- const e$7 = cwd();
595
- const n$4 = this._options;
596
- const r = {
597
- ...V,
598
- ...n$4.nodeOptions
599
- };
600
- const i$8 = [];
601
- this._resetState();
602
- if (n$4.timeout !== void 0) i$8.push(AbortSignal.timeout(n$4.timeout));
603
- if (n$4.signal !== void 0) i$8.push(n$4.signal);
604
- if (n$4.persist === true) r.detached = true;
605
- if (i$8.length > 0) r.signal = U(i$8);
606
- r.env = C$1(e$7, r.env);
607
- const { command: a$11, args: s$8 } = H$2(this._command, this._args);
608
- const c$6 = (0, R$2._parse)(a$11, s$8, r);
609
- const l$3 = spawn(c$6.command, c$6.args, c$6.options);
610
- if (l$3.stderr) this._streamErr = l$3.stderr;
611
- if (l$3.stdout) this._streamOut = l$3.stdout;
612
- this._process = l$3;
613
- l$3.once("error", this._onError);
614
- l$3.once("close", this._onClose);
615
- if (n$4.stdin !== void 0 && l$3.stdin && n$4.stdin.process) {
616
- const { stdout: e$8 } = n$4.stdin.process;
617
- if (e$8) e$8.pipe(l$3.stdin);
618
- }
619
- }
620
- _resetState() {
621
- this._aborted = false;
622
- this._processClosed = new Promise((e$7) => {
623
- this._resolveClose = e$7;
624
- });
625
- this._thrownError = void 0;
626
- }
627
- _onError = (e$7) => {
628
- if (e$7.name === "AbortError" && (!(e$7.cause instanceof Error) || e$7.cause.name !== "TimeoutError")) {
629
- this._aborted = true;
630
- return;
631
- }
632
- this._thrownError = e$7;
633
- };
634
- _onClose = () => {
635
- if (this._resolveClose) this._resolveClose();
636
- };
637
- };
638
- const K = (e$7, t$7, n$4) => {
639
- const r = new G$1(e$7, t$7, n$4);
640
- r.spawn();
641
- return r;
642
- };
643
- const q$1 = K;
644
-
645
- //#endregion
646
- //#region node_modules/.pnpm/nypm@0.6.4/node_modules/nypm/dist/index.mjs
647
- var dist_exports$1 = /* @__PURE__ */ __exportAll({
648
- addDependency: () => addDependency,
649
- addDevDependency: () => addDevDependency,
650
- detectPackageManager: () => detectPackageManager,
651
- installDependencies: () => installDependencies,
652
- packageManagers: () => packageManagers
653
- });
654
- async function findup(cwd$1, match, options = {}) {
655
- const segments = normalize$2(cwd$1).split("/");
656
- while (segments.length > 0) {
657
- const result = await match(segments.join("/") || "/");
658
- if (result || !options.includeParentDirs) return result;
659
- segments.pop();
660
- }
661
- }
662
- async function readPackageJSON(cwd$1) {
663
- return findup(cwd$1, (p$2) => {
664
- const pkgPath = join$1(p$2, "package.json");
665
- if (existsSync(pkgPath)) return readFile(pkgPath, "utf8").then((data) => JSON.parse(data));
666
- });
667
- }
668
- function cached(fn) {
669
- let v$3;
670
- return () => {
671
- if (v$3 === void 0) v$3 = fn().then((r) => {
672
- v$3 = r;
673
- return v$3;
674
- });
675
- return v$3;
676
- };
677
- }
678
- const hasCorepack = cached(async () => {
679
- if (globalThis.process?.versions?.webcontainer) return false;
680
- try {
681
- const { exitCode } = await K("corepack", ["--version"]);
682
- return exitCode === 0;
683
- } catch {
684
- return false;
685
- }
686
- });
687
- async function executeCommand(command, args, options = {}) {
688
- const xArgs = command !== "npm" && command !== "bun" && command !== "deno" && options.corepack !== false && await hasCorepack() ? ["corepack", [command, ...args]] : [command, args];
689
- const { exitCode, stdout, stderr } = await K(xArgs[0], xArgs[1], { nodeOptions: {
690
- cwd: resolve$2(options.cwd || process.cwd()),
691
- env: options.env,
692
- stdio: options.silent ? "pipe" : "inherit"
693
- } });
694
- if (exitCode !== 0) throw new Error(`\`${xArgs.flat().join(" ")}\` failed.${options.silent ? [
695
- "",
696
- stdout,
697
- stderr
698
- ].join("\n") : ""}`);
699
- }
700
- const NO_PACKAGE_MANAGER_DETECTED_ERROR_MSG = "No package manager auto-detected.";
701
- async function resolveOperationOptions(options = {}) {
702
- const cwd$1 = options.cwd || process.cwd();
703
- const env = {
704
- ...process.env,
705
- ...options.env
706
- };
707
- const packageManager = (typeof options.packageManager === "string" ? packageManagers.find((pm) => pm.name === options.packageManager) : options.packageManager) || await detectPackageManager(options.cwd || process.cwd());
708
- if (!packageManager) throw new Error(NO_PACKAGE_MANAGER_DETECTED_ERROR_MSG);
709
- return {
710
- cwd: cwd$1,
711
- env,
712
- silent: options.silent ?? false,
713
- packageManager,
714
- dev: options.dev ?? false,
715
- workspace: options.workspace,
716
- global: options.global ?? false,
717
- dry: options.dry ?? false,
718
- corepack: options.corepack ?? true
719
- };
720
- }
721
- function getWorkspaceArgs(options) {
722
- if (!options.workspace) return [];
723
- const workspacePkg = typeof options.workspace === "string" && options.workspace !== "" ? options.workspace : void 0;
724
- if (options.packageManager.name === "pnpm") return workspacePkg ? ["--filter", workspacePkg] : ["--workspace-root"];
725
- if (options.packageManager.name === "npm") return workspacePkg ? ["-w", workspacePkg] : ["--workspaces"];
726
- if (options.packageManager.name === "yarn") if (!options.packageManager.majorVersion || options.packageManager.majorVersion === "1") return workspacePkg ? ["--cwd", workspacePkg] : ["-W"];
727
- else return workspacePkg ? ["workspace", workspacePkg] : [];
728
- return [];
729
- }
730
- function parsePackageManagerField(packageManager) {
731
- const [name, _version] = (packageManager || "").split("@");
732
- const [version, buildMeta] = _version?.split("+") || [];
733
- if (name && name !== "-" && /^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(name)) return {
734
- name,
735
- version,
736
- buildMeta
737
- };
738
- const sanitized = (name || "").replace(/\W+/g, "");
739
- return {
740
- name: sanitized,
741
- version,
742
- buildMeta,
743
- warnings: [`Abnormal characters found in \`packageManager\` field, sanitizing from \`${name}\` to \`${sanitized}\``]
744
- };
745
- }
746
- const packageManagers = [
747
- {
748
- name: "npm",
749
- command: "npm",
750
- lockFile: "package-lock.json"
751
- },
752
- {
753
- name: "pnpm",
754
- command: "pnpm",
755
- lockFile: "pnpm-lock.yaml",
756
- files: ["pnpm-workspace.yaml"]
757
- },
758
- {
759
- name: "bun",
760
- command: "bun",
761
- lockFile: ["bun.lockb", "bun.lock"]
762
- },
763
- {
764
- name: "yarn",
765
- command: "yarn",
766
- lockFile: "yarn.lock",
767
- files: [".yarnrc.yml"]
768
- },
769
- {
770
- name: "deno",
771
- command: "deno",
772
- lockFile: "deno.lock",
773
- files: ["deno.json"]
774
- }
775
- ];
776
- /**
777
- * Detect the package manager used in a directory (and up) by checking various sources:
778
- *
779
- * 1. Use `packageManager` field from package.json
780
- *
781
- * 2. Known lock files and other files
782
- */
783
- async function detectPackageManager(cwd$1, options = {}) {
784
- const detected = await findup(resolve$2(cwd$1 || "."), async (path$2) => {
785
- if (!options.ignorePackageJSON) {
786
- const packageJSONPath = join$2(path$2, "package.json");
787
- if (existsSync(packageJSONPath)) {
788
- const packageJSON = JSON.parse(await readFile(packageJSONPath, "utf8"));
789
- if (packageJSON?.packageManager) {
790
- const { name, version = "0.0.0", buildMeta, warnings } = parsePackageManagerField(packageJSON.packageManager);
791
- if (name) {
792
- const majorVersion = version.split(".")[0];
793
- const packageManager = packageManagers.find((pm) => pm.name === name && pm.majorVersion === majorVersion) || packageManagers.find((pm) => pm.name === name);
794
- return {
795
- name,
796
- command: name,
797
- version,
798
- majorVersion,
799
- buildMeta,
800
- warnings,
801
- files: packageManager?.files,
802
- lockFile: packageManager?.lockFile
803
- };
804
- }
805
- }
806
- }
807
- if (existsSync(join$2(path$2, "deno.json"))) return packageManagers.find((pm) => pm.name === "deno");
808
- }
809
- if (!options.ignoreLockFile) {
810
- for (const packageManager of packageManagers) if ([packageManager.lockFile, packageManager.files].flat().filter(Boolean).some((file) => existsSync(resolve$2(path$2, file)))) return { ...packageManager };
811
- }
812
- }, { includeParentDirs: options.includeParentDirs ?? true });
813
- if (!detected && !options.ignoreArgv) {
814
- const scriptArg = process.argv[1];
815
- if (scriptArg) {
816
- for (const packageManager of packageManagers) if ((/* @__PURE__ */ new RegExp(`[/\\\\]\\.?${packageManager.command}`)).test(scriptArg)) return packageManager;
817
- }
818
- }
819
- return detected;
820
- }
821
- /**
822
- * Installs project dependencies.
823
- *
824
- * @param options - Options to pass to the API call.
825
- * @param options.cwd - The directory to run the command in.
826
- * @param options.silent - Whether to run the command in silent mode.
827
- * @param options.packageManager - The package manager info to use (auto-detected).
828
- * @param options.frozenLockFile - Whether to install dependencies with frozen lock file.
829
- */
830
- async function installDependencies(options = {}) {
831
- const resolvedOptions = await resolveOperationOptions(options);
832
- const commandArgs = options.frozenLockFile ? {
833
- npm: ["ci"],
834
- yarn: ["install", "--immutable"],
835
- bun: ["install", "--frozen-lockfile"],
836
- pnpm: ["install", "--frozen-lockfile"],
837
- deno: ["install", "--frozen"]
838
- }[resolvedOptions.packageManager.name] : ["install"];
839
- if (options.ignoreWorkspace && resolvedOptions.packageManager.name === "pnpm") commandArgs.push("--ignore-workspace");
840
- if (!resolvedOptions.dry) await executeCommand(resolvedOptions.packageManager.command, commandArgs, {
841
- cwd: resolvedOptions.cwd,
842
- silent: resolvedOptions.silent,
843
- corepack: resolvedOptions.corepack
844
- });
845
- return { exec: {
846
- command: resolvedOptions.packageManager.command,
847
- args: commandArgs
848
- } };
849
- }
850
- /**
851
- * Adds dependency to the project.
852
- *
853
- * @param name - Name of the dependency to add.
854
- * @param options - Options to pass to the API call.
855
- * @param options.cwd - The directory to run the command in.
856
- * @param options.silent - Whether to run the command in silent mode.
857
- * @param options.packageManager - The package manager info to use (auto-detected).
858
- * @param options.dev - Whether to add the dependency as dev dependency.
859
- * @param options.workspace - The name of the workspace to use.
860
- * @param options.global - Whether to run the command in global mode.
861
- */
862
- async function addDependency(name, options = {}) {
863
- const resolvedOptions = await resolveOperationOptions(options);
864
- const names = Array.isArray(name) ? name : [name];
865
- if (resolvedOptions.packageManager.name === "deno") {
866
- for (let i$8 = 0; i$8 < names.length; i$8++) if (!/^(npm|jsr|file):.+$/.test(names[i$8] || "")) names[i$8] = `npm:${names[i$8]}`;
867
- }
868
- if (names.length === 0) return {};
869
- const args = (resolvedOptions.packageManager.name === "yarn" ? [
870
- ...getWorkspaceArgs(resolvedOptions),
871
- resolvedOptions.global && resolvedOptions.packageManager.majorVersion === "1" ? "global" : "",
872
- "add",
873
- resolvedOptions.dev ? "-D" : "",
874
- ...names
875
- ] : [
876
- resolvedOptions.packageManager.name === "npm" ? "install" : "add",
877
- ...getWorkspaceArgs(resolvedOptions),
878
- resolvedOptions.dev ? "-D" : "",
879
- resolvedOptions.global ? "-g" : "",
880
- ...names
881
- ]).filter(Boolean);
882
- if (!resolvedOptions.dry) await executeCommand(resolvedOptions.packageManager.command, args, {
883
- cwd: resolvedOptions.cwd,
884
- silent: resolvedOptions.silent,
885
- corepack: resolvedOptions.corepack
886
- });
887
- if (!resolvedOptions.dry && options.installPeerDependencies) {
888
- const existingPkg = await readPackageJSON(resolvedOptions.cwd);
889
- const peerDeps = [];
890
- const peerDevDeps = [];
891
- for (const _name of names) {
892
- const pkgName = _name.match(/^(.[^@]+)/)?.[0];
893
- const pkg = createRequire(join$1(resolvedOptions.cwd, "/_.js"))(`${pkgName}/package.json`);
894
- if (!pkg.peerDependencies || pkg.name !== pkgName) continue;
895
- for (const [peerDependency, version] of Object.entries(pkg.peerDependencies)) {
896
- if (pkg.peerDependenciesMeta?.[peerDependency]?.optional) continue;
897
- if (existingPkg?.dependencies?.[peerDependency] || existingPkg?.devDependencies?.[peerDependency]) continue;
898
- (pkg.peerDependenciesMeta?.[peerDependency]?.dev ? peerDevDeps : peerDeps).push(`${peerDependency}@${version}`);
899
- }
900
- }
901
- if (peerDeps.length > 0) await addDependency(peerDeps, { ...resolvedOptions });
902
- if (peerDevDeps.length > 0) await addDevDependency(peerDevDeps, { ...resolvedOptions });
903
- }
904
- return { exec: {
905
- command: resolvedOptions.packageManager.command,
906
- args
907
- } };
908
- }
909
- /**
910
- * Adds dev dependency to the project.
911
- *
912
- * @param name - Name of the dev dependency to add.
913
- * @param options - Options to pass to the API call.
914
- * @param options.cwd - The directory to run the command in.
915
- * @param options.silent - Whether to run the command in silent mode.
916
- * @param options.packageManager - The package manager info to use (auto-detected).
917
- * @param options.workspace - The name of the workspace to use.
918
- * @param options.global - Whether to run the command in global mode.
919
- *
920
- */
921
- async function addDevDependency(name, options = {}) {
922
- return await addDependency(name, {
923
- ...options,
924
- dev: true
925
- });
926
- }
927
-
928
- //#endregion
929
- //#region node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/native.mjs
930
- const e$6 = globalThis.Blob, o$5 = globalThis.File, a$10 = globalThis.FormData, s$7 = globalThis.Headers, t$6 = globalThis.Request, h = globalThis.Response, i$7 = globalThis.AbortController, l$1 = globalThis.fetch || (() => {
931
- throw new Error("[node-fetch-native] Failed to fetch: `globalThis.fetch` is not available!");
932
- });
933
-
934
- //#endregion
935
- //#region node_modules/.pnpm/giget@2.0.0/node_modules/giget/dist/shared/giget.OCaTp9b-.mjs
936
- var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
937
- function getDefaultExportFromCjs(x$1) {
938
- return x$1 && x$1.__esModule && Object.prototype.hasOwnProperty.call(x$1, "default") ? x$1["default"] : x$1;
939
- }
940
- var i$6, t$5;
941
- function s$6() {
942
- if (t$5) return i$6;
943
- t$5 = 1;
944
- const n = new Map([
945
- ["C", "cwd"],
946
- ["f", "file"],
947
- ["z", "gzip"],
948
- ["P", "preservePaths"],
949
- ["U", "unlink"],
950
- ["strip-components", "strip"],
951
- ["stripComponents", "strip"],
952
- ["keep-newer", "newer"],
953
- ["keepNewer", "newer"],
954
- ["keep-newer-files", "newer"],
955
- ["keepNewerFiles", "newer"],
956
- ["k", "keep"],
957
- ["keep-existing", "keep"],
958
- ["keepExisting", "keep"],
959
- ["m", "noMtime"],
960
- ["no-mtime", "noMtime"],
961
- ["p", "preserveOwner"],
962
- ["L", "follow"],
963
- ["h", "follow"]
964
- ]);
965
- return i$6 = (r) => r ? Object.keys(r).map((e) => [n.has(e) ? n.get(e) : e, r[e]]).reduce((e, p) => (e[p[0]] = p[1], e), Object.create(null)) : {}, i$6;
966
- }
967
- var e$5, t$4;
968
- function c$4() {
969
- return t$4 || (t$4 = 1, e$5 = (o) => class extends o {
970
- warn(n, i, r = {}) {
971
- this.file && (r.file = this.file), this.cwd && (r.cwd = this.cwd), r.code = i instanceof Error && i.code || n, r.tarCode = n, !this.strict && r.recoverable !== false ? (i instanceof Error && (r = Object.assign(i, r), i = i.message), this.emit("warn", r.tarCode, i, r)) : i instanceof Error ? this.emit("error", Object.assign(i, r)) : this.emit("error", Object.assign(/* @__PURE__ */ new Error(`${n}: ${i}`), r));
972
- }
973
- }), e$5;
974
- }
975
- var e$4 = {};
976
- var a$9;
977
- function n$3() {
978
- return a$9 ? e$4 : (a$9 = 1, function(e) {
979
- e.name = new Map([
980
- ["0", "File"],
981
- ["", "OldFile"],
982
- ["1", "Link"],
983
- ["2", "SymbolicLink"],
984
- ["3", "CharacterDevice"],
985
- ["4", "BlockDevice"],
986
- ["5", "Directory"],
987
- ["6", "FIFO"],
988
- ["7", "ContiguousFile"],
989
- ["g", "GlobalExtendedHeader"],
990
- ["x", "ExtendedHeader"],
991
- ["A", "SolarisACL"],
992
- ["D", "GNUDumpDir"],
993
- ["I", "Inode"],
994
- ["K", "NextFileHasLongLinkpath"],
995
- ["L", "NextFileHasLongPath"],
996
- ["M", "ContinuationFile"],
997
- ["N", "OldGnuLongPath"],
998
- ["S", "SparseFile"],
999
- ["V", "TapeVolumeHeader"],
1000
- ["X", "OldExtendedHeader"]
1001
- ]), e.code = new Map(Array.from(e.name).map((i) => [i[1], i[0]]));
1002
- }(e$4), e$4);
1003
- }
1004
- var f$3, i$5;
1005
- function w$1() {
1006
- if (i$5) return f$3;
1007
- i$5 = 1;
1008
- const v = (e, r) => {
1009
- if (Number.isSafeInteger(e)) e < 0 ? g$1(e, r) : p(e, r);
1010
- else throw Error("cannot encode number outside of javascript safe integer range");
1011
- return r;
1012
- }, p = (e, r) => {
1013
- r[0] = 128;
1014
- for (var o = r.length; o > 1; o--) r[o - 1] = e & 255, e = Math.floor(e / 256);
1015
- }, g$1 = (e, r) => {
1016
- r[0] = 255;
1017
- var o = false;
1018
- e = e * -1;
1019
- for (var s = r.length; s > 1; s--) {
1020
- var a = e & 255;
1021
- e = Math.floor(e / 256), o ? r[s - 1] = l(a) : a === 0 ? r[s - 1] = 0 : (o = true, r[s - 1] = c$1(a));
1022
- }
1023
- }, h$2 = (e) => {
1024
- const r = e[0], o = r === 128 ? d$1(e.slice(1, e.length)) : r === 255 ? x$1(e) : null;
1025
- if (o === null) throw Error("invalid base256 encoding");
1026
- if (!Number.isSafeInteger(o)) throw Error("parsed number outside of javascript safe integer range");
1027
- return o;
1028
- }, x$1 = (e) => {
1029
- for (var r = e.length, o = 0, s = false, a = r - 1; a > -1; a--) {
1030
- var n = e[a], t;
1031
- s ? t = l(n) : n === 0 ? t = n : (s = true, t = c$1(n)), t !== 0 && (o -= t * Math.pow(256, r - a - 1));
1032
- }
1033
- return o;
1034
- }, d$1 = (e) => {
1035
- for (var r = e.length, o = 0, s = r - 1; s > -1; s--) {
1036
- var a = e[s];
1037
- a !== 0 && (o += a * Math.pow(256, r - s - 1));
1038
- }
1039
- return o;
1040
- }, l = (e) => (255 ^ e) & 255, c$1 = (e) => (255 ^ e) + 1 & 255;
1041
- return f$3 = {
1042
- encode: v,
1043
- parse: h$2
1044
- }, f$3;
1045
- }
1046
- var k, w;
1047
- function E() {
1048
- if (w) return k;
1049
- w = 1;
1050
- const u = n$3(), x$1 = path.posix, y = w$1(), P$2 = Symbol("slurp"), a = Symbol("type");
1051
- class B$1 {
1052
- constructor(e, t, i, h$2) {
1053
- this.cksumValid = false, this.needPax = false, this.nullBlock = false, this.block = null, this.path = null, this.mode = null, this.uid = null, this.gid = null, this.size = null, this.mtime = null, this.cksum = null, this[a] = "0", this.linkpath = null, this.uname = null, this.gname = null, this.devmaj = 0, this.devmin = 0, this.atime = null, this.ctime = null, Buffer.isBuffer(e) ? this.decode(e, t || 0, i, h$2) : e && this.set(e);
1054
- }
1055
- decode(e, t, i, h$2) {
1056
- if (t || (t = 0), !e || !(e.length >= t + 512)) throw new Error("need 512 bytes for header");
1057
- if (this.path = d$1(e, t, 100), this.mode = r(e, t + 100, 8), this.uid = r(e, t + 108, 8), this.gid = r(e, t + 116, 8), this.size = r(e, t + 124, 12), this.mtime = o(e, t + 136, 12), this.cksum = r(e, t + 148, 12), this[P$2](i), this[P$2](h$2, true), this[a] = d$1(e, t + 156, 1), this[a] === "" && (this[a] = "0"), this[a] === "0" && this.path.slice(-1) === "/" && (this[a] = "5"), this[a] === "5" && (this.size = 0), this.linkpath = d$1(e, t + 157, 100), e.slice(t + 257, t + 265).toString() === "ustar\x0000") if (this.uname = d$1(e, t + 265, 32), this.gname = d$1(e, t + 297, 32), this.devmaj = r(e, t + 329, 8), this.devmin = r(e, t + 337, 8), e[t + 475] !== 0) this.path = d$1(e, t + 345, 155) + "/" + this.path;
1058
- else {
1059
- const n = d$1(e, t + 345, 130);
1060
- n && (this.path = n + "/" + this.path), this.atime = o(e, t + 476, 12), this.ctime = o(e, t + 488, 12);
1061
- }
1062
- let l = 256;
1063
- for (let n = t; n < t + 148; n++) l += e[n];
1064
- for (let n = t + 156; n < t + 512; n++) l += e[n];
1065
- this.cksumValid = l === this.cksum, this.cksum === null && l === 256 && (this.nullBlock = true);
1066
- }
1067
- [P$2](e, t) {
1068
- for (const i in e) e[i] !== null && e[i] !== void 0 && !(t && i === "path") && (this[i] = e[i]);
1069
- }
1070
- encode(e, t) {
1071
- if (e || (e = this.block = Buffer.alloc(512), t = 0), t || (t = 0), !(e.length >= t + 512)) throw new Error("need 512 bytes for header");
1072
- const i = this.ctime || this.atime ? 130 : 155, h$2 = L(this.path || "", i), l = h$2[0], n = h$2[1];
1073
- this.needPax = h$2[2], this.needPax = m(e, t, 100, l) || this.needPax, this.needPax = c$1(e, t + 100, 8, this.mode) || this.needPax, this.needPax = c$1(e, t + 108, 8, this.uid) || this.needPax, this.needPax = c$1(e, t + 116, 8, this.gid) || this.needPax, this.needPax = c$1(e, t + 124, 12, this.size) || this.needPax, this.needPax = g$1(e, t + 136, 12, this.mtime) || this.needPax, e[t + 156] = this[a].charCodeAt(0), this.needPax = m(e, t + 157, 100, this.linkpath) || this.needPax, e.write("ustar\x0000", t + 257, 8), this.needPax = m(e, t + 265, 32, this.uname) || this.needPax, this.needPax = m(e, t + 297, 32, this.gname) || this.needPax, this.needPax = c$1(e, t + 329, 8, this.devmaj) || this.needPax, this.needPax = c$1(e, t + 337, 8, this.devmin) || this.needPax, this.needPax = m(e, t + 345, i, n) || this.needPax, e[t + 475] !== 0 ? this.needPax = m(e, t + 345, 155, n) || this.needPax : (this.needPax = m(e, t + 345, 130, n) || this.needPax, this.needPax = g$1(e, t + 476, 12, this.atime) || this.needPax, this.needPax = g$1(e, t + 488, 12, this.ctime) || this.needPax);
1074
- let S = 256;
1075
- for (let p = t; p < t + 148; p++) S += e[p];
1076
- for (let p = t + 156; p < t + 512; p++) S += e[p];
1077
- return this.cksum = S, c$1(e, t + 148, 8, this.cksum), this.cksumValid = true, this.needPax;
1078
- }
1079
- set(e) {
1080
- for (const t in e) e[t] !== null && e[t] !== void 0 && (this[t] = e[t]);
1081
- }
1082
- get type() {
1083
- return u.name.get(this[a]) || this[a];
1084
- }
1085
- get typeKey() {
1086
- return this[a];
1087
- }
1088
- set type(e) {
1089
- u.code.has(e) ? this[a] = u.code.get(e) : this[a] = e;
1090
- }
1091
- }
1092
- const L = (s, e) => {
1093
- let i = s, h$2 = "", l;
1094
- const n = x$1.parse(s).root || ".";
1095
- if (Buffer.byteLength(i) < 100) l = [
1096
- i,
1097
- h$2,
1098
- false
1099
- ];
1100
- else {
1101
- h$2 = x$1.dirname(i), i = x$1.basename(i);
1102
- do
1103
- Buffer.byteLength(i) <= 100 && Buffer.byteLength(h$2) <= e ? l = [
1104
- i,
1105
- h$2,
1106
- false
1107
- ] : Buffer.byteLength(i) > 100 && Buffer.byteLength(h$2) <= e ? l = [
1108
- i.slice(0, 99),
1109
- h$2,
1110
- true
1111
- ] : (i = x$1.join(x$1.basename(h$2), i), h$2 = x$1.dirname(h$2));
1112
- while (h$2 !== n && !l);
1113
- l || (l = [
1114
- s.slice(0, 99),
1115
- "",
1116
- true
1117
- ]);
1118
- }
1119
- return l;
1120
- }, d$1 = (s, e, t) => s.slice(e, e + t).toString("utf8").replace(/\0.*/, ""), o = (s, e, t) => N$1(r(s, e, t)), N$1 = (s) => s === null ? null : /* @__PURE__ */ new Date(s * 1e3), r = (s, e, t) => s[e] & 128 ? y.parse(s.slice(e, e + t)) : j(s, e, t), q = (s) => isNaN(s) ? null : s, j = (s, e, t) => q(parseInt(s.slice(e, e + t).toString("utf8").replace(/\0.*$/, "").trim(), 8)), v = {
1121
- 12: 8589934591,
1122
- 8: 2097151
1123
- }, c$1 = (s, e, t, i) => i === null ? false : i > v[t] || i < 0 ? (y.encode(i, s.slice(e, e + t)), true) : ($(s, e, t, i), false), $ = (s, e, t, i) => s.write(_(i, t), e, t, "ascii"), _ = (s, e) => z(Math.floor(s).toString(8), e), z = (s, e) => (s.length === e - 1 ? s : new Array(e - s.length - 1).join("0") + s + " ") + "\0", g$1 = (s, e, t, i) => i === null ? false : c$1(s, e, t, i.getTime() / 1e3), A$1 = new Array(156).join("\0"), m = (s, e, t, i) => i === null ? false : (s.write(i + A$1, e, t, "utf8"), i.length !== Buffer.byteLength(i) || i.length > t);
1124
- return k = B$1, k;
1125
- }
1126
- var e$3, t$3;
1127
- function i$4() {
1128
- return t$3 || (t$3 = 1, e$3 = function(o) {
1129
- o.prototype[Symbol.iterator] = function* () {
1130
- for (let r = this.head; r; r = r.next) yield r.value;
1131
- };
1132
- }), e$3;
1133
- }
1134
- var u$4, a$8;
1135
- function c$3() {
1136
- if (a$8) return u$4;
1137
- a$8 = 1, u$4 = r, r.Node = s, r.create = r;
1138
- function r(t) {
1139
- var i = this;
1140
- if (i instanceof r || (i = new r()), i.tail = null, i.head = null, i.length = 0, t && typeof t.forEach == "function") t.forEach(function(n) {
1141
- i.push(n);
1142
- });
1143
- else if (arguments.length > 0) for (var e = 0, h$2 = arguments.length; e < h$2; e++) i.push(arguments[e]);
1144
- return i;
1145
- }
1146
- r.prototype.removeNode = function(t) {
1147
- if (t.list !== this) throw new Error("removing node which does not belong to this list");
1148
- var i = t.next, e = t.prev;
1149
- return i && (i.prev = e), e && (e.next = i), t === this.head && (this.head = i), t === this.tail && (this.tail = e), t.list.length--, t.next = null, t.prev = null, t.list = null, i;
1150
- }, r.prototype.unshiftNode = function(t) {
1151
- if (t !== this.head) {
1152
- t.list && t.list.removeNode(t);
1153
- var i = this.head;
1154
- t.list = this, t.next = i, i && (i.prev = t), this.head = t, this.tail || (this.tail = t), this.length++;
1155
- }
1156
- }, r.prototype.pushNode = function(t) {
1157
- if (t !== this.tail) {
1158
- t.list && t.list.removeNode(t);
1159
- var i = this.tail;
1160
- t.list = this, t.prev = i, i && (i.next = t), this.tail = t, this.head || (this.head = t), this.length++;
1161
- }
1162
- }, r.prototype.push = function() {
1163
- for (var t = 0, i = arguments.length; t < i; t++) f(this, arguments[t]);
1164
- return this.length;
1165
- }, r.prototype.unshift = function() {
1166
- for (var t = 0, i = arguments.length; t < i; t++) o(this, arguments[t]);
1167
- return this.length;
1168
- }, r.prototype.pop = function() {
1169
- if (this.tail) {
1170
- var t = this.tail.value;
1171
- return this.tail = this.tail.prev, this.tail ? this.tail.next = null : this.head = null, this.length--, t;
1172
- }
1173
- }, r.prototype.shift = function() {
1174
- if (this.head) {
1175
- var t = this.head.value;
1176
- return this.head = this.head.next, this.head ? this.head.prev = null : this.tail = null, this.length--, t;
1177
- }
1178
- }, r.prototype.forEach = function(t, i) {
1179
- i = i || this;
1180
- for (var e = this.head, h$2 = 0; e !== null; h$2++) t.call(i, e.value, h$2, this), e = e.next;
1181
- }, r.prototype.forEachReverse = function(t, i) {
1182
- i = i || this;
1183
- for (var e = this.tail, h$2 = this.length - 1; e !== null; h$2--) t.call(i, e.value, h$2, this), e = e.prev;
1184
- }, r.prototype.get = function(t) {
1185
- for (var i = 0, e = this.head; e !== null && i < t; i++) e = e.next;
1186
- if (i === t && e !== null) return e.value;
1187
- }, r.prototype.getReverse = function(t) {
1188
- for (var i = 0, e = this.tail; e !== null && i < t; i++) e = e.prev;
1189
- if (i === t && e !== null) return e.value;
1190
- }, r.prototype.map = function(t, i) {
1191
- i = i || this;
1192
- for (var e = new r(), h$2 = this.head; h$2 !== null;) e.push(t.call(i, h$2.value, this)), h$2 = h$2.next;
1193
- return e;
1194
- }, r.prototype.mapReverse = function(t, i) {
1195
- i = i || this;
1196
- for (var e = new r(), h$2 = this.tail; h$2 !== null;) e.push(t.call(i, h$2.value, this)), h$2 = h$2.prev;
1197
- return e;
1198
- }, r.prototype.reduce = function(t, i) {
1199
- var e, h$2 = this.head;
1200
- if (arguments.length > 1) e = i;
1201
- else if (this.head) h$2 = this.head.next, e = this.head.value;
1202
- else throw new TypeError("Reduce of empty list with no initial value");
1203
- for (var n = 0; h$2 !== null; n++) e = t(e, h$2.value, n), h$2 = h$2.next;
1204
- return e;
1205
- }, r.prototype.reduceReverse = function(t, i) {
1206
- var e, h$2 = this.tail;
1207
- if (arguments.length > 1) e = i;
1208
- else if (this.tail) h$2 = this.tail.prev, e = this.tail.value;
1209
- else throw new TypeError("Reduce of empty list with no initial value");
1210
- for (var n = this.length - 1; h$2 !== null; n--) e = t(e, h$2.value, n), h$2 = h$2.prev;
1211
- return e;
1212
- }, r.prototype.toArray = function() {
1213
- for (var t = new Array(this.length), i = 0, e = this.head; e !== null; i++) t[i] = e.value, e = e.next;
1214
- return t;
1215
- }, r.prototype.toArrayReverse = function() {
1216
- for (var t = new Array(this.length), i = 0, e = this.tail; e !== null; i++) t[i] = e.value, e = e.prev;
1217
- return t;
1218
- }, r.prototype.slice = function(t, i) {
1219
- i = i || this.length, i < 0 && (i += this.length), t = t || 0, t < 0 && (t += this.length);
1220
- var e = new r();
1221
- if (i < t || i < 0) return e;
1222
- t < 0 && (t = 0), i > this.length && (i = this.length);
1223
- for (var h$2 = 0, n = this.head; n !== null && h$2 < t; h$2++) n = n.next;
1224
- for (; n !== null && h$2 < i; h$2++, n = n.next) e.push(n.value);
1225
- return e;
1226
- }, r.prototype.sliceReverse = function(t, i) {
1227
- i = i || this.length, i < 0 && (i += this.length), t = t || 0, t < 0 && (t += this.length);
1228
- var e = new r();
1229
- if (i < t || i < 0) return e;
1230
- t < 0 && (t = 0), i > this.length && (i = this.length);
1231
- for (var h$2 = this.length, n = this.tail; n !== null && h$2 > i; h$2--) n = n.prev;
1232
- for (; n !== null && h$2 > t; h$2--, n = n.prev) e.push(n.value);
1233
- return e;
1234
- }, r.prototype.splice = function(t, i, ...e) {
1235
- t > this.length && (t = this.length - 1), t < 0 && (t = this.length + t);
1236
- for (var h$2 = 0, n = this.head; n !== null && h$2 < t; h$2++) n = n.next;
1237
- for (var l = [], h$2 = 0; n && h$2 < i; h$2++) l.push(n.value), n = this.removeNode(n);
1238
- n === null && (n = this.tail), n !== this.head && n !== this.tail && (n = n.prev);
1239
- for (var h$2 = 0; h$2 < e.length; h$2++) n = v(this, n, e[h$2]);
1240
- return l;
1241
- }, r.prototype.reverse = function() {
1242
- for (var t = this.head, i = this.tail, e = t; e !== null; e = e.prev) {
1243
- var h$2 = e.prev;
1244
- e.prev = e.next, e.next = h$2;
1245
- }
1246
- return this.head = i, this.tail = t, this;
1247
- };
1248
- function v(t, i, e) {
1249
- var h$2 = i === t.head ? new s(e, null, i, t) : new s(e, i, i.next, t);
1250
- return h$2.next === null && (t.tail = h$2), h$2.prev === null && (t.head = h$2), t.length++, h$2;
1251
- }
1252
- function f(t, i) {
1253
- t.tail = new s(i, t.tail, null, t), t.head || (t.head = t.tail), t.length++;
1254
- }
1255
- function o(t, i) {
1256
- t.head = new s(i, null, t.head, t), t.tail || (t.tail = t.head), t.length++;
1257
- }
1258
- function s(t, i, e, h$2) {
1259
- if (!(this instanceof s)) return new s(t, i, e, h$2);
1260
- this.list = h$2, this.value = t, i ? (i.next = this, this.prev = i) : this.prev = null, e ? (e.prev = this, this.next = e) : this.next = null;
1261
- }
1262
- try {
1263
- i$4()(r);
1264
- } catch {}
1265
- return u$4;
1266
- }
1267
- var s$5 = {};
1268
- var X$1;
1269
- function ft() {
1270
- if (X$1) return s$5;
1271
- X$1 = 1;
1272
- const H = typeof process == "object" && process ? process : {
1273
- stdout: null,
1274
- stderr: null
1275
- }, Z = nt, q = ot, G = ht.StringDecoder, m = Symbol("EOF"), d$1 = Symbol("maybeEmitEnd"), y = Symbol("emittedEnd"), R = Symbol("emittingEnd"), g$1 = Symbol("emittedError"), B$1 = Symbol("closed"), Y = Symbol("read"), T = Symbol("flush"), $ = Symbol("flushChunk"), f = Symbol("encoding"), c$1 = Symbol("decoder"), M$1 = Symbol("flowing"), S = Symbol("paused"), b$1 = Symbol("resume"), i = Symbol("buffer"), a = Symbol("pipes"), n = Symbol("bufferLength"), j = Symbol("bufferPush"), I$1 = Symbol("bufferShift"), o = Symbol("objectMode"), r = Symbol("destroyed"), P$2 = Symbol("error"), x$1 = Symbol("emitData"), V$1 = Symbol("emitEnd"), N$1 = Symbol("emitEnd2"), p = Symbol("async"), _ = Symbol("abort"), O = Symbol("aborted"), E = Symbol("signal"), w = (h$2) => Promise.resolve().then(h$2), J = commonjsGlobal._MP_NO_ITERATOR_SYMBOLS_ !== "1", K$1 = J && Symbol.asyncIterator || Symbol("asyncIterator not implemented"), W$1 = J && Symbol.iterator || Symbol("iterator not implemented"), k = (h$2) => h$2 === "end" || h$2 === "finish" || h$2 === "prefinish", tt = (h$2) => h$2 instanceof ArrayBuffer || typeof h$2 == "object" && h$2.constructor && h$2.constructor.name === "ArrayBuffer" && h$2.byteLength >= 0, et = (h$2) => !Buffer.isBuffer(h$2) && ArrayBuffer.isView(h$2);
1276
- class z {
1277
- constructor(t, e, s) {
1278
- this.src = t, this.dest = e, this.opts = s, this.ondrain = () => t[b$1](), e.on("drain", this.ondrain);
1279
- }
1280
- unpipe() {
1281
- this.dest.removeListener("drain", this.ondrain);
1282
- }
1283
- proxyErrors() {}
1284
- end() {
1285
- this.unpipe(), this.opts.end && this.dest.end();
1286
- }
1287
- }
1288
- class st extends z {
1289
- unpipe() {
1290
- this.src.removeListener("error", this.proxyErrors), super.unpipe();
1291
- }
1292
- constructor(t, e, s) {
1293
- super(t, e, s), this.proxyErrors = (l) => e.emit("error", l), t.on("error", this.proxyErrors);
1294
- }
1295
- }
1296
- class F extends q {
1297
- constructor(t) {
1298
- super(), this[M$1] = false, this[S] = false, this[a] = [], this[i] = [], this[o] = t && t.objectMode || false, this[o] ? this[f] = null : this[f] = t && t.encoding || null, this[f] === "buffer" && (this[f] = null), this[p] = t && !!t.async || false, this[c$1] = this[f] ? new G(this[f]) : null, this[m] = false, this[y] = false, this[R] = false, this[B$1] = false, this[g$1] = null, this.writable = true, this.readable = true, this[n] = 0, this[r] = false, t && t.debugExposeBuffer === true && Object.defineProperty(this, "buffer", { get: () => this[i] }), t && t.debugExposePipes === true && Object.defineProperty(this, "pipes", { get: () => this[a] }), this[E] = t && t.signal, this[O] = false, this[E] && (this[E].addEventListener("abort", () => this[_]()), this[E].aborted && this[_]());
1299
- }
1300
- get bufferLength() {
1301
- return this[n];
1302
- }
1303
- get encoding() {
1304
- return this[f];
1305
- }
1306
- set encoding(t) {
1307
- if (this[o]) throw new Error("cannot set encoding in objectMode");
1308
- if (this[f] && t !== this[f] && (this[c$1] && this[c$1].lastNeed || this[n])) throw new Error("cannot change encoding");
1309
- this[f] !== t && (this[c$1] = t ? new G(t) : null, this[i].length && (this[i] = this[i].map((e) => this[c$1].write(e)))), this[f] = t;
1310
- }
1311
- setEncoding(t) {
1312
- this.encoding = t;
1313
- }
1314
- get objectMode() {
1315
- return this[o];
1316
- }
1317
- set objectMode(t) {
1318
- this[o] = this[o] || !!t;
1319
- }
1320
- get async() {
1321
- return this[p];
1322
- }
1323
- set async(t) {
1324
- this[p] = this[p] || !!t;
1325
- }
1326
- [_]() {
1327
- this[O] = true, this.emit("abort", this[E].reason), this.destroy(this[E].reason);
1328
- }
1329
- get aborted() {
1330
- return this[O];
1331
- }
1332
- set aborted(t) {}
1333
- write(t, e, s) {
1334
- if (this[O]) return false;
1335
- if (this[m]) throw new Error("write after end");
1336
- if (this[r]) return this.emit("error", Object.assign(/* @__PURE__ */ new Error("Cannot call write after a stream was destroyed"), { code: "ERR_STREAM_DESTROYED" })), true;
1337
- typeof e == "function" && (s = e, e = "utf8"), e || (e = "utf8");
1338
- const l = this[p] ? w : (u) => u();
1339
- return !this[o] && !Buffer.isBuffer(t) && (et(t) ? t = Buffer.from(t.buffer, t.byteOffset, t.byteLength) : tt(t) ? t = Buffer.from(t) : typeof t != "string" && (this.objectMode = true)), this[o] ? (this.flowing && this[n] !== 0 && this[T](true), this.flowing ? this.emit("data", t) : this[j](t), this[n] !== 0 && this.emit("readable"), s && l(s), this.flowing) : t.length ? (typeof t == "string" && !(e === this[f] && !this[c$1].lastNeed) && (t = Buffer.from(t, e)), Buffer.isBuffer(t) && this[f] && (t = this[c$1].write(t)), this.flowing && this[n] !== 0 && this[T](true), this.flowing ? this.emit("data", t) : this[j](t), this[n] !== 0 && this.emit("readable"), s && l(s), this.flowing) : (this[n] !== 0 && this.emit("readable"), s && l(s), this.flowing);
1340
- }
1341
- read(t) {
1342
- if (this[r]) return null;
1343
- if (this[n] === 0 || t === 0 || t > this[n]) return this[d$1](), null;
1344
- this[o] && (t = null), this[i].length > 1 && !this[o] && (this.encoding ? this[i] = [this[i].join("")] : this[i] = [Buffer.concat(this[i], this[n])]);
1345
- const e = this[Y](t || null, this[i][0]);
1346
- return this[d$1](), e;
1347
- }
1348
- [Y](t, e) {
1349
- return t === e.length || t === null ? this[I$1]() : (this[i][0] = e.slice(t), e = e.slice(0, t), this[n] -= t), this.emit("data", e), !this[i].length && !this[m] && this.emit("drain"), e;
1350
- }
1351
- end(t, e, s) {
1352
- return typeof t == "function" && (s = t, t = null), typeof e == "function" && (s = e, e = "utf8"), t && this.write(t, e), s && this.once("end", s), this[m] = true, this.writable = false, (this.flowing || !this[S]) && this[d$1](), this;
1353
- }
1354
- [b$1]() {
1355
- this[r] || (this[S] = false, this[M$1] = true, this.emit("resume"), this[i].length ? this[T]() : this[m] ? this[d$1]() : this.emit("drain"));
1356
- }
1357
- resume() {
1358
- return this[b$1]();
1359
- }
1360
- pause() {
1361
- this[M$1] = false, this[S] = true;
1362
- }
1363
- get destroyed() {
1364
- return this[r];
1365
- }
1366
- get flowing() {
1367
- return this[M$1];
1368
- }
1369
- get paused() {
1370
- return this[S];
1371
- }
1372
- [j](t) {
1373
- this[o] ? this[n] += 1 : this[n] += t.length, this[i].push(t);
1374
- }
1375
- [I$1]() {
1376
- return this[o] ? this[n] -= 1 : this[n] -= this[i][0].length, this[i].shift();
1377
- }
1378
- [T](t) {
1379
- do ;
1380
- while (this[$](this[I$1]()) && this[i].length);
1381
- !t && !this[i].length && !this[m] && this.emit("drain");
1382
- }
1383
- [$](t) {
1384
- return this.emit("data", t), this.flowing;
1385
- }
1386
- pipe(t, e) {
1387
- if (this[r]) return;
1388
- const s = this[y];
1389
- return e = e || {}, t === H.stdout || t === H.stderr ? e.end = false : e.end = e.end !== false, e.proxyErrors = !!e.proxyErrors, s ? e.end && t.end() : (this[a].push(e.proxyErrors ? new st(this, t, e) : new z(this, t, e)), this[p] ? w(() => this[b$1]()) : this[b$1]()), t;
1390
- }
1391
- unpipe(t) {
1392
- const e = this[a].find((s) => s.dest === t);
1393
- e && (this[a].splice(this[a].indexOf(e), 1), e.unpipe());
1394
- }
1395
- addListener(t, e) {
1396
- return this.on(t, e);
1397
- }
1398
- on(t, e) {
1399
- const s = super.on(t, e);
1400
- return t === "data" && !this[a].length && !this.flowing ? this[b$1]() : t === "readable" && this[n] !== 0 ? super.emit("readable") : k(t) && this[y] ? (super.emit(t), this.removeAllListeners(t)) : t === "error" && this[g$1] && (this[p] ? w(() => e.call(this, this[g$1])) : e.call(this, this[g$1])), s;
1401
- }
1402
- get emittedEnd() {
1403
- return this[y];
1404
- }
1405
- [d$1]() {
1406
- !this[R] && !this[y] && !this[r] && this[i].length === 0 && this[m] && (this[R] = true, this.emit("end"), this.emit("prefinish"), this.emit("finish"), this[B$1] && this.emit("close"), this[R] = false);
1407
- }
1408
- emit(t, e, ...s) {
1409
- if (t !== "error" && t !== "close" && t !== r && this[r]) return;
1410
- if (t === "data") return !this[o] && !e ? false : this[p] ? w(() => this[x$1](e)) : this[x$1](e);
1411
- if (t === "end") return this[V$1]();
1412
- if (t === "close") {
1413
- if (this[B$1] = true, !this[y] && !this[r]) return;
1414
- const u = super.emit("close");
1415
- return this.removeAllListeners("close"), u;
1416
- } else if (t === "error") {
1417
- this[g$1] = e, super.emit(P$2, e);
1418
- const u = !this[E] || this.listeners("error").length ? super.emit("error", e) : false;
1419
- return this[d$1](), u;
1420
- } else if (t === "resume") {
1421
- const u = super.emit("resume");
1422
- return this[d$1](), u;
1423
- } else if (t === "finish" || t === "prefinish") {
1424
- const u = super.emit(t);
1425
- return this.removeAllListeners(t), u;
1426
- }
1427
- const l = super.emit(t, e, ...s);
1428
- return this[d$1](), l;
1429
- }
1430
- [x$1](t) {
1431
- for (const s of this[a]) s.dest.write(t) === false && this.pause();
1432
- const e = super.emit("data", t);
1433
- return this[d$1](), e;
1434
- }
1435
- [V$1]() {
1436
- this[y] || (this[y] = true, this.readable = false, this[p] ? w(() => this[N$1]()) : this[N$1]());
1437
- }
1438
- [N$1]() {
1439
- if (this[c$1]) {
1440
- const e = this[c$1].end();
1441
- if (e) {
1442
- for (const s of this[a]) s.dest.write(e);
1443
- super.emit("data", e);
1444
- }
1445
- }
1446
- for (const e of this[a]) e.end();
1447
- const t = super.emit("end");
1448
- return this.removeAllListeners("end"), t;
1449
- }
1450
- collect() {
1451
- const t = [];
1452
- this[o] || (t.dataLength = 0);
1453
- const e = this.promise();
1454
- return this.on("data", (s) => {
1455
- t.push(s), this[o] || (t.dataLength += s.length);
1456
- }), e.then(() => t);
1457
- }
1458
- concat() {
1459
- return this[o] ? Promise.reject(/* @__PURE__ */ new Error("cannot concat in objectMode")) : this.collect().then((t) => this[o] ? Promise.reject(/* @__PURE__ */ new Error("cannot concat in objectMode")) : this[f] ? t.join("") : Buffer.concat(t, t.dataLength));
1460
- }
1461
- promise() {
1462
- return new Promise((t, e) => {
1463
- this.on(r, () => e(/* @__PURE__ */ new Error("stream destroyed"))), this.on("error", (s) => e(s)), this.on("end", () => t());
1464
- });
1465
- }
1466
- [K$1]() {
1467
- let t = false;
1468
- const e = () => (this.pause(), t = true, Promise.resolve({ done: true }));
1469
- return {
1470
- next: () => {
1471
- if (t) return e();
1472
- const l = this.read();
1473
- if (l !== null) return Promise.resolve({
1474
- done: false,
1475
- value: l
1476
- });
1477
- if (this[m]) return e();
1478
- let u = null, Q = null;
1479
- const A$1 = (L) => {
1480
- this.removeListener("data", U$1), this.removeListener("end", C), this.removeListener(r, D$1), e(), Q(L);
1481
- }, U$1 = (L) => {
1482
- this.removeListener("error", A$1), this.removeListener("end", C), this.removeListener(r, D$1), this.pause(), u({
1483
- value: L,
1484
- done: !!this[m]
1485
- });
1486
- }, C = () => {
1487
- this.removeListener("error", A$1), this.removeListener("data", U$1), this.removeListener(r, D$1), e(), u({ done: true });
1488
- }, D$1 = () => A$1(/* @__PURE__ */ new Error("stream destroyed"));
1489
- return new Promise((L, it) => {
1490
- Q = it, u = L, this.once(r, D$1), this.once("error", A$1), this.once("end", C), this.once("data", U$1);
1491
- });
1492
- },
1493
- throw: e,
1494
- return: e,
1495
- [K$1]() {
1496
- return this;
1497
- }
1498
- };
1499
- }
1500
- [W$1]() {
1501
- let t = false;
1502
- const e = () => (this.pause(), this.removeListener(P$2, e), this.removeListener(r, e), this.removeListener("end", e), t = true, { done: true }), s = () => {
1503
- if (t) return e();
1504
- const l = this.read();
1505
- return l === null ? e() : { value: l };
1506
- };
1507
- return this.once("end", e), this.once(P$2, e), this.once(r, e), {
1508
- next: s,
1509
- throw: e,
1510
- return: e,
1511
- [W$1]() {
1512
- return this;
1513
- }
1514
- };
1515
- }
1516
- destroy(t) {
1517
- return this[r] ? (t ? this.emit("error", t) : this.emit(r), this) : (this[r] = true, this[i].length = 0, this[n] = 0, typeof this.close == "function" && !this[B$1] && this.close(), t ? this.emit("error", t) : this.emit(r), this);
1518
- }
1519
- static isStream(t) {
1520
- return !!t && (t instanceof F || t instanceof q || t instanceof Z && (typeof t.pipe == "function" || typeof t.write == "function" && typeof t.end == "function"));
1521
- }
1522
- }
1523
- return s$5.Minipass = F, s$5;
1524
- }
1525
- var e$2, o$4;
1526
- function a$7() {
1527
- return o$4 || (o$4 = 1, e$2 = (process.env.TESTING_TAR_FAKE_PLATFORM || process.platform) !== "win32" ? (r) => r : (r) => r && r.replace(/\\/g, "/")), e$2;
1528
- }
1529
- var n$2, a$6;
1530
- function u$3() {
1531
- if (a$6) return n$2;
1532
- a$6 = 1;
1533
- const { Minipass: o } = ft(), s = a$7(), r = Symbol("slurp");
1534
- return n$2 = class extends o {
1535
- constructor(t, e, i) {
1536
- switch (super(), this.pause(), this.extended = e, this.globalExtended = i, this.header = t, this.startBlockSize = 512 * Math.ceil(t.size / 512), this.blockRemain = this.startBlockSize, this.remain = t.size, this.type = t.type, this.meta = false, this.ignore = false, this.type) {
1537
- case "File":
1538
- case "OldFile":
1539
- case "Link":
1540
- case "SymbolicLink":
1541
- case "CharacterDevice":
1542
- case "BlockDevice":
1543
- case "Directory":
1544
- case "FIFO":
1545
- case "ContiguousFile":
1546
- case "GNUDumpDir": break;
1547
- case "NextFileHasLongLinkpath":
1548
- case "NextFileHasLongPath":
1549
- case "OldGnuLongPath":
1550
- case "GlobalExtendedHeader":
1551
- case "ExtendedHeader":
1552
- case "OldExtendedHeader":
1553
- this.meta = true;
1554
- break;
1555
- default: this.ignore = true;
1556
- }
1557
- this.path = s(t.path), this.mode = t.mode, this.mode && (this.mode = this.mode & 4095), this.uid = t.uid, this.gid = t.gid, this.uname = t.uname, this.gname = t.gname, this.size = t.size, this.mtime = t.mtime, this.atime = t.atime, this.ctime = t.ctime, this.linkpath = s(t.linkpath), this.uname = t.uname, this.gname = t.gname, e && this[r](e), i && this[r](i, true);
1558
- }
1559
- write(t) {
1560
- const e = t.length;
1561
- if (e > this.blockRemain) throw new Error("writing more to entry than is appropriate");
1562
- const i = this.remain, c$1 = this.blockRemain;
1563
- return this.remain = Math.max(0, i - e), this.blockRemain = Math.max(0, c$1 - e), this.ignore ? true : i >= e ? super.write(t) : super.write(t.slice(0, i));
1564
- }
1565
- [r](t, e) {
1566
- for (const i in t) t[i] !== null && t[i] !== void 0 && !(e && i === "path") && (this[i] = i === "path" || i === "linkpath" ? s(t[i]) : t[i]);
1567
- }
1568
- }, n$2;
1569
- }
1570
- var r$2, a$5;
1571
- function f$2() {
1572
- if (a$5) return r$2;
1573
- a$5 = 1;
1574
- const c$1 = E(), d$1 = path;
1575
- class h$2 {
1576
- constructor(e, n) {
1577
- this.atime = e.atime || null, this.charset = e.charset || null, this.comment = e.comment || null, this.ctime = e.ctime || null, this.gid = e.gid || null, this.gname = e.gname || null, this.linkpath = e.linkpath || null, this.mtime = e.mtime || null, this.path = e.path || null, this.size = e.size || null, this.uid = e.uid || null, this.uname = e.uname || null, this.dev = e.dev || null, this.ino = e.ino || null, this.nlink = e.nlink || null, this.global = n || false;
1578
- }
1579
- encode() {
1580
- const e = this.encodeBody();
1581
- if (e === "") return null;
1582
- const n = Buffer.byteLength(e), l = 512 * Math.ceil(1 + n / 512), i = Buffer.allocUnsafe(l);
1583
- for (let t = 0; t < 512; t++) i[t] = 0;
1584
- new c$1({
1585
- path: ("PaxHeader/" + d$1.basename(this.path)).slice(0, 99),
1586
- mode: this.mode || 420,
1587
- uid: this.uid || null,
1588
- gid: this.gid || null,
1589
- size: n,
1590
- mtime: this.mtime || null,
1591
- type: this.global ? "GlobalExtendedHeader" : "ExtendedHeader",
1592
- linkpath: "",
1593
- uname: this.uname || "",
1594
- gname: this.gname || "",
1595
- devmaj: 0,
1596
- devmin: 0,
1597
- atime: this.atime || null,
1598
- ctime: this.ctime || null
1599
- }).encode(i), i.write(e, 512, n, "utf8");
1600
- for (let t = n + 512; t < i.length; t++) i[t] = 0;
1601
- return i;
1602
- }
1603
- encodeBody() {
1604
- return this.encodeField("path") + this.encodeField("ctime") + this.encodeField("atime") + this.encodeField("dev") + this.encodeField("ino") + this.encodeField("nlink") + this.encodeField("charset") + this.encodeField("comment") + this.encodeField("gid") + this.encodeField("gname") + this.encodeField("linkpath") + this.encodeField("mtime") + this.encodeField("size") + this.encodeField("uid") + this.encodeField("uname");
1605
- }
1606
- encodeField(e) {
1607
- if (this[e] === null || this[e] === void 0) return "";
1608
- const n = this[e] instanceof Date ? this[e].getTime() / 1e3 : this[e], l = " " + (e === "dev" || e === "ino" || e === "nlink" ? "SCHILY." : "") + e + "=" + n + `
1609
- `, i = Buffer.byteLength(l);
1610
- let t = Math.floor(Math.log(i) / Math.log(10)) + 1;
1611
- return i + t >= Math.pow(10, t) && (t += 1), t + i + l;
1612
- }
1613
- }
1614
- h$2.parse = (s, e, n) => new h$2(o(u(s), e), n);
1615
- const o = (s, e) => e ? Object.keys(s).reduce((n, l) => (n[l] = s[l], n), e) : s, u = (s) => s.replace(/\n$/, "").split(`
1616
- `).reduce(m, Object.create(null)), m = (s, e) => {
1617
- const n = parseInt(e, 10);
1618
- if (n !== Buffer.byteLength(e) + 1) return s;
1619
- e = e.slice((n + " ").length);
1620
- const l = e.split("="), i = l.shift().replace(/^SCHILY\.(dev|ino|nlink)/, "$1");
1621
- if (!i) return s;
1622
- const t = l.join("=");
1623
- return s[i] = /^([A-Z]+\.)?([mac]|birth|creation)time$/.test(i) ? /* @__PURE__ */ new Date(t * 1e3) : /^[0-9]+$/.test(t) ? +t : t, s;
1624
- };
1625
- return r$2 = h$2, r$2;
1626
- }
1627
- var i$3 = {};
1628
- var _, R$1;
1629
- function T() {
1630
- if (R$1) return _;
1631
- R$1 = 1;
1632
- const E = O$2.constants || { ZLIB_VERNUM: 4736 };
1633
- return _ = Object.freeze(Object.assign(Object.create(null), {
1634
- Z_NO_FLUSH: 0,
1635
- Z_PARTIAL_FLUSH: 1,
1636
- Z_SYNC_FLUSH: 2,
1637
- Z_FULL_FLUSH: 3,
1638
- Z_FINISH: 4,
1639
- Z_BLOCK: 5,
1640
- Z_OK: 0,
1641
- Z_STREAM_END: 1,
1642
- Z_NEED_DICT: 2,
1643
- Z_ERRNO: -1,
1644
- Z_STREAM_ERROR: -2,
1645
- Z_DATA_ERROR: -3,
1646
- Z_MEM_ERROR: -4,
1647
- Z_BUF_ERROR: -5,
1648
- Z_VERSION_ERROR: -6,
1649
- Z_NO_COMPRESSION: 0,
1650
- Z_BEST_SPEED: 1,
1651
- Z_BEST_COMPRESSION: 9,
1652
- Z_DEFAULT_COMPRESSION: -1,
1653
- Z_FILTERED: 1,
1654
- Z_HUFFMAN_ONLY: 2,
1655
- Z_RLE: 3,
1656
- Z_FIXED: 4,
1657
- Z_DEFAULT_STRATEGY: 0,
1658
- DEFLATE: 1,
1659
- INFLATE: 2,
1660
- GZIP: 3,
1661
- GUNZIP: 4,
1662
- DEFLATERAW: 5,
1663
- INFLATERAW: 6,
1664
- UNZIP: 7,
1665
- BROTLI_DECODE: 8,
1666
- BROTLI_ENCODE: 9,
1667
- Z_MIN_WINDOWBITS: 8,
1668
- Z_MAX_WINDOWBITS: 15,
1669
- Z_DEFAULT_WINDOWBITS: 15,
1670
- Z_MIN_CHUNK: 64,
1671
- Z_MAX_CHUNK: Infinity,
1672
- Z_DEFAULT_CHUNK: 16384,
1673
- Z_MIN_MEMLEVEL: 1,
1674
- Z_MAX_MEMLEVEL: 9,
1675
- Z_DEFAULT_MEMLEVEL: 8,
1676
- Z_MIN_LEVEL: -1,
1677
- Z_MAX_LEVEL: 9,
1678
- Z_DEFAULT_LEVEL: -1,
1679
- BROTLI_OPERATION_PROCESS: 0,
1680
- BROTLI_OPERATION_FLUSH: 1,
1681
- BROTLI_OPERATION_FINISH: 2,
1682
- BROTLI_OPERATION_EMIT_METADATA: 3,
1683
- BROTLI_MODE_GENERIC: 0,
1684
- BROTLI_MODE_TEXT: 1,
1685
- BROTLI_MODE_FONT: 2,
1686
- BROTLI_DEFAULT_MODE: 0,
1687
- BROTLI_MIN_QUALITY: 0,
1688
- BROTLI_MAX_QUALITY: 11,
1689
- BROTLI_DEFAULT_QUALITY: 11,
1690
- BROTLI_MIN_WINDOW_BITS: 10,
1691
- BROTLI_MAX_WINDOW_BITS: 24,
1692
- BROTLI_LARGE_MAX_WINDOW_BITS: 30,
1693
- BROTLI_DEFAULT_WINDOW: 22,
1694
- BROTLI_MIN_INPUT_BLOCK_BITS: 16,
1695
- BROTLI_MAX_INPUT_BLOCK_BITS: 24,
1696
- BROTLI_PARAM_MODE: 0,
1697
- BROTLI_PARAM_QUALITY: 1,
1698
- BROTLI_PARAM_LGWIN: 2,
1699
- BROTLI_PARAM_LGBLOCK: 3,
1700
- BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: 4,
1701
- BROTLI_PARAM_SIZE_HINT: 5,
1702
- BROTLI_PARAM_LARGE_WINDOW: 6,
1703
- BROTLI_PARAM_NPOSTFIX: 7,
1704
- BROTLI_PARAM_NDIRECT: 8,
1705
- BROTLI_DECODER_RESULT_ERROR: 0,
1706
- BROTLI_DECODER_RESULT_SUCCESS: 1,
1707
- BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: 2,
1708
- BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: 3,
1709
- BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: 0,
1710
- BROTLI_DECODER_PARAM_LARGE_WINDOW: 1,
1711
- BROTLI_DECODER_NO_ERROR: 0,
1712
- BROTLI_DECODER_SUCCESS: 1,
1713
- BROTLI_DECODER_NEEDS_MORE_INPUT: 2,
1714
- BROTLI_DECODER_NEEDS_MORE_OUTPUT: 3,
1715
- BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: -1,
1716
- BROTLI_DECODER_ERROR_FORMAT_RESERVED: -2,
1717
- BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: -3,
1718
- BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: -4,
1719
- BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: -5,
1720
- BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: -6,
1721
- BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: -7,
1722
- BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: -8,
1723
- BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: -9,
1724
- BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: -10,
1725
- BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: -11,
1726
- BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: -12,
1727
- BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: -13,
1728
- BROTLI_DECODER_ERROR_FORMAT_PADDING_1: -14,
1729
- BROTLI_DECODER_ERROR_FORMAT_PADDING_2: -15,
1730
- BROTLI_DECODER_ERROR_FORMAT_DISTANCE: -16,
1731
- BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: -19,
1732
- BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: -20,
1733
- BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: -21,
1734
- BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: -22,
1735
- BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: -25,
1736
- BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: -26,
1737
- BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: -27,
1738
- BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: -30,
1739
- BROTLI_DECODER_ERROR_UNREACHABLE: -31
1740
- }, E)), _;
1741
- }
1742
- var j, H$1;
1743
- function tt() {
1744
- if (H$1) return j;
1745
- H$1 = 1;
1746
- const I$1 = typeof process == "object" && process ? process : {
1747
- stdout: null,
1748
- stderr: null
1749
- }, Y = nt, x$1 = ot, N$1 = ht.StringDecoder, u = Symbol("EOF"), a = Symbol("maybeEmitEnd"), c$1 = Symbol("emittedEnd"), S = Symbol("emittingEnd"), E = Symbol("emittedError"), w = Symbol("closed"), P$2 = Symbol("read"), L = Symbol("flush"), _ = Symbol("flushChunk"), h$2 = Symbol("encoding"), m = Symbol("decoder"), M$1 = Symbol("flowing"), y = Symbol("paused"), p = Symbol("resume"), s = Symbol("bufferLength"), T = Symbol("bufferPush"), B$1 = Symbol("bufferShift"), r = Symbol("objectMode"), n = Symbol("destroyed"), D$1 = Symbol("emitData"), F = Symbol("emitEnd"), R = Symbol("emitEnd2"), d$1 = Symbol("async"), b$1 = (o) => Promise.resolve().then(o), C = commonjsGlobal._MP_NO_ITERATOR_SYMBOLS_ !== "1", $ = C && Symbol.asyncIterator || Symbol("asyncIterator not implemented"), G = C && Symbol.iterator || Symbol("iterator not implemented"), V$1 = (o) => o === "end" || o === "finish" || o === "prefinish", v = (o) => o instanceof ArrayBuffer || typeof o == "object" && o.constructor && o.constructor.name === "ArrayBuffer" && o.byteLength >= 0, J = (o) => !Buffer.isBuffer(o) && ArrayBuffer.isView(o);
1750
- class U$1 {
1751
- constructor(t, e, i) {
1752
- this.src = t, this.dest = e, this.opts = i, this.ondrain = () => t[p](), e.on("drain", this.ondrain);
1753
- }
1754
- unpipe() {
1755
- this.dest.removeListener("drain", this.ondrain);
1756
- }
1757
- proxyErrors() {}
1758
- end() {
1759
- this.unpipe(), this.opts.end && this.dest.end();
1760
- }
1761
- }
1762
- class K$1 extends U$1 {
1763
- unpipe() {
1764
- this.src.removeListener("error", this.proxyErrors), super.unpipe();
1765
- }
1766
- constructor(t, e, i) {
1767
- super(t, e, i), this.proxyErrors = (l) => e.emit("error", l), t.on("error", this.proxyErrors);
1768
- }
1769
- }
1770
- return j = class q extends x$1 {
1771
- constructor(t) {
1772
- super(), this[M$1] = false, this[y] = false, this.pipes = [], this.buffer = [], this[r] = t && t.objectMode || false, this[r] ? this[h$2] = null : this[h$2] = t && t.encoding || null, this[h$2] === "buffer" && (this[h$2] = null), this[d$1] = t && !!t.async || false, this[m] = this[h$2] ? new N$1(this[h$2]) : null, this[u] = false, this[c$1] = false, this[S] = false, this[w] = false, this[E] = null, this.writable = true, this.readable = true, this[s] = 0, this[n] = false;
1773
- }
1774
- get bufferLength() {
1775
- return this[s];
1776
- }
1777
- get encoding() {
1778
- return this[h$2];
1779
- }
1780
- set encoding(t) {
1781
- if (this[r]) throw new Error("cannot set encoding in objectMode");
1782
- if (this[h$2] && t !== this[h$2] && (this[m] && this[m].lastNeed || this[s])) throw new Error("cannot change encoding");
1783
- this[h$2] !== t && (this[m] = t ? new N$1(t) : null, this.buffer.length && (this.buffer = this.buffer.map((e) => this[m].write(e)))), this[h$2] = t;
1784
- }
1785
- setEncoding(t) {
1786
- this.encoding = t;
1787
- }
1788
- get objectMode() {
1789
- return this[r];
1790
- }
1791
- set objectMode(t) {
1792
- this[r] = this[r] || !!t;
1793
- }
1794
- get async() {
1795
- return this[d$1];
1796
- }
1797
- set async(t) {
1798
- this[d$1] = this[d$1] || !!t;
1799
- }
1800
- write(t, e, i) {
1801
- if (this[u]) throw new Error("write after end");
1802
- if (this[n]) return this.emit("error", Object.assign(/* @__PURE__ */ new Error("Cannot call write after a stream was destroyed"), { code: "ERR_STREAM_DESTROYED" })), true;
1803
- typeof e == "function" && (i = e, e = "utf8"), e || (e = "utf8");
1804
- const l = this[d$1] ? b$1 : (f) => f();
1805
- return !this[r] && !Buffer.isBuffer(t) && (J(t) ? t = Buffer.from(t.buffer, t.byteOffset, t.byteLength) : v(t) ? t = Buffer.from(t) : typeof t != "string" && (this.objectMode = true)), this[r] ? (this.flowing && this[s] !== 0 && this[L](true), this.flowing ? this.emit("data", t) : this[T](t), this[s] !== 0 && this.emit("readable"), i && l(i), this.flowing) : t.length ? (typeof t == "string" && !(e === this[h$2] && !this[m].lastNeed) && (t = Buffer.from(t, e)), Buffer.isBuffer(t) && this[h$2] && (t = this[m].write(t)), this.flowing && this[s] !== 0 && this[L](true), this.flowing ? this.emit("data", t) : this[T](t), this[s] !== 0 && this.emit("readable"), i && l(i), this.flowing) : (this[s] !== 0 && this.emit("readable"), i && l(i), this.flowing);
1806
- }
1807
- read(t) {
1808
- if (this[n]) return null;
1809
- if (this[s] === 0 || t === 0 || t > this[s]) return this[a](), null;
1810
- this[r] && (t = null), this.buffer.length > 1 && !this[r] && (this.encoding ? this.buffer = [this.buffer.join("")] : this.buffer = [Buffer.concat(this.buffer, this[s])]);
1811
- const e = this[P$2](t || null, this.buffer[0]);
1812
- return this[a](), e;
1813
- }
1814
- [P$2](t, e) {
1815
- return t === e.length || t === null ? this[B$1]() : (this.buffer[0] = e.slice(t), e = e.slice(0, t), this[s] -= t), this.emit("data", e), !this.buffer.length && !this[u] && this.emit("drain"), e;
1816
- }
1817
- end(t, e, i) {
1818
- return typeof t == "function" && (i = t, t = null), typeof e == "function" && (i = e, e = "utf8"), t && this.write(t, e), i && this.once("end", i), this[u] = true, this.writable = false, (this.flowing || !this[y]) && this[a](), this;
1819
- }
1820
- [p]() {
1821
- this[n] || (this[y] = false, this[M$1] = true, this.emit("resume"), this.buffer.length ? this[L]() : this[u] ? this[a]() : this.emit("drain"));
1822
- }
1823
- resume() {
1824
- return this[p]();
1825
- }
1826
- pause() {
1827
- this[M$1] = false, this[y] = true;
1828
- }
1829
- get destroyed() {
1830
- return this[n];
1831
- }
1832
- get flowing() {
1833
- return this[M$1];
1834
- }
1835
- get paused() {
1836
- return this[y];
1837
- }
1838
- [T](t) {
1839
- this[r] ? this[s] += 1 : this[s] += t.length, this.buffer.push(t);
1840
- }
1841
- [B$1]() {
1842
- return this.buffer.length && (this[r] ? this[s] -= 1 : this[s] -= this.buffer[0].length), this.buffer.shift();
1843
- }
1844
- [L](t) {
1845
- do ;
1846
- while (this[_](this[B$1]()));
1847
- !t && !this.buffer.length && !this[u] && this.emit("drain");
1848
- }
1849
- [_](t) {
1850
- return t ? (this.emit("data", t), this.flowing) : false;
1851
- }
1852
- pipe(t, e) {
1853
- if (this[n]) return;
1854
- const i = this[c$1];
1855
- return e = e || {}, t === I$1.stdout || t === I$1.stderr ? e.end = false : e.end = e.end !== false, e.proxyErrors = !!e.proxyErrors, i ? e.end && t.end() : (this.pipes.push(e.proxyErrors ? new K$1(this, t, e) : new U$1(this, t, e)), this[d$1] ? b$1(() => this[p]()) : this[p]()), t;
1856
- }
1857
- unpipe(t) {
1858
- const e = this.pipes.find((i) => i.dest === t);
1859
- e && (this.pipes.splice(this.pipes.indexOf(e), 1), e.unpipe());
1860
- }
1861
- addListener(t, e) {
1862
- return this.on(t, e);
1863
- }
1864
- on(t, e) {
1865
- const i = super.on(t, e);
1866
- return t === "data" && !this.pipes.length && !this.flowing ? this[p]() : t === "readable" && this[s] !== 0 ? super.emit("readable") : V$1(t) && this[c$1] ? (super.emit(t), this.removeAllListeners(t)) : t === "error" && this[E] && (this[d$1] ? b$1(() => e.call(this, this[E])) : e.call(this, this[E])), i;
1867
- }
1868
- get emittedEnd() {
1869
- return this[c$1];
1870
- }
1871
- [a]() {
1872
- !this[S] && !this[c$1] && !this[n] && this.buffer.length === 0 && this[u] && (this[S] = true, this.emit("end"), this.emit("prefinish"), this.emit("finish"), this[w] && this.emit("close"), this[S] = false);
1873
- }
1874
- emit(t, e, ...i) {
1875
- if (t !== "error" && t !== "close" && t !== n && this[n]) return;
1876
- if (t === "data") return e ? this[d$1] ? b$1(() => this[D$1](e)) : this[D$1](e) : false;
1877
- if (t === "end") return this[F]();
1878
- if (t === "close") {
1879
- if (this[w] = true, !this[c$1] && !this[n]) return;
1880
- const f = super.emit("close");
1881
- return this.removeAllListeners("close"), f;
1882
- } else if (t === "error") {
1883
- this[E] = e;
1884
- const f = super.emit("error", e);
1885
- return this[a](), f;
1886
- } else if (t === "resume") {
1887
- const f = super.emit("resume");
1888
- return this[a](), f;
1889
- } else if (t === "finish" || t === "prefinish") {
1890
- const f = super.emit(t);
1891
- return this.removeAllListeners(t), f;
1892
- }
1893
- const l = super.emit(t, e, ...i);
1894
- return this[a](), l;
1895
- }
1896
- [D$1](t) {
1897
- for (const i of this.pipes) i.dest.write(t) === false && this.pause();
1898
- const e = super.emit("data", t);
1899
- return this[a](), e;
1900
- }
1901
- [F]() {
1902
- this[c$1] || (this[c$1] = true, this.readable = false, this[d$1] ? b$1(() => this[R]()) : this[R]());
1903
- }
1904
- [R]() {
1905
- if (this[m]) {
1906
- const e = this[m].end();
1907
- if (e) {
1908
- for (const i of this.pipes) i.dest.write(e);
1909
- super.emit("data", e);
1910
- }
1911
- }
1912
- for (const e of this.pipes) e.end();
1913
- const t = super.emit("end");
1914
- return this.removeAllListeners("end"), t;
1915
- }
1916
- collect() {
1917
- const t = [];
1918
- this[r] || (t.dataLength = 0);
1919
- const e = this.promise();
1920
- return this.on("data", (i) => {
1921
- t.push(i), this[r] || (t.dataLength += i.length);
1922
- }), e.then(() => t);
1923
- }
1924
- concat() {
1925
- return this[r] ? Promise.reject(/* @__PURE__ */ new Error("cannot concat in objectMode")) : this.collect().then((t) => this[r] ? Promise.reject(/* @__PURE__ */ new Error("cannot concat in objectMode")) : this[h$2] ? t.join("") : Buffer.concat(t, t.dataLength));
1926
- }
1927
- promise() {
1928
- return new Promise((t, e) => {
1929
- this.on(n, () => e(/* @__PURE__ */ new Error("stream destroyed"))), this.on("error", (i) => e(i)), this.on("end", () => t());
1930
- });
1931
- }
1932
- [$]() {
1933
- return { next: () => {
1934
- const e = this.read();
1935
- if (e !== null) return Promise.resolve({
1936
- done: false,
1937
- value: e
1938
- });
1939
- if (this[u]) return Promise.resolve({ done: true });
1940
- let i = null, l = null;
1941
- const f = (g$1) => {
1942
- this.removeListener("data", A$1), this.removeListener("end", O), l(g$1);
1943
- }, A$1 = (g$1) => {
1944
- this.removeListener("error", f), this.removeListener("end", O), this.pause(), i({
1945
- value: g$1,
1946
- done: !!this[u]
1947
- });
1948
- }, O = () => {
1949
- this.removeListener("error", f), this.removeListener("data", A$1), i({ done: true });
1950
- }, W$1 = () => f(/* @__PURE__ */ new Error("stream destroyed"));
1951
- return new Promise((g$1, z) => {
1952
- l = z, i = g$1, this.once(n, W$1), this.once("error", f), this.once("end", O), this.once("data", A$1);
1953
- });
1954
- } };
1955
- }
1956
- [G]() {
1957
- return { next: () => {
1958
- const e = this.read();
1959
- return {
1960
- value: e,
1961
- done: e === null
1962
- };
1963
- } };
1964
- }
1965
- destroy(t) {
1966
- return this[n] ? (t ? this.emit("error", t) : this.emit(n), this) : (this[n] = true, this.buffer.length = 0, this[s] = 0, typeof this.close == "function" && !this[w] && this.close(), t ? this.emit("error", t) : this.emit(n), this);
1967
- }
1968
- static isStream(t) {
1969
- return !!t && (t instanceof q || t instanceof x$1 || t instanceof Y && (typeof t.pipe == "function" || typeof t.write == "function" && typeof t.end == "function"));
1970
- }
1971
- }, j;
1972
- }
1973
- var C;
1974
- function J() {
1975
- if (C) return i$3;
1976
- C = 1;
1977
- const w = j$1, n = P.Buffer, z = O$2, u = i$3.constants = T(), L = tt(), E = n.concat, c$1 = Symbol("_superWrite");
1978
- class d$1 extends Error {
1979
- constructor(s) {
1980
- super("zlib: " + s.message), this.code = s.code, this.errno = s.errno, this.code || (this.code = "ZLIB_ERROR"), this.message = "zlib: " + s.message, Error.captureStackTrace(this, this.constructor);
1981
- }
1982
- get name() {
1983
- return "ZlibError";
1984
- }
1985
- }
1986
- const Z = Symbol("opts"), p = Symbol("flushFlag"), I$1 = Symbol("finishFlushFlag"), y = Symbol("fullFlushFlag"), t = Symbol("handle"), _ = Symbol("onError"), f = Symbol("sawError"), F = Symbol("level"), S = Symbol("strategy"), g$1 = Symbol("ended");
1987
- class x$1 extends L {
1988
- constructor(s, e) {
1989
- if (!s || typeof s != "object") throw new TypeError("invalid options for ZlibBase constructor");
1990
- super(s), this[f] = false, this[g$1] = false, this[Z] = s, this[p] = s.flush, this[I$1] = s.finishFlush;
1991
- try {
1992
- this[t] = new z[e](s);
1993
- } catch (i) {
1994
- throw new d$1(i);
1995
- }
1996
- this[_] = (i) => {
1997
- this[f] || (this[f] = true, this.close(), this.emit("error", i));
1998
- }, this[t].on("error", (i) => this[_](new d$1(i))), this.once("end", () => this.close);
1999
- }
2000
- close() {
2001
- this[t] && (this[t].close(), this[t] = null, this.emit("close"));
2002
- }
2003
- reset() {
2004
- if (!this[f]) return w(this[t], "zlib binding closed"), this[t].reset();
2005
- }
2006
- flush(s) {
2007
- this.ended || (typeof s != "number" && (s = this[y]), this.write(Object.assign(n.alloc(0), { [p]: s })));
2008
- }
2009
- end(s, e, i) {
2010
- return s && this.write(s, e), this.flush(this[I$1]), this[g$1] = true, super.end(null, null, i);
2011
- }
2012
- get ended() {
2013
- return this[g$1];
2014
- }
2015
- write(s, e, i) {
2016
- if (typeof e == "function" && (i = e, e = "utf8"), typeof s == "string" && (s = n.from(s, e)), this[f]) return;
2017
- w(this[t], "zlib binding closed");
2018
- const m = this[t]._handle, R = m.close;
2019
- m.close = () => {};
2020
- const G = this[t].close;
2021
- this[t].close = () => {}, n.concat = (l) => l;
2022
- let h$2;
2023
- try {
2024
- const l = typeof s[p] == "number" ? s[p] : this[p];
2025
- h$2 = this[t]._processChunk(s, l), n.concat = E;
2026
- } catch (l) {
2027
- n.concat = E, this[_](new d$1(l));
2028
- } finally {
2029
- this[t] && (this[t]._handle = m, m.close = R, this[t].close = G, this[t].removeAllListeners("error"));
2030
- }
2031
- this[t] && this[t].on("error", (l) => this[_](new d$1(l)));
2032
- let b$1;
2033
- if (h$2) if (Array.isArray(h$2) && h$2.length > 0) {
2034
- b$1 = this[c$1](n.from(h$2[0]));
2035
- for (let l = 1; l < h$2.length; l++) b$1 = this[c$1](h$2[l]);
2036
- } else b$1 = this[c$1](n.from(h$2));
2037
- return i && i(), b$1;
2038
- }
2039
- [c$1](s) {
2040
- return super.write(s);
2041
- }
2042
- }
2043
- class a extends x$1 {
2044
- constructor(s, e) {
2045
- s = s || {}, s.flush = s.flush || u.Z_NO_FLUSH, s.finishFlush = s.finishFlush || u.Z_FINISH, super(s, e), this[y] = u.Z_FULL_FLUSH, this[F] = s.level, this[S] = s.strategy;
2046
- }
2047
- params(s, e) {
2048
- if (!this[f]) {
2049
- if (!this[t]) throw new Error("cannot switch params when binding is closed");
2050
- if (!this[t].params) throw new Error("not supported in this implementation");
2051
- if (this[F] !== s || this[S] !== e) {
2052
- this.flush(u.Z_SYNC_FLUSH), w(this[t], "zlib binding closed");
2053
- const i = this[t].flush;
2054
- this[t].flush = (m, R) => {
2055
- this.flush(m), R();
2056
- };
2057
- try {
2058
- this[t].params(s, e);
2059
- } finally {
2060
- this[t].flush = i;
2061
- }
2062
- this[t] && (this[F] = s, this[S] = e);
2063
- }
2064
- }
2065
- }
2066
- }
2067
- class q extends a {
2068
- constructor(s) {
2069
- super(s, "Deflate");
2070
- }
2071
- }
2072
- class D$1 extends a {
2073
- constructor(s) {
2074
- super(s, "Inflate");
2075
- }
2076
- }
2077
- const B$1 = Symbol("_portable");
2078
- class $ extends a {
2079
- constructor(s) {
2080
- super(s, "Gzip"), this[B$1] = s && !!s.portable;
2081
- }
2082
- [c$1](s) {
2083
- return this[B$1] ? (this[B$1] = false, s[9] = 255, super[c$1](s)) : super[c$1](s);
2084
- }
2085
- }
2086
- class N$1 extends a {
2087
- constructor(s) {
2088
- super(s, "Gunzip");
2089
- }
2090
- }
2091
- class H extends a {
2092
- constructor(s) {
2093
- super(s, "DeflateRaw");
2094
- }
2095
- }
2096
- let T$1$1 = class T extends a {
2097
- constructor(s) {
2098
- super(s, "InflateRaw");
2099
- }
2100
- };
2101
- class U$1 extends a {
2102
- constructor(s) {
2103
- super(s, "Unzip");
2104
- }
2105
- }
2106
- class O extends x$1 {
2107
- constructor(s, e) {
2108
- s = s || {}, s.flush = s.flush || u.BROTLI_OPERATION_PROCESS, s.finishFlush = s.finishFlush || u.BROTLI_OPERATION_FINISH, super(s, e), this[y] = u.BROTLI_OPERATION_FLUSH;
2109
- }
2110
- }
2111
- class v extends O {
2112
- constructor(s) {
2113
- super(s, "BrotliCompress");
2114
- }
2115
- }
2116
- class A$1 extends O {
2117
- constructor(s) {
2118
- super(s, "BrotliDecompress");
2119
- }
2120
- }
2121
- return i$3.Deflate = q, i$3.Inflate = D$1, i$3.Gzip = $, i$3.Gunzip = N$1, i$3.DeflateRaw = H, i$3.InflateRaw = T$1$1, i$3.Unzip = U$1, typeof z.BrotliCompress == "function" ? (i$3.BrotliCompress = v, i$3.BrotliDecompress = A$1) : i$3.BrotliCompress = i$3.BrotliDecompress = class {
2122
- constructor() {
2123
- throw new Error("Brotli is not supported in this version of Node.js");
2124
- }
2125
- }, i$3;
2126
- }
2127
- var O$1, F$2;
2128
- function rt() {
2129
- if (F$2) return O$1;
2130
- F$2 = 1;
2131
- const P$2 = c$4(), $ = E(), v = nt, W$1 = c$3(), G = 1024 * 1024, k = u$3(), C = f$2(), x$1 = J(), { nextTick: j } = nt$1, B$1 = Buffer.from([31, 139]), h$2 = Symbol("state"), d$1 = Symbol("writeEntry"), a = Symbol("readEntry"), I$1 = Symbol("nextEntry"), U$1 = Symbol("processEntry"), l = Symbol("extendedHeader"), y = Symbol("globalExtendedHeader"), c$1 = Symbol("meta"), H = Symbol("emitMeta"), n = Symbol("buffer"), f = Symbol("queue"), u = Symbol("ended"), L = Symbol("emittedEnd"), b$1 = Symbol("emit"), r = Symbol("unzip"), _ = Symbol("consumeChunk"), g$1 = Symbol("consumeChunkSub"), q = Symbol("consumeBody"), z = Symbol("consumeMeta"), Y = Symbol("consumeHeader"), N$1 = Symbol("consuming"), D$1 = Symbol("bufferConcat"), M$1 = Symbol("maybeEnd"), S = Symbol("writing"), m = Symbol("aborted"), T = Symbol("onDone"), E$1$1 = Symbol("sawValidEntry"), R = Symbol("sawNullBlock"), A$1 = Symbol("sawEOF"), V$1 = Symbol("closeStream"), K$1 = (X) => true;
2132
- return O$1 = P$2(class extends v {
2133
- constructor(t) {
2134
- t = t || {}, super(t), this.file = t.file || "", this[E$1$1] = null, this.on(T, (s) => {
2135
- (this[h$2] === "begin" || this[E$1$1] === false) && this.warn("TAR_BAD_ARCHIVE", "Unrecognized archive format");
2136
- }), t.ondone ? this.on(T, t.ondone) : this.on(T, (s) => {
2137
- this.emit("prefinish"), this.emit("finish"), this.emit("end");
2138
- }), this.strict = !!t.strict, this.maxMetaEntrySize = t.maxMetaEntrySize || G, this.filter = typeof t.filter == "function" ? t.filter : K$1;
2139
- const i = t.file && (t.file.endsWith(".tar.br") || t.file.endsWith(".tbr"));
2140
- this.brotli = !t.gzip && t.brotli !== void 0 ? t.brotli : i ? void 0 : false, this.writable = true, this.readable = false, this[f] = new W$1(), this[n] = null, this[a] = null, this[d$1] = null, this[h$2] = "begin", this[c$1] = "", this[l] = null, this[y] = null, this[u] = false, this[r] = null, this[m] = false, this[R] = false, this[A$1] = false, this.on("end", () => this[V$1]()), typeof t.onwarn == "function" && this.on("warn", t.onwarn), typeof t.onentry == "function" && this.on("entry", t.onentry);
2141
- }
2142
- [Y](t, i) {
2143
- this[E$1$1] === null && (this[E$1$1] = false);
2144
- let s;
2145
- try {
2146
- s = new $(t, i, this[l], this[y]);
2147
- } catch (o) {
2148
- return this.warn("TAR_ENTRY_INVALID", o);
2149
- }
2150
- if (s.nullBlock) this[R] ? (this[A$1] = true, this[h$2] === "begin" && (this[h$2] = "header"), this[b$1]("eof")) : (this[R] = true, this[b$1]("nullBlock"));
2151
- else if (this[R] = false, !s.cksumValid) this.warn("TAR_ENTRY_INVALID", "checksum failure", { header: s });
2152
- else if (!s.path) this.warn("TAR_ENTRY_INVALID", "path is required", { header: s });
2153
- else {
2154
- const o = s.type;
2155
- if (/^(Symbolic)?Link$/.test(o) && !s.linkpath) this.warn("TAR_ENTRY_INVALID", "linkpath required", { header: s });
2156
- else if (!/^(Symbolic)?Link$/.test(o) && s.linkpath) this.warn("TAR_ENTRY_INVALID", "linkpath forbidden", { header: s });
2157
- else {
2158
- const e = this[d$1] = new k(s, this[l], this[y]);
2159
- if (!this[E$1$1]) if (e.remain) {
2160
- const w = () => {
2161
- e.invalid || (this[E$1$1] = true);
2162
- };
2163
- e.on("end", w);
2164
- } else this[E$1$1] = true;
2165
- e.meta ? e.size > this.maxMetaEntrySize ? (e.ignore = true, this[b$1]("ignoredEntry", e), this[h$2] = "ignore", e.resume()) : e.size > 0 && (this[c$1] = "", e.on("data", (w) => this[c$1] += w), this[h$2] = "meta") : (this[l] = null, e.ignore = e.ignore || !this.filter(e.path, e), e.ignore ? (this[b$1]("ignoredEntry", e), this[h$2] = e.remain ? "ignore" : "header", e.resume()) : (e.remain ? this[h$2] = "body" : (this[h$2] = "header", e.end()), this[a] ? this[f].push(e) : (this[f].push(e), this[I$1]())));
2166
- }
2167
- }
2168
- }
2169
- [V$1]() {
2170
- j(() => this.emit("close"));
2171
- }
2172
- [U$1](t) {
2173
- let i = true;
2174
- return t ? Array.isArray(t) ? this.emit.apply(this, t) : (this[a] = t, this.emit("entry", t), t.emittedEnd || (t.on("end", (s) => this[I$1]()), i = false)) : (this[a] = null, i = false), i;
2175
- }
2176
- [I$1]() {
2177
- do ;
2178
- while (this[U$1](this[f].shift()));
2179
- if (!this[f].length) {
2180
- const t = this[a];
2181
- !t || t.flowing || t.size === t.remain ? this[S] || this.emit("drain") : t.once("drain", (s) => this.emit("drain"));
2182
- }
2183
- }
2184
- [q](t, i) {
2185
- const s = this[d$1], o = s.blockRemain, e = o >= t.length && i === 0 ? t : t.slice(i, i + o);
2186
- return s.write(e), s.blockRemain || (this[h$2] = "header", this[d$1] = null, s.end()), e.length;
2187
- }
2188
- [z](t, i) {
2189
- const s = this[d$1], o = this[q](t, i);
2190
- return this[d$1] || this[H](s), o;
2191
- }
2192
- [b$1](t, i, s) {
2193
- !this[f].length && !this[a] ? this.emit(t, i, s) : this[f].push([
2194
- t,
2195
- i,
2196
- s
2197
- ]);
2198
- }
2199
- [H](t) {
2200
- switch (this[b$1]("meta", this[c$1]), t.type) {
2201
- case "ExtendedHeader":
2202
- case "OldExtendedHeader":
2203
- this[l] = C.parse(this[c$1], this[l], false);
2204
- break;
2205
- case "GlobalExtendedHeader":
2206
- this[y] = C.parse(this[c$1], this[y], true);
2207
- break;
2208
- case "NextFileHasLongPath":
2209
- case "OldGnuLongPath":
2210
- this[l] = this[l] || Object.create(null), this[l].path = this[c$1].replace(/\0.*/, "");
2211
- break;
2212
- case "NextFileHasLongLinkpath":
2213
- this[l] = this[l] || Object.create(null), this[l].linkpath = this[c$1].replace(/\0.*/, "");
2214
- break;
2215
- default: throw new Error("unknown meta: " + t.type);
2216
- }
2217
- }
2218
- abort(t) {
2219
- this[m] = true, this.emit("abort", t), this.warn("TAR_ABORT", t, { recoverable: false });
2220
- }
2221
- write(t) {
2222
- if (this[m]) return;
2223
- if ((this[r] === null || this.brotli === void 0 && this[r] === false) && t) {
2224
- if (this[n] && (t = Buffer.concat([this[n], t]), this[n] = null), t.length < B$1.length) return this[n] = t, true;
2225
- for (let e = 0; this[r] === null && e < B$1.length; e++) t[e] !== B$1[e] && (this[r] = false);
2226
- const o = this.brotli === void 0;
2227
- if (this[r] === false && o) if (t.length < 512) if (this[u]) this.brotli = true;
2228
- else return this[n] = t, true;
2229
- else try {
2230
- new $(t.slice(0, 512)), this.brotli = !1;
2231
- } catch {
2232
- this.brotli = true;
2233
- }
2234
- if (this[r] === null || this[r] === false && this.brotli) {
2235
- const e = this[u];
2236
- this[u] = false, this[r] = this[r] === null ? new x$1.Unzip() : new x$1.BrotliDecompress(), this[r].on("data", (p) => this[_](p)), this[r].on("error", (p) => this.abort(p)), this[r].on("end", (p) => {
2237
- this[u] = true, this[_]();
2238
- }), this[S] = true;
2239
- const w = this[r][e ? "end" : "write"](t);
2240
- return this[S] = false, w;
2241
- }
2242
- }
2243
- this[S] = true, this[r] ? this[r].write(t) : this[_](t), this[S] = false;
2244
- const s = this[f].length ? false : this[a] ? this[a].flowing : true;
2245
- return !s && !this[f].length && this[a].once("drain", (o) => this.emit("drain")), s;
2246
- }
2247
- [D$1](t) {
2248
- t && !this[m] && (this[n] = this[n] ? Buffer.concat([this[n], t]) : t);
2249
- }
2250
- [M$1]() {
2251
- if (this[u] && !this[L] && !this[m] && !this[N$1]) {
2252
- this[L] = true;
2253
- const t = this[d$1];
2254
- if (t && t.blockRemain) {
2255
- const i = this[n] ? this[n].length : 0;
2256
- this.warn("TAR_BAD_ARCHIVE", `Truncated input (needed ${t.blockRemain} more bytes, only ${i} available)`, { entry: t }), this[n] && t.write(this[n]), t.end();
2257
- }
2258
- this[b$1](T);
2259
- }
2260
- }
2261
- [_](t) {
2262
- if (this[N$1]) this[D$1](t);
2263
- else if (!t && !this[n]) this[M$1]();
2264
- else {
2265
- if (this[N$1] = true, this[n]) {
2266
- this[D$1](t);
2267
- const i = this[n];
2268
- this[n] = null, this[g$1](i);
2269
- } else this[g$1](t);
2270
- for (; this[n] && this[n].length >= 512 && !this[m] && !this[A$1];) {
2271
- const i = this[n];
2272
- this[n] = null, this[g$1](i);
2273
- }
2274
- this[N$1] = false;
2275
- }
2276
- (!this[n] || this[u]) && this[M$1]();
2277
- }
2278
- [g$1](t) {
2279
- let i = 0;
2280
- const s = t.length;
2281
- for (; i + 512 <= s && !this[m] && !this[A$1];) switch (this[h$2]) {
2282
- case "begin":
2283
- case "header":
2284
- this[Y](t, i), i += 512;
2285
- break;
2286
- case "ignore":
2287
- case "body":
2288
- i += this[q](t, i);
2289
- break;
2290
- case "meta":
2291
- i += this[z](t, i);
2292
- break;
2293
- default: throw new Error("invalid state: " + this[h$2]);
2294
- }
2295
- i < s && (this[n] ? this[n] = Buffer.concat([t.slice(i), this[n]]) : this[n] = t.slice(i));
2296
- }
2297
- end(t) {
2298
- this[m] || (this[r] ? this[r].end(t) : (this[u] = true, this.brotli === void 0 && (t = t || Buffer.alloc(0)), this.write(t)));
2299
- }
2300
- }), O$1;
2301
- }
2302
- var s$4 = {};
2303
- var v$1;
2304
- function X() {
2305
- if (v$1) return s$4;
2306
- v$1 = 1;
2307
- const H = tt(), I$1 = nt.EventEmitter, r = nativeFs;
2308
- let R = r.writev;
2309
- if (!R) {
2310
- const c$1 = process.binding("fs"), t = c$1.FSReqWrap || c$1.FSReqCallback;
2311
- R = (e, i, $, A$1) => {
2312
- const G = (J, K$1) => A$1(J, K$1, i), j = new t();
2313
- j.oncomplete = G, c$1.writeBuffers(e, i, $, j);
2314
- };
2315
- }
2316
- const m = Symbol("_autoClose"), h$2 = Symbol("_close"), g$1 = Symbol("_ended"), s = Symbol("_fd"), B$1 = Symbol("_finished"), o = Symbol("_flags"), x$1 = Symbol("_flush"), z = Symbol("_handleChunk"), T = Symbol("_makeBuf"), q = Symbol("_mode"), E = Symbol("_needDrain"), d$1 = Symbol("_onerror"), y = Symbol("_onopen"), W$1 = Symbol("_onread"), _ = Symbol("_onwrite"), a = Symbol("_open"), l = Symbol("_path"), u = Symbol("_pos"), n = Symbol("_queue"), S = Symbol("_read"), M$1 = Symbol("_readSize"), f = Symbol("_reading"), k = Symbol("_remain"), N$1 = Symbol("_size"), C = Symbol("_write"), b$1 = Symbol("_writing"), F = Symbol("_defaultFlag"), p = Symbol("_errored");
2317
- class D$1 extends H {
2318
- constructor(t, e) {
2319
- if (e = e || {}, super(e), this.readable = true, this.writable = false, typeof t != "string") throw new TypeError("path must be a string");
2320
- this[p] = false, this[s] = typeof e.fd == "number" ? e.fd : null, this[l] = t, this[M$1] = e.readSize || 16 * 1024 * 1024, this[f] = false, this[N$1] = typeof e.size == "number" ? e.size : Infinity, this[k] = this[N$1], this[m] = typeof e.autoClose == "boolean" ? e.autoClose : true, typeof this[s] == "number" ? this[S]() : this[a]();
2321
- }
2322
- get fd() {
2323
- return this[s];
2324
- }
2325
- get path() {
2326
- return this[l];
2327
- }
2328
- write() {
2329
- throw new TypeError("this is a readable stream");
2330
- }
2331
- end() {
2332
- throw new TypeError("this is a readable stream");
2333
- }
2334
- [a]() {
2335
- r.open(this[l], "r", (t, e) => this[y](t, e));
2336
- }
2337
- [y](t, e) {
2338
- t ? this[d$1](t) : (this[s] = e, this.emit("open", e), this[S]());
2339
- }
2340
- [T]() {
2341
- return Buffer.allocUnsafe(Math.min(this[M$1], this[k]));
2342
- }
2343
- [S]() {
2344
- if (!this[f]) {
2345
- this[f] = true;
2346
- const t = this[T]();
2347
- if (t.length === 0) return process.nextTick(() => this[W$1](null, 0, t));
2348
- r.read(this[s], t, 0, t.length, null, (e, i, $) => this[W$1](e, i, $));
2349
- }
2350
- }
2351
- [W$1](t, e, i) {
2352
- this[f] = false, t ? this[d$1](t) : this[z](e, i) && this[S]();
2353
- }
2354
- [h$2]() {
2355
- if (this[m] && typeof this[s] == "number") {
2356
- const t = this[s];
2357
- this[s] = null, r.close(t, (e) => e ? this.emit("error", e) : this.emit("close"));
2358
- }
2359
- }
2360
- [d$1](t) {
2361
- this[f] = true, this[h$2](), this.emit("error", t);
2362
- }
2363
- [z](t, e) {
2364
- let i = false;
2365
- return this[k] -= t, t > 0 && (i = super.write(t < e.length ? e.slice(0, t) : e)), (t === 0 || this[k] <= 0) && (i = false, this[h$2](), super.end()), i;
2366
- }
2367
- emit(t, e) {
2368
- switch (t) {
2369
- case "prefinish":
2370
- case "finish": break;
2371
- case "drain":
2372
- typeof this[s] == "number" && this[S]();
2373
- break;
2374
- case "error": return this[p] ? void 0 : (this[p] = true, super.emit(t, e));
2375
- default: return super.emit(t, e);
2376
- }
2377
- }
2378
- }
2379
- class P$2 extends D$1 {
2380
- [a]() {
2381
- let t = true;
2382
- try {
2383
- this[y](null, r.openSync(this[l], "r")), t = !1;
2384
- } finally {
2385
- t && this[h$2]();
2386
- }
2387
- }
2388
- [S]() {
2389
- let t = true;
2390
- try {
2391
- if (!this[f]) {
2392
- this[f] = !0;
2393
- do {
2394
- const e = this[T](), i = e.length === 0 ? 0 : r.readSync(this[s], e, 0, e.length, null);
2395
- if (!this[z](i, e)) break;
2396
- } while (!0);
2397
- this[f] = !1;
2398
- }
2399
- t = !1;
2400
- } finally {
2401
- t && this[h$2]();
2402
- }
2403
- }
2404
- [h$2]() {
2405
- if (this[m] && typeof this[s] == "number") {
2406
- const t = this[s];
2407
- this[s] = null, r.closeSync(t), this.emit("close");
2408
- }
2409
- }
2410
- }
2411
- class O extends I$1 {
2412
- constructor(t, e) {
2413
- e = e || {}, super(e), this.readable = false, this.writable = true, this[p] = false, this[b$1] = false, this[g$1] = false, this[E] = false, this[n] = [], this[l] = t, this[s] = typeof e.fd == "number" ? e.fd : null, this[q] = e.mode === void 0 ? 438 : e.mode, this[u] = typeof e.start == "number" ? e.start : null, this[m] = typeof e.autoClose == "boolean" ? e.autoClose : true;
2414
- const i = this[u] !== null ? "r+" : "w";
2415
- this[F] = e.flags === void 0, this[o] = this[F] ? i : e.flags, this[s] === null && this[a]();
2416
- }
2417
- emit(t, e) {
2418
- if (t === "error") {
2419
- if (this[p]) return;
2420
- this[p] = true;
2421
- }
2422
- return super.emit(t, e);
2423
- }
2424
- get fd() {
2425
- return this[s];
2426
- }
2427
- get path() {
2428
- return this[l];
2429
- }
2430
- [d$1](t) {
2431
- this[h$2](), this[b$1] = true, this.emit("error", t);
2432
- }
2433
- [a]() {
2434
- r.open(this[l], this[o], this[q], (t, e) => this[y](t, e));
2435
- }
2436
- [y](t, e) {
2437
- this[F] && this[o] === "r+" && t && t.code === "ENOENT" ? (this[o] = "w", this[a]()) : t ? this[d$1](t) : (this[s] = e, this.emit("open", e), this[x$1]());
2438
- }
2439
- end(t, e) {
2440
- return t && this.write(t, e), this[g$1] = true, !this[b$1] && !this[n].length && typeof this[s] == "number" && this[_](null, 0), this;
2441
- }
2442
- write(t, e) {
2443
- return typeof t == "string" && (t = Buffer.from(t, e)), this[g$1] ? (this.emit("error", /* @__PURE__ */ new Error("write() after end()")), false) : this[s] === null || this[b$1] || this[n].length ? (this[n].push(t), this[E] = true, false) : (this[b$1] = true, this[C](t), true);
2444
- }
2445
- [C](t) {
2446
- r.write(this[s], t, 0, t.length, this[u], (e, i) => this[_](e, i));
2447
- }
2448
- [_](t, e) {
2449
- t ? this[d$1](t) : (this[u] !== null && (this[u] += e), this[n].length ? this[x$1]() : (this[b$1] = false, this[g$1] && !this[B$1] ? (this[B$1] = true, this[h$2](), this.emit("finish")) : this[E] && (this[E] = false, this.emit("drain"))));
2450
- }
2451
- [x$1]() {
2452
- if (this[n].length === 0) this[g$1] && this[_](null, 0);
2453
- else if (this[n].length === 1) this[C](this[n].pop());
2454
- else {
2455
- const t = this[n];
2456
- this[n] = [], R(this[s], t, this[u], (e, i) => this[_](e, i));
2457
- }
2458
- }
2459
- [h$2]() {
2460
- if (this[m] && typeof this[s] == "number") {
2461
- const t = this[s];
2462
- this[s] = null, r.close(t, (e) => e ? this.emit("error", e) : this.emit("close"));
2463
- }
2464
- }
2465
- }
2466
- class U$1 extends O {
2467
- [a]() {
2468
- let t;
2469
- if (this[F] && this[o] === "r+") try {
2470
- t = r.openSync(this[l], this[o], this[q]);
2471
- } catch (e) {
2472
- if (e.code === "ENOENT") return this[o] = "w", this[a]();
2473
- throw e;
2474
- }
2475
- else t = r.openSync(this[l], this[o], this[q]);
2476
- this[y](null, t);
2477
- }
2478
- [h$2]() {
2479
- if (this[m] && typeof this[s] == "number") {
2480
- const t = this[s];
2481
- this[s] = null, r.closeSync(t), this.emit("close");
2482
- }
2483
- }
2484
- [C](t) {
2485
- let e = true;
2486
- try {
2487
- this[_](null, r.writeSync(this[s], t, 0, t.length, this[u])), e = !1;
2488
- } finally {
2489
- if (e) try {
2490
- this[h$2]();
2491
- } catch {}
2492
- }
2493
- }
2494
- }
2495
- return s$4.ReadStream = D$1, s$4.ReadStreamSync = P$2, s$4.WriteStream = O, s$4.WriteStreamSync = U$1, s$4;
2496
- }
2497
- var r$1 = { exports: {} };
2498
- var i$2, m$2;
2499
- function t$2() {
2500
- if (m$2) return i$2;
2501
- m$2 = 1;
2502
- const { promisify: n } = a$a, e = nativeFs;
2503
- return i$2 = (r) => {
2504
- if (!r) r = {
2505
- mode: 511,
2506
- fs: e
2507
- };
2508
- else if (typeof r == "object") r = {
2509
- mode: 511,
2510
- fs: e,
2511
- ...r
2512
- };
2513
- else if (typeof r == "number") r = {
2514
- mode: r,
2515
- fs: e
2516
- };
2517
- else if (typeof r == "string") r = {
2518
- mode: parseInt(r, 8),
2519
- fs: e
2520
- };
2521
- else throw new TypeError("invalid options argument");
2522
- return r.mkdir = r.mkdir || r.fs.mkdir || e.mkdir, r.mkdirAsync = n(r.mkdir), r.stat = r.stat || r.fs.stat || e.stat, r.statAsync = n(r.stat), r.statSync = r.statSync || r.fs.statSync || e.statSync, r.mkdirSync = r.mkdirSync || r.fs.mkdirSync || e.mkdirSync, r;
2523
- }, i$2;
2524
- }
2525
- var e$1, t$1;
2526
- function u$2() {
2527
- if (t$1) return e$1;
2528
- t$1 = 1;
2529
- const s = process.env.__TESTING_MKDIRP_PLATFORM__ || process.platform, { resolve: o, parse: n } = path;
2530
- return e$1 = (r) => {
2531
- if (/\0/.test(r)) throw Object.assign(/* @__PURE__ */ new TypeError("path must be a string without null bytes"), {
2532
- path: r,
2533
- code: "ERR_INVALID_ARG_VALUE"
2534
- });
2535
- if (r = o(r), s === "win32") {
2536
- const i = /[*|"<>?:]/, { root: a } = n(r);
2537
- if (i.test(r.substr(a.length))) throw Object.assign(/* @__PURE__ */ new Error("Illegal characters in path."), {
2538
- path: r,
2539
- code: "EINVAL"
2540
- });
2541
- }
2542
- return r;
2543
- }, e$1;
2544
- }
2545
- var i$1, c$2;
2546
- function t() {
2547
- if (c$2) return i$1;
2548
- c$2 = 1;
2549
- const { dirname: u } = path, f = (r, e, n = void 0) => n === e ? Promise.resolve() : r.statAsync(e).then((d$1) => d$1.isDirectory() ? n : void 0, (d$1) => d$1.code === "ENOENT" ? f(r, u(e), e) : void 0), o = (r, e, n = void 0) => {
2550
- if (n !== e) try {
2551
- return r.statSync(e).isDirectory() ? n : void 0;
2552
- } catch (d$1) {
2553
- return d$1.code === "ENOENT" ? o(r, u(e), e) : void 0;
2554
- }
2555
- };
2556
- return i$1 = {
2557
- findMade: f,
2558
- findMadeSync: o
2559
- }, i$1;
2560
- }
2561
- var o$3, a$4;
2562
- function y$2() {
2563
- if (a$4) return o$3;
2564
- a$4 = 1;
2565
- const { dirname: f } = path, t = (n, e, c$1) => {
2566
- e.recursive = false;
2567
- const i = f(n);
2568
- return i === n ? e.mkdirAsync(n, e).catch((r) => {
2569
- if (r.code !== "EISDIR") throw r;
2570
- }) : e.mkdirAsync(n, e).then(() => c$1 || n, (r) => {
2571
- if (r.code === "ENOENT") return t(i, e).then((u) => t(n, e, u));
2572
- if (r.code !== "EEXIST" && r.code !== "EROFS") throw r;
2573
- return e.statAsync(n).then((u) => {
2574
- if (u.isDirectory()) return c$1;
2575
- throw r;
2576
- }, () => {
2577
- throw r;
2578
- });
2579
- });
2580
- }, d$1 = (n, e, c$1) => {
2581
- const i = f(n);
2582
- if (e.recursive = false, i === n) try {
2583
- return e.mkdirSync(n, e);
2584
- } catch (r) {
2585
- if (r.code !== "EISDIR") throw r;
2586
- return;
2587
- }
2588
- try {
2589
- return e.mkdirSync(n, e), c$1 || n;
2590
- } catch (r) {
2591
- if (r.code === "ENOENT") return d$1(n, e, d$1(i, e, c$1));
2592
- if (r.code !== "EEXIST" && r.code !== "EROFS") throw r;
2593
- try {
2594
- if (!e.statSync(n).isDirectory()) throw r;
2595
- } catch {
2596
- throw r;
2597
- }
2598
- }
2599
- };
2600
- return o$3 = {
2601
- mkdirpManual: t,
2602
- mkdirpManualSync: d$1
2603
- }, o$3;
2604
- }
2605
- var c$1, m$1;
2606
- function s$3() {
2607
- if (m$1) return c$1;
2608
- m$1 = 1;
2609
- const { dirname: u } = path, { findMade: d$1, findMadeSync: t$1 } = t(), { mkdirpManual: a, mkdirpManualSync: k } = y$2();
2610
- return c$1 = {
2611
- mkdirpNative: (e, r) => (r.recursive = true, u(e) === e ? r.mkdirAsync(e, r) : d$1(r, e).then((n) => r.mkdirAsync(e, r).then(() => n).catch((i) => {
2612
- if (i.code === "ENOENT") return a(e, r);
2613
- throw i;
2614
- }))),
2615
- mkdirpNativeSync: (e, r) => {
2616
- if (r.recursive = true, u(e) === e) return r.mkdirSync(e, r);
2617
- const n = t$1(r, e);
2618
- try {
2619
- return r.mkdirSync(e, r), n;
2620
- } catch (i) {
2621
- if (i.code === "ENOENT") return k(e, r);
2622
- throw i;
2623
- }
2624
- }
2625
- }, c$1;
2626
- }
2627
- var s$2, n$1;
2628
- function a$3() {
2629
- if (n$1) return s$2;
2630
- n$1 = 1;
2631
- const i = nativeFs, e = (process.env.__TESTING_MKDIRP_NODE_VERSION__ || process.version).replace(/^v/, "").split("."), t = +e[0] > 10 || +e[0] == 10 && +e[1] >= 12;
2632
- return s$2 = {
2633
- useNative: t ? (r) => r.mkdir === i.mkdir : () => false,
2634
- useNativeSync: t ? (r) => r.mkdirSync === i.mkdirSync : () => false
2635
- }, s$2;
2636
- }
2637
- var m, s$1;
2638
- function S() {
2639
- if (s$1) return m;
2640
- s$1 = 1;
2641
- const i = t$2(), u = u$2(), { mkdirpNative: a, mkdirpNativeSync: c$1 } = s$3(), { mkdirpManual: o, mkdirpManualSync: q } = y$2(), { useNative: t, useNativeSync: _ } = a$3(), n = (e, r) => (e = u(e), r = i(r), t(r) ? a(e, r) : o(e, r)), d$1 = (e, r) => (e = u(e), r = i(r), _(r) ? c$1(e, r) : q(e, r));
2642
- return n.sync = d$1, n.native = (e, r) => a(u(e), i(r)), n.manual = (e, r) => o(u(e), i(r)), n.nativeSync = (e, r) => c$1(u(e), i(r)), n.manualSync = (e, r) => q(u(e), i(r)), m = n, m;
2643
- }
2644
- var y$1, O;
2645
- function F$1() {
2646
- if (O) return y$1;
2647
- O = 1;
2648
- const c$1 = nativeFs, a = path, T = c$1.lchown ? "lchown" : "chown", I$1 = c$1.lchownSync ? "lchownSync" : "chownSync", i = c$1.lchown && !process.version.match(/v1[1-9]+\./) && !process.version.match(/v10\.[6-9]/), u = (r, e, n) => {
2649
- try {
2650
- return c$1[I$1](r, e, n);
2651
- } catch (t) {
2652
- if (t.code !== "ENOENT") throw t;
2653
- }
2654
- }, D$1 = (r, e, n) => {
2655
- try {
2656
- return c$1.chownSync(r, e, n);
2657
- } catch (t) {
2658
- if (t.code !== "ENOENT") throw t;
2659
- }
2660
- }, _ = i ? (r, e, n, t) => (o) => {
2661
- !o || o.code !== "EISDIR" ? t(o) : c$1.chown(r, e, n, t);
2662
- } : (r, e, n, t) => t, w = i ? (r, e, n) => {
2663
- try {
2664
- return u(r, e, n);
2665
- } catch (t) {
2666
- if (t.code !== "EISDIR") throw t;
2667
- D$1(r, e, n);
2668
- }
2669
- } : (r, e, n) => u(r, e, n), R = process.version;
2670
- let N$1 = (r, e, n) => c$1.readdir(r, e, n), q = (r, e) => c$1.readdirSync(r, e);
2671
- /^v4\./.test(R) && (N$1 = (r, e, n) => c$1.readdir(r, n));
2672
- const h$2 = (r, e, n, t) => {
2673
- c$1[T](r, e, n, _(r, e, n, (o) => {
2674
- t(o && o.code !== "ENOENT" ? o : null);
2675
- }));
2676
- }, S = (r, e, n, t, o) => {
2677
- if (typeof e == "string") return c$1.lstat(a.resolve(r, e), (s, f) => {
2678
- if (s) return o(s.code !== "ENOENT" ? s : null);
2679
- f.name = e, S(r, f, n, t, o);
2680
- });
2681
- if (e.isDirectory()) E(a.resolve(r, e.name), n, t, (s) => {
2682
- if (s) return o(s);
2683
- h$2(a.resolve(r, e.name), n, t, o);
2684
- });
2685
- else h$2(a.resolve(r, e.name), n, t, o);
2686
- }, E = (r, e, n, t) => {
2687
- N$1(r, { withFileTypes: true }, (o, s) => {
2688
- if (o) {
2689
- if (o.code === "ENOENT") return t();
2690
- if (o.code !== "ENOTDIR" && o.code !== "ENOTSUP") return t(o);
2691
- }
2692
- if (o || !s.length) return h$2(r, e, n, t);
2693
- let f = s.length, v = null;
2694
- const H = (l) => {
2695
- if (!v) {
2696
- if (l) return t(v = l);
2697
- if (--f === 0) return h$2(r, e, n, t);
2698
- }
2699
- };
2700
- s.forEach((l) => S(r, l, e, n, H));
2701
- });
2702
- }, C = (r, e, n, t) => {
2703
- if (typeof e == "string") try {
2704
- const o = c$1.lstatSync(a.resolve(r, e));
2705
- o.name = e, e = o;
2706
- } catch (o) {
2707
- if (o.code === "ENOENT") return;
2708
- throw o;
2709
- }
2710
- e.isDirectory() && m(a.resolve(r, e.name), n, t), w(a.resolve(r, e.name), n, t);
2711
- }, m = (r, e, n) => {
2712
- let t;
2713
- try {
2714
- t = q(r, { withFileTypes: !0 });
2715
- } catch (o) {
2716
- if (o.code === "ENOENT") return;
2717
- if (o.code === "ENOTDIR" || o.code === "ENOTSUP") return w(r, e, n);
2718
- throw o;
2719
- }
2720
- return t && t.length && t.forEach((o) => C(r, o, e, n)), w(r, e, n);
2721
- };
2722
- return y$1 = E, E.sync = m, y$1;
2723
- }
2724
- var R;
2725
- function H() {
2726
- if (R) return r$1.exports;
2727
- R = 1;
2728
- const g$1 = S(), l = nativeFs, p = path, x$1 = F$1(), y = a$7();
2729
- class D$1 extends Error {
2730
- constructor(e, s) {
2731
- super("Cannot extract through symbolic link"), this.path = s, this.symlink = e;
2732
- }
2733
- get name() {
2734
- return "SylinkError";
2735
- }
2736
- }
2737
- class E extends Error {
2738
- constructor(e, s) {
2739
- super(s + ": Cannot cd into '" + e + "'"), this.path = e, this.code = s;
2740
- }
2741
- get name() {
2742
- return "CwdError";
2743
- }
2744
- }
2745
- const v = (n, e) => n.get(y(e)), q = (n, e, s) => n.set(y(e), s), I$1 = (n, e) => {
2746
- l.stat(n, (s, r) => {
2747
- (s || !r.isDirectory()) && (s = new E(n, s && s.code || "ENOTDIR")), e(s);
2748
- });
2749
- };
2750
- r$1.exports = (n, e, s) => {
2751
- n = y(n);
2752
- const r = e.umask, c$1 = e.mode | 448, f = (c$1 & r) !== 0, t = e.uid, i = e.gid, a = typeof t == "number" && typeof i == "number" && (t !== e.processUid || i !== e.processGid), u = e.preserve, m = e.unlink, h$2 = e.cache, d$1 = y(e.cwd), w = (k, o) => {
2753
- k ? s(k) : (q(h$2, n, true), o && a ? x$1(o, t, i, (G) => w(G)) : f ? l.chmod(n, c$1, s) : s());
2754
- };
2755
- if (h$2 && v(h$2, n) === true) return w();
2756
- if (n === d$1) return I$1(n, w);
2757
- if (u) return g$1(n, { mode: c$1 }).then((k) => w(null, k), w);
2758
- C(d$1, y(p.relative(d$1, n)).split("/"), c$1, h$2, m, d$1, null, w);
2759
- };
2760
- const C = (n, e, s, r, c$1, f, t, i) => {
2761
- if (!e.length) return i(null, t);
2762
- const a = e.shift(), u = y(p.resolve(n + "/" + a));
2763
- if (v(r, u)) return C(u, e, s, r, c$1, f, t, i);
2764
- l.mkdir(u, s, j(u, e, s, r, c$1, f, t, i));
2765
- }, j = (n, e, s, r, c$1, f, t, i) => (a) => {
2766
- a ? l.lstat(n, (u, m) => {
2767
- if (u) u.path = u.path && y(u.path), i(u);
2768
- else if (m.isDirectory()) C(n, e, s, r, c$1, f, t, i);
2769
- else if (c$1) l.unlink(n, (h$2) => {
2770
- if (h$2) return i(h$2);
2771
- l.mkdir(n, s, j(n, e, s, r, c$1, f, t, i));
2772
- });
2773
- else {
2774
- if (m.isSymbolicLink()) return i(new D$1(n, n + "/" + e.join("/")));
2775
- i(a);
2776
- }
2777
- }) : (t = t || n, C(n, e, s, r, c$1, f, t, i));
2778
- }, L = (n) => {
2779
- let e = false, s = "ENOTDIR";
2780
- try {
2781
- e = l.statSync(n).isDirectory();
2782
- } catch (r) {
2783
- s = r.code;
2784
- } finally {
2785
- if (!e) throw new E(n, s);
2786
- }
2787
- };
2788
- return r$1.exports.sync = (n, e) => {
2789
- n = y(n);
2790
- const s = e.umask, r = e.mode | 448, c$1 = (r & s) !== 0, f = e.uid, t = e.gid, i = typeof f == "number" && typeof t == "number" && (f !== e.processUid || t !== e.processGid), a = e.preserve, u = e.unlink, m = e.cache, h$2 = y(e.cwd), d$1 = (k) => {
2791
- q(m, n, true), k && i && x$1.sync(k, f, t), c$1 && l.chmodSync(n, r);
2792
- };
2793
- if (m && v(m, n) === true) return d$1();
2794
- if (n === h$2) return L(h$2), d$1();
2795
- if (a) return d$1(g$1.sync(n, r));
2796
- const $ = y(p.relative(h$2, n)).split("/");
2797
- let S = null;
2798
- for (let k = $.shift(), o = h$2; k && (o += "/" + k); k = $.shift()) if (o = y(p.resolve(o)), !v(m, o)) try {
2799
- l.mkdirSync(o, r), S = S || o, q(m, o, !0);
2800
- } catch {
2801
- const M$1 = l.lstatSync(o);
2802
- if (M$1.isDirectory()) {
2803
- q(m, o, true);
2804
- continue;
2805
- } else if (u) {
2806
- l.unlinkSync(o), l.mkdirSync(o, r), S = S || o, q(m, o, true);
2807
- continue;
2808
- } else if (M$1.isSymbolicLink()) return new D$1(o, o + "/" + $.join("/"));
2809
- }
2810
- return d$1(S);
2811
- }, r$1.exports;
2812
- }
2813
- var a$2, i;
2814
- function p() {
2815
- if (i) return a$2;
2816
- i = 1;
2817
- const o = [
2818
- "|",
2819
- "<",
2820
- ">",
2821
- "?",
2822
- ":"
2823
- ], t = o.map((e) => String.fromCharCode(61440 + e.charCodeAt(0))), s = new Map(o.map((e, r) => [e, t[r]])), c$1 = new Map(t.map((e, r) => [e, o[r]]));
2824
- return a$2 = {
2825
- encode: (e) => o.reduce((r, n) => r.split(n).join(s.get(n)), e),
2826
- decode: (e) => t.reduce((r, n) => r.split(n).join(c$1.get(n)), e)
2827
- }, a$2;
2828
- }
2829
- var o$2, n;
2830
- function a$1() {
2831
- if (n) return o$2;
2832
- n = 1;
2833
- const r = Object.create(null), { hasOwnProperty: i } = Object.prototype;
2834
- return o$2 = (e) => (i.call(r, e) || (r[e] = e.normalize("NFD")), r[e]), o$2;
2835
- }
2836
- var a, l;
2837
- function s() {
2838
- return l || (l = 1, a = (r) => {
2839
- let e = r.length - 1, i = -1;
2840
- for (; e > -1 && r.charAt(e) === "/";) i = e, e--;
2841
- return i === -1 ? r : r.slice(0, i);
2842
- }), a;
2843
- }
2844
- var u$1, f$1;
2845
- function z() {
2846
- if (f$1) return u$1;
2847
- f$1 = 1;
2848
- const l = j$1, m = a$1(), g$1 = s(), { join: d$1 } = path, q = (process.env.TESTING_TAR_FAKE_PLATFORM || process.platform) === "win32";
2849
- return u$1 = () => {
2850
- const i = /* @__PURE__ */ new Map(), c$1 = /* @__PURE__ */ new Map(), v = (e) => e.split("/").slice(0, -1).reduce((o, r) => (o.length && (r = d$1(o[o.length - 1], r)), o.push(r || "/"), o), []), a = /* @__PURE__ */ new Set(), w = (e) => {
2851
- const s = c$1.get(e);
2852
- if (!s) throw new Error("function does not have any path reservations");
2853
- return {
2854
- paths: s.paths.map((o) => i.get(o)),
2855
- dirs: [...s.dirs].map((o) => i.get(o))
2856
- };
2857
- }, h$2 = (e) => {
2858
- const { paths: s, dirs: o } = w(e);
2859
- return s.every((r) => r[0] === e) && o.every((r) => r[0] instanceof Set && r[0].has(e));
2860
- }, p = (e) => a.has(e) || !h$2(e) ? false : (a.add(e), e(() => S(e)), true), S = (e) => {
2861
- if (!a.has(e)) return false;
2862
- const { paths: s, dirs: o } = c$1.get(e), r = /* @__PURE__ */ new Set();
2863
- return s.forEach((t) => {
2864
- const n = i.get(t);
2865
- l.equal(n[0], e), n.length === 1 ? i.delete(t) : (n.shift(), typeof n[0] == "function" ? r.add(n[0]) : n[0].forEach((E) => r.add(E)));
2866
- }), o.forEach((t) => {
2867
- const n = i.get(t);
2868
- l(n[0] instanceof Set), n[0].size === 1 && n.length === 1 ? i.delete(t) : n[0].size === 1 ? (n.shift(), r.add(n[0])) : n[0].delete(e);
2869
- }), a.delete(e), r.forEach((t) => p(t)), true;
2870
- };
2871
- return {
2872
- check: h$2,
2873
- reserve: (e, s) => {
2874
- e = q ? ["win32 parallelization disabled"] : e.map((r) => g$1(d$1(m(r))).toLowerCase());
2875
- const o = new Set(e.map((r) => v(r)).reduce((r, t) => r.concat(t)));
2876
- return c$1.set(s, {
2877
- dirs: o,
2878
- paths: e
2879
- }), e.forEach((r) => {
2880
- const t = i.get(r);
2881
- t ? t.push(s) : i.set(r, [s]);
2882
- }), o.forEach((r) => {
2883
- const t = i.get(r);
2884
- t ? t[t.length - 1] instanceof Set ? t[t.length - 1].add(s) : t.push(new Set([s])) : i.set(r, [new Set([s])]);
2885
- }), p(s);
2886
- }
2887
- };
2888
- }, u$1;
2889
- }
2890
- var o$1, u;
2891
- function c$5() {
2892
- if (u) return o$1;
2893
- u = 1;
2894
- const { isAbsolute: l, parse: t } = path.win32;
2895
- return o$1 = (r) => {
2896
- let s = "", e = t(r);
2897
- for (; l(r) || e.root;) {
2898
- const i = r.charAt(0) === "/" && r.slice(0, 4) !== "//?/" ? "/" : e.root;
2899
- r = r.slice(i.length), s += i, e = t(r);
2900
- }
2901
- return [s, r];
2902
- }, o$1;
2903
- }
2904
- var e, o;
2905
- function F() {
2906
- if (o) return e;
2907
- o = 1;
2908
- const t = process.env.__FAKE_PLATFORM__ || process.platform, s = typeof Bun < "u" ? false : t === "win32", { O_CREAT: _, O_TRUNC: a, O_WRONLY: i, UV_FS_O_FILEMAP: r = 0 } = (commonjsGlobal.__FAKE_TESTING_FS__ || nativeFs).constants, c$1 = s && !!r, f = 512 * 1024, p = r | a | _ | i;
2909
- return e = c$1 ? (l) => l < f ? p : "w" : () => "w", e;
2910
- }
2911
- var G, y;
2912
- function Os() {
2913
- if (y) return G;
2914
- y = 1;
2915
- const ss = j$1, is = rt(), r = nativeFs, es = X(), w = path, M$1 = H(), K$1 = p(), ts = z(), os$1 = c$5(), l = a$7(), rs = s(), hs = a$1(), H$1 = Symbol("onEntry"), q = Symbol("checkFs"), Y = Symbol("checkFs2"), v = Symbol("pruneCache"), N$1 = Symbol("isReusable"), d$1 = Symbol("makeFs"), U$1 = Symbol("file"), F$1 = Symbol("directory"), O = Symbol("link"), B$1 = Symbol("symlink"), z$1$1 = Symbol("hardlink"), W$1 = Symbol("unsupported"), j = Symbol("checkPath"), b$1 = Symbol("mkdir"), m = Symbol("onError"), $ = Symbol("pending"), V$1 = Symbol("pend"), S = Symbol("unpend"), P$2 = Symbol("ended"), A$1 = Symbol("maybeClose"), x$1 = Symbol("skip"), E = Symbol("doChown"), R = Symbol("uid"), _ = Symbol("gid"), g$1 = Symbol("checkedCwd"), X$1 = Ds, J = F(), C = (process.env.TESTING_TAR_FAKE_PLATFORM || process.platform) === "win32", cs = 1024, as = (a, s) => {
2916
- if (!C) return r.unlink(a, s);
2917
- const i = a + ".DELETE." + X$1.randomBytes(16).toString("hex");
2918
- r.rename(a, i, (e) => {
2919
- if (e) return s(e);
2920
- r.unlink(i, s);
2921
- });
2922
- }, us = (a) => {
2923
- if (!C) return r.unlinkSync(a);
2924
- const s = a + ".DELETE." + X$1.randomBytes(16).toString("hex");
2925
- r.renameSync(a, s), r.unlinkSync(s);
2926
- }, Q = (a, s, i) => a === a >>> 0 ? a : s === s >>> 0 ? s : i, Z = (a) => rs(l(hs(a))).toLowerCase(), ns = (a, s) => {
2927
- s = Z(s);
2928
- for (const i of a.keys()) {
2929
- const e = Z(i);
2930
- (e === s || e.indexOf(s + "/") === 0) && a.delete(i);
2931
- }
2932
- }, ms = (a) => {
2933
- for (const s of a.keys()) a.delete(s);
2934
- };
2935
- class L extends is {
2936
- constructor(s) {
2937
- if (s || (s = {}), s.ondone = (i) => {
2938
- this[P$2] = true, this[A$1]();
2939
- }, super(s), this[g$1] = false, this.reservations = ts(), this.transform = typeof s.transform == "function" ? s.transform : null, this.writable = true, this.readable = false, this[$] = 0, this[P$2] = false, this.dirCache = s.dirCache || /* @__PURE__ */ new Map(), typeof s.uid == "number" || typeof s.gid == "number") {
2940
- if (typeof s.uid != "number" || typeof s.gid != "number") throw new TypeError("cannot set owner without number uid and gid");
2941
- if (s.preserveOwner) throw new TypeError("cannot preserve owner in archive and also set owner explicitly");
2942
- this.uid = s.uid, this.gid = s.gid, this.setOwner = true;
2943
- } else this.uid = null, this.gid = null, this.setOwner = false;
2944
- s.preserveOwner === void 0 && typeof s.uid != "number" ? this.preserveOwner = process.getuid && process.getuid() === 0 : this.preserveOwner = !!s.preserveOwner, this.processUid = (this.preserveOwner || this.setOwner) && process.getuid ? process.getuid() : null, this.processGid = (this.preserveOwner || this.setOwner) && process.getgid ? process.getgid() : null, this.maxDepth = typeof s.maxDepth == "number" ? s.maxDepth : cs, this.forceChown = s.forceChown === true, this.win32 = !!s.win32 || C, this.newer = !!s.newer, this.keep = !!s.keep, this.noMtime = !!s.noMtime, this.preservePaths = !!s.preservePaths, this.unlink = !!s.unlink, this.cwd = l(w.resolve(s.cwd || process.cwd())), this.strip = +s.strip || 0, this.processUmask = s.noChmod ? 0 : process.umask(), this.umask = typeof s.umask == "number" ? s.umask : this.processUmask, this.dmode = s.dmode || 511 & ~this.umask, this.fmode = s.fmode || 438 & ~this.umask, this.on("entry", (i) => this[H$1](i));
2945
- }
2946
- warn(s, i, e = {}) {
2947
- return (s === "TAR_BAD_ARCHIVE" || s === "TAR_ABORT") && (e.recoverable = false), super.warn(s, i, e);
2948
- }
2949
- [A$1]() {
2950
- this[P$2] && this[$] === 0 && (this.emit("prefinish"), this.emit("finish"), this.emit("end"));
2951
- }
2952
- [j](s) {
2953
- const i = l(s.path), e = i.split("/");
2954
- if (this.strip) {
2955
- if (e.length < this.strip) return false;
2956
- if (s.type === "Link") {
2957
- const t = l(s.linkpath).split("/");
2958
- if (t.length >= this.strip) s.linkpath = t.slice(this.strip).join("/");
2959
- else return false;
2960
- }
2961
- e.splice(0, this.strip), s.path = e.join("/");
2962
- }
2963
- if (isFinite(this.maxDepth) && e.length > this.maxDepth) return this.warn("TAR_ENTRY_ERROR", "path excessively deep", {
2964
- entry: s,
2965
- path: i,
2966
- depth: e.length,
2967
- maxDepth: this.maxDepth
2968
- }), false;
2969
- if (!this.preservePaths) {
2970
- if (e.includes("..") || C && /^[a-z]:\.\.$/i.test(e[0])) return this.warn("TAR_ENTRY_ERROR", "path contains '..'", {
2971
- entry: s,
2972
- path: i
2973
- }), false;
2974
- const [t, o] = os$1(i);
2975
- t && (s.path = o, this.warn("TAR_ENTRY_INFO", `stripping ${t} from absolute path`, {
2976
- entry: s,
2977
- path: i
2978
- }));
2979
- }
2980
- if (w.isAbsolute(s.path) ? s.absolute = l(w.resolve(s.path)) : s.absolute = l(w.resolve(this.cwd, s.path)), !this.preservePaths && s.absolute.indexOf(this.cwd + "/") !== 0 && s.absolute !== this.cwd) return this.warn("TAR_ENTRY_ERROR", "path escaped extraction target", {
2981
- entry: s,
2982
- path: l(s.path),
2983
- resolvedPath: s.absolute,
2984
- cwd: this.cwd
2985
- }), false;
2986
- if (s.absolute === this.cwd && s.type !== "Directory" && s.type !== "GNUDumpDir") return false;
2987
- if (this.win32) {
2988
- const { root: t } = w.win32.parse(s.absolute);
2989
- s.absolute = t + K$1.encode(s.absolute.slice(t.length));
2990
- const { root: o } = w.win32.parse(s.path);
2991
- s.path = o + K$1.encode(s.path.slice(o.length));
2992
- }
2993
- return true;
2994
- }
2995
- [H$1](s) {
2996
- if (!this[j](s)) return s.resume();
2997
- switch (ss.equal(typeof s.absolute, "string"), s.type) {
2998
- case "Directory":
2999
- case "GNUDumpDir": s.mode && (s.mode = s.mode | 448);
3000
- case "File":
3001
- case "OldFile":
3002
- case "ContiguousFile":
3003
- case "Link":
3004
- case "SymbolicLink": return this[q](s);
3005
- case "CharacterDevice":
3006
- case "BlockDevice":
3007
- case "FIFO":
3008
- default: return this[W$1](s);
3009
- }
3010
- }
3011
- [m](s, i) {
3012
- s.name === "CwdError" ? this.emit("error", s) : (this.warn("TAR_ENTRY_ERROR", s, { entry: i }), this[S](), i.resume());
3013
- }
3014
- [b$1](s, i, e) {
3015
- M$1(l(s), {
3016
- uid: this.uid,
3017
- gid: this.gid,
3018
- processUid: this.processUid,
3019
- processGid: this.processGid,
3020
- umask: this.processUmask,
3021
- preserve: this.preservePaths,
3022
- unlink: this.unlink,
3023
- cache: this.dirCache,
3024
- cwd: this.cwd,
3025
- mode: i,
3026
- noChmod: this.noChmod
3027
- }, e);
3028
- }
3029
- [E](s) {
3030
- return this.forceChown || this.preserveOwner && (typeof s.uid == "number" && s.uid !== this.processUid || typeof s.gid == "number" && s.gid !== this.processGid) || typeof this.uid == "number" && this.uid !== this.processUid || typeof this.gid == "number" && this.gid !== this.processGid;
3031
- }
3032
- [R](s) {
3033
- return Q(this.uid, s.uid, this.processUid);
3034
- }
3035
- [_](s) {
3036
- return Q(this.gid, s.gid, this.processGid);
3037
- }
3038
- [U$1](s, i) {
3039
- const e = s.mode & 4095 || this.fmode, t = new es.WriteStream(s.absolute, {
3040
- flags: J(s.size),
3041
- mode: e,
3042
- autoClose: false
3043
- });
3044
- t.on("error", (c$1) => {
3045
- t.fd && r.close(t.fd, () => {}), t.write = () => true, this[m](c$1, s), i();
3046
- });
3047
- let o = 1;
3048
- const u = (c$1) => {
3049
- if (c$1) {
3050
- t.fd && r.close(t.fd, () => {}), this[m](c$1, s), i();
3051
- return;
3052
- }
3053
- --o === 0 && r.close(t.fd, (n) => {
3054
- n ? this[m](n, s) : this[S](), i();
3055
- });
3056
- };
3057
- t.on("finish", (c$1) => {
3058
- const n = s.absolute, p = t.fd;
3059
- if (s.mtime && !this.noMtime) {
3060
- o++;
3061
- const f = s.atime || /* @__PURE__ */ new Date(), k = s.mtime;
3062
- r.futimes(p, f, k, (D$1) => D$1 ? r.utimes(n, f, k, (I$1) => u(I$1 && D$1)) : u());
3063
- }
3064
- if (this[E](s)) {
3065
- o++;
3066
- const f = this[R](s), k = this[_](s);
3067
- r.fchown(p, f, k, (D$1) => D$1 ? r.chown(n, f, k, (I$1) => u(I$1 && D$1)) : u());
3068
- }
3069
- u();
3070
- });
3071
- const h$2 = this.transform && this.transform(s) || s;
3072
- h$2 !== s && (h$2.on("error", (c$1) => {
3073
- this[m](c$1, s), i();
3074
- }), s.pipe(h$2)), h$2.pipe(t);
3075
- }
3076
- [F$1](s, i) {
3077
- const e = s.mode & 4095 || this.dmode;
3078
- this[b$1](s.absolute, e, (t) => {
3079
- if (t) {
3080
- this[m](t, s), i();
3081
- return;
3082
- }
3083
- let o = 1;
3084
- const u = (h$2) => {
3085
- --o === 0 && (i(), this[S](), s.resume());
3086
- };
3087
- s.mtime && !this.noMtime && (o++, r.utimes(s.absolute, s.atime || /* @__PURE__ */ new Date(), s.mtime, u)), this[E](s) && (o++, r.chown(s.absolute, this[R](s), this[_](s), u)), u();
3088
- });
3089
- }
3090
- [W$1](s) {
3091
- s.unsupported = true, this.warn("TAR_ENTRY_UNSUPPORTED", `unsupported entry type: ${s.type}`, { entry: s }), s.resume();
3092
- }
3093
- [B$1](s, i) {
3094
- this[O](s, s.linkpath, "symlink", i);
3095
- }
3096
- [z$1$1](s, i) {
3097
- const e = l(w.resolve(this.cwd, s.linkpath));
3098
- this[O](s, e, "link", i);
3099
- }
3100
- [V$1]() {
3101
- this[$]++;
3102
- }
3103
- [S]() {
3104
- this[$]--, this[A$1]();
3105
- }
3106
- [x$1](s) {
3107
- this[S](), s.resume();
3108
- }
3109
- [N$1](s, i) {
3110
- return s.type === "File" && !this.unlink && i.isFile() && i.nlink <= 1 && !C;
3111
- }
3112
- [q](s) {
3113
- this[V$1]();
3114
- const i = [s.path];
3115
- s.linkpath && i.push(s.linkpath), this.reservations.reserve(i, (e) => this[Y](s, e));
3116
- }
3117
- [v](s) {
3118
- s.type === "SymbolicLink" ? ms(this.dirCache) : s.type !== "Directory" && ns(this.dirCache, s.absolute);
3119
- }
3120
- [Y](s, i) {
3121
- this[v](s);
3122
- const e = (h$2) => {
3123
- this[v](s), i(h$2);
3124
- }, t = () => {
3125
- this[b$1](this.cwd, this.dmode, (h$2) => {
3126
- if (h$2) {
3127
- this[m](h$2, s), e();
3128
- return;
3129
- }
3130
- this[g$1] = true, o();
3131
- });
3132
- }, o = () => {
3133
- if (s.absolute !== this.cwd) {
3134
- const h$2 = l(w.dirname(s.absolute));
3135
- if (h$2 !== this.cwd) return this[b$1](h$2, this.dmode, (c$1) => {
3136
- if (c$1) {
3137
- this[m](c$1, s), e();
3138
- return;
3139
- }
3140
- u();
3141
- });
3142
- }
3143
- u();
3144
- }, u = () => {
3145
- r.lstat(s.absolute, (h$2, c$1) => {
3146
- if (c$1 && (this.keep || this.newer && c$1.mtime > s.mtime)) {
3147
- this[x$1](s), e();
3148
- return;
3149
- }
3150
- if (h$2 || this[N$1](s, c$1)) return this[d$1](null, s, e);
3151
- if (c$1.isDirectory()) {
3152
- if (s.type === "Directory") {
3153
- const n = !this.noChmod && s.mode && (c$1.mode & 4095) !== s.mode, p = (f) => this[d$1](f, s, e);
3154
- return n ? r.chmod(s.absolute, s.mode, p) : p();
3155
- }
3156
- if (s.absolute !== this.cwd) return r.rmdir(s.absolute, (n) => this[d$1](n, s, e));
3157
- }
3158
- if (s.absolute === this.cwd) return this[d$1](null, s, e);
3159
- as(s.absolute, (n) => this[d$1](n, s, e));
3160
- });
3161
- };
3162
- this[g$1] ? o() : t();
3163
- }
3164
- [d$1](s, i, e) {
3165
- if (s) {
3166
- this[m](s, i), e();
3167
- return;
3168
- }
3169
- switch (i.type) {
3170
- case "File":
3171
- case "OldFile":
3172
- case "ContiguousFile": return this[U$1](i, e);
3173
- case "Link": return this[z$1$1](i, e);
3174
- case "SymbolicLink": return this[B$1](i, e);
3175
- case "Directory":
3176
- case "GNUDumpDir": return this[F$1](i, e);
3177
- }
3178
- }
3179
- [O](s, i, e, t) {
3180
- r[e](i, s.absolute, (o) => {
3181
- o ? this[m](o, s) : (this[S](), s.resume()), t();
3182
- });
3183
- }
3184
- }
3185
- const T = (a) => {
3186
- try {
3187
- return [null, a()];
3188
- } catch (s) {
3189
- return [s, null];
3190
- }
3191
- };
3192
- class ls extends L {
3193
- [d$1](s, i) {
3194
- return super[d$1](s, i, () => {});
3195
- }
3196
- [q](s) {
3197
- if (this[v](s), !this[g$1]) {
3198
- const o = this[b$1](this.cwd, this.dmode);
3199
- if (o) return this[m](o, s);
3200
- this[g$1] = true;
3201
- }
3202
- if (s.absolute !== this.cwd) {
3203
- const o = l(w.dirname(s.absolute));
3204
- if (o !== this.cwd) {
3205
- const u = this[b$1](o, this.dmode);
3206
- if (u) return this[m](u, s);
3207
- }
3208
- }
3209
- const [i, e] = T(() => r.lstatSync(s.absolute));
3210
- if (e && (this.keep || this.newer && e.mtime > s.mtime)) return this[x$1](s);
3211
- if (i || this[N$1](s, e)) return this[d$1](null, s);
3212
- if (e.isDirectory()) {
3213
- if (s.type === "Directory") {
3214
- const [h$2] = !this.noChmod && s.mode && (e.mode & 4095) !== s.mode ? T(() => {
3215
- r.chmodSync(s.absolute, s.mode);
3216
- }) : [];
3217
- return this[d$1](h$2, s);
3218
- }
3219
- const [o] = T(() => r.rmdirSync(s.absolute));
3220
- this[d$1](o, s);
3221
- }
3222
- const [t] = s.absolute === this.cwd ? [] : T(() => us(s.absolute));
3223
- this[d$1](t, s);
3224
- }
3225
- [U$1](s, i) {
3226
- const e = s.mode & 4095 || this.fmode, t = (h$2) => {
3227
- let c$1;
3228
- try {
3229
- r.closeSync(o);
3230
- } catch (n) {
3231
- c$1 = n;
3232
- }
3233
- (h$2 || c$1) && this[m](h$2 || c$1, s), i();
3234
- };
3235
- let o;
3236
- try {
3237
- o = r.openSync(s.absolute, J(s.size), e);
3238
- } catch (h$2) {
3239
- return t(h$2);
3240
- }
3241
- const u = this.transform && this.transform(s) || s;
3242
- u !== s && (u.on("error", (h$2) => this[m](h$2, s)), s.pipe(u)), u.on("data", (h$2) => {
3243
- try {
3244
- r.writeSync(o, h$2, 0, h$2.length);
3245
- } catch (c$1) {
3246
- t(c$1);
3247
- }
3248
- }), u.on("end", (h$2) => {
3249
- let c$1 = null;
3250
- if (s.mtime && !this.noMtime) {
3251
- const n = s.atime || /* @__PURE__ */ new Date(), p = s.mtime;
3252
- try {
3253
- r.futimesSync(o, n, p);
3254
- } catch (f) {
3255
- try {
3256
- r.utimesSync(s.absolute, n, p);
3257
- } catch {
3258
- c$1 = f;
3259
- }
3260
- }
3261
- }
3262
- if (this[E](s)) {
3263
- const n = this[R](s), p = this[_](s);
3264
- try {
3265
- r.fchownSync(o, n, p);
3266
- } catch (f) {
3267
- try {
3268
- r.chownSync(s.absolute, n, p);
3269
- } catch {
3270
- c$1 = c$1 || f;
3271
- }
3272
- }
3273
- }
3274
- t(c$1);
3275
- });
3276
- }
3277
- [F$1](s, i) {
3278
- const e = s.mode & 4095 || this.dmode, t = this[b$1](s.absolute, e);
3279
- if (t) {
3280
- this[m](t, s), i();
3281
- return;
3282
- }
3283
- if (s.mtime && !this.noMtime) try {
3284
- r.utimesSync(s.absolute, s.atime || /* @__PURE__ */ new Date(), s.mtime);
3285
- } catch {}
3286
- if (this[E](s)) try {
3287
- r.chownSync(s.absolute, this[R](s), this[_](s));
3288
- } catch {}
3289
- i(), s.resume();
3290
- }
3291
- [b$1](s, i) {
3292
- try {
3293
- return M$1.sync(l(s), {
3294
- uid: this.uid,
3295
- gid: this.gid,
3296
- processUid: this.processUid,
3297
- processGid: this.processGid,
3298
- umask: this.processUmask,
3299
- preserve: this.preservePaths,
3300
- unlink: this.unlink,
3301
- cache: this.dirCache,
3302
- cwd: this.cwd,
3303
- mode: i
3304
- });
3305
- } catch (e) {
3306
- return e;
3307
- }
3308
- }
3309
- [O](s, i, e, t) {
3310
- try {
3311
- r[e + "Sync"](i, s.absolute), t(), s.resume();
3312
- } catch (o) {
3313
- return this[m](o, s);
3314
- }
3315
- }
3316
- }
3317
- return L.Sync = ls, G = L, G;
3318
- }
3319
- var f, q;
3320
- function v() {
3321
- if (q) return f;
3322
- q = 1;
3323
- const w = s$6(), u = Os(), p = nativeFs, y = X(), l = path, m = s();
3324
- f = (r, e, o) => {
3325
- typeof r == "function" ? (o = r, e = null, r = {}) : Array.isArray(r) && (e = r, r = {}), typeof e == "function" && (o = e, e = null), e ? e = Array.from(e) : e = [];
3326
- const t = w(r);
3327
- if (t.sync && typeof o == "function") throw new TypeError("callback not supported for sync tar functions");
3328
- if (!t.file && typeof o == "function") throw new TypeError("callback only supported with file option");
3329
- return e.length && d$1(t, e), t.file && t.sync ? $(t) : t.file ? h$2(t, o) : t.sync ? x$1(t) : z(t);
3330
- };
3331
- const d$1 = (r, e) => {
3332
- const o = new Map(e.map((n) => [m(n), true])), t = r.filter, s = (n, i) => {
3333
- const a = i || l.parse(n).root || ".", c$1 = n === a ? false : o.has(n) ? o.get(n) : s(l.dirname(n), a);
3334
- return o.set(n, c$1), c$1;
3335
- };
3336
- r.filter = t ? (n, i) => t(n, i) && s(m(n)) : (n) => s(m(n));
3337
- }, $ = (r) => {
3338
- const e = new u.Sync(r), o = r.file, t = p.statSync(o), s = r.maxReadSize || 16 * 1024 * 1024;
3339
- new y.ReadStreamSync(o, {
3340
- readSize: s,
3341
- size: t.size
3342
- }).pipe(e);
3343
- }, h$2 = (r, e) => {
3344
- const o = new u(r), t = r.maxReadSize || 16 * 1024 * 1024, s = r.file, n = new Promise((i, a) => {
3345
- o.on("error", a), o.on("close", i), p.stat(s, (c$1, R) => {
3346
- if (c$1) a(c$1);
3347
- else {
3348
- const S = new y.ReadStream(s, {
3349
- readSize: t,
3350
- size: R.size
3351
- });
3352
- S.on("error", a), S.pipe(o);
3353
- }
3354
- });
3355
- });
3356
- return e ? n.then(e, e) : n;
3357
- }, x$1 = (r) => new u.Sync(r), z = (r) => new u(r);
3358
- return f;
3359
- }
3360
- const tarExtract = getDefaultExportFromCjs(v());
3361
- async function download(url, filePath, options = {}) {
3362
- const infoPath = filePath + ".json";
3363
- const info = JSON.parse(await readFile(infoPath, "utf8").catch(() => "{}"));
3364
- const etag = (await sendFetch(url, {
3365
- method: "HEAD",
3366
- headers: options.headers
3367
- }).catch(() => void 0))?.headers.get("etag");
3368
- if (info.etag === etag && existsSync(filePath)) return;
3369
- if (typeof etag === "string") info.etag = etag;
3370
- const response = await sendFetch(url, { headers: options.headers });
3371
- if (response.status >= 400) throw new Error(`Failed to download ${url}: ${response.status} ${response.statusText}`);
3372
- const stream = createWriteStream(filePath);
3373
- await promisify(pipeline)(response.body, stream);
3374
- await writeFile(infoPath, JSON.stringify(info), "utf8");
3375
- }
3376
- const inputRegex = /^(?<repo>[\w.-]+\/[\w.-]+)(?<subdir>[^#]+)?(?<ref>#[\w./@-]+)?/;
3377
- function parseGitURI(input) {
3378
- const m = input.match(inputRegex)?.groups || {};
3379
- return {
3380
- repo: m.repo,
3381
- subdir: m.subdir || "/",
3382
- ref: m.ref ? m.ref.slice(1) : "main"
3383
- };
3384
- }
3385
- function debug(...args) {
3386
- if (process.env.DEBUG) console.debug("[giget]", ...args);
3387
- }
3388
- async function sendFetch(url, options = {}) {
3389
- if (options.headers?.["sec-fetch-mode"]) options.mode = options.headers["sec-fetch-mode"];
3390
- const res = await l$1(url, {
3391
- ...options,
3392
- headers: normalizeHeaders(options.headers)
3393
- }).catch((error) => {
3394
- throw new Error(`Failed to download ${url}: ${error}`, { cause: error });
3395
- });
3396
- if (options.validateStatus && res.status >= 400) throw new Error(`Failed to fetch ${url}: ${res.status} ${res.statusText}`);
3397
- return res;
3398
- }
3399
- function cacheDirectory() {
3400
- const cacheDir = process.env.XDG_CACHE_HOME ? resolve$2(process.env.XDG_CACHE_HOME, "giget") : resolve$2(homedir(), ".cache/giget");
3401
- if (process.platform === "win32") {
3402
- const windowsCacheDir = resolve$2(tmpdir(), "giget");
3403
- if (!existsSync(windowsCacheDir) && existsSync(cacheDir)) try {
3404
- renameSync(cacheDir, windowsCacheDir);
3405
- } catch {}
3406
- return windowsCacheDir;
3407
- }
3408
- return cacheDir;
3409
- }
3410
- function normalizeHeaders(headers = {}) {
3411
- const normalized = {};
3412
- for (const [key, value] of Object.entries(headers)) {
3413
- if (!value) continue;
3414
- normalized[key.toLowerCase()] = value;
3415
- }
3416
- return normalized;
3417
- }
3418
- const http = async (input, options) => {
3419
- if (input.endsWith(".json")) return await _httpJSON(input, options);
3420
- const url = new URL(input);
3421
- let name = basename$2(url.pathname);
3422
- try {
3423
- const head = await sendFetch(url.href, {
3424
- method: "HEAD",
3425
- validateStatus: true,
3426
- headers: { authorization: options.auth ? `Bearer ${options.auth}` : void 0 }
3427
- });
3428
- if ((head.headers.get("content-type") || "").includes("application/json")) return await _httpJSON(input, options);
3429
- const filename = head.headers.get("content-disposition")?.match(/filename="?(.+)"?/)?.[1];
3430
- if (filename) name = filename.split(".")[0];
3431
- } catch (error) {
3432
- debug(`Failed to fetch HEAD for ${url.href}:`, error);
3433
- }
3434
- return {
3435
- name: `${name}-${url.href.slice(0, 8)}`,
3436
- version: "",
3437
- subdir: "",
3438
- tar: url.href,
3439
- defaultDir: name,
3440
- headers: { Authorization: options.auth ? `Bearer ${options.auth}` : void 0 }
3441
- };
3442
- };
3443
- const _httpJSON = async (input, options) => {
3444
- const info = await (await sendFetch(input, {
3445
- validateStatus: true,
3446
- headers: { authorization: options.auth ? `Bearer ${options.auth}` : void 0 }
3447
- })).json();
3448
- if (!info.tar || !info.name) throw new Error(`Invalid template info from ${input}. name or tar fields are missing!`);
3449
- return info;
3450
- };
3451
- const github = (input, options) => {
3452
- const parsed = parseGitURI(input);
3453
- const githubAPIURL = process.env.GIGET_GITHUB_URL || "https://api.github.com";
3454
- return {
3455
- name: parsed.repo.replace("/", "-"),
3456
- version: parsed.ref,
3457
- subdir: parsed.subdir,
3458
- headers: {
3459
- Authorization: options.auth ? `Bearer ${options.auth}` : void 0,
3460
- Accept: "application/vnd.github+json",
3461
- "X-GitHub-Api-Version": "2022-11-28"
3462
- },
3463
- url: `${githubAPIURL.replace("api.github.com", "github.com")}/${parsed.repo}/tree/${parsed.ref}${parsed.subdir}`,
3464
- tar: `${githubAPIURL}/repos/${parsed.repo}/tarball/${parsed.ref}`
3465
- };
3466
- };
3467
- const gitlab = (input, options) => {
3468
- const parsed = parseGitURI(input);
3469
- const gitlab2 = process.env.GIGET_GITLAB_URL || "https://gitlab.com";
3470
- return {
3471
- name: parsed.repo.replace("/", "-"),
3472
- version: parsed.ref,
3473
- subdir: parsed.subdir,
3474
- headers: {
3475
- authorization: options.auth ? `Bearer ${options.auth}` : void 0,
3476
- "sec-fetch-mode": "same-origin"
3477
- },
3478
- url: `${gitlab2}/${parsed.repo}/tree/${parsed.ref}${parsed.subdir}`,
3479
- tar: `${gitlab2}/${parsed.repo}/-/archive/${parsed.ref}.tar.gz`
3480
- };
3481
- };
3482
- const bitbucket = (input, options) => {
3483
- const parsed = parseGitURI(input);
3484
- return {
3485
- name: parsed.repo.replace("/", "-"),
3486
- version: parsed.ref,
3487
- subdir: parsed.subdir,
3488
- headers: { authorization: options.auth ? `Bearer ${options.auth}` : void 0 },
3489
- url: `https://bitbucket.com/${parsed.repo}/src/${parsed.ref}${parsed.subdir}`,
3490
- tar: `https://bitbucket.org/${parsed.repo}/get/${parsed.ref}.tar.gz`
3491
- };
3492
- };
3493
- const sourcehut = (input, options) => {
3494
- const parsed = parseGitURI(input);
3495
- return {
3496
- name: parsed.repo.replace("/", "-"),
3497
- version: parsed.ref,
3498
- subdir: parsed.subdir,
3499
- headers: { authorization: options.auth ? `Bearer ${options.auth}` : void 0 },
3500
- url: `https://git.sr.ht/~${parsed.repo}/tree/${parsed.ref}/item${parsed.subdir}`,
3501
- tar: `https://git.sr.ht/~${parsed.repo}/archive/${parsed.ref}.tar.gz`
3502
- };
3503
- };
3504
- const providers = {
3505
- http,
3506
- https: http,
3507
- github,
3508
- gh: github,
3509
- gitlab,
3510
- bitbucket,
3511
- sourcehut
3512
- };
3513
- const DEFAULT_REGISTRY = "https://raw.githubusercontent.com/unjs/giget/main/templates";
3514
- const registryProvider = (registryEndpoint = DEFAULT_REGISTRY, options = {}) => {
3515
- return async (input) => {
3516
- const start = Date.now();
3517
- const registryURL = `${registryEndpoint}/${input}.json`;
3518
- const result = await sendFetch(registryURL, { headers: { authorization: options.auth ? `Bearer ${options.auth}` : void 0 } });
3519
- if (result.status >= 400) throw new Error(`Failed to download ${input} template info from ${registryURL}: ${result.status} ${result.statusText}`);
3520
- const info = await result.json();
3521
- if (!info.tar || !info.name) throw new Error(`Invalid template info from ${registryURL}. name or tar fields are missing!`);
3522
- debug(`Fetched ${input} template info from ${registryURL} in ${Date.now() - start}ms`);
3523
- return info;
3524
- };
3525
- };
3526
- const sourceProtoRe = /^([\w-.]+):/;
3527
- async function downloadTemplate(input, options = {}) {
3528
- options = defu({
3529
- registry: process.env.GIGET_REGISTRY,
3530
- auth: process.env.GIGET_AUTH
3531
- }, options);
3532
- const registry = options.registry === false ? void 0 : registryProvider(options.registry, { auth: options.auth });
3533
- let providerName = options.provider || (registry ? "registry" : "github");
3534
- let source = input;
3535
- const sourceProviderMatch = input.match(sourceProtoRe);
3536
- if (sourceProviderMatch) {
3537
- providerName = sourceProviderMatch[1];
3538
- source = input.slice(sourceProviderMatch[0].length);
3539
- if (providerName === "http" || providerName === "https") source = input;
3540
- }
3541
- const provider = options.providers?.[providerName] || providers[providerName] || registry;
3542
- if (!provider) throw new Error(`Unsupported provider: ${providerName}`);
3543
- const template = await Promise.resolve().then(() => provider(source, { auth: options.auth })).catch((error) => {
3544
- throw new Error(`Failed to download template from ${providerName}: ${error.message}`);
3545
- });
3546
- if (!template) throw new Error(`Failed to resolve template from ${providerName}`);
3547
- template.name = (template.name || "template").replace(/[^\da-z-]/gi, "-");
3548
- template.defaultDir = (template.defaultDir || template.name).replace(/[^\da-z-]/gi, "-");
3549
- const tarPath = resolve$2(resolve$2(cacheDirectory(), providerName, template.name), (template.version || template.name) + ".tar.gz");
3550
- if (options.preferOffline && existsSync(tarPath)) options.offline = true;
3551
- if (!options.offline) {
3552
- await mkdir(dirname$2(tarPath), { recursive: true });
3553
- const s2 = Date.now();
3554
- await download(template.tar, tarPath, { headers: {
3555
- Authorization: options.auth ? `Bearer ${options.auth}` : void 0,
3556
- ...normalizeHeaders(template.headers)
3557
- } }).catch((error) => {
3558
- if (!existsSync(tarPath)) throw error;
3559
- debug("Download error. Using cached version:", error);
3560
- options.offline = true;
3561
- });
3562
- debug(`Downloaded ${template.tar} to ${tarPath} in ${Date.now() - s2}ms`);
3563
- }
3564
- if (!existsSync(tarPath)) throw new Error(`Tarball not found: ${tarPath} (offline: ${options.offline})`);
3565
- const extractPath = resolve$2(resolve$2(options.cwd || "."), options.dir || template.defaultDir);
3566
- if (options.forceClean) await rm(extractPath, {
3567
- recursive: true,
3568
- force: true
3569
- });
3570
- if (!options.force && existsSync(extractPath) && readdirSync(extractPath).length > 0) throw new Error(`Destination ${extractPath} already exists.`);
3571
- await mkdir(extractPath, { recursive: true });
3572
- const s = Date.now();
3573
- const subdir = template.subdir?.replace(/^\//, "") || "";
3574
- await tarExtract({
3575
- file: tarPath,
3576
- cwd: extractPath,
3577
- onentry(entry) {
3578
- entry.path = entry.path.split("/").splice(1).join("/");
3579
- if (subdir) if (entry.path.startsWith(subdir + "/")) entry.path = entry.path.slice(subdir.length);
3580
- else entry.path = "";
3581
- }
3582
- });
3583
- debug(`Extracted to ${extractPath} in ${Date.now() - s}ms`);
3584
- if (options.install) {
3585
- debug("Installing dependencies...");
3586
- await installDependencies({
3587
- cwd: extractPath,
3588
- silent: options.silent
3589
- });
3590
- }
3591
- return {
3592
- ...template,
3593
- source,
3594
- dir: extractPath
3595
- };
3596
- }
3597
-
3598
- //#endregion
3599
- //#region node_modules/.pnpm/giget@2.0.0/node_modules/giget/dist/index.mjs
3600
- var dist_exports = /* @__PURE__ */ __exportAll({ downloadTemplate: () => downloadTemplate });
3601
-
3602
- //#endregion
3603
- export { dist_exports$1 as n, dist_exports as t };