Skip to content

Commit

Permalink
fix: fix static content optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
nolanlawson committed Apr 16, 2024
1 parent 42ab135 commit 8c32821
Show file tree
Hide file tree
Showing 24 changed files with 298 additions and 43 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template>
<div class={computed}></div>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{
"root": {
"type": "Root",
"location": {
"startLine": 1,
"startColumn": 1,
"endLine": 3,
"endColumn": 12,
"start": 0,
"end": 55,
"startTag": {
"startLine": 1,
"startColumn": 1,
"endLine": 1,
"endColumn": 11,
"start": 0,
"end": 10
},
"endTag": {
"startLine": 3,
"startColumn": 1,
"endLine": 3,
"endColumn": 12,
"start": 44,
"end": 55
}
},
"directives": [],
"children": [
{
"type": "Element",
"name": "div",
"namespace": "http://www.w3.org/1999/xhtml",
"location": {
"startLine": 2,
"startColumn": 5,
"endLine": 2,
"endColumn": 33,
"start": 15,
"end": 43,
"startTag": {
"startLine": 2,
"startColumn": 5,
"endLine": 2,
"endColumn": 27,
"start": 15,
"end": 37
},
"endTag": {
"startLine": 2,
"startColumn": 27,
"endLine": 2,
"endColumn": 33,
"start": 37,
"end": 43
}
},
"attributes": [
{
"type": "Attribute",
"name": "class",
"value": {
"type": "Identifier",
"start": 1,
"end": 9,
"name": "computed",
"location": {
"startLine": 2,
"startColumn": 10,
"endLine": 2,
"endColumn": 26,
"start": 20,
"end": 36
}
},
"location": {
"startLine": 2,
"startColumn": 10,
"endLine": 2,
"endColumn": 26,
"start": 20,
"end": 36
}
}
],
"properties": [],
"directives": [],
"listeners": [],
"children": []
}
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"apiVersion": 62,
"enableStaticContentOptimization": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { registerTemplate } from "lwc";
function tmpl($api, $cmp, $slotset, $ctx) {
const { ncls: api_normalize_class_name, h: api_element } = $api;
return [
api_element("div", {
className: api_normalize_class_name($cmp.computed),
key: 0,
}),
];
/*LWC compiler vX.X.X*/
}
export default registerTemplate(tmpl);
tmpl.stylesheets = [];
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"warnings": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template>
<div class={computed}></div>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{
"root": {
"type": "Root",
"location": {
"startLine": 1,
"startColumn": 1,
"endLine": 3,
"endColumn": 12,
"start": 0,
"end": 55,
"startTag": {
"startLine": 1,
"startColumn": 1,
"endLine": 1,
"endColumn": 11,
"start": 0,
"end": 10
},
"endTag": {
"startLine": 3,
"startColumn": 1,
"endLine": 3,
"endColumn": 12,
"start": 44,
"end": 55
}
},
"directives": [],
"children": [
{
"type": "Element",
"name": "div",
"namespace": "http://www.w3.org/1999/xhtml",
"location": {
"startLine": 2,
"startColumn": 5,
"endLine": 2,
"endColumn": 33,
"start": 15,
"end": 43,
"startTag": {
"startLine": 2,
"startColumn": 5,
"endLine": 2,
"endColumn": 27,
"start": 15,
"end": 37
},
"endTag": {
"startLine": 2,
"startColumn": 27,
"endLine": 2,
"endColumn": 33,
"start": 37,
"end": 43
}
},
"attributes": [
{
"type": "Attribute",
"name": "class",
"value": {
"type": "Identifier",
"start": 1,
"end": 9,
"name": "computed",
"location": {
"startLine": 2,
"startColumn": 10,
"endLine": 2,
"endColumn": 26,
"start": 20,
"end": 36
}
},
"location": {
"startLine": 2,
"startColumn": 10,
"endLine": 2,
"endColumn": 26,
"start": 20,
"end": 36
}
}
],
"properties": [],
"directives": [],
"listeners": [],
"children": []
}
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"apiVersion": 61,
"enableStaticContentOptimization": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { registerTemplate } from "lwc";
function tmpl($api, $cmp, $slotset, $ctx) {
const { h: api_element } = $api;
return [
api_element("div", {
className: $cmp.computed,
key: 0,
}),
];
/*LWC compiler vX.X.X*/
}
export default registerTemplate(tmpl);
tmpl.stylesheets = [];
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"warnings": []
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function tmpl($api, $cmp, $slotset, $ctx) {
api_static_part(
0,
{
className: $cmp.computed,
className: api_normalize_class_name($cmp.computed),
},
null
),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"apiVersion": 60
}
"apiVersion": 61
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function tmpl($api, $cmp, $slotset, $ctx) {
api_static_part(
0,
{
className: $cmp.foo,
className: api_normalize_class_name($cmp.foo),
},
null
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function tmpl($api, $cmp, $slotset, $ctx) {
api_static_part(
0,
{
className: item.x,
className: api_normalize_class_name(item.x),
},
null
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function tmpl($api, $cmp, $slotset, $ctx) {
api_static_part(
0,
{
className: item.x,
className: api_normalize_class_name(item.x),
},
null
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ function tmpl($api, $cmp, $slotset, $ctx) {
const {
k: api_key,
d: api_dynamic_text,
ncls: api_normalize_class_name,
sp: api_static_part,
st: api_static_fragment,
i: api_iterator,
Expand Down Expand Up @@ -43,7 +44,7 @@ function tmpl($api, $cmp, $slotset, $ctx) {
7,
{
style: $cmp.baaz,
className: $cmp.bar,
className: api_normalize_class_name($cmp.bar),
attrs: {
"data-dynamic": $cmp.foo,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function tmpl($api, $cmp, $slotset, $ctx) {
api_static_part(
0,
{
className: $cmp.dynamicClass,
className: api_normalize_class_name($cmp.dynamicClass),
},
null
),
Expand All @@ -64,7 +64,7 @@ function tmpl($api, $cmp, $slotset, $ctx) {
api_static_part(
0,
{
className: $cmp.dynamicClass,
className: api_normalize_class_name($cmp.dynamicClass),
style: $cmp.dynamicStyle,
attrs: {
"data-dynamic": $cmp.dynamic,
Expand Down Expand Up @@ -96,7 +96,7 @@ function tmpl($api, $cmp, $slotset, $ctx) {
api_static_part(
0,
{
className: $cmp.dynamicClass,
className: api_normalize_class_name($cmp.dynamicClass),
},
null
),
Expand All @@ -114,7 +114,7 @@ function tmpl($api, $cmp, $slotset, $ctx) {
api_static_part(
0,
{
className: $cmp.dynamicClass,
className: api_normalize_class_name($cmp.dynamicClass),
style: $cmp.dynamicStyle,
attrs: {
"data-dynamic": $cmp.dynamic,
Expand Down Expand Up @@ -143,7 +143,7 @@ function tmpl($api, $cmp, $slotset, $ctx) {
api_static_part(
0,
{
className: $cmp.dynamicClass,
className: api_normalize_class_name($cmp.dynamicClass),
},
null
),
Expand All @@ -161,7 +161,7 @@ function tmpl($api, $cmp, $slotset, $ctx) {
api_static_part(
0,
{
className: $cmp.dynamicClass,
className: api_normalize_class_name($cmp.dynamicClass),
style: $cmp.dynamicStyle,
attrs: {
"data-dynamic": $cmp.dynamic,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import { parseFragment, registerTemplate } from "lwc";
const $fragment1 = parseFragment`<section${3}><p${"c1"}${2}></p></section>`;
function tmpl($api, $cmp, $slotset, $ctx) {
const { sp: api_static_part, st: api_static_fragment } = $api;
const {
ncls: api_normalize_class_name,
sp: api_static_part,
st: api_static_fragment,
} = $api;
return [
api_static_fragment($fragment1, 1, [
api_static_part(
1,
{
className: $cmp.bar.foo.baz,
className: api_normalize_class_name($cmp.bar.foo.baz),
},
null
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ function tmpl($api, $cmp, $slotset, $ctx) {
api_static_part(
0,
{
className: $cmp.foo.c,
className: api_normalize_class_name($cmp.foo.c),
},
null
),
api_static_part(
1,
{
className: $cmp.bar.c,
className: api_normalize_class_name($cmp.bar.c),
},
null
),
Expand Down

0 comments on commit 8c32821

Please sign in to comment.