API โ€บ @builder.io/qwik/server

getQwikLoaderScript

Provides the qwikloader.js file as a string. Useful for tooling to inline the qwikloader script into HTML.

export declare function getQwikLoaderScript(opts?: { debug?: boolean }): string;

Parameter

Type

Description

opts

{ debug?: boolean; }

(Optional)

string

Edit this section

getQwikPrefetchWorkerScript

Provides the qwik-prefetch-service-worker.js file as a string. Useful for tooling to inline the qwikloader script into HTML.

export declare function getQwikPrefetchWorkerScript(opts?: {
  debug?: boolean;
}): string;

Parameter

Type

Description

opts

{ debug?: boolean; }

(Optional)

string

Edit this section

InOrderAuto

export interface InOrderAuto

Property

Modifiers

Type

Description

maximumChunk?

number

(Optional)

maximumInitialChunk?

number

(Optional)

strategy

'auto'

Edit this section

InOrderDisabled

export interface InOrderDisabled

Property

Modifiers

Type

Description

strategy

'disabled'

Edit this section

InOrderStreaming

export type InOrderStreaming = InOrderAuto | InOrderDisabled | InOrderDirect;

References: InOrderAuto, InOrderDisabled

Edit this section

PrefetchImplementation

export interface PrefetchImplementation

Property

Modifiers

Type

Description

linkInsert?

'js-append' | 'html-append' | null

(Optional) js-append: Use JS runtime to create each <link> and append to the body.

html-append: Render each <link> within html, appended at the end of the body.

linkRel?

'prefetch' | 'preload' | 'modulepreload' | null

(Optional) Value of the <link rel="..."> attribute when link is used. Defaults to prefetch if links are inserted.

prefetchEvent?

'always' | null

(Optional) Dispatch a qprefetch event with detail data containing the bundles that should be prefetched. The event dispatch script will be inlined into the document's HTML so any listeners of this event should already be ready to handle the event.

This implementation will inject a script similar to:

<script type="module">
  document.dispatchEvent(new CustomEvent("qprefetch", { detail:{ "bundles": [...] } }))
</script>

By default, the prefetchEvent implementation will be set to always.

workerFetchInsert?

'always' | 'no-link-support' | null

(Optional) always: Always include the worker fetch JS runtime.

no-link-support: Only include the worker fetch JS runtime when the browser doesn't support <link> prefetch/preload/modulepreload.

Edit this section

PrefetchResource

export interface PrefetchResource

Property

Modifiers

Type

Description

imports

PrefetchResource[]

url

string

Edit this section

PrefetchStrategy

export interface PrefetchStrategy

Property

Modifiers

Type

Description

implementation?

PrefetchImplementation

(Optional)

symbolsToPrefetch?

SymbolsToPrefetch

(Optional)

Edit this section

QwikLoaderOptions

export interface QwikLoaderOptions

Property

Modifiers

Type

Description

include?

'always' | 'never' | 'auto'

(Optional)

position?

'top' | 'bottom'

(Optional)

Edit this section

Render

export type Render = RenderToString | RenderToStream;

References: RenderToString, RenderToStream

Edit this section

RenderOptions

export interface RenderOptions extends SerializeDocumentOptions

Extends: SerializeDocumentOptions

Property

Modifiers

Type

Description

base?

string | ((options: RenderOptions) => string)

(Optional) Specifies the root of the JS files of the client build. Setting a base, will cause the render of the q:base attribute in the q:container element.

containerAttributes?

Record<string, string>

(Optional)

containerTagName?

string

(Optional) When set, the app is serialized into a fragment. And the returned html is not a complete document. Defaults to html

locale?

string | ((options: RenderOptions) => string)

(Optional) Language to use when rendering the document.

prefetchStrategy?

PrefetchStrategy | null

(Optional)

qwikLoader?

QwikLoaderOptions

(Optional) Specifies if the Qwik Loader script is added to the document or not.

Defaults to { include: true }.

qwikPrefetchServiceWorker?

QwikPrefetchServiceWorkerOptions

(Optional) Specifies if the Qwik Prefetch Service Worker script is added to the document or not.

Defaults to { include: false }. NOTE: This may be change in the future.

serverData?

Record<string, any>

(Optional)

snapshot?

boolean

(Optional) Defaults to true

Edit this section

RenderResult

export interface RenderResult

Property

Modifiers

Type

Description

isStatic

boolean

manifest?

QwikManifest

(Optional)

prefetchResources

PrefetchResource[]

snapshotResult

SnapshotResult | undefined

Edit this section

renderToStream

Creates a server-side document, renders to root node to the document, then serializes the document to a string.

renderToStream2: typeof renderToStream;

Edit this section

RenderToStream

Creates a server-side document, renders to root node to the document, then serializes the document to a string.

renderToStream2: typeof renderToStream;

Edit this section

RenderToStreamOptions

export interface RenderToStreamOptions extends RenderOptions

Extends: RenderOptions

Property

Modifiers

Type

Description

stream

StreamWriter

streaming?

StreamingOptions

(Optional)

Edit this section

RenderToStreamResult

export interface RenderToStreamResult extends RenderResult

Extends: RenderResult

Property

Modifiers

Type

Description

flushes

number

size

number

timing

{ firstFlush: number; render: number; snapshot: number; }

Edit this section

renderToString

Creates a server-side document, renders to root node to the document, then serializes the document to a string.

renderToString2: typeof renderToString;

Edit this section

RenderToString

Creates a server-side document, renders to root node to the document, then serializes the document to a string.

renderToString2: typeof renderToString;

Edit this section

RenderToStringOptions

export interface RenderToStringOptions extends RenderOptions

Extends: RenderOptions

Edit this section

RenderToStringResult

export interface RenderToStringResult extends RenderResult

Extends: RenderResult

Property

Modifiers

Type

Description

html

string

timing

{ firstFlush: number; render: number; snapshot: number; }

Edit this section

resolveManifest

export declare function resolveManifest(
  manifest: QwikManifest | ResolvedManifest | undefined,
): ResolvedManifest | undefined;

Parameter

Type

Description

manifest

QwikManifest | ResolvedManifest | undefined

ResolvedManifest | undefined

Edit this section

SerializeDocumentOptions

export interface SerializeDocumentOptions

Property

Modifiers

Type

Description

debug?

boolean

(Optional)

manifest?

QwikManifest | ResolvedManifest

(Optional)

symbolMapper?

SymbolMapperFn

(Optional)

Edit this section

setServerPlatform

export declare function setServerPlatform(
  manifest: QwikManifest | ResolvedManifest | undefined,
): Promise<void>;

Parameter

Type

Description

manifest

QwikManifest | ResolvedManifest | undefined

Promise<void>

Edit this section

StreamingOptions

export interface StreamingOptions

Property

Modifiers

Type

Description

inOrder?

InOrderStreaming

(Optional)

Edit this section

SymbolsToPrefetch

Auto: Prefetch all possible QRLs used by the document. Default

export type SymbolsToPrefetch =
  | "auto"
  | ((opts: { manifest: QwikManifest }) => PrefetchResource[]);

References: PrefetchResource

Edit this section

versions

versions: {
    readonly qwik: string;
    readonly qwikDom: string;
}

Edit this section