@oddsquad/vite-plugin-lit 0.7.0 → 0.8.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.
- package/CHANGELOG.md +29 -0
- package/LICENSE +1 -1
- package/README.md +14 -7
- package/bin.mjs +2 -8
- package/client.d.ts +0 -6
- package/dist/client/assets/{browser-agent-rpc-BXhoSh1z-BuCvPGjS.js → browser-agent-rpc-BXhoSh1z-ybEeG-x9.js} +2 -2
- package/dist/client/assets/{browser-agent-rpc-BXhoSh1z-BuCvPGjS.js.map → browser-agent-rpc-BXhoSh1z-ybEeG-x9.js.map} +1 -1
- package/dist/client/assets/{index-D632jo79.js → index-CgkhETVR.js} +2 -144
- package/dist/client/assets/index-CgkhETVR.js.map +1 -0
- package/dist/client/index.html +1 -1
- package/dist/standalone/lit-devtools.js +2 -105
- package/index.d.ts +0 -5
- package/index.d.ts.map +1 -1
- package/index.js +1 -5
- package/index.js.map +1 -1
- package/lib/color-scheme.d.ts +0 -5
- package/lib/color-scheme.d.ts.map +1 -1
- package/lib/color-scheme.js +0 -5
- package/lib/color-scheme.js.map +1 -1
- package/lib/confine.d.ts +0 -5
- package/lib/confine.d.ts.map +1 -1
- package/lib/confine.js +0 -5
- package/lib/confine.js.map +1 -1
- package/lib/devframe/allowed-origins.d.ts +11 -3
- package/lib/devframe/allowed-origins.d.ts.map +1 -1
- package/lib/devframe/allowed-origins.js +0 -5
- package/lib/devframe/allowed-origins.js.map +1 -1
- package/lib/devframe/definition.d.ts +7 -3
- package/lib/devframe/definition.d.ts.map +1 -1
- package/lib/devframe/definition.js +1 -6
- package/lib/devframe/definition.js.map +1 -1
- package/lib/devframe/icon.d.ts +0 -5
- package/lib/devframe/icon.d.ts.map +1 -1
- package/lib/devframe/icon.js +0 -5
- package/lib/devframe/icon.js.map +1 -1
- package/lib/devframe/launch-editor.d.ts +0 -5
- package/lib/devframe/launch-editor.d.ts.map +1 -1
- package/lib/devframe/launch-editor.js +0 -5
- package/lib/devframe/launch-editor.js.map +1 -1
- package/lib/devframe/paths.d.ts +8 -3
- package/lib/devframe/paths.d.ts.map +1 -1
- package/lib/devframe/paths.js +0 -5
- package/lib/devframe/paths.js.map +1 -1
- package/lib/devframe/protocol.d.ts +6 -3
- package/lib/devframe/protocol.d.ts.map +1 -1
- package/lib/devframe/protocol.js +0 -5
- package/lib/devframe/protocol.js.map +1 -1
- package/lib/devframe/rpc-source.d.ts +15 -3
- package/lib/devframe/rpc-source.d.ts.map +1 -1
- package/lib/devframe/rpc-source.js +0 -5
- package/lib/devframe/rpc-source.js.map +1 -1
- package/lib/devframe/source.d.ts +0 -5
- package/lib/devframe/source.d.ts.map +1 -1
- package/lib/devframe/source.js +7 -3
- package/lib/devframe/source.js.map +1 -1
- package/lib/devframe/vite.d.ts +0 -5
- package/lib/devframe/vite.d.ts.map +1 -1
- package/lib/devframe/vite.js +16 -3
- package/lib/devframe/vite.js.map +1 -1
- package/lib/http.d.ts +0 -5
- package/lib/http.d.ts.map +1 -1
- package/lib/http.js +0 -5
- package/lib/http.js.map +1 -1
- package/lib/icons.d.ts +0 -5
- package/lib/icons.d.ts.map +1 -1
- package/lib/icons.js +0 -5
- package/lib/icons.js.map +1 -1
- package/lib/options.d.ts +0 -5
- package/lib/options.d.ts.map +1 -1
- package/lib/options.js +0 -5
- package/lib/options.js.map +1 -1
- package/lib/override-baselines.d.ts +0 -5
- package/lib/override-baselines.d.ts.map +1 -1
- package/lib/override-baselines.js +0 -5
- package/lib/override-baselines.js.map +1 -1
- package/lib/plugin.d.ts +0 -5
- package/lib/plugin.d.ts.map +1 -1
- package/lib/plugin.js +0 -5
- package/lib/plugin.js.map +1 -1
- package/lib/plugins/css-literals.d.ts +0 -5
- package/lib/plugins/css-literals.d.ts.map +1 -1
- package/lib/plugins/css-literals.js +0 -5
- package/lib/plugins/css-literals.js.map +1 -1
- package/lib/plugins/css-queries.d.ts +0 -5
- package/lib/plugins/css-queries.d.ts.map +1 -1
- package/lib/plugins/css-queries.js +0 -5
- package/lib/plugins/css-queries.js.map +1 -1
- package/lib/plugins/open-in-editor.d.ts +0 -5
- package/lib/plugins/open-in-editor.d.ts.map +1 -1
- package/lib/plugins/open-in-editor.js +0 -5
- package/lib/plugins/open-in-editor.js.map +1 -1
- package/lib/plugins/private-fields.d.ts +0 -5
- package/lib/plugins/private-fields.d.ts.map +1 -1
- package/lib/plugins/private-fields.js +0 -5
- package/lib/plugins/private-fields.js.map +1 -1
- package/lib/plugins/shared.d.ts +0 -5
- package/lib/plugins/shared.d.ts.map +1 -1
- package/lib/plugins/shared.js +0 -5
- package/lib/plugins/shared.js.map +1 -1
- package/lib/plugins/timeline-virtual.d.ts +0 -5
- package/lib/plugins/timeline-virtual.d.ts.map +1 -1
- package/lib/plugins/timeline-virtual.js +0 -5
- package/lib/plugins/timeline-virtual.js.map +1 -1
- package/lib/runtime/child-state.d.ts +0 -5
- package/lib/runtime/child-state.d.ts.map +1 -1
- package/lib/runtime/child-state.js +18 -3
- package/lib/runtime/child-state.js.map +1 -1
- package/lib/runtime/css.d.ts +14 -3
- package/lib/runtime/css.d.ts.map +1 -1
- package/lib/runtime/css.js +3 -5
- package/lib/runtime/css.js.map +1 -1
- package/lib/runtime/edge-panel.d.ts +8 -3
- package/lib/runtime/edge-panel.d.ts.map +1 -1
- package/lib/runtime/edge-panel.js +0 -5
- package/lib/runtime/edge-panel.js.map +1 -1
- package/lib/runtime/fonts.d.ts +0 -5
- package/lib/runtime/fonts.d.ts.map +1 -1
- package/lib/runtime/fonts.js +0 -5
- package/lib/runtime/fonts.js.map +1 -1
- package/lib/runtime/indicator.d.ts +3 -3
- package/lib/runtime/indicator.js +0 -5
- package/lib/runtime/indicator.js.map +1 -1
- package/lib/runtime/inspector/collect.d.ts +3 -3
- package/lib/runtime/inspector/collect.d.ts.map +1 -1
- package/lib/runtime/inspector/collect.js +0 -5
- package/lib/runtime/inspector/collect.js.map +1 -1
- package/lib/runtime/inspector/highlight.d.ts +10 -3
- package/lib/runtime/inspector/highlight.d.ts.map +1 -1
- package/lib/runtime/inspector/highlight.js +0 -5
- package/lib/runtime/inspector/highlight.js.map +1 -1
- package/lib/runtime/inspector/install.d.ts +6 -3
- package/lib/runtime/inspector/install.d.ts.map +1 -1
- package/lib/runtime/inspector/install.js +0 -5
- package/lib/runtime/inspector/install.js.map +1 -1
- package/lib/runtime/inspector/serialize.d.ts +4 -3
- package/lib/runtime/inspector/serialize.d.ts.map +1 -1
- package/lib/runtime/inspector/serialize.js +0 -5
- package/lib/runtime/inspector/serialize.js.map +1 -1
- package/lib/runtime/intern.d.ts +11 -3
- package/lib/runtime/intern.d.ts.map +1 -1
- package/lib/runtime/intern.js +11 -3
- package/lib/runtime/intern.js.map +1 -1
- package/lib/runtime/overrides.d.ts +3 -3
- package/lib/runtime/overrides.d.ts.map +1 -1
- package/lib/runtime/overrides.js +0 -5
- package/lib/runtime/overrides.js.map +1 -1
- package/lib/runtime/page-channel.d.ts +0 -5
- package/lib/runtime/page-channel.d.ts.map +1 -1
- package/lib/runtime/page-channel.js +13 -3
- package/lib/runtime/page-channel.js.map +1 -1
- package/lib/runtime/patch.d.ts +0 -5
- package/lib/runtime/patch.d.ts.map +1 -1
- package/lib/runtime/patch.js +0 -5
- package/lib/runtime/patch.js.map +1 -1
- package/lib/runtime/rpc-transport.d.ts +13 -3
- package/lib/runtime/rpc-transport.d.ts.map +1 -1
- package/lib/runtime/rpc-transport.js +3 -5
- package/lib/runtime/rpc-transport.js.map +1 -1
- package/lib/runtime/source-meta.d.ts +0 -5
- package/lib/runtime/source-meta.d.ts.map +1 -1
- package/lib/runtime/source-meta.js +0 -5
- package/lib/runtime/source-meta.js.map +1 -1
- package/lib/runtime/source-overlay/editors.d.ts +0 -5
- package/lib/runtime/source-overlay/editors.d.ts.map +1 -1
- package/lib/runtime/source-overlay/editors.js +0 -5
- package/lib/runtime/source-overlay/editors.js.map +1 -1
- package/lib/runtime/source-overlay/mask-path.d.ts +0 -5
- package/lib/runtime/source-overlay/mask-path.d.ts.map +1 -1
- package/lib/runtime/source-overlay/mask-path.js +0 -5
- package/lib/runtime/source-overlay/mask-path.js.map +1 -1
- package/lib/runtime/source-overlay/overlay-element.d.ts +0 -5
- package/lib/runtime/source-overlay/overlay-element.d.ts.map +1 -1
- package/lib/runtime/source-overlay/overlay-element.js +0 -5
- package/lib/runtime/source-overlay/overlay-element.js.map +1 -1
- package/lib/runtime/source-overlay/source-host.d.ts +0 -5
- package/lib/runtime/source-overlay/source-host.d.ts.map +1 -1
- package/lib/runtime/source-overlay/source-host.js +0 -5
- package/lib/runtime/source-overlay/source-host.js.map +1 -1
- package/lib/runtime/source-overlay/template.d.ts +0 -5
- package/lib/runtime/source-overlay/template.d.ts.map +1 -1
- package/lib/runtime/source-overlay/template.js +0 -5
- package/lib/runtime/source-overlay/template.js.map +1 -1
- package/lib/runtime/source-overlay.d.ts +0 -5
- package/lib/runtime/source-overlay.d.ts.map +1 -1
- package/lib/runtime/source-overlay.js +0 -5
- package/lib/runtime/source-overlay.js.map +1 -1
- package/lib/runtime/standalone.d.ts +0 -5
- package/lib/runtime/standalone.d.ts.map +1 -1
- package/lib/runtime/standalone.js +0 -5
- package/lib/runtime/standalone.js.map +1 -1
- package/lib/runtime/timeline/chrome-tracks.d.ts +0 -5
- package/lib/runtime/timeline/chrome-tracks.d.ts.map +1 -1
- package/lib/runtime/timeline/chrome-tracks.js +5 -3
- package/lib/runtime/timeline/chrome-tracks.js.map +1 -1
- package/lib/runtime/timeline/clock.d.ts +7 -3
- package/lib/runtime/timeline/clock.d.ts.map +1 -1
- package/lib/runtime/timeline/clock.js +0 -5
- package/lib/runtime/timeline/clock.js.map +1 -1
- package/lib/runtime/timeline/flash.d.ts +0 -5
- package/lib/runtime/timeline/flash.d.ts.map +1 -1
- package/lib/runtime/timeline/flash.js +15 -3
- package/lib/runtime/timeline/flash.js.map +1 -1
- package/lib/runtime/timeline/identity.d.ts +0 -5
- package/lib/runtime/timeline/identity.d.ts.map +1 -1
- package/lib/runtime/timeline/identity.js +9 -3
- package/lib/runtime/timeline/identity.js.map +1 -1
- package/lib/runtime/timeline/input.d.ts +0 -5
- package/lib/runtime/timeline/input.d.ts.map +1 -1
- package/lib/runtime/timeline/input.js +2 -3
- package/lib/runtime/timeline/input.js.map +1 -1
- package/lib/runtime/timeline/install.d.ts +11 -3
- package/lib/runtime/timeline/install.d.ts.map +1 -1
- package/lib/runtime/timeline/install.js +0 -5
- package/lib/runtime/timeline/install.js.map +1 -1
- package/lib/runtime/timeline/lifecycle.d.ts +13 -3
- package/lib/runtime/timeline/lifecycle.d.ts.map +1 -1
- package/lib/runtime/timeline/lifecycle.js +0 -5
- package/lib/runtime/timeline/lifecycle.js.map +1 -1
- package/lib/runtime/timeline/public-api.d.ts +6 -3
- package/lib/runtime/timeline/public-api.d.ts.map +1 -1
- package/lib/runtime/timeline/public-api.js +0 -5
- package/lib/runtime/timeline/public-api.js.map +1 -1
- package/lib/runtime/timeline/render.d.ts +0 -5
- package/lib/runtime/timeline/render.d.ts.map +1 -1
- package/lib/runtime/timeline/render.js +21 -3
- package/lib/runtime/timeline/render.js.map +1 -1
- package/lib/runtime/timeline/transport.d.ts +0 -5
- package/lib/runtime/timeline/transport.d.ts.map +1 -1
- package/lib/runtime/timeline/transport.js +10 -3
- package/lib/runtime/timeline/transport.js.map +1 -1
- package/lib/segmented-tabs.d.ts +0 -5
- package/lib/segmented-tabs.d.ts.map +1 -1
- package/lib/segmented-tabs.js +0 -5
- package/lib/segmented-tabs.js.map +1 -1
- package/lib/snapshot.d.ts +11 -3
- package/lib/snapshot.d.ts.map +1 -1
- package/lib/snapshot.js +0 -5
- package/lib/snapshot.js.map +1 -1
- package/lib/source-meta.d.ts +0 -5
- package/lib/source-meta.d.ts.map +1 -1
- package/lib/source-meta.js +0 -5
- package/lib/source-meta.js.map +1 -1
- package/lib/timeline/derive.d.ts +0 -5
- package/lib/timeline/derive.d.ts.map +1 -1
- package/lib/timeline/derive.js +22 -3
- package/lib/timeline/derive.js.map +1 -1
- package/lib/timeline/filter.d.ts +0 -5
- package/lib/timeline/filter.d.ts.map +1 -1
- package/lib/timeline/filter.js +6 -3
- package/lib/timeline/filter.js.map +1 -1
- package/lib/timeline/tracks.d.ts +0 -5
- package/lib/timeline/tracks.d.ts.map +1 -1
- package/lib/timeline/tracks.js +12 -3
- package/lib/timeline/tracks.js.map +1 -1
- package/lib/tokens.d.ts +0 -5
- package/lib/tokens.d.ts.map +1 -1
- package/lib/tokens.js +0 -5
- package/lib/tokens.js.map +1 -1
- package/lib/transform.d.ts +0 -5
- package/lib/transform.d.ts.map +1 -1
- package/lib/transform.js +0 -5
- package/lib/transform.js.map +1 -1
- package/lib/types.d.ts +10 -5
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js +0 -5
- package/lib/types.js.map +1 -1
- package/lib/wrap-table.d.ts +0 -5
- package/lib/wrap-table.d.ts.map +1 -1
- package/lib/wrap-table.js +12 -3
- package/lib/wrap-table.js.map +1 -1
- package/package.json +2 -2
- package/types/hmr-incompatibility.d.ts +0 -5
- package/types/hmr-incompatibility.d.ts.map +1 -1
- package/types/hmr-incompatibility.js +13 -3
- package/types/hmr-incompatibility.js.map +1 -1
- package/types/in-page.d.ts +0 -5
- package/types/in-page.d.ts.map +1 -1
- package/types/in-page.js +0 -5
- package/types/in-page.js.map +1 -1
- package/types/inspector.d.ts +0 -5
- package/types/inspector.d.ts.map +1 -1
- package/types/inspector.js +13 -3
- package/types/inspector.js.map +1 -1
- package/types/snapshot.d.ts +0 -5
- package/types/snapshot.d.ts.map +1 -1
- package/types/snapshot.js +12 -3
- package/types/snapshot.js.map +1 -1
- package/types/timeline.d.ts +0 -5
- package/types/timeline.d.ts.map +1 -1
- package/types/timeline.js +0 -5
- package/types/timeline.js.map +1 -1
- package/dist/client/assets/index-D632jo79.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.js","sourceRoot":"","sources":["../../../src/lib/runtime/inspector/install.ts"],"names":[],"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,CAAC;gBACnB,MAAM;YACR,KAAK,WAAW;gBACd,kEAAkE;gBAClE,8CAA8C;gBAC9C,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;gBACtB,MAAM;YACR,KAAK,SAAS;gBACZ,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;gBAC1B,MAAM;QACV,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,wEAAwE;IACxE,IAAI,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC,CAAC;IACtB,2EAA2E;IAC3E,kBAAkB;IAClB,WAAW,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC,CAAC,CAAC;AACpD,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2026 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * Components inspector runtime.\n *\n * Injected into the host page (alongside the timeline runtime) when the\n * DevTools panel is enabled. Answers the panel's tree/details requests over the\n * Vite HMR channel, keeps a watched element's details fresh as it updates, and\n * outlines elements the panel hovers in its tree.\n */\n\nimport {createPageScriptChannel} from 'devframe/in-page-channel';\nimport {elementById} from '../timeline/identity.js';\nimport {pageChannel} from '../page-channel.js';\nimport type {ViteHotLike} from '../page-channel.js';\nimport {buildTree, collectDetails} from './collect.js';\nimport {clearHighlight, highlightById} from './highlight.js';\nimport {\n LIT_IN_PAGE_CHANNEL,\n type LitInPageProtocol,\n} from '../../../types/in-page.js';\nimport {\n INSPECT_CMD_CHANNEL,\n INSPECT_DATA_CHANNEL,\n type InspectorCommand,\n type InspectorMessage,\n} from '../../../types/inspector.js';\n\nconst hot = (import.meta as {hot?: ViteHotLike}).hot;\nif (hot !== undefined) pageChannel.useViteHot(hot);\n\n// The direct panel channel, outside the `hot` gate on purpose: it is the one\n// part of the inspector that does not need a dev server, which is what lets\n// the hover outline keep working in a static snapshot of the panel. Answering\n// handshakes costs nothing until a panel actually sends one.\nif (typeof window !== 'undefined') {\n const channel = createPageScriptChannel<LitInPageProtocol>({\n name: LIT_IN_PAGE_CHANNEL,\n functions: {},\n events: {\n highlight: {handler: (id) => highlightById(id)},\n },\n });\n // A panel that goes away mid-hover never gets to send its `highlight(null)`,\n // and an outline left painted over the app is worse than a missing one.\n channel.events.on('panel:disconnected', () => clearHighlight());\n}\n\nif (typeof window !== 'undefined') {\n const send = (msg: InspectorMessage): void => {\n try {\n pageChannel.send(INSPECT_DATA_CHANNEL, msg);\n } catch {\n // HMR channel temporarily unavailable; the panel can re-request.\n }\n };\n\n // -------------------------------------------------------------------------\n // Live-watch: re-push details whenever the watched element finishes updating.\n // We wrap the instance's `updated` (not the prototype) so the hook is scoped\n // to one element and trivially removable, and it works without the timeline's\n // recording gate.\n // -------------------------------------------------------------------------\n\n type Updatable = Element & {\n updated?: (changed: unknown) => void;\n };\n // Hold the watched element via a WeakRef so an active watch doesn't keep a\n // removed element alive: the override and `restore` only reach `el` through\n // the ref, leaving the DOM as its sole strong root.\n let watched: {ref: WeakRef<Updatable>; restore: () => void} | null = null;\n\n const unwatch = (): void => {\n watched?.restore();\n watched = null;\n };\n\n const watch = (id: number): void => {\n unwatch();\n const el = elementById(id) as Updatable | undefined;\n if (el === undefined) {\n send({type: 'gone', id});\n return;\n }\n const hadOwn = Object.prototype.hasOwnProperty.call(el, 'updated');\n // Only an *own* `updated` is stable across an HMR hot patch. A prototype\n // implementation is replaced in place on every patch (`syncOwnMembers` in\n // ../patch.ts), so caching it here would pin the watched instance to the\n // pre-edit code for the life of the watch — resolve it through the\n // prototype chain on each call instead. Our wrapper is an own property, so\n // the lookup skips it and cannot recurse.\n const ownPrev = hadOwn ? el.updated : undefined;\n const ref = new WeakRef(el);\n el.updated = function (this: Updatable, changed: unknown) {\n const current =\n ownPrev ?? (Object.getPrototypeOf(this) as Updatable | null)?.updated;\n current?.call(this, changed);\n const cur = ref.deref();\n if (cur !== undefined) {\n send({type: 'details', details: collectDetails(cur)});\n }\n };\n watched = {\n ref,\n restore: () => {\n const cur = ref.deref();\n if (cur === undefined) return;\n if (hadOwn) cur.updated = ownPrev;\n else delete cur.updated;\n },\n };\n // Push an immediate snapshot so the panel doesn't wait for the next update.\n send({type: 'details', details: collectDetails(el)});\n };\n\n // -------------------------------------------------------------------------\n // Opt-in live tree: watch the DOM (light + every shadow root) and push a\n // fresh tree when the component hierarchy actually changes. Off by default.\n // childList-only (no attributes), so cosmetic changes — including our own\n // highlight box toggling — don't churn; identical rebuilds are also deduped.\n // Batches that only move text or comment nodes (most Lit re-renders) are\n // dropped before the debounce, and only added subtrees are walked for new\n // shadow roots, so a busy page no longer costs a full-page walk per batch.\n // -------------------------------------------------------------------------\n\n let observer: MutationObserver | null = null;\n let observeTimer: ReturnType<typeof setTimeout> | undefined;\n let lastTreeJson = '';\n // Added elements whose subtrees still need their shadow roots observed.\n let pendingRoots: Element[] = [];\n\n /** Observe every shadow root at or under `root` (and `root`'s subtree). */\n const observeShadowRoots = (\n obs: MutationObserver,\n root: ParentNode\n ): void => {\n if (root instanceof Element && root.shadowRoot !== null) {\n obs.observe(root.shadowRoot, {childList: true, subtree: true});\n observeShadowRoots(obs, root.shadowRoot);\n }\n for (const el of root.querySelectorAll('*')) {\n if (el.shadowRoot !== null) {\n obs.observe(el.shadowRoot, {childList: true, subtree: true});\n observeShadowRoots(obs, el.shadowRoot);\n }\n }\n };\n\n /** Re-attach the observer to the body and every shadow root in the page. */\n const syncObserverTargets = (obs: MutationObserver): void => {\n obs.disconnect();\n obs.observe(document.body, {childList: true, subtree: true});\n observeShadowRoots(obs, document);\n };\n\n const pushTreeIfChanged = (): void => {\n const roots = buildTree();\n const json = JSON.stringify(roots);\n if (json === lastTreeJson) return;\n lastTreeJson = json;\n send({type: 'tree', roots});\n };\n\n /** Whether a subtree holds anything the tree (or observer) cares about. */\n const mayHoldComponents = (node: Node): node is Element => {\n if (!(node instanceof Element)) return false;\n const matters = (el: Element): boolean =>\n el.localName.includes('-') || el.shadowRoot !== null;\n if (matters(node)) return true;\n for (const el of node.querySelectorAll('*')) if (matters(el)) return true;\n return false;\n };\n\n const onMutation = (records: MutationRecord[]): void => {\n // The tree only has custom elements in it, so a batch that adds or\n // removes none (text, comments, plain markup) can't change it.\n let relevant = false;\n for (const record of records) {\n for (const node of record.addedNodes) {\n if (mayHoldComponents(node)) {\n pendingRoots.push(node);\n relevant = true;\n }\n }\n if (!relevant) {\n for (const node of record.removedNodes) {\n if (mayHoldComponents(node)) {\n relevant = true;\n break;\n }\n }\n }\n }\n if (!relevant) return;\n if (observeTimer !== undefined) clearTimeout(observeTimer);\n observeTimer = setTimeout(() => {\n observeTimer = undefined;\n // Walk added subtrees now rather than on arrival: a custom element\n // attaches its shadow root when it upgrades, which can be after insert.\n // Removed roots need no bookkeeping; a detached shadow root just stops\n // producing records.\n const roots = pendingRoots;\n pendingRoots = [];\n if (observer !== null) {\n for (const root of roots) {\n if (root.isConnected) observeShadowRoots(observer, root);\n }\n }\n pushTreeIfChanged();\n }, 100);\n };\n\n const setObserving = (enabled: boolean): void => {\n if (enabled) {\n if (observer === null) observer = new MutationObserver(onMutation);\n lastTreeJson = '';\n syncObserverTargets(observer);\n pushTreeIfChanged();\n } else if (observer !== null) {\n observer.disconnect();\n observer = null;\n pendingRoots = [];\n if (observeTimer !== undefined) {\n clearTimeout(observeTimer);\n observeTimer = undefined;\n }\n }\n };\n\n // -------------------------------------------------------------------------\n // SPA navigation: a route change swaps the component tree without any HMR\n // or panel event, so the snapshot went stale until a manual refresh. Push a\n // deduped tree after each navigation — twice, since routes typically\n // lazy-load and render async. Redundant while the live observer watches.\n // -------------------------------------------------------------------------\n\n const onNavigation = (): void => {\n if (observer !== null) return;\n for (const delay of [150, 1000]) {\n setTimeout(pushTreeIfChanged, delay);\n }\n };\n window.addEventListener('popstate', onNavigation);\n window.addEventListener('hashchange', onNavigation);\n for (const method of ['pushState', 'replaceState'] as const) {\n const original = history[method].bind(history);\n history[method] = (...args: Parameters<History['pushState']>) => {\n original(...args);\n onNavigation();\n };\n }\n\n // -------------------------------------------------------------------------\n // Command dispatch\n // -------------------------------------------------------------------------\n\n pageChannel.on(INSPECT_CMD_CHANNEL, (data) => {\n const cmd = data as InspectorCommand;\n switch (cmd.type) {\n case 'tree': {\n const roots = buildTree();\n lastTreeJson = JSON.stringify(roots);\n send({type: 'tree', roots});\n break;\n }\n case 'details': {\n const el = elementById(cmd.id);\n if (el !== undefined) {\n send({type: 'details', details: collectDetails(el)});\n } else {\n send({type: 'gone', id: cmd.id});\n }\n break;\n }\n case 'watch':\n if (cmd.id === null) unwatch();\n else watch(cmd.id);\n break;\n case 'highlight':\n // Fallback path. A panel that handshaked over the in-page channel\n // emits there instead and never reaches this.\n highlightById(cmd.id);\n break;\n case 'observe':\n setObserving(cmd.enabled);\n break;\n }\n });\n\n // Announce readiness so a panel that loaded first re-requests the tree.\n send({type: 'ready'});\n // A carrier attached later (a standalone dev server) starts with no idea a\n // runtime exists.\n pageChannel.onAttach(() => send({type: 'ready'}));\n}\n"]}
|
|
1
|
+
{"version":3,"file":"install.js","sourceRoot":"","sources":["../../../src/lib/runtime/inspector/install.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAC,uBAAuB,EAAC,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAC,WAAW,EAAC,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAC,WAAW,EAAC,MAAM,oBAAoB,CAAC;AAE/C,OAAO,EAAC,SAAS,EAAE,cAAc,EAAC,MAAM,cAAc,CAAC;AACvD,OAAO,EAAC,cAAc,EAAE,aAAa,EAAC,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EACL,mBAAmB,GAEpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,mBAAmB,EACnB,oBAAoB,GAGrB,MAAM,6BAA6B,CAAC;AAErC,MAAM,GAAG,GAAI,OAAO,IAA4B,CAAC,GAAG,CAAC;AACrD,IAAI,GAAG,KAAK,SAAS;IAAE,WAAW,CAA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BAC1B,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;gBACrC,IAAI,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAC,CAAC,CAAC;gBAC5B,MAAM;YACR,CAAC;YACD,KAAK,SAAS,EAAE,CAAC;gBACf,MAAM,EAAE,GAAG,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;gBAC/B,IAAI,EAAE,KAAK,SAAS,EAAE,CAAC;oBACrB,IAAI,CAAC,EAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,cAAc,CAAC,EAAE,CAAC,EAAC,CAAC,CAAC;gBACvD,CAAC;qBAAM,CAAC;oBACN,IAAI,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE,EAAC,CAAC,CAAC;gBACnC,CAAC;gBACD,MAAM;YACR,CAAC;YACD,KAAK,OAAO;gBACV,IAAI,GAAG,CAAC,EAAE,KAAK,IAAI;oBAAE,OAAO,EAAE,CAAC;;oBAC1B,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;gBACnB,MAAM;YACR,KAAK,WAAW;gBACd,kEAAkE;gBAClE,8CAA8C;gBAC9C,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;gBACtB,MAAM;YACR,KAAK,SAAS;gBACZ,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;gBAC1B,MAAM;QACV,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,wEAAwE;IACxE,IAAI,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC,CAAC;IACtB,2EAA2E;IAC3E,kBAAkB;IAClB,WAAW,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC,CAAC,CAAC;AACpD,CAAC","sourcesContent":["/**\n * Components inspector runtime.\n *\n * Injected into the host page (alongside the timeline runtime) when the\n * DevTools panel is enabled. Answers the panel's tree/details requests over the\n * Vite HMR channel, keeps a watched element's details fresh as it updates, and\n * outlines elements the panel hovers in its tree.\n */\n\nimport {createPageScriptChannel} from 'devframe/in-page-channel';\nimport {elementById} from '../timeline/identity.js';\nimport {pageChannel} from '../page-channel.js';\nimport type {ViteHotLike} from '../page-channel.js';\nimport {buildTree, collectDetails} from './collect.js';\nimport {clearHighlight, highlightById} from './highlight.js';\nimport {\n LIT_IN_PAGE_CHANNEL,\n type LitInPageProtocol,\n} from '../../../types/in-page.js';\nimport {\n INSPECT_CMD_CHANNEL,\n INSPECT_DATA_CHANNEL,\n type InspectorCommand,\n type InspectorMessage,\n} from '../../../types/inspector.js';\n\nconst hot = (import.meta as {hot?: ViteHotLike}).hot;\nif (hot !== undefined) pageChannel.useViteHot(hot);\n\n// The direct panel channel, outside the `hot` gate on purpose: it is the one\n// part of the inspector that does not need a dev server, which is what lets\n// the hover outline keep working in a static snapshot of the panel. Answering\n// handshakes costs nothing until a panel actually sends one.\nif (typeof window !== 'undefined') {\n const channel = createPageScriptChannel<LitInPageProtocol>({\n name: LIT_IN_PAGE_CHANNEL,\n functions: {},\n events: {\n highlight: {handler: (id) => highlightById(id)},\n },\n });\n // A panel that goes away mid-hover never gets to send its `highlight(null)`,\n // and an outline left painted over the app is worse than a missing one.\n channel.events.on('panel:disconnected', () => clearHighlight());\n}\n\nif (typeof window !== 'undefined') {\n const send = (msg: InspectorMessage): void => {\n try {\n pageChannel.send(INSPECT_DATA_CHANNEL, msg);\n } catch {\n // HMR channel temporarily unavailable; the panel can re-request.\n }\n };\n\n // -------------------------------------------------------------------------\n // Live-watch: re-push details whenever the watched element finishes updating.\n // We wrap the instance's `updated` (not the prototype) so the hook is scoped\n // to one element and trivially removable, and it works without the timeline's\n // recording gate.\n // -------------------------------------------------------------------------\n\n type Updatable = Element & {\n updated?: (changed: unknown) => void;\n };\n // Hold the watched element via a WeakRef so an active watch doesn't keep a\n // removed element alive: the override and `restore` only reach `el` through\n // the ref, leaving the DOM as its sole strong root.\n let watched: {ref: WeakRef<Updatable>; restore: () => void} | null = null;\n\n const unwatch = (): void => {\n watched?.restore();\n watched = null;\n };\n\n const watch = (id: number): void => {\n unwatch();\n const el = elementById(id) as Updatable | undefined;\n if (el === undefined) {\n send({type: 'gone', id});\n return;\n }\n const hadOwn = Object.prototype.hasOwnProperty.call(el, 'updated');\n // Only an *own* `updated` is stable across an HMR hot patch. A prototype\n // implementation is replaced in place on every patch (`syncOwnMembers` in\n // ../patch.ts), so caching it here would pin the watched instance to the\n // pre-edit code for the life of the watch — resolve it through the\n // prototype chain on each call instead. Our wrapper is an own property, so\n // the lookup skips it and cannot recurse.\n const ownPrev = hadOwn ? el.updated : undefined;\n const ref = new WeakRef(el);\n el.updated = function (this: Updatable, changed: unknown) {\n const current =\n ownPrev ?? (Object.getPrototypeOf(this) as Updatable | null)?.updated;\n current?.call(this, changed);\n const cur = ref.deref();\n if (cur !== undefined) {\n send({type: 'details', details: collectDetails(cur)});\n }\n };\n watched = {\n ref,\n restore: () => {\n const cur = ref.deref();\n if (cur === undefined) return;\n if (hadOwn) cur.updated = ownPrev;\n else delete cur.updated;\n },\n };\n // Push an immediate snapshot so the panel doesn't wait for the next update.\n send({type: 'details', details: collectDetails(el)});\n };\n\n // -------------------------------------------------------------------------\n // Opt-in live tree: watch the DOM (light + every shadow root) and push a\n // fresh tree when the component hierarchy actually changes. Off by default.\n // childList-only (no attributes), so cosmetic changes — including our own\n // highlight box toggling — don't churn; identical rebuilds are also deduped.\n // Batches that only move text or comment nodes (most Lit re-renders) are\n // dropped before the debounce, and only added subtrees are walked for new\n // shadow roots, so a busy page no longer costs a full-page walk per batch.\n // -------------------------------------------------------------------------\n\n let observer: MutationObserver | null = null;\n let observeTimer: ReturnType<typeof setTimeout> | undefined;\n let lastTreeJson = '';\n // Added elements whose subtrees still need their shadow roots observed.\n let pendingRoots: Element[] = [];\n\n /** Observe every shadow root at or under `root` (and `root`'s subtree). */\n const observeShadowRoots = (\n obs: MutationObserver,\n root: ParentNode\n ): void => {\n if (root instanceof Element && root.shadowRoot !== null) {\n obs.observe(root.shadowRoot, {childList: true, subtree: true});\n observeShadowRoots(obs, root.shadowRoot);\n }\n for (const el of root.querySelectorAll('*')) {\n if (el.shadowRoot !== null) {\n obs.observe(el.shadowRoot, {childList: true, subtree: true});\n observeShadowRoots(obs, el.shadowRoot);\n }\n }\n };\n\n /** Re-attach the observer to the body and every shadow root in the page. */\n const syncObserverTargets = (obs: MutationObserver): void => {\n obs.disconnect();\n obs.observe(document.body, {childList: true, subtree: true});\n observeShadowRoots(obs, document);\n };\n\n const pushTreeIfChanged = (): void => {\n const roots = buildTree();\n const json = JSON.stringify(roots);\n if (json === lastTreeJson) return;\n lastTreeJson = json;\n send({type: 'tree', roots});\n };\n\n /** Whether a subtree holds anything the tree (or observer) cares about. */\n const mayHoldComponents = (node: Node): node is Element => {\n if (!(node instanceof Element)) return false;\n const matters = (el: Element): boolean =>\n el.localName.includes('-') || el.shadowRoot !== null;\n if (matters(node)) return true;\n for (const el of node.querySelectorAll('*')) if (matters(el)) return true;\n return false;\n };\n\n const onMutation = (records: MutationRecord[]): void => {\n // The tree only has custom elements in it, so a batch that adds or\n // removes none (text, comments, plain markup) can't change it.\n let relevant = false;\n for (const record of records) {\n for (const node of record.addedNodes) {\n if (mayHoldComponents(node)) {\n pendingRoots.push(node);\n relevant = true;\n }\n }\n if (!relevant) {\n for (const node of record.removedNodes) {\n if (mayHoldComponents(node)) {\n relevant = true;\n break;\n }\n }\n }\n }\n if (!relevant) return;\n if (observeTimer !== undefined) clearTimeout(observeTimer);\n observeTimer = setTimeout(() => {\n observeTimer = undefined;\n // Walk added subtrees now rather than on arrival: a custom element\n // attaches its shadow root when it upgrades, which can be after insert.\n // Removed roots need no bookkeeping; a detached shadow root just stops\n // producing records.\n const roots = pendingRoots;\n pendingRoots = [];\n if (observer !== null) {\n for (const root of roots) {\n if (root.isConnected) observeShadowRoots(observer, root);\n }\n }\n pushTreeIfChanged();\n }, 100);\n };\n\n const setObserving = (enabled: boolean): void => {\n if (enabled) {\n if (observer === null) observer = new MutationObserver(onMutation);\n lastTreeJson = '';\n syncObserverTargets(observer);\n pushTreeIfChanged();\n } else if (observer !== null) {\n observer.disconnect();\n observer = null;\n pendingRoots = [];\n if (observeTimer !== undefined) {\n clearTimeout(observeTimer);\n observeTimer = undefined;\n }\n }\n };\n\n // -------------------------------------------------------------------------\n // SPA navigation: a route change swaps the component tree without any HMR\n // or panel event, so the snapshot went stale until a manual refresh. Push a\n // deduped tree after each navigation — twice, since routes typically\n // lazy-load and render async. Redundant while the live observer watches.\n // -------------------------------------------------------------------------\n\n const onNavigation = (): void => {\n if (observer !== null) return;\n for (const delay of [150, 1000]) {\n setTimeout(pushTreeIfChanged, delay);\n }\n };\n window.addEventListener('popstate', onNavigation);\n window.addEventListener('hashchange', onNavigation);\n for (const method of ['pushState', 'replaceState'] as const) {\n const original = history[method].bind(history);\n history[method] = (...args: Parameters<History['pushState']>) => {\n original(...args);\n onNavigation();\n };\n }\n\n // -------------------------------------------------------------------------\n // Command dispatch\n // -------------------------------------------------------------------------\n\n pageChannel.on(INSPECT_CMD_CHANNEL, (data) => {\n const cmd = data as InspectorCommand;\n switch (cmd.type) {\n case 'tree': {\n const roots = buildTree();\n lastTreeJson = JSON.stringify(roots);\n send({type: 'tree', roots});\n break;\n }\n case 'details': {\n const el = elementById(cmd.id);\n if (el !== undefined) {\n send({type: 'details', details: collectDetails(el)});\n } else {\n send({type: 'gone', id: cmd.id});\n }\n break;\n }\n case 'watch':\n if (cmd.id === null) unwatch();\n else watch(cmd.id);\n break;\n case 'highlight':\n // Fallback path. A panel that handshaked over the in-page channel\n // emits there instead and never reaches this.\n highlightById(cmd.id);\n break;\n case 'observe':\n setObserving(cmd.enabled);\n break;\n }\n });\n\n // Announce readiness so a panel that loaded first re-requests the tree.\n send({type: 'ready'});\n // A carrier attached later (a standalone dev server) starts with no idea a\n // runtime exists.\n pageChannel.onAttach(() => send({type: 'ready'}));\n}\n"]}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Compact, depth- and breadth-limited previews of arbitrary property values
|
|
3
|
+
* for the inspector details pane. Values cross the transport as plain strings,
|
|
4
|
+
* so this never needs to round-trip — it only has to be readable and safe
|
|
5
|
+
* (circular refs, DOM nodes, functions, huge collections all handled).
|
|
5
6
|
*/
|
|
6
7
|
/** A short type label for the details table's "type" column. */
|
|
7
8
|
export declare const typeTag: (value: unknown) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../../src/lib/runtime/inspector/serialize.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../../src/lib/runtime/inspector/serialize.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAmBH,gEAAgE;AAChE,eAAO,MAAM,OAAO,UAAW,OAAO,KAAG,MAaxC,CAAC;AAiGF,oEAAoE;AACpE,eAAO,MAAM,SAAS,UAAW,OAAO,KAAG,MAM1C,CAAC"}
|
|
@@ -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;;;;;GAKG;AACH,MAAM,WAAW,GAAG,CAAC,KAAa,EAAsB,EAAE;IACxD,MAAM,GAAG,GAAI,KAA0C,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAC5E,OAAO,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,UAAU,CAAC,WAAW,CAAC;QAC3D,CAAC,CAAC,GAAG;QACL,CA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AAK,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"]}
|
|
1
|
+
{"version":3,"file":"serialize.js","sourceRoot":"","sources":["../../../src/lib/runtime/inspector/serialize.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,SAAS,GAAG,CAAC,CAAC;AACpB,MAAM,SAAS,GAAG,CAAC,CAAC;AACpB,MAAM,UAAU,GAAG,GAAG,CAAC;AAEvB;;;;;GAKG;AACH,MAAM,WAAW,GAAG,CAAC,KAAa,EAAsB,EAAE;IACxD,MAAM,GAAG,GAAI,KAA0C,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAC5E,OAAO,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,UAAU,CAAC,WAAW,CAAC;QAC3D,CAAC,CAAC,GAAG;QACL,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC,CAAC;AAEF,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,QAAQ,GAAG,WAAW,CAAC,KAAe,CAAC,CAAC;IA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,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 * 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"]}
|
package/lib/runtime/intern.d.ts
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Template-strings interning.
|
|
3
|
+
*
|
|
4
|
+
* lit-html keys its template cache by the object identity of the
|
|
5
|
+
* `TemplateStringsArray`, so when Vite HMR re-executes a module, every
|
|
6
|
+
* template literal produces a fresh array and lit rebuilds the entire DOM
|
|
7
|
+
* subtree. Interning canonicalizes strings arrays by content: unchanged
|
|
8
|
+
* templates keep their identity across re-execution, so only the edited
|
|
9
|
+
* template rebuilds its part.
|
|
10
|
+
*
|
|
11
|
+
* This module is dependency-free and must stay safe to load in any
|
|
12
|
+
* environment (it is injected into user modules in dev).
|
|
5
13
|
*/
|
|
6
14
|
/**
|
|
7
15
|
* Returns the canonical strings array for `strings` within namespace `ns`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intern.d.ts","sourceRoot":"","sources":["../../src/lib/runtime/intern.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"intern.d.ts","sourceRoot":"","sources":["../../src/lib/runtime/intern.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAyCH;;;;;;;GAOG;AACH,eAAO,MAAM,MAAM,OACb,MAAM,WACD,oBAAoB,KAC5B,oBAoBF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,OAAO,GAClB,CAAC,SAAS,CAAC,OAAO,EAAE,oBAAoB,EAAE,GAAG,MAAM,EAAE,KAAK,EAAE,KAAK,OAAO,OAEnE,CAAC,MACF,MAAM,KACT,CAE0C,CAAC"}
|
package/lib/runtime/intern.js
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Template-strings interning.
|
|
3
|
+
*
|
|
4
|
+
* lit-html keys its template cache by the object identity of the
|
|
5
|
+
* `TemplateStringsArray`, so when Vite HMR re-executes a module, every
|
|
6
|
+
* template literal produces a fresh array and lit rebuilds the entire DOM
|
|
7
|
+
* subtree. Interning canonicalizes strings arrays by content: unchanged
|
|
8
|
+
* templates keep their identity across re-execution, so only the edited
|
|
9
|
+
* template rebuilds its part.
|
|
10
|
+
*
|
|
11
|
+
* This module is dependency-free and must stay safe to load in any
|
|
12
|
+
* environment (it is injected into user modules in dev).
|
|
5
13
|
*/
|
|
6
14
|
// Exactly one intern state per page, even if this module is loaded twice
|
|
7
15
|
// (e.g. via both an optimized and a raw URL).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intern.js","sourceRoot":"","sources":["../../src/lib/runtime/intern.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"intern.js","sourceRoot":"","sources":["../../src/lib/runtime/intern.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAaH,yEAAyE;AACzE,8CAA8C;AAC9C,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;AAEjE,MAAM,QAAQ,GAAG,GAAgB,EAAE;IACjC,MAAM,C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AAG,EAAE,SAAS,CAAC,CAAC;IACtC,CAAC;IACD,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAC1C,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAGrB,GAAM,EACN,EAAU,EACP,EAAE,CACL,CAAC,CAAC,OAA6B,EAAE,GAAG,MAAe,EAAE,EAAE,CACrD,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,CAAC,EAAE,GAAG,MAAM,CAAC,CAAM,CAAC","sourcesContent":["/**\n * Template-strings interning.\n *\n * lit-html keys its template cache by the object identity of the\n * `TemplateStringsArray`, so when Vite HMR re-executes a module, every\n * template literal produces a fresh array and lit rebuilds the entire DOM\n * subtree. Interning canonicalizes strings arrays by content: unchanged\n * templates keep their identity across re-execution, so only the edited\n * template rebuilds its part.\n *\n * This module is dependency-free and must stay safe to load in any\n * environment (it is injected into user modules in dev).\n */\n\ninterface InternState {\n /** Content key → the canonical (first-seen) strings array. */\n byContent: Map<string, TemplateStringsArray>;\n /**\n * Fast path: per-call-site arrays recur on every render, so after the\n * first lookup we can map them to their canonical array with a single\n * WeakMap hit instead of rebuilding the content key.\n */\n canonicalOf: WeakMap<TemplateStringsArray, TemplateStringsArray>;\n}\n\n// Exactly one intern state per page, even if this module is loaded twice\n// (e.g. via both an optimized and a raw URL).\nconst STATE_KEY = Symbol.for('@lit-labs/vite-plugin-lit#intern');\n\nconst getState = (): InternState => {\n const g = globalThis as unknown as Record<symbol, InternState | undefined>;\n return (g[STATE_KEY] ??= {\n byContent: new Map(),\n canonicalOf: new WeakMap(),\n });\n};\n\n/**\n * Builds a collision-free content key for a strings array.\n *\n * Uses the `raw` chunks (cooked strings derive from raw) with length\n * prefixes so that chunk boundaries can never collide, namespaced per tag\n * type: `html` and `svg` templates with equal content must not share a\n * canonical array, or one shared `Template` would parse SVG as HTML.\n */\nconst contentKey = (ns: string, raw: readonly string[]): string => {\n let key = ns + '\\x00' + raw.length;\n for (const chunk of raw) {\n key += '\\x01' + chunk.length + '\\x01' + chunk;\n }\n return key;\n};\n\n/**\n * Returns the canonical strings array for `strings` within namespace `ns`.\n *\n * The first genuine `TemplateStringsArray` seen for a given content becomes\n * the canonical array; later content-equal arrays map onto it. Non-template\n * input (anything without a `raw` array) passes through untouched so lit\n * can raise its own error.\n */\nexport const intern = (\n ns: string,\n strings: TemplateStringsArray\n): TemplateStringsArray => {\n if (\n !Array.isArray(strings) ||\n !Array.isArray((strings as {raw?: unknown}).raw)\n ) {\n return strings;\n }\n const state = getState();\n const fast = state.canonicalOf.get(strings);\n if (fast !== undefined) {\n return fast;\n }\n const key = contentKey(ns, strings.raw);\n let canonical = state.byContent.get(key);\n if (canonical === undefined) {\n canonical = strings;\n state.byContent.set(key, canonical);\n }\n state.canonicalOf.set(strings, canonical);\n return canonical;\n};\n\n/**\n * Wraps a template tag so its strings argument is interned in `ns`.\n */\nexport const wrapTag = <\n T extends (strings: TemplateStringsArray, ...values: never[]) => unknown,\n>(\n tag: T,\n ns: string\n): T =>\n ((strings: TemplateStringsArray, ...values: never[]) =>\n tag(intern(ns, strings), ...values)) as T;\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Browser-runtime side of the panel's live setting overrides. Reads the
|
|
3
|
+
* persisted override (written by the panel; same origin) and subscribes to the
|
|
4
|
+
* page channel the server rebroadcasts panel changes on.
|
|
5
5
|
*/
|
|
6
6
|
import type { ViteHotLike } from './page-channel.js';
|
|
7
7
|
import { type SettingsOverride } from '../../types/timeline.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overrides.d.ts","sourceRoot":"","sources":["../../src/lib/runtime/overrides.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"overrides.d.ts","sourceRoot":"","sources":["../../src/lib/runtime/overrides.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,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"}
|
package/lib/runtime/overrides.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overrides.js","sourceRoot":"","sources":["../../src/lib/runtime/overrides.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH
|
|
1
|
+
{"version":3,"file":"overrides.js","sourceRoot":"","sources":["../../src/lib/runtime/overrides.ts"],"names":[],"mappings":"AAAA;;;;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 * 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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-channel.d.ts","sourceRoot":"","sources":["../../src/lib/runtime/page-channel.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"page-channel.d.ts","sourceRoot":"","sources":["../../src/lib/runtime/page-channel.ts"],"names":[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
4
|
-
*
|
|
2
|
+
* The page runtime's one seam to whatever carries its traffic to the DevTools
|
|
3
|
+
* server. Every `lit:*` message the runtime sends or receives (timeline
|
|
4
|
+
* events, inspector data and commands, settings overrides, HMR-incompatibility
|
|
5
|
+
* notices) goes through {@link pageChannel}, never through `import.meta.hot`
|
|
6
|
+
* directly, so the carrier can be swapped without touching a call site.
|
|
7
|
+
*
|
|
8
|
+
* The default carrier is Vite's HMR channel ({@link fromViteHot}). An
|
|
9
|
+
* alternative (see `rpc-transport.ts`) is attached with
|
|
10
|
+
* {@link PageChannel.attach}; listeners registered earlier move over to it.
|
|
11
|
+
*
|
|
12
|
+
* Vite's own lifecycle events (`vite:afterUpdate`, `vite:beforeFullReload`,
|
|
13
|
+
* `vite:ws:*`) are not part of this channel: they describe the HMR connection
|
|
14
|
+
* itself, so the sites that care still read `import.meta.hot` for those.
|
|
5
15
|
*/
|
|
6
16
|
/** Wraps Vite's HMR client as a {@link PageTransport}. */
|
|
7
17
|
export const fromViteHot = (hot) => ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-channel.js","sourceRoot":"","sources":["../../src/lib/runtime/page-channel.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"page-channel.js","sourceRoot":"","sources":["../../src/lib/runtime/page-channel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAgBH,0DAA0D;AAC1D,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,GAAgB,EAAiB,EAAE,CAAC,CAAC;IAC/D,IAAI,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC;IAChD,EAAE,CAAC,OAAO,EAAE,OAAO;QACjB,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACzB,OAAO,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,OAA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AAS;gBAAE,IAAI,CAAC,KAAK,CAAC,CAAC;YAC3C,KAAK,MAAM,QAAQ,IAAI,eAAe,EAAE,CAAC;gBACvC,IAAI,CAAC;oBACH,QAAQ,EAAE,CAAC;gBACb,CAAC;gBAAC,MAAM,CAAC;oBACP,0DAA0D;gBAC5D,CAAC;YACH,CAAC;QACH,CAAC;QACD,UAAU,CAAC,GAAG;YACZ,IAAI,SAAS,KAAK,SAAS;gBAAE,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;QAChE,CAAC;QACD,QAAQ,CAAC,QAAQ;YACf,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACjC,CAAC;KACF,CAAC;IACF,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF,8EAA8E;AAC9E,gFAAgF;AAChF,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,wCAAwC,CAAC,CAAC;AAEzE,MAAM,MAAM,GAAG,UAAgE,CAAC;AAEhF,MAAM,CAAC,MAAM,WAAW,GAAgB,CAAC,MAAM,CAAC,WAAW,CAAC;IAC1D,iBAAiB,EAAE,CAAC,CAAC","sourcesContent":["/**\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"]}
|
package/lib/runtime/patch.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"patch.d.ts","sourceRoot":"","sources":["../../src/lib/runtime/patch.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"patch.d.ts","sourceRoot":"","sources":["../../src/lib/runtime/patch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,kBAAkB,CAAC;AAI1B,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;IAEnC;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,cAAc,CAAC;CAC7B;AAwDD;;;;GAIG;AAEH,eAAO,MAAM,cAAc,WACjB,MAAM,UACN,MAAM,QACR,aAAa,CAAC,WAAW,CAAC,SA4BjC,CAAC;AA+IF;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,YAC3B,MAAM,UACP,wBAAwB,UACxB,uBAAuB,CAAC,QAAQ,CAAC,KACxC,uBAAwE,CAAC;AA8K5E;;;GAGG;AACH,eAAO,MAAM,OAAO,aAAa,YAAY,KAAQ,IAuFpD,CAAC"}
|
package/lib/runt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;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 {\n createChildState,\n type ChildState,\n type ChildStateMode,\n} from './child-state.js';\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 /**\n * What happens to custom elements a hot patch re-creates (an edited\n * template clones fresh DOM): `'reset'` leaves them at their defaults,\n * `'transfer'` copies the old element's state onto the new one, `'reuse'`\n * puts the old element back where the new one carries no bindings (and\n * transfers otherwise). Defaults to `'transfer'`.\n */\n childState?: ChildStateMode;\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 /** Pairs re-created child elements with the ones they replace. */\n childState?: ChildState;\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 // Before the original runs, so a transfer lands ahead of the\n // element's first update.\n state.childState?.connected(this, !state.generationOf.has(this));\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 state.childState?.disconnected(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. Re-renders may re-create child elements\n // (edited templates clone fresh DOM); the window pairs them up.\n state.childState?.open();\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 // Read after requestUpdate() so each promise covers the new update.\n state.childState?.watch(record.instances);\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 if (options.childState !== undefined) {\n existing.options.childState = options.childState;\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 childState: options.childState ?? 'transfer',\n },\n hot: hot === undefined ? undefined : pageChannel,\n };\n state.childState = createChildState({\n mode: () => state.options.childState,\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 // Read on every patch (see createChildState's `mode`), so it applies from\n // the next edit on.\n if (o.hmrChildState !== undefined) {\n state.options.childState = o.hmrChildState;\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;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,gBAAgB,GAGjB,MAAM,kBAAkB,CAAC;AAC1B,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;AAqE5C,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,W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IAC3C,cAAc,CAAC,MAAM,GAAG,UAEtB,IAAY,EACZ,IAA8B,EAC9B,aAAwC;QAExC,IAAI,MAAM,GAAG,KAAK,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 * 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 {\n createChildState,\n type ChildState,\n type ChildStateMode,\n} from './child-state.js';\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 /**\n * What happens to custom elements a hot patch re-creates (an edited\n * template clones fresh DOM): `'reset'` leaves them at their defaults,\n * `'transfer'` copies the old element's state onto the new one, `'reuse'`\n * puts the old element back where the new one carries no bindings (and\n * transfers otherwise). Defaults to `'transfer'`.\n */\n childState?: ChildStateMode;\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 /** Pairs re-created child elements with the ones they replace. */\n childState?: ChildState;\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 // Before the original runs, so a transfer lands ahead of the\n // element's first update.\n state.childState?.connected(this, !state.generationOf.has(this));\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 state.childState?.disconnected(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. Re-renders may re-create child elements\n // (edited templates clone fresh DOM); the window pairs them up.\n state.childState?.open();\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 // Read after requestUpdate() so each promise covers the new update.\n state.childState?.watch(record.instances);\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 if (options.childState !== undefined) {\n existing.options.childState = options.childState;\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 childState: options.childState ?? 'transfer',\n },\n hot: hot === undefined ? undefined : pageChannel,\n };\n state.childState = createChildState({\n mode: () => state.options.childState,\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 // Read on every patch (see createChildState's `mode`), so it applies from\n // the next edit on.\n if (o.hmrChildState !== undefined) {\n state.options.childState = o.hmrChildState;\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,13 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Carries the page channel over devframe RPC to a standalone
|
|
3
|
+
* `lit-devtools dev` server, so a page that is not served by a DevTools-enabled
|
|
4
|
+
* Vite dev server can still feed the panel. The server half is
|
|
5
|
+
* `devframe/rpc-source.ts`.
|
|
6
|
+
*
|
|
7
|
+
* Opt-in and explicit: nothing connects until {@link connectToDevServer} is
|
|
8
|
+
* called, and `devframe/client` is only imported then, so a page that never
|
|
9
|
+
* asks pays nothing.
|
|
10
|
+
*
|
|
11
|
+
* @module
|
|
5
12
|
*/
|
|
6
13
|
import type { ConnectionMeta } from 'devframe';
|
|
7
14
|
import type { PageTransport } from './page-channel.js';
|
|
8
15
|
/** The slice of a scoped devframe client the transport uses. */
|
|
9
16
|
export interface PageRpc {
|
|
17
|
+
/** Fires a devframe event on the server, without waiting for a reply. */
|
|
10
18
|
callEvent(method: string, ...args: unknown[]): void;
|
|
19
|
+
/** Registers a handler for an event the server sends to this page. */
|
|
11
20
|
register(fn: {
|
|
12
21
|
name: string;
|
|
13
22
|
type: 'event';
|
|
@@ -20,6 +29,7 @@ export interface PageRpc {
|
|
|
20
29
|
* registered with `on`.
|
|
21
30
|
*/
|
|
22
31
|
export declare const createRpcTransport: (rpc: PageRpc) => PageTransport;
|
|
32
|
+
/** Options for {@link connectToDevServer}. */
|
|
23
33
|
export interface ConnectOptions {
|
|
24
34
|
/**
|
|
25
35
|
* A bearer token the server already trusts. Without one the client falls
|