@vizhub/runtime 0.1.4 → 0.2.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 (287) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +240 -194
  3. package/dist/common/packageJson.d.ts +39 -0
  4. package/dist/common/packageJson.js +71 -0
  5. package/dist/common/packageJson.test.d.ts +1 -0
  6. package/dist/common/packageJson.test.js +146 -0
  7. package/dist/common/sucrasePlugin.d.ts +2 -0
  8. package/dist/common/sucrasePlugin.js +24 -0
  9. package/dist/common/virtualFileSystem.d.ts +3 -0
  10. package/dist/common/virtualFileSystem.js +75 -0
  11. package/dist/determineRuntimeVersion.d.ts +2 -0
  12. package/dist/determineRuntimeVersion.js +22 -0
  13. package/dist/determineRuntimeVersion.test.d.ts +1 -0
  14. package/dist/determineRuntimeVersion.test.js +101 -0
  15. package/dist/fixtures/basicHTML.d.ts +2 -0
  16. package/dist/fixtures/basicHTML.js +22 -0
  17. package/dist/fixtures/fetchProxy.d.ts +2 -0
  18. package/dist/fixtures/fetchProxy.js +25 -0
  19. package/dist/fixtures/index.d.ts +3 -0
  20. package/dist/fixtures/index.js +9 -0
  21. package/dist/fixtures/jsScriptTag.d.ts +2 -0
  22. package/dist/fixtures/jsScriptTag.js +19 -0
  23. package/dist/index.d.ts +14 -8
  24. package/dist/index.js +59 -24882
  25. package/dist/index.test.d.ts +1 -0
  26. package/dist/index.test.js +50 -0
  27. package/dist/magicSandbox/fixProtocollessUrls.d.ts +4 -0
  28. package/dist/magicSandbox/fixProtocollessUrls.js +10 -0
  29. package/dist/magicSandbox/generateInterceptorScript.d.ts +4 -0
  30. package/dist/magicSandbox/generateInterceptorScript.js +178 -0
  31. package/dist/magicSandbox/index.d.ts +19 -0
  32. package/dist/magicSandbox/index.js +48 -0
  33. package/dist/test/fixtures/basicHTML.d.ts +2 -0
  34. package/dist/test/fixtures/basicHTML.js +19 -0
  35. package/dist/test/fixtures/fetchProxy.d.ts +2 -0
  36. package/dist/test/fixtures/fetchProxy.js +22 -0
  37. package/dist/test/fixtures/index.d.ts +6 -0
  38. package/dist/test/fixtures/index.js +6 -0
  39. package/dist/test/fixtures/jsScriptTag.d.ts +2 -0
  40. package/dist/test/fixtures/jsScriptTag.js +16 -0
  41. package/dist/test/fixtures/magicSandbox/basicHTML.d.ts +5 -0
  42. package/dist/test/fixtures/magicSandbox/basicHTML.js +17 -0
  43. package/dist/test/fixtures/magicSandbox/fetchProxy.d.ts +11 -0
  44. package/dist/test/fixtures/magicSandbox/fetchProxy.js +18 -0
  45. package/dist/test/fixtures/magicSandbox/index.d.ts +6 -0
  46. package/dist/test/fixtures/magicSandbox/index.js +6 -0
  47. package/dist/test/fixtures/magicSandbox/jsScriptTag.d.ts +8 -0
  48. package/dist/test/fixtures/magicSandbox/jsScriptTag.js +13 -0
  49. package/dist/test/fixtures/magicSandbox/protocolTest.d.ts +5 -0
  50. package/dist/test/fixtures/magicSandbox/protocolTest.js +17 -0
  51. package/dist/test/fixtures/magicSandbox/styleTest.d.ts +8 -0
  52. package/dist/test/fixtures/magicSandbox/styleTest.js +19 -0
  53. package/dist/test/fixtures/magicSandbox/xmlTest.d.ts +8 -0
  54. package/dist/test/fixtures/magicSandbox/xmlTest.js +23 -0
  55. package/dist/test/fixtures/protocolTest.d.ts +2 -0
  56. package/dist/test/fixtures/protocolTest.js +19 -0
  57. package/dist/test/fixtures/styleTest.d.ts +2 -0
  58. package/dist/test/fixtures/styleTest.js +22 -0
  59. package/dist/test/fixtures/v1/basicHTML.d.ts +3 -0
  60. package/dist/test/fixtures/v1/basicHTML.js +15 -0
  61. package/dist/test/fixtures/v1/fetchProxy.d.ts +5 -0
  62. package/dist/test/fixtures/v1/fetchProxy.js +12 -0
  63. package/dist/test/fixtures/v1/index.d.ts +6 -0
  64. package/dist/test/fixtures/v1/index.js +6 -0
  65. package/dist/test/fixtures/v1/jsScriptTag.d.ts +4 -0
  66. package/dist/test/fixtures/v1/jsScriptTag.js +9 -0
  67. package/dist/test/fixtures/v1/protocolTest.d.ts +3 -0
  68. package/dist/test/fixtures/v1/protocolTest.js +15 -0
  69. package/dist/test/fixtures/v1/styleTest.d.ts +4 -0
  70. package/dist/test/fixtures/v1/styleTest.js +15 -0
  71. package/dist/test/fixtures/v1/xmlTest.d.ts +4 -0
  72. package/dist/test/fixtures/v1/xmlTest.js +19 -0
  73. package/dist/test/fixtures/v2/basicBundle.d.ts +5 -0
  74. package/dist/test/fixtures/v2/basicBundle.js +5 -0
  75. package/dist/test/fixtures/v2/basicBundleNoExtension.d.ts +5 -0
  76. package/dist/test/fixtures/v2/basicBundleNoExtension.js +5 -0
  77. package/dist/test/fixtures/v2/d3Import.d.ts +4 -0
  78. package/dist/test/fixtures/v2/d3Import.js +7 -0
  79. package/dist/test/fixtures/v2/d3ImportPkg.d.ts +5 -0
  80. package/dist/test/fixtures/v2/d3ImportPkg.js +19 -0
  81. package/dist/test/fixtures/v2/d3RosettaImportPkg.d.ts +5 -0
  82. package/dist/test/fixtures/v2/d3RosettaImportPkg.js +19 -0
  83. package/dist/test/fixtures/v2/es6Preserve.d.ts +4 -0
  84. package/dist/test/fixtures/v2/es6Preserve.js +6 -0
  85. package/dist/test/fixtures/v2/generatorSupport.d.ts +4 -0
  86. package/dist/test/fixtures/v2/generatorSupport.js +6 -0
  87. package/dist/test/fixtures/v2/index.d.ts +14 -0
  88. package/dist/test/fixtures/v2/index.js +15 -0
  89. package/dist/test/fixtures/v2/jsxTranspile.d.ts +4 -0
  90. package/dist/test/fixtures/v2/jsxTranspile.js +6 -0
  91. package/dist/test/fixtures/v2/reactDomImport.d.ts +4 -0
  92. package/dist/test/fixtures/v2/reactDomImport.js +8 -0
  93. package/dist/test/fixtures/v2/reactDomImportPkg.d.ts +5 -0
  94. package/dist/test/fixtures/v2/reactDomImportPkg.js +24 -0
  95. package/dist/test/fixtures/v2/reactImport.d.ts +4 -0
  96. package/dist/test/fixtures/v2/reactImport.js +7 -0
  97. package/dist/test/fixtures/v2/reactImportPkg.d.ts +5 -0
  98. package/dist/test/fixtures/v2/reactImportPkg.js +17 -0
  99. package/dist/test/fixtures/v2/sourceMapErrorFixture.d.ts +5 -0
  100. package/dist/test/fixtures/v2/sourceMapErrorFixture.js +19 -0
  101. package/dist/test/fixtures/v2/unicodeSupport.d.ts +4 -0
  102. package/dist/test/fixtures/v2/unicodeSupport.js +6 -0
  103. package/dist/test/fixtures/v3/basicIndexJS.d.ts +3 -0
  104. package/dist/test/fixtures/v3/basicIndexJS.js +7 -0
  105. package/dist/test/fixtures/v3/cssImport.d.ts +4 -0
  106. package/dist/test/fixtures/v3/cssImport.js +9 -0
  107. package/dist/test/fixtures/v3/csvImport.d.ts +4 -0
  108. package/dist/test/fixtures/v3/csvImport.js +11 -0
  109. package/dist/test/fixtures/v3/csvStrangeChars.d.ts +4 -0
  110. package/dist/test/fixtures/v3/csvStrangeChars.js +12 -0
  111. package/dist/test/fixtures/v3/index.d.ts +9 -0
  112. package/dist/test/fixtures/v3/index.js +9 -0
  113. package/dist/test/fixtures/v3/jsExport.d.ts +4 -0
  114. package/dist/test/fixtures/v3/jsExport.js +10 -0
  115. package/dist/test/fixtures/v3/sourcemap.d.ts +3 -0
  116. package/dist/test/fixtures/v3/sourcemap.js +10 -0
  117. package/dist/test/fixtures/v3/svelte.d.ts +4 -0
  118. package/dist/test/fixtures/v3/svelte.js +18 -0
  119. package/dist/test/fixtures/v3/vizContent.d.ts +2 -0
  120. package/dist/test/fixtures/v3/vizContent.js +11 -0
  121. package/dist/test/fixtures/v3/vizImport.d.ts +6 -0
  122. package/dist/test/fixtures/v3/vizImport.js +85 -0
  123. package/dist/test/fixtures/v4/d3Usage.d.ts +5 -0
  124. package/dist/test/fixtures/v4/d3Usage.js +31 -0
  125. package/dist/test/fixtures/v4/esmBuild.d.ts +5 -0
  126. package/dist/test/fixtures/v4/esmBuild.js +18 -0
  127. package/dist/test/fixtures/v4/fetchInterception.d.ts +5 -0
  128. package/dist/test/fixtures/v4/fetchInterception.js +18 -0
  129. package/dist/test/fixtures/v4/index.d.ts +9 -0
  130. package/dist/test/fixtures/v4/index.js +9 -0
  131. package/dist/test/fixtures/v4/jsScriptTagTypeModule.d.ts +4 -0
  132. package/dist/test/fixtures/v4/jsScriptTagTypeModule.js +18 -0
  133. package/dist/test/fixtures/v4/jsScriptTagTypeModules.d.ts +5 -0
  134. package/dist/test/fixtures/v4/jsScriptTagTypeModules.js +12 -0
  135. package/dist/test/fixtures/v4/reactHooks.d.ts +6 -0
  136. package/dist/test/fixtures/v4/reactHooks.js +47 -0
  137. package/dist/test/fixtures/v4/reactJsx.d.ts +6 -0
  138. package/dist/test/fixtures/v4/reactJsx.js +34 -0
  139. package/dist/test/fixtures/v4/threeJsUsage.d.ts +4 -0
  140. package/dist/test/fixtures/v4/threeJsUsage.js +24 -0
  141. package/dist/test/fixtures/v4/typeScriptSupport.d.ts +5 -0
  142. package/dist/test/fixtures/v4/typeScriptSupport.js +29 -0
  143. package/dist/test/fixtures/xmlTest.d.ts +2 -0
  144. package/dist/test/fixtures/xmlTest.js +26 -0
  145. package/dist/test/index.test.d.ts +1 -0
  146. package/dist/test/index.test.js +40 -0
  147. package/dist/test/testInBrowser.d.ts +16 -0
  148. package/dist/test/testInBrowser.js +47 -0
  149. package/dist/test/testStackTrace.d.ts +9 -0
  150. package/dist/test/testStackTrace.js +55 -0
  151. package/dist/test/v1.test.d.ts +1 -0
  152. package/dist/test/v1.test.js +65 -0
  153. package/dist/test/v2.test.d.ts +1 -0
  154. package/dist/test/v2.test.js +121 -0
  155. package/dist/test/v3.test.d.ts +1 -0
  156. package/dist/test/v3.test.js +114 -0
  157. package/dist/test/v4.test.d.ts +1 -0
  158. package/dist/test/v4.test.js +100 -0
  159. package/dist/types.d.ts +2 -0
  160. package/dist/types.js +1 -0
  161. package/dist/utils/getFileText.d.ts +2 -0
  162. package/dist/utils/getFileText.js +13 -0
  163. package/dist/utils/getFileText.test.d.ts +1 -0
  164. package/dist/utils/getFileText.test.js +72 -0
  165. package/dist/utils/vizContentToFileCollection.d.ts +8 -0
  166. package/dist/utils/vizContentToFileCollection.js +19 -0
  167. package/dist/utils/vizContentToFileCollection.test.d.ts +1 -0
  168. package/dist/utils/vizContentToFileCollection.test.js +75 -0
  169. package/dist/v2/computeBundleJSV2.d.ts +7 -0
  170. package/dist/v2/computeBundleJSV2.js +29 -0
  171. package/dist/v2/getComputedIndexHtml.d.ts +4 -0
  172. package/dist/v2/getComputedIndexHtml.js +81 -0
  173. package/dist/v2/getComputedIndexHtml.test.d.ts +1 -0
  174. package/dist/v2/getComputedIndexHtml.test.js +134 -0
  175. package/dist/v2/index.d.ts +1 -0
  176. package/dist/v2/index.js +1 -0
  177. package/dist/v2/v2Build.d.ts +7 -0
  178. package/dist/v2/v2Build.js +11 -0
  179. package/dist/v3/computeBundleJSV3.d.ts +18 -0
  180. package/dist/v3/computeBundleJSV3.js +48 -0
  181. package/dist/v3/createVizContent.d.ts +9 -0
  182. package/dist/v3/createVizContent.js +23 -0
  183. package/dist/{v3Runtime → v3}/extractVizImport.d.ts +2 -3
  184. package/dist/v3/extractVizImport.js +23 -0
  185. package/dist/v3/extractVizImport.test.d.ts +1 -0
  186. package/dist/v3/extractVizImport.test.js +30 -0
  187. package/dist/v3/htmlTemplate.d.ts +5 -0
  188. package/dist/v3/htmlTemplate.js +89 -0
  189. package/dist/v3/index.d.ts +1 -0
  190. package/dist/v3/index.js +1 -0
  191. package/dist/v3/parseId.d.ts +6 -0
  192. package/dist/v3/parseId.js +5 -0
  193. package/dist/v3/parseId.test.d.ts +1 -0
  194. package/dist/v3/parseId.test.js +25 -0
  195. package/dist/v3/slugCache.d.ts +11 -0
  196. package/dist/v3/slugCache.js +35 -0
  197. package/dist/v3/slugCache.test.d.ts +1 -0
  198. package/dist/v3/slugCache.test.js +105 -0
  199. package/dist/v3/transformDSV/dsvParseSrc.d.ts +1 -0
  200. package/dist/v3/transformDSV/dsvParseSrc.js +121 -0
  201. package/dist/v3/transformDSV/index.d.ts +2 -0
  202. package/dist/v3/transformDSV/index.js +40 -0
  203. package/dist/{v3Runtime → v3}/transformSvelte.d.ts +4 -2
  204. package/dist/v3/transformSvelte.js +77 -0
  205. package/dist/{v3Runtime → v3}/types.d.ts +18 -18
  206. package/dist/v3/types.js +1 -0
  207. package/dist/v3/v3Build.d.ts +15 -0
  208. package/dist/v3/v3Build.js +30 -0
  209. package/dist/v3/vizCache.d.ts +10 -0
  210. package/dist/v3/vizCache.js +36 -0
  211. package/dist/v3/vizCache.test.d.ts +1 -0
  212. package/dist/v3/vizCache.test.js +98 -0
  213. package/dist/{v3Runtime → v3}/vizLoad.d.ts +3 -4
  214. package/dist/v3/vizLoad.js +46 -0
  215. package/dist/v3/vizResolve.d.ts +7 -0
  216. package/dist/v3/vizResolve.js +69 -0
  217. package/dist/v4/index.d.ts +10 -0
  218. package/dist/v4/index.js +134 -0
  219. package/package.json +35 -38
  220. package/dist/assets/setupV3Runtime-BVr5lyKp.js +0 -240
  221. package/dist/computeSrcDoc.d.ts +0 -13
  222. package/dist/computeSrcDoc.d.ts.map +0 -1
  223. package/dist/computeSrcDoc.test.d.ts +0 -2
  224. package/dist/computeSrcDoc.test.d.ts.map +0 -1
  225. package/dist/index.d.ts.map +0 -1
  226. package/dist/useRuntime.d.ts +0 -13
  227. package/dist/useRuntime.d.ts.map +0 -1
  228. package/dist/v2Runtime/bundle/bubleJSXOnly.d.ts +0 -5
  229. package/dist/v2Runtime/bundle/bubleJSXOnly.d.ts.map +0 -1
  230. package/dist/v2Runtime/bundle/packageJson.d.ts +0 -10
  231. package/dist/v2Runtime/bundle/packageJson.d.ts.map +0 -1
  232. package/dist/v2Runtime/computeSrcDocV2.d.ts +0 -3
  233. package/dist/v2Runtime/computeSrcDocV2.d.ts.map +0 -1
  234. package/dist/v2Runtime/computeSrcDocV2.test.d.ts +0 -2
  235. package/dist/v2Runtime/computeSrcDocV2.test.d.ts.map +0 -1
  236. package/dist/v2Runtime/getComputedIndexHtml.d.ts +0 -4
  237. package/dist/v2Runtime/getComputedIndexHtml.d.ts.map +0 -1
  238. package/dist/v2Runtime/getComputedIndexHtml.test.d.ts +0 -2
  239. package/dist/v2Runtime/getComputedIndexHtml.test.d.ts.map +0 -1
  240. package/dist/v2Runtime/getText.d.ts +0 -3
  241. package/dist/v2Runtime/getText.d.ts.map +0 -1
  242. package/dist/v2Runtime/transformFiles.d.ts +0 -3
  243. package/dist/v2Runtime/transformFiles.d.ts.map +0 -1
  244. package/dist/v2Runtime/v3FilesToV2Files.d.ts +0 -3
  245. package/dist/v2Runtime/v3FilesToV2Files.d.ts.map +0 -1
  246. package/dist/v2Runtime/v3FilesToV2Files.test.d.ts +0 -2
  247. package/dist/v2Runtime/v3FilesToV2Files.test.d.ts.map +0 -1
  248. package/dist/v3Runtime/build.d.ts +0 -14
  249. package/dist/v3Runtime/build.d.ts.map +0 -1
  250. package/dist/v3Runtime/build.test.d.ts +0 -2
  251. package/dist/v3Runtime/build.test.d.ts.map +0 -1
  252. package/dist/v3Runtime/cleanRollupErrorMessage.d.ts +0 -5
  253. package/dist/v3Runtime/cleanRollupErrorMessage.d.ts.map +0 -1
  254. package/dist/v3Runtime/computeSrcDocV3.d.ts +0 -7
  255. package/dist/v3Runtime/computeSrcDocV3.d.ts.map +0 -1
  256. package/dist/v3Runtime/extractVizImport.d.ts.map +0 -1
  257. package/dist/v3Runtime/extractVizImport.test.d.ts +0 -2
  258. package/dist/v3Runtime/extractVizImport.test.d.ts.map +0 -1
  259. package/dist/v3Runtime/generateRollupErrorMessage.d.ts +0 -5
  260. package/dist/v3Runtime/generateRollupErrorMessage.d.ts.map +0 -1
  261. package/dist/v3Runtime/importFromViz.d.ts +0 -1
  262. package/dist/v3Runtime/importFromViz.d.ts.map +0 -1
  263. package/dist/v3Runtime/index.d.ts +0 -2
  264. package/dist/v3Runtime/index.d.ts.map +0 -1
  265. package/dist/v3Runtime/parseId.d.ts +0 -7
  266. package/dist/v3Runtime/parseId.d.ts.map +0 -1
  267. package/dist/v3Runtime/setupV3Runtime.d.ts +0 -15
  268. package/dist/v3Runtime/setupV3Runtime.d.ts.map +0 -1
  269. package/dist/v3Runtime/transformDSV/index.d.ts +0 -3
  270. package/dist/v3Runtime/transformDSV/index.d.ts.map +0 -1
  271. package/dist/v3Runtime/transformSvelte.d.ts.map +0 -1
  272. package/dist/v3Runtime/types.d.ts.map +0 -1
  273. package/dist/v3Runtime/urlLoad.d.ts +0 -1
  274. package/dist/v3Runtime/urlLoad.d.ts.map +0 -1
  275. package/dist/v3Runtime/virtual.d.ts +0 -1
  276. package/dist/v3Runtime/virtual.d.ts.map +0 -1
  277. package/dist/v3Runtime/vizCache.d.ts +0 -11
  278. package/dist/v3Runtime/vizCache.d.ts.map +0 -1
  279. package/dist/v3Runtime/vizCache.test.d.ts +0 -2
  280. package/dist/v3Runtime/vizCache.test.d.ts.map +0 -1
  281. package/dist/v3Runtime/vizLoad.d.ts.map +0 -1
  282. package/dist/v3Runtime/vizLoadSvelte.d.ts +0 -1
  283. package/dist/v3Runtime/vizLoadSvelte.d.ts.map +0 -1
  284. package/dist/v3Runtime/vizResolve.d.ts +0 -10
  285. package/dist/v3Runtime/vizResolve.d.ts.map +0 -1
  286. package/dist/v3Runtime/worker.d.ts +0 -2
  287. package/dist/v3Runtime/worker.d.ts.map +0 -1
@@ -0,0 +1,15 @@
1
+ export const basicHTML = {
2
+ "index.html": `<!DOCTYPE html>
3
+ <html>
4
+ <head>
5
+ <title>My HTML Document</title>
6
+ </head>
7
+ <body>
8
+ <h1>Hello, World!</h1>
9
+ <p>This is my first HTML document.</p>
10
+ <script>
11
+ console.log('Hello, World!');
12
+ </script>
13
+ </body>
14
+ </html>`,
15
+ };
@@ -0,0 +1,5 @@
1
+ export declare const fetchProxy: {
2
+ "index.html": string;
3
+ "index.js": string;
4
+ "data.csv": string;
5
+ };
@@ -0,0 +1,12 @@
1
+ export const fetchProxy = {
2
+ "index.html": `<!DOCTYPE html>
3
+ <html>
4
+ <body>
5
+ <script src="index.js"></script>
6
+ </body>
7
+ </html>`,
8
+ "index.js": `fetch("data.csv")
9
+ .then((response) => response.text())
10
+ .then(console.log);`,
11
+ "data.csv": `Hello, Fetch!`,
12
+ };
@@ -0,0 +1,6 @@
1
+ export { basicHTML } from "./basicHTML";
2
+ export { jsScriptTag } from "./jsScriptTag";
3
+ export { fetchProxy } from "./fetchProxy";
4
+ export { styleTest } from "./styleTest";
5
+ export { xmlTest } from "./xmlTest";
6
+ export { protocolTest } from "./protocolTest";
@@ -0,0 +1,6 @@
1
+ export { basicHTML } from "./basicHTML";
2
+ export { jsScriptTag } from "./jsScriptTag";
3
+ export { fetchProxy } from "./fetchProxy";
4
+ export { styleTest } from "./styleTest";
5
+ export { xmlTest } from "./xmlTest";
6
+ export { protocolTest } from "./protocolTest";
@@ -0,0 +1,4 @@
1
+ export declare const jsScriptTag: {
2
+ "index.html": string;
3
+ "index.js": string;
4
+ };
@@ -0,0 +1,9 @@
1
+ export const jsScriptTag = {
2
+ "index.html": `<!DOCTYPE html>
3
+ <html>
4
+ <body>
5
+ <script src="index.js"></script>
6
+ </body>
7
+ </html>`,
8
+ "index.js": `console.log('Hello, JS!');`,
9
+ };
@@ -0,0 +1,3 @@
1
+ export declare const protocolTest: {
2
+ "index.html": string;
3
+ };
@@ -0,0 +1,15 @@
1
+ export const protocolTest = {
2
+ "index.html": `<!DOCTYPE html>
3
+ <html>
4
+ <head>
5
+ <link href="//fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
6
+ <script src="//code.jquery.com/jquery-3.6.0.min.js"></script>
7
+ </head>
8
+ <body>
9
+ <div>Protocol Test</div>
10
+ <script>
11
+ console.log('Protocol test loaded');
12
+ </script>
13
+ </body>
14
+ </html>`,
15
+ };
@@ -0,0 +1,4 @@
1
+ export declare const styleTest: {
2
+ "index.html": string;
3
+ "styles.css": string;
4
+ };
@@ -0,0 +1,15 @@
1
+ export const styleTest = {
2
+ "index.html": `<!DOCTYPE html>
3
+ <html>
4
+ <head>
5
+ <link rel="stylesheet" href="styles.css">
6
+ </head>
7
+ <body>
8
+ <div id="test">Test</div>
9
+ <script>
10
+ console.log(window.getComputedStyle(document.getElementById('test')).color);
11
+ </script>
12
+ </body>
13
+ </html>`,
14
+ "styles.css": `#test { color: rgb(255, 0, 0); }`,
15
+ };
@@ -0,0 +1,4 @@
1
+ export declare const xmlTest: {
2
+ "index.html": string;
3
+ "data.xml": string;
4
+ };
@@ -0,0 +1,19 @@
1
+ export const xmlTest = {
2
+ "index.html": `<!DOCTYPE html>
3
+ <html>
4
+ <body>
5
+ <script>
6
+ const xhr = new XMLHttpRequest();
7
+ xhr.open('GET', 'data.xml');
8
+ xhr.onload = () => {
9
+ console.log(xhr.responseXML.documentElement.nodeName);
10
+ };
11
+ xhr.send();
12
+ </script>
13
+ </body>
14
+ </html>`,
15
+ "data.xml": `<?xml version="1.0" encoding="UTF-8"?>
16
+ <root>
17
+ <item>Test</item>
18
+ </root>`,
19
+ };
@@ -0,0 +1,5 @@
1
+ export declare const basicBundle: {
2
+ "index.html": string;
3
+ "index.js": string;
4
+ "foo.js": string;
5
+ };
@@ -0,0 +1,5 @@
1
+ export const basicBundle = {
2
+ "index.html": "<script src='bundle.js'></script>",
3
+ "index.js": 'import { foo } from "./foo.js"; console.log(foo);',
4
+ "foo.js": 'export const foo = "bar";',
5
+ };
@@ -0,0 +1,5 @@
1
+ export declare const basicBundleNoExtension: {
2
+ "index.html": string;
3
+ "index.js": string;
4
+ "foo.js": string;
5
+ };
@@ -0,0 +1,5 @@
1
+ export const basicBundleNoExtension = {
2
+ "index.html": "<script src='bundle.js'></script>",
3
+ "index.js": 'import { foo } from "./foo"; console.log(foo);',
4
+ "foo.js": 'export const foo = "bar";',
5
+ };
@@ -0,0 +1,4 @@
1
+ export declare const d3Import: {
2
+ "index.html": string;
3
+ "index.js": string;
4
+ };
@@ -0,0 +1,7 @@
1
+ export const d3Import = {
2
+ "index.html": `
3
+ <script src='https://cdn.jsdelivr.net/npm/d3@6.7.0/dist/d3.min.js'></script>
4
+ <script src='bundle.js'></script>
5
+ `,
6
+ "index.js": 'import { select } from "d3"; console.log(typeof select);',
7
+ };
@@ -0,0 +1,5 @@
1
+ export declare const d3ImportPkg: {
2
+ "index.html": string;
3
+ "index.js": string;
4
+ "package.json": string;
5
+ };
@@ -0,0 +1,19 @@
1
+ export const d3ImportPkg = {
2
+ "index.html": `
3
+ <script src='bundle.js'></script>
4
+ `,
5
+ "index.js": 'import { select } from "d3"; console.log(typeof select);',
6
+ "package.json": `{
7
+ "dependencies": {
8
+ "d3": "6.7.0"
9
+ },
10
+ "vizhub": {
11
+ "libraries": {
12
+ "d3": {
13
+ "global": "d3",
14
+ "path": "/dist/d3.min.js"
15
+ }
16
+ }
17
+ }
18
+ }`,
19
+ };
@@ -0,0 +1,5 @@
1
+ export declare const d3RosettaImportPkg: {
2
+ "index.html": string;
3
+ "index.js": string;
4
+ "package.json": string;
5
+ };
@@ -0,0 +1,19 @@
1
+ export const d3RosettaImportPkg = {
2
+ "index.html": `
3
+ <script src='bundle.js'></script>
4
+ `,
5
+ "index.js": 'import { one } from "d3-rosetta"; console.log(typeof one);',
6
+ "package.json": `{
7
+ "dependencies": {
8
+ "d3-rosetta": "1.0.0"
9
+ },
10
+ "vizhub": {
11
+ "libraries": {
12
+ "d3-rosetta": {
13
+ "global": "d3Rosetta",
14
+ "path": "/dist/d3-rosetta.umd.js"
15
+ }
16
+ }
17
+ }
18
+ }`,
19
+ };
@@ -0,0 +1,4 @@
1
+ export declare const es6Preserve: {
2
+ "index.html": string;
3
+ "index.js": string;
4
+ };
@@ -0,0 +1,6 @@
1
+ export const es6Preserve = {
2
+ "index.html": `
3
+ <script src='bundle.js'></script>
4
+ `,
5
+ "index.js": "const fn = a => a * a; console.log(fn(4));",
6
+ };
@@ -0,0 +1,4 @@
1
+ export declare const generatorSupport: {
2
+ "index.html": string;
3
+ "index.js": string;
4
+ };
@@ -0,0 +1,6 @@
1
+ export const generatorSupport = {
2
+ "index.html": `
3
+ <script src='bundle.js'></script>
4
+ `,
5
+ "index.js": "console.log(function* () { yield 5; }().next().value)",
6
+ };
@@ -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,15 @@
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
+ // Make sure to add the sourceMapErrorFixture to the exports
15
+ export * from "./sourceMapErrorFixture";
@@ -0,0 +1,4 @@
1
+ export declare const jsxTranspile: {
2
+ "index.html": string;
3
+ "index.js": string;
4
+ };
@@ -0,0 +1,6 @@
1
+ export const jsxTranspile = {
2
+ "index.html": `
3
+ <script src='bundle.js'></script>
4
+ `,
5
+ "index.js": "<div>Hello JSX!</div>",
6
+ };
@@ -0,0 +1,4 @@
1
+ export declare const reactDomImport: {
2
+ "index.html": string;
3
+ "index.js": string;
4
+ };
@@ -0,0 +1,8 @@
1
+ export const reactDomImport = {
2
+ "index.html": `
3
+ <script src='https://cdn.jsdelivr.net/npm/react@18.3.1/umd/react.production.min.js'></script>
4
+ <script src='https://cdn.jsdelivr.net/npm/react-dom@18.3.1/umd/react-dom.production.min.js'></script>
5
+ <script src='bundle.js'></script>
6
+ `,
7
+ "index.js": 'import ReactDOM from "react-dom"; console.log(typeof ReactDOM);',
8
+ };
@@ -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,24 @@
1
+ export const reactDomImportPkg = {
2
+ "index.html": `
3
+ <script src='bundle.js'></script>
4
+ `,
5
+ "index.js": 'import ReactDOM from "react-dom"; console.log(typeof ReactDOM);',
6
+ "package.json": `{
7
+ "dependencies": {
8
+ "react": "18.2.0",
9
+ "react-dom": "18.2.0"
10
+ },
11
+ "vizhub": {
12
+ "libraries": {
13
+ "react": {
14
+ "global": "React",
15
+ "path": "/umd/react.production.min.js"
16
+ },
17
+ "react-dom": {
18
+ "global": "ReactDOM",
19
+ "path": "/umd/react-dom.production.min.js"
20
+ }
21
+ }
22
+ }
23
+ }`,
24
+ };
@@ -0,0 +1,4 @@
1
+ export declare const reactImport: {
2
+ "index.html": string;
3
+ "index.js": string;
4
+ };
@@ -0,0 +1,7 @@
1
+ export const reactImport = {
2
+ "index.html": `
3
+ <script src='https://cdn.jsdelivr.net/npm/react@18.3.1/umd/react.production.min.js'></script>
4
+ <script src='bundle.js'></script>
5
+ `,
6
+ "index.js": 'import React from "react"; console.log(typeof React);',
7
+ };
@@ -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,17 @@
1
+ export const reactImportPkg = {
2
+ "index.html": `<script src='bundle.js'></script>`,
3
+ "index.js": 'import React from "react"; console.log(typeof React);',
4
+ "package.json": `{
5
+ "dependencies": {
6
+ "react": "18.2.0"
7
+ },
8
+ "vizhub": {
9
+ "libraries": {
10
+ "react": {
11
+ "global": "React",
12
+ "path": "/umd/react.production.min.js"
13
+ }
14
+ }
15
+ }
16
+ }`,
17
+ };
@@ -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,19 @@
1
+ export const sourceMapErrorFixture = {
2
+ "index.html": "<script src='bundle.js'></script>",
3
+ "index.js": `
4
+ import { generateError } from "./error.js";
5
+
6
+ // Line numbers are important for this test
7
+ // This will be line 6 in the original source
8
+ generateError();
9
+
10
+ // Add a console log to help debug
11
+ console.log("If you see this, the error was caught by the window.onerror handler");
12
+ `,
13
+ "error.js": `
14
+ export function generateError() {
15
+ // This is line 3 in error.js
16
+ throw new Error("Test error for sourcemap validation");
17
+ }
18
+ `,
19
+ };
@@ -0,0 +1,4 @@
1
+ export declare const unicodeSupport: {
2
+ "index.html": string;
3
+ "index.js": string;
4
+ };
@@ -0,0 +1,6 @@
1
+ export const unicodeSupport = {
2
+ "index.html": `
3
+ <script src='bundle.js'></script>
4
+ `,
5
+ "index.js": 'console.log("Привет")',
6
+ };
@@ -0,0 +1,3 @@
1
+ export declare const basicIndexJS: {
2
+ "index.js": string;
3
+ };
@@ -0,0 +1,7 @@
1
+ export const basicIndexJS = {
2
+ "index.js": `
3
+ export const main = () => {
4
+ console.log("Hello main!");
5
+ }
6
+ `,
7
+ };
@@ -0,0 +1,4 @@
1
+ export declare const cssImport: {
2
+ "index.js": string;
3
+ "styles.css": string;
4
+ };
@@ -0,0 +1,9 @@
1
+ export const cssImport = {
2
+ "index.js": `
3
+ import './styles.css';
4
+ console.log(getComputedStyle(document.body).color);
5
+ `,
6
+ "styles.css": `
7
+ body { color: red; }
8
+ `,
9
+ };
@@ -0,0 +1,4 @@
1
+ export declare const csvImport: {
2
+ "index.js": string;
3
+ "data.csv": string;
4
+ };
@@ -0,0 +1,11 @@
1
+ export const csvImport = {
2
+ "index.js": `
3
+ import data from './data.csv';
4
+ console.log(data[0].variety);
5
+ `,
6
+ "data.csv": `"sepal.length","sepal.width","petal.length","petal.width","variety"
7
+ 5.1,3.5,1.4,.2,"Setosa"
8
+ 4.9,3,1.4,.2,"Setosa"
9
+ 4.7,3.2,1.3,.2,"Setosa"
10
+ 4.6,3.1,1.5,.2,"Setosa"`,
11
+ };
@@ -0,0 +1,4 @@
1
+ export declare const csvStrangeChars: {
2
+ "index.js": string;
3
+ "data.csv": string;
4
+ };
@@ -0,0 +1,12 @@
1
+ export const csvStrangeChars = {
2
+ "index.js": `
3
+ import data from './data.csv';
4
+ console.log(data[0].Country);
5
+ `,
6
+ "data.csv": `Country,Users,New users,Engaged sessions,Engagement rate,Engaged sessions per user,Average engagement time,Event count,Conversions,Total revenue
7
+ Türkiye,180,177,133,0.5450819672131147,0.7388888888888889,86.22777777777777,1007,0,0
8
+ (not set),28,27,2,0.06896551724137931,0.07142857142857142,7.178571428571429,101,0,0
9
+ Myanmar (Burma),11,11,29,0.58,2.6363636363636362,141.0909090909091,209,0,0
10
+ Côte d'Ivoire,10,10,8,0.6666666666666666,0.8,33.4,57,0,0
11
+ Réunion,1,1,0,0,0,0,5,0,0`,
12
+ };
@@ -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,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,10 @@
1
+ export const jsExport = {
2
+ "index.js": `
3
+ import { innerMessage } from './message';
4
+ export const message = "Outer " + innerMessage;
5
+ console.log(message);
6
+ `,
7
+ "message.js": `
8
+ export const innerMessage = "Inner";
9
+ `,
10
+ };
@@ -0,0 +1,3 @@
1
+ export declare const sourcemap: {
2
+ "index.js": string;
3
+ };
@@ -0,0 +1,10 @@
1
+ export const sourcemap = {
2
+ "index.js": `
3
+ const x = 1;
4
+ const y = 2;
5
+ console.log(x + y);
6
+
7
+ // The error should resolve to this line number, 6.
8
+ throw new Error("Hello main!");
9
+ `,
10
+ };
@@ -0,0 +1,4 @@
1
+ export declare const svelte: {
2
+ "App.svelte": string;
3
+ "index.js": string;
4
+ };
@@ -0,0 +1,18 @@
1
+ export const svelte = {
2
+ "App.svelte": `
3
+ <script>
4
+ const name = 'Svelte';
5
+ console.log(name);
6
+ </script>
7
+ <h1>Hello {name}!</h1>
8
+ `,
9
+ "index.js": `
10
+ import App from './App.svelte';
11
+
12
+ export const main = (container) => {
13
+ new App({
14
+ target: container,
15
+ });
16
+ };
17
+ `,
18
+ };
@@ -0,0 +1,2 @@
1
+ import { VizContent } from "@vizhub/viz-types";
2
+ export declare const sampleVizContent: VizContent;
@@ -0,0 +1,11 @@
1
+ import { createVizContent } from "../../../v3/createVizContent";
2
+ // Content for testing JS imports
3
+ export const sampleVizContent = createVizContent({
4
+ "index.js": `
5
+ import { innerMessage } from './message';
6
+ export const message = "Outer " + innerMessage;
7
+ `,
8
+ "message.js": `
9
+ export const innerMessage = "Inner";
10
+ `,
11
+ });
@@ -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;