Skip to main content
Module

x/aleph/server/aleph.ts>Aleph

The Full-stack Framework in Deno.
Go to Latest
class Aleph
implements IAleph
import { Aleph } from "https://deno.land/x/aleph@v0.3.0-beta.18/server/aleph.ts";

The class for Aleph server runtime.

Constructors

new
Aleph(
workingDir?,
mode?: "development" | "production",
reload?,
)

Properties

readonly
buildDir
readonly
commonCompilerOptions: TransformOptions

common compiler options

readonly
config
readonly
importMap
readonly
isDev
readonly
mode
readonly
ready
readonly
transformListeners
readonly
workingDir

Methods

addDist(path: string, content: Uint8Array): Promise<void>

add a dist.

addModule(
specifier: string,
sourceCode: string,
forceRefresh?: boolean,
): Promise<Module>

add a module by given path and optional source code.

build the application to a static site(SSG)

compile(specifier: string, options?: CompileOptions)

compile the module by given specifier

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.

remove the fs watcher.

renderPage(request: Request, loc: { pathname: string; search?: string; }): Promise<[number, string]>

render page to HTML by the given location

resolveImport(
unnamed 0: Module,
importer: string,
bundleMode?: boolean,
timeStamp?: boolean,
): string
resolveModuleSource(specifier: string, data?: any): Promise<ModuleSource>