@builder.io/qwik-city
Advanced tools
Comparing version 0.0.105 to 0.0.106
/// <reference path="./modules.d.ts" /> | ||
import { Component } from '@builder.io/qwik'; | ||
import { JSXNode } from '@builder.io/qwik'; | ||
import { QwikIntrinsicElements } from '@builder.io/qwik'; | ||
@@ -145,3 +146,3 @@ import { ResourceReturn } from '@builder.io/qwik'; | ||
* @alpha | ||
* @deprecated - use QwikCity | ||
* @deprecated - The "Html" component has been renamed to "QwikCity". | ||
*/ | ||
@@ -325,2 +326,7 @@ export declare const Html: Component< {}>; | ||
/** | ||
* @alpha | ||
*/ | ||
export declare const ServiceWorkerRegister: () => JSXNode<"script">; | ||
declare interface StaticGenerate { | ||
@@ -327,0 +333,0 @@ params?: RouteParams[]; |
@@ -7,115 +7,2 @@ import type { Render } from '@builder.io/qwik/server'; | ||
*/ | ||
declare interface ContentHeading { | ||
text: string; | ||
id: string; | ||
level: number; | ||
} | ||
/** | ||
* @alpha | ||
*/ | ||
declare interface ContentMenu { | ||
text: string; | ||
href?: string; | ||
items?: ContentMenu[]; | ||
} | ||
declare type ContentModule = PageModule | LayoutModule; | ||
declare type ContentModuleHead = DocumentHead | ResolvedDocumentHead; | ||
declare type ContentModuleLoader = () => Promise<ContentModule>; | ||
/** | ||
* @alpha | ||
*/ | ||
declare type DocumentHead<T = unknown> = DocumentHeadValue | ((props: DocumentHeadProps<GetEndpointData<T>>) => DocumentHeadValue); | ||
/** | ||
* @alpha | ||
*/ | ||
declare interface DocumentHeadProps<T = unknown> extends RouteLocation { | ||
data: T; | ||
head: ResolvedDocumentHead; | ||
} | ||
/** | ||
* @alpha | ||
*/ | ||
declare interface DocumentHeadValue { | ||
/** | ||
* Sets `document.title`. | ||
*/ | ||
title?: string; | ||
/** | ||
* Used to manually set meta tags in the head. Additionally, the `data` | ||
* property could be used to set arbitrary data which the `<head>` component | ||
* could later use to generate `<meta>` tags. | ||
*/ | ||
meta?: DocumentMeta[]; | ||
/** | ||
* Used to manually append `<link>` elements to the `<head>`. | ||
*/ | ||
links?: DocumentLink[]; | ||
/** | ||
* Used to manually append `<style>` elements to the `<head>`. | ||
*/ | ||
styles?: DocumentStyle[]; | ||
} | ||
/** | ||
* @alpha | ||
*/ | ||
declare interface DocumentLink { | ||
as?: string; | ||
crossorigin?: string; | ||
disabled?: boolean; | ||
href?: string; | ||
hreflang?: string; | ||
id?: string; | ||
imagesizes?: string; | ||
imagesrcset?: string; | ||
integrity?: string; | ||
media?: string; | ||
prefetch?: string; | ||
referrerpolicy?: string; | ||
rel?: string; | ||
sizes?: string; | ||
title?: string; | ||
type?: string; | ||
key?: string; | ||
} | ||
/** | ||
* @alpha | ||
*/ | ||
declare interface DocumentMeta { | ||
content?: string; | ||
httpEquiv?: string; | ||
name?: string; | ||
property?: string; | ||
key?: string; | ||
} | ||
/** | ||
* @alpha | ||
*/ | ||
declare interface DocumentStyle { | ||
style: string; | ||
props?: { | ||
[propName: string]: string; | ||
}; | ||
key?: string; | ||
} | ||
declare type EndpointModuleLoader = () => Promise<RouteModule>; | ||
declare class ErrorResponse extends Error { | ||
status: number; | ||
constructor(status: number, message?: string); | ||
} | ||
/** | ||
* @alpha | ||
*/ | ||
export declare interface EventPluginContext { | ||
@@ -128,28 +15,2 @@ request: Request; | ||
declare type FallbackRouteData = [pattern: RegExp, loaders: ModuleLoader[]] | [pattern: RegExp, loaders: ModuleLoader[], paramNames: string[]]; | ||
declare type GetEndpointData<T> = T extends RequestHandler<infer U> ? U : T; | ||
declare interface LayoutModule extends RouteModule { | ||
readonly default: any; | ||
readonly head?: ContentModuleHead; | ||
} | ||
declare type MenuData = [pathname: string, menuLoader: MenuModuleLoader]; | ||
declare interface MenuModule { | ||
readonly default: ContentMenu; | ||
} | ||
declare type MenuModuleLoader = () => Promise<MenuModule>; | ||
declare type ModuleLoader = ContentModuleLoader | EndpointModuleLoader; | ||
declare interface PageModule extends RouteModule { | ||
readonly default: any; | ||
readonly head?: ContentModuleHead; | ||
readonly headings?: ContentHeading[]; | ||
readonly onStaticGenerate?: StaticGenerateHandler; | ||
} | ||
/** | ||
@@ -166,142 +27,5 @@ * @alpha | ||
/** | ||
* @alpha | ||
*/ | ||
declare interface QwikCityPlan { | ||
routes?: RouteData[]; | ||
fallbackRoutes?: FallbackRouteData[]; | ||
menus?: MenuData[]; | ||
trailingSlash?: boolean; | ||
cacheModules?: boolean; | ||
declare interface QwikCityRequestOptions extends RenderOptions { | ||
} | ||
declare interface QwikCityRequestOptions extends QwikCityPlan, RenderOptions { | ||
} | ||
declare class RedirectResponse { | ||
url: string; | ||
status: number; | ||
headers: Headers; | ||
location: string; | ||
constructor(url: string, status?: number, headers?: Headers); | ||
} | ||
/** | ||
* @alpha | ||
*/ | ||
declare interface RequestContext { | ||
formData(): Promise<FormData>; | ||
headers: Headers; | ||
json(): Promise<any>; | ||
method: string; | ||
text(): Promise<string>; | ||
url: string; | ||
} | ||
/** | ||
* @alpha | ||
*/ | ||
declare interface RequestEvent { | ||
request: RequestContext; | ||
response: ResponseContext; | ||
url: URL; | ||
/** URL Route params which have been parsed from the current url pathname. */ | ||
params: RouteParams; | ||
/** Platform specific data and functions */ | ||
platform: Record<string, any>; | ||
next: () => Promise<void>; | ||
abort: () => void; | ||
} | ||
/** | ||
* @alpha | ||
*/ | ||
declare type RequestHandler<BODY = unknown> = (ev: RequestEvent) => RequestHandlerResult<BODY>; | ||
declare type RequestHandlerBody<BODY> = BODY | string | number | boolean | undefined | null | void; | ||
declare type RequestHandlerBodyFunction<BODY> = () => RequestHandlerBody<BODY> | Promise<RequestHandlerBody<BODY>>; | ||
declare type RequestHandlerResult<BODY> = (RequestHandlerBody<BODY> | RequestHandlerBodyFunction<BODY>) | Promise<RequestHandlerBody<BODY> | RequestHandlerBodyFunction<BODY>>; | ||
/** | ||
* @alpha | ||
*/ | ||
declare type ResolvedDocumentHead = Required<DocumentHeadValue>; | ||
/** | ||
* @alpha | ||
*/ | ||
declare interface ResponseContext { | ||
/** | ||
* HTTP response status code. | ||
* | ||
* https://developer.mozilla.org/en-US/docs/Web/HTTP/Status | ||
*/ | ||
status: number; | ||
/** | ||
* HTTP response headers. | ||
* | ||
* https://developer.mozilla.org/en-US/docs/Glossary/Response_header | ||
*/ | ||
readonly headers: Headers; | ||
/** | ||
* URL to redirect to. When called, the response will immediately | ||
* end with the correct redirect status and headers. | ||
* Defaults to use the `307` response status code, but can be | ||
* overridden by setting the `status` argument. | ||
* | ||
* https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections | ||
*/ | ||
readonly redirect: (url: string, status?: number) => RedirectResponse; | ||
/** | ||
* When called, the response will immediately end with the given | ||
* status code. This could be useful to end a response with `404`, | ||
* and use the 404 handler in the routes directory. | ||
* See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status | ||
* for which status code should be used. | ||
*/ | ||
readonly error: (status: number) => ErrorResponse; | ||
} | ||
/** | ||
* @alpha | ||
*/ | ||
declare type RouteData = [pattern: RegExp, loaders: ModuleLoader[]] | [pattern: RegExp, loaders: ModuleLoader[], paramNames: string[]] | [pattern: RegExp, loaders: ModuleLoader[], paramNames: string[], originalPathname: string]; | ||
/** | ||
* @alpha | ||
*/ | ||
declare interface RouteLocation { | ||
readonly params: RouteParams; | ||
readonly href: string; | ||
readonly pathname: string; | ||
readonly query: Record<string, string>; | ||
} | ||
declare interface RouteModule<BODY = unknown> { | ||
onDelete?: RequestHandler<BODY>; | ||
onGet?: RequestHandler<BODY>; | ||
onHead?: RequestHandler<BODY>; | ||
onOptions?: RequestHandler<BODY>; | ||
onPatch?: RequestHandler<BODY>; | ||
onPost?: RequestHandler<BODY>; | ||
onPut?: RequestHandler<BODY>; | ||
onRequest?: RequestHandler<BODY>; | ||
} | ||
/** | ||
* @alpha | ||
*/ | ||
declare type RouteParams = Record<string, string>; | ||
declare interface StaticGenerate { | ||
params?: RouteParams[]; | ||
} | ||
/** | ||
* @alpha | ||
*/ | ||
declare type StaticGenerateHandler = () => Promise<StaticGenerate> | StaticGenerate; | ||
export { } |
@@ -10,141 +10,2 @@ import type { NextFunction } from 'express'; | ||
*/ | ||
declare interface ContentHeading { | ||
text: string; | ||
id: string; | ||
level: number; | ||
} | ||
/** | ||
* @alpha | ||
*/ | ||
declare interface ContentMenu { | ||
text: string; | ||
href?: string; | ||
items?: ContentMenu[]; | ||
} | ||
declare type ContentModule = PageModule | LayoutModule; | ||
declare type ContentModuleHead = DocumentHead | ResolvedDocumentHead; | ||
declare type ContentModuleLoader = () => Promise<ContentModule>; | ||
/** | ||
* @alpha | ||
*/ | ||
declare type DocumentHead<T = unknown> = DocumentHeadValue | ((props: DocumentHeadProps<GetEndpointData<T>>) => DocumentHeadValue); | ||
/** | ||
* @alpha | ||
*/ | ||
declare interface DocumentHeadProps<T = unknown> extends RouteLocation { | ||
data: T; | ||
head: ResolvedDocumentHead; | ||
} | ||
/** | ||
* @alpha | ||
*/ | ||
declare interface DocumentHeadValue { | ||
/** | ||
* Sets `document.title`. | ||
*/ | ||
title?: string; | ||
/** | ||
* Used to manually set meta tags in the head. Additionally, the `data` | ||
* property could be used to set arbitrary data which the `<head>` component | ||
* could later use to generate `<meta>` tags. | ||
*/ | ||
meta?: DocumentMeta[]; | ||
/** | ||
* Used to manually append `<link>` elements to the `<head>`. | ||
*/ | ||
links?: DocumentLink[]; | ||
/** | ||
* Used to manually append `<style>` elements to the `<head>`. | ||
*/ | ||
styles?: DocumentStyle[]; | ||
} | ||
/** | ||
* @alpha | ||
*/ | ||
declare interface DocumentLink { | ||
as?: string; | ||
crossorigin?: string; | ||
disabled?: boolean; | ||
href?: string; | ||
hreflang?: string; | ||
id?: string; | ||
imagesizes?: string; | ||
imagesrcset?: string; | ||
integrity?: string; | ||
media?: string; | ||
prefetch?: string; | ||
referrerpolicy?: string; | ||
rel?: string; | ||
sizes?: string; | ||
title?: string; | ||
type?: string; | ||
key?: string; | ||
} | ||
/** | ||
* @alpha | ||
*/ | ||
declare interface DocumentMeta { | ||
content?: string; | ||
httpEquiv?: string; | ||
name?: string; | ||
property?: string; | ||
key?: string; | ||
} | ||
/** | ||
* @alpha | ||
*/ | ||
declare interface DocumentStyle { | ||
style: string; | ||
props?: { | ||
[propName: string]: string; | ||
}; | ||
key?: string; | ||
} | ||
declare type EndpointModuleLoader = () => Promise<RouteModule>; | ||
declare class ErrorResponse extends Error { | ||
status: number; | ||
constructor(status: number, message?: string); | ||
} | ||
declare type FallbackRouteData = [pattern: RegExp, loaders: ModuleLoader[]] | [pattern: RegExp, loaders: ModuleLoader[], paramNames: string[]]; | ||
declare type GetEndpointData<T> = T extends RequestHandler<infer U> ? U : T; | ||
declare interface LayoutModule extends RouteModule { | ||
readonly default: any; | ||
readonly head?: ContentModuleHead; | ||
} | ||
declare type MenuData = [pathname: string, menuLoader: MenuModuleLoader]; | ||
declare interface MenuModule { | ||
readonly default: ContentMenu; | ||
} | ||
declare type MenuModuleLoader = () => Promise<MenuModule>; | ||
declare type ModuleLoader = ContentModuleLoader | EndpointModuleLoader; | ||
declare interface PageModule extends RouteModule { | ||
readonly default: any; | ||
readonly head?: ContentModuleHead; | ||
readonly headings?: ContentHeading[]; | ||
readonly onStaticGenerate?: StaticGenerateHandler; | ||
} | ||
/** | ||
* @alpha | ||
*/ | ||
export declare function qwikCity(render: Render, opts?: QwikCityExpressOptions): { | ||
@@ -161,142 +22,5 @@ router: (req: Request_2, res: Response_2, next: NextFunction) => Promise<void>; | ||
/** | ||
* @alpha | ||
*/ | ||
declare interface QwikCityPlan { | ||
routes?: RouteData[]; | ||
fallbackRoutes?: FallbackRouteData[]; | ||
menus?: MenuData[]; | ||
trailingSlash?: boolean; | ||
cacheModules?: boolean; | ||
declare interface QwikCityRequestOptions extends RenderOptions { | ||
} | ||
declare interface QwikCityRequestOptions extends QwikCityPlan, RenderOptions { | ||
} | ||
declare class RedirectResponse { | ||
url: string; | ||
status: number; | ||
headers: Headers; | ||
location: string; | ||
constructor(url: string, status?: number, headers?: Headers); | ||
} | ||
/** | ||
* @alpha | ||
*/ | ||
declare interface RequestContext { | ||
formData(): Promise<FormData>; | ||
headers: Headers; | ||
json(): Promise<any>; | ||
method: string; | ||
text(): Promise<string>; | ||
url: string; | ||
} | ||
/** | ||
* @alpha | ||
*/ | ||
declare interface RequestEvent { | ||
request: RequestContext; | ||
response: ResponseContext; | ||
url: URL; | ||
/** URL Route params which have been parsed from the current url pathname. */ | ||
params: RouteParams; | ||
/** Platform specific data and functions */ | ||
platform: Record<string, any>; | ||
next: () => Promise<void>; | ||
abort: () => void; | ||
} | ||
/** | ||
* @alpha | ||
*/ | ||
declare type RequestHandler<BODY = unknown> = (ev: RequestEvent) => RequestHandlerResult<BODY>; | ||
declare type RequestHandlerBody<BODY> = BODY | string | number | boolean | undefined | null | void; | ||
declare type RequestHandlerBodyFunction<BODY> = () => RequestHandlerBody<BODY> | Promise<RequestHandlerBody<BODY>>; | ||
declare type RequestHandlerResult<BODY> = (RequestHandlerBody<BODY> | RequestHandlerBodyFunction<BODY>) | Promise<RequestHandlerBody<BODY> | RequestHandlerBodyFunction<BODY>>; | ||
/** | ||
* @alpha | ||
*/ | ||
declare type ResolvedDocumentHead = Required<DocumentHeadValue>; | ||
/** | ||
* @alpha | ||
*/ | ||
declare interface ResponseContext { | ||
/** | ||
* HTTP response status code. | ||
* | ||
* https://developer.mozilla.org/en-US/docs/Web/HTTP/Status | ||
*/ | ||
status: number; | ||
/** | ||
* HTTP response headers. | ||
* | ||
* https://developer.mozilla.org/en-US/docs/Glossary/Response_header | ||
*/ | ||
readonly headers: Headers; | ||
/** | ||
* URL to redirect to. When called, the response will immediately | ||
* end with the correct redirect status and headers. | ||
* Defaults to use the `307` response status code, but can be | ||
* overridden by setting the `status` argument. | ||
* | ||
* https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections | ||
*/ | ||
readonly redirect: (url: string, status?: number) => RedirectResponse; | ||
/** | ||
* When called, the response will immediately end with the given | ||
* status code. This could be useful to end a response with `404`, | ||
* and use the 404 handler in the routes directory. | ||
* See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status | ||
* for which status code should be used. | ||
*/ | ||
readonly error: (status: number) => ErrorResponse; | ||
} | ||
/** | ||
* @alpha | ||
*/ | ||
declare type RouteData = [pattern: RegExp, loaders: ModuleLoader[]] | [pattern: RegExp, loaders: ModuleLoader[], paramNames: string[]] | [pattern: RegExp, loaders: ModuleLoader[], paramNames: string[], originalPathname: string]; | ||
/** | ||
* @alpha | ||
*/ | ||
declare interface RouteLocation { | ||
readonly params: RouteParams; | ||
readonly href: string; | ||
readonly pathname: string; | ||
readonly query: Record<string, string>; | ||
} | ||
declare interface RouteModule<BODY = unknown> { | ||
onDelete?: RequestHandler<BODY>; | ||
onGet?: RequestHandler<BODY>; | ||
onHead?: RequestHandler<BODY>; | ||
onOptions?: RequestHandler<BODY>; | ||
onPatch?: RequestHandler<BODY>; | ||
onPost?: RequestHandler<BODY>; | ||
onPut?: RequestHandler<BODY>; | ||
onRequest?: RequestHandler<BODY>; | ||
} | ||
/** | ||
* @alpha | ||
*/ | ||
declare type RouteParams = Record<string, string>; | ||
declare interface StaticGenerate { | ||
params?: RouteParams[]; | ||
} | ||
/** | ||
* @alpha | ||
*/ | ||
declare type StaticGenerateHandler = () => Promise<StaticGenerate> | StaticGenerate; | ||
export { } |
@@ -7,115 +7,2 @@ import type { Render } from '@builder.io/qwik/server'; | ||
*/ | ||
declare interface ContentHeading { | ||
text: string; | ||
id: string; | ||
level: number; | ||
} | ||
/** | ||
* @alpha | ||
*/ | ||
declare interface ContentMenu { | ||
text: string; | ||
href?: string; | ||
items?: ContentMenu[]; | ||
} | ||
declare type ContentModule = PageModule | LayoutModule; | ||
declare type ContentModuleHead = DocumentHead | ResolvedDocumentHead; | ||
declare type ContentModuleLoader = () => Promise<ContentModule>; | ||
/** | ||
* @alpha | ||
*/ | ||
declare type DocumentHead<T = unknown> = DocumentHeadValue | ((props: DocumentHeadProps<GetEndpointData<T>>) => DocumentHeadValue); | ||
/** | ||
* @alpha | ||
*/ | ||
declare interface DocumentHeadProps<T = unknown> extends RouteLocation { | ||
data: T; | ||
head: ResolvedDocumentHead; | ||
} | ||
/** | ||
* @alpha | ||
*/ | ||
declare interface DocumentHeadValue { | ||
/** | ||
* Sets `document.title`. | ||
*/ | ||
title?: string; | ||
/** | ||
* Used to manually set meta tags in the head. Additionally, the `data` | ||
* property could be used to set arbitrary data which the `<head>` component | ||
* could later use to generate `<meta>` tags. | ||
*/ | ||
meta?: DocumentMeta[]; | ||
/** | ||
* Used to manually append `<link>` elements to the `<head>`. | ||
*/ | ||
links?: DocumentLink[]; | ||
/** | ||
* Used to manually append `<style>` elements to the `<head>`. | ||
*/ | ||
styles?: DocumentStyle[]; | ||
} | ||
/** | ||
* @alpha | ||
*/ | ||
declare interface DocumentLink { | ||
as?: string; | ||
crossorigin?: string; | ||
disabled?: boolean; | ||
href?: string; | ||
hreflang?: string; | ||
id?: string; | ||
imagesizes?: string; | ||
imagesrcset?: string; | ||
integrity?: string; | ||
media?: string; | ||
prefetch?: string; | ||
referrerpolicy?: string; | ||
rel?: string; | ||
sizes?: string; | ||
title?: string; | ||
type?: string; | ||
key?: string; | ||
} | ||
/** | ||
* @alpha | ||
*/ | ||
declare interface DocumentMeta { | ||
content?: string; | ||
httpEquiv?: string; | ||
name?: string; | ||
property?: string; | ||
key?: string; | ||
} | ||
/** | ||
* @alpha | ||
*/ | ||
declare interface DocumentStyle { | ||
style: string; | ||
props?: { | ||
[propName: string]: string; | ||
}; | ||
key?: string; | ||
} | ||
declare type EndpointModuleLoader = () => Promise<RouteModule>; | ||
declare class ErrorResponse extends Error { | ||
status: number; | ||
constructor(status: number, message?: string); | ||
} | ||
/** | ||
* @alpha | ||
*/ | ||
export declare interface EventPluginContext { | ||
@@ -125,28 +12,2 @@ next: (input?: Request | string, init?: RequestInit) => Promise<Response>; | ||
declare type FallbackRouteData = [pattern: RegExp, loaders: ModuleLoader[]] | [pattern: RegExp, loaders: ModuleLoader[], paramNames: string[]]; | ||
declare type GetEndpointData<T> = T extends RequestHandler<infer U> ? U : T; | ||
declare interface LayoutModule extends RouteModule { | ||
readonly default: any; | ||
readonly head?: ContentModuleHead; | ||
} | ||
declare type MenuData = [pathname: string, menuLoader: MenuModuleLoader]; | ||
declare interface MenuModule { | ||
readonly default: ContentMenu; | ||
} | ||
declare type MenuModuleLoader = () => Promise<MenuModule>; | ||
declare type ModuleLoader = ContentModuleLoader | EndpointModuleLoader; | ||
declare interface PageModule extends RouteModule { | ||
readonly default: any; | ||
readonly head?: ContentModuleHead; | ||
readonly headings?: ContentHeading[]; | ||
readonly onStaticGenerate?: StaticGenerateHandler; | ||
} | ||
/** | ||
@@ -163,142 +24,5 @@ * @alpha | ||
/** | ||
* @alpha | ||
*/ | ||
declare interface QwikCityPlan { | ||
routes?: RouteData[]; | ||
fallbackRoutes?: FallbackRouteData[]; | ||
menus?: MenuData[]; | ||
trailingSlash?: boolean; | ||
cacheModules?: boolean; | ||
declare interface QwikCityRequestOptions extends RenderOptions { | ||
} | ||
declare interface QwikCityRequestOptions extends QwikCityPlan, RenderOptions { | ||
} | ||
declare class RedirectResponse { | ||
url: string; | ||
status: number; | ||
headers: Headers; | ||
location: string; | ||
constructor(url: string, status?: number, headers?: Headers); | ||
} | ||
/** | ||
* @alpha | ||
*/ | ||
declare interface RequestContext { | ||
formData(): Promise<FormData>; | ||
headers: Headers; | ||
json(): Promise<any>; | ||
method: string; | ||
text(): Promise<string>; | ||
url: string; | ||
} | ||
/** | ||
* @alpha | ||
*/ | ||
declare interface RequestEvent { | ||
request: RequestContext; | ||
response: ResponseContext; | ||
url: URL; | ||
/** URL Route params which have been parsed from the current url pathname. */ | ||
params: RouteParams; | ||
/** Platform specific data and functions */ | ||
platform: Record<string, any>; | ||
next: () => Promise<void>; | ||
abort: () => void; | ||
} | ||
/** | ||
* @alpha | ||
*/ | ||
declare type RequestHandler<BODY = unknown> = (ev: RequestEvent) => RequestHandlerResult<BODY>; | ||
declare type RequestHandlerBody<BODY> = BODY | string | number | boolean | undefined | null | void; | ||
declare type RequestHandlerBodyFunction<BODY> = () => RequestHandlerBody<BODY> | Promise<RequestHandlerBody<BODY>>; | ||
declare type RequestHandlerResult<BODY> = (RequestHandlerBody<BODY> | RequestHandlerBodyFunction<BODY>) | Promise<RequestHandlerBody<BODY> | RequestHandlerBodyFunction<BODY>>; | ||
/** | ||
* @alpha | ||
*/ | ||
declare type ResolvedDocumentHead = Required<DocumentHeadValue>; | ||
/** | ||
* @alpha | ||
*/ | ||
declare interface ResponseContext { | ||
/** | ||
* HTTP response status code. | ||
* | ||
* https://developer.mozilla.org/en-US/docs/Web/HTTP/Status | ||
*/ | ||
status: number; | ||
/** | ||
* HTTP response headers. | ||
* | ||
* https://developer.mozilla.org/en-US/docs/Glossary/Response_header | ||
*/ | ||
readonly headers: Headers; | ||
/** | ||
* URL to redirect to. When called, the response will immediately | ||
* end with the correct redirect status and headers. | ||
* Defaults to use the `307` response status code, but can be | ||
* overridden by setting the `status` argument. | ||
* | ||
* https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections | ||
*/ | ||
readonly redirect: (url: string, status?: number) => RedirectResponse; | ||
/** | ||
* When called, the response will immediately end with the given | ||
* status code. This could be useful to end a response with `404`, | ||
* and use the 404 handler in the routes directory. | ||
* See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status | ||
* for which status code should be used. | ||
*/ | ||
readonly error: (status: number) => ErrorResponse; | ||
} | ||
/** | ||
* @alpha | ||
*/ | ||
declare type RouteData = [pattern: RegExp, loaders: ModuleLoader[]] | [pattern: RegExp, loaders: ModuleLoader[], paramNames: string[]] | [pattern: RegExp, loaders: ModuleLoader[], paramNames: string[], originalPathname: string]; | ||
/** | ||
* @alpha | ||
*/ | ||
declare interface RouteLocation { | ||
readonly params: RouteParams; | ||
readonly href: string; | ||
readonly pathname: string; | ||
readonly query: Record<string, string>; | ||
} | ||
declare interface RouteModule<BODY = unknown> { | ||
onDelete?: RequestHandler<BODY>; | ||
onGet?: RequestHandler<BODY>; | ||
onHead?: RequestHandler<BODY>; | ||
onOptions?: RequestHandler<BODY>; | ||
onPatch?: RequestHandler<BODY>; | ||
onPost?: RequestHandler<BODY>; | ||
onPut?: RequestHandler<BODY>; | ||
onRequest?: RequestHandler<BODY>; | ||
} | ||
/** | ||
* @alpha | ||
*/ | ||
declare type RouteParams = Record<string, string>; | ||
declare interface StaticGenerate { | ||
params?: RouteParams[]; | ||
} | ||
/** | ||
* @alpha | ||
*/ | ||
declare type StaticGenerateHandler = () => Promise<StaticGenerate> | StaticGenerate; | ||
export { } |
declare module '@qwik-city-plan' { | ||
const qwikCityPlan: any; | ||
export default qwikCityPlan; | ||
export const routes: any[]; | ||
export const menus: any[]; | ||
export const trailingSlash: boolean; | ||
export const basePathname: string; | ||
export const cacheModules: boolean; | ||
} |
{ | ||
"name": "@builder.io/qwik-city", | ||
"version": "0.0.105", | ||
"version": "0.0.106", | ||
"description": "The meta-framework for Qwik.", | ||
@@ -32,2 +32,6 @@ "main": "./index.qwik.cjs", | ||
"require": "./vite/index.cjs" | ||
}, | ||
"./service-worker": { | ||
"import": "./service-worker.mjs", | ||
"require": "./service-worker.cjs" | ||
} | ||
@@ -51,3 +55,2 @@ }, | ||
}, | ||
"private": false, | ||
"publishConfig": { | ||
@@ -60,2 +63,4 @@ "access": "public" | ||
"index.qwik.cjs", | ||
"service-worker.mjs", | ||
"service-worker.cjs", | ||
"modules.d.ts", | ||
@@ -62,0 +67,0 @@ "middleware", |
@@ -7,6 +7,3 @@ import type { Render } from '@builder.io/qwik/server'; | ||
*/ | ||
declare interface ContentHeading { | ||
text: string; | ||
id: string; | ||
level: number; | ||
export declare interface NodeStaticGeneratorOptions extends StaticGeneratorOptions { | ||
} | ||
@@ -17,291 +14,48 @@ | ||
*/ | ||
declare interface ContentMenu { | ||
text: string; | ||
href?: string; | ||
items?: ContentMenu[]; | ||
} | ||
export declare function qwikCityGenerate(render: Render, opts: NodeStaticGeneratorOptions): Promise<void>; | ||
declare type ContentModule = PageModule | LayoutModule; | ||
declare type ContentModuleHead = DocumentHead | ResolvedDocumentHead; | ||
declare type ContentModuleLoader = () => Promise<ContentModule>; | ||
/** | ||
* @alpha | ||
*/ | ||
declare type DocumentHead<T = unknown> = DocumentHeadValue | ((props: DocumentHeadProps<GetEndpointData<T>>) => DocumentHeadValue); | ||
/** | ||
* @alpha | ||
*/ | ||
declare interface DocumentHeadProps<T = unknown> extends RouteLocation { | ||
data: T; | ||
head: ResolvedDocumentHead; | ||
declare interface QwikCityRequestOptions extends RenderOptions { | ||
} | ||
/** | ||
* @alpha | ||
*/ | ||
declare interface DocumentHeadValue { | ||
declare interface StaticGeneratorOptions extends QwikCityRequestOptions { | ||
/** | ||
* Sets `document.title`. | ||
* File system directory where the static files should be written. | ||
*/ | ||
title?: string; | ||
outDir: string; | ||
/** | ||
* Used to manually set meta tags in the head. Additionally, the `data` | ||
* property could be used to set arbitrary data which the `<head>` component | ||
* could later use to generate `<meta>` tags. | ||
* The URL `origin`, which is combination of only the scheme (protocol) and hostname (domain). | ||
* For example, `https://qwik.builder.io` has the protocol `https://` and domain `qwik.builder.io`. | ||
* However, the `origin` does not include a `pathname`. | ||
* | ||
* The `origin` is used to provide a full URL during Static Site Generation (SSG), and to | ||
* simulate a complete URL rather than just the `pathname`. For example, in order to | ||
* render a correct canonical tag URL or URLs within the `sitemap.xml`, the `origin` must | ||
* be provided too. | ||
* | ||
* If the site also starts with a pathname other than `/`, please use the `basePathname` | ||
* option in the Qwik City config options. | ||
*/ | ||
meta?: DocumentMeta[]; | ||
origin: string; | ||
/** | ||
* Used to manually append `<link>` elements to the `<head>`. | ||
* Maximum number of workers to use while generating the static pages. | ||
* Defaults to the number of CPUs available. | ||
*/ | ||
links?: DocumentLink[]; | ||
maxWorkers?: number; | ||
/** | ||
* Used to manually append `<style>` elements to the `<head>`. | ||
* Maximum number of tasks to be running at one time per worker. | ||
* Defaults to `20`. | ||
*/ | ||
styles?: DocumentStyle[]; | ||
} | ||
/** | ||
* @alpha | ||
*/ | ||
declare interface DocumentLink { | ||
as?: string; | ||
crossorigin?: string; | ||
disabled?: boolean; | ||
href?: string; | ||
hreflang?: string; | ||
id?: string; | ||
imagesizes?: string; | ||
imagesrcset?: string; | ||
integrity?: string; | ||
media?: string; | ||
prefetch?: string; | ||
referrerpolicy?: string; | ||
rel?: string; | ||
sizes?: string; | ||
title?: string; | ||
type?: string; | ||
key?: string; | ||
} | ||
/** | ||
* @alpha | ||
*/ | ||
declare interface DocumentMeta { | ||
content?: string; | ||
httpEquiv?: string; | ||
name?: string; | ||
property?: string; | ||
key?: string; | ||
} | ||
/** | ||
* @alpha | ||
*/ | ||
declare interface DocumentStyle { | ||
style: string; | ||
props?: { | ||
[propName: string]: string; | ||
}; | ||
key?: string; | ||
} | ||
declare type EndpointModuleLoader = () => Promise<RouteModule>; | ||
declare class ErrorResponse extends Error { | ||
status: number; | ||
constructor(status: number, message?: string); | ||
} | ||
declare type FallbackRouteData = [pattern: RegExp, loaders: ModuleLoader[]] | [pattern: RegExp, loaders: ModuleLoader[], paramNames: string[]]; | ||
declare type GetEndpointData<T> = T extends RequestHandler<infer U> ? U : T; | ||
declare interface LayoutModule extends RouteModule { | ||
readonly default: any; | ||
readonly head?: ContentModuleHead; | ||
} | ||
declare type MenuData = [pathname: string, menuLoader: MenuModuleLoader]; | ||
declare interface MenuModule { | ||
readonly default: ContentMenu; | ||
} | ||
declare type MenuModuleLoader = () => Promise<MenuModule>; | ||
declare type ModuleLoader = ContentModuleLoader | EndpointModuleLoader; | ||
/** | ||
* @alpha | ||
*/ | ||
export declare interface NodeStaticGeneratorOptions extends StaticGeneratorOptions { | ||
} | ||
declare interface PageModule extends RouteModule { | ||
readonly default: any; | ||
readonly head?: ContentModuleHead; | ||
readonly headings?: ContentHeading[]; | ||
readonly onStaticGenerate?: StaticGenerateHandler; | ||
} | ||
/** | ||
* @alpha | ||
*/ | ||
export declare function qwikCityGenerate(render: Render, opts: NodeStaticGeneratorOptions): Promise<void>; | ||
/** | ||
* @alpha | ||
*/ | ||
declare interface QwikCityPlan { | ||
routes?: RouteData[]; | ||
fallbackRoutes?: FallbackRouteData[]; | ||
menus?: MenuData[]; | ||
trailingSlash?: boolean; | ||
cacheModules?: boolean; | ||
} | ||
declare interface QwikCityRequestOptions extends QwikCityPlan, RenderOptions { | ||
} | ||
declare class RedirectResponse { | ||
url: string; | ||
status: number; | ||
headers: Headers; | ||
location: string; | ||
constructor(url: string, status?: number, headers?: Headers); | ||
} | ||
/** | ||
* @alpha | ||
*/ | ||
declare interface RequestContext { | ||
formData(): Promise<FormData>; | ||
headers: Headers; | ||
json(): Promise<any>; | ||
method: string; | ||
text(): Promise<string>; | ||
url: string; | ||
} | ||
/** | ||
* @alpha | ||
*/ | ||
declare interface RequestEvent { | ||
request: RequestContext; | ||
response: ResponseContext; | ||
url: URL; | ||
/** URL Route params which have been parsed from the current url pathname. */ | ||
params: RouteParams; | ||
/** Platform specific data and functions */ | ||
platform: Record<string, any>; | ||
next: () => Promise<void>; | ||
abort: () => void; | ||
} | ||
/** | ||
* @alpha | ||
*/ | ||
declare type RequestHandler<BODY = unknown> = (ev: RequestEvent) => RequestHandlerResult<BODY>; | ||
declare type RequestHandlerBody<BODY> = BODY | string | number | boolean | undefined | null | void; | ||
declare type RequestHandlerBodyFunction<BODY> = () => RequestHandlerBody<BODY> | Promise<RequestHandlerBody<BODY>>; | ||
declare type RequestHandlerResult<BODY> = (RequestHandlerBody<BODY> | RequestHandlerBodyFunction<BODY>) | Promise<RequestHandlerBody<BODY> | RequestHandlerBodyFunction<BODY>>; | ||
/** | ||
* @alpha | ||
*/ | ||
declare type ResolvedDocumentHead = Required<DocumentHeadValue>; | ||
/** | ||
* @alpha | ||
*/ | ||
declare interface ResponseContext { | ||
maxTasksPerWorker?: number; | ||
/** | ||
* HTTP response status code. | ||
* | ||
* https://developer.mozilla.org/en-US/docs/Web/HTTP/Status | ||
* File system path to write the `sitemap.xml` to. Defaults to `sitemap.xml` | ||
* and written to the root of the `outDir`. Setting to `null` will prevent | ||
* the sitemap from being created. | ||
*/ | ||
status: number; | ||
sitemapOutFile?: string; | ||
/** | ||
* HTTP response headers. | ||
* | ||
* https://developer.mozilla.org/en-US/docs/Glossary/Response_header | ||
* Log level. | ||
*/ | ||
readonly headers: Headers; | ||
/** | ||
* URL to redirect to. When called, the response will immediately | ||
* end with the correct redirect status and headers. | ||
* Defaults to use the `307` response status code, but can be | ||
* overridden by setting the `status` argument. | ||
* | ||
* https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections | ||
*/ | ||
readonly redirect: (url: string, status?: number) => RedirectResponse; | ||
/** | ||
* When called, the response will immediately end with the given | ||
* status code. This could be useful to end a response with `404`, | ||
* and use the 404 handler in the routes directory. | ||
* See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status | ||
* for which status code should be used. | ||
*/ | ||
readonly error: (status: number) => ErrorResponse; | ||
} | ||
/** | ||
* @alpha | ||
*/ | ||
declare type RouteData = [pattern: RegExp, loaders: ModuleLoader[]] | [pattern: RegExp, loaders: ModuleLoader[], paramNames: string[]] | [pattern: RegExp, loaders: ModuleLoader[], paramNames: string[], originalPathname: string]; | ||
/** | ||
* @alpha | ||
*/ | ||
declare interface RouteLocation { | ||
readonly params: RouteParams; | ||
readonly href: string; | ||
readonly pathname: string; | ||
readonly query: Record<string, string>; | ||
} | ||
declare interface RouteModule<BODY = unknown> { | ||
onDelete?: RequestHandler<BODY>; | ||
onGet?: RequestHandler<BODY>; | ||
onHead?: RequestHandler<BODY>; | ||
onOptions?: RequestHandler<BODY>; | ||
onPatch?: RequestHandler<BODY>; | ||
onPost?: RequestHandler<BODY>; | ||
onPut?: RequestHandler<BODY>; | ||
onRequest?: RequestHandler<BODY>; | ||
} | ||
/** | ||
* @alpha | ||
*/ | ||
declare type RouteParams = Record<string, string>; | ||
declare interface StaticGenerate { | ||
params?: RouteParams[]; | ||
} | ||
/** | ||
* @alpha | ||
*/ | ||
declare type StaticGenerateHandler = () => Promise<StaticGenerate> | StaticGenerate; | ||
declare interface StaticGeneratorOptions extends QwikCityRequestOptions { | ||
outDir: string; | ||
baseUrl: string; | ||
urlLoader?: () => Promise<string[]>; | ||
crawl?: boolean; | ||
maxWorkers?: number; | ||
maxTasksPerWorker?: number; | ||
log?: 'debug'; | ||
sitemapOutFile?: string; | ||
} | ||
export { } |
@@ -17,6 +17,7 @@ import { CompileOptions } from '@mdx-js/mdx/lib/compile'; | ||
/** | ||
* The base url is used to create absolute URL paths to | ||
* the hostname. Defaults to `/`. | ||
* The base pathname is used to create absolute URL paths up to | ||
* the `hostname`, and must always start and end with a | ||
* `/`. Defaults to `/`. | ||
*/ | ||
baseUrl?: string; | ||
basePathname?: string; | ||
/** | ||
@@ -30,2 +31,6 @@ * Ensure a trailing slash ends page urls. Defaults to `false`. | ||
mdx?: any; | ||
/** | ||
* @deprecated Please use "basePathname" instead. | ||
*/ | ||
baseUrl?: string; | ||
} | ||
@@ -32,0 +37,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
2172518
23
64122
25
24