From 65ee95ca0c45a7a4adbc56c4bfadda0f2fd102ff Mon Sep 17 00:00:00 2001 From: Chris Wanstrath Date: Thu, 29 Jan 2026 19:34:55 -0800 Subject: [PATCH] v0.1.3 --- package.json | 4 ++-- src/index.tsx | 12 +++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 6ea8dfb..8f055dd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@_because/hype", - "version": "0.1.2", + "version": "0.1.3", "module": "src/index.tsx", "type": "module", "exports": { @@ -26,4 +26,4 @@ "hono": "^4.10.4", "kleur": "^4.1.5" } -} \ No newline at end of file +} diff --git a/src/index.tsx b/src/index.tsx index a99e399..7f6432a 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -24,9 +24,10 @@ export type HypeProps = { reset?: boolean prettyHTML?: boolean layout?: boolean - router?: boolean } +type InternalProps = HypeProps & { _isRouter?: boolean } + export type SSEHandler = ( send: (data: unknown, event?: string) => Promise, c: Context @@ -41,12 +42,17 @@ export class Hype< middlewareRegistered = false routesRegistered = false - constructor(props?: HypeProps & ConstructorParameters>[0]) { + constructor(props?: InternalProps & ConstructorParameters>[0]) { super(props) this.props = props ?? {} - if (!this.props.router) + if (!props?._isRouter) { this.registerMiddleware() + } + } + + static router(): Hype { + return new Hype({ _isRouter: true }) } sse(path: string, handler: SSEHandler) {