class Aleph
implements IAleph
Re-export
import { Aleph } from "https://deno.land/x/aleph@v0.3.0-beta.5/server/mod.ts";
The class for Aleph server runtime.
Methods
private
acceptHMR(ret: ResolveResult): booleanprivate
applyCompilationSideEffect()apply compilation side-effect caused by updating dependency graph.
private
cacheModule(module: Module, sourceMap?: string)private
clearSSRCache(specifier: string)private
createRouteUpdate(specifier: string): [string, string, boolean | undefined]private
initModule(specifier: string, unnamed 1?: CompileOptions): Promise<[Module, ModuleSource | null]>init the module by given specifier, don't transpile the code when the returned source
is equal to null
private
transpileModule(): Promise<void>private
watchHandler(path: string, specifier: string): Promise<void>analyze()
fetchModule(specifier: string): Promise<{ content: Uint8Array; contentType: string | null; }>
fetch module source by the specifier.
findModule(predicate: (module: Module) => boolean): Module | null
get the first module in the modules map where predicate is true, and null otherwise.
getAPIRoute(location: { pathname: string; search?: string; }): Promise<[RouterURL, Module] | null>
get api route by the given location.
getModuleJS(module: Module, injectHMRCode?): Promise<Uint8Array | null>
getSSRData(loc: { pathname: string; search?: string; }): Promise<Record<string, SSRData> | null>
get ssr data by the given location(page), return null
if no data defined
gteModuleHash(module: Module)
importModule<T = any>(module: Module): Promise<T>
onLoad(test: RegExp, callback: (input: LoadInput) => LoadOutput | Promise<LoadOutput>): void
onRender(callback: (input: RenderOutput & { path: string; }) => void | Promise<void>): void
onResolve(test: RegExp, callback: (specifier: string) => ResolveResult): void
onTransform(test: RegExp | "hmr" | "main", callback: (input: TransformOutput & { module: Module; }) => TransformOutput | Promise<TransformOutput>): void
renderPage(loc: { pathname: string; search?: string; }): Promise<[number, string]>
render page to HTML by the given location
resolveModuleSource(specifier: string, data?: any): Promise<ModuleSource>