@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.
- package/dist/cjs/buildHTML.js +71 -0
- package/dist/cjs/common/packageJson.js +81 -0
- package/dist/cjs/common/packageJson.test.js +148 -0
- package/dist/cjs/common/sucrasePlugin.js +27 -0
- package/dist/cjs/common/virtualFileSystem.js +79 -0
- package/dist/cjs/determineRuntimeVersion.js +26 -0
- package/dist/cjs/determineRuntimeVersion.test.js +103 -0
- package/dist/cjs/index.js +9 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/test/fixtures/v1/basicHTML.js +18 -0
- package/dist/cjs/test/fixtures/v1/fetchProxy.js +15 -0
- package/dist/cjs/test/fixtures/v1/index.js +15 -0
- package/dist/cjs/test/fixtures/v1/jsScriptTag.js +12 -0
- package/dist/cjs/test/fixtures/v1/protocolTest.js +18 -0
- package/dist/cjs/test/fixtures/v1/styleTest.js +18 -0
- package/dist/cjs/test/fixtures/v1/xmlTest.js +22 -0
- package/dist/cjs/test/fixtures/v2/basicBundle.js +8 -0
- package/dist/cjs/test/fixtures/v2/basicBundleNoExtension.js +8 -0
- package/dist/cjs/test/fixtures/v2/d3Import.js +10 -0
- package/dist/cjs/test/fixtures/v2/d3ImportPkg.js +22 -0
- package/dist/cjs/test/fixtures/v2/d3RosettaImportPkg.js +22 -0
- package/dist/cjs/test/fixtures/v2/es6Preserve.js +9 -0
- package/dist/cjs/test/fixtures/v2/generatorSupport.js +9 -0
- package/dist/cjs/test/fixtures/v2/index.js +45 -0
- package/dist/cjs/test/fixtures/v2/jsxTranspile.js +9 -0
- package/dist/cjs/test/fixtures/v2/reactDomImport.js +11 -0
- package/dist/cjs/test/fixtures/v2/reactDomImportPkg.js +27 -0
- package/dist/cjs/test/fixtures/v2/reactImport.js +10 -0
- package/dist/cjs/test/fixtures/v2/reactImportPkg.js +20 -0
- package/dist/cjs/test/fixtures/v2/sourceMapErrorFixture.js +22 -0
- package/dist/cjs/test/fixtures/v2/unicodeSupport.js +9 -0
- package/dist/cjs/test/fixtures/v3/basicIndexJS.js +10 -0
- package/dist/cjs/test/fixtures/v3/cssImport.js +12 -0
- package/dist/cjs/test/fixtures/v3/csvImport.js +14 -0
- package/dist/cjs/test/fixtures/v3/csvStrangeChars.js +15 -0
- package/dist/cjs/test/fixtures/v3/index.js +25 -0
- package/dist/cjs/test/fixtures/v3/jsExport.js +13 -0
- package/dist/cjs/test/fixtures/v3/sourcemap.js +13 -0
- package/dist/cjs/test/fixtures/v3/svelte.js +21 -0
- package/dist/cjs/test/fixtures/v3/vizContent.js +14 -0
- package/dist/cjs/test/fixtures/v3/vizImport.js +88 -0
- package/dist/cjs/test/fixtures/v4/d3Usage.js +34 -0
- package/dist/cjs/test/fixtures/v4/esmBuild.js +21 -0
- package/dist/cjs/test/fixtures/v4/fetchInterception.js +21 -0
- package/dist/cjs/test/fixtures/v4/index.js +21 -0
- package/dist/cjs/test/fixtures/v4/jsScriptTagTypeModule.js +21 -0
- package/dist/cjs/test/fixtures/v4/jsScriptTagTypeModules.js +15 -0
- package/dist/cjs/test/fixtures/v4/reactHooks.js +50 -0
- package/dist/cjs/test/fixtures/v4/reactJsx.js +37 -0
- package/dist/cjs/test/fixtures/v4/threeJsUsage.js +27 -0
- package/dist/cjs/test/fixtures/v4/typeScriptSupport.js +32 -0
- package/dist/cjs/test/testInBrowser.js +50 -0
- package/dist/cjs/test/testStackTrace.js +58 -0
- package/dist/cjs/test/v1.test.js +70 -0
- package/dist/cjs/test/v2.test.js +124 -0
- package/dist/cjs/test/v3.test.js +119 -0
- package/dist/cjs/test/v4.test.js +105 -0
- package/dist/cjs/types.js +2 -0
- package/dist/cjs/utils/vizContentToFileCollection.js +23 -0
- package/dist/cjs/utils/vizContentToFileCollection.test.js +77 -0
- package/dist/cjs/v2/computeBundleJSV2.js +33 -0
- package/dist/cjs/v2/getComputedIndexHtml.js +86 -0
- package/dist/cjs/v2/getComputedIndexHtml.test.js +136 -0
- package/dist/cjs/v2/index.js +5 -0
- package/dist/cjs/v2/v2Build.js +15 -0
- package/dist/cjs/v3/cleanRollupErrorMessage.js +13 -0
- package/dist/cjs/v3/computeBundleJSV3.js +52 -0
- package/dist/cjs/v3/createVizContent.js +27 -0
- package/dist/cjs/v3/extractVizImport.js +27 -0
- package/dist/cjs/v3/extractVizImport.test.js +32 -0
- package/dist/cjs/v3/htmlTemplate.js +93 -0
- package/dist/cjs/v3/index.js +5 -0
- package/dist/cjs/v3/parseId.js +9 -0
- package/dist/cjs/v3/parseId.test.js +27 -0
- package/dist/cjs/v3/setupV3Runtime.js +345 -0
- package/dist/cjs/v3/slugCache.js +39 -0
- package/dist/cjs/v3/slugCache.test.js +107 -0
- package/dist/cjs/v3/transformDSV/dsvParseSrc.js +124 -0
- package/dist/cjs/v3/transformDSV/index.js +44 -0
- package/dist/cjs/v3/transformSvelte.js +81 -0
- package/dist/cjs/v3/types.js +2 -0
- package/dist/cjs/v3/v3Build.js +34 -0
- package/dist/cjs/v3/vizCache.js +40 -0
- package/dist/cjs/v3/vizCache.test.js +100 -0
- package/dist/cjs/v3/vizLoad.js +50 -0
- package/dist/cjs/v3/vizResolve.js +73 -0
- package/dist/cjs/v4/index.js +138 -0
- package/dist/esm/buildHTML.js +67 -0
- package/dist/esm/common/packageJson.js +71 -0
- package/dist/esm/common/packageJson.test.js +146 -0
- package/dist/esm/common/sucrasePlugin.js +24 -0
- package/dist/esm/common/virtualFileSystem.js +75 -0
- package/dist/esm/determineRuntimeVersion.js +22 -0
- package/dist/esm/determineRuntimeVersion.test.js +101 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/test/fixtures/v1/basicHTML.js +15 -0
- package/dist/esm/test/fixtures/v1/fetchProxy.js +12 -0
- package/dist/esm/test/fixtures/v1/index.js +6 -0
- package/dist/esm/test/fixtures/v1/jsScriptTag.js +9 -0
- package/dist/esm/test/fixtures/v1/protocolTest.js +15 -0
- package/dist/esm/test/fixtures/v1/styleTest.js +15 -0
- package/dist/esm/test/fixtures/v1/xmlTest.js +19 -0
- package/dist/esm/test/fixtures/v2/basicBundle.js +5 -0
- package/dist/esm/test/fixtures/v2/basicBundleNoExtension.js +5 -0
- package/dist/esm/test/fixtures/v2/d3Import.js +7 -0
- package/dist/esm/test/fixtures/v2/d3ImportPkg.js +19 -0
- package/dist/esm/test/fixtures/v2/d3RosettaImportPkg.js +19 -0
- package/dist/esm/test/fixtures/v2/es6Preserve.js +6 -0
- package/dist/esm/test/fixtures/v2/generatorSupport.js +6 -0
- package/dist/esm/test/fixtures/v2/index.js +15 -0
- package/dist/esm/test/fixtures/v2/jsxTranspile.js +6 -0
- package/dist/esm/test/fixtures/v2/reactDomImport.js +8 -0
- package/dist/esm/test/fixtures/v2/reactDomImportPkg.js +24 -0
- package/dist/esm/test/fixtures/v2/reactImport.js +7 -0
- package/dist/esm/test/fixtures/v2/reactImportPkg.js +17 -0
- package/dist/esm/test/fixtures/v2/sourceMapErrorFixture.js +19 -0
- package/dist/esm/test/fixtures/v2/unicodeSupport.js +6 -0
- package/dist/esm/test/fixtures/v3/basicIndexJS.js +7 -0
- package/dist/esm/test/fixtures/v3/cssImport.js +9 -0
- package/dist/esm/test/fixtures/v3/csvImport.js +11 -0
- package/dist/esm/test/fixtures/v3/csvStrangeChars.js +12 -0
- package/dist/esm/test/fixtures/v3/index.js +9 -0
- package/dist/esm/test/fixtures/v3/jsExport.js +10 -0
- package/dist/esm/test/fixtures/v3/sourcemap.js +10 -0
- package/dist/esm/test/fixtures/v3/svelte.js +18 -0
- package/dist/esm/test/fixtures/v3/vizContent.js +11 -0
- package/dist/esm/test/fixtures/v3/vizImport.js +85 -0
- package/dist/esm/test/fixtures/v4/d3Usage.js +31 -0
- package/dist/esm/test/fixtures/v4/esmBuild.js +18 -0
- package/dist/esm/test/fixtures/v4/fetchInterception.js +18 -0
- package/dist/esm/test/fixtures/v4/index.js +9 -0
- package/dist/esm/test/fixtures/v4/jsScriptTagTypeModule.js +18 -0
- package/dist/esm/test/fixtures/v4/jsScriptTagTypeModules.js +12 -0
- package/dist/esm/test/fixtures/v4/reactHooks.js +47 -0
- package/dist/esm/test/fixtures/v4/reactJsx.js +34 -0
- package/dist/esm/test/fixtures/v4/threeJsUsage.js +24 -0
- package/dist/esm/test/fixtures/v4/typeScriptSupport.js +29 -0
- package/dist/esm/test/testInBrowser.js +47 -0
- package/dist/esm/test/testStackTrace.js +55 -0
- package/dist/esm/test/v1.test.js +65 -0
- package/dist/esm/test/v2.test.js +121 -0
- package/dist/esm/test/v3.test.js +114 -0
- package/dist/esm/test/v4.test.js +100 -0
- package/dist/esm/types.js +1 -0
- package/dist/esm/utils/vizContentToFileCollection.js +19 -0
- package/dist/esm/utils/vizContentToFileCollection.test.js +75 -0
- package/dist/esm/v2/computeBundleJSV2.js +29 -0
- package/dist/esm/v2/getComputedIndexHtml.js +81 -0
- package/dist/esm/v2/getComputedIndexHtml.test.js +134 -0
- package/dist/esm/v2/index.js +1 -0
- package/dist/esm/v2/v2Build.js +11 -0
- package/dist/esm/v3/cleanRollupErrorMessage.js +9 -0
- package/dist/esm/v3/computeBundleJSV3.js +48 -0
- package/dist/esm/v3/createVizContent.js +23 -0
- package/dist/esm/v3/extractVizImport.js +23 -0
- package/dist/esm/v3/extractVizImport.test.js +30 -0
- package/dist/esm/v3/htmlTemplate.js +89 -0
- package/dist/esm/v3/index.js +1 -0
- package/dist/esm/v3/parseId.js +5 -0
- package/dist/esm/v3/parseId.test.js +25 -0
- package/dist/esm/v3/setupV3Runtime.js +341 -0
- package/dist/esm/v3/slugCache.js +35 -0
- package/dist/esm/v3/slugCache.test.js +105 -0
- package/dist/esm/v3/transformDSV/dsvParseSrc.js +121 -0
- package/dist/esm/v3/transformDSV/index.js +40 -0
- package/dist/esm/v3/transformSvelte.js +77 -0
- package/dist/esm/v3/types.js +1 -0
- package/dist/esm/v3/v3Build.js +30 -0
- package/dist/esm/v3/vizCache.js +36 -0
- package/dist/esm/v3/vizCache.test.js +98 -0
- package/dist/esm/v3/vizLoad.js +46 -0
- package/dist/esm/v3/vizResolve.js +69 -0
- package/dist/esm/v4/index.js +134 -0
- package/dist/types/buildHTML.d.ts +14 -0
- package/dist/types/common/packageJson.d.ts +39 -0
- package/dist/types/common/packageJson.test.d.ts +1 -0
- package/dist/types/common/sucrasePlugin.d.ts +2 -0
- package/dist/types/common/virtualFileSystem.d.ts +3 -0
- package/dist/types/determineRuntimeVersion.d.ts +3 -0
- package/dist/types/determineRuntimeVersion.test.d.ts +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/test/fixtures/v1/basicHTML.d.ts +3 -0
- package/dist/types/test/fixtures/v1/fetchProxy.d.ts +5 -0
- package/dist/types/test/fixtures/v1/index.d.ts +6 -0
- package/dist/types/test/fixtures/v1/jsScriptTag.d.ts +4 -0
- package/dist/types/test/fixtures/v1/protocolTest.d.ts +3 -0
- package/dist/types/test/fixtures/v1/styleTest.d.ts +4 -0
- package/dist/types/test/fixtures/v1/xmlTest.d.ts +4 -0
- package/dist/types/test/fixtures/v2/basicBundle.d.ts +5 -0
- package/dist/types/test/fixtures/v2/basicBundleNoExtension.d.ts +5 -0
- package/dist/types/test/fixtures/v2/d3Import.d.ts +4 -0
- package/dist/types/test/fixtures/v2/d3ImportPkg.d.ts +5 -0
- package/dist/types/test/fixtures/v2/d3RosettaImportPkg.d.ts +5 -0
- package/dist/types/test/fixtures/v2/es6Preserve.d.ts +4 -0
- package/dist/types/test/fixtures/v2/generatorSupport.d.ts +4 -0
- package/dist/types/test/fixtures/v2/index.d.ts +14 -0
- package/dist/types/test/fixtures/v2/jsxTranspile.d.ts +4 -0
- package/dist/types/test/fixtures/v2/reactDomImport.d.ts +4 -0
- package/dist/types/test/fixtures/v2/reactDomImportPkg.d.ts +5 -0
- package/dist/types/test/fixtures/v2/reactImport.d.ts +4 -0
- package/dist/types/test/fixtures/v2/reactImportPkg.d.ts +5 -0
- package/dist/types/test/fixtures/v2/sourceMapErrorFixture.d.ts +5 -0
- package/dist/types/test/fixtures/v2/unicodeSupport.d.ts +4 -0
- package/dist/types/test/fixtures/v3/basicIndexJS.d.ts +3 -0
- package/dist/types/test/fixtures/v3/cssImport.d.ts +4 -0
- package/dist/types/test/fixtures/v3/csvImport.d.ts +4 -0
- package/dist/types/test/fixtures/v3/csvStrangeChars.d.ts +4 -0
- package/dist/types/test/fixtures/v3/index.d.ts +9 -0
- package/dist/types/test/fixtures/v3/jsExport.d.ts +4 -0
- package/dist/types/test/fixtures/v3/sourcemap.d.ts +3 -0
- package/dist/types/test/fixtures/v3/svelte.d.ts +4 -0
- package/dist/types/test/fixtures/v3/vizContent.d.ts +2 -0
- package/dist/types/test/fixtures/v3/vizImport.d.ts +6 -0
- package/dist/types/test/fixtures/v4/d3Usage.d.ts +5 -0
- package/dist/types/test/fixtures/v4/esmBuild.d.ts +5 -0
- package/dist/types/test/fixtures/v4/fetchInterception.d.ts +5 -0
- package/dist/types/test/fixtures/v4/index.d.ts +9 -0
- package/dist/types/test/fixtures/v4/jsScriptTagTypeModule.d.ts +4 -0
- package/dist/types/test/fixtures/v4/jsScriptTagTypeModules.d.ts +5 -0
- package/dist/types/test/fixtures/v4/reactHooks.d.ts +6 -0
- package/dist/types/test/fixtures/v4/reactJsx.d.ts +6 -0
- package/dist/types/test/fixtures/v4/threeJsUsage.d.ts +4 -0
- package/dist/types/test/fixtures/v4/typeScriptSupport.d.ts +5 -0
- package/dist/types/test/testInBrowser.d.ts +15 -0
- package/dist/types/test/testStackTrace.d.ts +9 -0
- package/dist/types/test/v1.test.d.ts +1 -0
- package/dist/types/test/v2.test.d.ts +1 -0
- package/dist/types/test/v3.test.d.ts +1 -0
- package/dist/types/test/v4.test.d.ts +1 -0
- package/dist/types/types.d.ts +1 -0
- package/dist/types/utils/vizContentToFileCollection.d.ts +7 -0
- package/dist/types/utils/vizContentToFileCollection.test.d.ts +1 -0
- package/dist/types/v2/computeBundleJSV2.d.ts +7 -0
- package/dist/types/v2/getComputedIndexHtml.d.ts +4 -0
- package/dist/types/v2/getComputedIndexHtml.test.d.ts +1 -0
- package/dist/types/v2/index.d.ts +1 -0
- package/dist/types/v2/v2Build.d.ts +7 -0
- package/dist/types/v3/cleanRollupErrorMessage.d.ts +4 -0
- package/dist/types/v3/computeBundleJSV3.d.ts +17 -0
- package/dist/types/v3/createVizContent.d.ts +8 -0
- package/dist/types/v3/extractVizImport.d.ts +6 -0
- package/dist/types/v3/extractVizImport.test.d.ts +1 -0
- package/dist/types/v3/htmlTemplate.d.ts +5 -0
- package/dist/types/v3/index.d.ts +1 -0
- package/dist/types/v3/parseId.d.ts +6 -0
- package/dist/types/v3/parseId.test.d.ts +1 -0
- package/dist/types/v3/setupV3Runtime.d.ts +15 -0
- package/dist/types/v3/slugCache.d.ts +11 -0
- package/dist/types/v3/slugCache.test.d.ts +1 -0
- package/dist/types/v3/transformDSV/dsvParseSrc.d.ts +1 -0
- package/dist/types/v3/transformDSV/index.d.ts +2 -0
- package/dist/types/v3/transformSvelte.d.ts +8 -0
- package/dist/types/v3/types.d.ts +65 -0
- package/dist/types/v3/v3Build.d.ts +14 -0
- package/dist/types/v3/vizCache.d.ts +10 -0
- package/dist/types/v3/vizCache.test.d.ts +1 -0
- package/dist/types/v3/vizLoad.d.ts +7 -0
- package/dist/types/v3/vizResolve.d.ts +7 -0
- package/dist/types/v4/index.d.ts +10 -0
- package/package.json +14 -7
@@ -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,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,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,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,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,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,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,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,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,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,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,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,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,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,85 @@
|
|
1
|
+
// Sample content for testing JS imports
|
2
|
+
export const sampleContent = {
|
3
|
+
id: "84bddfb1cc0545f299e5083c3e71e0bb",
|
4
|
+
files: {
|
5
|
+
"7548392": {
|
6
|
+
name: "index.js",
|
7
|
+
text: `
|
8
|
+
import { innerMessage } from './message';
|
9
|
+
export const message = "Outer " + innerMessage;
|
10
|
+
`,
|
11
|
+
},
|
12
|
+
"6714854": {
|
13
|
+
name: "message.js",
|
14
|
+
text: `
|
15
|
+
export const innerMessage = "Inner";
|
16
|
+
`,
|
17
|
+
},
|
18
|
+
},
|
19
|
+
title: "Sample Content for Exporting",
|
20
|
+
};
|
21
|
+
// Sample content for testing JS imports
|
22
|
+
// across vizzes by id
|
23
|
+
export const sampleContentVizImport = {
|
24
|
+
id: "a6014044e0c6425f911a7e128e1928a6",
|
25
|
+
files: {
|
26
|
+
"7548392": {
|
27
|
+
name: "index.js",
|
28
|
+
text: `
|
29
|
+
import { message } from '@joe/${sampleContent.id}';
|
30
|
+
console.log("Imported from viz: " + message);
|
31
|
+
`,
|
32
|
+
},
|
33
|
+
},
|
34
|
+
title: "Sample Content for Viz Importing",
|
35
|
+
};
|
36
|
+
// Sample content for testing JS imports
|
37
|
+
// across vizzes by slug
|
38
|
+
export const sampleContentVizImportSlug = {
|
39
|
+
id: "6f8aec8c3cd348d7a7d4661cc8d75c9a",
|
40
|
+
files: {
|
41
|
+
"7548392": {
|
42
|
+
name: "index.js",
|
43
|
+
text: `
|
44
|
+
import { message } from '@joe/sample-content-slug';
|
45
|
+
console.log("Imported from viz with slug: " + message);
|
46
|
+
`,
|
47
|
+
},
|
48
|
+
},
|
49
|
+
title: "Sample Content for Viz Importing",
|
50
|
+
};
|
51
|
+
// Sample content for testing CSS imports
|
52
|
+
export const sampleContentWithCSS = {
|
53
|
+
id: "cd52ba7f80834807b72e66ce4abac185",
|
54
|
+
files: {
|
55
|
+
"5473849": {
|
56
|
+
name: "index.js",
|
57
|
+
text: `
|
58
|
+
import './styles.css';
|
59
|
+
`,
|
60
|
+
},
|
61
|
+
"0175432": {
|
62
|
+
name: "styles.css",
|
63
|
+
text: `
|
64
|
+
body { color: red; }
|
65
|
+
`,
|
66
|
+
},
|
67
|
+
},
|
68
|
+
title: "Sample Content for CSS Importing",
|
69
|
+
};
|
70
|
+
// Sample content for testing CSS imports
|
71
|
+
// across vizzes
|
72
|
+
export const sampleContentVizImportWithCSS = {
|
73
|
+
id: "816040d214484b41b653bd6916a11fd9",
|
74
|
+
files: {
|
75
|
+
"7548392": {
|
76
|
+
name: "index.js",
|
77
|
+
text: `
|
78
|
+
// Import for the CSS side effect
|
79
|
+
import '@joe/${sampleContentWithCSS.id}';
|
80
|
+
console.log(getComputedStyle(document.body).color);
|
81
|
+
`,
|
82
|
+
},
|
83
|
+
},
|
84
|
+
title: "Sample Content for Viz Importing with CSS",
|
85
|
+
};
|
@@ -0,0 +1,31 @@
|
|
1
|
+
export const d3Usage = {
|
2
|
+
"index.html": `<!DOCTYPE html>
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<title>D3 Test</title>
|
6
|
+
</head>
|
7
|
+
<body>
|
8
|
+
<div id="chart"></div>
|
9
|
+
<script type="module" src="index.js"></script>
|
10
|
+
</body>
|
11
|
+
</html>`,
|
12
|
+
"index.js": `import * as d3 from 'd3';
|
13
|
+
|
14
|
+
const svg = d3.select('#chart')
|
15
|
+
.append('svg')
|
16
|
+
.attr('width', 100)
|
17
|
+
.attr('height', 100);
|
18
|
+
|
19
|
+
svg.append('circle')
|
20
|
+
.attr('cx', 50)
|
21
|
+
.attr('cy', 50)
|
22
|
+
.attr('r', 40)
|
23
|
+
.style('fill', 'blue');
|
24
|
+
|
25
|
+
console.log('D3 chart rendered successfully');`,
|
26
|
+
"package.json": `{
|
27
|
+
"dependencies": {
|
28
|
+
"d3": "^7.8.5"
|
29
|
+
}
|
30
|
+
}`,
|
31
|
+
};
|
@@ -0,0 +1,18 @@
|
|
1
|
+
export const esmBuild = {
|
2
|
+
"index.html": `<!DOCTYPE html>
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<title>ESM Build Test</title>
|
6
|
+
</head>
|
7
|
+
<body>
|
8
|
+
<script type="module" src="index.js"></script>
|
9
|
+
</body>
|
10
|
+
</html>`,
|
11
|
+
"index.js": `import { format } from 'date-fns';
|
12
|
+
console.log(format(new Date(), 'yyyy-MM-dd'));`,
|
13
|
+
"package.json": `{
|
14
|
+
"dependencies": {
|
15
|
+
"date-fns": "2.30.0"
|
16
|
+
}
|
17
|
+
}`,
|
18
|
+
};
|
@@ -0,0 +1,18 @@
|
|
1
|
+
export const fetchInterception = {
|
2
|
+
"index.html": `<!DOCTYPE html>
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<title>Fetch Interception Test</title>
|
6
|
+
</head>
|
7
|
+
<body>
|
8
|
+
<script type="module" src="index.js"></script>
|
9
|
+
</body>
|
10
|
+
</html>`,
|
11
|
+
"index.js": `
|
12
|
+
fetch("data.json")
|
13
|
+
.then(response => response.json())
|
14
|
+
.then(data => console.log(data.message));`,
|
15
|
+
"data.json": `{
|
16
|
+
"message": "Fetch intercepted successfully"
|
17
|
+
}`,
|
18
|
+
};
|
@@ -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,18 @@
|
|
1
|
+
export const jsScriptTagTypeModule = {
|
2
|
+
"index.html": `<!DOCTYPE html>
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<script type="importmap">
|
6
|
+
{
|
7
|
+
"imports": {
|
8
|
+
"greeter": "data:text/javascript;charset=utf-8,export const greeting = \\"Hello, ES Module!\\";"
|
9
|
+
}
|
10
|
+
}
|
11
|
+
</script>
|
12
|
+
</head>
|
13
|
+
<body>
|
14
|
+
<script type="module" src="index.js"></script>
|
15
|
+
</body>
|
16
|
+
</html>`,
|
17
|
+
"index.js": `import { greeting } from 'greeter';\nconsole.log(greeting);`,
|
18
|
+
};
|
@@ -0,0 +1,12 @@
|
|
1
|
+
export const jsScriptTagTypeModules = {
|
2
|
+
"index.html": `<!DOCTYPE html>
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
</head>
|
6
|
+
<body>
|
7
|
+
<script type="module" src="index.js"></script>
|
8
|
+
</body>
|
9
|
+
</html>`,
|
10
|
+
"index.js": `import { greeting } from './greeter.js';\nconsole.log(greeting);`,
|
11
|
+
"greeter.js": `export const greeting = "Hello, ES Module File!";`,
|
12
|
+
};
|
@@ -0,0 +1,47 @@
|
|
1
|
+
export const reactHooks = {
|
2
|
+
"index.html": `<!DOCTYPE html>
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<title>React Hooks Test</title>
|
6
|
+
</head>
|
7
|
+
<body>
|
8
|
+
<div id="root"></div>
|
9
|
+
<script type="module" src="index.jsx"></script>
|
10
|
+
</body>
|
11
|
+
</html>`,
|
12
|
+
"index.jsx": `import React from 'react';
|
13
|
+
import ReactDOM from 'react-dom/client';
|
14
|
+
import Counter from './Counter.jsx';
|
15
|
+
|
16
|
+
ReactDOM.createRoot(document.getElementById('root')).render(
|
17
|
+
<React.StrictMode>
|
18
|
+
<Counter />
|
19
|
+
</React.StrictMode>
|
20
|
+
);`,
|
21
|
+
"Counter.jsx": `import React, { useState, useEffect } from 'react';
|
22
|
+
|
23
|
+
function Counter() {
|
24
|
+
const [count, setCount] = useState(0);
|
25
|
+
|
26
|
+
useEffect(() => {
|
27
|
+
console.log('React Hooks working: count is ' + count);
|
28
|
+
}, [count]);
|
29
|
+
|
30
|
+
return (
|
31
|
+
<div>
|
32
|
+
<p>You clicked {count} times</p>
|
33
|
+
<button onClick={() => setCount(count + 1)}>
|
34
|
+
Click me
|
35
|
+
</button>
|
36
|
+
</div>
|
37
|
+
);
|
38
|
+
}
|
39
|
+
|
40
|
+
export default Counter;`,
|
41
|
+
"package.json": `{
|
42
|
+
"dependencies": {
|
43
|
+
"react": "^18.2.0",
|
44
|
+
"react-dom": "^18.2.0"
|
45
|
+
}
|
46
|
+
}`,
|
47
|
+
};
|