Surface security and variables options on non-SvelteKit adapters
Two RefractPluginOptions fields are only honoured by @refrakt-md/sveltekit today, even though the underlying machinery (createRefraktLoader + loadContent) accepts both:
Two RefractPluginOptions fields are only honoured by @refrakt-md/sveltekit today, even though the underlying machinery (createRefraktLoader + loadContent) accepts both:
7f34b5951ec9e4RefraktAstroOptions extends with security?: SecurityPolicy and variables?: Record<string, string> (plus Record<string, unknown> value type — see Approach)createRefraktLoader (once WORK-244-style usage of the shared loader lands in the integration or template setup)site/content/docs/adapters/astro.md covers both options with example usageRefraktNuxtOptions extends with the same two fieldscreateRefraktLoader as the SvelteKit reference does)site/content/docs/adapters/nuxt.md covers both optionscreateRefraktLoader call sites in the template / helper APIs accept and forward security and variables parameterssite/content/docs/adapters/next.md covers both optionscreateDataFile's config object extends with security and variables; both forwarded to the underlying loadContent callsite/content/docs/adapters/eleventy.md covers both optionssecurity and variables and forwards into createRefraktLoadersite/content/docs/adapters/html.md covers both optionsvariables: { version: '"1.0.0"' } (note the embedded JSON value) and Markdoc content using {% $version %}, renders 1.0.0 in the outputsecurity: { policy: 'strict' } (or whatever the SecurityPolicy shape declares as the locked-down preset) produces sanitised output for an author-provided script tagBoth fields are pure passthrough. The Astro integration currently has:
const refraktConfig = loadRefraktConfig(configPath); const { site } = resolveSite(refraktConfig, options.site);
It will grow into using createRefraktLoader (matching the template-astro cleanup in WORK-244, lifted up to the integration layer where it natively belongs):
const loader = createRefraktLoader({ configPath, site: options.site, variables: options.variables, // security passed to the underlying loadContent call inside createRefraktLoader // — extend the loader's options shape if it doesn't already accept it });
The same shape applies to Nuxt's module, Eleventy's data file, and any Next.js / HTML helper.
Variable value typing: the SvelteKit plugin's variables: Record<string, string> interprets values as raw JavaScript expressions embedded in the generated virtual module (packages/sveltekit/src/types.ts:17). For non-Vite adapters that go through createRefraktLoader directly, the value type is Record<string, unknown> — actual JavaScript values, not source-text expressions, because there's no generated module to embed into. Document both shapes; type discriminator is the adapter (Vite vs. runtime).
createRefraktLoader security forwarding: check whether the current loader (packages/content/src/refract-loader.ts:15–25) accepts a security option. If not, extend the options interface to add it and forward into the underlying loadContent call. The SvelteKit plugin currently passes security directly to loadContent (line 182) without going through the loader — closing that gap is part of this item.
Pairs naturally with the per-adapter wiring items but doesn't block on them. If WORK-244 lands first, the Astro template already wires through createRefraktLoader and only needs the option surface added.
security + variables out of "Out of scope")SecurityPolicy for transform pipeline (the spec that introduced the option)packages/sveltekit/src/types.ts:17,22 — reference shape for both optionspackages/content/src/refract-loader.ts:15–25 — loader options interface (may need extension for security)site/vite.config.ts:11 — example variables consumerCompleted: 2026-05-21
Branch: `claude/update-adapters-5CJgQ`
Per-adapter wiring:
Docs updated on all five adapter pages: option tables now list `security` and `variables` with their default-and-purpose explanations. The `variables` value-type difference (`Record<string, unknown>` for non-SvelteKit; `Record<string, string>` source-text in SvelteKit) is documented per the spec.
For Eleventy/HTML the value type is the natural `Record<string, unknown>` (real JS values). For SvelteKit it stays `Record<string, string>` of raw source expressions — that's a Vite virtual-module-specific shape. Adapter docs make the distinction explicit.
End-to-end test-site verification deferred to SPEC-059.
Full workspace build clean; all 2652 tests pass; site builds clean.