@vizhub/runtime 0.1.4 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +376 -178
- package/dist/buildHTML.d.ts +14 -0
- package/dist/buildHTML.js +67 -0
- package/dist/common/packageJson.d.ts +39 -0
- package/dist/common/packageJson.js +71 -0
- package/dist/common/packageJson.test.d.ts +1 -0
- package/dist/common/packageJson.test.js +146 -0
- package/dist/common/sucrasePlugin.d.ts +2 -0
- package/dist/common/sucrasePlugin.js +24 -0
- package/dist/common/virtualFileSystem.d.ts +3 -0
- package/dist/common/virtualFileSystem.js +75 -0
- package/dist/determineRuntimeVersion.d.ts +3 -0
- package/dist/determineRuntimeVersion.js +22 -0
- package/dist/determineRuntimeVersion.test.d.ts +1 -0
- package/dist/determineRuntimeVersion.test.js +101 -0
- package/dist/fixtures/basicHTML.d.ts +2 -0
- package/dist/fixtures/basicHTML.js +22 -0
- package/dist/fixtures/fetchProxy.d.ts +2 -0
- package/dist/fixtures/fetchProxy.js +25 -0
- package/dist/fixtures/index.d.ts +3 -0
- package/dist/fixtures/index.js +9 -0
- package/dist/fixtures/jsScriptTag.d.ts +2 -0
- package/dist/fixtures/jsScriptTag.js +19 -0
- package/dist/index.d.ts +3 -8
- package/dist/index.js +3 -24890
- package/dist/index.test.d.ts +1 -0
- package/dist/index.test.js +50 -0
- package/dist/magicSandbox/fixProtocollessUrls.d.ts +4 -0
- package/dist/magicSandbox/fixProtocollessUrls.js +10 -0
- package/dist/magicSandbox/generateInterceptorScript.d.ts +4 -0
- package/dist/magicSandbox/generateInterceptorScript.js +178 -0
- package/dist/magicSandbox/index.d.ts +19 -0
- package/dist/magicSandbox/index.js +48 -0
- package/dist/test/fixtures/basicHTML.d.ts +2 -0
- package/dist/test/fixtures/basicHTML.js +19 -0
- package/dist/test/fixtures/fetchProxy.d.ts +2 -0
- package/dist/test/fixtures/fetchProxy.js +22 -0
- package/dist/test/fixtures/index.d.ts +6 -0
- package/dist/test/fixtures/index.js +6 -0
- package/dist/test/fixtures/jsScriptTag.d.ts +2 -0
- package/dist/test/fixtures/jsScriptTag.js +16 -0
- package/dist/test/fixtures/magicSandbox/basicHTML.d.ts +5 -0
- package/dist/test/fixtures/magicSandbox/basicHTML.js +17 -0
- package/dist/test/fixtures/magicSandbox/fetchProxy.d.ts +11 -0
- package/dist/test/fixtures/magicSandbox/fetchProxy.js +18 -0
- package/dist/test/fixtures/magicSandbox/index.d.ts +6 -0
- package/dist/test/fixtures/magicSandbox/index.js +6 -0
- package/dist/test/fixtures/magicSandbox/jsScriptTag.d.ts +8 -0
- package/dist/test/fixtures/magicSandbox/jsScriptTag.js +13 -0
- package/dist/test/fixtures/magicSandbox/protocolTest.d.ts +5 -0
- package/dist/test/fixtures/magicSandbox/protocolTest.js +17 -0
- package/dist/test/fixtures/magicSandbox/styleTest.d.ts +8 -0
- package/dist/test/fixtures/magicSandbox/styleTest.js +19 -0
- package/dist/test/fixtures/magicSandbox/xmlTest.d.ts +8 -0
- package/dist/test/fixtures/magicSandbox/xmlTest.js +23 -0
- package/dist/test/fixtures/protocolTest.d.ts +2 -0
- package/dist/test/fixtures/protocolTest.js +19 -0
- package/dist/test/fixtures/styleTest.d.ts +2 -0
- package/dist/test/fixtures/styleTest.js +22 -0
- package/dist/test/fixtures/v1/basicHTML.d.ts +3 -0
- package/dist/test/fixtures/v1/basicHTML.js +15 -0
- package/dist/test/fixtures/v1/fetchProxy.d.ts +5 -0
- package/dist/test/fixtures/v1/fetchProxy.js +12 -0
- package/dist/test/fixtures/v1/index.d.ts +6 -0
- package/dist/test/fixtures/v1/index.js +6 -0
- package/dist/test/fixtures/v1/jsScriptTag.d.ts +4 -0
- package/dist/test/fixtures/v1/jsScriptTag.js +9 -0
- package/dist/test/fixtures/v1/protocolTest.d.ts +3 -0
- package/dist/test/fixtures/v1/protocolTest.js +15 -0
- package/dist/test/fixtures/v1/styleTest.d.ts +4 -0
- package/dist/test/fixtures/v1/styleTest.js +15 -0
- package/dist/test/fixtures/v1/xmlTest.d.ts +4 -0
- package/dist/test/fixtures/v1/xmlTest.js +19 -0
- package/dist/test/fixtures/v2/basicBundle.d.ts +5 -0
- package/dist/test/fixtures/v2/basicBundle.js +5 -0
- package/dist/test/fixtures/v2/basicBundleNoExtension.d.ts +5 -0
- package/dist/test/fixtures/v2/basicBundleNoExtension.js +5 -0
- package/dist/test/fixtures/v2/d3Import.d.ts +4 -0
- package/dist/test/fixtures/v2/d3Import.js +7 -0
- package/dist/test/fixtures/v2/d3ImportPkg.d.ts +5 -0
- package/dist/test/fixtures/v2/d3ImportPkg.js +19 -0
- package/dist/test/fixtures/v2/d3RosettaImportPkg.d.ts +5 -0
- package/dist/test/fixtures/v2/d3RosettaImportPkg.js +19 -0
- package/dist/test/fixtures/v2/es6Preserve.d.ts +4 -0
- package/dist/test/fixtures/v2/es6Preserve.js +6 -0
- package/dist/test/fixtures/v2/generatorSupport.d.ts +4 -0
- package/dist/test/fixtures/v2/generatorSupport.js +6 -0
- package/dist/test/fixtures/v2/index.d.ts +14 -0
- package/dist/test/fixtures/v2/index.js +15 -0
- package/dist/test/fixtures/v2/jsxTranspile.d.ts +4 -0
- package/dist/test/fixtures/v2/jsxTranspile.js +6 -0
- package/dist/test/fixtures/v2/reactDomImport.d.ts +4 -0
- package/dist/test/fixtures/v2/reactDomImport.js +8 -0
- package/dist/test/fixtures/v2/reactDomImportPkg.d.ts +5 -0
- package/dist/test/fixtures/v2/reactDomImportPkg.js +24 -0
- package/dist/test/fixtures/v2/reactImport.d.ts +4 -0
- package/dist/test/fixtures/v2/reactImport.js +7 -0
- package/dist/test/fixtures/v2/reactImportPkg.d.ts +5 -0
- package/dist/test/fixtures/v2/reactImportPkg.js +17 -0
- package/dist/test/fixtures/v2/sourceMapErrorFixture.d.ts +5 -0
- package/dist/test/fixtures/v2/sourceMapErrorFixture.js +19 -0
- package/dist/test/fixtures/v2/unicodeSupport.d.ts +4 -0
- package/dist/test/fixtures/v2/unicodeSupport.js +6 -0
- package/dist/test/fixtures/v3/basicIndexJS.d.ts +3 -0
- package/dist/test/fixtures/v3/basicIndexJS.js +7 -0
- package/dist/test/fixtures/v3/cssImport.d.ts +4 -0
- package/dist/test/fixtures/v3/cssImport.js +9 -0
- package/dist/test/fixtures/v3/csvImport.d.ts +4 -0
- package/dist/test/fixtures/v3/csvImport.js +11 -0
- package/dist/test/fixtures/v3/csvStrangeChars.d.ts +4 -0
- package/dist/test/fixtures/v3/csvStrangeChars.js +12 -0
- package/dist/test/fixtures/v3/index.d.ts +9 -0
- package/dist/test/fixtures/v3/index.js +9 -0
- package/dist/test/fixtures/v3/jsExport.d.ts +4 -0
- package/dist/test/fixtures/v3/jsExport.js +10 -0
- package/dist/test/fixtures/v3/sourcemap.d.ts +3 -0
- package/dist/test/fixtures/v3/sourcemap.js +10 -0
- package/dist/test/fixtures/v3/svelte.d.ts +4 -0
- package/dist/test/fixtures/v3/svelte.js +18 -0
- package/dist/test/fixtures/v3/vizContent.d.ts +2 -0
- package/dist/test/fixtures/v3/vizContent.js +11 -0
- package/dist/test/fixtures/v3/vizImport.d.ts +6 -0
- package/dist/test/fixtures/v3/vizImport.js +85 -0
- package/dist/test/fixtures/v4/d3Usage.d.ts +5 -0
- package/dist/test/fixtures/v4/d3Usage.js +31 -0
- package/dist/test/fixtures/v4/esmBuild.d.ts +5 -0
- package/dist/test/fixtures/v4/esmBuild.js +18 -0
- package/dist/test/fixtures/v4/fetchInterception.d.ts +5 -0
- package/dist/test/fixtures/v4/fetchInterception.js +18 -0
- package/dist/test/fixtures/v4/index.d.ts +9 -0
- package/dist/test/fixtures/v4/index.js +9 -0
- package/dist/test/fixtures/v4/jsScriptTagTypeModule.d.ts +4 -0
- package/dist/test/fixtures/v4/jsScriptTagTypeModule.js +18 -0
- package/dist/test/fixtures/v4/jsScriptTagTypeModules.d.ts +5 -0
- package/dist/test/fixtures/v4/jsScriptTagTypeModules.js +12 -0
- package/dist/test/fixtures/v4/reactHooks.d.ts +6 -0
- package/dist/test/fixtures/v4/reactHooks.js +47 -0
- package/dist/test/fixtures/v4/reactJsx.d.ts +6 -0
- package/dist/test/fixtures/v4/reactJsx.js +34 -0
- package/dist/test/fixtures/v4/threeJsUsage.d.ts +4 -0
- package/dist/test/fixtures/v4/threeJsUsage.js +24 -0
- package/dist/test/fixtures/v4/typeScriptSupport.d.ts +5 -0
- package/dist/test/fixtures/v4/typeScriptSupport.js +29 -0
- package/dist/test/fixtures/xmlTest.d.ts +2 -0
- package/dist/test/fixtures/xmlTest.js +26 -0
- package/dist/test/index.test.d.ts +1 -0
- package/dist/test/index.test.js +40 -0
- package/dist/test/testInBrowser.d.ts +15 -0
- package/dist/test/testInBrowser.js +47 -0
- package/dist/test/testStackTrace.d.ts +9 -0
- package/dist/test/testStackTrace.js +55 -0
- package/dist/test/v1.test.d.ts +1 -0
- package/dist/test/v1.test.js +65 -0
- package/dist/test/v2.test.d.ts +1 -0
- package/dist/test/v2.test.js +121 -0
- package/dist/test/v3.test.d.ts +1 -0
- package/dist/test/v3.test.js +114 -0
- package/dist/test/v4.test.d.ts +1 -0
- package/dist/test/v4.test.js +100 -0
- package/dist/types.d.ts +1 -0
- package/dist/types.js +1 -0
- package/dist/utils/getFileText.d.ts +2 -0
- package/dist/utils/getFileText.js +13 -0
- package/dist/utils/getFileText.test.d.ts +1 -0
- package/dist/utils/getFileText.test.js +72 -0
- package/dist/utils/vizContentToFileCollection.d.ts +7 -0
- package/dist/utils/vizContentToFileCollection.js +19 -0
- package/dist/utils/vizContentToFileCollection.test.d.ts +1 -0
- package/dist/utils/vizContentToFileCollection.test.js +75 -0
- package/dist/v2/computeBundleJSV2.d.ts +7 -0
- package/dist/v2/computeBundleJSV2.js +29 -0
- package/dist/v2/getComputedIndexHtml.d.ts +4 -0
- package/dist/v2/getComputedIndexHtml.js +81 -0
- package/dist/v2/getComputedIndexHtml.test.d.ts +1 -0
- package/dist/v2/getComputedIndexHtml.test.js +134 -0
- package/dist/v2/index.d.ts +1 -0
- package/dist/v2/index.js +1 -0
- package/dist/v2/v2Build.d.ts +7 -0
- package/dist/v2/v2Build.js +11 -0
- package/dist/{v3Runtime → v3}/cleanRollupErrorMessage.d.ts +0 -1
- package/dist/v3/cleanRollupErrorMessage.js +9 -0
- package/dist/v3/computeBundleJSV3.d.ts +17 -0
- package/dist/v3/computeBundleJSV3.js +48 -0
- package/dist/v3/createVizContent.d.ts +8 -0
- package/dist/v3/createVizContent.js +23 -0
- package/dist/{v3Runtime → v3}/extractVizImport.d.ts +2 -3
- package/dist/v3/extractVizImport.js +23 -0
- package/dist/v3/extractVizImport.test.d.ts +1 -0
- package/dist/v3/extractVizImport.test.js +30 -0
- package/dist/v3/htmlTemplate.d.ts +5 -0
- package/dist/v3/htmlTemplate.js +89 -0
- package/dist/v3/index.d.ts +1 -0
- package/dist/v3/index.js +1 -0
- package/dist/v3/parseId.d.ts +6 -0
- package/dist/v3/parseId.js +5 -0
- package/dist/v3/parseId.test.d.ts +1 -0
- package/dist/v3/parseId.test.js +25 -0
- package/dist/{v3Runtime → v3}/setupV3Runtime.d.ts +5 -5
- package/dist/v3/setupV3Runtime.js +341 -0
- package/dist/v3/slugCache.d.ts +11 -0
- package/dist/v3/slugCache.js +35 -0
- package/dist/v3/slugCache.test.d.ts +1 -0
- package/dist/v3/slugCache.test.js +105 -0
- package/dist/v3/transformDSV/dsvParseSrc.d.ts +1 -0
- package/dist/v3/transformDSV/dsvParseSrc.js +121 -0
- package/dist/v3/transformDSV/index.d.ts +2 -0
- package/dist/v3/transformDSV/index.js +40 -0
- package/dist/{v3Runtime → v3}/transformSvelte.d.ts +4 -2
- package/dist/v3/transformSvelte.js +77 -0
- package/dist/{v3Runtime → v3}/types.d.ts +18 -18
- package/dist/v3/types.js +1 -0
- package/dist/v3/v3Build.d.ts +14 -0
- package/dist/v3/v3Build.js +30 -0
- package/dist/v3/vizCache.d.ts +10 -0
- package/dist/v3/vizCache.js +36 -0
- package/dist/v3/vizCache.test.d.ts +1 -0
- package/dist/v3/vizCache.test.js +98 -0
- package/dist/{v3Runtime → v3}/vizLoad.d.ts +3 -4
- package/dist/v3/vizLoad.js +46 -0
- package/dist/v3/vizResolve.d.ts +7 -0
- package/dist/v3/vizResolve.js +69 -0
- package/dist/v4/index.d.ts +10 -0
- package/dist/v4/index.js +134 -0
- package/package.json +37 -38
- package/dist/assets/setupV3Runtime-BVr5lyKp.js +0 -240
- package/dist/computeSrcDoc.d.ts +0 -13
- package/dist/computeSrcDoc.d.ts.map +0 -1
- package/dist/computeSrcDoc.test.d.ts +0 -2
- package/dist/computeSrcDoc.test.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/useRuntime.d.ts +0 -13
- package/dist/useRuntime.d.ts.map +0 -1
- package/dist/v2Runtime/bundle/bubleJSXOnly.d.ts +0 -5
- package/dist/v2Runtime/bundle/bubleJSXOnly.d.ts.map +0 -1
- package/dist/v2Runtime/bundle/packageJson.d.ts +0 -10
- package/dist/v2Runtime/bundle/packageJson.d.ts.map +0 -1
- package/dist/v2Runtime/computeSrcDocV2.d.ts +0 -3
- package/dist/v2Runtime/computeSrcDocV2.d.ts.map +0 -1
- package/dist/v2Runtime/computeSrcDocV2.test.d.ts +0 -2
- package/dist/v2Runtime/computeSrcDocV2.test.d.ts.map +0 -1
- package/dist/v2Runtime/getComputedIndexHtml.d.ts +0 -4
- package/dist/v2Runtime/getComputedIndexHtml.d.ts.map +0 -1
- package/dist/v2Runtime/getComputedIndexHtml.test.d.ts +0 -2
- package/dist/v2Runtime/getComputedIndexHtml.test.d.ts.map +0 -1
- package/dist/v2Runtime/getText.d.ts +0 -3
- package/dist/v2Runtime/getText.d.ts.map +0 -1
- package/dist/v2Runtime/transformFiles.d.ts +0 -3
- package/dist/v2Runtime/transformFiles.d.ts.map +0 -1
- package/dist/v2Runtime/v3FilesToV2Files.d.ts +0 -3
- package/dist/v2Runtime/v3FilesToV2Files.d.ts.map +0 -1
- package/dist/v2Runtime/v3FilesToV2Files.test.d.ts +0 -2
- package/dist/v2Runtime/v3FilesToV2Files.test.d.ts.map +0 -1
- package/dist/v3Runtime/build.d.ts +0 -14
- package/dist/v3Runtime/build.d.ts.map +0 -1
- package/dist/v3Runtime/build.test.d.ts +0 -2
- package/dist/v3Runtime/build.test.d.ts.map +0 -1
- package/dist/v3Runtime/cleanRollupErrorMessage.d.ts.map +0 -1
- package/dist/v3Runtime/computeSrcDocV3.d.ts +0 -7
- package/dist/v3Runtime/computeSrcDocV3.d.ts.map +0 -1
- package/dist/v3Runtime/extractVizImport.d.ts.map +0 -1
- package/dist/v3Runtime/extractVizImport.test.d.ts +0 -2
- package/dist/v3Runtime/extractVizImport.test.d.ts.map +0 -1
- package/dist/v3Runtime/generateRollupErrorMessage.d.ts +0 -5
- package/dist/v3Runtime/generateRollupErrorMessage.d.ts.map +0 -1
- package/dist/v3Runtime/importFromViz.d.ts +0 -1
- package/dist/v3Runtime/importFromViz.d.ts.map +0 -1
- package/dist/v3Runtime/index.d.ts +0 -2
- package/dist/v3Runtime/index.d.ts.map +0 -1
- package/dist/v3Runtime/parseId.d.ts +0 -7
- package/dist/v3Runtime/parseId.d.ts.map +0 -1
- package/dist/v3Runtime/setupV3Runtime.d.ts.map +0 -1
- package/dist/v3Runtime/transformDSV/index.d.ts +0 -3
- package/dist/v3Runtime/transformDSV/index.d.ts.map +0 -1
- package/dist/v3Runtime/transformSvelte.d.ts.map +0 -1
- package/dist/v3Runtime/types.d.ts.map +0 -1
- package/dist/v3Runtime/urlLoad.d.ts +0 -1
- package/dist/v3Runtime/urlLoad.d.ts.map +0 -1
- package/dist/v3Runtime/virtual.d.ts +0 -1
- package/dist/v3Runtime/virtual.d.ts.map +0 -1
- package/dist/v3Runtime/vizCache.d.ts +0 -11
- package/dist/v3Runtime/vizCache.d.ts.map +0 -1
- package/dist/v3Runtime/vizCache.test.d.ts +0 -2
- package/dist/v3Runtime/vizCache.test.d.ts.map +0 -1
- package/dist/v3Runtime/vizLoad.d.ts.map +0 -1
- package/dist/v3Runtime/vizLoadSvelte.d.ts +0 -1
- package/dist/v3Runtime/vizLoadSvelte.d.ts.map +0 -1
- package/dist/v3Runtime/vizResolve.d.ts +0 -10
- package/dist/v3Runtime/vizResolve.d.ts.map +0 -1
- package/dist/v3Runtime/worker.d.ts +0 -2
- package/dist/v3Runtime/worker.d.ts.map +0 -1
@@ -0,0 +1,65 @@
|
|
1
|
+
import puppeteer from "puppeteer";
|
2
|
+
import { describe, it, expect, beforeAll, afterAll, } from "vitest";
|
3
|
+
import { buildHTML } from "../index";
|
4
|
+
import { testInBrowser } from "./testInBrowser";
|
5
|
+
import { basicHTML, fetchProxy, jsScriptTag, styleTest, xmlTest, protocolTest, } from "./fixtures/v1";
|
6
|
+
import { setJSDOM } from "../v2/getComputedIndexHtml";
|
7
|
+
import { JSDOM } from "jsdom";
|
8
|
+
setJSDOM(JSDOM);
|
9
|
+
let browser;
|
10
|
+
beforeAll(async () => {
|
11
|
+
browser = await puppeteer.launch();
|
12
|
+
});
|
13
|
+
afterAll(async () => {
|
14
|
+
await browser.close();
|
15
|
+
});
|
16
|
+
describe("VizHub Runtime v1", () => {
|
17
|
+
it("should generate srcdoc HTML", async () => {
|
18
|
+
const srcdoc = await buildHTML({
|
19
|
+
files: basicHTML,
|
20
|
+
});
|
21
|
+
expect(srcdoc).toContain("<!DOCTYPE html>");
|
22
|
+
expect(srcdoc).toContain("<title>My HTML Document</title>");
|
23
|
+
expect(srcdoc).toContain("Hello, World!");
|
24
|
+
});
|
25
|
+
it("basicHTML", async () => {
|
26
|
+
await testInBrowser({
|
27
|
+
browser,
|
28
|
+
files: basicHTML,
|
29
|
+
expectedLog: "Hello, World!",
|
30
|
+
});
|
31
|
+
});
|
32
|
+
it("jsScriptTag", async () => {
|
33
|
+
await testInBrowser({
|
34
|
+
browser,
|
35
|
+
files: jsScriptTag,
|
36
|
+
expectedLog: "Hello, JS!",
|
37
|
+
});
|
38
|
+
});
|
39
|
+
it("fetchProxy", async () => {
|
40
|
+
await testInBrowser({
|
41
|
+
browser,
|
42
|
+
files: fetchProxy,
|
43
|
+
expectedLog: "Hello, Fetch!",
|
44
|
+
});
|
45
|
+
});
|
46
|
+
it("should handle CSS file loading", async () => {
|
47
|
+
await testInBrowser({
|
48
|
+
browser,
|
49
|
+
files: styleTest,
|
50
|
+
expectedLog: "rgb(255, 0, 0)",
|
51
|
+
});
|
52
|
+
});
|
53
|
+
it("should handle XML file loading", async () => {
|
54
|
+
await testInBrowser({
|
55
|
+
browser,
|
56
|
+
files: xmlTest,
|
57
|
+
expectedLog: "root",
|
58
|
+
});
|
59
|
+
});
|
60
|
+
it("should convert protocol-less URLs to https", async () => {
|
61
|
+
const srcdoc = await buildHTML({ files: protocolTest });
|
62
|
+
expect(srcdoc).toContain('href="https://fonts.googleapis.com');
|
63
|
+
expect(srcdoc).toContain('src="https://code.jquery.com');
|
64
|
+
});
|
65
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,121 @@
|
|
1
|
+
import puppeteer from "puppeteer";
|
2
|
+
import { rollup } from "rollup";
|
3
|
+
import { describe, it, expect, beforeAll, afterAll, } from "vitest";
|
4
|
+
import { buildHTML } from "../index";
|
5
|
+
import { testInBrowser } from "./testInBrowser";
|
6
|
+
import { basicBundle, d3Import, d3ImportPkg, reactImport, reactImportPkg, reactDomImport, reactDomImportPkg, jsxTranspile, es6Preserve, generatorSupport, unicodeSupport, d3RosettaImportPkg, basicBundleNoExtension,
|
7
|
+
// sourceMapErrorFixture,
|
8
|
+
} from "./fixtures/v2";
|
9
|
+
import { setJSDOM } from "../v2/getComputedIndexHtml";
|
10
|
+
import { JSDOM } from "jsdom";
|
11
|
+
setJSDOM(JSDOM);
|
12
|
+
let browser;
|
13
|
+
beforeAll(async () => {
|
14
|
+
browser = await puppeteer.launch();
|
15
|
+
});
|
16
|
+
afterAll(async () => {
|
17
|
+
await browser.close();
|
18
|
+
});
|
19
|
+
describe("VizHub Runtime v2", () => {
|
20
|
+
it("should bundle basic imports", async () => {
|
21
|
+
await testInBrowser({
|
22
|
+
browser,
|
23
|
+
files: basicBundle,
|
24
|
+
expectedLog: "bar",
|
25
|
+
});
|
26
|
+
});
|
27
|
+
it("should bundle basic imports missing .js extension", async () => {
|
28
|
+
await testInBrowser({
|
29
|
+
browser,
|
30
|
+
files: basicBundleNoExtension,
|
31
|
+
expectedLog: "bar",
|
32
|
+
});
|
33
|
+
});
|
34
|
+
it("should support d3 imports", async () => {
|
35
|
+
await testInBrowser({
|
36
|
+
browser,
|
37
|
+
files: d3Import,
|
38
|
+
expectedLog: "function",
|
39
|
+
});
|
40
|
+
});
|
41
|
+
it("should support d3 imports from packages", async () => {
|
42
|
+
await testInBrowser({
|
43
|
+
browser,
|
44
|
+
files: d3ImportPkg,
|
45
|
+
expectedLog: "function",
|
46
|
+
});
|
47
|
+
});
|
48
|
+
it("should support React imports", async () => {
|
49
|
+
await testInBrowser({
|
50
|
+
browser,
|
51
|
+
files: reactImport,
|
52
|
+
expectedLog: "object",
|
53
|
+
});
|
54
|
+
});
|
55
|
+
it("should support React imports from packages", async () => {
|
56
|
+
await testInBrowser({
|
57
|
+
browser,
|
58
|
+
files: reactImportPkg,
|
59
|
+
expectedLog: "object",
|
60
|
+
});
|
61
|
+
});
|
62
|
+
it("should support ReactDOM imports", async () => {
|
63
|
+
await testInBrowser({
|
64
|
+
browser,
|
65
|
+
files: reactDomImport,
|
66
|
+
expectedLog: "object",
|
67
|
+
});
|
68
|
+
});
|
69
|
+
it("should support ReactDOM imports from packages", async () => {
|
70
|
+
await testInBrowser({
|
71
|
+
browser,
|
72
|
+
files: reactDomImportPkg,
|
73
|
+
expectedLog: "object",
|
74
|
+
});
|
75
|
+
});
|
76
|
+
it("should transpile JSX", async () => {
|
77
|
+
const srcdoc = await buildHTML({
|
78
|
+
files: jsxTranspile,
|
79
|
+
rollup,
|
80
|
+
});
|
81
|
+
expect(srcdoc).toContain("React.createElement");
|
82
|
+
});
|
83
|
+
it("should preserve ES6 syntax", async () => {
|
84
|
+
await testInBrowser({
|
85
|
+
browser,
|
86
|
+
files: es6Preserve,
|
87
|
+
expectedLog: "16", // 4 * 4 = 16
|
88
|
+
});
|
89
|
+
});
|
90
|
+
it("should support generator functions", async () => {
|
91
|
+
await testInBrowser({
|
92
|
+
browser,
|
93
|
+
files: generatorSupport,
|
94
|
+
expectedLog: "5",
|
95
|
+
});
|
96
|
+
});
|
97
|
+
it("should support unicode characters", async () => {
|
98
|
+
await testInBrowser({
|
99
|
+
browser,
|
100
|
+
files: unicodeSupport,
|
101
|
+
expectedLog: "Привет",
|
102
|
+
});
|
103
|
+
});
|
104
|
+
it("should handle globals config for arbitrary package d3-rosetta", async () => {
|
105
|
+
await testInBrowser({
|
106
|
+
browser,
|
107
|
+
files: d3RosettaImportPkg,
|
108
|
+
expectedLog: "function",
|
109
|
+
});
|
110
|
+
});
|
111
|
+
// it("should handle CSS imports", async () => {
|
112
|
+
// TODO: Add test for CSS imports
|
113
|
+
// });
|
114
|
+
// TODO get this working
|
115
|
+
// it("should provide sourcemaps with correct line numbers in stack traces", async () => {
|
116
|
+
// await testStackTrace(browser, sourceMapErrorFixture, {
|
117
|
+
// sourceFile: "error.js", // Note: The actual filename may not appear in stack traces
|
118
|
+
// sourceLine: 3,
|
119
|
+
// });
|
120
|
+
// });
|
121
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,114 @@
|
|
1
|
+
import puppeteer from "puppeteer";
|
2
|
+
import { describe, it, beforeAll, afterAll } from "vitest";
|
3
|
+
import { compile } from "svelte/compiler";
|
4
|
+
import { testInBrowser } from "./testInBrowser";
|
5
|
+
import { basicIndexJS, jsExport, cssImport, csvImport, csvStrangeChars, svelte, sampleContent, sampleContentVizImport, sampleContentVizImportSlug, sampleContentWithCSS, sampleContentVizImportWithCSS, sourcemap, } from "./fixtures/v3";
|
6
|
+
import { setJSDOM } from "../v2/getComputedIndexHtml";
|
7
|
+
import { JSDOM } from "jsdom";
|
8
|
+
import { createVizCache } from "../v3/vizCache";
|
9
|
+
import { createSlugCache } from "../v3/slugCache";
|
10
|
+
import { testStackTrace } from "./testStackTrace";
|
11
|
+
setJSDOM(JSDOM);
|
12
|
+
let browser;
|
13
|
+
beforeAll(async () => {
|
14
|
+
browser = await puppeteer.launch();
|
15
|
+
});
|
16
|
+
afterAll(async () => {
|
17
|
+
await browser.close();
|
18
|
+
});
|
19
|
+
describe("VizHub Runtime v3", () => {
|
20
|
+
it("should run main without index.html", async () => {
|
21
|
+
await testInBrowser({
|
22
|
+
browser,
|
23
|
+
files: basicIndexJS,
|
24
|
+
expectedLog: "Hello main!",
|
25
|
+
});
|
26
|
+
});
|
27
|
+
it("should handle JS exports", async () => {
|
28
|
+
await testInBrowser({
|
29
|
+
browser,
|
30
|
+
files: jsExport,
|
31
|
+
expectedLog: "Outer Inner",
|
32
|
+
});
|
33
|
+
});
|
34
|
+
it("should handle CSS imports", async () => {
|
35
|
+
await testInBrowser({
|
36
|
+
browser,
|
37
|
+
files: cssImport,
|
38
|
+
expectedLog: "rgb(255, 0, 0)",
|
39
|
+
});
|
40
|
+
});
|
41
|
+
it("should handle CSV imports", async () => {
|
42
|
+
await testInBrowser({
|
43
|
+
browser,
|
44
|
+
files: csvImport,
|
45
|
+
expectedLog: "Setosa",
|
46
|
+
});
|
47
|
+
});
|
48
|
+
it("should handle CSV with strange characters", async () => {
|
49
|
+
await testInBrowser({
|
50
|
+
browser,
|
51
|
+
files: csvStrangeChars,
|
52
|
+
expectedLog: "Türkiye",
|
53
|
+
});
|
54
|
+
});
|
55
|
+
it("should handle viz imports", async () => {
|
56
|
+
await testInBrowser({
|
57
|
+
browser,
|
58
|
+
expectedLog: "Imported from viz: Outer Inner",
|
59
|
+
vizCache: createVizCache({
|
60
|
+
initialContents: [
|
61
|
+
sampleContent,
|
62
|
+
sampleContentVizImport,
|
63
|
+
],
|
64
|
+
}),
|
65
|
+
vizId: sampleContentVizImport.id,
|
66
|
+
});
|
67
|
+
});
|
68
|
+
it("should handle viz imports with slug", async () => {
|
69
|
+
await testInBrowser({
|
70
|
+
browser,
|
71
|
+
expectedLog: "Imported from viz with slug: Outer Inner",
|
72
|
+
vizCache: createVizCache({
|
73
|
+
initialContents: [
|
74
|
+
sampleContent,
|
75
|
+
sampleContentVizImportSlug,
|
76
|
+
],
|
77
|
+
}),
|
78
|
+
vizId: sampleContentVizImportSlug.id,
|
79
|
+
slugCache: createSlugCache({
|
80
|
+
initialMappings: {
|
81
|
+
"joe/sample-content-slug": sampleContent.id,
|
82
|
+
},
|
83
|
+
}),
|
84
|
+
});
|
85
|
+
});
|
86
|
+
it("should handle viz imports with CSS", async () => {
|
87
|
+
await testInBrowser({
|
88
|
+
browser,
|
89
|
+
expectedLog: "rgb(255, 0, 0)",
|
90
|
+
vizCache: createVizCache({
|
91
|
+
initialContents: [
|
92
|
+
sampleContentWithCSS,
|
93
|
+
sampleContentVizImportWithCSS,
|
94
|
+
],
|
95
|
+
}),
|
96
|
+
vizId: sampleContentVizImportWithCSS.id,
|
97
|
+
});
|
98
|
+
});
|
99
|
+
it("should handle Svelte components", async () => {
|
100
|
+
await testInBrowser({
|
101
|
+
browser,
|
102
|
+
files: svelte,
|
103
|
+
expectedLog: "Svelte",
|
104
|
+
getSvelteCompiler: async () => compile,
|
105
|
+
});
|
106
|
+
});
|
107
|
+
it("should provide sourcemaps with correct line numbers in stack traces", async () => {
|
108
|
+
await testStackTrace({
|
109
|
+
browser,
|
110
|
+
files: sourcemap,
|
111
|
+
expectedLineNumber: 6,
|
112
|
+
});
|
113
|
+
});
|
114
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,100 @@
|
|
1
|
+
import puppeteer from "puppeteer";
|
2
|
+
import { describe, it, beforeAll, afterAll } from "vitest";
|
3
|
+
import { testInBrowser } from "./testInBrowser";
|
4
|
+
import { jsScriptTagTypeModule, jsScriptTagTypeModules, fetchInterception, esmBuild, reactJsx, d3Usage, threeJsUsage, reactHooks, typeScriptSupport, } from "./fixtures/v4";
|
5
|
+
let browser;
|
6
|
+
beforeAll(async () => {
|
7
|
+
browser = await puppeteer.launch();
|
8
|
+
});
|
9
|
+
afterAll(async () => {
|
10
|
+
await browser.close();
|
11
|
+
});
|
12
|
+
describe("VizHub Runtime v4", () => {
|
13
|
+
it("should handle script type=module with import maps", async () => {
|
14
|
+
await testInBrowser({
|
15
|
+
browser,
|
16
|
+
files: jsScriptTagTypeModule,
|
17
|
+
expectedLog: "Hello, ES Module!",
|
18
|
+
});
|
19
|
+
});
|
20
|
+
it("should handle script type=module with file imports", async () => {
|
21
|
+
await testInBrowser({
|
22
|
+
browser,
|
23
|
+
files: jsScriptTagTypeModules,
|
24
|
+
expectedLog: "Hello, ES Module File!",
|
25
|
+
});
|
26
|
+
});
|
27
|
+
it("should handle fetch interception", async () => {
|
28
|
+
await testInBrowser({
|
29
|
+
browser,
|
30
|
+
files: fetchInterception,
|
31
|
+
expectedLog: "Fetch intercepted successfully",
|
32
|
+
});
|
33
|
+
});
|
34
|
+
it.skip("should handle ESM builds from npm packages", async () => {
|
35
|
+
await testInBrowser({
|
36
|
+
browser,
|
37
|
+
files: esmBuild,
|
38
|
+
expectedLog: new RegExp(/\d{4}-\d{2}-\d{2}/), // matches date format yyyy-MM-dd
|
39
|
+
});
|
40
|
+
});
|
41
|
+
it.skip("should handle React JSX", async () => {
|
42
|
+
await testInBrowser({
|
43
|
+
browser,
|
44
|
+
files: reactJsx,
|
45
|
+
expectedLog: "Hello React JSX!",
|
46
|
+
evaluateInBrowser: async (page) => {
|
47
|
+
return await page.evaluate(() => {
|
48
|
+
return document.querySelector("#root div")
|
49
|
+
?.textContent;
|
50
|
+
});
|
51
|
+
},
|
52
|
+
});
|
53
|
+
});
|
54
|
+
it.skip("should handle D3 usage", async () => {
|
55
|
+
await testInBrowser({
|
56
|
+
browser,
|
57
|
+
files: d3Usage,
|
58
|
+
expectedLog: "D3 chart rendered successfully",
|
59
|
+
evaluateInBrowser: async (page) => {
|
60
|
+
return await page.evaluate(() => {
|
61
|
+
return (document.querySelector("#chart svg circle") !==
|
62
|
+
null);
|
63
|
+
});
|
64
|
+
},
|
65
|
+
});
|
66
|
+
});
|
67
|
+
it("should handle Three.js usage", async () => {
|
68
|
+
await testInBrowser({
|
69
|
+
browser,
|
70
|
+
files: threeJsUsage,
|
71
|
+
expectedLog: "Three.js imports: object function",
|
72
|
+
});
|
73
|
+
});
|
74
|
+
it.skip("should handle React hooks", async () => {
|
75
|
+
await testInBrowser({
|
76
|
+
browser,
|
77
|
+
files: reactHooks,
|
78
|
+
expectedLog: "React Hooks working: count is 0",
|
79
|
+
evaluateInBrowser: async (page) => {
|
80
|
+
return await page.evaluate(() => {
|
81
|
+
return (document.querySelector("#root p")
|
82
|
+
?.textContent === "You clicked 0 times");
|
83
|
+
});
|
84
|
+
},
|
85
|
+
});
|
86
|
+
});
|
87
|
+
it.skip("should handle TypeScript support", async () => {
|
88
|
+
await testInBrowser({
|
89
|
+
browser,
|
90
|
+
files: typeScriptSupport,
|
91
|
+
expectedLog: "TypeScript is working",
|
92
|
+
evaluateInBrowser: async (page) => {
|
93
|
+
return await page.evaluate(() => {
|
94
|
+
return (document.querySelector("#app h1")
|
95
|
+
?.textContent === "Hello, John Doe!");
|
96
|
+
});
|
97
|
+
},
|
98
|
+
});
|
99
|
+
});
|
100
|
+
});
|
package/dist/types.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export type runtimeVersion = "v1" | "v2" | "v3" | "v4";
|
package/dist/types.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// Gets the text content of a file with the given name.
|
2
|
+
// Returns null if not found.
|
3
|
+
export const getFileText = (content, fileName) => {
|
4
|
+
if (content && content.files) {
|
5
|
+
for (const fileId of Object.keys(content.files)) {
|
6
|
+
const file = content.files[fileId];
|
7
|
+
if (file.name === fileName) {
|
8
|
+
return file.text;
|
9
|
+
}
|
10
|
+
}
|
11
|
+
}
|
12
|
+
return null;
|
13
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,72 @@
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
2
|
+
import { getFileText } from "./getFileText";
|
3
|
+
describe("getFileText", () => {
|
4
|
+
it("should return the text content of a file with matching name", () => {
|
5
|
+
const mockVizContent = {
|
6
|
+
id: "test-viz-123",
|
7
|
+
files: {
|
8
|
+
file1: {
|
9
|
+
name: "index.html",
|
10
|
+
text: "<html>Test</html>",
|
11
|
+
},
|
12
|
+
file2: {
|
13
|
+
name: "script.js",
|
14
|
+
text: 'console.log("Hello");',
|
15
|
+
},
|
16
|
+
},
|
17
|
+
};
|
18
|
+
const result = getFileText(mockVizContent, "index.html");
|
19
|
+
expect(result).toBe("<html>Test</html>");
|
20
|
+
});
|
21
|
+
it("should return null when no file with the given name exists", () => {
|
22
|
+
const mockVizContent = {
|
23
|
+
id: "test-viz-123",
|
24
|
+
files: {
|
25
|
+
file1: {
|
26
|
+
name: "index.html",
|
27
|
+
text: "<html>Test</html>",
|
28
|
+
},
|
29
|
+
file2: {
|
30
|
+
name: "script.js",
|
31
|
+
text: 'console.log("Hello");',
|
32
|
+
},
|
33
|
+
},
|
34
|
+
};
|
35
|
+
const result = getFileText(mockVizContent, "style.css");
|
36
|
+
expect(result).toBeNull();
|
37
|
+
});
|
38
|
+
it("should return null when content has no files property", () => {
|
39
|
+
const mockVizContent = {
|
40
|
+
id: "test-viz-123",
|
41
|
+
};
|
42
|
+
const result = getFileText(mockVizContent, "index.html");
|
43
|
+
expect(result).toBeNull();
|
44
|
+
});
|
45
|
+
it("should return null when content is undefined", () => {
|
46
|
+
const result = getFileText(undefined, "index.html");
|
47
|
+
expect(result).toBeNull();
|
48
|
+
});
|
49
|
+
it("should find the correct file when multiple files exist", () => {
|
50
|
+
const mockVizContent = {
|
51
|
+
id: "test-viz-123",
|
52
|
+
files: {
|
53
|
+
file1: { name: "data.csv", text: "a,b,c" },
|
54
|
+
file2: {
|
55
|
+
name: "index.html",
|
56
|
+
text: "<html>First</html>",
|
57
|
+
},
|
58
|
+
file3: {
|
59
|
+
name: "script.js",
|
60
|
+
text: 'console.log("Hello");',
|
61
|
+
},
|
62
|
+
file4: {
|
63
|
+
name: "index.html",
|
64
|
+
text: "<html>Second</html>",
|
65
|
+
},
|
66
|
+
},
|
67
|
+
};
|
68
|
+
// Should return the first matching file's content
|
69
|
+
const result = getFileText(mockVizContent, "index.html");
|
70
|
+
expect(result).toBe("<html>First</html>");
|
71
|
+
});
|
72
|
+
});
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import type { FileCollection, VizContent } from "@vizhub/viz-types";
|
2
|
+
/**
|
3
|
+
* Converts VizContent format to FileCollection format
|
4
|
+
* VizContent has files as {id: {name, text}} structure
|
5
|
+
* FileCollection is a simple {name: text} structure
|
6
|
+
*/
|
7
|
+
export declare const vizContentToFileCollection: (vizContent: VizContent) => FileCollection;
|
@@ -0,0 +1,19 @@
|
|
1
|
+
/**
|
2
|
+
* Converts VizContent format to FileCollection format
|
3
|
+
* VizContent has files as {id: {name, text}} structure
|
4
|
+
* FileCollection is a simple {name: text} structure
|
5
|
+
*/
|
6
|
+
export const vizContentToFileCollection = (vizContent) => {
|
7
|
+
const fileCollection = {};
|
8
|
+
// Extract files from vizContent
|
9
|
+
const { files } = vizContent;
|
10
|
+
// Return empty object if files is undefined
|
11
|
+
if (!files) {
|
12
|
+
return fileCollection;
|
13
|
+
}
|
14
|
+
// Convert each VizFile to the FileCollection format
|
15
|
+
Object.values(files).forEach((file) => {
|
16
|
+
fileCollection[file.name] = file.text;
|
17
|
+
});
|
18
|
+
return fileCollection;
|
19
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,75 @@
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
2
|
+
import { vizContentToFileCollection } from "./vizContentToFileCollection";
|
3
|
+
describe("vizContentToFileCollection", () => {
|
4
|
+
it("should convert VizContent files to FileCollection format", () => {
|
5
|
+
const mockVizContent = {
|
6
|
+
id: "test-viz-123",
|
7
|
+
files: {
|
8
|
+
file1: {
|
9
|
+
name: "index.html",
|
10
|
+
text: "<html>Test</html>",
|
11
|
+
},
|
12
|
+
file2: {
|
13
|
+
name: "script.js",
|
14
|
+
text: 'console.log("Hello");',
|
15
|
+
},
|
16
|
+
},
|
17
|
+
};
|
18
|
+
const result = vizContentToFileCollection(mockVizContent);
|
19
|
+
expect(result).toEqual({
|
20
|
+
"index.html": "<html>Test</html>",
|
21
|
+
"script.js": 'console.log("Hello");',
|
22
|
+
});
|
23
|
+
});
|
24
|
+
it("should return an empty object when no files exist", () => {
|
25
|
+
const mockVizContent = {
|
26
|
+
id: "empty-viz",
|
27
|
+
files: {},
|
28
|
+
};
|
29
|
+
const result = vizContentToFileCollection(mockVizContent);
|
30
|
+
expect(result).toEqual({});
|
31
|
+
});
|
32
|
+
it("should return an empty object when no files property", () => {
|
33
|
+
const mockVizContent = {
|
34
|
+
id: "empty-viz",
|
35
|
+
// @ts-ignore
|
36
|
+
files: undefined,
|
37
|
+
};
|
38
|
+
const result = vizContentToFileCollection(mockVizContent);
|
39
|
+
expect(result).toEqual({});
|
40
|
+
});
|
41
|
+
it("should handle files with special characters in names", () => {
|
42
|
+
const mockVizContent = {
|
43
|
+
id: "special-chars-viz",
|
44
|
+
files: {
|
45
|
+
fileId1: {
|
46
|
+
name: "file with spaces.txt",
|
47
|
+
text: "content",
|
48
|
+
},
|
49
|
+
fileId2: { name: "data.csv", text: "a,b,c\n1,2,3" },
|
50
|
+
},
|
51
|
+
};
|
52
|
+
const result = vizContentToFileCollection(mockVizContent);
|
53
|
+
expect(result).toEqual({
|
54
|
+
"file with spaces.txt": "content",
|
55
|
+
"data.csv": "a,b,c\n1,2,3",
|
56
|
+
});
|
57
|
+
});
|
58
|
+
it("should preserve file content exactly", () => {
|
59
|
+
const longText = `function complex() {
|
60
|
+
return {
|
61
|
+
nested: {
|
62
|
+
data: [1, 2, 3]
|
63
|
+
}
|
64
|
+
};
|
65
|
+
}`;
|
66
|
+
const mockVizContent = {
|
67
|
+
id: "preserve-content-viz",
|
68
|
+
files: {
|
69
|
+
fileId: { name: "complex.js", text: longText },
|
70
|
+
},
|
71
|
+
};
|
72
|
+
const result = vizContentToFileCollection(mockVizContent);
|
73
|
+
expect(result["complex.js"]).toBe(longText);
|
74
|
+
});
|
75
|
+
});
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import type { RollupBuild, RollupOptions } from "rollup";
|
2
|
+
import { FileCollection } from "@vizhub/viz-types";
|
3
|
+
export declare const computeBundleJSV2: ({ files, rollup, enableSourcemap, }: {
|
4
|
+
files: FileCollection;
|
5
|
+
rollup: (options: RollupOptions) => Promise<RollupBuild>;
|
6
|
+
enableSourcemap?: boolean;
|
7
|
+
}) => Promise<string>;
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import { virtualFileSystem } from "../common/virtualFileSystem";
|
2
|
+
import { sucrasePlugin } from "../common/sucrasePlugin";
|
3
|
+
import { getGlobals, packageJSON, } from "../common/packageJson";
|
4
|
+
export const computeBundleJSV2 = async ({ files, rollup, enableSourcemap = true, }) => {
|
5
|
+
const indexJSContent = files["index.js"];
|
6
|
+
if (!indexJSContent) {
|
7
|
+
throw new Error("Missing index.js");
|
8
|
+
}
|
9
|
+
const inputOptions = {
|
10
|
+
input: "./index.js",
|
11
|
+
plugins: [virtualFileSystem(files), sucrasePlugin()],
|
12
|
+
onwarn(warning, warn) {
|
13
|
+
// Suppress "treating module as external dependency" warnings
|
14
|
+
if (warning.code === "UNRESOLVED_IMPORT")
|
15
|
+
return;
|
16
|
+
warn(warning);
|
17
|
+
},
|
18
|
+
};
|
19
|
+
const bundle = await rollup(inputOptions);
|
20
|
+
const pkg = packageJSON(files);
|
21
|
+
const globals = getGlobals(pkg);
|
22
|
+
const outputOptions = {
|
23
|
+
format: "iife",
|
24
|
+
globals,
|
25
|
+
sourcemap: enableSourcemap,
|
26
|
+
};
|
27
|
+
const { output } = await bundle.generate(outputOptions);
|
28
|
+
return output[0].code;
|
29
|
+
};
|