@visulima/vis 1.0.0-alpha.41 → 1.0.0-alpha.43

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 (193) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/LICENSE.md +265 -35
  3. package/dist/bin.js +1 -1
  4. package/dist/binx.js +2 -2
  5. package/dist/config/index.d.ts +1 -1
  6. package/dist/config/index.js +1 -1
  7. package/dist/packem_chunks/CONFIG_FILES.js +8 -0
  8. package/dist/packem_chunks/bloom-status.js +1 -1
  9. package/dist/packem_chunks/bloom-sync.js +1 -1
  10. package/dist/packem_chunks/catalog.js +113 -0
  11. package/dist/packem_chunks/cli-exec.js +1 -0
  12. package/dist/packem_chunks/cli-main.js +1068 -0
  13. package/dist/packem_chunks/detect.js +3 -3
  14. package/dist/packem_chunks/devtools.js +1 -78
  15. package/dist/packem_chunks/dispatch.js +4 -0
  16. package/dist/packem_chunks/doctor-probe.js +1 -1
  17. package/dist/packem_chunks/fix.js +1 -1
  18. package/dist/packem_chunks/handler.js +1 -1
  19. package/dist/packem_chunks/handler10.js +5 -1
  20. package/dist/packem_chunks/handler11.js +1 -5
  21. package/dist/packem_chunks/handler12.js +27 -1
  22. package/dist/packem_chunks/handler13.js +5 -27
  23. package/dist/packem_chunks/handler14.js +1 -5
  24. package/dist/packem_chunks/handler15.js +1 -1
  25. package/dist/packem_chunks/handler16.js +1 -1
  26. package/dist/packem_chunks/handler17.js +1 -1
  27. package/dist/packem_chunks/handler18.js +1 -1
  28. package/dist/packem_chunks/handler19.js +5 -1
  29. package/dist/packem_chunks/handler2.js +1 -4
  30. package/dist/packem_chunks/handler20.js +2 -5
  31. package/dist/packem_chunks/handler21.js +2 -2
  32. package/dist/packem_chunks/handler22.js +5 -2
  33. package/dist/packem_chunks/handler23.js +1 -1
  34. package/dist/packem_chunks/handler24.js +1 -1
  35. package/dist/packem_chunks/handler25.js +1 -1
  36. package/dist/packem_chunks/handler26.js +1 -1
  37. package/dist/packem_chunks/handler27.js +1 -1
  38. package/dist/packem_chunks/handler28.js +1 -1
  39. package/dist/packem_chunks/handler29.js +1 -1
  40. package/dist/packem_chunks/handler3.js +4 -4
  41. package/dist/packem_chunks/handler30.js +1 -1
  42. package/dist/packem_chunks/handler33.js +1 -1
  43. package/dist/packem_chunks/handler4.js +4 -6
  44. package/dist/packem_chunks/handler40.js +1 -1
  45. package/dist/packem_chunks/handler5.js +6 -8
  46. package/dist/packem_chunks/handler50.js +5 -5
  47. package/dist/packem_chunks/handler51.js +5 -5
  48. package/dist/packem_chunks/handler52.js +1 -1
  49. package/dist/packem_chunks/handler53.js +1 -1
  50. package/dist/packem_chunks/handler54.js +1 -1
  51. package/dist/packem_chunks/handler55.js +1 -1
  52. package/dist/packem_chunks/handler56.js +1 -1
  53. package/dist/packem_chunks/handler57.js +5 -7
  54. package/dist/packem_chunks/handler58.js +11 -5
  55. package/dist/packem_chunks/handler59.js +3 -11
  56. package/dist/packem_chunks/handler6.js +8 -1
  57. package/dist/packem_chunks/handler60.js +22 -3
  58. package/dist/packem_chunks/handler61.js +60 -21
  59. package/dist/packem_chunks/handler62.js +3 -61
  60. package/dist/packem_chunks/handler63.js +6 -3
  61. package/dist/packem_chunks/handler64.js +9 -6
  62. package/dist/packem_chunks/handler65.js +2 -708
  63. package/dist/packem_chunks/handler66.js +10 -10
  64. package/dist/packem_chunks/handler67.js +5 -5
  65. package/dist/packem_chunks/handler68.js +1 -1
  66. package/dist/packem_chunks/handler69.js +5 -5
  67. package/dist/packem_chunks/handler7.js +1 -1
  68. package/dist/packem_chunks/handler70.js +7 -7
  69. package/dist/packem_chunks/handler71.js +15 -15
  70. package/dist/packem_chunks/handler72.js +708 -48
  71. package/dist/packem_chunks/handler73.js +48 -27
  72. package/dist/packem_chunks/handler74.js +27 -3
  73. package/dist/packem_chunks/handler75.js +3 -190
  74. package/dist/packem_chunks/handler76.js +189 -37
  75. package/dist/packem_chunks/handler77.js +38 -0
  76. package/dist/packem_chunks/handler8.js +1 -1
  77. package/dist/packem_chunks/handler9.js +1 -1
  78. package/dist/packem_chunks/heal-accept.js +1 -1
  79. package/dist/packem_chunks/heal.js +1 -1
  80. package/dist/packem_chunks/help-command.js +4 -4
  81. package/dist/packem_chunks/index2.js +2 -2
  82. package/dist/packem_chunks/index3.js +135 -0
  83. package/dist/packem_chunks/index4.js +74 -0
  84. package/dist/packem_chunks/keys-refresh.js +1 -1
  85. package/dist/packem_chunks/lean.js +4 -0
  86. package/dist/packem_chunks/list.js +1 -1
  87. package/dist/packem_chunks/loader.js +1 -1
  88. package/dist/packem_chunks/loader2.js +1 -1
  89. package/dist/packem_chunks/orchestrator.js +19 -19
  90. package/dist/packem_chunks/prompts.js +1 -1
  91. package/dist/packem_chunks/prune.js +1 -1
  92. package/dist/packem_chunks/registry.js +2 -2
  93. package/dist/packem_chunks/run.js +1 -1
  94. package/dist/packem_chunks/shell-runner.js +1 -1
  95. package/dist/packem_chunks/status.js +1 -1
  96. package/dist/packem_chunks/sync.js +1 -1
  97. package/dist/packem_chunks/sync2.js +1 -1
  98. package/dist/packem_chunks/tar.js +1 -1
  99. package/dist/packem_chunks/tripwire.js +1 -1
  100. package/dist/packem_chunks/ts-loader.js +2 -0
  101. package/dist/packem_chunks/verify-lockfile.js +1 -1
  102. package/dist/packem_chunks/version-resolver.js +2 -2
  103. package/dist/packem_shared/{Table-CcVkyULl-B_ef6zfS.js → Table-CcVkyULl-DLWu6XHL.js} +25 -26
  104. package/dist/packem_shared/{advisories-DLeO5KMN.js → advisories-CefYKEPe.js} +1 -1
  105. package/dist/packem_shared/{affected-shas-cVnX8-zs.js → affected-shas-C1XuRlvo.js} +1 -1
  106. package/dist/packem_shared/{ai-analysis-BUeX2J2H.js → ai-analysis-Co-b15d_.js} +7 -7
  107. package/dist/packem_shared/{ai-fix-9Vzlp6XU.js → ai-fix-DnJDgPN-.js} +9 -9
  108. package/dist/packem_shared/augment-8fIWWGSc.js +3 -0
  109. package/dist/packem_shared/bin-DDq2oszw.js +1 -0
  110. package/dist/packem_shared/build-scripts-Doxce2VM.js +1 -0
  111. package/dist/packem_shared/command-runtime-RiCMa2C8.js +1 -0
  112. package/dist/packem_shared/compile-cache-B_Vf_WxT.js +3 -0
  113. package/dist/packem_shared/{cyclonedx-Cadls41z.js → cyclonedx-BTBzGCBW.js} +1 -1
  114. package/dist/packem_shared/dependency-scan-DEv-scN6.js +1 -0
  115. package/dist/packem_shared/{docker-BMLrNtWm.js → docker-DKlF-gk3.js} +1 -1
  116. package/dist/packem_shared/env-XJzocuUP.js +27 -0
  117. package/dist/packem_shared/failure-log-Sp1j-5qo.js +2 -0
  118. package/dist/packem_shared/{giget-DHY1sQZC.js → giget-DVTFJlbR.js} +2 -2
  119. package/dist/packem_shared/glob-fqg4KepW-7Bs2kZuM.js +1 -0
  120. package/dist/packem_shared/index-B0EsgdzO.js +1 -0
  121. package/dist/packem_shared/{index-DGSsjmpV.js → index-Cg0IHaFI.js} +1 -1
  122. package/dist/packem_shared/index-CkZnT2Fe.js +1 -0
  123. package/dist/packem_shared/index-DJAnbLEh.js +28 -0
  124. package/dist/packem_shared/index-DjTWo3sH.js +1 -0
  125. package/dist/packem_shared/{index-BDmTbWX1.js → index-OQZQyN5R.js} +1 -1
  126. package/dist/packem_shared/index.server-J83sowC4.js +2 -0
  127. package/dist/packem_shared/{lifecycle-4z9hHE5b.js → lifecycle-C4nRsXxc.js} +2 -2
  128. package/dist/packem_shared/{lockfile-C8Q1_4KK.js → lockfile-DIGyLfmF.js} +1 -1
  129. package/dist/packem_shared/main-B3juSU5z.js +1 -0
  130. package/dist/packem_shared/manifests-pLwnVmCN.js +1 -0
  131. package/dist/packem_shared/{min-release-age-D1alDE3K.js → min-release-age-B23Mr7NO.js} +3 -3
  132. package/dist/packem_shared/missing-package-json-DdMNbe_j.js +1 -0
  133. package/dist/packem_shared/{native-config-sync-BEkJW7g3.js → native-config-sync-4K9wWTj5.js} +1 -1
  134. package/dist/packem_shared/{osv-bloom-B03tUWf3.js → osv-bloom-BsQ-aFiM.js} +1 -1
  135. package/dist/packem_shared/packument-QjOLAMSk.js +1 -0
  136. package/dist/packem_shared/{pm-runner-BKZQo7Ts.js → pm-runner-CIH0wPh-.js} +1 -1
  137. package/dist/packem_shared/prompt-DjXHVgYU.js +1 -0
  138. package/dist/packem_shared/provenance-CilBg0Ee.js +1 -0
  139. package/dist/packem_shared/readJsonSync-CvkZyKmL-CY7PZob_.js +4 -0
  140. package/dist/packem_shared/registry-keys-BEavOCPz.js +1 -0
  141. package/dist/packem_shared/resolve-explicit-C4o8_-SE.js +5 -0
  142. package/dist/packem_shared/resolve-runtime-CJSWV-K8.js +1 -0
  143. package/dist/packem_shared/run-file-B4TqKa0X.js +1 -0
  144. package/dist/packem_shared/runtime-check-0lUJvgKt.js +1 -0
  145. package/dist/packem_shared/runtime-process-Dmz0vCJy-DUwTvH1J.js +1 -0
  146. package/dist/packem_shared/s1ngularity-DuG-LLaX.js +1 -0
  147. package/dist/packem_shared/scan-progress-RTMsE3Z4.js +2 -0
  148. package/dist/packem_shared/{selectors-GCJIe342.js → selectors-UmnAuc26.js} +1 -1
  149. package/dist/packem_shared/{signatures-Xpd6HjG_.js → signatures-CYheSqd3.js} +2 -2
  150. package/dist/packem_shared/spinner-DuJJvFTl.js +1 -0
  151. package/dist/packem_shared/tabs-CgxCvjCY.js +1 -0
  152. package/dist/packem_shared/target-merge-DOm6h6tW.js +11 -0
  153. package/dist/packem_shared/target-options-ChWcK60i.js +1 -0
  154. package/dist/packem_shared/toolchain-DyCKnGch.js +5 -0
  155. package/dist/packem_shared/typosquats-hCtH-23t.js +1 -0
  156. package/dist/packem_shared/use-measured-height-BKUjhm_3.js +1 -0
  157. package/dist/packem_shared/verify-CVPYlUrF.js +1 -0
  158. package/dist/packem_shared/vis-update-app-K-qATSeh.js +1 -0
  159. package/dist/packem_shared/watch-Bkp_AAbc.js +1 -0
  160. package/dist/packem_shared/watch-loop-WE7nWIEt.js +11 -0
  161. package/dist/packem_shared/window-ops-DDePlWLV.js +2 -0
  162. package/dist/runtime/preload.d.ts +1 -0
  163. package/dist/runtime/preload.js +1 -0
  164. package/index.d.ts +215 -201
  165. package/index.js +54 -53
  166. package/package.json +18 -27
  167. package/dist/packem_chunks/bin.js +0 -1198
  168. package/dist/packem_chunks/config.js +0 -21
  169. package/dist/packem_shared/CONFIG_FILES-BfaR0jKT.js +0 -1
  170. package/dist/packem_shared/build-scripts-CCCi8U66.js +0 -1
  171. package/dist/packem_shared/command-runtime-CR70qSUM.js +0 -1
  172. package/dist/packem_shared/dependency-scan-DnTgYleU.js +0 -1
  173. package/dist/packem_shared/failure-log-CEWP3bP0.js +0 -2
  174. package/dist/packem_shared/glob-fqg4KepW-B7EjLRvw.js +0 -1
  175. package/dist/packem_shared/index-3jMNqQom.js +0 -1
  176. package/dist/packem_shared/index-Bt521H5J.js +0 -30
  177. package/dist/packem_shared/manifests-Dj3pRKBT.js +0 -1
  178. package/dist/packem_shared/missing-package-json-8vNHwbqw.js +0 -1
  179. package/dist/packem_shared/provenance-BFEwKgI3.js +0 -1
  180. package/dist/packem_shared/registry-keys-BfFto6vI.js +0 -1
  181. package/dist/packem_shared/resolve-explicit-C6WM-I2u.js +0 -5
  182. package/dist/packem_shared/runtime-check-Stc9AI78.js +0 -1
  183. package/dist/packem_shared/s1ngularity-DCPmPE5M.js +0 -1
  184. package/dist/packem_shared/scan-progress-CFhc0CMj.js +0 -2
  185. package/dist/packem_shared/spinner-CV3WVJLv.js +0 -1
  186. package/dist/packem_shared/tabs-BuTy5gPV.js +0 -1
  187. package/dist/packem_shared/toolchain-pR7AJ-tB.js +0 -5
  188. package/dist/packem_shared/typosquats-DN78xx1x.js +0 -1
  189. package/dist/packem_shared/use-measured-height-_eVGWtWt.js +0 -1
  190. package/dist/packem_shared/verify-6WCmFmy8.js +0 -1
  191. package/dist/packem_shared/vis-update-app-k3fDxech.js +0 -1
  192. package/dist/packem_shared/watch-BvIwLG4N.js +0 -1
  193. package/dist/packem_shared/watch-loop-DWkvv2tK.js +0 -11
@@ -1,3 +1,3 @@
1
- import{createRequire as I}from"node:module";import C from"./index.js";import{VisReleaseError as u}from"../packem_shared/VisReleaseError-DMGRBTNO.js";const N=I(import.meta.url),h=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,k=c=>{if(typeof h<"u"&&h.versions&&h.versions.node){const[t,s]=h.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return h.getBuiltinModule(c)}return N(c)},{readFile:b,rename:A,readdir:x}=k("node:fs/promises"),{join:o,basename:L}=k("node:path");class m{constructor(t){this.runner=t}runner;async publishNative(t){throw new u({code:"CONFIG_INVALID",hint:'Set publish.publishStrategy back to "npm-publish-tarball" (the default), or use a package manager whose adapter implements native publish.',message:`publishStrategy "native" is not supported by the "${this.id}" adapter.`})}async readCatalogYaml(t){}}const f=(c,t)=>{if(c.exitCode===0)return{output:c.stdout,published:!0};const s=`${c.stdout}
2
- ${c.stderr}`;if(/EPUBLISHCONFLICT|cannot publish over the previously published versions|forbidden.*409/i.test(s))return{alreadyPublished:!0,output:s,published:!1};throw new u({code:"PUBLISH_FAILED",message:`${t} failed: ${s}`})};class g extends m{id="npm";minVersion="11.5.1";async pack(t){const s=["pack","--json"];t.destination&&s.push("--pack-destination",t.destination);const e=await this.runner.run("npm",s,{cwd:t.cwd,silent:!0});if(e.exitCode!==0)throw new u({code:"PUBLISH_FAILED",message:`npm pack failed: ${e.stderr||e.stdout}`});const a=JSON.parse(e.stdout),n=a[0]?.filename;if(!n)throw new u({code:"PUBLISH_FAILED",hint:"Upgrade npm to a version that emits --json output, or report this with the raw stdout.",message:`npm pack: could not parse output: ${e.stdout}`});const r=t.destination??t.cwd;let i=o(r,n);return t.filename&&(await(await import("node:fs/promises")).rename(i,o(r,t.filename)),i=o(r,t.filename)),{raw:a,tarball:i}}async installLockfileOnly(t){const s=await this.runner.run("npm",["install","--package-lock-only"],{cwd:t.cwd,silent:t.silent});if(s.exitCode!==0)throw new u({code:"CONFIG_INVALID",message:`npm install --package-lock-only failed: ${s.stderr||s.stdout}`})}async listWorkspacePackages(t){const s=await this.runner.run("npm",["query",".workspace","--json"],{cwd:t,silent:!0});if(s.exitCode!==0)return[];try{return JSON.parse(s.stdout).filter(e=>typeof e.name=="string").map(e=>({name:e.name,path:e.path??e.location??t,private:e.private??!1,version:e.version??"0.0.0"}))}catch{return[]}}async publish(t){const s=t.stage?["stage","publish",t.tarball]:["publish",t.tarball];t.tag&&s.push("--tag",t.tag),t.access&&s.push("--access",t.access),t.registry&&s.push("--registry",t.registry),t.otp&&s.push("--otp",t.otp),t.provenance&&s.push("--provenance"),t.stage&&s.push("--json");for(const n of t.extraArgs??[])s.push(n);const e=await this.runner.run("npm",s,{cwd:process.cwd(),silent:!0});if(e.exitCode===0){const n={output:e.stdout,published:!0};if(t.stage)try{const r=JSON.parse(e.stdout);n.stageId=r.id??r.stageId}catch{}return n}const a=`${e.stdout}
3
- ${e.stderr}`;if(/EPUBLISHCONFLICT|cannot publish over the previously published versions|forbidden.*409/i.test(a))return{alreadyPublished:!0,output:a,published:!1};throw new u({code:"PUBLISH_FAILED",message:`npm publish failed: ${a}`})}async publishNative(t){const s=["publish"];t.tag&&s.push("--tag",t.tag),t.access&&s.push("--access",t.access),t.registry&&s.push("--registry",t.registry),t.otp&&s.push("--otp",t.otp),t.provenance&&s.push("--provenance");for(const a of t.extraArgs??[])s.push(a);const e=await this.runner.run("npm",s,{cwd:t.cwd,silent:!0});return f(e,"npm publish")}async detectVersion(t){const s=await this.runner.run("npm",["--version"],{cwd:t,silent:!0});return s.exitCode===0?s.stdout.trim():void 0}}class S extends m{id="bun";minVersion="1.1.36";async pack(t){const s=["pm","pack"];t.destination&&s.push("--destination",t.destination);const e=await this.runner.run("bun",s,{cwd:t.cwd,silent:!0});if(e.exitCode!==0)throw new u({code:"PUBLISH_FAILED",message:`bun pm pack failed: ${e.stderr||e.stdout}`});const a=/(?:^|["'\s])([^\s"']*\.tgz)/m.exec(e.stdout),n=t.destination??t.cwd;let r;if(a?.[1]){const i=a[1];r=i.startsWith("/")?i:o(n,i)}else{const i=JSON.parse(await b(o(t.cwd,"package.json"),"utf8")),d=(i.name??"package").replaceAll("/","-").replace(/^@/,"");r=o(n,`${d}-${i.version??"0.0.0"}.tgz`)}if(t.filename&&L(r)!==t.filename){const i=o(n,t.filename);await A(r,i),r=i}return{raw:e.stdout,tarball:r}}async installLockfileOnly(t){const s=await this.runner.run("bun",["install","--lockfile-only"],{cwd:t.cwd,silent:t.silent});if(s.exitCode!==0)throw new u({code:"CONFIG_INVALID",message:`bun install --lockfile-only failed: ${s.stderr||s.stdout}`})}async listWorkspacePackages(t){try{const s=JSON.parse(await b(o(t,"package.json"),"utf8")),e=Array.isArray(s.workspaces)?s.workspaces:s.workspaces?.packages??[];if(e.length===0)return[];const a=new Set,n=["."],r=5,i=new Set;for(;n.length>0;){const p=n.shift();if(i.has(p)||(i.add(p),(p==="."?0:p.split("/").length)>r))continue;let w;try{w=await x(o(t,p),{withFileTypes:!0})}catch{continue}for(const l of w){if(!l.isDirectory()||l.name==="node_modules"||l.name.startsWith("."))continue;const y=p==="."?l.name:`${p}/${l.name}`;e.some(v=>C(v,y))&&a.add(y),n.push(y)}}const d=[];for(const p of a){const w=o(t,p,"package.json");try{const l=JSON.parse(await b(w,"utf8"));if(typeof l.name!="string")continue;d.push({name:l.name,path:o(t,p),private:l.private??!1,version:l.version??"0.0.0"})}catch{}}return d}catch{return[]}}async publish(t){return new g(this.runner).publish(t)}async publishNative(t){const s=["publish"];t.tag&&s.push("--tag",t.tag),t.access&&s.push("--access",t.access),t.registry&&s.push("--registry",t.registry);for(const a of t.extraArgs??[])s.push(a);const e=await this.runner.run("bun",s,{cwd:t.cwd,silent:!0});return f(e,"bun publish")}async detectVersion(t){const s=await this.runner.run("bun",["--version"],{cwd:t,silent:!0});return s.exitCode===0?s.stdout.trim():void 0}}class _ extends m{id="pnpm";minVersion="9.5.0";async pack(t){const s=["pack","--json"];t.destination&&s.push("--pack-destination",t.destination);const e=await this.runner.run("pnpm",s,{cwd:t.cwd,silent:!0});if(e.exitCode!==0)throw new u({code:"PUBLISH_FAILED",message:`pnpm pack failed: ${e.stderr||e.stdout}`});const a=JSON.parse(e.stdout),{filename:n}=a;if(!n)throw new u({code:"PUBLISH_FAILED",message:`pnpm pack: could not parse output: ${e.stdout}`});const r=t.destination??t.cwd;let i=n.startsWith("/")?n:o(r,n);return t.filename&&(await(await import("node:fs/promises")).rename(i,o(r,t.filename)),i=o(r,t.filename)),{raw:a,tarball:i}}async installLockfileOnly(t){const s=await this.runner.run("pnpm",["install","--lockfile-only"],{cwd:t.cwd,silent:t.silent});if(s.exitCode!==0)throw new u({code:"CONFIG_INVALID",message:`pnpm install --lockfile-only failed: ${s.stderr||s.stdout}`})}async listWorkspacePackages(t){const s=await this.runner.run("pnpm",["-r","ls","--depth","-1","--json"],{cwd:t,silent:!0});if(s.exitCode!==0)return[];try{return JSON.parse(s.stdout).filter(e=>typeof e.name=="string").map(e=>({name:e.name,path:e.path??t,private:e.private??!1,version:e.version??"0.0.0"}))}catch{return[]}}async publish(t){return new g(this.runner).publish(t)}async publishNative(t){const s=["publish","--no-git-checks"];t.tag&&s.push("--tag",t.tag),t.access&&s.push("--access",t.access),t.registry&&s.push("--registry",t.registry),t.otp&&s.push("--otp",t.otp),t.provenance&&s.push("--provenance");for(const a of t.extraArgs??[])s.push(a);const e=await this.runner.run("pnpm",s,{cwd:t.cwd,silent:!0});return f(e,"pnpm publish")}async detectVersion(t){const s=await this.runner.run("pnpm",["--version"],{cwd:t,silent:!0});return s.exitCode===0?s.stdout.trim():void 0}async readCatalogYaml(t){const s=await import("node:fs/promises");try{return await s.readFile(o(t,"pnpm-workspace.yaml"),"utf8")}catch{return}}}class O extends m{id="yarn";minVersion="4.0.0";async pack(t){const s=t.destination??t.cwd,e=t.filename??"%s-%v.tgz",a=["pack","--out",o(s,e)],n=await this.runner.run("yarn",a,{cwd:t.cwd,silent:!0});if(n.exitCode!==0)throw new u({code:"PUBLISH_FAILED",message:`yarn pack failed: ${n.stderr||n.stdout}`});const r=await import("node:fs/promises"),i=await import("node:path"),d=JSON.parse(await r.readFile(i.join(t.cwd,"package.json"),"utf8")),p=e.replaceAll("%s",(d.name??"package").replaceAll("/","-").replace(/^@/,"")).replaceAll("%v",d.version??"0.0.0");return{raw:n.stdout,tarball:o(s,p)}}async installLockfileOnly(t){const s=await this.runner.run("yarn",["install","--mode","update-lockfile"],{cwd:t.cwd,silent:t.silent});if(s.exitCode!==0)throw new u({code:"CONFIG_INVALID",message:`yarn install --mode update-lockfile failed: ${s.stderr||s.stdout}`})}async listWorkspacePackages(t){const s=await this.runner.run("yarn",["workspaces","list","--json"],{cwd:t,silent:!0});if(s.exitCode!==0)return[];const e=[];for(const a of s.stdout.split(/\r?\n/)){const n=a.trim();if(n)try{const r=JSON.parse(n);if(typeof r.name!="string"||r.name==="")continue;e.push({name:r.name,path:r.location?o(t,r.location):t,private:!1,version:"0.0.0"})}catch{}}return e}async publish(t){return new g(this.runner).publish(t)}async publishNative(t){const s=["npm","publish"];t.tag&&s.push("--tag",t.tag),t.access&&s.push("--access",t.access),t.provenance&&s.push("--provenance");for(const a of t.extraArgs??[])s.push(a);const e=await this.runner.run("yarn",s,{cwd:t.cwd,silent:!0});return f(e,"yarn npm publish")}async detectVersion(t){const s=await this.runner.run("yarn",["--version"],{cwd:t,silent:!0});return s.exitCode===0?s.stdout.trim():void 0}}const F=async(c,t)=>{const s=await import("node:fs/promises"),e=await import("node:path");try{const n=JSON.parse(await s.readFile(e.join(c,"package.json"),"utf8"));if(typeof n.packageManager=="string"){const r=n.packageManager.indexOf("@"),i=r>0?n.packageManager.slice(0,r):n.packageManager;if(i==="pnpm"||i==="yarn"||i==="bun"||i==="npm")return i}}catch{}const a=async n=>{try{return await s.access(e.join(c,n)),!0}catch{return!1}};return await a("bun.lock")||await a("bun.lockb")?"bun":await a("pnpm-lock.yaml")?"pnpm":await a("yarn.lock")?"yarn":"npm"},D=(c,t)=>{switch(c){case"bun":return new S(t);case"pnpm":return new _(t);case"yarn":return new O(t);default:return new g(t)}};export{g as N,D as c,F as d};
1
+ import{createRequire as N}from"node:module";import S from"./index.js";import{VisReleaseError as u}from"../packem_shared/VisReleaseError-DMGRBTNO.js";const A=N(import.meta.url),h=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,v=c=>{if(typeof h<"u"&&h.versions&&h.versions.node){const[t,s]=h.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return h.getBuiltinModule(c)}return A(c)},{readFile:b,rename:x,readdir:L}=v("node:fs/promises"),{isAbsolute:k,join:o,basename:C}=v("node:path");class m{constructor(t){this.runner=t}runner;async publishNative(t){throw new u({code:"CONFIG_INVALID",hint:'Set publish.publishStrategy back to "npm-publish-tarball" (the default), or use a package manager whose adapter implements native publish.',message:`publishStrategy "native" is not supported by the "${this.id}" adapter.`})}async readCatalogYaml(t){}}const f=(c,t)=>{if(c.exitCode===0)return{output:c.stdout,published:!0};const s=`${c.stdout}
2
+ ${c.stderr}`;if(/EPUBLISHCONFLICT|cannot publish over the previously published versions|forbidden.*409/i.test(s))return{alreadyPublished:!0,output:s,published:!1};throw new u({code:"PUBLISH_FAILED",message:`${t} failed: ${s}`})};class g extends m{id="npm";minVersion="11.5.1";async pack(t){const s=["pack","--json"];t.destination&&s.push("--pack-destination",t.destination);const e=await this.runner.run("npm",s,{cwd:t.cwd,silent:!0});if(e.exitCode!==0)throw new u({code:"PUBLISH_FAILED",message:`npm pack failed: ${e.stderr||e.stdout}`});const a=JSON.parse(e.stdout),n=a[0]?.filename;if(!n)throw new u({code:"PUBLISH_FAILED",hint:"Upgrade npm to a version that emits --json output, or report this with the raw stdout.",message:`npm pack: could not parse output: ${e.stdout}`});const r=t.destination??t.cwd;let i=k(n)?n:o(r,n);return t.filename&&(await(await import("node:fs/promises")).rename(i,o(r,t.filename)),i=o(r,t.filename)),{raw:a,tarball:i}}async installLockfileOnly(t){const s=await this.runner.run("npm",["install","--package-lock-only"],{cwd:t.cwd,silent:t.silent});if(s.exitCode!==0)throw new u({code:"CONFIG_INVALID",message:`npm install --package-lock-only failed: ${s.stderr||s.stdout}`})}async listWorkspacePackages(t){const s=await this.runner.run("npm",["query",".workspace","--json"],{cwd:t,silent:!0});if(s.exitCode!==0)return[];try{return JSON.parse(s.stdout).filter(e=>typeof e.name=="string").map(e=>({name:e.name,path:e.path??e.location??t,private:e.private??!1,version:e.version??"0.0.0"}))}catch{return[]}}async publish(t){const s=t.stage?["stage","publish",t.tarball]:["publish",t.tarball];t.tag&&s.push("--tag",t.tag),t.access&&s.push("--access",t.access),t.registry&&s.push("--registry",t.registry),t.otp&&s.push("--otp",t.otp),t.provenance&&s.push("--provenance"),t.stage&&s.push("--json");for(const n of t.extraArgs??[])s.push(n);const e=await this.runner.run("npm",s,{cwd:process.cwd(),silent:!0});if(e.exitCode===0){const n={output:e.stdout,published:!0};if(t.stage)try{const r=JSON.parse(e.stdout);n.stageId=r.id??r.stageId}catch{}return n}const a=`${e.stdout}
3
+ ${e.stderr}`;if(/EPUBLISHCONFLICT|cannot publish over the previously published versions|forbidden.*409/i.test(a))return{alreadyPublished:!0,output:a,published:!1};throw new u({code:"PUBLISH_FAILED",message:`npm publish failed: ${a}`})}async publishNative(t){const s=["publish"];t.tag&&s.push("--tag",t.tag),t.access&&s.push("--access",t.access),t.registry&&s.push("--registry",t.registry),t.otp&&s.push("--otp",t.otp),t.provenance&&s.push("--provenance");for(const a of t.extraArgs??[])s.push(a);const e=await this.runner.run("npm",s,{cwd:t.cwd,silent:!0});return f(e,"npm publish")}async detectVersion(t){const s=await this.runner.run("npm",["--version"],{cwd:t,silent:!0});return s.exitCode===0?s.stdout.trim():void 0}}class _ extends m{id="bun";minVersion="1.1.36";async pack(t){const s=["pm","pack"];t.destination&&s.push("--destination",t.destination);const e=await this.runner.run("bun",s,{cwd:t.cwd,silent:!0});if(e.exitCode!==0)throw new u({code:"PUBLISH_FAILED",message:`bun pm pack failed: ${e.stderr||e.stdout}`});const a=/(?:^|["'\s])([^\s"']*\.tgz)/m.exec(e.stdout),n=t.destination??t.cwd;let r;if(a?.[1]){const i=a[1];r=k(i)?i:o(n,i)}else{const i=JSON.parse(await b(o(t.cwd,"package.json"),"utf8")),d=(i.name??"package").replaceAll("/","-").replace(/^@/,"");r=o(n,`${d}-${i.version??"0.0.0"}.tgz`)}if(t.filename&&C(r)!==t.filename){const i=o(n,t.filename);await x(r,i),r=i}return{raw:e.stdout,tarball:r}}async installLockfileOnly(t){const s=await this.runner.run("bun",["install","--lockfile-only"],{cwd:t.cwd,silent:t.silent});if(s.exitCode!==0)throw new u({code:"CONFIG_INVALID",message:`bun install --lockfile-only failed: ${s.stderr||s.stdout}`})}async listWorkspacePackages(t){try{const s=JSON.parse(await b(o(t,"package.json"),"utf8")),e=Array.isArray(s.workspaces)?s.workspaces:s.workspaces?.packages??[];if(e.length===0)return[];const a=new Set,n=["."],r=5,i=new Set;for(;n.length>0;){const p=n.shift();if(i.has(p)||(i.add(p),(p==="."?0:p.split("/").length)>r))continue;let w;try{w=await L(o(t,p),{withFileTypes:!0})}catch{continue}for(const l of w){if(!l.isDirectory()||l.name==="node_modules"||l.name.startsWith("."))continue;const y=p==="."?l.name:`${p}/${l.name}`;e.some(I=>S(I,y))&&a.add(y),n.push(y)}}const d=[];for(const p of a){const w=o(t,p,"package.json");try{const l=JSON.parse(await b(w,"utf8"));if(typeof l.name!="string")continue;d.push({name:l.name,path:o(t,p),private:l.private??!1,version:l.version??"0.0.0"})}catch{}}return d}catch{return[]}}async publish(t){return new g(this.runner).publish(t)}async publishNative(t){const s=["publish"];t.tag&&s.push("--tag",t.tag),t.access&&s.push("--access",t.access),t.registry&&s.push("--registry",t.registry);for(const a of t.extraArgs??[])s.push(a);const e=await this.runner.run("bun",s,{cwd:t.cwd,silent:!0});return f(e,"bun publish")}async detectVersion(t){const s=await this.runner.run("bun",["--version"],{cwd:t,silent:!0});return s.exitCode===0?s.stdout.trim():void 0}}class O extends m{id="pnpm";minVersion="9.5.0";async pack(t){const s=["pack","--json"];t.destination&&s.push("--pack-destination",t.destination);const e=await this.runner.run("pnpm",s,{cwd:t.cwd,silent:!0});if(e.exitCode!==0)throw new u({code:"PUBLISH_FAILED",message:`pnpm pack failed: ${e.stderr||e.stdout}`});const a=JSON.parse(e.stdout),{filename:n}=a;if(!n)throw new u({code:"PUBLISH_FAILED",message:`pnpm pack: could not parse output: ${e.stdout}`});const r=t.destination??t.cwd;let i=k(n)?n:o(r,n);return t.filename&&(await(await import("node:fs/promises")).rename(i,o(r,t.filename)),i=o(r,t.filename)),{raw:a,tarball:i}}async installLockfileOnly(t){const s=await this.runner.run("pnpm",["install","--lockfile-only"],{cwd:t.cwd,silent:t.silent});if(s.exitCode!==0)throw new u({code:"CONFIG_INVALID",message:`pnpm install --lockfile-only failed: ${s.stderr||s.stdout}`})}async listWorkspacePackages(t){const s=await this.runner.run("pnpm",["-r","ls","--depth","-1","--json"],{cwd:t,silent:!0});if(s.exitCode!==0)return[];try{return JSON.parse(s.stdout).filter(e=>typeof e.name=="string").map(e=>({name:e.name,path:e.path??t,private:e.private??!1,version:e.version??"0.0.0"}))}catch{return[]}}async publish(t){return new g(this.runner).publish(t)}async publishNative(t){const s=["publish","--no-git-checks"];t.tag&&s.push("--tag",t.tag),t.access&&s.push("--access",t.access),t.registry&&s.push("--registry",t.registry),t.otp&&s.push("--otp",t.otp),t.provenance&&s.push("--provenance");for(const a of t.extraArgs??[])s.push(a);const e=await this.runner.run("pnpm",s,{cwd:t.cwd,silent:!0});return f(e,"pnpm publish")}async detectVersion(t){const s=await this.runner.run("pnpm",["--version"],{cwd:t,silent:!0});return s.exitCode===0?s.stdout.trim():void 0}async readCatalogYaml(t){const s=await import("node:fs/promises");try{return await s.readFile(o(t,"pnpm-workspace.yaml"),"utf8")}catch{return}}}class $ extends m{id="yarn";minVersion="4.0.0";async pack(t){const s=t.destination??t.cwd,e=t.filename??"%s-%v.tgz",a=["pack","--out",o(s,e)],n=await this.runner.run("yarn",a,{cwd:t.cwd,silent:!0});if(n.exitCode!==0)throw new u({code:"PUBLISH_FAILED",message:`yarn pack failed: ${n.stderr||n.stdout}`});const r=await import("node:fs/promises"),i=await import("node:path"),d=JSON.parse(await r.readFile(i.join(t.cwd,"package.json"),"utf8")),p=e.replaceAll("%s",(d.name??"package").replaceAll("/","-").replace(/^@/,"")).replaceAll("%v",d.version??"0.0.0");return{raw:n.stdout,tarball:o(s,p)}}async installLockfileOnly(t){const s=await this.runner.run("yarn",["install","--mode","update-lockfile"],{cwd:t.cwd,silent:t.silent});if(s.exitCode!==0)throw new u({code:"CONFIG_INVALID",message:`yarn install --mode update-lockfile failed: ${s.stderr||s.stdout}`})}async listWorkspacePackages(t){const s=await this.runner.run("yarn",["workspaces","list","--json"],{cwd:t,silent:!0});if(s.exitCode!==0)return[];const e=[];for(const a of s.stdout.split(/\r?\n/)){const n=a.trim();if(n)try{const r=JSON.parse(n);if(typeof r.name!="string"||r.name==="")continue;e.push({name:r.name,path:r.location?o(t,r.location):t,private:!1,version:"0.0.0"})}catch{}}return e}async publish(t){return new g(this.runner).publish(t)}async publishNative(t){const s=["npm","publish"];t.tag&&s.push("--tag",t.tag),t.access&&s.push("--access",t.access),t.provenance&&s.push("--provenance");for(const a of t.extraArgs??[])s.push(a);const e=await this.runner.run("yarn",s,{cwd:t.cwd,silent:!0});return f(e,"yarn npm publish")}async detectVersion(t){const s=await this.runner.run("yarn",["--version"],{cwd:t,silent:!0});return s.exitCode===0?s.stdout.trim():void 0}}const D=async(c,t)=>{const s=await import("node:fs/promises"),e=await import("node:path");try{const n=JSON.parse(await s.readFile(e.join(c,"package.json"),"utf8"));if(typeof n.packageManager=="string"){const r=n.packageManager.indexOf("@"),i=r>0?n.packageManager.slice(0,r):n.packageManager;if(i==="pnpm"||i==="yarn"||i==="bun"||i==="npm")return i}}catch{}const a=async n=>{try{return await s.access(e.join(c,n)),!0}catch{return!1}};return await a("bun.lock")||await a("bun.lockb")?"bun":await a("pnpm-lock.yaml")?"pnpm":await a("yarn.lock")?"yarn":"npm"},V=(c,t)=>{switch(c){case"bun":return new _(t);case"pnpm":return new O(t);case"yarn":return new $(t);default:return new g(t)}};export{g as N,V as c,D as d};