@expo/cli 55.0.6 → 55.0.8

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 (87) hide show
  1. package/build/bin/cli +13 -1
  2. package/build/bin/cli.map +1 -1
  3. package/build/src/api/user/actions.js +5 -2
  4. package/build/src/api/user/actions.js.map +1 -1
  5. package/build/src/api/user/expoSsoLauncher.js +22 -49
  6. package/build/src/api/user/expoSsoLauncher.js.map +1 -1
  7. package/build/src/api/user/user.js +6 -5
  8. package/build/src/api/user/user.js.map +1 -1
  9. package/build/src/config/configAsync.js +1 -1
  10. package/build/src/config/configAsync.js.map +1 -1
  11. package/build/src/customize/customizeAsync.js +1 -1
  12. package/build/src/customize/customizeAsync.js.map +1 -1
  13. package/build/src/export/embed/exportEmbedAsync.js +1 -1
  14. package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
  15. package/build/src/export/exportApp.js +1 -1
  16. package/build/src/export/exportApp.js.map +1 -1
  17. package/build/src/export/exportStaticAsync.js +7 -11
  18. package/build/src/export/exportStaticAsync.js.map +1 -1
  19. package/build/src/export/web/exportWebAsync.js +1 -1
  20. package/build/src/export/web/exportWebAsync.js.map +1 -1
  21. package/build/src/install/installAsync.js +1 -1
  22. package/build/src/install/installAsync.js.map +1 -1
  23. package/build/src/lint/lintAsync.js +1 -1
  24. package/build/src/lint/lintAsync.js.map +1 -1
  25. package/build/src/login/index.js +6 -2
  26. package/build/src/login/index.js.map +1 -1
  27. package/build/src/prebuild/prebuildAsync.js +1 -1
  28. package/build/src/prebuild/prebuildAsync.js.map +1 -1
  29. package/build/src/run/android/runAndroidAsync.js +1 -1
  30. package/build/src/run/android/runAndroidAsync.js.map +1 -1
  31. package/build/src/run/ios/runIosAsync.js +1 -1
  32. package/build/src/run/ios/runIosAsync.js.map +1 -1
  33. package/build/src/serve/serveAsync.js +1 -1
  34. package/build/src/serve/serveAsync.js.map +1 -1
  35. package/build/src/start/interface/commandsTable.js +89 -69
  36. package/build/src/start/interface/commandsTable.js.map +1 -1
  37. package/build/src/start/interface/interactiveActions.js +29 -14
  38. package/build/src/start/interface/interactiveActions.js.map +1 -1
  39. package/build/src/start/platforms/ios/devicectl.js +4 -1
  40. package/build/src/start/platforms/ios/devicectl.js.map +1 -1
  41. package/build/src/start/server/BundlerDevServer.js +16 -9
  42. package/build/src/start/server/BundlerDevServer.js.map +1 -1
  43. package/build/src/start/server/DevServerManager.js +5 -1
  44. package/build/src/start/server/DevServerManager.js.map +1 -1
  45. package/build/src/start/server/UrlCreator.js +17 -7
  46. package/build/src/start/server/UrlCreator.js.map +1 -1
  47. package/build/src/start/server/getStaticRenderFunctions.js +8 -8
  48. package/build/src/start/server/getStaticRenderFunctions.js.map +1 -1
  49. package/build/src/start/server/metro/MetroBundlerDevServer.js +20 -20
  50. package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
  51. package/build/src/start/server/metro/MetroTerminalReporter.js +1 -1
  52. package/build/src/start/server/metro/MetroTerminalReporter.js.map +1 -1
  53. package/build/src/start/server/metro/createServerComponentsMiddleware.js +1 -1
  54. package/build/src/start/server/metro/createServerComponentsMiddleware.js.map +1 -1
  55. package/build/src/start/server/metro/debugging/createDebugMiddleware.js +5 -1
  56. package/build/src/start/server/metro/debugging/createDebugMiddleware.js.map +1 -1
  57. package/build/src/start/server/metro/dev-server/createMetroMiddleware.js +18 -18
  58. package/build/src/start/server/metro/dev-server/createMetroMiddleware.js.map +1 -1
  59. package/build/src/start/server/metro/instantiateMetro.js +9 -5
  60. package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
  61. package/build/src/start/server/metro/log-box/LogBoxSymbolication.js +5 -1
  62. package/build/src/start/server/metro/log-box/LogBoxSymbolication.js.map +1 -1
  63. package/build/src/start/server/metro/resolveLoader.js +2 -0
  64. package/build/src/start/server/metro/resolveLoader.js.map +1 -1
  65. package/build/src/start/server/metro/runServer-fork.js +6 -5
  66. package/build/src/start/server/metro/runServer-fork.js.map +1 -1
  67. package/build/src/start/server/webpack/WebpackBundlerDevServer.js +4 -4
  68. package/build/src/start/server/webpack/WebpackBundlerDevServer.js.map +1 -1
  69. package/build/src/utils/downloadExpoGoAsync.js +36 -0
  70. package/build/src/utils/downloadExpoGoAsync.js.map +1 -1
  71. package/build/src/utils/editor.js +404 -31
  72. package/build/src/utils/editor.js.map +1 -1
  73. package/build/src/utils/env.js +13 -11
  74. package/build/src/utils/env.js.map +1 -1
  75. package/build/src/utils/getRunningProcess.js +80 -41
  76. package/build/src/utils/getRunningProcess.js.map +1 -1
  77. package/build/src/utils/ip.js +44 -8
  78. package/build/src/utils/ip.js.map +1 -1
  79. package/build/src/utils/nodeEnv.js +66 -1
  80. package/build/src/utils/nodeEnv.js.map +1 -1
  81. package/build/src/utils/port.js +2 -2
  82. package/build/src/utils/port.js.map +1 -1
  83. package/build/src/utils/qr.js +186 -0
  84. package/build/src/utils/qr.js.map +1 -0
  85. package/build/src/utils/telemetry/clients/FetchClient.js +1 -1
  86. package/build/src/utils/telemetry/utils/context.js +1 -1
  87. package/package.json +16 -17
@@ -12,6 +12,9 @@ _export(exports, {
12
12
  guessEditor: function() {
13
13
  return guessEditor;
14
14
  },
15
+ guessFallbackVisualEditor: function() {
16
+ return guessFallbackVisualEditor;
17
+ },
15
18
  openInEditorAsync: function() {
16
19
  return openInEditorAsync;
17
20
  }
@@ -23,9 +26,23 @@ function _spawnasync() {
23
26
  };
24
27
  return data;
25
28
  }
26
- function _enveditor() {
27
- const data = /*#__PURE__*/ _interop_require_default(require("env-editor"));
28
- _enveditor = function() {
29
+ function _nodefs() {
30
+ const data = /*#__PURE__*/ _interop_require_default(require("node:fs"));
31
+ _nodefs = function() {
32
+ return data;
33
+ };
34
+ return data;
35
+ }
36
+ function _nodepath() {
37
+ const data = /*#__PURE__*/ _interop_require_default(require("node:path"));
38
+ _nodepath = function() {
39
+ return data;
40
+ };
41
+ return data;
42
+ }
43
+ function _nodeprocess() {
44
+ const data = /*#__PURE__*/ _interop_require_default(require("node:process"));
45
+ _nodeprocess = function() {
29
46
  return data;
30
47
  };
31
48
  return data;
@@ -79,70 +96,189 @@ function _interop_require_wildcard(obj, nodeInterop) {
79
96
  return newObj;
80
97
  }
81
98
  const debug = require('debug')('expo:utils:editor');
99
+ // See: https://github.com/sindresorhus/env-editor/blob/3f6aea10ff53910c877b1bf73a8e0c954a5fbf11/index.js
100
+ // MIT License, Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
101
+ function getEditor(input, allowAnyEditor = false) {
102
+ var _needle_split_pop;
103
+ const needle = input == null ? void 0 : input.trim().toLowerCase();
104
+ if (!needle) {
105
+ return null;
106
+ }
107
+ const id = (_needle_split_pop = needle.split(/[/\\]/).pop()) == null ? void 0 : _needle_split_pop.replace(/\s/g, '-');
108
+ const binary = id == null ? void 0 : id.split('-')[0];
109
+ const editor = EDITORS.find((editor)=>{
110
+ switch(needle){
111
+ case editor.id:
112
+ case editor.name.toLowerCase():
113
+ case editor.binary:
114
+ return true;
115
+ default:
116
+ for (const editorPath of editor.paths){
117
+ if (_nodepath().default.normalize(needle) === _nodepath().default.normalize(editorPath.toLowerCase())) return true;
118
+ }
119
+ for (const keyword of editor.keywords){
120
+ if (needle === keyword) return true;
121
+ }
122
+ return false;
123
+ }
124
+ }) ?? (binary ? EDITORS.find((editor)=>editor.binary === binary) : null);
125
+ if (allowAnyEditor && id && binary && !editor) {
126
+ return {
127
+ id,
128
+ name: needle,
129
+ binary,
130
+ isTerminalEditor: false,
131
+ paths: [],
132
+ keywords: []
133
+ };
134
+ }
135
+ return editor || null;
136
+ }
82
137
  function guessEditor() {
83
- try {
84
- const editor = _env.env.EXPO_EDITOR;
138
+ let editor = null;
139
+ if (_env.env.EXPO_EDITOR) {
140
+ editor = getEditor(_env.env.EXPO_EDITOR);
141
+ if (editor) {
142
+ debug('Using $EXPO_EDITOR:', editor.name);
143
+ }
144
+ }
145
+ if (!editor && _nodeprocess().default.env.VISUAL) {
146
+ editor = getEditor(_nodeprocess().default.env.VISUAL);
147
+ if (editor) {
148
+ debug('Using $VISUAL:', editor.name);
149
+ }
150
+ }
151
+ if (!editor && _nodeprocess().default.env.EDITOR) {
152
+ editor = getEditor(_nodeprocess().default.env.EDITOR);
85
153
  if (editor) {
86
- debug('Using $EXPO_EDITOR:', editor);
87
- return _enveditor().default.getEditor(editor);
154
+ debug('Using $EDITOR:', editor.name);
155
+ }
156
+ }
157
+ return editor;
158
+ }
159
+ async function guessFallbackVisualEditor() {
160
+ // We search for editors at known `editor.paths`
161
+ for (const editor of VISUAL_EDITORS){
162
+ const target = await editorExistsAtPaths(editor);
163
+ if (target) {
164
+ debug('Found visual editor fallback:', editor.name);
165
+ return {
166
+ ...editor,
167
+ binary: target
168
+ };
88
169
  }
89
- debug('Falling back on $EDITOR:', editor);
90
- return _enveditor().default.defaultEditor();
91
- } catch {
92
- debug('Falling back on vscode');
93
- return _enveditor().default.getEditor('vscode');
94
170
  }
171
+ // We search again for a visual editor against `editor.binary` in `$PATH`
172
+ for (const editor of VISUAL_EDITORS){
173
+ const target = await editorExistsInPath(editor);
174
+ if (target) {
175
+ debug('Found visual editor fallback in $PATH:', editor.name);
176
+ return {
177
+ ...editor,
178
+ binary: target
179
+ };
180
+ }
181
+ }
182
+ return null;
183
+ }
184
+ let _cachedEditor;
185
+ async function determineEditorAsync() {
186
+ if (_cachedEditor !== undefined) {
187
+ return _cachedEditor;
188
+ }
189
+ // First: Try to get a known editor
190
+ let editor = guessEditor();
191
+ // Second: If we don't have a known editor, fall back to EXPO_EDITOR / VISUAL resolution
192
+ // We check if the binary in these environment variables exists in the $PATH
193
+ const forceEditorName = _env.env.EXPO_EDITOR ?? _nodeprocess().default.env.VISUAL;
194
+ if (!editor && forceEditorName) {
195
+ const forceEditor = getEditor(forceEditorName, true);
196
+ if (forceEditor && await editorExistsInPath(forceEditor)) {
197
+ editor = forceEditor;
198
+ }
199
+ }
200
+ // Third: Try to find a fallback visual editor, but keep the found one if we can't find a fallback
201
+ if (editor == null ? void 0 : editor.isTerminalEditor) {
202
+ const fallback = await guessFallbackVisualEditor();
203
+ if (fallback) {
204
+ editor = fallback;
205
+ }
206
+ }
207
+ return _cachedEditor = editor;
95
208
  }
96
209
  async function openInEditorAsync(path, lineNumber) {
97
- const editor = guessEditor();
98
- const fileReference = lineNumber ? `${path}:${lineNumber}` : path;
99
- debug(`Opening ${fileReference} in ${editor == null ? void 0 : editor.name} (bin: ${editor == null ? void 0 : editor.binary}, id: ${editor == null ? void 0 : editor.id})`);
100
- if (editor) {
101
- try {
102
- await (0, _spawnasync().default)(editor.binary, getEditorArguments(editor, path, lineNumber));
103
- return true;
104
- } catch (error) {
105
- debug(`Failed to open ${fileReference} in editor (path: ${path}, binary: ${editor.binary}):`, error);
210
+ const editor = await determineEditorAsync();
211
+ if (editor && !editor.isTerminalEditor) {
212
+ const fileReference = lineNumber ? `${path}:${lineNumber}` : path;
213
+ debug(`Opening ${fileReference} in ${editor == null ? void 0 : editor.name} (bin: ${editor == null ? void 0 : editor.binary}, id: ${editor == null ? void 0 : editor.id})`);
214
+ if (editor) {
215
+ try {
216
+ await (0, _spawnasync().default)(editor.binary, getEditorArguments(editor, path, lineNumber), {
217
+ timeout: 1000
218
+ });
219
+ return true;
220
+ } catch (error) {
221
+ // NOTE(@kitten): The process might explicitly request to be terminated, which is fine
222
+ if ((error == null ? void 0 : error.signal) === 'SIGTERM') {
223
+ return true;
224
+ }
225
+ debug(`Failed to open ${fileReference} in editor (path: ${path}, binary: ${editor.binary}):`, error);
226
+ }
106
227
  }
107
228
  }
108
- _log.error('Could not open editor, you can set it by defining the $EDITOR environment variable with the binary of your editor. (e.g. "vscode" or "atom")');
229
+ _log.error(((editor == null ? void 0 : editor.isTerminalEditor) ? `Could not open ${editor.name} as it's a terminal editor.` : 'Could not open editor.') + `\nYou can set an editor for Expo to open by defining the $EXPO_EDITOR or $VISUAL environment variable (e.g. "vscode" or "atom")`);
109
230
  return false;
110
231
  }
111
232
  function getEditorArguments(editor, path, lineNumber) {
112
- if (!lineNumber) {
113
- return [
114
- path
115
- ];
116
- }
117
233
  switch(editor.id){
118
234
  case 'atom':
119
235
  case 'sublime':
120
- return [
236
+ return lineNumber ? [
121
237
  `${path}:${lineNumber}`
238
+ ] : [
239
+ path
122
240
  ];
123
241
  case 'emacs':
124
242
  case 'emacsforosx':
125
243
  case 'nano':
126
244
  case 'neovim':
127
245
  case 'vim':
128
- return [
246
+ return lineNumber ? [
129
247
  `+${lineNumber}`,
130
248
  path
249
+ ] : [
250
+ path
131
251
  ];
132
252
  case 'android-studio':
133
253
  case 'intellij':
134
254
  case 'textmate':
135
255
  case 'webstorm':
136
256
  case 'xcode':
137
- return [
257
+ return lineNumber ? [
138
258
  `--line=${lineNumber}`,
139
259
  path
260
+ ] : [
261
+ path
140
262
  ];
141
263
  case 'vscode':
142
264
  case 'vscodium':
143
- return [
265
+ case 'cursor':
266
+ return lineNumber ? [
144
267
  '-g',
145
268
  `${path}:${lineNumber}`
269
+ ] : [
270
+ '-g',
271
+ path
272
+ ];
273
+ case 'zed':
274
+ // '-r': Stands for "--reuse" and ensures we don't use the `zed` GUI binary, since the Zed CLI
275
+ // is linked as `zed` into `$PATH` when it's actually the CLI
276
+ return lineNumber ? [
277
+ '-r',
278
+ `${path}:${lineNumber}`
279
+ ] : [
280
+ '-r',
281
+ path
146
282
  ];
147
283
  default:
148
284
  return [
@@ -150,5 +286,242 @@ function getEditorArguments(editor, path, lineNumber) {
150
286
  ];
151
287
  }
152
288
  }
289
+ /** Attempt to resolve an editor against $PATH */ async function editorExistsInPath(editor) {
290
+ if (_nodeprocess().default.platform !== 'darwin' && editor.isOSXOnly) {
291
+ return null;
292
+ }
293
+ const binary = editor.binary;
294
+ const paths = (_nodeprocess().default.env.PATH || _nodeprocess().default.env.Path || '').split(_nodepath().default.delimiter).map((target)=>target.trim()).filter((target)=>!!target);
295
+ const exts = _nodeprocess().default.platform === 'win32' ? (_nodeprocess().default.env.PATHEXT || '.EXE;.CMD;.BAT;.COM').split(_nodepath().default.delimiter).filter(Boolean) : [
296
+ ''
297
+ ];
298
+ const targets = paths.flatMap((dir)=>exts.map((ext)=>_nodepath().default.join(dir, `${binary}${ext}`)));
299
+ for (const target of targets){
300
+ try {
301
+ const mode = _nodeprocess().default.platform === 'win32' ? _nodefs().default.constants.F_OK : _nodefs().default.constants.X_OK;
302
+ await _nodefs().default.promises.access(target, mode);
303
+ return target;
304
+ } catch {
305
+ // ignore not found and continue
306
+ }
307
+ }
308
+ return null;
309
+ }
310
+ /** Attempt to resolve an editor against known `paths` */ async function editorExistsAtPaths(editor) {
311
+ // We can skip the path if it's not for our platform (win32 vs posix paths)
312
+ const targets = editor.paths.filter((target)=>target.includes(_nodepath().default.sep));
313
+ for (const target of targets){
314
+ try {
315
+ const mode = _nodeprocess().default.platform === 'win32' ? _nodefs().default.constants.F_OK : _nodefs().default.constants.X_OK;
316
+ await _nodefs().default.promises.access(target, mode);
317
+ return target;
318
+ } catch {
319
+ // ignore not found and continue
320
+ }
321
+ }
322
+ return null;
323
+ }
324
+ const TERMINAL_EDITORS = [
325
+ {
326
+ id: 'vim',
327
+ name: 'Vim',
328
+ binary: 'vim',
329
+ isTerminalEditor: true,
330
+ paths: [],
331
+ keywords: [
332
+ 'vi'
333
+ ]
334
+ },
335
+ {
336
+ id: 'neovim',
337
+ name: 'NeoVim',
338
+ binary: 'nvim',
339
+ isTerminalEditor: true,
340
+ paths: [],
341
+ keywords: [
342
+ 'vim'
343
+ ]
344
+ },
345
+ {
346
+ id: 'nano',
347
+ name: 'GNU nano',
348
+ binary: 'nano',
349
+ isTerminalEditor: true,
350
+ paths: [],
351
+ keywords: []
352
+ },
353
+ {
354
+ id: 'emacs',
355
+ name: 'GNU Emacs',
356
+ binary: 'emacs',
357
+ isTerminalEditor: true,
358
+ paths: [],
359
+ keywords: []
360
+ }
361
+ ];
362
+ const VISUAL_EDITORS = [
363
+ {
364
+ id: 'vscode',
365
+ name: 'Visual Studio Code',
366
+ binary: 'code',
367
+ isTerminalEditor: false,
368
+ paths: [
369
+ '/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code'
370
+ ],
371
+ keywords: [
372
+ 'vs code'
373
+ ]
374
+ },
375
+ {
376
+ id: 'vscode-insiders',
377
+ name: 'Visual Studio Code - Insiders',
378
+ binary: 'code-insiders',
379
+ isTerminalEditor: false,
380
+ paths: [
381
+ '/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/bin/code-insiders'
382
+ ],
383
+ keywords: [
384
+ 'vs code insiders',
385
+ 'code insiders',
386
+ 'insiders'
387
+ ]
388
+ },
389
+ {
390
+ id: 'vscodium',
391
+ name: 'VSCodium',
392
+ binary: 'codium',
393
+ isTerminalEditor: false,
394
+ paths: [
395
+ '/Applications/VSCodium.app/Contents/Resources/app/bin/codium'
396
+ ],
397
+ keywords: []
398
+ },
399
+ {
400
+ id: 'cursor',
401
+ name: 'Cursor',
402
+ binary: 'cursor',
403
+ isTerminalEditor: false,
404
+ paths: [
405
+ '/Applications/Cursor.app/Contents/Resources/app/bin/codium'
406
+ ],
407
+ keywords: []
408
+ },
409
+ {
410
+ id: 'sublime',
411
+ name: 'Sublime Text',
412
+ binary: 'subl',
413
+ isTerminalEditor: false,
414
+ paths: [
415
+ '/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl',
416
+ '/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl'
417
+ ],
418
+ keywords: []
419
+ },
420
+ {
421
+ id: 'atom',
422
+ name: 'Atom',
423
+ binary: 'atom',
424
+ isTerminalEditor: false,
425
+ paths: [
426
+ '/Applications/Atom.app/Contents/Resources/app/atom.sh'
427
+ ],
428
+ keywords: []
429
+ },
430
+ {
431
+ id: 'webstorm',
432
+ name: 'WebStorm',
433
+ binary: 'webstorm',
434
+ isTerminalEditor: false,
435
+ paths: [],
436
+ keywords: [
437
+ 'wstorm'
438
+ ]
439
+ },
440
+ {
441
+ id: 'phpstorm',
442
+ name: 'PhpStorm',
443
+ binary: 'pstorm',
444
+ isTerminalEditor: false,
445
+ paths: [],
446
+ keywords: [
447
+ 'php'
448
+ ]
449
+ },
450
+ {
451
+ id: 'zed',
452
+ name: 'Zed',
453
+ binary: 'zed',
454
+ isTerminalEditor: false,
455
+ paths: [
456
+ '/Applications/Zed.app/Contents/MacOS/cli'
457
+ ],
458
+ keywords: []
459
+ },
460
+ {
461
+ id: 'textmate',
462
+ name: 'TextMate',
463
+ binary: 'mate',
464
+ isTerminalEditor: false,
465
+ paths: [],
466
+ keywords: []
467
+ },
468
+ {
469
+ id: 'intellij',
470
+ name: 'IntelliJ IDEA',
471
+ binary: 'idea',
472
+ isTerminalEditor: false,
473
+ paths: [],
474
+ keywords: [
475
+ 'idea',
476
+ 'java',
477
+ 'jetbrains',
478
+ 'ide'
479
+ ]
480
+ },
481
+ {
482
+ id: 'emacsforosx',
483
+ name: 'GNU Emacs for Mac OS X',
484
+ binary: 'Emacs',
485
+ isTerminalEditor: false,
486
+ isOSXOnly: true,
487
+ paths: [
488
+ '/Applications/Emacs.app/Contents/MacOS/Emacs'
489
+ ],
490
+ keywords: []
491
+ },
492
+ {
493
+ id: 'xcode',
494
+ name: 'Xcode',
495
+ binary: 'xed',
496
+ isTerminalEditor: false,
497
+ isOSXOnly: true,
498
+ paths: [
499
+ '/Applications/Xcode.app/Contents/MacOS/Xcode',
500
+ '/Applications/Xcode-beta.app/Contents/MacOS/Xcode'
501
+ ],
502
+ keywords: [
503
+ 'xed'
504
+ ]
505
+ },
506
+ {
507
+ id: 'android-studio',
508
+ name: 'Android Studio',
509
+ binary: 'studio',
510
+ isTerminalEditor: false,
511
+ paths: [
512
+ '/Applications/Android Studio.app/Contents/MacOS/studio',
513
+ '/usr/local/Android/android-studio/bin/studio.sh',
514
+ 'C:\\Program Files (x86)\\Android\\android-studio\\bin\\studio.exe',
515
+ 'C:\\Program Files\\Android\\android-studio\\bin\\studio64.exe'
516
+ ],
517
+ keywords: [
518
+ 'studio'
519
+ ]
520
+ }
521
+ ];
522
+ const EDITORS = [
523
+ ...VISUAL_EDITORS,
524
+ ...TERMINAL_EDITORS
525
+ ];
153
526
 
154
527
  //# sourceMappingURL=editor.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/utils/editor.ts"],"sourcesContent":["import spawnAsync from '@expo/spawn-async';\nimport editors from 'env-editor';\n\nimport { env } from './env';\nimport * as Log from '../log';\n\nconst debug = require('debug')('expo:utils:editor') as typeof console.log;\n\n/** Guess what the default editor is and default to VSCode. */\nexport function guessEditor(): editors.Editor {\n try {\n const editor = env.EXPO_EDITOR;\n if (editor) {\n debug('Using $EXPO_EDITOR:', editor);\n return editors.getEditor(editor);\n }\n debug('Falling back on $EDITOR:', editor);\n return editors.defaultEditor();\n } catch {\n debug('Falling back on vscode');\n return editors.getEditor('vscode');\n }\n}\n\n/** Open a file path in a given editor. */\nexport async function openInEditorAsync(path: string, lineNumber?: number): Promise<boolean> {\n const editor = guessEditor();\n const fileReference = lineNumber ? `${path}:${lineNumber}` : path;\n\n debug(`Opening ${fileReference} in ${editor?.name} (bin: ${editor?.binary}, id: ${editor?.id})`);\n\n if (editor) {\n try {\n await spawnAsync(editor.binary, getEditorArguments(editor, path, lineNumber));\n return true;\n } catch (error: any) {\n debug(\n `Failed to open ${fileReference} in editor (path: ${path}, binary: ${editor.binary}):`,\n error\n );\n }\n }\n\n Log.error(\n 'Could not open editor, you can set it by defining the $EDITOR environment variable with the binary of your editor. (e.g. \"vscode\" or \"atom\")'\n );\n return false;\n}\n\nfunction getEditorArguments(editor: editors.Editor, path: string, lineNumber?: number): string[] {\n if (!lineNumber) {\n return [path];\n }\n\n switch (editor.id) {\n case 'atom':\n case 'sublime':\n return [`${path}:${lineNumber}`];\n\n case 'emacs':\n case 'emacsforosx':\n case 'nano':\n case 'neovim':\n case 'vim':\n return [`+${lineNumber}`, path];\n\n case 'android-studio':\n case 'intellij':\n case 'textmate':\n case 'webstorm':\n case 'xcode':\n return [`--line=${lineNumber}`, path];\n\n case 'vscode':\n case 'vscodium':\n return ['-g', `${path}:${lineNumber}`];\n\n default:\n return [path];\n }\n}\n"],"names":["guessEditor","openInEditorAsync","debug","require","editor","env","EXPO_EDITOR","editors","getEditor","defaultEditor","path","lineNumber","fileReference","name","binary","id","spawnAsync","getEditorArguments","error","Log"],"mappings":";;;;;;;;;;;IASgBA,WAAW;eAAXA;;IAgBMC,iBAAiB;eAAjBA;;;;gEAzBC;;;;;;;gEACH;;;;;;qBAEA;6DACC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAErB,MAAMC,QAAQC,QAAQ,SAAS;AAGxB,SAASH;IACd,IAAI;QACF,MAAMI,SAASC,QAAG,CAACC,WAAW;QAC9B,IAAIF,QAAQ;YACVF,MAAM,uBAAuBE;YAC7B,OAAOG,oBAAO,CAACC,SAAS,CAACJ;QAC3B;QACAF,MAAM,4BAA4BE;QAClC,OAAOG,oBAAO,CAACE,aAAa;IAC9B,EAAE,OAAM;QACNP,MAAM;QACN,OAAOK,oBAAO,CAACC,SAAS,CAAC;IAC3B;AACF;AAGO,eAAeP,kBAAkBS,IAAY,EAAEC,UAAmB;IACvE,MAAMP,SAASJ;IACf,MAAMY,gBAAgBD,aAAa,GAAGD,KAAK,CAAC,EAAEC,YAAY,GAAGD;IAE7DR,MAAM,CAAC,QAAQ,EAAEU,cAAc,IAAI,EAAER,0BAAAA,OAAQS,IAAI,CAAC,OAAO,EAAET,0BAAAA,OAAQU,MAAM,CAAC,MAAM,EAAEV,0BAAAA,OAAQW,EAAE,CAAC,CAAC,CAAC;IAE/F,IAAIX,QAAQ;QACV,IAAI;YACF,MAAMY,IAAAA,qBAAU,EAACZ,OAAOU,MAAM,EAAEG,mBAAmBb,QAAQM,MAAMC;YACjE,OAAO;QACT,EAAE,OAAOO,OAAY;YACnBhB,MACE,CAAC,eAAe,EAAEU,cAAc,kBAAkB,EAAEF,KAAK,UAAU,EAAEN,OAAOU,MAAM,CAAC,EAAE,CAAC,EACtFI;QAEJ;IACF;IAEAC,KAAID,KAAK,CACP;IAEF,OAAO;AACT;AAEA,SAASD,mBAAmBb,MAAsB,EAAEM,IAAY,EAAEC,UAAmB;IACnF,IAAI,CAACA,YAAY;QACf,OAAO;YAACD;SAAK;IACf;IAEA,OAAQN,OAAOW,EAAE;QACf,KAAK;QACL,KAAK;YACH,OAAO;gBAAC,GAAGL,KAAK,CAAC,EAAEC,YAAY;aAAC;QAElC,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;YACH,OAAO;gBAAC,CAAC,CAAC,EAAEA,YAAY;gBAAED;aAAK;QAEjC,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;YACH,OAAO;gBAAC,CAAC,OAAO,EAAEC,YAAY;gBAAED;aAAK;QAEvC,KAAK;QACL,KAAK;YACH,OAAO;gBAAC;gBAAM,GAAGA,KAAK,CAAC,EAAEC,YAAY;aAAC;QAExC;YACE,OAAO;gBAACD;aAAK;IACjB;AACF"}
1
+ {"version":3,"sources":["../../../src/utils/editor.ts"],"sourcesContent":["import spawnAsync from '@expo/spawn-async';\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport process from 'node:process';\n\nimport { env } from './env';\nimport * as Log from '../log';\n\nconst debug = require('debug')('expo:utils:editor') as typeof console.log;\n\ninterface Editor {\n id: string;\n name: string;\n binary: string;\n isTerminalEditor: boolean;\n isOSXOnly?: boolean;\n paths: string[];\n keywords: string[];\n}\n\n// See: https://github.com/sindresorhus/env-editor/blob/3f6aea10ff53910c877b1bf73a8e0c954a5fbf11/index.js\n// MIT License, Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)\nfunction getEditor(input: string | undefined, allowAnyEditor = false): Editor | null {\n const needle = input?.trim().toLowerCase();\n if (!needle) {\n return null;\n }\n const id = needle.split(/[/\\\\]/).pop()?.replace(/\\s/g, '-');\n const binary = id?.split('-')[0];\n const editor =\n EDITORS.find((editor) => {\n switch (needle) {\n case editor.id:\n case editor.name.toLowerCase():\n case editor.binary:\n return true;\n default:\n for (const editorPath of editor.paths) {\n if (path.normalize(needle) === path.normalize(editorPath.toLowerCase())) return true;\n }\n for (const keyword of editor.keywords) {\n if (needle === keyword) return true;\n }\n return false;\n }\n }) ?? (binary ? EDITORS.find((editor) => editor.binary === binary) : null);\n if (allowAnyEditor && id && binary && !editor) {\n return {\n id,\n name: needle,\n binary,\n isTerminalEditor: false,\n paths: [],\n keywords: [],\n };\n }\n return editor || null;\n}\n\n/** Guess what the default editor is and default to VSCode. */\nexport function guessEditor(): Editor | null {\n let editor: Editor | null = null;\n if (env.EXPO_EDITOR) {\n editor = getEditor(env.EXPO_EDITOR);\n if (editor) {\n debug('Using $EXPO_EDITOR:', editor.name);\n }\n }\n\n if (!editor && process.env.VISUAL) {\n editor = getEditor(process.env.VISUAL);\n if (editor) {\n debug('Using $VISUAL:', editor.name);\n }\n }\n\n if (!editor && process.env.EDITOR) {\n editor = getEditor(process.env.EDITOR);\n if (editor) {\n debug('Using $EDITOR:', editor.name);\n }\n }\n\n return editor;\n}\n\nexport async function guessFallbackVisualEditor(): Promise<Editor | null> {\n // We search for editors at known `editor.paths`\n for (const editor of VISUAL_EDITORS) {\n const target = await editorExistsAtPaths(editor);\n if (target) {\n debug('Found visual editor fallback:', editor.name);\n return { ...editor, binary: target };\n }\n }\n // We search again for a visual editor against `editor.binary` in `$PATH`\n for (const editor of VISUAL_EDITORS) {\n const target = await editorExistsInPath(editor);\n if (target) {\n debug('Found visual editor fallback in $PATH:', editor.name);\n return { ...editor, binary: target };\n }\n }\n return null;\n}\n\nlet _cachedEditor: Editor | null | undefined;\n\nasync function determineEditorAsync(): Promise<Editor | null> {\n if (_cachedEditor !== undefined) {\n return _cachedEditor;\n }\n\n // First: Try to get a known editor\n let editor = guessEditor();\n\n // Second: If we don't have a known editor, fall back to EXPO_EDITOR / VISUAL resolution\n // We check if the binary in these environment variables exists in the $PATH\n const forceEditorName = env.EXPO_EDITOR ?? process.env.VISUAL;\n if (!editor && forceEditorName) {\n const forceEditor = getEditor(forceEditorName, true);\n if (forceEditor && (await editorExistsInPath(forceEditor))) {\n editor = forceEditor;\n }\n }\n\n // Third: Try to find a fallback visual editor, but keep the found one if we can't find a fallback\n if (editor?.isTerminalEditor) {\n const fallback = await guessFallbackVisualEditor();\n if (fallback) {\n editor = fallback;\n }\n }\n\n return (_cachedEditor = editor);\n}\n\n/** Open a file path in a given editor. */\nexport async function openInEditorAsync(path: string, lineNumber?: number): Promise<boolean> {\n const editor = await determineEditorAsync();\n\n if (editor && !editor.isTerminalEditor) {\n const fileReference = lineNumber ? `${path}:${lineNumber}` : path;\n debug(\n `Opening ${fileReference} in ${editor?.name} (bin: ${editor?.binary}, id: ${editor?.id})`\n );\n\n if (editor) {\n try {\n await spawnAsync(editor.binary, getEditorArguments(editor, path, lineNumber), {\n timeout: 1_000,\n });\n return true;\n } catch (error: any) {\n // NOTE(@kitten): The process might explicitly request to be terminated, which is fine\n if (error?.signal === 'SIGTERM') {\n return true;\n }\n debug(\n `Failed to open ${fileReference} in editor (path: ${path}, binary: ${editor.binary}):`,\n error\n );\n }\n }\n }\n\n Log.error(\n (editor?.isTerminalEditor\n ? `Could not open ${editor.name} as it's a terminal editor.`\n : 'Could not open editor.') +\n `\\nYou can set an editor for Expo to open by defining the $EXPO_EDITOR or $VISUAL environment variable (e.g. \"vscode\" or \"atom\")`\n );\n return false;\n}\n\nfunction getEditorArguments(editor: Editor, path: string, lineNumber?: number): string[] {\n switch (editor.id) {\n case 'atom':\n case 'sublime':\n return lineNumber ? [`${path}:${lineNumber}`] : [path];\n\n case 'emacs':\n case 'emacsforosx':\n case 'nano':\n case 'neovim':\n case 'vim':\n return lineNumber ? [`+${lineNumber}`, path] : [path];\n\n case 'android-studio':\n case 'intellij':\n case 'textmate':\n case 'webstorm':\n case 'xcode':\n return lineNumber ? [`--line=${lineNumber}`, path] : [path];\n\n case 'vscode':\n case 'vscodium':\n case 'cursor':\n return lineNumber ? ['-g', `${path}:${lineNumber}`] : ['-g', path];\n\n case 'zed':\n // '-r': Stands for \"--reuse\" and ensures we don't use the `zed` GUI binary, since the Zed CLI\n // is linked as `zed` into `$PATH` when it's actually the CLI\n return lineNumber ? ['-r', `${path}:${lineNumber}`] : ['-r', path];\n\n default:\n return [path];\n }\n}\n\n/** Attempt to resolve an editor against $PATH */\nasync function editorExistsInPath(editor: Editor) {\n if (process.platform !== 'darwin' && editor.isOSXOnly) {\n return null;\n }\n const binary = editor.binary;\n const paths = (process.env.PATH || process.env.Path || '')\n .split(path.delimiter)\n .map((target) => target.trim())\n .filter((target) => !!target);\n const exts =\n process.platform === 'win32'\n ? (process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM').split(path.delimiter).filter(Boolean)\n : [''];\n const targets = paths.flatMap((dir) => exts.map((ext) => path.join(dir, `${binary}${ext}`)));\n for (const target of targets) {\n try {\n const mode = process.platform === 'win32' ? fs.constants.F_OK : fs.constants.X_OK;\n await fs.promises.access(target, mode);\n return target;\n } catch {\n // ignore not found and continue\n }\n }\n return null;\n}\n\n/** Attempt to resolve an editor against known `paths` */\nasync function editorExistsAtPaths(editor: Editor) {\n // We can skip the path if it's not for our platform (win32 vs posix paths)\n const targets = editor.paths.filter((target) => target.includes(path.sep));\n for (const target of targets) {\n try {\n const mode = process.platform === 'win32' ? fs.constants.F_OK : fs.constants.X_OK;\n await fs.promises.access(target, mode);\n return target;\n } catch {\n // ignore not found and continue\n }\n }\n return null;\n}\n\nconst TERMINAL_EDITORS: (Editor & { isTerminalEditor: true })[] = [\n {\n id: 'vim',\n name: 'Vim',\n binary: 'vim',\n isTerminalEditor: true,\n paths: [],\n keywords: ['vi'],\n },\n {\n id: 'neovim',\n name: 'NeoVim',\n binary: 'nvim',\n isTerminalEditor: true,\n paths: [],\n keywords: ['vim'],\n },\n {\n id: 'nano',\n name: 'GNU nano',\n binary: 'nano',\n isTerminalEditor: true,\n paths: [],\n keywords: [],\n },\n {\n id: 'emacs',\n name: 'GNU Emacs',\n binary: 'emacs',\n isTerminalEditor: true,\n paths: [],\n keywords: [],\n },\n];\n\nconst VISUAL_EDITORS: (Editor & { isTerminalEditor: false })[] = [\n {\n id: 'vscode',\n name: 'Visual Studio Code',\n binary: 'code',\n isTerminalEditor: false,\n paths: ['/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code'],\n keywords: ['vs code'],\n },\n {\n id: 'vscode-insiders',\n name: 'Visual Studio Code - Insiders',\n binary: 'code-insiders',\n isTerminalEditor: false,\n paths: [\n '/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/bin/code-insiders',\n ],\n keywords: ['vs code insiders', 'code insiders', 'insiders'],\n },\n {\n id: 'vscodium',\n name: 'VSCodium',\n binary: 'codium',\n isTerminalEditor: false,\n paths: ['/Applications/VSCodium.app/Contents/Resources/app/bin/codium'],\n keywords: [],\n },\n {\n id: 'cursor',\n name: 'Cursor',\n binary: 'cursor',\n isTerminalEditor: false,\n paths: ['/Applications/Cursor.app/Contents/Resources/app/bin/codium'],\n keywords: [],\n },\n {\n id: 'sublime',\n name: 'Sublime Text',\n binary: 'subl',\n isTerminalEditor: false,\n paths: [\n '/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl',\n '/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl',\n ],\n keywords: [],\n },\n {\n id: 'atom',\n name: 'Atom',\n binary: 'atom',\n isTerminalEditor: false,\n paths: ['/Applications/Atom.app/Contents/Resources/app/atom.sh'],\n keywords: [],\n },\n {\n id: 'webstorm',\n name: 'WebStorm',\n binary: 'webstorm',\n isTerminalEditor: false,\n paths: [],\n keywords: ['wstorm'],\n },\n {\n id: 'phpstorm',\n name: 'PhpStorm',\n binary: 'pstorm',\n isTerminalEditor: false,\n paths: [],\n keywords: ['php'],\n },\n {\n id: 'zed',\n name: 'Zed',\n binary: 'zed',\n isTerminalEditor: false,\n paths: ['/Applications/Zed.app/Contents/MacOS/cli'],\n keywords: [],\n },\n {\n id: 'textmate',\n name: 'TextMate',\n binary: 'mate',\n isTerminalEditor: false,\n paths: [],\n keywords: [],\n },\n {\n id: 'intellij',\n name: 'IntelliJ IDEA',\n binary: 'idea',\n isTerminalEditor: false,\n paths: [],\n keywords: ['idea', 'java', 'jetbrains', 'ide'],\n },\n {\n id: 'emacsforosx',\n name: 'GNU Emacs for Mac OS X',\n binary: 'Emacs',\n isTerminalEditor: false,\n isOSXOnly: true,\n paths: ['/Applications/Emacs.app/Contents/MacOS/Emacs'],\n keywords: [],\n },\n {\n id: 'xcode',\n name: 'Xcode',\n binary: 'xed',\n isTerminalEditor: false,\n isOSXOnly: true,\n paths: [\n '/Applications/Xcode.app/Contents/MacOS/Xcode',\n '/Applications/Xcode-beta.app/Contents/MacOS/Xcode',\n ],\n keywords: ['xed'],\n },\n {\n id: 'android-studio',\n name: 'Android Studio',\n binary: 'studio',\n isTerminalEditor: false,\n paths: [\n '/Applications/Android Studio.app/Contents/MacOS/studio',\n '/usr/local/Android/android-studio/bin/studio.sh',\n 'C:\\\\Program Files (x86)\\\\Android\\\\android-studio\\\\bin\\\\studio.exe',\n 'C:\\\\Program Files\\\\Android\\\\android-studio\\\\bin\\\\studio64.exe',\n ],\n keywords: ['studio'],\n },\n];\n\nconst EDITORS: Editor[] = [...VISUAL_EDITORS, ...TERMINAL_EDITORS];\n"],"names":["guessEditor","guessFallbackVisualEditor","openInEditorAsync","debug","require","getEditor","input","allowAnyEditor","needle","trim","toLowerCase","id","split","pop","replace","binary","editor","EDITORS","find","name","editorPath","paths","path","normalize","keyword","keywords","isTerminalEditor","env","EXPO_EDITOR","process","VISUAL","EDITOR","VISUAL_EDITORS","target","editorExistsAtPaths","editorExistsInPath","_cachedEditor","determineEditorAsync","undefined","forceEditorName","forceEditor","fallback","lineNumber","fileReference","spawnAsync","getEditorArguments","timeout","error","signal","Log","platform","isOSXOnly","PATH","Path","delimiter","map","filter","exts","PATHEXT","Boolean","targets","flatMap","dir","ext","join","mode","fs","constants","F_OK","X_OK","promises","access","includes","sep","TERMINAL_EDITORS"],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O,EAAE;QACTI,UAAU;YAAC;SAAS;IACtB;IACA;QACEd,IAAI;QACJQ,MAAM;QACNJ,QAAQ;QACRW,kBAAkB;QAClBL,OAAO,EAAE;QACTI,UAAU;YAAC;SAAM;IACnB;IACA;QACEd,IAAI;QACJQ,MAAM;QACNJ,QAAQ;QACRW,kBAAkB;QAClBL,OAAO;YAAC;SAA2C;QACnDI,UAAU,EAAE;IACd;IACA;QACEd,IAAI;QACJQ,MAAM;QACNJ,QAAQ;QACRW,kBAAkB;QAClBL,OAAO,EAAE;QACTI,UAAU,EAAE;IACd;IACA;QACEd,IAAI;QACJQ,MAAM;QACNJ,QAAQ;QACRW,kBAAkB;QAClBL,OAAO,EAAE;QACTI,UAAU;YAAC;YAAQ;YAAQ;YAAa;SAAM;IAChD;IACA;QACEd,IAAI;QACJQ,MAAM;QACNJ,QAAQ;QACRW,kBAAkB;QAClByB,WAAW;QACX9B,OAAO;YAAC;SAA+C;QACvDI,UAAU,EAAE;IACd;IACA;QACEd,IAAI;QACJQ,MAAM;QACNJ,QAAQ;QACRW,kBAAkB;QAClByB,WAAW;QACX9B,OAAO;YACL;YACA;SACD;QACDI,UAAU;YAAC;SAAM;IACnB;IACA;QACEd,IAAI;QACJQ,MAAM;QACNJ,QAAQ;QACRW,kBAAkB;QAClBL,OAAO;YACL;YACA;YACA;YACA;SACD;QACDI,UAAU;YAAC;SAAS;IACtB;CACD;AAED,MAAMR,UAAoB;OAAIe;OAAmB0C;CAAiB"}
@@ -12,6 +12,9 @@ _export(exports, {
12
12
  env: function() {
13
13
  return env;
14
14
  },
15
+ envIsHeadless: function() {
16
+ return envIsHeadless;
17
+ },
15
18
  envIsWebcontainer: function() {
16
19
  return envIsWebcontainer;
17
20
  }
@@ -75,7 +78,7 @@ class Env {
75
78
  return (0, _getenv().boolish)('EXPO_NO_GIT_STATUS', true);
76
79
  }
77
80
  /** Disable auto web setup */ get EXPO_NO_WEB_SETUP() {
78
- return (0, _getenv().boolish)('EXPO_NO_WEB_SETUP', false);
81
+ return (0, _getenv().boolish)('EXPO_NO_WEB_SETUP', envIsHeadless());
79
82
  }
80
83
  /** Disable auto TypeScript setup */ get EXPO_NO_TYPESCRIPT_SETUP() {
81
84
  return (0, _getenv().boolish)('EXPO_NO_TYPESCRIPT_SETUP', false);
@@ -164,11 +167,6 @@ class Env {
164
167
  */ get EXPO_METRO_UNSTABLE_ERRORS() {
165
168
  return (0, _getenv().boolish)('EXPO_METRO_UNSTABLE_ERRORS', true);
166
169
  }
167
- /** Enable the experimental sticky resolver for Metro (Uses Expo Autolinking results and applies them to Metro's resolution)
168
- * @deprecated Replaced by `exp.experiments.autolinkingModuleResolution`
169
- */ get EXPO_USE_STICKY_RESOLVER() {
170
- return (0, _getenv().boolish)('EXPO_USE_STICKY_RESOLVER', false);
171
- }
172
170
  /** Disable Environment Variable injection in client bundles. */ get EXPO_NO_CLIENT_ENV_VARS() {
173
171
  return (0, _getenv().boolish)('EXPO_NO_CLIENT_ENV_VARS', false);
174
172
  }
@@ -218,12 +216,10 @@ class Env {
218
216
  return (0, _getenv().boolish)('EAS_BUILD', false);
219
217
  }
220
218
  /** Disable the React Native Directory compatibility check for new architecture when installing packages */ get EXPO_NO_NEW_ARCH_COMPAT_CHECK() {
221
- return (0, _getenv().boolish)('EXPO_NO_NEW_ARCH_COMPAT_CHECK', false);
219
+ return (0, _getenv().boolish)('EXPO_NO_NEW_ARCH_COMPAT_CHECK', envIsHeadless());
222
220
  }
223
221
  /** Disable the dependency validation when installing other dependencies and starting the project */ get EXPO_NO_DEPENDENCY_VALIDATION() {
224
- // Default to disabling when running in a web container (stackblitz, bolt, etc).
225
- const isWebContainer = _nodeprocess().default.versions.webcontainer != null;
226
- return (0, _getenv().boolish)('EXPO_NO_DEPENDENCY_VALIDATION', isWebContainer);
222
+ return (0, _getenv().boolish)('EXPO_NO_DEPENDENCY_VALIDATION', envIsHeadless());
227
223
  }
228
224
  /** Force Expo CLI to run in webcontainer mode, this has impact on which URL Expo is using by default */ get EXPO_FORCE_WEBCONTAINER_ENV() {
229
225
  return (0, _getenv().boolish)('EXPO_FORCE_WEBCONTAINER_ENV', false);
@@ -249,7 +245,10 @@ class Env {
249
245
  /**
250
246
  * Enable Bonjour advertising of the Expo CLI on local networks
251
247
  */ get EXPO_UNSTABLE_BONJOUR() {
252
- return (0, _getenv().boolish)('EXPO_UNSTABLE_BONJOUR', false);
248
+ return (0, _getenv().boolish)('EXPO_UNSTABLE_BONJOUR', !envIsHeadless());
249
+ }
250
+ /** @internal Configure other environment variables for headless operations */ get EXPO_UNSTABLE_HEADLESS() {
251
+ return (0, _getenv().boolish)('EXPO_UNSTABLE_HEADLESS', envIsWebcontainer());
253
252
  }
254
253
  }
255
254
  const env = new Env();
@@ -257,5 +256,8 @@ function envIsWebcontainer() {
257
256
  // See: https://github.com/unjs/std-env/blob/4b1e03c4efce58249858efc2cc5f5eac727d0adb/src/providers.ts#L134-L143
258
257
  return env.EXPO_FORCE_WEBCONTAINER_ENV || _nodeprocess().default.env.SHELL === '/bin/jsh' && !!_nodeprocess().default.versions.webcontainer;
259
258
  }
259
+ function envIsHeadless() {
260
+ return env.EXPO_UNSTABLE_HEADLESS;
261
+ }
260
262
 
261
263
  //# sourceMappingURL=env.js.map