bajo 2.12.0 → 2.12.1

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
@@ -852,32 +852,42 @@ class Bajo extends Plugin {
852
852
  const { parseObject } = this.app.lib
853
853
  const { defaultsDeep } = this.app.lib.aneka
854
854
  const { uniq, isString, isArray, findIndex, isPlainObject } = this.app.lib._
855
- let { ns, baseNs, extend, pattern, ignoreError = true, defValue = {}, parserOpts = {}, globOpts = {} } = options
855
+ let { ns, baseNs, extend, checkOverride, pattern, ignoreError = true, defValue = {}, parserOpts = {}, globOpts = {} } = options
856
+
857
+ const getParseOptsArgs = (opts, orig) => {
858
+ opts.parserOpts = opts.parserOpts ?? {}
859
+ opts.parserOpts.args = opts.parserOpts.args ?? []
860
+ const idx = findIndex(opts.parserOpts.args, item => {
861
+ return isPlainObject(item) && Object.keys(item)[0] === '_orig'
862
+ })
863
+ if (idx > -1) opts.parserOpts.args[idx] = { _orig: orig }
864
+ else opts.parserOpts.args.push({ _orig: orig })
865
+ }
856
866
 
857
867
  const output = async (obj) => {
858
- const orig = parseObject(obj)
868
+ let orig = parseObject(obj)
859
869
  if (!baseNs || extend === false) return orig
860
870
  const { suffix = '', keys = [] } = options
861
871
  let bases = this.app.getAllNs()
862
872
  if (isString(extend)) extend = extend.split(',').map(i => i.trim)
863
873
  if (isArray(extend)) bases = [...extend, 'main']
864
874
  bases = uniq(bases)
865
- let ext = isArray(obj) ? [] : {}
875
+ let ext = isArray(orig) ? [] : {}
866
876
  const dir = this.app[ns].dir.pkg
867
877
  let [names, _path] = file.split(':')
868
878
  if (file.slice(0, names.length + 1) !== `${ns}:`) _path = file.slice(dir.length + 1)
869
879
  if (_path.startsWith('extend/')) _path = _path.slice(7)
870
880
  if (_path.startsWith(`${baseNs}/`)) _path = _path.slice(baseNs.length + 1)
871
881
  _path = _path.slice(0, -(path.extname(_path).length)) + '.*'
882
+ // check for override? Override only exists in main plugin
872
883
  const opts = omit(options, ['suffix', 'keys', 'extend'])
873
- opts.parserOpts = opts.parserOpts ?? {}
874
- opts.parserOpts.args = opts.parserOpts.args ?? []
875
- const idx = findIndex(opts.parserOpts.args, item => {
876
- return isPlainObject(item) && Object.keys(item)[0] === '_orig'
877
- })
878
- if (idx > -1) opts.parserOpts.args[idx] = { _orig: orig }
879
- else opts.parserOpts.args.push({ _orig: orig })
880
-
884
+ if (checkOverride) {
885
+ getParseOptsArgs(opts, orig)
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 }))
888
+ if (!isEmpty(result)) orig = result
889
+ }
890
+ getParseOptsArgs(opts, orig)
881
891
  for (const base of bases) {
882
892
  if (!this.app[base]) continue
883
893
  const fileExt = `${this.app[base].dir.pkg}/extend/${baseNs}/extend/${ns}${suffix}/${_path}`
@@ -983,13 +993,13 @@ class Bajo extends Plugin {
983
993
  let ext = {}
984
994
  // default config file
985
995
  try {
986
- cfg = await this.readConfig(`${path}.*`, { ignoreError: true })
996
+ cfg = await this.readConfig(`${path}.*`)
987
997
  } catch (err) {
988
998
  if (['BAJO_CONFIG_NO_PARSER'].includes(err.code)) throw err
989
999
  }
990
1000
  // env based config file
991
1001
  try {
992
- ext = await this.readConfig(`${path}-${this.config.env}.*`, { ignoreError: true })
1002
+ ext = await this.readConfig(`${path}-${this.config.env}.*`)
993
1003
  } catch (err) {
994
1004
  if (!['BAJO_CONFIG_FILE_NOT_FOUND'].includes(err.code)) throw err
995
1005
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bajo",
3
- "version": "2.12.0",
3
+ "version": "2.12.1",
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,9 @@
1
1
  # Changes
2
2
 
3
+ ## 2026-04-25
4
+
5
+ - [2.12.1] Bug fix in ```readConfig()```
6
+
3
7
  ## 2026-04-23
4
8
 
5
9
  - [2.12.0] Remove ```breakNsPathFromFile()```