Skip to content

Conversation

@rictic
Copy link
Collaborator

@rictic rictic commented May 14, 2025

This improves fidelity, and by making the class a declaration rather than an expression, and explicitly implementing the real interface we're able to better cooperate with JSCompiler's renaming.

This improves fidelity, and by making the class a declaration rather than an expression, and explicitly implementing the real interface we're able to better cooperate with JSCompiler's renaming.
@rictic rictic requested a review from kevinpschaaf as a code owner May 14, 2025 18:24
@changeset-bot
Copy link

changeset-bot bot commented May 14, 2025

🦋 Changeset detected

Latest commit: 4f135e7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@lit-labs/ssr-dom-shim Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented May 14, 2025

📊 Tachometer Benchmark Results

Summary

nop-update

  • this-change, tip-of-tree, previous-release: faster ✔ 3% - 18% (0.29ms - 2.60ms)
    this-change vs tip-of-tree

render

  • this-change: 45.78ms - 60.94ms
  • this-change, tip-of-tree, previous-release: unsure 🔍 -2% - +5% (-0.36ms - +1.01ms)
    this-change vs tip-of-tree
  • this-change, tip-of-tree, previous-release: unsure 🔍 -1% - +2% (-0.32ms - +0.70ms)
    this-change vs tip-of-tree
  • this-change, tip-of-tree, previous-release: unsure 🔍 -5% - +60% (-0.82ms - +29.55ms)
    this-change vs tip-of-tree

update

  • this-change: 503.60ms - 510.25ms
  • this-change, tip-of-tree, previous-release: unsure 🔍 -4% - +6% (-1.44ms - +2.34ms)
    this-change vs tip-of-tree
  • this-change, tip-of-tree, previous-release: unsure 🔍 -3% - +2% (-2.45ms - +1.23ms)
    this-change vs tip-of-tree
  • this-change, tip-of-tree, previous-release: unsure 🔍 -2% - +1% (-9.57ms - +4.40ms)
    this-change vs tip-of-tree

update-reflect

  • this-change: 495.25ms - 500.74ms
  • this-change, tip-of-tree, previous-release: unsure 🔍 -2% - +1% (-7.84ms - +5.45ms)
    this-change vs tip-of-tree

Results

this-change

render

VersionAvg timevs
45.78ms - 60.94ms-

update

VersionAvg timevs
503.60ms - 510.25ms-

update-reflect

VersionAvg timevs
495.25ms - 500.74ms-
this-change, tip-of-tree, previous-release

render

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
18.80ms - 19.94ms-unsure 🔍
-2% - +5%
-0.36ms - +1.01ms
unsure 🔍
-2% - +6%
-0.45ms - +1.20ms
tip-of-tree
tip-of-tree
18.65ms - 19.43msunsure 🔍
-5% - +2%
-1.01ms - +0.36ms
-unsure 🔍
-3% - +4%
-0.66ms - +0.76ms
previous-release
previous-release
18.39ms - 19.59msunsure 🔍
-6% - +2%
-1.20ms - +0.45ms
unsure 🔍
-4% - +3%
-0.76ms - +0.66ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
36.85ms - 39.90ms-unsure 🔍
-4% - +6%
-1.44ms - +2.34ms
unsure 🔍
-6% - +4%
-2.20ms - +1.56ms
tip-of-tree
tip-of-tree
36.82ms - 39.04msunsure 🔍
-6% - +4%
-2.34ms - +1.44ms
-unsure 🔍
-6% - +2%
-2.33ms - +0.79ms
previous-release
previous-release
37.60ms - 39.79msunsure 🔍
-4% - +6%
-1.56ms - +2.20ms
unsure 🔍
-2% - +6%
-0.79ms - +2.33ms
-

nop-update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
11.75ms - 13.30ms-faster ✔
3% - 18%
0.29ms - 2.60ms
unsure 🔍
-15% - +2%
-2.11ms - +0.29ms
tip-of-tree
tip-of-tree
13.11ms - 14.82msslower ❌
2% - 21%
0.29ms - 2.60ms
-unsure 🔍
-6% - +14%
-0.72ms - +1.79ms
previous-release
previous-release
12.51ms - 14.36msunsure 🔍
-3% - +17%
-0.29ms - +2.11ms
unsure 🔍
-13% - +5%
-1.79ms - +0.72ms
-
this-change, tip-of-tree, previous-release

render

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
34.94ms - 35.78ms-unsure 🔍
-1% - +2%
-0.32ms - +0.70ms
unsure 🔍
-2% - +2%
-0.76ms - +0.60ms
tip-of-tree
tip-of-tree
34.87ms - 35.46msunsure 🔍
-2% - +1%
-0.70ms - +0.32ms
-unsure 🔍
-2% - +1%
-0.88ms - +0.33ms
previous-release
previous-release
34.91ms - 35.97msunsure 🔍
-2% - +2%
-0.60ms - +0.76ms
unsure 🔍
-1% - +3%
-0.33ms - +0.88ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
73.48ms - 76.14ms-unsure 🔍
-3% - +2%
-2.45ms - +1.23ms
unsure 🔍
-4% - +1%
-2.74ms - +0.82ms
tip-of-tree
tip-of-tree
74.14ms - 76.69msunsure 🔍
-2% - +3%
-1.23ms - +2.45ms
-unsure 🔍
-3% - +2%
-2.09ms - +1.39ms
previous-release
previous-release
74.58ms - 76.95msunsure 🔍
-1% - +4%
-0.82ms - +2.74ms
unsure 🔍
-2% - +3%
-1.39ms - +2.09ms
-
this-change, tip-of-tree, previous-release

render

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
55.49ms - 78.12ms-unsure 🔍
-5% - +60%
-0.82ms - +29.55ms
unsure 🔍
-5% - +60%
-0.71ms - +29.58ms
tip-of-tree
tip-of-tree
42.32ms - 62.56msunsure 🔍
-42% - -1%
-29.55ms - +0.82ms
-unsure 🔍
-27% - +27%
-14.20ms - +14.34ms
previous-release
previous-release
42.31ms - 62.43msunsure 🔍
-42% - -2%
-29.58ms - +0.71ms
unsure 🔍
-27% - +27%
-14.34ms - +14.20ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
504.67ms - 515.28ms-unsure 🔍
-2% - +1%
-9.57ms - +4.40ms
unsure 🔍
-2% - +1%
-10.68ms - +4.34ms
tip-of-tree
tip-of-tree
508.01ms - 517.10msunsure 🔍
-1% - +2%
-4.40ms - +9.57ms
-unsure 🔍
-1% - +1%
-7.59ms - +6.41ms
previous-release
previous-release
507.83ms - 518.47msunsure 🔍
-1% - +2%
-4.34ms - +10.68ms
unsure 🔍
-1% - +1%
-6.41ms - +7.59ms
-

update-reflect

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
512.46ms - 521.97ms-unsure 🔍
-2% - +1%
-7.84ms - +5.45ms
unsure 🔍
-2% - +1%
-9.49ms - +4.52ms
tip-of-tree
tip-of-tree
513.77ms - 523.05msunsure 🔍
-1% - +2%
-5.45ms - +7.84ms
-unsure 🔍
-2% - +1%
-8.21ms - +5.64ms
previous-release
previous-release
514.56ms - 524.84msunsure 🔍
-1% - +2%
-4.52ms - +9.49ms
unsure 🔍
-1% - +2%
-5.64ms - +8.21ms
-

tachometer-reporter-action v2 for Benchmarks

@rictic rictic requested review from Copilot and justinfagnani and removed request for kevinpschaaf May 14, 2025 18:26
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the server-side rendering shim by fully implementing the CustomElementRegistry type, ensuring better type fidelity and improved compatibility with JSCompiler renaming.

  • Introduces a full class implementation for CustomElementRegistry with additional methods (getName, upgrade, whenDefined)
  • Adds helper types and functions to manage asynchronous element definition resolution
  • Updates export statements to align with the new type declarations

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
packages/labs/ssr-dom-shim/src/index.ts Implements a complete CustomElementRegistry type with added methods and helper types for improved fidelity.
.changeset/rare-dryers-jump.md Minor changeset documentation describing the update.

@github-actions
Copy link
Contributor

The size of lit-html.js and lit-core.min.js are as expected.

@rictic rictic requested a review from justinfagnani May 14, 2025 21:09
@rictic rictic enabled auto-merge (squash) May 14, 2025 21:09
Comment on lines +186 to +192
let resolve: (value: T) => void;
let reject: (reason?: unknown) => void;
const promise = new Promise<T>((res, rej) => {
resolve = res;
reject = rej;
});
return {promise, resolve: resolve!, reject: reject!};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fyi, you can do slightly more compact non-null assertions:

Suggested change
let resolve: (value: T) => void;
let reject: (reason?: unknown) => void;
const promise = new Promise<T>((res, rej) => {
resolve = res;
reject = rej;
});
return {promise, resolve: resolve!, reject: reject!};
let resolve!: (value: T) => void;
let rejec!t: (reason?: unknown) => void;
const promise = new Promise<T>((res, rej) => {
resolve = res;
reject = rej;
});
return {promise, resolve, reject};

@rictic rictic merged commit 3ac01ae into main May 14, 2025
10 checks passed
@rictic rictic deleted the higher-fidelity-ce-ssr-shim branch May 14, 2025 21:50
@lit-robot lit-robot mentioned this pull request Jul 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants