bajo 2.12.1 → 2.13.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/class/bajo.js CHANGED
@@ -851,8 +851,8 @@ class Bajo extends Plugin {
851
851
  readConfig = async (file, options = {}) => {
852
852
  const { parseObject } = this.app.lib
853
853
  const { defaultsDeep } = this.app.lib.aneka
854
- const { uniq, isString, isArray, findIndex, isPlainObject } = this.app.lib._
855
- let { ns, baseNs, extend, checkOverride, pattern, ignoreError = true, defValue = {}, parserOpts = {}, globOpts = {} } = options
854
+ const { uniq, isString, isArray, findIndex, isPlainObject, merge } = this.app.lib._
855
+ let { ns, baseNs, extend, checkOverride, merge: merged, pattern, ignoreError = true, defValue = {}, parserOpts = {}, globOpts = {} } = options
856
856
 
857
857
  const getParseOptsArgs = (opts, orig) => {
858
858
  opts.parserOpts = opts.parserOpts ?? {}
@@ -884,19 +884,22 @@ class Bajo extends Plugin {
884
884
  if (checkOverride) {
885
885
  getParseOptsArgs(opts, orig)
886
886
  const fileExt = `${this.app.main.dir.pkg}/extend/${baseNs}/override/${ns}${suffix}/${_path}`
887
- const result = parseObject(await this.readConfig(fileExt, { ...opts, extend: false, checkOverride: false }))
887
+ const result = parseObject(await this.readConfig(fileExt, { ...opts, extend: false, checkOverride: false, merge: false }))
888
888
  if (!isEmpty(result)) orig = result
889
889
  }
890
890
  getParseOptsArgs(opts, orig)
891
+ const binder = merged ? merge : defaultsDeep
891
892
  for (const base of bases) {
892
893
  if (!this.app[base]) continue
893
894
  const fileExt = `${this.app[base].dir.pkg}/extend/${baseNs}/extend/${ns}${suffix}/${_path}`
894
- const result = parseObject(await this.readConfig(fileExt, { ...opts, extend: false }))
895
+ const result = parseObject(await this.readConfig(fileExt, { ...opts, extend: false, merge: false }))
895
896
  if (isEmpty(result)) continue
896
897
  if (isArray(result)) ext = [...result, ...ext]
897
- else ext = defaultsDeep({}, result, ext)
898
+ else ext = binder({}, result, ext)
898
899
  }
899
- return isArray(orig) ? [...orig, ...ext] : defaultsDeep({}, keys.length > 0 ? pick(ext, keys) : ext, orig)
900
+ if (isArray(orig)) return [...orig, ...ext]
901
+ const item = keys.length > 0 ? pick(ext, keys) : ext
902
+ return binder({}, item, orig)
900
903
  }
901
904
 
902
905
  parserOpts.readFromFile = true
@@ -103,7 +103,10 @@ class Err extends Tools {
103
103
  const detailsMessage = []
104
104
  each(value, (v, i) => {
105
105
  if (isString(v)) v = { error: v }
106
- if (!v.context) return undefined
106
+ if (!v.context) {
107
+ v.error = me.plugin.t(v.error)
108
+ return undefined
109
+ }
107
110
  v.context.message = v.message
108
111
  if (v.type === 'any.only') {
109
112
  const items = without(get(v, 'context.valids', []))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bajo",
3
- "version": "2.12.1",
3
+ "version": "2.13.0",
4
4
  "description": "The ultimate framework for whipping up massive apps in no time",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/wiki/CHANGES.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changes
2
2
 
3
+ ## 2026-04-28
4
+
5
+ - [2.13.0] Add ```options.merge``` to ```readConfig()```
6
+ - [2.13.0] Bug fix in ```err.js```
7
+
3
8
  ## 2026-04-25
4
9
 
5
10
  - [2.12.1] Bug fix in ```readConfig()```