Skip to main content
Module

x/aleph/server/mod.ts>Aleph

The Full-stack Framework in Deno.
Very Popular
Go to Latest
class Aleph
implements IAleph
Re-export
import { Aleph } from "https://deno.land/x/aleph@v0.3.0-beta.8/server/mod.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
workingDir

Methods

private
acceptHMR(ret: ResolveResult): boolean
private
applyCompilationSideEffect(
by: Module,
callback: (mod: Module) => void,
__tracing?,
)

apply compilation side-effect caused by updating dependency graph.

private
bundle()

create bundled chunks for production.

private
cacheModule(module: Module, sourceMap?: string)
private
clearSSRCache(specifier: string)
private
createRouteUpdate(specifier: string): [string, string, boolean | undefined]
private
createSPAIndexHtml(): Promise<string>

create the index html for SPA mode.

private
init(reload: boolean)

initiate runtime

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
isHMRable(specifier: string): boolean

check the module whether it is hmrable.

private
isPageModule(specifier: string): boolean

check the module whether it is page.

private
isScopedModule(specifier: string)

check the file whether it is a scoped module.

private
isSSRable(pathname: string): boolean

check the page whether it supports SSR.

private
replaceDepHash(
module: Module,
hashLoc: number,
hash: string,
)

replace dep hash in the jsBuffer and remove csrCode cache if it exits

private
ssg()

render all pages in routing.

private
transpileModule(
module: Module,
source: ModuleSource | null,
ignoreDeps?,
__tracing?: Set<string>,
): Promise<void>
private
watch()

watch file changes, re-compile modules, and send HMR signal to client.

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

add a dist.

addModule(specifier: string, sourceCode: string): 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, Module] | 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(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(loc: { pathname: string; search?: string; }): Promise<[number, string]>

render page to HTML by the given location

resolveModuleSource(specifier: string, data?: any): Promise<ModuleSource>