waibu 2.3.4 → 2.4.0

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/index.js CHANGED
@@ -458,7 +458,7 @@ async function factory (pkgName) {
458
458
  const { defaultsDeep } = this.app.lib.aneka
459
459
  const { isEmpty, get, trimEnd, trimStart } = this.app.lib._
460
460
  const { breakNsPath } = this.app.bajo
461
- const { query = {}, base = this.ns, params = {}, guessHost } = options
461
+ const { query = {}, base = this.ns, params = {}, guessHost, defaults = {} } = options
462
462
 
463
463
  const plugin = getPlugin(base)
464
464
  const cfg = plugin.config ?? {}
@@ -474,7 +474,12 @@ async function factory (pkgName) {
474
474
  if (info.path.includes('//')) return info.path
475
475
 
476
476
  info.path = info.path.split('/').map(p => {
477
- return p[0] === ':' && params[p.slice(1)] ? params[p.slice(1)] : p
477
+ if (!(p[0] === ':' || (p[0] === '{' && p[p.length - 1] === '}'))) return p
478
+ const _p = p
479
+ p = p.replace(':', '').replace('{', '').replace('}', '')
480
+ if (params[p]) return params[p]
481
+ if (defaults[p]) return defaults[p]
482
+ return _p
478
483
  }).join('/')
479
484
  let url = info.path
480
485
  const langDetector = get(cfg, 'intl.detectors', [])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "waibu",
3
- "version": "2.3.4",
3
+ "version": "2.4.0",
4
4
  "description": "Web Framework for Bajo",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/wiki/CHANGES.md CHANGED
@@ -5,6 +5,7 @@
5
5
  - [2.3.4] Bug fix on error handling
6
6
  - [2.3.4] Bug fix on not found handling
7
7
  - [2.3.4] Bug fix on redirection handling
8
+ - [2.4.0] Accept path parameter as in ```{param}``` to complement ```:param``` in ```routePath()```
8
9
 
9
10
  ## 2026-02-08
10
11