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
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
InOrderAuto
export interface InOrderAuto
Property
Modifiers
Type
Description
number
(Optional)
number
(Optional)
'auto'
InOrderDisabled
export interface InOrderDisabled
Property
Modifiers
Type
Description
'disabled'
InOrderStreaming
export type InOrderStreaming = InOrderAuto | InOrderDisabled | InOrderDirect;
References: InOrderAuto, InOrderDisabled
PrefetchImplementation
export interface PrefetchImplementation
Property
Modifiers
Type
Description
'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.
'prefetch' | 'preload' | 'modulepreload' | null
(Optional) Value of the <link rel="...">
attribute when link is used. Defaults to prefetch
if links are inserted.
'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
.
'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.
PrefetchResource
export interface PrefetchResource
Property
Modifiers
Type
Description
string
PrefetchStrategy
export interface PrefetchStrategy
Property
Modifiers
Type
Description
(Optional)
(Optional)
QwikLoaderOptions
export interface QwikLoaderOptions
Property
Modifiers
Type
Description
'always' | 'never' | 'auto'
(Optional)
'top' | 'bottom'
(Optional)
Render
export type Render = RenderToString | RenderToStream;
References: RenderToString, RenderToStream
RenderOptions
export interface RenderOptions extends SerializeDocumentOptions
Extends: SerializeDocumentOptions
Property
Modifiers
Type
Description
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.
Record<string, string>
(Optional)
string
(Optional) When set, the app is serialized into a fragment. And the returned html is not a complete document. Defaults to html
string | ((options: RenderOptions) => string)
(Optional) Language to use when rendering the document.
PrefetchStrategy | null
(Optional)
(Optional) Specifies if the Qwik Loader script is added to the document or not.
Defaults to { include: true }
.
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.
Record<string, any>
(Optional)
boolean
(Optional) Defaults to true
RenderResult
export interface RenderResult
Property
Modifiers
Type
Description
boolean
QwikManifest
(Optional)
SnapshotResult | undefined
renderToStream
Creates a server-side document
, renders to root node to the document, then serializes the document to a string.
renderToStream2: typeof renderToStream;
RenderToStream
Creates a server-side document
, renders to root node to the document, then serializes the document to a string.
renderToStream2: typeof renderToStream;
RenderToStreamOptions
export interface RenderToStreamOptions extends RenderOptions
Extends: RenderOptions
Property
Modifiers
Type
Description
StreamWriter
(Optional)
RenderToStreamResult
export interface RenderToStreamResult extends RenderResult
Extends: RenderResult
Property
Modifiers
Type
Description
number
number
{ firstFlush: number; render: number; snapshot: number; }
renderToString
Creates a server-side document
, renders to root node to the document, then serializes the document to a string.
renderToString2: typeof renderToString;
RenderToString
Creates a server-side document
, renders to root node to the document, then serializes the document to a string.
renderToString2: typeof renderToString;
RenderToStringOptions
export interface RenderToStringOptions extends RenderOptions
Extends: RenderOptions
RenderToStringResult
export interface RenderToStringResult extends RenderResult
Extends: RenderResult
Property
Modifiers
Type
Description
string
{ firstFlush: number; render: number; snapshot: number; }
resolveManifest
export declare function resolveManifest(
manifest: QwikManifest | ResolvedManifest | undefined,
): ResolvedManifest | undefined;
Parameter
Type
Description
manifest
QwikManifest | ResolvedManifest | undefined
ResolvedManifest | undefined
SerializeDocumentOptions
export interface SerializeDocumentOptions
Property
Modifiers
Type
Description
boolean
(Optional)
QwikManifest | ResolvedManifest
(Optional)
SymbolMapperFn
(Optional)
setServerPlatform
export declare function setServerPlatform(
manifest: QwikManifest | ResolvedManifest | undefined,
): Promise<void>;
Parameter
Type
Description
manifest
QwikManifest | ResolvedManifest | undefined
Promise<void>
StreamingOptions
export interface StreamingOptions
Property
Modifiers
Type
Description
(Optional)
SymbolsToPrefetch
Auto: Prefetch all possible QRLs used by the document. Default
export type SymbolsToPrefetch =
| "auto"
| ((opts: { manifest: QwikManifest }) => PrefetchResource[]);
References: PrefetchResource
versions
versions: {
readonly qwik: string;
readonly qwikDom: string;
}