fundus 0.9.1 → 0.11.0

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 (239) hide show
  1. package/README.md +64 -0
  2. package/build/client/_app/immutable/assets/2.6TBn1n3x.css +1 -0
  3. package/build/client/_app/immutable/assets/2.6TBn1n3x.css.br +0 -0
  4. package/build/client/_app/immutable/assets/2.6TBn1n3x.css.gz +0 -0
  5. package/build/client/_app/immutable/assets/3.BuCXJbRG.css +1 -0
  6. package/build/client/_app/immutable/assets/3.BuCXJbRG.css.br +0 -0
  7. package/build/client/_app/immutable/assets/3.BuCXJbRG.css.gz +0 -0
  8. package/build/client/_app/immutable/assets/4.C0QkCMQ4.css +1 -0
  9. package/build/client/_app/immutable/assets/4.C0QkCMQ4.css.br +0 -0
  10. package/build/client/_app/immutable/assets/4.C0QkCMQ4.css.gz +0 -0
  11. package/build/client/_app/immutable/assets/Popover.Et4sBRbI.css +1 -0
  12. package/build/client/_app/immutable/assets/Popover.Et4sBRbI.css.br +0 -0
  13. package/build/client/_app/immutable/assets/Popover.Et4sBRbI.css.gz +0 -0
  14. package/build/client/_app/immutable/chunks/BAva9YXm.js +1 -0
  15. package/build/client/_app/immutable/chunks/BAva9YXm.js.br +0 -0
  16. package/build/client/_app/immutable/chunks/BAva9YXm.js.gz +0 -0
  17. package/build/client/_app/immutable/chunks/BGAUmugt.js +1 -0
  18. package/build/client/_app/immutable/chunks/BGAUmugt.js.br +0 -0
  19. package/build/client/_app/immutable/chunks/BGAUmugt.js.gz +0 -0
  20. package/build/client/_app/immutable/chunks/BMORe2Gb.js +3 -0
  21. package/build/client/_app/immutable/chunks/BMORe2Gb.js.br +0 -0
  22. package/build/client/_app/immutable/chunks/BMORe2Gb.js.gz +0 -0
  23. package/build/client/_app/immutable/chunks/CBygkKLq.js +1 -0
  24. package/build/client/_app/immutable/chunks/CBygkKLq.js.br +0 -0
  25. package/build/client/_app/immutable/chunks/CBygkKLq.js.gz +0 -0
  26. package/build/client/_app/immutable/chunks/Cil0r9BR.js +108 -0
  27. package/build/client/_app/immutable/chunks/Cil0r9BR.js.br +0 -0
  28. package/build/client/_app/immutable/chunks/Cil0r9BR.js.gz +0 -0
  29. package/build/client/_app/immutable/chunks/D-p-QSzz.js +1 -0
  30. package/build/client/_app/immutable/chunks/D-p-QSzz.js.br +0 -0
  31. package/build/client/_app/immutable/chunks/D-p-QSzz.js.gz +0 -0
  32. package/build/client/_app/immutable/chunks/D15yxLq9.js +1 -0
  33. package/build/client/_app/immutable/chunks/D15yxLq9.js.br +0 -0
  34. package/build/client/_app/immutable/chunks/D15yxLq9.js.gz +0 -0
  35. package/build/client/_app/immutable/chunks/DFRlZOKz.js +2 -0
  36. package/build/client/_app/immutable/chunks/DFRlZOKz.js.br +0 -0
  37. package/build/client/_app/immutable/chunks/DFRlZOKz.js.gz +0 -0
  38. package/build/client/_app/immutable/chunks/{BFccgFID.js → DpFtnEPx.js} +1 -1
  39. package/build/client/_app/immutable/chunks/DpFtnEPx.js.br +4 -0
  40. package/build/client/_app/immutable/chunks/DpFtnEPx.js.gz +0 -0
  41. package/build/client/_app/immutable/entry/app.BaP08B0_.js +2 -0
  42. package/build/client/_app/immutable/entry/app.BaP08B0_.js.br +0 -0
  43. package/build/client/_app/immutable/entry/app.BaP08B0_.js.gz +0 -0
  44. package/build/client/_app/immutable/entry/start.DntfygIK.js +1 -0
  45. package/build/client/_app/immutable/entry/start.DntfygIK.js.br +0 -0
  46. package/build/client/_app/immutable/entry/start.DntfygIK.js.gz +0 -0
  47. package/build/client/_app/immutable/nodes/0.6A6JK0Xm.js +1 -0
  48. package/build/client/_app/immutable/nodes/0.6A6JK0Xm.js.br +0 -0
  49. package/build/client/_app/immutable/nodes/0.6A6JK0Xm.js.gz +0 -0
  50. package/build/client/_app/immutable/nodes/1.8K7wLW9R.js +1 -0
  51. package/build/client/_app/immutable/nodes/1.8K7wLW9R.js.br +0 -0
  52. package/build/client/_app/immutable/nodes/1.8K7wLW9R.js.gz +0 -0
  53. package/build/client/_app/immutable/nodes/2.CB_PeUBC.js +3 -0
  54. package/build/client/_app/immutable/nodes/2.CB_PeUBC.js.br +0 -0
  55. package/build/client/_app/immutable/nodes/2.CB_PeUBC.js.gz +0 -0
  56. package/build/client/_app/immutable/nodes/3.qIkVQyP6.js +1 -0
  57. package/build/client/_app/immutable/nodes/3.qIkVQyP6.js.br +0 -0
  58. package/build/client/_app/immutable/nodes/3.qIkVQyP6.js.gz +0 -0
  59. package/build/client/_app/immutable/nodes/4.SmoVIy5D.js +2 -0
  60. package/build/client/_app/immutable/nodes/4.SmoVIy5D.js.br +0 -0
  61. package/build/client/_app/immutable/nodes/4.SmoVIy5D.js.gz +0 -0
  62. package/build/client/_app/version.json +1 -1
  63. package/build/client/_app/version.json.br +0 -0
  64. package/build/client/_app/version.json.gz +0 -0
  65. package/build/handler.js +7 -7
  66. package/build/index.js +7 -7
  67. package/build/server/chunks/chunks/{context.js-mXbNUDBD.js → context.js-BJfk3ZiR.js} +440 -6
  68. package/build/server/chunks/chunks/context.js-BJfk3ZiR.js.map +1 -0
  69. package/build/server/chunks/chunks/{contract.js-BCXeXDmU.js → contract.js-DRcxzb4o.js} +33 -13
  70. package/build/server/chunks/chunks/contract.js-DRcxzb4o.js.map +1 -0
  71. package/build/server/chunks/chunks/{exports.js-xvDCCOrG.js → exports.js-aVVdkXgn.js} +2 -2
  72. package/build/server/chunks/chunks/{exports.js-xvDCCOrG.js.map → exports.js-aVVdkXgn.js.map} +1 -1
  73. package/build/server/chunks/chunks/{http.js-BHghHRmI.js → http.js-DMkgmpI5.js} +2 -2
  74. package/build/server/chunks/chunks/{http.js-BHghHRmI.js.map → http.js-DMkgmpI5.js.map} +1 -1
  75. package/build/server/chunks/chunks/{internal.js-Dqy56Bi9.js → internal.js-C6cIfe5d.js} +3 -3
  76. package/build/server/chunks/chunks/{internal.js-Dqy56Bi9.js.map → internal.js-C6cIfe5d.js.map} +1 -1
  77. package/build/server/chunks/chunks/internal2.js-BlXt2rfE.js.map +1 -1
  78. package/build/server/chunks/chunks/{shared.js-CHSvdnOT.js → shared.js-BNd0HSxp.js} +2 -2
  79. package/build/server/chunks/chunks/{shared.js-CHSvdnOT.js.map → shared.js-BNd0HSxp.js.map} +1 -1
  80. package/build/server/chunks/chunks/{utils.js-Chb8lDKD.js → utils.js-6HSqnONB.js} +3 -3
  81. package/build/server/chunks/chunks/{utils.js-Chb8lDKD.js.map → utils.js-6HSqnONB.js.map} +1 -1
  82. package/build/server/chunks/entries/endpoints/api/_...path_/{_server.ts.js-CN1hcfLb.js → _server.ts.js-m2QGyBiV.js} +3 -3
  83. package/build/server/chunks/entries/endpoints/api/_...path_/{_server.ts.js-CN1hcfLb.js.map → _server.ts.js-m2QGyBiV.js.map} +1 -1
  84. package/build/server/chunks/entries/endpoints/api/assets/_id_/{_server.ts.js-D_LU4nrh.js → _server.ts.js-eMNgdaf4.js} +4 -4
  85. package/build/server/chunks/entries/endpoints/api/assets/_id_/{_server.ts.js-D_LU4nrh.js.map → _server.ts.js-eMNgdaf4.js.map} +1 -1
  86. package/build/server/chunks/entries/endpoints/api/assets/_id_/raw/{_server.ts.js-BY9NgKmC.js → _server.ts.js-CEQd4Wxn.js} +4 -4
  87. package/build/server/chunks/entries/endpoints/api/assets/_id_/raw/{_server.ts.js-BY9NgKmC.js.map → _server.ts.js-CEQd4Wxn.js.map} +1 -1
  88. package/build/server/chunks/entries/endpoints/api/assets/_id_/reimport/{_server.ts.js-D2uPmOzD.js → _server.ts.js-B2JoGCzy.js} +4 -4
  89. package/build/server/chunks/entries/endpoints/api/assets/_id_/reimport/{_server.ts.js-D2uPmOzD.js.map → _server.ts.js-B2JoGCzy.js.map} +1 -1
  90. package/build/server/chunks/entries/endpoints/api/assets/{_server.ts.js-CCsQkuSA.js → _server.ts.js-DTpkVywC.js} +4 -4
  91. package/build/server/chunks/entries/endpoints/api/assets/{_server.ts.js-CCsQkuSA.js.map → _server.ts.js-DTpkVywC.js.map} +1 -1
  92. package/build/server/chunks/entries/endpoints/api/assets/delete/{_server.ts.js-CFVRCJTe.js → _server.ts.js-D6Z_pGEZ.js} +4 -4
  93. package/build/server/chunks/entries/endpoints/api/assets/delete/{_server.ts.js-CFVRCJTe.js.map → _server.ts.js-D6Z_pGEZ.js.map} +1 -1
  94. package/build/server/chunks/entries/endpoints/api/assets/move/{_server.ts.js-DTDSQlpi.js → _server.ts.js-CnDi9p0a.js} +4 -4
  95. package/build/server/chunks/entries/endpoints/api/assets/move/{_server.ts.js-DTDSQlpi.js.map → _server.ts.js-CnDi9p0a.js.map} +1 -1
  96. package/build/server/chunks/entries/endpoints/api/folders/_path_/{_server.ts.js-DrunH7kn.js → _server.ts.js-BCzuPX5Z.js} +4 -4
  97. package/build/server/chunks/entries/endpoints/api/folders/_path_/{_server.ts.js-DrunH7kn.js.map → _server.ts.js-BCzuPX5Z.js.map} +1 -1
  98. package/build/server/chunks/entries/endpoints/api/folders/{_server.ts.js-jskTD8nZ.js → _server.ts.js-CGbYyJ6S.js} +4 -4
  99. package/build/server/chunks/entries/endpoints/api/folders/{_server.ts.js-jskTD8nZ.js.map → _server.ts.js-CGbYyJ6S.js.map} +1 -1
  100. package/build/server/chunks/entries/endpoints/api/imports/{_server.ts.js-DEXkS6pQ.js → _server.ts.js-CL_89klb.js} +4 -4
  101. package/build/server/chunks/entries/endpoints/api/imports/{_server.ts.js-DEXkS6pQ.js.map → _server.ts.js-CL_89klb.js.map} +1 -1
  102. package/build/server/chunks/entries/endpoints/api/manifests/_name_/{_server.ts.js-baLtBCf4.js → _server.ts.js-DZUKtjz9.js} +4 -4
  103. package/build/server/chunks/entries/endpoints/api/manifests/_name_/{_server.ts.js-baLtBCf4.js.map → _server.ts.js-DZUKtjz9.js.map} +1 -1
  104. package/build/server/chunks/entries/endpoints/api/manifests/{_server.ts.js-1Cx7sbfQ.js → _server.ts.js-Dz25LG_P.js} +4 -4
  105. package/build/server/chunks/entries/endpoints/api/manifests/{_server.ts.js-1Cx7sbfQ.js.map → _server.ts.js-Dz25LG_P.js.map} +1 -1
  106. package/build/server/chunks/entries/endpoints/api/raw/adopt/{_server.ts.js-Xc7glEPl.js → _server.ts.js-C-NuN3JJ.js} +4 -4
  107. package/build/server/chunks/entries/endpoints/api/raw/adopt/{_server.ts.js-Xc7glEPl.js.map → _server.ts.js-C-NuN3JJ.js.map} +1 -1
  108. package/build/server/chunks/entries/endpoints/api/raw/edited/accept/{_server.ts.js-C7IxpaSj.js → _server.ts.js-CwL9UPh3.js} +4 -4
  109. package/build/server/chunks/entries/endpoints/api/raw/edited/accept/{_server.ts.js-C7IxpaSj.js.map → _server.ts.js-CwL9UPh3.js.map} +1 -1
  110. package/build/server/chunks/entries/endpoints/api/raw/edited/dismiss/{_server.ts.js-DLZkdOrS.js → _server.ts.js-DanXYrj1.js} +4 -4
  111. package/build/server/chunks/entries/endpoints/api/raw/edited/dismiss/{_server.ts.js-DLZkdOrS.js.map → _server.ts.js-DanXYrj1.js.map} +1 -1
  112. package/build/server/chunks/entries/endpoints/api/reconcile/{_server.ts.js-CSS2DDb1.js → _server.ts.js-BZrun0up.js} +4 -4
  113. package/build/server/chunks/entries/endpoints/api/reconcile/{_server.ts.js-CSS2DDb1.js.map → _server.ts.js-BZrun0up.js.map} +1 -1
  114. package/build/server/chunks/entries/endpoints/api/reveal/{_server.ts.js-CrXh2YL-.js → _server.ts.js-DQOabHbS.js} +4 -4
  115. package/build/server/chunks/entries/endpoints/api/reveal/{_server.ts.js-CrXh2YL-.js.map → _server.ts.js-DQOabHbS.js.map} +1 -1
  116. package/build/server/chunks/entries/endpoints/api/state/{_server.ts.js-yT-0jHAT.js → _server.ts.js-k8Ueydx1.js} +4 -4
  117. package/build/server/chunks/entries/endpoints/api/state/{_server.ts.js-yT-0jHAT.js.map → _server.ts.js-k8Ueydx1.js.map} +1 -1
  118. package/build/server/chunks/entries/endpoints/api/usage/_server.ts.js-DmMmiFiu.js +82 -0
  119. package/build/server/chunks/entries/endpoints/api/usage/_server.ts.js-DmMmiFiu.js.map +1 -0
  120. package/build/server/chunks/entries/endpoints/files/_...path_/{_server.ts.js-DTZAlq3j.js → _server.ts.js-CT7yOdDS.js} +3 -3
  121. package/build/server/chunks/entries/endpoints/files/_...path_/{_server.ts.js-DTZAlq3j.js.map → _server.ts.js-CT7yOdDS.js.map} +1 -1
  122. package/build/server/chunks/entries/endpoints/files/proxy/_...path_/{_server.ts.js-Cux6Dnfu.js → _server.ts.js-BQTC0OSC.js} +4 -4
  123. package/build/server/chunks/entries/endpoints/files/proxy/_...path_/{_server.ts.js-Cux6Dnfu.js.map → _server.ts.js-BQTC0OSC.js.map} +1 -1
  124. package/build/server/chunks/entries/endpoints/files/raw/_...path_/{_server.ts.js-BjcPFOHi.js → _server.ts.js-mv9cqSuS.js} +4 -4
  125. package/build/server/chunks/entries/endpoints/files/raw/_...path_/{_server.ts.js-BjcPFOHi.js.map → _server.ts.js-mv9cqSuS.js.map} +1 -1
  126. package/build/server/chunks/entries/{hooks.server.js-e6ugpMpo.js → hooks.server.js-BNQO3cZr.js} +3 -3
  127. package/build/server/chunks/entries/{hooks.server.js-e6ugpMpo.js.map → hooks.server.js-BNQO3cZr.js.map} +1 -1
  128. package/build/server/chunks/{handler-BT9ZZoXM.js → handler-rG16rikT.js} +5 -5
  129. package/build/server/chunks/{handler-BT9ZZoXM.js.map → handler-rG16rikT.js.map} +1 -1
  130. package/build/server/chunks/{index.js-Cvg0bLxz.js → index.js-DYK_SfL5.js} +5 -5
  131. package/build/server/chunks/{index.js-Cvg0bLxz.js.map → index.js-DYK_SfL5.js.map} +1 -1
  132. package/build/server/chunks/{manifest.js-CtTOK1ZJ.js → manifest.js-h2lDpEPs.js} +35 -28
  133. package/build/server/chunks/manifest.js-h2lDpEPs.js.map +1 -0
  134. package/build/server/chunks/nodes/{0.js-CyEDHDwU.js → 0.js-Db28RwnA.js} +2 -2
  135. package/build/server/chunks/nodes/{0.js-CyEDHDwU.js.map → 0.js-Db28RwnA.js.map} +1 -1
  136. package/build/server/chunks/nodes/1.js-D26Uv3YT.js +7 -0
  137. package/build/server/chunks/nodes/{1.js-Cv0zPe22.js.map → 1.js-D26Uv3YT.js.map} +1 -1
  138. package/build/server/chunks/nodes/2.js-BeRlEFid.js +7 -0
  139. package/build/server/chunks/nodes/{2.js-CAIMXiqt.js.map → 2.js-BeRlEFid.js.map} +1 -1
  140. package/build/server/chunks/nodes/3.js-BRUNmCyG.js +7 -0
  141. package/build/server/chunks/nodes/3.js-BRUNmCyG.js.map +1 -0
  142. package/build/server/chunks/nodes/4.js-CTHWqDf1.js +7 -0
  143. package/build/server/chunks/nodes/4.js-CTHWqDf1.js.map +1 -0
  144. package/dist/cli.js +6 -1
  145. package/dist/config.d.ts +1 -1
  146. package/dist/core/api-types.d.ts +36 -1
  147. package/dist/core/config.d.ts +35 -0
  148. package/dist/core/index.d.ts +2 -2
  149. package/dist/core/manifest-entry.d.ts +11 -0
  150. package/dist/runtime/kind-handlers.d.ts +3 -2
  151. package/dist/runtime/kind-handlers.js +38 -10
  152. package/dist/runtime/manifest.d.ts +2 -1
  153. package/dist/runtime/manifest.js +13 -6
  154. package/dist/runtime/preload-registry.d.ts +1 -1
  155. package/dist/runtime/preload-registry.js +6 -3
  156. package/dist/server/check.d.ts +6 -0
  157. package/dist/server/check.js +4 -1
  158. package/dist/server/cli-commands.d.ts +3 -1
  159. package/dist/server/cli-commands.js +117 -2
  160. package/dist/server/codegen.d.ts +3 -0
  161. package/dist/server/codegen.js +19 -2
  162. package/dist/server/config-loader.d.ts +3 -1
  163. package/dist/server/config-loader.js +13 -1
  164. package/dist/server/index.d.ts +2 -2
  165. package/dist/server/index.js +1 -1
  166. package/dist/server/operations.d.ts +7 -1
  167. package/dist/server/operations.js +85 -2
  168. package/dist/server/plugins/audio.js +1 -0
  169. package/dist/server/plugins/chroma-key-video.js +1 -0
  170. package/dist/server/plugins/image.js +1 -0
  171. package/dist/server/plugins/slice.js +1 -0
  172. package/dist/server/plugins/video.js +1 -0
  173. package/dist/server/start.d.ts +8 -0
  174. package/dist/server/start.js +24 -0
  175. package/dist/server/usage.d.ts +24 -0
  176. package/dist/server/usage.js +441 -0
  177. package/package.json +2 -2
  178. package/build/client/_app/immutable/assets/2.CK3PVkJ5.css +0 -1
  179. package/build/client/_app/immutable/assets/2.CK3PVkJ5.css.br +0 -0
  180. package/build/client/_app/immutable/assets/2.CK3PVkJ5.css.gz +0 -0
  181. package/build/client/_app/immutable/assets/3.CmXD8k9d.css +0 -1
  182. package/build/client/_app/immutable/assets/3.CmXD8k9d.css.br +0 -0
  183. package/build/client/_app/immutable/assets/3.CmXD8k9d.css.gz +0 -0
  184. package/build/client/_app/immutable/assets/4.p004hmEN.css +0 -1
  185. package/build/client/_app/immutable/assets/4.p004hmEN.css.br +0 -0
  186. package/build/client/_app/immutable/assets/4.p004hmEN.css.gz +0 -0
  187. package/build/client/_app/immutable/chunks/-scmOfVp.js +0 -108
  188. package/build/client/_app/immutable/chunks/-scmOfVp.js.br +0 -0
  189. package/build/client/_app/immutable/chunks/-scmOfVp.js.gz +0 -0
  190. package/build/client/_app/immutable/chunks/BD3hQKzV.js +0 -1
  191. package/build/client/_app/immutable/chunks/BD3hQKzV.js.br +0 -0
  192. package/build/client/_app/immutable/chunks/BD3hQKzV.js.gz +0 -0
  193. package/build/client/_app/immutable/chunks/BFccgFID.js.br +0 -1
  194. package/build/client/_app/immutable/chunks/BFccgFID.js.gz +0 -0
  195. package/build/client/_app/immutable/chunks/C3HGm51f.js +0 -1
  196. package/build/client/_app/immutable/chunks/C3HGm51f.js.br +0 -0
  197. package/build/client/_app/immutable/chunks/C3HGm51f.js.gz +0 -0
  198. package/build/client/_app/immutable/chunks/C7OUKWnm.js +0 -1
  199. package/build/client/_app/immutable/chunks/C7OUKWnm.js.br +0 -0
  200. package/build/client/_app/immutable/chunks/C7OUKWnm.js.gz +0 -0
  201. package/build/client/_app/immutable/chunks/DPZDGjcn.js +0 -1
  202. package/build/client/_app/immutable/chunks/DPZDGjcn.js.br +0 -0
  203. package/build/client/_app/immutable/chunks/DPZDGjcn.js.gz +0 -0
  204. package/build/client/_app/immutable/chunks/DRjIin01.js +0 -1
  205. package/build/client/_app/immutable/chunks/DRjIin01.js.br +0 -0
  206. package/build/client/_app/immutable/chunks/DRjIin01.js.gz +0 -0
  207. package/build/client/_app/immutable/chunks/NblqapDQ.js +0 -3
  208. package/build/client/_app/immutable/chunks/NblqapDQ.js.br +0 -0
  209. package/build/client/_app/immutable/chunks/NblqapDQ.js.gz +0 -0
  210. package/build/client/_app/immutable/entry/app.SxIeroQ7.js +0 -2
  211. package/build/client/_app/immutable/entry/app.SxIeroQ7.js.br +0 -0
  212. package/build/client/_app/immutable/entry/app.SxIeroQ7.js.gz +0 -0
  213. package/build/client/_app/immutable/entry/start.BLJzoe4Q.js +0 -1
  214. package/build/client/_app/immutable/entry/start.BLJzoe4Q.js.br +0 -0
  215. package/build/client/_app/immutable/entry/start.BLJzoe4Q.js.gz +0 -0
  216. package/build/client/_app/immutable/nodes/0.ZD2ILzva.js +0 -2
  217. package/build/client/_app/immutable/nodes/0.ZD2ILzva.js.br +0 -0
  218. package/build/client/_app/immutable/nodes/0.ZD2ILzva.js.gz +0 -0
  219. package/build/client/_app/immutable/nodes/1.DwuNSOrz.js +0 -1
  220. package/build/client/_app/immutable/nodes/1.DwuNSOrz.js.br +0 -1
  221. package/build/client/_app/immutable/nodes/1.DwuNSOrz.js.gz +0 -0
  222. package/build/client/_app/immutable/nodes/2.Dq9XLv2P.js +0 -3
  223. package/build/client/_app/immutable/nodes/2.Dq9XLv2P.js.br +0 -0
  224. package/build/client/_app/immutable/nodes/2.Dq9XLv2P.js.gz +0 -0
  225. package/build/client/_app/immutable/nodes/3._kFEQXPD.js +0 -1
  226. package/build/client/_app/immutable/nodes/3._kFEQXPD.js.br +0 -0
  227. package/build/client/_app/immutable/nodes/3._kFEQXPD.js.gz +0 -0
  228. package/build/client/_app/immutable/nodes/4.B6dS2ueh.js +0 -2
  229. package/build/client/_app/immutable/nodes/4.B6dS2ueh.js.br +0 -0
  230. package/build/client/_app/immutable/nodes/4.B6dS2ueh.js.gz +0 -0
  231. package/build/server/chunks/chunks/context.js-mXbNUDBD.js.map +0 -1
  232. package/build/server/chunks/chunks/contract.js-BCXeXDmU.js.map +0 -1
  233. package/build/server/chunks/manifest.js-CtTOK1ZJ.js.map +0 -1
  234. package/build/server/chunks/nodes/1.js-Cv0zPe22.js +0 -7
  235. package/build/server/chunks/nodes/2.js-CAIMXiqt.js +0 -7
  236. package/build/server/chunks/nodes/3.js-CFifsujw.js +0 -7
  237. package/build/server/chunks/nodes/3.js-CFifsujw.js.map +0 -1
  238. package/build/server/chunks/nodes/4.js-BS8_mlOS.js +0 -7
  239. package/build/server/chunks/nodes/4.js-BS8_mlOS.js.map +0 -1
@@ -1,14 +1,15 @@
1
- import { g as folderOfRawPath, h as rawFileNameOfPath, j as canonicalizeParameters, n as normalizeFolderPath, c as compareCodeUnits, H as typesForFileName, J as proposeAssetId, k as parentFolderPath, u as portableFolderPathKey } from './core.js-Cj7hjmtV.js';
2
- import { s as serverPluginsByType, i as isRecord, L as LibraryStore, a as serverPluginForType, S as SourceImportError, p as processAssets, g as generateManifestModules, d as descriptorsByType, r as readCurrentProxy, e as encodeRelativePathForUrl, b as invalidInput, c as parseLibrary } from './contract.js-BCXeXDmU.js';
3
- import { a as assetIdError, c as collectAllReferences, b as computeLibraryMembership, d as allDeliveredAssetIds } from './manifest-membership.js-vIb-KkQi.js';
1
+ import { c as compareCodeUnits, g as folderOfRawPath, h as rawFileNameOfPath, j as canonicalizeParameters, n as normalizeFolderPath, H as typesForFileName, J as proposeAssetId, k as parentFolderPath, u as portableFolderPathKey } from './core.js-Cj7hjmtV.js';
2
+ import { s as serverPluginsByType, i as isRecord, L as LibraryStore, d as descriptorsByType, m as manifestModuleFileName, l as locateGeneratedAssetDeclaration, a as serializeLibrary, b as serverPluginForType, S as SourceImportError, p as processAssets, g as generateManifestModules, r as readCurrentProxy, e as encodeRelativePathForUrl, c as invalidInput, f as parseLibrary } from './contract.js-DRcxzb4o.js';
3
+ import { c as collectAllReferences, a as assetIdError, b as computeLibraryMembership, d as allDeliveredAssetIds } from './manifest-membership.js-vIb-KkQi.js';
4
4
  import { v as verifyStableRawFile, c as classifyRawDirectory } from './raw-reconciliation2.js-5mUCDiJk.js';
5
5
  import { isAbsolute, resolve, join, extname, relative, sep } from 'node:path';
6
6
  import { existsSync } from 'node:fs';
7
7
  import { createJiti } from 'jiti';
8
- import { realpath } from 'node:fs/promises';
8
+ import { readFile, realpath } from 'node:fs/promises';
9
9
  import { execFile } from 'node:child_process';
10
10
  import { isDeepStrictEqual, promisify } from 'node:util';
11
11
  import sharp from 'sharp';
12
+ import { randomBytes, createHmac, timingSafeEqual, createHash } from 'node:crypto';
12
13
  import { lookup } from 'node:dns/promises';
13
14
  import { isIP } from 'node:net';
14
15
  import { request } from 'node:https';
@@ -57,6 +58,10 @@ function resolveConfig(projectRoot, value, registry = serverPluginsByType) {
57
58
  if (!isRecord(defaults)) throw new Error("fundus.config: \"import.figma.defaults\" must be an object.");
58
59
  const scale = defaults.scale === void 0 ? 2 : defaults.scale;
59
60
  if (scale !== 1 && scale !== 2 && scale !== 3 && scale !== 4) throw new Error("fundus.config: \"import.figma.defaults.scale\" must be 1, 2, 3, or 4.");
61
+ const usage = value.usage;
62
+ if (usage !== void 0 && !isRecord(usage)) throw new Error("fundus.config: \"usage\" must be an object.");
63
+ if (usage !== void 0 && typeof usage.referenceProvider !== "function") throw new Error("fundus.config: \"usage.referenceProvider\" must be a function.");
64
+ if (usage !== void 0 && typeof usage.openLocation !== "function") throw new Error("fundus.config: \"usage.openLocation\" must be a function.");
60
65
  return {
61
66
  projectRoot: resolve(projectRoot),
62
67
  rawDir: resolvePath(projectRoot, requiredString(value, "rawDir")),
@@ -68,7 +73,8 @@ function resolveConfig(projectRoot, value, registry = serverPluginsByType) {
68
73
  import: { figma: {
69
74
  ...figma.token !== void 0 ? { token: figma.token } : {},
70
75
  defaults: { scale }
71
- } }
76
+ } },
77
+ usage: usage === void 0 ? null : usage
72
78
  };
73
79
  }
74
80
  /** Load `fundus.config.ts` from the host project root. */
@@ -709,6 +715,367 @@ async function gitAssetChanges(projectRoot, libraryPath, currentLibrary) {
709
715
  }
710
716
  }
711
717
  //#endregion
718
+ //#region src/lib/server/usage.ts
719
+ var MAX_PATHS = 20;
720
+ var TOKEN_TTL_MS = 600 * 1e3;
721
+ function locationKey(location) {
722
+ return `${location.file}\u0000${location.line}\u0000${location.column}`;
723
+ }
724
+ function compareLocations(left, right) {
725
+ return compareCodeUnits(left.file, right.file) || left.line - right.line || left.column - right.column || compareCodeUnits(left.label ?? "", right.label ?? "");
726
+ }
727
+ function validateLocation(value, context, allowLabel) {
728
+ if (typeof value !== "object" || value === null || Array.isArray(value)) throw new Error(`${context} must be an object.`);
729
+ const record = value;
730
+ if (typeof record.file !== "string" || record.file.length === 0 || !isAbsolute(record.file)) throw new Error(`${context}.file must be an absolute path.`);
731
+ for (const key of ["line", "column"]) if (!Number.isSafeInteger(record[key]) || record[key] <= 0) throw new Error(`${context}.${key} must be a positive safe integer.`);
732
+ if (allowLabel && record.label !== void 0 && typeof record.label !== "string") throw new Error(`${context}.label must be a string.`);
733
+ return {
734
+ file: record.file,
735
+ line: record.line,
736
+ column: record.column,
737
+ ...allowLabel && typeof record.label === "string" ? { label: record.label } : {}
738
+ };
739
+ }
740
+ function normalizeResult(value, target) {
741
+ const context = `fundus.config: usage.referenceProvider for ${target.manifest}.${target.assetId}`;
742
+ try {
743
+ if (typeof value !== "object" || value === null || Array.isArray(value)) throw new Error(`${context} must return an object.`);
744
+ const result = value;
745
+ if (result.status === "unknown") {
746
+ if (result.reason !== void 0 && typeof result.reason !== "string") throw new Error(`${context} unknown reason must be a string.`);
747
+ return {
748
+ status: "unknown",
749
+ ...typeof result.reason === "string" ? { reason: result.reason } : {}
750
+ };
751
+ }
752
+ if (result.status !== "resolved" || !Array.isArray(result.references)) throw new Error(`${context} must return resolved references or unknown.`);
753
+ const declarationKey = locationKey(target.declaration);
754
+ const references = result.references.map((reference, index) => validateLocation(reference, `${context} references[${index}]`, true)).filter((reference) => locationKey(reference) !== declarationKey).sort(compareLocations);
755
+ const deduplicated = [];
756
+ const seen = /* @__PURE__ */ new Set();
757
+ for (const reference of references) {
758
+ const key = locationKey(reference);
759
+ if (seen.has(key)) continue;
760
+ seen.add(key);
761
+ deduplicated.push(reference);
762
+ }
763
+ return {
764
+ status: "resolved",
765
+ references: deduplicated
766
+ };
767
+ } catch (cause) {
768
+ return {
769
+ status: "unknown",
770
+ reason: cause instanceof Error ? cause.message : String(cause)
771
+ };
772
+ }
773
+ }
774
+ var FifoLimiter = class {
775
+ #active = 0;
776
+ #queue = [];
777
+ async run(operation) {
778
+ if (this.#active >= 4) await new Promise((resolve) => this.#queue.push(resolve));
779
+ this.#active++;
780
+ try {
781
+ return await operation();
782
+ } finally {
783
+ this.#active--;
784
+ this.#queue.shift()?.();
785
+ }
786
+ }
787
+ };
788
+ var FundusUsageAnalyzer = class {
789
+ #usage;
790
+ #secret = randomBytes(32);
791
+ #limiter = new FifoLimiter();
792
+ #inflight = /* @__PURE__ */ new Map();
793
+ #freshGeneration = 0;
794
+ constructor(usage) {
795
+ this.#usage = usage;
796
+ }
797
+ async analyze(snapshot, options = {}) {
798
+ if (options.assetId && !Object.hasOwn(snapshot.library.assets, options.assetId)) throw new Error(`Unknown asset "${options.assetId}".`);
799
+ const rootsToAnalyze = options.assetId ? relevantRootsForAsset(snapshot, options.assetId) : snapshot.roots;
800
+ const freshKey = options.forceFresh ? `fresh:${++this.#freshGeneration}` : "normal";
801
+ const rootResults = /* @__PURE__ */ new Map();
802
+ await Promise.all(rootsToAnalyze.map(async (root) => {
803
+ const key = rootKey(root);
804
+ if (!root.declaration) {
805
+ rootResults.set(key, {
806
+ status: "unknown",
807
+ reason: root.declarationError ?? `Cannot locate generated declaration for ${root.manifest}.${root.assetId}.`
808
+ });
809
+ return;
810
+ }
811
+ const target = {
812
+ assetId: root.assetId,
813
+ manifest: root.manifest,
814
+ declaration: root.declaration
815
+ };
816
+ const inflightKey = `${snapshot.revision}|${locationKey(root.declaration)}|${freshKey}`;
817
+ let run = !options.forceFresh ? this.#inflight.get(inflightKey) : void 0;
818
+ if (!run) {
819
+ run = this.#limiter.run(async () => {
820
+ try {
821
+ return normalizeResult(await this.#usage.referenceProvider(target), target);
822
+ } catch (cause) {
823
+ return {
824
+ status: "unknown",
825
+ reason: `usage.referenceProvider failed for ${root.manifest}.${root.assetId}: ${cause instanceof Error ? cause.message : String(cause)}`
826
+ };
827
+ }
828
+ });
829
+ if (!options.forceFresh) {
830
+ this.#inflight.set(inflightKey, run);
831
+ run.finally(() => this.#inflight.delete(inflightKey));
832
+ }
833
+ }
834
+ rootResults.set(key, await run);
835
+ }));
836
+ return this.#assemble(snapshot, rootResults, options.assetId);
837
+ }
838
+ stale(snapshot, assetId) {
839
+ const results = /* @__PURE__ */ new Map();
840
+ for (const root of assetId ? relevantRootsForAsset(snapshot, assetId) : snapshot.roots) results.set(rootKey(root), {
841
+ status: "unknown",
842
+ reason: "The Fundus project changed repeatedly during usage analysis; refresh to retry."
843
+ });
844
+ return this.#assemble(snapshot, results, assetId);
845
+ }
846
+ async open(token) {
847
+ if (typeof token !== "string" || token.length === 0) throw new Error("Usage location token must be a non-empty string.");
848
+ const [encoded, signature, extra] = token.split(".");
849
+ if (!encoded || !signature || extra !== void 0) throw new Error("Invalid usage location token.");
850
+ const expected = createHmac("sha256", this.#secret).update(encoded).digest();
851
+ let received;
852
+ try {
853
+ received = Buffer.from(signature, "base64url");
854
+ } catch {
855
+ throw new Error("Invalid usage location token.");
856
+ }
857
+ if (received.length !== expected.length || !timingSafeEqual(received, expected)) throw new Error("Invalid usage location token; refresh usage and try again.");
858
+ let payload;
859
+ try {
860
+ payload = JSON.parse(Buffer.from(encoded, "base64url").toString("utf8"));
861
+ } catch {
862
+ throw new Error("Invalid usage location token.");
863
+ }
864
+ if (typeof payload !== "object" || payload === null || Array.isArray(payload)) throw new Error("Invalid usage location token.");
865
+ const record = payload;
866
+ if (record.v !== 1 || typeof record.expiresAt !== "number" || Date.now() > record.expiresAt) throw new Error("Usage location token expired; refresh usage and try again.");
867
+ const location = validateLocation(record.location, "Usage location token", false);
868
+ const normalized = {
869
+ file: location.file,
870
+ line: location.line,
871
+ column: location.column
872
+ };
873
+ try {
874
+ await this.#usage.openLocation(normalized);
875
+ } catch (cause) {
876
+ throw new Error(`Could not open ${normalized.file}:${normalized.line}:${normalized.column}: ${cause instanceof Error ? cause.message : String(cause)}`);
877
+ }
878
+ }
879
+ #token(location) {
880
+ const encoded = Buffer.from(JSON.stringify({
881
+ v: 1,
882
+ expiresAt: Date.now() + TOKEN_TTL_MS,
883
+ location
884
+ })).toString("base64url");
885
+ return `${encoded}.${createHmac("sha256", this.#secret).update(encoded).digest("base64url")}`;
886
+ }
887
+ #assemble(snapshot, rootResults, requestedAssetId) {
888
+ const assetIds = requestedAssetId ? [requestedAssetId] : Object.keys(snapshot.library.assets).sort(compareCodeUnits);
889
+ const analyzedRoots = snapshot.roots.filter((root) => rootResults.has(rootKey(root)));
890
+ const cyclicNodes = referenceCycleNodes(snapshot.referencesByAsset);
891
+ const cycleAncestors = reverseClosure(cyclicNodes, snapshot.referencesByAsset);
892
+ const adjustedResults = /* @__PURE__ */ new Map();
893
+ for (const root of analyzedRoots) {
894
+ const result = rootResults.get(rootKey(root));
895
+ adjustedResults.set(rootKey(root), cycleAncestors.has(root.assetId) && result.status === "resolved" && result.references.length === 0 ? {
896
+ status: "unknown",
897
+ reason: "A reference cycle prevents complete usage analysis for this root."
898
+ } : result);
899
+ }
900
+ const usedAssets = referenceClosureFromSources(analyzedRoots.filter((root) => {
901
+ const result = adjustedResults.get(rootKey(root));
902
+ return result?.status === "resolved" && result.references.length > 0;
903
+ }).map((root) => root.assetId), snapshot.referencesByAsset);
904
+ const unknownAssets = referenceClosureFromSources(analyzedRoots.filter((root) => adjustedResults.get(rootKey(root))?.status === "unknown").map((root) => root.assetId), snapshot.referencesByAsset);
905
+ return { assets: assetIds.map((assetId) => {
906
+ const status = usedAssets.has(assetId) ? "used" : unknownAssets.has(assetId) ? "unknown" : "unused";
907
+ if (!requestedAssetId) return {
908
+ assetId,
909
+ status,
910
+ references: [],
911
+ roots: []
912
+ };
913
+ const groups = [];
914
+ const pathCountMemo = /* @__PURE__ */ new Map();
915
+ for (const root of analyzedRoots) {
916
+ const paths = pathsFromRoot(root.assetId, assetId, snapshot.referencesByAsset, pathCountMemo, cyclicNodes);
917
+ if (paths.count > 0n) groups.push({
918
+ root,
919
+ paths: paths.paths,
920
+ count: paths.count
921
+ });
922
+ }
923
+ const allReferences = [];
924
+ for (const group of groups) {
925
+ const result = adjustedResults.get(rootKey(group.root));
926
+ if (result?.status === "resolved") allReferences.push(...result.references);
927
+ }
928
+ allReferences.sort(compareLocations);
929
+ const uniqueReferences = [];
930
+ const referenceIdByKey = /* @__PURE__ */ new Map();
931
+ for (const reference of allReferences) {
932
+ const key = locationKey(reference);
933
+ if (referenceIdByKey.has(key)) continue;
934
+ const id = `r${uniqueReferences.length}`;
935
+ referenceIdByKey.set(key, id);
936
+ uniqueReferences.push(reference);
937
+ }
938
+ const roots = groups.map(({ root, paths, count }) => {
939
+ const result = adjustedResults.get(rootKey(root)) ?? {
940
+ status: "unknown",
941
+ reason: "Usage analysis result is missing."
942
+ };
943
+ const dtoResult = result.status === "unknown" ? result : {
944
+ status: "resolved",
945
+ referenceIds: result.references.map((reference) => referenceIdByKey.get(locationKey(reference))).filter((id) => id !== void 0)
946
+ };
947
+ return {
948
+ manifest: root.manifest,
949
+ rootAssetId: root.assetId,
950
+ paths,
951
+ pathsTruncated: count > BigInt(paths.length),
952
+ ...count > BigInt(paths.length) ? { additionalPathCount: (count - BigInt(paths.length)).toString() } : {},
953
+ declaration: root.declaration,
954
+ result: dtoResult
955
+ };
956
+ });
957
+ return {
958
+ assetId,
959
+ status,
960
+ references: uniqueReferences.map((reference, index) => ({
961
+ ...reference,
962
+ id: `r${index}`,
963
+ openToken: this.#token(reference)
964
+ })),
965
+ roots
966
+ };
967
+ }) };
968
+ }
969
+ };
970
+ function rootKey(root) {
971
+ return `${root.manifest}\u0000${root.assetId}`;
972
+ }
973
+ function relevantRootsForAsset(snapshot, assetId) {
974
+ const ancestors = reverseClosure(/* @__PURE__ */ new Set([assetId]), snapshot.referencesByAsset);
975
+ return snapshot.roots.filter((root) => ancestors.has(root.assetId));
976
+ }
977
+ function reverseClosure(sources, referencesByAsset) {
978
+ const incoming = /* @__PURE__ */ new Map();
979
+ for (const [source, references] of Object.entries(referencesByAsset)) for (const target of new Set(references.map((reference) => reference.assetId))) {
980
+ const sources = incoming.get(target);
981
+ if (sources) sources.push(source);
982
+ else incoming.set(target, [source]);
983
+ }
984
+ const closure = /* @__PURE__ */ new Set();
985
+ const pending = [...sources];
986
+ while (pending.length > 0) {
987
+ const current = pending.pop();
988
+ if (closure.has(current)) continue;
989
+ closure.add(current);
990
+ pending.push(...incoming.get(current) ?? []);
991
+ }
992
+ return closure;
993
+ }
994
+ function referenceClosureFromSources(sources, referencesByAsset) {
995
+ const closure = /* @__PURE__ */ new Set();
996
+ const pending = [...sources];
997
+ while (pending.length > 0) {
998
+ const current = pending.pop();
999
+ if (closure.has(current) || !Object.hasOwn(referencesByAsset, current)) continue;
1000
+ closure.add(current);
1001
+ for (const reference of referencesByAsset[current]) pending.push(reference.assetId);
1002
+ }
1003
+ return closure;
1004
+ }
1005
+ /** Tarjan SCC detection; singleton components count only when they self-reference. */
1006
+ function referenceCycleNodes(referencesByAsset) {
1007
+ let nextIndex = 0;
1008
+ const indexByNode = /* @__PURE__ */ new Map();
1009
+ const lowLink = /* @__PURE__ */ new Map();
1010
+ const stack = [];
1011
+ const onStack = /* @__PURE__ */ new Set();
1012
+ const cyclic = /* @__PURE__ */ new Set();
1013
+ const visit = (node) => {
1014
+ indexByNode.set(node, nextIndex);
1015
+ lowLink.set(node, nextIndex++);
1016
+ stack.push(node);
1017
+ onStack.add(node);
1018
+ for (const target of new Set((referencesByAsset[node] ?? []).map((ref) => ref.assetId))) {
1019
+ if (!Object.hasOwn(referencesByAsset, target)) continue;
1020
+ if (!indexByNode.has(target)) {
1021
+ visit(target);
1022
+ lowLink.set(node, Math.min(lowLink.get(node), lowLink.get(target)));
1023
+ } else if (onStack.has(target)) lowLink.set(node, Math.min(lowLink.get(node), indexByNode.get(target)));
1024
+ }
1025
+ if (lowLink.get(node) !== indexByNode.get(node)) return;
1026
+ const component = [];
1027
+ for (;;) {
1028
+ const member = stack.pop();
1029
+ onStack.delete(member);
1030
+ component.push(member);
1031
+ if (member === node) break;
1032
+ }
1033
+ if (component.length > 1 || (referencesByAsset[node] ?? []).some((reference) => reference.assetId === node)) for (const member of component) cyclic.add(member);
1034
+ };
1035
+ for (const node of Object.keys(referencesByAsset)) if (!indexByNode.has(node)) visit(node);
1036
+ return cyclic;
1037
+ }
1038
+ function pathsFromRoot(root, target, referencesByAsset, countMemo = /* @__PURE__ */ new Map(), cyclicNodes = referenceCycleNodes(referencesByAsset)) {
1039
+ const count = (assetId, visiting) => {
1040
+ if (assetId === target) return 1n;
1041
+ const visitedCyclicNodes = [...visiting].filter((id) => cyclicNodes.has(id)).sort(compareCodeUnits);
1042
+ const memoKey = JSON.stringify([assetId, visitedCyclicNodes]);
1043
+ const cached = countMemo.get(memoKey);
1044
+ if (cached !== void 0) return cached;
1045
+ if (visiting.has(assetId)) return 0n;
1046
+ const nextVisiting = new Set(visiting).add(assetId);
1047
+ let total = 0n;
1048
+ const nextIds = [...new Set((referencesByAsset[assetId] ?? []).map((ref) => ref.assetId))].sort(compareCodeUnits);
1049
+ for (const next of nextIds) total += count(next, nextVisiting);
1050
+ countMemo.set(memoKey, total);
1051
+ return total;
1052
+ };
1053
+ const total = count(root, /* @__PURE__ */ new Set());
1054
+ const paths = [];
1055
+ const collect = (assetId, path, visiting) => {
1056
+ if (paths.length >= MAX_PATHS) return;
1057
+ if (assetId === target) {
1058
+ paths.push(path);
1059
+ return;
1060
+ }
1061
+ if (visiting.has(assetId)) return;
1062
+ const nextVisiting = new Set(visiting).add(assetId);
1063
+ const nextIds = [...new Set((referencesByAsset[assetId] ?? []).map((ref) => ref.assetId))].sort(compareCodeUnits);
1064
+ for (const next of nextIds) {
1065
+ if (count(next, nextVisiting) > 0n) collect(next, [...path, next], nextVisiting);
1066
+ if (paths.length >= MAX_PATHS) break;
1067
+ }
1068
+ };
1069
+ if (total > 0n) collect(root, [root], /* @__PURE__ */ new Set());
1070
+ return {
1071
+ paths,
1072
+ count: total
1073
+ };
1074
+ }
1075
+ function usageSnapshotRevision(parts) {
1076
+ return createHash("sha256").update(parts.join("\0")).digest("hex");
1077
+ }
1078
+ //#endregion
712
1079
  //#region src/lib/server/operations.ts
713
1080
  /**
714
1081
  * The one operations layer: builds the state payload and runs
@@ -740,6 +1107,7 @@ var FundusOperations = class {
740
1107
  #registry;
741
1108
  #store;
742
1109
  #importers;
1110
+ #usageAnalyzer;
743
1111
  #operationQueue = Promise.resolve();
744
1112
  #pipelineQueue = Promise.resolve();
745
1113
  constructor(config, registry = serverPluginsByType, importerRegistry = serverImporters) {
@@ -747,6 +1115,7 @@ var FundusOperations = class {
747
1115
  this.#registry = registry;
748
1116
  this.#store = new LibraryStore(config, registry);
749
1117
  this.#importers = importerRegistry;
1118
+ this.#usageAnalyzer = config.usage ? new FundusUsageAnalyzer(config.usage) : null;
750
1119
  }
751
1120
  get config() {
752
1121
  return this.#config;
@@ -754,11 +1123,76 @@ var FundusOperations = class {
754
1123
  get store() {
755
1124
  return this.#store;
756
1125
  }
1126
+ get usageAvailable() {
1127
+ return this.#usageAnalyzer !== null;
1128
+ }
1129
+ async analyzeUsage(options = {}) {
1130
+ const analyzer = this.#usageAnalyzer;
1131
+ if (!analyzer) throw new Error("Usage analysis is not configured.");
1132
+ for (let attempt = 0; attempt < 2; attempt++) {
1133
+ const snapshot = await this.#enqueueOperation(() => this.#usageSnapshot());
1134
+ const report = await analyzer.analyze(snapshot, {
1135
+ ...options,
1136
+ forceFresh: options.forceFresh === true || attempt > 0
1137
+ });
1138
+ if ((await this.#enqueueOperation(() => this.#usageSnapshot())).revision === snapshot.revision) return report;
1139
+ }
1140
+ const current = await this.#enqueueOperation(() => this.#usageSnapshot());
1141
+ if (options.assetId && !Object.hasOwn(current.library.assets, options.assetId)) throw new Error(`Unknown asset "${options.assetId}".`);
1142
+ return analyzer.stale(current, options.assetId);
1143
+ }
1144
+ async openUsageLocation(token) {
1145
+ if (!this.#usageAnalyzer) throw new Error("Usage analysis is not configured.");
1146
+ await this.#usageAnalyzer.open(token);
1147
+ }
757
1148
  #enqueueOperation(operation) {
758
1149
  const run = this.#operationQueue.then(operation, operation);
759
1150
  this.#operationQueue = run.then(() => {}, () => {});
760
1151
  return run;
761
1152
  }
1153
+ async #usageSnapshot() {
1154
+ await this.#pipelineQueue;
1155
+ const library = structuredClone(await this.#store.read());
1156
+ const referencesByAsset = collectAllReferences(library, descriptorsByType(this.#registry));
1157
+ const modules = /* @__PURE__ */ new Map();
1158
+ const roots = [];
1159
+ for (const manifest of Object.keys(library.manifests).sort(compareCodeUnits)) {
1160
+ const rootAssetIds = Object.keys(library.assets).filter((assetId) => library.assets[assetId].manifests.includes(manifest)).sort(compareCodeUnits);
1161
+ if (rootAssetIds.length === 0) continue;
1162
+ const path = join(this.#config.manifestsDir, manifestModuleFileName(manifest));
1163
+ let content;
1164
+ try {
1165
+ content = await readFile(path, "utf8");
1166
+ } catch (cause) {
1167
+ if (cause.code !== "ENOENT") throw cause;
1168
+ content = null;
1169
+ }
1170
+ modules.set(manifest, {
1171
+ content,
1172
+ path
1173
+ });
1174
+ for (const assetId of rootAssetIds) {
1175
+ const declaration = content === null ? null : locateGeneratedAssetDeclaration(path, content, assetId);
1176
+ roots.push({
1177
+ manifest,
1178
+ assetId,
1179
+ declaration,
1180
+ ...declaration ? {} : { declarationError: content === null ? `Generated manifest module is missing: ${path}.` : `Generated declaration ${manifest}.${assetId} was not found in ${path}.` }
1181
+ });
1182
+ }
1183
+ }
1184
+ const revisionParts = [serializeLibrary(library)];
1185
+ for (const manifest of [...modules.keys()].sort(compareCodeUnits)) {
1186
+ const module = modules.get(manifest);
1187
+ revisionParts.push(manifest, module.path, module.content ?? "<missing>");
1188
+ }
1189
+ return {
1190
+ revision: usageSnapshotRevision(revisionParts),
1191
+ library,
1192
+ referencesByAsset,
1193
+ roots
1194
+ };
1195
+ }
762
1196
  /** Read-only state snapshot, serialized with mutations but never processing or writing. */
763
1197
  state() {
764
1198
  return this.#enqueueOperation(() => this.#state());
@@ -1517,4 +1951,4 @@ async function createFundusContext() {
1517
1951
  }
1518
1952
 
1519
1953
  export { getFundusContext as g, initializeFundusContext as i };
1520
- //# sourceMappingURL=context.js-mXbNUDBD.js.map
1954
+ //# sourceMappingURL=context.js-BJfk3ZiR.js.map