@akala/pm 14.6.3 → 15.0.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 (53) hide show
  1. package/changelog.md +23 -2
  2. package/cli-commands.json +13 -3
  3. package/dist/esm/akala.d.mts +4 -0
  4. package/dist/esm/akala.mjs +37 -18
  5. package/dist/esm/akala.mjs.map +1 -1
  6. package/dist/esm/cli-commands/discover.js +6 -6
  7. package/dist/esm/cli-commands/discover.js.map +1 -1
  8. package/dist/esm/cli-commands/map.d.ts +2 -2
  9. package/dist/esm/cli-commands/map.js +2 -2
  10. package/dist/esm/cli-commands/map.js.map +1 -1
  11. package/dist/esm/cli-commands/run.js +6 -34
  12. package/dist/esm/cli-commands/run.js.map +1 -1
  13. package/dist/esm/cli-container.d.ts +3 -3
  14. package/dist/esm/cli-container.js +1 -1
  15. package/dist/esm/cli-container.js.map +1 -1
  16. package/dist/esm/commands/start.js +87 -111
  17. package/dist/esm/commands/start.js.map +1 -1
  18. package/dist/esm/commands/status.js +1 -1
  19. package/dist/esm/commands/status.js.map +1 -1
  20. package/dist/esm/commands/stop.js +1 -1
  21. package/dist/esm/commands/stop.js.map +1 -1
  22. package/dist/esm/container.d.ts +3 -3
  23. package/dist/esm/container.js +1 -1
  24. package/dist/esm/container.js.map +1 -1
  25. package/dist/esm/runtimes/child_process.d.ts +3 -1
  26. package/dist/esm/runtimes/child_process.js +14 -6
  27. package/dist/esm/runtimes/child_process.js.map +1 -1
  28. package/dist/esm/runtimes/process.d.ts +2 -0
  29. package/dist/esm/runtimes/process.js +3 -8
  30. package/dist/esm/runtimes/process.js.map +1 -1
  31. package/dist/esm/runtimes/shared.d.ts +2 -0
  32. package/dist/esm/runtimes/worker.d.ts +1 -0
  33. package/dist/esm/runtimes/worker.js +1 -0
  34. package/dist/esm/runtimes/worker.js.map +1 -1
  35. package/dist/esm/state.d.ts +2 -2
  36. package/dist/tsconfig.esm.tsbuildinfo +1 -1
  37. package/package.json +6 -6
  38. package/src/akala.mts +48 -19
  39. package/src/cli-commands/discover.ts +7 -7
  40. package/src/cli-commands/map.json +10 -2
  41. package/src/cli-commands/map.ts +4 -4
  42. package/src/cli-commands/run.json +2 -1
  43. package/src/cli-commands/run.ts +6 -38
  44. package/src/cli-container.ts +3 -3
  45. package/src/commands/start.ts +96 -128
  46. package/src/commands/status.ts +2 -2
  47. package/src/commands/stop.ts +1 -1
  48. package/src/container.ts +3 -3
  49. package/src/runtimes/child_process.ts +15 -6
  50. package/src/runtimes/process.ts +3 -10
  51. package/src/runtimes/shared.ts +2 -0
  52. package/src/runtimes/worker.ts +1 -0
  53. package/src/state.ts +2 -2
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "pm": "dist/esm/cli.js",
5
5
  "pm-fork": "dist/esm/fork.js"
6
6
  },
7
- "version": "14.6.3",
7
+ "version": "15.0.0",
8
8
  "scripts": {
9
9
  "test": "echo 1",
10
10
  "generate": "ac generate dist/esm/commands commands.json --name pm && ac generate dist/esm/cli-commands cli-commands.json --name pm",
@@ -29,11 +29,11 @@
29
29
  "src/fork.ts"
30
30
  ],
31
31
  "dependencies": {
32
- "@akala/cli": "^5.8.0",
33
- "@akala/commands": "^15.0.0",
34
- "@akala/config": "^6.0.68",
35
- "@akala/core": "^39.1.1",
36
- "@akala/json-rpc-ws": "^11.0.78",
32
+ "@akala/cli": "^5.8.1",
33
+ "@akala/commands": "^15.1.0",
34
+ "@akala/config": "^6.0.69",
35
+ "@akala/core": "^39.2.0",
36
+ "@akala/json-rpc-ws": "^11.0.79",
37
37
  "reflect-metadata": "^0.2.2",
38
38
  "source-map-support": "^0.5.21"
39
39
  },
package/src/akala.mts CHANGED
@@ -1,5 +1,4 @@
1
- import { Processors, Metadata, Container, Triggers, Cli, connect, registerCommands } from '@akala/commands';
2
- import { platform } from 'os';
1
+ import { Processors, Metadata, Container, Triggers, Cli, registerCommands, protocolHandlers, SelfDefinedCommand, StructuredParameters, ICommandProcessor, HandlerResult } from '@akala/commands';
3
2
  import { Readable } from 'stream';
4
3
 
5
4
  import { StateConfiguration } from './state.js';
@@ -8,6 +7,7 @@ import { eachAsync, HttpStatusCode, logger } from '@akala/core';
8
7
  import commands from './container.js';
9
8
  import cliCommands from './cli-container.js';
10
9
  import Configuration from '@akala/config';
10
+ import { IpcAdapter } from './ipc-adapter.js';
11
11
 
12
12
  const log = logger('akala:pm');
13
13
 
@@ -30,6 +30,23 @@ const tableChars = {
30
30
  }
31
31
  const truncate = '…';
32
32
 
33
+ export const backChannelContainer = new Container('', {});
34
+ export const remotePm = new Container('proxy-pm', {}) as commands.container & Container<unknown>;
35
+
36
+
37
+ if (process.connected)
38
+ protocolHandlers.useProtocol('ipc', async (url, options) =>
39
+ {
40
+ const connection = Processors.JsonRpc.getConnection(new IpcAdapter(process), options.container);
41
+
42
+ return {
43
+ processor: new Processors.JsonRpc(connection),
44
+ getMetadata: () => new Promise<Metadata.Container>((resolve, reject) => connection.sendMethod<any, any>('$metadata', { param: true }, (err, metadata) =>
45
+ typeof (err) == 'undefined' ? resolve(metadata) : reject(err)
46
+ ))
47
+ };
48
+ })
49
+
33
50
  type CliOptions = { output: string, verbose: number, pmSock: string | number, tls: boolean, help: boolean };
34
51
  export default async function (_config, program: NamespaceMiddleware<{ configFile: string, verbose: number }>)
35
52
  {
@@ -49,24 +66,21 @@ export default async function (_config, program: NamespaceMiddleware<{ configFil
49
66
 
50
67
  await pm.attach(Triggers.cli, cli);
51
68
 
52
- let container: Container<unknown>;
53
69
  const metaContainer = commands.meta;
70
+ let result: HandlerResult<ICommandProcessor>;
54
71
 
55
72
  cli.preAction(async c =>
56
73
  {
57
- if (!container)
74
+ if (!result)
58
75
  {
76
+ let pmConnectInfo: URL;
59
77
  if (c.options.pmSock)
60
78
  {
61
79
  if (typeof (c.options.pmSock) == 'string')
62
- {
63
- container = await connect(c.options.pmSock, c.abort.signal, metaContainer);
64
- }
80
+ result = await protocolHandlers.process(new URL(c.options.pmSock), { signal: c.abort.signal, container: backChannelContainer }, {})
65
81
  else
66
- container = await connect(new URL('jsonrpc+tcp://localhost:' + c.options.pmSock), c.abort.signal, metaContainer);
82
+ result = await protocolHandlers.process(new URL('jsonrpc+tcp://localhost:' + c.options.pmSock), { signal: c.abort.signal, container: backChannelContainer }, {})
67
83
  }
68
- else if (platform() == 'win32')
69
- container = await connect(new URL('jsonrpc+unix://\\\\?\\pipe\\pm'), c.abort.signal, metaContainer);
70
84
  else
71
85
  {
72
86
  let connectMapping = c.state?.pm?.mapping.pm?.connect;
@@ -76,7 +90,7 @@ export default async function (_config, program: NamespaceMiddleware<{ configFil
76
90
  if (connectMapping)
77
91
  await eachAsync(connectMapping, async (config, connectionString) =>
78
92
  {
79
- if (container)
93
+ if (result)
80
94
  return;
81
95
  try
82
96
  {
@@ -84,7 +98,7 @@ export default async function (_config, program: NamespaceMiddleware<{ configFil
84
98
  const url = new URL(connectionString);
85
99
  if (url.hostname == '0.0.0.0')
86
100
  url.hostname = 'localhost';
87
- container = await connect(url, c.abort.signal, metaContainer);
101
+ result = await protocolHandlers.process(url, { signal: c.abort.signal, container: backChannelContainer }, {})
88
102
  }
89
103
  catch (e)
90
104
  {
@@ -98,12 +112,27 @@ export default async function (_config, program: NamespaceMiddleware<{ configFil
98
112
 
99
113
  })
100
114
  }
101
- if (container)
115
+ if (result)
102
116
  {
103
- container.unregister(Cli.Metadata.name);
104
- container.register(Metadata.extractCommandMetadata(Cli.Metadata));
117
+ remotePm.processor.useMiddleware(20, result.processor);
118
+
119
+ registerCommands(metaContainer.commands.filter(c => !['run', 'connect', Cli.Metadata.name].includes(c.name)), null, remotePm);
120
+ remotePm.unregister(Cli.Metadata.name);
121
+ remotePm.register(Metadata.extractCommandMetadata(Cli.Metadata));
105
122
 
106
- await container.attach(Triggers.cli, cli);
123
+ remotePm.register({ ...metaContainer.commands.find(c => c.name === 'run'), processor: fs });
124
+
125
+ remotePm.register(new SelfDefinedCommand((name: string, param: StructuredParameters<unknown[]>) =>
126
+ {
127
+ if (name == 'pm')
128
+ return { [pmConnectInfo.toString()]: {} };
129
+ return result.processor.handle(pm, metaContainer.commands.find(c => c.name === 'connect'), param).then(e => { throw e }, r => r);
130
+ }, 'connect', [
131
+ "param.0",
132
+ "$param"
133
+ ]));
134
+
135
+ await remotePm.attach(Triggers.cli, cli);
107
136
  }
108
137
  }
109
138
  })
@@ -127,12 +156,12 @@ export default async function (_config, program: NamespaceMiddleware<{ configFil
127
156
 
128
157
  function formatResult(result: unknown, outputFormat: string, context: CliContext)
129
158
  {
130
- if (typeof result == 'undefined')
131
- return;
132
-
133
159
  if (!context.options.$repl)
134
160
  context.abort.abort();
135
161
 
162
+ if (typeof result == 'undefined')
163
+ return;
164
+
136
165
  switch (outputFormat)
137
166
  {
138
167
  case 'table':
@@ -70,9 +70,9 @@ export default async function discover(packageName: string, folder: string, pm:
70
70
  if (Array.isArray(packageConfig))
71
71
  throw new Error('commands property must be of type object or string');
72
72
 
73
- return await Promise.all(Object.keys(packageConfig.commands).map(v => pm.dispatch('map', v, moduleRequire?.resolve('./' + packageConfig.commands[v]), path, { commandable: true })));
73
+ return await Promise.all(Object.keys(packageConfig.commands).map(v => pm.dispatch('map', v, moduleRequire?.resolve('./' + packageConfig.commands[v]), 'nodejs', path, { commandable: true })));
74
74
  case 'string':
75
- return await pm.dispatch('map', packageName, moduleRequire.resolve('./' + packageConfig.commands), path, { commandable: true });
75
+ return await pm.dispatch('map', packageName, moduleRequire.resolve('./' + packageConfig.commands), 'nodejs', path, { commandable: true });
76
76
  default:
77
77
  throw new Error('commands property must be of type object or string');
78
78
  }
@@ -85,9 +85,9 @@ export default async function discover(packageName: string, folder: string, pm:
85
85
  case 'object':
86
86
  if (Array.isArray(packageConfig))
87
87
  throw new Error('bin property must be of type object or string');
88
- return Promise.all(Object.keys(packageConfig.bin).map(v => pm.dispatch('map', v, moduleRequire.resolve('./' + packageConfig.bin[v]), path, { commandable: false })));
88
+ return Promise.all(Object.keys(packageConfig.bin).map(v => pm.dispatch('map', v, moduleRequire.resolve('./' + packageConfig.bin[v]), 'nodejs', path, { commandable: false })));
89
89
  case 'string':
90
- return await pm.dispatch('map', packageName, moduleRequire.resolve('./' + packageConfig.bin), path, { commandable: false });
90
+ return await pm.dispatch('map', packageName, moduleRequire.resolve('./' + packageConfig.bin), 'nodejs', path, { commandable: false });
91
91
  default:
92
92
  throw new Error('bin property must be of type object or string');
93
93
  }
@@ -95,7 +95,7 @@ export default async function discover(packageName: string, folder: string, pm:
95
95
 
96
96
  const commandsJsonFile = tryModuleRequireResolve('./commands.json');
97
97
  if (commandsJsonFile)
98
- return pm.dispatch('map', packageName, commandsJsonFile, path, { commandable: true });
98
+ return pm.dispatch('map', packageName, commandsJsonFile, 'nodejs', path, { commandable: true });
99
99
 
100
- return pm.dispatch('map', packageName, moduleRequire.resolve('./' + packageConfig.main), path, { commandable: false });
101
- }
100
+ return pm.dispatch('map', packageName, moduleRequire.resolve('./' + packageConfig.main), 'nodejs', path, { commandable: false });
101
+ }
@@ -5,13 +5,15 @@
5
5
  "param.0",
6
6
  "param.1",
7
7
  "param.2",
8
- "param.3"
8
+ "param.3",
9
+ "param.4"
9
10
  ]
10
11
  },
11
12
  "cli": {
12
13
  "inject": [
13
14
  "options.name",
14
15
  "options.path",
16
+ "options.runtime",
15
17
  "cwd",
16
18
  "options"
17
19
  ],
@@ -27,8 +29,14 @@
27
29
  "s"
28
30
  ],
29
31
  "needsValue": false
32
+ },
33
+ "runtime": {
34
+ "aliases": [
35
+ "r"
36
+ ],
37
+ "needsValue": true
30
38
  }
31
39
  },
32
40
  "usage": "map <name> <path>"
33
41
  }
34
- }
42
+ }
@@ -1,11 +1,11 @@
1
- import State from '../state.js';
1
+ import State, { SidecarMetadata } from '../state.js';
2
2
  import { isAbsolute, resolve } from "path";
3
3
 
4
- export default async function map<TName extends string>(this: State, name: TName, targetPath: string, cwd?: string, options?: { commandable?: boolean })
4
+ export default async function map<TName extends string>(this: State, name: TName, targetPath: string, runtime: SidecarMetadata['type'], cwd?: string, options?: { commandable?: boolean })
5
5
  {
6
6
  if (!isAbsolute(targetPath))
7
7
  targetPath = resolve(cwd || process.cwd(), targetPath);
8
- this.config.containers.set(name, { path: targetPath, commandable: !!options?.commandable });
8
+ this.config.containers.set(name, { type: runtime, path: targetPath, commandable: !!options?.commandable });
9
9
  await this.config.commit();
10
10
  return name
11
- }
11
+ }
@@ -6,6 +6,7 @@
6
6
  "param.1"
7
7
  ]
8
8
  },
9
+ "jsonrpc": false,
9
10
  "cli": {
10
11
  "options": {
11
12
  "output": {
@@ -68,6 +69,6 @@
68
69
  "context",
69
70
  "options.pmSock"
70
71
  ],
71
- "usage": "run [...args]"
72
+ "usage": "run <name> [...args]"
72
73
  }
73
74
  }
@@ -3,15 +3,13 @@ import sms from 'source-map-support'
3
3
  sms.install();
4
4
  import path from 'path'
5
5
  import pmDef from '../container.js';
6
- import { IpcAdapter } from "../ipc-adapter.js";
7
6
  import { module as coreModule } from '@akala/core';
8
7
  import { buildCliContextFromContext, CliContext, NamespaceMiddleware } from '@akala/cli';
9
- import { Processors, ServeMetadata, Cli, registerCommands, SelfDefinedCommand, StructuredParameters, Container, serveMetadata, connectByPreference, Metadata, $metadata, protocolHandlers } from '@akala/commands';
8
+ import { ServeMetadata, registerCommands, SelfDefinedCommand, Container, connectByPreference, Metadata, $metadata, protocolHandlers } from '@akala/commands';
10
9
  import { pathToFileURL } from 'url';
11
- import commands from '../container.js';
12
10
  import fsHandler, { Stats } from '@akala/fs';
13
11
  import { Triggers } from '@akala/commands';
14
-
12
+ import { backChannelContainer, remotePm } from '../akala.mjs';
15
13
 
16
14
  export default async function run(program: string, name: string, c: CliContext<{ help: boolean, configFile: string, name?: string, args?: string[] }>, pmSocket?: string)
17
15
  {
@@ -23,12 +21,13 @@ export default async function run(program: string, name: string, c: CliContext<{
23
21
  if (folderOrFile.isFile && path.extname(program) === '.js')
24
22
  return import(program);
25
23
 
26
- const cliContainer = new Container(name, {});
24
+ const cliContainer = backChannelContainer
27
25
 
28
26
  const result = await protocolHandlers.process(new URL(program), { signal: c.abort.signal, container: cliContainer }, {});
29
27
  cliContainer.processor.useMiddleware(20, result.processor);
30
28
  const metaContainer = await result.getMetadata();
31
29
  registerCommands(metaContainer.commands, result.processor, cliContainer);
30
+ cliContainer.name = name;
32
31
 
33
32
  const isPm = name === 'pm' && program === new URL('../../../commands.json', import.meta.url).toString();
34
33
  const init = cliContainer.resolve('$init');
@@ -44,45 +43,14 @@ export default async function run(program: string, name: string, c: CliContext<{
44
43
  c.abort.abort(x)
45
44
  return false;
46
45
  });
47
- process.on('SIGINT', () => c.abort.abort(null));
46
+ process.on('SIGINT', () => { c.abort.abort('SIGINT') });
48
47
 
49
48
  let pm: Container<unknown> & pmDef.container;
50
49
  let pmConnectInfo: ServeMetadata;
51
50
 
52
51
  if (!isPm)
53
52
  {
54
- //eslint-disable-next-line @typescript-eslint/no-var-requires
55
- const pmMeta = commands.meta;
56
- if (process.connected)
57
- {
58
- pm = new Container('pm', null, new Processors.JsonRpc(Processors.JsonRpc.getConnection(new IpcAdapter(process), cliContainer))) as Container<unknown> & pmDef.container;
59
- registerCommands(pmMeta.commands, null, pm);
60
- }
61
- else
62
- {
63
- if (pmSocket)
64
- pmConnectInfo = { [pmSocket]: {} };
65
- else
66
- pmConnectInfo = serveMetadata({ args: ['local'], options: { socketName: 'pm' } })
67
- const x = await connectByPreference(pmConnectInfo, { metadata: pmMeta, signal: c.abort.signal, container: cliContainer });
68
- // controller.signal.addEventListener('abort', () => x.processor)
69
- pm = x.container as Container<unknown> & pmDef.container;
70
- pm.processor.useMiddleware(20, x.processor);
71
- const connect = pm.resolve('connect');
72
- pm.unregister('connect');
73
- pm.register(new SelfDefinedCommand((name: string, param: StructuredParameters<unknown[]>) =>
74
- {
75
- if (name == 'pm')
76
- return pmConnectInfo;
77
- return x.processor.handle(pm, connect, param).then(e => { throw e }, r => r);
78
- }, 'connect', [
79
- "param.0",
80
- "$param"
81
- ]));
82
- }
83
- // eslint-disable-next-line @typescript-eslint/no-var-requires
84
- pm.unregister(Cli.Metadata.name);
85
- pm.register(Metadata.extractCommandMetadata(Cli.Metadata));
53
+ pm = remotePm;
86
54
  }
87
55
  else
88
56
  pm = cliContainer as pmDef.container & Container<unknown>;
@@ -15,7 +15,7 @@ namespace cliCommands
15
15
  dispatch (cmd:'link', ...args: [Argument0<typeof import('./cli-commands/link.js').default>, Argument1<typeof import('./cli-commands/link.js').default>]): ReturnType<typeof import('./cli-commands/link.js').default>
16
16
  dispatch (cmd:'log', ...args: [Argument0<typeof import('./cli-commands/log.js').default>]): ReturnType<typeof import('./cli-commands/log.js').default>
17
17
  dispatch (cmd:'ls', ...args: []): ReturnType<typeof import('./cli-commands/ls.js').default>
18
- dispatch (cmd:'map', ...args: [Argument0<typeof import('./cli-commands/map.js').default>, Argument1<typeof import('./cli-commands/map.js').default>, Argument2<typeof import('./cli-commands/map.js').default>, Argument3<typeof import('./cli-commands/map.js').default>]): ReturnType<typeof import('./cli-commands/map.js').default>
18
+ dispatch (cmd:'map', ...args: [Argument0<typeof import('./cli-commands/map.js').default>, Argument1<typeof import('./cli-commands/map.js').default>, Argument2<typeof import('./cli-commands/map.js').default>, Argument3<typeof import('./cli-commands/map.js').default>, Argument4<typeof import('./cli-commands/map.js').default>]): ReturnType<typeof import('./cli-commands/map.js').default>
19
19
  dispatch (cmd:'run', ...args: [Argument0<typeof import('./cli-commands/run.js').default>, Argument1<typeof import('./cli-commands/run.js').default>]): ReturnType<typeof import('./cli-commands/run.js').default>
20
20
  dispatch (cmd:'start', ...args: [Argument0<typeof import('./cli-commands/start.js').default>, Argument1<typeof import('./cli-commands/start.js').default>]): ReturnType<typeof import('./cli-commands/start.js').default>
21
21
  dispatch (cmd:'uninstall', ...args: [Argument0<typeof import('./cli-commands/uninstall.js').default>]): ReturnType<typeof import('./cli-commands/uninstall.js').default>
@@ -31,14 +31,14 @@ namespace cliCommands
31
31
  'link'(...args: [Argument0<typeof import('./cli-commands/link.js').default>, Argument1<typeof import('./cli-commands/link.js').default>]): ReturnType<typeof import('./cli-commands/link.js').default>
32
32
  'log'(...args: [Argument0<typeof import('./cli-commands/log.js').default>]): ReturnType<typeof import('./cli-commands/log.js').default>
33
33
  'ls'(...args: []): ReturnType<typeof import('./cli-commands/ls.js').default>
34
- 'map'(...args: [Argument0<typeof import('./cli-commands/map.js').default>, Argument1<typeof import('./cli-commands/map.js').default>, Argument2<typeof import('./cli-commands/map.js').default>, Argument3<typeof import('./cli-commands/map.js').default>]): ReturnType<typeof import('./cli-commands/map.js').default>
34
+ 'map'(...args: [Argument0<typeof import('./cli-commands/map.js').default>, Argument1<typeof import('./cli-commands/map.js').default>, Argument2<typeof import('./cli-commands/map.js').default>, Argument3<typeof import('./cli-commands/map.js').default>, Argument4<typeof import('./cli-commands/map.js').default>]): ReturnType<typeof import('./cli-commands/map.js').default>
35
35
  'run'(...args: [Argument0<typeof import('./cli-commands/run.js').default>, Argument1<typeof import('./cli-commands/run.js').default>]): ReturnType<typeof import('./cli-commands/run.js').default>
36
36
  'start'(...args: [Argument0<typeof import('./cli-commands/start.js').default>, Argument1<typeof import('./cli-commands/start.js').default>]): ReturnType<typeof import('./cli-commands/start.js').default>
37
37
  'uninstall'(...args: [Argument0<typeof import('./cli-commands/uninstall.js').default>]): ReturnType<typeof import('./cli-commands/uninstall.js').default>
38
38
  'update'(...args: [Argument0<typeof import('./cli-commands/update.js').default>, Argument1<typeof import('./cli-commands/update.js').default>, Argument2<typeof import('./cli-commands/update.js').default>]): ReturnType<typeof import('./cli-commands/update.js').default>
39
39
  'version'(...args: [Argument0<typeof import('./cli-commands/version.js').default>, Argument1<typeof import('./cli-commands/version.js').default>]): ReturnType<typeof import('./cli-commands/version.js').default>
40
40
  }
41
- export const meta={"name":"pm","commands":[{"name":"$init","config":{"fs":{"path":"dist/esm/cli-commands/$init.js","source":"src/cli-commands/$init.ts","inject":["param.0"]},"cli":{"inject":["context"],"options":{"pmSock":{"aliases":["pm-sock"],"needsValue":true}}},"":{"inject":["param.0"]}}},{"name":"connect","config":{"fs":{"path":"dist/esm/cli-commands/connect.js","source":"src/cli-commands/connect.ts","inject":["param.0","param.1"]},"":{"inject":["param.0","param.1"]},"cli":{"usage":"connect <name>","inject":["options.name","context"],"options":{"tcpPort":{"needsValue":true,"aliases":["tcp-port"]},"port":{"needsValue":true},"key":{"needsValue":true},"cert":{"needsValue":true}}}}},{"name":"discover","config":{"fs":{"path":"dist/esm/cli-commands/discover.js","source":"src/cli-commands/discover.ts","inject":["param.0","param.1","$container"]},"":{"inject":["param.0","param.1","$container"]},"cli":{"usage":"discover <name> <folder>","options":{"folder":{"normalize":true}},"inject":["options.name","options.folder","$container"]}}},{"name":"install","config":{"fs":{"path":"dist/esm/cli-commands/install.js","source":"src/cli-commands/install.ts","inject":["param.0","$container"]},"":{"inject":["param.0","$container"]},"cli":{"inject":["param.0","$container"]}}},{"name":"link","config":{"fs":{"path":"dist/esm/cli-commands/link.js","source":"src/cli-commands/link.ts","inject":["param.0","param.1","$container"]},"":{"inject":["param.0","param.1","$container"]},"cli":{"inject":["param.0","param.1","$container"]}}},{"name":"log","config":{"fs":{"path":"dist/esm/cli-commands/log.js","source":"src/cli-commands/log.ts","inject":["param.0"]},"":{"inject":["param.0"]},"cli":{"inject":["param.0"]}}},{"name":"ls","config":{"fs":{"path":"dist/esm/cli-commands/ls.js","source":"src/cli-commands/ls.ts","inject":[]},"":{"inject":[]},"cli":{"inject":[]},"html-form":{"inject":[]}}},{"name":"map","config":{"fs":{"path":"dist/esm/cli-commands/map.js","source":"src/cli-commands/map.ts","inject":["param.0","param.1","param.2","param.3"]},"":{"inject":["param.0","param.1","param.2","param.3"]},"cli":{"inject":["options.name","options.path","cwd","options"],"options":{"commandable":{"aliases":["c"],"needsValue":false},"stateless":{"aliases":["s"],"needsValue":false}},"usage":"map <name> <path>"}}},{"name":"run","config":{"fs":{"path":"dist/esm/cli-commands/run.js","source":"src/cli-commands/run.ts","inject":["param.0","param.1"]},"":{"inject":["param.0","param.1"]},"cli":{"options":{"output":{"aliases":["o"],"needsValue":true,"doc":"output as `table` if array otherwise falls back to standard node output"},"verbose":{"aliases":["v"]},"tls":{"doc":"enables tls connection to the `pmSock`"},"pmSock":{"aliases":["pm-sock"],"needsValue":true,"doc":"path to the unix socket or destination in the form host:port"},"help":{"doc":"displays this help message"},"keepAttached":{"aliases":["keep-attached"],"needsValue":false,"doc":"keeps the process attached to the current terminal"},"wait":{"aliases":["w"],"needsValue":false,"doc":"waits for the program to be started before returning, otherwise, returns after the start command is sent to the pm daemon"},"inspect":{"needsValue":false,"doc":"starts the process with --inspect-brk parameter to help debugging"},"new":{"needsValue":false},"name":{"doc":"name to assign to the process","needsValue":true},"program":{"doc":"program to start"}},"inject":["options.program","options.name","context","options.pmSock"],"usage":"run [...args]"}}},{"name":"start","config":{"fs":{"path":"dist/esm/cli-commands/start.js","source":"src/cli-commands/start.ts","inject":["param.0","param.1"]},"":{"inject":["param.0","param.1"]},"cli":{"options":{"output":{"aliases":["o"],"needsValue":true,"doc":"output as `table` if array otherwise falls back to standard node output"},"verbose":{"aliases":["v"]},"tls":{"doc":"enables tls connection to the `pmSock`"},"pmSock":{"aliases":["pm-sock"],"needsValue":true,"doc":"path to the unix socket or destination in the form host:port"},"help":{"doc":"displays this help message"},"keepAttached":{"aliases":["keep-attached"],"needsValue":false,"doc":"keeps the process attached to the current terminal"},"wait":{"aliases":["w"],"needsValue":false,"doc":"waits for the program to be started before returning, otherwise, returns after the start command is sent to the pm daemon"},"inspect":{"needsValue":false,"doc":"starts the process with --inspect-brk parameter to help debugging"},"program":{"doc":"program to start"}},"inject":["options.program","context"],"usage":"start pm"}}},{"name":"uninstall","config":{"fs":{"path":"dist/esm/cli-commands/uninstall.js","source":"src/cli-commands/uninstall.ts","inject":["param.0","$container"]},"":{"inject":["param.0","$container"]},"cli":{"inject":["param.0","$container"]}}},{"name":"update","config":{"fs":{"path":"dist/esm/cli-commands/update.js","source":"src/cli-commands/update.ts","inject":["param.0","param.1","param.2"]},"cli":{"inject":["param.0","param.1","$container"]},"":{"inject":["param.0","param.1","param.2"]}}},{"name":"version","config":{"fs":{"path":"dist/esm/cli-commands/version.js","source":"src/cli-commands/version.ts","inject":["param.0","param.1"]},"":{"inject":["param.0","param.1"]},"cli":{"inject":["options.packageName","options.folder"],"usage":"version <packageName> [folder]"},"schema":{"inject":["param.0","param.1"],"$defs":{"param.0":{"type":"string"},"param.1":{"type":"string"}}}}}],"$schema":"https://raw.githubusercontent.com/npenin/akala/main/packages/commands/container-schema.json"} as Metadata.Container;
41
+ export const meta={"name":"pm","commands":[{"name":"$init","config":{"fs":{"path":"dist/esm/cli-commands/$init.js","source":"src/cli-commands/$init.ts","inject":["param.0"]},"cli":{"inject":["context"],"options":{"pmSock":{"aliases":["pm-sock"],"needsValue":true}}},"":{"inject":["param.0"]}}},{"name":"connect","config":{"fs":{"path":"dist/esm/cli-commands/connect.js","source":"src/cli-commands/connect.ts","inject":["param.0","param.1"]},"":{"inject":["param.0","param.1"]},"cli":{"usage":"connect <name>","inject":["options.name","context"],"options":{"tcpPort":{"needsValue":true,"aliases":["tcp-port"]},"port":{"needsValue":true},"key":{"needsValue":true},"cert":{"needsValue":true}}}}},{"name":"discover","config":{"fs":{"path":"dist/esm/cli-commands/discover.js","source":"src/cli-commands/discover.ts","inject":["param.0","param.1","$container"]},"":{"inject":["param.0","param.1","$container"]},"cli":{"usage":"discover <name> <folder>","options":{"folder":{"normalize":true}},"inject":["options.name","options.folder","$container"]}}},{"name":"install","config":{"fs":{"path":"dist/esm/cli-commands/install.js","source":"src/cli-commands/install.ts","inject":["param.0","$container"]},"":{"inject":["param.0","$container"]},"cli":{"inject":["param.0","$container"]}}},{"name":"link","config":{"fs":{"path":"dist/esm/cli-commands/link.js","source":"src/cli-commands/link.ts","inject":["param.0","param.1","$container"]},"":{"inject":["param.0","param.1","$container"]},"cli":{"inject":["param.0","param.1","$container"]}}},{"name":"log","config":{"fs":{"path":"dist/esm/cli-commands/log.js","source":"src/cli-commands/log.ts","inject":["param.0"]},"":{"inject":["param.0"]},"cli":{"inject":["param.0"]}}},{"name":"ls","config":{"fs":{"path":"dist/esm/cli-commands/ls.js","source":"src/cli-commands/ls.ts","inject":[]},"":{"inject":[]},"cli":{"inject":[]},"html-form":{"inject":[]}}},{"name":"map","config":{"fs":{"path":"dist/esm/cli-commands/map.js","source":"src/cli-commands/map.ts","inject":["param.0","param.1","param.2","param.3","param.4"]},"":{"inject":["param.0","param.1","param.2","param.3","param.4"]},"cli":{"inject":["options.name","options.path","options.runtime","cwd","options"],"options":{"commandable":{"aliases":["c"],"needsValue":false},"stateless":{"aliases":["s"],"needsValue":false},"runtime":{"aliases":["r"],"needsValue":true}},"usage":"map <name> <path>"}}},{"name":"run","config":{"fs":{"path":"dist/esm/cli-commands/run.js","source":"src/cli-commands/run.ts","inject":["param.0","param.1"]},"":{"inject":["param.0","param.1"]},"jsonrpc":false,"cli":{"options":{"output":{"aliases":["o"],"needsValue":true,"doc":"output as `table` if array otherwise falls back to standard node output"},"verbose":{"aliases":["v"]},"tls":{"doc":"enables tls connection to the `pmSock`"},"pmSock":{"aliases":["pm-sock"],"needsValue":true,"doc":"path to the unix socket or destination in the form host:port"},"help":{"doc":"displays this help message"},"keepAttached":{"aliases":["keep-attached"],"needsValue":false,"doc":"keeps the process attached to the current terminal"},"wait":{"aliases":["w"],"needsValue":false,"doc":"waits for the program to be started before returning, otherwise, returns after the start command is sent to the pm daemon"},"inspect":{"needsValue":false,"doc":"starts the process with --inspect-brk parameter to help debugging"},"new":{"needsValue":false},"name":{"doc":"name to assign to the process","needsValue":true},"program":{"doc":"program to start"}},"inject":["options.program","options.name","context","options.pmSock"],"usage":"run <name> [...args]"}}},{"name":"start","config":{"fs":{"path":"dist/esm/cli-commands/start.js","source":"src/cli-commands/start.ts","inject":["param.0","param.1"]},"":{"inject":["param.0","param.1"]},"cli":{"options":{"output":{"aliases":["o"],"needsValue":true,"doc":"output as `table` if array otherwise falls back to standard node output"},"verbose":{"aliases":["v"]},"tls":{"doc":"enables tls connection to the `pmSock`"},"pmSock":{"aliases":["pm-sock"],"needsValue":true,"doc":"path to the unix socket or destination in the form host:port"},"help":{"doc":"displays this help message"},"keepAttached":{"aliases":["keep-attached"],"needsValue":false,"doc":"keeps the process attached to the current terminal"},"wait":{"aliases":["w"],"needsValue":false,"doc":"waits for the program to be started before returning, otherwise, returns after the start command is sent to the pm daemon"},"inspect":{"needsValue":false,"doc":"starts the process with --inspect-brk parameter to help debugging"},"program":{"doc":"program to start"}},"inject":["options.program","context"],"usage":"start pm"}}},{"name":"uninstall","config":{"fs":{"path":"dist/esm/cli-commands/uninstall.js","source":"src/cli-commands/uninstall.ts","inject":["param.0","$container"]},"":{"inject":["param.0","$container"]},"cli":{"inject":["param.0","$container"]}}},{"name":"update","config":{"fs":{"path":"dist/esm/cli-commands/update.js","source":"src/cli-commands/update.ts","inject":["param.0","param.1","param.2"]},"cli":{"inject":["param.0","param.1","$container"]},"":{"inject":["param.0","param.1","param.2"]}}},{"name":"version","config":{"fs":{"path":"dist/esm/cli-commands/version.js","source":"src/cli-commands/version.ts","inject":["param.0","param.1"]},"":{"inject":["param.0","param.1"]},"cli":{"inject":["options.packageName","options.folder"],"usage":"version <packageName> [folder]"},"schema":{"inject":["param.0","param.1"],"$defs":{"param.0":{"type":"string"},"param.1":{"type":"string"}}}}}],"$schema":"https://raw.githubusercontent.com/npenin/akala/main/packages/commands/container-schema.json"} as Metadata.Container;
42
42
 
43
43
  export function connect(processor?:ICommandProcessor) {
44
44
  const container = new Container<void>("cliCommands", void 0);