@vizhub/runtime 0.1.4 → 0.3.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 (291) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +376 -178
  3. package/dist/buildHTML.d.ts +14 -0
  4. package/dist/buildHTML.js +67 -0
  5. package/dist/common/packageJson.d.ts +39 -0
  6. package/dist/common/packageJson.js +71 -0
  7. package/dist/common/packageJson.test.d.ts +1 -0
  8. package/dist/common/packageJson.test.js +146 -0
  9. package/dist/common/sucrasePlugin.d.ts +2 -0
  10. package/dist/common/sucrasePlugin.js +24 -0
  11. package/dist/common/virtualFileSystem.d.ts +3 -0
  12. package/dist/common/virtualFileSystem.js +75 -0
  13. package/dist/determineRuntimeVersion.d.ts +3 -0
  14. package/dist/determineRuntimeVersion.js +22 -0
  15. package/dist/determineRuntimeVersion.test.d.ts +1 -0
  16. package/dist/determineRuntimeVersion.test.js +101 -0
  17. package/dist/fixtures/basicHTML.d.ts +2 -0
  18. package/dist/fixtures/basicHTML.js +22 -0
  19. package/dist/fixtures/fetchProxy.d.ts +2 -0
  20. package/dist/fixtures/fetchProxy.js +25 -0
  21. package/dist/fixtures/index.d.ts +3 -0
  22. package/dist/fixtures/index.js +9 -0
  23. package/dist/fixtures/jsScriptTag.d.ts +2 -0
  24. package/dist/fixtures/jsScriptTag.js +19 -0
  25. package/dist/index.d.ts +3 -8
  26. package/dist/index.js +3 -24890
  27. package/dist/index.test.d.ts +1 -0
  28. package/dist/index.test.js +50 -0
  29. package/dist/magicSandbox/fixProtocollessUrls.d.ts +4 -0
  30. package/dist/magicSandbox/fixProtocollessUrls.js +10 -0
  31. package/dist/magicSandbox/generateInterceptorScript.d.ts +4 -0
  32. package/dist/magicSandbox/generateInterceptorScript.js +178 -0
  33. package/dist/magicSandbox/index.d.ts +19 -0
  34. package/dist/magicSandbox/index.js +48 -0
  35. package/dist/test/fixtures/basicHTML.d.ts +2 -0
  36. package/dist/test/fixtures/basicHTML.js +19 -0
  37. package/dist/test/fixtures/fetchProxy.d.ts +2 -0
  38. package/dist/test/fixtures/fetchProxy.js +22 -0
  39. package/dist/test/fixtures/index.d.ts +6 -0
  40. package/dist/test/fixtures/index.js +6 -0
  41. package/dist/test/fixtures/jsScriptTag.d.ts +2 -0
  42. package/dist/test/fixtures/jsScriptTag.js +16 -0
  43. package/dist/test/fixtures/magicSandbox/basicHTML.d.ts +5 -0
  44. package/dist/test/fixtures/magicSandbox/basicHTML.js +17 -0
  45. package/dist/test/fixtures/magicSandbox/fetchProxy.d.ts +11 -0
  46. package/dist/test/fixtures/magicSandbox/fetchProxy.js +18 -0
  47. package/dist/test/fixtures/magicSandbox/index.d.ts +6 -0
  48. package/dist/test/fixtures/magicSandbox/index.js +6 -0
  49. package/dist/test/fixtures/magicSandbox/jsScriptTag.d.ts +8 -0
  50. package/dist/test/fixtures/magicSandbox/jsScriptTag.js +13 -0
  51. package/dist/test/fixtures/magicSandbox/protocolTest.d.ts +5 -0
  52. package/dist/test/fixtures/magicSandbox/protocolTest.js +17 -0
  53. package/dist/test/fixtures/magicSandbox/styleTest.d.ts +8 -0
  54. package/dist/test/fixtures/magicSandbox/styleTest.js +19 -0
  55. package/dist/test/fixtures/magicSandbox/xmlTest.d.ts +8 -0
  56. package/dist/test/fixtures/magicSandbox/xmlTest.js +23 -0
  57. package/dist/test/fixtures/protocolTest.d.ts +2 -0
  58. package/dist/test/fixtures/protocolTest.js +19 -0
  59. package/dist/test/fixtures/styleTest.d.ts +2 -0
  60. package/dist/test/fixtures/styleTest.js +22 -0
  61. package/dist/test/fixtures/v1/basicHTML.d.ts +3 -0
  62. package/dist/test/fixtures/v1/basicHTML.js +15 -0
  63. package/dist/test/fixtures/v1/fetchProxy.d.ts +5 -0
  64. package/dist/test/fixtures/v1/fetchProxy.js +12 -0
  65. package/dist/test/fixtures/v1/index.d.ts +6 -0
  66. package/dist/test/fixtures/v1/index.js +6 -0
  67. package/dist/test/fixtures/v1/jsScriptTag.d.ts +4 -0
  68. package/dist/test/fixtures/v1/jsScriptTag.js +9 -0
  69. package/dist/test/fixtures/v1/protocolTest.d.ts +3 -0
  70. package/dist/test/fixtures/v1/protocolTest.js +15 -0
  71. package/dist/test/fixtures/v1/styleTest.d.ts +4 -0
  72. package/dist/test/fixtures/v1/styleTest.js +15 -0
  73. package/dist/test/fixtures/v1/xmlTest.d.ts +4 -0
  74. package/dist/test/fixtures/v1/xmlTest.js +19 -0
  75. package/dist/test/fixtures/v2/basicBundle.d.ts +5 -0
  76. package/dist/test/fixtures/v2/basicBundle.js +5 -0
  77. package/dist/test/fixtures/v2/basicBundleNoExtension.d.ts +5 -0
  78. package/dist/test/fixtures/v2/basicBundleNoExtension.js +5 -0
  79. package/dist/test/fixtures/v2/d3Import.d.ts +4 -0
  80. package/dist/test/fixtures/v2/d3Import.js +7 -0
  81. package/dist/test/fixtures/v2/d3ImportPkg.d.ts +5 -0
  82. package/dist/test/fixtures/v2/d3ImportPkg.js +19 -0
  83. package/dist/test/fixtures/v2/d3RosettaImportPkg.d.ts +5 -0
  84. package/dist/test/fixtures/v2/d3RosettaImportPkg.js +19 -0
  85. package/dist/test/fixtures/v2/es6Preserve.d.ts +4 -0
  86. package/dist/test/fixtures/v2/es6Preserve.js +6 -0
  87. package/dist/test/fixtures/v2/generatorSupport.d.ts +4 -0
  88. package/dist/test/fixtures/v2/generatorSupport.js +6 -0
  89. package/dist/test/fixtures/v2/index.d.ts +14 -0
  90. package/dist/test/fixtures/v2/index.js +15 -0
  91. package/dist/test/fixtures/v2/jsxTranspile.d.ts +4 -0
  92. package/dist/test/fixtures/v2/jsxTranspile.js +6 -0
  93. package/dist/test/fixtures/v2/reactDomImport.d.ts +4 -0
  94. package/dist/test/fixtures/v2/reactDomImport.js +8 -0
  95. package/dist/test/fixtures/v2/reactDomImportPkg.d.ts +5 -0
  96. package/dist/test/fixtures/v2/reactDomImportPkg.js +24 -0
  97. package/dist/test/fixtures/v2/reactImport.d.ts +4 -0
  98. package/dist/test/fixtures/v2/reactImport.js +7 -0
  99. package/dist/test/fixtures/v2/reactImportPkg.d.ts +5 -0
  100. package/dist/test/fixtures/v2/reactImportPkg.js +17 -0
  101. package/dist/test/fixtures/v2/sourceMapErrorFixture.d.ts +5 -0
  102. package/dist/test/fixtures/v2/sourceMapErrorFixture.js +19 -0
  103. package/dist/test/fixtures/v2/unicodeSupport.d.ts +4 -0
  104. package/dist/test/fixtures/v2/unicodeSupport.js +6 -0
  105. package/dist/test/fixtures/v3/basicIndexJS.d.ts +3 -0
  106. package/dist/test/fixtures/v3/basicIndexJS.js +7 -0
  107. package/dist/test/fixtures/v3/cssImport.d.ts +4 -0
  108. package/dist/test/fixtures/v3/cssImport.js +9 -0
  109. package/dist/test/fixtures/v3/csvImport.d.ts +4 -0
  110. package/dist/test/fixtures/v3/csvImport.js +11 -0
  111. package/dist/test/fixtures/v3/csvStrangeChars.d.ts +4 -0
  112. package/dist/test/fixtures/v3/csvStrangeChars.js +12 -0
  113. package/dist/test/fixtures/v3/index.d.ts +9 -0
  114. package/dist/test/fixtures/v3/index.js +9 -0
  115. package/dist/test/fixtures/v3/jsExport.d.ts +4 -0
  116. package/dist/test/fixtures/v3/jsExport.js +10 -0
  117. package/dist/test/fixtures/v3/sourcemap.d.ts +3 -0
  118. package/dist/test/fixtures/v3/sourcemap.js +10 -0
  119. package/dist/test/fixtures/v3/svelte.d.ts +4 -0
  120. package/dist/test/fixtures/v3/svelte.js +18 -0
  121. package/dist/test/fixtures/v3/vizContent.d.ts +2 -0
  122. package/dist/test/fixtures/v3/vizContent.js +11 -0
  123. package/dist/test/fixtures/v3/vizImport.d.ts +6 -0
  124. package/dist/test/fixtures/v3/vizImport.js +85 -0
  125. package/dist/test/fixtures/v4/d3Usage.d.ts +5 -0
  126. package/dist/test/fixtures/v4/d3Usage.js +31 -0
  127. package/dist/test/fixtures/v4/esmBuild.d.ts +5 -0
  128. package/dist/test/fixtures/v4/esmBuild.js +18 -0
  129. package/dist/test/fixtures/v4/fetchInterception.d.ts +5 -0
  130. package/dist/test/fixtures/v4/fetchInterception.js +18 -0
  131. package/dist/test/fixtures/v4/index.d.ts +9 -0
  132. package/dist/test/fixtures/v4/index.js +9 -0
  133. package/dist/test/fixtures/v4/jsScriptTagTypeModule.d.ts +4 -0
  134. package/dist/test/fixtures/v4/jsScriptTagTypeModule.js +18 -0
  135. package/dist/test/fixtures/v4/jsScriptTagTypeModules.d.ts +5 -0
  136. package/dist/test/fixtures/v4/jsScriptTagTypeModules.js +12 -0
  137. package/dist/test/fixtures/v4/reactHooks.d.ts +6 -0
  138. package/dist/test/fixtures/v4/reactHooks.js +47 -0
  139. package/dist/test/fixtures/v4/reactJsx.d.ts +6 -0
  140. package/dist/test/fixtures/v4/reactJsx.js +34 -0
  141. package/dist/test/fixtures/v4/threeJsUsage.d.ts +4 -0
  142. package/dist/test/fixtures/v4/threeJsUsage.js +24 -0
  143. package/dist/test/fixtures/v4/typeScriptSupport.d.ts +5 -0
  144. package/dist/test/fixtures/v4/typeScriptSupport.js +29 -0
  145. package/dist/test/fixtures/xmlTest.d.ts +2 -0
  146. package/dist/test/fixtures/xmlTest.js +26 -0
  147. package/dist/test/index.test.d.ts +1 -0
  148. package/dist/test/index.test.js +40 -0
  149. package/dist/test/testInBrowser.d.ts +15 -0
  150. package/dist/test/testInBrowser.js +47 -0
  151. package/dist/test/testStackTrace.d.ts +9 -0
  152. package/dist/test/testStackTrace.js +55 -0
  153. package/dist/test/v1.test.d.ts +1 -0
  154. package/dist/test/v1.test.js +65 -0
  155. package/dist/test/v2.test.d.ts +1 -0
  156. package/dist/test/v2.test.js +121 -0
  157. package/dist/test/v3.test.d.ts +1 -0
  158. package/dist/test/v3.test.js +114 -0
  159. package/dist/test/v4.test.d.ts +1 -0
  160. package/dist/test/v4.test.js +100 -0
  161. package/dist/types.d.ts +1 -0
  162. package/dist/types.js +1 -0
  163. package/dist/utils/getFileText.d.ts +2 -0
  164. package/dist/utils/getFileText.js +13 -0
  165. package/dist/utils/getFileText.test.d.ts +1 -0
  166. package/dist/utils/getFileText.test.js +72 -0
  167. package/dist/utils/vizContentToFileCollection.d.ts +7 -0
  168. package/dist/utils/vizContentToFileCollection.js +19 -0
  169. package/dist/utils/vizContentToFileCollection.test.d.ts +1 -0
  170. package/dist/utils/vizContentToFileCollection.test.js +75 -0
  171. package/dist/v2/computeBundleJSV2.d.ts +7 -0
  172. package/dist/v2/computeBundleJSV2.js +29 -0
  173. package/dist/v2/getComputedIndexHtml.d.ts +4 -0
  174. package/dist/v2/getComputedIndexHtml.js +81 -0
  175. package/dist/v2/getComputedIndexHtml.test.d.ts +1 -0
  176. package/dist/v2/getComputedIndexHtml.test.js +134 -0
  177. package/dist/v2/index.d.ts +1 -0
  178. package/dist/v2/index.js +1 -0
  179. package/dist/v2/v2Build.d.ts +7 -0
  180. package/dist/v2/v2Build.js +11 -0
  181. package/dist/{v3Runtime → v3}/cleanRollupErrorMessage.d.ts +0 -1
  182. package/dist/v3/cleanRollupErrorMessage.js +9 -0
  183. package/dist/v3/computeBundleJSV3.d.ts +17 -0
  184. package/dist/v3/computeBundleJSV3.js +48 -0
  185. package/dist/v3/createVizContent.d.ts +8 -0
  186. package/dist/v3/createVizContent.js +23 -0
  187. package/dist/{v3Runtime → v3}/extractVizImport.d.ts +2 -3
  188. package/dist/v3/extractVizImport.js +23 -0
  189. package/dist/v3/extractVizImport.test.d.ts +1 -0
  190. package/dist/v3/extractVizImport.test.js +30 -0
  191. package/dist/v3/htmlTemplate.d.ts +5 -0
  192. package/dist/v3/htmlTemplate.js +89 -0
  193. package/dist/v3/index.d.ts +1 -0
  194. package/dist/v3/index.js +1 -0
  195. package/dist/v3/parseId.d.ts +6 -0
  196. package/dist/v3/parseId.js +5 -0
  197. package/dist/v3/parseId.test.d.ts +1 -0
  198. package/dist/v3/parseId.test.js +25 -0
  199. package/dist/{v3Runtime → v3}/setupV3Runtime.d.ts +5 -5
  200. package/dist/v3/setupV3Runtime.js +341 -0
  201. package/dist/v3/slugCache.d.ts +11 -0
  202. package/dist/v3/slugCache.js +35 -0
  203. package/dist/v3/slugCache.test.d.ts +1 -0
  204. package/dist/v3/slugCache.test.js +105 -0
  205. package/dist/v3/transformDSV/dsvParseSrc.d.ts +1 -0
  206. package/dist/v3/transformDSV/dsvParseSrc.js +121 -0
  207. package/dist/v3/transformDSV/index.d.ts +2 -0
  208. package/dist/v3/transformDSV/index.js +40 -0
  209. package/dist/{v3Runtime → v3}/transformSvelte.d.ts +4 -2
  210. package/dist/v3/transformSvelte.js +77 -0
  211. package/dist/{v3Runtime → v3}/types.d.ts +18 -18
  212. package/dist/v3/types.js +1 -0
  213. package/dist/v3/v3Build.d.ts +14 -0
  214. package/dist/v3/v3Build.js +30 -0
  215. package/dist/v3/vizCache.d.ts +10 -0
  216. package/dist/v3/vizCache.js +36 -0
  217. package/dist/v3/vizCache.test.d.ts +1 -0
  218. package/dist/v3/vizCache.test.js +98 -0
  219. package/dist/{v3Runtime → v3}/vizLoad.d.ts +3 -4
  220. package/dist/v3/vizLoad.js +46 -0
  221. package/dist/v3/vizResolve.d.ts +7 -0
  222. package/dist/v3/vizResolve.js +69 -0
  223. package/dist/v4/index.d.ts +10 -0
  224. package/dist/v4/index.js +134 -0
  225. package/package.json +37 -38
  226. package/dist/assets/setupV3Runtime-BVr5lyKp.js +0 -240
  227. package/dist/computeSrcDoc.d.ts +0 -13
  228. package/dist/computeSrcDoc.d.ts.map +0 -1
  229. package/dist/computeSrcDoc.test.d.ts +0 -2
  230. package/dist/computeSrcDoc.test.d.ts.map +0 -1
  231. package/dist/index.d.ts.map +0 -1
  232. package/dist/useRuntime.d.ts +0 -13
  233. package/dist/useRuntime.d.ts.map +0 -1
  234. package/dist/v2Runtime/bundle/bubleJSXOnly.d.ts +0 -5
  235. package/dist/v2Runtime/bundle/bubleJSXOnly.d.ts.map +0 -1
  236. package/dist/v2Runtime/bundle/packageJson.d.ts +0 -10
  237. package/dist/v2Runtime/bundle/packageJson.d.ts.map +0 -1
  238. package/dist/v2Runtime/computeSrcDocV2.d.ts +0 -3
  239. package/dist/v2Runtime/computeSrcDocV2.d.ts.map +0 -1
  240. package/dist/v2Runtime/computeSrcDocV2.test.d.ts +0 -2
  241. package/dist/v2Runtime/computeSrcDocV2.test.d.ts.map +0 -1
  242. package/dist/v2Runtime/getComputedIndexHtml.d.ts +0 -4
  243. package/dist/v2Runtime/getComputedIndexHtml.d.ts.map +0 -1
  244. package/dist/v2Runtime/getComputedIndexHtml.test.d.ts +0 -2
  245. package/dist/v2Runtime/getComputedIndexHtml.test.d.ts.map +0 -1
  246. package/dist/v2Runtime/getText.d.ts +0 -3
  247. package/dist/v2Runtime/getText.d.ts.map +0 -1
  248. package/dist/v2Runtime/transformFiles.d.ts +0 -3
  249. package/dist/v2Runtime/transformFiles.d.ts.map +0 -1
  250. package/dist/v2Runtime/v3FilesToV2Files.d.ts +0 -3
  251. package/dist/v2Runtime/v3FilesToV2Files.d.ts.map +0 -1
  252. package/dist/v2Runtime/v3FilesToV2Files.test.d.ts +0 -2
  253. package/dist/v2Runtime/v3FilesToV2Files.test.d.ts.map +0 -1
  254. package/dist/v3Runtime/build.d.ts +0 -14
  255. package/dist/v3Runtime/build.d.ts.map +0 -1
  256. package/dist/v3Runtime/build.test.d.ts +0 -2
  257. package/dist/v3Runtime/build.test.d.ts.map +0 -1
  258. package/dist/v3Runtime/cleanRollupErrorMessage.d.ts.map +0 -1
  259. package/dist/v3Runtime/computeSrcDocV3.d.ts +0 -7
  260. package/dist/v3Runtime/computeSrcDocV3.d.ts.map +0 -1
  261. package/dist/v3Runtime/extractVizImport.d.ts.map +0 -1
  262. package/dist/v3Runtime/extractVizImport.test.d.ts +0 -2
  263. package/dist/v3Runtime/extractVizImport.test.d.ts.map +0 -1
  264. package/dist/v3Runtime/generateRollupErrorMessage.d.ts +0 -5
  265. package/dist/v3Runtime/generateRollupErrorMessage.d.ts.map +0 -1
  266. package/dist/v3Runtime/importFromViz.d.ts +0 -1
  267. package/dist/v3Runtime/importFromViz.d.ts.map +0 -1
  268. package/dist/v3Runtime/index.d.ts +0 -2
  269. package/dist/v3Runtime/index.d.ts.map +0 -1
  270. package/dist/v3Runtime/parseId.d.ts +0 -7
  271. package/dist/v3Runtime/parseId.d.ts.map +0 -1
  272. package/dist/v3Runtime/setupV3Runtime.d.ts.map +0 -1
  273. package/dist/v3Runtime/transformDSV/index.d.ts +0 -3
  274. package/dist/v3Runtime/transformDSV/index.d.ts.map +0 -1
  275. package/dist/v3Runtime/transformSvelte.d.ts.map +0 -1
  276. package/dist/v3Runtime/types.d.ts.map +0 -1
  277. package/dist/v3Runtime/urlLoad.d.ts +0 -1
  278. package/dist/v3Runtime/urlLoad.d.ts.map +0 -1
  279. package/dist/v3Runtime/virtual.d.ts +0 -1
  280. package/dist/v3Runtime/virtual.d.ts.map +0 -1
  281. package/dist/v3Runtime/vizCache.d.ts +0 -11
  282. package/dist/v3Runtime/vizCache.d.ts.map +0 -1
  283. package/dist/v3Runtime/vizCache.test.d.ts +0 -2
  284. package/dist/v3Runtime/vizCache.test.d.ts.map +0 -1
  285. package/dist/v3Runtime/vizLoad.d.ts.map +0 -1
  286. package/dist/v3Runtime/vizLoadSvelte.d.ts +0 -1
  287. package/dist/v3Runtime/vizLoadSvelte.d.ts.map +0 -1
  288. package/dist/v3Runtime/vizResolve.d.ts +0 -10
  289. package/dist/v3Runtime/vizResolve.d.ts.map +0 -1
  290. package/dist/v3Runtime/worker.d.ts +0 -2
  291. package/dist/v3Runtime/worker.d.ts.map +0 -1
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Datavis Tech INC
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,257 +1,455 @@
1
- # @vizhub-core/runtime
1
+ # @vizhub/runtime
2
2
 
3
- The `@vizhub-core/runtime` package is a core component of the VizHub platform, responsible for executing and rendering visualizations in an isolated environment. It supports multiple runtime versions (V2 and V3) and provides a flexible system for handling dependencies, file transformations, and hot reloading.
3
+ [![NPM version](https://img.shields.io/npm/v/@vizhub/runtime.svg)](https://www.npmjs.com/package/@vizhub/runtime)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4
5
 
5
- ## Features
6
+ A powerful, flexible runtime environment for executing code sandboxes in the browser. `@vizhub/runtime` powers [VizHub](https://vizhub.com/) and can be used to build similar interactive coding platforms.
6
7
 
7
- - **Source code to HTML transformation**: Converts source code to HTML with embedded scripts and styles, ready for rendering in a browser.
8
- - **File transformations**: Transforms various file types (e.g., JavaScript, CSS, CSV, Svelte) to be used in the runtime environment.
9
- - **Hot reloading**: Automatically reloads visualizations when files are updated, providing a smooth development experience.
10
- - **Dependency management**: Handles external dependencies via CDN and supports custom package configurations.
11
- - **Virtual file system**: Implements a virtual file system for handling imports and file loading within the runtime.
12
- - **Web Worker-based build system**: Uses Web Workers to offload the build process, ensuring a responsive UI during development.
13
- - **Multi-version runtime support**: Supports both V2 and V3 runtime environments, allowing for backward compatibility and future-proofing.
8
+ ## Overview
14
9
 
15
- ## Installation
16
-
17
- Install the package using npm:
10
+ `@vizhub/runtime` intelligently detects the appropriate runtime version based on the provided files and generates executable HTML that can be used within an iframe's `srcdoc` attribute. It handles everything from simple HTML/JS/CSS combinations to complex module bundling, dependency resolution, and cross-viz imports.
18
11
 
19
- ```bash
20
- npm install @vizhub-core/runtime
21
- ```
12
+ ## Runtime Versions
22
13
 
23
- ## Usage
14
+ The library automatically detects which runtime version to use based on the files provided:
24
15
 
25
- The `@vizhub-core/runtime` package is designed to be used within the VizHub platform but can also be utilized in other environments where isolated execution of visualizations is required.
16
+ - **v1**: When only `index.html` is present
17
+ - **v2**: When both `index.html` and `index.js` (or `index.jsx`) are present
18
+ - **v3**: When only `index.js` is present (no `index.html`)
19
+ - **v4**: When `index.html` contains ES module scripts with import maps
26
20
 
27
- ### Example
21
+ | Feature | **V1** | **V2** | **V3** | **V4** |
22
+ | --------------------- | ----------------- | ------------------------------ | --------------------------------- | ---------------------------- |
23
+ | **When Used** | Only `index.html` | `index.html` + `index.js/.jsx` | Only `index.js` (no `index.html`) | `index.html` with ES modules |
24
+ | **`index.html`** | User-provided | User-provided | Auto-generated | User-provided |
25
+ | **ES Modules** | ☐ | ✅ | ✅ | ✅ |
26
+ | **UMD Libraries** | ✅ | ✅ | ✅ | ☐ |
27
+ | **ESM Libraries** | ☐ | ☐ | ☐ | ✅ |
28
+ | **JSX Support** | ☐ | ✅ | ☐ | ✅ |
29
+ | **Svelte Support** | ☐ | ☐ | ✅ | ☐ |
30
+ | **Cross-Viz Imports** | ☐ | ☐ | ✅ | ☐ |
31
+ | **State Management** | ☐ | ☐ | ✅ | ☐ |
32
+ | **Import from CSV** | ☐ | ☐ | ✅ | ☐ |
33
+ | **`fetch` proxy** | ✅ | ✅ | ☐ | ✅ |
34
+ | **Best For** | Simple HTML demos | React with CDN deps | Svelte / reusable D3 | Modern module-based apps |
28
35
 
29
- Here's an example of how to use the runtime to compute the `srcdoc` for a visualization:
36
+ ## V1 Runtime
30
37
 
31
- ```javascript
32
- import { expect, test } from "vitest";
33
- import { rollup } from "rollup";
34
- import { computeSrcDoc, createVizCache, VizCache } from "@vizhub/runtime";
35
-
36
- test("computeSrcDoc", async () => {
37
- const content = {
38
- files: {
39
- "32748932": {
40
- name: "index.js",
41
- text: "export const main = (container) => container.innerHTML = 'Hello, world!';",
42
- },
43
- },
44
- };
38
+ The V1 runtime is the simplest version, designed for basic HTML, CSS, and JavaScript projects. This runtime is automatically selected when your project contains only an `index.html` file.
45
39
 
46
- const vizCache: VizCache = createVizCache({
47
- initialContents: [content],
48
- handleCacheMiss: async () => {
49
- return content;
50
- },
51
- });
40
+ ### How It Works
52
41
 
53
- const resolveSlug = async (slug: string) => {
54
- throw new Error("Not implemented");
55
- };
42
+ In V1 runtime:
56
43
 
57
- const getSvelteCompiler = async () => {
58
- throw new Error("Not implemented");
59
- };
44
+ - Your `index.html` file is executed directly in the browser
45
+ - You can include inline JavaScript and CSS within your HTML file
46
+ - The runtime provides fetch request proxying to handle cross-origin requests
60
47
 
61
- const { initialSrcdoc, initialSrcdocError } = await computeSrcDoc({
62
- rollup,
63
- content,
64
- vizCache,
65
- resolveSlug,
66
- getSvelteCompiler,
67
- });
48
+ ### Example Usage
68
49
 
69
- const randomID = initialSrcdoc.match(/viz-container-(\d+)/)?.[1];
50
+ As a VizHub user, you simply need to create an `index.html` file containing your entire project:
70
51
 
71
- const srcdocWithoutMapping = initialSrcdoc.replace(
72
- /\/\/# sourceMappingURL=.*$/gm,
73
- ""
74
- );
52
+ **index.html**
75
53
 
76
- expect(srcdocWithoutMapping).toEqual(`<!DOCTYPE html>
54
+ ```html
55
+ <!DOCTYPE html>
77
56
  <html>
78
57
  <head>
79
- <meta charset="utf-8">
80
58
  <style>
81
59
  body {
82
- margin: 0;
83
- overflow: hidden;
84
- }
85
- #viz-container-${randomID} {
86
- height: 100vh;
60
+ font-family: sans-serif;
87
61
  }
88
62
  </style>
89
63
  </head>
90
64
  <body>
91
- <div id="viz-container-${randomID}"></div>
92
- <script id="injected-script">(function(g,f){typeof exports==='object'&&typeof module!=='undefined'?f(exports):typeof define==='function'&&define.amd?define(['exports'],f):(g=typeof globalThis!=='undefined'?globalThis:g||self,f(g.Viz={}));})(this,(function(exports){'use strict';const main = (container) => container.innerHTML = 'Hello, world!';exports.main=main;}));
93
-
94
-
65
+ <h1>Hello World</h1>
95
66
  <script>
96
- (() => {
97
- let cleanup;
98
- const render = () => {
99
- const container = document.getElementById('viz-container-${randomID}');
100
- typeof cleanup === 'function' && cleanup();
101
- cleanup = Viz.main(container, { state: window.state, setState, writeFile });
102
- };
103
- const setState = (next) => {
104
- window.state = next(window.state);
105
- render();
106
- };
107
- const writeFile = (fileName, content) => {
108
- parent.postMessage({ type: 'writeFile', fileName, content }, "*");
109
- };
110
- const run = () => {
111
- try {
112
- setState((state) => state || {});
113
- } catch (error) {
114
- console.error(error);
115
- parent.postMessage({ type: 'runError', error }, "*");
116
- }
117
- }
118
- run();
119
- const runJS = (src) => {
120
- document.getElementById('injected-script')?.remove();
121
- const script = document.createElement('script');
122
- script.textContent = src;
123
- script.id = 'injected-script';
124
- document.body.appendChild(script);
125
- run();
126
- };
127
- const runCSS = (src, id) => {
128
- const styleElementId = 'injected-style' + id;
129
- let style = document.getElementById(styleElementId);
130
- if (!style) {
131
- style = document.createElement('style');
132
- style.type = 'text/css';
133
- style.id = styleElementId;
134
- document.head.appendChild(style);
135
- }
136
- style.textContent = src;
137
- };
138
- onmessage = (message) => {
139
- switch (message.data.type) {
140
- case 'runJS':
141
- runJS(message.data.src);
142
- parent.postMessage({ type: 'runDone' }, "*");
143
- break;
144
- case 'runCSS':
145
- runCSS(message.data.src, message.data.id);
146
- break;
147
- case 'ping':
148
- parent.postMessage({ type: 'pong' }, "*");
149
- break;
150
- default:
151
- break;
152
- }
153
- }
154
- })();
67
+ console.log("Hello from V1 runtime!");
155
68
  </script>
156
69
  </body>
157
- </html>`);
158
- });
70
+ </html>
159
71
  ```
160
72
 
161
- You can use the generated HTML and run it as a standalone page or within an iframe to display the visualization.
73
+ V1 is ideal for simple demonstrations or when you want complete control over your HTML structure.
162
74
 
163
- ## API Documentation
75
+ ## V2 Runtime
164
76
 
165
- ### `computeSrcDoc`
77
+ The V2 runtime introduces JavaScript bundling with Rollup, JSX support, and CDN-based dependency resolution. This runtime is automatically selected when your project contains both an `index.html` and an `index.js` (or `index.jsx`) file.
166
78
 
167
- Computes the `srcdoc` for a visualization based on its content and dependencies.
79
+ ### How It Works
168
80
 
169
- #### Parameters
81
+ In V2 runtime:
170
82
 
171
- - **`rollup`**: The Rollup instance used for bundling.
172
- - **`content`**: The content of the visualization, including files like `index.js` and `index.html`.
173
- - **`vizCache`**: A cache of visualizations used to resolve imports from other visualizations.
174
- - **`resolveSlug`**: A function to resolve slug-based imports to a viz ID.
175
- - **`getSvelteCompiler`**: A function to get the Svelte compiler.
83
+ - Your JavaScript files are bundled together using Rollup
84
+ - Internally, a file named `bundle.js` is created
85
+ - The `index.html` file references this `bundle.js` file
86
+ - You can use ES6 modules to import/export code
87
+ - JSX syntax is supported for React development
88
+ - Dependencies listed in `package.json` are automatically resolved via CDNs (jsDelivr/unpkg)
89
+ - The bundled JavaScript is referenced in your HTML file
176
90
 
177
- #### Returns
91
+ ### Example Usage
178
92
 
179
- A promise that resolves to an object containing:
93
+ As a VizHub user, you'll typically create:
180
94
 
181
- - **`initialSrcdoc`**: The computed `srcdoc` for the visualization.
182
- - **`initialSrcdocError`**: Any error that occurred during the computation.
95
+ 1. An `index.html` file that references a `bundle.js` file
96
+ 2. An `index.js` (or `index.jsx`) file as your entry point
97
+ 3. Additional JavaScript modules as needed
98
+ 4. A `package.json` file to list dependencies
183
99
 
184
- ### `createVizCache`
100
+ **index.html**
185
101
 
186
- Creates a cache for visualizations, used to resolve imports from other visualizations.
102
+ ```html
103
+ <!DOCTYPE html>
104
+ <html>
105
+ <body>
106
+ <div id="root"></div>
107
+ <script src="bundle.js"></script>
108
+ </body>
109
+ </html>
110
+ ```
111
+
112
+ **index.js**
113
+
114
+ ```javascript
115
+ import { render } from "./render";
116
+ render(document.getElementById("root"));
117
+ ```
187
118
 
188
- #### Parameters
119
+ **render.js**
189
120
 
190
- - **`initialContents`**: An array of initial contents to populate the cache.
191
- - **`handleCacheMiss`**: A function called when a visualization is not found in the cache.
121
+ ```javascript
122
+ export function render(element) {
123
+ element.innerHTML = "<h1>Hello from V2 runtime!</h1>";
124
+ }
125
+ ```
192
126
 
193
- #### Returns
127
+ **package.json**
194
128
 
195
- A `VizCache` object with the following methods:
129
+ ```json
130
+ {
131
+ "dependencies": {
132
+ "d3": "7.8.5",
133
+ "react": "18.2.0",
134
+ "react-dom": "18.2.0"
135
+ }
136
+ }
137
+ ```
196
138
 
197
- - **`get(vizId)`**: Retrieves the content of a visualization by its ID.
198
- - **`set(content)`**: Adds or updates the content of a visualization in the cache.
199
- - **`invalidate(vizId)`**: Invalidates the cache for a specific visualization.
139
+ V2 is ideal for more complex projects that require modular JavaScript and external dependencies that provide UMD builds. Note that the V2 runtime does not support ESM builds for external dependencies (see V4 if you need this).
200
140
 
201
- ### `setJSDOM`
141
+ ## V3 Runtime
202
142
 
203
- Sets the DOM parser for environments where the native `DOMParser` is not available (e.g., Node.js).
143
+ The V3 runtime provides advanced module bundling with Svelte support and cross-viz imports. This runtime is automatically selected when your project contains an `index.js` file but no `index.html` file.
204
144
 
205
- #### Parameters
145
+ ### How It Works
206
146
 
207
- - **`JSDOM`**: The `JSDOM` instance to use for parsing HTML.
147
+ In V3 runtime:
208
148
 
209
- ### `cleanRollupErrorMessage`
149
+ - Your JavaScript modules are bundled together using Rollup
150
+ - A default HTML structure is automatically generated
151
+ - Svelte components are supported
152
+ - Cross-viz imports allow you to import code from other viz instances
153
+ - The runtime provides a built-in state management system
210
154
 
211
- Cleans up Rollup error messages by removing unnecessary details like the viz ID.
155
+ ### State Management in V3
212
156
 
213
- #### Parameters
157
+ V3 runtime includes a built-in state management system via the [unidirectional-data-flow](https://www.npmjs.com/package/unidirectional-data-flow) package ([GitHub](https://github.com/vizhub-core/unidirectional-data-flow)). This provides React-like state management capabilities with:
214
158
 
215
- - **`rawMessage`**: The raw error message from Rollup.
216
- - **`vizId`**: The ID of the visualization.
159
+ - A `main` entry point
160
+ - A minimal state management system based on `state` and `setState`
161
+ - Similar semantics to React's `useState` hook: `const [state, setState] = useState({})`
162
+ - Automatic re-rendering when state changes
217
163
 
218
- #### Returns
164
+ ### The Problem: Re-using D3 Rendering Logic Across Frameworks
219
165
 
220
- - A cleaned-up error message string.
166
+ While frameworks like React, Svelte, Vue, and Angular offer state management and DOM manipulation solutions, D3 excels in data transformation and visualization, particularly with axes, transitions, and behaviors (e.g. zoom, drag, and brush). These D3 features require direct access to the DOM, making it challenging to replicate them effectively within frameworks.
221
167
 
222
- ## Development
168
+ ### The Solution: Unidirectional Data Flow
169
+
170
+ Unidirectional data flow is a pattern that can be cleanly invoked from multiple frameworks. In this paradigm, a single function is responsible for updating the DOM or rendering visuals based on a single, central state. As the state updates, the function re-renders the visualization in an idempotent manner, meaning it can run multiple times without causing side effects. Here's what the entry point function looks like for a D3-based visualization that uses unidirectional data flow:
171
+
172
+ **index.js**
173
+
174
+ ```js
175
+ export const main = (container, { state, setState }) => {
176
+ // Your reusable D3-based rendering logic goes here
177
+ };
178
+ ```
223
179
 
224
- To contribute to the development of this package, follow these steps:
180
+ - **`container`**: A DOM element where the visualization will be rendered
181
+ - **`state`**: An object representing the current state of the application, initially empty
182
+ - **`setState`**: A function that updates the state using immutable update patterns
183
+
184
+ Whenever `setState` is invoked, `main` re-executes with the new state, ensuring that the rendering logic is both dynamic and responsive.
185
+
186
+ For cross-viz imports, you can reference other vizzes directly:
187
+
188
+ **example-with-import.js**
189
+
190
+ ```javascript
191
+ // Import from another viz using @username/vizIdOrSlug syntax
192
+ import { someFunction } from "@username/my-other-viz";
193
+ ```
194
+
195
+ V3 is ideal for modern JavaScript applications that benefit from automatic HTML structure generation and built-in state management. Additional features of V3 include:
196
+
197
+ - **Cross-Viz Imports**: Import code from other viz instances using `@username/vizIdOrSlug` syntax
198
+ - **Import from CSV**: Import CSV files directly into your viz
199
+
200
+ ## V4 Runtime
201
+
202
+ The V4 runtime leverages modern ES Modules with import maps for direct browser execution. This runtime is automatically selected when your project's `index.html` contains ES module scripts with import maps.
203
+
204
+ ### How It Works
205
+
206
+ In V4 runtime:
207
+
208
+ - Native browser ES modules are used without bundling
209
+ - Import maps allow you to specify module resolution directly in the browser
210
+ - Module paths can be aliased for cleaner imports
211
+ - External dependencies can be loaded directly from CDNs
212
+
213
+ ### Example Usage
214
+
215
+ As a VizHub user, you'll create an `index.html` file with import maps and ES module scripts:
216
+
217
+ **index.html**
218
+
219
+ ```html
220
+ <!DOCTYPE html>
221
+ <html>
222
+ <head>
223
+ <script type="importmap">
224
+ {
225
+ "imports": {
226
+ "utils": "./utils.js",
227
+ "d3": "https://cdn.jsdelivr.net/npm/d3@7.8.5/+esm"
228
+ }
229
+ }
230
+ </script>
231
+ </head>
232
+ <body>
233
+ <div id="app"></div>
234
+ <script type="module" src="index.js"></script>
235
+ </body>
236
+ </html>
237
+ ```
238
+
239
+ **index.js**
240
+
241
+ ```javascript
242
+ import { createApp } from "utils";
243
+ import * as d3 from "d3";
244
+
245
+ createApp(document.getElementById("app"));
246
+ ```
225
247
 
226
- ### Clone the Repository
248
+ **utils.js**
249
+
250
+ ```javascript
251
+ export function createApp(element) {
252
+ element.innerHTML = "<h1>Hello from V4 runtime!</h1>";
253
+ }
254
+ ```
255
+
256
+ V4 is ideal for modern browsers with native ES module support and when you want direct control over module resolution.
257
+
258
+ ## Key Features
259
+
260
+ - **Multi-Version Runtime Support**
261
+
262
+ - **v1**: Simple HTML execution with fetch proxying
263
+ - **v2**: JavaScript bundling with Rollup, JSX support, and CDN-based dependency resolution
264
+ - **v3**: Advanced module bundling with Svelte support and cross-viz imports
265
+ - **v4**: Modern ES Modules with import maps for direct browser execution
266
+
267
+ - **Comprehensive Tooling**
268
+
269
+ - **Bundling**: Seamless integration with Rollup for module bundling
270
+ - **Transpilation**: Support for JSX (v2) and Svelte components (v3)
271
+ - **Dependency Management**: Automatic resolution via CDNs (jsDelivr/unpkg)
272
+ - **Caching**: Efficient viz content and slug resolution caching
273
+ - **Debugging**: Sourcemap generation for improved debugging experience
274
+
275
+ - **Advanced Capabilities**
276
+ - **Cross-Viz Imports**: Import code from other viz instances using `@username/vizIdOrSlug` syntax
277
+ - **Fetch Interception**: Handle cross-origin requests and authentication
278
+ - **File Type Support**: Process JS, JSX, CSS, CSV, JSON, and more
279
+
280
+ ## Installation
227
281
 
228
282
  ```bash
229
- git clone https://github.com/vizhub-core/vizhub3.git
230
- cd vizhub3
283
+ npm install @vizhub/runtime
284
+ ```
285
+
286
+ ## Usage
287
+
288
+ ### Basic Usage
289
+
290
+ ```javascript
291
+ import { buildHTML } from "@vizhub/runtime";
292
+ import { rollup } from "rollup";
293
+
294
+ // Simple v1 runtime (HTML only)
295
+ const html = await buildHTML({
296
+ files: {
297
+ "index.html":
298
+ "<html><body><h1>Hello World</h1></body></html>",
299
+ },
300
+ });
301
+
302
+ // v2 runtime with bundling
303
+ const html = await buildHTML({
304
+ files: {
305
+ "index.html":
306
+ '<html><body><div id="root"></div><script src="bundle.js"></script></body></html>',
307
+ "index.js":
308
+ 'import { message } from "./message"; console.log(message);',
309
+ "message.js":
310
+ 'export const message = "Hello, bundled world!";',
311
+ },
312
+ rollup,
313
+ });
314
+
315
+ // Use the generated HTML in an iframe
316
+ const iframe = document.createElement("iframe");
317
+ iframe.srcdoc = html;
318
+ document.body.appendChild(iframe);
319
+ ```
320
+
321
+ ### Advanced Usage: v3 Runtime with Cross-Viz Imports
322
+
323
+ ```javascript
324
+ import {
325
+ buildHTML,
326
+ createVizCache,
327
+ createSlugCache,
328
+ } from "@vizhub/runtime";
329
+ import { rollup } from "rollup";
330
+ import { compile } from "svelte/compiler";
331
+
332
+ // Create caches for viz content and slug resolution
333
+ const vizCache = createVizCache({
334
+ initialContents: [
335
+ {
336
+ id: "viz-123",
337
+ files: {
338
+ file1: {
339
+ name: "index.js",
340
+ text: "export const value = 42;",
341
+ },
342
+ },
343
+ },
344
+ ],
345
+ handleCacheMiss: async (vizId) => {
346
+ // Fetch viz content from your backend
347
+ return await fetchVizContent(vizId);
348
+ },
349
+ });
350
+
351
+ const slugCache = createSlugCache({
352
+ initialMappings: {
353
+ "username/my-viz": "viz-123",
354
+ },
355
+ handleCacheMiss: async (slug) => {
356
+ // Resolve slug to vizId from your backend
357
+ return await resolveSlug(slug);
358
+ },
359
+ });
360
+
361
+ // Build HTML with cross-viz imports
362
+ const html = await buildHTML({
363
+ files: {
364
+ "index.js":
365
+ 'import { value } from "@username/my-viz"; console.log(value);',
366
+ },
367
+ rollup,
368
+ vizCache,
369
+ vizId: "current-viz-id",
370
+ slugCache,
371
+ getSvelteCompiler: async () => compile,
372
+ });
231
373
  ```
232
374
 
233
- ### Install Dependencies
375
+ ## API Reference
376
+
377
+ ### buildHTML(options)
378
+
379
+ Builds HTML that can be used as the `srcdoc` of an iframe.
380
+
381
+ #### Options
382
+
383
+ - **files**: `FileCollection` - A map of filenames to their contents
384
+ - **rollup**: `(options: RollupOptions) => Promise<RollupBuild>` - Rollup function (required for v2, v3, v4)
385
+ - **enableSourcemap**: `boolean` - Whether to include sourcemaps (default: true)
386
+ - **vizCache**: `VizCache` - Cache for viz content (required for v3 with cross-viz imports)
387
+ - **vizId**: `string` - ID of the current viz (required for v3 with cross-viz imports)
388
+ - **slugCache**: `SlugCache` - Cache for slug resolution (optional for v3)
389
+ - **getSvelteCompiler**: `() => Promise<SvelteCompiler>` - Function that returns Svelte compiler (optional for v3)
390
+
391
+ ### createVizCache(options)
392
+
393
+ Creates a cache for viz content.
394
+
395
+ #### Options
396
+
397
+ - **initialContents**: `VizContent[]` - Initial viz contents to populate the cache
398
+ - **handleCacheMiss**: `(vizId: string) => Promise<VizContent>` - Function to handle cache misses
399
+
400
+ ### createSlugCache(options)
401
+
402
+ Creates a cache for slug resolution.
403
+
404
+ #### Options
405
+
406
+ - **initialMappings**: `Record<string, string>` - Initial slug to vizId mappings
407
+ - **handleCacheMiss**: `(slug: string) => Promise<string>` - Function to handle cache misses
408
+
409
+ ## Development
410
+
411
+ ### Setup
234
412
 
235
413
  ```bash
414
+ git clone https://github.com/vizhub-core/vizhub-runtime.git
415
+ cd vizhub-runtime
236
416
  npm install
237
417
  ```
238
418
 
239
- ### Run Tests
419
+ ### Build
420
+
421
+ ```bash
422
+ npm run build
423
+ ```
240
424
 
241
- The package uses Vitest for testing. Run the tests with:
425
+ ### Test
242
426
 
243
427
  ```bash
244
- npm run test
428
+ npm test
245
429
  ```
246
430
 
247
- ### Build the Package
431
+ Run specific tests:
248
432
 
249
- To build the package, use:
433
+ ```bash
434
+ npx vitest run -t "should handle CSS imports"
435
+ ```
436
+
437
+ ### Type Checking
250
438
 
251
439
  ```bash
252
- npm run build
440
+ npm run typecheck
253
441
  ```
254
442
 
443
+ ## Contributing
444
+
445
+ Contributions are welcome! Please feel free to submit a Pull Request.
446
+
447
+ 1. Fork the repository
448
+ 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
449
+ 3. Commit your changes (`git commit -m 'Add some amazing feature'`)
450
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
451
+ 5. Open a Pull Request
452
+
255
453
  ## License
256
454
 
257
- This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
455
+ This project is licensed under the MIT License - see the LICENSE file for details.
@@ -0,0 +1,14 @@
1
+ import type { RollupBuild, RollupOptions } from "rollup";
2
+ import { VizCache } from "./v3/vizCache";
3
+ import { SlugCache } from "./v3/slugCache";
4
+ import { SvelteCompiler } from "./v3/transformSvelte";
5
+ import { FileCollection } from "@vizhub/viz-types";
6
+ export declare const buildHTML: ({ files, rollup, enableSourcemap, vizCache, vizId, slugCache, getSvelteCompiler, }: {
7
+ files?: FileCollection;
8
+ rollup?: (options: RollupOptions) => Promise<RollupBuild>;
9
+ enableSourcemap?: boolean;
10
+ vizCache?: VizCache;
11
+ vizId?: string;
12
+ slugCache?: SlugCache;
13
+ getSvelteCompiler?: () => Promise<SvelteCompiler>;
14
+ }) => Promise<string>;