Skip to content

Commit 58b466d

Browse files
DylanPierceyclaude
andcommitted
perf: inline references to constant primitive <const> tags
In the transform phase, replace every reference to a `<const>` whose value is a compile-time primitive (string, number, bigint, boolean, null, or undefined) with the literal value. Downstream evaluation can then fold larger expressions and bake the result into the static template output, and the now-unreferenced binding is pruned entirely. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G1bgkqJCLUsEz3xsossMCN
1 parent bc20394 commit 58b466d

127 files changed

Lines changed: 561 additions & 500 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@marko/runtime-tags": patch
3+
---
4+
5+
Inline references to `<const>` tags with statically known primitive values, removing the binding and its reactive signal.

packages/runtime-tags/src/__tests__/fixtures-interop/ambiguous-tags-and-components-dir/sizes.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"template.marko.page.mjs": {
44
"total": {
55
"min": 921,
6-
"brotli": 452
6+
"brotli": 453
77
},
88
"files": {
99
"v:template.marko.hydrate-6.js": 104,

packages/runtime-tags/src/__tests__/fixtures-interop/class/sizes.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"dom": {
33
"template.marko.page.mjs": {
44
"min": 49563,
5-
"brotli": 14671
5+
"brotli": 14672
66
}
77
},
88
"html": {

packages/runtime-tags/src/__tests__/fixtures-interop/custom-tag-parameters-from-args/sizes.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"dom": {
33
"template.marko.page.mjs": {
44
"total": {
5-
"min": 68022,
6-
"brotli": 21118
5+
"min": 68015,
6+
"brotli": 21132
77
},
88
"files": {
99
"components/custom-tag.marko": 1121,

packages/runtime-tags/src/__tests__/fixtures-interop/interop-basic-class-to-tags/sizes.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"dom": {
33
"template.marko.page.mjs": {
44
"total": {
5-
"min": 65782,
6-
"brotli": 20201
5+
"min": 65755,
6+
"brotli": 20208
77
},
88
"files": {
99
"components/tags-counter.marko": 691,

packages/runtime-tags/src/__tests__/fixtures-interop/interop-basic-tags-to-class/sizes.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"dom": {
33
"template.marko.page.mjs": {
44
"total": {
5-
"min": 67231,
6-
"brotli": 20838
5+
"min": 67215,
6+
"brotli": 20859
77
},
88
"files": {
99
"components/class-counter.marko": 1028,

packages/runtime-tags/src/__tests__/fixtures-interop/interop-class-in-components-in-tags-dir/sizes.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"dom": {
33
"template.marko.page.mjs": {
44
"total": {
5-
"min": 66817,
6-
"brotli": 20584
5+
"min": 66798,
6+
"brotli": 20608
77
},
88
"files": {
99
"tags/components/hello-internal.marko": 941,

packages/runtime-tags/src/__tests__/fixtures-interop/interop-class-to-tags-import/sizes.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"dom": {
33
"template.marko.page.mjs": {
44
"total": {
5-
"min": 65782,
6-
"brotli": 20201
5+
"min": 65755,
6+
"brotli": 20208
77
},
88
"files": {
99
"components/tags-counter.marko": 691,

packages/runtime-tags/src/__tests__/fixtures-interop/interop-event-handler-render-body-tags-to-class/sizes.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"dom": {
33
"template.marko.page.mjs": {
44
"total": {
5-
"min": 67549,
6-
"brotli": 20983
5+
"min": 67536,
6+
"brotli": 20950
77
},
88
"files": {
99
"components/my-button.marko": 1048,

packages/runtime-tags/src/__tests__/fixtures-interop/interop-events-tags-to-class/sizes.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"dom": {
33
"template.marko.page.mjs": {
44
"total": {
5-
"min": 67184,
6-
"brotli": 20787
5+
"min": 67166,
6+
"brotli": 20812
77
},
88
"files": {
99
"components/class-counter.marko": 1043,

0 commit comments

Comments
 (0)