bajo 2.14.0 → 2.14.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/helper/bajo.js +1 -1
- package/class/helper/base.js +10 -7
- package/package.json +1 -1
- package/wiki/CHANGES.md +5 -0
package/class/helper/bajo.js
CHANGED
|
@@ -106,7 +106,7 @@ export default factory
|
|
|
106
106
|
export async function buildBaseConfig () {
|
|
107
107
|
// dirs
|
|
108
108
|
const { defaultsDeep, textToArray, currentLoc, resolvePath } = this.app.lib.aneka
|
|
109
|
-
this.config = defaultsDeep({}, this.app.
|
|
109
|
+
this.config = defaultsDeep({}, this.app.argv._, this.app.envVars._)
|
|
110
110
|
set(this, 'dir.base', this.app.dir)
|
|
111
111
|
const path = currentLoc(import.meta).dir + '/../..'
|
|
112
112
|
set(this, 'dir.pkg', resolvePath(path))
|
package/class/helper/base.js
CHANGED
|
@@ -100,17 +100,20 @@ export async function checkDependencies () {
|
|
|
100
100
|
*/
|
|
101
101
|
export async function collectHooks () {
|
|
102
102
|
const { eachPlugins, runHook, isLogInRange, importModule } = this.bajo
|
|
103
|
-
const me = this
|
|
103
|
+
const me = this // "this" is "app"
|
|
104
104
|
me.bajo.log.trace('collecting%s', this.t('hooks'))
|
|
105
|
-
// collects
|
|
106
105
|
await eachPlugins(async function ({ dir, file }) {
|
|
107
|
-
const _file = file.replace(dir + '/hook/', '').replace('.js', '')
|
|
108
|
-
const [names, path] = _file.split('@')
|
|
109
|
-
const [ns, subNs] = names.split('.').map(n => camelCase(n))
|
|
110
106
|
const mod = await importModule(file, { asHandler: true })
|
|
111
107
|
if (!mod) return undefined
|
|
112
|
-
|
|
113
|
-
|
|
108
|
+
const _file = file.replace(dir + '/hook/', '').replace('.js', '')
|
|
109
|
+
let [names, path] = _file.split('@')
|
|
110
|
+
names = names.split('$').map(n => trim(n))
|
|
111
|
+
for (const name of names) {
|
|
112
|
+
let [ns, subNs, subSubNs] = name.split('.').map(n => camelCase(n))
|
|
113
|
+
if (subSubNs) subNs = `${subNs}.${subSubNs}`
|
|
114
|
+
const m = merge({}, mod, { ns, subNs, path: camelCase(path), src: this.ns })
|
|
115
|
+
me.bajo.hooks.push(m)
|
|
116
|
+
}
|
|
114
117
|
}, { glob: 'hook/**/*.js', prefix: me.bajo.ns })
|
|
115
118
|
// for log trace purpose only
|
|
116
119
|
if (isLogInRange('trace')) {
|
package/package.json
CHANGED