Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/const-fold-primitives.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@marko/runtime-tags": patch
---

Fold `<const>` tags with statically known primitive values: bare references are baked into the static template output and reactive positions inline the literal, so the binding carries no reactive signal and is never serialized.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"template.marko.page.mjs": {
"total": {
"min": 921,
"brotli": 452
"brotli": 453
},
"files": {
"v:template.marko.hydrate-6.js": 104,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"dom": {
"template.marko.page.mjs": {
"min": 49563,
"brotli": 14671
"brotli": 14672
}
},
"html": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"dom": {
"template.marko.page.mjs": {
"total": {
"min": 68022,
"brotli": 21118
"min": 68015,
"brotli": 21132
},
"files": {
"components/custom-tag.marko": 1121,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"dom": {
"template.marko.page.mjs": {
"total": {
"min": 65782,
"brotli": 20201
"min": 65755,
"brotli": 20208
},
"files": {
"components/tags-counter.marko": 691,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"dom": {
"template.marko.page.mjs": {
"total": {
"min": 67231,
"brotli": 20838
"min": 67215,
"brotli": 20859
},
"files": {
"components/class-counter.marko": 1028,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"dom": {
"template.marko.page.mjs": {
"total": {
"min": 66817,
"brotli": 20584
"min": 66798,
"brotli": 20608
},
"files": {
"tags/components/hello-internal.marko": 941,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"dom": {
"template.marko.page.mjs": {
"total": {
"min": 65782,
"brotli": 20201
"min": 65755,
"brotli": 20208
},
"files": {
"components/tags-counter.marko": 691,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"dom": {
"template.marko.page.mjs": {
"total": {
"min": 67549,
"brotli": 20983
"min": 67536,
"brotli": 20950
},
"files": {
"components/my-button.marko": 1048,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"dom": {
"template.marko.page.mjs": {
"total": {
"min": 67184,
"brotli": 20787
"min": 67166,
"brotli": 20812
},
"files": {
"components/class-counter.marko": 1043,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"dom": {
"template.marko.page.mjs": {
"total": {
"min": 66107,
"brotli": 20382
"min": 66078,
"brotli": 20371
},
"files": {
"components/tags-layout.marko": 912,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"dom": {
"template.marko.page.mjs": {
"total": {
"min": 65777,
"brotli": 20245
"min": 65750,
"brotli": 20186
},
"files": {
"components/tags-layout.marko": 758,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"dom": {
"template.marko.page.mjs": {
"total": {
"min": 67655,
"brotli": 21011
"min": 67644,
"brotli": 20983
},
"files": {
"components/class-layout.marko": 1227,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"dom": {
"template.marko.page.mjs": {
"total": {
"min": 66972,
"brotli": 20691
"min": 66950,
"brotli": 20708
},
"files": {
"components/my-button/component-browser.js": 457,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"dom": {
"template.marko.page.mjs": {
"total": {
"min": 66135,
"brotli": 20397
"min": 66109,
"brotli": 20394
},
"files": {
"components/tags-layout.marko": 922,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"dom": {
"template.marko.page.mjs": {
"total": {
"min": 68010,
"brotli": 21162
"min": 67999,
"brotli": 21146
},
"files": {
"components/class-layout.marko": 1245,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"dom": {
"template.marko.page.mjs": {
"min": 1983,
"brotli": 942
"brotli": 945
},
"child.mjs": {
"min": 366,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"dom": {
"template.marko.page.mjs": {
"min": 1937,
"brotli": 928
"brotli": 929
},
"child.mjs": {
"min": 366,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"dom": {
"template.marko.page.mjs": {
"min": 50468,
"brotli": 14924
"brotli": 14941
},
"child.mjs": {
"min": 321,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"dom": {
"template.marko.page.mjs": {
"min": 50451,
"brotli": 14925
"brotli": 14964
},
"child.mjs": {
"min": 321,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"dom": {
"template.marko.page.mjs": {
"min": 50468,
"brotli": 14924
"brotli": 14930
},
"child.mjs": {
"min": 321,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"dom": {
"template.marko.page.mjs": {
"min": 50797,
"brotli": 15038
"brotli": 15055
},
"child.mjs": {
"min": 321,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"dom": {
"template.marko.page.mjs": {
"min": 3259,
"brotli": 1579
"min": 3239,
"brotli": 1571
}
},
"html": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"dom": {
"template.marko.page.mjs": {
"min": 5888,
"brotli": 2681
"min": 5860,
"brotli": 2673
}
},
"html": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
// template.marko
const $template = "<button>inc</button><div></div><div></div>";
const $walks = " b b b";
const $d__OR__more__OR__obj__OR__k = /* @__PURE__ */ _or(9, ($scope) => _attr_class($scope["#div/1"], [
const $d__OR__more__OR__obj = /* @__PURE__ */ _or(8, ($scope) => _attr_class($scope["#div/1"], [
"a",
["b", $scope.d],
...$scope.more,
...["n1", $scope.d],
{
[$scope.k]: $scope.d,
["computed"]: $scope.d,
...$scope.obj,
"q": $scope.d
}
]), 3);
]), 2);
const $d__OR__moreStyles = /* @__PURE__ */ _or(6, ($scope) => _attr_style($scope["#div/2"], [
"color:red",
["margin:0", $scope.d && "padding:0"],
Expand All @@ -21,19 +21,17 @@ const $d__script = _script("__tests__/template.marko_0_d", ($scope) => _on($scop
$d($scope, $scope.d + "2");
}));
const $d = /* @__PURE__ */ _let("d/3", ($scope) => {
$d__OR__more__OR__obj__OR__k($scope);
$d__OR__more__OR__obj($scope);
$d__OR__moreStyles($scope);
$d__script($scope);
});
const $more = /* @__PURE__ */ _const("more", $d__OR__more__OR__obj__OR__k);
const $more = /* @__PURE__ */ _const("more", $d__OR__more__OR__obj);
const $moreStyles = /* @__PURE__ */ _const("moreStyles", $d__OR__moreStyles);
const $obj = /* @__PURE__ */ _const("obj", $d__OR__more__OR__obj__OR__k);
const $k = /* @__PURE__ */ _const("k", $d__OR__more__OR__obj__OR__k);
const $obj = /* @__PURE__ */ _const("obj", $d__OR__more__OR__obj);
function $setup($scope) {
$d($scope, "dyn");
$more($scope, ["m1"]);
$moreStyles($scope, ["display:block"]);
$obj($scope, { o: true });
$k($scope, "computed");
}
var template_default = /* @__PURE__ */ _template("__tests__/template.marko", $template, $walks, $setup);
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// template.marko
const $d__OR__more__OR__obj__OR__k = /* @__PURE__ */ _or(9, ($scope) => _attr_class($scope.b, [
const $d__OR__more__OR__obj = /* @__PURE__ */ _or(8, ($scope) => _attr_class($scope.b, [
"a",
["b", $scope.d],
...$scope.e,
...["n1", $scope.d],
{
[$scope.i]: $scope.d,
["computed"]: $scope.d,
...$scope.h,
"q": $scope.d
}
]), 3);
]), 2);
const $d__OR__moreStyles = /* @__PURE__ */ _or(6, ($scope) => _attr_style($scope.c, [
"color:red",
["margin:0", $scope.d && "padding:0"],
Expand All @@ -19,7 +19,7 @@ const $d__script = _script("a0", ($scope) => _on($scope.a, "click", function() {
$d($scope, $scope.d + "2");
}));
const $d = /* @__PURE__ */ _let(3, ($scope) => {
$d__OR__more__OR__obj__OR__k($scope);
$d__OR__more__OR__obj($scope);
$d__OR__moreStyles($scope);
$d__script($scope);
});
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ var template_default = _template("__tests__/template.marko", (input) => {
const more = ["m1"];
const moreStyles = ["display:block"];
const obj = { o: true };
const k = "computed";
_html(`<button>inc</button>${_el_resume($scope0_id, "#button/0")}<div${_attr_class([
"a",
["b", d],
...more,
...["n1", d],
{
[k]: d,
["computed"]: d,
...obj,
"q": d
}
Expand All @@ -27,14 +26,12 @@ var template_default = _template("__tests__/template.marko", (input) => {
d,
more,
moreStyles,
obj,
k
obj
}, "__tests__/template.marko", 0, {
d: "1:6",
more: "2:8",
moreStyles: "3:8",
obj: "4:8",
k: "5:8"
obj: "4:8"
});
_resume_branch($scope0_id);
}, 1);
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ var template_default = _template("a", (input) => {
const more = ["m1"];
const moreStyles = ["display:block"];
const obj = { o: true };
const k = "computed";
_html(`<button>inc</button>${_el_resume($scope0_id, "a")}<div${_attr_class([
"a",
["b", d],
...more,
...["n1", d],
{
[k]: d,
["computed"]: d,
...obj,
"q": d
}
Expand All @@ -27,8 +26,7 @@ var template_default = _template("a", (input) => {
d,
e: more,
f: moreStyles,
h: obj,
i: k
h: obj
});
_resume_branch($scope0_id);
}, 1);
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
moreStyles: ["display:block"],
obj: {
o: !0
},
k: "computed"
}
}],
"packages/runtime-tags/src/__tests__/fixtures/attr-class-delimited-shapes/template.marko_0_d 1"
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
f: ["display:block"],
h: {
o: !0
},
i: "computed"
}
}], "a0 1"];
M._.w()
</script>
Loading
Loading