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 qwik-prefetch-service-worker 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

maximunChunk?

number

(Optional)

maximunInitialChunk?

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

debug?

boolean

(Optional) If true, the preloader will log debug information to the console.

Defaults to false

linkFetchPriority?

'auto' | 'low' | 'high' | null

(Optional) Value of the <link fetchpriority="..."> attribute when links are added. Defaults to null.

linkInsert?

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

(Optional)

linkRel?

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

(Optional) Value of the <link rel="..."> attribute when links are added. The preloader itself will autodetect which attribute to use based on the browser capabilities.

Defaults to modulepreload.

maxPreloads?

number

(Optional) Maximum number of preload links to add during SSR. These instruct the browser to preload likely bundles before the preloader script is active. This includes the 2 preloads used for the preloader script itself and the bundle information. Setting this to 0 will disable all preload links.

Defaults to 5

maxSimultaneousPreloads?

number

(Optional) Maximum number of simultaneous preload links that the preloader will maintain.

Defaults to 5

minPreloadProbability?

number

(Optional) The minimum probability for a bundle to be added to the preload queue.

Defaults to 0.25 (25% probability)

minProbability?

number

(Optional) The minimum probability of a bundle to be added as a preload link during SSR.

Defaults to 0.6 (60% probability)

prefetchEvent?

'always' | null

(Optional)

workerFetchInsert?

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

(Optional)

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)

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

export type RenderToStream = (
  opts: RenderToStreamOptions,
) => Promise<RenderToStreamResult>;

References: RenderToStreamOptions, RenderToStreamResult

Edit this section

RenderToStream

export type RenderToStream = (
  opts: RenderToStreamOptions,
) => Promise<RenderToStreamResult>;

References: RenderToStreamOptions, RenderToStreamResult

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

export type RenderToString = (
  opts: RenderToStringOptions,
) => Promise<RenderToStringResult>;

References: RenderToStringOptions, RenderToStringResult

Edit this section

RenderToString

export type RenderToString = (
  opts: RenderToStringOptions,
) => Promise<RenderToStringResult>;

References: RenderToStringOptions, RenderToStringResult

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

{ render: number; snapshot: number; }

Edit this section

resolveManifest

Merges a given manifest with the built manifest and provides mappings for symbols.

export declare function resolveManifest(
  manifest?: Partial<QwikManifest | ResolvedManifest> | undefined,
): ResolvedManifest | undefined;

Parameter

Type

Description

manifest

Partial<QwikManifest | ResolvedManifest> | undefined

(Optional)

ResolvedManifest | undefined

Edit this section

SerializeDocumentOptions

export interface SerializeDocumentOptions

Property

Modifiers

Type

Description

debug?

boolean

(Optional)

manifest?

Partial<QwikManifest | ResolvedManifest>

(Optional)

symbolMapper?

SymbolMapperFn

(Optional)

Edit this section

setServerPlatform

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

Parameter

Type

Description

manifest

Partial<QwikManifest | ResolvedManifest>

(Optional)

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