-
Notifications
You must be signed in to change notification settings - Fork 1k
[lit-labs/compiler] only compile the valid html tag function imported from lit #4055
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: d0a371d 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.
LGTM. I imagine this also won't work for re-exports of html from packages not named lit or lit-html. Unsure if that's a use case we need to support at the moment.
This is accurate. It's something to consider as a feature in the future. |
| @@ -0,0 +1,4 @@ | |||
| import {svg as html, html as svg} from 'lit'; | |||
|
|
|||
| html`<text>Do not compile me, I am an svg</text>`; | |||
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.
ha ha, great test!
packages/labs/compiler/test_files/handle_html_identifier_reassignment.js
Outdated
Show resolved
Hide resolved
459d3ae to
d0a371d
Compare
Issue: #189
RFC: lit/rfcs#21
Full prototype PR: #3984
PR made to replace #4050 (which was not granular or specific enough).
Why
This change exists to restrict compilation down to our (
litorlit-html)htmltag function. This prevents miscompilation by ignoring thestatic.jshtml tag function (and others).Note this change doesn't cover all cases, e.g. reassignment is not covered because it became far too complex to include. A test was checked in with TODO.
How
Add a single file simple TypeScript TypeChecker that provides a much more robust
isLitTemplatemethod.Cases handled in this change:
Anything else does not get compiled. E.g.:
Test plan
Added goldens.