eas-cli 24.1.1 → 24.1.2

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.
@@ -44,7 +44,7 @@ class SimulatorEgress extends EasCommand_1.default {
44
44
  ...egress,
45
45
  signal: abortController.signal,
46
46
  onConnected: () => {
47
- log_1.default.succeed("Egress tunnel connected. Proxied HTTP(S) requests can use this machine's network.");
47
+ log_1.default.succeed('Egress tunnel connected.');
48
48
  },
49
49
  onDisconnected: () => {
50
50
  log_1.default.warn('Egress tunnel disconnected; reconnecting. Proxied HTTP(S) requests are unavailable until it reconnects.');
@@ -324,9 +324,7 @@ class Simulator extends EasCommand_1.default {
324
324
  const localEgress = (0, utils_1.getLocalEgressConfig)(remoteConfig, egressAllow);
325
325
  if (nonInteractive) {
326
326
  sessionInterrupt.dispose();
327
- if (localEgress) {
328
- log_1.default.log(`Start \`eas simulator:egress${flags['out-config-type'] === OUT_CONFIG_TYPE_VALUES.Env ? ' --config-type env' : ''}\` in another process to connect the tunnel for proxied HTTP(S) requests.`);
329
- }
327
+ // The instructions above already tell the reader to run eas simulator:egress.
330
328
  log_1.default.log(`When you are done, stop the session with: eas simulator:stop --id ${deviceRunSessionId}`);
331
329
  return;
332
330
  }
@@ -336,8 +334,6 @@ class Simulator extends EasCommand_1.default {
336
334
  let egressError;
337
335
  const egressAbortController = new AbortController();
338
336
  if (localEgress) {
339
- log_1.default.log('Press Ctrl+C to stop both the egress client and the simulator session.');
340
- log_1.default.newLine();
341
337
  sessionInterrupt.signal.addEventListener('abort', () => {
342
338
  egressAbortController.abort();
343
339
  }, { once: true });
@@ -345,7 +341,7 @@ class Simulator extends EasCommand_1.default {
345
341
  ...localEgress,
346
342
  signal: egressAbortController.signal,
347
343
  onConnected: () => {
348
- log_1.default.succeed("Egress tunnel connected. Proxied HTTP(S) requests can use this machine's network.");
344
+ log_1.default.succeed('Egress tunnel connected.');
349
345
  },
350
346
  onDisconnected: () => {
351
347
  log_1.default.warn('Egress tunnel disconnected; reconnecting. Proxied HTTP(S) requests are unavailable until it reconnects.');
@@ -825,7 +825,10 @@ async function runLocalEgressAsync({ url, token, fingerprint, port, allow = [],
825
825
  case 'disconnected':
826
826
  if (connected) {
827
827
  connected = false;
828
- onDisconnected?.(line);
828
+ // A disconnect we caused by stopping is not something to warn about.
829
+ if (!signal.aborted) {
830
+ onDisconnected?.(line);
831
+ }
829
832
  }
830
833
  break;
831
834
  case 'other':
@@ -57,7 +57,11 @@ export type LoopbackForwardPlan = {
57
57
  * port is already taken by the tunnel server, so those entries are skipped.
58
58
  */
59
59
  export declare function getLoopbackForwardPlan(allow: readonly string[], proxyPort: number): LoopbackForwardPlan;
60
- export declare function formatLoopbackForwardNotice({ ports, skipped }: LoopbackForwardPlan): string[];
60
+ /**
61
+ * Only the exception is worth a line: forwarded ports just work, but an entry
62
+ * the device host will not forward changes what the reader would expect.
63
+ */
64
+ export declare function formatLoopbackForwardNotice({ skipped }: LoopbackForwardPlan): string[];
61
65
  export declare function getLocalEgressEnvironmentVariables(egress: LocalEgressConfig | null): Record<string, string>;
62
66
  export declare function getRemoteSessionEnvironmentVariables(remoteConfig: DeviceRunSessionRemoteConfig, { egressAllow }?: LocalEgressOptions): Record<string, string>;
63
67
  type RemoteSessionInstructionsConfigType = 'env' | 'dotenv';
@@ -89,19 +89,18 @@ function getLoopbackForwardPlan(allow, proxyPort) {
89
89
  }
90
90
  return { ports: [...ports].sort((a, b) => a - b), skipped };
91
91
  }
92
- function formatLoopbackForwardNotice({ ports, skipped }) {
93
- const lines = [];
94
- if (ports.length > 0) {
95
- const addresses = ports.map(port => `127.0.0.1:${port}`).join(', ');
96
- lines.push(`${addresses} in the simulator ${ports.length === 1 ? 'reaches' : 'reach'} the same ` +
97
- `${ports.length === 1 ? 'port' : 'ports'} on this machine (like adb reverse), so dev server ` +
98
- 'URLs that use 127.0.0.1 work.');
99
- }
100
- if (skipped.length > 0) {
101
- lines.push(`${skipped.join(', ')} ${skipped.length === 1 ? 'is' : 'are'} reachable by name only: ` +
102
- 'privileged ports and the egress proxy port are not forwarded to 127.0.0.1 in the simulator.');
92
+ /**
93
+ * Only the exception is worth a line: forwarded ports just work, but an entry
94
+ * the device host will not forward changes what the reader would expect.
95
+ */
96
+ function formatLoopbackForwardNotice({ skipped }) {
97
+ if (skipped.length === 0) {
98
+ return [];
103
99
  }
104
- return lines;
100
+ return [
101
+ `${skipped.join(', ')} ${skipped.length === 1 ? 'is' : 'are'} reachable by name only: ` +
102
+ 'privileged ports and the egress proxy port are not forwarded to 127.0.0.1 in the simulator.',
103
+ ];
105
104
  }
106
105
  function getLocalEgressEnvironmentVariables(egress) {
107
106
  if (!egress) {
@@ -187,33 +186,27 @@ function formatRemoteSessionInstructions(remoteConfig, configType, { egressAllow
187
186
  return instructions;
188
187
  }
189
188
  const egressCommand = configType === 'env' ? 'eas simulator:egress --config-type env' : 'eas simulator:egress';
189
+ const summary = "🔀 Local egress: the simulator's HTTP(S) traffic exits from this machine." +
190
+ (egress.allow.length > 0 ? ` It can also reach ${egress.allow.join(', ')}.` : '');
190
191
  return [
191
192
  instructions,
192
193
  '',
193
- '🔀 This session can route proxied HTTP(S) requests through this machine.',
194
- ...(configType === 'env'
195
- ? Object.entries(getLocalEgressEnvironmentVariables(egress)).map(([key, value]) => `export ${key}='${value}'`)
196
- : []),
194
+ summary,
195
+ ...formatLoopbackForwardNotice(getLoopbackForwardPlan(egress.allow, egress.port)),
196
+ // In interactive mode the client starts in this terminal once the session is
197
+ // ready and stops with it, so there is nothing for the reader to run.
197
198
  ...(egressClientRunsInline
198
- ? [
199
- 'The egress client runs in this terminal for the life of the session. If this process exits, reconnect the tunnel from another shell with:',
200
- '',
201
- egressCommand,
202
- ]
199
+ ? []
203
200
  : [
201
+ ...(configType === 'env'
202
+ ? Object.entries(getLocalEgressEnvironmentVariables(egress)).map(([key, value]) => `export ${key}='${value}'`)
203
+ : []),
204
204
  'Run the egress client to connect the tunnel:',
205
205
  '',
206
206
  egressCommand,
207
207
  '',
208
208
  'Keep it running for the life of the session.',
209
209
  ]),
210
- ...(egress.allow.length > 0
211
- ? [
212
- '',
213
- `The simulator may reach ${egress.allow.join(', ')} on this machine's network.`,
214
- ...formatLoopbackForwardNotice(getLoopbackForwardPlan(egress.allow, egress.port)),
215
- ]
216
- : []),
217
210
  ].join('\n');
218
211
  }
219
212
  function formatControllerInstructions(remoteConfig, configType) {