@vizhub/runtime 0.3.0 → 0.3.1
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,71 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.buildHTML = void 0;
|
4
|
+
const magic_sandbox_1 = require("magic-sandbox");
|
5
|
+
const determineRuntimeVersion_1 = require("./determineRuntimeVersion");
|
6
|
+
const v2_1 = require("./v2");
|
7
|
+
const v3_1 = require("./v3");
|
8
|
+
const v4_1 = require("./v4");
|
9
|
+
const vizCache_1 = require("./v3/vizCache");
|
10
|
+
const createVizContent_1 = require("./v3/createVizContent");
|
11
|
+
const vizContentToFileCollection_1 = require("./utils/vizContentToFileCollection");
|
12
|
+
const DEBUG = false;
|
13
|
+
const buildHTML = async ({ files, rollup, enableSourcemap = true, vizCache, vizId, slugCache, getSvelteCompiler, }) => {
|
14
|
+
if (!files && !vizCache) {
|
15
|
+
throw new Error("Either files or vizCache is required");
|
16
|
+
}
|
17
|
+
if (!files && vizCache && !vizId) {
|
18
|
+
throw new Error("vizId is required when using vizCache");
|
19
|
+
}
|
20
|
+
if (!files && vizCache && vizId) {
|
21
|
+
files = (0, vizContentToFileCollection_1.vizContentToFileCollection)(await vizCache.get(vizId));
|
22
|
+
}
|
23
|
+
if (!files) {
|
24
|
+
throw new Error("Upable to extract viz files");
|
25
|
+
}
|
26
|
+
const version = (0, determineRuntimeVersion_1.determineRuntimeVersion)(files);
|
27
|
+
DEBUG && console.log("[buildHTML] version:", version);
|
28
|
+
if (version === "v1") {
|
29
|
+
return (0, magic_sandbox_1.magicSandbox)(files);
|
30
|
+
}
|
31
|
+
if (version === "v2") {
|
32
|
+
if (!rollup) {
|
33
|
+
throw new Error("Rollup is required for v2 runtime");
|
34
|
+
}
|
35
|
+
return (0, magic_sandbox_1.magicSandbox)(await (0, v2_1.v2Build)({ files, rollup, enableSourcemap }));
|
36
|
+
}
|
37
|
+
if (version === "v3") {
|
38
|
+
if (!rollup) {
|
39
|
+
throw new Error("Rollup is required for v3 runtime");
|
40
|
+
}
|
41
|
+
if (!vizCache && !vizId) {
|
42
|
+
const vizContent = (0, createVizContent_1.createVizContent)(files);
|
43
|
+
vizId = vizContent.id;
|
44
|
+
vizCache = (0, vizCache_1.createVizCache)({
|
45
|
+
initialContents: [vizContent],
|
46
|
+
handleCacheMiss: async () => {
|
47
|
+
throw new Error("Cache miss handler not implemented");
|
48
|
+
},
|
49
|
+
});
|
50
|
+
}
|
51
|
+
if (!vizCache || !vizId) {
|
52
|
+
throw new Error("vizCache and vizId are required for v3 runtime");
|
53
|
+
}
|
54
|
+
return await (0, v3_1.v3Build)({
|
55
|
+
files,
|
56
|
+
rollup,
|
57
|
+
vizCache,
|
58
|
+
vizId,
|
59
|
+
slugCache,
|
60
|
+
getSvelteCompiler,
|
61
|
+
});
|
62
|
+
}
|
63
|
+
if (version === "v4") {
|
64
|
+
if (!rollup) {
|
65
|
+
throw new Error("Rollup is required for v4 runtime");
|
66
|
+
}
|
67
|
+
return (0, magic_sandbox_1.magicSandbox)(await (0, v4_1.v4Build)({ files, rollup, enableSourcemap }));
|
68
|
+
}
|
69
|
+
throw new Error(`Unsupported runtime version: ${version}`);
|
70
|
+
};
|
71
|
+
exports.buildHTML = buildHTML;
|
@@ -0,0 +1,81 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.getGlobals = exports.getConfiguredGlobals = exports.getLicense = exports.dependencySource = exports.getConfiguredLibraries = exports.dependencies = exports.packageJSON = void 0;
|
4
|
+
const EMPTY_PKG_JSON = {
|
5
|
+
dependencies: {},
|
6
|
+
vizhub: {},
|
7
|
+
license: "MIT",
|
8
|
+
};
|
9
|
+
const DEBUG = false;
|
10
|
+
const packageJSON = (files) => {
|
11
|
+
const packageJsonText = files["package.json"];
|
12
|
+
DEBUG &&
|
13
|
+
console.log("[packageJSON] packageJsonText:", packageJsonText);
|
14
|
+
try {
|
15
|
+
const pkg = packageJsonText
|
16
|
+
? JSON.parse(packageJsonText)
|
17
|
+
: EMPTY_PKG_JSON;
|
18
|
+
DEBUG &&
|
19
|
+
console.log("[packageJSON] pkg:", JSON.stringify(pkg, null, 2));
|
20
|
+
return pkg;
|
21
|
+
}
|
22
|
+
catch {
|
23
|
+
DEBUG &&
|
24
|
+
console.log("[packageJSON] Error parsing package.json");
|
25
|
+
return EMPTY_PKG_JSON;
|
26
|
+
}
|
27
|
+
};
|
28
|
+
exports.packageJSON = packageJSON;
|
29
|
+
const dependencies = (files) => (0, exports.packageJSON)(files).dependencies || {};
|
30
|
+
exports.dependencies = dependencies;
|
31
|
+
const getConfiguredLibraries = (files) => {
|
32
|
+
const vizhubConfig = (0, exports.packageJSON)(files).vizhub || {};
|
33
|
+
return vizhubConfig.libraries || {};
|
34
|
+
};
|
35
|
+
exports.getConfiguredLibraries = getConfiguredLibraries;
|
36
|
+
const dependencySource = ({ name, version }, libraries, cdn = "jsdelivr") => {
|
37
|
+
const path = libraries[name]
|
38
|
+
? libraries[name].path || ""
|
39
|
+
: "";
|
40
|
+
const src = cdn === "jsdelivr"
|
41
|
+
? `https://cdn.jsdelivr.net/npm/${name}@${version}${path}`
|
42
|
+
: `https://unpkg.com/${name}@${version}${path}`;
|
43
|
+
return src;
|
44
|
+
};
|
45
|
+
exports.dependencySource = dependencySource;
|
46
|
+
const getLicense = (files) => {
|
47
|
+
const license = (0, exports.packageJSON)(files).license;
|
48
|
+
if (typeof license === "object" &&
|
49
|
+
license !== null &&
|
50
|
+
"type" in license) {
|
51
|
+
return license.type;
|
52
|
+
}
|
53
|
+
return license || EMPTY_PKG_JSON.license;
|
54
|
+
};
|
55
|
+
exports.getLicense = getLicense;
|
56
|
+
const getConfiguredGlobals = (pkg) => {
|
57
|
+
const libraries = pkg?.vizhub?.libraries;
|
58
|
+
if (libraries) {
|
59
|
+
return Object.entries(libraries).reduce((accumulator, [packageName, config]) => {
|
60
|
+
if (config.global) {
|
61
|
+
accumulator[packageName] = config.global;
|
62
|
+
}
|
63
|
+
return accumulator;
|
64
|
+
}, {});
|
65
|
+
}
|
66
|
+
return {};
|
67
|
+
};
|
68
|
+
exports.getConfiguredGlobals = getConfiguredGlobals;
|
69
|
+
const defaultGlobals = {
|
70
|
+
d3: "d3",
|
71
|
+
react: "React",
|
72
|
+
"react-dom": "ReactDOM",
|
73
|
+
};
|
74
|
+
const getGlobals = (pkg) => {
|
75
|
+
const configuredGlobals = (0, exports.getConfiguredGlobals)(pkg);
|
76
|
+
return {
|
77
|
+
...defaultGlobals,
|
78
|
+
...configuredGlobals,
|
79
|
+
};
|
80
|
+
};
|
81
|
+
exports.getGlobals = getGlobals;
|
@@ -0,0 +1,148 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const vitest_1 = require("vitest");
|
4
|
+
const packageJson_1 = require("./packageJson");
|
5
|
+
(0, vitest_1.describe)("packageJson", () => {
|
6
|
+
const mockFiles = {
|
7
|
+
"package.json": JSON.stringify({
|
8
|
+
dependencies: {
|
9
|
+
react: "17.0.2",
|
10
|
+
d3: "7.0.0",
|
11
|
+
},
|
12
|
+
vizhub: {
|
13
|
+
libraries: {
|
14
|
+
d3: { path: "/dist/d3.min.js" },
|
15
|
+
},
|
16
|
+
},
|
17
|
+
license: "Apache-2.0",
|
18
|
+
}),
|
19
|
+
};
|
20
|
+
const emptyFiles = {};
|
21
|
+
const invalidFiles = {
|
22
|
+
"package.json": "invalid json",
|
23
|
+
};
|
24
|
+
(0, vitest_1.describe)("packageJSON", () => {
|
25
|
+
(0, vitest_1.it)("should parse valid package.json", () => {
|
26
|
+
const result = (0, packageJson_1.packageJSON)(mockFiles);
|
27
|
+
(0, vitest_1.expect)(result).toHaveProperty("dependencies");
|
28
|
+
(0, vitest_1.expect)(result.dependencies).toHaveProperty("react", "17.0.2");
|
29
|
+
});
|
30
|
+
(0, vitest_1.it)("should return empty object for missing package.json", () => {
|
31
|
+
const result = (0, packageJson_1.packageJSON)(emptyFiles);
|
32
|
+
(0, vitest_1.expect)(result).toEqual({
|
33
|
+
dependencies: {},
|
34
|
+
vizhub: {},
|
35
|
+
license: "MIT",
|
36
|
+
});
|
37
|
+
});
|
38
|
+
(0, vitest_1.it)("should handle invalid JSON", () => {
|
39
|
+
const result = (0, packageJson_1.packageJSON)(invalidFiles);
|
40
|
+
(0, vitest_1.expect)(result).toEqual({
|
41
|
+
dependencies: {},
|
42
|
+
vizhub: {},
|
43
|
+
license: "MIT",
|
44
|
+
});
|
45
|
+
});
|
46
|
+
});
|
47
|
+
(0, vitest_1.describe)("dependencies", () => {
|
48
|
+
(0, vitest_1.it)("should return dependencies from package.json", () => {
|
49
|
+
const result = (0, packageJson_1.dependencies)(mockFiles);
|
50
|
+
(0, vitest_1.expect)(result).toEqual({
|
51
|
+
react: "17.0.2",
|
52
|
+
d3: "7.0.0",
|
53
|
+
});
|
54
|
+
});
|
55
|
+
(0, vitest_1.it)("should return empty object when no dependencies", () => {
|
56
|
+
const result = (0, packageJson_1.dependencies)(emptyFiles);
|
57
|
+
(0, vitest_1.expect)(result).toEqual({});
|
58
|
+
});
|
59
|
+
});
|
60
|
+
(0, vitest_1.describe)("getConfiguredLibraries", () => {
|
61
|
+
(0, vitest_1.it)("should return configured libraries", () => {
|
62
|
+
const result = (0, packageJson_1.getConfiguredLibraries)(mockFiles);
|
63
|
+
(0, vitest_1.expect)(result).toEqual({
|
64
|
+
d3: { path: "/dist/d3.min.js" },
|
65
|
+
});
|
66
|
+
});
|
67
|
+
(0, vitest_1.it)("should return empty object when no libraries configured", () => {
|
68
|
+
const result = (0, packageJson_1.getConfiguredLibraries)(emptyFiles);
|
69
|
+
(0, vitest_1.expect)(result).toEqual({});
|
70
|
+
});
|
71
|
+
});
|
72
|
+
(0, vitest_1.describe)("dependencySource", () => {
|
73
|
+
(0, vitest_1.it)("should generate correct URL with path - jsdelivr", () => {
|
74
|
+
const dependency = { name: "d3", version: "7.0.0" };
|
75
|
+
const libraries = { d3: { path: "/dist/d3.min.js" } };
|
76
|
+
const result = (0, packageJson_1.dependencySource)(dependency, libraries);
|
77
|
+
(0, vitest_1.expect)(result).toBe("https://cdn.jsdelivr.net/npm/d3@7.0.0/dist/d3.min.js");
|
78
|
+
});
|
79
|
+
(0, vitest_1.it)("should generate correct URL without path - jsdelivr", () => {
|
80
|
+
const dependency = {
|
81
|
+
name: "react",
|
82
|
+
version: "17.0.2",
|
83
|
+
};
|
84
|
+
const libraries = {};
|
85
|
+
const result = (0, packageJson_1.dependencySource)(dependency, libraries);
|
86
|
+
(0, vitest_1.expect)(result).toBe("https://cdn.jsdelivr.net/npm/react@17.0.2");
|
87
|
+
});
|
88
|
+
(0, vitest_1.it)("should generate correct URL with path - unpkg", () => {
|
89
|
+
const dependency = { name: "d3", version: "7.0.0" };
|
90
|
+
const libraries = { d3: { path: "/dist/d3.min.js" } };
|
91
|
+
const result = (0, packageJson_1.dependencySource)(dependency, libraries, "unpkg");
|
92
|
+
(0, vitest_1.expect)(result).toBe("https://unpkg.com/d3@7.0.0/dist/d3.min.js");
|
93
|
+
});
|
94
|
+
(0, vitest_1.it)("should generate correct URL without path - unpkg", () => {
|
95
|
+
const dependency = {
|
96
|
+
name: "react",
|
97
|
+
version: "17.0.2",
|
98
|
+
};
|
99
|
+
const libraries = {};
|
100
|
+
const result = (0, packageJson_1.dependencySource)(dependency, libraries, "unpkg");
|
101
|
+
(0, vitest_1.expect)(result).toBe("https://unpkg.com/react@17.0.2");
|
102
|
+
});
|
103
|
+
});
|
104
|
+
(0, vitest_1.describe)("getLicense", () => {
|
105
|
+
(0, vitest_1.it)("should return license from package.json", () => {
|
106
|
+
const result = (0, packageJson_1.getLicense)(mockFiles);
|
107
|
+
(0, vitest_1.expect)(result).toBe("Apache-2.0");
|
108
|
+
});
|
109
|
+
(0, vitest_1.it)("should return default MIT license when not specified", () => {
|
110
|
+
const result = (0, packageJson_1.getLicense)(emptyFiles);
|
111
|
+
(0, vitest_1.expect)(result).toBe("MIT");
|
112
|
+
});
|
113
|
+
});
|
114
|
+
(0, vitest_1.describe)("Edge cases", () => {
|
115
|
+
(0, vitest_1.it)("should handle malformed library configuration", () => {
|
116
|
+
const malformedFiles = {
|
117
|
+
"package.json": JSON.stringify({
|
118
|
+
dependencies: { d3: "7.0.0" },
|
119
|
+
vizhub: { libraries: { d3: null } },
|
120
|
+
}),
|
121
|
+
};
|
122
|
+
const result = (0, packageJson_1.getConfiguredLibraries)(malformedFiles);
|
123
|
+
(0, vitest_1.expect)(result).toEqual({ d3: null });
|
124
|
+
});
|
125
|
+
(0, vitest_1.it)("should handle empty version strings", () => {
|
126
|
+
const dependency = { name: "react", version: "" };
|
127
|
+
const result = (0, packageJson_1.dependencySource)(dependency, {});
|
128
|
+
(0, vitest_1.expect)(result).toBe("https://cdn.jsdelivr.net/npm/react@");
|
129
|
+
});
|
130
|
+
(0, vitest_1.it)("should handle special characters in dependency names", () => {
|
131
|
+
const specialCharDep = {
|
132
|
+
name: "@angular/core",
|
133
|
+
version: "14.0.0",
|
134
|
+
};
|
135
|
+
const result = (0, packageJson_1.dependencySource)(specialCharDep, {});
|
136
|
+
(0, vitest_1.expect)(result).toBe("https://cdn.jsdelivr.net/npm/@angular/core@14.0.0");
|
137
|
+
});
|
138
|
+
(0, vitest_1.it)("should handle unusual license formats", () => {
|
139
|
+
const unusualLicenseFiles = {
|
140
|
+
"package.json": JSON.stringify({
|
141
|
+
license: { type: "MIT" },
|
142
|
+
}),
|
143
|
+
};
|
144
|
+
const result = (0, packageJson_1.getLicense)(unusualLicenseFiles);
|
145
|
+
(0, vitest_1.expect)(result).toBe("MIT");
|
146
|
+
});
|
147
|
+
});
|
148
|
+
});
|
@@ -0,0 +1,27 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.sucrasePlugin = sucrasePlugin;
|
4
|
+
const sucrase_1 = require("sucrase");
|
5
|
+
function sucrasePlugin() {
|
6
|
+
return {
|
7
|
+
name: "sucrase",
|
8
|
+
transform(code, id) {
|
9
|
+
// Transform .js, .jsx, and .tsx files
|
10
|
+
if (!id.match(/\.(?:js|[jt]sx)$/)) {
|
11
|
+
return null;
|
12
|
+
}
|
13
|
+
const result = (0, sucrase_1.transform)(code, {
|
14
|
+
transforms: ["jsx", "typescript"],
|
15
|
+
filePath: id, // For source maps
|
16
|
+
sourceMapOptions: {
|
17
|
+
compiledFilename: "bundle.js",
|
18
|
+
},
|
19
|
+
production: true,
|
20
|
+
});
|
21
|
+
return {
|
22
|
+
code: result.code,
|
23
|
+
map: result.sourceMap,
|
24
|
+
};
|
25
|
+
},
|
26
|
+
};
|
27
|
+
}
|
@@ -0,0 +1,79 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.virtualFileSystem = void 0;
|
4
|
+
const normalizePath = (filepath) => {
|
5
|
+
// Remove leading ./
|
6
|
+
let normalized = filepath.replace(/^\.\//, "");
|
7
|
+
// Replace multiple slashes with single slash
|
8
|
+
normalized = normalized.replace(/\/+/g, "/");
|
9
|
+
// Remove trailing slash
|
10
|
+
normalized = normalized.replace(/\/$/, "");
|
11
|
+
return normalized;
|
12
|
+
};
|
13
|
+
const joinPaths = (base, relative) => {
|
14
|
+
// Get directory name of base path
|
15
|
+
const baseDir = base.includes("/")
|
16
|
+
? base.slice(0, base.lastIndexOf("/"))
|
17
|
+
: "";
|
18
|
+
// Handle .. by removing one directory level
|
19
|
+
const parts = relative.split("/");
|
20
|
+
const resultParts = baseDir
|
21
|
+
? baseDir.split("/")
|
22
|
+
: [];
|
23
|
+
for (const part of parts) {
|
24
|
+
if (part === "..") {
|
25
|
+
resultParts.pop();
|
26
|
+
}
|
27
|
+
else if (part !== "." && part !== "") {
|
28
|
+
resultParts.push(part);
|
29
|
+
}
|
30
|
+
}
|
31
|
+
return resultParts.join("/");
|
32
|
+
};
|
33
|
+
const virtualFileSystem = (files) => {
|
34
|
+
return {
|
35
|
+
name: "virtual-file-system",
|
36
|
+
resolveId(source, importer) {
|
37
|
+
// Handle relative paths
|
38
|
+
if (source.startsWith("./") ||
|
39
|
+
source.startsWith("../")) {
|
40
|
+
const resolvedPath = importer
|
41
|
+
? normalizePath(joinPaths(importer, source))
|
42
|
+
: normalizePath(source);
|
43
|
+
// Try exact match first
|
44
|
+
if (files[resolvedPath]) {
|
45
|
+
return resolvedPath;
|
46
|
+
}
|
47
|
+
// Try with extensions if no exact match is found
|
48
|
+
const extensions = [".js", ".jsx", ".ts", ".tsx"];
|
49
|
+
for (const ext of extensions) {
|
50
|
+
const pathWithExt = resolvedPath + ext;
|
51
|
+
if (files[pathWithExt]) {
|
52
|
+
return pathWithExt;
|
53
|
+
}
|
54
|
+
}
|
55
|
+
}
|
56
|
+
// Handle bare module imports
|
57
|
+
if (files[source]) {
|
58
|
+
return source;
|
59
|
+
}
|
60
|
+
// Try bare imports with extensions
|
61
|
+
const extensions = [".js", ".jsx", ".ts", ".tsx"];
|
62
|
+
for (const ext of extensions) {
|
63
|
+
const pathWithExt = source + ext;
|
64
|
+
if (files[pathWithExt]) {
|
65
|
+
return pathWithExt;
|
66
|
+
}
|
67
|
+
}
|
68
|
+
return null;
|
69
|
+
},
|
70
|
+
load(id) {
|
71
|
+
// Return the contents if the file exists in our virtual system
|
72
|
+
if (files[id]) {
|
73
|
+
return files[id];
|
74
|
+
}
|
75
|
+
return null;
|
76
|
+
},
|
77
|
+
};
|
78
|
+
};
|
79
|
+
exports.virtualFileSystem = virtualFileSystem;
|
@@ -0,0 +1,26 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.determineRuntimeVersion = void 0;
|
4
|
+
const determineRuntimeVersion = (files) => {
|
5
|
+
if (Object.keys(files).length === 0) {
|
6
|
+
return null;
|
7
|
+
}
|
8
|
+
const hasIndexHTML = "index.html" in files;
|
9
|
+
const hasIndexJS = "index.js" in files;
|
10
|
+
const hasIndexJSX = "index.jsx" in files;
|
11
|
+
if (hasIndexHTML) {
|
12
|
+
const hasModuleScript = files["index.html"].includes('type="module"');
|
13
|
+
if (hasModuleScript) {
|
14
|
+
return "v4";
|
15
|
+
}
|
16
|
+
if (hasIndexJS || hasIndexJSX) {
|
17
|
+
return "v2";
|
18
|
+
}
|
19
|
+
return "v1";
|
20
|
+
}
|
21
|
+
if (!hasIndexHTML && hasIndexJS) {
|
22
|
+
return "v3";
|
23
|
+
}
|
24
|
+
return null;
|
25
|
+
};
|
26
|
+
exports.determineRuntimeVersion = determineRuntimeVersion;
|
@@ -0,0 +1,103 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const vitest_1 = require("vitest");
|
4
|
+
const determineRuntimeVersion_1 = require("./determineRuntimeVersion");
|
5
|
+
const v4_1 = require("./test/fixtures/v4");
|
6
|
+
(0, vitest_1.describe)("determineRuntimeVersion", () => {
|
7
|
+
(0, vitest_1.it)("should return null when there are no files", () => {
|
8
|
+
const mockFiles = {};
|
9
|
+
const result = (0, determineRuntimeVersion_1.determineRuntimeVersion)(mockFiles);
|
10
|
+
(0, vitest_1.expect)(result).toBe(null);
|
11
|
+
});
|
12
|
+
(0, vitest_1.it)("should return v1 when only index.html exists", () => {
|
13
|
+
const mockFiles = {
|
14
|
+
"index.html": "<html></html>",
|
15
|
+
};
|
16
|
+
const result = (0, determineRuntimeVersion_1.determineRuntimeVersion)(mockFiles);
|
17
|
+
(0, vitest_1.expect)(result).toBe("v1");
|
18
|
+
});
|
19
|
+
(0, vitest_1.it)("should return v2 when both index.html and index.js exist", () => {
|
20
|
+
const mockFiles = {
|
21
|
+
"index.html": "<html></html>",
|
22
|
+
"index.js": 'console.log("Hello");',
|
23
|
+
};
|
24
|
+
const result = (0, determineRuntimeVersion_1.determineRuntimeVersion)(mockFiles);
|
25
|
+
(0, vitest_1.expect)(result).toBe("v2");
|
26
|
+
});
|
27
|
+
(0, vitest_1.it)("should return v2 when both index.html and index.jsx exist", () => {
|
28
|
+
const mockFiles = {
|
29
|
+
"index.html": "<html></html>",
|
30
|
+
"index.jsx": 'console.log("Hello");',
|
31
|
+
};
|
32
|
+
const result = (0, determineRuntimeVersion_1.determineRuntimeVersion)(mockFiles);
|
33
|
+
(0, vitest_1.expect)(result).toBe("v2");
|
34
|
+
});
|
35
|
+
(0, vitest_1.it)("should return v3 when only index.js exists", () => {
|
36
|
+
const mockFiles = {
|
37
|
+
"index.js": 'console.log("Hello");',
|
38
|
+
};
|
39
|
+
const result = (0, determineRuntimeVersion_1.determineRuntimeVersion)(mockFiles);
|
40
|
+
(0, vitest_1.expect)(result).toBe("v3");
|
41
|
+
});
|
42
|
+
(0, vitest_1.it)("should return null when only index.jsx exists (no v3 support for JSX)", () => {
|
43
|
+
const mockFiles = {
|
44
|
+
"index.jsx": 'console.log("Hello");',
|
45
|
+
};
|
46
|
+
const result = (0, determineRuntimeVersion_1.determineRuntimeVersion)(mockFiles);
|
47
|
+
(0, vitest_1.expect)(result).toBe(null);
|
48
|
+
});
|
49
|
+
(0, vitest_1.it)("should return v4 when index.html contains script type=module with importmap", () => {
|
50
|
+
const mockFiles = {
|
51
|
+
"index.html": `
|
52
|
+
<!DOCTYPE html>
|
53
|
+
<html>
|
54
|
+
<head>
|
55
|
+
<script type="importmap">
|
56
|
+
{ "imports": { "test": "./test.js" } }
|
57
|
+
</script>
|
58
|
+
</head>
|
59
|
+
<body>
|
60
|
+
<script type="module" src="index.js"></script>
|
61
|
+
</body>
|
62
|
+
</html>
|
63
|
+
`,
|
64
|
+
"index.js": 'import { hello } from "test"; console.log(hello);',
|
65
|
+
"test.js": 'export const hello = "world";',
|
66
|
+
};
|
67
|
+
const result = (0, determineRuntimeVersion_1.determineRuntimeVersion)(mockFiles);
|
68
|
+
(0, vitest_1.expect)(result).toBe("v4");
|
69
|
+
});
|
70
|
+
(0, vitest_1.it)("should return v4 when multiple module scripts are present", () => {
|
71
|
+
const mockFiles = {
|
72
|
+
"index.html": `
|
73
|
+
<!DOCTYPE html>
|
74
|
+
<html>
|
75
|
+
<body>
|
76
|
+
<script type="module" src="index.js"></script>
|
77
|
+
</body>
|
78
|
+
</html>
|
79
|
+
`,
|
80
|
+
"index.js": 'import { hello } from "./utils.js"; console.log(hello);',
|
81
|
+
"utils.js": 'export const hello = "world";',
|
82
|
+
};
|
83
|
+
const result = (0, determineRuntimeVersion_1.determineRuntimeVersion)(mockFiles);
|
84
|
+
(0, vitest_1.expect)(result).toBe("v4");
|
85
|
+
});
|
86
|
+
// Test v4 fixtures
|
87
|
+
(0, vitest_1.it)("should detect v4 for jsScriptTagTypeModule fixture", () => {
|
88
|
+
const result = (0, determineRuntimeVersion_1.determineRuntimeVersion)(v4_1.jsScriptTagTypeModule);
|
89
|
+
(0, vitest_1.expect)(result).toBe("v4");
|
90
|
+
});
|
91
|
+
(0, vitest_1.it)("should detect v4 for jsScriptTagTypeModules fixture", () => {
|
92
|
+
const result = (0, determineRuntimeVersion_1.determineRuntimeVersion)(v4_1.jsScriptTagTypeModules);
|
93
|
+
(0, vitest_1.expect)(result).toBe("v4");
|
94
|
+
});
|
95
|
+
(0, vitest_1.it)("should detect v4 for fetchInterception fixture", () => {
|
96
|
+
const result = (0, determineRuntimeVersion_1.determineRuntimeVersion)(v4_1.fetchInterception);
|
97
|
+
(0, vitest_1.expect)(result).toBe("v4");
|
98
|
+
});
|
99
|
+
(0, vitest_1.it)("should detect v4 for esmBuild fixture", () => {
|
100
|
+
const result = (0, determineRuntimeVersion_1.determineRuntimeVersion)(v4_1.esmBuild);
|
101
|
+
(0, vitest_1.expect)(result).toBe("v4");
|
102
|
+
});
|
103
|
+
});
|
@@ -0,0 +1,9 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.createSlugCache = exports.createVizCache = exports.buildHTML = void 0;
|
4
|
+
var buildHTML_js_1 = require("./buildHTML.js");
|
5
|
+
Object.defineProperty(exports, "buildHTML", { enumerable: true, get: function () { return buildHTML_js_1.buildHTML; } });
|
6
|
+
var vizCache_js_1 = require("./v3/vizCache.js");
|
7
|
+
Object.defineProperty(exports, "createVizCache", { enumerable: true, get: function () { return vizCache_js_1.createVizCache; } });
|
8
|
+
var slugCache_js_1 = require("./v3/slugCache.js");
|
9
|
+
Object.defineProperty(exports, "createSlugCache", { enumerable: true, get: function () { return slugCache_js_1.createSlugCache; } });
|
@@ -0,0 +1 @@
|
|
1
|
+
{"type":"commonjs"}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.basicHTML = void 0;
|
4
|
+
exports.basicHTML = {
|
5
|
+
"index.html": `<!DOCTYPE html>
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>My HTML Document</title>
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
<h1>Hello, World!</h1>
|
12
|
+
<p>This is my first HTML document.</p>
|
13
|
+
<script>
|
14
|
+
console.log('Hello, World!');
|
15
|
+
</script>
|
16
|
+
</body>
|
17
|
+
</html>`,
|
18
|
+
};
|
@@ -0,0 +1,15 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.fetchProxy = void 0;
|
4
|
+
exports.fetchProxy = {
|
5
|
+
"index.html": `<!DOCTYPE html>
|
6
|
+
<html>
|
7
|
+
<body>
|
8
|
+
<script src="index.js"></script>
|
9
|
+
</body>
|
10
|
+
</html>`,
|
11
|
+
"index.js": `fetch("data.csv")
|
12
|
+
.then((response) => response.text())
|
13
|
+
.then(console.log);`,
|
14
|
+
"data.csv": `Hello, Fetch!`,
|
15
|
+
};
|
@@ -0,0 +1,15 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.protocolTest = exports.xmlTest = exports.styleTest = exports.fetchProxy = exports.jsScriptTag = exports.basicHTML = void 0;
|
4
|
+
var basicHTML_1 = require("./basicHTML");
|
5
|
+
Object.defineProperty(exports, "basicHTML", { enumerable: true, get: function () { return basicHTML_1.basicHTML; } });
|
6
|
+
var jsScriptTag_1 = require("./jsScriptTag");
|
7
|
+
Object.defineProperty(exports, "jsScriptTag", { enumerable: true, get: function () { return jsScriptTag_1.jsScriptTag; } });
|
8
|
+
var fetchProxy_1 = require("./fetchProxy");
|
9
|
+
Object.defineProperty(exports, "fetchProxy", { enumerable: true, get: function () { return fetchProxy_1.fetchProxy; } });
|
10
|
+
var styleTest_1 = require("./styleTest");
|
11
|
+
Object.defineProperty(exports, "styleTest", { enumerable: true, get: function () { return styleTest_1.styleTest; } });
|
12
|
+
var xmlTest_1 = require("./xmlTest");
|
13
|
+
Object.defineProperty(exports, "xmlTest", { enumerable: true, get: function () { return xmlTest_1.xmlTest; } });
|
14
|
+
var protocolTest_1 = require("./protocolTest");
|
15
|
+
Object.defineProperty(exports, "protocolTest", { enumerable: true, get: function () { return protocolTest_1.protocolTest; } });
|
@@ -0,0 +1,12 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.jsScriptTag = void 0;
|
4
|
+
exports.jsScriptTag = {
|
5
|
+
"index.html": `<!DOCTYPE html>
|
6
|
+
<html>
|
7
|
+
<body>
|
8
|
+
<script src="index.js"></script>
|
9
|
+
</body>
|
10
|
+
</html>`,
|
11
|
+
"index.js": `console.log('Hello, JS!');`,
|
12
|
+
};
|
@@ -0,0 +1,18 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.protocolTest = void 0;
|
4
|
+
exports.protocolTest = {
|
5
|
+
"index.html": `<!DOCTYPE html>
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<link href="//fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
|
9
|
+
<script src="//code.jquery.com/jquery-3.6.0.min.js"></script>
|
10
|
+
</head>
|
11
|
+
<body>
|
12
|
+
<div>Protocol Test</div>
|
13
|
+
<script>
|
14
|
+
console.log('Protocol test loaded');
|
15
|
+
</script>
|
16
|
+
</body>
|
17
|
+
</html>`,
|
18
|
+
};
|
@@ -0,0 +1,18 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.styleTest = void 0;
|
4
|
+
exports.styleTest = {
|
5
|
+
"index.html": `<!DOCTYPE html>
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<link rel="stylesheet" href="styles.css">
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
<div id="test">Test</div>
|
12
|
+
<script>
|
13
|
+
console.log(window.getComputedStyle(document.getElementById('test')).color);
|
14
|
+
</script>
|
15
|
+
</body>
|
16
|
+
</html>`,
|
17
|
+
"styles.css": `#test { color: rgb(255, 0, 0); }`,
|
18
|
+
};
|