solid-tag-runtime 0.0.4 → 0.0.5

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/ARCHITECTURE.md CHANGED
@@ -916,3 +916,13 @@ Reason: attributes are useful across declarative HTML and DevTools but cannot un
916
916
  ### 0.0.4 — typing/test/documentation hardening
917
917
 
918
918
  Decision: publish the next package as `0.0.4` because `0.0.3` has already been published. `0.0.4` preserves the `0.0.3` runtime/HTML semantics while shipping the DOM-compatible HTML adapter declaration fixes, broader regression coverage, and updated feature documentation. No module-resolution, ownership, execution-backend, or cache-invalidation semantics change in this release.
919
+ ### 0.0.5 — fresh module identity after invalidation
920
+
921
+ Decision: every execution-backend `create(code)` call must produce a fresh native ESM module identity, even when the generated source text is byte-for-byte identical to an earlier version. The `data:` backend now appends a monotonically increasing fragment to each generated URL. This matches the naturally unique URLs returned by `URL.createObjectURL()` and prevents the browser/Node ESM cache from returning a previously evaluated module after `invalidate()`, `update()`, or `defineModule()` replacement.
922
+
923
+ Reason: replacing a host namespace correctly invalidated its dependents in the runtime graph, but a deterministic `data:` URL could recreate the exact same URL for the host bridge and dependent source. Native ESM caches by URL, so the old evaluation was reused and dependents continued to observe stale host exports.
924
+
925
+ Invariant: invalidation must result in a fresh executable module identity on the next compile/import. Cache invalidation is not complete if the execution backend can recreate an already-evaluated URL.
926
+
927
+ Regression coverage: host-module replacement must update already-imported dependents, and explicit `runtime.invalidate()` must cause a side-effecting module to evaluate again on the next import.
928
+
package/README.md CHANGED
@@ -272,7 +272,7 @@ solid-module → infer from module/src extension
272
272
 
273
273
  ### Addition-only observation
274
274
 
275
- Observation remains addition-only in `0.0.4`.
275
+ Observation remains addition-only in `0.0.5`.
276
276
 
277
277
  Changing the source/attributes of an already owned script or removing it from the DOM does not implicitly update/delete the corresponding runtime module. Use `runtime.update()` / `runtime.invalidate()` for explicit module lifecycle changes.
278
278
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "solid-tag-runtime",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "Runtime module system for JSX modules compiled with solid-tag and executed through @solidjs/html",
5
5
  "type": "module",
6
6
  "exports": {
@@ -23,10 +23,17 @@ export function createBlobModuleUrlBackend() {
23
23
  }
24
24
 
25
25
  export function createDataModuleUrlBackend() {
26
+ let sequence = 0;
27
+
26
28
  return {
27
29
  kind: "data",
28
30
  create(code) {
29
- return `data:text/javascript;charset=utf-8,${encodeURIComponent(code)}`;
31
+ // Native ESM caches modules by URL. Recreating the same data: URL after
32
+ // invalidation would otherwise return the previously evaluated module.
33
+ // Give every backend create() call a fresh module identity, matching the
34
+ // naturally unique identity of URL.createObjectURL() in the blob backend.
35
+ const identity = ++sequence;
36
+ return `data:text/javascript;charset=utf-8,${encodeURIComponent(code)}#solid-tag-runtime-${identity}`;
30
37
  },
31
38
  revoke() {},
32
39
  };