import { Aleph } from "https://deno.land/x/aleph_plugin_mdx@v1.3.0-beta.1/dev_deps.ts";
The class for Aleph server runtime.
Methods
addDist(path: string, content: Uint8Array): Promise<void>
add a dist.
addModule(): Promise<Module>
specifier: string,
sourceCode: string,
forceRefresh?: boolean,
add a module by given path and optional source code.
analyze()
build()
build the application to a static site(SSG)
compile(specifier: string, options?: CompileOptions)
compile the module by given specifier
computeModuleHash(module: Module)
createFSWatcher(): EventEmitter
create a fs watcher.
createMainJS(bundleMode?): Promise<string>
create main bootstrap script in javascript.
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, APIHandler] | null>
get api route by the given location.
getModule(specifier: string): Module | null
get the module by given specifier.
getModuleJS(module: Module, injectHMRCode?): Promise<Uint8Array | null>
getScripts(entryFile?: string)
get scripts for html output
getSSRData(request: Request, loc: { pathname: string; search?: string; }): Promise<Record<string, SSRData> | null>
get ssr data by the given location(page), return null
if no data defined
importModule<T = any>(module: Module): Promise<T>
lookupDeps()
specifier: string,
callback: (dep: DependencyDescriptor) => false | void,
__tracing?: Set<string>,
lookup app deps recurively.
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
parseModuleExportNames(specifier: string): Promise<string[]>
parse the export names of the module.
removeFSWatcher(e: EventEmitter)
remove the fs watcher.
renderPage(request: Request, loc: { pathname: string; search?: string; }): Promise<[number, string]>
render page to HTML by the given location
resolveImport(): string
unnamed 0: Module,
importer: string,
bundleMode?: boolean,
timeStamp?: boolean,
resolveModuleSource(specifier: string, data?: any): Promise<ModuleSource>