fix: noSyncScripts type="module"#8149
Conversation
🦋 Changeset detectedLatest commit: c4c53c0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
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 |
c6741e6 to
ff17ff3
Compare
| "@biomejs/biome": patch | ||
| --- | ||
|
|
||
| Improve noSyncScripts, ignore script tags with `type="module"` |
There was a problem hiding this comment.
Link the issue that this is fixing
ff17ff3 to
341bd21
Compare
CodSpeed Performance ReportMerging #8149 will not alter performanceComparing Summary
Footnotes
|
| attribute.initializer().is_some_and(|initializer| { | ||
| initializer.value().ok().is_some_and(|value| { | ||
| value.as_html_string().is_some_and(|html_string| { | ||
| html_string.inner_string_text().unwrap().text() == "module" |
| } | ||
|
|
||
| /// Create a new string literal token with no attached trivia | ||
| pub fn html_string_literal(text: &str) -> HtmlSyntaxToken { |
There was a problem hiding this comment.
Does this get used anywhere in the PR?
There was a problem hiding this comment.
It's used in the example of inner_string_text. The CI seemed to fail on that implementation missing even tho it's it's only in the docs
| /// .with_leading_trivia(vec![(TriviaPieceKind::Whitespace, " ")])); | ||
| /// assert_eq!(string.inner_string_text().unwrap().text(), "button"); | ||
| /// ``` | ||
| pub fn inner_string_text(&self) -> SyntaxResult<TokenText> { |
There was a problem hiding this comment.
What is the purpose of this wrapper function?
There was a problem hiding this comment.
To make it easier to access the inner string text; js, json, css also have such wrapper function
There was a problem hiding this comment.
How much easier is it if we already have one?
There was a problem hiding this comment.
The css, json, css wrapper functions are not available on the HtmlString
inner_string_text(html_string.value_token()?).ok()?.text() vs
html_string.inner_string_text?.text()
basically continued the pattern that was already in place, to make inner_string_text a function of a syntax String, but missing for HtmlString
| attribute.initializer().is_some_and(|initializer| { | ||
| initializer.value().ok().is_some_and(|value| { | ||
| value.as_jsx_string().is_some_and(|jsx_string| { | ||
| jsx_string.inner_string_text().unwrap().text() == "module" |
There was a problem hiding this comment.
Also mind this unwrap() please.
Summary
script tags with
type="module"are non-blocking; https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/script#blockingCloses #8144
Test Plan
Docs