Documentation navigation

App

Pages and code generation

Generate typed lazy page registration from source modules.

Each page is a lazy module under src/pages/. Give page keys that match ^[a-z][A-Za-z0-9]*$, and place {"sideEffects":false} in src/pages/package.json so page modules can be safely split. The generator emits src/pages.gen.ts from the page files.

pnpm exec wseffect-codegen .
pnpm exec wseffect-codegen --check .

Run generation after adding, removing, or renaming pages. The check command fails on stale generated output; commit the generated file with the page source. Generated code imports the app’s /runtime boot-runtime entry; application code should use the package root API. Avoid editing generated registrations by hand.

./codegen

@wsagency/wseffect-app · MIT · source · MIT license · WS-AGENCY-NOTICE

This entry point is published in @wsagency/wseffect-app@0.1.0-rc.1. Import it from the package subpath shown below; the signatures and documentation are read from the installed package declarations.

import * as Wseffect from '@wsagency/wseffect-app/codegen'

Exported declarations

checkPages

export declare function checkPages(appRoot: string, options: GeneratePagesOptions): {
    ok: true;
} | {
    ok: false;
    diff: string;
};

computeBuildId

export declare function computeBuildId({ appRoot, workspaceRoot, env }: ComputeBuildIdInput): string;

generatePages

export declare function generatePages(appRoot: string, options: GeneratePagesOptions): {
    path: string;
    source: string;
};

GeneratePagesOptions

export interface GeneratePagesOptions {
    readonly pagesDir: string;
    readonly primaryPages?: ReadonlyArray<string>;
}

writePages

export declare function writePages(appRoot: string, options: GeneratePagesOptions): string;