Skip to report

RegExpRouter joins Hono’s trie router

Trace Hono’s RegExpRouter, which combines routes into regular-expression matchers, through the shared router interface an app selects when it is created.

honojs/hono #109 · PR by usualoma · Merged

honojs/hono ea329b83..ad570f2b

base and head as given

  • Route matching is selectable when applications are created.
  • A regular-expression router joins the built-in trie router.
  • The regular-expression router uses the shared routing interface.
files changed
10
in a component
8
lines in components
375
components
3
public routes changed
0
schema statements
0
new dependencies
0
excluded by role
2
Based on 8 of 8 eligible changed files

Selectable route matching

Added
Before
Only trie routing was available
After
Trie or regex routing is selectable

Applications can select regular-expression route matching when created. The matcher combines routes by method, supports parameters and wildcards, includes all-method middleware, and discards registered route lists after building matchers.

In favour

  • In favour: Reuses one routing contract for default and alternate matchers
  • In favour: Releases registered routes after building matchers

Against

  • Against: Regex routers reject routes after their first match
Files changed in 3 components. Dependencies shown: 1 new
new · 11 component added

1 new dependency between components — Reg Exp Router → Source

What else could behave differently

2 components · 6 files

These components import changed code, directly or through other files. A traced dependency is a place to review, not a confirmed runtime failure.

Reached 2

ComponentSymbolCited atFilesReached by
Sourcesrc/Signature changed 1 of 6 changed symbols reaching itsrc/hono.ts:55-22933 direct
Trace path

Shortest component path from the changed symbol:

  1. Source

Later steps follow file imports; they do not prove this symbol is called.

Reg Exp Routersrc/router/reg-exp-router/Added 1 of 9 changed symbols reaching itsrc/router.ts:133 direct
Trace path

Shortest component path from the changed symbol:

  1. Source
  2. Reg Exp Router

Later steps follow file imports; they do not prove this symbol is called.

Statements 2

Hono's signature changed and reached 3 files in Source; 4 of 10 names changed in its origin file. 3
src/hono.ts:55-229
METHOD_NAME_OF_ALL was added and reached 3 files in Reg Exp Router. 3
src/router.ts:1

14 reached files belong to no component — tests, docs and config.

Routes, schema, dependencies

No public URL, no migration and no new package.

Inspect components, files and symbols

Component

SourceModified
src/

3 files · 51 lines

2 dependents

Source exported the new TrieRouter name.
Handle Event BenchmarksModified
benchmarks/handle-event/

1 file · 47 lines

Reg Exp RouterAdded
src/router/reg-exp-router/

4 files · 277 lines

Reg Exp Router exported six new names: Context, Node, ParamMap, RegExpRouter, ReplacementMap, and Trie.

File

Sourcesrc/
src/hono.ts

+12 −12

Sourcesrc/
src/router.ts

+15 −0

Sourcesrc/
src/node.ts

+1 −11

Handle Event Benchmarksbenchmarks/handle-event/
benchmarks/handle-event/index.js

+29 −18

Reg Exp Routersrc/router/reg-exp-router/
src/router/reg-exp-router/router.ts

+119 −0

Reg Exp Routersrc/router/reg-exp-router/
src/router/reg-exp-router/node.ts

+110 −0

Reg Exp Routersrc/router/reg-exp-router/
src/router/reg-exp-router/trie.ts

+47 −0

Reg Exp Routersrc/router/reg-exp-router/
src/router/reg-exp-router/index.ts

+1 −0

Diff

Sourcesrc/
src/hono.ts

1–1, 6–7, 38–38 and 7 more spans

Sourcesrc/
src/router.ts

1–15

Sourcesrc/
src/node.ts

3–3

Handle Event Benchmarksbenchmarks/handle-event/
benchmarks/handle-event/index.js

4–4, 12–29, 31–35 and 2 more spans

Reg Exp Routersrc/router/reg-exp-router/
src/router/reg-exp-router/router.ts

1–119

Reg Exp Routersrc/router/reg-exp-router/
src/router/reg-exp-router/node.ts

1–110

Reg Exp Routersrc/router/reg-exp-router/
src/router/reg-exp-router/trie.ts

1–47

Reg Exp Routersrc/router/reg-exp-router/
src/router/reg-exp-router/index.ts

1–1

Analysis scope

121 → 3
  1. 121
    files at head
  2. 8
    components
  3. 3
    changed by this change

Where the new files landed

5 new files
New fileBelongs toUsed byCallsServes
src/router.ts
Sourcebase frame
Reg Exp Router
nothing outside its own component
src/router/reg-exp-router/4 new files
Reg Exp Routernew territory
its own component only — 1 of 4 files imported by nothing
Source

1 added file carries no component — 1 test.

3components changed
0reached, not changed
1components added/removed
1dependencies added between components
0dependencies removed between components
0files moved to another path

10 files changed, 7 claims stated. 2 components reached in total.

naming: “model

narrative: “model

analyzer 0.2.0, config v1.9.0-phase8

Every line above is derived from ea329b83..ad570f2b and nothing else.