bajo 2.18.0 → 2.19.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/_helper.js +22 -7
- package/class/app.js +59 -45
- package/class/bajo.js +150 -129
- package/class/base.js +3 -3
- package/class/cache.js +60 -0
- package/class/err.js +14 -11
- package/class/log.js +41 -40
- package/class/plugin.js +35 -36
- package/class/print.js +54 -51
- package/class/tools.js +3 -4
- package/docs/App.html +7 -7
- package/docs/Bajo.html +2 -2
- package/docs/Base.html +1 -1
- package/docs/Cache.html +3 -0
- package/docs/Err.html +2 -2
- package/docs/Log.html +2 -2
- package/docs/Plugin.html +1 -1
- package/docs/Print.html +1 -1
- package/docs/Tools.html +3 -0
- package/docs/class__helper.js.html +694 -0
- package/docs/class_app.js.html +307 -149
- package/docs/class_bajo.js.html +316 -464
- package/docs/class_base.js.html +35 -32
- package/docs/class_cache.js.html +150 -0
- package/docs/class_err.js.html +144 -0
- package/docs/class_log.js.html +270 -0
- package/docs/class_plugin.js.html +98 -71
- package/docs/class_print.js.html +261 -0
- package/docs/class_tools.js.html +44 -0
- package/docs/data/search.json +1 -1
- package/docs/global.html +1 -4
- package/docs/index.html +1 -1
- package/docs/index.js.html +21 -14
- package/docs/lib_find-deep.js.html +27 -0
- package/docs/lib_formats.js.html +19 -19
- package/docs/lib_freeze.js.html +19 -0
- package/docs/lib_import-module.js.html +16 -14
- package/docs/lib_index.js.html +9 -0
- package/docs/lib_log-levels.js.html +2 -2
- package/docs/module-Helper.html +3 -0
- package/docs/module-Lib.html +3 -8
- package/docs/scripts/core.js +477 -476
- package/docs/scripts/resize.js +36 -36
- package/docs/scripts/search.js +105 -105
- package/docs/scripts/third-party/fuse.js +1 -1
- package/docs/scripts/third-party/hljs-line-num-original.js +285 -282
- package/docs/scripts/third-party/hljs-line-num.js +1 -1
- package/docs/scripts/third-party/hljs-original.js +1202 -1195
- package/docs/scripts/third-party/hljs.js +1 -1
- package/docs/scripts/third-party/popper.js +1 -1
- package/docs/scripts/third-party/tippy.js +1 -1
- package/docs/scripts/third-party/tocbot.js +509 -508
- package/index.js +8 -11
- package/lib/find-deep.js +3 -3
- package/lib/formats.js +17 -17
- package/lib/freeze.js +3 -3
- package/lib/import-module.js +8 -8
- package/package.json +1 -1
- package/test/app.test.js +183 -0
- package/test/bajo.test.js +125 -0
- package/test/base.test.js +74 -107
- package/test/cache.test.js +94 -0
- package/test/e2e.test.js +137 -0
- package/test/err.test.js +73 -0
- package/test/helper.test.js +39 -0
- package/test/import-module.test.js +138 -0
- package/test/integration.test.js +218 -0
- package/test/log.test.js +119 -0
- package/test/plugin.test.js +116 -0
- package/test/print.test.js +100 -0
- package/test/tools.test.js +38 -0
- package/wiki/CHANGES.md +5 -0
- package/.mocharc.json +0 -4
package/class/_helper.js
CHANGED
|
@@ -140,13 +140,13 @@ dayjs.extend(weekOfYear)
|
|
|
140
140
|
|
|
141
141
|
/**
|
|
142
142
|
* @typedef {Object} TAppLib
|
|
143
|
-
* @property {Object} _
|
|
144
|
-
* @property {Object} fs
|
|
145
|
-
* @property {Object} fastGlob
|
|
146
|
-
* @property {Object} sprintf
|
|
147
|
-
* @property {Object} aneka
|
|
148
|
-
* @property {Object} outmatch
|
|
149
|
-
* @property {Object} dayjs
|
|
143
|
+
* @property {Object} _ Access to {@link https://lodash.com|lodash}.
|
|
144
|
+
* @property {Object} fs Access to {@link https://github.com/jprichardson/node-fs-extra|fs-extra}.
|
|
145
|
+
* @property {Object} fastGlob Access to {@link https://github.com/mrmlnc/fast-glob|fast-glob}.
|
|
146
|
+
* @property {Object} sprintf Access to {@link https://github.com/alexei/sprintf.js|sprintf}.
|
|
147
|
+
* @property {Object} aneka Access to {@link https://github.com/ardhi/aneka|aneka}.
|
|
148
|
+
* @property {Object} outmatch Access to {@link https://github.com/axtgr/outmatch|outmatch}.
|
|
149
|
+
* @property {Object} dayjs Access to {@link https://day.js.org|dayjs} with utc & customParseFormat plugin already applied.
|
|
150
150
|
* @property {Object} freeze
|
|
151
151
|
* @property {Object} findDeep
|
|
152
152
|
* @see App
|
|
@@ -173,6 +173,8 @@ export const lib = {
|
|
|
173
173
|
* - read the list of plugins from ```.plugins``` file
|
|
174
174
|
*
|
|
175
175
|
* @async
|
|
176
|
+
* @method
|
|
177
|
+
* @memberof module:Helper
|
|
176
178
|
*/
|
|
177
179
|
export async function buildBaseConfig () {
|
|
178
180
|
// dirs
|
|
@@ -214,6 +216,7 @@ export async function buildBaseConfig () {
|
|
|
214
216
|
* - attach these plugins to the app instance
|
|
215
217
|
*
|
|
216
218
|
* @async
|
|
219
|
+
* @memberof module:Helper
|
|
217
220
|
*/
|
|
218
221
|
export async function buildPlugins () {
|
|
219
222
|
const { resolvePath } = this.app.lib.aneka
|
|
@@ -247,6 +250,7 @@ export async function buildPlugins () {
|
|
|
247
250
|
* Collect all config handlers, including the one provided by plugins
|
|
248
251
|
*
|
|
249
252
|
* @async
|
|
253
|
+
* @memberof module:Helper
|
|
250
254
|
*/
|
|
251
255
|
export async function collectConfigHandlers () {
|
|
252
256
|
for (const pkg of this.app.pluginPkgs) {
|
|
@@ -271,6 +275,7 @@ export async function collectConfigHandlers () {
|
|
|
271
275
|
* - Set environment (```dev``` or ```prod```)
|
|
272
276
|
*
|
|
273
277
|
* @async
|
|
278
|
+
* @memberof module:Helper
|
|
274
279
|
*/
|
|
275
280
|
export async function buildExtConfig () {
|
|
276
281
|
// config merging
|
|
@@ -321,6 +326,7 @@ export async function buildExtConfig () {
|
|
|
321
326
|
* Setup plugins boot orders by reading plugin's ```.bootorder``` file if provided.
|
|
322
327
|
*
|
|
323
328
|
* @async
|
|
329
|
+
* @memberof module:Helper
|
|
324
330
|
*/
|
|
325
331
|
export async function bootOrder () {
|
|
326
332
|
const { freeze } = this.app.lib
|
|
@@ -349,6 +355,7 @@ export async function bootOrder () {
|
|
|
349
355
|
* Build configurations
|
|
350
356
|
*
|
|
351
357
|
* @async
|
|
358
|
+
* @memberof module:Helper
|
|
352
359
|
*/
|
|
353
360
|
export async function buildConfigs () {
|
|
354
361
|
this.bajo.log.debug('readConfigs')
|
|
@@ -363,6 +370,7 @@ export async function buildConfigs () {
|
|
|
363
370
|
* Ensure for names and aliases to be unique and no clashes with other plugins
|
|
364
371
|
*
|
|
365
372
|
* @async
|
|
373
|
+
* @memberof module:Helper
|
|
366
374
|
*/
|
|
367
375
|
export async function checkNameAliases () {
|
|
368
376
|
this.bajo.log.debug('checkAliasNameClash')
|
|
@@ -382,6 +390,7 @@ export async function checkNameAliases () {
|
|
|
382
390
|
* Ensure dependencies are met
|
|
383
391
|
*
|
|
384
392
|
* @async
|
|
393
|
+
* @memberof module:Helper
|
|
385
394
|
*/
|
|
386
395
|
export async function checkDependencies () {
|
|
387
396
|
const { join } = this.bajo
|
|
@@ -417,6 +426,7 @@ export async function checkDependencies () {
|
|
|
417
426
|
* Collect and build hooks and push them to the bajo's hook system
|
|
418
427
|
*
|
|
419
428
|
* @async
|
|
429
|
+
* @memberof module:Helper
|
|
420
430
|
* @fires bajo:afterCollectHooks
|
|
421
431
|
*/
|
|
422
432
|
export async function collectHooks () {
|
|
@@ -482,6 +492,7 @@ export async function collectHooks () {
|
|
|
482
492
|
* @fires {ns}:before{method}
|
|
483
493
|
* @fires {ns}:after{method}
|
|
484
494
|
* @fires bajo:afterAll{method}
|
|
495
|
+
* @memberof module:Helper
|
|
485
496
|
*/
|
|
486
497
|
export async function run () {
|
|
487
498
|
const me = this
|
|
@@ -552,6 +563,7 @@ export async function run () {
|
|
|
552
563
|
* 5. {@link module:Helper/Base.run|run plugins}
|
|
553
564
|
*
|
|
554
565
|
* @async
|
|
566
|
+
* @memberof module:Helper
|
|
555
567
|
*/
|
|
556
568
|
export async function bootPlugins () {
|
|
557
569
|
await buildConfigs.call(this.app)
|
|
@@ -565,6 +577,7 @@ export async function bootPlugins () {
|
|
|
565
577
|
* Attach plugins exit handlers and make sure the app shutdowns gracefully
|
|
566
578
|
*
|
|
567
579
|
* @async
|
|
580
|
+
* @memberof module:Helper
|
|
568
581
|
*/
|
|
569
582
|
export async function exitHandler () {
|
|
570
583
|
if (!this.config.exitHandler) return
|
|
@@ -629,6 +642,7 @@ export async function exitHandler () {
|
|
|
629
642
|
* @async
|
|
630
643
|
* @fires {ns}:beforeAppletRun
|
|
631
644
|
* @fires {ns}:afterAppletRun
|
|
645
|
+
* @memberof module:Helper
|
|
632
646
|
*/
|
|
633
647
|
export async function runAsApplet () {
|
|
634
648
|
const { isString, map, find } = this.app.lib._
|
|
@@ -671,6 +685,7 @@ export async function runAsApplet () {
|
|
|
671
685
|
* @param {...any} params
|
|
672
686
|
* @see {@tutorial hook}
|
|
673
687
|
* @see module:Helper/Bajo.runAsApplet
|
|
688
|
+
* @memberof module:Helper
|
|
674
689
|
*/
|
|
675
690
|
await this.runHook(`${applet.ns}:afterAppletRun`, ...this.app.args)
|
|
676
691
|
}
|
package/class/app.js
CHANGED
|
@@ -44,21 +44,21 @@ function getCallerFilename () {
|
|
|
44
44
|
*/
|
|
45
45
|
class App {
|
|
46
46
|
/**
|
|
47
|
-
* @param {Object} [options] - App options
|
|
48
|
-
* @param {string} [options.cwd] - Set current working directory. Defaults to the script directory
|
|
49
|
-
* @param {string[]} [options.plugins] - Array of plugins to load. If provided, it override the list in ```package.json``` and ```.plugins``` file
|
|
50
|
-
* @param {Object} [options.config] - Plugin's config object. If provided, plugin configs will no longer be read from its config files
|
|
47
|
+
* @param {Object} [options] - App options.
|
|
48
|
+
* @param {string} [options.cwd] - Set current working directory. Defaults to the script directory.
|
|
49
|
+
* @param {string[]} [options.plugins] - Array of plugins to load. If provided, it override the list in ```package.json``` and ```.plugins``` file.
|
|
50
|
+
* @param {Object} [options.config] - Plugin's config object. If provided, plugin configs will no longer be read from its config files.
|
|
51
51
|
*/
|
|
52
52
|
constructor (options = {}) {
|
|
53
53
|
/**
|
|
54
|
-
* Copy of provided options
|
|
54
|
+
* Copy of provided options.
|
|
55
55
|
*
|
|
56
56
|
* @type {Object}
|
|
57
57
|
*/
|
|
58
58
|
this.options = options
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
|
-
* Your main namespace. And yes, you suppose to NOT CHANGE this
|
|
61
|
+
* Your main namespace. And yes, you suppose to NOT CHANGE this.
|
|
62
62
|
*
|
|
63
63
|
* @memberof App
|
|
64
64
|
* @constant {string}
|
|
@@ -67,27 +67,29 @@ class App {
|
|
|
67
67
|
this.mainNs = 'main'
|
|
68
68
|
|
|
69
69
|
/**
|
|
70
|
-
* App environments
|
|
70
|
+
* App environments.
|
|
71
|
+
*
|
|
71
72
|
* @memberof App
|
|
72
73
|
* @constant {TAppEnv}
|
|
73
74
|
*/
|
|
74
75
|
this.envs = { dev: 'development', prod: 'production' }
|
|
75
76
|
|
|
76
77
|
/**
|
|
77
|
-
* Date/time when your app start
|
|
78
|
+
* Date/time when your app start.
|
|
79
|
+
*
|
|
78
80
|
* @type {Date}
|
|
79
81
|
*/
|
|
80
82
|
this.runAt = new Date()
|
|
81
83
|
|
|
82
84
|
/**
|
|
83
|
-
* Applets
|
|
85
|
+
* Applets container.
|
|
84
86
|
*
|
|
85
87
|
* @type {Array}
|
|
86
88
|
*/
|
|
87
89
|
this.applets = []
|
|
88
90
|
|
|
89
91
|
/**
|
|
90
|
-
*
|
|
92
|
+
* Plugin's package names container. This is the list of plugins to load. It is read from ```package.json``` and ```.plugins``` file by default, but you can override it by providing ```options.plugins``` at constructor.
|
|
91
93
|
*
|
|
92
94
|
* @type {Array}
|
|
93
95
|
*/
|
|
@@ -95,9 +97,9 @@ class App {
|
|
|
95
97
|
|
|
96
98
|
/**
|
|
97
99
|
* @typedef {Object} TAppConfigHandler
|
|
98
|
-
* @property {string} ext - File extension
|
|
99
|
-
* @property {function} [readHandler] - Function to call for reading
|
|
100
|
-
* @property {function} [writeHandler] - Function to call for writing
|
|
100
|
+
* @property {string} ext - File extension.
|
|
101
|
+
* @property {function} [readHandler] - Function to call for reading.
|
|
102
|
+
* @property {function} [writeHandler] - Function to call for writing.
|
|
101
103
|
* @see App#configHandlers
|
|
102
104
|
*/
|
|
103
105
|
|
|
@@ -106,7 +108,7 @@ class App {
|
|
|
106
108
|
*
|
|
107
109
|
* By default, there are two built-in handlers available: ```.js```
|
|
108
110
|
* and ```.json```. Use plugins to add more, e.g {@link https://github.com/ardhi/bajo-config|bajo-config}
|
|
109
|
-
* lets you to use ```.yaml/.yml``` and ```.toml
|
|
111
|
+
* lets you to use ```.yaml/.yml``` and ```.toml```.
|
|
110
112
|
*
|
|
111
113
|
* @type {TAppConfigHandler[]}
|
|
112
114
|
*/
|
|
@@ -129,7 +131,7 @@ class App {
|
|
|
129
131
|
this.lib.parseObject = parseObject.bind(this)
|
|
130
132
|
|
|
131
133
|
/**
|
|
132
|
-
* Instance of system log
|
|
134
|
+
* Instance of system log.
|
|
133
135
|
*
|
|
134
136
|
* @type {Log}
|
|
135
137
|
*/
|
|
@@ -148,14 +150,14 @@ class App {
|
|
|
148
150
|
this.baseClass = { Base, Tools }
|
|
149
151
|
|
|
150
152
|
/**
|
|
151
|
-
* If app runs in applet mode, this will be the applet's name
|
|
153
|
+
* If app runs in applet mode, this will be the applet's name.
|
|
152
154
|
*
|
|
153
155
|
* @type {string}
|
|
154
156
|
*/
|
|
155
157
|
this.applet = undefined
|
|
156
158
|
|
|
157
159
|
/**
|
|
158
|
-
* Program arguments
|
|
160
|
+
* Program arguments.
|
|
159
161
|
*
|
|
160
162
|
* ```
|
|
161
163
|
* $ node index.js arg1 arg2
|
|
@@ -234,11 +236,11 @@ class App {
|
|
|
234
236
|
}
|
|
235
237
|
|
|
236
238
|
/**
|
|
237
|
-
* Add and save plugin and it's base class definition (if provided)
|
|
239
|
+
* Add and save plugin and it's base class definition (if provided).
|
|
238
240
|
*
|
|
239
241
|
* @method
|
|
240
|
-
* @param {TPlugin} plugin - A valid bajo plugin
|
|
241
|
-
* @param {Object} [baseClass] - Base class definition
|
|
242
|
+
* @param {TPlugin} plugin - A valid bajo plugin.
|
|
243
|
+
* @param {Object} [baseClass] - Base class definition.
|
|
242
244
|
*/
|
|
243
245
|
addPlugin = (plugin, baseClass) => {
|
|
244
246
|
if (this[plugin.ns]) throw new Error(`Plugin '${plugin.ns}' added already`)
|
|
@@ -247,7 +249,7 @@ class App {
|
|
|
247
249
|
}
|
|
248
250
|
|
|
249
251
|
/**
|
|
250
|
-
* Get all loaded plugin namespaces
|
|
252
|
+
* Get all loaded plugin namespaces.
|
|
251
253
|
*
|
|
252
254
|
* @method
|
|
253
255
|
* @returns {string[]}
|
|
@@ -257,10 +259,10 @@ class App {
|
|
|
257
259
|
}
|
|
258
260
|
|
|
259
261
|
/**
|
|
260
|
-
* Get loaded plugins
|
|
262
|
+
* Get loaded plugins.
|
|
261
263
|
*
|
|
262
264
|
* @method
|
|
263
|
-
* @param {string[]} [nss] - Array of namespaces. If empty, it returns all loaded plugins
|
|
265
|
+
* @param {string[]} [nss] - Array of namespaces. If empty, it returns all loaded plugins.
|
|
264
266
|
* @returns {TPlugin[]}
|
|
265
267
|
*/
|
|
266
268
|
getPlugins = (nss) => {
|
|
@@ -269,7 +271,7 @@ class App {
|
|
|
269
271
|
}
|
|
270
272
|
|
|
271
273
|
/**
|
|
272
|
-
* Get all plugins loaded plugins
|
|
274
|
+
* Get all plugins loaded plugins.
|
|
273
275
|
*
|
|
274
276
|
* @method
|
|
275
277
|
* @returns {TPlugin[]}
|
|
@@ -279,12 +281,12 @@ class App {
|
|
|
279
281
|
}
|
|
280
282
|
|
|
281
283
|
/**
|
|
282
|
-
* Get plugin by
|
|
284
|
+
* Get plugin by its namespace.
|
|
283
285
|
*
|
|
284
286
|
* @method
|
|
285
|
-
* @param {string} name - Plugin name/namespace or alias
|
|
286
|
-
* @param {boolean} [silent] - If ```true```, silently return undefined even on error
|
|
287
|
-
* @returns {Object} Plugin object
|
|
287
|
+
* @param {string} name - Plugin name/namespace or alias.
|
|
288
|
+
* @param {boolean} [silent] - If ```true```, silently return undefined even on error.
|
|
289
|
+
* @returns {Object} Plugin object.
|
|
288
290
|
*/
|
|
289
291
|
getPlugin = (name, silent) => {
|
|
290
292
|
if (!this[name]) {
|
|
@@ -310,8 +312,8 @@ class App {
|
|
|
310
312
|
* Get plugin data directory
|
|
311
313
|
*
|
|
312
314
|
* @method
|
|
313
|
-
* @param {string} name - Plugin name (namespace) or alias
|
|
314
|
-
* @param {boolean} [ensureDir=true] - Set ```true``` (default) to ensure directory is existed
|
|
315
|
+
* @param {string} name - Plugin name (namespace) or alias.
|
|
316
|
+
* @param {boolean} [ensureDir=true] - Set ```true``` (default) to ensure directory is existed.
|
|
315
317
|
* @returns {string}
|
|
316
318
|
*/
|
|
317
319
|
getPluginDataDir = (name, ensureDir = true) => {
|
|
@@ -330,8 +332,8 @@ class App {
|
|
|
330
332
|
* - file under node_modules, e.g. ```myPlugin:node_modules/some-package/file.txt```
|
|
331
333
|
*
|
|
332
334
|
* @method
|
|
333
|
-
* @param {string} file - File path, see above for supported types
|
|
334
|
-
* @returns {string} Resolved file path
|
|
335
|
+
* @param {string} file - File path, see above for supported types.
|
|
336
|
+
* @returns {string} Resolved file path.
|
|
335
337
|
*/
|
|
336
338
|
getPluginFile = (file) => {
|
|
337
339
|
const { currentLoc } = this.lib.aneka
|
|
@@ -366,7 +368,7 @@ class App {
|
|
|
366
368
|
* See {@link Bajo#config} for details.
|
|
367
369
|
*
|
|
368
370
|
* @method
|
|
369
|
-
* @param {...any} args - Variables to dump
|
|
371
|
+
* @param {...any} args - Variables to dump.
|
|
370
372
|
*/
|
|
371
373
|
dump = (...args) => {
|
|
372
374
|
let caller = getCallerFilename()
|
|
@@ -445,10 +447,10 @@ class App {
|
|
|
445
447
|
}
|
|
446
448
|
|
|
447
449
|
/**
|
|
448
|
-
* Terminate the app and back to console
|
|
450
|
+
* Terminate the app and back to console.
|
|
449
451
|
*
|
|
450
452
|
* @method
|
|
451
|
-
* @param {string} [signal=SIGINT] - Signal to send
|
|
453
|
+
* @param {string} [signal=SIGINT] - Signal to send.
|
|
452
454
|
*/
|
|
453
455
|
exit = (signal = 'SIGINT') => {
|
|
454
456
|
if (signal === true) process.exit('1')
|
|
@@ -456,10 +458,10 @@ class App {
|
|
|
456
458
|
}
|
|
457
459
|
|
|
458
460
|
/**
|
|
459
|
-
* Load internationalization & languages files for particular plugin
|
|
461
|
+
* Load internationalization & languages files for particular plugin.
|
|
460
462
|
*
|
|
461
463
|
* @method
|
|
462
|
-
* @param {string} ns - Plugin name
|
|
464
|
+
* @param {string} ns - Plugin name.
|
|
463
465
|
*/
|
|
464
466
|
loadIntl = (ns) => {
|
|
465
467
|
const { fs } = this.lib
|
|
@@ -525,9 +527,9 @@ class App {
|
|
|
525
527
|
* const translated = this.t('My cute cat is %s', 'purring')
|
|
526
528
|
* ```
|
|
527
529
|
* @method
|
|
528
|
-
* @param {string} ns - Namespace
|
|
529
|
-
* @param {string} text - Text to translate
|
|
530
|
-
* @param {...any} params - Arguments
|
|
530
|
+
* @param {string} ns - Namespace.
|
|
531
|
+
* @param {string} text - Text to translate.
|
|
532
|
+
* @param {...any} params - Arguments.
|
|
531
533
|
* @returns {string}
|
|
532
534
|
*/
|
|
533
535
|
t = (ns, text, ...params) => {
|
|
@@ -548,18 +550,17 @@ class App {
|
|
|
548
550
|
* Check whether translation text/key exists
|
|
549
551
|
*
|
|
550
552
|
* @method
|
|
551
|
-
* @param {string} ns - Namespace
|
|
552
|
-
* @param {string} text - Text to translate
|
|
553
|
+
* @param {string} ns - Namespace.
|
|
554
|
+
* @param {string} text - Text to translate.
|
|
553
555
|
* @returns {boolean}
|
|
554
556
|
*/
|
|
555
|
-
|
|
556
557
|
te = (ns, text, ...params) => {
|
|
557
558
|
const { trans } = this._prepTrans(ns, text, params)
|
|
558
559
|
return !!trans
|
|
559
560
|
}
|
|
560
561
|
|
|
561
562
|
/**
|
|
562
|
-
* Helper method to list all supported config formats
|
|
563
|
+
* Helper method to list all supported config formats.
|
|
563
564
|
*
|
|
564
565
|
* @returns {string[]}
|
|
565
566
|
*/
|
|
@@ -567,12 +568,25 @@ class App {
|
|
|
567
568
|
return map(this.configHandlers, 'ext')
|
|
568
569
|
}
|
|
569
570
|
|
|
571
|
+
/**
|
|
572
|
+
* Start a plugin.
|
|
573
|
+
*
|
|
574
|
+
* @param {string} ns - Plugin namespace.
|
|
575
|
+
* @param {...any} args - Arguments to pass to the plugin's start method.
|
|
576
|
+
*/
|
|
570
577
|
startPlugin = (ns, ...args) => {
|
|
571
578
|
this[ns].start(...args)
|
|
572
579
|
}
|
|
573
580
|
|
|
581
|
+
/**
|
|
582
|
+
* Stop a plugin.
|
|
583
|
+
*
|
|
584
|
+
* @param {string} ns - Plugin namespace.
|
|
585
|
+
* @param {...any} args - Arguments to pass to the plugin's stop method.
|
|
586
|
+
*/
|
|
574
587
|
stopPlugin = (ns, ...args) => {
|
|
575
|
-
|
|
588
|
+
// Disabled for now, reserved for future use. It is not a good idea to stop a plugin because other plugins might be dependent on it.
|
|
589
|
+
// this[ns].stop(...args)
|
|
576
590
|
}
|
|
577
591
|
}
|
|
578
592
|
|