@akala/pm 8.0.25 → 8.1.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 (58) hide show
  1. package/changelog.md +1 -1
  2. package/dist/cjs/cli-commands/start-self.js +37 -48
  3. package/dist/cjs/cli-commands/start-self.js.map +1 -1
  4. package/dist/cjs/commands/config.js +15 -26
  5. package/dist/cjs/commands/config.js.map +1 -1
  6. package/dist/cjs/commands/connect.js +21 -33
  7. package/dist/cjs/commands/connect.js.map +1 -1
  8. package/dist/cjs/commands/discover.js +59 -70
  9. package/dist/cjs/commands/discover.js.map +1 -1
  10. package/dist/cjs/commands/install.js +9 -20
  11. package/dist/cjs/commands/install.js.map +1 -1
  12. package/dist/cjs/commands/link.js +6 -17
  13. package/dist/cjs/commands/link.js.map +1 -1
  14. package/dist/cjs/commands/log.js +1 -2
  15. package/dist/cjs/commands/log.js.map +1 -1
  16. package/dist/cjs/commands/map.js +6 -17
  17. package/dist/cjs/commands/map.js.map +1 -1
  18. package/dist/cjs/commands/proxy.js +14 -25
  19. package/dist/cjs/commands/proxy.js.map +1 -1
  20. package/dist/cjs/commands/ready.js +19 -31
  21. package/dist/cjs/commands/ready.js.map +1 -1
  22. package/dist/cjs/commands/reload-metadata.js +4 -15
  23. package/dist/cjs/commands/reload-metadata.js.map +1 -1
  24. package/dist/cjs/commands/restart.js +3 -14
  25. package/dist/cjs/commands/restart.js.map +1 -1
  26. package/dist/cjs/commands/start.js +123 -135
  27. package/dist/cjs/commands/start.js.map +1 -1
  28. package/dist/cjs/commands/stop.js +26 -37
  29. package/dist/cjs/commands/stop.js.map +1 -1
  30. package/dist/cjs/commands/update.js +11 -22
  31. package/dist/cjs/commands/update.js.map +1 -1
  32. package/dist/cjs/commands/version.js +10 -21
  33. package/dist/cjs/commands/version.js.map +1 -1
  34. package/dist/cjs/index.js +20 -32
  35. package/dist/cjs/index.js.map +1 -1
  36. package/dist/cjs/ipc-adapter.js +1 -0
  37. package/dist/cjs/ipc-adapter.js.map +1 -1
  38. package/dist/cjs/new-line-prefixer.js +3 -2
  39. package/dist/cjs/new-line-prefixer.js.map +1 -1
  40. package/dist/cjs/npm-helper.js +6 -21
  41. package/dist/cjs/npm-helper.js.map +1 -1
  42. package/dist/cjs/sidecar.js +8 -17
  43. package/dist/cjs/sidecar.js.map +1 -1
  44. package/dist/cjs/standalone.js +12 -21
  45. package/dist/cjs/standalone.js.map +1 -1
  46. package/dist/cjs/test/pwet.js +4 -15
  47. package/dist/cjs/test/pwet.js.map +1 -1
  48. package/dist/cjs/yarn-helper.js +6 -21
  49. package/dist/cjs/yarn-helper.js.map +1 -1
  50. package/dist/esm/cli.js +2 -42
  51. package/dist/esm/cli.js.map +1 -1
  52. package/dist/esm/commands/connect.js +1 -1
  53. package/dist/esm/commands/connect.js.map +1 -1
  54. package/dist/tsconfig.cjs.tsbuildinfo +1 -1
  55. package/dist/tsconfig.esm.tsbuildinfo +1 -1
  56. package/package.json +6 -6
  57. package/src/cli.ts +2 -53
  58. package/src/commands/connect.ts +1 -1
package/src/cli.ts CHANGED
@@ -8,7 +8,7 @@ import start from './cli-commands/start-self.js'
8
8
  import { Readable } from 'stream';
9
9
 
10
10
  import State, { StateConfiguration } from './state.js';
11
- import { program, buildCliContextFromProcess, ErrorMessage } from '@akala/cli';
11
+ import { program, buildCliContextFromProcess, ErrorMessage, supportInteract } from '@akala/cli';
12
12
  import { InteractError } from './index.js';
13
13
  import { Binding } from '@akala/core';
14
14
  import { open } from 'fs/promises';
@@ -158,27 +158,7 @@ cli.preAction(async c =>
158
158
  }).
159
159
  // cli.
160
160
  // useMiddleware(null, handle).
161
- useError(async (err: InteractError, args) =>
162
- {
163
- if (err.code === 'INTERACT')
164
- {
165
- console.log(err.message);
166
- const value = await readLine();
167
- if (typeof err.as == 'string')
168
- {
169
- const indexOfDot = err.as.indexOf('.');
170
- if (indexOfDot > 0)
171
- {
172
- Binding.getSetter(args.options, err.as)(value);
173
- }
174
- args.options[err.as] = value;
175
- }
176
- else
177
- args.args.push(value);
178
- return await cli.process(args);
179
- }
180
- throw err;
181
- })
161
+ useError(supportInteract(cli))
182
162
 
183
163
  // handle.action(async args =>
184
164
  // {
@@ -410,35 +390,4 @@ function formatResult(result: unknown, outputFormat: string)
410
390
  console.log(result);
411
391
  break;
412
392
  }
413
- }
414
-
415
- let stdinBuffer = '';
416
- function readLine()
417
- {
418
- process.stdin.pause();
419
- return new Promise<string>((resolve) =>
420
- {
421
-
422
- process.stdin.on('data', function processChunk(chunk)
423
- {
424
- const indexOfNewLine = stdinBuffer.length + chunk.indexOf('\n');
425
- stdinBuffer += chunk;
426
- if (indexOfNewLine > -1)
427
- {
428
- process.stdin.pause();
429
- process.stdin.removeListener('data', processChunk);
430
- if (indexOfNewLine < stdinBuffer.length - 1)
431
- {
432
- resolve(stdinBuffer.substr(0, indexOfNewLine));
433
- stdinBuffer = stdinBuffer.substr(indexOfNewLine + 1);
434
- }
435
- else
436
- {
437
- resolve(stdinBuffer);
438
- stdinBuffer = '';
439
- }
440
- }
441
- })
442
- process.stdin.resume();
443
- })
444
393
  }
@@ -11,7 +11,7 @@ export default async function connect(this: State, name: string, context?: Serve
11
11
  if (!mapping)
12
12
  mapping = Object.values(this.config.mapping).find(m => m.container === name);
13
13
  if (!mapping)
14
- mapping = await Configuration.new(null, this.processes[name] as SidecarConfiguration);
14
+ mapping = await Configuration.newAsync(null, this.processes[name] as SidecarConfiguration);
15
15
  // console.log(name);
16
16
  // console.log(mapping);
17
17
  // console.log(mapping.connect);