Skip to main content
Module

x/aleph/server/app.ts>Application

The Full-stack Framework in Deno.
Very Popular
Go to Latest
class Application
import { Application } from "https://deno.land/x/aleph@v0.3.0-alpha.7/server/app.ts";

The Aleph Server Application class.

Constructors

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

Properties

readonly
buildDir
readonly
config: Readonly<Required<Config>>
readonly
importMap: ImportMap
readonly
isDev
readonly
mode: "development" | "production"
readonly
outputDir
readonly
ready: Promise<void>
readonly
srcDir
readonly
workingDir: string

Methods

private
bundle()

bundle modules for production.

private
checkCompilationSideEffect(url: string, callback?: (mod: Module) => void)

check compilation side-effect caused by dependency graph.

private
compile(url: string, options?: { sourceCode?: string; forceCompile?: boolean; bundleMode?: boolean; bundledModules?: string[]; }): Promise<Module>

download and compile a moudle by given url, then cache on the disk.

private
copyDist()
private
createChunkBundle(name: string, deps: string[])

create chunk bundle.

private
createPageBundle(mod: Module, bundledModules: string[])

create page bundle.

create polyfill bundle.

private
fetchDependency(url: string): Promise<Uint8Array>

fetch dependency content, use deno builtin cache system

private
fixImportUrl(importUrl: string): string

fix import url

private
getRouteModule(unnamed 0: Pick<Module, "url" | "hash">): RouteModule

returns the route module by given module.

private
init(reload: boolean)

initialize project

private
isSSRable(pathname: string): boolean

check a page whether is ssrable.

private
lookupDeps(
url: string,
tracing?: Set<string>,
)

lookup deps recurively.

private
newModule(url: string): Module

create a new module by given url.

private
optimize()

optimize for production.

private
preprocessCSS(sourceCode: string)

preprocess css with postcss plugins

private
render404Page(url?: RouterURL)

render custom 404 page.

render custom loading page for SPA mode.

private
renderPage(loc: { pathname: string; search?: string; })

render page base the given location.

private
runDenoBundle(
bundleEntryFile: string,
bundleFile: string,
header?,
reload?,
)

run deno bundle and compess the output with terser.

private
ssg()

render all pages in routing.

private
transpile(sourceCode: string, options: TransformOptions)

transpile code without types checking.

private
watch()

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

addPageModule(pathname: string, code: string): Promise<void>

add a new page module by given path and source code.

build the application to a static site(SSG)

getMainJS(bundleMode?): string

get main js.

getModule(url: string): Module | null

returns the module by given url.

getPageHtml(loc: { pathname: string; search?: string; }): Promise<[number, string, Record<string, string> | null]>
getSSRData(loc: { pathname: string; search?: string; }): Promise<[number, any]>
handleAPI(req: ServerRequest, loc: { pathname: string; search?: string; })
injectHMRCode(unnamed 0: Module, content: string): string

inject HMR code

isHMRable(url: string)
removePageModule(pathname: string): Promise<void>

add a new page module by given path and source code.