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?: {
  events?: string[];
  debug?: boolean;
}): string;
ParameterTypeDescription
opts{ events?: string[]; debug?: boolean; }(Optional)

Returns:

string

Edit this section

InOrderAuto

export interface InOrderAuto
PropertyModifiersTypeDescription
maximunChunk?number(Optional)
maximunInitialChunk?number(Optional)
strategy'auto'

Edit this section

InOrderDisabled

export interface InOrderDisabled
PropertyModifiersTypeDescription
strategy'disabled'

Edit this section

InOrderStreaming

export type InOrderStreaming = InOrderAuto | InOrderDisabled | InOrderDirect;

References: InOrderAuto, InOrderDisabled

Edit this section

PrefetchImplementation

export interface PrefetchImplementation
PropertyModifiersTypeDescription
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>

Edit this section

PrefetchResource

export interface PrefetchResource
PropertyModifiersTypeDescription
importsPrefetchResource[]
urlstring

Edit this section

PrefetchStrategy

export interface PrefetchStrategy
PropertyModifiersTypeDescription
implementation?PrefetchImplementation(Optional)
symbolsToPrefetch?SymbolsToPrefetch(Optional)

Edit this section

QwikLoaderOptions

export interface QwikLoaderOptions
PropertyModifiersTypeDescription
events?string[](Optional)
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

PropertyModifiersTypeDescription
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 }.
serverData?Record<string, any>(Optional)
snapshot?boolean(Optional) Defaults to true

Edit this section

RenderResult

export interface RenderResult
PropertyModifiersTypeDescription
isStaticboolean
manifest?QwikManifest(Optional)
prefetchResourcesPrefetchResource[]
snapshotResultSnapshotResult | 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

PropertyModifiersTypeDescription
streamStreamWriter
streaming?StreamingOptions(Optional)

Edit this section

RenderToStreamResult

export interface RenderToStreamResult extends RenderResult

Extends: RenderResult

PropertyModifiersTypeDescription
flushesnumber
sizenumber
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

PropertyModifiersTypeDescription
htmlstring
timing{ render: number; snapshot: number; }

Edit this section

resolveManifest

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

Returns:

ResolvedManifest | undefined

Edit this section

SerializeDocumentOptions

export interface SerializeDocumentOptions
PropertyModifiersTypeDescription
debug?boolean(Optional)
manifest?QwikManifest | ResolvedManifest(Optional)
symbolMapper?SymbolMapperFn(Optional)

Edit this section

setServerPlatform

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

Returns:

Promise<void>

Edit this section

StreamingOptions

export interface StreamingOptions
PropertyModifiersTypeDescription
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