Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/aleph/server/app.ts>Application

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

The application class for aleph server.

Constructors

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

Properties

readonly
buildDir: string
readonly
commonCompileOptions: TransformOptions

common compiler options

readonly
config: RequiredConfig
readonly
importMap: ImportMap
readonly
isDev
readonly
loaders
readonly
mode: "development" | "production"
readonly
ready: Promise<void>
readonly
workingDir: string

Methods

private
applyCompilationSideEffect(by: Module, callback: (mod: Module) => void)

apply compilation side-effect caused by dependency graph updating.

private
applyModuleSideEffect(url: string)
private
bundle()

create bundle chunks for production.

private
cacheModule(module: Module)
private
compile(url: string)

compile the module by given url

private
createRouteUpdate(url: string): [string, string, { isIndex?: boolean; withData?: boolean; }]
private
hasSSRData(url: string)
private
init(reload: boolean)

initiate application

private
initModule(url: string, unnamed 1?: { source?: Source; forceRefresh?: boolean; }): Promise<Module>
private
isScopedModule(url: string)

check the changed file whether it is a scoped module that can emit the HMR event.

private
isSSRable(pathname: string): boolean

check the page whether it supports SSR.

private
ssg()

render all pages in routing.

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

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

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

add a dist.

addModule(url: string, sourceCode?: string): Promise<void>

add a module by given path and optional source code.

analyze(): Promise<void>

build the application to a static site(SSG)

create a fs watcher.

fetch(url: string): Promise<{ content: Uint8Array; contentType: string | null; }>

fetch resource by the url.

findModule(predicate: (module: Module) => boolean): Module | null

returns the module of the first one in the modules where predicate is true, and null otherwise..

getAPIRoute(location: { pathname: string; search?: string; }): [RouterURL, Module] | null

get api route by given location.

getCodeInjects(phase: "compilation" | "hmr" | "ssr")

get code injects

getMainJS(bundleMode?): string

get main code in javascript.

getModule(url: string): Module | null

get the module by given url.

getModuleJSCode(module: Module): Promise<Uint8Array | null>
getPageHTML(loc: { pathname: string; search?: string; }): Promise<[number, string]>

get ssr page

getSSRData(loc: { pathname: string; search?: string; }): Promise<any>

get ssr data

getSSRHTMLScripts(entryFile?: string)

get ssr html scripts

importModule(unnamed 0: Module): Promise<any>
injectCode(stage: "compilation" | "hmr" | "ssr", transform: TransformFn): void

inject code

isHMRable(url: string)

check the module whether it is hmrable.

loadModule(url: string, data?: any): Promise<Source>
lookupDeps(
url: string,
callback: (dep: DependencyDescriptor) => false | void,
__tracing?: Set<string>,
)

lookup app deps recurively.

parseModuleExportNames(url: string): Promise<string[]>

parse the export names of the module.

remove the fs watcher.