bajo 2.21.1 → 2.23.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.
Files changed (67) hide show
  1. package/.jsdoc.conf.json +1 -1
  2. package/class/app.js +139 -115
  3. package/class/bajo.js +108 -92
  4. package/class/base.js +25 -9
  5. package/class/cache.js +32 -19
  6. package/class/err.js +11 -9
  7. package/class/log.js +102 -52
  8. package/class/plugin.js +45 -35
  9. package/class/print.js +45 -44
  10. package/class/tools.js +7 -1
  11. package/docs/App.html +1 -23
  12. package/docs/Bajo.html +1 -6
  13. package/docs/Base.html +1 -1
  14. package/docs/Cache.html +1 -1
  15. package/docs/Err.html +2 -2
  16. package/docs/Log.html +4 -4
  17. package/docs/Plugin.html +1 -1
  18. package/docs/Print.html +1 -1
  19. package/docs/Tools.html +1 -1
  20. package/docs/class_app.js.html +141 -117
  21. package/docs/class_bajo.js.html +98 -91
  22. package/docs/class_base.js.html +27 -11
  23. package/docs/class_cache.js.html +34 -21
  24. package/docs/class_err.js.html +13 -11
  25. package/docs/class_log.js.html +104 -54
  26. package/docs/class_plugin.js.html +47 -37
  27. package/docs/class_print.js.html +47 -46
  28. package/docs/class_tools.js.html +9 -3
  29. package/docs/data/search.json +1 -1
  30. package/docs/global.html +1 -1
  31. package/docs/index.html +1 -1
  32. package/docs/index.js.html +8 -4
  33. package/docs/{class__helper.js.html → lib_helper.js.html} +208 -96
  34. package/docs/lib_hook.js.html +231 -0
  35. package/docs/module-Helper.html +8 -1
  36. package/docs/module-Hook.html +3 -0
  37. package/docs/module-Lib.html +1 -8
  38. package/index.js +1 -1
  39. package/{class/_helper.js → lib/helper.js} +206 -94
  40. package/lib/hook.js +228 -0
  41. package/package.json +1 -1
  42. package/wiki/CHANGES.md +11 -0
  43. package/wiki/ECOSYSTEM.md +6 -6
  44. package/docs/class_helper_bajo.js.html +0 -398
  45. package/docs/class_helper_base.js.html +0 -246
  46. package/docs/class_misc_err.js.html +0 -129
  47. package/docs/class_misc_log.js.html +0 -210
  48. package/docs/class_misc_print.js.html +0 -267
  49. package/docs/lib_current-loc.js.html +0 -36
  50. package/docs/lib_find-deep.js.html +0 -27
  51. package/docs/lib_formats.js.html +0 -68
  52. package/docs/lib_freeze.js.html +0 -54
  53. package/docs/lib_import-module.js.html +0 -61
  54. package/docs/lib_index.js.html +0 -9
  55. package/docs/lib_log-levels.js.html +0 -38
  56. package/docs/lib_parse-args-argv.js.html +0 -83
  57. package/docs/lib_parse-env.js.html +0 -53
  58. package/docs/lib_resolve-path.js.html +0 -27
  59. package/docs/lib_shim.js.html +0 -40
  60. package/docs/module-Helper_Bajo.html +0 -3
  61. package/docs/module-Helper_Base.html +0 -3
  62. package/lib/find-deep.js +0 -24
  63. package/lib/formats.js +0 -65
  64. package/lib/freeze.js +0 -51
  65. package/lib/import-module.js +0 -58
  66. package/lib/index.js +0 -6
  67. package/lib/log-levels.js +0 -35
package/class/err.js CHANGED
@@ -8,7 +8,7 @@ Error.stackTraceLimit = 15
8
8
  /**
9
9
  * Bajo error class, a thin wrapper of node's Error object.
10
10
  *
11
- * Every Bajo {@link Plugin|plugin} has a built-in method called ```error``` which basically the shortcut to create a new Err instance.
11
+ * Every Bajo {@link Plugin|plugin} has a built-in method called `error` which basically the shortcut to create a new Err instance.
12
12
  * It helps you create this instance anywhere in your code quickly without the hassle of importing & instantiating:
13
13
  *
14
14
  * ```javascript
@@ -18,30 +18,29 @@ Error.stackTraceLimit = 15
18
18
  */
19
19
  class Err extends Tools {
20
20
  /**
21
- * @param {Plugin} plugin Plugin instance.
22
- * @param {string} msg Error message.
23
- * @param {...any} [args] Variables to interpolate with error message. Payload object can be pushed at the very last argument
21
+ * Constructor.
22
+ *
23
+ * @param {Plugin} plugin - Plugin instance
24
+ * @param {string} msg - Error message
25
+ * @param {...any} [args] - Variables to interpolate with error message. Payload object can be pushed at the very last argument
24
26
  */
25
27
  constructor (plugin, msg, ...args) {
26
28
  super(plugin)
27
29
 
28
30
  /**
29
31
  * Error payload extracted from the last arguments.
30
- *
31
32
  * @type {Object}
32
33
  */
33
34
  this.payload = args.length > 0 && isPlainObject(args[args.length - 1]) ? args[args.length - 1] : {}
34
35
 
35
36
  /**
36
37
  * Original message before translation.
37
- *
38
38
  * @type {string}
39
39
  */
40
40
  this.orgMessage = msg
41
41
 
42
42
  /**
43
43
  * Translated message.
44
- *
45
44
  * @type {string}
46
45
  */
47
46
  this.message = this.payload.noTrans ? msg : this.plugin.t(msg, ...args)
@@ -51,7 +50,7 @@ class Err extends Tools {
51
50
  * Write message to the console.
52
51
  *
53
52
  * @method
54
- * @returns {Err} Error object, useful for chaining.
53
+ * @returns {Err} - Error object, useful for chaining
55
54
  */
56
55
  write = () => {
57
56
  let err
@@ -94,8 +93,11 @@ class Err extends Tools {
94
93
  /**
95
94
  * Pretty format error details.
96
95
  *
96
+ * Formatted error will be applied directly to the value parameter, and a detailsMessage
97
+ * will be returned for display purpose.
98
+ *
97
99
  * @method
98
- * @param {Object} value Value to format.
100
+ * @param {Object} value - Value to format
99
101
  * @returns {Object}
100
102
  */
101
103
  formatErrorDetails = (value) => {
package/class/log.js CHANGED
@@ -1,12 +1,49 @@
1
1
  import os from 'os'
2
- import logLevels from '../lib/log-levels.js'
3
2
  import chalk from 'chalk'
4
3
  import { stripVTControlCharacters } from 'node:util'
5
4
 
6
5
  /**
7
- * Log output in stringified JSON format. Returned when app run in ```prod``` environment.
6
+ * @typedef {Object} TLevels
7
+ * @memberof Log
8
+ * @type {Object}
9
+ * @property {Object} trace
10
+ * @property {number} [trace.number=10]
11
+ * @property {string} [trace.color=gray]
12
+ * @property {Object} debug
13
+ * @property {number} [debug.number=20]
14
+ * @property {string} [debug.color=greenBright]
15
+ * @property {Object} info
16
+ * @property {number} [info.number=30]
17
+ * @property {string} [info.color=blueBright]
18
+ * @property {Object} warn
19
+ * @property {number} [warn.number=40]
20
+ * @property {string} [warn.color=yellowBright]
21
+ * @property {Object} error
22
+ * @property {number} [error.number=50]
23
+ * @property {string} [error.color=redBright]
24
+ * @property {Object} fatal
25
+ * @property {number} [fatal.number=60]
26
+ * @property {string} [fatal.color=magentaBright]
27
+ * @property {Object} silent
28
+ * @property {number} [silent.number=99]
29
+ * @property {string} [silent.color=white]
30
+ */
31
+
32
+ export const logLevels = {
33
+ trace: { number: 10, color: 'gray' },
34
+ debug: { number: 20, color: 'greenBright' },
35
+ info: { number: 30, color: 'blueBright' },
36
+ warn: { number: 40, color: 'yellowBright' },
37
+ error: { number: 50, color: 'redBright' },
38
+ fatal: { number: 60, color: 'magentaBright' },
39
+ silent: { number: 99, color: 'white' }
40
+ }
41
+
42
+ /**
43
+ * Log output in stringified JSON format. Returned when app run in `prod` environment.
8
44
  *
9
- * @typedef TLogJson
45
+ * @typedef TJsonOutput
46
+ * @memberof Log
10
47
  * @property {string} prefix Message prefix.
11
48
  * @property {string} message The message itself.
12
49
  * @property {string} level Log level.
@@ -20,32 +57,34 @@ import { stripVTControlCharacters } from 'node:util'
20
57
  /**
21
58
  * A thin & fast logger system.
22
59
  *
23
- * An instance is created by the {@link App|app} and available to use anywhere like this:
24
- *
25
- * ```javascript
26
- * ... anywhere inside your code
27
- * this.app.log.debug(...)
28
- * ```
60
+ * An instance is created by the {@link App|app} and available to use from anywhere inside your code.
29
61
  *
30
62
  * Shortcuts to log's methods are also available on every Bajo {@link Plugin|plugin}. Call on
31
- * these shortcuts will be prefixed with it's plugin name automatically:
63
+ * these shortcuts will be prefixed with it's plugin name automatically.
32
64
  *
33
- * ```javascript
34
- * ... anywhere inside your code
35
- * if (!isValid) this.log.error('Invalid value!')
65
+ * Example:
66
+ * ```js
67
+ * // ... anywhere inside your code
68
+ * this.app.log.debug(...)
69
+ * // or inside a plugin
70
+ * if (!isValid) this.log.error('Invalid value!') // will be prefixed with plugin namespace automatically
36
71
  * ```
37
72
  *
38
73
  * @class
39
74
  */
40
75
  class Log {
41
76
  /**
77
+ * Constructor.
42
78
  * @param {App} app - App instance
43
79
  */
44
80
  constructor (app) {
45
- this.lastDelta = 0
81
+ /**
82
+ * Last delta time in millisecond since app started. Used for log's time taken feature.
83
+ * @type {number}
84
+ */
85
+ this._lastDelta = 0
46
86
  /**
47
87
  * The app instance.
48
- *
49
88
  * @type {App}
50
89
  */
51
90
  this.app = app
@@ -57,18 +96,18 @@ class Log {
57
96
 
58
97
  /**
59
98
  * Display & format message according to one of these rules:
60
- * 1. ```level``` ```prefix``` ```text``` ```var 1``` ```var 2``` ```...var n``` - Translate ```text``` and interpolate with ```vars``` for level ```level```
61
- * 2. ```level``` ```prefix``` ```data``` ```text``` ```var 1``` ```var 2``` ```...var n``` - As above, and append stringified ```data```
62
- * 3. ```level``` ```prefix``` ```error``` - Format as {@link Err} object. If current log level is _trace_, dump it on screen
99
+ * 1. `level` `prefix` `text` `var 1` `var 2` `...var n` - Translate `text` and interpolate with `vars` for level `level`
100
+ * 2. `level` `prefix` `data` `text` `var 1` `var 2` `...var n` - As above, and append stringified `data`
101
+ * 3. `level` `prefix` `error` - Format as {@link Err} object. If current log level is _trace_, dump it on screen
63
102
  *
64
- * In ```prod``` environment, log will be delivered as JSON stringified object. See {@link TLogJson} for more info
103
+ * In `prod` environment, log will be delivered as JSON stringified object. See {@link Log.TJsonOutput} for more info
65
104
  *
66
105
  * @method
67
- * @param {string} level Log level to use.
68
- * @param {string} prefix Prefix to the message.
69
- * @param {...any} params See format above.
106
+ * @param {string} level - Log level to use
107
+ * @param {string} prefix - Prefix to the message
108
+ * @param {...any} params - See format above
70
109
  * @see Err
71
- * @see TLogJson
110
+ * @see Log.TJsonOutput
72
111
  */
73
112
  formatMsg = (level, prefix, ...params) => {
74
113
  const { dayjs } = this.app.lib
@@ -95,8 +134,8 @@ class Log {
95
134
  let diff = null
96
135
  if (timeTaken) {
97
136
  const delta = dt.diff(this.app.runAt, 'ms')
98
- diff = delta - this.lastDelta
99
- this.lastDelta = delta
137
+ diff = delta - this._lastDelta
138
+ this._lastDelta = delta
100
139
  }
101
140
  if (this.app.bajo.config.env === 'prod') {
102
141
  const json = { prefix, msg, level: logLevels[level].number, time: dt.valueOf(), pid: process.pid, hostname: os.hostname() }
@@ -121,17 +160,24 @@ class Log {
121
160
  if (this.app.bajo.config.log.save) this.save(text, prefix)
122
161
  }
123
162
 
163
+ /**
164
+ * Get error message from an Error object. If the message is empty, return the code or statusCode instead.
165
+ *
166
+ * @method
167
+ * @param {Error} error - Error object
168
+ * @returns {string} Error message
169
+ */
124
170
  getErrorMessage = error => {
125
171
  const { isEmpty } = this.app.lib._
126
172
  return isEmpty(error.message) ? (error.code ?? error.statusCode) : error.message
127
173
  }
128
174
 
129
175
  /**
130
- * Calculate pattern used for log rotation.
176
+ * Calculate pattern used for log rotation. Used by {@link Log#save|save} method to determine the log file name.
131
177
  *
132
178
  * @method
133
- * @param {boolean} isPrev If true, calculate previous rotation pattern.
134
- * @returns {string} Calculated pattern.
179
+ * @param {boolean} isPrev - If `true`, calculate previous rotation pattern.
180
+ * @returns {string} Calculated pattern
135
181
  */
136
182
  getRotationPattern = (isPrev) => {
137
183
  const { dayjs } = this.app.lib
@@ -160,11 +206,11 @@ class Log {
160
206
  }
161
207
 
162
208
  /**
163
- * Save log to file in {dataDir}/log.
209
+ * Save log to file in `{dataDir}/log`.
164
210
  *
165
211
  * @method
166
- * @param {string} text Log message to save.
167
- * @param {string} prefix Use prefix as basename. Defaults to 'bajo'.
212
+ * @param {string} text - Log message to save
213
+ * @param {string} [prefix='bajo'] - Use prefix as basename. Defaults to `bajo`
168
214
  */
169
215
  save = (text, prefix = 'bajo') => {
170
216
  const { fs } = this.app.lib
@@ -180,77 +226,77 @@ class Log {
180
226
  }
181
227
 
182
228
  /**
183
- * Display & format message in ```trace``` level. See {@link Log#formatMsg|formatMsg} for details.
229
+ * Display & format message in `trace` level. See {@link Log#formatMsg|formatMsg} for details.
184
230
  *
185
231
  * @method
186
- * @param {string} prefix Message prefix.
187
- * @param {...any} params Parameters.
232
+ * @param {string} prefix - Message prefix
233
+ * @param {...any} params - Parameters
188
234
  */
189
235
  trace = (prefix, ...params) => {
190
236
  this.formatMsg('trace', prefix, ...params)
191
237
  }
192
238
 
193
239
  /**
194
- * Display & format message in ```debug``` level. See {@link Log#formatMsg|formatMsg} for details.
240
+ * Display & format message in `debug` level. See {@link Log#formatMsg|formatMsg} for details.
195
241
  *
196
242
  * @method
197
- * @param {string} prefix Message prefix.
198
- * @param {...any} params Parameters.
243
+ * @param {string} prefix - Message prefix
244
+ * @param {...any} params - Parameters
199
245
  */
200
246
  debug = (prefix, ...params) => {
201
247
  this.formatMsg('debug', prefix, ...params)
202
248
  }
203
249
 
204
250
  /**
205
- * Display & format message in ```info``` level. See {@link Log#formatMsg|formatMsg} for details.
251
+ * Display & format message in `info` level. See {@link Log#formatMsg|formatMsg} for details.
206
252
  *
207
253
  * @method
208
- * @param {string} prefix Message prefix.
209
- * @param {...any} params Parameters.
254
+ * @param {string} prefix - Message prefix
255
+ * @param {...any} params - Parameters
210
256
  */
211
257
  info = (prefix, ...params) => {
212
258
  this.formatMsg('info', prefix, ...params)
213
259
  }
214
260
 
215
261
  /**
216
- * Display & format message in ```warn``` level. See {@link Log#formatMsg|formatMsg} for details.
262
+ * Display & format message in `warn` level. See {@link Log#formatMsg|formatMsg} for details.
217
263
  *
218
264
  * @method
219
- * @param {string} prefix Message prefix.
220
- * @param {...any} params Parameters.
265
+ * @param {string} prefix - Message prefix
266
+ * @param {...any} params - Parameters
221
267
  */
222
268
  warn = (prefix, ...params) => {
223
269
  this.formatMsg('warn', prefix, ...params)
224
270
  }
225
271
 
226
272
  /**
227
- * Display & format message in ```error``` level. See {@link Log#formatMsg|formatMsg} for details.
273
+ * Display & format message in `error` level. See {@link Log#formatMsg|formatMsg} for details.
228
274
  *
229
275
  * @method
230
- * @param {string} prefix Message prefix.
231
- * @param {...any} params Parameters.
276
+ * @param {string} prefix - Message prefix
277
+ * @param {...any} params - Parameters
232
278
  */
233
279
  error = (prefix, ...params) => {
234
280
  this.formatMsg('error', prefix, ...params)
235
281
  }
236
282
 
237
283
  /**
238
- * Display & format message in ```fatal``` level. See {@link Log#formatMsg|formatMsg} for details.
284
+ * Display & format message in `fatal` level. See {@link Log#formatMsg|formatMsg} for details.
239
285
  *
240
286
  * @method
241
- * @param {string} prefix Message prefix.
242
- * @param {...any} params Parameters.
287
+ * @param {string} prefix - Message prefix
288
+ * @param {...any} params - Parameters
243
289
  */
244
290
  fatal = (prefix, ...params) => {
245
291
  this.formatMsg('fatal', prefix, ...params)
246
292
  }
247
293
 
248
294
  /**
249
- * Display & format message in ```silent``` level. See {@link Log#formatMsg|formatMsg} for details.
295
+ * Display & format message in `silent` level. See {@link Log#formatMsg|formatMsg} for details.
250
296
  *
251
297
  * @method
252
- * @param {string} prefix Message prefix.
253
- * @param {...any} params Parameters.
298
+ * @param {string} prefix - Message prefix
299
+ * @param {...any} params - Parameters
254
300
  */
255
301
  silent = (prefix, ...params) => {
256
302
  this.formatMsg('silent', prefix, ...params)
@@ -258,6 +304,10 @@ class Log {
258
304
 
259
305
  /**
260
306
  * Dispose internal references.
307
+ *
308
+ * @async
309
+ * @method
310
+ * @returns {Promise<void>}
261
311
  */
262
312
  dispose = async () => {
263
313
  this.app = null
package/class/plugin.js CHANGED
@@ -15,23 +15,23 @@ const { get, isEmpty, cloneDeep, omit, isPlainObject, camelCase } = lodash
15
15
  */
16
16
  class Plugin {
17
17
  /**
18
- * @param {string} pkgName Package name (the one you use in package.json).
19
- * @param {Object} app App instance reference. Usefull to call app method inside a plugin.
18
+ * Constructor.
19
+ *
20
+ * @param {string} pkgName - Package name (the one in package.json)
21
+ * @param {Object} app - App instance reference. Usefull to call app method inside a plugin
20
22
  */
21
23
  constructor (pkgName, app) {
22
24
  /**
23
25
  * Package name, the one from package.json.
24
26
  *
25
- * @memberof Plugin
26
- * @constant {string}
27
+ * @type {string}
27
28
  */
28
29
  this.pkgName = pkgName
29
30
 
30
31
  /**
31
- * Namespace (ns) or plugin's name. Simply the camel cased version of plugin's package name.
32
+ * Namespace (ns) or plugin's name. It is the camel cased version of plugin's package name.
32
33
  *
33
- * @memberof Plugin
34
- * @constant {string}
34
+ * @type {string}
35
35
  */
36
36
  this.ns = camelCase(pkgName)
37
37
 
@@ -40,20 +40,18 @@ class Plugin {
40
40
  * Bajo will provide this automatically (by using the kebab-cased version of plugin name).
41
41
  *
42
42
  * @readonly
43
- * @memberof Plugin
44
43
  * @type {string}
45
44
  */
46
45
  this.alias = null
47
46
 
48
47
  /**
49
- * Reference to the app instance.
50
- *
51
- * @type {Object}
48
+ * Reference to the app instance
49
+ * @type {App}
52
50
  */
53
51
  this.app = app
54
52
 
55
53
  /**
56
- * Config object.
54
+ * Configuration object.
57
55
  *
58
56
  * @type {Object}
59
57
  * @see {@tutorial config}
@@ -80,8 +78,9 @@ class Plugin {
80
78
  * Get package info.
81
79
  *
82
80
  * @method
83
- * @param {string} [dir] Package directory. Defaults to the current plugin's package dir.
84
- * @param {Array} [keys=['name', 'version', 'description', 'author', 'license', 'homepage', 'bajo']] Field keys to be use. Set empty to use all keys.
81
+ * @param {string} [dir] - Package directory. Defaults to the current plugin's package dir
82
+ * @param {Array} [keys=['name', 'version', 'description', 'author', 'license', 'homepage', 'bajo']] - Field keys to be use. Set empty to use all keys
83
+ * @returns {Object} Package info object
85
84
  */
86
85
  getPkgInfo = (dir, keys = ['name', 'version', 'description', 'author', 'license', 'homepage', 'bajo']) => {
87
86
  const { pick, isEmpty } = this.app.lib._
@@ -95,12 +94,12 @@ class Plugin {
95
94
  * Get plugin's config value.
96
95
  *
97
96
  * @method
98
- * @param {string} [path] dot separated config path (think of lodash's 'get'). If not provided, the full config will be given.
99
- * @param {Object} [options={}] Options.
100
- * @param {any} [options.defValue={}] Default value to use if returned object is undefined.
101
- * @param {string[]} [options.omit=[]] Omit these keys from returned object.
102
- * @param {boolean} [options.noClone=false] Set true to NOT clone returned object.
103
- * @returns {Object} Returned object. If no path provided, the whole config object is returned.
97
+ * @param {string} [path] - dot separated config path (think of lodash's 'get'). If not provided, the full config will be given
98
+ * @param {Object} [options={}] - Options object
99
+ * @param {any} [options.defValue={}] - Default value to use if returned object is undefined
100
+ * @param {string[]} [options.omit=[]] - Omit these keys from returned object
101
+ * @param {boolean} [options.noClone=false] - Set true to NOT clone returned object
102
+ * @returns {Object} Returned object. If no path provided, the whole config object is returned
104
103
  */
105
104
  getConfig = (path, options = {}) => {
106
105
  let obj = isEmpty(path) ? this.config : get(this.config, path, options.defValue ?? {})
@@ -114,9 +113,9 @@ class Plugin {
114
113
  * Create an instance of {@link Err} object.
115
114
  *
116
115
  * @method
117
- * @param {string} msg Error message.
118
- * @param {...any} [args] Argument variables you might want to add to the error object.
119
- * @returns {Object} Err instance.
116
+ * @param {string} msg - Error message
117
+ * @param {...any} [args] - Argument variables you might want to add to the error object
118
+ * @returns {Err} Err instance
120
119
  */
121
120
  error = (msg, ...args) => {
122
121
  if (!this.print) return new Error(msg, ...args)
@@ -126,11 +125,12 @@ class Plugin {
126
125
 
127
126
  /**
128
127
  * Create an instance of Err object, display it on screen and then force
129
- * terminate the app process.
128
+ * terminate the app.
130
129
  *
131
130
  * @method
132
- * @param {string} msg Error message.
133
- * @param {...any} [args] Argument variables you might want to add to the error object.
131
+ * @param {string} msg - Error message
132
+ * @param {...any} [args] - Argument variables you might want to add to the error object
133
+ * @returns {void}
134
134
  */
135
135
  fatal = (msg, ...args) => {
136
136
  if (!this.print) return new Error(msg, ...args)
@@ -139,12 +139,13 @@ class Plugin {
139
139
  }
140
140
 
141
141
  /**
142
- * Translate text and interpolate with given ```args```.
142
+ * Translate text and interpolate with given `args`.
143
143
  *
144
144
  * Shortcut to {@link App#t} with ns parameter set to this plugin namespace.
145
145
  *
146
- * @param {string} text Text to translate.
147
- * @param {...any} params Variables to interpolate to ```text```.
146
+ * @method
147
+ * @param {string} text - Text to translate
148
+ * @param {...any} params - Variables to interpolate to `text`
148
149
  * @returns {string}
149
150
  */
150
151
  t = (text, ...params) => {
@@ -156,8 +157,9 @@ class Plugin {
156
157
  *
157
158
  * Shortcut to {@link App#te} with ns parameter set to this plugin namespace.
158
159
  *
159
- * @param {string} text Text to translate.
160
- * @param {...any} params Variables to interpolate to ```text```.
160
+ * @method
161
+ * @param {string} text - Text to translate
162
+ * @param {...any} params - Variables to interpolate to `text`
161
163
  * @returns {string}
162
164
  */
163
165
  te = (text, ...params) => {
@@ -165,9 +167,11 @@ class Plugin {
165
167
  }
166
168
 
167
169
  /**
168
- * Force bind methods to self (```this```).
170
+ * Force bind methods to self (`this`).
169
171
  *
170
- * @param {string[]} names Method's names.
172
+ * @method
173
+ * @param {string[]} names - Method's names
174
+ * @returns {void}
171
175
  */
172
176
  selfBind (names) {
173
177
  if (!Array.isArray(names)) names = [names]
@@ -177,9 +181,11 @@ class Plugin {
177
181
  }
178
182
 
179
183
  /**
180
- * Alias to ```this.app.dump()```.
184
+ * Alias to `this.app.dump()`.
181
185
  *
182
- * @param {...any} args
186
+ * @method
187
+ * @param {...any} args - Arguments
188
+ * @returns {void}
183
189
  */
184
190
  dump = (...args) => {
185
191
  this.app.dump(...args)
@@ -187,6 +193,10 @@ class Plugin {
187
193
 
188
194
  /**
189
195
  * Dispose internal references.
196
+ *
197
+ * @async
198
+ * @method
199
+ * @returns {Promise<void>}
190
200
  */
191
201
  dispose = async () => {
192
202
  this.app = null