Skip to content

RFC#997 - {{on}} as keyword#21068

Open
NullVoxPopuli wants to merge 5 commits intomainfrom
nvp/on-as-keyword-tremplate-the-transform-way
Open

RFC#997 - {{on}} as keyword#21068
NullVoxPopuli wants to merge 5 commits intomainfrom
nvp/on-as-keyword-tremplate-the-transform-way

Conversation

@NullVoxPopuli
Copy link
Contributor

@NullVoxPopuli NullVoxPopuli commented Jan 26, 2026

Alternate implementation to #21055


https://rfcs.emberjs.com/id/0997-make-on-built-in

We already have tests for importing on.

This PR lays the foundation for all future modifiers/helpers being used as "keywords"

(which are all going to be more tests than implementation (we're set up for each new utility to basically be one line each))

Also in this PR is an internal upgrade for our smoke-test app(s), because I was hitting the error where emberAppSatisfies was missing due to out of date deps.

@NullVoxPopuli NullVoxPopuli changed the title RFC#997 - {{on}} as keyword RFC#997 - {{on}} as keyword - option 2 Jan 26, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 26, 2026

Estimated Asset Sizes

Diff

--- main/out.txt	2026-01-30 19:10:24.000000000 +0000
+++ pr/./pr-21651845123/out.txt	2026-02-03 23:27:48.000000000 +0000
@@ -1,13 +1,13 @@
-╔═══════╤═══════════╤═══════════╗
-║       │ Min       │ Gzip      ║
-╟───────┼───────────┼───────────╢
-║ Total │ 352.26 KB │ 203.67 KB ║
-╚═══════╧═══════════╧═══════════╝
+╔═══════╤═══════════╤══════════╗
+║       │ Min       │ Gzip     ║
+╟───────┼───────────┼──────────╢
+║ Total │ 353.92 KB │ 204.6 KB ║
+╚═══════╧═══════════╧══════════╝
 
 ╔══════════════════════╤═══════════╤═══════════╗
 ║ @ember/*             │ Min       │ Gzip      ║
 ╟──────────────────────┼───────────┼───────────╢
-║ Total                │ 313.87 KB │ 181.82 KB ║
+║ Total                │ 315.53 KB │ 182.75 KB ║
 ╟──────────────────────┼───────────┼───────────╢
 ║ -internals           │ 36.68 KB  │ 26.02 KB  ║
 ║ application          │ 13.24 KB  │ 8.03 KB   ║
@@ -30,7 +30,7 @@
 ║ service              │ 1 KB      │ 858 B     ║
 ║ template             │ 654 B     │ 523 B     ║
 ║ template-compilation │ 429 B     │ 366 B     ║
-║ template-compiler    │ 123.33 KB │ 59.68 KB  ║
+║ template-compiler    │ 124.99 KB │ 60.62 KB  ║
 ║ template-factory     │ 370 B     │ 351 B     ║
 ║ test                 │ 923 B     │ 627 B     ║
 ║ utils                │ 4.11 KB   │ 3.63 KB   ║

Details

This PRmain
╔═══════╤═══════════╤══════════╗
║       │ Min       │ Gzip     ║
╟───────┼───────────┼──────────╢
║ Total │ 353.92 KB │ 204.6 KB ║
╚═══════╧═══════════╧══════════╝

╔══════════════════════╤═══════════╤═══════════╗
║ @ember/*             │ Min       │ Gzip      ║
╟──────────────────────┼───────────┼───────────╢
║ Total                │ 315.53 KB │ 182.75 KB ║
╟──────────────────────┼───────────┼───────────╢
║ -internals           │ 36.68 KB  │ 26.02 KB  ║
║ application          │ 13.24 KB  │ 8.03 KB   ║
║ array                │ 13.05 KB  │ 7.54 KB   ║
║ canary-features      │ 304 B     │ 419 B     ║
║ component            │ 2.05 KB   │ 1.56 KB   ║
║ controller           │ 1.96 KB   │ 1.45 KB   ║
║ debug                │ 11.73 KB  │ 8.14 KB   ║
║ deprecated-features  │ 31 B      │ 77 B      ║
║ destroyable          │ 561 B     │ 383 B     ║
║ enumerable           │ 259 B     │ 387 B     ║
║ helper               │ 1.08 KB   │ 805 B     ║
║ instrumentation      │ 2.43 KB   │ 1.78 KB   ║
║ modifier             │ 1.22 KB   │ 1011 B    ║
║ object               │ 35.98 KB  │ 22.1 KB   ║
║ owner                │ 159 B     │ 178 B     ║
║ renderer             │ 630 B     │ 508 B     ║
║ routing              │ 59.37 KB  │ 33.92 KB  ║
║ runloop              │ 2.36 KB   │ 1.5 KB    ║
║ service              │ 1 KB      │ 858 B     ║
║ template             │ 654 B     │ 523 B     ║
║ template-compilation │ 429 B     │ 366 B     ║
║ template-compiler    │ 124.99 KB │ 60.62 KB  ║
║ template-factory     │ 370 B     │ 351 B     ║
║ test                 │ 923 B     │ 627 B     ║
║ utils                │ 4.11 KB   │ 3.63 KB   ║
║ version              │ 55 B      │ 131 B     ║
╚══════════════════════╧═══════════╧═══════════╝

╔═════════════════╤══════════╤══════════╗
║ @glimmer/*      │ Min      │ Gzip     ║
╟─────────────────┼──────────┼──────────╢
║ Total           │ 38.38 KB │ 21.85 KB ║
╟─────────────────┼──────────┼──────────╢
║ destroyable     │ 2.78 KB  │ 1.38 KB  ║
║ encoder         │ 81 B     │ 171 B    ║
║ env             │ 38 B     │ 87 B     ║
║ global-context  │ 886 B    │ 545 B    ║
║ manager         │ 977 B    │ 627 B    ║
║ node            │ 175 B    │ 244 B    ║
║ opcode-compiler │ 1.11 KB  │ 905 B    ║
║ owner           │ 159 B    │ 202 B    ║
║ program         │ 252 B    │ 333 B    ║
║ reference       │ 548 B    │ 544 B    ║
║ runtime         │ 10.32 KB │ 5.3 KB   ║
║ tracking        │ 1.34 KB  │ 1.18 KB  ║
║ util            │ 1.94 KB  │ 1.6 KB   ║
║ validator       │ 15.53 KB │ 6.9 KB   ║
║ vm              │ 495 B    │ 569 B    ║
║ wire-format     │ 1.84 KB  │ 1.35 KB  ║
╚═════════════════╧══════════╧══════════╝
╔═══════╤═══════════╤═══════════╗
║       │ Min       │ Gzip      ║
╟───────┼───────────┼───────────╢
║ Total │ 352.26 KB │ 203.67 KB ║
╚═══════╧═══════════╧═══════════╝

╔══════════════════════╤═══════════╤═══════════╗
║ @ember/*             │ Min       │ Gzip      ║
╟──────────────────────┼───────────┼───────────╢
║ Total                │ 313.87 KB │ 181.82 KB ║
╟──────────────────────┼───────────┼───────────╢
║ -internals           │ 36.68 KB  │ 26.02 KB  ║
║ application          │ 13.24 KB  │ 8.03 KB   ║
║ array                │ 13.05 KB  │ 7.54 KB   ║
║ canary-features      │ 304 B     │ 419 B     ║
║ component            │ 2.05 KB   │ 1.56 KB   ║
║ controller           │ 1.96 KB   │ 1.45 KB   ║
║ debug                │ 11.73 KB  │ 8.14 KB   ║
║ deprecated-features  │ 31 B      │ 77 B      ║
║ destroyable          │ 561 B     │ 383 B     ║
║ enumerable           │ 259 B     │ 387 B     ║
║ helper               │ 1.08 KB   │ 805 B     ║
║ instrumentation      │ 2.43 KB   │ 1.78 KB   ║
║ modifier             │ 1.22 KB   │ 1011 B    ║
║ object               │ 35.98 KB  │ 22.1 KB   ║
║ owner                │ 159 B     │ 178 B     ║
║ renderer             │ 630 B     │ 508 B     ║
║ routing              │ 59.37 KB  │ 33.92 KB  ║
║ runloop              │ 2.36 KB   │ 1.5 KB    ║
║ service              │ 1 KB      │ 858 B     ║
║ template             │ 654 B     │ 523 B     ║
║ template-compilation │ 429 B     │ 366 B     ║
║ template-compiler    │ 123.33 KB │ 59.68 KB  ║
║ template-factory     │ 370 B     │ 351 B     ║
║ test                 │ 923 B     │ 627 B     ║
║ utils                │ 4.11 KB   │ 3.63 KB   ║
║ version              │ 55 B      │ 131 B     ║
╚══════════════════════╧═══════════╧═══════════╝

╔═════════════════╤══════════╤══════════╗
║ @glimmer/*      │ Min      │ Gzip     ║
╟─────────────────┼──────────┼──────────╢
║ Total           │ 38.38 KB │ 21.85 KB ║
╟─────────────────┼──────────┼──────────╢
║ destroyable     │ 2.78 KB  │ 1.38 KB  ║
║ encoder         │ 81 B     │ 171 B    ║
║ env             │ 38 B     │ 87 B     ║
║ global-context  │ 886 B    │ 545 B    ║
║ manager         │ 977 B    │ 627 B    ║
║ node            │ 175 B    │ 244 B    ║
║ opcode-compiler │ 1.11 KB  │ 905 B    ║
║ owner           │ 159 B    │ 202 B    ║
║ program         │ 252 B    │ 333 B    ║
║ reference       │ 548 B    │ 544 B    ║
║ runtime         │ 10.32 KB │ 5.3 KB   ║
║ tracking        │ 1.34 KB  │ 1.18 KB  ║
║ util            │ 1.94 KB  │ 1.6 KB   ║
║ validator       │ 15.53 KB │ 6.9 KB   ║
║ vm              │ 495 B    │ 569 B    ║
║ wire-format     │ 1.84 KB  │ 1.35 KB  ║
╚═════════════════╧══════════╧══════════╝

@NullVoxPopuli
Copy link
Contributor Author

NullVoxPopuli commented Jan 28, 2026

Edit: solved


Currently failing in Safari and Firefox 🤔
But not chrome-based browsers.

This repros locally

@NullVoxPopuli NullVoxPopuli changed the title RFC#997 - {{on}} as keyword - option 2 RFC#997 - {{on}} as keyword Jan 28, 2026
@NullVoxPopuli NullVoxPopuli marked this pull request as ready for review January 28, 2026 15:53
if (options.eval) {
return options.eval;
} else {
const scope = options.scope?.();
Copy link
Contributor Author

@NullVoxPopuli NullVoxPopuli Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ef4 this is why I think we need to change the compiled JSON format to allow objects for scope.
Because the runtime compiler now eagerly consumes all args upon setting up the component to render.

This is incorrect, because args should not be consumed until rendered.

NullVoxPopuli added a commit that referenced this pull request Jan 28, 2026
@NullVoxPopuli NullVoxPopuli requested a review from ef4 January 28, 2026 19:43
@NullVoxPopuli NullVoxPopuli force-pushed the nvp/on-as-keyword-tremplate-the-transform-way branch from 357a531 to afde876 Compare January 30, 2026 19:12
@NullVoxPopuli NullVoxPopuli force-pushed the nvp/on-as-keyword-tremplate-the-transform-way branch from afde876 to 8f84f97 Compare January 30, 2026 19:14
return evaluator;
}

scope = Object.assign({}, keywords, scope);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these need to be mixed in here when using "explicit scope"

Copy link
Contributor Author

@NullVoxPopuli NullVoxPopuli Jan 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a demo of what happens when we remove: #21073

not ok 14 Chrome 144.0 - [5 ms] - [integration] jit :: keyword modifier: on (runtime): explicit scope
    ---
        stack: >
            ReferenceError: on is not defined

return component;
}

Object.assign(template, keywords);
Copy link
Contributor Author

@NullVoxPopuli NullVoxPopuli Jan 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have to have a known reference for "implicit scope" to use -- becauseu we can't change imports.

the only alternative to this is maybe having a static list of things on globalThis, but then we can't have multiple ember versions loaded at once

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants