Repository navigation
Add an experimental gjs|codegen format: templates compiled straight t… - #2287
Draft
NullVoxPopuli wants to merge 2 commits into
Draft
NullVoxPopuli wants to merge 2 commits into
NullVoxPopuli wants to merge 2 commits into
Conversation
…o DOM ops Adds a `codegen` flavor to the gjs compiler. Instead of compiling <template>s to the wire format (and then to VM bytecode at runtime), the templates are compiled directly to JavaScript that builds and updates DOM, using a small runtime (`@glimmer/dom`). The compiler and runtime are vendored from an ember.js branch: https://github.com/NullVoxPopuli-ai-agent/ember.js/tree/claude/gallant-heisenberg-aovzyr - repl-sdk: `gjs.codegen` config, sharing the gjs pipeline, but with the codegen babel plugin, and rendering with @glimmer/dom - ember-repl: provides `@glimmer/dom` to compiled code - repl app: 'Glimmer JS (codegen, experimental)' format + a demo Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H2cNyDMVxZb1xQB6oCzX89
|
|
Contributor
Footnotes
|
Vendors @glimmer/dom and the compiler from emberjs/ember.js#21649: - compile with `vmInterop`, so compiled templates can render components that only have a VM template (e.g. from addons), and the other way around - `@glimmer/dom/vm` is a known module (the VM interop runtime) - allowed globals (RFC 1070) resolve in compiled templates - the demo renders ember-primitives' <ExternalLink> from a compiled template Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H2cNyDMVxZb1xQB6oCzX89
Owner
Author
|
Count: import { clone as _clone, html as _html, at as _at, content as _content, get as _get, listen as _listen } from /*"@glimmer/dom"*/'blob:https://nvp-codegen-gjs-flavor.limber-glimdown.pages.dev/190a098e-aaca-4511-8cf2-3e3dcf49710a';
import { template as _template, setTemplate as _setTemplate } from /*"@glimmer/dom/vm"*/'blob:https://nvp-codegen-gjs-flavor.limber-glimdown.pages.dev/55ca1836-bc27-4f34-abe1-e39935d3307f';
const $_0_t2 = _html("<p>You have clicked the button <!> times.</p>\n\n<button type=\"button\">Click</button>");
import Component from /*'@glimmer/component'*/'blob:https://nvp-codegen-gjs-flavor.limber-glimdown.pages.dev/b77d5391-da1e-4779-a569-0b244523d07c';
import { tracked } from /*'@glimmer/tracking'*/'blob:https://nvp-codegen-gjs-flavor.limber-glimdown.pages.dev/62ba06ac-9fe4-4a2d-8221-c4d4c2d23003';
import { on } from /*'@ember/modifier'*/'blob:https://nvp-codegen-gjs-flavor.limber-glimdown.pages.dev/c6d78410-ddf1-4133-89ec-6c48eca9b3bc';
import { g, i } from /*"decorator-transforms/runtime-esm"*/'blob:https://nvp-codegen-gjs-flavor.limber-glimdown.pages.dev/14686cdd-3aa5-464e-9221-35a1f369de76';
export default class HelloWorld extends Component {
static {
g(this.prototype, "count", [tracked], function () {
return 0;
});
}
#count = (i(this, "count"), void 0);
increment = () => this.count += 1;
static {
_setTemplate(this, _template(($_b, $_ctx) => {
const $_s = $_ctx.self,
$_a = $_ctx.args;
const $_0_r1 = _clone($_b, $_0_t2);
const $_0_n3 = _at($_0_r1, 0, 1);
const $_0_n4 = _at($_0_r1, 2);
_content($_b, $_0_n3, () => _get($_s, "count"), 0);
_listen($_b, $_0_n4, "click", () => _get($_s, "increment"));
return $_0_r1;
}));
}
}
//# sourceURL=file:///src/index.gjs?v=4 |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…o DOM ops
Adds a
codegenflavor to the gjs compiler. Instead of compiling s to the wire format (and then to VM bytecode at runtime), the templates are compiled directly to JavaScript that builds and updates DOM, using a small runtime (@glimmer/dom).The compiler and runtime are vendored from an ember.js branch: https://github.com/NullVoxPopuli-ai-agent/ember.js/tree/claude/gallant-heisenberg-aovzyr
gjs.codegenconfig, sharing the gjs pipeline, but with the codegen babel plugin, and rendering with @glimmer/dom@glimmer/domto compiled codeClaude-Session: https://claude.ai/code/session_01H2cNyDMVxZb1xQB6oCzX89