@lwc/template-compiler 6.2.1 → 6.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +23 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +23 -4
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -10682,7 +10682,7 @@ class TemplateHtmlTokenizer extends Tokenizer {
|
|
|
10682
10682
|
// coming later in an unquoted attr value should not be considered
|
|
10683
10683
|
// the beginning of a template expression.
|
|
10684
10684
|
this.checkedAttrs.add(this.currentAttr);
|
|
10685
|
-
// @ts-
|
|
10685
|
+
// @ts-expect-error private method
|
|
10686
10686
|
super._stateAttributeValueUnquoted(codePoint);
|
|
10687
10687
|
}
|
|
10688
10688
|
}
|
|
@@ -10715,7 +10715,7 @@ class TemplateHtmlTokenizer extends Tokenizer {
|
|
|
10715
10715
|
this.currentCharacterToken = null;
|
|
10716
10716
|
}
|
|
10717
10717
|
else {
|
|
10718
|
-
// @ts-
|
|
10718
|
+
// @ts-expect-error private method
|
|
10719
10719
|
super._stateData(codePoint);
|
|
10720
10720
|
}
|
|
10721
10721
|
}
|
|
@@ -11479,7 +11479,23 @@ function parseText(ctx, parse5Text) {
|
|
|
11479
11479
|
}
|
|
11480
11480
|
// Extract the raw source to avoid HTML entity decoding done by parse5
|
|
11481
11481
|
const rawText = cleanTextNode(ctx.getSource(location.startOffset, location.endOffset));
|
|
11482
|
-
|
|
11482
|
+
/*
|
|
11483
|
+
The original job of this if-block was to discard the whitespace between HTML tags, HTML
|
|
11484
|
+
comments, and HTML tags and HTML comments. The whitespace inside the text content of HTML tags
|
|
11485
|
+
would never be considered here because they would not be parsed into individual text nodes until
|
|
11486
|
+
later (several lines below).
|
|
11487
|
+
|
|
11488
|
+
["Hello {first} {last}!"] => ["Hello ", "{first}", " ", "{last}", "!"]
|
|
11489
|
+
|
|
11490
|
+
With the implementation of complex template expressions, whitespace that shouldn't be discarded
|
|
11491
|
+
has already been parsed into individual text nodes at this point so we only discard when
|
|
11492
|
+
experimentalComplexExpressions is disabled.
|
|
11493
|
+
|
|
11494
|
+
When removing the experimentalComplexExpressions flag, we need to figure out how to best discard
|
|
11495
|
+
the HTML whitespace while preserving text content whitespace, while also taking into account how
|
|
11496
|
+
comments are sometimes preserved (in which case we need to keep the HTML whitespace).
|
|
11497
|
+
*/
|
|
11498
|
+
if (!rawText.trim().length && !ctx.config.experimentalComplexExpressions) {
|
|
11483
11499
|
return parsedTextNodes;
|
|
11484
11500
|
}
|
|
11485
11501
|
// TODO [#3370]: remove experimental template expression flag
|
|
@@ -13145,6 +13161,9 @@ class CodeGen {
|
|
|
13145
13161
|
}
|
|
13146
13162
|
// TODO [#3370]: remove experimental template expression flag
|
|
13147
13163
|
if (this.state.config.experimentalComplexExpressions) {
|
|
13164
|
+
// Cloning here is necessary because `this.replace()` is destructive, and we might use the
|
|
13165
|
+
// node later during static content optimization
|
|
13166
|
+
expression = doStructuredClone(expression);
|
|
13148
13167
|
return bindComplexExpression(expression, this);
|
|
13149
13168
|
}
|
|
13150
13169
|
// We need access to both this `this` and the walker's `this` in the walker
|
|
@@ -13994,5 +14013,5 @@ function compile(source, config) {
|
|
|
13994
14013
|
}
|
|
13995
14014
|
|
|
13996
14015
|
export { ElementDirectiveName, LWCDirectiveDomMode, LWCDirectiveRenderMode, LwcTagName, RootDirectiveName, TemplateDirectiveName, compile, compile as default, parse };
|
|
13997
|
-
/** version: 6.
|
|
14016
|
+
/** version: 6.3.1 */
|
|
13998
14017
|
//# sourceMappingURL=index.js.map
|