Skip to main content
Module

x/aleph/server/mod.ts>Application

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

The application class for aleph server.

Constructors

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

Properties

private
readonly
defaultCompileOptions: TransformOptions

default compiler options

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

Methods

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

apply compilation side-effect caused by dependency graph breaking.

private
applyLoader(loader: LoaderPlugin, input: { url: string; content: Uint8Array; map?: Uint8Array; }): Promise<Omit<LoaderTransformResult, "loader">>

apply loaders recurively.

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.

private
createRouteModule(url: string): RouteModule
private
fetchModule(url: string): Promise<{ content: Uint8Array; contentType: string | null; }>

fetch module content

private
getDir(name: string, init: () => string)
private
init(reload: boolean)

initiate application

private
isScopedModule(url: string)
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<[string, SourceType] | null>
private
replaceDepHash(jsContent: string, dep: DependencyDescriptor)
private
ssg()

render all pages in routing.

private
useRenderCache(
namespace: string,
key: string,
render: () => Promise<[string, any]>,
): Promise<[string, any]>
private
watch()

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

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

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

build the application to a static site(SSG)

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

get main code in javascript.

getModule(url: string): Module | null

returns 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[]]
getSSRData(loc: { pathname: string; search?: string; }): Promise<any>

get ssr data

getSSRHTMLScripts(pagePath?: 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)
resolveModule(url: string)