bajo-template 2.9.2 → 2.9.3
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 +6 -6
- package/package.json +1 -1
- package/wiki/CHANGES.md +4 -0
package/index.js
CHANGED
|
@@ -315,7 +315,7 @@ async function factory (pkgName) {
|
|
|
315
315
|
* @returns {string|null} - Found file path or null
|
|
316
316
|
*/
|
|
317
317
|
_findFile = (options = {}) => {
|
|
318
|
-
const { type, ns, subSubNs, dir, base, exts, theme, req } = options
|
|
318
|
+
const { type, ns, subSubNs, dir, base, exts, theme, req, item } = options
|
|
319
319
|
const checking = ({ check, info }) => {
|
|
320
320
|
const { fs } = this.app.lib
|
|
321
321
|
let file
|
|
@@ -327,8 +327,8 @@ async function factory (pkgName) {
|
|
|
327
327
|
break
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
|
-
if (this.config.log.resolver) {
|
|
331
|
-
this.log.trace('Checking %s for "%s" -> %s', info, base, check)
|
|
330
|
+
if (this.config.log.resolver === type) {
|
|
331
|
+
this.log.trace('%s => Checking %s for "%s" -> %s', item, info, base, check)
|
|
332
332
|
if (file) this.log.trace('OK: %s', file)
|
|
333
333
|
else this.log.trace('Failed')
|
|
334
334
|
}
|
|
@@ -399,7 +399,7 @@ async function factory (pkgName) {
|
|
|
399
399
|
const { isEmpty } = this.app.lib._
|
|
400
400
|
const { parseWithConfig } = this.app.bajo
|
|
401
401
|
const { parseObject } = this.app.lib
|
|
402
|
-
const result = await parseWithConfig(input)
|
|
402
|
+
const result = await parseWithConfig(input, null, { defValue: {} })
|
|
403
403
|
if (isEmpty(result)) return {}
|
|
404
404
|
return parseObject(result, { parseValue: false, lang }) ?? {}
|
|
405
405
|
}
|
|
@@ -507,7 +507,7 @@ async function factory (pkgName) {
|
|
|
507
507
|
if (opts.lang) exts.unshift(`.${opts.lang}${ext}`)
|
|
508
508
|
let theme
|
|
509
509
|
if (opts.theme && this.app.waibuMpa && opts.req) theme = find(this.app.waibuMpa.themes, { name: opts.theme })
|
|
510
|
-
let file = this._findFile({ type, ns, subSubNs, dir, base, exts, theme, req: opts.req })
|
|
510
|
+
let file = this._findFile({ type, ns, subSubNs, dir, base, exts, theme, req: opts.req, item })
|
|
511
511
|
if (!file) {
|
|
512
512
|
if (fallbackHandler) file = fallbackHandler.call(this, { dir, base, exts, ns, subSubNs, type, theme, req: opts.req })
|
|
513
513
|
if (opts.default) {
|
|
@@ -533,7 +533,7 @@ async function factory (pkgName) {
|
|
|
533
533
|
const fallbackHandler = ({ type, ns, subSubNs, dir, exts, theme, req }) => {
|
|
534
534
|
if (!this.config.layout.fallback) return false
|
|
535
535
|
const base = 'default'
|
|
536
|
-
return this._findFile({ type, ns, subSubNs, dir, base, exts, theme, req })
|
|
536
|
+
return this._findFile({ type, ns, subSubNs, dir, base, exts, theme, req, item })
|
|
537
537
|
}
|
|
538
538
|
|
|
539
539
|
return this.resolveResource('layout', item, opts, fallbackHandler)
|
package/package.json
CHANGED