@oddsquad/vite-plugin-lit 0.3.0 → 0.4.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 (70) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/README.md +10 -6
  3. package/dist/client/assets/{browser-agent-rpc-BXhoSh1z-BvWe4sTJ.js → browser-agent-rpc-BXhoSh1z-CdtPhBL-.js} +2 -2
  4. package/dist/client/assets/{browser-agent-rpc-BXhoSh1z-BvWe4sTJ.js.map → browser-agent-rpc-BXhoSh1z-CdtPhBL-.js.map} +1 -1
  5. package/dist/client/assets/flow-DK8vmxvN.js +745 -0
  6. package/dist/client/assets/flow-DK8vmxvN.js.map +1 -0
  7. package/dist/client/assets/{index-CFrVgNfS.js → index-DVe6M4HV.js} +976 -102
  8. package/dist/client/assets/index-DVe6M4HV.js.map +1 -0
  9. package/dist/client/index.html +1 -1
  10. package/lib/devframe/protocol.d.ts.map +1 -1
  11. package/lib/devframe/protocol.js +1 -0
  12. package/lib/devframe/protocol.js.map +1 -1
  13. package/lib/devframe/vite.d.ts.map +1 -1
  14. package/lib/devframe/vite.js +1 -0
  15. package/lib/devframe/vite.js.map +1 -1
  16. package/lib/options.d.ts +131 -0
  17. package/lib/options.d.ts.map +1 -0
  18. package/lib/options.js +128 -0
  19. package/lib/options.js.map +1 -0
  20. package/lib/plugin.d.ts +6 -148
  21. package/lib/plugin.d.ts.map +1 -1
  22. package/lib/plugin.js +14 -477
  23. package/lib/plugin.js.map +1 -1
  24. package/lib/plugins/css-literals.d.ts +15 -0
  25. package/lib/plugins/css-literals.d.ts.map +1 -0
  26. package/lib/plugins/css-literals.js +154 -0
  27. package/lib/plugins/css-literals.js.map +1 -0
  28. package/lib/plugins/css-queries.d.ts +20 -0
  29. package/lib/plugins/css-queries.d.ts.map +1 -0
  30. package/lib/plugins/css-queries.js +139 -0
  31. package/lib/plugins/css-queries.js.map +1 -0
  32. package/lib/plugins/open-in-editor.d.ts +16 -0
  33. package/lib/plugins/open-in-editor.d.ts.map +1 -0
  34. package/lib/plugins/open-in-editor.js +91 -0
  35. package/lib/plugins/open-in-editor.js.map +1 -0
  36. package/lib/plugins/shared.d.ts +13 -0
  37. package/lib/plugins/shared.d.ts.map +1 -0
  38. package/lib/plugins/shared.js +23 -0
  39. package/lib/plugins/shared.js.map +1 -0
  40. package/lib/plugins/timeline-virtual.d.ts +19 -0
  41. package/lib/plugins/timeline-virtual.d.ts.map +1 -0
  42. package/lib/plugins/timeline-virtual.js +53 -0
  43. package/lib/plugins/timeline-virtual.js.map +1 -0
  44. package/lib/runtime/css.d.ts.map +1 -1
  45. package/lib/runtime/css.js +9 -2
  46. package/lib/runtime/css.js.map +1 -1
  47. package/lib/runtime/inspector/install.js +61 -11
  48. package/lib/runtime/inspector/install.js.map +1 -1
  49. package/lib/runtime/source-overlay/overlay-element.d.ts.map +1 -1
  50. package/lib/runtime/source-overlay/overlay-element.js +19 -6
  51. package/lib/runtime/source-overlay/overlay-element.js.map +1 -1
  52. package/lib/runtime/timeline/install.js +10 -5
  53. package/lib/runtime/timeline/install.js.map +1 -1
  54. package/lib/runtime/timeline/public-api.d.ts +2 -2
  55. package/lib/runtime/timeline/public-api.js +2 -2
  56. package/lib/runtime/timeline/public-api.js.map +1 -1
  57. package/lib/runtime/timeline/render.d.ts +15 -6
  58. package/lib/runtime/timeline/render.d.ts.map +1 -1
  59. package/lib/runtime/timeline/render.js +150 -11
  60. package/lib/runtime/timeline/render.js.map +1 -1
  61. package/package.json +4 -1
  62. package/types/timeline.d.ts +12 -1
  63. package/types/timeline.d.ts.map +1 -1
  64. package/types/timeline.js +2 -0
  65. package/types/timeline.js.map +1 -1
  66. package/dist/client/assets/index-CFrVgNfS.js.map +0 -1
  67. package/lib/timeline-plugin.d.ts +0 -72
  68. package/lib/timeline-plugin.d.ts.map +0 -1
  69. package/lib/timeline-plugin.js +0 -359
  70. package/lib/timeline-plugin.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,54 @@
3
3
  Notable changes per release. Versions before 0.3.0 predate this file; see the
4
4
  git history for those.
5
5
 
6
+ ## 0.4.0 — 2026-09-29
7
+
8
+ A maintenance release. The timeline panel stays fast with a full buffer, the
9
+ live inspector stops walking the whole page, and several failures that used to
10
+ pass silently now say so. Releases are published from CI now.
11
+
12
+ ### Added
13
+
14
+ - **Verbose render layer.** lit-html's per-part debug events (template
15
+ instantiation, `set part`, each binding commit) go to a new "Lit Render
16
+ (verbose)" layer. It is off by default, because it fires once per binding on
17
+ every render. Values are summarized as strings (`string:"…"`, `node:<li>`,
18
+ `template`, `function:onClick`) and never passed through.
19
+ - **Releases from a version tag.** Pushing a `v*` tag runs the CI gate, checks
20
+ the tag against `package.json` and `CHANGELOG.md`, publishes to npm over
21
+ trusted publishing (OIDC), and creates the GitHub Release from the changelog
22
+ section. Prereleases go to the `next` dist-tag.
23
+
24
+ ### Changed
25
+
26
+ - **The timeline list renders only the visible rows**, through
27
+ `@lit-labs/virtualizer`. A 2500-event recording keeps about 75 rows in the
28
+ DOM instead of one per event. Filtering reruns only when the events or
29
+ filters change.
30
+ - **Live inspector mode no longer re-walks the page on every mutation.**
31
+ Batches with no custom element or shadow root in them are dropped, and
32
+ relevant batches walk only the subtrees they added.
33
+ - **The docs site was rewritten** in plain language, with a tutorial, task-sized
34
+ DevTools guides, a troubleshooting page, screenshots in both themes, and the
35
+ Lit Design System's colours and type.
36
+
37
+ ### Fixed
38
+
39
+ - The source overlay's default hotkey is Ctrl+Shift+S, as documented. The
40
+ runtime used to fall back to `e`, which also collided with the DevTools pick
41
+ command.
42
+ - The source overlay removes its HMR listeners when it disconnects. Moving the
43
+ element used to register the toggle twice, so the Vite DevTools overlay
44
+ command did nothing, and a removed overlay kept reacting.
45
+ - `urlSheet()` and `?css-sheet` warn when a stylesheet fails to load, and treat
46
+ non-ok responses as failures. A 404 used to hand Vite's fallback page to the
47
+ sheet as CSS, with a clean console. The sheet keeps its last good CSS.
48
+ - An unknown `LIT_PLUGIN_HMR_ON_INCOMPATIBLE` value logs a warning and falls
49
+ back to the default, instead of quietly acting as `reload`.
50
+ - The Lightning CSS pass over `css` literals finds them by parsing the module,
51
+ so `css`-tagged text inside a string, a comment, or another template literal
52
+ is no longer rewritten.
53
+
6
54
  ## 0.3.0 — 2026-09-17
7
55
 
8
56
  The DevTools half of the plugin was rebuilt on
package/README.md CHANGED
@@ -26,7 +26,7 @@ This plugin fixes that with two cooperating mechanisms:
26
26
  re-executed module patches the originally-registered class in place, then
27
27
  restores reactive property values through the new accessors.
28
28
 
29
- [How it works →](https://oddcelot.github.io/vite-plugin-lit/getting-started/how-it-works/)
29
+ [How it works →](https://oddcelot.github.io/vite-plugin-lit/concepts/how-hmr-works/)
30
30
 
31
31
  ## Usage
32
32
 
@@ -51,7 +51,7 @@ CSS literal processing apply in both dev and build.
51
51
  - **[Stylesheets at scale](https://oddcelot.github.io/vite-plugin-lit/guides/stylesheets/)**
52
52
  — one shared `CSSStyleSheet` for thousands of shadow roots, hot-swapped
53
53
  without re-rendering, from a bare `?css-sheet` import.
54
- - **[DevTools timeline](https://oddcelot.github.io/vite-plugin-lit/guides/devtools-timeline/)**
54
+ - **[DevTools timeline](https://oddcelot.github.io/vite-plugin-lit/guides/devtools/)**
55
55
  — a layered event recorder and live component inspector inside Vite DevTools.
56
56
  - **[Source overlay](https://oddcelot.github.io/vite-plugin-lit/guides/source-overlay/)**
57
57
  — click any element in the page to open its source in your editor.
@@ -65,15 +65,18 @@ Reference:
65
65
  [environment variables](https://oddcelot.github.io/vite-plugin-lit/reference/environment-variables/) ·
66
66
  [import queries](https://oddcelot.github.io/vite-plugin-lit/reference/import-queries/) ·
67
67
  [runtime API](https://oddcelot.github.io/vite-plugin-lit/reference/runtime-api/) ·
68
+ [CLI](https://oddcelot.github.io/vite-plugin-lit/reference/cli/) ·
68
69
  [limitations](https://oddcelot.github.io/vite-plugin-lit/reference/limitations/) ·
69
- [benchmarks](https://oddcelot.github.io/vite-plugin-lit/reference/benchmarks/)
70
+ [compatibility](https://oddcelot.github.io/vite-plugin-lit/reference/compatibility/) ·
71
+ [benchmarks](https://oddcelot.github.io/vite-plugin-lit/reference/benchmarks/) ·
72
+ [troubleshooting](https://oddcelot.github.io/vite-plugin-lit/guides/troubleshooting/)
70
73
 
71
74
  ## Coding agents (MCP)
72
75
 
73
76
  The DevTools panel's data is also exposed as MCP tools — `lit_list-components`,
74
- `lit_component-details`, `lit_recent-events`, `lit_get-meta`,
75
- `lit_hmr-incompatibilities`, `lit_set-recording` — so an agent can read the
76
- live component tree and timeline instead of guessing from source.
77
+ `lit_component-details`, `lit_update-summary`, `lit_recent-events`,
78
+ `lit_get-meta`, `lit_hmr-incompatibilities`, `lit_set-recording` — so an agent
79
+ can read the live component tree and timeline instead of guessing from source.
77
80
 
78
81
  These answer only while a Vite dev server with DevTools is **running**. There
79
82
  is no stored data and nothing to go stale: with the server down an agent gets
@@ -135,6 +138,7 @@ pnpm dev # builds the plugin, then serves http://localhost:5179
135
138
  ## Development
136
139
 
137
140
  Requires Node 26 and pnpm 12 (`corepack enable` picks up the pinned version).
141
+ The published package itself runs on Node 20 or newer.
138
142
 
139
143
  ```sh
140
144
  pnpm install # workspace: root package + playground + docs
@@ -1,4 +1,4 @@
1
- import { n as onBrowserAgentToolsChanged, r as nanoid, t as listBrowserAgentTools } from "./index-CFrVgNfS.js";
1
+ import { n as onBrowserAgentToolsChanged, r as nanoid, t as listBrowserAgentTools } from "./index-DVe6M4HV.js";
2
2
  //#region node_modules/.pnpm/devframe@1.0.0_@devframes+agentic@1.0.0_cac@7.0.0_srvx@1.0.5/node_modules/devframe/dist/browser-agent-rpc-BXhoSh1z.mjs
3
3
  var CLIENT_ID_STORAGE_KEY = "devframe:client-id";
4
4
  var memoryClientId;
@@ -66,4 +66,4 @@ function setupBrowserAgentRpcBridge(rpc) {
66
66
  //#endregion
67
67
  export { setupBrowserAgentRpcBridge };
68
68
 
69
- //# sourceMappingURL=browser-agent-rpc-BXhoSh1z-BvWe4sTJ.js.map
69
+ //# sourceMappingURL=browser-agent-rpc-BXhoSh1z-CdtPhBL-.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"browser-agent-rpc-BXhoSh1z-BvWe4sTJ.js","names":[],"sources":["../../../node_modules/.pnpm/devframe@1.0.0_@devframes+agentic@1.0.0_cac@7.0.0_srvx@1.0.5/node_modules/devframe/dist/browser-agent-rpc-BXhoSh1z.mjs"],"sourcesContent":["import { nanoid } from \"./utils/nanoid.mjs\";\nimport { n as onBrowserAgentToolsChanged, t as listBrowserAgentTools } from \"./browser-agent-Pu-FLk6I.mjs\";\n//#region src/client/client-id.ts\nconst CLIENT_ID_STORAGE_KEY = \"devframe:client-id\";\nlet memoryClientId;\n/**\n* This browser tab's stable client id: one nanoid per tab, persisted in\n* `sessionStorage` so it survives page reloads and RPC reconnects. The node\n* side uses it to tell connected tabs apart across reconnects (see #394).\n*\n* Tab duplication copies `sessionStorage`, so two tabs can briefly share an id\n* until per-tab disambiguation lands with the wider tab-metadata work.\n*/\nfunction resolveClientId(win = globalThis.window) {\n\ttry {\n\t\tconst storage = win?.sessionStorage;\n\t\tif (storage) {\n\t\t\tlet id = storage.getItem(CLIENT_ID_STORAGE_KEY);\n\t\t\tif (!id) {\n\t\t\t\tid = nanoid();\n\t\t\t\tstorage.setItem(CLIENT_ID_STORAGE_KEY, id);\n\t\t\t}\n\t\t\treturn id;\n\t\t}\n\t} catch {}\n\tmemoryClientId ??= nanoid();\n\treturn memoryClientId;\n}\n//#endregion\n//#region src/client/browser-agent-rpc.ts\n/** Mirror this document's browser-agent registry over its existing RPC connection. */\nfunction setupBrowserAgentRpcBridge(rpc) {\n\trpc.client.register({\n\t\tname: \"devframe:agent:invoke-client-tool\",\n\t\ttype: \"action\",\n\t\tjsonSerializable: true,\n\t\thandler: async (id, args) => {\n\t\t\tconst tool = listBrowserAgentTools().find((tool) => tool.id === id);\n\t\t\tif (!tool) throw new Error(`[devframe/agent] browser tool \"${id}\" not found`);\n\t\t\treturn await tool.invoke(args);\n\t\t}\n\t});\n\tlet queued = false;\n\tlet disposed = false;\n\tlet lastSyncedCount = 0;\n\tconst sync = () => {\n\t\tif (queued || disposed) return;\n\t\tqueued = true;\n\t\tqueueMicrotask(async () => {\n\t\t\tqueued = false;\n\t\t\tif (disposed) return;\n\t\t\tconst manifests = listBrowserAgentTools().map(({ invoke: _, ...manifest }) => manifest);\n\t\t\tif (manifests.length === 0 && lastSyncedCount === 0) return;\n\t\t\tlastSyncedCount = manifests.length;\n\t\t\tawait rpc.callOptional(\"devframe:agent:sync-client-tools\", resolveClientId(), manifests).catch(() => {});\n\t\t});\n\t};\n\tconst stopTools = onBrowserAgentToolsChanged(sync);\n\tconst stopConnection = rpc.events.on(\"connection:status\", (status) => {\n\t\tif (status === \"connected\") sync();\n\t});\n\tsync();\n\treturn () => {\n\t\tdisposed = true;\n\t\tstopTools();\n\t\tstopConnection();\n\t};\n}\n//#endregion\nexport { setupBrowserAgentRpcBridge };\n"],"x_google_ignoreList":[0],"mappings":";;AAGA,IAAM,wBAAwB;AAC9B,IAAI;;;;;;;;;AASJ,SAAS,gBAAgB,MAAM,WAAW,QAAQ;CACjD,IAAI;EACH,MAAM,UAAU,KAAK;EACrB,IAAI,SAAS;GACZ,IAAI,KAAK,QAAQ,QAAQ,qBAAqB;GAC9C,IAAI,CAAC,IAAI;IACR,KAAK,OAAO;IACZ,QAAQ,QAAQ,uBAAuB,EAAE;GAC1C;GACA,OAAO;EACR;CACD,QAAQ,CAAC;CACT,mBAAmB,OAAO;CAC1B,OAAO;AACR;;AAIA,SAAS,2BAA2B,KAAK;CACxC,IAAI,OAAO,SAAS;EACnB,MAAM;EACN,MAAM;EACN,kBAAkB;EAClB,SAAS,OAAO,IAAI,SAAS;GAC5B,MAAM,OAAO,sBAAsB,CAAC,CAAC,MAAM,SAAS,KAAK,OAAO,EAAE;GAClE,IAAI,CAAC,MAAM,MAAM,IAAI,MAAM,kCAAkC,GAAG,YAAY;GAC5E,OAAO,MAAM,KAAK,OAAO,IAAI;EAC9B;CACD,CAAC;CACD,IAAI,SAAS;CACb,IAAI,WAAW;CACf,IAAI,kBAAkB;CACtB,MAAM,aAAa;EAClB,IAAI,UAAU,UAAU;EACxB,SAAS;EACT,eAAe,YAAY;GAC1B,SAAS;GACT,IAAI,UAAU;GACd,MAAM,YAAY,sBAAsB,CAAC,CAAC,KAAK,EAAE,QAAQ,GAAG,GAAG,eAAe,QAAQ;GACtF,IAAI,UAAU,WAAW,KAAK,oBAAoB,GAAG;GACrD,kBAAkB,UAAU;GAC5B,MAAM,IAAI,aAAa,oCAAoC,gBAAgB,GAAG,SAAS,CAAC,CAAC,YAAY,CAAC,CAAC;EACxG,CAAC;CACF;CACA,MAAM,YAAY,2BAA2B,IAAI;CACjD,MAAM,iBAAiB,IAAI,OAAO,GAAG,sBAAsB,WAAW;EACrE,IAAI,WAAW,aAAa,KAAK;CAClC,CAAC;CACD,KAAK;CACL,aAAa;EACZ,WAAW;EACX,UAAU;EACV,eAAe;CAChB;AACD"}
1
+ {"version":3,"file":"browser-agent-rpc-BXhoSh1z-CdtPhBL-.js","names":[],"sources":["../../../node_modules/.pnpm/devframe@1.0.0_@devframes+agentic@1.0.0_cac@7.0.0_srvx@1.0.5/node_modules/devframe/dist/browser-agent-rpc-BXhoSh1z.mjs"],"sourcesContent":["import { nanoid } from \"./utils/nanoid.mjs\";\nimport { n as onBrowserAgentToolsChanged, t as listBrowserAgentTools } from \"./browser-agent-Pu-FLk6I.mjs\";\n//#region src/client/client-id.ts\nconst CLIENT_ID_STORAGE_KEY = \"devframe:client-id\";\nlet memoryClientId;\n/**\n* This browser tab's stable client id: one nanoid per tab, persisted in\n* `sessionStorage` so it survives page reloads and RPC reconnects. The node\n* side uses it to tell connected tabs apart across reconnects (see #394).\n*\n* Tab duplication copies `sessionStorage`, so two tabs can briefly share an id\n* until per-tab disambiguation lands with the wider tab-metadata work.\n*/\nfunction resolveClientId(win = globalThis.window) {\n\ttry {\n\t\tconst storage = win?.sessionStorage;\n\t\tif (storage) {\n\t\t\tlet id = storage.getItem(CLIENT_ID_STORAGE_KEY);\n\t\t\tif (!id) {\n\t\t\t\tid = nanoid();\n\t\t\t\tstorage.setItem(CLIENT_ID_STORAGE_KEY, id);\n\t\t\t}\n\t\t\treturn id;\n\t\t}\n\t} catch {}\n\tmemoryClientId ??= nanoid();\n\treturn memoryClientId;\n}\n//#endregion\n//#region src/client/browser-agent-rpc.ts\n/** Mirror this document's browser-agent registry over its existing RPC connection. */\nfunction setupBrowserAgentRpcBridge(rpc) {\n\trpc.client.register({\n\t\tname: \"devframe:agent:invoke-client-tool\",\n\t\ttype: \"action\",\n\t\tjsonSerializable: true,\n\t\thandler: async (id, args) => {\n\t\t\tconst tool = listBrowserAgentTools().find((tool) => tool.id === id);\n\t\t\tif (!tool) throw new Error(`[devframe/agent] browser tool \"${id}\" not found`);\n\t\t\treturn await tool.invoke(args);\n\t\t}\n\t});\n\tlet queued = false;\n\tlet disposed = false;\n\tlet lastSyncedCount = 0;\n\tconst sync = () => {\n\t\tif (queued || disposed) return;\n\t\tqueued = true;\n\t\tqueueMicrotask(async () => {\n\t\t\tqueued = false;\n\t\t\tif (disposed) return;\n\t\t\tconst manifests = listBrowserAgentTools().map(({ invoke: _, ...manifest }) => manifest);\n\t\t\tif (manifests.length === 0 && lastSyncedCount === 0) return;\n\t\t\tlastSyncedCount = manifests.length;\n\t\t\tawait rpc.callOptional(\"devframe:agent:sync-client-tools\", resolveClientId(), manifests).catch(() => {});\n\t\t});\n\t};\n\tconst stopTools = onBrowserAgentToolsChanged(sync);\n\tconst stopConnection = rpc.events.on(\"connection:status\", (status) => {\n\t\tif (status === \"connected\") sync();\n\t});\n\tsync();\n\treturn () => {\n\t\tdisposed = true;\n\t\tstopTools();\n\t\tstopConnection();\n\t};\n}\n//#endregion\nexport { setupBrowserAgentRpcBridge };\n"],"x_google_ignoreList":[0],"mappings":";;AAGA,IAAM,wBAAwB;AAC9B,IAAI;;;;;;;;;AASJ,SAAS,gBAAgB,MAAM,WAAW,QAAQ;CACjD,IAAI;EACH,MAAM,UAAU,KAAK;EACrB,IAAI,SAAS;GACZ,IAAI,KAAK,QAAQ,QAAQ,qBAAqB;GAC9C,IAAI,CAAC,IAAI;IACR,KAAK,OAAO;IACZ,QAAQ,QAAQ,uBAAuB,EAAE;GAC1C;GACA,OAAO;EACR;CACD,QAAQ,CAAC;CACT,mBAAmB,OAAO;CAC1B,OAAO;AACR;;AAIA,SAAS,2BAA2B,KAAK;CACxC,IAAI,OAAO,SAAS;EACnB,MAAM;EACN,MAAM;EACN,kBAAkB;EAClB,SAAS,OAAO,IAAI,SAAS;GAC5B,MAAM,OAAO,sBAAsB,CAAC,CAAC,MAAM,SAAS,KAAK,OAAO,EAAE;GAClE,IAAI,CAAC,MAAM,MAAM,IAAI,MAAM,kCAAkC,GAAG,YAAY;GAC5E,OAAO,MAAM,KAAK,OAAO,IAAI;EAC9B;CACD,CAAC;CACD,IAAI,SAAS;CACb,IAAI,WAAW;CACf,IAAI,kBAAkB;CACtB,MAAM,aAAa;EAClB,IAAI,UAAU,UAAU;EACxB,SAAS;EACT,eAAe,YAAY;GAC1B,SAAS;GACT,IAAI,UAAU;GACd,MAAM,YAAY,sBAAsB,CAAC,CAAC,KAAK,EAAE,QAAQ,GAAG,GAAG,eAAe,QAAQ;GACtF,IAAI,UAAU,WAAW,KAAK,oBAAoB,GAAG;GACrD,kBAAkB,UAAU;GAC5B,MAAM,IAAI,aAAa,oCAAoC,gBAAgB,GAAG,SAAS,CAAC,CAAC,YAAY,CAAC,CAAC;EACxG,CAAC;CACF;CACA,MAAM,YAAY,2BAA2B,IAAI;CACjD,MAAM,iBAAiB,IAAI,OAAO,GAAG,sBAAsB,WAAW;EACrE,IAAI,WAAW,aAAa,KAAK;CAClC,CAAC;CACD,KAAK;CACL,aAAa;EACZ,WAAW;EACX,UAAU;EACV,eAAe;CAChB;AACD"}