bluera-knowledge 0.9.32 → 0.9.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/hooks/post-edit-check.sh +5 -3
- package/.claude/skills/atomic-commits/SKILL.md +3 -1
- package/.husky/pre-commit +3 -2
- package/.prettierrc +9 -0
- package/.versionrc.json +1 -1
- package/CHANGELOG.md +33 -0
- package/CLAUDE.md +6 -0
- package/README.md +25 -13
- package/bun.lock +277 -33
- package/dist/{chunk-L2YVNC63.js → chunk-6FHWC36B.js} +9 -1
- package/dist/chunk-6FHWC36B.js.map +1 -0
- package/dist/{chunk-RST4XGRL.js → chunk-DC7CGSGT.js} +288 -241
- package/dist/chunk-DC7CGSGT.js.map +1 -0
- package/dist/{chunk-6PBP5DVD.js → chunk-WFNPNAAP.js} +3212 -3054
- package/dist/chunk-WFNPNAAP.js.map +1 -0
- package/dist/{chunk-WT2DAEO7.js → chunk-Z2KKVH45.js} +548 -482
- package/dist/chunk-Z2KKVH45.js.map +1 -0
- package/dist/index.js +871 -758
- package/dist/index.js.map +1 -1
- package/dist/mcp/server.js +3 -3
- package/dist/watch.service-BJV3TI3F.js +7 -0
- package/dist/workers/background-worker-cli.js +46 -45
- package/dist/workers/background-worker-cli.js.map +1 -1
- package/eslint.config.js +43 -1
- package/package.json +18 -11
- package/plugin.json +8 -0
- package/python/requirements.txt +1 -1
- package/src/analysis/ast-parser.test.ts +12 -11
- package/src/analysis/ast-parser.ts +28 -22
- package/src/analysis/code-graph.test.ts +52 -62
- package/src/analysis/code-graph.ts +9 -13
- package/src/analysis/dependency-usage-analyzer.test.ts +91 -271
- package/src/analysis/dependency-usage-analyzer.ts +52 -24
- package/src/analysis/go-ast-parser.test.ts +22 -22
- package/src/analysis/go-ast-parser.ts +18 -25
- package/src/analysis/parser-factory.test.ts +9 -9
- package/src/analysis/parser-factory.ts +3 -3
- package/src/analysis/python-ast-parser.test.ts +27 -27
- package/src/analysis/python-ast-parser.ts +2 -2
- package/src/analysis/repo-url-resolver.test.ts +82 -82
- package/src/analysis/rust-ast-parser.test.ts +19 -19
- package/src/analysis/rust-ast-parser.ts +17 -27
- package/src/analysis/tree-sitter-parser.test.ts +3 -3
- package/src/analysis/tree-sitter-parser.ts +10 -16
- package/src/cli/commands/crawl.test.ts +40 -24
- package/src/cli/commands/crawl.ts +186 -166
- package/src/cli/commands/index-cmd.test.ts +90 -90
- package/src/cli/commands/index-cmd.ts +52 -36
- package/src/cli/commands/mcp.test.ts +6 -6
- package/src/cli/commands/mcp.ts +2 -2
- package/src/cli/commands/plugin-api.test.ts +16 -18
- package/src/cli/commands/plugin-api.ts +9 -6
- package/src/cli/commands/search.test.ts +16 -7
- package/src/cli/commands/search.ts +124 -87
- package/src/cli/commands/serve.test.ts +67 -25
- package/src/cli/commands/serve.ts +18 -3
- package/src/cli/commands/setup.test.ts +176 -101
- package/src/cli/commands/setup.ts +140 -117
- package/src/cli/commands/store.test.ts +82 -53
- package/src/cli/commands/store.ts +56 -37
- package/src/cli/program.ts +2 -2
- package/src/crawl/article-converter.test.ts +4 -1
- package/src/crawl/article-converter.ts +46 -31
- package/src/crawl/bridge.test.ts +240 -132
- package/src/crawl/bridge.ts +87 -30
- package/src/crawl/claude-client.test.ts +124 -56
- package/src/crawl/claude-client.ts +7 -15
- package/src/crawl/intelligent-crawler.test.ts +65 -22
- package/src/crawl/intelligent-crawler.ts +86 -53
- package/src/crawl/markdown-utils.ts +1 -4
- package/src/db/embeddings.ts +4 -6
- package/src/db/lance.test.ts +4 -4
- package/src/db/lance.ts +16 -12
- package/src/index.ts +26 -17
- package/src/logging/index.ts +1 -5
- package/src/logging/logger.ts +3 -5
- package/src/logging/payload.test.ts +1 -1
- package/src/logging/payload.ts +3 -5
- package/src/mcp/commands/index.ts +2 -2
- package/src/mcp/commands/job.commands.ts +12 -18
- package/src/mcp/commands/meta.commands.ts +13 -13
- package/src/mcp/commands/registry.ts +5 -8
- package/src/mcp/commands/store.commands.ts +19 -19
- package/src/mcp/handlers/execute.handler.test.ts +10 -10
- package/src/mcp/handlers/execute.handler.ts +4 -5
- package/src/mcp/handlers/index.ts +10 -14
- package/src/mcp/handlers/job.handler.test.ts +10 -10
- package/src/mcp/handlers/job.handler.ts +22 -25
- package/src/mcp/handlers/search.handler.test.ts +36 -65
- package/src/mcp/handlers/search.handler.ts +135 -104
- package/src/mcp/handlers/store.handler.test.ts +41 -52
- package/src/mcp/handlers/store.handler.ts +108 -88
- package/src/mcp/schemas/index.test.ts +73 -68
- package/src/mcp/schemas/index.ts +18 -12
- package/src/mcp/server.test.ts +1 -1
- package/src/mcp/server.ts +59 -46
- package/src/plugin/commands.test.ts +230 -95
- package/src/plugin/commands.ts +24 -25
- package/src/plugin/dependency-analyzer.test.ts +52 -52
- package/src/plugin/dependency-analyzer.ts +85 -22
- package/src/plugin/git-clone.test.ts +24 -13
- package/src/plugin/git-clone.ts +3 -7
- package/src/server/app.test.ts +109 -109
- package/src/server/app.ts +32 -23
- package/src/server/index.test.ts +64 -66
- package/src/services/chunking.service.test.ts +32 -32
- package/src/services/chunking.service.ts +16 -9
- package/src/services/code-graph.service.test.ts +30 -36
- package/src/services/code-graph.service.ts +24 -10
- package/src/services/code-unit.service.test.ts +55 -11
- package/src/services/code-unit.service.ts +85 -11
- package/src/services/config.service.test.ts +37 -18
- package/src/services/config.service.ts +30 -7
- package/src/services/index.service.test.ts +49 -18
- package/src/services/index.service.ts +98 -48
- package/src/services/index.ts +6 -9
- package/src/services/job.service.test.ts +22 -22
- package/src/services/job.service.ts +18 -18
- package/src/services/project-root.service.test.ts +1 -3
- package/src/services/search.service.test.ts +248 -120
- package/src/services/search.service.ts +286 -156
- package/src/services/services.test.ts +1 -1
- package/src/services/snippet.service.test.ts +14 -6
- package/src/services/snippet.service.ts +7 -5
- package/src/services/store.service.test.ts +68 -29
- package/src/services/store.service.ts +41 -12
- package/src/services/watch.service.test.ts +34 -14
- package/src/services/watch.service.ts +11 -1
- package/src/types/brands.test.ts +3 -1
- package/src/types/index.ts +2 -13
- package/src/types/search.ts +10 -8
- package/src/utils/type-guards.test.ts +20 -15
- package/src/utils/type-guards.ts +1 -1
- package/src/workers/background-worker-cli.ts +2 -2
- package/src/workers/background-worker.test.ts +54 -40
- package/src/workers/background-worker.ts +76 -60
- package/src/workers/spawn-worker.test.ts +22 -10
- package/src/workers/spawn-worker.ts +6 -6
- package/tests/analysis/ast-parser.test.ts +3 -3
- package/tests/analysis/code-graph.test.ts +5 -5
- package/tests/fixtures/code-snippets/api/error-handling.ts +4 -15
- package/tests/fixtures/code-snippets/api/rest-controller.ts +3 -9
- package/tests/fixtures/code-snippets/auth/jwt-auth.ts +5 -21
- package/tests/fixtures/code-snippets/auth/oauth-flow.ts +4 -4
- package/tests/fixtures/code-snippets/database/repository-pattern.ts +11 -3
- package/tests/fixtures/corpus/oss-repos/hono/src/adapter/aws-lambda/handler.ts +2 -2
- package/tests/fixtures/corpus/oss-repos/hono/src/adapter/cloudflare-pages/handler.ts +1 -1
- package/tests/fixtures/corpus/oss-repos/hono/src/adapter/cloudflare-workers/serve-static.ts +2 -2
- package/tests/fixtures/corpus/oss-repos/hono/src/client/client.ts +2 -2
- package/tests/fixtures/corpus/oss-repos/hono/src/client/types.ts +22 -20
- package/tests/fixtures/corpus/oss-repos/hono/src/context.ts +13 -10
- package/tests/fixtures/corpus/oss-repos/hono/src/helper/accepts/accepts.ts +10 -7
- package/tests/fixtures/corpus/oss-repos/hono/src/helper/adapter/index.ts +2 -2
- package/tests/fixtures/corpus/oss-repos/hono/src/helper/css/index.ts +1 -1
- package/tests/fixtures/corpus/oss-repos/hono/src/helper/factory/index.ts +16 -16
- package/tests/fixtures/corpus/oss-repos/hono/src/helper/ssg/ssg.ts +2 -2
- package/tests/fixtures/corpus/oss-repos/hono/src/hono-base.ts +3 -3
- package/tests/fixtures/corpus/oss-repos/hono/src/hono.ts +1 -1
- package/tests/fixtures/corpus/oss-repos/hono/src/jsx/dom/css.ts +2 -2
- package/tests/fixtures/corpus/oss-repos/hono/src/jsx/dom/intrinsic-element/components.ts +1 -1
- package/tests/fixtures/corpus/oss-repos/hono/src/jsx/dom/render.ts +7 -7
- package/tests/fixtures/corpus/oss-repos/hono/src/jsx/hooks/index.ts +3 -3
- package/tests/fixtures/corpus/oss-repos/hono/src/jsx/intrinsic-element/components.ts +1 -1
- package/tests/fixtures/corpus/oss-repos/hono/src/jsx/utils.ts +6 -6
- package/tests/fixtures/corpus/oss-repos/hono/src/middleware/jsx-renderer/index.ts +3 -3
- package/tests/fixtures/corpus/oss-repos/hono/src/middleware/serve-static/index.ts +1 -1
- package/tests/fixtures/corpus/oss-repos/hono/src/preset/quick.ts +1 -1
- package/tests/fixtures/corpus/oss-repos/hono/src/preset/tiny.ts +1 -1
- package/tests/fixtures/corpus/oss-repos/hono/src/router/pattern-router/router.ts +2 -2
- package/tests/fixtures/corpus/oss-repos/hono/src/router/reg-exp-router/node.ts +4 -4
- package/tests/fixtures/corpus/oss-repos/hono/src/router/reg-exp-router/router.ts +1 -1
- package/tests/fixtures/corpus/oss-repos/hono/src/router/trie-router/node.ts +1 -1
- package/tests/fixtures/corpus/oss-repos/hono/src/types.ts +166 -169
- package/tests/fixtures/corpus/oss-repos/hono/src/utils/body.ts +8 -8
- package/tests/fixtures/corpus/oss-repos/hono/src/utils/color.ts +3 -3
- package/tests/fixtures/corpus/oss-repos/hono/src/utils/cookie.ts +2 -2
- package/tests/fixtures/corpus/oss-repos/hono/src/utils/encode.ts +2 -2
- package/tests/fixtures/corpus/oss-repos/hono/src/utils/types.ts +30 -33
- package/tests/fixtures/corpus/oss-repos/hono/src/validator/validator.ts +2 -2
- package/tests/fixtures/test-server.ts +3 -2
- package/tests/helpers/performance-metrics.ts +8 -25
- package/tests/helpers/search-relevance.ts +14 -69
- package/tests/integration/cli-consistency.test.ts +5 -4
- package/tests/integration/python-bridge.test.ts +13 -3
- package/tests/mcp/server.test.ts +1 -1
- package/tests/services/code-unit.service.test.ts +48 -0
- package/tests/services/job.service.test.ts +124 -0
- package/tests/services/search.progressive-context.test.ts +2 -2
- package/.claude-plugin/plugin.json +0 -13
- package/dist/chunk-6PBP5DVD.js.map +0 -1
- package/dist/chunk-L2YVNC63.js.map +0 -1
- package/dist/chunk-RST4XGRL.js.map +0 -1
- package/dist/chunk-WT2DAEO7.js.map +0 -1
- package/dist/watch.service-YAIKKDCF.js +0 -7
- package/skills/atomic-commits/SKILL.md +0 -77
- /package/dist/{watch.service-YAIKKDCF.js.map → watch.service-BJV3TI3F.js.map} +0 -0
|
@@ -169,7 +169,7 @@ export interface ToSSGOptions {
|
|
|
169
169
|
export const fetchRoutesContent = function* <
|
|
170
170
|
E extends Env = Env,
|
|
171
171
|
S extends Schema = {},
|
|
172
|
-
BasePath extends string = '/'
|
|
172
|
+
BasePath extends string = '/',
|
|
173
173
|
>(
|
|
174
174
|
app: Hono<E, S, BasePath>,
|
|
175
175
|
beforeRequestHook?: BeforeRequestHook,
|
|
@@ -323,7 +323,7 @@ export interface ToSSGInterface {
|
|
|
323
323
|
export interface ToSSGAdaptorInterface<
|
|
324
324
|
E extends Env = Env,
|
|
325
325
|
S extends Schema = {},
|
|
326
|
-
BasePath extends string = '/'
|
|
326
|
+
BasePath extends string = '/',
|
|
327
327
|
> {
|
|
328
328
|
(app: Hono<E, S, BasePath>, options?: ToSSGOptions): Promise<ToSSGResult>
|
|
329
329
|
}
|
|
@@ -171,7 +171,7 @@ class Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string =
|
|
|
171
171
|
const strict = options.strict ?? true
|
|
172
172
|
delete options.strict
|
|
173
173
|
Object.assign(this, options)
|
|
174
|
-
this.getPath = strict ? options.getPath ?? getPath : getPathNoStrict
|
|
174
|
+
this.getPath = strict ? (options.getPath ?? getPath) : getPathNoStrict
|
|
175
175
|
}
|
|
176
176
|
|
|
177
177
|
private clone(): Hono<E, S, BasePath> {
|
|
@@ -208,7 +208,7 @@ class Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string =
|
|
|
208
208
|
SubPath extends string,
|
|
209
209
|
SubEnv extends Env,
|
|
210
210
|
SubSchema extends Schema,
|
|
211
|
-
SubBasePath extends string
|
|
211
|
+
SubBasePath extends string,
|
|
212
212
|
>(
|
|
213
213
|
path: SubPath,
|
|
214
214
|
app: Hono<SubEnv, SubSchema, SubBasePath>
|
|
@@ -434,7 +434,7 @@ class Hono<E extends Env = Env, S extends Schema = {}, BasePath extends string =
|
|
|
434
434
|
resolved || (c.finalized ? c.res : this.notFoundHandler(c))
|
|
435
435
|
)
|
|
436
436
|
.catch((err: Error) => this.handleError(err, c))
|
|
437
|
-
: res ?? this.notFoundHandler(c)
|
|
437
|
+
: (res ?? this.notFoundHandler(c))
|
|
438
438
|
}
|
|
439
439
|
|
|
440
440
|
const composed = compose<Context>(matchResult[0], this.errorHandler, this.notFoundHandler)
|
|
@@ -16,7 +16,7 @@ import type { BlankEnv, BlankSchema, Env, Schema } from './types'
|
|
|
16
16
|
export class Hono<
|
|
17
17
|
E extends Env = BlankEnv,
|
|
18
18
|
S extends Schema = BlankSchema,
|
|
19
|
-
BasePath extends string = '/'
|
|
19
|
+
BasePath extends string = '/',
|
|
20
20
|
> extends HonoBase<E, S, BasePath> {
|
|
21
21
|
/**
|
|
22
22
|
* Creates an instance of the Hono class.
|
|
@@ -66,7 +66,7 @@ interface CreateCssJsxDomObjectsType {
|
|
|
66
66
|
{
|
|
67
67
|
toString(this: CssClassName): string
|
|
68
68
|
},
|
|
69
|
-
FC<PropsWithChildren<void
|
|
69
|
+
FC<PropsWithChildren<void>>,
|
|
70
70
|
]
|
|
71
71
|
}
|
|
72
72
|
|
|
@@ -133,7 +133,7 @@ export const createCssJsxDomObjects: CreateCssJsxDomObjectsType = ({ id }) => {
|
|
|
133
133
|
),
|
|
134
134
|
},
|
|
135
135
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
136
|
-
} as any
|
|
136
|
+
}) as any
|
|
137
137
|
|
|
138
138
|
return [cssObject, Style] as const
|
|
139
139
|
}
|
|
@@ -108,7 +108,7 @@ const documentMetadataTag = (
|
|
|
108
108
|
existingElements = head.querySelectorAll<HTMLElement>(tag)
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
precedence = supportSort ? precedence ?? '' : undefined
|
|
111
|
+
precedence = supportSort ? (precedence ?? '') : undefined
|
|
112
112
|
if (supportSort) {
|
|
113
113
|
restProps[dataPrecedenceAttr] = precedence
|
|
114
114
|
}
|
|
@@ -51,7 +51,7 @@ export type NodeObject = {
|
|
|
51
51
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
52
52
|
any[][], // stash for hooks
|
|
53
53
|
LocalJSXContexts, // context
|
|
54
|
-
[Context, Function, NodeObject] // [context, error handler, node] for closest error boundary or suspense
|
|
54
|
+
[Context, Function, NodeObject], // [context, error handler, node] for closest error boundary or suspense
|
|
55
55
|
]
|
|
56
56
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
57
57
|
| [number, any[][]]
|
|
@@ -88,7 +88,7 @@ export type Context =
|
|
|
88
88
|
UpdateHook, // update hook
|
|
89
89
|
boolean, // is in view transition
|
|
90
90
|
boolean, // is in top level render
|
|
91
|
-
[Context, Function, NodeObject][] // [context, error handler, node] stack for this context
|
|
91
|
+
[Context, Function, NodeObject][], // [context, error handler, node] stack for this context
|
|
92
92
|
]
|
|
93
93
|
| [PendingType, boolean, UpdateHook, boolean]
|
|
94
94
|
| [PendingType, boolean, UpdateHook]
|
|
@@ -462,8 +462,8 @@ export const build = (context: Context, node: NodeObject, children?: Child[]): v
|
|
|
462
462
|
const oldVChildren: Node[] | undefined = buildWithPreviousChildren
|
|
463
463
|
? [...(node.pC as Node[])]
|
|
464
464
|
: node.vC
|
|
465
|
-
|
|
466
|
-
|
|
465
|
+
? [...node.vC]
|
|
466
|
+
: undefined
|
|
467
467
|
const vChildren: Node[] = []
|
|
468
468
|
let prevNode: Node | undefined
|
|
469
469
|
for (let i = 0; i < children.length; i++) {
|
|
@@ -491,8 +491,8 @@ export const build = (context: Context, node: NodeObject, children?: Child[]): v
|
|
|
491
491
|
isNodeString(child)
|
|
492
492
|
? (c) => isNodeString(c)
|
|
493
493
|
: child.key !== undefined
|
|
494
|
-
|
|
495
|
-
|
|
494
|
+
? (c) => c.key === (child as Node).key && c.tag === (child as Node).tag
|
|
495
|
+
: (c) => c.tag === (child as Node).tag
|
|
496
496
|
)
|
|
497
497
|
|
|
498
498
|
if (i !== -1) {
|
|
@@ -769,4 +769,4 @@ export const createPortal = (children: Child, container: HTMLElement, key?: stri
|
|
|
769
769
|
e: container,
|
|
770
770
|
p: 1,
|
|
771
771
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
772
|
-
} as any
|
|
772
|
+
}) as any
|
|
@@ -16,7 +16,7 @@ export type EffectData = [
|
|
|
16
16
|
(() => void | (() => void)) | undefined, // layout effect
|
|
17
17
|
(() => void) | undefined, // cleanup
|
|
18
18
|
(() => void) | undefined, // effect
|
|
19
|
-
(() => void) | undefined // insertion effect
|
|
19
|
+
(() => void) | undefined, // insertion effect
|
|
20
20
|
]
|
|
21
21
|
|
|
22
22
|
const resolvedPromiseValueMap: WeakMap<Promise<unknown>, unknown> = new WeakMap<
|
|
@@ -36,7 +36,7 @@ const isDepsChanged = (
|
|
|
36
36
|
let viewTransitionState:
|
|
37
37
|
| [
|
|
38
38
|
boolean, // isUpdating
|
|
39
|
-
boolean // useViewTransition() is called
|
|
39
|
+
boolean, // useViewTransition() is called
|
|
40
40
|
]
|
|
41
41
|
| undefined = undefined
|
|
42
42
|
|
|
@@ -208,7 +208,7 @@ export const useState: UseStateType = <T>(
|
|
|
208
208
|
if (pendingStack.length) {
|
|
209
209
|
const [pendingType, pendingPromise] = pendingStack.at(-1) as [
|
|
210
210
|
PendingType | 3,
|
|
211
|
-
Promise<void
|
|
211
|
+
Promise<void>,
|
|
212
212
|
]
|
|
213
213
|
Promise.all([
|
|
214
214
|
pendingType === 3
|
|
@@ -85,7 +85,7 @@ const documentMetadataTag = (tag: string, children: Child, props: Props, sort: b
|
|
|
85
85
|
|
|
86
86
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
87
87
|
let { precedence, blocking, ...restProps } = props
|
|
88
|
-
precedence = sort ? precedence ?? '' : undefined
|
|
88
|
+
precedence = sort ? (precedence ?? '') : undefined
|
|
89
89
|
if (sort) {
|
|
90
90
|
restProps[dataPrecedenceAttr] = precedence
|
|
91
91
|
}
|
|
@@ -25,12 +25,12 @@ export const styleObjectForEach = (
|
|
|
25
25
|
v == null
|
|
26
26
|
? null
|
|
27
27
|
: typeof v === 'number'
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
? !key.match(
|
|
29
|
+
/^(?:a|border-im|column(?:-c|s)|flex(?:$|-[^b])|grid-(?:ar|[^a])|font-w|li|or|sca|st|ta|wido|z)|ty$/
|
|
30
|
+
)
|
|
31
|
+
? `${v}px`
|
|
32
|
+
: `${v}`
|
|
33
|
+
: v
|
|
34
34
|
)
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -37,8 +37,8 @@ const createRenderer =
|
|
|
37
37
|
typeof options?.docType === 'string'
|
|
38
38
|
? options.docType
|
|
39
39
|
: options?.docType === false
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
? ''
|
|
41
|
+
: '<!DOCTYPE html>'
|
|
42
42
|
|
|
43
43
|
const currentLayout = component
|
|
44
44
|
? jsx(
|
|
@@ -148,7 +148,7 @@ export const jsxRenderer = (
|
|
|
148
148
|
export const useRequestContext = <
|
|
149
149
|
E extends Env = any,
|
|
150
150
|
P extends string = any,
|
|
151
|
-
I extends Input = {}
|
|
151
|
+
I extends Input = {},
|
|
152
152
|
>(): Context<E, P, I> => {
|
|
153
153
|
const c = useContext(RequestContext)
|
|
154
154
|
if (!c) {
|
|
@@ -97,7 +97,7 @@ export const serveStatic = <E extends Env = Env>(
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
const mimeType = options.mimes
|
|
100
|
-
? getMimeType(path, options.mimes) ?? getMimeType(path)
|
|
100
|
+
? (getMimeType(path, options.mimes) ?? getMimeType(path))
|
|
101
101
|
: getMimeType(path)
|
|
102
102
|
|
|
103
103
|
if (mimeType) {
|
|
@@ -13,7 +13,7 @@ import type { BlankEnv, BlankSchema, Env, Schema } from '../types'
|
|
|
13
13
|
export class Hono<
|
|
14
14
|
E extends Env = BlankEnv,
|
|
15
15
|
S extends Schema = BlankSchema,
|
|
16
|
-
BasePath extends string = '/'
|
|
16
|
+
BasePath extends string = '/',
|
|
17
17
|
> extends HonoBase<E, S, BasePath> {
|
|
18
18
|
constructor(options: HonoOptions<E> = {}) {
|
|
19
19
|
super(options)
|
|
@@ -11,7 +11,7 @@ import type { BlankEnv, BlankSchema, Env, Schema } from '../types'
|
|
|
11
11
|
export class Hono<
|
|
12
12
|
E extends Env = BlankEnv,
|
|
13
13
|
S extends Schema = BlankSchema,
|
|
14
|
-
BasePath extends string = '/'
|
|
14
|
+
BasePath extends string = '/',
|
|
15
15
|
> extends HonoBase<E, S, BasePath> {
|
|
16
16
|
constructor(options: HonoOptions<E> = {}) {
|
|
17
17
|
super(options)
|
|
@@ -23,8 +23,8 @@ export class PatternRouter<T> implements Router<T> {
|
|
|
23
23
|
return match
|
|
24
24
|
? `/(?<${match[1]}>${match[2] || '[^/]+'})`
|
|
25
25
|
: part === '/*'
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
? '/[^/]+'
|
|
27
|
+
: part.replace(/[.\\+*[^\]$()]/g, '\\$&')
|
|
28
28
|
}
|
|
29
29
|
)
|
|
30
30
|
|
|
@@ -73,8 +73,8 @@ export class Node {
|
|
|
73
73
|
? ['', '', ONLY_WILDCARD_REG_EXP_STR] // '*' matches to all the trailing paths
|
|
74
74
|
: ['', '', LABEL_REG_EXP_STR]
|
|
75
75
|
: token === '/*'
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
? ['', '', TAIL_WILDCARD_REG_EXP_STR] // '/path/to/*' is /\/path\/to(?:|/.*)$
|
|
77
|
+
: token.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/)
|
|
78
78
|
|
|
79
79
|
let node
|
|
80
80
|
if (pattern) {
|
|
@@ -138,8 +138,8 @@ export class Node {
|
|
|
138
138
|
(typeof c.varIndex === 'number'
|
|
139
139
|
? `(${k})@${c.varIndex}`
|
|
140
140
|
: regExpMetaChars.has(k)
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
? `\\${k}`
|
|
142
|
+
: k) + c.buildRegExpStr()
|
|
143
143
|
)
|
|
144
144
|
})
|
|
145
145
|
|
|
@@ -259,7 +259,7 @@ export class RegExpRouter<T> implements Router<T> {
|
|
|
259
259
|
routes.push(
|
|
260
260
|
...(Object.keys(r[METHOD_NAME_ALL]).map((path) => [path, r[METHOD_NAME_ALL][path]]) as [
|
|
261
261
|
string,
|
|
262
|
-
HandlerWithMetadata<T>[]
|
|
262
|
+
HandlerWithMetadata<T>[],
|
|
263
263
|
][])
|
|
264
264
|
)
|
|
265
265
|
}
|
|
@@ -103,7 +103,7 @@ export class Node<T> {
|
|
|
103
103
|
handlerSet.possibleKeys.forEach((key) => {
|
|
104
104
|
const processed = processedSet[handlerSet.name]
|
|
105
105
|
handlerSet.params[key] =
|
|
106
|
-
params[key] && !processed ? params[key] : nodeParams[key] ?? params[key]
|
|
106
|
+
params[key] && !processed ? params[key] : (nodeParams[key] ?? params[key])
|
|
107
107
|
processedSet[handlerSet.name] = true
|
|
108
108
|
})
|
|
109
109
|
handlerSets.push(handlerSet)
|