@vizhub/runtime 0.3.0 → 0.3.2

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 (260) hide show
  1. package/dist/cjs/buildHTML.js +71 -0
  2. package/dist/cjs/common/packageJson.js +81 -0
  3. package/dist/cjs/common/packageJson.test.js +148 -0
  4. package/dist/cjs/common/sucrasePlugin.js +27 -0
  5. package/dist/cjs/common/virtualFileSystem.js +79 -0
  6. package/dist/cjs/determineRuntimeVersion.js +26 -0
  7. package/dist/cjs/determineRuntimeVersion.test.js +103 -0
  8. package/dist/cjs/index.js +9 -0
  9. package/dist/cjs/package.json +1 -0
  10. package/dist/cjs/test/fixtures/v1/basicHTML.js +18 -0
  11. package/dist/cjs/test/fixtures/v1/fetchProxy.js +15 -0
  12. package/dist/cjs/test/fixtures/v1/index.js +15 -0
  13. package/dist/cjs/test/fixtures/v1/jsScriptTag.js +12 -0
  14. package/dist/cjs/test/fixtures/v1/protocolTest.js +18 -0
  15. package/dist/cjs/test/fixtures/v1/styleTest.js +18 -0
  16. package/dist/cjs/test/fixtures/v1/xmlTest.js +22 -0
  17. package/dist/cjs/test/fixtures/v2/basicBundle.js +8 -0
  18. package/dist/cjs/test/fixtures/v2/basicBundleNoExtension.js +8 -0
  19. package/dist/cjs/test/fixtures/v2/d3Import.js +10 -0
  20. package/dist/cjs/test/fixtures/v2/d3ImportPkg.js +22 -0
  21. package/dist/cjs/test/fixtures/v2/d3RosettaImportPkg.js +22 -0
  22. package/dist/cjs/test/fixtures/v2/es6Preserve.js +9 -0
  23. package/dist/cjs/test/fixtures/v2/generatorSupport.js +9 -0
  24. package/dist/cjs/test/fixtures/v2/index.js +45 -0
  25. package/dist/cjs/test/fixtures/v2/jsxTranspile.js +9 -0
  26. package/dist/cjs/test/fixtures/v2/reactDomImport.js +11 -0
  27. package/dist/cjs/test/fixtures/v2/reactDomImportPkg.js +27 -0
  28. package/dist/cjs/test/fixtures/v2/reactImport.js +10 -0
  29. package/dist/cjs/test/fixtures/v2/reactImportPkg.js +20 -0
  30. package/dist/cjs/test/fixtures/v2/sourceMapErrorFixture.js +22 -0
  31. package/dist/cjs/test/fixtures/v2/unicodeSupport.js +9 -0
  32. package/dist/cjs/test/fixtures/v3/basicIndexJS.js +10 -0
  33. package/dist/cjs/test/fixtures/v3/cssImport.js +12 -0
  34. package/dist/cjs/test/fixtures/v3/csvImport.js +14 -0
  35. package/dist/cjs/test/fixtures/v3/csvStrangeChars.js +15 -0
  36. package/dist/cjs/test/fixtures/v3/index.js +25 -0
  37. package/dist/cjs/test/fixtures/v3/jsExport.js +13 -0
  38. package/dist/cjs/test/fixtures/v3/sourcemap.js +13 -0
  39. package/dist/cjs/test/fixtures/v3/svelte.js +21 -0
  40. package/dist/cjs/test/fixtures/v3/vizContent.js +14 -0
  41. package/dist/cjs/test/fixtures/v3/vizImport.js +88 -0
  42. package/dist/cjs/test/fixtures/v4/d3Usage.js +34 -0
  43. package/dist/cjs/test/fixtures/v4/esmBuild.js +21 -0
  44. package/dist/cjs/test/fixtures/v4/fetchInterception.js +21 -0
  45. package/dist/cjs/test/fixtures/v4/index.js +21 -0
  46. package/dist/cjs/test/fixtures/v4/jsScriptTagTypeModule.js +21 -0
  47. package/dist/cjs/test/fixtures/v4/jsScriptTagTypeModules.js +15 -0
  48. package/dist/cjs/test/fixtures/v4/reactHooks.js +50 -0
  49. package/dist/cjs/test/fixtures/v4/reactJsx.js +37 -0
  50. package/dist/cjs/test/fixtures/v4/threeJsUsage.js +27 -0
  51. package/dist/cjs/test/fixtures/v4/typeScriptSupport.js +32 -0
  52. package/dist/cjs/test/testInBrowser.js +50 -0
  53. package/dist/cjs/test/testStackTrace.js +58 -0
  54. package/dist/cjs/test/v1.test.js +70 -0
  55. package/dist/cjs/test/v2.test.js +124 -0
  56. package/dist/cjs/test/v3.test.js +119 -0
  57. package/dist/cjs/test/v4.test.js +105 -0
  58. package/dist/cjs/types.js +2 -0
  59. package/dist/cjs/utils/vizContentToFileCollection.js +23 -0
  60. package/dist/cjs/utils/vizContentToFileCollection.test.js +77 -0
  61. package/dist/cjs/v2/computeBundleJSV2.js +33 -0
  62. package/dist/cjs/v2/getComputedIndexHtml.js +86 -0
  63. package/dist/cjs/v2/getComputedIndexHtml.test.js +136 -0
  64. package/dist/cjs/v2/index.js +5 -0
  65. package/dist/cjs/v2/v2Build.js +15 -0
  66. package/dist/cjs/v3/cleanRollupErrorMessage.js +13 -0
  67. package/dist/cjs/v3/computeBundleJSV3.js +52 -0
  68. package/dist/cjs/v3/createVizContent.js +27 -0
  69. package/dist/cjs/v3/extractVizImport.js +27 -0
  70. package/dist/cjs/v3/extractVizImport.test.js +32 -0
  71. package/dist/cjs/v3/htmlTemplate.js +93 -0
  72. package/dist/cjs/v3/index.js +5 -0
  73. package/dist/cjs/v3/parseId.js +9 -0
  74. package/dist/cjs/v3/parseId.test.js +27 -0
  75. package/dist/cjs/v3/setupV3Runtime.js +345 -0
  76. package/dist/cjs/v3/slugCache.js +39 -0
  77. package/dist/cjs/v3/slugCache.test.js +107 -0
  78. package/dist/cjs/v3/transformDSV/dsvParseSrc.js +124 -0
  79. package/dist/cjs/v3/transformDSV/index.js +44 -0
  80. package/dist/cjs/v3/transformSvelte.js +81 -0
  81. package/dist/cjs/v3/types.js +2 -0
  82. package/dist/cjs/v3/v3Build.js +34 -0
  83. package/dist/cjs/v3/vizCache.js +40 -0
  84. package/dist/cjs/v3/vizCache.test.js +100 -0
  85. package/dist/cjs/v3/vizLoad.js +50 -0
  86. package/dist/cjs/v3/vizResolve.js +73 -0
  87. package/dist/cjs/v4/index.js +138 -0
  88. package/dist/esm/buildHTML.js +67 -0
  89. package/dist/esm/common/packageJson.js +71 -0
  90. package/dist/esm/common/packageJson.test.js +146 -0
  91. package/dist/esm/common/sucrasePlugin.js +24 -0
  92. package/dist/esm/common/virtualFileSystem.js +75 -0
  93. package/dist/esm/determineRuntimeVersion.js +22 -0
  94. package/dist/esm/determineRuntimeVersion.test.js +101 -0
  95. package/dist/esm/index.js +3 -0
  96. package/dist/esm/test/fixtures/v1/basicHTML.js +15 -0
  97. package/dist/esm/test/fixtures/v1/fetchProxy.js +12 -0
  98. package/dist/esm/test/fixtures/v1/index.js +6 -0
  99. package/dist/esm/test/fixtures/v1/jsScriptTag.js +9 -0
  100. package/dist/esm/test/fixtures/v1/protocolTest.js +15 -0
  101. package/dist/esm/test/fixtures/v1/styleTest.js +15 -0
  102. package/dist/esm/test/fixtures/v1/xmlTest.js +19 -0
  103. package/dist/esm/test/fixtures/v2/basicBundle.js +5 -0
  104. package/dist/esm/test/fixtures/v2/basicBundleNoExtension.js +5 -0
  105. package/dist/esm/test/fixtures/v2/d3Import.js +7 -0
  106. package/dist/esm/test/fixtures/v2/d3ImportPkg.js +19 -0
  107. package/dist/esm/test/fixtures/v2/d3RosettaImportPkg.js +19 -0
  108. package/dist/esm/test/fixtures/v2/es6Preserve.js +6 -0
  109. package/dist/esm/test/fixtures/v2/generatorSupport.js +6 -0
  110. package/dist/esm/test/fixtures/v2/index.js +15 -0
  111. package/dist/esm/test/fixtures/v2/jsxTranspile.js +6 -0
  112. package/dist/esm/test/fixtures/v2/reactDomImport.js +8 -0
  113. package/dist/esm/test/fixtures/v2/reactDomImportPkg.js +24 -0
  114. package/dist/esm/test/fixtures/v2/reactImport.js +7 -0
  115. package/dist/esm/test/fixtures/v2/reactImportPkg.js +17 -0
  116. package/dist/esm/test/fixtures/v2/sourceMapErrorFixture.js +19 -0
  117. package/dist/esm/test/fixtures/v2/unicodeSupport.js +6 -0
  118. package/dist/esm/test/fixtures/v3/basicIndexJS.js +7 -0
  119. package/dist/esm/test/fixtures/v3/cssImport.js +9 -0
  120. package/dist/esm/test/fixtures/v3/csvImport.js +11 -0
  121. package/dist/esm/test/fixtures/v3/csvStrangeChars.js +12 -0
  122. package/dist/esm/test/fixtures/v3/index.js +9 -0
  123. package/dist/esm/test/fixtures/v3/jsExport.js +10 -0
  124. package/dist/esm/test/fixtures/v3/sourcemap.js +10 -0
  125. package/dist/esm/test/fixtures/v3/svelte.js +18 -0
  126. package/dist/esm/test/fixtures/v3/vizContent.js +11 -0
  127. package/dist/esm/test/fixtures/v3/vizImport.js +85 -0
  128. package/dist/esm/test/fixtures/v4/d3Usage.js +31 -0
  129. package/dist/esm/test/fixtures/v4/esmBuild.js +18 -0
  130. package/dist/esm/test/fixtures/v4/fetchInterception.js +18 -0
  131. package/dist/esm/test/fixtures/v4/index.js +9 -0
  132. package/dist/esm/test/fixtures/v4/jsScriptTagTypeModule.js +18 -0
  133. package/dist/esm/test/fixtures/v4/jsScriptTagTypeModules.js +12 -0
  134. package/dist/esm/test/fixtures/v4/reactHooks.js +47 -0
  135. package/dist/esm/test/fixtures/v4/reactJsx.js +34 -0
  136. package/dist/esm/test/fixtures/v4/threeJsUsage.js +24 -0
  137. package/dist/esm/test/fixtures/v4/typeScriptSupport.js +29 -0
  138. package/dist/esm/test/testInBrowser.js +47 -0
  139. package/dist/esm/test/testStackTrace.js +55 -0
  140. package/dist/esm/test/v1.test.js +65 -0
  141. package/dist/esm/test/v2.test.js +121 -0
  142. package/dist/esm/test/v3.test.js +114 -0
  143. package/dist/esm/test/v4.test.js +100 -0
  144. package/dist/esm/types.js +1 -0
  145. package/dist/esm/utils/vizContentToFileCollection.js +19 -0
  146. package/dist/esm/utils/vizContentToFileCollection.test.js +75 -0
  147. package/dist/esm/v2/computeBundleJSV2.js +29 -0
  148. package/dist/esm/v2/getComputedIndexHtml.js +81 -0
  149. package/dist/esm/v2/getComputedIndexHtml.test.js +134 -0
  150. package/dist/esm/v2/index.js +1 -0
  151. package/dist/esm/v2/v2Build.js +11 -0
  152. package/dist/esm/v3/cleanRollupErrorMessage.js +9 -0
  153. package/dist/esm/v3/computeBundleJSV3.js +48 -0
  154. package/dist/esm/v3/createVizContent.js +23 -0
  155. package/dist/esm/v3/extractVizImport.js +23 -0
  156. package/dist/esm/v3/extractVizImport.test.js +30 -0
  157. package/dist/esm/v3/htmlTemplate.js +89 -0
  158. package/dist/esm/v3/index.js +1 -0
  159. package/dist/esm/v3/parseId.js +5 -0
  160. package/dist/esm/v3/parseId.test.js +25 -0
  161. package/dist/esm/v3/setupV3Runtime.js +341 -0
  162. package/dist/esm/v3/slugCache.js +35 -0
  163. package/dist/esm/v3/slugCache.test.js +105 -0
  164. package/dist/esm/v3/transformDSV/dsvParseSrc.js +121 -0
  165. package/dist/esm/v3/transformDSV/index.js +40 -0
  166. package/dist/esm/v3/transformSvelte.js +77 -0
  167. package/dist/esm/v3/types.js +1 -0
  168. package/dist/esm/v3/v3Build.js +30 -0
  169. package/dist/esm/v3/vizCache.js +36 -0
  170. package/dist/esm/v3/vizCache.test.js +98 -0
  171. package/dist/esm/v3/vizLoad.js +46 -0
  172. package/dist/esm/v3/vizResolve.js +69 -0
  173. package/dist/esm/v4/index.js +134 -0
  174. package/dist/types/buildHTML.d.ts +14 -0
  175. package/dist/types/common/packageJson.d.ts +39 -0
  176. package/dist/types/common/packageJson.test.d.ts +1 -0
  177. package/dist/types/common/sucrasePlugin.d.ts +2 -0
  178. package/dist/types/common/virtualFileSystem.d.ts +3 -0
  179. package/dist/types/determineRuntimeVersion.d.ts +3 -0
  180. package/dist/types/determineRuntimeVersion.test.d.ts +1 -0
  181. package/dist/types/index.d.ts +3 -0
  182. package/dist/types/test/fixtures/v1/basicHTML.d.ts +3 -0
  183. package/dist/types/test/fixtures/v1/fetchProxy.d.ts +5 -0
  184. package/dist/types/test/fixtures/v1/index.d.ts +6 -0
  185. package/dist/types/test/fixtures/v1/jsScriptTag.d.ts +4 -0
  186. package/dist/types/test/fixtures/v1/protocolTest.d.ts +3 -0
  187. package/dist/types/test/fixtures/v1/styleTest.d.ts +4 -0
  188. package/dist/types/test/fixtures/v1/xmlTest.d.ts +4 -0
  189. package/dist/types/test/fixtures/v2/basicBundle.d.ts +5 -0
  190. package/dist/types/test/fixtures/v2/basicBundleNoExtension.d.ts +5 -0
  191. package/dist/types/test/fixtures/v2/d3Import.d.ts +4 -0
  192. package/dist/types/test/fixtures/v2/d3ImportPkg.d.ts +5 -0
  193. package/dist/types/test/fixtures/v2/d3RosettaImportPkg.d.ts +5 -0
  194. package/dist/types/test/fixtures/v2/es6Preserve.d.ts +4 -0
  195. package/dist/types/test/fixtures/v2/generatorSupport.d.ts +4 -0
  196. package/dist/types/test/fixtures/v2/index.d.ts +14 -0
  197. package/dist/types/test/fixtures/v2/jsxTranspile.d.ts +4 -0
  198. package/dist/types/test/fixtures/v2/reactDomImport.d.ts +4 -0
  199. package/dist/types/test/fixtures/v2/reactDomImportPkg.d.ts +5 -0
  200. package/dist/types/test/fixtures/v2/reactImport.d.ts +4 -0
  201. package/dist/types/test/fixtures/v2/reactImportPkg.d.ts +5 -0
  202. package/dist/types/test/fixtures/v2/sourceMapErrorFixture.d.ts +5 -0
  203. package/dist/types/test/fixtures/v2/unicodeSupport.d.ts +4 -0
  204. package/dist/types/test/fixtures/v3/basicIndexJS.d.ts +3 -0
  205. package/dist/types/test/fixtures/v3/cssImport.d.ts +4 -0
  206. package/dist/types/test/fixtures/v3/csvImport.d.ts +4 -0
  207. package/dist/types/test/fixtures/v3/csvStrangeChars.d.ts +4 -0
  208. package/dist/types/test/fixtures/v3/index.d.ts +9 -0
  209. package/dist/types/test/fixtures/v3/jsExport.d.ts +4 -0
  210. package/dist/types/test/fixtures/v3/sourcemap.d.ts +3 -0
  211. package/dist/types/test/fixtures/v3/svelte.d.ts +4 -0
  212. package/dist/types/test/fixtures/v3/vizContent.d.ts +2 -0
  213. package/dist/types/test/fixtures/v3/vizImport.d.ts +6 -0
  214. package/dist/types/test/fixtures/v4/d3Usage.d.ts +5 -0
  215. package/dist/types/test/fixtures/v4/esmBuild.d.ts +5 -0
  216. package/dist/types/test/fixtures/v4/fetchInterception.d.ts +5 -0
  217. package/dist/types/test/fixtures/v4/index.d.ts +9 -0
  218. package/dist/types/test/fixtures/v4/jsScriptTagTypeModule.d.ts +4 -0
  219. package/dist/types/test/fixtures/v4/jsScriptTagTypeModules.d.ts +5 -0
  220. package/dist/types/test/fixtures/v4/reactHooks.d.ts +6 -0
  221. package/dist/types/test/fixtures/v4/reactJsx.d.ts +6 -0
  222. package/dist/types/test/fixtures/v4/threeJsUsage.d.ts +4 -0
  223. package/dist/types/test/fixtures/v4/typeScriptSupport.d.ts +5 -0
  224. package/dist/types/test/testInBrowser.d.ts +15 -0
  225. package/dist/types/test/testStackTrace.d.ts +9 -0
  226. package/dist/types/test/v1.test.d.ts +1 -0
  227. package/dist/types/test/v2.test.d.ts +1 -0
  228. package/dist/types/test/v3.test.d.ts +1 -0
  229. package/dist/types/test/v4.test.d.ts +1 -0
  230. package/dist/types/types.d.ts +1 -0
  231. package/dist/types/utils/vizContentToFileCollection.d.ts +7 -0
  232. package/dist/types/utils/vizContentToFileCollection.test.d.ts +1 -0
  233. package/dist/types/v2/computeBundleJSV2.d.ts +7 -0
  234. package/dist/types/v2/getComputedIndexHtml.d.ts +4 -0
  235. package/dist/types/v2/getComputedIndexHtml.test.d.ts +1 -0
  236. package/dist/types/v2/index.d.ts +1 -0
  237. package/dist/types/v2/v2Build.d.ts +7 -0
  238. package/dist/types/v3/cleanRollupErrorMessage.d.ts +4 -0
  239. package/dist/types/v3/computeBundleJSV3.d.ts +17 -0
  240. package/dist/types/v3/createVizContent.d.ts +8 -0
  241. package/dist/types/v3/extractVizImport.d.ts +6 -0
  242. package/dist/types/v3/extractVizImport.test.d.ts +1 -0
  243. package/dist/types/v3/htmlTemplate.d.ts +5 -0
  244. package/dist/types/v3/index.d.ts +1 -0
  245. package/dist/types/v3/parseId.d.ts +6 -0
  246. package/dist/types/v3/parseId.test.d.ts +1 -0
  247. package/dist/types/v3/setupV3Runtime.d.ts +15 -0
  248. package/dist/types/v3/slugCache.d.ts +11 -0
  249. package/dist/types/v3/slugCache.test.d.ts +1 -0
  250. package/dist/types/v3/transformDSV/dsvParseSrc.d.ts +1 -0
  251. package/dist/types/v3/transformDSV/index.d.ts +2 -0
  252. package/dist/types/v3/transformSvelte.d.ts +8 -0
  253. package/dist/types/v3/types.d.ts +65 -0
  254. package/dist/types/v3/v3Build.d.ts +14 -0
  255. package/dist/types/v3/vizCache.d.ts +10 -0
  256. package/dist/types/v3/vizCache.test.d.ts +1 -0
  257. package/dist/types/v3/vizLoad.d.ts +7 -0
  258. package/dist/types/v3/vizResolve.d.ts +7 -0
  259. package/dist/types/v4/index.d.ts +10 -0
  260. package/package.json +14 -7
@@ -0,0 +1,4 @@
1
+ export declare const generatorSupport: {
2
+ "index.html": string;
3
+ "index.js": string;
4
+ };
@@ -0,0 +1,14 @@
1
+ export { basicBundle } from "./basicBundle";
2
+ export { basicBundleNoExtension } from "./basicBundleNoExtension";
3
+ export { d3Import } from "./d3Import";
4
+ export { d3ImportPkg } from "./d3ImportPkg";
5
+ export { reactImport } from "./reactImport";
6
+ export { reactImportPkg } from "./reactImportPkg";
7
+ export { reactDomImport } from "./reactDomImport";
8
+ export { reactDomImportPkg } from "./reactDomImportPkg";
9
+ export { jsxTranspile } from "./jsxTranspile";
10
+ export { es6Preserve } from "./es6Preserve";
11
+ export { generatorSupport } from "./generatorSupport";
12
+ export { unicodeSupport } from "./unicodeSupport";
13
+ export { d3RosettaImportPkg } from "./d3RosettaImportPkg";
14
+ export * from "./sourceMapErrorFixture";
@@ -0,0 +1,4 @@
1
+ export declare const jsxTranspile: {
2
+ "index.html": string;
3
+ "index.js": string;
4
+ };
@@ -0,0 +1,4 @@
1
+ export declare const reactDomImport: {
2
+ "index.html": string;
3
+ "index.js": string;
4
+ };
@@ -0,0 +1,5 @@
1
+ export declare const reactDomImportPkg: {
2
+ "index.html": string;
3
+ "index.js": string;
4
+ "package.json": string;
5
+ };
@@ -0,0 +1,4 @@
1
+ export declare const reactImport: {
2
+ "index.html": string;
3
+ "index.js": string;
4
+ };
@@ -0,0 +1,5 @@
1
+ export declare const reactImportPkg: {
2
+ "index.html": string;
3
+ "index.js": string;
4
+ "package.json": string;
5
+ };
@@ -0,0 +1,5 @@
1
+ export declare const sourceMapErrorFixture: {
2
+ "index.html": string;
3
+ "index.js": string;
4
+ "error.js": string;
5
+ };
@@ -0,0 +1,4 @@
1
+ export declare const unicodeSupport: {
2
+ "index.html": string;
3
+ "index.js": string;
4
+ };
@@ -0,0 +1,3 @@
1
+ export declare const basicIndexJS: {
2
+ "index.js": string;
3
+ };
@@ -0,0 +1,4 @@
1
+ export declare const cssImport: {
2
+ "index.js": string;
3
+ "styles.css": string;
4
+ };
@@ -0,0 +1,4 @@
1
+ export declare const csvImport: {
2
+ "index.js": string;
3
+ "data.csv": string;
4
+ };
@@ -0,0 +1,4 @@
1
+ export declare const csvStrangeChars: {
2
+ "index.js": string;
3
+ "data.csv": string;
4
+ };
@@ -0,0 +1,9 @@
1
+ export { basicIndexJS } from "./basicIndexJS";
2
+ export { sampleVizContent } from "./vizContent";
3
+ export { jsExport } from "./jsExport";
4
+ export { cssImport } from "./cssImport";
5
+ export { csvImport } from "./csvImport";
6
+ export { csvStrangeChars } from "./csvStrangeChars";
7
+ export { sampleContent, sampleContentVizImport, sampleContentVizImportSlug, sampleContentWithCSS, sampleContentVizImportWithCSS, } from "./vizImport";
8
+ export { svelte } from "./svelte";
9
+ export { sourcemap } from "./sourcemap";
@@ -0,0 +1,4 @@
1
+ export declare const jsExport: {
2
+ "index.js": string;
3
+ "message.js": string;
4
+ };
@@ -0,0 +1,3 @@
1
+ export declare const sourcemap: {
2
+ "index.js": string;
3
+ };
@@ -0,0 +1,4 @@
1
+ export declare const svelte: {
2
+ "App.svelte": string;
3
+ "index.js": string;
4
+ };
@@ -0,0 +1,2 @@
1
+ import { VizContent } from "@vizhub/viz-types";
2
+ export declare const sampleVizContent: VizContent;
@@ -0,0 +1,6 @@
1
+ import { VizContent } from "@vizhub/viz-types";
2
+ export declare const sampleContent: VizContent;
3
+ export declare const sampleContentVizImport: VizContent;
4
+ export declare const sampleContentVizImportSlug: VizContent;
5
+ export declare const sampleContentWithCSS: VizContent;
6
+ export declare const sampleContentVizImportWithCSS: VizContent;
@@ -0,0 +1,5 @@
1
+ export declare const d3Usage: {
2
+ "index.html": string;
3
+ "index.js": string;
4
+ "package.json": string;
5
+ };
@@ -0,0 +1,5 @@
1
+ export declare const esmBuild: {
2
+ "index.html": string;
3
+ "index.js": string;
4
+ "package.json": string;
5
+ };
@@ -0,0 +1,5 @@
1
+ export declare const fetchInterception: {
2
+ "index.html": string;
3
+ "index.js": string;
4
+ "data.json": string;
5
+ };
@@ -0,0 +1,9 @@
1
+ export { jsScriptTagTypeModule } from "./jsScriptTagTypeModule";
2
+ export { jsScriptTagTypeModules } from "./jsScriptTagTypeModules";
3
+ export { fetchInterception } from "./fetchInterception";
4
+ export { esmBuild } from "./esmBuild";
5
+ export { reactJsx } from "./reactJsx";
6
+ export { d3Usage } from "./d3Usage";
7
+ export { threeJsUsage } from "./threeJsUsage";
8
+ export { reactHooks } from "./reactHooks";
9
+ export { typeScriptSupport } from "./typeScriptSupport";
@@ -0,0 +1,4 @@
1
+ export declare const jsScriptTagTypeModule: {
2
+ "index.html": string;
3
+ "index.js": string;
4
+ };
@@ -0,0 +1,5 @@
1
+ export declare const jsScriptTagTypeModules: {
2
+ "index.html": string;
3
+ "index.js": string;
4
+ "greeter.js": string;
5
+ };
@@ -0,0 +1,6 @@
1
+ export declare const reactHooks: {
2
+ "index.html": string;
3
+ "index.jsx": string;
4
+ "Counter.jsx": string;
5
+ "package.json": string;
6
+ };
@@ -0,0 +1,6 @@
1
+ export declare const reactJsx: {
2
+ "index.html": string;
3
+ "index.jsx": string;
4
+ "App.jsx": string;
5
+ "package.json": string;
6
+ };
@@ -0,0 +1,4 @@
1
+ export declare const threeJsUsage: {
2
+ "index.html": string;
3
+ "index.js": string;
4
+ };
@@ -0,0 +1,5 @@
1
+ export declare const typeScriptSupport: {
2
+ "index.html": string;
3
+ "index.ts": string;
4
+ "person.ts": string;
5
+ };
@@ -0,0 +1,15 @@
1
+ import { Browser, Page } from "puppeteer";
2
+ import { VizCache } from "../v3/vizCache";
3
+ import { FileCollection, VizId } from "@vizhub/viz-types";
4
+ import { SlugCache } from "../v3/slugCache";
5
+ import { SvelteCompiler } from "../v3/transformSvelte";
6
+ export declare function testInBrowser({ browser, files, vizCache, slugCache, vizId, expectedLog, evaluateInBrowser, getSvelteCompiler, }: {
7
+ browser: Browser;
8
+ files?: FileCollection;
9
+ vizCache?: VizCache;
10
+ slugCache?: SlugCache;
11
+ vizId?: VizId;
12
+ expectedLog: string | RegExp;
13
+ evaluateInBrowser?: (page: Page) => Promise<any>;
14
+ getSvelteCompiler?: () => Promise<SvelteCompiler>;
15
+ }): Promise<void>;
@@ -0,0 +1,9 @@
1
+ import { Browser } from "puppeteer";
2
+ import { FileCollection } from "@vizhub/viz-types";
3
+ interface TestStackTraceOptions {
4
+ browser: Browser;
5
+ files: FileCollection;
6
+ expectedLineNumber: number;
7
+ }
8
+ export declare function testStackTrace({ browser, files, expectedLineNumber, }: TestStackTraceOptions): Promise<void>;
9
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export type runtimeVersion = "v1" | "v2" | "v3" | "v4";
@@ -0,0 +1,7 @@
1
+ import type { FileCollection, VizContent } from "@vizhub/viz-types";
2
+ /**
3
+ * Converts VizContent format to FileCollection format
4
+ * VizContent has files as {id: {name, text}} structure
5
+ * FileCollection is a simple {name: text} structure
6
+ */
7
+ export declare const vizContentToFileCollection: (vizContent: VizContent) => FileCollection;
@@ -0,0 +1,7 @@
1
+ import type { RollupBuild, RollupOptions } from "rollup";
2
+ import { FileCollection } from "@vizhub/viz-types";
3
+ export declare const computeBundleJSV2: ({ files, rollup, enableSourcemap, }: {
4
+ files: FileCollection;
5
+ rollup: (options: RollupOptions) => Promise<RollupBuild>;
6
+ enableSourcemap?: boolean;
7
+ }) => Promise<string>;
@@ -0,0 +1,4 @@
1
+ import { FileCollection } from "@vizhub/viz-types";
2
+ import type { JSDOM } from "jsdom";
3
+ export declare const setJSDOM: (JSDOMInstance: typeof JSDOM) => void;
4
+ export declare const getComputedIndexHtml: (files: FileCollection) => string;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export { v2Build } from "./v2Build.js";
@@ -0,0 +1,7 @@
1
+ import type { RollupBuild, RollupOptions } from "rollup";
2
+ import { FileCollection } from "@vizhub/viz-types";
3
+ export declare const v2Build: ({ files, rollup, enableSourcemap, }: {
4
+ files: FileCollection;
5
+ rollup: (options: RollupOptions) => Promise<RollupBuild>;
6
+ enableSourcemap?: boolean;
7
+ }) => Promise<FileCollection>;
@@ -0,0 +1,4 @@
1
+ export declare const cleanRollupErrorMessage: ({ rawMessage, vizId, }: {
2
+ rawMessage: string;
3
+ vizId: string;
4
+ }) => string;
@@ -0,0 +1,17 @@
1
+ import type { RollupBuild, RollupOptions } from "rollup";
2
+ import { VizCache } from "./vizCache";
3
+ import { FileCollection, VizId } from "@vizhub/viz-types";
4
+ import { SlugCache } from "./slugCache";
5
+ import { SvelteCompiler } from "./transformSvelte";
6
+ export declare const computeBundleJSV3: ({ files, rollup, enableSourcemap, vizCache, vizId, slugCache, getSvelteCompiler, }: {
7
+ files: FileCollection;
8
+ rollup: (options: RollupOptions) => Promise<RollupBuild>;
9
+ enableSourcemap?: boolean;
10
+ vizCache: VizCache;
11
+ vizId: VizId;
12
+ slugCache?: SlugCache;
13
+ getSvelteCompiler?: () => Promise<SvelteCompiler>;
14
+ }) => Promise<{
15
+ src: string;
16
+ cssFiles: string[];
17
+ }>;
@@ -0,0 +1,8 @@
1
+ import { FileCollection, VizContent } from "@vizhub/viz-types";
2
+ /**
3
+ * Creates a VizContent object with the given files
4
+ * @param files An object with file names as keys and file content as values
5
+ * @param title Optional title for the content
6
+ * @returns A VizContent object with randomly generated IDs
7
+ */
8
+ export declare const createVizContent: (files: FileCollection, title?: string) => VizContent;
@@ -0,0 +1,6 @@
1
+ import { VizId } from "@vizhub/viz-types";
2
+ export type VizImport = {
3
+ userName: string;
4
+ idOrSlug: VizId | string;
5
+ };
6
+ export declare const extractVizImport: (str: string) => VizImport | null;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ export declare const htmlTemplate: ({ cdn, src, styles, }: {
2
+ cdn: string;
3
+ src: string;
4
+ styles: string;
5
+ }) => string;
@@ -0,0 +1 @@
1
+ export { v3Build } from "./v3Build.js";
@@ -0,0 +1,6 @@
1
+ import { VizId } from "@vizhub/viz-types";
2
+ import type { ResolvedVizFileId } from "./types";
3
+ export declare const parseId: (id: ResolvedVizFileId) => {
4
+ vizId: VizId;
5
+ fileName: string;
6
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,15 @@
1
+ import { VizContent, VizId } from "@vizhub/viz-types";
2
+ export type V3Runtime = {
3
+ handleCodeChange: (content: VizContent) => void;
4
+ invalidateVizCache: (changedVizIds: Array<VizId>) => void;
5
+ resetSrcdoc: (changedVizIds: Array<VizId>) => void;
6
+ };
7
+ export declare const setupV3Runtime: ({ vizId, iframe, setSrcdocErrorMessage, getLatestContent, resolveSlugKey, writeFile, worker, }: {
8
+ vizId: VizId;
9
+ iframe: HTMLIFrameElement;
10
+ setSrcdocErrorMessage: (error: string | null) => void;
11
+ getLatestContent: (vizId: VizId) => Promise<VizContent>;
12
+ resolveSlugKey: (slugKey: string) => Promise<VizId>;
13
+ writeFile: (fileName: string, content: string) => void;
14
+ worker: Worker;
15
+ }) => V3Runtime;
@@ -0,0 +1,11 @@
1
+ import { VizId } from "@vizhub/viz-types";
2
+ export type SlugIdentifier = `${string}/${string}`;
3
+ export type SlugCache = {
4
+ get: (slug: SlugIdentifier) => Promise<VizId>;
5
+ set: (slug: SlugIdentifier, vizId: VizId) => void;
6
+ invalidate: (slug: SlugIdentifier) => void;
7
+ };
8
+ export declare const createSlugCache: ({ initialMappings, handleCacheMiss, }: {
9
+ initialMappings?: Record<SlugIdentifier, VizId>;
10
+ handleCacheMiss?: (slug: SlugIdentifier) => Promise<VizId>;
11
+ }) => SlugCache;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export declare const dsvParseSrc = "var EOL = {},\n EOF = {},\n QUOTE = 34,\n NEWLINE = 10,\n RETURN = 13;\n\nfunction objectConverter(columns) {\n return new Function(\n 'd',\n 'return {' +\n columns\n .map(function (name, i) {\n return (\n JSON.stringify(name) + ': d[' + i + '] || \"\"'\n );\n })\n .join(',') +\n '}',\n );\n}\n\nfunction customConverter(columns, f) {\n var object = objectConverter(columns);\n return function (row, i) {\n return f(object(row), i, columns);\n };\n}\n\nfunction dsv(delimiter) {\n var DELIMITER = delimiter.charCodeAt(0);\n\n function parse(text, f) {\n var convert,\n columns,\n rows = parseRows(text, function (row, i) {\n if (convert) return convert(row, i - 1);\n (columns = row),\n (convert = f\n ? customConverter(row, f)\n : objectConverter(row));\n });\n rows.columns = columns || [];\n return rows;\n }\n\n function parseRows(text, f) {\n var rows = [], // output rows\n N = text.length,\n I = 0, // current character index\n n = 0, // current line number\n t, // current token\n eof = N <= 0, // current token followed by EOF?\n eol = false; // current token followed by EOL?\n\n // Strip the trailing newline.\n if (text.charCodeAt(N - 1) === NEWLINE) --N;\n if (text.charCodeAt(N - 1) === RETURN) --N;\n\n function token() {\n if (eof) return EOF;\n if (eol) return (eol = false), EOL;\n\n // Unescape quotes.\n var i,\n j = I,\n c;\n if (text.charCodeAt(j) === QUOTE) {\n while (\n (I++ < N && text.charCodeAt(I) !== QUOTE) ||\n text.charCodeAt(++I) === QUOTE\n );\n if ((i = I) >= N) eof = true;\n else if ((c = text.charCodeAt(I++)) === NEWLINE)\n eol = true;\n else if (c === RETURN) {\n eol = true;\n if (text.charCodeAt(I) === NEWLINE) ++I;\n }\n return text.slice(j + 1, i - 1).replace(/\"\"/g, '\"');\n }\n\n // Find next delimiter or newline.\n while (I < N) {\n if ((c = text.charCodeAt((i = I++))) === NEWLINE)\n eol = true;\n else if (c === RETURN) {\n eol = true;\n if (text.charCodeAt(I) === NEWLINE) ++I;\n } else if (c !== DELIMITER) continue;\n return text.slice(j, i);\n }\n\n // Return last token before EOF.\n return (eof = true), text.slice(j, N);\n }\n\n while ((t = token()) !== EOF) {\n var row = [];\n while (t !== EOL && t !== EOF)\n row.push(t), (t = token());\n if (f && (row = f(row, n++)) == null) continue;\n rows.push(row);\n }\n\n return rows;\n }\n\n return {\n parse: parse,\n };\n}\n\nvar csv = dsv(',');\n\nvar csvParse = csv.parse;\n\nvar tsv = dsv('\t');\n\nvar tsvParse = tsv.parse;\n\nexport { csvParse, tsvParse };";
@@ -0,0 +1,2 @@
1
+ import { InputPluginOption } from "rollup";
2
+ export declare const transformDSV: () => InputPluginOption;
@@ -0,0 +1,8 @@
1
+ import { InputPluginOption } from "rollup";
2
+ export type SvelteCompiler = (code: string, options: any) => {
3
+ js: string;
4
+ };
5
+ export declare const svelteCompilerUrl = "https://cdn.jsdelivr.net/npm/svelte@4.2.9/compiler.cjs";
6
+ export declare const transformSvelte: ({ getSvelteCompiler, }: {
7
+ getSvelteCompiler?: () => Promise<any>;
8
+ }) => InputPluginOption;
@@ -0,0 +1,65 @@
1
+ import { VizContent, VizId } from "@vizhub/viz-types";
2
+ import type { PackageJson } from "../common/packageJson";
3
+ export type V3BuildResult = {
4
+ src: string | undefined;
5
+ pkg: PackageJson | undefined;
6
+ warnings: Array<V3BuildError>;
7
+ time: number;
8
+ cssFiles: Array<ResolvedVizFileId>;
9
+ };
10
+ export type V3BuildError = {
11
+ code: string;
12
+ message: string;
13
+ };
14
+ export type ResolvedVizFileId = string;
15
+ export type V3WorkerMessage = {
16
+ type: "contentRequest";
17
+ vizId: VizId;
18
+ } | {
19
+ type: "contentResponse";
20
+ vizId: VizId;
21
+ content: VizContent;
22
+ } | {
23
+ type: "buildRequest";
24
+ vizId: VizId;
25
+ enableSourcemap: boolean;
26
+ } | {
27
+ type: "buildResponse";
28
+ buildResult?: V3BuildResult;
29
+ error?: Error;
30
+ } | {
31
+ type: "invalidateVizCacheRequest";
32
+ changedVizIds: Array<VizId>;
33
+ } | {
34
+ type: "invalidateVizCacheResponse";
35
+ } | {
36
+ type: "resolveSlugRequest";
37
+ slugKey: string;
38
+ requestId: string;
39
+ } | {
40
+ type: "resolveSlugResponse";
41
+ slugKey: string;
42
+ vizId: VizId;
43
+ requestId: string;
44
+ } | {
45
+ type: "resetSrcdocRequest";
46
+ vizId: VizId;
47
+ changedVizIds: Array<VizId>;
48
+ } | {
49
+ type: "resetSrcdocResponse";
50
+ srcdoc?: string;
51
+ error?: Error;
52
+ };
53
+ export type V3WindowMessage = {
54
+ type: "runJS";
55
+ src: string;
56
+ } | {
57
+ type: "runCSS";
58
+ src: string;
59
+ id: ResolvedVizFileId;
60
+ } | {
61
+ type: "runDone";
62
+ } | {
63
+ type: "runError";
64
+ error: Error;
65
+ };
@@ -0,0 +1,14 @@
1
+ import { RollupBuild, RollupOptions } from "rollup";
2
+ import { VizCache } from "./vizCache";
3
+ import { FileCollection, VizId } from "@vizhub/viz-types";
4
+ import { SlugCache } from "./slugCache";
5
+ import { SvelteCompiler } from "./transformSvelte";
6
+ export declare const v3Build: ({ files, rollup, enableSourcemap, vizCache, vizId, slugCache, getSvelteCompiler, }: {
7
+ files: FileCollection;
8
+ rollup: (options: RollupOptions) => Promise<RollupBuild>;
9
+ enableSourcemap?: boolean;
10
+ vizCache: VizCache;
11
+ vizId: VizId;
12
+ slugCache?: SlugCache;
13
+ getSvelteCompiler?: () => Promise<SvelteCompiler>;
14
+ }) => Promise<string>;
@@ -0,0 +1,10 @@
1
+ import { VizContent, VizId } from "@vizhub/viz-types";
2
+ export type VizCache = {
3
+ get: (vizId: string) => Promise<VizContent>;
4
+ set: (content: VizContent) => void;
5
+ invalidate: (vizId: string) => void;
6
+ };
7
+ export declare const createVizCache: ({ initialContents, handleCacheMiss, }: {
8
+ initialContents: Array<VizContent>;
9
+ handleCacheMiss?: (vizId: VizId) => Promise<VizContent>;
10
+ }) => VizCache;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import { InputPluginOption } from "rollup";
2
+ import { ResolvedVizFileId } from "./types";
3
+ import { VizCache } from "./vizCache";
4
+ export declare const vizLoad: ({ vizCache, trackCSSImport, }: {
5
+ vizCache: VizCache;
6
+ trackCSSImport: (cssFile: ResolvedVizFileId) => void;
7
+ }) => InputPluginOption;
@@ -0,0 +1,7 @@
1
+ import { InputPluginOption } from "rollup";
2
+ import { VizId } from "@vizhub/viz-types";
3
+ import { SlugCache } from "./slugCache";
4
+ export declare const vizResolve: ({ vizId, slugCache, }: {
5
+ vizId: VizId;
6
+ slugCache?: SlugCache;
7
+ }) => InputPluginOption;
@@ -0,0 +1,10 @@
1
+ import type { RollupBuild, RollupOptions } from "rollup";
2
+ import { FileCollection } from "@vizhub/viz-types";
3
+ /**
4
+ * Build for v4 runtime
5
+ */
6
+ export declare const v4Build: ({ files, rollup, enableSourcemap, }: {
7
+ files: FileCollection;
8
+ rollup: (options: RollupOptions) => Promise<RollupBuild>;
9
+ enableSourcemap?: boolean;
10
+ }) => Promise<FileCollection>;
package/package.json CHANGED
@@ -1,21 +1,28 @@
1
1
  {
2
2
  "name": "@vizhub/runtime",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Flexible runtime environment for data visualization sandboxes",
5
5
  "type": "module",
6
- "main": "./dist/index.js",
7
- "types": "./dist/index.d.ts",
6
+ "main": "./dist/cjs/index.js",
7
+ "module": "./dist/esm/index.js",
8
+ "types": "./dist/types/index.d.ts",
8
9
  "exports": {
9
10
  ".": {
10
- "types": "./dist/index.d.ts",
11
- "import": "./dist/index.js"
11
+ "import": "./dist/esm/index.js",
12
+ "require": "./dist/cjs/index.js",
13
+ "default": "./dist/esm/index.js",
14
+ "types": "./dist/types/index.d.ts"
12
15
  }
13
16
  },
14
17
  "files": [
15
- "dist"
18
+ "dist",
19
+ "README.md"
16
20
  ],
17
21
  "scripts": {
18
- "build": "tsc",
22
+ "build": "npm run build:esm && npm run build:cjs && npm run build:types",
23
+ "build:esm": "tsc -p tsconfig.esm.json",
24
+ "build:cjs": "tsc -p tsconfig.cjs.json && echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
25
+ "build:types": "tsc --emitDeclarationOnly --declarationDir ./dist/types",
19
26
  "prepublishOnly": "npm run build",
20
27
  "test": "vitest run",
21
28
  "test:watch": "vitest",