@akala/pm 5.2.20 → 5.2.22

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/src/cli.ts CHANGED
@@ -40,7 +40,7 @@ cli.command('start pm')
40
40
  .action(c =>
41
41
  {
42
42
  c.options['name'] = 'pm'
43
- c.options['program'] = require.resolve('../commands.json');
43
+ c.options['program'] = new URL('../../commands.json', import.meta.url).toString();
44
44
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
45
45
  return start.call({} as unknown as State, null, 'pm', c as any);
46
46
  });
@@ -59,7 +59,7 @@ cli.preAction(async c =>
59
59
  const netsocket = socket = new Socket();
60
60
  if (c.options.tls)
61
61
  {
62
- socket = new TLSSocket(socket, {});
62
+ socket = new TLSSocket(netsocket, {});
63
63
  }
64
64
 
65
65
  await new Promise<void>((resolve, reject) =>
@@ -84,9 +84,9 @@ cli.preAction(async c =>
84
84
  try
85
85
  {
86
86
  // eslint-disable-next-line @typescript-eslint/no-var-requires
87
- const config = require(path.join(homedir(), './.pm.config.json'));
88
-
89
- netsocket.connect(config.mapping.pm.connect.socket[0]);
87
+ import(path.join(homedir(), './.pm.config.json'), { assert: { type: 'json' } }).then(config =>
88
+ netsocket.connect(config.default.mapping.pm.connect.socket[0])
89
+ );
90
90
  }
91
91
  catch (e)
92
92
  {
@@ -144,7 +144,7 @@ cli.preAction(async c =>
144
144
  if (!processor)
145
145
  processor = new Processors.JsonRpc(Processors.JsonRpc.getConnection(new NetSocketAdapter(socket)));
146
146
  if (!metaContainer)
147
- metaContainer = require('../commands.json');
147
+ metaContainer = (await import(new URL('../../commands.json', import.meta.url).toString(), { assert: { type: 'json' } })).default;
148
148
  if (!container)
149
149
  {
150
150
  container = proxy(metaContainer, processor);
package/src/fork.ts CHANGED
@@ -143,7 +143,7 @@ program.option<string, 'program'>('program', { needsValue: true, normalize: true
143
143
  {
144
144
  if (!pmConnectInfo)
145
145
  pmConnectInfo = await pm.dispatch('connect', 'pm');
146
- var pm2 = await ac.connectByPreference(pmConnectInfo, { container: cliContainer });
146
+ var pm2 = await ac.connectByPreference(pmConnectInfo, { container: cliContainer, metadata: await cliContainer.dispatch('$metadata') });
147
147
  pm2.container.processor.useMiddleware(20, pm2.processor);
148
148
  pm2.container.unregister(ac.Cli.Metadata.name);
149
149
  pm2.container.register(ac.Metadata.extractCommandMetadata(ac.Cli.Metadata));
package/tsconfig.cjs.json CHANGED
@@ -3,7 +3,10 @@
3
3
  "compileOnSave": true,
4
4
  "compilerOptions": {
5
5
  "rootDir": "src",
6
- "outDir": "dist/cjs"
6
+ "outDir": "dist/cjs",
7
+ "customConditions": [
8
+ "node"
9
+ ]
7
10
  },
8
11
  "references": [
9
12
  {
package/tsconfig.esm.json CHANGED
@@ -3,7 +3,10 @@
3
3
  "compileOnSave": true,
4
4
  "compilerOptions": {
5
5
  "rootDir": "src",
6
- "outDir": "dist/esm"
6
+ "outDir": "dist/esm",
7
+ "customConditions": [
8
+ "node"
9
+ ]
7
10
  },
8
11
  "references": [
9
12
  {