@akala/pm 14.5.2 → 14.5.3

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/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.5.2",
7
+ "version": "14.5.3",
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",
@@ -30,8 +30,8 @@
30
30
  ],
31
31
  "dependencies": {
32
32
  "@akala/cli": "^5.6.1",
33
- "@akala/commands": "^13.0.5",
34
- "@akala/config": "^6.0.59",
33
+ "@akala/commands": "^14.0.0",
34
+ "@akala/config": "^6.0.60",
35
35
  "@akala/core": "^39.0.0",
36
36
  "@akala/json-rpc-ws": "^11.0.75",
37
37
  "reflect-metadata": "^0.2.2",
@@ -59,9 +59,8 @@
59
59
  "default": "./dist/cjs/index.js"
60
60
  }
61
61
  },
62
- "./commands.json": {
63
- "default": "./commands.json"
64
- },
62
+ "./commands.json": "./commands.json",
63
+ "./cli-commands.json": "./cli-commands.json",
65
64
  "./akala": {
66
65
  "default": "./dist/esm/akala.mjs",
67
66
  "bun": "./src/akala.mts"
package/src/akala.mts CHANGED
@@ -38,8 +38,6 @@ const truncate = '…';
38
38
  type CliOptions = { output: string, verbose: number, pmSock: string | number, tls: boolean, help: boolean };
39
39
  export default async function (_config, program: NamespaceMiddleware<{ configFile: string, verbose: number }>)
40
40
  {
41
-
42
-
43
41
  const cli = program.command('pm').state<{ pm?: StateConfiguration }>().options<CliOptions>({
44
42
  output: { aliases: ['o'], needsValue: true, doc: 'output as `table` if array otherwise falls back to standard node output' },
45
43
  verbose: { aliases: ['v'] }, tls: { doc: "enables tls connection to the `pmSock`" },
@@ -49,7 +47,8 @@ export default async function (_config, program: NamespaceMiddleware<{ configFil
49
47
 
50
48
  const pm = new Container('pm-cli', {});
51
49
 
52
- const fs = new Processors.FileSystem();
50
+ const root = new URL('../../', import.meta.url);
51
+ const fs = new Processors.FileSystem(root);
53
52
 
54
53
  registerCommands(cliCommands.meta.commands, fs, pm);
55
54
 
@@ -16,7 +16,7 @@ namespace cliCommands
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
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>
19
- dispatch (cmd:'start', ...args: [Argument1<typeof import('./cli-commands/start.js').default>, Argument2<typeof import('./cli-commands/start.js').default>]): ReturnType<typeof import('./cli-commands/start.js').default>
19
+ 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>
20
20
  dispatch (cmd:'uninstall', ...args: [Argument0<typeof import('./cli-commands/uninstall.js').default>]): ReturnType<typeof import('./cli-commands/uninstall.js').default>
21
21
  dispatch (cmd:'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>
22
22
  dispatch (cmd:'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>
@@ -31,12 +31,12 @@ namespace cliCommands
31
31
  'log'(...args: [Argument0<typeof import('./cli-commands/log.js').default>]): ReturnType<typeof import('./cli-commands/log.js').default>
32
32
  'ls'(...args: []): ReturnType<typeof import('./cli-commands/ls.js').default>
33
33
  '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
- 'start'(...args: [Argument1<typeof import('./cli-commands/start.js').default>, Argument2<typeof import('./cli-commands/start.js').default>]): ReturnType<typeof import('./cli-commands/start.js').default>
34
+ '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>
35
35
  'uninstall'(...args: [Argument0<typeof import('./cli-commands/uninstall.js').default>]): ReturnType<typeof import('./cli-commands/uninstall.js').default>
36
36
  '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>
37
37
  '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>
38
38
  }
39
- export const meta={"name":"pm","commands":[{"name":"$init-akala","config":{"fs":{"path":"dist/esm/cli-commands/$init-akala.js","source":"src/cli-commands/$init-akala.ts","inject":["param.0"]},"cli":{"inject":["options.pmSock"],"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":"start","config":{"fs":{"path":"dist/esm/cli-commands/start.js","source":"src/cli-commands/start.ts","inject":["$container","param.0","param.1"]},"":{"inject":["$container","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"},"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":["$container","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;
39
+ export const meta={"name":"pm","commands":[{"name":"$init-akala","config":{"fs":{"path":"dist/esm/cli-commands/$init-akala.js","source":"src/cli-commands/$init-akala.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":"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"},"new":{"needsValue":false},"name":{"doc":"name to assign to the process","needsValue":true},"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;
40
40
 
41
41
  export function connect(processor?:ICommandProcessor) {
42
42
  const container = new Container<void>("cliCommands", void 0);
package/src/container.ts CHANGED
@@ -52,7 +52,7 @@ namespace commands
52
52
  '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>
53
53
  '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>
54
54
  }
55
- export const meta={"name":"pm","commands":[{"name":"$init","config":{"fs":{"disabled":true,"path":"dist/esm/commands/$init.js","source":"src/commands/$init.ts","inject":["$container","param.0"]},"":{"inject":["$container","param.0"]},"cli":{"inject":["$container","context"],"usage":"$init [...args]","options":{"configFile":{"needsValue":true,"aliases":["c"]},"keepAttached":{"needsValue":true}}}}},{"name":"bridge","config":{"fs":{"path":"dist/esm/commands/bridge.js","source":"src/commands/bridge.ts","inject":["param.0","param.1"]},"jsonrpc":{"inject":["param.0","socket"]},"":{"inject":["param.0","param.1"]}}},{"name":"name","config":{"fs":{"path":"dist/esm/commands/name.js","source":"src/commands/name.ts","inject":["param.0"]},"":{"inject":["param.0"]}}},{"name":"proxy","config":{"fs":{"path":"dist/esm/commands/proxy.js","source":"src/commands/proxy.ts","inject":["param.0","param.1"]},"jsonrpc":{"inject":["param.0","socket"]},"":{"inject":["param.0","param.1"]}}},{"name":"ready","config":{"fs":{"path":"dist/esm/commands/ready.js","source":"src/commands/ready.ts","inject":["$container","ignore"]},"jsonrpc":{"inject":["$container","dummy","connectionAsContainer"]},"":{"inject":["$container","connectionAsContainer"]}}},{"name":"reload-metadata","config":{"fs":{"inject":["param.0"],"path":"dist/esm/commands/reload-metadata.js","source":"src/commands/reload-metadata.ts"},"jsonrpc":{"inject":["connectionAsContainer"]},"":{"inject":["param.0"]}}},{"name":"restart","config":{"fs":{"path":"dist/esm/commands/restart.js","source":"src/commands/restart.ts","inject":["$container","param.0","param.1"]},"":{"inject":["$container","param.0","param.1"]},"cli":{"options":{"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":["$container","param.0","context"],"usage":"restart <program>"},"schema":{"inject":["$container","param.0","param.1"],"$defs":{"param.0":{"type":"string"},"param.1":{"type":"object","properties":{"wait":{"type":"boolean"}}}}},"html-form":{"inject":["$container","param.0","param.1"]}}},{"name":"start","config":{"fs":{"path":"dist/esm/commands/start.js","source":"src/commands/start.ts","inject":["$container","param.0","param.1","param.2"]},"":{"inject":["$container","param.0","param.1","param.2"]},"cli":{"options":{"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"},"autostart":{"doc":"start automatically when pm starts"}},"inject":["$container","options.program","options","context"],"usage":"start <program>"},"html-form":{"inject":["$container","param.0","param.1","param.2"]},"schema":{"inject":["$container","param.0","param.1","param.2"],"$defs":{"param.0":{"type":"string"},"param.1":{"type":"object","properties":{"wait":{"type":"boolean"},"inspect":{"type":"boolean"},"new":{"type":"boolean"},"name":{"type":"string"},"program":{"type":"string"}}},"param.2":{"type":"object","properties":{"args":{"type":"array","items":{"type":"string"}}}}}}}},{"name":"status","config":{"fs":{"path":"dist/esm/commands/status.js","source":"src/commands/status.ts","inject":["param.0"]},"":{"inject":["param.0"]},"cli":{"inject":["param.0"]},"html-form":{"inject":["param.0"]},"schema":{"inject":["param.0"],"$defs":{"param.0":{"type":"string","description":"The name of the container to get the status of"}}}}},{"name":"stop","config":{"fs":{"path":"dist/esm/commands/stop.js","source":"src/commands/stop.ts","inject":["param.0","$container"]},"":{"inject":["param.0","$container"]},"cli":{"inject":["options.process","$container"],"options":{"process":{"doc":"process to stop. Stops all the processes otherwise (including pm)."}},"usage":"stop [process]"},"html-form":{"inject":["param.0","$container"]},"schema":{"inject":["param.0","$container"],"$defs":{"param.0":{"type":"string"}}}}},{"name":"$init-akala","config":{"fs":{"path":"/Users/nicolas/dev/akala/packages/pm/dist/esm/cli-commands/$init-akala.js","source":"/Users/nicolas/dev/akala/packages/pm/src/cli-commands/$init-akala.ts","inject":["param.0"]},"cli":{"inject":["options.pmSock"],"options":{"pmSock":{"aliases":["pm-sock"],"needsValue":true}}},"":{"inject":["param.0"]}}},{"name":"connect","config":{"fs":{"path":"/Users/nicolas/dev/akala/packages/pm/dist/esm/cli-commands/connect.js","source":"/Users/nicolas/dev/akala/packages/pm/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":"/Users/nicolas/dev/akala/packages/pm/dist/esm/cli-commands/discover.js","source":"/Users/nicolas/dev/akala/packages/pm/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":"/Users/nicolas/dev/akala/packages/pm/dist/esm/cli-commands/install.js","source":"/Users/nicolas/dev/akala/packages/pm/src/cli-commands/install.ts","inject":["param.0","$container"]},"":{"inject":["param.0","$container"]},"cli":{"inject":["param.0","$container"]}}},{"name":"link","config":{"fs":{"path":"/Users/nicolas/dev/akala/packages/pm/dist/esm/cli-commands/link.js","source":"/Users/nicolas/dev/akala/packages/pm/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":"/Users/nicolas/dev/akala/packages/pm/dist/esm/cli-commands/log.js","source":"/Users/nicolas/dev/akala/packages/pm/src/cli-commands/log.ts","inject":["param.0"]},"":{"inject":["param.0"]},"cli":{"inject":["param.0"]}}},{"name":"ls","config":{"fs":{"path":"/Users/nicolas/dev/akala/packages/pm/dist/esm/cli-commands/ls.js","source":"/Users/nicolas/dev/akala/packages/pm/src/cli-commands/ls.ts","inject":[]},"":{"inject":[]},"cli":{"inject":[]},"html-form":{"inject":[]}}},{"name":"map","config":{"fs":{"path":"/Users/nicolas/dev/akala/packages/pm/dist/esm/cli-commands/map.js","source":"/Users/nicolas/dev/akala/packages/pm/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":"uninstall","config":{"fs":{"path":"/Users/nicolas/dev/akala/packages/pm/dist/esm/cli-commands/uninstall.js","source":"/Users/nicolas/dev/akala/packages/pm/src/cli-commands/uninstall.ts","inject":["param.0","$container"]},"":{"inject":["param.0","$container"]},"cli":{"inject":["param.0","$container"]}}},{"name":"update","config":{"fs":{"path":"/Users/nicolas/dev/akala/packages/pm/dist/esm/cli-commands/update.js","source":"/Users/nicolas/dev/akala/packages/pm/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":"/Users/nicolas/dev/akala/packages/pm/dist/esm/cli-commands/version.js","source":"/Users/nicolas/dev/akala/packages/pm/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"}}}}}],"extends":["./cli-commands.json"],"$schema":"https://raw.githubusercontent.com/npenin/akala/main/packages/commands/container-schema.json"} as Metadata.Container;
55
+ export const meta={"name":"pm","commands":[{"name":"$init","config":{"fs":{"disabled":true,"path":"dist/esm/commands/$init.js","source":"src/commands/$init.ts","inject":["$container","param.0"]},"":{"inject":["$container","param.0"]},"cli":{"inject":["$container","context"],"usage":"$init [...args]","options":{"configFile":{"needsValue":true,"aliases":["c"]},"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"}}}}},{"name":"bridge","config":{"fs":{"path":"dist/esm/commands/bridge.js","source":"src/commands/bridge.ts","inject":["param.0","param.1"]},"jsonrpc":{"inject":["param.0","socket"]},"":{"inject":["param.0","param.1"]}}},{"name":"name","config":{"fs":{"path":"dist/esm/commands/name.js","source":"src/commands/name.ts","inject":["param.0"]},"":{"inject":["param.0"]}}},{"name":"proxy","config":{"fs":{"path":"dist/esm/commands/proxy.js","source":"src/commands/proxy.ts","inject":["param.0","param.1"]},"jsonrpc":{"inject":["param.0","socket"]},"":{"inject":["param.0","param.1"]}}},{"name":"ready","config":{"fs":{"path":"dist/esm/commands/ready.js","source":"src/commands/ready.ts","inject":["$container","ignore"]},"jsonrpc":{"inject":["$container","dummy","connectionAsContainer"]},"":{"inject":["$container","connectionAsContainer"]}}},{"name":"reload-metadata","config":{"fs":{"inject":["param.0"],"path":"dist/esm/commands/reload-metadata.js","source":"src/commands/reload-metadata.ts"},"jsonrpc":{"inject":["connectionAsContainer"]},"":{"inject":["param.0"]}}},{"name":"restart","config":{"fs":{"path":"dist/esm/commands/restart.js","source":"src/commands/restart.ts","inject":["$container","param.0","param.1"]},"":{"inject":["$container","param.0","param.1"]},"cli":{"options":{"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":["$container","param.0","context"],"usage":"restart <program>"},"schema":{"inject":["$container","param.0","param.1"],"$defs":{"param.0":{"type":"string"},"param.1":{"type":"object","properties":{"wait":{"type":"boolean"}}}}},"html-form":{"inject":["$container","param.0","param.1"]}}},{"name":"start","config":{"fs":{"path":"dist/esm/commands/start.js","source":"src/commands/start.ts","inject":["$container","param.0","param.1","param.2"]},"":{"inject":["$container","param.0","param.1","param.2"]},"cli":{"options":{"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"},"autostart":{"doc":"start automatically when pm starts"}},"inject":["$container","options.program","options","context"],"usage":"start <program>"},"html-form":{"inject":["$container","param.0","param.1","param.2"]},"schema":{"inject":["$container","param.0","param.1","param.2"],"$defs":{"param.0":{"type":"string"},"param.1":{"type":"object","properties":{"wait":{"type":"boolean"},"inspect":{"type":"boolean"},"new":{"type":"boolean"},"name":{"type":"string"},"program":{"type":"string"}}},"param.2":{"type":"object","properties":{"args":{"type":"array","items":{"type":"string"}}}}}}}},{"name":"status","config":{"fs":{"path":"dist/esm/commands/status.js","source":"src/commands/status.ts","inject":["param.0"]},"":{"inject":["param.0"]},"cli":{"inject":["param.0"]},"html-form":{"inject":["param.0"]},"schema":{"inject":["param.0"],"$defs":{"param.0":{"type":"string","description":"The name of the container to get the status of"}}}}},{"name":"stop","config":{"fs":{"path":"dist/esm/commands/stop.js","source":"src/commands/stop.ts","inject":["param.0","$container"]},"":{"inject":["param.0","$container"]},"cli":{"inject":["options.process","$container"],"options":{"process":{"doc":"process to stop. Stops all the processes otherwise (including pm)."}},"usage":"stop [process]"},"html-form":{"inject":["param.0","$container"]},"schema":{"inject":["param.0","$container"],"$defs":{"param.0":{"type":"string"}}}}},{"name":"$init-akala","config":{"fs":{"path":"dist/esm/cli-commands/$init-akala.js","source":"src/cli-commands/$init-akala.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":"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"}}}}}],"extends":["./cli-commands.json"],"$schema":"https://raw.githubusercontent.com/npenin/akala/main/packages/commands/container-schema.json"} as Metadata.Container;
56
56
 
57
57
  export function connect(processor?:ICommandProcessor) {
58
58
  const container = new Container<void>("commands", void 0);
package/src/fork.ts CHANGED
@@ -2,16 +2,15 @@
2
2
  import sms from 'source-map-support'
3
3
  sms.install();
4
4
  import path from 'path'
5
- import { lstat } from 'fs/promises';
6
5
  import pmDef from './container.js';
7
6
  import { IpcAdapter } from "./ipc-adapter.js";
8
7
  import { logger, Logger, module as coreModule, MiddlewareCompositeAsync } from '@akala/core';
9
8
  import { program, buildCliContextFromProcess, ErrorMessage, NamespaceMiddleware } from '@akala/cli';
10
- import { Stats } from 'fs';
11
9
  import { Processors, Triggers, ServeMetadata, Cli, registerCommands, SelfDefinedCommand, StructuredParameters, Container, CommandProcessor, serveMetadata, connectByPreference, Metadata, $metadata } from '@akala/commands';
12
- import { fileURLToPath } from 'url';
10
+ import { pathToFileURL } from 'url';
13
11
  import commands from './container.js';
14
12
  import Configuration from '@akala/config';
13
+ import fsHandler, { Stats } from '@akala/fs';
15
14
 
16
15
  var isPm = false;
17
16
 
@@ -23,14 +22,14 @@ let log: Logger;
23
22
  const logMiddleware = new NamespaceMiddleware<{ program: string, name: string, tls: boolean }>(null).option<string>()('verbose', { aliases: ['v',] });
24
23
  logMiddleware.preAction(async c =>
25
24
  {
26
- const fs: Processors.FileSystem = new Processors.FileSystem(path.dirname(c.options.program));
25
+ const fs: Processors.FileSystem = new Processors.FileSystem(new URL('./', c.options.program));
27
26
  if (c.options.verbose)
28
27
  processor = new Processors.LogEventProcessor(fs, c.abort.signal, (_c, cmd, params) =>
29
28
  {
30
29
  log.verbose({ cmd, params });
31
30
  });
32
31
 
33
- const options: Processors.DiscoveryOptions = { processor: processor, isDirectory: folderOrFile.isDirectory() };
32
+ const options: Processors.DiscoveryOptions = { processor: processor, isDirectory: folderOrFile.isDirectory };
34
33
  await Processors.FileSystem.discoverCommands(c.options.program, cliContainer, options);
35
34
  });
36
35
  let initMiddleware = new NamespaceMiddleware<{ program: string, name: string, tls: boolean }>(null);
@@ -54,18 +53,12 @@ program.option<string>()('program', { needsValue: true, normalize: true, positio
54
53
  }).
55
54
  preAction(async c => //If pure js file
56
55
  {
57
- if (URL.canParse(c.options.program))
58
- {
59
- const url = new URL(c.options.program);
60
- if (url.protocol == 'file:')
61
- c.options.program = fileURLToPath(url);
62
- else
63
- throw new Error('remote commands are not yet supported');
64
- }
65
-
66
- folderOrFile = await lstat(c.options.program);
67
- if (folderOrFile.isFile() && path.extname(c.options.program) === '.js')
68
- return require(c.options.program);
56
+ if (!URL.canParse(c.options.program))
57
+ c.options.program = pathToFileURL(c.options.program).toString();
58
+ const fs = await fsHandler.process(new URL('./', c.options.program));
59
+ folderOrFile = await fs.stat(c.options.program);
60
+ if (folderOrFile.isFile && path.extname(c.options.program) === '.js')
61
+ return import(c.options.program);
69
62
 
70
63
  log = logger(c.options.name);
71
64
 
@@ -74,17 +67,17 @@ program.option<string>()('program', { needsValue: true, normalize: true, positio
74
67
 
75
68
  cliContainer = new Container('cli', {});
76
69
 
77
- if (folderOrFile.isFile())
78
- processor = new Processors.FileSystem(path.dirname(c.options.program));
70
+ if (folderOrFile.isFile)
71
+ processor = new Processors.FileSystem(new URL('./', c.options.program));
79
72
  else
80
- processor = new Processors.FileSystem(c.options.program);
73
+ processor = new Processors.FileSystem(new URL(c.options.program));
81
74
  }).
82
75
  useMiddleware(null, MiddlewareCompositeAsync.new(logMiddleware,
83
76
  {
84
77
  handle: async c =>
85
78
  {
86
79
  cliContainer.name = c.options.name;
87
- isPm = c.options.name === 'pm' && 'file://' + c.options.program === new URL('../../commands.json', import.meta.url).toString();
80
+ isPm = c.options.name === 'pm' && c.options.program === new URL('../../commands.json', import.meta.url).toString();
88
81
  const init = cliContainer.resolve('$init');
89
82
  if (init && init.config && init.config.cli && init.config.cli.options)
90
83
  {
package/src/standalone.ts CHANGED
@@ -3,10 +3,10 @@ import sms from 'source-map-support'
3
3
  sms.install();
4
4
  import * as path from 'path'
5
5
  import * as ac from '@akala/commands';
6
- import { lstat } from 'fs/promises';
7
6
  import { convertToMiddleware, logger, Logger, MiddlewareCompositeAsync } from '@akala/core';
8
7
  import { program, buildCliContextFromProcess, ErrorMessage, NamespaceMiddleware } from '@akala/cli';
9
- import { Stats } from 'fs';
8
+ import fsHandler, { Stats } from '@akala/fs';
9
+ import { pathToFileURL } from 'url';
10
10
 
11
11
  program.option('help')
12
12
  let folderOrFile: Stats;
@@ -24,7 +24,7 @@ logMiddleware.preAction(async c =>
24
24
  return undefined;
25
25
  });
26
26
 
27
- await ac.Processors.FileSystem.discoverCommands(c.options.program, cliContainer, { processor: processor, isDirectory: folderOrFile.isDirectory() });
27
+ await ac.Processors.FileSystem.discoverCommands(c.options.program, cliContainer, { processor: processor, isDirectory: folderOrFile.isDirectory });
28
28
  });
29
29
  const initMiddleware = new NamespaceMiddleware<{ program: string, name: string, tls: boolean }>(null);
30
30
  const controller = new AbortController();
@@ -45,18 +45,19 @@ program.option<string, 'program'>('program', { needsValue: true, normalize: true
45
45
  }).
46
46
  preAction(async c => //If pure js file
47
47
  {
48
- folderOrFile = await lstat(c.options.program);
49
- if (folderOrFile.isFile() && path.extname(c.options.program) === '.js')
50
- return require(c.options.program);
48
+ const fs = await fsHandler.process(pathToFileURL(c.currentWorkingDirectory));
49
+ folderOrFile = await fs.stat(c.options.program);
50
+ if (folderOrFile.isFile && path.extname(c.options.program) === '.js')
51
+ return import(c.options.program);
51
52
 
52
53
  log = logger(c.options.name);
53
54
 
54
55
  cliContainer = new ac.Container('cli', {});
55
56
 
56
- if (folderOrFile.isFile())
57
- processor = new ac.Processors.FileSystem(path.dirname(c.options.program));
57
+ if (folderOrFile.isFile)
58
+ processor = new ac.Processors.FileSystem(new URL('./', c.options.program));
58
59
  else
59
- processor = new ac.Processors.FileSystem(c.options.program);
60
+ processor = new ac.Processors.FileSystem(new URL(c.options.program));
60
61
  }).
61
62
  useMiddleware(null, MiddlewareCompositeAsync.new(logMiddleware,
62
63
  convertToMiddleware(async c =>