Skip to content

Forward per-format compiler options from setup() - #386

Merged
NullVoxPopuli merged 1 commit into
universal-ember:mainfrom
adrianbw:format-options-passthrough
Sep 3, 2026
Merged

NullVoxPopuli merged 1 commit into
universal-ember:mainfrom
adrianbw:format-options-passthrough

Conversation

@adrianbw

Copy link
Copy Markdown
Contributor

setupKolay spreads userland options into the docs service, but setup() picks a fixed set of option names and builds the compiler options internally — so repl-sdk's supported per-format options (gjs, gmd, hbs, md, …) can't be supplied from an app. The one we need is a custom owner for rendered snippets: ember-repl already defaults each format's owner and spreads user entries over it (gjs: { owner, ...(options.gjs ?? {}) }), so the only missing link is kolay forwarding them.

This adds a formatOptions option to setup() (and the kolay/setup types), keyed by format. Entries merge over the options kolay configures for each format:

await setupKolay(this, {
  formatOptions: {
    gjs: { owner: myOwner },
    gmd: { owner: myOwner },
  },
});

Formats kolay doesn't configure (like gjs) pass straight through; for md/gmd/hbs the user's entries win key-by-key over kolay's. The JSDoc steers plugin additions to the existing remarkPlugins/rehypePlugins options so kolay's own plugins (frontmatter, link rebasing) aren't accidentally replaced.

Testing

Integration test in markdown-and-gjs-md-app: the application route injects a probe owner via formatOptions, and a live gjs snippet on a runtime-compiled page asserts getOwner(this).lookup(...) resolves through it. (The probe page is plain .md on purpose — .gjs.md pages compile at build time and never consult the runtime compiler.)

All five test-apps pass, pnpm lint clean.

Motivation

Our docs app needs to hand rendered snippets an owner that can answer environment-scoped lookups (the ember-provide-consume-context interaction described in customerio/ember-provide-consume-context#58 — providers register on the snippet island's Environment while consumer reads resolve through the host app's renderer). This passthrough is the supported surface for that kind of customization; discussed with @NullVoxPopuli.


🤖 Generated with Claude Code

AI attribution: drafted by Claude Code (Fable 5), directed by @adrianbw; the approach (forwarding per-format options through setup()) is per NullVoxPopuli's guidance. Tested as described above; reviewed by the author before opening.

setupKolay already spreads userland options into the docs service, but
setup() picked a fixed set of names and built the compiler options
internally, so per-format options (repl-sdk's supported surface —
notably a custom owner for rendered snippets) could not be supplied.

Add a formatOptions option, keyed by format, whose entries merge over
the options kolay configures for each format. An integration test
injects a gjs/gmd owner and asserts a rendered snippet resolves
getOwner() lookups through it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@bolt-new-by-stackblitz

Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@vercel

vercel Bot commented Aug 31, 2026

Copy link
Copy Markdown

@adrianbw is attempting to deploy a commit to the universal-ember Team on Vercel.

A member of the Team first needs to authorize it.

@NullVoxPopuli NullVoxPopuli added the bug Something isn't working label Sep 1, 2026
@NullVoxPopuli
NullVoxPopuli merged commit 42c1c28 into universal-ember:main Sep 3, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants