Replace template-astro/src/setup.ts with createRefraktLoader
packages/create-refrakt/template-astro/src/setup.ts (92 lines) hand-rolls the loader pipeline:
packages/create-refrakt/template-astro/src/setup.ts (92 lines) hand-rolls the loader pipeline:
ba2b92e804df99packages/create-refrakt/template-astro/src/setup.ts is reduced to ~15–20 lines that instantiate createRefraktLoader and re-export its methods (getTransform, getHighlightTransform, getSite) plus a getTheme() helper that reads the manifest + layouts via the established Astro pathgetTheme() helper is the only template-specific code remaining — it builds the AstroTheme object ({ manifest, layouts }) from the theme package, baking in routeRules, siteName, baseUrl, defaultImage, logo from the resolved site config so adapter SEO threading (the sibling item in this milestone) has the fields it needs[...slug].astro template behaviour preserved — the page builder logic at packages/create-refrakt/template-astro/src/pages/[...slug].astro continues to work without modification (or with minimal updates)npx create-refrakt my-test-astro --template astro site builds cleanly and renders pages with the same output the SvelteKit reference produces for the same contentsite.tints.nord = { extends: "@refrakt-md/lumina/presets/nord" } produces [data-tint="nord"] scoped CSS in the built output (validates the SPEC-056 preset-loading path is now active)The replacement reduces to:
// packages/create-refrakt/template-astro/src/setup.ts import { createRefraktLoader } from '@refrakt-md/content'; import { loadRefraktConfig, resolveSite } from '@refrakt-md/transform/node'; import { getThemePackage } from '@refrakt-md/types'; import { readFileSync } from 'node:fs'; import { createRequire } from 'node:module'; import { resolve } from 'node:path'; const loader = createRefraktLoader({ configPath: resolve('refrakt.config.json'), }); export const getTransform = () => loader.getTransform(); export const getHighlightTransform = () => loader.getHighlightTransform(); export const getSite = () => loader.getSite(); export async function getTheme() { // Resolve once, read theme manifest + layouts, bake in SEO fields from site config const config = loadRefraktConfig(resolve('refrakt.config.json')); const { site } = resolveSite(config); const themePackage = getThemePackage(site.theme); const layouts = (await import(themePackage + '/layouts')).layouts; const manifestPath = createRequire(import.meta.url).resolve(themePackage + '/manifest'); const manifest = JSON.parse(readFileSync(manifestPath, 'utf-8')); return { manifest: { ...manifest, routeRules: site.routeRules ?? [{ pattern: '**', layout: 'default' }], ...(site.siteName && { siteName: site.siteName }), ...(site.baseUrl && { baseUrl: site.baseUrl }), ...(site.defaultImage && { defaultImage: site.defaultImage }), ...(site.logo && { logo: site.logo }), }, layouts, }; }
The getTheme() helper duplicates a small amount of work (it calls loadRefraktConfig / resolveSite again, even though createRefraktLoader already resolved them internally). The duplication is acceptable because the loader doesn't currently expose its resolved site — opening that up is out of scope here; can be revisited later if multiple templates need the same pattern.
This work item is independent — it can land any time the milestone is open. It coordinates with the milestone's SEO threading item (the SEO fields baked into the manifest become consumable once SEO threading lands) but does not block on it.
template-astro/src/setup.ts uses createRefraktLoader"packages/create-refrakt/template-astro/src/setup.ts — file to replacepackages/content/src/refract-loader.ts:172 — createRefraktLoader referenceCompleted: 2026-05-21
Branch: `claude/update-adapters-5CJgQ`
Replaced `packages/create-refrakt/template-astro/src/setup.ts` (92 lines of hand-rolled loader pipeline) with a ~55-line file that delegates to `createRefraktLoader`:
The pre-cleanup setup.ts had two bugs the loader handles correctly:
Side effect: `site.tints` and `site.backgrounds` overrides now also flow through `assembleThemeConfig`'s `themeOverrides` field, matching the SvelteKit reference.
The `getTheme()` helper duplicates a small amount of work — it calls `loadRefraktConfig` / `resolveSite` at module-scope even though `createRefraktLoader` does the same internally. The loader doesn't currently expose its resolved `site` object; opening that up is out of scope here. The duplication is one-time, module-load cost — acceptable.
Full workspace build succeeds.
Per the criterion, the `npx create-refrakt my-test-astro --template astro` end-to-end test is deferred to SPEC-059's testing infrastructure (which will scaffold each adapter's template against a shared fixture). The code path is verified by the workspace build + existing astro test suite.