@vizhub/runtime 0.4.0 → 0.6.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/README.md +33 -21
- package/dist/{buildHTML.d.ts → build/build.d.ts} +5 -6
- package/dist/build/build.d.ts.map +1 -0
- package/dist/{determineRuntimeVersion.d.ts → build/determineRuntimeVersion.d.ts} +1 -1
- package/dist/build/determineRuntimeVersion.d.ts.map +1 -0
- package/dist/build/determineRuntimeVersion.test.d.ts.map +1 -0
- package/dist/build/index.d.ts +2 -0
- package/dist/build/index.d.ts.map +1 -0
- package/dist/build/types.d.ts +7 -0
- package/dist/build/types.d.ts.map +1 -0
- package/dist/{slugCache-CxGQFqi6.js → build-DU4cyBtp.js} +351 -337
- package/dist/build-DU4cyBtp.js.map +1 -0
- package/dist/build-DkIslKFi.cjs +214 -0
- package/dist/build-DkIslKFi.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +5 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +167 -73
- package/dist/index.js.map +1 -1
- package/dist/{createRuntime.d.ts → orchestration/createRuntime.d.ts} +1 -2
- package/dist/orchestration/createRuntime.d.ts.map +1 -0
- package/dist/orchestration/generateRequestId.d.ts +2 -0
- package/dist/orchestration/generateRequestId.d.ts.map +1 -0
- package/dist/orchestration/setupBuild.d.ts +10 -0
- package/dist/orchestration/setupBuild.d.ts.map +1 -0
- package/dist/orchestration/setupInvalidateVizCache.d.ts +3 -0
- package/dist/orchestration/setupInvalidateVizCache.d.ts.map +1 -0
- package/dist/{types.d.ts → orchestration/types.d.ts} +26 -14
- package/dist/orchestration/types.d.ts.map +1 -0
- package/dist/orchestration/worker.d.ts.map +1 -0
- package/dist/test/end-to-end.test.d.ts +2 -0
- package/dist/test/end-to-end.test.d.ts.map +1 -0
- package/dist/test/orchestration.test.d.ts +2 -0
- package/dist/test/orchestration.test.d.ts.map +1 -0
- package/dist/test/testInBrowser.d.ts.map +1 -1
- package/dist/test/testMockedIframeWithWorker.d.ts +2 -1
- package/dist/test/testMockedIframeWithWorker.d.ts.map +1 -1
- package/dist/test/testRuntimeWithWorker.d.ts +4 -3
- package/dist/test/testRuntimeWithWorker.d.ts.map +1 -1
- package/dist/test/testStackTrace.d.ts.map +1 -1
- package/dist/v3/computeBundleJSV3.d.ts +2 -2
- package/dist/v3/computeBundleJSV3.d.ts.map +1 -1
- package/dist/v3/htmlTemplate.d.ts.map +1 -1
- package/dist/v3/index.d.ts +9 -0
- package/dist/v3/index.d.ts.map +1 -1
- package/dist/v3/v3Build.d.ts +2 -1
- package/dist/v3/v3Build.d.ts.map +1 -1
- package/dist/v4/bundleModule.d.ts.map +1 -1
- package/dist/worker.cjs +1 -1
- package/dist/worker.cjs.map +1 -1
- package/dist/worker.js +41 -37
- package/dist/worker.js.map +1 -1
- package/package.json +4 -2
- package/dist/buildHTML.d.ts.map +0 -1
- package/dist/createRuntime.d.ts.map +0 -1
- package/dist/determineRuntimeVersion.d.ts.map +0 -1
- package/dist/determineRuntimeVersion.test.d.ts.map +0 -1
- package/dist/slugCache-Bt1Sipcs.cjs +0 -214
- package/dist/slugCache-Bt1Sipcs.cjs.map +0 -1
- package/dist/slugCache-CxGQFqi6.js.map +0 -1
- package/dist/test/iframeWorkerManagement.test.d.ts +0 -2
- package/dist/test/iframeWorkerManagement.test.d.ts.map +0 -1
- package/dist/test/v3-hot-reloading.test.d.ts +0 -2
- package/dist/test/v3-hot-reloading.test.d.ts.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/worker.d.ts.map +0 -1
- /package/dist/{determineRuntimeVersion.test.d.ts → build/determineRuntimeVersion.test.d.ts} +0 -0
- /package/dist/{worker.d.ts → orchestration/worker.d.ts} +0 -0
package/README.md
CHANGED
@@ -18,20 +18,20 @@ The library automatically detects which runtime version to use based on the file
|
|
18
18
|
- **v3**: When only `index.js` is present (no `index.html`)
|
19
19
|
- **v4**: When `index.html` contains ES module scripts with import maps
|
20
20
|
|
21
|
-
| Feature
|
22
|
-
|
|
23
|
-
| **Custom `index.html`**
|
24
|
-
| **Local ES Modules**
|
25
|
-
| **UMD Libraries**
|
26
|
-
| **ESM Libraries**
|
27
|
-
| **React JSX**
|
28
|
-
| **TypeScript**
|
29
|
-
| **Svelte**
|
30
|
-
| **Cross-Viz Imports**
|
31
|
-
| **Hot Reloading**
|
32
|
-
| **State Management**
|
33
|
-
| **Import from CSV**
|
34
|
-
| **`fetch` proxy**
|
21
|
+
| Feature | **V1** | **V2** | **V3** | **V4** |
|
22
|
+
| ----------------------- | ------ | ------ | ------ | ------ |
|
23
|
+
| **Custom `index.html`** | ✅ | ✅ | ⬜️ | ✅ |
|
24
|
+
| **Local ES Modules** | ⬜️ | ✅ | ✅ | ✅ |
|
25
|
+
| **UMD Libraries** | ✅ | ✅ | ✅ | ⬜️ |
|
26
|
+
| **ESM Libraries** | ⬜️ | ⬜️ | ⬜️ | ✅ |
|
27
|
+
| **React JSX** | ⬜️ | ✅ | ⬜️ | ✅ |
|
28
|
+
| **TypeScript** | ⬜️ | ⬜️ | ⬜️ | ✅ |
|
29
|
+
| **Svelte** | ⬜️ | ⬜️ | ✅ | ⬜️ |
|
30
|
+
| **Cross-Viz Imports** | ⬜️ | ⬜️ | ✅ | ⬜️ |
|
31
|
+
| **Hot Reloading** | ⬜️ | ⬜️ | ✅ | ⬜️ |
|
32
|
+
| **State Management** | ⬜️ | ⬜️ | ✅ | ⬜️ |
|
33
|
+
| **Import from CSV** | ⬜️ | ⬜️ | ✅ | ⬜️ |
|
34
|
+
| **`fetch` proxy** | ✅ | ✅ | ⬜️ | ✅ |
|
35
35
|
|
36
36
|
## V1 Runtime
|
37
37
|
|
@@ -288,11 +288,11 @@ npm install @vizhub/runtime
|
|
288
288
|
### Basic Usage
|
289
289
|
|
290
290
|
```javascript
|
291
|
-
import {
|
291
|
+
import { build } from "@vizhub/runtime";
|
292
292
|
import { rollup } from "rollup";
|
293
293
|
|
294
294
|
// Simple v1 runtime (HTML only)
|
295
|
-
const html = await
|
295
|
+
const html = await build({
|
296
296
|
files: {
|
297
297
|
"index.html":
|
298
298
|
"<html><body><h1>Hello World</h1></body></html>",
|
@@ -300,7 +300,7 @@ const html = await buildHTML({
|
|
300
300
|
});
|
301
301
|
|
302
302
|
// v2 runtime with bundling
|
303
|
-
const html = await
|
303
|
+
const html = await build({
|
304
304
|
files: {
|
305
305
|
"index.html":
|
306
306
|
'<html><body><div id="root"></div><script src="bundle.js"></script></body></html>',
|
@@ -322,7 +322,7 @@ document.body.appendChild(iframe);
|
|
322
322
|
|
323
323
|
```javascript
|
324
324
|
import {
|
325
|
-
|
325
|
+
build,
|
326
326
|
createVizCache,
|
327
327
|
createSlugCache,
|
328
328
|
} from "@vizhub/runtime";
|
@@ -359,7 +359,7 @@ const slugCache = createSlugCache({
|
|
359
359
|
});
|
360
360
|
|
361
361
|
// Build HTML with cross-viz imports
|
362
|
-
const html = await
|
362
|
+
const html = await build({
|
363
363
|
files: {
|
364
364
|
"index.js":
|
365
365
|
'import { value } from "@username/my-viz"; console.log(value);',
|
@@ -374,7 +374,7 @@ const html = await buildHTML({
|
|
374
374
|
|
375
375
|
## API Reference
|
376
376
|
|
377
|
-
###
|
377
|
+
### build(options)
|
378
378
|
|
379
379
|
Builds HTML that can be used as the `srcdoc` of an iframe.
|
380
380
|
|
@@ -448,7 +448,19 @@ Contributions are welcome! Please feel free to submit a Pull Request.
|
|
448
448
|
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
449
449
|
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
450
450
|
4. Push to the branch (`git push origin feature/amazing-feature`)
|
451
|
-
5. Open a Pull Request
|
451
|
+
5. Open a Draft Pull Request
|
452
|
+
6. Perform the Preflight Check
|
453
|
+
7. Double check if the README needs to be updated with any new changes
|
454
|
+
8. Ensure `DEBUG = true` is set back to `DEBUG = false` in the code
|
455
|
+
9. Once everything is ready, mark the PR as ready for review
|
456
|
+
10. Once approved, we will merge your PR!
|
457
|
+
|
458
|
+
### Preflight Check
|
459
|
+
|
460
|
+
Before finalizing a PR and marking it ready for review, please ensure that:
|
461
|
+
|
462
|
+
- Running `npm run preflight` passes without errors
|
463
|
+
- The demo app is still working - run `npm run demo` and click through the green buttons to see if everything still works
|
452
464
|
|
453
465
|
## License
|
454
466
|
|
@@ -1,9 +1,8 @@
|
|
1
1
|
import { FileCollection } from "@vizhub/viz-types";
|
2
2
|
import type { RollupBuild, RollupOptions } from "rollup";
|
3
|
-
import { VizCache } from "
|
4
|
-
import {
|
5
|
-
|
6
|
-
export declare const buildHTML: ({ files, rollup, enableSourcemap, vizCache, vizId, slugCache, getSvelteCompiler, }: {
|
3
|
+
import { SlugCache, SvelteCompiler, VizCache } from "../v3";
|
4
|
+
import { BuildResult } from "./types";
|
5
|
+
export declare const build: ({ files, rollup, enableSourcemap, vizCache, vizId, slugCache, getSvelteCompiler, }: {
|
7
6
|
files?: FileCollection;
|
8
7
|
rollup?: (options: RollupOptions) => Promise<RollupBuild>;
|
9
8
|
enableSourcemap?: boolean;
|
@@ -11,5 +10,5 @@ export declare const buildHTML: ({ files, rollup, enableSourcemap, vizCache, viz
|
|
11
10
|
vizId?: string;
|
12
11
|
slugCache?: SlugCache;
|
13
12
|
getSvelteCompiler?: () => Promise<SvelteCompiler>;
|
14
|
-
}) => Promise<
|
15
|
-
//# sourceMappingURL=
|
13
|
+
}) => Promise<BuildResult>;
|
14
|
+
//# sourceMappingURL=build.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/build/build.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACzD,OAAO,EAGL,SAAS,EACT,cAAc,EAEd,QAAQ,EACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAStC,eAAO,MAAM,KAAK,GAAU,oFAQzB;IAGD,KAAK,CAAC,EAAE,cAAc,CAAC;IAGvB,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;IAQ1D,eAAe,CAAC,EAAE,OAAO,CAAC;IAI1B,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAGpB,KAAK,CAAC,EAAE,MAAM,CAAC;IAGf,SAAS,CAAC,EAAE,SAAS,CAAC;IAGtB,iBAAiB,CAAC,EAAE,MAAM,OAAO,CAAC,cAAc,CAAC,CAAC;CACnD,KAAG,OAAO,CAAC,WAAW,CA4GtB,CAAC"}
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import { FileCollection } from "@vizhub/viz-types";
|
2
|
-
import
|
2
|
+
import { runtimeVersion } from "./types";
|
3
3
|
export declare const determineRuntimeVersion: (files: FileCollection) => runtimeVersion | null;
|
4
4
|
//# sourceMappingURL=determineRuntimeVersion.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"determineRuntimeVersion.d.ts","sourceRoot":"","sources":["../../src/build/determineRuntimeVersion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,eAAO,MAAM,uBAAuB,GAClC,OAAO,cAAc,KACpB,cAAc,GAAG,IA4BnB,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"determineRuntimeVersion.test.d.ts","sourceRoot":"","sources":["../../src/build/determineRuntimeVersion.test.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/build/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/build/types.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAGvD,MAAM,MAAM,WAAW,GAAG;IAKxB,IAAI,EAAE,MAAM,CAAC;IAIb,GAAG,CAAC,EAAE,MAAM,CAAC;IAIb,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,CAAC"}
|