@format.dev/compile 0.0.0 → 0.1.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 (466) hide show
  1. package/README.md +30 -20
  2. package/bin/format-compile +3 -0
  3. package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/defineProperty.mjs +14 -0
  4. package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/toPrimitive.mjs +16 -0
  5. package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/toPropertyKey.mjs +11 -0
  6. package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/typeof.mjs +12 -0
  7. package/dist/_virtual/rolldown_runtime.mjs +46 -0
  8. package/dist/node_modules/.pnpm/@babel_parser@7.29.8/node_modules/@babel/parser/lib/index.mjs +12606 -0
  9. package/dist/node_modules/.pnpm/@babel_parser@7.29.8/node_modules/@babel/parser/lib/index.mjs.map +1 -0
  10. package/dist/node_modules/.pnpm/@vue_compiler-core@3.5.41/node_modules/@vue/compiler-core/dist/compiler-core.cjs.mjs +4866 -0
  11. package/dist/node_modules/.pnpm/@vue_compiler-core@3.5.41/node_modules/@vue/compiler-core/dist/compiler-core.cjs.mjs.map +1 -0
  12. package/dist/node_modules/.pnpm/@vue_compiler-core@3.5.41/node_modules/@vue/compiler-core/index.mjs +13 -0
  13. package/dist/node_modules/.pnpm/@vue_compiler-core@3.5.41/node_modules/@vue/compiler-core/index.mjs.map +1 -0
  14. package/dist/node_modules/.pnpm/@vue_compiler-dom@3.5.41/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.mjs +663 -0
  15. package/dist/node_modules/.pnpm/@vue_compiler-dom@3.5.41/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.mjs.map +1 -0
  16. package/dist/node_modules/.pnpm/@vue_compiler-dom@3.5.41/node_modules/@vue/compiler-dom/index.mjs +13 -0
  17. package/dist/node_modules/.pnpm/@vue_compiler-dom@3.5.41/node_modules/@vue/compiler-dom/index.mjs.map +1 -0
  18. package/dist/node_modules/.pnpm/@vue_compiler-ssr@3.5.41/node_modules/@vue/compiler-ssr/dist/compiler-ssr.cjs.mjs +846 -0
  19. package/dist/node_modules/.pnpm/@vue_compiler-ssr@3.5.41/node_modules/@vue/compiler-ssr/dist/compiler-ssr.cjs.mjs.map +1 -0
  20. package/dist/node_modules/.pnpm/@vue_reactivity@3.5.41/node_modules/@vue/reactivity/dist/reactivity.cjs.mjs +1600 -0
  21. package/dist/node_modules/.pnpm/@vue_reactivity@3.5.41/node_modules/@vue/reactivity/dist/reactivity.cjs.mjs.map +1 -0
  22. package/dist/node_modules/.pnpm/@vue_reactivity@3.5.41/node_modules/@vue/reactivity/index.mjs +13 -0
  23. package/dist/node_modules/.pnpm/@vue_reactivity@3.5.41/node_modules/@vue/reactivity/index.mjs.map +1 -0
  24. package/dist/node_modules/.pnpm/@vue_runtime-core@3.5.41/node_modules/@vue/runtime-core/dist/runtime-core.cjs.mjs +5619 -0
  25. package/dist/node_modules/.pnpm/@vue_runtime-core@3.5.41/node_modules/@vue/runtime-core/dist/runtime-core.cjs.mjs.map +1 -0
  26. package/dist/node_modules/.pnpm/@vue_runtime-core@3.5.41/node_modules/@vue/runtime-core/index.mjs +13 -0
  27. package/dist/node_modules/.pnpm/@vue_runtime-core@3.5.41/node_modules/@vue/runtime-core/index.mjs.map +1 -0
  28. package/dist/node_modules/.pnpm/@vue_runtime-dom@3.5.41/node_modules/@vue/runtime-dom/dist/runtime-dom.cjs.mjs +1479 -0
  29. package/dist/node_modules/.pnpm/@vue_runtime-dom@3.5.41/node_modules/@vue/runtime-dom/dist/runtime-dom.cjs.mjs.map +1 -0
  30. package/dist/node_modules/.pnpm/@vue_runtime-dom@3.5.41/node_modules/@vue/runtime-dom/index.mjs +13 -0
  31. package/dist/node_modules/.pnpm/@vue_runtime-dom@3.5.41/node_modules/@vue/runtime-dom/index.mjs.map +1 -0
  32. package/dist/node_modules/.pnpm/@vue_server-renderer@3.5.41/node_modules/@vue/server-renderer/dist/server-renderer.cjs.mjs +510 -0
  33. package/dist/node_modules/.pnpm/@vue_server-renderer@3.5.41/node_modules/@vue/server-renderer/dist/server-renderer.cjs.mjs.map +1 -0
  34. package/dist/node_modules/.pnpm/@vue_server-renderer@3.5.41/node_modules/@vue/server-renderer/index.mjs +13 -0
  35. package/dist/node_modules/.pnpm/@vue_server-renderer@3.5.41/node_modules/@vue/server-renderer/index.mjs.map +1 -0
  36. package/dist/node_modules/.pnpm/@vue_shared@3.5.41/node_modules/@vue/shared/dist/shared.cjs.mjs +499 -0
  37. package/dist/node_modules/.pnpm/@vue_shared@3.5.41/node_modules/@vue/shared/dist/shared.cjs.mjs.map +1 -0
  38. package/dist/node_modules/.pnpm/@vue_shared@3.5.41/node_modules/@vue/shared/index.mjs +13 -0
  39. package/dist/node_modules/.pnpm/@vue_shared@3.5.41/node_modules/@vue/shared/index.mjs.map +1 -0
  40. package/dist/node_modules/.pnpm/entities@7.0.1/node_modules/entities/dist/commonjs/decode-codepoint.mjs +79 -0
  41. package/dist/node_modules/.pnpm/entities@7.0.1/node_modules/entities/dist/commonjs/decode-codepoint.mjs.map +1 -0
  42. package/dist/node_modules/.pnpm/entities@7.0.1/node_modules/entities/dist/commonjs/decode.mjs +471 -0
  43. package/dist/node_modules/.pnpm/entities@7.0.1/node_modules/entities/dist/commonjs/decode.mjs.map +1 -0
  44. package/dist/node_modules/.pnpm/entities@7.0.1/node_modules/entities/dist/commonjs/generated/decode-data-html.mjs +16 -0
  45. package/dist/node_modules/.pnpm/entities@7.0.1/node_modules/entities/dist/commonjs/generated/decode-data-html.mjs.map +1 -0
  46. package/dist/node_modules/.pnpm/entities@7.0.1/node_modules/entities/dist/commonjs/generated/decode-data-xml.mjs +16 -0
  47. package/dist/node_modules/.pnpm/entities@7.0.1/node_modules/entities/dist/commonjs/generated/decode-data-xml.mjs.map +1 -0
  48. package/dist/node_modules/.pnpm/entities@7.0.1/node_modules/entities/dist/commonjs/internal/bin-trie-flags.mjs +30 -0
  49. package/dist/node_modules/.pnpm/entities@7.0.1/node_modules/entities/dist/commonjs/internal/bin-trie-flags.mjs.map +1 -0
  50. package/dist/node_modules/.pnpm/entities@7.0.1/node_modules/entities/dist/commonjs/internal/decode-shared.mjs +24 -0
  51. package/dist/node_modules/.pnpm/entities@7.0.1/node_modules/entities/dist/commonjs/internal/decode-shared.mjs.map +1 -0
  52. package/dist/node_modules/.pnpm/estree-walker@2.0.2/node_modules/estree-walker/dist/umd/estree-walker.mjs +253 -0
  53. package/dist/node_modules/.pnpm/estree-walker@2.0.2/node_modules/estree-walker/dist/umd/estree-walker.mjs.map +1 -0
  54. package/dist/node_modules/.pnpm/react-dom@19.2.8_react@19.2.8/node_modules/react-dom/cjs/react-dom-server-legacy.node.development.mjs +5246 -0
  55. package/dist/node_modules/.pnpm/react-dom@19.2.8_react@19.2.8/node_modules/react-dom/cjs/react-dom-server-legacy.node.development.mjs.map +1 -0
  56. package/dist/node_modules/.pnpm/react-dom@19.2.8_react@19.2.8/node_modules/react-dom/cjs/react-dom-server.node.development.mjs +5616 -0
  57. package/dist/node_modules/.pnpm/react-dom@19.2.8_react@19.2.8/node_modules/react-dom/cjs/react-dom-server.node.development.mjs.map +1 -0
  58. package/dist/node_modules/.pnpm/react-dom@19.2.8_react@19.2.8/node_modules/react-dom/cjs/react-dom.development.mjs +183 -0
  59. package/dist/node_modules/.pnpm/react-dom@19.2.8_react@19.2.8/node_modules/react-dom/cjs/react-dom.development.mjs.map +1 -0
  60. package/dist/node_modules/.pnpm/react-dom@19.2.8_react@19.2.8/node_modules/react-dom/index.mjs +13 -0
  61. package/dist/node_modules/.pnpm/react-dom@19.2.8_react@19.2.8/node_modules/react-dom/index.mjs.map +1 -0
  62. package/dist/node_modules/.pnpm/react-dom@19.2.8_react@19.2.8/node_modules/react-dom/server.node.mjs +21 -0
  63. package/dist/node_modules/.pnpm/react-dom@19.2.8_react@19.2.8/node_modules/react-dom/server.node.mjs.map +1 -0
  64. package/dist/node_modules/.pnpm/react@19.2.8/node_modules/react/cjs/react.development.mjs +766 -0
  65. package/dist/node_modules/.pnpm/react@19.2.8/node_modules/react/cjs/react.development.mjs.map +1 -0
  66. package/dist/node_modules/.pnpm/react@19.2.8/node_modules/react/index.mjs +13 -0
  67. package/dist/node_modules/.pnpm/react@19.2.8/node_modules/react/index.mjs.map +1 -0
  68. package/dist/node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/array-set.mjs +100 -0
  69. package/dist/node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/array-set.mjs.map +1 -0
  70. package/dist/node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/base64-vlq.mjs +73 -0
  71. package/dist/node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/base64-vlq.mjs.map +1 -0
  72. package/dist/node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/base64.mjs +41 -0
  73. package/dist/node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/base64.mjs.map +1 -0
  74. package/dist/node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/binary-search.mjs +68 -0
  75. package/dist/node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/binary-search.mjs.map +1 -0
  76. package/dist/node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/mapping-list.mjs +77 -0
  77. package/dist/node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/mapping-list.mjs.map +1 -0
  78. package/dist/node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/quick-sort.mjs +89 -0
  79. package/dist/node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/quick-sort.mjs.map +1 -0
  80. package/dist/node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/source-map-consumer.mjs +788 -0
  81. package/dist/node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/source-map-consumer.mjs.map +1 -0
  82. package/dist/node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/source-map-generator.mjs +295 -0
  83. package/dist/node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/source-map-generator.mjs.map +1 -0
  84. package/dist/node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/source-node.mjs +293 -0
  85. package/dist/node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/source-node.mjs.map +1 -0
  86. package/dist/node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/util.mjs +352 -0
  87. package/dist/node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/lib/util.mjs.map +1 -0
  88. package/dist/node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/source-map.mjs +17 -0
  89. package/dist/node_modules/.pnpm/source-map-js@1.2.1/node_modules/source-map-js/source-map.mjs.map +1 -0
  90. package/dist/node_modules/.pnpm/vue@3.5.41_typescript@5.9.3/node_modules/vue/dist/vue.cjs.mjs +67 -0
  91. package/dist/node_modules/.pnpm/vue@3.5.41_typescript@5.9.3/node_modules/vue/dist/vue.cjs.mjs.map +1 -0
  92. package/dist/node_modules/.pnpm/vue@3.5.41_typescript@5.9.3/node_modules/vue/index.mjs +13 -0
  93. package/dist/node_modules/.pnpm/vue@3.5.41_typescript@5.9.3/node_modules/vue/index.mjs.map +1 -0
  94. package/dist/node_modules/.pnpm/vue@3.5.41_typescript@5.9.3/node_modules/vue/index2.mjs +10 -0
  95. package/dist/node_modules/.pnpm/vue@3.5.41_typescript@5.9.3/node_modules/vue/index2.mjs.map +1 -0
  96. package/dist/node_modules/.pnpm/vue@3.5.41_typescript@5.9.3/node_modules/vue/server-renderer/index.mjs +10 -0
  97. package/dist/node_modules/.pnpm/vue@3.5.41_typescript@5.9.3/node_modules/vue/server-renderer/index.mjs.map +1 -0
  98. package/dist/server/cli/bin.d.mts +1 -0
  99. package/dist/server/cli/bin.mjs +8 -0
  100. package/dist/server/cli/bin.mjs.map +1 -0
  101. package/dist/server/cli/cli-spec.mjs +150 -0
  102. package/dist/server/cli/cli-spec.mjs.map +1 -0
  103. package/dist/server/cli/index.d.mts +16 -0
  104. package/dist/server/cli/index.d.mts.map +1 -0
  105. package/dist/server/cli/index.mjs +64 -0
  106. package/dist/server/cli/index.mjs.map +1 -0
  107. package/dist/server/compile/adaptors/html-partials.d.mts +24 -0
  108. package/dist/server/compile/adaptors/html-partials.d.mts.map +1 -0
  109. package/dist/server/compile/adaptors/html-partials.mjs +50 -0
  110. package/dist/server/compile/adaptors/html-partials.mjs.map +1 -0
  111. package/dist/server/compile/adaptors/html.d.mts +15 -0
  112. package/dist/server/compile/adaptors/html.d.mts.map +1 -0
  113. package/dist/server/compile/adaptors/html.mjs +39 -0
  114. package/dist/server/compile/adaptors/html.mjs.map +1 -0
  115. package/dist/server/compile/adaptors/node-require.d.mts +6 -0
  116. package/dist/server/compile/adaptors/node-require.d.mts.map +1 -0
  117. package/dist/server/compile/adaptors/node-require.mjs +35 -0
  118. package/dist/server/compile/adaptors/node-require.mjs.map +1 -0
  119. package/dist/server/compile/adaptors/react-browser.d.mts +20 -0
  120. package/dist/server/compile/adaptors/react-browser.d.mts.map +1 -0
  121. package/dist/server/compile/adaptors/react-browser.mjs +19 -0
  122. package/dist/server/compile/adaptors/react-browser.mjs.map +1 -0
  123. package/dist/server/compile/adaptors/react-node.d.mts +17 -0
  124. package/dist/server/compile/adaptors/react-node.d.mts.map +1 -0
  125. package/dist/server/compile/adaptors/react-node.mjs +50 -0
  126. package/dist/server/compile/adaptors/react-node.mjs.map +1 -0
  127. package/dist/server/compile/adaptors/types.d.mts +14 -0
  128. package/dist/server/compile/adaptors/types.d.mts.map +1 -0
  129. package/dist/server/compile/adaptors/types.mjs +1 -0
  130. package/dist/server/compile/adaptors/vue-browser.d.mts +16 -0
  131. package/dist/server/compile/adaptors/vue-browser.d.mts.map +1 -0
  132. package/dist/server/compile/adaptors/vue-browser.mjs +16 -0
  133. package/dist/server/compile/adaptors/vue-browser.mjs.map +1 -0
  134. package/dist/server/compile/adaptors/vue-node.d.mts +17 -0
  135. package/dist/server/compile/adaptors/vue-node.d.mts.map +1 -0
  136. package/dist/server/compile/adaptors/vue-node.mjs +50 -0
  137. package/dist/server/compile/adaptors/vue-node.mjs.map +1 -0
  138. package/dist/server/compile/build-entry-module.d.mts +20 -0
  139. package/dist/server/compile/build-entry-module.d.mts.map +1 -0
  140. package/dist/server/compile/build-entry-module.mjs +56 -0
  141. package/dist/server/compile/build-entry-module.mjs.map +1 -0
  142. package/dist/server/compile/bundle-name.d.mts +5 -0
  143. package/dist/server/compile/bundle-name.d.mts.map +1 -0
  144. package/dist/server/compile/bundle-name.mjs +13 -0
  145. package/dist/server/compile/bundle-name.mjs.map +1 -0
  146. package/dist/server/compile/compile-cache.d.mts +23 -0
  147. package/dist/server/compile/compile-cache.d.mts.map +1 -0
  148. package/dist/server/compile/compile-cache.mjs +102 -0
  149. package/dist/server/compile/compile-cache.mjs.map +1 -0
  150. package/dist/server/compile/compile.d.mts +100 -0
  151. package/dist/server/compile/compile.d.mts.map +1 -0
  152. package/dist/server/compile/compile.mjs +735 -0
  153. package/dist/server/compile/compile.mjs.map +1 -0
  154. package/dist/server/compile/constants.d.mts +11 -0
  155. package/dist/server/compile/constants.d.mts.map +1 -0
  156. package/dist/server/compile/constants.mjs +12 -0
  157. package/dist/server/compile/constants.mjs.map +1 -0
  158. package/dist/server/compile/create-renderer.d.mts +16 -0
  159. package/dist/server/compile/create-renderer.d.mts.map +1 -0
  160. package/dist/server/compile/create-renderer.mjs +59 -0
  161. package/dist/server/compile/create-renderer.mjs.map +1 -0
  162. package/dist/server/compile/decode-style-entities.d.mts +12 -0
  163. package/dist/server/compile/decode-style-entities.d.mts.map +1 -0
  164. package/dist/server/compile/decode-style-entities.mjs +32 -0
  165. package/dist/server/compile/decode-style-entities.mjs.map +1 -0
  166. package/dist/server/compile/defaults.d.mts +18 -0
  167. package/dist/server/compile/defaults.d.mts.map +1 -0
  168. package/dist/server/compile/defaults.mjs +128 -0
  169. package/dist/server/compile/defaults.mjs.map +1 -0
  170. package/dist/server/compile/dependency-closure.d.mts +10 -0
  171. package/dist/server/compile/dependency-closure.d.mts.map +1 -0
  172. package/dist/server/compile/dependency-closure.mjs +79 -0
  173. package/dist/server/compile/dependency-closure.mjs.map +1 -0
  174. package/dist/server/compile/document-assets.d.mts +103 -0
  175. package/dist/server/compile/document-assets.d.mts.map +1 -0
  176. package/dist/server/compile/document-assets.mjs +184 -0
  177. package/dist/server/compile/document-assets.mjs.map +1 -0
  178. package/dist/server/compile/finalize-document-html.d.mts +53 -0
  179. package/dist/server/compile/finalize-document-html.d.mts.map +1 -0
  180. package/dist/server/compile/finalize-document-html.mjs +132 -0
  181. package/dist/server/compile/finalize-document-html.mjs.map +1 -0
  182. package/dist/server/compile/generated/adaptorHtml.mjs +6 -0
  183. package/dist/server/compile/generated/adaptorHtml.mjs.map +1 -0
  184. package/dist/server/compile/generated/adaptorReactBrowser.mjs +6 -0
  185. package/dist/server/compile/generated/adaptorReactBrowser.mjs.map +1 -0
  186. package/dist/server/compile/generated/adaptorReactNode.mjs +6 -0
  187. package/dist/server/compile/generated/adaptorReactNode.mjs.map +1 -0
  188. package/dist/server/compile/generated/adaptorVueBrowser.mjs +6 -0
  189. package/dist/server/compile/generated/adaptorVueBrowser.mjs.map +1 -0
  190. package/dist/server/compile/generated/adaptorVueNode.mjs +6 -0
  191. package/dist/server/compile/generated/adaptorVueNode.mjs.map +1 -0
  192. package/dist/server/compile/generated/createRenderer.mjs +6 -0
  193. package/dist/server/compile/generated/createRenderer.mjs.map +1 -0
  194. package/dist/server/compile/generated/decodeStyleEntities.mjs +6 -0
  195. package/dist/server/compile/generated/decodeStyleEntities.mjs.map +1 -0
  196. package/dist/server/compile/generated/sanitizeHtml.mjs +6 -0
  197. package/dist/server/compile/generated/sanitizeHtml.mjs.map +1 -0
  198. package/dist/server/compile/generated/validate.mjs +6 -0
  199. package/dist/server/compile/generated/validate.mjs.map +1 -0
  200. package/dist/server/compile/generated/virtualStyles.mjs +6 -0
  201. package/dist/server/compile/generated/virtualStyles.mjs.map +1 -0
  202. package/dist/server/compile/get-renderer.d.mts +18 -0
  203. package/dist/server/compile/get-renderer.d.mts.map +1 -0
  204. package/dist/server/compile/get-renderer.mjs +31 -0
  205. package/dist/server/compile/get-renderer.mjs.map +1 -0
  206. package/dist/server/compile/index.d.mts +2 -0
  207. package/dist/server/compile/index.mjs +3 -0
  208. package/dist/server/compile/make-config.d.mts +39 -0
  209. package/dist/server/compile/make-config.d.mts.map +1 -0
  210. package/dist/server/compile/make-config.mjs +272 -0
  211. package/dist/server/compile/make-config.mjs.map +1 -0
  212. package/dist/server/compile/package-json.d.mts +5 -0
  213. package/dist/server/compile/package-json.d.mts.map +1 -0
  214. package/dist/server/compile/package-json.mjs +33 -0
  215. package/dist/server/compile/package-json.mjs.map +1 -0
  216. package/dist/server/compile/producer-agreement.d.mts +82 -0
  217. package/dist/server/compile/producer-agreement.d.mts.map +1 -0
  218. package/dist/server/compile/producer-agreement.mjs +143 -0
  219. package/dist/server/compile/producer-agreement.mjs.map +1 -0
  220. package/dist/server/compile/producer-release.d.mts +19 -0
  221. package/dist/server/compile/producer-release.d.mts.map +1 -0
  222. package/dist/server/compile/producer-release.mjs +27 -0
  223. package/dist/server/compile/producer-release.mjs.map +1 -0
  224. package/dist/server/compile/render-error.d.mts +37 -0
  225. package/dist/server/compile/render-error.d.mts.map +1 -0
  226. package/dist/server/compile/render-error.mjs +55 -0
  227. package/dist/server/compile/render-error.mjs.map +1 -0
  228. package/dist/server/compile/sanitize/shared.d.mts +19 -0
  229. package/dist/server/compile/sanitize/shared.d.mts.map +1 -0
  230. package/dist/server/compile/sanitize/shared.mjs +131 -0
  231. package/dist/server/compile/sanitize/shared.mjs.map +1 -0
  232. package/dist/server/compile/sanitize-html.d.mts +5 -0
  233. package/dist/server/compile/sanitize-html.d.mts.map +1 -0
  234. package/dist/server/compile/sanitize-html.mjs +65 -0
  235. package/dist/server/compile/sanitize-html.mjs.map +1 -0
  236. package/dist/server/compile/structured-log.d.mts +22 -0
  237. package/dist/server/compile/structured-log.d.mts.map +1 -0
  238. package/dist/server/compile/structured-log.mjs +31 -0
  239. package/dist/server/compile/structured-log.mjs.map +1 -0
  240. package/dist/server/compile/virtual-styles.d.mts +5 -0
  241. package/dist/server/compile/virtual-styles.d.mts.map +1 -0
  242. package/dist/server/compile/virtual-styles.mjs +19 -0
  243. package/dist/server/compile/virtual-styles.mjs.map +1 -0
  244. package/dist/server/compile/wrapper-source.d.mts +55 -0
  245. package/dist/server/compile/wrapper-source.d.mts.map +1 -0
  246. package/dist/server/compile/wrapper-source.mjs +187 -0
  247. package/dist/server/compile/wrapper-source.mjs.map +1 -0
  248. package/dist/server/constants.d.mts +17 -0
  249. package/dist/server/constants.d.mts.map +1 -0
  250. package/dist/server/constants.mjs +41 -0
  251. package/dist/server/constants.mjs.map +1 -0
  252. package/dist/server/errors.d.mts +21 -0
  253. package/dist/server/errors.d.mts.map +1 -0
  254. package/dist/server/errors.mjs +24 -0
  255. package/dist/server/errors.mjs.map +1 -0
  256. package/dist/server/index.d.mts +4 -0
  257. package/dist/server/index.mjs +4 -0
  258. package/dist/server/integrations/nextjs/generate-entry.d.mts +19 -0
  259. package/dist/server/integrations/nextjs/generate-entry.d.mts.map +1 -0
  260. package/dist/server/integrations/nextjs/generate-entry.mjs +246 -0
  261. package/dist/server/integrations/nextjs/generate-entry.mjs.map +1 -0
  262. package/dist/server/integrations/nextjs/index.d.mts +8 -0
  263. package/dist/server/integrations/nextjs/index.d.mts.map +1 -0
  264. package/dist/server/integrations/nextjs/index.mjs +90 -0
  265. package/dist/server/integrations/nextjs/index.mjs.map +1 -0
  266. package/dist/server/integrations/nextjs/watcher.d.mts +9 -0
  267. package/dist/server/integrations/nextjs/watcher.d.mts.map +1 -0
  268. package/dist/server/integrations/nextjs/watcher.mjs +45 -0
  269. package/dist/server/integrations/nextjs/watcher.mjs.map +1 -0
  270. package/dist/server/integrations/unplugin/esbuild.d.mts +2 -0
  271. package/dist/server/integrations/unplugin/esbuild.mjs +3 -0
  272. package/dist/server/integrations/unplugin/index.d.mts +69 -0
  273. package/dist/server/integrations/unplugin/index.d.mts.map +1 -0
  274. package/dist/server/integrations/unplugin/index.mjs +539 -0
  275. package/dist/server/integrations/unplugin/index.mjs.map +1 -0
  276. package/dist/server/integrations/unplugin/rollup.d.mts +2 -0
  277. package/dist/server/integrations/unplugin/rollup.mjs +3 -0
  278. package/dist/server/integrations/unplugin/utils.d.mts +12 -0
  279. package/dist/server/integrations/unplugin/utils.d.mts.map +1 -0
  280. package/dist/server/integrations/unplugin/utils.mjs +46 -0
  281. package/dist/server/integrations/unplugin/utils.mjs.map +1 -0
  282. package/dist/server/integrations/unplugin/vite.d.mts +2 -0
  283. package/dist/server/integrations/unplugin/vite.mjs +3 -0
  284. package/dist/server/integrations/unplugin/webpack.d.mts +2 -0
  285. package/dist/server/integrations/unplugin/webpack.mjs +3 -0
  286. package/dist/server/project/documents.d.mts +21 -0
  287. package/dist/server/project/documents.d.mts.map +1 -0
  288. package/dist/server/project/documents.mjs +114 -0
  289. package/dist/server/project/documents.mjs.map +1 -0
  290. package/dist/server/project/format-env-types.d.mts +19 -0
  291. package/dist/server/project/format-env-types.d.mts.map +1 -0
  292. package/dist/server/project/format-env-types.mjs +64 -0
  293. package/dist/server/project/format-env-types.mjs.map +1 -0
  294. package/dist/server/project/paths.d.mts +21 -0
  295. package/dist/server/project/paths.d.mts.map +1 -0
  296. package/dist/server/project/paths.mjs +31 -0
  297. package/dist/server/project/paths.mjs.map +1 -0
  298. package/dist/server/project/user-project-dir.d.mts +7 -0
  299. package/dist/server/project/user-project-dir.d.mts.map +1 -0
  300. package/dist/server/project/user-project-dir.mjs +16 -0
  301. package/dist/server/project/user-project-dir.mjs.map +1 -0
  302. package/dist/server/render-worker/client.d.mts +83 -0
  303. package/dist/server/render-worker/client.d.mts.map +1 -0
  304. package/dist/server/render-worker/client.mjs +359 -0
  305. package/dist/server/render-worker/client.mjs.map +1 -0
  306. package/dist/server/render-worker/document-css.d.mts +27 -0
  307. package/dist/server/render-worker/document-css.d.mts.map +1 -0
  308. package/dist/server/render-worker/document-css.mjs +37 -0
  309. package/dist/server/render-worker/document-css.mjs.map +1 -0
  310. package/dist/server/render-worker/env.d.mts +11 -0
  311. package/dist/server/render-worker/env.d.mts.map +1 -0
  312. package/dist/server/render-worker/env.mjs +26 -0
  313. package/dist/server/render-worker/env.mjs.map +1 -0
  314. package/dist/server/render-worker/error.d.mts +17 -0
  315. package/dist/server/render-worker/error.d.mts.map +1 -0
  316. package/dist/server/render-worker/error.mjs +40 -0
  317. package/dist/server/render-worker/error.mjs.map +1 -0
  318. package/dist/server/render-worker/host.d.mts +1 -0
  319. package/dist/server/render-worker/host.mjs +181 -0
  320. package/dist/server/render-worker/host.mjs.map +1 -0
  321. package/dist/server/render-worker/index.d.mts +4 -0
  322. package/dist/server/render-worker/index.mjs +4 -0
  323. package/dist/server/render-worker/sandbox.d.mts +25 -0
  324. package/dist/server/render-worker/sandbox.d.mts.map +1 -0
  325. package/dist/server/render-worker/sandbox.mjs +60 -0
  326. package/dist/server/render-worker/sandbox.mjs.map +1 -0
  327. package/dist/server/render-worker/types.d.mts +59 -0
  328. package/dist/server/render-worker/types.d.mts.map +1 -0
  329. package/dist/server/render-worker/types.mjs +1 -0
  330. package/dist/server/runtime-state.d.mts +12 -0
  331. package/dist/server/runtime-state.d.mts.map +1 -0
  332. package/dist/server/runtime-state.mjs +24 -0
  333. package/dist/server/runtime-state.mjs.map +1 -0
  334. package/dist/server/utils/check-dir.d.mts +12 -0
  335. package/dist/server/utils/check-dir.d.mts.map +1 -0
  336. package/dist/server/utils/check-dir.mjs +30 -0
  337. package/dist/server/utils/check-dir.mjs.map +1 -0
  338. package/dist/server/utils/dependencies.d.mts +11 -0
  339. package/dist/server/utils/dependencies.d.mts.map +1 -0
  340. package/dist/server/utils/dependencies.mjs +34 -0
  341. package/dist/server/utils/dependencies.mjs.map +1 -0
  342. package/dist/server/utils/env-var.d.mts +6 -0
  343. package/dist/server/utils/env-var.d.mts.map +1 -0
  344. package/dist/server/utils/env-var.mjs +28 -0
  345. package/dist/server/utils/env-var.mjs.map +1 -0
  346. package/dist/server/utils/format-for-log.d.mts +5 -0
  347. package/dist/server/utils/format-for-log.d.mts.map +1 -0
  348. package/dist/server/utils/format-for-log.mjs +17 -0
  349. package/dist/server/utils/format-for-log.mjs.map +1 -0
  350. package/dist/server/utils/index.d.mts +8 -0
  351. package/dist/server/utils/index.mjs +9 -0
  352. package/dist/server/utils/load-config.d.mts +13 -0
  353. package/dist/server/utils/load-config.d.mts.map +1 -0
  354. package/dist/server/utils/load-config.mjs +65 -0
  355. package/dist/server/utils/load-config.mjs.map +1 -0
  356. package/dist/server/utils/log.d.mts +36 -0
  357. package/dist/server/utils/log.d.mts.map +1 -0
  358. package/dist/server/utils/log.mjs +125 -0
  359. package/dist/server/utils/log.mjs.map +1 -0
  360. package/dist/server/utils/read-file.d.mts +5 -0
  361. package/dist/server/utils/read-file.d.mts.map +1 -0
  362. package/dist/server/utils/read-file.mjs +14 -0
  363. package/dist/server/utils/read-file.mjs.map +1 -0
  364. package/dist/server/utils/resolve-path-with-extensions.d.mts +21 -0
  365. package/dist/server/utils/resolve-path-with-extensions.d.mts.map +1 -0
  366. package/dist/server/utils/resolve-path-with-extensions.mjs +39 -0
  367. package/dist/server/utils/resolve-path-with-extensions.mjs.map +1 -0
  368. package/dist/server/utils/schema.d.mts +7 -0
  369. package/dist/server/utils/schema.d.mts.map +1 -0
  370. package/dist/server/utils/schema.mjs +21 -0
  371. package/dist/server/utils/schema.mjs.map +1 -0
  372. package/dist/server/utils/standard-schema-validate.d.mts +13 -0
  373. package/dist/server/utils/standard-schema-validate.d.mts.map +1 -0
  374. package/dist/server/utils/standard-schema-validate.mjs +21 -0
  375. package/dist/server/utils/standard-schema-validate.mjs.map +1 -0
  376. package/dist/server/utils/suggest-similar.d.mts +9 -0
  377. package/dist/server/utils/suggest-similar.d.mts.map +1 -0
  378. package/dist/server/utils/suggest-similar.mjs +39 -0
  379. package/dist/server/utils/suggest-similar.mjs.map +1 -0
  380. package/dist/server/utils/warn-lockstep.d.mts +13 -0
  381. package/dist/server/utils/warn-lockstep.d.mts.map +1 -0
  382. package/dist/server/utils/warn-lockstep.mjs +23 -0
  383. package/dist/server/utils/warn-lockstep.mjs.map +1 -0
  384. package/dist/server/vite/create-config.d.mts +35 -0
  385. package/dist/server/vite/create-config.d.mts.map +1 -0
  386. package/dist/server/vite/create-config.mjs +64 -0
  387. package/dist/server/vite/create-config.mjs.map +1 -0
  388. package/dist/server/vite/plugins/collect-css.d.mts +8 -0
  389. package/dist/server/vite/plugins/collect-css.d.mts.map +1 -0
  390. package/dist/server/vite/plugins/collect-css.mjs +21 -0
  391. package/dist/server/vite/plugins/collect-css.mjs.map +1 -0
  392. package/dist/server/vite/plugins/get-styles.d.mts +14 -0
  393. package/dist/server/vite/plugins/get-styles.d.mts.map +1 -0
  394. package/dist/server/vite/plugins/get-styles.mjs +88 -0
  395. package/dist/server/vite/plugins/get-styles.mjs.map +1 -0
  396. package/dist/server/vite/plugins/html-loader.d.mts +18 -0
  397. package/dist/server/vite/plugins/html-loader.d.mts.map +1 -0
  398. package/dist/server/vite/plugins/html-loader.mjs +88 -0
  399. package/dist/server/vite/plugins/html-loader.mjs.map +1 -0
  400. package/dist/server/vite/plugins/postcss/import-url.d.mts +14 -0
  401. package/dist/server/vite/plugins/postcss/import-url.d.mts.map +1 -0
  402. package/dist/server/vite/plugins/postcss/import-url.mjs +163 -0
  403. package/dist/server/vite/plugins/postcss/import-url.mjs.map +1 -0
  404. package/dist/server/vite/plugins/styles-pre-processor.d.mts +7 -0
  405. package/dist/server/vite/plugins/styles-pre-processor.d.mts.map +1 -0
  406. package/dist/server/vite/plugins/styles-pre-processor.mjs +64 -0
  407. package/dist/server/vite/plugins/styles-pre-processor.mjs.map +1 -0
  408. package/dist/server/vite/plugins/utils.d.mts +9 -0
  409. package/dist/server/vite/plugins/utils.d.mts.map +1 -0
  410. package/dist/server/vite/plugins/utils.mjs +14 -0
  411. package/dist/server/vite/plugins/utils.mjs.map +1 -0
  412. package/dist/shared/constants.d.mts +11 -0
  413. package/dist/shared/constants.d.mts.map +1 -0
  414. package/dist/shared/constants.mjs +12 -0
  415. package/dist/shared/constants.mjs.map +1 -0
  416. package/dist/shared/env.d.mts +6 -0
  417. package/dist/shared/env.d.mts.map +1 -0
  418. package/dist/shared/env.mjs +11 -0
  419. package/dist/shared/env.mjs.map +1 -0
  420. package/dist/shared/http.d.mts +15 -0
  421. package/dist/shared/http.d.mts.map +1 -0
  422. package/dist/shared/http.mjs +54 -0
  423. package/dist/shared/http.mjs.map +1 -0
  424. package/dist/shared/types/document.d.mts +17 -0
  425. package/dist/shared/types/document.d.mts.map +1 -0
  426. package/dist/shared/types/document.mjs +1 -0
  427. package/dist/shared/types/index.d.mts +7 -0
  428. package/dist/shared/types/index.mjs +4 -0
  429. package/dist/shared/types/log.d.mts +10 -0
  430. package/dist/shared/types/log.d.mts.map +1 -0
  431. package/dist/shared/types/log.mjs +12 -0
  432. package/dist/shared/types/log.mjs.map +1 -0
  433. package/dist/shared/types/public/cli.d.mts +33 -0
  434. package/dist/shared/types/public/cli.d.mts.map +1 -0
  435. package/dist/shared/types/public/cli.mjs +1 -0
  436. package/dist/shared/types/public/compile.d.mts +45 -0
  437. package/dist/shared/types/public/compile.d.mts.map +1 -0
  438. package/dist/shared/types/public/compile.mjs +29 -0
  439. package/dist/shared/types/public/compile.mjs.map +1 -0
  440. package/dist/shared/types/public/config.d.mts +94 -0
  441. package/dist/shared/types/public/config.d.mts.map +1 -0
  442. package/dist/shared/types/public/config.mjs +20 -0
  443. package/dist/shared/types/public/config.mjs.map +1 -0
  444. package/dist/shared/types/public/index.d.mts +6 -0
  445. package/dist/shared/types/public/index.mjs +4 -0
  446. package/dist/shared/types/public/nextjs.d.mts +111 -0
  447. package/dist/shared/types/public/nextjs.d.mts.map +1 -0
  448. package/dist/shared/types/public/nextjs.mjs +1 -0
  449. package/dist/shared/types/public/renderer.d.mts +2 -0
  450. package/dist/shared/types/public/renderer.mjs +1 -0
  451. package/dist/shared/types/public/unplugin.d.mts +65 -0
  452. package/dist/shared/types/public/unplugin.d.mts.map +1 -0
  453. package/dist/shared/types/public/unplugin.mjs +1 -0
  454. package/dist/shared/types/server.d.mts +5 -0
  455. package/dist/shared/types/server.d.mts.map +1 -0
  456. package/dist/shared/types/server.mjs +1 -0
  457. package/dist/shared/types/state.d.mts +15 -0
  458. package/dist/shared/types/state.d.mts.map +1 -0
  459. package/dist/shared/types/state.mjs +1 -0
  460. package/dist/shared/types/system.d.mts +18 -0
  461. package/dist/shared/types/system.d.mts.map +1 -0
  462. package/dist/shared/types/system.mjs +1 -0
  463. package/package.json +146 -34
  464. package/types/next.d.ts +6 -0
  465. package/index.d.ts +0 -2
  466. package/index.js +0 -3
@@ -0,0 +1,6 @@
1
+ //#region src/server/compile/generated/validate.mjs?raw
2
+ var validate_default = "//#region src/server/utils/standard-schema-validate.ts\nfunction hasIssues(x) {\n return typeof x === \"object\" && x !== null && \"issues\" in x;\n}\nasync function validate(schema, input) {\n let result = schema[\"~standard\"].validate(input);\n if (result instanceof Promise) result = await result;\n if (hasIssues(result)) return {\n ok: false,\n errors: result.issues ?? []\n };\n return {\n ok: true,\n data: result.value\n };\n}\nvar standard_schema_validate_default = validate;\n\n//#endregion\nexport { standard_schema_validate_default as default, validate };";
3
+
4
+ //#endregion
5
+ export { validate_default as default };
6
+ //# sourceMappingURL=validate.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.mjs","names":[],"sources":["../../../../src/server/compile/generated/validate.mjs?raw"],"sourcesContent":["export default \"//#region src/server/utils/standard-schema-validate.ts\\nfunction hasIssues(x) {\\n\\treturn typeof x === \\\"object\\\" && x !== null && \\\"issues\\\" in x;\\n}\\nasync function validate(schema, input) {\\n\\tlet result = schema[\\\"~standard\\\"].validate(input);\\n\\tif (result instanceof Promise) result = await result;\\n\\tif (hasIssues(result)) return {\\n\\t\\tok: false,\\n\\t\\terrors: result.issues ?? []\\n\\t};\\n\\treturn {\\n\\t\\tok: true,\\n\\t\\tdata: result.value\\n\\t};\\n}\\nvar standard_schema_validate_default = validate;\\n\\n//#endregion\\nexport { standard_schema_validate_default as default, validate };\""],"mappings":";AAAA,uBAAe"}
@@ -0,0 +1,6 @@
1
+ //#region src/server/compile/generated/virtualStyles.mjs?raw
2
+ var virtualStyles_default = "//#region src/server/compile/constants.ts\nconst STYLES_BY_FILE_REPLACEMENT = \"__FMT_STYLES_BY_FILE__\";\nconst ENTRY_CSS_FILES_REPLACEMENT = \"__FMT_ENTRY_CSS_FILES__\";\n\n//#endregion\n//#region src/server/compile/virtual-styles.ts\nconst stylesByFile = STYLES_BY_FILE_REPLACEMENT;\nconst entryCssFiles = ENTRY_CSS_FILES_REPLACEMENT;\nconst cache = Object.create(null);\nfunction getEntryStyles(entryName) {\n if (cache[entryName]) return cache[entryName];\n const files = entryCssFiles[entryName] || [];\n let styles = \"\";\n for (const file of files) styles += stylesByFile[file] || \"\";\n cache[entryName] = styles;\n return styles;\n}\nvar virtual_styles_default = getEntryStyles;\n\n//#endregion\nexport { virtual_styles_default as default, getEntryStyles };";
3
+
4
+ //#endregion
5
+ export { virtualStyles_default as default };
6
+ //# sourceMappingURL=virtualStyles.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"virtualStyles.mjs","names":[],"sources":["../../../../src/server/compile/generated/virtualStyles.mjs?raw"],"sourcesContent":["export default \"//#region src/server/compile/constants.ts\\nconst STYLES_BY_FILE_REPLACEMENT = \\\"__FMT_STYLES_BY_FILE__\\\";\\nconst ENTRY_CSS_FILES_REPLACEMENT = \\\"__FMT_ENTRY_CSS_FILES__\\\";\\n\\n//#endregion\\n//#region src/server/compile/virtual-styles.ts\\nconst stylesByFile = STYLES_BY_FILE_REPLACEMENT;\\nconst entryCssFiles = ENTRY_CSS_FILES_REPLACEMENT;\\nconst cache = Object.create(null);\\nfunction getEntryStyles(entryName) {\\n\\tif (cache[entryName]) return cache[entryName];\\n\\tconst files = entryCssFiles[entryName] || [];\\n\\tlet styles = \\\"\\\";\\n\\tfor (const file of files) styles += stylesByFile[file] || \\\"\\\";\\n\\tcache[entryName] = styles;\\n\\treturn styles;\\n}\\nvar virtual_styles_default = getEntryStyles;\\n\\n//#endregion\\nexport { virtual_styles_default as default, getEntryStyles };\""],"mappings":";AAAA,4BAAe"}
@@ -0,0 +1,18 @@
1
+ import { FormatConfig } from "../../shared/types/public/config.mjs";
2
+
3
+ //#region src/server/compile/get-renderer.d.ts
4
+ interface GetRendererArgs {
5
+ dir: string;
6
+ documentName: string;
7
+ variant?: string;
8
+ config: FormatConfig;
9
+ bundle?: Record<string, any>;
10
+ }
11
+ declare function loadRendererBundle(dir: string, documentName?: string): Promise<Record<string, any>>;
12
+ declare function getRenderer(args: GetRendererArgs): Promise<{
13
+ pdfRenderer: any;
14
+ data: any;
15
+ }>;
16
+ //#endregion
17
+ export { getRenderer, loadRendererBundle };
18
+ //# sourceMappingURL=get-renderer.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-renderer.d.mts","names":[],"sources":["../../../src/server/compile/get-renderer.ts"],"sourcesContent":[],"mappings":";;;UAQU,eAAA;;EAAA,YAAA,EAAA,MAAe;EAQH,OAAA,CAAA,EAAA,MAAA;EA0BA,MAAA,EA9Bb,YA8BwB;WA7BvB;;iBAGY,kBAAA,sCAAwD,QAAQ;iBA0BhE,WAAA,OAAkB,kBAAe"}
@@ -0,0 +1,31 @@
1
+ import { BUNDLE_ENTRY_POINT_FILE_NAME } from "./constants.mjs";
2
+ import { DEFAULT_VARIANT } from "../../shared/constants.mjs";
3
+ import { getDocumentDataFile } from "../project/documents.mjs";
4
+ import { resolve } from "node:path";
5
+ import { pathToFileURL } from "node:url";
6
+ import { getDocumentExportName } from "@format.dev/cli/scaffold";
7
+
8
+ //#region src/server/compile/get-renderer.ts
9
+ async function loadRendererBundle(dir, documentName) {
10
+ const entryPath = documentName != null ? resolve(dir, documentName, BUNDLE_ENTRY_POINT_FILE_NAME) : resolve(dir, BUNDLE_ENTRY_POINT_FILE_NAME);
11
+ const url = new URL(pathToFileURL(entryPath).href);
12
+ url.search = `?t=${`${Date.now()}-${Math.random().toString(36).slice(2)}`}`;
13
+ return import(url.href);
14
+ }
15
+ function resolveRenderer(bundle, documentName) {
16
+ const exportName = getDocumentExportName(documentName);
17
+ const renderer = bundle?.[exportName] ?? bundle?.default?.[exportName] ?? bundle?.default?.default?.[exportName];
18
+ if (!renderer) throw new Error(`Renderer export "${exportName}" not found for document "${documentName}".`);
19
+ return renderer;
20
+ }
21
+ async function getRenderer(args) {
22
+ const { dir, documentName, config, variant = DEFAULT_VARIANT, bundle } = args;
23
+ return {
24
+ pdfRenderer: resolveRenderer(bundle ?? await loadRendererBundle(dir, documentName), documentName),
25
+ data: await getDocumentDataFile(documentName, variant, config)
26
+ };
27
+ }
28
+
29
+ //#endregion
30
+ export { getRenderer, loadRendererBundle };
31
+ //# sourceMappingURL=get-renderer.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-renderer.mjs","names":[],"sources":["../../../src/server/compile/get-renderer.ts"],"sourcesContent":["import type { FormatConfig } from '../../shared/types/public/config'\nimport { resolve } from 'node:path'\nimport { pathToFileURL } from 'node:url'\nimport { getDocumentDataFile } from '../project/documents'\nimport { DEFAULT_VARIANT } from '../../shared/constants'\nimport { BUNDLE_ENTRY_POINT_FILE_NAME } from './constants'\nimport { getDocumentExportName } from '@format.dev/cli/scaffold'\n\ninterface GetRendererArgs {\n\tdir: string\n\tdocumentName: string\n\tvariant?: string\n\tconfig: FormatConfig\n\tbundle?: Record<string, any>\n}\n\nexport async function loadRendererBundle(dir: string, documentName?: string): Promise<Record<string, any>> {\n\tconst entryPath =\n\t\tdocumentName != null\n\t\t\t? resolve(dir, documentName, BUNDLE_ENTRY_POINT_FILE_NAME)\n\t\t\t: resolve(dir, BUNDLE_ENTRY_POINT_FILE_NAME)\n\n\t// Need a unique URL; Node ESM caches by URL and ignores hash fragments.\n\tconst url = new URL(pathToFileURL(entryPath).href)\n\tconst cacheBuster = `${Date.now()}-${Math.random().toString(36).slice(2)}`\n\turl.search = `?t=${cacheBuster}`\n\n\treturn import(url.href)\n}\n\nfunction resolveRenderer(bundle: Record<string, any>, documentName: string) {\n\tconst exportName = getDocumentExportName(documentName)\n\n\tconst renderer = bundle?.[exportName] ?? bundle?.default?.[exportName] ?? bundle?.default?.default?.[exportName]\n\n\tif (!renderer) {\n\t\tthrow new Error(`Renderer export \"${exportName}\" not found for document \"${documentName}\".`)\n\t}\n\n\treturn renderer\n}\n\nexport async function getRenderer(args: GetRendererArgs) {\n\tconst { dir, documentName, config, variant = DEFAULT_VARIANT, bundle } = args\n\n\tconst rendererBundle = bundle ?? (await loadRendererBundle(dir, documentName))\n\tconst pdfRenderer = resolveRenderer(rendererBundle, documentName)\n\tconst data = await getDocumentDataFile(documentName, variant, config)\n\n\treturn { pdfRenderer, data }\n}\n"],"mappings":";;;;;;;;AAgBA,eAAsB,mBAAmB,KAAa,cAAqD;CAC1G,MAAM,YACL,gBAAgB,OACb,QAAQ,KAAK,cAAc,6BAA6B,GACxD,QAAQ,KAAK,6BAA6B;CAG9C,MAAM,MAAM,IAAI,IAAI,cAAc,UAAU,CAAC,KAAK;AAElD,KAAI,SAAS,MADO,GAAG,KAAK,KAAK,CAAC,GAAG,KAAK,QAAQ,CAAC,SAAS,GAAG,CAAC,MAAM,EAAE;AAGxE,QAAO,OAAO,IAAI;;AAGnB,SAAS,gBAAgB,QAA6B,cAAsB;CAC3E,MAAM,aAAa,sBAAsB,aAAa;CAEtD,MAAM,WAAW,SAAS,eAAe,QAAQ,UAAU,eAAe,QAAQ,SAAS,UAAU;AAErG,KAAI,CAAC,SACJ,OAAM,IAAI,MAAM,oBAAoB,WAAW,4BAA4B,aAAa,IAAI;AAG7F,QAAO;;AAGR,eAAsB,YAAY,MAAuB;CACxD,MAAM,EAAE,KAAK,cAAc,QAAQ,UAAU,iBAAiB,WAAW;AAMzE,QAAO;EAAE,aAHW,gBADG,UAAW,MAAM,mBAAmB,KAAK,aAAa,EACzB,aAAa;EAG3C,MAFT,MAAM,oBAAoB,cAAc,SAAS,OAAO;EAEzC"}
@@ -0,0 +1,2 @@
1
+ import { DocumentAssetState, RenderCompiledDocumentArgs, StudioCompileOptions, StudioCompileResult, compile, compileForStudio, compileForTest, compileForUnplugin, getBundleOutDir, getDefaultOutDir, getDocumentAssetsPath, getDocumentEntryPath, getDocumentOutDir, getHtmlVariantPath, renderCompiledDocument, resolveHtmlVariantMatrix, warnIncompatibleHtmlOptions } from "./compile.mjs";
2
+ export { DocumentAssetState, RenderCompiledDocumentArgs, StudioCompileOptions, StudioCompileResult, compile, compileForStudio, compileForTest, compileForUnplugin, getBundleOutDir, getDefaultOutDir, getDocumentAssetsPath, getDocumentEntryPath, getDocumentOutDir, getHtmlVariantPath, renderCompiledDocument, resolveHtmlVariantMatrix, warnIncompatibleHtmlOptions };
@@ -0,0 +1,3 @@
1
+ import { compile, compileForStudio, compileForTest, compileForUnplugin, getBundleOutDir, getDefaultOutDir, getDocumentAssetsPath, getDocumentEntryPath, getDocumentOutDir, getHtmlVariantPath, renderCompiledDocument, resolveHtmlVariantMatrix, warnIncompatibleHtmlOptions } from "./compile.mjs";
2
+
3
+ export { compile, compileForStudio, compileForTest, compileForUnplugin, getBundleOutDir, getDefaultOutDir, getDocumentAssetsPath, getDocumentEntryPath, getDocumentOutDir, getHtmlVariantPath, renderCompiledDocument, resolveHtmlVariantMatrix, warnIncompatibleHtmlOptions };
@@ -0,0 +1,39 @@
1
+ import { FormatConfig } from "../../shared/types/public/config.mjs";
2
+ import { AssetMode, Format, NormalizedCompileOptions } from "../../shared/types/public/compile.mjs";
3
+ import { BuildDocument } from "./build-entry-module.mjs";
4
+ import { PluginOption, UserConfig } from "vite";
5
+ import { LogLevel as LogLevel$1, RollupLog } from "rolldown";
6
+
7
+ //#region src/server/compile/make-config.d.ts
8
+ type Target = 'node' | 'browser' | 'worker';
9
+ type BuildConfigInput = {
10
+ documents: BuildDocument[];
11
+ outDir: string;
12
+ compiledFileName: string;
13
+ target: Target;
14
+ source: 'cli' | 'unplugin';
15
+ plugins: PluginOption[];
16
+ shouldMinify: boolean;
17
+ format: Format;
18
+ logger: { [K in LogLevel$1]: (log: RollupLog) => void };
19
+ emittedAssetsDir: string;
20
+ assetMode: AssetMode;
21
+ options: NormalizedCompileOptions;
22
+ config: FormatConfig;
23
+ forceExternalFramework?: boolean;
24
+ };
25
+ /**
26
+ * Resolved absolute path to the zip module the compiled wrapper imports its
27
+ * helpers from, for every target and source: the full `@format.dev/zip/web` entry
28
+ * for dynamic mode (it carries node-html-parser for runtime zipping) or the
29
+ * slim `@format.dev/zip/scan` entry for static mode (regex scanner only). Both are
30
+ * fully self-contained ESM (no bare imports to resolve, no node coupling), so
31
+ * our own builds and consumer bundlers (vite, webpack, rollup, esbuild) inline
32
+ * the file as-is — and static bundles never pull the parser.
33
+ */
34
+ declare function resolveZipModulePath(assetMode: AssetMode): string;
35
+ declare const frameworkPkgs: string[];
36
+ declare function makeViteBuildConfig(i: BuildConfigInput): UserConfig;
37
+ //#endregion
38
+ export { frameworkPkgs, makeViteBuildConfig, resolveZipModulePath };
39
+ //# sourceMappingURL=make-config.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"make-config.d.mts","names":[],"sources":["../../../src/server/compile/make-config.ts"],"sourcesContent":[],"mappings":";;;;;;;KAgEK,MAAA;KAEA,gBAAA;EAFA,SAAM,EAGC,aAHD,EAAA;EAEN,MAAA,EAAA,MAAA;EACO,gBAAA,EAAA,MAAA;EAGH,MAAA,EAAA,MAAA;EAEC,MAAA,EAAA,KAAA,GAAA,UAAA;EAED,OAAA,EAFC,YAED,EAAA;EACQ,YAAA,EAAA,OAAA;EAAuB,MAAA,EAD/B,MAC+B;EAE5B,MAAA,EAAA,QAFK,UAGP,GAAA,CAAA,GAAA,EAH8B,SAG9B,EAAA,GAAA,IAAA,EACD;EAAY,gBAAA,EAAA,MAAA;EAaL,SAAA,EAfJ,SAeI;EAmBH,OAAA,EAjCH,wBAiCuE;EAIjE,MAAA,EApCP,YAoCO;;;;;;;;;;;;iBAvBA,oBAAA,YAAgC;cAmBnC;iBAIG,mBAAA,IAAuB,mBAAmB"}
@@ -0,0 +1,272 @@
1
+ import { buildDocumentEntryModule } from "./build-entry-module.mjs";
2
+ import { shouldDecodeStyleEntities } from "../utils/dependencies.mjs";
3
+ import { producerDefines } from "./producer-release.mjs";
4
+ import { expandTransitiveDependencyClosure } from "./dependency-closure.mjs";
5
+ import adaptorReactNode_default from "./generated/adaptorReactNode.mjs";
6
+ import adaptorReactBrowser_default from "./generated/adaptorReactBrowser.mjs";
7
+ import adaptorVueNode_default from "./generated/adaptorVueNode.mjs";
8
+ import adaptorVueBrowser_default from "./generated/adaptorVueBrowser.mjs";
9
+ import adaptorHtml_default from "./generated/adaptorHtml.mjs";
10
+ import createRenderer_default from "./generated/createRenderer.mjs";
11
+ import decodeStyleEntities_default from "./generated/decodeStyleEntities.mjs";
12
+ import sanitizeHtml_default from "./generated/sanitizeHtml.mjs";
13
+ import virtualStyles_default from "./generated/virtualStyles.mjs";
14
+ import validate_default from "./generated/validate.mjs";
15
+ import { createRequire } from "node:module";
16
+ import { extname } from "node:path";
17
+
18
+ //#region src/server/compile/make-config.ts
19
+ const VIRTUAL_STYLES_MODULE_ID = "virtual:styles";
20
+ const VIRTUAL_DECODE_STYLE_ENTITIES_MODULE_ID = "virtual:decode-style-entities";
21
+ const VIRTUAL_SANITIZE_HTML_MODULE_ID = "virtual:sanitize-html";
22
+ const VIRTUAL_ENTRY_PREFIX = "virtual:entry:";
23
+ const VIRTUAL_ADAPTOR_MODULE_ID = "virtual:adaptor";
24
+ const VIRTUAL_VALIDATE_MODULE_ID = "virtual:validate";
25
+ const VIRTUAL_CREATE_RENDERER_PREFIX = "virtual:create-renderer:";
26
+ const ROLLDOWN_RUNTIME_CHUNK_RE = /^chunks\/rolldown-runtime-.*\.js$/;
27
+ const ROLLDOWN_REQUIRE_LINE_RE = /var __require = \/\* @__PURE__ \*\/ createRequire\(import\.meta\.url\);/g;
28
+ const WEBPACK_COMPAT_REQUIRE_LINE = "var __require = typeof process !== \"undefined\" && typeof process.getBuiltinModule === \"function\" ? process.getBuiltinModule(\"module\").createRequire(import.meta.url) : /* @__PURE__ */ createRequire(import.meta.url);";
29
+ function makeExternalPredicate(externalArr) {
30
+ if (externalArr.length === 0) return () => false;
31
+ return (id) => {
32
+ return externalArr.some((external) => {
33
+ if (id === external) return true;
34
+ if (id.startsWith(external + "/")) return true;
35
+ return false;
36
+ });
37
+ };
38
+ }
39
+ function getAdaptor(framework, frameworkIsBundled) {
40
+ if (framework === "html") return adaptorHtml_default;
41
+ if (framework === "react") return frameworkIsBundled ? adaptorReactBrowser_default : adaptorReactNode_default;
42
+ return frameworkIsBundled ? adaptorVueBrowser_default : adaptorVueNode_default;
43
+ }
44
+ /**
45
+ * Resolved absolute path to the zip module the compiled wrapper imports its
46
+ * helpers from, for every target and source: the full `@format.dev/zip/web` entry
47
+ * for dynamic mode (it carries node-html-parser for runtime zipping) or the
48
+ * slim `@format.dev/zip/scan` entry for static mode (regex scanner only). Both are
49
+ * fully self-contained ESM (no bare imports to resolve, no node coupling), so
50
+ * our own builds and consumer bundlers (vite, webpack, rollup, esbuild) inline
51
+ * the file as-is — and static bundles never pull the parser.
52
+ */
53
+ function resolveZipModulePath(assetMode) {
54
+ if (assetMode === "none") return "";
55
+ const subpath = assetMode === "dynamic" ? "@format.dev/zip/web" : "@format.dev/zip/scan";
56
+ return createRequire(import.meta.url).resolve(subpath).replace(/\.cjs$/, ".mjs");
57
+ }
58
+ const frameworkPkgs = [
59
+ "react",
60
+ "react-dom",
61
+ "vue",
62
+ "vue/server-renderer"
63
+ ];
64
+ function makeViteBuildConfig(i) {
65
+ const { target, source, plugins, documents, compiledFileName, outDir, shouldMinify, format, config, logger, emittedAssetsDir, options } = i;
66
+ const effectiveBundle = i.forceExternalFramework ? options.bundle.filter((pkg) => !frameworkPkgs.includes(pkg)) : options.bundle;
67
+ const frameworkIsBundled = (() => {
68
+ if (config.framework === "html") return false;
69
+ const primaryPkg = config.framework;
70
+ if (target === "node") return effectiveBundle.includes(primaryPkg);
71
+ return !options.external.includes(primaryPkg);
72
+ })();
73
+ const adaptor = getAdaptor(config.framework, frameworkIsBundled);
74
+ const documentMap = new Map(documents.map((document) => [document.name, document]));
75
+ const rendererVirtualPlugin = {
76
+ name: "plugin:virtual-modules",
77
+ enforce: "pre",
78
+ resolveId(id) {
79
+ if (id.startsWith(VIRTUAL_ENTRY_PREFIX)) return id;
80
+ if (id === VIRTUAL_ADAPTOR_MODULE_ID) return VIRTUAL_ADAPTOR_MODULE_ID;
81
+ if (id === VIRTUAL_VALIDATE_MODULE_ID) return VIRTUAL_VALIDATE_MODULE_ID;
82
+ if (id === VIRTUAL_STYLES_MODULE_ID) return VIRTUAL_STYLES_MODULE_ID;
83
+ if (id === VIRTUAL_DECODE_STYLE_ENTITIES_MODULE_ID) return VIRTUAL_DECODE_STYLE_ENTITIES_MODULE_ID;
84
+ if (id === VIRTUAL_SANITIZE_HTML_MODULE_ID) return VIRTUAL_SANITIZE_HTML_MODULE_ID;
85
+ if (id.startsWith(VIRTUAL_CREATE_RENDERER_PREFIX)) return id;
86
+ return null;
87
+ },
88
+ async load(id) {
89
+ if (id.startsWith(VIRTUAL_ENTRY_PREFIX)) {
90
+ const documentName = id.slice(14);
91
+ const document = documentMap.get(documentName);
92
+ if (!document) throw new Error(`Unknown document entry "${documentName}"`);
93
+ return { code: buildDocumentEntryModule(document, `${VIRTUAL_CREATE_RENDERER_PREFIX}${documentName}`, {
94
+ target,
95
+ source,
96
+ assetMode: i.assetMode,
97
+ zipModulePath: resolveZipModulePath(i.assetMode)
98
+ }) };
99
+ }
100
+ if (id === VIRTUAL_ADAPTOR_MODULE_ID) return { code: adaptor };
101
+ if (id === VIRTUAL_VALIDATE_MODULE_ID) return { code: validate_default };
102
+ if (id === VIRTUAL_STYLES_MODULE_ID) return { code: virtualStyles_default };
103
+ if (id === VIRTUAL_DECODE_STYLE_ENTITIES_MODULE_ID) {
104
+ if (shouldDecodeStyleEntities({ framework: config.framework })) return { code: decodeStyleEntities_default };
105
+ return { code: [`export function decodeStyleEntities(html) { return html; }`, `export default decodeStyleEntities;`].join("\n") };
106
+ }
107
+ if (id === VIRTUAL_SANITIZE_HTML_MODULE_ID) return { code: sanitizeHtml_default };
108
+ if (id.startsWith(VIRTUAL_CREATE_RENDERER_PREFIX)) return { code: createRenderer_default };
109
+ return null;
110
+ }
111
+ };
112
+ const webpackNodeCompatRuntimePlugin = target !== "node" || source !== "unplugin" || options.userBundler !== "webpack" ? null : {
113
+ name: "plugin:webpack-node-compat-runtime",
114
+ renderChunk(code, chunk) {
115
+ if (!ROLLDOWN_RUNTIME_CHUNK_RE.test(chunk.fileName)) return null;
116
+ let patched = code.replace(/from\s+["']node:module["']/g, "from \"module\"");
117
+ patched = patched.replace(ROLLDOWN_REQUIRE_LINE_RE, WEBPACK_COMPAT_REQUIRE_LINE);
118
+ if (patched === code) return null;
119
+ return {
120
+ code: patched,
121
+ map: null
122
+ };
123
+ }
124
+ };
125
+ const cwd = config.cwd ? JSON.stringify(config.cwd) : JSON.stringify(process.cwd());
126
+ const conditions = options.conditions.length ? options.conditions : void 0;
127
+ const externalConditions = options.externalConditions.length ? options.externalConditions : void 0;
128
+ const common = {
129
+ mode: "production",
130
+ publicDir: false,
131
+ plugins: [
132
+ rendererVirtualPlugin,
133
+ ...webpackNodeCompatRuntimePlugin ? [webpackNodeCompatRuntimePlugin] : [],
134
+ ...plugins
135
+ ],
136
+ resolve: {
137
+ preserveSymlinks: false,
138
+ conditions
139
+ },
140
+ define: {
141
+ _FMT_VALIDATE_SCHEMA_: JSON.stringify(options.validateSchema),
142
+ _FMT_CWD_: cwd,
143
+ ...producerDefines()
144
+ },
145
+ esbuild: {
146
+ jsx: "automatic",
147
+ jsxDev: false,
148
+ jsxImportSource: "react"
149
+ }
150
+ };
151
+ const buildCommon = {
152
+ outDir,
153
+ emptyOutDir: false,
154
+ minify: shouldMinify,
155
+ cssMinify: shouldMinify,
156
+ cssCodeSplit: true
157
+ };
158
+ const rollupOptions = {
159
+ input: Object.fromEntries(documents.map((document) => [document.name, `${VIRTUAL_ENTRY_PREFIX}${document.name}`])),
160
+ preserveEntrySignatures: "strict",
161
+ treeshake: false,
162
+ output: {
163
+ format,
164
+ entryFileNames: (chunkInfo) => `${chunkInfo.name}/${compiledFileName}`,
165
+ chunkFileNames: (chunkInfo) => chunkInfo.name === "styles" || chunkInfo.name === "rolldown-runtime" ? `chunks/${chunkInfo.name}.js` : "chunks/[name]-[hash].js",
166
+ manualChunks: (id) => {
167
+ if (id === VIRTUAL_STYLES_MODULE_ID) return "styles";
168
+ },
169
+ exports: "named",
170
+ assetFileNames: (assetInfo) => {
171
+ const ext = extname(assetInfo.names?.[0] ?? "").toLowerCase();
172
+ const imageExtensions = [
173
+ ".png",
174
+ ".jpg",
175
+ ".jpeg",
176
+ ".gif",
177
+ ".svg",
178
+ ".webp",
179
+ ".avif"
180
+ ];
181
+ const fontExtensions = [
182
+ ".woff",
183
+ ".woff2",
184
+ ".ttf",
185
+ ".otf",
186
+ ".eot"
187
+ ];
188
+ if (imageExtensions.includes(ext)) return `${emittedAssetsDir}/[name]-[hash][extname]`;
189
+ if (fontExtensions.includes(ext)) return `${emittedAssetsDir}/[name][extname]`;
190
+ return "[name][extname]";
191
+ }
192
+ },
193
+ onLog: (level, log) => {
194
+ logger[level](log);
195
+ }
196
+ };
197
+ const nodeNoExternal = expandTransitiveDependencyClosure({
198
+ seedPackages: effectiveBundle,
199
+ excludedPackages: frameworkPkgs.filter((pkg) => !effectiveBundle.includes(pkg))
200
+ });
201
+ const node = {
202
+ ...common,
203
+ ssr: {
204
+ noExternal: nodeNoExternal,
205
+ resolve: {
206
+ conditions,
207
+ externalConditions
208
+ }
209
+ },
210
+ build: {
211
+ ...buildCommon,
212
+ ssr: true,
213
+ ssrEmitAssets: true,
214
+ target: "esnext",
215
+ rollupOptions
216
+ }
217
+ };
218
+ const workerNoExternal = options.bundleAll ? true : options.bundle.length ? options.bundle : void 0;
219
+ const workerTarget = "webworker";
220
+ const worker = {
221
+ ...common,
222
+ define: {
223
+ ...common.define,
224
+ "process.env.NODE_ENV": JSON.stringify("production"),
225
+ "process.env": JSON.stringify({}),
226
+ global: "globalThis"
227
+ },
228
+ ssr: {
229
+ target: workerTarget,
230
+ noExternal: workerNoExternal === true ? true : Array.isArray(workerNoExternal) ? expandTransitiveDependencyClosure({
231
+ seedPackages: workerNoExternal,
232
+ excludedPackages: frameworkPkgs
233
+ }) : workerNoExternal,
234
+ external: options.external.length ? options.external : void 0,
235
+ resolve: {
236
+ conditions,
237
+ externalConditions
238
+ }
239
+ },
240
+ build: {
241
+ ...buildCommon,
242
+ ssr: true,
243
+ ssrEmitAssets: true,
244
+ target: "esnext",
245
+ rollupOptions
246
+ }
247
+ };
248
+ const browser = {
249
+ ...common,
250
+ define: {
251
+ ...common.define,
252
+ "process.env.NODE_ENV": JSON.stringify("production"),
253
+ "process.env": JSON.stringify({}),
254
+ global: "globalThis"
255
+ },
256
+ build: {
257
+ ...buildCommon,
258
+ target: "baseline-widely-available",
259
+ rollupOptions: {
260
+ ...rollupOptions,
261
+ external: makeExternalPredicate(options.external)
262
+ }
263
+ }
264
+ };
265
+ if (target === "node") return node;
266
+ if (target === "worker") return worker;
267
+ return browser;
268
+ }
269
+
270
+ //#endregion
271
+ export { frameworkPkgs, makeViteBuildConfig, resolveZipModulePath };
272
+ //# sourceMappingURL=make-config.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"make-config.mjs","names":["adaptorHtml","adaptorReactBrowser","adaptorReactNode","adaptorVueBrowser","adaptorVueNode","rendererVirtualPlugin: PluginOption","validate","virtualStyles","decodeStyleEntitiesModule","sanitizeHtml","createRenderer","webpackNodeCompatRuntimePlugin: PluginOption","common: UserConfig","workerNoExternal: NoExternal | undefined","workerTarget: SSRTarget"],"sources":["../../../src/server/compile/make-config.ts"],"sourcesContent":["import type { FormatConfig } from '../../shared/types/public/config'\nimport type { UserConfig, PluginOption, SSRTarget } from 'vite'\nimport type { PreRenderedAsset, PreRenderedChunk, LogLevel as RollupLogLevel, RollupLog } from 'rolldown'\nimport type { AssetMode, NormalizedCompileOptions, Format } from '../../shared/types/public/compile'\nimport type { BuildDocument } from './build-entry-module'\n\nimport { buildDocumentEntryModule } from './build-entry-module'\n\nimport { extname } from 'node:path'\nimport { createRequire } from 'node:module'\nimport { shouldDecodeStyleEntities } from '../utils/dependencies'\nimport { producerDefines } from './producer-release'\nimport { expandTransitiveDependencyClosure } from './dependency-closure'\n\nimport adaptorReactNode from './generated/adaptorReactNode.mjs?raw'\nimport adaptorReactBrowser from './generated/adaptorReactBrowser.mjs?raw'\nimport adaptorVueNode from './generated/adaptorVueNode.mjs?raw'\nimport adaptorVueBrowser from './generated/adaptorVueBrowser.mjs?raw'\nimport adaptorHtml from './generated/adaptorHtml.mjs?raw'\nimport createRenderer from './generated/createRenderer.mjs?raw'\nimport decodeStyleEntitiesModule from './generated/decodeStyleEntities.mjs?raw'\nimport sanitizeHtml from './generated/sanitizeHtml.mjs?raw'\nimport virtualStyles from './generated/virtualStyles.mjs?raw'\nimport validate from './generated/validate.mjs?raw'\n\nconst VIRTUAL_STYLES_MODULE_ID = 'virtual:styles'\nconst VIRTUAL_DECODE_STYLE_ENTITIES_MODULE_ID = 'virtual:decode-style-entities'\nconst VIRTUAL_SANITIZE_HTML_MODULE_ID = 'virtual:sanitize-html'\nconst VIRTUAL_ENTRY_PREFIX = 'virtual:entry:'\nconst VIRTUAL_ADAPTOR_MODULE_ID = 'virtual:adaptor'\nconst VIRTUAL_VALIDATE_MODULE_ID = 'virtual:validate'\nconst VIRTUAL_CREATE_RENDERER_PREFIX = 'virtual:create-renderer:'\nconst ROLLDOWN_RUNTIME_CHUNK_RE = /^chunks\\/rolldown-runtime-.*\\.js$/\nconst ROLLDOWN_REQUIRE_LINE_RE = /var __require = \\/\\* @__PURE__ \\*\\/ createRequire\\(import\\.meta\\.url\\);/g\nconst WEBPACK_COMPAT_REQUIRE_LINE =\n\t'var __require = typeof process !== \"undefined\" && typeof process.getBuiltinModule === \"function\" ? process.getBuiltinModule(\"module\").createRequire(import.meta.url) : /* @__PURE__ */ createRequire(import.meta.url);'\n\nfunction makeExternalPredicate(\n\texternalArr: string[]\n): (id: string, parentId?: string, isResolved?: boolean) => boolean {\n\tif (externalArr.length === 0) {\n\t\treturn () => false\n\t}\n\n\treturn (id: string) => {\n\t\treturn externalArr.some(external => {\n\t\t\tif (id === external) return true\n\t\t\t// Match subpaths: e.g 'react-dom' matches 'react-dom/client'\n\t\t\tif (id.startsWith(external + '/')) return true\n\t\t\treturn false\n\t\t})\n\t}\n}\n\nfunction getAdaptor(framework: string, frameworkIsBundled: boolean): string {\n\tif (framework === 'html') return adaptorHtml\n\n\tif (framework === 'react') {\n\t\treturn frameworkIsBundled ? adaptorReactBrowser : adaptorReactNode\n\t}\n\n\treturn frameworkIsBundled ? adaptorVueBrowser : adaptorVueNode\n}\n\ntype Target = 'node' | 'browser' | 'worker'\n\ntype BuildConfigInput = {\n\tdocuments: BuildDocument[]\n\toutDir: string\n\tcompiledFileName: string\n\ttarget: Target\n\tsource: 'cli' | 'unplugin'\n\tplugins: PluginOption[]\n\tshouldMinify: boolean\n\tformat: Format\n\tlogger: { [K in RollupLogLevel]: (log: RollupLog) => void }\n\temittedAssetsDir: string\n\tassetMode: AssetMode\n\toptions: NormalizedCompileOptions\n\tconfig: FormatConfig\n\tforceExternalFramework?: boolean\n}\n\n/**\n * Resolved absolute path to the zip module the compiled wrapper imports its\n * helpers from, for every target and source: the full `@format.dev/zip/web` entry\n * for dynamic mode (it carries node-html-parser for runtime zipping) or the\n * slim `@format.dev/zip/scan` entry for static mode (regex scanner only). Both are\n * fully self-contained ESM (no bare imports to resolve, no node coupling), so\n * our own builds and consumer bundlers (vite, webpack, rollup, esbuild) inline\n * the file as-is — and static bundles never pull the parser.\n */\nexport function resolveZipModulePath(assetMode: AssetMode): string {\n\t// `none` wrappers do no asset work, so they import nothing from @format.dev/zip.\n\tif (assetMode === 'none') {\n\t\treturn ''\n\t}\n\n\t// Dynamic wrappers call zip() at render time and need the full web entry\n\t// (it carries node-html-parser). Static wrappers only run the regex\n\t// known-asset check, so they import the slim scan entry, which has no\n\t// path to the parser — that keeps node-html-parser in dynamic bundles only.\n\tconst subpath = assetMode === 'dynamic' ? '@format.dev/zip/web' : '@format.dev/zip/scan'\n\n\t// require.resolve honours the \"require\" condition (.cjs); the wrapper is\n\t// emitted as ESM, so swap to the sibling ESM build we own the layout of.\n\treturn createRequire(import.meta.url)\n\t\t.resolve(subpath)\n\t\t.replace(/\\.cjs$/, '.mjs')\n}\n\nexport const frameworkPkgs = ['react', 'react-dom', 'vue', 'vue/server-renderer']\n\ntype NoExternal = NonNullable<NonNullable<UserConfig['ssr']>['noExternal']>\n\nexport function makeViteBuildConfig(i: BuildConfigInput): UserConfig {\n\tconst {\n\t\ttarget,\n\t\tsource,\n\t\tplugins,\n\t\tdocuments,\n\t\tcompiledFileName,\n\t\toutDir,\n\t\tshouldMinify,\n\t\tformat,\n\t\tconfig,\n\t\tlogger,\n\t\temittedAssetsDir,\n\t\toptions\n\t} = i\n\n\t// When forceExternalFramework is set (SSR temp builds for asset pre-rendering),\n\t// framework packages are always kept external regardless of the user's bundle config.\n\t// Otherwise, the user's config determines whether framework is bundled or external.\n\tconst effectiveBundle = i.forceExternalFramework\n\t\t? options.bundle.filter(pkg => !frameworkPkgs.includes(pkg))\n\t\t: options.bundle\n\n\tconst frameworkIsBundled = (() => {\n\t\tif (config.framework === 'html') return false\n\n\t\tconst primaryPkg = config.framework // 'react' or 'vue'\n\n\t\tif (target === 'node') {\n\t\t\treturn effectiveBundle.includes(primaryPkg)\n\t\t}\n\n\t\t// Browser and worker bundle framework by default\n\t\treturn !options.external.includes(primaryPkg)\n\t})()\n\n\tconst adaptor = getAdaptor(config.framework, frameworkIsBundled)\n\n\tconst documentMap = new Map(documents.map(document => [document.name, document]))\n\n\tconst rendererVirtualPlugin: PluginOption = {\n\t\tname: 'plugin:virtual-modules',\n\t\tenforce: 'pre',\n\t\tresolveId(id) {\n\t\t\tif (id.startsWith(VIRTUAL_ENTRY_PREFIX)) {\n\t\t\t\treturn id\n\t\t\t}\n\n\t\t\tif (id === VIRTUAL_ADAPTOR_MODULE_ID) {\n\t\t\t\treturn VIRTUAL_ADAPTOR_MODULE_ID\n\t\t\t}\n\n\t\t\tif (id === VIRTUAL_VALIDATE_MODULE_ID) {\n\t\t\t\treturn VIRTUAL_VALIDATE_MODULE_ID\n\t\t\t}\n\n\t\t\tif (id === VIRTUAL_STYLES_MODULE_ID) {\n\t\t\t\treturn VIRTUAL_STYLES_MODULE_ID\n\t\t\t}\n\n\t\t\tif (id === VIRTUAL_DECODE_STYLE_ENTITIES_MODULE_ID) {\n\t\t\t\treturn VIRTUAL_DECODE_STYLE_ENTITIES_MODULE_ID\n\t\t\t}\n\n\t\t\tif (id === VIRTUAL_SANITIZE_HTML_MODULE_ID) {\n\t\t\t\treturn VIRTUAL_SANITIZE_HTML_MODULE_ID\n\t\t\t}\n\n\t\t\tif (id.startsWith(VIRTUAL_CREATE_RENDERER_PREFIX)) {\n\t\t\t\treturn id\n\t\t\t}\n\n\t\t\treturn null\n\t\t},\n\t\tasync load(id) {\n\t\t\tif (id.startsWith(VIRTUAL_ENTRY_PREFIX)) {\n\t\t\t\tconst documentName = id.slice(VIRTUAL_ENTRY_PREFIX.length)\n\t\t\t\tconst document = documentMap.get(documentName)\n\n\t\t\t\tif (!document) {\n\t\t\t\t\tthrow new Error(`Unknown document entry \"${documentName}\"`)\n\t\t\t\t}\n\n\t\t\t\tconst createRendererId = `${VIRTUAL_CREATE_RENDERER_PREFIX}${documentName}`\n\t\t\t\tconst entryModule = buildDocumentEntryModule(document, createRendererId, {\n\t\t\t\t\ttarget,\n\t\t\t\t\tsource,\n\t\t\t\t\tassetMode: i.assetMode,\n\t\t\t\t\tzipModulePath: resolveZipModulePath(i.assetMode)\n\t\t\t\t})\n\t\t\t\treturn { code: entryModule }\n\t\t\t}\n\n\t\t\tif (id === VIRTUAL_ADAPTOR_MODULE_ID) {\n\t\t\t\treturn { code: adaptor }\n\t\t\t}\n\n\t\t\tif (id === VIRTUAL_VALIDATE_MODULE_ID) {\n\t\t\t\treturn { code: validate }\n\t\t\t}\n\n\t\t\tif (id === VIRTUAL_STYLES_MODULE_ID) {\n\t\t\t\treturn { code: virtualStyles }\n\t\t\t}\n\n\t\t\tif (id === VIRTUAL_DECODE_STYLE_ENTITIES_MODULE_ID) {\n\t\t\t\tif (shouldDecodeStyleEntities({ framework: config.framework })) {\n\t\t\t\t\treturn { code: decodeStyleEntitiesModule }\n\t\t\t\t}\n\n\t\t\t\t// Stub: always safe to call, doesn't import any deps.\n\t\t\t\treturn {\n\t\t\t\t\tcode: [\n\t\t\t\t\t\t`export function decodeStyleEntities(html) { return html; }`,\n\t\t\t\t\t\t`export default decodeStyleEntities;`\n\t\t\t\t\t].join('\\n')\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (id === VIRTUAL_SANITIZE_HTML_MODULE_ID) {\n\t\t\t\treturn { code: sanitizeHtml }\n\t\t\t}\n\n\t\t\tif (id.startsWith(VIRTUAL_CREATE_RENDERER_PREFIX)) {\n\t\t\t\treturn { code: createRenderer }\n\t\t\t}\n\n\t\t\treturn null\n\t\t}\n\t}\n\n\tconst webpackNodeCompatRuntimePlugin: PluginOption =\n\t\ttarget !== 'node' || source !== 'unplugin' || options.userBundler !== 'webpack'\n\t\t\t? null\n\t\t\t: {\n\t\t\t\t\tname: 'plugin:webpack-node-compat-runtime',\n\t\t\t\t\trenderChunk(code, chunk) {\n\t\t\t\t\t\tif (!ROLLDOWN_RUNTIME_CHUNK_RE.test(chunk.fileName)) {\n\t\t\t\t\t\t\treturn null\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Webpack-node re-bundles can fail on the rolldown runtime's ESM helper:\n\t\t\t\t\t\t// ```\n\t\t\t\t\t\t// var __require = /* @__PURE__ */ createRequire(import.meta.url);\n\t\t\t\t\t\t// ```\n\t\t\t\t\t\t//\n\t\t\t\t\t\t// We rewrite it to a guarded variant:\n\t\t\t\t\t\t// ```\n\t\t\t\t\t\t// var __require = typeof process !== \"undefined\" && typeof process.getBuiltinModule === \"function\"\n\t\t\t\t\t\t// ? process.getBuiltinModule(\"module\").createRequire(import.meta.url)\n\t\t\t\t\t\t// : /* @__PURE__ */ createRequire(import.meta.url);\n\t\t\t\t\t\t// ```\n\t\t\t\t\t\t//\n\t\t\t\t\t\t// Also rewrite:\n\t\t\t\t\t\t// ```\n\t\t\t\t\t\t// import { createRequire } from \"node:module\"\n\t\t\t\t\t\t// ```\n\t\t\t\t\t\t// to:\n\t\t\t\t\t\t// ```\n\t\t\t\t\t\t// import { createRequire } from \"module\"\n\t\t\t\t\t\t// ```\n\t\t\t\t\t\tlet patched = code.replace(/from\\s+[\"']node:module[\"']/g, 'from \"module\"')\n\t\t\t\t\t\tpatched = patched.replace(ROLLDOWN_REQUIRE_LINE_RE, WEBPACK_COMPAT_REQUIRE_LINE)\n\n\t\t\t\t\t\tif (patched === code) {\n\t\t\t\t\t\t\treturn null\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn { code: patched, map: null }\n\t\t\t\t\t}\n\t\t\t\t}\n\n\tconst cwd = config.cwd ? JSON.stringify(config.cwd) : JSON.stringify(process.cwd())\n\n\tconst conditions = options.conditions.length ? options.conditions : undefined\n\tconst externalConditions = options.externalConditions.length ? options.externalConditions : undefined\n\n\tconst common: UserConfig = {\n\t\tmode: 'production' as const,\n\t\tpublicDir: false,\n\t\tplugins: [\n\t\t\trendererVirtualPlugin,\n\t\t\t...(webpackNodeCompatRuntimePlugin ? [webpackNodeCompatRuntimePlugin] : []),\n\t\t\t...plugins\n\t\t],\n\t\tresolve: {\n\t\t\tpreserveSymlinks: false,\n\t\t\tconditions\n\t\t},\n\t\tdefine: {\n\t\t\t_FMT_VALIDATE_SCHEMA_: JSON.stringify(options.validateSchema),\n\t\t\t_FMT_CWD_: cwd,\n\t\t\t...producerDefines()\n\t\t},\n\t\tesbuild: {\n\t\t\tjsx: 'automatic',\n\t\t\tjsxDev: false,\n\t\t\tjsxImportSource: 'react'\n\t\t}\n\t}\n\n\tconst buildCommon = {\n\t\toutDir,\n\t\temptyOutDir: false, // very important*\n\t\tminify: shouldMinify,\n\t\tcssMinify: shouldMinify,\n\t\tcssCodeSplit: true\n\t}\n\n\tconst rollupInput = Object.fromEntries(\n\t\tdocuments.map(document => [document.name, `${VIRTUAL_ENTRY_PREFIX}${document.name}`])\n\t)\n\n\tconst rollupOptions = {\n\t\tinput: rollupInput,\n\t\tpreserveEntrySignatures: 'strict' as const,\n\t\ttreeshake: false, // I'm slightly nervous about treeshaking, so I've gone with false for now.\n\t\toutput: {\n\t\t\tformat,\n\t\t\tentryFileNames: (chunkInfo: PreRenderedChunk) => `${chunkInfo.name}/${compiledFileName}`,\n\t\t\t// styles and rolldown's runtime helpers are one-per-build infrastructure\n\t\t\t// chunks — hashing them would churn consumer output (and goldens) on\n\t\t\t// every toolchain bump for no caching benefit. User-code chunks keep the\n\t\t\t// hashed fallback so same-named dynamic chunks can't collide.\n\t\t\tchunkFileNames: (chunkInfo: PreRenderedChunk) =>\n\t\t\t\tchunkInfo.name === 'styles' || chunkInfo.name === 'rolldown-runtime'\n\t\t\t\t\t? `chunks/${chunkInfo.name}.js`\n\t\t\t\t\t: 'chunks/[name]-[hash].js',\n\t\t\tmanualChunks: (id: string) => {\n\t\t\t\t// Force virtual:styles into a shared chunk.\n\t\t\t\tif (id === VIRTUAL_STYLES_MODULE_ID) {\n\t\t\t\t\treturn 'styles'\n\t\t\t\t}\n\t\t\t\treturn undefined\n\t\t\t},\n\t\t\t// Each entry deliberately ships a named export (the document's export\n\t\t\t// name) alongside a default. 'auto' can't pick a CJS shape when both are\n\t\t\t// present and warns (MIXED_EXPORT); 'named' makes the choice explicit and\n\t\t\t// keeps both reachable. Ignored for ES output, so the default ESM build is\n\t\t\t// unaffected.\n\t\t\texports: 'named' as const,\n\t\t\tassetFileNames: (assetInfo: PreRenderedAsset) => {\n\t\t\t\tconst name = assetInfo.names?.[0] ?? ''\n\t\t\t\tconst ext = extname(name).toLowerCase()\n\t\t\t\tconst imageExtensions = ['.png', '.jpg', '.jpeg', '.gif', '.svg', '.webp', '.avif']\n\t\t\t\tconst fontExtensions = ['.woff', '.woff2', '.ttf', '.otf', '.eot']\n\n\t\t\t\t// Images and fonts — the assets a document author references — land in\n\t\t\t\t// the shared `assets/` dir so they sit in one place rather than split\n\t\t\t\t// across the outDir root. Images are content-hashed; fonts keep their\n\t\t\t\t// stable name (their @font-face src references them by it). Everything\n\t\t\t\t// else (e.g. emitted CSS the styles pipeline keys by its root path)\n\t\t\t\t// stays at the root, where the rest of the build expects it.\n\t\t\t\tif (imageExtensions.includes(ext)) {\n\t\t\t\t\treturn `${emittedAssetsDir}/[name]-[hash][extname]`\n\t\t\t\t}\n\n\t\t\t\tif (fontExtensions.includes(ext)) {\n\t\t\t\t\treturn `${emittedAssetsDir}/[name][extname]`\n\t\t\t\t}\n\n\t\t\t\treturn '[name][extname]'\n\t\t\t}\n\t\t},\n\t\tonLog: (level: RollupLogLevel, log: RollupLog) => {\n\t\t\tlogger[level](log)\n\t\t}\n\t}\n\n\t// Framework packages not in the effective bundle list are excluded from\n\t// the transitive closure so they don't get pulled in as indirect deps.\n\tconst frameworkExclude = frameworkPkgs.filter(pkg => !effectiveBundle.includes(pkg))\n\tconst nodeNoExternal = expandTransitiveDependencyClosure({\n\t\tseedPackages: effectiveBundle,\n\t\texcludedPackages: frameworkExclude\n\t})\n\n\t// Method: We use a Vite build + SSR configs to bundle for Node.\n\t// Externals: When bundling for Node, Vite's \"SSR\" mode defaults\n\t// to all deps being externalized. The \"bundle\" option includes\n\t// deps (including framework packages) in the bundle.\n\tconst node = {\n\t\t...common,\n\t\tssr: {\n\t\t\tnoExternal: nodeNoExternal,\n\t\t\tresolve: {\n\t\t\t\tconditions,\n\t\t\t\texternalConditions\n\t\t\t}\n\t\t},\n\t\tbuild: {\n\t\t\t...buildCommon,\n\t\t\tssr: true,\n\t\t\tssrEmitAssets: true,\n\t\t\ttarget: 'esnext' as const,\n\t\t\trollupOptions\n\t\t}\n\t} satisfies UserConfig\n\n\tconst workerNoExternal: NoExternal | undefined = options.bundleAll\n\t\t? (true as const)\n\t\t: options.bundle.length\n\t\t\t? options.bundle\n\t\t\t: undefined\n\n\tconst workerTarget: SSRTarget = 'webworker'\n\n\t// Method: We use a Vite build + SSR configs to bundle for a Worker-like runtime.\n\t// Externals: Worker builds can bundle all deps by default via presets, but users can still override.\n\tconst worker = {\n\t\t...common,\n\t\tdefine: {\n\t\t\t...common.define!,\n\t\t\t'process.env.NODE_ENV': JSON.stringify('production'),\n\t\t\t'process.env': JSON.stringify({}),\n\t\t\tglobal: 'globalThis'\n\t\t},\n\t\tssr: {\n\t\t\ttarget: workerTarget,\n\t\t\tnoExternal:\n\t\t\t\tworkerNoExternal === true\n\t\t\t\t\t? true\n\t\t\t\t\t: Array.isArray(workerNoExternal)\n\t\t\t\t\t\t? expandTransitiveDependencyClosure({\n\t\t\t\t\t\t\t\tseedPackages: workerNoExternal as string[],\n\t\t\t\t\t\t\t\texcludedPackages: frameworkPkgs\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t: workerNoExternal,\n\t\t\texternal: options.external.length ? options.external : undefined,\n\t\t\tresolve: {\n\t\t\t\tconditions,\n\t\t\t\texternalConditions\n\t\t\t}\n\t\t},\n\t\tbuild: {\n\t\t\t...buildCommon,\n\t\t\tssr: true,\n\t\t\tssrEmitAssets: true,\n\t\t\ttarget: 'esnext' as const,\n\t\t\trollupOptions\n\t\t}\n\t} satisfies UserConfig\n\n\t// Method: We use standard Vite mode to bundle for the browser.\n\t// Externals: When bundling for the browser, Vite + Rollup default\n\t// to all deps being bundled. We provide the \"external\" option\n\t// to exclude deps from the bundle in this case.\n\tconst browser = {\n\t\t...common,\n\t\tdefine: {\n\t\t\t...common.define!,\n\t\t\t'process.env.NODE_ENV': JSON.stringify('production'),\n\t\t\t'process.env': JSON.stringify({}),\n\t\t\tglobal: 'globalThis'\n\t\t},\n\t\tbuild: {\n\t\t\t...buildCommon,\n\t\t\ttarget: 'baseline-widely-available',\n\t\t\trollupOptions: {\n\t\t\t\t...rollupOptions,\n\t\t\t\texternal: makeExternalPredicate(options.external)\n\t\t\t}\n\t\t}\n\t} satisfies UserConfig\n\n\t// *emptyOutDir is true by default in vite. For browser bundles, we build\n\t// an SSR bundle to render HTML for zip and this goes in the same ourDir.\n\t// So we don't want any automatic outDir emptying/cleansing.\n\n\tif (target === 'node') return node\n\tif (target === 'worker') return worker\n\treturn browser\n}\n"],"mappings":"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"}
@@ -0,0 +1,5 @@
1
+ //#region src/server/compile/package-json.d.ts
2
+ declare function emitPackageJson(outDir: string, bundleName: string, format: string, version: string | null): Promise<void>;
3
+ //#endregion
4
+ export { emitPackageJson };
5
+ //# sourceMappingURL=package-json.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-json.d.mts","names":[],"sources":["../../../src/server/compile/package-json.ts"],"sourcesContent":[],"mappings":";iBAcsB,eAAA,8EAA0F"}
@@ -0,0 +1,33 @@
1
+ import { BUNDLE_ENTRY_POINT_FILE_NAME } from "./constants.mjs";
2
+ import { join } from "node:path";
3
+ import { writeFile } from "node:fs/promises";
4
+
5
+ //#region src/server/compile/package-json.ts
6
+ async function emitPackageJson(outDir, bundleName, format, version) {
7
+ const entryPath = `./${BUNDLE_ENTRY_POINT_FILE_NAME}`;
8
+ const pkgJson = {
9
+ name: bundleName,
10
+ ...version ? { version } : { private: true },
11
+ main: entryPath
12
+ };
13
+ if (format === "es") {
14
+ pkgJson.type = "module";
15
+ pkgJson.module = entryPath;
16
+ pkgJson.exports = { ".": {
17
+ import: entryPath,
18
+ require: entryPath
19
+ } };
20
+ }
21
+ if (format === "cjs") {
22
+ pkgJson.type = "commonjs";
23
+ pkgJson.exports = { ".": {
24
+ require: entryPath,
25
+ default: entryPath
26
+ } };
27
+ }
28
+ await writeFile(join(outDir, "package.json"), JSON.stringify(pkgJson, null, 2) + "\n", "utf8");
29
+ }
30
+
31
+ //#endregion
32
+ export { emitPackageJson };
33
+ //# sourceMappingURL=package-json.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-json.mjs","names":["pkgJson: PackageJson"],"sources":["../../../src/server/compile/package-json.ts"],"sourcesContent":["import { writeFile } from 'node:fs/promises'\nimport { join } from 'node:path'\nimport { BUNDLE_ENTRY_POINT_FILE_NAME } from './constants'\n\ntype PackageJson = {\n\tname: string\n\tversion?: string\n\tprivate?: boolean\n\tmain: string\n\ttype?: string\n\tmodule?: string\n\texports?: Record<string, Record<string, string>>\n}\n\nexport async function emitPackageJson(outDir: string, bundleName: string, format: string, version: string | null) {\n\tconst entryPath = `./${BUNDLE_ENTRY_POINT_FILE_NAME}`\n\n\tconst pkgJson: PackageJson = {\n\t\tname: bundleName,\n\t\t...(version ? { version } : { private: true }),\n\t\tmain: entryPath\n\t}\n\n\tif (format === 'es') {\n\t\tpkgJson.type = 'module'\n\t\tpkgJson.module = entryPath\n\t\tpkgJson.exports = {\n\t\t\t'.': {\n\t\t\t\timport: entryPath,\n\t\t\t\trequire: entryPath\n\t\t\t}\n\t\t}\n\t}\n\n\tif (format === 'cjs') {\n\t\tpkgJson.type = 'commonjs'\n\t\tpkgJson.exports = {\n\t\t\t'.': {\n\t\t\t\trequire: entryPath,\n\t\t\t\tdefault: entryPath\n\t\t\t}\n\t\t}\n\t}\n\n\tconst file = join(outDir, 'package.json')\n\tawait writeFile(file, JSON.stringify(pkgJson, null, 2) + '\\n', 'utf8')\n}\n"],"mappings":";;;;;AAcA,eAAsB,gBAAgB,QAAgB,YAAoB,QAAgB,SAAwB;CACjH,MAAM,YAAY,KAAK;CAEvB,MAAMA,UAAuB;EAC5B,MAAM;EACN,GAAI,UAAU,EAAE,SAAS,GAAG,EAAE,SAAS,MAAM;EAC7C,MAAM;EACN;AAED,KAAI,WAAW,MAAM;AACpB,UAAQ,OAAO;AACf,UAAQ,SAAS;AACjB,UAAQ,UAAU,EACjB,KAAK;GACJ,QAAQ;GACR,SAAS;GACT,EACD;;AAGF,KAAI,WAAW,OAAO;AACrB,UAAQ,OAAO;AACf,UAAQ,UAAU,EACjB,KAAK;GACJ,SAAS;GACT,SAAS;GACT,EACD;;AAIF,OAAM,UADO,KAAK,QAAQ,eAAe,EACnB,KAAK,UAAU,SAAS,MAAM,EAAE,GAAG,MAAM,OAAO"}
@@ -0,0 +1,82 @@
1
+ //#region src/server/compile/producer-agreement.d.ts
2
+ /**
3
+ * Check that every installed Format package that produces documents is on the
4
+ * same release as this compiler.
5
+ *
6
+ * The compiler stamps `data-sdk` with its own version, but React or Vue rendered
7
+ * the markup. If they are on a different version that stamp is wrong, so this
8
+ * refuses before anything renders and names the packages to fix.
9
+ *
10
+ * It finds each package by walking up `node_modules` and reading the first
11
+ * `package.json` it hits, which is the copy Node would load. It does not use
12
+ * `require.resolve`: under vitest that resolves to this workspace's own source,
13
+ * so a test for "not installed" would pass by finding the repo it runs in.
14
+ *
15
+ * A package that is not installed is fine — a React project has no Vue, and a
16
+ * build that aliases an SDK to source has no manifest to read. A `package.json`
17
+ * that exists but will not parse is not fine: the walk stops there rather than
18
+ * carrying on up and reporting some other installation's version as this one's.
19
+ *
20
+ * `finalize-document-html` checks again at render time, comparing the `data-sdk`
21
+ * already on the markup against this compiler's. That catches what this cannot
22
+ * see, such as Yarn PnP, where there is no `node_modules` tree to walk.
23
+ */
24
+ /**
25
+ * The packages that produce document markup this compiler then stamps.
26
+ *
27
+ * Only these. `@format.dev/zip`, `@format.dev/fonts` and the rest move on the
28
+ * same release number and are checked by the lockstep warning, but none of them
29
+ * writes markup, so none of them can make a document's provenance wrong.
30
+ */
31
+ declare const PRODUCING_PACKAGES: readonly ["@format.dev/react", "@format.dev/vue"];
32
+ /** One producing package, as it resolves from the project being compiled. */
33
+ interface ResolvedProducer {
34
+ name: string;
35
+ version: string;
36
+ }
37
+ /**
38
+ * A producing package is installed and its version cannot be established.
39
+ *
40
+ * Separate from disagreement because it is a different fact: nothing has been
41
+ * shown to disagree, and nothing has been shown to agree either. The reason it
42
+ * stops the compile anyway is that this module exists to make one claim
43
+ * honest — that the release number about to be stamped on a document is the
44
+ * release that produced it — and a package whose version is unreadable is
45
+ * exactly the case where that claim cannot be made.
46
+ *
47
+ * Only a package that is absent is silence. Absent is an ordinary state with an
48
+ * ordinary meaning: a project that uses React never installed Vue, or a build
49
+ * aliased an SDK to source. A manifest that exists and will not parse is neither
50
+ * of those, and reading past it to a copy in a parent directory would be worse
51
+ * than failing — it would report a version belonging to an installation that is
52
+ * not the one Node will load.
53
+ */
54
+ declare class ProducerManifestError extends Error {
55
+ readonly name = "ProducerManifestError";
56
+ constructor(packageName: string, manifest: string, problem: string);
57
+ }
58
+ declare class ProducerAgreementError extends Error {
59
+ readonly compilerSdk: string;
60
+ readonly disagreeing: ResolvedProducer[];
61
+ constructor(compilerSdk: string, disagreeing: ResolvedProducer[]);
62
+ }
63
+ /**
64
+ * The producing packages that resolve from `cwd`, with the versions that will
65
+ * actually run.
66
+ *
67
+ * Exported so a test can see what resolution found without inferring it from
68
+ * whether a throw happened.
69
+ */
70
+ declare function resolveProducers(cwd: string, packages?: readonly string[]): ResolvedProducer[];
71
+ /**
72
+ * Refuse to compile when a producing package is a different release from this
73
+ * compiler.
74
+ *
75
+ * Called once per compile run, before any document is rendered, so the failure
76
+ * arrives as one message about the installation rather than as a stamping error
77
+ * per document.
78
+ */
79
+ declare function assertProducersAgree(cwd: string, compilerSdk?: string): void;
80
+ //#endregion
81
+ export { PRODUCING_PACKAGES, ProducerAgreementError, ProducerManifestError, ResolvedProducer, assertProducersAgree, resolveProducers };
82
+ //# sourceMappingURL=producer-agreement.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"producer-agreement.d.mts","names":[],"sources":["../../../src/server/compile/producer-agreement.ts"],"sourcesContent":[],"mappings":";;AAmCA;AAGA;AAsBA;AAcA;;;;;AA0BA;AAsFA;;;;;;;;;;;;;;;;;;;cAvJa;;UAGI,gBAAA;;;;;;;;;;;;;;;;;;;;;cAsBJ,qBAAA,SAA8B,KAAA;;;;cAc9B,sBAAA,SAA+B,KAAA;;wBAErB;gDAEwB;;;;;;;;;iBAsB/B,gBAAA,6CAAiF;;;;;;;;;iBAsFjF,oBAAA"}