@lwc/template-compiler 7.0.0 → 7.0.1-alpha.0
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/codegen/codegen.d.ts +1 -1
- package/dist/index.cjs.js +17 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +17 -4
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -11048,6 +11048,9 @@ class TemplateHtmlTokenizer extends Tokenizer {
|
|
|
11048
11048
|
function isTemplateExpressionTextNodeValue(value) {
|
|
11049
11049
|
return value?.[0] === '{';
|
|
11050
11050
|
}
|
|
11051
|
+
function isTemplateElement(node) {
|
|
11052
|
+
return node.nodeName === 'template';
|
|
11053
|
+
}
|
|
11051
11054
|
function isTextNode(node) {
|
|
11052
11055
|
return node?.nodeName === '#text';
|
|
11053
11056
|
}
|
|
@@ -11088,7 +11091,12 @@ class TemplateHtmlParser extends Parser {
|
|
|
11088
11091
|
sourceCodeLocation: token.location ? { ...token.location } : null,
|
|
11089
11092
|
parentNode,
|
|
11090
11093
|
};
|
|
11091
|
-
parentNode
|
|
11094
|
+
if (isTemplateElement(parentNode)) {
|
|
11095
|
+
parentNode.content.childNodes.push(textNode);
|
|
11096
|
+
}
|
|
11097
|
+
else {
|
|
11098
|
+
parentNode.childNodes.push(textNode);
|
|
11099
|
+
}
|
|
11092
11100
|
}
|
|
11093
11101
|
}
|
|
11094
11102
|
/**
|
|
@@ -13576,7 +13584,7 @@ class CodeGen {
|
|
|
13576
13584
|
return classExpression;
|
|
13577
13585
|
}
|
|
13578
13586
|
genNormalizeClassName(className) {
|
|
13579
|
-
return this._renderApiCall(RENDER_APIS.normalizeClassName, [className]);
|
|
13587
|
+
return this._renderApiCall(RENDER_APIS.normalizeClassName, [className], className);
|
|
13580
13588
|
}
|
|
13581
13589
|
/**
|
|
13582
13590
|
* Generates childs vnodes when slot content is static.
|
|
@@ -13674,13 +13682,18 @@ class CodeGen {
|
|
|
13674
13682
|
// usage of the lwc:inner-html, and in an iteration, usages are dynamically generated.
|
|
13675
13683
|
return conditionalExpression(binaryExpression('!==', memberExpression(identifier(TEMPLATE_PARAMS.CONTEXT), identifier(`_rawHtml$${instance}`)), assignmentExpression('=', memberExpression(identifier(TEMPLATE_PARAMS.CONTEXT), identifier(`_rawHtml$${instance}`)), expr)), assignmentExpression('=', memberExpression(identifier(TEMPLATE_PARAMS.CONTEXT), identifier(`_sanitizedHtml$${instance}`)), this.genSanitizeHtmlContent(expr)), memberExpression(identifier(TEMPLATE_PARAMS.CONTEXT), identifier(`_sanitizedHtml$${instance}`)));
|
|
13676
13684
|
}
|
|
13677
|
-
_renderApiCall(primitive, params) {
|
|
13685
|
+
_renderApiCall(primitive, params, fallbackForCompilerEngineVersionMismatch) {
|
|
13678
13686
|
const { name, alias } = primitive;
|
|
13679
13687
|
let identifier$1 = this.usedApis[name];
|
|
13680
13688
|
if (!identifier$1) {
|
|
13681
13689
|
identifier$1 = this.usedApis[name] = identifier(alias);
|
|
13682
13690
|
}
|
|
13683
|
-
|
|
13691
|
+
const callExpression$1 = callExpression(identifier$1, params);
|
|
13692
|
+
// Check if the property actually exists before calling, to allow
|
|
13693
|
+
// for older engines to work with newer compilers
|
|
13694
|
+
return fallbackForCompilerEngineVersionMismatch
|
|
13695
|
+
? conditionalExpression(identifier$1, callExpression$1, fallbackForCompilerEngineVersionMismatch)
|
|
13696
|
+
: callExpression$1;
|
|
13684
13697
|
}
|
|
13685
13698
|
beginScope() {
|
|
13686
13699
|
this.scope = this.createScope(this.scope);
|