@oddsquad/vite-plugin-lit 0.3.0 → 0.5.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 (124) hide show
  1. package/CHANGELOG.md +118 -0
  2. package/README.md +26 -11
  3. package/bin.mjs +16 -12
  4. package/dist/client/assets/{browser-agent-rpc-BXhoSh1z-BvWe4sTJ.js → browser-agent-rpc-BXhoSh1z-CRHFLjFo.js} +2 -2
  5. package/dist/client/assets/{browser-agent-rpc-BXhoSh1z-BvWe4sTJ.js.map → browser-agent-rpc-BXhoSh1z-CRHFLjFo.js.map} +1 -1
  6. package/dist/client/assets/flow-DK8vmxvN.js +745 -0
  7. package/dist/client/assets/flow-DK8vmxvN.js.map +1 -0
  8. package/dist/client/assets/{index-CFrVgNfS.js → index-Gn4Hk_9s.js} +2749 -793
  9. package/dist/client/assets/index-Gn4Hk_9s.js.map +1 -0
  10. package/dist/client/index.html +11 -1
  11. package/lib/devframe/definition.d.ts +7 -0
  12. package/lib/devframe/definition.d.ts.map +1 -1
  13. package/lib/devframe/definition.js +56 -11
  14. package/lib/devframe/definition.js.map +1 -1
  15. package/lib/devframe/launch-editor.d.ts +20 -0
  16. package/lib/devframe/launch-editor.d.ts.map +1 -0
  17. package/lib/devframe/launch-editor.js +40 -0
  18. package/lib/devframe/launch-editor.js.map +1 -0
  19. package/lib/devframe/protocol.d.ts +31 -4
  20. package/lib/devframe/protocol.d.ts.map +1 -1
  21. package/lib/devframe/protocol.js +22 -3
  22. package/lib/devframe/protocol.js.map +1 -1
  23. package/lib/devframe/rpc-source.d.ts +44 -0
  24. package/lib/devframe/rpc-source.d.ts.map +1 -0
  25. package/lib/devframe/rpc-source.js +150 -0
  26. package/lib/devframe/rpc-source.js.map +1 -0
  27. package/lib/devframe/source.d.ts +12 -0
  28. package/lib/devframe/source.d.ts.map +1 -1
  29. package/lib/devframe/source.js +12 -0
  30. package/lib/devframe/source.js.map +1 -1
  31. package/lib/devframe/vite.d.ts +2 -0
  32. package/lib/devframe/vite.d.ts.map +1 -1
  33. package/lib/devframe/vite.js +3 -8
  34. package/lib/devframe/vite.js.map +1 -1
  35. package/lib/options.d.ts +136 -0
  36. package/lib/options.d.ts.map +1 -0
  37. package/lib/options.js +175 -0
  38. package/lib/options.js.map +1 -0
  39. package/lib/override-baselines.d.ts +17 -0
  40. package/lib/override-baselines.d.ts.map +1 -0
  41. package/lib/override-baselines.js +25 -0
  42. package/lib/override-baselines.js.map +1 -0
  43. package/lib/plugin.d.ts +6 -148
  44. package/lib/plugin.d.ts.map +1 -1
  45. package/lib/plugin.js +22 -477
  46. package/lib/plugin.js.map +1 -1
  47. package/lib/plugins/css-literals.d.ts +15 -0
  48. package/lib/plugins/css-literals.d.ts.map +1 -0
  49. package/lib/plugins/css-literals.js +154 -0
  50. package/lib/plugins/css-literals.js.map +1 -0
  51. package/lib/plugins/css-queries.d.ts +20 -0
  52. package/lib/plugins/css-queries.d.ts.map +1 -0
  53. package/lib/plugins/css-queries.js +139 -0
  54. package/lib/plugins/css-queries.js.map +1 -0
  55. package/lib/plugins/open-in-editor.d.ts +16 -0
  56. package/lib/plugins/open-in-editor.d.ts.map +1 -0
  57. package/lib/plugins/open-in-editor.js +96 -0
  58. package/lib/plugins/open-in-editor.js.map +1 -0
  59. package/lib/plugins/shared.d.ts +13 -0
  60. package/lib/plugins/shared.d.ts.map +1 -0
  61. package/lib/plugins/shared.js +23 -0
  62. package/lib/plugins/shared.js.map +1 -0
  63. package/lib/plugins/timeline-virtual.d.ts +19 -0
  64. package/lib/plugins/timeline-virtual.d.ts.map +1 -0
  65. package/lib/plugins/timeline-virtual.js +53 -0
  66. package/lib/plugins/timeline-virtual.js.map +1 -0
  67. package/lib/runtime/css.d.ts.map +1 -1
  68. package/lib/runtime/css.js +9 -2
  69. package/lib/runtime/css.js.map +1 -1
  70. package/lib/runtime/indicator.js.map +1 -1
  71. package/lib/runtime/inspector/install.js +65 -13
  72. package/lib/runtime/inspector/install.js.map +1 -1
  73. package/lib/runtime/inspector/serialize.d.ts.map +1 -1
  74. package/lib/runtime/inspector/serialize.js +20 -0
  75. package/lib/runtime/inspector/serialize.js.map +1 -1
  76. package/lib/runtime/overrides.d.ts +4 -10
  77. package/lib/runtime/overrides.d.ts.map +1 -1
  78. package/lib/runtime/overrides.js +5 -3
  79. package/lib/runtime/overrides.js.map +1 -1
  80. package/lib/runtime/page-channel.d.ts +52 -0
  81. package/lib/runtime/page-channel.d.ts.map +1 -0
  82. package/lib/runtime/page-channel.js +67 -0
  83. package/lib/runtime/page-channel.js.map +1 -0
  84. package/lib/runtime/patch.d.ts.map +1 -1
  85. package/lib/runtime/patch.js +2 -1
  86. package/lib/runtime/patch.js.map +1 -1
  87. package/lib/runtime/rpc-transport.d.ts +46 -0
  88. package/lib/runtime/rpc-transport.d.ts.map +1 -0
  89. package/lib/runtime/rpc-transport.js +82 -0
  90. package/lib/runtime/rpc-transport.js.map +1 -0
  91. package/lib/runtime/source-overlay/overlay-element.d.ts.map +1 -1
  92. package/lib/runtime/source-overlay/overlay-element.js +30 -7
  93. package/lib/runtime/source-overlay/overlay-element.js.map +1 -1
  94. package/lib/runtime/timeline/install.js +25 -9
  95. package/lib/runtime/timeline/install.js.map +1 -1
  96. package/lib/runtime/timeline/public-api.d.ts +2 -2
  97. package/lib/runtime/timeline/public-api.d.ts.map +1 -1
  98. package/lib/runtime/timeline/public-api.js +13 -5
  99. package/lib/runtime/timeline/public-api.js.map +1 -1
  100. package/lib/runtime/timeline/render.d.ts +15 -6
  101. package/lib/runtime/timeline/render.d.ts.map +1 -1
  102. package/lib/runtime/timeline/render.js +150 -11
  103. package/lib/runtime/timeline/render.js.map +1 -1
  104. package/lib/runtime/timeline/transport.d.ts +6 -9
  105. package/lib/runtime/timeline/transport.d.ts.map +1 -1
  106. package/lib/runtime/timeline/transport.js.map +1 -1
  107. package/lib/timeline/filter.d.ts +38 -0
  108. package/lib/timeline/filter.d.ts.map +1 -0
  109. package/lib/timeline/filter.js +44 -0
  110. package/lib/timeline/filter.js.map +1 -0
  111. package/lib/timeline/tracks.d.ts +113 -0
  112. package/lib/timeline/tracks.d.ts.map +1 -0
  113. package/lib/timeline/tracks.js +168 -0
  114. package/lib/timeline/tracks.js.map +1 -0
  115. package/package.json +9 -1
  116. package/types/timeline.d.ts +50 -1
  117. package/types/timeline.d.ts.map +1 -1
  118. package/types/timeline.js +4 -0
  119. package/types/timeline.js.map +1 -1
  120. package/dist/client/assets/index-CFrVgNfS.js.map +0 -1
  121. package/lib/timeline-plugin.d.ts +0 -72
  122. package/lib/timeline-plugin.d.ts.map +0 -1
  123. package/lib/timeline-plugin.js +0 -359
  124. package/lib/timeline-plugin.js.map +0 -1
@@ -12,6 +12,18 @@
12
12
  const MAX_DEPTH = 2;
13
13
  const MAX_ITEMS = 8;
14
14
  const MAX_STRING = 120;
15
+ /**
16
+ * `'Temporal.Instant'`, `'Temporal.PlainDate'`, … for a Temporal value, else
17
+ * `undefined`. Reads the spec's `Symbol.toStringTag` rather than touching the
18
+ * `Temporal` global, so it works on pages without native Temporal (Safari,
19
+ * at the time of writing) and with polyfilled values alike.
20
+ */
21
+ const temporalTag = (value) => {
22
+ const tag = value[Symbol.toStringTag];
23
+ return typeof tag === 'string' && tag.startsWith('Temporal.')
24
+ ? tag
25
+ : undefined;
26
+ };
15
27
  /** A short type label for the details table's "type" column. */
16
28
  export const typeTag = (value) => {
17
29
  if (value === null) return 'null';
@@ -22,6 +34,8 @@ export const typeTag = (value) => {
22
34
  if (value instanceof Map) return `Map(${value.size})`;
23
35
  if (value instanceof Set) return `Set(${value.size})`;
24
36
  if (value instanceof Node) return 'Node';
37
+ const temporal = temporalTag(value);
38
+ if (temporal !== undefined) return temporal;
25
39
  const name = value.constructor?.name;
26
40
  return name !== undefined && name !== 'Object' ? name : 'object';
27
41
  };
@@ -53,6 +67,12 @@ const serializeAt = (value, depth, seen) => {
53
67
  if (seen.has(obj)) return '[Circular]';
54
68
  if (value instanceof Node) return previewNode(value);
55
69
  if (value instanceof Date) return value.toISOString();
70
+ // Temporal objects have no own enumerable fields, so the generic object
71
+ // branch would show `{}`. Their `toString()` is the ISO form.
72
+ const temporal = temporalTag(obj);
73
+ if (temporal !== undefined) {
74
+ return `${temporal}(${obj.toString()})`;
75
+ }
56
76
  if (value instanceof RegExp) return String(value);
57
77
  if (value instanceof Map) return `Map(${value.size})`;
58
78
  if (value instanceof Set) return `Set(${value.size})`;
@@ -1 +1 @@
1
- {"version":3,"file":"serialize.js","sourceRoot":"","sources":["../../../src/lib/runtime/inspector/serialize.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;GAKG;AAEH,MAAM,SAAS,GAAG,CAAC,CAAC;AACpB,MAAM,SAAS,GAAG,CAAC,CAAC;AACpB,MAAM,UAAU,GAAG,GAAG,CAAC;AAEvB,gEAAgE;AAChE,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,KAAc,EAAU,EAAE;IAChD,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,MAAM,CAAC;IAClC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,SAAS,KAAK,CAAC,MAAM,GAAG,CAAC;IAC1D,MAAM,CAAC,GAAG,OAAO,KAAK,CAAC;IACvB,IAAI,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,UAAU;QAAE,OAAO,CAAC,CAAC;IACjD,IAAI,CAAC,KAAK,UAAU;QAAE,OAAO,UAAU,CAAC;IACxC,IAAI,KAAK,YAAY,GAAG;QAAE,OAAO,OAAO,KAAK,CAAC,IAAI,GAAG,CAAC;IACtD,IAAI,KAAK,YAAY,GAAG;QAAE,OAAO,OAAO,KAAK,CAAC,IAAI,GAAG,CAAC;IACtD,IAAI,KAAK,YAAY,IAAI;QAAE,OAAO,MAAM,CAAC;IACzC,MAAM,IAAI,GAAI,KAAgB,CAAC,WAAW,EAAE,IAAI,CAAC;IACjD,OAAO,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,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C,GAAI,KAAiC,CAAC,CAAC,CAAC,CAAC;YAC5C,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,GAAG,CAAC,kBAAkB,CAAC;YAChC,CAAC;YACD,OAAO,GAAG,CAAC,KAAK,WAAW,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC;QACpD,CAAC,CAAC,CAAC;QACH,IAAI,IAAI,CAAC,MAAM,GAAG,SAAS,EAAE,CAAC;YAC5B,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,MAAM,GAAG,SAAS,EAAE,CAAC,CAAC;QAC7C,CAAC;QACD,MAAM,IAAI,GAAG,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC;QACnC,MAAM,MAAM,GAAG,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QACzE,OAAO,GAAG,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;IAC1C,CAAC;YAAS,CAAC;QACT,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACnB,CAAC;AACH,CAAC,CAAC;AAEF,oEAAoE;AACpE,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAc,EAAU,EAAE;IAClD,IAAI,CAAC;QACH,OAAO,WAAW,CAAC,KAAK,EAAE,CAAC,EAAE,IAAI,OAAO,EAAE,CAAC,CAAC;IAC9C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,kBAAkB,CAAC;IAC5B,CAAC;AACH,CAAC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * Compact, depth- and breadth-limited previews of arbitrary property values\n * for the inspector details pane. Values cross the transport as plain strings,\n * so this never needs to round-trip — it only has to be readable and safe\n * (circular refs, DOM nodes, functions, huge collections all handled).\n */\n\nconst MAX_DEPTH = 2;\nconst MAX_ITEMS = 8;\nconst MAX_STRING = 120;\n\n/** A short type label for the details table's \"type\" column. */\nexport const typeTag = (value: unknown): string => {\n if (value === null) return 'null';\n if (Array.isArray(value)) return `Array(${value.length})`;\n const t = typeof value;\n if (t !== 'object' && t !== 'function') return t;\n if (t === 'function') return 'function';\n if (value instanceof Map) return `Map(${value.size})`;\n if (value instanceof Set) return `Set(${value.size})`;\n if (value instanceof Node) return 'Node';\n const name = (value as object).constructor?.name;\n return name !== undefined && name !== 'Object' ? name : 'object';\n};\n\nconst truncate = (s: string): string =>\n s.length > MAX_STRING ? s.slice(0, MAX_STRING) + '…' : s;\n\nconst previewNode = (node: Node): string => {\n if (node instanceof Element) {\n const id = node.id ? `#${node.id}` : '';\n return `<${node.tagName.toLowerCase()}${id}>`;\n }\n return `#${node.nodeName.toLowerCase()}`;\n};\n\nconst serializeAt = (\n value: unknown,\n depth: number,\n seen: WeakSet<object>\n): string => {\n if (value === null) return 'null';\n if (value === undefined) return 'undefined';\n\n // Narrow on `value` rather than a saved `typeof`: the compiler cannot carry\n // a discriminant through a separate variable.\n if (typeof value === 'string') return JSON.stringify(truncate(value));\n if (typeof value === 'number' || typeof value === 'boolean') {\n return String(value);\n }\n if (typeof value === 'bigint') return `${value}n`;\n if (typeof value === 'symbol') return value.toString();\n if (typeof value === 'function') {\n const name = (value as {name?: string}).name;\n return name ? `ƒ ${name}()` : 'ƒ ()';\n }\n\n const obj = value as object;\n if (seen.has(obj)) return '[Circular]';\n\n if (value instanceof Node) return previewNode(value);\n if (value instanceof Date) return value.toISOString();\n if (value instanceof RegExp) return String(value);\n if (value instanceof Map) return `Map(${value.size})`;\n if (value instanceof Set) return `Set(${value.size})`;\n\n if (depth >= MAX_DEPTH) {\n return Array.isArray(value) ? `Array(${value.length})` : typeTag(value);\n }\n\n // Typed arrays are indexable but not `Array.isArray`; routing them through\n // the generic object branch would make `Object.keys` materialize every index\n // (e.g. a million-element Uint8Array) before slicing. Handle them as arrays.\n if (ArrayBuffer.isView(value) && !(value instanceof DataView)) {\n const arr = value as unknown as {length: number; [i: number]: number};\n const shown = Math.min(arr.length, MAX_ITEMS);\n const items: string[] = [];\n for (let i = 0; i < shown; i++) items.push(String(arr[i]));\n if (arr.length > MAX_ITEMS) items.push(`…+${arr.length - MAX_ITEMS}`);\n return `${obj.constructor?.name ?? 'TypedArray'}(${arr.length}) [${items.join(', ')}]`;\n }\n\n seen.add(obj);\n try {\n if (Array.isArray(value)) {\n const items = value\n .slice(0, MAX_ITEMS)\n .map((v) => serializeAt(v, depth + 1, seen));\n if (value.length > MAX_ITEMS) items.push(`…+${value.length - MAX_ITEMS}`);\n return `[${items.join(', ')}]`;\n }\n // Read each property individually (keys, not entries) so a single throwing\n // getter degrades to a placeholder instead of aborting the whole preview.\n const keys = Object.keys(value as Record<string, unknown>);\n const parts = keys.slice(0, MAX_ITEMS).map((k) => {\n let v: unknown;\n try {\n v = (value as Record<string, unknown>)[k];\n } catch {\n return `${k}: [getter threw]`;\n }\n return `${k}: ${serializeAt(v, depth + 1, seen)}`;\n });\n if (keys.length > MAX_ITEMS) {\n parts.push(`…+${keys.length - MAX_ITEMS}`);\n }\n const name = obj.constructor?.name;\n const prefix = name !== undefined && name !== 'Object' ? `${name} ` : '';\n return `${prefix}{${parts.join(', ')}}`;\n } finally {\n seen.delete(obj);\n }\n};\n\n/** Produce a readable one-line preview of `value`. Never throws. */\nexport const serialize = (value: unknown): string => {\n try {\n return serializeAt(value, 0, new WeakSet());\n } catch {\n return '[unserializable]';\n }\n};\n"]}
1
+ {"version":3,"file":"serialize.js","sourceRoot":"","sources":["../../../src/lib/runtime/inspector/serialize.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;GAKG;AAEH,MAAM,SAAS,GAAG,CAAC,CAAC;AACpB,MAAM,SAAS,GAAG,CAAC,CAAC;AACpB,MAAM,UAAU,GAAG,GAAG,CAAC;AAEvB;;;;;GAKG;AACH,MAAM,WAAW,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C,EAAE,EAAE;YAC/C,IAAI,CAAU,CAAC;YACf,IAAI,CAAC;gBACH,CAAC,GAAI,KAAiC,CAAC,CAAC,CAAC,CAAC;YAC5C,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,GAAG,CAAC,kBAAkB,CAAC;YAChC,CAAC;YACD,OAAO,GAAG,CAAC,KAAK,WAAW,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC;QACpD,CAAC,CAAC,CAAC;QACH,IAAI,IAAI,CAAC,MAAM,GAAG,SAAS,EAAE,CAAC;YAC5B,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,MAAM,GAAG,SAAS,EAAE,CAAC,CAAC;QAC7C,CAAC;QACD,MAAM,IAAI,GAAG,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC;QACnC,MAAM,MAAM,GAAG,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QACzE,OAAO,GAAG,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;IAC1C,CAAC;YAAS,CAAC;QACT,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACnB,CAAC;AACH,CAAC,CAAC;AAEF,oEAAoE;AACpE,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAc,EAAU,EAAE;IAClD,IAAI,CAAC;QACH,OAAO,WAAW,CAAC,KAAK,EAAE,CAAC,EAAE,IAAI,OAAO,EAAE,CAAC,CAAC;IAC9C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,kBAAkB,CAAC;IAC5B,CAAC;AACH,CAAC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * Compact, depth- and breadth-limited previews of arbitrary property values\n * for the inspector details pane. Values cross the transport as plain strings,\n * so this never needs to round-trip — it only has to be readable and safe\n * (circular refs, DOM nodes, functions, huge collections all handled).\n */\n\nconst MAX_DEPTH = 2;\nconst MAX_ITEMS = 8;\nconst MAX_STRING = 120;\n\n/**\n * `'Temporal.Instant'`, `'Temporal.PlainDate'`, … for a Temporal value, else\n * `undefined`. Reads the spec's `Symbol.toStringTag` rather than touching the\n * `Temporal` global, so it works on pages without native Temporal (Safari,\n * at the time of writing) and with polyfilled values alike.\n */\nconst temporalTag = (value: object): string | undefined => {\n const tag = (value as {[Symbol.toStringTag]?: unknown})[Symbol.toStringTag];\n return typeof tag === 'string' && tag.startsWith('Temporal.')\n ? tag\n : undefined;\n};\n\n/** A short type label for the details table's \"type\" column. */\nexport const typeTag = (value: unknown): string => {\n if (value === null) return 'null';\n if (Array.isArray(value)) return `Array(${value.length})`;\n const t = typeof value;\n if (t !== 'object' && t !== 'function') return t;\n if (t === 'function') return 'function';\n if (value instanceof Map) return `Map(${value.size})`;\n if (value instanceof Set) return `Set(${value.size})`;\n if (value instanceof Node) return 'Node';\n const temporal = temporalTag(value as object);\n if (temporal !== undefined) return temporal;\n const name = (value as object).constructor?.name;\n return name !== undefined && name !== 'Object' ? name : 'object';\n};\n\nconst truncate = (s: string): string =>\n s.length > MAX_STRING ? s.slice(0, MAX_STRING) + '…' : s;\n\nconst previewNode = (node: Node): string => {\n if (node instanceof Element) {\n const id = node.id ? `#${node.id}` : '';\n return `<${node.tagName.toLowerCase()}${id}>`;\n }\n return `#${node.nodeName.toLowerCase()}`;\n};\n\nconst serializeAt = (\n value: unknown,\n depth: number,\n seen: WeakSet<object>\n): string => {\n if (value === null) return 'null';\n if (value === undefined) return 'undefined';\n\n // Narrow on `value` rather than a saved `typeof`: the compiler cannot carry\n // a discriminant through a separate variable.\n if (typeof value === 'string') return JSON.stringify(truncate(value));\n if (typeof value === 'number' || typeof value === 'boolean') {\n return String(value);\n }\n if (typeof value === 'bigint') return `${value}n`;\n if (typeof value === 'symbol') return value.toString();\n if (typeof value === 'function') {\n const name = (value as {name?: string}).name;\n return name ? `ƒ ${name}()` : 'ƒ ()';\n }\n\n const obj = value as object;\n if (seen.has(obj)) return '[Circular]';\n\n if (value instanceof Node) return previewNode(value);\n if (value instanceof Date) return value.toISOString();\n // Temporal objects have no own enumerable fields, so the generic object\n // branch would show `{}`. Their `toString()` is the ISO form.\n const temporal = temporalTag(obj);\n if (temporal !== undefined) {\n return `${temporal}(${(obj as {toString(): string}).toString()})`;\n }\n if (value instanceof RegExp) return String(value);\n if (value instanceof Map) return `Map(${value.size})`;\n if (value instanceof Set) return `Set(${value.size})`;\n\n if (depth >= MAX_DEPTH) {\n return Array.isArray(value) ? `Array(${value.length})` : typeTag(value);\n }\n\n // Typed arrays are indexable but not `Array.isArray`; routing them through\n // the generic object branch would make `Object.keys` materialize every index\n // (e.g. a million-element Uint8Array) before slicing. Handle them as arrays.\n if (ArrayBuffer.isView(value) && !(value instanceof DataView)) {\n const arr = value as unknown as {length: number; [i: number]: number};\n const shown = Math.min(arr.length, MAX_ITEMS);\n const items: string[] = [];\n for (let i = 0; i < shown; i++) items.push(String(arr[i]));\n if (arr.length > MAX_ITEMS) items.push(`…+${arr.length - MAX_ITEMS}`);\n return `${obj.constructor?.name ?? 'TypedArray'}(${arr.length}) [${items.join(', ')}]`;\n }\n\n seen.add(obj);\n try {\n if (Array.isArray(value)) {\n const items = value\n .slice(0, MAX_ITEMS)\n .map((v) => serializeAt(v, depth + 1, seen));\n if (value.length > MAX_ITEMS) items.push(`…+${value.length - MAX_ITEMS}`);\n return `[${items.join(', ')}]`;\n }\n // Read each property individually (keys, not entries) so a single throwing\n // getter degrades to a placeholder instead of aborting the whole preview.\n const keys = Object.keys(value as Record<string, unknown>);\n const parts = keys.slice(0, MAX_ITEMS).map((k) => {\n let v: unknown;\n try {\n v = (value as Record<string, unknown>)[k];\n } catch {\n return `${k}: [getter threw]`;\n }\n return `${k}: ${serializeAt(v, depth + 1, seen)}`;\n });\n if (keys.length > MAX_ITEMS) {\n parts.push(`…+${keys.length - MAX_ITEMS}`);\n }\n const name = obj.constructor?.name;\n const prefix = name !== undefined && name !== 'Object' ? `${name} ` : '';\n return `${prefix}{${parts.join(', ')}}`;\n } finally {\n seen.delete(obj);\n }\n};\n\n/** Produce a readable one-line preview of `value`. Never throws. */\nexport const serialize = (value: unknown): string => {\n try {\n return serializeAt(value, 0, new WeakSet());\n } catch {\n return '[unserializable]';\n }\n};\n"]}
@@ -3,21 +3,15 @@
3
3
  * Copyright 2026 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
5
5
  */
6
- /**
7
- * Browser-runtime side of the panel's live setting overrides. Reads the
8
- * persisted override (written by the panel; same origin) and subscribes to the
9
- * Vite HMR channel the server rebroadcasts panel changes on.
10
- */
6
+ import type { ViteHotLike } from './page-channel.js';
11
7
  import { type SettingsOverride } from '../../types/timeline.js';
12
- /** Minimal `import.meta.hot` shape we rely on. */
13
- type Hot = {
14
- on: (event: string, cb: (data: unknown) => void) => void;
15
- } | undefined;
8
+ /** `import.meta.hot` of the calling module, when it has one. */
9
+ type Hot = ViteHotLike | undefined;
16
10
  /** Reads the persisted override; `{}` when unset or unparsable. */
17
11
  export declare const readOverride: () => SettingsOverride;
18
12
  /**
19
13
  * Applies the persisted override immediately, then again whenever the panel
20
- * pushes a change over the HMR channel. `apply` receives the full override
14
+ * pushes a change over the page channel. `apply` receives the full override
21
15
  * object each time and should act only on the fields it owns.
22
16
  */
23
17
  export declare const subscribeOverride: (hot: Hot, apply: (override: SettingsOverride) => void) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"overrides.d.ts","sourceRoot":"","sources":["../../src/lib/runtime/overrides.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AAEH,OAAO,EAGL,KAAK,gBAAgB,EACtB,MAAM,yBAAyB,CAAC;AAEjC,kDAAkD;AAClD,KAAK,GAAG,GACJ;IAAC,EAAE,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,KAAK,IAAI,CAAA;CAAC,GAC1D,SAAS,CAAC;AAEd,mEAAmE;AACnE,eAAO,MAAM,YAAY,QAAO,gBAQ/B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,QACvB,GAAG,SACD,CAAC,QAAQ,EAAE,gBAAgB,KAAK,IAAI,KAC1C,IAKF,CAAC"}
1
+ {"version":3,"file":"overrides.d.ts","sourceRoot":"","sources":["../../src/lib/runtime/overrides.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAGL,KAAK,gBAAgB,EACtB,MAAM,yBAAyB,CAAC;AAEjC,gEAAgE;AAChE,KAAK,GAAG,GAAG,WAAW,GAAG,SAAS,CAAC;AAEnC,mEAAmE;AACnE,eAAO,MAAM,YAAY,QAAO,gBAQ/B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,QACvB,GAAG,SACD,CAAC,QAAQ,EAAE,gBAAgB,KAAK,IAAI,KAC1C,IAMF,CAAC"}
@@ -6,8 +6,9 @@
6
6
  /**
7
7
  * Browser-runtime side of the panel's live setting overrides. Reads the
8
8
  * persisted override (written by the panel; same origin) and subscribes to the
9
- * Vite HMR channel the server rebroadcasts panel changes on.
9
+ * page channel the server rebroadcasts panel changes on.
10
10
  */
11
+ import {pageChannel} from './page-channel.js';
11
12
  import {
12
13
  SETTINGS_OVERRIDE_CHANNEL,
13
14
  SETTINGS_OVERRIDE_LS_KEY,
@@ -24,11 +25,12 @@ export const readOverride = () => {
24
25
  };
25
26
  /**
26
27
  * Applies the persisted override immediately, then again whenever the panel
27
- * pushes a change over the HMR channel. `apply` receives the full override
28
+ * pushes a change over the page channel. `apply` receives the full override
28
29
  * object each time and should act only on the fields it owns.
29
30
  */
30
31
  export const subscribeOverride = (hot, apply) => {
31
32
  apply(readOverride());
32
- hot?.on(SETTINGS_OVERRIDE_CHANNEL, (data) => apply(data ?? {}));
33
+ if (hot !== undefined) pageChannel.useViteHot(hot);
34
+ pageChannel.on(SETTINGS_OVERRIDE_CHANNEL, (data) => apply(data ?? {}));
33
35
  };
34
36
  //# sourceMappingURL=overrides.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"overrides.js","sourceRoot":"","sources":["../../src/lib/runtime/overrides.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AAEH,OAAO,EACL,yBAAyB,EACzB,wBAAwB,GAEzB,MAAM,yBAAyB,CAAC;AAOjC,mEAAmE;AACnE,MAAM,CAAC,MAAM,YAAY,GAAG,GAAqB,EAAE;IACjD,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,YAAY,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAC;QAC3D,IAAI,GAAG,KAAK,IAAI;YAAE,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAqB,CAAC;IAC/D,CAAC;IAAC,MAAM,CAAC;QACP,6DAA6D;IAC/D,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,GAAQ,EACR,KAA2C,EACrC,EAAE;IACR,KAAK,CAAC,YAAY,EAAE,CAAC,CAAC;IACtB,GAAG,EAAE,EAAE,CAAC,yBAAyB,EAAE,CAAC,IAAI,EAAE,EAAE,CAC1C,KAAK,CAAC,CAAC,IAAI,IAAI,EAAE,CAAqB,CAAC,CACxC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * Browser-runtime side of the panel's live setting overrides. Reads the\n * persisted override (written by the panel; same origin) and subscribes to the\n * Vite HMR channel the server rebroadcasts panel changes on.\n */\n\nimport {\n SETTINGS_OVERRIDE_CHANNEL,\n SETTINGS_OVERRIDE_LS_KEY,\n type SettingsOverride,\n} from '../../types/timeline.js';\n\n/** Minimal `import.meta.hot` shape we rely on. */\ntype Hot =\n | {on: (event: string, cb: (data: unknown) => void) => void}\n | undefined;\n\n/** Reads the persisted override; `{}` when unset or unparsable. */\nexport const readOverride = (): SettingsOverride => {\n try {\n const raw = localStorage.getItem(SETTINGS_OVERRIDE_LS_KEY);\n if (raw !== null) return JSON.parse(raw) as SettingsOverride;\n } catch {\n // storage unavailable / malformed — fall through to defaults\n }\n return {};\n};\n\n/**\n * Applies the persisted override immediately, then again whenever the panel\n * pushes a change over the HMR channel. `apply` receives the full override\n * object each time and should act only on the fields it owns.\n */\nexport const subscribeOverride = (\n hot: Hot,\n apply: (override: SettingsOverride) => void\n): void => {\n apply(readOverride());\n hot?.on(SETTINGS_OVERRIDE_CHANNEL, (data) =>\n apply((data ?? {}) as SettingsOverride)\n );\n};\n"]}
1
+ {"version":3,"file":"overrides.js","sourceRoot":"","sources":["../../src/lib/runtime/overrides.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AAEH,OAAO,EAAC,WAAW,EAAC,MAAM,mBAAmB,CAAC;AAG9C,OAAO,EACL,yBAAyB,EACzB,wBAAwB,GAEzB,MAAM,yBAAyB,CAAC;AAKjC,mEAAmE;AACnE,MAAM,CAAC,MAAM,YAAY,GAAG,GAAqB,EAAE;IACjD,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,YAAY,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAC;QAC3D,IAAI,GAAG,KAAK,IAAI;YAAE,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAqB,CAAC;IAC/D,CAAC;IAAC,MAAM,CAAC;QACP,6DAA6D;IAC/D,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,GAAQ,EACR,KAA2C,EACrC,EAAE;IACR,KAAK,CAAC,YAAY,EAAE,CAAC,CAAC;IACtB,IAAI,GAAG,KAAK,SAAS;QAAE,WAAW,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IACnD,WAAW,CAAC,EAAE,CAAC,yBAAyB,EAAE,CAAC,IAAI,EAAE,EAAE,CACjD,KAAK,CAAC,CAAC,IAAI,IAAI,EAAE,CAAqB,CAAC,CACxC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * Browser-runtime side of the panel's live setting overrides. Reads the\n * persisted override (written by the panel; same origin) and subscribes to the\n * page channel the server rebroadcasts panel changes on.\n */\n\nimport {pageChannel} from './page-channel.js';\nimport type {ViteHotLike} from './page-channel.js';\n\nimport {\n SETTINGS_OVERRIDE_CHANNEL,\n SETTINGS_OVERRIDE_LS_KEY,\n type SettingsOverride,\n} from '../../types/timeline.js';\n\n/** `import.meta.hot` of the calling module, when it has one. */\ntype Hot = ViteHotLike | undefined;\n\n/** Reads the persisted override; `{}` when unset or unparsable. */\nexport const readOverride = (): SettingsOverride => {\n try {\n const raw = localStorage.getItem(SETTINGS_OVERRIDE_LS_KEY);\n if (raw !== null) return JSON.parse(raw) as SettingsOverride;\n } catch {\n // storage unavailable / malformed — fall through to defaults\n }\n return {};\n};\n\n/**\n * Applies the persisted override immediately, then again whenever the panel\n * pushes a change over the page channel. `apply` receives the full override\n * object each time and should act only on the fields it owns.\n */\nexport const subscribeOverride = (\n hot: Hot,\n apply: (override: SettingsOverride) => void\n): void => {\n apply(readOverride());\n if (hot !== undefined) pageChannel.useViteHot(hot);\n pageChannel.on(SETTINGS_OVERRIDE_CHANNEL, (data) =>\n apply((data ?? {}) as SettingsOverride)\n );\n};\n"]}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: BSD-3-Clause
5
+ */
6
+ /**
7
+ * The page runtime's one seam to whatever carries its traffic to the DevTools
8
+ * server. Every `lit:*` message the runtime sends or receives (timeline
9
+ * events, inspector data and commands, settings overrides, HMR-incompatibility
10
+ * notices) goes through {@link pageChannel}, never through `import.meta.hot`
11
+ * directly, so the carrier can be swapped without touching a call site.
12
+ *
13
+ * The default carrier is Vite's HMR channel ({@link fromViteHot}). An
14
+ * alternative (see `rpc-transport.ts`) is attached with
15
+ * {@link PageChannel.attach}; listeners registered earlier move over to it.
16
+ *
17
+ * Vite's own lifecycle events (`vite:afterUpdate`, `vite:beforeFullReload`,
18
+ * `vite:ws:*`) are not part of this channel: they describe the HMR connection
19
+ * itself, so the sites that care still read `import.meta.hot` for those.
20
+ */
21
+ /** A carrier for named messages between the page runtime and the server. */
22
+ export interface PageTransport {
23
+ send(channel: string, data?: unknown): void;
24
+ /** Listen on a channel. Returns the function that removes the listener. */
25
+ on(channel: string, handler: (data: unknown) => void): () => void;
26
+ }
27
+ /** The slice of `import.meta.hot` the default carrier relies on. */
28
+ export interface ViteHotLike {
29
+ send(event: string, data?: unknown): void;
30
+ on(event: string, handler: (data: any) => void): void;
31
+ off?(event: string, handler: (data: any) => void): void;
32
+ }
33
+ /** Wraps Vite's HMR client as a {@link PageTransport}. */
34
+ export declare const fromViteHot: (hot: ViteHotLike) => PageTransport;
35
+ export interface PageChannel extends PageTransport {
36
+ /** Whether a carrier is attached. Sends made before one is are dropped. */
37
+ readonly attached: boolean;
38
+ /** The carrier in use, so a replacement can hand the channel back. */
39
+ readonly transport: PageTransport | undefined;
40
+ /**
41
+ * Make `transport` the carrier. Listeners already registered are moved onto
42
+ * it and removed from the previous carrier, and `onAttach` callbacks run so
43
+ * their owners can announce themselves to the new peer.
44
+ */
45
+ attach(transport: PageTransport): void;
46
+ /** Attach Vite's HMR client, unless a carrier is already in place. */
47
+ useViteHot(hot: ViteHotLike): void;
48
+ /** Run `callback` on every later {@link attach}. Not run for past ones. */
49
+ onAttach(callback: () => void): void;
50
+ }
51
+ export declare const pageChannel: PageChannel;
52
+ //# sourceMappingURL=page-channel.d.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AO,MAAM,WAAW,EAAE,WACJ,CAAC"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: BSD-3-Clause
5
+ */
6
+ /** Wraps Vite's HMR client as a {@link PageTransport}. */
7
+ export const fromViteHot = (hot) => ({
8
+ send: (channel, data) => hot.send(channel, data),
9
+ on(channel, handler) {
10
+ hot.on(channel, handler);
11
+ return () => hot.off?.(channel, handler);
12
+ },
13
+ });
14
+ const createPageChannel = () => {
15
+ let transport;
16
+ const listeners = [];
17
+ const attachCallbacks = [];
18
+ const bind = (entry) => {
19
+ entry.off = transport?.on(entry.channel, entry.handler);
20
+ };
21
+ const channel = {
22
+ get attached() {
23
+ return transport !== undefined;
24
+ },
25
+ get transport() {
26
+ return transport;
27
+ },
28
+ send(name, data) {
29
+ transport?.send(name, data);
30
+ },
31
+ on(name, handler) {
32
+ const entry = {channel: name, handler};
33
+ listeners.push(entry);
34
+ bind(entry);
35
+ return () => {
36
+ entry.off?.();
37
+ const index = listeners.indexOf(entry);
38
+ if (index !== -1) listeners.splice(index, 1);
39
+ };
40
+ },
41
+ attach(next) {
42
+ for (const entry of listeners) entry.off?.();
43
+ transport = next;
44
+ for (const entry of listeners) bind(entry);
45
+ for (const callback of attachCallbacks) {
46
+ try {
47
+ callback();
48
+ } catch {
49
+ // One owner failing to announce must not strand the rest.
50
+ }
51
+ }
52
+ },
53
+ useViteHot(hot) {
54
+ if (transport === undefined) channel.attach(fromViteHot(hot));
55
+ },
56
+ onAttach(callback) {
57
+ attachCallbacks.push(callback);
58
+ },
59
+ };
60
+ return channel;
61
+ };
62
+ // One channel per page even if this module is loaded twice (for instance once
63
+ // through Vite's dependency optimizer and once directly), like the patch state.
64
+ const CHANNEL_KEY = Symbol.for('@lit-labs/vite-plugin-lit#page-channel');
65
+ const shared = globalThis;
66
+ export const pageChannel = (shared[CHANNEL_KEY] ??= createPageChannel());
67
+ //# sourceMappingURL=page-channel.js.map
@@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copyright 2026 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * The page runtime's one seam to whatever carries its traffic to the DevTools\n * server. Every `lit:*` message the runtime sends or receives (timeline\n * events, inspector data and commands, settings overrides, HMR-incompatibility\n * notices) goes through {@link pageChannel}, never through `import.meta.hot`\n * directly, so the carrier can be swapped without touching a call site.\n *\n * The default carrier is Vite's HMR channel ({@link fromViteHot}). An\n * alternative (see `rpc-transport.ts`) is attached with\n * {@link PageChannel.attach}; listeners registered earlier move over to it.\n *\n * Vite's own lifecycle events (`vite:afterUpdate`, `vite:beforeFullReload`,\n * `vite:ws:*`) are not part of this channel: they describe the HMR connection\n * itself, so the sites that care still read `import.meta.hot` for those.\n */\n\n/** A carrier for named messages between the page runtime and the server. */\nexport interface PageTransport {\n send(channel: string, data?: unknown): void;\n /** Listen on a channel. Returns the function that removes the listener. */\n on(channel: string, handler: (data: unknown) => void): () => void;\n}\n\n/** The slice of `import.meta.hot` the default carrier relies on. */\nexport interface ViteHotLike {\n send(event: string, data?: unknown): void;\n on(event: string, handler: (data: any) => void): void;\n off?(event: string, handler: (data: any) => void): void;\n}\n\n/** Wraps Vite's HMR client as a {@link PageTransport}. */\nexport const fromViteHot = (hot: ViteHotLike): PageTransport => ({\n send: (channel, data) => hot.send(channel, data),\n on(channel, handler) {\n hot.on(channel, handler);\n return () => hot.off?.(channel, handler);\n },\n});\n\nexport interface PageChannel extends PageTransport {\n /** Whether a carrier is attached. Sends made before one is are dropped. */\n readonly attached: boolean;\n /** The carrier in use, so a replacement can hand the channel back. */\n readonly transport: PageTransport | undefined;\n /**\n * Make `transport` the carrier. Listeners already registered are moved onto\n * it and removed from the previous carrier, and `onAttach` callbacks run so\n * their owners can announce themselves to the new peer.\n */\n attach(transport: PageTransport): void;\n /** Attach Vite's HMR client, unless a carrier is already in place. */\n useViteHot(hot: ViteHotLike): void;\n /** Run `callback` on every later {@link attach}. Not run for past ones. */\n onAttach(callback: () => void): void;\n}\n\nconst createPageChannel = (): PageChannel => {\n let transport: PageTransport | undefined;\n const listeners: Array<{\n channel: string;\n handler: (data: unknown) => void;\n off?: () => void;\n }> = [];\n const attachCallbacks: Array<() => void> = [];\n\n const bind = (entry: (typeof listeners)[number]): void => {\n entry.off = transport?.on(entry.channel, entry.handler);\n };\n\n const channel: PageChannel = {\n get attached() {\n return transport !== undefined;\n },\n get transport() {\n return transport;\n },\n send(name, data) {\n transport?.send(name, data);\n },\n on(name, handler) {\n const entry: (typeof listeners)[number] = {channel: name, handler};\n listeners.push(entry);\n bind(entry);\n return () => {\n entry.off?.();\n const index = listeners.indexOf(entry);\n if (index !== -1) listeners.splice(index, 1);\n };\n },\n attach(next) {\n for (const entry of listeners) entry.off?.();\n transport = next;\n for (const entry of listeners) bind(entry);\n for (const callback of attachCallbacks) {\n try {\n callback();\n } catch {\n // One owner failing to announce must not strand the rest.\n }\n }\n },\n useViteHot(hot) {\n if (transport === undefined) channel.attach(fromViteHot(hot));\n },\n onAttach(callback) {\n attachCallbacks.push(callback);\n },\n };\n return channel;\n};\n\n// One channel per page even if this module is loaded twice (for instance once\n// through Vite's dependency optimizer and once directly), like the patch state.\nconst CHANNEL_KEY = Symbol.for('@lit-labs/vite-plugin-lit#page-channel');\n\nconst shared = globalThis as unknown as Record<symbol, PageChannel | undefined>;\n\nexport const pageChannel: PageChannel = (shared[CHANNEL_KEY] ??=\n createPageChannel());\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"patch.d.ts","sourceRoot":"","sources":["../../src/lib/runtime/patch.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAmBH,OAAO,EAGL,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC9B,MAAM,oCAAoC,CAAC;AAW5C,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;OAGG;IACH,cAAc,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;CACpC;AAsDD;;;;GAIG;AAEH,eAAO,MAAM,cAAc,WACjB,MAAM,UACN,MAAM,QACR,aAAa,CAAC,WAAW,CAAC,SA4BjC,CAAC;AA2IF;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,YAC3B,MAAM,UACP,wBAAwB,UACxB,uBAAuB,CAAC,QAAQ,CAAC,KACxC,uBAAwE,CAAC;AA0K5E;;;GAGG;AACH,eAAO,MAAM,OAAO,aAAa,YAAY,KAAQ,IA2EpD,CAAC"}
1
+ {"version":3,"file":"patch.d.ts","sourceRoot":"","sources":["../../src/lib/runtime/patch.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAqBH,OAAO,EAGL,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC9B,MAAM,oCAAoC,CAAC;AAK5C,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;OAGG;IACH,cAAc,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;CACpC;AAsDD;;;;GAIG;AAEH,eAAO,MAAM,cAAc,WACjB,MAAM,UACN,MAAM,QACR,aAAa,CAAC,WAAW,CAAC,SA4BjC,CAAC;AA2IF;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,YAC3B,MAAM,UACP,wBAAwB,UACxB,uBAAuB,CAAC,QAAQ,CAAC,KACxC,uBAAwE,CAAC;AA0K5E;;;GAGG;AACH,eAAO,MAAM,OAAO,aAAa,YAAY,KAAQ,IA2EpD,CAAC"}
@@ -19,6 +19,7 @@
19
19
  * custom elements, which get prototype/static patching only).
20
20
  */
21
21
  import {subscribeOverride} from './overrides.js';
22
+ import {pageChannel} from './page-channel.js';
22
23
  import {
23
24
  HMR_INCOMPATIBLE_CHANNEL,
24
25
  describeHmrReason,
@@ -366,7 +367,7 @@ export const install = (options = {}) => {
366
367
  reconnect: options.reconnect ?? false,
367
368
  onIncompatible: options.onIncompatible ?? 'reload',
368
369
  },
369
- hot,
370
+ hot: hot === undefined ? undefined : pageChannel,
370
371
  };
371
372
  g[STATE_KEY] = state;
372
373
  // Let the DevTools panel override these behaviours live (and persist across
@@ -1 +1 @@
1
- {"version":3,"file":"patch.js","sourceRoot":"","sources":["../../src/lib/runtime/patch.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAC,iBAAiB,EAAC,MAAM,gBAAgB,CAAC;AACjD,OAAO,EACL,wBAAwB,EACxB,iBAAiB,GAGlB,MAAM,oCAAoC,CAAC;AAgE5C,qEAAqE;AACrE,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;AAChE,qEAAqE;AACrE,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,yCAAyC,CAAC,CAAC;AAE3E,MAAM,UAAU,GAA+B,CAAC,aAAa,CAAC,CAAC;AAC/D,MAAM,WAAW,GAA+B,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;AAEhF,MAAM,OAAO,GAAG,CAAC,CAAS,EAAiB,EAAE,CAAC;IAC5C,GAAG,MAAM,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAChC,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC,CAAC;CACnC,CAAC;AAEF;;;;GAIG;AACH,wDAAwD;AACxD,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,MAAc,EACd,MAAc,EACd,IAAgC,EAChC,EAAE;IACF,KAAK,MAAM,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAClC,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YACvB,SAAS;QACX,CAAC;QACD,IAAI,MAAM,CAAC,wBAAwB,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,SAAS,EAAE,CAAC;YAC/D,IAAI,CAAC;gBACH,OAAQ,MAAuC,CAAC,GAAG,CAAC,CAAC;YACvD,CAAC;YAAC,MAAM,CAAC;gBACP,8BAA8B;YAChC,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gBAC1B,SAAS,EAAE,IAAI,GAAG,EAAE;gBACpB,UAAU,EAAE,CAAC;aACd,CAAC;YACF,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAClC,CAAC;QACD,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,MAAM,GAAG;gBACP,OAAO,EAAE,IAAI;gBACb,SAAS,EAAE,IAAI;gBACf,SAAS,EAAE,IAAI,GAAG,EAAE;gBACpB,UAAU,EAAE,CAAC;aACd,CAAC;YACF,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YAChC,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;YAC1C,OAAO,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC;QAC5D,CAAC;QACD,IAAI,IAAI,KAAK,MAAM,CAAC,SAAS,EAAE,CAAC;YAC9B,kDAAkD;YAClD,OAAO;QACT,CAAC;QACD,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,IAAwB,CAAC,CAAC;IACpD,CAAC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * In-place custom element class patching.\n *\n * Vite HMR re-executes an edited component module, which calls\n * `customElements.define()` again with a freshly evaluated class. The\n * platform registry can't re-define a tag, and live instances keep their\n * original prototype chain, so instead of swapping classes we intercept the\n * duplicate define and patch the originally-registered class in place:\n * copy prototype + static descriptors from the new class onto the old one\n * and nudge live instances to re-render.\n *\n * This module is dependency-free and duck-typed against ReactiveElement so\n * it never imports lit (keeps it version-agnostic and safe for non-Lit\n * custom elements, which get prototype/static patching only).\n */\n\nimport {subscribeOverride} from './overrides.js';\nimport {\n HMR_INCOMPATIBLE_CHANNEL,\n describeHmrReason,\n type HmrIncompatibilityEvent,\n type HmrIncompatibilityReason,\n} from '../../types/hmr-incompatibility.js';\n\n/**\n * Minimal `import.meta.hot` shape used to receive live setting overrides and\n * to report HMR-incompatibility events.\n */\ntype HotChannel = {\n on: (event: string, cb: (data: unknown) => void) => void;\n send: (event: string, data: unknown) => void;\n};\n\nexport interface PatchOptions {\n /**\n * Cycle `disconnectedCallback()`/`connectedCallback()` on live instances\n * after a hot patch. Defaults to `false`.\n */\n reconnect?: boolean;\n\n /**\n * What to do when a component can't be hot-patched in place (e.g.\n * standard `accessor` decorators). Defaults to `'reload'`.\n */\n onIncompatible?: 'reload' | 'warn';\n}\n\ninterface ReactiveElementLike extends HTMLElement {\n requestUpdate?: () => void;\n renderRoot?: unknown;\n connectedCallback?: () => void;\n disconnectedCallback?: () => void;\n}\n\n/** Duck-typed view of ReactiveElement constructor statics. */\ninterface ReactiveCtorLike extends CustomElementConstructor {\n finalize?: () => void;\n elementProperties?: Map<PropertyKey, unknown>;\n elementStyles?: ReadonlyArray<unknown>;\n observedAttributes?: readonly string[];\n _initializers?: Array<(element: unknown) => void>;\n}\n\ninterface TagRecord {\n tagName: string;\n canonical: CustomElementConstructor;\n instances: Set<ReactiveElementLike>;\n generation: number;\n}\n\ninterface PatchState {\n records: Map<string, TagRecord>;\n /** Generation a (possibly detached) instance last caught up to. */\n generationOf: WeakMap<ReactiveElementLike, number>;\n options: Required<PatchOptions>;\n /** Set in `install()`; reports HMR-incompatibility events when present. */\n hot?: HotChannel;\n}\n\ntype LifecycleName = 'connectedCallback' | 'disconnectedCallback';\n\ninterface BrandedWrapper {\n (this: ReactiveElementLike): void;\n [RECORD_BRAND]?: TagRecord;\n}\n\n// Exactly one patch state per page, even if this module loads twice.\nconst STATE_KEY = Symbol.for('@lit-labs/vite-plugin-lit#patch');\n// Brands our lifecycle wrappers so re-instrumentation is idempotent.\nconst RECORD_BRAND = Symbol.for('@lit-labs/vite-plugin-lit#wrapperRecord');\n\nconst PROTO_SKIP: ReadonlyArray<PropertyKey> = ['constructor'];\nconst STATIC_SKIP: ReadonlyArray<PropertyKey> = ['prototype', 'name', 'length'];\n\nconst ownKeys = (o: object): PropertyKey[] => [\n ...Object.getOwnPropertyNames(o),\n ...Object.getOwnPropertySymbols(o),\n];\n\n/**\n * Syncs own members `source` → `target`: deletes own keys of `target` that\n * vanished from `source`, then copies every own descriptor of `source`.\n * Individual copies are best-effort (non-configurable slots are skipped).\n */\n// Exported for unit testing; otherwise module-internal.\nexport const syncOwnMembers = (\n target: object,\n source: object,\n skip: ReadonlyArray<PropertyKey>\n) => {\n for (const key of ownKeys(target)) {\n if (skip.includes(key)) {\n continue;\n }\n if (Object.getOwnPropertyDescriptor(source, key) === undefined) {\n try {\n delete (target as Record<PropertyKey, unknown>)[key];\n } catch {\n // Non-configurable; leave it.\n }\n }\n }\n for (const key of ownKeys(source)) {\n if (skip.includes(key)) {\n continue;\n }\n try {\n Object.defineProperty(\n target,\n key,\n Object.getOwnPropertyDescriptor(source, key)!\n );\n } catch {\n // Non-configurable; leave it.\n }\n }\n};\n\n/**\n * Defines branded `connectedCallback`/`disconnectedCallback` wrappers on the\n * prototype to maintain the live-instance set and generation stamps. Called\n * at first define and again after every patch (descriptor sync replaces or\n * deletes the wrappers).\n */\nconst instrument = (\n state: PatchState,\n proto: object,\n record: TagRecord\n): void => {\n for (const name of [\n 'connectedCallback',\n 'disconnectedCallback',\n ] as const satisfies readonly LifecycleName[]) {\n const own = Object.getOwnPropertyDescriptor(proto, name);\n if ((own?.value as BrandedWrapper | undefined)?.[RECORD_BRAND] === record) {\n continue;\n }\n // May be an own raw function (just copied from the new class), an\n // inherited base implementation, or absent entirely.\n const original = (proto as Record<LifecycleName, (() => void) | undefined>)[\n name\n ];\n const wrapper: BrandedWrapper =\n name === 'connectedCallback'\n ? function (this: ReactiveElementLike) {\n record.instances.add(this);\n const stamp = state.generationOf.get(this);\n if (stamp !== undefined && stamp !== record.generation) {\n // Was detached during one or more patches; catch up.\n this.requestUpdate?.();\n }\n state.generationOf.set(this, record.generation);\n original?.call(this);\n }\n : function (this: ReactiveElementLike) {\n record.instances.delete(this);\n original?.call(this);\n };\n wrapper[RECORD_BRAND] = record;\n try {\n Object.defineProperty(proto, name, {\n value: wrapper,\n writable: true,\n configurable: true,\n });\n } catch {\n // Non-configurable lifecycle slot; tracking degrades gracefully.\n }\n }\n};\n\n/**\n * Detects standard-decorator (`accessor`) reactive properties on the new\n * class. Those close over per-class-evaluation private slots, so copied\n * accessors would brand-check-throw — in-place patching is impossible.\n */\nconst usesStandardDecorators = (ctor: ReactiveCtorLike): boolean => {\n const metadataSymbol = (Symbol as {metadata?: symbol}).metadata;\n if (metadataSymbol === undefined) {\n return false;\n }\n const metadata = Object.getOwnPropertyDescriptor(ctor, metadataSymbol)\n ?.value as object | undefined;\n if (metadata === undefined || metadata === null) {\n return false;\n }\n // litPropertyMetadata is a Lit internal (not public API). Guard against\n // rename, removal, or shape changes — a false negative here means we try\n // to hot-patch and crash, which is handled by the outer catch in hotPatch.\n try {\n const litPropertyMetadata = (\n globalThis as {\n litPropertyMetadata?: WeakMap<object, Map<unknown, unknown>>;\n }\n ).litPropertyMetadata;\n const properties = litPropertyMetadata?.get(metadata);\n return properties !== undefined && properties.size > 0;\n } catch {\n return false;\n }\n};\n\n/**\n * Resolves a static `elementStyles` array to its constructed `CSSStyleSheet`s.\n * Returns `null` for a non-array or any shimmed sheet (no constructible\n * stylesheet support), so callers can bail rather than adopt a partial list.\n */\nconst stylesToSheets = (styles: unknown): CSSStyleSheet[] | null => {\n if (!Array.isArray(styles)) return null;\n const sheets: CSSStyleSheet[] = [];\n for (const style of styles) {\n const sheet =\n style instanceof CSSStyleSheet\n ? style\n : ((style as {styleSheet?: CSSStyleSheet} | null)?.styleSheet ??\n undefined);\n if (!(sheet instanceof CSSStyleSheet)) return null;\n sheets.push(sheet);\n }\n return sheets;\n};\n\n/**\n * Re-adopts constructed stylesheets on an instance's shadow root from the\n * (just-patched) static `elementStyles`. Local reimplementation — no lit\n * import. Skips cleanly for light-DOM components and shimmed sheets.\n *\n * `oldSheets` are the sheets the pre-patch class contributed (captured before\n * the static sync). We drop exactly those and append the new set, leaving any\n * sheet adopted imperatively by other code in place rather than clobbering the\n * whole list.\n */\nconst readoptStyles = (\n el: ReactiveElementLike,\n oldSheets: CSSStyleSheet[]\n): void => {\n const root = el.renderRoot;\n if (typeof ShadowRoot === 'undefined' || !(root instanceof ShadowRoot)) {\n return;\n }\n const sheets = stylesToSheets(\n (el.constructor as ReactiveCtorLike).elementStyles\n );\n if (sheets === null) {\n return;\n }\n const drop = new Set(oldSheets);\n const ours = new Set(sheets);\n // Our styles go first, matching Lit's own order (extra sheets appended).\n const preserved = [...root.adoptedStyleSheets].filter(\n (s) => !drop.has(s) && !ours.has(s)\n );\n root.adoptedStyleSheets = [...sheets, ...preserved];\n};\n\n/**\n * Builds the structured event reported over {@link HMR_INCOMPATIBLE_CHANNEL}.\n * Exported for unit testing; otherwise module-internal. Whether the send\n * survives the `location.reload()` that may follow it can only be checked by\n * hand against a real dev server.\n */\nexport const buildHmrIncompatibleEvent = (\n tagName: string,\n reason: HmrIncompatibilityReason,\n action: HmrIncompatibilityEvent['action']\n): HmrIncompatibilityEvent => ({tagName, time: Date.now(), reason, action});\n\nconst incompatible = (\n state: PatchState,\n tagName: string,\n reason: HmrIncompatibilityReason\n): void => {\n const message = describeHmrReason(reason);\n const action = state.options.onIncompatible === 'warn' ? 'warn' : 'reload';\n state.hot?.send(\n HMR_INCOMPATIBLE_CHANNEL,\n buildHmrIncompatibleEvent(tagName, reason, action)\n );\n if (state.options.onIncompatible === 'warn') {\n console.warn(\n `[lit-plugin] <${tagName}> can't be hot-patched (${message}). ` +\n `Reload the page to pick up the change.`\n );\n } else {\n console.info(\n `[lit-plugin] <${tagName}>: ${message} — performing full reload.`\n );\n location.reload();\n }\n};\n\n/**\n * Patches the originally-registered class for `record.tagName` in place\n * from the freshly evaluated `NewClass`, then updates live instances.\n */\nconst hotPatch = (\n state: PatchState,\n record: TagRecord,\n NewClass: ReactiveCtorLike\n): void => {\n const OldClass = record.canonical as ReactiveCtorLike;\n try {\n // 1. Materialize finalized/elementProperties/elementStyles/\n // __attributeToPropertyMap on the new class before we copy statics.\n if (typeof NewClass.finalize === 'function') {\n NewClass.finalize();\n }\n\n // 2. Standard-decorator `accessor` properties can't be patched in place.\n if (usesStandardDecorators(NewClass)) {\n incompatible(state, record.tagName, {code: 'accessor-decorators'});\n return;\n }\n\n // The platform snapshots observedAttributes at define time; new\n // attribute observations can't take effect without a reload.\n const oldObserved = [...(OldClass.observedAttributes ?? [])];\n const newObserved = [...(NewClass.observedAttributes ?? [])];\n\n // 3. Snapshot reactive property values per live instance through the\n // OLD accessors. Vite serves prod lit in dev (no `development`\n // export condition), where accessor storage keys are unique\n // Symbol()s per class evaluation — without this, state resets.\n const propertyKeys = new Set<PropertyKey>([\n ...(OldClass.elementProperties?.keys() ?? []),\n ...(NewClass.elementProperties?.keys() ?? []),\n ]);\n const snapshots = new Map<ReactiveElementLike, Map<PropertyKey, unknown>>();\n for (const el of record.instances) {\n const values = new Map<PropertyKey, unknown>();\n for (const key of propertyKeys) {\n values.set(key, (el as unknown as Record<PropertyKey, unknown>)[key]);\n }\n snapshots.set(el, values);\n }\n\n // 4. Re-parent prototype chains. Mixins regenerate intermediate classes\n // on every module evaluation, so the parents usually differ.\n const newProtoParent = Object.getPrototypeOf(NewClass.prototype) as object;\n if (Object.getPrototypeOf(OldClass.prototype) !== newProtoParent) {\n Object.setPrototypeOf(OldClass.prototype, newProtoParent);\n }\n const newStaticParent = Object.getPrototypeOf(NewClass) as object;\n if (Object.getPrototypeOf(OldClass) !== newStaticParent) {\n Object.setPrototypeOf(OldClass, newStaticParent);\n }\n\n // Capture the sheets the OLD class contributed before the static sync\n // overwrites `elementStyles`, so readoptStyles can drop exactly those and\n // leave imperatively-adopted sheets in place.\n const oldSheets = stylesToSheets(OldClass.elementStyles) ?? [];\n\n // 5. Sync own members new → old on the prototype and on statics.\n syncOwnMembers(OldClass.prototype, NewClass.prototype, PROTO_SKIP);\n syncOwnMembers(OldClass, NewClass, STATIC_SKIP);\n\n // 6. The sync replaced/removed our lifecycle wrappers; re-instrument.\n instrument(state, OldClass.prototype, record);\n record.generation++;\n // Module-local `instanceof NewClass` checks keep working against\n // instances of the canonical class.\n Object.defineProperty(NewClass, Symbol.hasInstance, {\n value: (instance: unknown) =>\n typeof instance === 'object' &&\n instance !== null &&\n OldClass.prototype.isPrototypeOf(instance),\n configurable: true,\n });\n\n if (\n oldObserved.length !== newObserved.length ||\n oldObserved.some((attr, i) => attr !== newObserved[i])\n ) {\n console.info(\n `[lit-plugin] <${record.tagName}> changed observedAttributes; the ` +\n `platform registry can't pick this up — reload recommended.`\n );\n state.hot?.send(\n HMR_INCOMPATIBLE_CHANNEL,\n buildHmrIncompatibleEvent(\n record.tagName,\n {code: 'observed-attributes-changed'},\n 'none'\n )\n );\n }\n\n // 7. Update live instances.\n const newPropertyKeys = NewClass.elementProperties?.keys() ?? [];\n // After the static sync this is the NEW class's initializer list.\n const initializers = OldClass._initializers;\n // Snapshot: the reconnect below mutates record.instances mid-iteration.\n // oxlint-disable-next-line unicorn/no-useless-spread\n for (const el of [...record.instances]) {\n if (state.options.reconnect) {\n el.disconnectedCallback?.();\n el.connectedCallback?.();\n }\n // Decorator-created reactive controllers (e.g. @lit/context's\n // @provide/@consume) live in per-class-evaluation closures keyed by\n // instance via addInitializer. Re-running the initializers enrolls\n // live instances in the new closures — without this, the first\n // assignment through a copied accessor throws and we'd full-reload.\n // Controllers from previous evaluations stay attached but inert\n // (everything flows through the newest closures); that's bounded by\n // edit count and dev-only. Runs before the value restore so e.g. a\n // re-created ContextProvider exists when the restore pushes into it.\n if (Array.isArray(initializers)) {\n for (const initialize of initializers) {\n initialize(el);\n }\n }\n const values = snapshots.get(el);\n if (values !== undefined) {\n // Restore through the new accessors — only keys the new class\n // still declares.\n for (const key of newPropertyKeys) {\n if (values.has(key)) {\n (el as unknown as Record<PropertyKey, unknown>)[key] =\n values.get(key);\n }\n }\n }\n readoptStyles(el, oldSheets);\n state.generationOf.set(el, record.generation);\n el.requestUpdate?.();\n }\n } catch (e) {\n incompatible(state, record.tagName, {\n code: 'patch-failed',\n detail: e instanceof Error ? e.message : String(e),\n });\n }\n};\n\n/**\n * Installs the `customElements.define` interceptor. Idempotent (per-page\n * global guard); no-ops in environments without `customElements` (SSR).\n */\nexport const install = (options: PatchOptions = {}): void => {\n if (typeof customElements === 'undefined') {\n return;\n }\n const g = globalThis as unknown as Record<symbol, PatchState | undefined>;\n const existing = g[STATE_KEY];\n if (existing !== undefined) {\n // Already installed; refresh explicitly-provided options only.\n if (options.reconnect !== undefined) {\n existing.options.reconnect = options.reconnect;\n }\n if (options.onIncompatible !== undefined) {\n existing.options.onIncompatible = options.onIncompatible;\n }\n return;\n }\n const hot = (import.meta as {hot?: HotChannel}).hot;\n const state: PatchState = {\n records: new Map(),\n generationOf: new WeakMap(),\n options: {\n reconnect: options.reconnect ?? false,\n onIncompatible: options.onIncompatible ?? 'reload',\n },\n hot,\n };\n g[STATE_KEY] = state;\n\n // Let the DevTools panel override these behaviours live (and persist across\n // reloads) on top of the config-time defaults above.\n subscribeOverride(hot, (o) => {\n if (o.hmrReconnect !== undefined) state.options.reconnect = o.hmrReconnect;\n if (o.hmrOnIncompatible !== undefined) {\n state.options.onIncompatible = o.hmrOnIncompatible;\n }\n });\n\n // Captured to re-invoke below as nativeDefine.call(this, ...).\n // oxlint-disable-next-line typescript/unbound-method\n const nativeDefine = customElements.define;\n customElements.define = function (\n this: CustomElementRegistry,\n name: string,\n ctor: CustomElementConstructor,\n defineOptions?: ElementDefinitionOptions\n ) {\n let record = state.records.get(name);\n if (record === undefined && this.get(name) !== undefined) {\n // Defined before install() ran (shouldn't happen — the installer is\n // import-hoisted — but recover gracefully without instance tracking).\n record = {\n tagName: name,\n canonical: this.get(name)!,\n instances: new Set(),\n generation: 0,\n };\n state.records.set(name, record);\n }\n if (record === undefined) {\n record = {\n tagName: name,\n canonical: ctor,\n instances: new Set(),\n generation: 0,\n };\n state.records.set(name, record);\n instrument(state, ctor.prototype, record);\n return nativeDefine.call(this, name, ctor, defineOptions);\n }\n if (ctor === record.canonical) {\n // Same class object re-defined; nothing to patch.\n return;\n }\n hotPatch(state, record, ctor as ReactiveCtorLike);\n };\n};\n"]}
1
+ {"version":3,"file":"patch.js","sourceRoot":"","sources":["../../src/lib/runtime/patch.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAC,iBAAiB,EAAC,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAC,WAAW,EAAC,MAAM,mBAAmB,CAAC;AAE9C,OAAO,EACL,wBAAwB,EACxB,iBAAiB,GAGlB,MAAM,oCAAoC,CAAC;AA0D5C,qEAAqE;AACrE,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;AAChE,qEAAqE;AACrE,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,yCAAyC,CAAC,CAAC;AAE3E,MAAM,UAAU,GAA+B,CAAC,aAAa,CAAC,CAAC;AAC/D,MAAM,WAAW,GAA+B,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;AAEhF,MAAM,OAAO,GAAG,CAAC,CAAS,EAAiB,EAAE,CAAC;IAC5C,GAAG,MAAM,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAChC,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC,CAAC;CACnC,CAAC;AAEF;;;;GAIG;AACH,wDAAwD;AACxD,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,MAAc,EACd,MAAc,EACd,IAAgC,EAChC,EAAE;IACF,KAAK,MAAM,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAClC,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YACvB,SAAS;QACX,CAAC;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K,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACrC,IAAI,MAAM,KAAK,SAAS,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;YACzD,oEAAoE;YACpE,sEAAsE;YACtE,MAAM,GAAG;gBACP,OAAO,EAAE,IAAI;gBACb,SAAS,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAE;gBAC1B,SAAS,EAAE,IAAI,GAAG,EAAE;gBACpB,UAAU,EAAE,CAAC;aACd,CAAC;YACF,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAClC,CAAC;QACD,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,MAAM,GAAG;gBACP,OAAO,EAAE,IAAI;gBACb,SAAS,EAAE,IAAI;gBACf,SAAS,EAAE,IAAI,GAAG,EAAE;gBACpB,UAAU,EAAE,CAAC;aACd,CAAC;YACF,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YAChC,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;YAC1C,OAAO,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC;QAC5D,CAAC;QACD,IAAI,IAAI,KAAK,MAAM,CAAC,SAAS,EAAE,CAAC;YAC9B,kDAAkD;YAClD,OAAO;QACT,CAAC;QACD,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,IAAwB,CAAC,CAAC;IACpD,CAAC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * In-place custom element class patching.\n *\n * Vite HMR re-executes an edited component module, which calls\n * `customElements.define()` again with a freshly evaluated class. The\n * platform registry can't re-define a tag, and live instances keep their\n * original prototype chain, so instead of swapping classes we intercept the\n * duplicate define and patch the originally-registered class in place:\n * copy prototype + static descriptors from the new class onto the old one\n * and nudge live instances to re-render.\n *\n * This module is dependency-free and duck-typed against ReactiveElement so\n * it never imports lit (keeps it version-agnostic and safe for non-Lit\n * custom elements, which get prototype/static patching only).\n */\n\nimport {subscribeOverride} from './overrides.js';\nimport {pageChannel} from './page-channel.js';\nimport type {PageTransport, ViteHotLike} from './page-channel.js';\nimport {\n HMR_INCOMPATIBLE_CHANNEL,\n describeHmrReason,\n type HmrIncompatibilityEvent,\n type HmrIncompatibilityReason,\n} from '../../types/hmr-incompatibility.js';\n\n/** What the patcher needs of the page channel: reporting incompatibilities. */\ntype HotChannel = Pick<PageTransport, 'send'>;\n\nexport interface PatchOptions {\n /**\n * Cycle `disconnectedCallback()`/`connectedCallback()` on live instances\n * after a hot patch. Defaults to `false`.\n */\n reconnect?: boolean;\n\n /**\n * What to do when a component can't be hot-patched in place (e.g.\n * standard `accessor` decorators). Defaults to `'reload'`.\n */\n onIncompatible?: 'reload' | 'warn';\n}\n\ninterface ReactiveElementLike extends HTMLElement {\n requestUpdate?: () => void;\n renderRoot?: unknown;\n connectedCallback?: () => void;\n disconnectedCallback?: () => void;\n}\n\n/** Duck-typed view of ReactiveElement constructor statics. */\ninterface ReactiveCtorLike extends CustomElementConstructor {\n finalize?: () => void;\n elementProperties?: Map<PropertyKey, unknown>;\n elementStyles?: ReadonlyArray<unknown>;\n observedAttributes?: readonly string[];\n _initializers?: Array<(element: unknown) => void>;\n}\n\ninterface TagRecord {\n tagName: string;\n canonical: CustomElementConstructor;\n instances: Set<ReactiveElementLike>;\n generation: number;\n}\n\ninterface PatchState {\n records: Map<string, TagRecord>;\n /** Generation a (possibly detached) instance last caught up to. */\n generationOf: WeakMap<ReactiveElementLike, number>;\n options: Required<PatchOptions>;\n /** Set in `install()`; reports HMR-incompatibility events when present. */\n hot?: HotChannel;\n}\n\ntype LifecycleName = 'connectedCallback' | 'disconnectedCallback';\n\ninterface BrandedWrapper {\n (this: ReactiveElementLike): void;\n [RECORD_BRAND]?: TagRecord;\n}\n\n// Exactly one patch state per page, even if this module loads twice.\nconst STATE_KEY = Symbol.for('@lit-labs/vite-plugin-lit#patch');\n// Brands our lifecycle wrappers so re-instrumentation is idempotent.\nconst RECORD_BRAND = Symbol.for('@lit-labs/vite-plugin-lit#wrapperRecord');\n\nconst PROTO_SKIP: ReadonlyArray<PropertyKey> = ['constructor'];\nconst STATIC_SKIP: ReadonlyArray<PropertyKey> = ['prototype', 'name', 'length'];\n\nconst ownKeys = (o: object): PropertyKey[] => [\n ...Object.getOwnPropertyNames(o),\n ...Object.getOwnPropertySymbols(o),\n];\n\n/**\n * Syncs own members `source` → `target`: deletes own keys of `target` that\n * vanished from `source`, then copies every own descriptor of `source`.\n * Individual copies are best-effort (non-configurable slots are skipped).\n */\n// Exported for unit testing; otherwise module-internal.\nexport const syncOwnMembers = (\n target: object,\n source: object,\n skip: ReadonlyArray<PropertyKey>\n) => {\n for (const key of ownKeys(target)) {\n if (skip.includes(key)) {\n continue;\n }\n if (Object.getOwnPropertyDescriptor(source, key) === undefined) {\n try {\n delete (target as Record<PropertyKey, unknown>)[key];\n } catch {\n // Non-configurable; leave it.\n }\n }\n }\n for (const key of ownKeys(source)) {\n if (skip.includes(key)) {\n continue;\n }\n try {\n Object.defineProperty(\n target,\n key,\n Object.getOwnPropertyDescriptor(source, key)!\n );\n } catch {\n // Non-configurable; leave it.\n }\n }\n};\n\n/**\n * Defines branded `connectedCallback`/`disconnectedCallback` wrappers on the\n * prototype to maintain the live-instance set and generation stamps. Called\n * at first define and again after every patch (descriptor sync replaces or\n * deletes the wrappers).\n */\nconst instrument = (\n state: PatchState,\n proto: object,\n record: TagRecord\n): void => {\n for (const name of [\n 'connectedCallback',\n 'disconnectedCallback',\n ] as const satisfies readonly LifecycleName[]) {\n const own = Object.getOwnPropertyDescriptor(proto, name);\n if ((own?.value as BrandedWrapper | undefined)?.[RECORD_BRAND] === record) {\n continue;\n }\n // May be an own raw function (just copied from the new class), an\n // inherited base implementation, or absent entirely.\n const original = (proto as Record<LifecycleName, (() => void) | undefined>)[\n name\n ];\n const wrapper: BrandedWrapper =\n name === 'connectedCallback'\n ? function (this: ReactiveElementLike) {\n record.instances.add(this);\n const stamp = state.generationOf.get(this);\n if (stamp !== undefined && stamp !== record.generation) {\n // Was detached during one or more patches; catch up.\n this.requestUpdate?.();\n }\n state.generationOf.set(this, record.generation);\n original?.call(this);\n }\n : function (this: ReactiveElementLike) {\n record.instances.delete(this);\n original?.call(this);\n };\n wrapper[RECORD_BRAND] = record;\n try {\n Object.defineProperty(proto, name, {\n value: wrapper,\n writable: true,\n configurable: true,\n });\n } catch {\n // Non-configurable lifecycle slot; tracking degrades gracefully.\n }\n }\n};\n\n/**\n * Detects standard-decorator (`accessor`) reactive properties on the new\n * class. Those close over per-class-evaluation private slots, so copied\n * accessors would brand-check-throw — in-place patching is impossible.\n */\nconst usesStandardDecorators = (ctor: ReactiveCtorLike): boolean => {\n const metadataSymbol = (Symbol as {metadata?: symbol}).metadata;\n if (metadataSymbol === undefined) {\n return false;\n }\n const metadata = Object.getOwnPropertyDescriptor(ctor, metadataSymbol)\n ?.value as object | undefined;\n if (metadata === undefined || metadata === null) {\n return false;\n }\n // litPropertyMetadata is a Lit internal (not public API). Guard against\n // rename, removal, or shape changes — a false negative here means we try\n // to hot-patch and crash, which is handled by the outer catch in hotPatch.\n try {\n const litPropertyMetadata = (\n globalThis as {\n litPropertyMetadata?: WeakMap<object, Map<unknown, unknown>>;\n }\n ).litPropertyMetadata;\n const properties = litPropertyMetadata?.get(metadata);\n return properties !== undefined && properties.size > 0;\n } catch {\n return false;\n }\n};\n\n/**\n * Resolves a static `elementStyles` array to its constructed `CSSStyleSheet`s.\n * Returns `null` for a non-array or any shimmed sheet (no constructible\n * stylesheet support), so callers can bail rather than adopt a partial list.\n */\nconst stylesToSheets = (styles: unknown): CSSStyleSheet[] | null => {\n if (!Array.isArray(styles)) return null;\n const sheets: CSSStyleSheet[] = [];\n for (const style of styles) {\n const sheet =\n style instanceof CSSStyleSheet\n ? style\n : ((style as {styleSheet?: CSSStyleSheet} | null)?.styleSheet ??\n undefined);\n if (!(sheet instanceof CSSStyleSheet)) return null;\n sheets.push(sheet);\n }\n return sheets;\n};\n\n/**\n * Re-adopts constructed stylesheets on an instance's shadow root from the\n * (just-patched) static `elementStyles`. Local reimplementation — no lit\n * import. Skips cleanly for light-DOM components and shimmed sheets.\n *\n * `oldSheets` are the sheets the pre-patch class contributed (captured before\n * the static sync). We drop exactly those and append the new set, leaving any\n * sheet adopted imperatively by other code in place rather than clobbering the\n * whole list.\n */\nconst readoptStyles = (\n el: ReactiveElementLike,\n oldSheets: CSSStyleSheet[]\n): void => {\n const root = el.renderRoot;\n if (typeof ShadowRoot === 'undefined' || !(root instanceof ShadowRoot)) {\n return;\n }\n const sheets = stylesToSheets(\n (el.constructor as ReactiveCtorLike).elementStyles\n );\n if (sheets === null) {\n return;\n }\n const drop = new Set(oldSheets);\n const ours = new Set(sheets);\n // Our styles go first, matching Lit's own order (extra sheets appended).\n const preserved = [...root.adoptedStyleSheets].filter(\n (s) => !drop.has(s) && !ours.has(s)\n );\n root.adoptedStyleSheets = [...sheets, ...preserved];\n};\n\n/**\n * Builds the structured event reported over {@link HMR_INCOMPATIBLE_CHANNEL}.\n * Exported for unit testing; otherwise module-internal. Whether the send\n * survives the `location.reload()` that may follow it can only be checked by\n * hand against a real dev server.\n */\nexport const buildHmrIncompatibleEvent = (\n tagName: string,\n reason: HmrIncompatibilityReason,\n action: HmrIncompatibilityEvent['action']\n): HmrIncompatibilityEvent => ({tagName, time: Date.now(), reason, action});\n\nconst incompatible = (\n state: PatchState,\n tagName: string,\n reason: HmrIncompatibilityReason\n): void => {\n const message = describeHmrReason(reason);\n const action = state.options.onIncompatible === 'warn' ? 'warn' : 'reload';\n state.hot?.send(\n HMR_INCOMPATIBLE_CHANNEL,\n buildHmrIncompatibleEvent(tagName, reason, action)\n );\n if (state.options.onIncompatible === 'warn') {\n console.warn(\n `[lit-plugin] <${tagName}> can't be hot-patched (${message}). ` +\n `Reload the page to pick up the change.`\n );\n } else {\n console.info(\n `[lit-plugin] <${tagName}>: ${message} — performing full reload.`\n );\n location.reload();\n }\n};\n\n/**\n * Patches the originally-registered class for `record.tagName` in place\n * from the freshly evaluated `NewClass`, then updates live instances.\n */\nconst hotPatch = (\n state: PatchState,\n record: TagRecord,\n NewClass: ReactiveCtorLike\n): void => {\n const OldClass = record.canonical as ReactiveCtorLike;\n try {\n // 1. Materialize finalized/elementProperties/elementStyles/\n // __attributeToPropertyMap on the new class before we copy statics.\n if (typeof NewClass.finalize === 'function') {\n NewClass.finalize();\n }\n\n // 2. Standard-decorator `accessor` properties can't be patched in place.\n if (usesStandardDecorators(NewClass)) {\n incompatible(state, record.tagName, {code: 'accessor-decorators'});\n return;\n }\n\n // The platform snapshots observedAttributes at define time; new\n // attribute observations can't take effect without a reload.\n const oldObserved = [...(OldClass.observedAttributes ?? [])];\n const newObserved = [...(NewClass.observedAttributes ?? [])];\n\n // 3. Snapshot reactive property values per live instance through the\n // OLD accessors. Vite serves prod lit in dev (no `development`\n // export condition), where accessor storage keys are unique\n // Symbol()s per class evaluation — without this, state resets.\n const propertyKeys = new Set<PropertyKey>([\n ...(OldClass.elementProperties?.keys() ?? []),\n ...(NewClass.elementProperties?.keys() ?? []),\n ]);\n const snapshots = new Map<ReactiveElementLike, Map<PropertyKey, unknown>>();\n for (const el of record.instances) {\n const values = new Map<PropertyKey, unknown>();\n for (const key of propertyKeys) {\n values.set(key, (el as unknown as Record<PropertyKey, unknown>)[key]);\n }\n snapshots.set(el, values);\n }\n\n // 4. Re-parent prototype chains. Mixins regenerate intermediate classes\n // on every module evaluation, so the parents usually differ.\n const newProtoParent = Object.getPrototypeOf(NewClass.prototype) as object;\n if (Object.getPrototypeOf(OldClass.prototype) !== newProtoParent) {\n Object.setPrototypeOf(OldClass.prototype, newProtoParent);\n }\n const newStaticParent = Object.getPrototypeOf(NewClass) as object;\n if (Object.getPrototypeOf(OldClass) !== newStaticParent) {\n Object.setPrototypeOf(OldClass, newStaticParent);\n }\n\n // Capture the sheets the OLD class contributed before the static sync\n // overwrites `elementStyles`, so readoptStyles can drop exactly those and\n // leave imperatively-adopted sheets in place.\n const oldSheets = stylesToSheets(OldClass.elementStyles) ?? [];\n\n // 5. Sync own members new → old on the prototype and on statics.\n syncOwnMembers(OldClass.prototype, NewClass.prototype, PROTO_SKIP);\n syncOwnMembers(OldClass, NewClass, STATIC_SKIP);\n\n // 6. The sync replaced/removed our lifecycle wrappers; re-instrument.\n instrument(state, OldClass.prototype, record);\n record.generation++;\n // Module-local `instanceof NewClass` checks keep working against\n // instances of the canonical class.\n Object.defineProperty(NewClass, Symbol.hasInstance, {\n value: (instance: unknown) =>\n typeof instance === 'object' &&\n instance !== null &&\n OldClass.prototype.isPrototypeOf(instance),\n configurable: true,\n });\n\n if (\n oldObserved.length !== newObserved.length ||\n oldObserved.some((attr, i) => attr !== newObserved[i])\n ) {\n console.info(\n `[lit-plugin] <${record.tagName}> changed observedAttributes; the ` +\n `platform registry can't pick this up — reload recommended.`\n );\n state.hot?.send(\n HMR_INCOMPATIBLE_CHANNEL,\n buildHmrIncompatibleEvent(\n record.tagName,\n {code: 'observed-attributes-changed'},\n 'none'\n )\n );\n }\n\n // 7. Update live instances.\n const newPropertyKeys = NewClass.elementProperties?.keys() ?? [];\n // After the static sync this is the NEW class's initializer list.\n const initializers = OldClass._initializers;\n // Snapshot: the reconnect below mutates record.instances mid-iteration.\n // oxlint-disable-next-line unicorn/no-useless-spread\n for (const el of [...record.instances]) {\n if (state.options.reconnect) {\n el.disconnectedCallback?.();\n el.connectedCallback?.();\n }\n // Decorator-created reactive controllers (e.g. @lit/context's\n // @provide/@consume) live in per-class-evaluation closures keyed by\n // instance via addInitializer. Re-running the initializers enrolls\n // live instances in the new closures — without this, the first\n // assignment through a copied accessor throws and we'd full-reload.\n // Controllers from previous evaluations stay attached but inert\n // (everything flows through the newest closures); that's bounded by\n // edit count and dev-only. Runs before the value restore so e.g. a\n // re-created ContextProvider exists when the restore pushes into it.\n if (Array.isArray(initializers)) {\n for (const initialize of initializers) {\n initialize(el);\n }\n }\n const values = snapshots.get(el);\n if (values !== undefined) {\n // Restore through the new accessors — only keys the new class\n // still declares.\n for (const key of newPropertyKeys) {\n if (values.has(key)) {\n (el as unknown as Record<PropertyKey, unknown>)[key] =\n values.get(key);\n }\n }\n }\n readoptStyles(el, oldSheets);\n state.generationOf.set(el, record.generation);\n el.requestUpdate?.();\n }\n } catch (e) {\n incompatible(state, record.tagName, {\n code: 'patch-failed',\n detail: e instanceof Error ? e.message : String(e),\n });\n }\n};\n\n/**\n * Installs the `customElements.define` interceptor. Idempotent (per-page\n * global guard); no-ops in environments without `customElements` (SSR).\n */\nexport const install = (options: PatchOptions = {}): void => {\n if (typeof customElements === 'undefined') {\n return;\n }\n const g = globalThis as unknown as Record<symbol, PatchState | undefined>;\n const existing = g[STATE_KEY];\n if (existing !== undefined) {\n // Already installed; refresh explicitly-provided options only.\n if (options.reconnect !== undefined) {\n existing.options.reconnect = options.reconnect;\n }\n if (options.onIncompatible !== undefined) {\n existing.options.onIncompatible = options.onIncompatible;\n }\n return;\n }\n const hot = (import.meta as {hot?: ViteHotLike}).hot;\n const state: PatchState = {\n records: new Map(),\n generationOf: new WeakMap(),\n options: {\n reconnect: options.reconnect ?? false,\n onIncompatible: options.onIncompatible ?? 'reload',\n },\n hot: hot === undefined ? undefined : pageChannel,\n };\n g[STATE_KEY] = state;\n\n // Let the DevTools panel override these behaviours live (and persist across\n // reloads) on top of the config-time defaults above.\n subscribeOverride(hot, (o) => {\n if (o.hmrReconnect !== undefined) state.options.reconnect = o.hmrReconnect;\n if (o.hmrOnIncompatible !== undefined) {\n state.options.onIncompatible = o.hmrOnIncompatible;\n }\n });\n\n // Captured to re-invoke below as nativeDefine.call(this, ...).\n // oxlint-disable-next-line typescript/unbound-method\n const nativeDefine = customElements.define;\n customElements.define = function (\n this: CustomElementRegistry,\n name: string,\n ctor: CustomElementConstructor,\n defineOptions?: ElementDefinitionOptions\n ) {\n let record = state.records.get(name);\n if (record === undefined && this.get(name) !== undefined) {\n // Defined before install() ran (shouldn't happen — the installer is\n // import-hoisted — but recover gracefully without instance tracking).\n record = {\n tagName: name,\n canonical: this.get(name)!,\n instances: new Set(),\n generation: 0,\n };\n state.records.set(name, record);\n }\n if (record === undefined) {\n record = {\n tagName: name,\n canonical: ctor,\n instances: new Set(),\n generation: 0,\n };\n state.records.set(name, record);\n instrument(state, ctor.prototype, record);\n return nativeDefine.call(this, name, ctor, defineOptions);\n }\n if (ctor === record.canonical) {\n // Same class object re-defined; nothing to patch.\n return;\n }\n hotPatch(state, record, ctor as ReactiveCtorLike);\n };\n};\n"]}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: BSD-3-Clause
5
+ */
6
+ import type { PageTransport } from './page-channel.js';
7
+ /** The slice of a scoped devframe client the transport uses. */
8
+ export interface PageRpc {
9
+ callEvent(method: string, ...args: unknown[]): void;
10
+ register(fn: {
11
+ name: string;
12
+ type: 'event';
13
+ handler: (...args: any[]) => void;
14
+ }): void;
15
+ }
16
+ /**
17
+ * A {@link PageTransport} over a devframe RPC client: `send` becomes a
18
+ * `page-send` event, and `page-receive` events fan out to the listeners
19
+ * registered with `on`.
20
+ */
21
+ export declare const createRpcTransport: (rpc: PageRpc) => PageTransport;
22
+ export interface ConnectOptions {
23
+ /**
24
+ * A bearer token the server already trusts. Without one the client falls
25
+ * back to devframe's own flow (a stored token, a magic-link code in the URL,
26
+ * or a prompt for the one-time code the server prints) unless the server was
27
+ * started with `--no-auth`.
28
+ */
29
+ authToken?: string;
30
+ }
31
+ /**
32
+ * Point this page's runtime at a standalone `lit-devtools dev` server.
33
+ *
34
+ * Resolves once the connection is trusted, after which the tree, inspector
35
+ * and timeline traffic that used to go to this page's own Vite server goes to
36
+ * `url` instead (the runtime announces itself again so the server can replay
37
+ * recording state). Returns a function that disconnects and hands the channel
38
+ * back to the carrier it replaced.
39
+ *
40
+ * The page's origin must be allowed to reach `url`; this does not set up
41
+ * cross-origin access.
42
+ *
43
+ * @param url Origin of the dev server, e.g. `http://localhost:5180/`.
44
+ */
45
+ export declare const connectToDevServer: (url: string, options?: ConnectOptions) => Promise<() => void>;
46
+ //# sourceMappingURL=rpc-transport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rpc-transport.d.ts","sourceRoot":"","sources":["../../src/lib/runtime/rpc-transport.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAmBH,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAErD,gEAAgE;AAChE,MAAM,WAAW,OAAO;IACtB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IACpD,QAAQ,CAAC,EAAE,EAAE;QACX,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,OAAO,CAAC;QACd,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;KACnC,GAAG,IAAI,CAAC;CACV;AAED;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,QAAS,OAAO,KAAG,aA4BjD,CAAC;AAEF,MAAM,WAAW,cAAc;IAC7B;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,kBAAkB,QACxB,MAAM,YACF,cAAc,KACtB,OAAO,CAAC,MAAM,IAAI,CAepB,CAAC"}
@@ -0,0 +1,82 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: BSD-3-Clause
5
+ */
6
+ /**
7
+ * Carries the page channel over devframe RPC to a standalone
8
+ * `lit-devtools dev` server, so a page that is not served by a DevTools-enabled
9
+ * Vite dev server can still feed the panel. The server half is
10
+ * `devframe/rpc-source.ts`.
11
+ *
12
+ * Opt-in and explicit: nothing connects until {@link connectToDevServer} is
13
+ * called, and `devframe/client` is only imported then, so a page that never
14
+ * asks pays nothing.
15
+ */
16
+ import {
17
+ LIT_DEVFRAME_ID,
18
+ RPC_PAGE_RECEIVE,
19
+ RPC_PAGE_SEND,
20
+ } from '../devframe/protocol.js';
21
+ import {pageChannel} from './page-channel.js';
22
+ /**
23
+ * A {@link PageTransport} over a devframe RPC client: `send` becomes a
24
+ * `page-send` event, and `page-receive` events fan out to the listeners
25
+ * registered with `on`.
26
+ */
27
+ export const createRpcTransport = (rpc) => {
28
+ const listeners = new Map();
29
+ rpc.register({
30
+ name: RPC_PAGE_RECEIVE,
31
+ type: 'event',
32
+ handler: (channel, data) => {
33
+ for (const listener of listeners.get(channel) ?? []) {
34
+ try {
35
+ listener(data);
36
+ } catch (error) {
37
+ console.error(`[lit-devtools] listener for ${channel} threw`, error);
38
+ }
39
+ }
40
+ },
41
+ });
42
+ return {
43
+ send(channel, data) {
44
+ rpc.callEvent(RPC_PAGE_SEND, channel, data);
45
+ },
46
+ on(channel, handler) {
47
+ let set = listeners.get(channel);
48
+ if (set === undefined) listeners.set(channel, (set = new Set()));
49
+ set.add(handler);
50
+ return () => void set.delete(handler);
51
+ },
52
+ };
53
+ };
54
+ /**
55
+ * Point this page's runtime at a standalone `lit-devtools dev` server.
56
+ *
57
+ * Resolves once the connection is trusted, after which the tree, inspector
58
+ * and timeline traffic that used to go to this page's own Vite server goes to
59
+ * `url` instead (the runtime announces itself again so the server can replay
60
+ * recording state). Returns a function that disconnects and hands the channel
61
+ * back to the carrier it replaced.
62
+ *
63
+ * The page's origin must be allowed to reach `url`; this does not set up
64
+ * cross-origin access.
65
+ *
66
+ * @param url Origin of the dev server, e.g. `http://localhost:5180/`.
67
+ */
68
+ export const connectToDevServer = async (url, options = {}) => {
69
+ const {getDevframeRpcClient} = await import('devframe/client');
70
+ const client = await getDevframeRpcClient({
71
+ baseURL: url,
72
+ authToken: options.authToken,
73
+ });
74
+ await client.ensureTrusted();
75
+ const previous = pageChannel.transport;
76
+ pageChannel.attach(createRpcTransport(client.scope(LIT_DEVFRAME_ID).rpc));
77
+ return () => {
78
+ client.close?.();
79
+ if (previous !== undefined) pageChannel.attach(previous);
80
+ };
81
+ };
82
+ //# sourceMappingURL=rpc-transport.js.map