solid-tag-runtime 0.0.3 → 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
@@ -197,7 +197,7 @@ This permits ordinary JavaScript and JSX modules to coexist in one graph.
197
197
 
198
198
  `solid-tag-runtime/html` is an opt-in browser-facing adapter over the core module runtime.
199
199
 
200
- `0.0.3` makes the adapter runtime-aware rather than treating document scripts as a single global pool.
200
+ `0.0.3` made the adapter runtime-aware rather than treating document scripts as a single global pool.
201
201
 
202
202
  Important architectural boundary:
203
203
 
@@ -397,7 +397,7 @@ An entry may therefore import a dependency that appears later in the same discov
397
397
 
398
398
  `flush()` waits for queued observer work and scans again, providing a deterministic synchronization point after external DOM mutations.
399
399
 
400
- Observation in `0.0.3` remains addition-only: changing attributes/text of an already owned script or removing it does not implicitly update/remove the runtime module. Module replacement remains explicit through the core runtime update/invalidation APIs.
400
+ Observation remains addition-only: changing attributes/text of an already owned script or removing it does not implicitly update/remove the runtime module. Module replacement remains explicit through the core runtime update/invalidation APIs.
401
401
 
402
402
  ### Supported script declarations
403
403
 
@@ -890,7 +890,7 @@ Reason: applications that dynamically insert runtime modules should not need to
890
890
 
891
891
  ### 2026-10-02 — Persistent HTML runtime controllers own DOM/module bindings
892
892
 
893
- Decision: `0.0.3` adds `createHTMLRuntime(runtime, options)` as the preferred advanced HTML API while keeping `registerHTML()`, `observeHTML()`, and `defineScript()` as compatibility conveniences.
893
+ Decision: `0.0.3` added `createHTMLRuntime(runtime, options)` as the preferred advanced HTML API while keeping `registerHTML()`, `observeHTML()`, and `defineScript()` as compatibility conveniences.
894
894
 
895
895
  Reason: once multiple runtimes, explicit append/register helpers, and observers coexist, ownership must be represented by a persistent object instead of implicit document-wide behavior.
896
896
 
@@ -912,3 +912,17 @@ Decision: scoped controllers stamp/use `data-solid-runtime="<scope>"` for discov
912
912
 
913
913
  Reason: attributes are useful across declarative HTML and DevTools but cannot uniquely identify a controller instance or safely coordinate concurrent registration work.
914
914
 
915
+
916
+ ### 0.0.4 — typing/test/documentation hardening
917
+
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
@@ -113,7 +113,7 @@ import {
113
113
  await registerHTML(runtime);
114
114
  ```
115
115
 
116
- For applications that may have multiple runtimes or that create runtime scripts programmatically, `0.0.3` adds a persistent HTML runtime controller:
116
+ For applications that may have multiple runtimes or that create runtime scripts programmatically, `0.0.3` added a persistent HTML runtime controller:
117
117
 
118
118
  ```ts
119
119
  import { createHTMLRuntime } from "solid-tag-runtime/html";
@@ -243,7 +243,7 @@ The observer is for DOM changes that happen **outside** the controller API. Pref
243
243
 
244
244
  All HTML controllers share an internal `WeakMap` of script element → ownership/registration record.
245
245
 
246
- That gives `0.0.3` these guarantees:
246
+ That controller model gives these guarantees:
247
247
 
248
248
  - one script element has at most one HTML-runtime owner;
249
249
  - manual registration and observer registration cannot compile the same element twice;
@@ -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.3`.
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/html.d.ts CHANGED
@@ -4,26 +4,26 @@ import type { ModuleFormat, ModuleNamespaceLike, SolidTagRuntime } from "./index
4
4
  export interface HTMLModuleScriptElement {
5
5
  textContent?: string | null;
6
6
  baseURI?: string;
7
- ownerDocument?: HTMLDocumentLike;
7
+ ownerDocument?: HTMLDocumentLike | null;
8
8
  getAttribute(name: string): string | null;
9
9
  hasAttribute?(name: string): boolean;
10
10
  setAttribute?(name: string, value: string): void;
11
11
  }
12
12
 
13
13
  export interface HTMLAppendTarget {
14
- append?(element: HTMLModuleScriptElement): void;
15
- appendChild?(element: HTMLModuleScriptElement): unknown;
14
+ append?(...nodes: any[]): void;
15
+ appendChild?(element: any): unknown;
16
16
  }
17
17
 
18
18
  export interface HTMLDocumentLike extends HTMLModuleRoot, HTMLAppendTarget {
19
19
  body?: HTMLAppendTarget;
20
20
  documentElement?: HTMLAppendTarget;
21
- createElement?(tagName: string): HTMLModuleScriptElement;
21
+ createElement?(tagName: string): any;
22
22
  }
23
23
 
24
24
  export interface HTMLModuleRoot {
25
25
  baseURI?: string;
26
- ownerDocument?: HTMLDocumentLike;
26
+ ownerDocument?: HTMLDocumentLike | null;
27
27
  body?: HTMLAppendTarget;
28
28
  documentElement?: HTMLAppendTarget;
29
29
  querySelectorAll(selector: string): Iterable<HTMLModuleScriptElement> | ArrayLike<HTMLModuleScriptElement>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "solid-tag-runtime",
3
- "version": "0.0.3",
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
  };