Compare commits

..

No commits in common. "5ed8673274187958e3bee569aba0d33baf605bb1" and "b9b5641b26dc660685e9dc88d283b3227c628b7e" have entirely different histories.

2 changed files with 6 additions and 12 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@because/hype", "name": "@_because/hype",
"version": "0.0.1", "version": "0.1.2",
"module": "src/index.tsx", "module": "src/index.tsx",
"type": "module", "type": "module",
"exports": { "exports": {

View File

@ -24,10 +24,9 @@ export type HypeProps = {
reset?: boolean reset?: boolean
prettyHTML?: boolean prettyHTML?: boolean
layout?: boolean layout?: boolean
router?: boolean
} }
type InternalProps = HypeProps & { _isRouter?: boolean }
export type SSEHandler<E extends Env> = ( export type SSEHandler<E extends Env> = (
send: (data: unknown, event?: string) => Promise<void>, send: (data: unknown, event?: string) => Promise<void>,
c: Context<E> c: Context<E>
@ -42,17 +41,12 @@ export class Hype<
middlewareRegistered = false middlewareRegistered = false
routesRegistered = false routesRegistered = false
constructor(props?: InternalProps & ConstructorParameters<typeof Hono<E, S, BasePath>>[0]) { constructor(props?: HypeProps & ConstructorParameters<typeof Hono<E, S, BasePath>>[0]) {
super(props) super(props)
this.props = props ?? {} this.props = props ?? {}
if (!props?._isRouter) { if (!this.props.router)
this.registerMiddleware() this.registerMiddleware()
}
}
static router<E extends Env = Env>(): Hype<E> {
return new Hype<E>({ _isRouter: true })
} }
sse(path: string, handler: SSEHandler<E>) { sse(path: string, handler: SSEHandler<E>) {