bajo 2.21.0 → 2.22.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/.jsdoc.conf.json +1 -1
- package/class/app.js +139 -115
- package/class/bajo.js +96 -89
- package/class/base.js +25 -9
- package/class/cache.js +32 -19
- package/class/err.js +11 -9
- package/class/log.js +102 -52
- package/class/plugin.js +45 -35
- package/class/print.js +45 -44
- package/class/tools.js +7 -1
- package/docs/App.html +1 -23
- package/docs/Bajo.html +1 -6
- package/docs/Base.html +1 -1
- package/docs/Cache.html +1 -1
- package/docs/Err.html +2 -2
- package/docs/Log.html +4 -4
- package/docs/Plugin.html +1 -1
- package/docs/Print.html +1 -1
- package/docs/Tools.html +1 -1
- package/docs/class_app.js.html +141 -117
- package/docs/class_bajo.js.html +98 -91
- package/docs/class_base.js.html +27 -11
- package/docs/class_cache.js.html +34 -21
- package/docs/class_err.js.html +13 -11
- package/docs/class_log.js.html +104 -54
- package/docs/class_plugin.js.html +47 -37
- package/docs/class_print.js.html +47 -46
- package/docs/class_tools.js.html +9 -3
- package/docs/data/search.json +1 -1
- package/docs/global.html +1 -1
- package/docs/index.html +1 -1
- package/docs/index.js.html +8 -4
- package/docs/{class__helper.js.html → lib_helper.js.html} +208 -96
- package/docs/lib_hook.js.html +231 -0
- package/docs/module-Helper.html +8 -1
- package/docs/module-Hook.html +3 -0
- package/docs/module-Lib.html +1 -8
- package/index.js +6 -2
- package/{class/_helper.js → lib/helper.js} +206 -94
- package/lib/hook.js +228 -0
- package/package.json +1 -1
- package/wiki/CHANGES.md +10 -0
- package/docs/class_helper_bajo.js.html +0 -398
- package/docs/class_helper_base.js.html +0 -246
- package/docs/class_misc_err.js.html +0 -129
- package/docs/class_misc_log.js.html +0 -210
- package/docs/class_misc_print.js.html +0 -267
- package/docs/lib_current-loc.js.html +0 -36
- package/docs/lib_find-deep.js.html +0 -27
- package/docs/lib_formats.js.html +0 -68
- package/docs/lib_freeze.js.html +0 -54
- package/docs/lib_import-module.js.html +0 -61
- package/docs/lib_index.js.html +0 -9
- package/docs/lib_log-levels.js.html +0 -38
- package/docs/lib_parse-args-argv.js.html +0 -83
- package/docs/lib_parse-env.js.html +0 -53
- package/docs/lib_resolve-path.js.html +0 -27
- package/docs/lib_shim.js.html +0 -40
- package/docs/module-Helper_Bajo.html +0 -3
- package/docs/module-Helper_Base.html +0 -3
- package/lib/find-deep.js +0 -24
- package/lib/formats.js +0 -65
- package/lib/freeze.js +0 -51
- package/lib/import-module.js +0 -58
- package/lib/index.js +0 -6
- package/lib/log-levels.js +0 -35
package/lib/hook.js
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Hook
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @typedef THook
|
|
7
|
+
* @type {Object}
|
|
8
|
+
* @property {string} name - Hook name
|
|
9
|
+
* @property {string} ns - Hook namespace
|
|
10
|
+
* @property {function} handler - Hook handler function
|
|
11
|
+
* @property {number} [level=999] - Hook level (lower number means higher priority)
|
|
12
|
+
* @property {string} src - Hook source (origin plugin namespace). Bajo will set this automatically, any value you set will be overriden.
|
|
13
|
+
* @property {boolean} [noWait=false] - If true, Bajo will not wait for this hook to complete before proceeding to the next hook. Default is false.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Run before boot process. You can use this hook to do some pre-boot process.
|
|
18
|
+
*
|
|
19
|
+
* @name bajo:beforeBoot
|
|
20
|
+
* @async
|
|
21
|
+
* @method
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Run after boot process. You can use this hook to do some post-boot process.
|
|
26
|
+
*
|
|
27
|
+
* @name bajo:afterBoot
|
|
28
|
+
* @async
|
|
29
|
+
* @method
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Run after hooks are collected. You can use this hook to modify the collected hooks before
|
|
34
|
+
* they are recognized as application hooks.
|
|
35
|
+
*
|
|
36
|
+
* @async
|
|
37
|
+
* @method
|
|
38
|
+
* @name bajo:afterCollectHooks
|
|
39
|
+
* @param {Array<module:Hook~THook>} hooks - Array of hook objects
|
|
40
|
+
* @see module:Helper.collectHooks
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Run before all plugins are initialized. You can use this hook to do some pre-initialization process.
|
|
45
|
+
*
|
|
46
|
+
* @async
|
|
47
|
+
* @method
|
|
48
|
+
* @name bajo:beforeAllInit
|
|
49
|
+
* @see module:Helper.run
|
|
50
|
+
*/
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Run after all plugins are initialized. You can use this hook to do some post-initialization process.
|
|
54
|
+
*
|
|
55
|
+
* @async
|
|
56
|
+
* @method
|
|
57
|
+
* @name bajo:afterAllInit
|
|
58
|
+
* @see module:Helper.run
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Run before all plugins are started. You can use this hook to do some pre-start process.
|
|
63
|
+
*
|
|
64
|
+
* @async
|
|
65
|
+
* @method
|
|
66
|
+
* @name bajo:beforeAllStart
|
|
67
|
+
* @see module:Helper.run
|
|
68
|
+
*/
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Run after all plugins are started. You can use this hook to do some post-start process.
|
|
72
|
+
*
|
|
73
|
+
* @async
|
|
74
|
+
* @method
|
|
75
|
+
* @name bajo:afterAllStart
|
|
76
|
+
* @see module:Helper.run
|
|
77
|
+
*/
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Run before `{ns}` plugins are initialized. You can use this hook to do some pre-initialization process.
|
|
81
|
+
*
|
|
82
|
+
* @async
|
|
83
|
+
* @method
|
|
84
|
+
* @name {ns}:beforeInit
|
|
85
|
+
* @see module:Helper.run
|
|
86
|
+
*/
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Run after `{ns}` plugins are initialized. You can use this hook to do some post-initialization process.
|
|
90
|
+
*
|
|
91
|
+
* @async
|
|
92
|
+
* @method
|
|
93
|
+
* @name {ns}:afterInit
|
|
94
|
+
* @see module:Helper.run
|
|
95
|
+
*/
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Run after `{ns}` plugins are initialized. You can use this hook to do some pre-start process.
|
|
99
|
+
*
|
|
100
|
+
* @async
|
|
101
|
+
* @method
|
|
102
|
+
* @name {ns}:beforeStart
|
|
103
|
+
* @see module:Helper.run
|
|
104
|
+
*/
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Run after `{ns}` plugins are started. You can use this hook to do some post-start process.
|
|
108
|
+
*
|
|
109
|
+
* @async
|
|
110
|
+
* @method
|
|
111
|
+
* @name {ns}:afterStart
|
|
112
|
+
* @see module:Helper.run
|
|
113
|
+
*/
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Run before applet is run. `{ns}` is the applet's namespace
|
|
117
|
+
*
|
|
118
|
+
* @name {ns}:beforeAppletRun
|
|
119
|
+
* @async
|
|
120
|
+
* @method
|
|
121
|
+
* @param {...any} args - Arguments passed to the applet
|
|
122
|
+
* @see module:Helper.runAsApplet
|
|
123
|
+
*/
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Run after applet is run. `{ns}` is the applet's namespace
|
|
127
|
+
*
|
|
128
|
+
* @name {ns}:afterAppletRun
|
|
129
|
+
* @async
|
|
130
|
+
* @method
|
|
131
|
+
* @param {...any} args - Arguments passed to the applet
|
|
132
|
+
* @see module:Helper.runAsApplet
|
|
133
|
+
*/
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Run before collection is built.
|
|
137
|
+
*
|
|
138
|
+
* @async
|
|
139
|
+
* @method
|
|
140
|
+
* @name bajo:beforeBuildCollection
|
|
141
|
+
* @param {string} container - Collection container name
|
|
142
|
+
* @see Bajo#buildCollections
|
|
143
|
+
*/
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Run after collection is built.
|
|
147
|
+
*
|
|
148
|
+
* @async
|
|
149
|
+
* @method
|
|
150
|
+
* @name bajo:afterBuildCollection
|
|
151
|
+
* @param {string} container - Collection container name
|
|
152
|
+
* @param {array<object>} items - Collection items
|
|
153
|
+
* @see Bajo#buildCollections
|
|
154
|
+
*/
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Run after a non override/extended configuration file is read.
|
|
158
|
+
*
|
|
159
|
+
* @async
|
|
160
|
+
* @method
|
|
161
|
+
* @name bajo.default:afterReadConfig
|
|
162
|
+
* @param {string} file - Config file path
|
|
163
|
+
* @param {string} orgObj - Original config object before parsing
|
|
164
|
+
* @param {object} options - readConfig options
|
|
165
|
+
*/
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Run before a configuration file override is read.
|
|
169
|
+
*
|
|
170
|
+
* @async
|
|
171
|
+
* @method
|
|
172
|
+
* @name bajo.override:beforeReadConfig
|
|
173
|
+
* @param {string} fileExt - Config file extension
|
|
174
|
+
* @param {object} options - readConfig options
|
|
175
|
+
*/
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Run after a configuration file override is read.
|
|
179
|
+
*
|
|
180
|
+
* @async
|
|
181
|
+
* @method
|
|
182
|
+
* @name bajo.override:afterReadConfig
|
|
183
|
+
* @param {string} fileExt - Config file extension
|
|
184
|
+
* @param {object} result - Resulting config object after parsing
|
|
185
|
+
* @param {object} options - readConfig options
|
|
186
|
+
*/
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Run before a extended configuration file is read.
|
|
190
|
+
*
|
|
191
|
+
* @async
|
|
192
|
+
* @method
|
|
193
|
+
* @name bajo.extend:beforeReadConfig
|
|
194
|
+
* @param {string} fileExt - Config file extension
|
|
195
|
+
* @param {object} options - readConfig options
|
|
196
|
+
*/
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Run after a extended configuration file is read.
|
|
200
|
+
*
|
|
201
|
+
* @async
|
|
202
|
+
* @method
|
|
203
|
+
* @name bajo.extend:afterReadConfig
|
|
204
|
+
* @param {string} fileExt - Config file extension
|
|
205
|
+
* @param {object} result - Resulting config object after parsing
|
|
206
|
+
* @param {object} options - readConfig options
|
|
207
|
+
*/
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Run before a configuration file is read.
|
|
211
|
+
*
|
|
212
|
+
* @async
|
|
213
|
+
* @method
|
|
214
|
+
* @name bajo:beforeReadConfig
|
|
215
|
+
* @param {string} file - Config file path
|
|
216
|
+
* @param {object} options - readConfig options
|
|
217
|
+
*/
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Run after all read processes of a configuration file are completed.
|
|
221
|
+
*
|
|
222
|
+
* @async
|
|
223
|
+
* @method
|
|
224
|
+
* @name bajo:afterReadConfig
|
|
225
|
+
* @param {string} file - Config file path
|
|
226
|
+
* @param {object} result - Resulting config object after parsing
|
|
227
|
+
* @param {object} options - readConfig options
|
|
228
|
+
*/
|
package/package.json
CHANGED
package/wiki/CHANGES.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changes
|
|
2
2
|
|
|
3
|
+
## 2026-07-08
|
|
4
|
+
|
|
5
|
+
- [2.22.0] Update documentations
|
|
6
|
+
- [2.22.0] Reorganize project files
|
|
7
|
+
- [2.22.0] Bug fix in boot process
|
|
8
|
+
|
|
9
|
+
## 2026-07-02
|
|
10
|
+
|
|
11
|
+
- [2.21.1] Bug fix in ```index.js```
|
|
12
|
+
|
|
3
13
|
## 2026-07-01
|
|
4
14
|
|
|
5
15
|
- [2.21.0] Add ```.yml/.yaml``` to the configHandlers core
|