@vizhub/runtime 4.2.0 → 4.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.
Files changed (48) hide show
  1. package/README.md +20 -3
  2. package/dist/build/build.d.ts.map +1 -1
  3. package/dist/{build-DnPT2Qew.js → build-BT6ouBQg.js} +474 -333
  4. package/dist/build-BT6ouBQg.js.map +1 -0
  5. package/dist/build-Dh4OViu-.cjs +317 -0
  6. package/dist/build-Dh4OViu-.cjs.map +1 -0
  7. package/dist/common/runtimeErrorHandling.d.ts.map +1 -1
  8. package/dist/index.cjs +1 -1
  9. package/dist/index.cjs.map +1 -1
  10. package/dist/index.js +55 -51
  11. package/dist/index.js.map +1 -1
  12. package/dist/orchestration/createRuntime.d.ts.map +1 -1
  13. package/dist/orchestration/types.d.ts +1 -0
  14. package/dist/orchestration/types.d.ts.map +1 -1
  15. package/dist/orchestration/worker.d.ts.map +1 -1
  16. package/dist/test/fixtures/v3/basicIndexJSWithViz.d.ts +4 -0
  17. package/dist/test/fixtures/v3/basicIndexJSWithViz.d.ts.map +1 -0
  18. package/dist/test/fixtures/v3/index.d.ts +1 -0
  19. package/dist/test/fixtures/v3/index.d.ts.map +1 -1
  20. package/dist/test/v3BuildIntegrationViz.test.d.ts +2 -0
  21. package/dist/test/v3BuildIntegrationViz.test.d.ts.map +1 -0
  22. package/dist/test/v4HotReload.test.d.ts +2 -0
  23. package/dist/test/v4HotReload.test.d.ts.map +1 -0
  24. package/dist/test/v4HotReloadIntegration.test.d.ts +2 -0
  25. package/dist/test/v4HotReloadIntegration.test.d.ts.map +1 -0
  26. package/dist/test/vizExportSupport.test.d.ts +2 -0
  27. package/dist/test/vizExportSupport.test.d.ts.map +1 -0
  28. package/dist/test/vizPriorityTest.test.d.ts +2 -0
  29. package/dist/test/vizPriorityTest.test.d.ts.map +1 -0
  30. package/dist/v2/getComputedIndexHtml.d.ts.map +1 -1
  31. package/dist/v3/computeBundleJSV3.d.ts.map +1 -1
  32. package/dist/v3/transformSvelte.d.ts +1 -1
  33. package/dist/v3/transformSvelte.d.ts.map +1 -1
  34. package/dist/v4/extractEntryPoints.d.ts.map +1 -1
  35. package/dist/v4/hotReloadScript.d.ts +6 -0
  36. package/dist/v4/hotReloadScript.d.ts.map +1 -0
  37. package/dist/v4/index.d.ts +12 -0
  38. package/dist/v4/index.d.ts.map +1 -1
  39. package/dist/v4/updateHTML.d.ts +1 -1
  40. package/dist/v4/updateHTML.d.ts.map +1 -1
  41. package/dist/worker.cjs +1 -1
  42. package/dist/worker.cjs.map +1 -1
  43. package/dist/worker.js +1 -1
  44. package/dist/worker.js.map +1 -1
  45. package/package.json +5 -5
  46. package/dist/build-BXOhZlRS.cjs +0 -256
  47. package/dist/build-BXOhZlRS.cjs.map +0 -1
  48. package/dist/build-DnPT2Qew.js.map +0 -1
package/README.md CHANGED
@@ -28,7 +28,7 @@ The library automatically detects which runtime version to use based on the file
28
28
  | **React JSX** | ⬜️ | ✅ | ⬜️ | ✅ |
29
29
  | **Svelte** | ⬜️ | ⬜️ | ✅ | ⬜️ |
30
30
  | **Cross-Viz Imports** | ⬜️ | ⬜️ | ✅ | ⬜️ |
31
- | **Hot Reloading** | ⬜️ | ⬜️ | ✅ | ⬜️ |
31
+ | **Hot Reloading** | ⬜️ | ⬜️ | ✅ | |
32
32
  | **State Management** | ⬜️ | ⬜️ | ✅ | ⬜️ |
33
33
  | **Import from CSV** | ⬜️ | ⬜️ | ✅ | ⬜️ |
34
34
  | **TypeScript** | ⬜️ | ⬜️ | ⬜️ | ✅ |
@@ -304,18 +304,35 @@ V4 is ideal for modern browsers with native ES module support, TypeScript develo
304
304
  - Import maps for direct CDN dependencies
305
305
  - Native ES modules without bundling
306
306
  - Local module imports with relative paths
307
+ - Hot reloading for fast development iteration
308
+
309
+ ### V4 Hot Reloading
310
+
311
+ V4 runtime supports hot reloading similar to V3, allowing for rapid development cycles without full page refreshes. When `enableHotReloading` is set to `true`, the V4 runtime:
312
+
313
+ - Monitors code changes and re-bundles ES modules
314
+ - Sends updated JavaScript to the iframe via `runJS` messages
315
+ - Replaces existing module script tags with updated bundled code
316
+ - Preserves the current browser state where possible
317
+
318
+ The hot reloading system works by:
319
+
320
+ 1. Bundling ES modules using Rollup (similar to V3)
321
+ 2. Injecting a hot reload script that listens for update messages
322
+ 3. Replacing module scripts dynamically when code changes
323
+ 4. Re-executing the updated modules in the current context
324
+
325
+ Unlike V3's built-in state management, V4 hot reloading relies on the application's own state management (e.g., React state, DOM state) to preserve state between updates.
307
326
 
308
327
  ## Key Features
309
328
 
310
329
  - **Multi-Version Runtime Support**
311
-
312
330
  - **v1**: Simple HTML execution with fetch proxying
313
331
  - **v2**: JavaScript bundling with Rollup, JSX support, and CDN-based dependency resolution
314
332
  - **v3**: Advanced module bundling with Svelte support and cross-viz imports
315
333
  - **v4**: Modern ES Modules with import maps for direct browser execution
316
334
 
317
335
  - **Comprehensive Tooling**
318
-
319
336
  - **Bundling**: Seamless integration with Rollup for module bundling
320
337
  - **Transpilation**: Support for JSX (v2) and Svelte components (v3)
321
338
  - **Dependency Management**: Automatic resolution via CDNs (jsDelivr/unpkg)
@@ -1 +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;AA+BtC,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;I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