bajo 2.15.0 → 2.16.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/app.js +22 -6
- package/package.json +2 -2
- package/wiki/CHANGES.md +10 -0
package/class/app.js
CHANGED
|
@@ -4,11 +4,11 @@ import Base from './base.js'
|
|
|
4
4
|
import { runAsApplet } from './helper/bajo.js'
|
|
5
5
|
import Cache from './app/cache.js'
|
|
6
6
|
import Tools from './plugin/tools.js'
|
|
7
|
-
|
|
8
7
|
import { outmatchNs, parseObject, lib } from './helper/app.js'
|
|
8
|
+
import { fileURLToPath } from 'url'
|
|
9
9
|
|
|
10
10
|
const { camelCase, isPlainObject, get, reverse, map, last, without, set } = lib._
|
|
11
|
-
const { pascalCase } = lib.aneka
|
|
11
|
+
const { pascalCase, getCallerFilename } = lib.aneka
|
|
12
12
|
let unknownLangWarning = false
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -197,6 +197,11 @@ class App {
|
|
|
197
197
|
*/
|
|
198
198
|
this.envVars = {}
|
|
199
199
|
|
|
200
|
+
/**
|
|
201
|
+
* Placeholder for boxen that will get imported from ```bajoCli``` later during boot process.
|
|
202
|
+
*/
|
|
203
|
+
this.boxen = null
|
|
204
|
+
|
|
200
205
|
this.cache = new Cache(this)
|
|
201
206
|
|
|
202
207
|
if (!options.cwd) options.cwd = process.cwd()
|
|
@@ -239,13 +244,19 @@ class App {
|
|
|
239
244
|
* @param {...any} args - any arguments passed will be displayed on screen. If the last argument is a boolean 'true', app will quit rightaway
|
|
240
245
|
*/
|
|
241
246
|
dump = (...args) => {
|
|
247
|
+
let caller = getCallerFilename()
|
|
248
|
+
caller = caller ? fileURLToPath(caller) : 'Unavailable'
|
|
242
249
|
const terminate = last(args) === true
|
|
243
250
|
if (terminate) args.pop()
|
|
244
|
-
|
|
245
|
-
|
|
251
|
+
const value = args.length === 1 ? args[0] : args
|
|
252
|
+
if (this.boxen) {
|
|
253
|
+
const result = util.inspect(value, { depth: 10, colors: true })
|
|
254
|
+
const info = this.boxen(result, { title: `Caller: ${caller}`, titleAlignment: 'center', padding: 1, margin: 1, borderStyle: 'round' })
|
|
255
|
+
console.log(info)
|
|
256
|
+
} else {
|
|
257
|
+
const result = util.inspect([caller, value], { depth: 10, colors: true })
|
|
246
258
|
console.log(result)
|
|
247
259
|
}
|
|
248
|
-
// if (terminate) process.kill(process.pid, 'SIGINT')
|
|
249
260
|
if (terminate) process.exit('1')
|
|
250
261
|
}
|
|
251
262
|
|
|
@@ -267,7 +278,11 @@ class App {
|
|
|
267
278
|
*/
|
|
268
279
|
boot = async () => {
|
|
269
280
|
this.bajo = new Bajo(this)
|
|
270
|
-
|
|
281
|
+
const hooks = (this.options.hooks ?? []).map(item => {
|
|
282
|
+
item.src = item.src ?? 'bajo'
|
|
283
|
+
return item
|
|
284
|
+
})
|
|
285
|
+
this.bajo.hooks.push(...hooks)
|
|
271
286
|
delete this.options.hooks
|
|
272
287
|
// argv/args/env
|
|
273
288
|
const { parseArgsArgv, parseEnv, secToHms } = this.lib.aneka
|
|
@@ -281,6 +296,7 @@ class App {
|
|
|
281
296
|
this.applet = this.envVars._.applet ?? this.argv._.applet
|
|
282
297
|
await this.bajo.runHook('bajo:beforeBoot')
|
|
283
298
|
await this.bajo.init()
|
|
299
|
+
if (this.bajoCli) this.boxen = await this.bajo.importPkg('bajoCli:boxen')
|
|
284
300
|
// cache
|
|
285
301
|
this.cache.purge()
|
|
286
302
|
setInterval(this.cache.purge, this.bajo.config.cache.purgeIntvDur)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bajo",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.16.0",
|
|
4
4
|
"description": "The ultimate framework for whipping up massive apps in no time",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"homepage": "https://github.com/ardhi/bajo#readme",
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"add-filename-increment": "^1.0.0",
|
|
29
|
-
"aneka": "^0.
|
|
29
|
+
"aneka": "^0.14.0",
|
|
30
30
|
"chalk": "^5.6.0",
|
|
31
31
|
"dayjs": "^1.11.13",
|
|
32
32
|
"deep-freeze-strict": "^1.1.1",
|
package/wiki/CHANGES.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changes
|
|
2
2
|
|
|
3
|
+
## 2026-06-01
|
|
4
|
+
|
|
5
|
+
- [2.16.0] Upgrade ```aneka@0.14.0```
|
|
6
|
+
- [2.16.0] Adding caller filename to the ```app.dump()```
|
|
7
|
+
- [2.16.0] Formatting ```app.dump()``` to be more catchy when ```bajoCli``` is loaded
|
|
8
|
+
|
|
9
|
+
## 2026-05-30
|
|
10
|
+
|
|
11
|
+
- [2.15.1] Bug fix in ```app.boot()```
|
|
12
|
+
|
|
3
13
|
## 2026-05-28
|
|
4
14
|
|
|
5
15
|
- [2.15.0] Add built-in cache feature through ```app.cache``` instance
|