@axium/client 0.38.0 → 0.38.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/dist/cli/config.js +6 -6
- package/dist/cli/index.js +3 -1
- package/package.json +1 -1
package/dist/cli/config.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { persistFeaturesTo } from '@axium/core/node/features';
|
|
2
|
-
import { loadPlugin } from '@axium/core/node/plugins';
|
|
2
|
+
import { loadPlugin, trackPluginLoading } from '@axium/core/node/plugins';
|
|
3
3
|
import { Manager as ConfigManager } from '@james-pre/config';
|
|
4
4
|
import { debug, warn } from 'ioium';
|
|
5
5
|
import * as io from 'ioium/node';
|
|
@@ -23,6 +23,10 @@ export function resolveServerURL(server) {
|
|
|
23
23
|
debug('Resolved server URL: ' + url.href);
|
|
24
24
|
return url.href;
|
|
25
25
|
}
|
|
26
|
+
async function loadPlugins(path, options) {
|
|
27
|
+
for (const plugin of config.plugins ?? [])
|
|
28
|
+
await loadPlugin('client', plugin, path, options);
|
|
29
|
+
}
|
|
26
30
|
export const configManager = new ConfigManager(z.looseObject({
|
|
27
31
|
token: z.base64url().nullish(),
|
|
28
32
|
server: z.url().nullish(),
|
|
@@ -35,11 +39,7 @@ export const configManager = new ConfigManager(z.looseObject({
|
|
|
35
39
|
if (config.token)
|
|
36
40
|
setToken(config.token);
|
|
37
41
|
})
|
|
38
|
-
|
|
39
|
-
.on('post_load', async (path, file, options) => {
|
|
40
|
-
for (const plugin of config.plugins ?? [])
|
|
41
|
-
await loadPlugin('client', plugin, path, options.plugins);
|
|
42
|
-
})
|
|
42
|
+
.on('post_load', (path, file, options) => trackPluginLoading(loadPlugins(path, options.plugins)))
|
|
43
43
|
.on('load_error', (path, stage, error) => io.warn('Failed to load config:', io.errorText(error)))
|
|
44
44
|
.on('write', path => io.debug('Saved config to', path));
|
|
45
45
|
export const config = configManager.data;
|
package/dist/cli/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#! /usr/bin/env node
|
|
2
2
|
import { createPluginCommand } from '@axium/core/node';
|
|
3
|
+
import { waitForPlugins } from '@axium/core/node/plugins';
|
|
3
4
|
import { _findPlugin, plugins } from '@axium/core/plugins';
|
|
4
5
|
import { configCommand } from '@james-pre/config/cli';
|
|
5
6
|
import { Service } from '@james-pre/systemd';
|
|
@@ -24,10 +25,11 @@ if (debug)
|
|
|
24
25
|
useUserAgent(clientUA);
|
|
25
26
|
const loadOptions = { plugins: { safe } };
|
|
26
27
|
configManager.loadDefaults(loadOptions);
|
|
28
|
+
await waitForPlugins();
|
|
27
29
|
cache.load();
|
|
28
30
|
process.on('SIGHUP', () => {
|
|
29
31
|
io.info('Reloading configuration due to SIGHUP.');
|
|
30
|
-
configManager.reloadFiles();
|
|
32
|
+
configManager.reloadFiles({ plugins: { safe, reload: true } });
|
|
31
33
|
});
|
|
32
34
|
program
|
|
33
35
|
.version($pkg.version)
|