@vizhub/runtime 0.1.1 → 0.1.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/README.md +18 -12
- package/dist/computeSrcDoc.test.d.ts +2 -0
- package/dist/computeSrcDoc.test.d.ts.map +1 -0
- package/dist/index.js +0 -1
- package/dist/useRuntime.d.ts.map +1 -1
- package/package.json +1 -2
package/README.md
CHANGED
@@ -4,12 +4,13 @@ The `@vizhub-core/runtime` package is a core component of the VizHub platform, r
|
|
4
4
|
|
5
5
|
## Features
|
6
6
|
|
7
|
-
- **
|
7
|
+
- **Source code to HTML transformation**: Converts source code to HTML with embedded scripts and styles, ready for rendering in a browser.
|
8
|
+
- **File transformations**: Transforms various file types (e.g., JavaScript, CSS, CSV, Svelte) to be used in the runtime environment.
|
8
9
|
- **Hot reloading**: Automatically reloads visualizations when files are updated, providing a smooth development experience.
|
9
10
|
- **Dependency management**: Handles external dependencies via CDN and supports custom package configurations.
|
10
|
-
- **File transformations**: Transforms various file types (e.g., JavaScript, CSS, CSV, Svelte) to be used in the runtime environment.
|
11
11
|
- **Virtual file system**: Implements a virtual file system for handling imports and file loading within the runtime.
|
12
12
|
- **Web Worker-based build system**: Uses Web Workers to offload the build process, ensuring a responsive UI during development.
|
13
|
+
- **Multi-version runtime support**: Supports both V2 and V3 runtime environments, allowing for backward compatibility and future-proofing.
|
13
14
|
|
14
15
|
## Installation
|
15
16
|
|
@@ -64,11 +65,16 @@ test("computeSrcDoc", async () => {
|
|
64
65
|
resolveSlug,
|
65
66
|
getSvelteCompiler,
|
66
67
|
});
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
68
|
+
|
69
|
+
const randomID = initialSrcdoc.match(/viz-container-(\d+)/)?.[1];
|
70
|
+
|
71
|
+
const srcdocWithoutMapping = initialSrcdoc.replace(
|
72
|
+
/\/\/# sourceMappingURL=.*$/gm,
|
73
|
+
""
|
74
|
+
);
|
75
|
+
|
76
|
+
expect(srcdocWithoutMapping).toEqual(`<!DOCTYPE html>
|
77
|
+
<html>
|
72
78
|
<head>
|
73
79
|
<meta charset="utf-8">
|
74
80
|
<style>
|
@@ -76,21 +82,21 @@ test("computeSrcDoc", async () => {
|
|
76
82
|
margin: 0;
|
77
83
|
overflow: hidden;
|
78
84
|
}
|
79
|
-
#viz-container
|
85
|
+
#viz-container-${randomID} {
|
80
86
|
height: 100vh;
|
81
87
|
}
|
82
88
|
</style>
|
83
89
|
</head>
|
84
90
|
<body>
|
85
|
-
<div id="viz-container
|
86
|
-
<script id="injected-script">(function(g,f){typeof exports==='object'&&typeof module!=='undefined'?f(exports):typeof define==='function'&&define.amd?define(['exports'],f):(g=typeof globalThis!=='undefined'?globalThis:g||self,f(g.Viz={}));})(this,(function(exports){'use strict';const main = (container) => container.innerHTML = 'Hello, world!';exports.main=main;}))
|
91
|
+
<div id="viz-container-${randomID}"></div>
|
92
|
+
<script id="injected-script">(function(g,f){typeof exports==='object'&&typeof module!=='undefined'?f(exports):typeof define==='function'&&define.amd?define(['exports'],f):(g=typeof globalThis!=='undefined'?globalThis:g||self,f(g.Viz={}));})(this,(function(exports){'use strict';const main = (container) => container.innerHTML = 'Hello, world!';exports.main=main;}));
|
93
|
+
|
87
94
|
|
88
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzIjpbInVuZGVmaW5lZC9pbmRleC5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgY29uc3QgbWFpbiA9IChjb250YWluZXIpID0+IGNvbnRhaW5lci5pbm5lckhUTUwgPSAnSGVsbG8sIHdvcmxkISc7Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJ5UEFBWSxNQUFDLElBQUksR0FBRyxDQUFDLFNBQVMsS0FBSyxTQUFTLENBQUMsU0FBUyxHQUFHIn0=</script>
|
89
95
|
<script>
|
90
96
|
(() => {
|
91
97
|
let cleanup;
|
92
98
|
const render = () => {
|
93
|
-
const container = document.getElementById('viz-container
|
99
|
+
const container = document.getElementById('viz-container-${randomID}');
|
94
100
|
typeof cleanup === 'function' && cleanup();
|
95
101
|
cleanup = Viz.main(container, { state: window.state, setState, writeFile });
|
96
102
|
};
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"computeSrcDoc.test.d.ts","sourceRoot":"","sources":["../src/computeSrcDoc.test.ts"],"names":[],"mappings":""}
|
package/dist/index.js
CHANGED
@@ -24646,7 +24646,6 @@ const useRuntime = ({
|
|
24646
24646
|
slugResolutionCache,
|
24647
24647
|
submitContentOperation
|
24648
24648
|
}) => {
|
24649
|
-
console.log("here in useRuntime!");
|
24650
24649
|
const initialMount = useRef(true);
|
24651
24650
|
const runtimeVersion = useMemo(
|
24652
24651
|
() => getRuntimeVersion(content),
|
package/dist/useRuntime.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useRuntime.d.ts","sourceRoot":"","sources":["../src/useRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAKV,MAAM,OAAO,CAAC;AACf,OAAO,EACL,OAAO,EAEP,OAAO,EACP,KAAK,EAGN,MAAM,UAAU,CAAC;AAOlB,eAAO,MAAM,UAAU,gJASpB;IACD,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,SAAS,CAAC,iBAAiB,CAAC,CAAC;IACxC,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,qBAAqB,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACtD,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAG1C,QAAQ,EAAE,OAAO,CAAC;IAClB,mBAAmB,EAAE,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC5C,sBAAsB,EAAE,CACtB,IAAI,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,KAChC,IAAI,CAAC;CACX,
|
1
|
+
{"version":3,"file":"useRuntime.d.ts","sourceRoot":"","sources":["../src/useRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAKV,MAAM,OAAO,CAAC;AACf,OAAO,EACL,OAAO,EAEP,OAAO,EACP,KAAK,EAGN,MAAM,UAAU,CAAC;AAOlB,eAAO,MAAM,UAAU,gJASpB;IACD,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,SAAS,CAAC,iBAAiB,CAAC,CAAC;IACxC,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,qBAAqB,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACtD,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAG1C,QAAQ,EAAE,OAAO,CAAC;IAClB,mBAAmB,EAAE,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC5C,sBAAsB,EAAE,CACtB,IAAI,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,KAChC,IAAI,CAAC;CACX,SAwVA,CAAC"}
|
package/package.json
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vizhub/runtime",
|
3
|
-
"version": "0.1.
|
3
|
+
"version": "0.1.3",
|
4
4
|
"type": "module",
|
5
5
|
"main": "dist/index",
|
6
6
|
"types": "dist/index.d.ts",
|
7
|
-
"exports": "./src/index.ts",
|
8
7
|
"scripts": {
|
9
8
|
"tsc": "tsc --noEmit",
|
10
9
|
"test": "vitest run --reporter verbose",
|