Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[infra] Add browser export conditions to package.json #4485

Merged
merged 9 commits into from
Jan 11, 2024

Conversation

AndrewJakubowicz
Copy link
Contributor

@AndrewJakubowicz AndrewJakubowicz commented Jan 10, 2024

Fixes: #4446

Context

This is a compromise so that testing in Vitest works. As part of this work I explored simplifying the package.json exports using subpath patterns. Unfortunately the ecosystem doesn't support those very well, so it's been punted.

  • First commit contains the script.
  • Second commit contains the result of running the script.

Marked this a patch change, as it's a minor "bug fix" workaround for testing in Jest and Vitest.

This script has two modes:

  • test: won't write any files, but instead checks that no files need to be fixed. Is run as part of our CI.
  • fix: writes to package.json files.

Test plan

The prior browser/node entrypoints are tested via our CI.

The script itself is lightly tested via node assertions. The script won't run if an assertion fails.

Risk

This changes the entrypoints in some of our package.json configurations, so it is a slightly risky change. We've manually verified that adding the browser export above node works correctly. Similarly if our test suite passes, then this should not be a regression as we use the exports in our tests.

Copy link

changeset-bot bot commented Jan 10, 2024

🦋 Changeset detected

Latest commit: 07e1f9a

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

This PR includes changesets to release 8 packages
Name Type
@lit/reactive-element Patch
@lit-labs/ssr-client Patch
@lit-labs/react Patch
lit-html Patch
@lit/react Patch
lit-element Patch
lit Patch
@lit-internal/test-elements-react Patch

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

Copy link
Contributor

github-actions bot commented Jan 10, 2024

📊 Tachometer Benchmark Results

Summary

nop-update

  • this-change, tip-of-tree, previous-release: unsure 🔍 -3% - +9% (-0.36ms - +1.00ms)
    this-change vs tip-of-tree

render

  • this-change: 47.15ms - 49.37ms
  • this-change, tip-of-tree, previous-release: unsure 🔍 -2% - +6% (-0.32ms - +1.09ms)
    this-change vs tip-of-tree
  • this-change, tip-of-tree, previous-release: unsure 🔍 -2% - +2% (-0.61ms - +0.63ms)
    this-change vs tip-of-tree
  • this-change, tip-of-tree, previous-release: unsure 🔍 -0% - +3% (-0.14ms - +0.99ms)
    this-change vs tip-of-tree

update

  • this-change: 511.07ms - 518.62ms
  • this-change, tip-of-tree, previous-release: unsure 🔍 -4% - +8% (-1.69ms - +3.18ms)
    this-change vs tip-of-tree
  • this-change, tip-of-tree, previous-release: unsure 🔍 -1% - +2% (-0.83ms - +1.35ms)
    this-change vs tip-of-tree
  • this-change, tip-of-tree, previous-release: unsure 🔍 -1% - +1% (-2.85ms - +3.28ms)
    this-change vs tip-of-tree

update-reflect

  • this-change: 513.66ms - 518.66ms
  • this-change, tip-of-tree, previous-release: unsure 🔍 -0% - +1% (-1.59ms - +4.30ms)
    this-change vs tip-of-tree

Results

this-change

render

VersionAvg timevs
47.15ms - 49.37ms-

update

VersionAvg timevs
511.07ms - 518.62ms-

update-reflect

VersionAvg timevs
513.66ms - 518.66ms-
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.70ms - 19.79ms-unsure 🔍
-2% - +6%
-0.32ms - +1.09ms
unsure 🔍
-1% - +7%
-0.23ms - +1.22ms
tip-of-tree
tip-of-tree
18.41ms - 19.30msunsure 🔍
-6% - +2%
-1.09ms - +0.32ms
-unsure 🔍
-3% - +4%
-0.54ms - +0.76ms
previous-release
previous-release
18.27ms - 19.22msunsure 🔍
-6% - +1%
-1.22ms - +0.23ms
unsure 🔍
-4% - +3%
-0.76ms - +0.54ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
39.06ms - 42.56ms-unsure 🔍
-4% - +8%
-1.69ms - +3.18ms
unsure 🔍
-6% - +7%
-2.35ms - +2.70ms
tip-of-tree
tip-of-tree
38.36ms - 41.76msunsure 🔍
-8% - +4%
-3.18ms - +1.69ms
-unsure 🔍
-8% - +5%
-3.07ms - +1.92ms
previous-release
previous-release
38.81ms - 42.46msunsure 🔍
-7% - +6%
-2.70ms - +2.35ms
unsure 🔍
-5% - +8%
-1.92ms - +3.07ms
-

nop-update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
11.22ms - 12.15ms-unsure 🔍
-3% - +9%
-0.36ms - +1.00ms
unsure 🔍
-3% - +7%
-0.39ms - +0.80ms
tip-of-tree
tip-of-tree
10.87ms - 11.86msunsure 🔍
-8% - +3%
-1.00ms - +0.36ms
-unsure 🔍
-6% - +4%
-0.74ms - +0.50ms
previous-release
previous-release
11.11ms - 11.85msunsure 🔍
-7% - +3%
-0.80ms - +0.39ms
unsure 🔍
-4% - +7%
-0.50ms - +0.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
33.19ms - 34.07ms-unsure 🔍
-2% - +2%
-0.61ms - +0.63ms
unsure 🔍
-4% - +2%
-1.34ms - +0.61ms
tip-of-tree
tip-of-tree
33.19ms - 34.05msunsure 🔍
-2% - +2%
-0.63ms - +0.61ms
-unsure 🔍
-4% - +2%
-1.35ms - +0.60ms
previous-release
previous-release
33.12ms - 34.87msunsure 🔍
-2% - +4%
-0.61ms - +1.34ms
unsure 🔍
-2% - +4%
-0.60ms - +1.35ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
69.18ms - 70.78ms-unsure 🔍
-1% - +2%
-0.83ms - +1.35ms
unsure 🔍
-1% - +2%
-0.80ms - +1.33ms
tip-of-tree
tip-of-tree
68.98ms - 70.46msunsure 🔍
-2% - +1%
-1.35ms - +0.83ms
-unsure 🔍
-1% - +1%
-1.02ms - +1.03ms
previous-release
previous-release
69.00ms - 70.42msunsure 🔍
-2% - +1%
-1.33ms - +0.80ms
unsure 🔍
-1% - +1%
-1.03ms - +1.02ms
-
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
33.73ms - 34.58ms-unsure 🔍
-0% - +3%
-0.14ms - +0.99ms
unsure 🔍
-2% - +2%
-0.63ms - +0.53ms
tip-of-tree
tip-of-tree
33.36ms - 34.10msunsure 🔍
-3% - +0%
-0.99ms - +0.14ms
-unsure 🔍
-3% - +0%
-1.02ms - +0.06ms
previous-release
previous-release
33.82ms - 34.60msunsure 🔍
-2% - +2%
-0.53ms - +0.63ms
unsure 🔍
-0% - +3%
-0.06ms - +1.02ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
521.87ms - 526.04ms-unsure 🔍
-1% - +1%
-2.85ms - +3.28ms
unsure 🔍
-1% - +1%
-3.22ms - +2.74ms
tip-of-tree
tip-of-tree
521.49ms - 525.99msunsure 🔍
-1% - +1%
-3.28ms - +2.85ms
-unsure 🔍
-1% - +1%
-3.55ms - +2.64ms
previous-release
previous-release
522.07ms - 526.32msunsure 🔍
-1% - +1%
-2.74ms - +3.22ms
unsure 🔍
-1% - +1%
-2.64ms - +3.55ms
-

update-reflect

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
529.60ms - 533.84ms-unsure 🔍
-0% - +1%
-1.59ms - +4.30ms
unsure 🔍
-1% - +1%
-3.93ms - +3.84ms
tip-of-tree
tip-of-tree
528.32ms - 532.41msunsure 🔍
-1% - +0%
-4.30ms - +1.59ms
-unsure 🔍
-1% - +0%
-5.25ms - +2.44ms
previous-release
previous-release
528.52ms - 535.02msunsure 🔍
-1% - +1%
-3.84ms - +3.93ms
unsure 🔍
-0% - +1%
-2.44ms - +5.25ms
-

tachometer-reporter-action v2 for Benchmarks

Copy link
Contributor

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

@rictic
Copy link
Collaborator

rictic commented Jan 10, 2024

This is great work!

.changeset/funny-files-tease.md Outdated Show resolved Hide resolved
packages/internal-scripts/package.json Outdated Show resolved Hide resolved
packages/internal-scripts/src/add-browser-exports.ts Outdated Show resolved Hide resolved
AndrewJakubowicz and others added 2 commits January 10, 2024 15:33
Co-authored-by: Peter Burns <rictic@google.com>
Co-authored-by: Augustine Kim <augustinekim@google.com>
@AndrewJakubowicz AndrewJakubowicz merged commit 57b0063 into main Jan 11, 2024
10 checks passed
@AndrewJakubowicz AndrewJakubowicz deleted the browser-export-script branch January 11, 2024 03:38
@lit-robot lit-robot mentioned this pull request Jan 31, 2024
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.

@lit/react package is not setting properties passed to the component during Vitest tests
3 participants