Module

x/aleph/server/mod.ts>Application

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

The application class for aleph server.

Constructors

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

Properties

readonly
buildDir
readonly
config: RequiredConfig
readonly
framework
readonly
importMap: ImportMap
readonly
isDev
readonly
loaders
readonly
mode: "development" | "production"
readonly
outputDir
readonly
ready: Promise<void>
readonly
sharedCompileOptions: TransformOptions

default compiler options

readonly
srcDir
readonly
workingDir: string

Methods

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

apply compilation side-effect caused by dependency graph breaking.

private
bundle()

create bundle chunks for production.

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

compile a moudle by given url, then cache on the disk. each moudle only be compiled once unless you set the forceCompile option to true.

private
createRouteUpdate(url: string): [string, string, { isIndex?: boolean; useDeno?: boolean; }]
private
fetchModule(url: string): Promise<{ content: Uint8Array; contentType: string | null; }>

fetch module content

private
init(reload: boolean)

initiate application

private
isScopedModule(url: string)

check the changed file whether it is a scoped module

private
isSSRable(pathname: string): boolean

check a page whether is able to SSR.

private
lookupDeps(
url: string,
callback: (dep: DependencyDescriptor) => false | void,
__tracing?: Set<string>,
)

lookup deps recurively.

private
precompile(
url: string,
sourceContent: Uint8Array,
contentType: string | null,
): Promise<{ code: string; type: SourceType; isStyle: boolean; map?: string; } | null>
private
ssg()

render all pages in routing.

private
updateImportUrls(jsContent: string, dep: DependencyDescriptor)

update the hash in import url of deps.

private
watch()

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

addModule(url: string, options?: { code?: string; }): Promise<void>

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

build the application to a static site(SSG)

create a fs watcher.

findModuleByName(name: string): Module | null

find the module by given name.

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.

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

get ssr page

getPageRoute(location: { pathname: string; search?: string; }): [RouterURL, RouteModule[]]

get page route by given location.

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

get ssr data

getSSRHTMLScripts(entryFile?: string)

get ssr html scripts

injectCode(stage: "compilation" | "hmr" | "ssr", transform: TransformFn): void

inject code

injectHMRCode(unnamed 0: Module, content: string): string

inject HMR code

isHMRable(url: string)

check the module whether it is hmrable.

lookupStyleModules(...urls: string[]): Module[]

lookup style deps of given modules.

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

parse the export names of the module.

readModule(url: string)

read the module contents.

remove the fs watcher.

import Application
import { Application } from "https://dotland.deno.dev/x/aleph@v0.3.0-alpha.31/server/mod.ts";