Releases: willybrauner/low-router
@wbe/[email protected]
Patch Changes
-
2abc0f7: export compilePath
Add missing
compilePath
export inindex.ts
@wbe/[email protected]
@wbe/[email protected]
Minor Changes
-
1cd1608: change local browserHistory listener params to object
Goal is to feat with the remix history lib api in order to switch to it easily, if needed.
before:
history.listen((location, action) => {})
after:
history.listen(({ location, action }) => {})
-
74f5122: Cleanup type generics
Patch Changes
-
b2efc1d: expose options
options
are now a public value, in order to get them from the instance.const router = new LowRouter(routes, options) console.log(router.options) // {...}
@wbe/[email protected]
Minor Changes
-
358bae8: RouteContext returns relativePathname
RouteContext returns
relativePathname
. It's the compiled path of current router instance.export interface RouteContext<A = any, C extends RouterContext = RouterContext> { pathname: string params: RouteParams query: QueryParams hash: Hash base: string route: Route<A, C> parent: RouteContext<A, C> | null + relativePathname: string }
@wbe/[email protected]
Minor Changes
-
5035b82: Externalize compile path as static method.
ex:
LowRouter.compilePath("/foo/:id")({ id: "bar" }) // "/zoo/bar"
@wbe/[email protected]
Minor Changes
-
4ce916c: Install @wbe/debug dependency
-
browser debug:
localStorage.debug = "low-router:*"
-
Node debug:
DEBUG=low-router:*
-
@wbe/[email protected]
Minor Changes
-
e02a7f3: Create resolveSync method
Resolve a route synchronously. It returns response and context without promise.
const { response, context } = router.resolveSync("/foo")
@wbe/[email protected]
Minor Changes
-
c98cc80: ## breaking change: Improve
resolve
andonResolve
params.router.resolve()
andonResolve()
option return now{response, context}
object of the matching route.before:
router.resolve("/").then((res) => { // res: "Hello home!" })
after:
router.resolve("/").then(({ response, context }) => { // response: "Hello home!" // context: RouteContext interface })
@wbe/[email protected]
Patch Changes
- 7b8d0d6: Rework types
@wbe/[email protected]
Minor Changes
- a6f0d1f: first release