-
Notifications
You must be signed in to change notification settings - Fork 1k
[lit-labs/compiler] Fix svg tag being accidentally compiled #4086
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
Conversation
🦋 Changeset detectedLatest commit: 0b75628 The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen 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 |
📊 Tachometer Benchmark ResultsSummarynop-update
render
update
update-reflect
Resultsthis-change
render
update
update-reflect
this-change, tip-of-tree, previous-release
render
update
nop-update
this-change, tip-of-tree, previous-release
render
update
this-change, tip-of-tree, previous-release
render
update
update-reflect
|
augustjk
left a comment
There was a problem hiding this 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') |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
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
svgtemplates were not correctly handled.import {svg} from 'lit'was marking thesvgtag 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.