@visulima/vis 4.2.0 → 4.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (215) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/LICENSE.md +55 -129
  3. package/dist/bin.js +1 -1
  4. package/dist/binx.js +1 -1
  5. package/dist/config/index.d.ts +96 -0
  6. package/dist/packem_chunks/CONFIG_FILES.js +3 -3
  7. package/dist/packem_chunks/bloom-status.js +1 -1
  8. package/dist/packem_chunks/bloom-sync.js +1 -1
  9. package/dist/packem_chunks/cargo-plan.js +3 -0
  10. package/dist/packem_chunks/catalog.js +51 -48
  11. package/dist/packem_chunks/cli-exec.js +1 -1
  12. package/dist/packem_chunks/cli-main.js +164 -164
  13. package/dist/packem_chunks/composer-projects.js +2 -0
  14. package/dist/packem_chunks/dart-plan.js +1 -0
  15. package/dist/packem_chunks/dart-projects.js +1 -0
  16. package/dist/packem_chunks/dispatch.js +1 -1
  17. package/dist/packem_chunks/fix.js +8 -8
  18. package/dist/packem_chunks/gem-plan.js +2 -0
  19. package/dist/packem_chunks/gem-projects.js +1 -0
  20. package/dist/packem_chunks/git.js +5 -5
  21. package/dist/packem_chunks/go-plan.js +1 -0
  22. package/dist/packem_chunks/go-projects.js +2 -0
  23. package/dist/packem_chunks/gradle-plan.js +1 -0
  24. package/dist/packem_chunks/handler.js +1 -1
  25. package/dist/packem_chunks/handler10.js +3 -3
  26. package/dist/packem_chunks/handler11.js +1 -1
  27. package/dist/packem_chunks/handler12.js +2 -2
  28. package/dist/packem_chunks/handler13.js +1 -1
  29. package/dist/packem_chunks/handler14.js +1 -1
  30. package/dist/packem_chunks/handler15.js +1 -1
  31. package/dist/packem_chunks/handler16.js +1 -1
  32. package/dist/packem_chunks/handler17.js +1 -1
  33. package/dist/packem_chunks/handler18.js +1 -1
  34. package/dist/packem_chunks/handler19.js +1 -1
  35. package/dist/packem_chunks/handler2.js +1 -1
  36. package/dist/packem_chunks/handler20.js +2 -2
  37. package/dist/packem_chunks/handler21.js +1 -1
  38. package/dist/packem_chunks/handler22.js +1 -1
  39. package/dist/packem_chunks/handler23.js +1 -1
  40. package/dist/packem_chunks/handler24.js +1 -1
  41. package/dist/packem_chunks/handler26.js +1 -1
  42. package/dist/packem_chunks/handler27.js +1 -1
  43. package/dist/packem_chunks/handler28.js +1 -1
  44. package/dist/packem_chunks/handler29.js +1 -1
  45. package/dist/packem_chunks/handler3.js +1 -1
  46. package/dist/packem_chunks/handler30.js +1 -1
  47. package/dist/packem_chunks/handler39.js +6 -6
  48. package/dist/packem_chunks/handler4.js +3 -3
  49. package/dist/packem_chunks/handler5.js +2 -2
  50. package/dist/packem_chunks/handler50.js +1 -1
  51. package/dist/packem_chunks/handler51.js +1 -1
  52. package/dist/packem_chunks/handler53.js +1 -1
  53. package/dist/packem_chunks/handler54.js +2 -2
  54. package/dist/packem_chunks/handler55.js +1 -1
  55. package/dist/packem_chunks/handler58.js +2 -2
  56. package/dist/packem_chunks/handler59.js +1 -1
  57. package/dist/packem_chunks/handler6.js +7 -7
  58. package/dist/packem_chunks/handler60.js +8 -8
  59. package/dist/packem_chunks/handler61.js +1 -1
  60. package/dist/packem_chunks/handler62.js +16 -16
  61. package/dist/packem_chunks/handler63.js +2 -2
  62. package/dist/packem_chunks/handler64.js +1 -1
  63. package/dist/packem_chunks/handler65.js +3 -3
  64. package/dist/packem_chunks/handler66.js +2 -2
  65. package/dist/packem_chunks/handler67.js +3 -3
  66. package/dist/packem_chunks/handler68.js +4 -4
  67. package/dist/packem_chunks/handler69.js +3 -3
  68. package/dist/packem_chunks/handler7.js +1 -1
  69. package/dist/packem_chunks/handler70.js +5 -5
  70. package/dist/packem_chunks/handler71.js +5 -5
  71. package/dist/packem_chunks/handler72.js +2 -2
  72. package/dist/packem_chunks/handler73.js +87 -86
  73. package/dist/packem_chunks/handler74.js +1 -1
  74. package/dist/packem_chunks/handler75.js +23 -23
  75. package/dist/packem_chunks/handler76.js +6 -6
  76. package/dist/packem_chunks/handler77.js +2 -2
  77. package/dist/packem_chunks/handler78.js +19 -19
  78. package/dist/packem_chunks/handler8.js +1 -1
  79. package/dist/packem_chunks/handler9.js +1 -1
  80. package/dist/packem_chunks/heal-accept.js +1 -1
  81. package/dist/packem_chunks/heal.js +1 -1
  82. package/dist/packem_chunks/help-command.js +7 -7
  83. package/dist/packem_chunks/hex-plan.js +3 -0
  84. package/dist/packem_chunks/hex-projects.js +1 -0
  85. package/dist/packem_chunks/index2.js +52 -42
  86. package/dist/packem_chunks/index4.js +58 -802
  87. package/dist/packem_chunks/index5.js +802 -7
  88. package/dist/packem_chunks/index6.js +7 -58
  89. package/dist/packem_chunks/keys-refresh.js +1 -1
  90. package/dist/packem_chunks/lean.js +1 -1
  91. package/dist/packem_chunks/list.js +2 -2
  92. package/dist/packem_chunks/loader.js +1 -1
  93. package/dist/packem_chunks/maven-plan.js +1 -0
  94. package/dist/packem_chunks/maven-projects.js +1 -0
  95. package/dist/packem_chunks/nuget-plan.js +1 -0
  96. package/dist/packem_chunks/nuget-projects.js +1 -0
  97. package/dist/packem_chunks/orchestrator.js +33 -33
  98. package/dist/packem_chunks/prune.js +1 -1
  99. package/dist/packem_chunks/python-plan.js +3 -0
  100. package/dist/packem_chunks/python-projects.js +1 -0
  101. package/dist/packem_chunks/run.js +1 -1
  102. package/dist/packem_chunks/security.js +1 -1
  103. package/dist/packem_chunks/snapshot.js +2 -2
  104. package/dist/packem_chunks/status.js +1 -1
  105. package/dist/packem_chunks/swift-projects.js +1 -0
  106. package/dist/packem_chunks/sync.js +3 -2
  107. package/dist/packem_chunks/sync2.js +1 -1
  108. package/dist/packem_chunks/tripwire.js +2 -2
  109. package/dist/packem_chunks/ts-loader.js +5 -5
  110. package/dist/packem_chunks/verify-lockfile.js +2 -2
  111. package/dist/packem_chunks/version-resolver.js +3 -3
  112. package/dist/packem_chunks/zig-plan.js +1 -0
  113. package/dist/packem_chunks/zig-projects.js +1 -0
  114. package/dist/packem_shared/{affected-selection-M7riOi5-.js → affected-selection-D4giBK2X.js} +1 -1
  115. package/dist/packem_shared/{affected-shas-CAwpSPmP.js → affected-shas-B2V84O0g.js} +1 -1
  116. package/dist/packem_shared/{ai-analysis-DSQQDFU9.js → ai-analysis-pldoS_N4.js} +2 -2
  117. package/dist/packem_shared/{ai-fix-BTm1Z5og.js → ai-fix-BC6aIRJT.js} +4 -4
  118. package/dist/packem_shared/{augment-CBv1hwMR.js → augment-B9kSZuvW.js} +1 -1
  119. package/dist/packem_shared/{bin-Cbs_ix6l.js → bin-C1XKj-O-.js} +1 -1
  120. package/dist/packem_shared/build-scripts-CEDx_nJp.js +1 -0
  121. package/dist/packem_shared/{command-runtime-BD-4UmPB.js → command-runtime-p4IXiIf6.js} +1 -1
  122. package/dist/packem_shared/composer-DR3D-Psb.js +1 -0
  123. package/dist/packem_shared/dart-pubspec-BK_cK2EP.js +2 -0
  124. package/dist/packem_shared/dependency-scan-B8jroa1D.js +1 -0
  125. package/dist/packem_shared/{docker-1jgKW5Wd.js → docker-DXqV-07f.js} +3 -3
  126. package/dist/packem_shared/ecosystem-gate-ddru_hOg.js +6 -0
  127. package/dist/packem_shared/failure-log-D2x5BT8S.js +2 -0
  128. package/dist/packem_shared/formatBytes-BHAzNIrn-CrusHOew.js +4 -0
  129. package/dist/packem_shared/gemspec-K7N05xxc.js +3 -0
  130. package/dist/packem_shared/go-modules-BsVqtyeC.js +1 -0
  131. package/dist/packem_shared/gradle-build-CHZDHyjI.js +8 -0
  132. package/dist/packem_shared/index-BzhrR_iC.js +22 -0
  133. package/dist/packem_shared/index-Chje3u9v.js +1 -0
  134. package/dist/packem_shared/{index-Cq-J2MdB.js → index-DQ2GJzmy.js} +1 -1
  135. package/dist/packem_shared/{isAccessibleSync-DYKTrrvc-K2xhg6sV.js → isAccessibleSync-DYKTrrvc-C-_5cgwu.js} +1 -1
  136. package/dist/packem_shared/lifecycle-D6PMPor-.js +2 -0
  137. package/dist/packem_shared/lockfile-CiUtEbnt.js +1 -0
  138. package/dist/packem_shared/manifests-Du4yKlf_.js +1 -0
  139. package/dist/packem_shared/maven-pom-B0KG9kJQ.js +1 -0
  140. package/dist/packem_shared/{min-release-age-Da4V046o.js → min-release-age-JViyQuBM.js} +7 -7
  141. package/dist/packem_shared/missing-package-json-Cu5YVAot.js +1 -0
  142. package/dist/packem_shared/mix-project-RYvdZp3_.js +2 -0
  143. package/dist/packem_shared/multi-eco-lockfiles-B2X3yhyo.js +1 -0
  144. package/dist/packem_shared/{native-config-sync-CEB0rWlk.js → native-config-sync-TdTWjVgI.js} +1 -1
  145. package/dist/packem_shared/nuget-project-RApYSW_y.js +4 -0
  146. package/dist/packem_shared/{osv-bloom-BRacgzs7.js → osv-bloom-BCAX5ARR.js} +1 -1
  147. package/dist/packem_shared/package-version-Dxirp-UO.js +4 -0
  148. package/dist/packem_shared/packument-BQv4je9m.js +1 -0
  149. package/dist/packem_shared/pm-runner-CMSml1Bj.js +1 -0
  150. package/dist/packem_shared/{project-name-filter-zrdrEQbu.js → project-name-filter-D6tXD8gd.js} +1 -1
  151. package/dist/packem_shared/{provenance-CFPT_FQA.js → provenance-DNyVMxNv.js} +1 -1
  152. package/dist/packem_shared/readJsonSync-CbryXYxN-EWl7_7KX.js +1 -0
  153. package/dist/packem_shared/registry-keys-DwB3ZXS_.js +1 -0
  154. package/dist/packem_shared/{resolve-explicit-opfIkxoY.js → resolve-explicit-BPsdmuty.js} +1 -1
  155. package/dist/packem_shared/resolve-runtime-CNiHcVtx.js +1 -0
  156. package/dist/packem_shared/run-file-UBukWaha.js +1 -0
  157. package/dist/packem_shared/runtime-check-1U8HrQd9.js +1 -0
  158. package/dist/packem_shared/s1ngularity-QD2LD1sO.js +1 -0
  159. package/dist/packem_shared/{scan-progress-BGB9hIrD.js → scan-progress-CkumcBG-.js} +2 -2
  160. package/dist/packem_shared/{selectors-CjIZ3gy2.js → selectors-edwcgNl3.js} +1 -1
  161. package/dist/packem_shared/{signatures-DpqZVmmU.js → signatures-t8LbOaqr.js} +1 -1
  162. package/dist/packem_shared/spinner-ukDEdGvp.js +1 -0
  163. package/dist/packem_shared/swift-package-B6X5kzQE.js +1 -0
  164. package/dist/packem_shared/tabs--uxJGL8N.js +1 -0
  165. package/dist/packem_shared/{target-merge-hsawesT4.js → target-merge-DVJl-7Qz.js} +1 -1
  166. package/dist/packem_shared/target-options-DsHFmRZH.js +1 -0
  167. package/dist/packem_shared/toolchain-BRdpaAC4.js +5 -0
  168. package/dist/packem_shared/typosquats-8u0drCqQ.js +1 -0
  169. package/dist/packem_shared/use-measured-height-DUZyyias.js +1 -0
  170. package/dist/packem_shared/verify-B_MblU_Q.js +1 -0
  171. package/dist/packem_shared/{vis-update-app-D9KWJ9Ir.js → vis-update-app-BCIccZfA.js} +1 -1
  172. package/dist/packem_shared/{vis-user-error-Bdg9NRuJ.js → vis-user-error-75VtCwMv.js} +15 -15
  173. package/dist/packem_shared/watch-CcTketln.js +1 -0
  174. package/dist/packem_shared/watch-loop-qRn0IHPG.js +11 -0
  175. package/dist/packem_shared/{writeFileSync-DJoHk3Ks-O9zOKqeM.js → writeFileSync-DJoHk3Ks-BPRoepNw.js} +1 -1
  176. package/dist/packem_shared/zig-manifest-P7ydLEOa.js +7 -0
  177. package/dist/release/plugin-sdk.d.ts +1 -1
  178. package/dist/release/types.d.ts +133 -7
  179. package/dist/runtime/preload.js +1 -1
  180. package/index.d.ts +204 -204
  181. package/index.js +52 -52
  182. package/package.json +11 -11
  183. package/schemas/vis-config.schema.json +265 -5
  184. package/schemas/vis-release-config.schema.json +132 -5
  185. package/dist/packem_shared/advisories-BSpzRIXP.js +0 -1
  186. package/dist/packem_shared/build-scripts-BIgkWVgY.js +0 -1
  187. package/dist/packem_shared/cyclonedx-CT1rtKxV.js +0 -4
  188. package/dist/packem_shared/dependency-scan-W9b2X0a1.js +0 -1
  189. package/dist/packem_shared/failure-log-B91LvYWw.js +0 -2
  190. package/dist/packem_shared/formatBytes-BHAzNIrn-CLYsxlUj.js +0 -4
  191. package/dist/packem_shared/index-CVBR-Kit.js +0 -22
  192. package/dist/packem_shared/index-onibYJkv.js +0 -1
  193. package/dist/packem_shared/lifecycle-DDJzp-4H.js +0 -2
  194. package/dist/packem_shared/lockfile-Bi1mw9jJ.js +0 -1
  195. package/dist/packem_shared/manifests-D671Sb1T.js +0 -1
  196. package/dist/packem_shared/missing-package-json-CMoHdvmj.js +0 -1
  197. package/dist/packem_shared/package-version-C5EPMgRw.js +0 -4
  198. package/dist/packem_shared/packument-DuEV-qSE.js +0 -1
  199. package/dist/packem_shared/path-CxEa27Rz-pjheKk6v.js +0 -1
  200. package/dist/packem_shared/pm-runner-9L6ocnu2.js +0 -1
  201. package/dist/packem_shared/readJsonSync-CbryXYxN-BxKjDZnF.js +0 -1
  202. package/dist/packem_shared/registry-keys-C3EsP_s4.js +0 -1
  203. package/dist/packem_shared/resolve-runtime-lJ5L9gU4.js +0 -1
  204. package/dist/packem_shared/run-file-DZff6GqY.js +0 -1
  205. package/dist/packem_shared/runtime-check-DAbveBr_.js +0 -1
  206. package/dist/packem_shared/s1ngularity-DTvrfWIM.js +0 -1
  207. package/dist/packem_shared/spinner-BVCEMm3G.js +0 -1
  208. package/dist/packem_shared/tabs-Dz6xVpfX.js +0 -1
  209. package/dist/packem_shared/target-options-Bxb0Y5qa.js +0 -1
  210. package/dist/packem_shared/toolchain-887JoquG.js +0 -5
  211. package/dist/packem_shared/typosquats-Xv6dN4sr.js +0 -1
  212. package/dist/packem_shared/use-measured-height-BPQg2q_p.js +0 -1
  213. package/dist/packem_shared/verify-BLoaI7En.js +0 -1
  214. package/dist/packem_shared/watch-BTZw2Y8Q.js +0 -1
  215. package/dist/packem_shared/watch-loop-Cjh2wlUl.js +0 -11
@@ -1,58 +1,7 @@
1
- /*!
2
- * Copyright (c) Squirrel Chat et al., All rights reserved.
3
- * SPDX-License-Identifier: BSD-3-Clause
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions are met:
7
- *
8
- * 1. Redistributions of source code must retain the above copyright notice, this
9
- * list of conditions and the following disclaimer.
10
- * 2. Redistributions in binary form must reproduce the above copyright notice,
11
- * this list of conditions and the following disclaimer in the
12
- * documentation and/or other materials provided with the distribution.
13
- * 3. Neither the name of the copyright holder nor the names of its contributors
14
- * may be used to endorse or promote products derived from this software without
15
- * specific prior written permission.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
21
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
- */function B(e,l){let i=e.slice(0,l).split(/\r?\n/);return[i.length,i.pop().length+1]}function L(e,l,i){let n=e.split(/\r?\n/),a="",s=(Math.log10(l+1)|0)+1;for(let r=l-1;r<=l+1;r++){let f=n[r-1];f&&(a+=r.toString().padEnd(s," "),a+=": ",a+=f,a+=`
28
- `,r===l&&(a+=" ".repeat(s+i+2),a+=`^
29
- `))}return a}class u extends Error{line;column;codeblock;constructor(l,i){const[n,a]=B(i.toml,i.ptr),s=L(i.toml,n,a);super(`Invalid TOML document: ${l}
30
-
31
- ${s}`,i),this.line=n,this.column=a,this.codeblock=s}static x(l,i,n){throw new u(l,{toml:i.s,ptr:n??i.p})}}function I(e){let l=e.p,i=e.s.charCodeAt(e.p++),n=i,a=i===39,s=i===e.s.charCodeAt(e.p)&&i===e.s.charCodeAt(e.p+1);s&&((i=e.s.charCodeAt(e.p+=2))===10?e.p++:i===13&&e.s.charCodeAt(e.p+1)===10&&(e.p+=2));let r="",f=e.p,t=0;for(;e.p<e.s.length;e.p++)if(i=e.s.charCodeAt(e.p),s&&(i===10||i===13&&e.s.charCodeAt(e.p+1)===10))t=t&&3;else if(i<32&&i!==9||i===127)u.x("control characters are not allowed in strings",e);else if((!t||t===3)&&i===n&&(!s||e.s.charCodeAt(e.p+1)===n&&e.s.charCodeAt(e.p+2)===n)){if(s&&(e.s.charCodeAt(e.p+3)===n&&e.p++,e.s.charCodeAt(e.p+3)===n&&e.p++),!t){let o=e.s.slice(f,e.p);r=r?r+o:o}return e.p+=s?3:1,r}else if(!t)!a&&i===92&&(r+=e.s.slice(f,f=e.p),t=1);else if(t===1)if(i===120||i===117||i===85){let o=e.p++-1,p=0,d=i===120?2:i===117?4:8;for(let m=0;m<d;m++,e.p++){let A=e.s.charCodeAt(e.p),y=A>=48&&A<=57?A-48:A>=65&&A<=70?A-65+10:A>=97&&A<=102?A-97+10:-1;y<0&&u.x("invalid non-hex character in unicode escape",e),p=p<<4|y}(p<0||p>1114111||p>=55296&&p<=57343)&&u.x("invalid unicode escape",e,o),r+=String.fromCodePoint(p),f=e.p--,t=0}else s&&(i===32||i===9)?t=2:(i===98?r+="\b":i===116?r+=" ":i===110?r+=`
32
- `:i===102?r+="\f":i===114?r+="\r":i===101?r+="\x1B":i===34?r+='"':i===92?r+="\\":u.x("unrecognised escape sequence",e),f=e.p+1,t=0);else i!==32&&i!==9&&(t===2&&u.x("invalid escape: only line-ending whitespace may be escaped",e,f),t=!a&&i===92?1:0,f=e.p);u.x("unfinished string",e,l)}/*!
33
- * Copyright (c) Squirrel Chat et al., All rights reserved.
34
- * SPDX-License-Identifier: BSD-3-Clause
35
- *
36
- * Redistribution and use in source and binary forms, with or without
37
- * modification, are permitted provided that the following conditions are met:
38
- *
39
- * 1. Redistributions of source code must retain the above copyright notice, this
40
- * list of conditions and the following disclaimer.
41
- * 2. Redistributions in binary form must reproduce the above copyright notice,
42
- * this list of conditions and the following disclaimer in the
43
- * documentation and/or other materials provided with the distribution.
44
- * 3. Neither the name of the copyright holder nor the names of its contributors
45
- * may be used to endorse or promote products derived from this software without
46
- * specific prior written permission.
47
- *
48
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
49
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
50
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
51
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
52
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
53
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
54
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
55
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
56
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
57
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
58
- */let Z=/^(\d{4}-\d{2}-\d{2})?[Tt ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|z|[-+]\d{2}:\d{2})?$/i;class C extends Date{#i=!1;#l=!1;#e=null;constructor(l,i,n){let a=!0,s=!0,r="Z",f;if(typeof l=="string")if(i)e:{if(i<3){if(+l.slice(11,13)>23){l="";break e}i===2?(r=null,l+="Z"):(f=l.charCodeAt(l.length-1))!==90&&f!==122&&(r=l.slice(l.length-6)),n&&(l=l.slice(0,10)+"T"+l.slice(11))}else i===4&&(l=+l.slice(0,2)>23?"":`0000-01-01T${l}Z`);a=i!==4,s=i!==3}else{let t=l.match(Z);t?(t[1]||(a=!1,l=`0000-01-01T${l}`),s=!!t[2],s&&l[10]===" "&&(l=l.replace(" ","T")),t[2]&&+t[2]>23?l="":(r=t[3]||null,!r&&s&&(l+="Z"))):l=""}super(l),isNaN(this.getTime())||(this.#i=a,this.#l=s,this.#e=r)}isDateTime(){return this.#i&&this.#l}isLocal(){return!this.#i||!this.#l||!this.#e}isDate(){return this.#i&&!this.#l}isTime(){return this.#l&&!this.#i}isValid(){return this.#i||this.#l}toISOString(){let l=super.toISOString();if(this.isDate())return l.slice(0,10);if(this.isTime())return l.slice(11,23);if(this.#e===null)return l.slice(0,-1);if(this.#e==="Z"||this.#e==="z")return l;let i=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return i=this.#e[0]==="-"?i:-i,new Date(this.getTime()-i*6e4).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(l,i="Z"){let n=new C(l);return n.#e=i,n}static wrapAsLocalDateTime(l){let i=new C(l);return i.#e=null,i}static wrapAsLocalDate(l){let i=new C(l);return i.#l=!1,i.#e=null,i}static wrapAsLocalTime(l){let i=new C(l);return i.#i=!1,i.#e=null,i}}function h(e,l=10){return l===16?e>47&&e<58||e>64&&e<71||e>96&&e<103:e>47&&e<48+l}function k(e,l){return e===32||e===9||e===10||e===13||l&&(e===l||e===44)||e===35}function O(e,l){let i=e.p,n=e.s.charCodeAt(e.p);if(n===91||n===123){e.d--||u.x("document contains excessively nested structures. aborting.",e);let a=n===91?V(e):P(e);return e.d++,a}return n===34||n===39?I(e):n===116?((e.s.charCodeAt(++e.p)!==114||e.s.charCodeAt(++e.p)!==117||e.s.charCodeAt(++e.p)!==101)&&u.x("invalid value",e,i),e.p++,!0):n===102?((e.s.charCodeAt(++e.p)!==97||e.s.charCodeAt(++e.p)!==108||e.s.charCodeAt(++e.p)!==115||e.s.charCodeAt(++e.p)!==101)&&u.x("invalid value",e,i),e.p++,!1):n===43||n===45?w(e,e.p,e.s.charCodeAt(++e.p),44-n,l):e.s.charCodeAt(e.p+4)===45&&e.s.charCodeAt(e.p+7)===45?E(e,n,l):e.s.charCodeAt(e.p+2)===58?N(e,n,l):w(e,e.p,n,0,l)}function w(e,l,i,n,a){let s=i,r=0,f=!1;if(s===105)return(e.s.charCodeAt(++e.p)!==110||e.s.charCodeAt(++e.p)!==102)&&u.x("invalid value",e,l),e.p++,(n||1)/0;if(s===110)return(e.s.charCodeAt(++e.p)!==97||e.s.charCodeAt(++e.p)!==110)&&u.x("invalid value",e,l),e.p++,NaN;if(s===48){if(++e.p>=e.s.length||k(s=e.s.charCodeAt(e.p),a))return e.bi===!0?0n:0;if(!n){if(s===120)return v(e,l,16,a);if(s===98)return v(e,l,2,a);if(s===111)return v(e,l,8,a)}s===46?r=2:s===101||s===69?r=4:u.x("illegal leading zero",e,l)}else h(s)||u.x("invalid value",e,l);for(;++e.p<e.s.length&&(s=e.s.charCodeAt(e.p),!k(s,a));)r||(r=1),s===95?(r&1||u.x("illegal underscore",e),r+=11,f=!0):r===1&&s===46?r=2:(r===1||r===3)&&(s===101||s===69)?r=4:r===4&&(s===43||s===45)||(h(s)?r>9?r-=11:r&1||r++:u.x("illegal character in numeric literal",e));if(!r){let o=(i-48)*(n||1);return e.bi===!0?BigInt(o):o}r&1||u.x("unfinished numeric value",e,l);let t=e.s.slice(l,e.p);return f&&(t=t.replaceAll("_","")),r>1?parseFloat(t):S(e,t,10,l)}function v(e,l,i,n){let a,s=1;for(;++e.p<e.s.length&&(a=e.s.charCodeAt(e.p),!k(a,n));)a===95?(s&1&&u.x("illegal underscore",e),s=3):h(a,i)?s&1&&s--:u.x("illegal character in numeric literal",e);s&1&&u.x("unfinished numeric value",e);let r=e.s.slice(l+2,e.p);return s&&(r=r.replaceAll("_","")),S(e,r,i,l)}function S(e,l,i,n){if(e.bi!==!0)e:{let a=parseInt(l,i);if(!Number.isSafeInteger(a)){if(e.bi)break e;u.x("integer value cannot be represented losslessly",e,n)}return a}return BigInt(i===10?l:(i===2?"0b":i===8?"0o":"0x")+l)}function E(e,l,i){let n=e.p++,a;if(!h(l)||!h(e.s.charCodeAt(e.p++))||!h(e.s.charCodeAt(e.p++))||!h(e.s.charCodeAt(e.p++)))return w(e,e.p=n,l,0,i);if(e.p+=5,h(e.s.charCodeAt(e.p++))||u.x("invalid date-time: date part is malformed",e,n),e.p>=e.s.length||((l=e.s.charCodeAt(e.p))!==32||(a=!0,!h(e.s.charCodeAt(e.p+1))))&&l!==84&&l!==116){let r=e.s.slice(n,e.p);return b(e,r,3,!1,n)}if(e.s.charCodeAt(e.p+=3)!==58&&u.x("invalid date-time: time part is malformed",e,n),e.s.charCodeAt(e.p+=3)===58&&(e.p+=3),e.s.charCodeAt(e.p)===46)for(;h(e.s.charCodeAt(++e.p)););if(l=e.s.charCodeAt(e.p)){if(l===90||l===122){let r=e.s.slice(n,++e.p);return b(e,r,1,a,n,"[+00:00]")}if(l===43||l===45){let r=e.s.slice(n,e.p+=6);return b(e,r,1,a,n,!e.ld&&"["+e.s.slice(e.p-6,e.p)+"]")}}let s=e.s.slice(n,e.p);return b(e,s,2,a,n)}function N(e,l,i){let n=e.p;if(!h(l)||!h(e.s.charCodeAt(++e.p)))return w(e,--e.p,l,0,i);if(e.s.charCodeAt(e.p+=4)===58&&(e.p+=3),e.s.charCodeAt(e.p)===46)for(;h(e.s.charCodeAt(++e.p)););let a=e.s.slice(n,e.p);return b(e,a,4,!1,n)}function b(e,l,i,n,a,s){if(e.ld){let r=new C(l,i,n);return r.isValid()||u.x("invalid date",e,a),r}try{switch(s&&(l+=s),i){case 1:return Temporal.ZonedDateTime.from(l);case 2:return Temporal.PlainDateTime.from(l);case 3:return Temporal.PlainDate.from(l);case 4:return Temporal.PlainTime.from(l)}}catch(r){u.x(r instanceof Error?r.message:""+r,e,a)}}function _(e){for(;e.p<e.s.length;e.p++){let l=e.s.charCodeAt(e.p);if(l===10)break;if(l===13&&e.s.charCodeAt(e.p+1)===10){e.p++;break}(l<32&&l!==9||l===127)&&u.x("control characters are not allowed in comments",e)}}function g(e,l,i){let n;for(;e.p<e.s.length;){for(;e.p<e.s.length&&((n=e.s.charCodeAt(e.p))===32||n===9||!l&&(n===10||n===13&&e.s.charCodeAt(e.p+1)===10));)e.p++;if(i||n!==35)break;_(e)}}function T(e,l=61){let i,n=0,a=[],s,r=e.s.charCodeAt(i=e.p);do{if(r===l)return n||u.x("unexpected end of key",e),n===1&&a.push(e.s.slice(s,e.p)),e.p++,a;r===46?(n||u.x("illegal empty bare key",e),n===1&&a.push(e.s.slice(s,e.p)),n=0):!n&&(r===34||r===39)?(r===e.s.charCodeAt(e.p+1)&&r===e.s.charCodeAt(e.p+2)&&u.x("illegal quoted key: multiline strings are not allowed",e),a.push(I(e)),n=2,e.p--):r===32||r===9?n===1&&(a.push(e.s.slice(s,e.p)),n=2):n===2||r<48&&r!==45||r>57&&r<65||r>90&&r<97&&r!==95||r>122?u.x("illegal character in key",e):n||(n=1,s=e.p)}while(r=e.s.charCodeAt(++e.p));u.x("incomplete key-value: cannot find end of key",e,i)}function P(e){let l=e.p++,i=Object.create(null),n=new Set,a;for(;e.p<e.s.length;){if(g(e),(a=e.s.charCodeAt(e.p))===125)return e.p++,i;let s,r=i,f=!1,t=e.p,o=T(e);for(let d=0;d<o.length;d++){d&&(r=f?r[s]:r[s]=Object.create(null)),s=o[d],(f=Object.hasOwn(r,s))&&(typeof r[s]!="object"||n.has(r[s]))&&u.x("trying to redefine an already defined value",e,t);let m=s==="__proto__";if(e.uk&&(m||s==="constructor")){r=e.uk!==1&&u.x("document contains an unsafe property",e,t);break}!f&&m&&Object.defineProperty(r,s,{enumerable:!0,configurable:!0,writable:!0})}f&&u.x("trying to redefine an already defined value",e,t),g(e,!0,!0);let p=O(e,125);if(r&&typeof(r[s]=p)=="object"&&n.add(p),g(e),(a=e.s.charCodeAt(e.p++))===125)return i;a!==44&&u.x("expected comma or end of structure",e,e.p-1)}u.x("unfinished table",e,l)}function V(e){let l=e.p++,i=[],n;for(;e.p<e.s.length;){if(g(e),(n=e.s.charCodeAt(e.p))===93)return e.p++,i;if(i.push(O(e,93)),g(e),(n=e.s.charCodeAt(e.p++))===93)return i;n!==44&&u.x("expected comma or end of structure",e,e.p-1)}u.x("unfinished array",e,l)}function D(e,l,i,n,a){let s=i,r=n,f,t=!1,o;for(let p=0;p<l.length;p++){if(p){if(s=t?s[f]:s[f]=Object.create(null),r=(o=r[f]).c,a===0&&(o.t===1||o.t===2))return null;if(o.t===2){let d=s.length-1;s=s[d],r=r[d].c}}if(f=l[p],(t=Object.hasOwn(s,f))&&r[f]?.t===0&&r[f]?.d)return null;if(!t){let d=f==="__proto__";if(e.uk&&(d||f==="constructor"))return!1;d&&(Object.defineProperty(s,f,{enumerable:!0,configurable:!0,writable:!0}),Object.defineProperty(r,f,{enumerable:!0,configurable:!0,writable:!0})),r[f]={t:p<l.length-1&&a===2?3:a,d:!1,i:0,c:Object.create(null)}}}if(o=r[f],o.t!==a&&!(a===1&&o.t===3)||(a===2&&(o.d||(o.d=!0,s[f]=[]),s[f].push(s=Object.create(null)),o.c[o.i++]=o={t:1,d:!1,i:0,c:Object.create(null)}),o.d))return null;if(o.d=!0,a===1)s=t?s[f]:s[f]=Object.create(null);else if(a===0&&t)return null;return[f,s,o.c]}function j(e,l,i){(l===null||e.uk===2)&&u.x(l===null?"trying to redefine an already defined table or value":"document contains an unsafe property",e,i)}function $(e,l={}){let i={s:e,p:0,d:l.maxDepth??1e3,bi:l.integersAsBigInt??!1,ld:l.useLegacyDate??!0,uk:l.unsafeKeyBehaviour==="throw"?2:l.unsafeKeyBehaviour==="drop"?1:0},n=Object.create(null),a=Object.create(null),s,r=!1,f=n,t=a;for(e.charCodeAt(0)===65279&&i.p++,g(i);i.p<e.length;){if(e.charCodeAt(i.p)===91){let o=e.charCodeAt(++i.p)===91;s=i.p+=+o,r=!1;let p=T(i,93);o&&(e.charCodeAt(i.p)!==93&&u.x("expected end of table array declaration",i),i.p++);let d=D(i,p,n,a,o?2:1);d?(t=d[2],f=d[1]):(j(i,d,s),r=!0)}else{s=i.p;let o=T(i),p=D(i,o,f,t,0);!p&&!r&&j(i,p,s),g(i,!0,!0);let d=O(i,void 0);p&&!r&&(p[1][p[0]]=d)}g(i,!0),i.p<e.length&&(s=e.charCodeAt(i.p))!==10&&(s!==13||e.charCodeAt(i.p+1)!==10)&&u.x("each key-value declaration must be followed by an end-of-line",i),g(i)}return n}export{C as TomlDate,u as TomlError,$ as parse};
1
+ import{a as nt,e as st,z as O}from"../packem_shared/index-BzhrR_iC.js";import{l as At}from"./ts-loader.js";import{L as Et}from"../packem_shared/index-BisalDCf.js";import{p as bt}from"./cli-main.js";import{q as xt,L as Ct,T as S,R as L,B as W,U as E,O as N,K as Q,Z as V,W as jt,r as K,t as kt,F as D,u as Y,x as J,H as Lt,w as Wt,M as Ut,C as St,P as Tt,v as Ot,y as Pt,Y as _t,z as It,J as Rt,A as zt,V as Nt,E as vt,G as Ft,I as Mt,N as Bt}from"../packem_shared/formatBytes-BHAzNIrn-CrusHOew.js";import{a2 as I,L as qt}from"./catalog.js";const Gt=(t,e)=>typeof t!="string"||t===""?"":t[0].toLowerCase()+t.slice(1),Qt=new RegExp("[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))","g"),Vt=t=>{if(typeof t!="string")throw new TypeError(`The "value" argument must be of type string. Received ${typeof t}`);return t.replaceAll(Qt,"")},v=new I(1e3),Kt=/[.*+?^${}()|[\]\\]/g,Dt=t=>{const e=t.join("");if(v.has(e)){const r=v.get(e);return r.lastIndex=0,r}const s=t.map(r=>r.replaceAll(Kt,String.raw`\$&`)).join("|"),n=new RegExp(s,"g");return v.set(e,n),n},Yt=t=>{const e=[];let s=0,n;for(L.lastIndex=0;(n=L.exec(t))!==null;)n.index>s&&e.push(t.slice(s,n.index)),e.push(n[0]),s=L.lastIndex;return s<t.length&&e.push(t.slice(s)),e.filter(Boolean)},Jt=/[ČŠŽĐ]/i,rt=new Uint8Array(128),ot=new Uint8Array(128),it=new Uint8Array(128);for(let t=0;t<128;t++)rt[t]=t>=65&&t<=90?1:0,ot[t]=t>=97&&t<=122?1:0,it[t]=t>=48&&t<=57?1:0;const F=t=>rt[t],Z=t=>ot[t],M=t=>it[t],j=(t,e,s,n,r)=>{if(t.length===0)return[];let o=!1;const a=Object.values(e);for(const u of a)if(u(t[0])){o=!0;break}if(!o&&!s)return[t];const l=[...t],h=[];let i=l[0],p="other";const d=Object.entries(e);for(const u of d){const[f,g]=u;if(g(l[0])){p=f;break}}let c=s&&n?l[0]===l[0].toLocaleUpperCase(n):!1;for(let u=1;u<l.length;u++){const f=l[u];let g="other";for(const w of d){const[$,A]=w;if(A(f)){g=$;break}}const y=s&&n?f===f.toLocaleUpperCase(n):!1;let m=!1;r?m=r(p,g,c,y,f,u,l):(p!==g&&p!=="other"&&g!=="other"&&(m=!0),s&&g!=="other"&&!c&&y&&(m=!0)),m?(h.push(i),i=f):i+=f,p=g,s&&(c=y)}return i&&i.length>0&&h.push(i),h.length>0?h:[t]},Zt=(t,e,s,n)=>{if(s.size===0)return e;for(const r of s)if(t.startsWith(r,e))return n.push(r),e+r.length;return e},lt=(t,e=new Set)=>{if(t.length===0)return[];if(t.toUpperCase()===t)return[t];let s=0;const n=[],r=t.length;for(let o=1;o<r;o++){const a=Zt(t,s,e,n);if(a!==s){s=a,o=s-1;continue}const l=t.codePointAt(o-1),h=t.codePointAt(o),i=l&&l<128&&F(l),p=h&&h<128&&F(h),d=l&&l<128&&Z(l),c=l&&l<128&&M(l),u=h&&h<128&&M(h);if(d&&p){n.push(t.slice(s,o)),s=o;continue}if(c&&!u||!c&&u){n.push(t.slice(s,o)),s=o;continue}if(u&&!c){let f=!1,g=!1;if(o+1<r){const y=t.codePointAt(o+1);f=y&&y<128&&F(y),g=y&&y<128&&M(y)}if(!g&&f){n.push(t.slice(s,o),t.slice(o,o+1)),s=o+1;continue}}if(o+1<r){const f=t.codePointAt(o+1),g=f&&f<128&&Z(f);if(i&&p&&g){const y=t.slice(s,o+1);e.has(y)||(n.push(t.slice(s,o)),s=o)}}}return s<r&&n.push(t.slice(s)),n.filter(o=>o!=="")},at=(t,e,s)=>{if(t.length===0)return[];const n=t===t.toLocaleUpperCase(e);if(e.startsWith("de")){if(!n&&t.replaceAll("ß","SS")===t.toLocaleUpperCase(e))return[t];const i=[...t],p=i.length,d=[];let c=i[0],u=i[0]===i[0].toLocaleUpperCase(e),f=u,g=u?0:-1;for(let y=1;y<p;y++){const m=i[y],w=m===m.toLocaleUpperCase(e);if(w===u)c+=m;else if(w)c&&c.length>0&&(d.push(c),c=m),f=!0,g=y;else{if(f&&y-g>1){const $=i[y-1],A=c.slice(0,-1);A&&A.length>0&&d.push(A),c=$+m}else c+=m;f=!1,g=-1}u=w}return c&&c.length>0&&d.push(c),d}if(e.startsWith("uk")||e.startsWith("ru")||e.startsWith("bg")||e.startsWith("sr")||e.startsWith("mk")||e.startsWith("be")){if(!W.test(t)&&!E.test(t))return[t];const i=[...t],p=i.length,d=[];let c=i[0];const u=i[0];let f;W.test(u)?f=1:E.test(u)?f=2:f=0;let g=u===u.toLocaleUpperCase(e);for(let m=1;m<p;m++){const w=i[m];let $;W.test(w)?$=1:E.test(w)?$=2:$=0;const A=w===w.toLocaleUpperCase(e);f!==$&&(f===1||f===2)&&($===1||$===2)||$===f&&!g&&A?(d.push(c),c=w):c+=w,f=$,g=A}c&&c.length>0&&d.push(c);const y=[];for(let m=0;m<d.length;m++)m<d.length-1&&d[m].length===1&&E.test(d[m])&&W.test(d[m+1][0])?(y.push(d[m]+d[m+1]),m+=1):y.push(d[m]);return y}if(e.startsWith("el")){if(!N.test(t)&&!E.test(t))return[t];const i=[];Q.lastIndex=0;let p;for(;(p=Q.exec(t))!==null;)i.push(p[0]);i.length===0&&i.push(t);const d=[];if(i.length===1){const c=i[0];if(!c||!N.test(c[0])||c.length===1)return[c??t]}for(const c of i){if(!c)continue;if(!N.test(c[0])||c.length===1){d.push(c);continue}const u=c.length;let f=c[0],g=c[0]===c[0].toLocaleUpperCase(e);for(let y=1;y<u;y++){const m=c[y],w=m===m.toLocaleUpperCase(e);!g&&w?(d.push(f),f=m):f+=m,g=w}f&&d.push(f)}return d}if(e.startsWith("ja")||e.startsWith("ko")){const i=e.startsWith("ja"),p=i?{hiragana:c=>kt.test(c),kanji:c=>K.test(c),katakana:c=>jt.test(c),latin:c=>E.test(c)}:{hangul:c=>D.test(c),latin:c=>E.test(c)},d=new Set(["が","で","と","に","の","は","へ","も","や","を"]);if(i){const c=j(t,p,!1,e,(f,g)=>f==="hiragana"&&g==="katakana"||f==="katakana"&&g==="hiragana"||f==="hiragana"&&g==="latin"||f==="katakana"&&g==="latin"||f==="kanji"&&g==="latin"||f==="latin"&&(g==="hiragana"||g==="katakana"||g==="kanji")),u=[];for(const f of c){const g=f;g.length===1&&d.has(g)&&u.length>0?u[u.length-1]=u.at(-1)+g:u.push(g)}return u.length>0?u:[t]}return j(t,p,!1,e,(c,u)=>c==="hangul"&&u==="latin"||c==="latin"&&u==="hangul")}if(e.startsWith("sl")){const i=[...t],p=i.length,d=[];let c=i[0],u=i[0]===i[0].toLocaleUpperCase(e);for(let f=1;f<p;f++){const g=i[f],y=g===g.toLocaleUpperCase(e),m=Jt.test(g),w=f<p-1&&i[f+1]===i[f+1].toLocaleUpperCase(e);!u&&y||m&&w?(d.push(c),c=g,m&&w&&(d.push(c),c="")):c+=g,u=y}return c&&c.length>0&&d.push(c),d}if(e.startsWith("zh"))return j(t,{han:i=>K.test(i),latin:i=>E.test(i)},!1,e);if(["ar","fa","he","ur"].includes(e.split("-")[0])){const i=p=>Y.test(p)||J.test(p);return j(t,{latin:p=>E.test(p),rtl:p=>i(p)},!1,e)}if(["am","bn","gu","hi","km","kn","lo","ml","mr","ne","or","pa","si","ta","te","th"].includes(e.split("-")[0])){const i=p=>Lt.test(p)||Wt.test(p)||Ut.test(p)||St.test(p)||Tt.test(p)||Ot.test(p)||Pt.test(p)||_t.test(p)||It.test(p)||Rt.test(p)||zt.test(p)||Nt.test(p)||vt.test(p)||Ft.test(p)||Mt.test(p)||Bt.test(p);return j(t,{indic:p=>i(p),latin:p=>E.test(p)},!1,e)}if(["be","bg","ru","sr","uk"].includes(e))return j(t,{cyrillic:i=>W.test(i),latin:i=>E.test(i)},!0,e);if(["ar","fa","he"].includes(e))return j(t,{latin:i=>E.test(i),rtl:i=>Y.test(i)||J.test(i)},!1,e);if(e.startsWith("ko"))return j(t,{hangul:i=>D.test(i),latin:i=>E.test(i)},!1,e);if(e.startsWith("uz")){if(!W.test(t)&&!E.test(t))return[t];const i=[...t],p=i.length,d=[];let c=i[0],u=i[0]===i[0].toLocaleUpperCase(e);for(let f=1;f<p;f++){const g=i[f],y=g===g.toLocaleUpperCase(e);if(V.test(g)||V.test(i[f-1])){c+=g;continue}!u&&y?(d.push(c),c=g):c+=g,u=y}return c&&c.length>0&&d.push(c),d}const r=[...t],o=r.length,a=[];let l=r[0],h=r[0]===r[0].toLocaleUpperCase(e);for(const i of s)if(t.startsWith(i)){a.push(i),l=r[i.length],h=l===l.toLocaleUpperCase(e);break}for(let i=1;i<o;i++){const p=r[i],d=p===p.toLocaleUpperCase(e);let c=0;for(const u of s)if(t.startsWith(u,i)){a.push(l,u),c=u.length,l="";const f=u.at(-1);f&&(h=f===f.toLocaleUpperCase(e));break}if(c>0){i+=c-1;continue}!h&&d?(a.push(l),l=p):l+=p,h=d}return l&&a.push(l),a},Ht=(t,e,s)=>{const n=[],r=S.test(t)?t.split(S).filter(Boolean):[t];for(const o of r){const a=o;if(S.test(a))n.push(a);else{L.lastIndex=0;const l=L.test(a)?Yt(a).filter(Boolean):[a];for(const h of l)if(L.lastIndex=0,L.test(h))n.push(h);else if(e){const i=e.toLowerCase().split("-")[0];n.push(...at(h,i,s))}else n.push(...lt(h,s))}}return n},R=(t,e={})=>{if(!t||typeof t!="string")return[];const{handleAnsi:s=!1,handleEmoji:n=!1,knownAcronyms:r=[],locale:o,normalize:a=!1,separators:l,stripAnsi:h=!1,stripEmoji:i=!1}=e,p=new Set([...r].toSorted((m,w)=>w.length-m.length));let d=t;h&&(d=Vt(d)),i&&(d=xt(d));let c;Array.isArray(l)?c=Dt(l):l instanceof RegExp?c=l:c=Ct;const u=[];let f=d;const g=c.flags.includes("g")?c:new RegExp(c.source,`${c.flags}g`);for(;f.length>0;){const m=g.exec(f);if(!m){f===".."?u.push(".."):f==="."?u.push("."):f.length>0&&u.push(f);break}const w=m.index,$=m[0],A=$.length,T=f.slice(0,w),$t=f.slice(w+A);if($.startsWith("../"))u.push(".."),f=f.slice(w+3);else if($.startsWith("./"))u.push("."),f=f.slice(w+2);else if(w===0&&$==="..")u.push(".."),f=f.slice(2);else if(w===0&&$===".")u.push("."),f=f.slice(1);else{T.length>0&&u.push(T);let x=0;for(;(x=$.indexOf("../",x))!==-1;)u.push(".."),x+=3;for(x=0;(x=$.indexOf("./",x))!==-1;)(x===0||$[x-1]!==".")&&u.push("."),x+=2;let C=$t;for(;C.startsWith("../");)u.push(".."),C=C.slice(3);for(;C.startsWith("./");)u.push("."),C=C.slice(2);if(C===".."){u.push("..");break}else if(C==="."){u.push(".");break}else f=C}g.lastIndex=0}if(u.length===0){const m=d.split(c).filter(Boolean);u.push(...m)}let y=[];for(const m of u)s||n?y.push(...Ht(m,o,p)):o?y.push(...at(m,o,p)):y.push(...lt(m,p));return a&&(y=y.map(m=>p.has(m)?m:o&&m===m.toLocaleUpperCase(o)?m[0]+m.slice(1).toLocaleLowerCase(o):m.toUpperCase()===m&&!p.has(m)?m.slice(0,1)+m.slice(1).toLowerCase():m)),y},q=(t,e)=>typeof t!="string"||t===""?"":(e?.locale?t[0].toLocaleUpperCase(e.locale):t[0].toUpperCase())+t.slice(1),Xt=(t,e)=>`${t}::${e?.joiner??""}::${e?.locale??""}::${e?.knownAcronyms?.join(",")??""}::${e?.normalize?"true":"false"}::${e?.stripAnsi?"true":"false"}::${e?.stripEmoji?"true":"false"}::${e?.handleAnsi?"true":"false"}::${e?.handleEmoji?"true":"false"}`,z=(t,e)=>{const{length:s}=t;if(s===0)return"";if(s===1)return t[0];const n=[];let r="",o="";for(let a=0;a<s;a++){const l=t[a];if(S.test(l)){r?(n.push(r+o+l),r="",o=""):(n.length>0&&n.push(e),r=l);continue}r?(o&&(o+=e),o+=l):(n.length>0&&n.push(e),n.push(l))}return n.join("")},te=/(?<![a-zß])SS(?![a-z])/g,ee=t=>t.replaceAll(te,"ß"),ne=(t,e)=>{if(typeof t!="string"||!t)return"";let s=!0;return z(R(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(r=>{const o=r,a=o.toLowerCase();return s?(s=!1,Gt(a)):q(a,e)}),"")},se=new I(1e3),G=(t,e)=>{if(typeof t!="string")return"";const s=e?.cache??!1,n=e?.cacheStore??se;let r;if(s&&(r=Xt(t,e)),s&&r&&n.has(r))return n.get(r);const o=R(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(l=>{if(e?.handleAnsi&&S.test(l))return l;if(e?.toUpperCase)return e.locale?l.toLocaleUpperCase(e.locale):l.toUpperCase();const h=e?.locale?.startsWith("de")?ee(l):l;return e?.locale?h.toLocaleLowerCase(e.locale):h.toLowerCase()}),a=z(o,e?.joiner??"-");return s&&r&&n.set(r,a),a},re=new I(1e3),oe=(t,e)=>G(t,{cacheStore:re,...e,joiner:"_",toUpperCase:!0}),ie=(t,e)=>typeof t!="string"||!t?"":z(R(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(n=>q(n.toLowerCase(),{locale:e?.locale})),""),le=new I(1e3),ae=(t,e)=>G(t,{cacheStore:le,...e,joiner:"_"}),ce=(t,e)=>typeof t!="string"?"":z(R(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(n=>q(n,{locale:e?.locale})),"-"),b=t=>t==null?"":typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"?String(t):JSON.stringify(t),H={camel_case:t=>ne(b(t)),kebab_case:t=>G(b(t)),lower_case:t=>b(t).toLowerCase(),pascal_case:t=>ie(b(t)),path_join:(t,...e)=>{const s=[b(t),...e.map(n=>b(n))];return st(...s)},path_relative:(t,e)=>nt(b(e),b(t)),snake_case:t=>ae(b(t)),upper_case:t=>b(t).toUpperCase(),upper_kebab_case:t=>ce(b(t)),upper_snake_case:t=>oe(b(t))},ct=(t,e,s=[])=>{const n=H[t];if(!n)throw new Error(`Unknown filter "${t}". Known filters: ${Object.keys(H).sort().join(", ")}.`);return n(e,...s)},ft=t=>{const e=[];let s=0,n=0,r,o=-1;for(const a of t){if(o+=1,r){a===r&&(r=void 0);continue}if(a==='"'||a==="'"){r=a;continue}a==="("?s+=1:a===")"?s-=1:a===","&&s===0&&(e.push(t.slice(n,o)),n=o+1)}return e.push(t.slice(n)),e},fe=t=>{if(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))return t.slice(1,-1)},ue=/\[([^\]]+)\]/g,pe=t=>{const e=t.trim(),s=e.indexOf("(");if(s===-1)return{args:[],name:e};if(!e.endsWith(")"))throw new Error(`Filter call "${t}" missing closing ")"`);const n=e.slice(0,s).trim(),r=e.slice(s+1,-1).trim();return r===""?{args:[],name:n}:{args:ft(r).map(a=>{const l=a.trim();return fe(l)??l}),name:n}},he=t=>{const e=t.split("|").map(r=>r.trim()),s=e[0]??"";if(!s)throw new Error(`Empty variable name in expression "${t}"`);return{filters:e.slice(1).map(r=>pe(r)),name:s}},de=t=>t==null?"":typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"?String(t):JSON.stringify(t),me=(t,e)=>{const s=t.replaceAll(ue,(n,r)=>{const{filters:o,name:a}=he(r);if(!Object.hasOwn(e,a))throw new Error(`Variable "${a}" used in filename "${t}" but not defined`);let l=e[a];for(const h of o)l=ct(h.name,l,h.args);return de(l)});return ut(s)},ut=t=>t.split("/").map(e=>e.endsWith(".tera")||e.endsWith(".twig")?e.slice(0,-5):e).join("/"),ge=t=>t.endsWith(".raw")?t.slice(0,-4):t,ye=t=>{const e=t.split("/");return(e.at(-1)??"").startsWith("_")?!0:e.slice(0,-1).includes("partials")},k="---",we=(t,e)=>{if(!t.startsWith(`${k}
2
+ `)&&!t.startsWith(`${k}\r
3
+ `))return{body:t};const s=t.indexOf(`
4
+ ${k}`,k.length);if(s===-1)return{body:t};let n=s+1+k.length;t[n]==="\r"&&(n+=1),t[n]===`
5
+ `&&(n+=1);const r=t.startsWith(`${k}\r
6
+ `)?k.length+2:k.length+1,o=t.slice(r,s).replaceAll("\r","");let a;try{a=e(o)}catch(l){const h=l instanceof Error?l.message:String(l);throw new Error(`Failed to parse frontmatter YAML: ${h}`,{cause:l})}if(a==null)return{body:t.slice(n)};if(typeof a!="object"||Array.isArray(a))throw new TypeError(`Frontmatter must be a YAML mapping, got ${Array.isArray(a)?"array":typeof a}`);return{body:t.slice(n),frontmatter:a}},$e=/\{\{-?(.+?)-?\}\}|\{%-?(.+?)-?%\}/gs,pt=t=>{const e=[];let s=0,n=1;const r=o=>{for(const a of o)a===`
7
+ `&&(n+=1)};for(const o of t.matchAll($e)){const a=o.index??0;if(a>s){const i=t.slice(s,a);e.push({line:n,type:"text",value:i}),r(i)}const l=n,h=o[0];h.startsWith("{{")?e.push({line:l,type:"expr",value:(o[1]??"").trim()}):e.push({line:l,type:"stmt",value:(o[2]??"").trim()}),r(h),s=a+h.length}if(s<t.length){const o=t.slice(s);e.push({line:n,type:"text",value:o})}return e},Ae=new Set(["block","endblock","endfilter","endmacro","extends","filter","import","macro","set"]),ht=(t,e)=>{let s=0;const n=(o,a)=>{throw new Error(`${e}:${o}: ${a}`)},r=o=>{const a=[];for(;s<t.length;){const l=t[s];if(l.type==="text"){a.push({type:"text",value:l.value}),s+=1;continue}if(l.type==="expr"){a.push({expression:l.value,line:l.line,type:"expr"}),s+=1;continue}const h=l.value.split(/\s+/)[0]??"";if(o.includes(h))return a;if(Ae.has(h)&&n(l.line,`Tera feature "{% ${h} %}" is not supported. Supported: if/else/endif, for/endfor, include. Rewrite the template to avoid macros, set, extends, block, and import.`),h==="if"){s+=1;const i=l.value.slice(2).trim(),p=r(["else","endif"]);let d;s<t.length&&t[s].type==="stmt"&&t[s].value.split(/\s+/)[0]==="else"&&(s+=1,d=r(["endif"])),(s>=t.length||t[s].type!=="stmt"||t[s].value.split(/\s+/)[0]!=="endif")&&n(l.line,"Unterminated {% if %} — missing {% endif %}"),s+=1,a.push({alternate:d,condition:i,consequent:p,line:l.line,type:"if"});continue}if(h==="for"){s+=1;const i=l.value.slice(3).trim(),p=i.indexOf(" in ");p===-1&&n(l.line,"Malformed {% for %} — expected `for <name> in <collection>`");const d=i.slice(0,p).trim(),c=i.slice(p+4).trim();(!d||!c)&&n(l.line,"Malformed {% for %} — missing binding or collection");const u=r(["endfor"]);(s>=t.length||t[s].type!=="stmt"||t[s].value.split(/\s+/)[0]!=="endfor")&&n(l.line,"Unterminated {% for %} — missing {% endfor %}"),s+=1,a.push({binding:d,body:u,collection:c,line:l.line,type:"for"});continue}if(h==="include"){s+=1;const i=l.value.slice(7).trim(),p=dt(i);p===void 0&&n(l.line,"Malformed {% include %} — expected a quoted partial name"),a.push({line:l.line,name:p,type:"include"});continue}n(l.line,`Unknown tag "{% ${h} %}". Supported: if, for, include.`)}return a};return r([])},dt=t=>{if(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))return t.slice(1,-1)},Ee=t=>t==null?"":typeof t=="boolean"||typeof t=="number"?String(t):typeof t=="string"?t:JSON.stringify(t),be=t=>t==null||t===!1||t===0||t===""?!1:Array.isArray(t)?t.length>0:!0,mt=(t,e,s,n,r=!0)=>{const o=t.split(".");if(r&&o.length>0&&!Object.hasOwn(e,o[0]))throw new Error(`${n}:${s}: Variable "${t}" is not defined`);let a=e;for(const l of o){if(a==null)return;if(typeof a!="object")throw new TypeError(`${n}:${s}: Cannot read "${l}" on non-object value`);a=a[l]}return a},xe=t=>{const e=[];let s=0,n=0,r;for(let o=0;o<t.length;o+=1){const a=t[o];if(r){a===r&&(r=void 0);continue}if(a==='"'||a==="'"){r=a;continue}a==="("?s+=1:a===")"?s-=1:a==="|"&&s===0&&(e.push(t.slice(n,o)),n=o+1)}return e.push(t.slice(n)),e},Ce=t=>{const e=t.trim(),s=e.indexOf("(");if(s===-1)return{args:[],name:e};if(!e.endsWith(")"))throw new Error(`Filter call "${t}" missing closing ")"`);const n=e.slice(0,s).trim(),r=e.slice(s+1,-1).trim();return r?{args:ft(r).map(o=>o.trim()),name:n}:{args:[],name:n}},_=(t,e,s,n,r=!0)=>{const o=t.trim();if(o==="true")return!0;if(o==="false")return!1;if(o==="null"||o==="none")return null;const a=dt(o);return a!==void 0?a:/^-?\d+(?:\.\d+)?$/.test(o)?Number(o):mt(o,e,s,n,r)},gt=(t,e,s,n,r=!0)=>{const o=xe(t),a=o[0].trim();let l=_(a,e,s,n,r);for(let h=1;h<o.length;h+=1){const i=o[h].trim(),{args:p,name:d}=Ce(i),c=p.map(u=>_(u,e,s,n,r));try{l=ct(d,l,c)}catch(u){const f=u instanceof Error?u.message:String(u);throw new Error(`${n}:${s}: ${f}`,{cause:u})}}return l},yt=(t,e)=>{let s,n=0;for(let r=0;r<=t.length-e.length;r+=1){const o=t[r];if(s){o===s&&(s=void 0);continue}if(o==='"'||o==="'"){s=o;continue}if(o==="("){n+=1;continue}if(o===")"){n-=1;continue}if(n===0&&t.slice(r,r+e.length)===e)return r}return-1},X=(t,e)=>{const s=[];let n=0,r=0;for(;r<=t.length-e.length;){const o=yt(t.slice(r),e);if(o===-1)break;s.push(t.slice(n,r+o)),r+=o+e.length,n=r}return s.push(t.slice(n)),s},U=(t,e,s,n)=>{const r=t.trim();if(r==="")return!1;if(r.startsWith("(")&&r.endsWith(")")&&je(r)===r.length-1)return U(r.slice(1,-1),e,s,n);const o=X(r," or ");if(o.length>1)return o.some(l=>U(l,e,s,n));const a=X(r," and ");if(a.length>1)return a.every(l=>U(l,e,s,n));if(r.startsWith("not "))return!U(r.slice(4),e,s,n);for(const l of["==","!="]){const h=yt(r,l);if(h!==-1){const i=_(r.slice(0,h),e,n,s,!1),p=_(r.slice(h+l.length),e,n,s,!1),d=i===p;return l==="=="?d:!d}}return be(gt(r,e,n,s,!1))},je=t=>{if(t[0]!=="(")return-1;let e=0,s,n=-1;for(const r of t){if(n+=1,s){r===s&&(s=void 0);continue}if(r==='"'||r==="'"){s=r;continue}if(r==="(")e+=1;else if(r===")"&&(e-=1,e===0))return n}return-1},P=(t,e)=>{let s="";for(const n of t){if(n.type==="text"){s+=n.value;continue}if(n.type==="expr"){s+=Ee(gt(n.expression,e.scope,n.line,e.filename));continue}if(n.type==="if"){const r=U(n.condition,e.scope,e.filename,n.line)?n.consequent:n.alternate??[];s+=P(r,e);continue}if(n.type==="for"){const r=mt(n.collection,e.scope,n.line,e.filename,!1);if(r==null)continue;if(!Array.isArray(r))throw new TypeError(`${e.filename}:${n.line}: {% for %} expected an array, got ${typeof r}`);for(const o of r){const a={...e.scope,[n.binding]:o};s+=P(n.body,{...e,scope:a})}continue}if(n.type==="include"){const r=e.partials?.get(n.name);if(!r)throw new Error(`${e.filename}:${n.line}: Partial "${n.name}" not found. Available: ${[...e.partials?.keys()??[]].join(", ")||"(none)"}`);const o=e.includeStack??new Set;if(o.has(n.name)){const a=[...o,n.name].join(" → ");throw new Error(`${e.filename}:${n.line}: Circular partial include detected: ${a}`)}o.add(n.name);try{s+=P(r,{...e,filename:`<partial:${n.name}>`,includeStack:o})}finally{o.delete(n.name)}}}return s},ke=(t,e)=>ht(pt(t),e),B=(t,e)=>P(ht(pt(t),e.filename),e),tt="template.yml",Le=".raw",We=new Set([".cjs",".css",".env",".gitattributes",".gitignore",".graphql",".html",".ini",".js",".json",".json5",".jsonc",".jsx",".lock",".md",".mdx",".mjs",".prettierrc",".raw",".rs",".scss",".sh",".sql",".svg",".tera",".toml",".ts",".tsx",".twig",".txt",".vue",".xml",".yaml",".yml"]),Ue=new Set(["Brewfile","CHANGELOG","CODEOWNERS","CONTRIBUTING","COPYING","Dockerfile","Gemfile","LICENCE","LICENSE","Makefile","NOTICE","Procfile","Rakefile","README","VERSION"]),Se=t=>{const e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\")),s=e===-1?t:t.slice(e+1),n=s.lastIndexOf(".");return n===-1||n===0?"":s.slice(n).toLowerCase()},wt=t=>{const e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e===-1?t:t.slice(e+1)},Te=t=>{const e=Se(t);if(e!=="")return We.has(e);const s=wt(t);return Ue.has(s)},Oe=t=>{const e={default:t.default,internal:t.internal,order:t.order,prompt:t.prompt,required:t.required};switch(t.type){case"array":return{...e,type:"array"};case"boolean":return{...e,default:typeof e.default=="boolean"?e.default:void 0,type:"boolean"};case"enum":return{...e,multiple:t.multiple,type:"enum",values:t.values??[]};case"number":return{...e,type:"number"};case"string":return{...e,type:"string"};default:throw new Error(`Unsupported variable type "${String(t.type)}"`)}},Pe=t=>t.replaceAll("\\","/").replace(/^\.\//,"").replaceAll(/\/+/g,"/"),_e=(t,e,s)=>{const n=e.split("/").filter(Boolean);if(n.length===0)throw new Error("Empty destination path for value");let r=t;for(let o=0;o<n.length-1;o+=1){const a=n[o],l=r[a];if(l===void 0){const h={};r[a]=h,r=h}else if(typeof l=="object"&&!Buffer.isBuffer(l))r=l;else throw new TypeError(`Path conflict: "${n.slice(0,o+1).join("/")}" is both a file and a directory`)}r[n.at(-1)]=s},et=(t,e,s)=>{if(typeof t!="string")return Ie(t);const n=t.includes("{{")||t.includes("{%")?B(t,{filename:`${s}#frontmatter`,scope:e}):t;return U(n,e,`${s}#frontmatter`,1)},Ie=t=>t==null||t===!1||t===0||t===""?!1:Array.isArray(t)?t.length>0:typeof t=="string"?t!=="false"&&t!=="0":!0,qe=(t,e)=>{const s=st(t,tt),n=At(s);if(!n||typeof n!="object")throw new Error(`${s}: must contain a YAML mapping`);const r={};if(n.variables)for(const[h,i]of Object.entries(n.variables))r[h]=Oe(i);const o=new Map,a=[];for(const h of qt(t,{includeDirs:!1,includeSymlinks:!1})){if(h.path===s)continue;const i=nt(t,h.path).replaceAll("\\","/");if(i===tt)continue;if(ye(i)){const c=O(h.path),u=ke(c,i);for(const f of Re(i))o.has(f)&&o.get(f)!==u&&bt.warn(`partial name "${f}" is declared by multiple files — last one wins. Use distinct names or fully-qualified includes.`),o.set(f,u);continue}if(i.endsWith(Le)){const c=O(h.path);a.push({binary:null,isRaw:!0,rawText:c,relativePath:i});continue}if(Te(i)){const c=O(h.path);a.push({binary:null,isRaw:!1,rawText:c,relativePath:i});continue}const d=O(h.path,{buffer:!0});a.push({binary:d,isRaw:!1,rawText:null,relativePath:i})}const l=h=>{const i={...h.builtins,...h.options},p={},d={};for(const u of a){const f=u.relativePath;let g,y,m=!1;if(u.binary)g=u.binary;else if(u.isRaw)g=u.rawText??"";else{const $=u.rawText??"",A=we($,T=>Et(T));if(A.frontmatter){if(A.frontmatter.skip!==void 0&&et(A.frontmatter.skip,i,f)||A.frontmatter.if!==void 0&&!et(A.frontmatter.if,i,f))continue;typeof A.frontmatter.to=="string"&&(y=B(A.frontmatter.to,{filename:`${f}#frontmatter.to`,partials:o,scope:i})),A.frontmatter.force===!0&&(m=!0)}g=B(A.body,{filename:f,partials:o,scope:i})}const w=Pe(y??me(ge(f),i));_e(p,w,g),m&&(d[w]={force:!0})}const c={files:p};return Object.keys(d).length>0&&(c.filesMeta=d),c};return{about:{description:n.description??`Moon-format template at ${t}`,name:n.title??e},destination:n.destination,options:r,produce:l}},Re=t=>{const e=ut(t),s=wt(e),n=new Set([s,e]);if(s.startsWith("_")){n.add(s.replace(/^_+/,""));const r=e.slice(0,e.length-s.length);n.add(`${r}${s.replace(/^_+/,"")}`)}return[...n]};export{qe as loadMoonTemplate};
@@ -1,4 +1,4 @@
1
- import{p as s}from"./cli-main.js";import{c as a,f as c}from"../packem_shared/registry-keys-C3EsP_s4.js";const f=async({options:r})=>{if(r.clear){const t=a();if(r.json){process.stdout.write(`${JSON.stringify({cleared:t,refetched:!1},void 0,2)}
1
+ import{p as s}from"./cli-main.js";import{c as a,f as c}from"../packem_shared/registry-keys-DwB3ZXS_.js";const f=async({options:r})=>{if(r.clear){const t=a();if(r.json){process.stdout.write(`${JSON.stringify({cleared:t,refetched:!1},void 0,2)}
2
2
  `);return}s.success(t?"Cleared cached npm signing keys.":"No cached npm signing keys to clear.");return}const e=await c({forceRefresh:!0});if(e===void 0){if(r.json){process.stdout.write(`${JSON.stringify({cleared:!1,error:"fetch-failed",refetched:!1},void 0,2)}
3
3
  `),process.exitCode=1;return}s.error("Failed to fetch npm signing keys (network error and no cached keys available)."),process.exitCode=1;return}if(r.json){process.stdout.write(`${JSON.stringify({cleared:!1,fromCache:e.fromCache,keyCount:e.keys.length,refetched:!e.fromCache,stale:e.stale??!1},void 0,2)}
4
4
  `);return}if(e.fromCache&&e.stale===!0){s.warn(`Network fetch failed — falling back to expired cache (${String(e.keys.length)} keys).`);return}s.success(`Refreshed npm signing keys (${String(e.keys.length)} keys).`)};export{f as default};
@@ -1,4 +1,4 @@
1
- import{v as l,U as a}from"../packem_shared/path-CxEa27Rz-pjheKk6v.js";import{r as m}from"../packem_shared/resolve-runtime-lJ5L9gU4.js";import{r as u}from"../packem_shared/run-file-DZff6GqY.js";const p=s=>{let r,n=!1,o;const i=[];for(let e=0;e<s.length;e+=1){const t=s[e];if(o===void 0){if(t==="--node"){n=!0;continue}if(t==="--runtime"){r=s[e+1],e+=1;continue}if(t.startsWith("--runtime=")){r=t.slice(10);continue}o=t;continue}i.push(t)}return i[0]==="--"&&i.shift(),{file:o,node:n,runtimeFlag:r,scriptArguments:i}},h=async s=>{const{file:r,node:n,runtimeFlag:o,scriptArguments:i}=p(s);if(r===void 0){process.stderr.write(`No file specified. Usage: vis x <file> [args...]
1
+ import{v as l,U as a}from"../packem_shared/index-BzhrR_iC.js";import{r as m}from"../packem_shared/resolve-runtime-CNiHcVtx.js";import{r as u}from"../packem_shared/run-file-UBukWaha.js";const p=s=>{let r,n=!1,o;const i=[];for(let e=0;e<s.length;e+=1){const t=s[e];if(o===void 0){if(t==="--node"){n=!0;continue}if(t==="--runtime"){r=s[e+1],e+=1;continue}if(t.startsWith("--runtime=")){r=t.slice(10);continue}o=t;continue}i.push(t)}return i[0]==="--"&&i.shift(),{file:o,node:n,runtimeFlag:r,scriptArguments:i}},h=async s=>{const{file:r,node:n,runtimeFlag:o,scriptArguments:i}=p(s);if(r===void 0){process.stderr.write(`No file specified. Usage: vis x <file> [args...]
2
2
  `),process.exitCode=1;return}const e=process.cwd(),t=l(r)?r:a(e,r);if(n){const d=await u(t,i,"node",e,{node:!0});d!==0&&(process.exitCode=d);return}let c;try{c=m(e,{flag:o})}catch(d){process.stderr.write(`${d.message}
3
3
  `),process.exitCode=1;return}c.deferredNotice!==void 0&&process.stderr.write(`${c.deferredNotice}
4
4
  `);const f=await u(t,i,c.runtime,e);f!==0&&(process.exitCode=f)};export{p as parseLeanXArgs,h as runLeanX};
@@ -1,3 +1,3 @@
1
- import{createRequire as _}from"node:module";import{x,p as t,y as R}from"./cli-main.js";import{d as P}from"../packem_shared/pm-runner-9L6ocnu2.js";import{a as M}from"../packem_shared/build-scripts-BIgkWVgY.js";import"../packem_shared/index-CVBR-Kit.js";import{e as v}from"../packem_shared/path-CxEa27Rz-pjheKk6v.js";import{y as k}from"../packem_shared/isAccessibleSync-DYKTrrvc-K2xhg6sV.js";import{p as q}from"../packem_shared/readJsonSync-CbryXYxN-BxKjDZnF.js";let j;const B=c=>(j??=_(import.meta.url))(c),y=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,D=c=>{if(typeof y<"u"&&y.versions&&y.versions.node){const[i,f]=y.versions.node.split(".").map(Number);if(i>22||i===22&&f>=3||i===20&&f>=16)return y.getBuiltinModule(c)}return B(c)},{readdirSync:S,statSync:N}=D("node:fs"),T=(c,i={})=>{const f=v(c,"node_modules");if(!k(f))return[];const l=new Map,p=new Set,b=(n,o,r)=>{const e=`${o}@${r}`;if(p.has(e))return;p.add(e);const s=r.startsWith(c)?r.slice(c.length+1):r;let u=l.get(n);u||(u=[],l.set(n,u)),u.some($=>$.name===o)||u.push({name:o,relativePath:s})},m=(n,o="")=>{let r;try{r=S(n)}catch{return}for(const e of r){const s=v(n,e);if(e.startsWith("@")){m(s,`${e}/`);continue}if(e===".pnpm"&&o===""){let a;try{a=S(s)}catch{continue}for(const d of a){const g=v(s,d,"node_modules");k(g)&&m(g)}continue}if(e.startsWith("."))continue;const u=o+e,$=v(s,"package.json");try{if(!N(s).isDirectory()||!k($))continue;const a=q($),d=typeof a.name=="string"?a.name:u;if(typeof a.bin=="string"){const w=d.includes("/")?d.split("/").pop():d;b(w,d,s)}else if(a.bin&&typeof a.bin=="object")for(const w of Object.keys(a.bin))b(w,d,s);const g=v(s,"node_modules");k(g)&&m(g)}catch{}}};m(f);const h=[];for(const[n,o]of l)o.length<2||i[n]===!0||o.every(e=>i[`${e.name}#${n}`]===!0)||h.push({bin:n,packages:o});return h.sort((n,o)=>n.bin.localeCompare(o.bin))},V=new Set(["bun","npm","pnpm","yarn"]),G=({options:c,visConfig:i,workspaceRoot:f})=>{const l=f??process.cwd(),p=P(l),b=i?.security?.policies?.installScripts?.allow??{},m=i?.security?.allowBins??{},h=i?.security?.pinVersions===!0,n=M(l,b,{pinVersions:h}),o=T(l,m),r=i&&V.has(p.name)?x(i,p.name,l):void 0;if(c.json){process.stdout.write(`${JSON.stringify({binConflicts:o,drift:r,excess:n.excess,installed:n.installed.map(e=>({hooks:e.hooks,name:e.name,version:e.version})),packageManager:p.name,pinVersions:h,unapproved:n.unapproved.map(e=>({hooks:e.hooks,name:e.name,version:e.version})),versionDrift:n.versionDrift},void 0,2)}
1
+ import{createRequire as _}from"node:module";import{w as x,p as t,x as R}from"./cli-main.js";import{d as P}from"../packem_shared/pm-runner-CMSml1Bj.js";import{a as M}from"../packem_shared/build-scripts-CEDx_nJp.js";import{e as v}from"../packem_shared/index-BzhrR_iC.js";import{y as w}from"../packem_shared/isAccessibleSync-DYKTrrvc-C-_5cgwu.js";import{p as q}from"../packem_shared/readJsonSync-CbryXYxN-EWl7_7KX.js";let j;const B=c=>(j??=_(import.meta.url))(c),y=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,D=c=>{if(typeof y<"u"&&y.versions&&y.versions.node){const[i,f]=y.versions.node.split(".").map(Number);if(i>22||i===22&&f>=3||i===20&&f>=16)return y.getBuiltinModule(c)}return B(c)},{readdirSync:S,statSync:N}=D("node:fs"),T=(c,i={})=>{const f=v(c,"node_modules");if(!w(f))return[];const l=new Map,p=new Set,b=(n,o,r)=>{const e=`${o}@${r}`;if(p.has(e))return;p.add(e);const s=r.startsWith(c)?r.slice(c.length+1):r;let u=l.get(n);u||(u=[],l.set(n,u)),u.some($=>$.name===o)||u.push({name:o,relativePath:s})},m=(n,o="")=>{let r;try{r=S(n)}catch{return}for(const e of r){const s=v(n,e);if(e.startsWith("@")){m(s,`${e}/`);continue}if(e===".pnpm"&&o===""){let a;try{a=S(s)}catch{continue}for(const d of a){const g=v(s,d,"node_modules");w(g)&&m(g)}continue}if(e.startsWith("."))continue;const u=o+e,$=v(s,"package.json");try{if(!N(s).isDirectory()||!w($))continue;const a=q($),d=typeof a.name=="string"?a.name:u;if(typeof a.bin=="string"){const k=d.includes("/")?d.split("/").pop():d;b(k,d,s)}else if(a.bin&&typeof a.bin=="object")for(const k of Object.keys(a.bin))b(k,d,s);const g=v(s,"node_modules");w(g)&&m(g)}catch{}}};m(f);const h=[];for(const[n,o]of l)o.length<2||i[n]===!0||o.every(e=>i[`${e.name}#${n}`]===!0)||h.push({bin:n,packages:o});return h.sort((n,o)=>n.bin.localeCompare(o.bin))},V=new Set(["bun","npm","pnpm","yarn"]),F=({options:c,visConfig:i,workspaceRoot:f})=>{const l=f??process.cwd(),p=P(l),b=i?.security?.policies?.installScripts?.allow??{},m=i?.security?.allowBins??{},h=i?.security?.pinVersions===!0,n=M(l,b,{pinVersions:h}),o=T(l,m),r=i&&V.has(p.name)?x(i,p.name,l):void 0;if(c.json){process.stdout.write(`${JSON.stringify({binConflicts:o,drift:r,excess:n.excess,installed:n.installed.map(e=>({hooks:e.hooks,name:e.name,version:e.version})),packageManager:p.name,pinVersions:h,unapproved:n.unapproved.map(e=>({hooks:e.hooks,name:e.name,version:e.version})),versionDrift:n.versionDrift},void 0,2)}
2
2
  `);return}if(t.info(`Build-script status (${p.name}):
3
- `),n.installed.length===0&&n.unapproved.length===0&&t.success(" No installed packages declare lifecycle scripts."),n.installed.length>0){t.success(` Approved (${String(n.installed.length)}):`);for(const e of n.installed)t.info(` ✓ ${e.name} — ${e.hooks.join(", ")}`)}if(n.unapproved.length>0){t.info(""),t.warn(` Unapproved (${String(n.unapproved.length)}):`);for(const e of n.unapproved)t.info(` ✗ ${e.name} — ${e.hooks.join(", ")}`);t.notice(" Run 'vis approve-builds' to review.")}if(n.excess.length>0){t.info(""),t.warn(` Stale allowlist entries (${String(n.excess.length)}):`);for(const e of n.excess)t.info(` ! ${e}`);t.notice(" Remove these from vis.config.ts security.policies.installScripts.allow.")}if(n.versionDrift.length>0){t.info(""),t.warn(` Version drift (pinVersions: true) — ${String(n.versionDrift.length)} entr${n.versionDrift.length===1?"y":"ies"} point at outdated versions:`);for(const{from:e,to:s}of n.versionDrift)t.info(` ${e} → ${s}`);t.notice(" Update vis.config.ts security.policies.installScripts.allow keys to migrate.")}if(o.length>0){t.info(""),t.warn(` Bin conflicts (${String(o.length)}) — multiple packages expose the same bin name:`);for(const e of o)t.info(` ${e.bin} ← ${e.packages.map(s=>s.name).join(", ")}`);t.notice(" Add the bin (or 'pkg#bin') to vis.config.ts security.allowBins to silence this.")}if(r?.hasDrift){t.info("");for(const e of R(r))t.warn(e)}};export{G as default};
3
+ `),n.installed.length===0&&n.unapproved.length===0&&t.success(" No installed packages declare lifecycle scripts."),n.installed.length>0){t.success(` Approved (${String(n.installed.length)}):`);for(const e of n.installed)t.info(` ✓ ${e.name} — ${e.hooks.join(", ")}`)}if(n.unapproved.length>0){t.info(""),t.warn(` Unapproved (${String(n.unapproved.length)}):`);for(const e of n.unapproved)t.info(` ✗ ${e.name} — ${e.hooks.join(", ")}`);t.notice(" Run 'vis approve-builds' to review.")}if(n.excess.length>0){t.info(""),t.warn(` Stale allowlist entries (${String(n.excess.length)}):`);for(const e of n.excess)t.info(` ! ${e}`);t.notice(" Remove these from vis.config.ts security.policies.installScripts.allow.")}if(n.versionDrift.length>0){t.info(""),t.warn(` Version drift (pinVersions: true) — ${String(n.versionDrift.length)} entr${n.versionDrift.length===1?"y":"ies"} point at outdated versions:`);for(const{from:e,to:s}of n.versionDrift)t.info(` ${e} → ${s}`);t.notice(" Update vis.config.ts security.policies.installScripts.allow keys to migrate.")}if(o.length>0){t.info(""),t.warn(` Bin conflicts (${String(o.length)}) — multiple packages expose the same bin name:`);for(const e of o)t.info(` ${e.bin} ← ${e.packages.map(s=>s.name).join(", ")}`);t.notice(" Add the bin (or 'pkg#bin') to vis.config.ts security.allowBins to silence this.")}if(r?.hasDrift){t.info("");for(const e of R(r))t.warn(e)}};export{F as default};
@@ -1,4 +1,4 @@
1
- import{createRequire as f}from"node:module";import{d as p,c as I}from"../packem_shared/pm-runner-9L6ocnu2.js";let _;const w=e=>(_??=f(import.meta.url))(e),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,g=e=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[t,r]=o.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return o.getBuiltinModule(e)}return w(e)},{createInterface:y}=g("node:readline"),s="sigstore",v=()=>!!process.stdout.isTTY&&process.env.CI!=="true",$=e=>new Promise(t=>{const r=y({input:process.stdin,output:process.stderr});r.question(`${e} (Y/n) `,a=>{r.close();const n=a.trim().toLowerCase();t(n===""||n==="y"||n==="yes")})}),h=e=>{const t=p(e),r=I(t,{exact:!1,filter:[],global:!1,optional:!1,packages:[s],peer:!1,saveDev:!0,workspace:!1,workspaceRoot:!1},e,console);return Promise.resolve({exitCode:r})},C=()=>{try{return import.meta.resolve(s),!0}catch{return!1}},R=e=>{let t="pnpm";try{t=p(e).name}catch{}switch(t){case"bun":return`bun add -d ${s}`;case"npm":return`npm install -D ${s}`;case"yarn":return`yarn add -D ${s}`;default:return`pnpm add -D ${s}`}},D=()=>import("sigstore"),E=async(e={})=>{const t=e.interactive??v(),r=e.prompt??$,a=e.runInstall??h,n=e.importImpl??D,l=e.workspaceRoot??process.cwd(),i=R(l);try{return await n()}catch(d){const{code:u,message:m}=d;if(!(u==="ERR_MODULE_NOT_FOUND"||u==="MODULE_NOT_FOUND")||!m.includes(s))throw d}if(!t)throw new Error(`${s} is not installed. \`vis attest\` needs it for keyless signing/verification. Install it in your repo first:
1
+ import{createRequire as f}from"node:module";import{d as p,c as I}from"../packem_shared/pm-runner-CMSml1Bj.js";let _;const w=e=>(_??=f(import.meta.url))(e),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,g=e=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[t,r]=o.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return o.getBuiltinModule(e)}return w(e)},{createInterface:y}=g("node:readline"),s="sigstore",v=()=>!!process.stdout.isTTY&&process.env.CI!=="true",$=e=>new Promise(t=>{const r=y({input:process.stdin,output:process.stderr});r.question(`${e} (Y/n) `,a=>{r.close();const n=a.trim().toLowerCase();t(n===""||n==="y"||n==="yes")})}),h=e=>{const t=p(e),r=I(t,{exact:!1,filter:[],global:!1,optional:!1,packages:[s],peer:!1,saveDev:!0,workspace:!1,workspaceRoot:!1},e,console);return Promise.resolve({exitCode:r})},C=()=>{try{return import.meta.resolve(s),!0}catch{return!1}},R=e=>{let t="pnpm";try{t=p(e).name}catch{}switch(t){case"bun":return`bun add -d ${s}`;case"npm":return`npm install -D ${s}`;case"yarn":return`yarn add -D ${s}`;default:return`pnpm add -D ${s}`}},D=()=>import("sigstore"),E=async(e={})=>{const t=e.interactive??v(),r=e.prompt??$,a=e.runInstall??h,n=e.importImpl??D,l=e.workspaceRoot??process.cwd(),i=R(l);try{return await n()}catch(d){const{code:u,message:m}=d;if(!(u==="ERR_MODULE_NOT_FOUND"||u==="MODULE_NOT_FOUND")||!m.includes(s))throw d}if(!t)throw new Error(`${s} is not installed. \`vis attest\` needs it for keyless signing/verification. Install it in your repo first:
2
2
  ${i}`);if(!await r(`${s} isn't installed. Install it now?`))throw new Error(`${s} install declined. Re-run \`vis attest\` after installing manually:
3
3
  ${i}`);const c=await a(l);if(c.exitCode!==0)throw new Error(`Install of ${s} failed (exit ${String(c.exitCode)}). Install manually and retry:
4
4
  ${i}`);return await n()};export{R as installCommandFor,C as isSigstoreInstalled,E as loadOptionalSigstore};
@@ -0,0 +1 @@
1
+ import{createRequire as I}from"node:module";import{s as $,d as k,i as R,b as N}from"../packem_shared/maven-pom-B0KG9kJQ.js";import{VisReleaseError as g}from"../packem_shared/VisReleaseError-DZtgcKf8.js";let b;const M=n=>(b??=I(import.meta.url))(n),p=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,P=n=>{if(typeof p<"u"&&p.versions&&p.versions.node){const[o,t]=p.versions.node.split(".").map(Number);if(o>22||o===22&&t>=3||o===20&&t>=16)return p.getBuiltinModule(n)}return M(n)},{readFile:V}=P("node:fs/promises"),y=n=>`${n.owner}\0${n.property===void 0?"version":`property:${n.property}`}`,_=async(n,o)=>n.get(o)??V(o,"utf8"),q=(n,o,t)=>{const c=$(n),a=o.property===void 0?c.version:c.properties.get(o.property);if(a===void 0){const f=o.property===void 0?"a literal <version>":`a <properties> entry ${o.property}`;throw new g({code:"CONFIG_INVALID",file:o.owner,message:`${o.owner} has no ${f} to bump for ${o.name}.`})}return N(n,[{slot:a,value:t}])},j=async n=>{const{pending:o,projects:t,releases:c}=n,a=new Set,f=new Set(t.map(e=>e.name));for(const e of c)if(!f.has(e.name))throw new g({code:"CONFIG_INVALID",message:`${e.name} is planned as a Maven release, but no Maven module with that name was discovered. Re-run the release from a fresh context.`,packageName:e.name});const u=new Map(c.map(e=>[e.name,e.newVersion])),v=new Map;for(const e of t){const s=y(e);v.set(s,[...v.get(s)??[],e])}const h=new Set;for(const e of t){const s=u.get(e.name),i=y(e);if(s===void 0||h.has(i))continue;h.add(i);const d=(v.get(i)??[]).filter(r=>u.get(r.name)!==s);if(d.length>0)throw new g({code:"CONFIG_INVALID",file:e.owner,message:`Maven modules share the version at ${e.owner}, so they must release together at ${s}. Not released at that version: ${d.map(r=>r.name).join(", ")}.`});const l=await _(o,e.owner);o.set(e.owner,q(l,e,s)),a.add(e.owner)}for(const e of t){const s=await _(o,e.manifestPath),i=$(s),m=[];for(const d of i.dependencies){const l=k(i,d),r=d.version,w=l===void 0?void 0:u.get(l);w!==void 0&&r!==void 0&&R(r.value)&&r.value!==w&&m.push({slot:r,value:w})}m.length>0&&(o.set(e.manifestPath,N(s,m)),a.add(e.manifestPath))}return a};export{j as planMavenWorkspace};
@@ -0,0 +1 @@
1
+ import{createRequire as R}from"node:module";import{e as k,d as N,i as T,s as E,a as $}from"../packem_shared/maven-pom-B0KG9kJQ.js";import{VisReleaseError as F}from"../packem_shared/VisReleaseError-DZtgcKf8.js";let j;const S=t=>(j??=R(import.meta.url))(t),p=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,I=t=>{if(typeof p<"u"&&p.versions&&p.versions.node){const[a,n]=p.versions.node.split(".").map(Number);if(a>22||a===22&&n>=3||a===20&&n>=16)return p.getBuiltinModule(t)}return S(t)},{readFile:q}=I("node:fs/promises"),{resolve:v,dirname:m}=I("node:path"),M=/^\$\{([^}]+)\}$/,O=async t=>{try{return await q(t,"utf8")}catch{return}},y=async t=>{const a=await O(t);return a===void 0?void 0:{manifestPath:t,scan:E(a)}},g=async t=>{const a=t.scan.parent;if(!a)return;const n=a.relativePath||"../pom.xml",f=n.endsWith(".xml")?v(m(t.manifestPath),n):v(m(t.manifestPath),n,"pom.xml"),s=await y(f);return s&&s.scan.artifactId?.value===a.artifactId?.value&&k(s.scan)===a.groupId?.value?s:void 0},l=(t,a)=>new F({code:"CONFIG_INVALID",file:t,message:a}),b=async(t,a=new Set)=>{const{manifestPath:n,scan:f}=t;if(a.has(n))throw l(n,`${n} is part of a parent cycle; vis cannot resolve its version.`);if(!f.version){const d=await g(t);if(!d)throw l(n,`${n} has no <version>, and its <parent> is not a pom on disk with matching coordinates.`);const e=await b(d,new Set([...a,n]));return e.kind==="literal"?{...e,kind:"inherited"}:e}const s=f.version.value,c=M.exec(s)?.[1];if(c===void 0){if(s===""||$(s))throw l(n,`${n} has an unresolvable <version> "${s}".`);return{kind:"literal",owner:n,version:s}}let r=t;const h=new Set;for(;r&&!h.has(r.manifestPath);){h.add(r.manifestPath);const d=r.scan.properties.get(c);if(d!==void 0){if(d.value===""||$(d.value))break;return{kind:"property",owner:r.manifestPath,property:c,version:d.value}}r=await g(r)}throw l(n,`${n} has version \${${c}}, but no literal <properties> entry ${c} in it or its parents.`)},G=async t=>{const{claimedDirs:a,cwd:n}=t,f=await y(v(n,"pom.xml"));if(!f)return[];const s=[],c=new Set,r=async e=>{if(!c.has(e.manifestPath)){c.add(e.manifestPath),s.push(e);for(const o of e.scan.modules){const i=v(m(e.manifestPath),o,"pom.xml"),u=await y(i);if(!u)throw l(e.manifestPath,`${e.manifestPath} lists module "${o}", but ${i} does not exist.`);await r(u)}}};await r(f);const h=[];for(const e of s){if(a.has(v(m(e.manifestPath))))continue;const o=k(e.scan),i=e.scan.artifactId?.value;if(o===void 0)throw l(e.manifestPath,`${e.manifestPath} has no groupId, and its <parent> does not supply one.`);if(i===void 0||i==="")throw l(e.manifestPath,`${e.manifestPath} has no <artifactId>.`);h.push({name:`${o}:${i}`,pom:e,version:await b(e)})}const d=new Set(h.map(e=>e.name));return h.map(({name:e,pom:o,version:i})=>{const u={};for(const _ of o.scan.dependencies){const w=N(o.scan,_),P=_.version?.value;w!==void 0&&P!==void 0&&d.has(w)&&(u[w]=T(P)?P:"*")}const x={dependencies:u,name:e,private:!1,version:i.version};return{kind:i.kind,manifestPath:o.manifestPath,name:e,owner:i.owner,package:{dir:m(o.manifestPath),ecosystem:"maven",manifest:x,manifestPath:o.manifestPath,name:e,private:!1,version:i.version},...i.property===void 0?{}:{property:i.property}}})};export{G as discoverMavenProjects};
@@ -0,0 +1 @@
1
+ import{createRequire as _}from"node:module";import{a as I,N as v}from"../packem_shared/nuget-project-RApYSW_y.js";import{VisReleaseError as m}from"../packem_shared/VisReleaseError-DZtgcKf8.js";let N;const j=o=>(N??=_(import.meta.url))(o),a=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,y=o=>{if(typeof a<"u"&&a.versions&&a.versions.node){const[r,s]=a.versions.node.split(".").map(Number);if(r>22||r===22&&s>=3||r===20&&s>=16)return a.getBuiltinModule(o)}return j(o)},{readFile:G}=y("node:fs/promises"),w=o=>`${o.owner}\0${o.line}`,k=async o=>{const{pending:r,projects:s,releases:p}=o,l=new Set,g=new Set(s.map(e=>e.name));for(const e of p)if(!g.has(e.name))throw new m({code:"CONFIG_INVALID",message:`${e.name} is planned as a NuGet release, but no NuGet project with that name was discovered. Re-run the release from a fresh context.`,packageName:e.name});const d=new Map(p.map(e=>[e.name,e.newVersion])),i=new Map;for(const e of s){const t=w(e);i.set(t,[...i.get(t)??[],e])}const u=new Set;for(const e of s){const t=d.get(e.name),c=w(e);if(t===void 0||u.has(c))continue;u.add(c);const f=(i.get(c)??[]).filter(n=>d.get(n.name)!==t);if(f.length>0)throw new m({code:"CONFIG_INVALID",file:e.owner,message:`NuGet projects share the version declared at ${e.owner}:${e.line}, so they must release together at ${t}. Not released at that version: ${f.map(n=>n.name).join(", ")}.`});const h=r.get(e.owner)??await G(e.owner,"utf8");try{r.set(e.owner,I(h,e.owner,"Version",e.line,t))}catch(n){throw n instanceof v?new m({code:"CONFIG_INVALID",file:n.file,message:n.message}):n}l.add(e.owner)}return l};export{k as planNuGetWorkspace};
@@ -0,0 +1 @@
1
+ import{createRequire as C}from"node:module";import{h as N,m as R,N as X,r as Z}from"../packem_shared/nuget-project-RApYSW_y.js";import{VisReleaseError as J}from"../packem_shared/VisReleaseError-DZtgcKf8.js";import{isValidPackageName as K}from"./security.js";let D;const q=t=>(D??=C(import.meta.url))(t),v=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,S=t=>{if(typeof v<"u"&&v.versions&&v.versions.node){const[s,i]=v.versions.node.split(".").map(Number);if(s>22||s===22&&i>=3||s===20&&i>=16)return v.getBuiltinModule(t)}return q(t)},{readFile:_,readdir:G,access:L}=S("node:fs/promises"),{resolve:E,dirname:w,basename:O,extname:T,join:x,sep:W}=S("node:path"),U=new Set([".csproj",".fsproj"]),z=new Set(["bin","node_modules","obj"]),H=/^\d+(?:\.\d+){0,3}(?:-[0-9A-Z.-]+)?(?:\+[0-9A-Z.-]+)?$/i,Q=[{message:"sets the package version through PackageVersion, which vis does not read",name:"PackageVersion"},{message:"sets VersionPrefix or VersionSuffix, which vis does not read (use a plain Version literal)",name:"VersionPrefix"},{message:"sets VersionSuffix, which vis does not read (use a plain Version literal)",name:"VersionSuffix"},{message:"imports another file, which vis does not read",name:"Import"}],u=(t,s,i)=>new J({code:"CONFIG_INVALID",file:t,message:s,packageName:i}),F=t=>{try{return t()}catch(s){throw s instanceof X?u(s.file,s.message):s}},Y=t=>L(t).then(()=>!0,()=>!1),I=async(t,s,i)=>{let o=t;for(;;){const r=x(o,i);if(await Y(r))return r;const g=w(o);if(o===s||g===o)return;o=g}},ee=(t,s)=>t===s||t.startsWith(`${s}${W}`),M=async(t,s)=>{if([...s].some(o=>ee(t,o)))return[];const i=[];for(const o of await G(t,{withFileTypes:!0})){const r=x(t,o.name);o.isDirectory()?!z.has(o.name)&&!o.name.startsWith(".")&&i.push(...await M(r,s)):o.isFile()&&U.has(T(o.name))&&i.push(r)}return[...i].sort()},p=(t,s,i)=>{const o=F(()=>Z(t,s,i));if(o.length>1)throw u(s,`${s} sets ${i} ${o.length} times (lines ${o.map(r=>r.line).join(", ")}). vis cannot tell which one applies.`);return o[0]},re=async t=>{const s=E(t.cwd),i=await M(s,t.claimedDirs),o=[];for(const e of i){const n=await _(e,"utf8"),a=await I(w(e),s,"Directory.Build.props"),c=a===void 0?void 0:await _(a,"utf8"),l=await I(w(e),s,"Directory.Build.targets"),k=l===void 0?void 0:await _(l,"utf8");for(const[d,f]of[[e,n],[a,c]])if(!(d===void 0||f===void 0)){for(const b of Q)if(N(f,b.name))throw u(d,`${d} ${b.message}. Remove it, or release this project with a shell publish.`)}if(l!==void 0&&k!==void 0&&N(k,"Version"))throw u(l,`${l} sets Version, which MSBuild applies after the project file. vis cannot follow that to a version; remove it, or release with a shell publish.`);if(F(()=>p(n,e,"IsPackable")??(c===void 0||a===void 0?void 0:p(c,a,"IsPackable")))?.value.toLowerCase()==="false"||p(n,e,"IsTestProject")?.value.toLowerCase()==="true"||/<PackageReference\s+Include="Microsoft\.NET\.Test\.Sdk"/i.test(R(n)))continue;const P=p(n,e,"Version"),V=c===void 0||a===void 0?void 0:p(c,a,"Version");if(P===void 0&&V===void 0)continue;const A=P===void 0?"inherited":"literal",j=P===void 0?a:e,h=P??V;if(!H.test(h.value))throw u(j,`${j} sets Version to "${h.value}". vis reads only a plain literal such as 1.2.0 or 1.2.0-beta.1, not an MSBuild expression.`);const $=d=>{const f=p(n,e,d)??(c===void 0||a===void 0?void 0:p(c,a,d));if(f!==void 0){if(f.value===""||f.value.includes("$("))throw u(e,`${e} sets ${d} to "${f.value}". vis reads only a plain literal for a package id.`);return f.value}},y=$("PackageId")??$("AssemblyName")??O(e,T(e)),m=y.toLowerCase();if(!K(m))throw u(e,`${e} names the package "${y}", which is not a valid package name (lowercase letters, digits, ".", "_" and "-").`,m);const B=[...R(n).matchAll(/<ProjectReference\s+Include="([^"]+)"/g)].map(d=>E(w(e),(d[1]??"").replaceAll("\\","/")));o.push({entry:{kind:A,line:h.line,name:m,owner:j,package:{dir:w(e),ecosystem:"nuget",manifest:{dependencies:{},name:m,private:!1,version:h.value},manifestPath:e,name:m,private:!1,version:h.value},projectPath:e},references:B})}const r=new Map;for(const{entry:e}of o){const n=r.get(e.name);if(n!==void 0)throw u(e.projectPath,`${e.name} is declared by both ${n} and ${e.projectPath}. NuGet ids compare case-insensitively, so they must be unique to release them.`,e.name);r.set(e.name,e.projectPath)}const g=new Map(o.map(({entry:e})=>[e.projectPath,e.name]));return o.map(({entry:e,references:n})=>{const a={};for(const c of n){const l=g.get(c);l!==void 0&&l!==e.name&&(a[l]="*")}return{...e,package:{...e.package,manifest:{...e.package.manifest,dependencies:a}}}})};export{re as discoverNuGetProjects};