Astro integration
import * as mod from "jsr:@nzip/lofi/astro";
Astro and Vite integration used by generated lofi applications.
prepareLofiAstroConfig materializes version-matched runtime aliases
and Jazz configuration into the ignored .lofi/ directory.
The generated configuration reads these environment variables at Astro config-load time:
LOFI_BASE_PATH— deployment base path for the built site (default/).LOFI_CSP— set tooffto disable the Content-Security-Policy meta tags Astro emits per page (on by default).LOFI_CSP_SCRIPT_SRC— space-separated sources appended to thescript-srcdirective.LOFI_CSP_STYLE_SRC— space-separated sources appended to thestyle-srcdirective.LOFI_CSP_CONNECT_SRC— sources for aconnect-srcdirective; absent by default because the sync location is user data enrolled at runtime.LOFI_CSP_DIRECTIVES— semicolon-separated additional CSP directives.JAZZ_APP_ID— cloud-mode Jazz application id; requiresJAZZ_SERVER_URL.JAZZ_SERVER_URL— cloud-mode Jazz sync server URL; requiresJAZZ_APP_ID.LOFI_SKIP_JAZZ_MANAGED— set to1to skip starting the managed local Jazz server during development.
prepareLofiAstroConfig
function
async function prepareLofiAstroConfig(options: LofiAstroOptions): Promise<string>
Materializes the package-owned Astro/Jazz integration into an ignored tooling directory so Astro's Node-compatible config loader can consume it.
Vendors the runtime, access, preact, recipe, and schema modules into
.lofi/package/ and writes .lofi/astro.config.ts, rewriting the config
only when its content changes.
| Parameter | Description |
|---|---|
options | The project root and schema directory; both optional. |
Returns: The absolute path of the generated .lofi/astro.config.ts.
LofiAstroOptions
type
type LofiAstroOptions = {
root?: string;
schemaDir?: "src";
};
Options for materializing the package-owned Astro configuration.