htmx-router
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -8,3 +8,3 @@ const generic = `import { Parameterized, ParameterShaper } from "htmx-router/util/parameters"; | ||
loader: RenderFunction<T>, | ||
children?: JSX.Element | ||
children?: JSX.Element[] | JSX.Element | ||
}): JSX.Element { | ||
@@ -11,0 +11,0 @@ return <div |
const generic = `import { RenderMetaDescriptor, ShellOptions } from "htmx-router/shell"; | ||
export function Head<T>(props: { options: ShellOptions<T>, children: JSX.Element }) { | ||
export function Head<T>(props: { options: ShellOptions<T>, children: JSX.Element[] | JSX.Element }) { | ||
return <head> | ||
@@ -5,0 +5,0 @@ { RenderMetaDescriptor(props.options) as "safe" } |
@@ -20,2 +20,3 @@ import { ServerOnlyWarning } from "./util.js"; | ||
this.headers.set("x-powered-by", "htmx-router"); | ||
this.headers.set("content-type", "text/html"); | ||
} | ||
@@ -22,0 +23,0 @@ shape(shape) { |
{ | ||
"name": "htmx-router", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "A lightweight SSR framework with server+client islands", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -135,2 +135,4 @@ import { ServerOnlyWarning } from "./internal/util.js"; | ||
return res; | ||
if (res === null) | ||
return null; | ||
return new Response(res, { headers: ctx.headers }); | ||
@@ -158,7 +160,7 @@ } | ||
ctx.params["$"] = fragments.join("/"); | ||
const res = this.slug.resolve | ||
? await this.slug.resolve(ctx) | ||
: null; | ||
const res = await this.slug.resolve(ctx); | ||
if (res instanceof Response) | ||
return res; | ||
if (res === null) | ||
return null; | ||
return new Response(res, { headers: ctx.headers }); | ||
@@ -188,3 +190,3 @@ } | ||
async resolve(ctx) { | ||
const res = await this.renderWrapper(ctx); | ||
const res = await this.response(ctx); | ||
if (res === null) | ||
@@ -204,3 +206,3 @@ return null; | ||
} | ||
async renderWrapper(ctx) { | ||
async response(ctx) { | ||
try { | ||
@@ -207,0 +209,0 @@ if (!this.module.loader && !this.module.action) |
@@ -23,2 +23,3 @@ declare const definitions: { | ||
306: "Switch Proxy"; | ||
307: "Temporary Redirect"; | ||
308: "Permanent Redirect"; | ||
@@ -29,2 +30,3 @@ 400: "Bad Request"; | ||
403: "Forbidden"; | ||
404: "Not Found"; | ||
405: "Method Not Allowed"; | ||
@@ -67,6 +69,6 @@ 406: "Not Acceptable"; | ||
export type StatusText = typeof definitions[keyof typeof definitions]; | ||
export declare function MakeStatus(lookup: number | StatusText | string): { | ||
export declare function MakeStatus(lookup: number | StatusText): { | ||
status: number; | ||
statusText: string; | ||
statusText: StatusText; | ||
}; | ||
export {}; |
@@ -23,2 +23,3 @@ const definitions = { | ||
306: "Switch Proxy", | ||
307: "Temporary Redirect", | ||
308: "Permanent Redirect", | ||
@@ -29,2 +30,3 @@ 400: "Bad Request", | ||
403: "Forbidden", | ||
404: "Not Found", | ||
405: "Method Not Allowed", | ||
@@ -31,0 +33,0 @@ 406: "Not Acceptable", |
81415
2348
9