@vizhub/runtime 0.3.1 → 0.3.3
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 +14 -14
- package/dist/cjs/v2/index.js +2 -2
- package/dist/cjs/v2/v2Build.js +4 -4
- package/dist/cjs/v3/computeBundleJSV3.js +13 -13
- package/dist/cjs/v3/createVizContent.js +2 -2
- package/dist/cjs/v3/index.js +2 -2
- package/dist/cjs/v3/setupV3Runtime.js +5 -5
- package/dist/cjs/v3/transformDSV/index.js +4 -4
- package/dist/cjs/v3/transformSvelte.js +2 -2
- package/dist/cjs/v3/v3Build.js +6 -6
- package/dist/cjs/v3/vizResolve.js +4 -4
- package/dist/cjs/v4/index.js +7 -7
- package/dist/esm/buildHTML.js +7 -7
- package/dist/esm/v2/index.js +1 -1
- package/dist/esm/v2/v2Build.js +2 -2
- package/dist/esm/v3/computeBundleJSV3.js +6 -6
- package/dist/esm/v3/createVizContent.js +2 -2
- package/dist/esm/v3/index.js +1 -1
- package/dist/esm/v3/setupV3Runtime.js +2 -2
- package/dist/esm/v3/transformDSV/index.js +2 -2
- package/dist/esm/v3/transformSvelte.js +1 -1
- package/dist/esm/v3/v3Build.js +3 -3
- package/dist/esm/v3/vizResolve.js +2 -2
- package/dist/esm/v4/index.js +3 -3
- package/dist/types/buildHTML.d.ts +3 -3
- package/dist/types/determineRuntimeVersion.d.ts +1 -1
- package/dist/types/v2/index.d.ts +1 -1
- package/dist/types/v3/computeBundleJSV3.d.ts +3 -3
- package/dist/types/v3/index.d.ts +1 -1
- package/dist/types/v3/parseId.d.ts +1 -1
- package/dist/types/v3/types.d.ts +1 -1
- package/dist/types/v3/v3Build.d.ts +3 -3
- package/dist/types/v3/vizResolve.d.ts +1 -1
- package/package.json +1 -1
package/dist/cjs/buildHTML.js
CHANGED
@@ -2,13 +2,13 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.buildHTML = void 0;
|
4
4
|
const magic_sandbox_1 = require("magic-sandbox");
|
5
|
-
const
|
6
|
-
const
|
7
|
-
const
|
8
|
-
const
|
9
|
-
const
|
10
|
-
const
|
11
|
-
const
|
5
|
+
const determineRuntimeVersion_js_1 = require("./determineRuntimeVersion.js");
|
6
|
+
const index_js_1 = require("./v2/index.js");
|
7
|
+
const index_js_2 = require("./v3/index.js");
|
8
|
+
const index_js_3 = require("./v4/index.js");
|
9
|
+
const vizCache_js_1 = require("./v3/vizCache.js");
|
10
|
+
const createVizContent_js_1 = require("./v3/createVizContent.js");
|
11
|
+
const vizContentToFileCollection_js_1 = require("./utils/vizContentToFileCollection.js");
|
12
12
|
const DEBUG = false;
|
13
13
|
const buildHTML = async ({ files, rollup, enableSourcemap = true, vizCache, vizId, slugCache, getSvelteCompiler, }) => {
|
14
14
|
if (!files && !vizCache) {
|
@@ -18,12 +18,12 @@ const buildHTML = async ({ files, rollup, enableSourcemap = true, vizCache, vizI
|
|
18
18
|
throw new Error("vizId is required when using vizCache");
|
19
19
|
}
|
20
20
|
if (!files && vizCache && vizId) {
|
21
|
-
files = (0,
|
21
|
+
files = (0, vizContentToFileCollection_js_1.vizContentToFileCollection)(await vizCache.get(vizId));
|
22
22
|
}
|
23
23
|
if (!files) {
|
24
24
|
throw new Error("Upable to extract viz files");
|
25
25
|
}
|
26
|
-
const version = (0,
|
26
|
+
const version = (0, determineRuntimeVersion_js_1.determineRuntimeVersion)(files);
|
27
27
|
DEBUG && console.log("[buildHTML] version:", version);
|
28
28
|
if (version === "v1") {
|
29
29
|
return (0, magic_sandbox_1.magicSandbox)(files);
|
@@ -32,16 +32,16 @@ const buildHTML = async ({ files, rollup, enableSourcemap = true, vizCache, vizI
|
|
32
32
|
if (!rollup) {
|
33
33
|
throw new Error("Rollup is required for v2 runtime");
|
34
34
|
}
|
35
|
-
return (0, magic_sandbox_1.magicSandbox)(await (0,
|
35
|
+
return (0, magic_sandbox_1.magicSandbox)(await (0, index_js_1.v2Build)({ files, rollup, enableSourcemap }));
|
36
36
|
}
|
37
37
|
if (version === "v3") {
|
38
38
|
if (!rollup) {
|
39
39
|
throw new Error("Rollup is required for v3 runtime");
|
40
40
|
}
|
41
41
|
if (!vizCache && !vizId) {
|
42
|
-
const vizContent = (0,
|
42
|
+
const vizContent = (0, createVizContent_js_1.createVizContent)(files);
|
43
43
|
vizId = vizContent.id;
|
44
|
-
vizCache = (0,
|
44
|
+
vizCache = (0, vizCache_js_1.createVizCache)({
|
45
45
|
initialContents: [vizContent],
|
46
46
|
handleCacheMiss: async () => {
|
47
47
|
throw new Error("Cache miss handler not implemented");
|
@@ -51,7 +51,7 @@ const buildHTML = async ({ files, rollup, enableSourcemap = true, vizCache, vizI
|
|
51
51
|
if (!vizCache || !vizId) {
|
52
52
|
throw new Error("vizCache and vizId are required for v3 runtime");
|
53
53
|
}
|
54
|
-
return await (0,
|
54
|
+
return await (0, index_js_2.v3Build)({
|
55
55
|
files,
|
56
56
|
rollup,
|
57
57
|
vizCache,
|
@@ -64,7 +64,7 @@ const buildHTML = async ({ files, rollup, enableSourcemap = true, vizCache, vizI
|
|
64
64
|
if (!rollup) {
|
65
65
|
throw new Error("Rollup is required for v4 runtime");
|
66
66
|
}
|
67
|
-
return (0, magic_sandbox_1.magicSandbox)(await (0,
|
67
|
+
return (0, magic_sandbox_1.magicSandbox)(await (0, index_js_3.v4Build)({ files, rollup, enableSourcemap }));
|
68
68
|
}
|
69
69
|
throw new Error(`Unsupported runtime version: ${version}`);
|
70
70
|
};
|
package/dist/cjs/v2/index.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.v2Build = void 0;
|
4
|
-
var
|
5
|
-
Object.defineProperty(exports, "v2Build", { enumerable: true, get: function () { return
|
4
|
+
var v2Build_js_1 = require("./v2Build.js");
|
5
|
+
Object.defineProperty(exports, "v2Build", { enumerable: true, get: function () { return v2Build_js_1.v2Build; } });
|
package/dist/cjs/v2/v2Build.js
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.v2Build = void 0;
|
4
|
-
const
|
5
|
-
const
|
4
|
+
const getComputedIndexHtml_js_1 = require("./getComputedIndexHtml.js");
|
5
|
+
const computeBundleJSV2_js_1 = require("./computeBundleJSV2.js");
|
6
6
|
const v2Build = async ({ files, rollup, enableSourcemap, }) => ({
|
7
7
|
...files,
|
8
|
-
"bundle.js": await (0,
|
8
|
+
"bundle.js": await (0, computeBundleJSV2_js_1.computeBundleJSV2)({
|
9
9
|
files,
|
10
10
|
rollup,
|
11
11
|
enableSourcemap,
|
12
12
|
}),
|
13
|
-
"index.html": (0,
|
13
|
+
"index.html": (0, getComputedIndexHtml_js_1.getComputedIndexHtml)(files),
|
14
14
|
});
|
15
15
|
exports.v2Build = v2Build;
|
@@ -1,12 +1,12 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.computeBundleJSV3 = void 0;
|
4
|
-
const
|
5
|
-
const
|
6
|
-
const
|
7
|
-
const
|
8
|
-
const
|
9
|
-
const
|
4
|
+
const sucrasePlugin_js_1 = require("../common/sucrasePlugin.js");
|
5
|
+
const packageJson_js_1 = require("../common/packageJson.js");
|
6
|
+
const index_js_1 = require("./transformDSV/index.js");
|
7
|
+
const vizResolve_js_1 = require("./vizResolve.js");
|
8
|
+
const vizLoad_js_1 = require("./vizLoad.js");
|
9
|
+
const transformSvelte_js_1 = require("./transformSvelte.js");
|
10
10
|
const computeBundleJSV3 = async ({ files, rollup, enableSourcemap = true, vizCache, vizId, slugCache, getSvelteCompiler, }) => {
|
11
11
|
// Track CSS imports
|
12
12
|
const cssFilesSet = new Set();
|
@@ -20,11 +20,11 @@ const computeBundleJSV3 = async ({ files, rollup, enableSourcemap = true, vizCac
|
|
20
20
|
const inputOptions = {
|
21
21
|
input: "./index.js",
|
22
22
|
plugins: [
|
23
|
-
(0,
|
24
|
-
(0,
|
25
|
-
(0,
|
26
|
-
(0,
|
27
|
-
(0,
|
23
|
+
(0, vizResolve_js_1.vizResolve)({ vizId, slugCache }),
|
24
|
+
(0, index_js_1.transformDSV)(),
|
25
|
+
(0, sucrasePlugin_js_1.sucrasePlugin)(),
|
26
|
+
(0, transformSvelte_js_1.transformSvelte)({ getSvelteCompiler }),
|
27
|
+
(0, vizLoad_js_1.vizLoad)({ vizCache, trackCSSImport }),
|
28
28
|
],
|
29
29
|
onwarn(warning, warn) {
|
30
30
|
// Suppress "treating module as external dependency" warnings
|
@@ -34,8 +34,8 @@ const computeBundleJSV3 = async ({ files, rollup, enableSourcemap = true, vizCac
|
|
34
34
|
},
|
35
35
|
};
|
36
36
|
const bundle = await rollup(inputOptions);
|
37
|
-
const pkg = (0,
|
38
|
-
const globals = (0,
|
37
|
+
const pkg = (0, packageJson_js_1.packageJSON)(files);
|
38
|
+
const globals = (0, packageJson_js_1.getGlobals)(pkg);
|
39
39
|
const outputOptions = {
|
40
40
|
format: "umd",
|
41
41
|
name: "Viz",
|
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.createVizContent = void 0;
|
4
|
-
const
|
4
|
+
const viz_utils_1 = require("@vizhub/viz-utils");
|
5
5
|
/**
|
6
6
|
* Creates a VizContent object with the given files
|
7
7
|
* @param files An object with file names as keys and file content as values
|
@@ -9,7 +9,7 @@ const uuid_1 = require("uuid");
|
|
9
9
|
* @returns A VizContent object with randomly generated IDs
|
10
10
|
*/
|
11
11
|
const createVizContent = (files, title = "Sample Content for Exporting") => {
|
12
|
-
const contentId = (0,
|
12
|
+
const contentId = (0, viz_utils_1.generateVizId)();
|
13
13
|
const contentFiles = {};
|
14
14
|
Object.entries(files).forEach(([fileName, fileContent]) => {
|
15
15
|
const fileId = Math.floor(Math.random() * 10000000).toString();
|
package/dist/cjs/v3/index.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.v3Build = void 0;
|
4
|
-
var
|
5
|
-
Object.defineProperty(exports, "v3Build", { enumerable: true, get: function () { return
|
4
|
+
var v3Build_js_1 = require("./v3Build.js");
|
5
|
+
Object.defineProperty(exports, "v3Build", { enumerable: true, get: function () { return v3Build_js_1.v3Build; } });
|
@@ -1,9 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.setupV3Runtime = void 0;
|
4
|
-
const parseId_1 = require("./parseId");
|
5
|
-
const cleanRollupErrorMessage_1 = require("./cleanRollupErrorMessage");
|
6
4
|
const viz_utils_1 = require("@vizhub/viz-utils");
|
5
|
+
const parseId_js_1 = require("./parseId.js");
|
6
|
+
const cleanRollupErrorMessage_js_1 = require("./cleanRollupErrorMessage.js");
|
7
7
|
// Flag for debugging.
|
8
8
|
const debug = false;
|
9
9
|
// Nothing happening.
|
@@ -85,7 +85,7 @@ const setupV3Runtime = ({ vizId, iframe, setSrcdocErrorMessage, getLatestContent
|
|
85
85
|
pendingBuildPromise = null;
|
86
86
|
}
|
87
87
|
if (error) {
|
88
|
-
setSrcdocErrorMessage((0,
|
88
|
+
setSrcdocErrorMessage((0, cleanRollupErrorMessage_js_1.cleanRollupErrorMessage)({
|
89
89
|
rawMessage: error.message,
|
90
90
|
vizId,
|
91
91
|
}));
|
@@ -140,7 +140,7 @@ const setupV3Runtime = ({ vizId, iframe, setSrcdocErrorMessage, getLatestContent
|
|
140
140
|
const srcdoc = message.srcdoc;
|
141
141
|
const error = message.error;
|
142
142
|
if (error) {
|
143
|
-
setSrcdocErrorMessage((0,
|
143
|
+
setSrcdocErrorMessage((0, cleanRollupErrorMessage_js_1.cleanRollupErrorMessage)({
|
144
144
|
rawMessage: error.message,
|
145
145
|
vizId,
|
146
146
|
}));
|
@@ -278,7 +278,7 @@ const setupV3Runtime = ({ vizId, iframe, setSrcdocErrorMessage, getLatestContent
|
|
278
278
|
if (iframe.contentWindow) {
|
279
279
|
// For each cssFiles
|
280
280
|
for (const cssFile of cssFiles) {
|
281
|
-
const { vizId, fileName } = (0,
|
281
|
+
const { vizId, fileName } = (0, parseId_js_1.parseId)(cssFile);
|
282
282
|
getLatestContent(vizId).then((content) => {
|
283
283
|
const src = (0, viz_utils_1.getFileText)(content, fileName);
|
284
284
|
if (src === null) {
|
@@ -1,8 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.transformDSV = void 0;
|
4
|
-
const
|
5
|
-
const
|
4
|
+
const parseId_js_1 = require("../parseId.js");
|
5
|
+
const dsvParseSrc_js_1 = require("./dsvParseSrc.js");
|
6
6
|
const DEBUG = false;
|
7
7
|
// Escape backticks in a string so that it can be
|
8
8
|
// used in a template literal. Also need to escape backslashes.
|
@@ -17,7 +17,7 @@ const transformDSV = () => ({
|
|
17
17
|
// `{vizId}/{fileName}`
|
18
18
|
transform: async (text, id) => {
|
19
19
|
DEBUG && console.log("[transformDSV]: load() " + id);
|
20
|
-
const { vizId, fileName } = (0,
|
20
|
+
const { vizId, fileName } = (0, parseId_js_1.parseId)(id);
|
21
21
|
DEBUG &&
|
22
22
|
console.log(" [transformDSV] vizId: " + vizId);
|
23
23
|
DEBUG &&
|
@@ -31,7 +31,7 @@ const transformDSV = () => ({
|
|
31
31
|
const parseFunction = isCSV ? "csvParse" : "tsvParse";
|
32
32
|
return {
|
33
33
|
code: `
|
34
|
-
${
|
34
|
+
${dsvParseSrc_js_1.dsvParseSrc}
|
35
35
|
const data = ${parseFunction}(\`${escapeBackticks(text)}\`);
|
36
36
|
export default data;
|
37
37
|
`,
|
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.transformSvelte = exports.svelteCompilerUrl = void 0;
|
4
|
-
const
|
4
|
+
const parseId_js_1 = require("./parseId.js");
|
5
5
|
const debug = false;
|
6
6
|
// The cache of fetched files.
|
7
7
|
const fetchedFileCache = new Map();
|
@@ -60,7 +60,7 @@ const transformSvelte = ({ getSvelteCompiler, }) => ({
|
|
60
60
|
}
|
61
61
|
},
|
62
62
|
transform: async (code, id) => {
|
63
|
-
const { fileName } = (0,
|
63
|
+
const { fileName } = (0, parseId_js_1.parseId)(id);
|
64
64
|
const isSvelte = fileName.endsWith(".svelte");
|
65
65
|
if (isSvelte) {
|
66
66
|
if (!compile) {
|
package/dist/cjs/v3/v3Build.js
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.v3Build = void 0;
|
4
|
-
const computeBundleJSV3_1 = require("./computeBundleJSV3");
|
5
|
-
const htmlTemplate_1 = require("./htmlTemplate");
|
6
|
-
const parseId_1 = require("./parseId");
|
7
4
|
const viz_utils_1 = require("@vizhub/viz-utils");
|
5
|
+
const computeBundleJSV3_js_1 = require("./computeBundleJSV3.js");
|
6
|
+
const htmlTemplate_js_1 = require("./htmlTemplate.js");
|
7
|
+
const parseId_js_1 = require("./parseId.js");
|
8
8
|
const v3Build = async ({ files, rollup, enableSourcemap = true, vizCache, vizId, slugCache, getSvelteCompiler, }) => {
|
9
|
-
const { src, cssFiles } = await (0,
|
9
|
+
const { src, cssFiles } = await (0, computeBundleJSV3_js_1.computeBundleJSV3)({
|
10
10
|
files,
|
11
11
|
rollup,
|
12
12
|
enableSourcemap,
|
@@ -23,12 +23,12 @@ const v3Build = async ({ files, rollup, enableSourcemap = true, vizCache, vizId,
|
|
23
23
|
const id = cssFiles[i];
|
24
24
|
const indent = i > 0 ? " " : "\n ";
|
25
25
|
const styleElementId = "injected-style" + id;
|
26
|
-
const { vizId, fileName } = (0,
|
26
|
+
const { vizId, fileName } = (0, parseId_js_1.parseId)(id);
|
27
27
|
const content = await vizCache.get(vizId);
|
28
28
|
const src = (0, viz_utils_1.getFileText)(content, fileName);
|
29
29
|
styles += `${indent}<style id="${styleElementId}">${src}</style>`;
|
30
30
|
}
|
31
31
|
}
|
32
|
-
return (0,
|
32
|
+
return (0, htmlTemplate_js_1.htmlTemplate)({ cdn: "", src, styles });
|
33
33
|
};
|
34
34
|
exports.v3Build = v3Build;
|
@@ -1,9 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.vizResolve = void 0;
|
4
|
-
const extractVizImport_1 = require("./extractVizImport");
|
5
|
-
const parseId_1 = require("./parseId");
|
6
4
|
const viz_utils_1 = require("@vizhub/viz-utils");
|
5
|
+
const extractVizImport_js_1 = require("./extractVizImport.js");
|
6
|
+
const parseId_js_1 = require("./parseId.js");
|
7
7
|
const debug = false;
|
8
8
|
const vizResolve = ({ vizId, slugCache, }) => ({
|
9
9
|
name: "vizResolve",
|
@@ -35,7 +35,7 @@ const vizResolve = ({ vizId, slugCache, }) => ({
|
|
35
35
|
// the entry point, so it should be resolved relative
|
36
36
|
// to the importer's directory
|
37
37
|
if (importer) {
|
38
|
-
const { vizId: importerVizId, fileName: importerFileName, } = (0,
|
38
|
+
const { vizId: importerVizId, fileName: importerFileName, } = (0, parseId_js_1.parseId)(importer);
|
39
39
|
// Get the directory of the importing file
|
40
40
|
const importerDir = importerFileName
|
41
41
|
.split("/")
|
@@ -52,7 +52,7 @@ const vizResolve = ({ vizId, slugCache, }) => ({
|
|
52
52
|
// Handle viz import resolution
|
53
53
|
// e.g. `import { foo } from '@curran/98e6d6509a1e407897d4f238a330efec'`
|
54
54
|
// e.g. `import { foo } from '@curran/scatter-plot'`
|
55
|
-
const vizImport = (0,
|
55
|
+
const vizImport = (0, extractVizImport_js_1.extractVizImport)(id);
|
56
56
|
if (vizImport) {
|
57
57
|
let vizId;
|
58
58
|
if ((0, viz_utils_1.isVizId)(vizImport.idOrSlug)) {
|
package/dist/cjs/v4/index.js
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.v4Build = void 0;
|
4
4
|
const jsdom_1 = require("jsdom");
|
5
|
-
const
|
6
|
-
const
|
7
|
-
const
|
5
|
+
const virtualFileSystem_js_1 = require("../common/virtualFileSystem.js");
|
6
|
+
const sucrasePlugin_js_1 = require("../common/sucrasePlugin.js");
|
7
|
+
const packageJson_js_1 = require("../common/packageJson.js");
|
8
8
|
const DEBUG = false;
|
9
9
|
/**
|
10
10
|
* Extract module script entry points from index.html
|
@@ -28,7 +28,7 @@ const extractModuleEntryPoints = (html) => {
|
|
28
28
|
const bundleESModule = async ({ entryPoint, files, rollup, enableSourcemap = true, }) => {
|
29
29
|
const inputOptions = {
|
30
30
|
input: `./${entryPoint}`,
|
31
|
-
plugins: [(0,
|
31
|
+
plugins: [(0, virtualFileSystem_js_1.virtualFileSystem)(files), (0, sucrasePlugin_js_1.sucrasePlugin)()],
|
32
32
|
onwarn(warning, warn) {
|
33
33
|
// Suppress "treating module as external dependency" warnings
|
34
34
|
if (warning.code === "UNRESOLVED_IMPORT")
|
@@ -48,14 +48,14 @@ const bundleESModule = async ({ entryPoint, files, rollup, enableSourcemap = tru
|
|
48
48
|
* Generate an import map for all dependencies
|
49
49
|
*/
|
50
50
|
const generateImportMap = (files) => {
|
51
|
-
const deps = (0,
|
51
|
+
const deps = (0, packageJson_js_1.dependencies)(files);
|
52
52
|
if (Object.keys(deps).length === 0) {
|
53
53
|
return null;
|
54
54
|
}
|
55
|
-
const libraries = (0,
|
55
|
+
const libraries = (0, packageJson_js_1.getConfiguredLibraries)(files);
|
56
56
|
const imports = {};
|
57
57
|
Object.entries(deps).forEach(([name, version]) => {
|
58
|
-
const url = (0,
|
58
|
+
const url = (0, packageJson_js_1.dependencySource)({ name, version }, libraries);
|
59
59
|
imports[name] = url;
|
60
60
|
});
|
61
61
|
return JSON.stringify({ imports }, null, 2);
|
package/dist/esm/buildHTML.js
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
import { magicSandbox } from "magic-sandbox";
|
2
|
-
import { determineRuntimeVersion } from "./determineRuntimeVersion";
|
3
|
-
import { v2Build } from "./v2";
|
4
|
-
import { v3Build } from "./v3";
|
5
|
-
import { v4Build } from "./v4";
|
6
|
-
import { createVizCache } from "./v3/vizCache";
|
7
|
-
import { createVizContent } from "./v3/createVizContent";
|
8
|
-
import { vizContentToFileCollection } from "./utils/vizContentToFileCollection";
|
2
|
+
import { determineRuntimeVersion } from "./determineRuntimeVersion.js";
|
3
|
+
import { v2Build } from "./v2/index.js";
|
4
|
+
import { v3Build } from "./v3/index.js";
|
5
|
+
import { v4Build } from "./v4/index.js";
|
6
|
+
import { createVizCache } from "./v3/vizCache.js";
|
7
|
+
import { createVizContent } from "./v3/createVizContent.js";
|
8
|
+
import { vizContentToFileCollection } from "./utils/vizContentToFileCollection.js";
|
9
9
|
const DEBUG = false;
|
10
10
|
export const buildHTML = async ({ files, rollup, enableSourcemap = true, vizCache, vizId, slugCache, getSvelteCompiler, }) => {
|
11
11
|
if (!files && !vizCache) {
|
package/dist/esm/v2/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export { v2Build } from "./v2Build";
|
1
|
+
export { v2Build } from "./v2Build.js";
|
package/dist/esm/v2/v2Build.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import { getComputedIndexHtml } from "./getComputedIndexHtml";
|
2
|
-
import { computeBundleJSV2 } from "./computeBundleJSV2";
|
1
|
+
import { getComputedIndexHtml } from "./getComputedIndexHtml.js";
|
2
|
+
import { computeBundleJSV2 } from "./computeBundleJSV2.js";
|
3
3
|
export const v2Build = async ({ files, rollup, enableSourcemap, }) => ({
|
4
4
|
...files,
|
5
5
|
"bundle.js": await computeBundleJSV2({
|
@@ -1,9 +1,9 @@
|
|
1
|
-
import { sucrasePlugin } from "../common/sucrasePlugin";
|
2
|
-
import { getGlobals, packageJSON, } from "../common/packageJson";
|
3
|
-
import { transformDSV } from "./transformDSV";
|
4
|
-
import { vizResolve } from "./vizResolve";
|
5
|
-
import { vizLoad } from "./vizLoad";
|
6
|
-
import { transformSvelte, } from "./transformSvelte";
|
1
|
+
import { sucrasePlugin } from "../common/sucrasePlugin.js";
|
2
|
+
import { getGlobals, packageJSON, } from "../common/packageJson.js";
|
3
|
+
import { transformDSV } from "./transformDSV/index.js";
|
4
|
+
import { vizResolve } from "./vizResolve.js";
|
5
|
+
import { vizLoad } from "./vizLoad.js";
|
6
|
+
import { transformSvelte, } from "./transformSvelte.js";
|
7
7
|
export const computeBundleJSV3 = async ({ files, rollup, enableSourcemap = true, vizCache, vizId, slugCache, getSvelteCompiler, }) => {
|
8
8
|
// Track CSS imports
|
9
9
|
const cssFilesSet = new Set();
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { generateVizId } from "@vizhub/viz-utils";
|
2
2
|
/**
|
3
3
|
* Creates a VizContent object with the given files
|
4
4
|
* @param files An object with file names as keys and file content as values
|
@@ -6,7 +6,7 @@ import { v4 as uuidv4 } from "uuid";
|
|
6
6
|
* @returns A VizContent object with randomly generated IDs
|
7
7
|
*/
|
8
8
|
export const createVizContent = (files, title = "Sample Content for Exporting") => {
|
9
|
-
const contentId =
|
9
|
+
const contentId = generateVizId();
|
10
10
|
const contentFiles = {};
|
11
11
|
Object.entries(files).forEach(([fileName, fileContent]) => {
|
12
12
|
const fileId = Math.floor(Math.random() * 10000000).toString();
|
package/dist/esm/v3/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export { v3Build } from "./v3Build";
|
1
|
+
export { v3Build } from "./v3Build.js";
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { parseId } from "./parseId";
|
2
|
-
import { cleanRollupErrorMessage } from "./cleanRollupErrorMessage";
|
3
1
|
import { getFileText } from "@vizhub/viz-utils";
|
2
|
+
import { parseId } from "./parseId.js";
|
3
|
+
import { cleanRollupErrorMessage } from "./cleanRollupErrorMessage.js";
|
4
4
|
// Flag for debugging.
|
5
5
|
const debug = false;
|
6
6
|
// Nothing happening.
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { parseId } from "../parseId";
|
2
|
-
import { dsvParseSrc } from "./dsvParseSrc";
|
1
|
+
import { parseId } from "../parseId.js";
|
2
|
+
import { dsvParseSrc } from "./dsvParseSrc.js";
|
3
3
|
const DEBUG = false;
|
4
4
|
// Escape backticks in a string so that it can be
|
5
5
|
// used in a template literal. Also need to escape backslashes.
|
package/dist/esm/v3/v3Build.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
import { computeBundleJSV3 } from "./computeBundleJSV3";
|
2
|
-
import { htmlTemplate } from "./htmlTemplate";
|
3
|
-
import { parseId } from "./parseId";
|
4
1
|
import { getFileText } from "@vizhub/viz-utils";
|
2
|
+
import { computeBundleJSV3 } from "./computeBundleJSV3.js";
|
3
|
+
import { htmlTemplate } from "./htmlTemplate.js";
|
4
|
+
import { parseId } from "./parseId.js";
|
5
5
|
export const v3Build = async ({ files, rollup, enableSourcemap = true, vizCache, vizId, slugCache, getSvelteCompiler, }) => {
|
6
6
|
const { src, cssFiles } = await computeBundleJSV3({
|
7
7
|
files,
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { extractVizImport } from "./extractVizImport";
|
2
|
-
import { parseId } from "./parseId";
|
3
1
|
import { isVizId } from "@vizhub/viz-utils";
|
2
|
+
import { extractVizImport } from "./extractVizImport.js";
|
3
|
+
import { parseId } from "./parseId.js";
|
4
4
|
const debug = false;
|
5
5
|
export const vizResolve = ({ vizId, slugCache, }) => ({
|
6
6
|
name: "vizResolve",
|
package/dist/esm/v4/index.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { JSDOM } from "jsdom";
|
2
|
-
import { virtualFileSystem } from "../common/virtualFileSystem";
|
3
|
-
import { sucrasePlugin } from "../common/sucrasePlugin";
|
4
|
-
import { dependencies, getConfiguredLibraries, dependencySource, } from "../common/packageJson";
|
2
|
+
import { virtualFileSystem } from "../common/virtualFileSystem.js";
|
3
|
+
import { sucrasePlugin } from "../common/sucrasePlugin.js";
|
4
|
+
import { dependencies, getConfiguredLibraries, dependencySource, } from "../common/packageJson.js";
|
5
5
|
const DEBUG = false;
|
6
6
|
/**
|
7
7
|
* Extract module script entry points from index.html
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { FileCollection } from "@vizhub/viz-types";
|
2
2
|
import type { RollupBuild, RollupOptions } from "rollup";
|
3
|
-
import { VizCache } from "./v3/vizCache";
|
4
|
-
import { SlugCache } from "./v3/slugCache";
|
5
|
-
import { SvelteCompiler } from "./v3/transformSvelte";
|
3
|
+
import { VizCache } from "./v3/vizCache.js";
|
4
|
+
import { SlugCache } from "./v3/slugCache.js";
|
5
|
+
import { SvelteCompiler } from "./v3/transformSvelte.js";
|
6
6
|
export declare const buildHTML: ({ files, rollup, enableSourcemap, vizCache, vizId, slugCache, getSvelteCompiler, }: {
|
7
7
|
files?: FileCollection;
|
8
8
|
rollup?: (options: RollupOptions) => Promise<RollupBuild>;
|
package/dist/types/v2/index.d.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export { v2Build } from "./v2Build";
|
1
|
+
export { v2Build } from "./v2Build.js";
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import type { RollupBuild, RollupOptions } from "rollup";
|
2
|
-
import { VizCache } from "./vizCache";
|
3
2
|
import { FileCollection, VizId } from "@vizhub/viz-types";
|
4
|
-
import {
|
5
|
-
import {
|
3
|
+
import { VizCache } from "./vizCache.js";
|
4
|
+
import { SlugCache } from "./slugCache.js";
|
5
|
+
import { SvelteCompiler } from "./transformSvelte.js";
|
6
6
|
export declare const computeBundleJSV3: ({ files, rollup, enableSourcemap, vizCache, vizId, slugCache, getSvelteCompiler, }: {
|
7
7
|
files: FileCollection;
|
8
8
|
rollup: (options: RollupOptions) => Promise<RollupBuild>;
|
package/dist/types/v3/index.d.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export { v3Build } from "./v3Build";
|
1
|
+
export { v3Build } from "./v3Build.js";
|
package/dist/types/v3/types.d.ts
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
import { RollupBuild, RollupOptions } from "rollup";
|
2
|
-
import { VizCache } from "./vizCache";
|
2
|
+
import { VizCache } from "./vizCache.js";
|
3
3
|
import { FileCollection, VizId } from "@vizhub/viz-types";
|
4
|
-
import { SlugCache } from "./slugCache";
|
5
|
-
import { SvelteCompiler } from "./transformSvelte";
|
4
|
+
import { SlugCache } from "./slugCache.js";
|
5
|
+
import { SvelteCompiler } from "./transformSvelte.js";
|
6
6
|
export declare const v3Build: ({ files, rollup, enableSourcemap, vizCache, vizId, slugCache, getSvelteCompiler, }: {
|
7
7
|
files: FileCollection;
|
8
8
|
rollup: (options: RollupOptions) => Promise<RollupBuild>;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { InputPluginOption } from "rollup";
|
2
2
|
import { VizId } from "@vizhub/viz-types";
|
3
|
-
import { SlugCache } from "./slugCache";
|
3
|
+
import { SlugCache } from "./slugCache.js";
|
4
4
|
export declare const vizResolve: ({ vizId, slugCache, }: {
|
5
5
|
vizId: VizId;
|
6
6
|
slugCache?: SlugCache;
|