Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@AndrewJakubowicz
Copy link
Contributor

Issue: #189
RFC: lit/rfcs#21
Full prototype PR: #3984

Context

I have a test branch which compiles lit-html_tests and runs tests and it caught that svg templates were not correctly handled.

import {svg} from 'lit' was marking the svg tag as a compilable template.

Fix

The original check handles the complex cases, but misses the simple case. For example an import of import {html as svg, svg as html} from 'lit' works prior to this change because we have been assuming there will be an aliased property name.

This change adds a check for direct imports. Note that the aliased golden continues to work (I just fixed punctuation).

Test plan

Unit tested by adding a new golden.

@changeset-bot
Copy link

changeset-bot bot commented Aug 11, 2023

🦋 Changeset detected

Latest commit: 0b75628

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

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

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 Aug 11, 2023

📊 Tachometer Benchmark Results

Summary

nop-update

  • this-change, tip-of-tree, previous-release: faster ✔ 7% - 19% (1.82ms - 5.33ms)
    this-change vs tip-of-tree

render

  • this-change: 101.11ms - 107.52ms
  • this-change, tip-of-tree, previous-release: unsure 🔍 -10% - +2% (-4.50ms - +0.86ms)
    this-change vs tip-of-tree
  • this-change, tip-of-tree, previous-release: unsure 🔍 -3% - +2% (-2.24ms - +1.45ms)
    this-change vs tip-of-tree
  • this-change, tip-of-tree, previous-release: unsure 🔍 -1% - +8% (-0.33ms - +5.50ms)
    this-change vs tip-of-tree

update

  • this-change: 1083.53ms - 1106.79ms
  • this-change, tip-of-tree, previous-release: unsure 🔍 -8% - +3% (-8.78ms - +3.64ms)
    this-change vs tip-of-tree
  • this-change, tip-of-tree, previous-release: unsure 🔍 -3% - +2% (-4.67ms - +3.48ms)
    this-change vs tip-of-tree
  • this-change, tip-of-tree, previous-release: unsure 🔍 -1% - +1% (-13.21ms - +15.44ms)
    this-change vs tip-of-tree

update-reflect

  • this-change: 1061.48ms - 1081.11ms
  • this-change, tip-of-tree, previous-release: unsure 🔍 -1% - +2% (-15.51ms - +18.03ms)
    this-change vs tip-of-tree

Results

this-change

render

VersionAvg timevs
101.11ms - 107.52ms-

update

VersionAvg timevs
1083.53ms - 1106.79ms-

update-reflect

VersionAvg timevs
1061.48ms - 1081.11ms-
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
40.46ms - 44.26ms-unsure 🔍
-10% - +2%
-4.50ms - +0.86ms
unsure 🔍
-10% - +2%
-4.53ms - +0.91ms
tip-of-tree
tip-of-tree
42.29ms - 46.07msunsure 🔍
-2% - +11%
-0.86ms - +4.50ms
-unsure 🔍
-6% - +6%
-2.71ms - +2.72ms
previous-release
previous-release
42.22ms - 46.12msunsure 🔍
-2% - +11%
-0.91ms - +4.53ms
unsure 🔍
-6% - +6%
-2.72ms - +2.71ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
106.12ms - 114.48ms-unsure 🔍
-8% - +3%
-8.78ms - +3.64ms
unsure 🔍
-6% - +6%
-6.07ms - +6.08ms
tip-of-tree
tip-of-tree
108.28ms - 117.46msunsure 🔍
-3% - +8%
-3.64ms - +8.78ms
-unsure 🔍
-4% - +8%
-3.79ms - +8.94ms
previous-release
previous-release
105.89ms - 114.70msunsure 🔍
-6% - +6%
-6.08ms - +6.07ms
unsure 🔍
-8% - +3%
-8.94ms - +3.79ms
-

nop-update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
22.47ms - 24.73ms-faster ✔
7% - 19%
1.82ms - 5.33ms
unsure 🔍
-12% - +1%
-3.18ms - +0.26ms
tip-of-tree
tip-of-tree
25.83ms - 28.52msslower ❌
7% - 23%
1.82ms - 5.33ms
-slower ❌
1% - 16%
0.25ms - 3.98ms
previous-release
previous-release
23.76ms - 26.35msunsure 🔍
-1% - +14%
-0.26ms - +3.18ms
faster ✔
1% - 14%
0.25ms - 3.98ms
-
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
67.29ms - 69.62ms-unsure 🔍
-3% - +2%
-2.24ms - +1.45ms
unsure 🔍
-2% - +3%
-1.59ms - +2.13ms
tip-of-tree
tip-of-tree
67.42ms - 70.27msunsure 🔍
-2% - +3%
-1.45ms - +2.24ms
-unsure 🔍
-2% - +4%
-1.37ms - +2.69ms
previous-release
previous-release
66.74ms - 69.63msunsure 🔍
-3% - +2%
-2.13ms - +1.59ms
unsure 🔍
-4% - +2%
-2.69ms - +1.37ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
149.54ms - 154.97ms-unsure 🔍
-3% - +2%
-4.67ms - +3.48ms
unsure 🔍
-2% - +3%
-3.36ms - +4.07ms
tip-of-tree
tip-of-tree
149.81ms - 155.88msunsure 🔍
-2% - +3%
-3.48ms - +4.67ms
-unsure 🔍
-2% - +3%
-3.01ms - +4.91ms
previous-release
previous-release
149.36ms - 154.43msunsure 🔍
-3% - +2%
-4.07ms - +3.36ms
unsure 🔍
-3% - +2%
-4.91ms - +3.01ms
-
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
69.14ms - 73.82ms-unsure 🔍
-1% - +8%
-0.33ms - +5.50ms
unsure 🔍
-5% - +4%
-3.34ms - +3.22ms
tip-of-tree
tip-of-tree
67.16ms - 70.64msunsure 🔍
-8% - +0%
-5.50ms - +0.33ms
-unsure 🔍
-8% - +0%
-5.53ms - +0.24ms
previous-release
previous-release
69.24ms - 73.84msunsure 🔍
-5% - +5%
-3.22ms - +3.34ms
unsure 🔍
-0% - +8%
-0.24ms - +5.53ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
1093.41ms - 1115.37ms-unsure 🔍
-1% - +1%
-13.21ms - +15.44ms
unsure 🔍
-2% - +1%
-19.05ms - +10.71ms
tip-of-tree
tip-of-tree
1094.08ms - 1112.47msunsure 🔍
-1% - +1%
-15.44ms - +13.21ms
-unsure 🔍
-2% - +1%
-18.90ms - +8.33ms
previous-release
previous-release
1098.52ms - 1118.60msunsure 🔍
-1% - +2%
-10.71ms - +19.05ms
unsure 🔍
-1% - +2%
-8.33ms - +18.90ms
-

update-reflect

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
1098.95ms - 1125.76ms-unsure 🔍
-1% - +2%
-15.51ms - +18.03ms
unsure 🔍
-1% - +2%
-12.47ms - +19.73ms
tip-of-tree
tip-of-tree
1101.02ms - 1121.17msunsure 🔍
-2% - +1%
-18.03ms - +15.51ms
-unsure 🔍
-1% - +1%
-11.08ms - +15.82ms
previous-release
previous-release
1099.81ms - 1117.63msunsure 🔍
-2% - +1%
-19.73ms - +12.47ms
unsure 🔍
-1% - +1%
-15.82ms - +11.08ms
-

tachometer-reporter-action v2 for Benchmarks

Copy link
Member

@augustjk augustjk left a comment

Choose a reason for hiding this comment

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

Good catch. Looking good!

templateImport.propertyName.text !== 'html'
(templateImport.propertyName &&
templateImport.propertyName.text !== 'html') ||
(!templateImport.propertyName && templateImport.name.text !== 'html')
Copy link
Member

Choose a reason for hiding this comment

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

does this mean that in the case of no alias, the import specifier is like this?

import {<name>} from <moduleSpecifier>;

so if there is no propertyName, we check that name is the right value?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is exactly right, I added your example without the alias to the source code.

@AndrewJakubowicz AndrewJakubowicz merged commit d586f8b into main Aug 11, 2023
@AndrewJakubowicz AndrewJakubowicz deleted the fix-svg-compilation branch August 11, 2023 16:59
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.

2 participants