@maskedeng-tom/ssrsx
Version:
server side renderer with tsx
37 lines (36 loc) • 1.14 kB
TypeScript
import { Fragment, VirtualChildren } from 'ssrsxjsx/jsx-runtime';
import { HttpServer } from '../src/types';
declare const getCurrentSsrsx: <C = unknown>() => SsrsxContext<C> | undefined;
declare const getCurrentFcId: () => string | undefined;
interface ElementEvent {
target: string;
event: string;
module: string;
f: string;
}
interface GlobalContext {
redirect?: boolean;
lastModified?: Date;
head?: VirtualChildren;
}
interface SsrsxContext<C = unknown> {
baseUrl: string;
context?: C;
parseContext: {
global: GlobalContext;
[key: string]: unknown;
};
server: HttpServer;
styles: string[];
events: ElementEvent[];
}
interface SsrsxFunctionContext {
finalize: () => VirtualChildren | Promise<VirtualChildren> | void | Promise<void>;
}
declare const parse: (root: VirtualChildren, httpServer: HttpServer, userContext: unknown, baseUrl: string) => Promise<{
body: string;
context: SsrsxContext;
}>;
export { Fragment, parse };
export type { SsrsxContext, SsrsxFunctionContext, ElementEvent, GlobalContext };
export { getCurrentSsrsx, getCurrentFcId };