@expo/cli 0.2.10 → 0.3.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 (37) hide show
  1. package/build/bin/cli +2 -2
  2. package/build/src/start/interface/interactiveActions.js +9 -4
  3. package/build/src/start/interface/interactiveActions.js.map +1 -1
  4. package/build/src/start/platforms/PlatformManager.js +29 -4
  5. package/build/src/start/platforms/PlatformManager.js.map +1 -1
  6. package/build/src/start/platforms/android/AndroidAppIdResolver.js +6 -2
  7. package/build/src/start/platforms/android/AndroidAppIdResolver.js.map +1 -1
  8. package/build/src/start/platforms/android/AndroidPlatformManager.js.map +1 -1
  9. package/build/src/start/platforms/ios/AppleAppIdResolver.js +11 -4
  10. package/build/src/start/platforms/ios/AppleAppIdResolver.js.map +1 -1
  11. package/build/src/start/platforms/ios/ApplePlatformManager.js.map +1 -1
  12. package/build/src/start/server/BundlerDevServer.js +17 -16
  13. package/build/src/start/server/BundlerDevServer.js.map +1 -1
  14. package/build/src/start/server/UrlCreator.js +12 -3
  15. package/build/src/start/server/UrlCreator.js.map +1 -1
  16. package/build/src/start/server/metro/MetroBundlerDevServer.js +7 -1
  17. package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
  18. package/build/src/start/server/metro/instantiateMetro.js +5 -0
  19. package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
  20. package/build/src/start/server/metro/router.js +35 -0
  21. package/build/src/start/server/metro/router.js.map +1 -0
  22. package/build/src/start/server/metro/withMetroMultiPlatform.js +2 -1
  23. package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
  24. package/build/src/start/server/middleware/ClassicManifestMiddleware.js +1 -1
  25. package/build/src/start/server/middleware/CreateFileMiddleware.js +103 -0
  26. package/build/src/start/server/middleware/CreateFileMiddleware.js.map +1 -0
  27. package/build/src/start/server/middleware/InterstitialPageMiddleware.js +25 -16
  28. package/build/src/start/server/middleware/InterstitialPageMiddleware.js.map +1 -1
  29. package/build/src/start/server/middleware/RuntimeRedirectMiddleware.js +2 -1
  30. package/build/src/start/server/middleware/RuntimeRedirectMiddleware.js.map +1 -1
  31. package/build/src/start/server/middleware/resolvePlatform.js +14 -0
  32. package/build/src/start/server/middleware/resolvePlatform.js.map +1 -1
  33. package/build/src/utils/analytics/rudderstackClient.js +2 -2
  34. package/build/src/utils/env.js +2 -2
  35. package/build/src/utils/env.js.map +1 -1
  36. package/package.json +3 -3
  37. package/static/loading-page/index.html +99 -6
package/build/bin/cli CHANGED
@@ -121,7 +121,7 @@ const args = (0, _arg).default({
121
121
  });
122
122
  if (args["--version"]) {
123
123
  // Version is added in the build script.
124
- console.log("0.2.10");
124
+ console.log("0.3.0");
125
125
  process.exit(0);
126
126
  }
127
127
  if (args["--non-interactive"]) {
@@ -248,7 +248,7 @@ commands[command]().then((exec)=>{
248
248
  logEventAsync("action", {
249
249
  action: `expo ${command}`,
250
250
  source: "expo/cli",
251
- source_version: "0.2.10"
251
+ source_version: "0.3.0"
252
252
  });
253
253
  });
254
254
 
@@ -43,10 +43,15 @@ class DevServerManagerActions {
43
43
  printDevServerInfo(options) {
44
44
  // If native dev server is running, print its URL.
45
45
  if (this.devServerManager.getNativeDevServerPort()) {
46
+ const devServer = this.devServerManager.getDefaultDevServer();
46
47
  try {
47
- const url = this.devServerManager.getDefaultDevServer().getNativeRuntimeUrl();
48
- (0, _commandsTable).printQRCode(url);
49
- Log.log((0, _commandsTable).printItem(_chalk.default`Metro waiting on {underline ${url}}`));
48
+ const nativeRuntimeUrl = devServer.getNativeRuntimeUrl();
49
+ const interstitialPageUrl = devServer.getRedirectUrl();
50
+ (0, _commandsTable).printQRCode(interstitialPageUrl != null ? interstitialPageUrl : nativeRuntimeUrl);
51
+ if (interstitialPageUrl) {
52
+ Log.log((0, _commandsTable).printItem(_chalk.default`Choose an app to open your project at {underline ${interstitialPageUrl}}`));
53
+ }
54
+ Log.log((0, _commandsTable).printItem(_chalk.default`Metro waiting on {underline ${nativeRuntimeUrl}}`));
50
55
  // TODO: if development build, change this message!
51
56
  Log.log((0, _commandsTable).printItem("Scan the QR code above with Expo Go (Android) or the Camera app (iOS)"));
52
57
  } catch (error) {
@@ -54,7 +59,7 @@ class DevServerManagerActions {
54
59
  if (error.code !== "NO_DEV_CLIENT_SCHEME") {
55
60
  throw error;
56
61
  } else {
57
- const serverUrl = this.devServerManager.getDefaultDevServer().getDevServerUrl();
62
+ const serverUrl = devServer.getDevServerUrl();
58
63
  Log.log((0, _commandsTable).printItem(_chalk.default`Metro waiting on {underline ${serverUrl}}`));
59
64
  Log.log((0, _commandsTable).printItem(`Linking is disabled because the client scheme cannot be resolved.`));
60
65
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/start/interface/interactiveActions.ts"],"sourcesContent":["import { openJsInspector, queryAllInspectorAppsAsync } from '@expo/dev-server';\nimport assert from 'assert';\nimport chalk from 'chalk';\n\nimport * as Log from '../../log';\nimport { learnMore } from '../../utils/link';\nimport { selectAsync } from '../../utils/prompts';\nimport { DevServerManager } from '../server/DevServerManager';\nimport { BLT, printHelp, printItem, printQRCode, printUsage, StartOptions } from './commandsTable';\n\nconst debug = require('debug')('expo:start:interface:interactiveActions') as typeof console.log;\n\n/** Wraps the DevServerManager and adds an interface for user actions. */\nexport class DevServerManagerActions {\n constructor(private devServerManager: DevServerManager) {}\n\n printDevServerInfo(\n options: Pick<StartOptions, 'devClient' | 'isWebSocketsEnabled' | 'platforms'>\n ) {\n // If native dev server is running, print its URL.\n if (this.devServerManager.getNativeDevServerPort()) {\n try {\n const url = this.devServerManager.getDefaultDevServer().getNativeRuntimeUrl()!;\n\n printQRCode(url);\n Log.log(printItem(chalk`Metro waiting on {underline ${url}}`));\n // TODO: if development build, change this message!\n Log.log(printItem('Scan the QR code above with Expo Go (Android) or the Camera app (iOS)'));\n } catch (error) {\n // @ts-ignore: If there is no development build scheme, then skip the QR code.\n if (error.code !== 'NO_DEV_CLIENT_SCHEME') {\n throw error;\n } else {\n const serverUrl = this.devServerManager.getDefaultDevServer().getDevServerUrl();\n Log.log(printItem(chalk`Metro waiting on {underline ${serverUrl}}`));\n Log.log(printItem(`Linking is disabled because the client scheme cannot be resolved.`));\n }\n }\n }\n\n const webDevServer = this.devServerManager.getWebDevServer();\n const webUrl = webDevServer?.getDevServerUrl({ hostType: 'localhost' });\n if (webUrl) {\n Log.log();\n Log.log(printItem(chalk`Web is waiting on {underline ${webUrl}}`));\n }\n\n printUsage(options, { verbose: false });\n printHelp();\n Log.log();\n }\n\n async openJsInspectorAsync() {\n Log.log('Opening JavaScript inspector in the browser...');\n const port = this.devServerManager.getNativeDevServerPort();\n assert(port, 'Metro dev server is not running');\n const metroServerOrigin = `http://localhost:${port}`;\n const apps = await queryAllInspectorAppsAsync(metroServerOrigin);\n if (!apps.length) {\n Log.warn(\n `No compatible apps connected. This feature is only available for apps using the Hermes runtime. ${learnMore(\n 'https://docs.expo.dev/guides/using-hermes/'\n )}`\n );\n return;\n }\n for (const app of apps) {\n openJsInspector(app);\n }\n }\n\n reloadApp() {\n Log.log(`${BLT} Reloading apps`);\n // Send reload requests over the dev servers\n this.devServerManager.broadcastMessage('reload');\n }\n\n async openMoreToolsAsync() {\n try {\n // Options match: Chrome > View > Developer\n const value = await selectAsync(chalk`Dev tools {dim (native only)}`, [\n { title: 'Inspect elements', value: 'toggleElementInspector' },\n { title: 'Toggle performance monitor', value: 'togglePerformanceMonitor' },\n { title: 'Toggle developer menu', value: 'toggleDevMenu' },\n { title: 'Reload app', value: 'reload' },\n // TODO: Maybe a \"View Source\" option to open code.\n // Toggling Remote JS Debugging is pretty rough, so leaving it disabled.\n // { title: 'Toggle Remote Debugging', value: 'toggleRemoteDebugging' },\n ]);\n this.devServerManager.broadcastMessage('sendDevCommand', { name: value });\n } catch (error: any) {\n debug(error);\n // do nothing\n } finally {\n printHelp();\n }\n }\n\n toggleDevMenu() {\n Log.log(`${BLT} Toggling dev menu`);\n this.devServerManager.broadcastMessage('devMenu');\n }\n}\n"],"names":["Log","debug","require","DevServerManagerActions","constructor","devServerManager","printDevServerInfo","options","getNativeDevServerPort","url","getDefaultDevServer","getNativeRuntimeUrl","printQRCode","log","printItem","chalk","error","code","serverUrl","getDevServerUrl","webDevServer","getWebDevServer","webUrl","hostType","printUsage","verbose","printHelp","openJsInspectorAsync","port","assert","metroServerOrigin","apps","queryAllInspectorAppsAsync","length","warn","learnMore","app","openJsInspector","reloadApp","BLT","broadcastMessage","openMoreToolsAsync","value","selectAsync","title","name","toggleDevMenu"],"mappings":"AAAA;;;;AAA4D,IAAA,UAAkB,WAAlB,kBAAkB,CAAA;AAC3D,IAAA,OAAQ,kCAAR,QAAQ,EAAA;AACT,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEbA,IAAAA,GAAG,mCAAM,WAAW,EAAjB;AACW,IAAA,KAAkB,WAAlB,kBAAkB,CAAA;AAChB,IAAA,QAAqB,WAArB,qBAAqB,CAAA;AAEgC,IAAA,cAAiB,WAAjB,iBAAiB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAElG,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,yCAAyC,CAAC,AAAsB,AAAC;AAGzF,MAAMC,uBAAuB;IAClCC,YAAoBC,gBAAkC,CAAE;aAApCA,gBAAkC,GAAlCA,gBAAkC;KAAI;IAE1DC,kBAAkB,CAChBC,OAA8E,EAC9E;QACA,kDAAkD;QAClD,IAAI,IAAI,CAACF,gBAAgB,CAACG,sBAAsB,EAAE,EAAE;YAClD,IAAI;gBACF,MAAMC,GAAG,GAAG,IAAI,CAACJ,gBAAgB,CAACK,mBAAmB,EAAE,CAACC,mBAAmB,EAAE,AAAC,AAAC;gBAE/EC,CAAAA,GAAAA,cAAW,AAAK,CAAA,YAAL,CAACH,GAAG,CAAC,CAAC;gBACjBT,GAAG,CAACa,GAAG,CAACC,CAAAA,GAAAA,cAAS,AAA4C,CAAA,UAA5C,CAACC,MAAK,QAAA,CAAC,4BAA4B,EAAEN,GAAG,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,kBAAkB;oBAAEF,KAAK,EAAE,wBAAwB;iBAAE;gBAC9D;oBAAEE,KAAK,EAAE,4BAA4B;oBAAEF,KAAK,EAAE,0BAA0B;iBAAE;gBAC1E;oBAAEE,KAAK,EAAE,uBAAuB;oBAAEF,KAAK,EAAE,eAAe;iBAAE;gBAC1D;oBAAEE,KAAK,EAAE,YAAY;oBAAEF,KAAK,EAAE,QAAQ;iBAAE;aAIzC,CAAC,AAAC;YACH,IAAI,CAACrC,gBAAgB,CAACmC,gBAAgB,CAAC,gBAAgB,EAAE;gBAAEK,IAAI,EAAEH,KAAK;aAAE,CAAC,CAAC;SAC3E,CAAC,OAAO1B,KAAK,EAAO;YACnBf,KAAK,CAACe,KAAK,CAAC,CAAC;QACb,aAAa;SACd,QAAS;YACRU,CAAAA,GAAAA,cAAS,AAAE,CAAA,UAAF,EAAE,CAAC;SACb;KACF;IAEDoB,aAAa,GAAG;QACd9C,GAAG,CAACa,GAAG,CAAC,CAAC,EAAE0B,cAAG,IAAA,CAAC,kBAAkB,CAAC,CAAC,CAAC;QACpC,IAAI,CAAClC,gBAAgB,CAACmC,gBAAgB,CAAC,SAAS,CAAC,CAAC;KACnD;CACF;QAzFYrC,uBAAuB,GAAvBA,uBAAuB"}
1
+ {"version":3,"sources":["../../../../src/start/interface/interactiveActions.ts"],"sourcesContent":["import { openJsInspector, queryAllInspectorAppsAsync } from '@expo/dev-server';\nimport assert from 'assert';\nimport chalk from 'chalk';\n\nimport * as Log from '../../log';\nimport { learnMore } from '../../utils/link';\nimport { selectAsync } from '../../utils/prompts';\nimport { DevServerManager } from '../server/DevServerManager';\nimport { BLT, printHelp, printItem, printQRCode, printUsage, StartOptions } from './commandsTable';\n\nconst debug = require('debug')('expo:start:interface:interactiveActions') as typeof console.log;\n\n/** Wraps the DevServerManager and adds an interface for user actions. */\nexport class DevServerManagerActions {\n constructor(private devServerManager: DevServerManager) {}\n\n printDevServerInfo(\n options: Pick<StartOptions, 'devClient' | 'isWebSocketsEnabled' | 'platforms'>\n ) {\n // If native dev server is running, print its URL.\n if (this.devServerManager.getNativeDevServerPort()) {\n const devServer = this.devServerManager.getDefaultDevServer();\n try {\n const nativeRuntimeUrl = devServer.getNativeRuntimeUrl()!;\n const interstitialPageUrl = devServer.getRedirectUrl();\n\n printQRCode(interstitialPageUrl ?? nativeRuntimeUrl);\n\n if (interstitialPageUrl) {\n Log.log(\n printItem(\n chalk`Choose an app to open your project at {underline ${interstitialPageUrl}}`\n )\n );\n }\n Log.log(printItem(chalk`Metro waiting on {underline ${nativeRuntimeUrl}}`));\n // TODO: if development build, change this message!\n Log.log(printItem('Scan the QR code above with Expo Go (Android) or the Camera app (iOS)'));\n } catch (error) {\n // @ts-ignore: If there is no development build scheme, then skip the QR code.\n if (error.code !== 'NO_DEV_CLIENT_SCHEME') {\n throw error;\n } else {\n const serverUrl = devServer.getDevServerUrl();\n Log.log(printItem(chalk`Metro waiting on {underline ${serverUrl}}`));\n Log.log(printItem(`Linking is disabled because the client scheme cannot be resolved.`));\n }\n }\n }\n\n const webDevServer = this.devServerManager.getWebDevServer();\n const webUrl = webDevServer?.getDevServerUrl({ hostType: 'localhost' });\n if (webUrl) {\n Log.log();\n Log.log(printItem(chalk`Web is waiting on {underline ${webUrl}}`));\n }\n\n printUsage(options, { verbose: false });\n printHelp();\n Log.log();\n }\n\n async openJsInspectorAsync() {\n Log.log('Opening JavaScript inspector in the browser...');\n const port = this.devServerManager.getNativeDevServerPort();\n assert(port, 'Metro dev server is not running');\n const metroServerOrigin = `http://localhost:${port}`;\n const apps = await queryAllInspectorAppsAsync(metroServerOrigin);\n if (!apps.length) {\n Log.warn(\n `No compatible apps connected. This feature is only available for apps using the Hermes runtime. ${learnMore(\n 'https://docs.expo.dev/guides/using-hermes/'\n )}`\n );\n return;\n }\n for (const app of apps) {\n openJsInspector(app);\n }\n }\n\n reloadApp() {\n Log.log(`${BLT} Reloading apps`);\n // Send reload requests over the dev servers\n this.devServerManager.broadcastMessage('reload');\n }\n\n async openMoreToolsAsync() {\n try {\n // Options match: Chrome > View > Developer\n const value = await selectAsync(chalk`Dev tools {dim (native only)}`, [\n { title: 'Inspect elements', value: 'toggleElementInspector' },\n { title: 'Toggle performance monitor', value: 'togglePerformanceMonitor' },\n { title: 'Toggle developer menu', value: 'toggleDevMenu' },\n { title: 'Reload app', value: 'reload' },\n // TODO: Maybe a \"View Source\" option to open code.\n // Toggling Remote JS Debugging is pretty rough, so leaving it disabled.\n // { title: 'Toggle Remote Debugging', value: 'toggleRemoteDebugging' },\n ]);\n this.devServerManager.broadcastMessage('sendDevCommand', { name: value });\n } catch (error: any) {\n debug(error);\n // do nothing\n } finally {\n printHelp();\n }\n }\n\n toggleDevMenu() {\n Log.log(`${BLT} Toggling dev menu`);\n this.devServerManager.broadcastMessage('devMenu');\n }\n}\n"],"names":["Log","debug","require","DevServerManagerActions","constructor","devServerManager","printDevServerInfo","options","getNativeDevServerPort","devServer","getDefaultDevServer","nativeRuntimeUrl","getNativeRuntimeUrl","interstitialPageUrl","getRedirectUrl","printQRCode","log","printItem","chalk","error","code","serverUrl","getDevServerUrl","webDevServer","getWebDevServer","webUrl","hostType","printUsage","verbose","printHelp","openJsInspectorAsync","port","assert","metroServerOrigin","apps","queryAllInspectorAppsAsync","length","warn","learnMore","app","openJsInspector","reloadApp","BLT","broadcastMessage","openMoreToolsAsync","value","selectAsync","title","name","toggleDevMenu"],"mappings":"AAAA;;;;AAA4D,IAAA,UAAkB,WAAlB,kBAAkB,CAAA;AAC3D,IAAA,OAAQ,kCAAR,QAAQ,EAAA;AACT,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEbA,IAAAA,GAAG,mCAAM,WAAW,EAAjB;AACW,IAAA,KAAkB,WAAlB,kBAAkB,CAAA;AAChB,IAAA,QAAqB,WAArB,qBAAqB,CAAA;AAEgC,IAAA,cAAiB,WAAjB,iBAAiB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAElG,MAAMC,KAAK,GAAGC,OAAO,CAAC,O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AK;aAAE,CAAC,CAAC;SAC3E,CAAC,OAAO1B,KAAK,EAAO;YACnBlB,KAAK,CAACkB,KAAK,CAAC,CAAC;QACb,aAAa;SACd,QAAS;YACRU,CAAAA,GAAAA,cAAS,AAAE,CAAA,UAAF,EAAE,CAAC;SACb;KACF;IAEDoB,aAAa,GAAG;QACdjD,GAAG,CAACgB,GAAG,CAAC,CAAC,EAAE0B,cAAG,IAAA,CAAC,kBAAkB,CAAC,CAAC,CAAC;QACpC,IAAI,CAACrC,gBAAgB,CAACsC,gBAAgB,CAAC,SAAS,CAAC,CAAC;KACnD;CACF;QAnGYxC,uBAAuB,GAAvBA,uBAAuB"}
@@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  var _config = require("@expo/config");
6
6
  var _assert = _interopRequireDefault(require("assert"));
7
+ var _chalk = _interopRequireDefault(require("chalk"));
8
+ var _log = require("../../log");
7
9
  var _rudderstackClient = require("../../utils/analytics/rudderstackClient");
8
10
  var _errors = require("../../utils/errors");
9
11
  var _link = require("../../utils/link");
@@ -21,11 +23,34 @@ class PlatformManager {
21
23
  /** Returns the project application identifier or asserts that one is not defined. Exposed for testing. */ _getAppIdResolver() {
22
24
  throw new _errors.UnimplementedError();
23
25
  }
26
+ /**
27
+ * Get the URL for users intending to launch the project in Expo Go.
28
+ * The CLI will check if the project has a custom dev client and if the redirect page feature is enabled.
29
+ * If both are true, the CLI will return the redirect page URL.
30
+ */ async getExpoGoOrCustomRuntimeUrlAsync(deviceManager) {
31
+ // Determine if the redirect page feature is enabled first since it's the cheapest to check.
32
+ const redirectUrl = this.props.getRedirectUrl();
33
+ if (redirectUrl) {
34
+ // If the redirect page feature is enabled, check if the project has a resolvable native identifier.
35
+ const applicationId = await this._getAppIdResolver().getAppIdAsync();
36
+ if (applicationId) {
37
+ debug(`Resolving launch URL: (appId: ${applicationId}, redirect URL: ${redirectUrl})`);
38
+ // NOTE(EvanBacon): This adds considerable amount of time to the command, we should consider removing or memoizing it.
39
+ // Finally determine if the target device has a custom dev client installed.
40
+ if (await deviceManager.isAppInstalledAsync(applicationId)) {
41
+ return redirectUrl;
42
+ } else {
43
+ // Log a warning if no development build is available on the device, but the
44
+ // interstitial page would otherwise be opened.
45
+ _log.Log.warn(_chalk.default`\u203A The {bold expo-dev-client} package is installed, but a development build is not ` + _chalk.default`installed on {bold ${deviceManager.name}}.\nLaunching in Expo Go. If you want to use a ` + `development build, you need to create and install one first.\n${(0, _link).learnMore("https://docs.expo.dev/development/build/")}`);
46
+ }
47
+ }
48
+ }
49
+ return this.props.getExpoGoUrl();
50
+ }
24
51
  async openProjectInExpoGoAsync(resolveSettings = {}) {
25
- const url = this.props.getExpoGoUrl();
26
- // This should never happen, but just in case...
27
- (0, _assert).default(url, "Could not get dev server URL");
28
52
  const deviceManager = await this.props.resolveDeviceAsync(resolveSettings);
53
+ const url = await this.getExpoGoOrCustomRuntimeUrlAsync(deviceManager);
29
54
  deviceManager.logOpeningUrl(url);
30
55
  // TODO: Expensive, we should only do this once.
31
56
  const { exp } = (0, _config).getConfig(this.projectRoot);
@@ -52,7 +77,7 @@ class PlatformManager {
52
77
  const applicationId = (_applicationId = props.applicationId) != null ? _applicationId : await this._getAppIdResolver().getAppIdAsync();
53
78
  const deviceManager = await this.props.resolveDeviceAsync(resolveSettings);
54
79
  if (!await deviceManager.isAppInstalledAsync(applicationId)) {
55
- throw new _errors.CommandError(`The development client (${applicationId}) for this project is not installed. ` + `Please build and install the client on the device first.\n${(0, _link).learnMore("https://docs.expo.dev/development/build/")}`);
80
+ throw new _errors.CommandError(`No development build (${applicationId}) for this project is installed. ` + `Please make and install a development build on the device first.\n${(0, _link).learnMore("https://docs.expo.dev/development/build/")}`);
56
81
  }
57
82
  // TODO: Rethink analytics
58
83
  await (0, _rudderstackClient).logEventAsync("Open Url on Device", {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/start/platforms/PlatformManager.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport assert from 'assert';\n\nimport { logEventAsync } from '../../utils/analytics/rudderstackClient';\nimport { CommandError, UnimplementedError } from '../../utils/errors';\nimport { learnMore } from '../../utils/link';\nimport { AppIdResolver } from './AppIdResolver';\nimport { DeviceManager } from './DeviceManager';\n\nconst debug = require('debug')('expo:start:platforms:platformManager') as typeof console.log;\n\nexport interface BaseOpenInCustomProps {\n scheme?: string;\n applicationId?: string | null;\n}\n\nexport interface BaseResolveDeviceProps<IDevice> {\n /** Should prompt the user to select a device. */\n shouldPrompt?: boolean;\n /** The target device to use. */\n device?: IDevice;\n}\n\n/** An abstract class for launching a URL on a device. */\nexport class PlatformManager<\n IDevice,\n IOpenInCustomProps extends BaseOpenInCustomProps = BaseOpenInCustomProps,\n IResolveDeviceProps extends BaseResolveDeviceProps<IDevice> = BaseResolveDeviceProps<IDevice>\n> {\n constructor(\n protected projectRoot: string,\n protected props: {\n platform: 'ios' | 'android';\n /** Get the base URL for the dev server hosting this platform manager. */\n getDevServerUrl: () => string | null;\n /** Expo Go URL */\n getExpoGoUrl: () => string | null;\n /** Dev Client */\n getCustomRuntimeUrl: (props?: { scheme?: string }) => string | null;\n /** Resolve a device, this function should automatically handle opening the device and asserting any system validations. */\n resolveDeviceAsync: (\n resolver?: Partial<IResolveDeviceProps>\n ) => Promise<DeviceManager<IDevice>>;\n }\n ) {}\n\n /** Returns the project application identifier or asserts that one is not defined. Exposed for testing. */\n _getAppIdResolver(): AppIdResolver {\n throw new UnimplementedError();\n }\n\n protected async openProjectInExpoGoAsync(\n resolveSettings: Partial<IResolveDeviceProps> = {}\n ): Promise<{ url: string }> {\n const url = this.props.getExpoGoUrl();\n // This should never happen, but just in case...\n assert(url, 'Could not get dev server URL');\n\n const deviceManager = await this.props.resolveDeviceAsync(resolveSettings);\n deviceManager.logOpeningUrl(url);\n\n // TODO: Expensive, we should only do this once.\n const { exp } = getConfig(this.projectRoot);\n const installedExpo = await deviceManager.ensureExpoGoAsync(exp.sdkVersion);\n\n deviceManager.activateWindowAsync();\n await deviceManager.openUrlAsync(url);\n\n await logEventAsync('Open Url on Device', {\n platform: this.props.platform,\n installedExpo,\n });\n\n return { url };\n }\n\n private async openProjectInCustomRuntimeAsync(\n resolveSettings: Partial<IResolveDeviceProps> = {},\n props: Partial<IOpenInCustomProps> = {}\n ): Promise<{ url: string }> {\n debug(\n `open custom (${Object.entries(props)\n .map(([k, v]) => `${k}: ${v}`)\n .join(', ')})`\n );\n\n let url = this.props.getCustomRuntimeUrl({ scheme: props.scheme });\n debug(`Opening project in custom runtime: ${url} -- %O`, props);\n // TODO: It's unclear why we do application id validation when opening with a URL\n const applicationId = props.applicationId ?? (await this._getAppIdResolver().getAppIdAsync());\n\n const deviceManager = await this.props.resolveDeviceAsync(resolveSettings);\n\n if (!(await deviceManager.isAppInstalledAsync(applicationId))) {\n throw new CommandError(\n `The development client (${applicationId}) for this project is not installed. ` +\n `Please build and install the client on the device first.\\n${learnMore(\n 'https://docs.expo.dev/development/build/'\n )}`\n );\n }\n\n // TODO: Rethink analytics\n await logEventAsync('Open Url on Device', {\n platform: this.props.platform,\n installedExpo: false,\n });\n\n if (!url) {\n url = this._resolveAlternativeLaunchUrl(applicationId, props);\n }\n\n deviceManager.logOpeningUrl(url);\n await deviceManager.activateWindowAsync();\n await deviceManager.openUrlAsync(url);\n\n return {\n url,\n };\n }\n\n /** Launch the project on a device given the input runtime. */\n async openAsync(\n options:\n | {\n runtime: 'expo' | 'web';\n }\n | {\n runtime: 'custom';\n props?: Partial<IOpenInCustomProps>;\n },\n resolveSettings: Partial<IResolveDeviceProps> = {}\n ): Promise<{ url: string }> {\n debug(\n `open (runtime: ${options.runtime}, platform: ${this.props.platform}, device: %O, shouldPrompt: ${resolveSettings.shouldPrompt})`,\n resolveSettings.device\n );\n if (options.runtime === 'expo') {\n return this.openProjectInExpoGoAsync(resolveSettings);\n } else if (options.runtime === 'web') {\n return this.openWebProjectAsync(resolveSettings);\n } else if (options.runtime === 'custom') {\n return this.openProjectInCustomRuntimeAsync(resolveSettings, options.props);\n } else {\n throw new CommandError(`Invalid runtime target: ${options.runtime}`);\n }\n }\n\n /** Open the current web project (Webpack) in a device . */\n private async openWebProjectAsync(resolveSettings: Partial<IResolveDeviceProps> = {}): Promise<{\n url: string;\n }> {\n const url = this.props.getDevServerUrl();\n assert(url, 'Dev server is not running.');\n\n const deviceManager = await this.props.resolveDeviceAsync(resolveSettings);\n deviceManager.logOpeningUrl(url);\n await deviceManager.activateWindowAsync();\n await deviceManager.openUrlAsync(url);\n\n return { url };\n }\n\n /** If the launch URL cannot be determined (`custom` runtimes) then an alternative string can be provided to open the device. Often a device ID or activity to launch. Exposed for testing. */\n _resolveAlternativeLaunchUrl(\n applicationId: string,\n props: Partial<IOpenInCustomProps> = {}\n ): string {\n throw new UnimplementedError();\n }\n}\n"],"names":["debug","require","PlatformManager","constructor","projectRoot","props","_getAppIdResolver","UnimplementedError","openProjectInExpoGoAsync","resolveSettings","url","getExpoGoUrl","assert","deviceManager","resolveDeviceAsync","logOpeningUrl","exp","getConfig","installedExpo","ensureExpoGoAsync","sdkVersion","activateWindowAsync","openUrlAsync","logEventAsync","platform","openProjectInCustomRuntimeAsync","Object","entries","map","k","v","join","getCustomRuntimeUrl","scheme","applicationId","getAppIdAsync","isAppInstalledAsync","CommandError","learnMore","_resolveAlternativeLaunchUrl","openAsync","options","runtime","shouldPrompt","device","openWebProjectAsync","getDevServerUrl"],"mappings":"AAAA;;;;AAA0B,IAAA,OAAc,WAAd,cAAc,CAAA;AACrB,IAAA,OAAQ,kCAAR,QAAQ,EAAA;AAEG,IAAA,kBAAyC,WAAzC,yCAAyC,CAAA;AACtB,IAAA,OAAoB,WAApB,oBAAoB,CAAA;AAC3C,IAAA,KAAkB,WAAlB,kBAAkB,CAAA;;;;;;AAI5C,MAAMA,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,sCAAsC,CAAC,AAAsB,AAAC;AAetF,MAAMC,eAAe;IAK1BC,YACYC,WAAmB,EACnBC,KAYT,CAC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MG,aAAa,GAAG,MAAM,IAAI,CAACR,KAAK,CAACS,kBAAkB,CAACL,eAAe,CAAC,AAAC;QAC3EI,aAAa,CAACE,aAAa,CAACL,GAAG,CAAC,CAAC;QACjC,MAAMG,aAAa,CAACQ,mBAAmB,EAAE,CAAC;QAC1C,MAAMR,aAAa,CAACS,YAAY,CAACZ,GAAG,CAAC,CAAC;QAEtC,OAAO;YAAEA,GAAG;SAAE,CAAC;KAChB;IAED,8LAA8L,CAC9L6B,4BAA4B,CAC1BL,aAAqB,EACrB7B,KAAkC,GAAG,EAAE,EAC/B;QACR,MAAM,IAAIE,OAAkB,mBAAA,EAAE,CAAC;KAChC;CACF;QAlJYL,eAAe,GAAfA,eAAe"}
1
+ {"version":3,"sources":["../../../../src/start/platforms/PlatformManager.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport assert from 'assert';\nimport chalk from 'chalk';\n\nimport { Log } from '../../log';\nimport { logEventAsync } from '../../utils/analytics/rudderstackClient';\nimport { CommandError, UnimplementedError } from '../../utils/errors';\nimport { learnMore } from '../../utils/link';\nimport { AppIdResolver } from './AppIdResolver';\nimport { DeviceManager } from './DeviceManager';\n\nconst debug = require('debug')('expo:start:platforms:platformManager') as typeof console.log;\n\nexport interface BaseOpenInCustomProps {\n scheme?: string;\n applicationId?: string | null;\n}\n\nexport interface BaseResolveDeviceProps<IDevice> {\n /** Should prompt the user to select a device. */\n shouldPrompt?: boolean;\n /** The target device to use. */\n device?: IDevice;\n}\n\n/** An abstract class for launching a URL on a device. */\nexport class PlatformManager<\n IDevice,\n IOpenInCustomProps extends BaseOpenInCustomProps = BaseOpenInCustomProps,\n IResolveDeviceProps extends BaseResolveDeviceProps<IDevice> = BaseResolveDeviceProps<IDevice>\n> {\n constructor(\n protected projectRoot: string,\n protected props: {\n platform: 'ios' | 'android';\n /** Get the base URL for the dev server hosting this platform manager. */\n getDevServerUrl: () => string | null;\n /** Expo Go URL. */\n getExpoGoUrl: () => string;\n /**\n * Get redirect URL for native disambiguation.\n * @returns a URL like `http://localhost:19000/_expo/loading`\n */\n getRedirectUrl: () => string | null;\n /** Dev Client */\n getCustomRuntimeUrl: (props?: { scheme?: string }) => string | null;\n /** Resolve a device, this function should automatically handle opening the device and asserting any system validations. */\n resolveDeviceAsync: (\n resolver?: Partial<IResolveDeviceProps>\n ) => Promise<DeviceManager<IDevice>>;\n }\n ) {}\n\n /** Returns the project application identifier or asserts that one is not defined. Exposed for testing. */\n _getAppIdResolver(): AppIdResolver {\n throw new UnimplementedError();\n }\n\n /**\n * Get the URL for users intending to launch the project in Expo Go.\n * The CLI will check if the project has a custom dev client and if the redirect page feature is enabled.\n * If both are true, the CLI will return the redirect page URL.\n */\n protected async getExpoGoOrCustomRuntimeUrlAsync(\n deviceManager: DeviceManager<IDevice>\n ): Promise<string> {\n // Determine if the redirect page feature is enabled first since it's the cheapest to check.\n const redirectUrl = this.props.getRedirectUrl();\n if (redirectUrl) {\n // If the redirect page feature is enabled, check if the project has a resolvable native identifier.\n const applicationId = await this._getAppIdResolver().getAppIdAsync();\n if (applicationId) {\n debug(`Resolving launch URL: (appId: ${applicationId}, redirect URL: ${redirectUrl})`);\n // NOTE(EvanBacon): This adds considerable amount of time to the command, we should consider removing or memoizing it.\n // Finally determine if the target device has a custom dev client installed.\n if (await deviceManager.isAppInstalledAsync(applicationId)) {\n return redirectUrl;\n } else {\n // Log a warning if no development build is available on the device, but the\n // interstitial page would otherwise be opened.\n Log.warn(\n chalk`\\u203A The {bold expo-dev-client} package is installed, but a development build is not ` +\n chalk`installed on {bold ${deviceManager.name}}.\\nLaunching in Expo Go. If you want to use a ` +\n `development build, you need to create and install one first.\\n${learnMore(\n 'https://docs.expo.dev/development/build/'\n )}`\n );\n }\n }\n }\n\n return this.props.getExpoGoUrl();\n }\n\n protected async openProjectInExpoGoAsync(\n resolveSettings: Partial<IResolveDeviceProps> = {}\n ): Promise<{ url: string }> {\n const deviceManager = await this.props.resolveDeviceAsync(resolveSettings);\n const url = await this.getExpoGoOrCustomRuntimeUrlAsync(deviceManager);\n\n deviceManager.logOpeningUrl(url);\n\n // TODO: Expensive, we should only do this once.\n const { exp } = getConfig(this.projectRoot);\n const installedExpo = await deviceManager.ensureExpoGoAsync(exp.sdkVersion);\n\n deviceManager.activateWindowAsync();\n await deviceManager.openUrlAsync(url);\n\n await logEventAsync('Open Url on Device', {\n platform: this.props.platform,\n installedExpo,\n });\n\n return { url };\n }\n\n private async openProjectInCustomRuntimeAsync(\n resolveSettings: Partial<IResolveDeviceProps> = {},\n props: Partial<IOpenInCustomProps> = {}\n ): Promise<{ url: string }> {\n debug(\n `open custom (${Object.entries(props)\n .map(([k, v]) => `${k}: ${v}`)\n .join(', ')})`\n );\n\n let url = this.props.getCustomRuntimeUrl({ scheme: props.scheme });\n debug(`Opening project in custom runtime: ${url} -- %O`, props);\n // TODO: It's unclear why we do application id validation when opening with a URL\n const applicationId = props.applicationId ?? (await this._getAppIdResolver().getAppIdAsync());\n\n const deviceManager = await this.props.resolveDeviceAsync(resolveSettings);\n\n if (!(await deviceManager.isAppInstalledAsync(applicationId))) {\n throw new CommandError(\n `No development build (${applicationId}) for this project is installed. ` +\n `Please make and install a development build on the device first.\\n${learnMore(\n 'https://docs.expo.dev/development/build/'\n )}`\n );\n }\n\n // TODO: Rethink analytics\n await logEventAsync('Open Url on Device', {\n platform: this.props.platform,\n installedExpo: false,\n });\n\n if (!url) {\n url = this._resolveAlternativeLaunchUrl(applicationId, props);\n }\n\n deviceManager.logOpeningUrl(url);\n await deviceManager.activateWindowAsync();\n await deviceManager.openUrlAsync(url);\n\n return {\n url,\n };\n }\n\n /** Launch the project on a device given the input runtime. */\n async openAsync(\n options:\n | {\n runtime: 'expo' | 'web';\n }\n | {\n runtime: 'custom';\n props?: Partial<IOpenInCustomProps>;\n },\n resolveSettings: Partial<IResolveDeviceProps> = {}\n ): Promise<{ url: string }> {\n debug(\n `open (runtime: ${options.runtime}, platform: ${this.props.platform}, device: %O, shouldPrompt: ${resolveSettings.shouldPrompt})`,\n resolveSettings.device\n );\n if (options.runtime === 'expo') {\n return this.openProjectInExpoGoAsync(resolveSettings);\n } else if (options.runtime === 'web') {\n return this.openWebProjectAsync(resolveSettings);\n } else if (options.runtime === 'custom') {\n return this.openProjectInCustomRuntimeAsync(resolveSettings, options.props);\n } else {\n throw new CommandError(`Invalid runtime target: ${options.runtime}`);\n }\n }\n\n /** Open the current web project (Webpack) in a device . */\n private async openWebProjectAsync(resolveSettings: Partial<IResolveDeviceProps> = {}): Promise<{\n url: string;\n }> {\n const url = this.props.getDevServerUrl();\n assert(url, 'Dev server is not running.');\n\n const deviceManager = await this.props.resolveDeviceAsync(resolveSettings);\n deviceManager.logOpeningUrl(url);\n await deviceManager.activateWindowAsync();\n await deviceManager.openUrlAsync(url);\n\n return { url };\n }\n\n /** If the launch URL cannot be determined (`custom` runtimes) then an alternative string can be provided to open the device. Often a device ID or activity to launch. Exposed for testing. */\n _resolveAlternativeLaunchUrl(\n applicationId: string,\n props: Partial<IOpenInCustomProps> = {}\n ): string {\n throw new UnimplementedError();\n }\n}\n"],"names":["debug","require","PlatformManager","constructor","projectRoot","props","_getAppIdResolver","UnimplementedError","getExpoGoOrCustomRuntimeUrlAsync","deviceManager","redirectUrl","getRedirectUrl","applicationId","getAppIdAsync","isAppInstalledAsync","Log","warn","chalk","name","learnMore","getExpoGoUrl","openProjectInExpoGoAsync","resolveSettings","resolveDeviceAsync","url","logOpeningUrl","exp","getConfig","installedExpo","ensureExpoGoAsync","sdkVersion","activateWindowAsync","openUrlAsync","logEventAsync","platform","openProjectInCustomRuntimeAsync","Object","entries","map","k","v","join","getCustomRuntimeUrl","scheme","CommandError","_resolveAlternativeLaunchUrl","openAsync","options","runtime","shouldPrompt","device","openWebProjectAsync","getDevServerUrl","assert"],"mappings":"AAAA;;;;AAA0B,IAAA,OAAc,WAAd,cAAc,CAAA;AACrB,IAAA,OAAQ,kCAAR,QAAQ,EAAA;AACT,IAAA,MAAO,kCAAP,OAAO,EAAA;AA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QAC3Eb,aAAa,CAACgB,aAAa,CAACD,GAAG,CAAC,CAAC;QACjC,MAAMf,aAAa,CAACsB,mBAAmB,EAAE,CAAC;QAC1C,MAAMtB,aAAa,CAACuB,YAAY,CAACR,GAAG,CAAC,CAAC;QAEtC,OAAO;YAAEA,GAAG;SAAE,CAAC;KAChB;IAED,8LAA8L,CAC9LqB,4BAA4B,CAC1BjC,aAAqB,EACrBP,KAAkC,GAAG,EAAE,EAC/B;QACR,MAAM,IAAIE,OAAkB,mBAAA,EAAE,CAAC;KAChC;CACF;QAzLYL,eAAe,GAAfA,eAAe"}
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  var _configPlugins = require("@expo/config-plugins");
6
6
  var _appIdResolver = require("../AppIdResolver");
7
+ const debug = require("debug")("expo:start:platforms:android:AndroidAppIdResolver");
7
8
  class AndroidAppIdResolver extends _appIdResolver.AppIdResolver {
8
9
  constructor(projectRoot){
9
10
  super(projectRoot, "android", "android.package");
@@ -12,7 +13,8 @@ class AndroidAppIdResolver extends _appIdResolver.AppIdResolver {
12
13
  try {
13
14
  await _configPlugins.AndroidConfig.Paths.getProjectPathOrThrowAsync(this.projectRoot);
14
15
  return true;
15
- } catch {
16
+ } catch (error) {
17
+ debug("Expected error checking for native project:", error);
16
18
  return false;
17
19
  }
18
20
  }
@@ -31,7 +33,9 @@ class AndroidAppIdResolver extends _appIdResolver.AppIdResolver {
31
33
  if ((ref = androidManifest.manifest) == null ? void 0 : (ref1 = ref.$) == null ? void 0 : ref1.package) {
32
34
  return androidManifest.manifest.$.package;
33
35
  }
34
- } catch {}
36
+ } catch (error) {
37
+ debug("Expected error resolving the package name from the AndroidManifest.xml:", error);
38
+ }
35
39
  return null;
36
40
  }
37
41
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/start/platforms/android/AndroidAppIdResolver.ts"],"sourcesContent":["import { AndroidConfig } from '@expo/config-plugins';\n\nimport { AppIdResolver } from '../AppIdResolver';\n\n/** Resolves the Android package name from the Expo config or native files. */\nexport class AndroidAppIdResolver extends AppIdResolver {\n constructor(projectRoot: string) {\n super(projectRoot, 'android', 'android.package');\n }\n\n async hasNativeProjectAsync(): Promise<boolean> {\n try {\n await AndroidConfig.Paths.getProjectPathOrThrowAsync(this.projectRoot);\n return true;\n } catch {\n return false;\n }\n }\n\n async resolveAppIdFromNativeAsync(): Promise<string | null> {\n const applicationIdFromGradle = await AndroidConfig.Package.getApplicationIdAsync(\n this.projectRoot\n ).catch(() => null);\n if (applicationIdFromGradle) {\n return applicationIdFromGradle;\n }\n\n try {\n const filePath = await AndroidConfig.Paths.getAndroidManifestAsync(this.projectRoot);\n const androidManifest = await AndroidConfig.Manifest.readAndroidManifestAsync(filePath);\n // Assert MainActivity defined.\n await AndroidConfig.Manifest.getMainActivityOrThrow(androidManifest);\n if (androidManifest.manifest?.$?.package) {\n return androidManifest.manifest.$.package;\n }\n } catch {}\n\n return null;\n }\n}\n"],"names":["AndroidAppIdResolver","AppIdResolver","constructor","projectRoot","hasNativeProjectAsync","AndroidConfig","Paths","getProjectPathOrThrowAsync","resolveAppIdFromNativeAsync","applicationIdFromGradle","Package","getApplicationIdAsync","catch","androidManifest","filePath","getAndroidManifestAsync","Manifest","readAndroidManifestAsync","getMainActivityOrThrow","manifest","$","package"],"mappings":"AAAA;;;;AAA8B,IAAA,cAAsB,WAAtB,sBAAsB,CAAA;AAEtB,IAAA,cAAkB,WAAlB,kBAAkB,CAAA;AAGzC,MAAMA,oBAAoB,SAASC,cAAa,cAAA;IACrDC,YAAYC,WAAmB,CAAE;QAC/B,KAAK,CAACA,WAAW,EAAE,SAAS,EAAE,iBAAiB,CAAC,CAAC;KAClD;IAED,MAAMC,qBAAqB,GAAqB;QAC9C,IAAI;YACF,MAAMC,cAAa,cAAA,CAACC,KAAK,CAACC,0BAA0B,CAAC,IAAI,CAACJ,WAAW,CAAC,CAAC;YACvE,OAAO,IAAI,CAAC;SACb,CAAC,OAAM;YACN,OAAO,KAAK,CAAC;SACd;KACF;IAED,MAAMK,2BAA2B,GAA2B;QAC1D,MAAMC,uBAAuB,GAAG,MAAMJ,cAAa,cAAA,CAACK,OAAO,CAACC,qBAAqB,CAC/E,IAAI,CAACR,WAAW,CACjB,CAACS,KAAK,CAAC,IAAM,IAAI;QAAA,CAAC,AAAC;QACpB,IAAIH,uBAAuB,EAAE;YAC3B,OAAOA,uBAAuB,CAAC;SAChC;QAED,IAAI;gBAKEI,GAAwB;YAJ5B,MAAMC,QAAQ,GAAG,MAAMT,cAAa,cAAA,CAACC,KAAK,CAACS,uBAAuB,CAAC,IAAI,CAACZ,WAAW,CAAC,AAAC;YACrF,MAAMU,eAAe,GAAG,MAAMR,cAAa,cAAA,CAACW,QAAQ,CAACC,wBAAwB,CAACH,QAAQ,CAAC,AAAC;YACxF,+BAA+B;YAC/B,MAAMT,cAAa,cAAA,CAACW,QAAQ,CAACE,sBAAsB,CAACL,eAAe,CAAC,CAAC;YACrE,IAAIA,CAAAA,GAAwB,GAAxBA,eAAe,CAACM,QAAQ,SAAG,GAA3BN,KAAAA,CAA2B,GAA3BA,QAAAA,GAAwB,CAAEO,CAAC,SAAA,GAA3BP,KAAAA,CAA2B,QAAEQ,OAAO,AAAT,EAAW;gBACxC,OAAOR,eAAe,CAACM,QAAQ,CAACC,CAAC,CAACC,OAAO,CAAC;aAC3C;SACF,CAAC,OAAM,EAAE;QAEV,OAAO,IAAI,CAAC;KACb;CACF;QAlCYrB,oBAAoB,GAApBA,oBAAoB"}
1
+ {"version":3,"sources":["../../../../../src/start/platforms/android/AndroidAppIdResolver.ts"],"sourcesContent":["import { AndroidConfig } from '@expo/config-plugins';\n\nimport { AppIdResolver } from '../AppIdResolver';\n\nconst debug = require('debug')(\n 'expo:start:platforms:android:AndroidAppIdResolver'\n) as typeof console.log;\n\n/** Resolves the Android package name from the Expo config or native files. */\nexport class AndroidAppIdResolver extends AppIdResolver {\n constructor(projectRoot: string) {\n super(projectRoot, 'android', 'android.package');\n }\n\n async hasNativeProjectAsync(): Promise<boolean> {\n try {\n await AndroidConfig.Paths.getProjectPathOrThrowAsync(this.projectRoot);\n return true;\n } catch (error: any) {\n debug('Expected error checking for native project:', error);\n return false;\n }\n }\n\n async resolveAppIdFromNativeAsync(): Promise<string | null> {\n const applicationIdFromGradle = await AndroidConfig.Package.getApplicationIdAsync(\n this.projectRoot\n ).catch(() => null);\n if (applicationIdFromGradle) {\n return applicationIdFromGradle;\n }\n\n try {\n const filePath = await AndroidConfig.Paths.getAndroidManifestAsync(this.projectRoot);\n const androidManifest = await AndroidConfig.Manifest.readAndroidManifestAsync(filePath);\n // Assert MainActivity defined.\n await AndroidConfig.Manifest.getMainActivityOrThrow(androidManifest);\n if (androidManifest.manifest?.$?.package) {\n return androidManifest.manifest.$.package;\n }\n } catch (error: any) {\n debug('Expected error resolving the package name from the AndroidManifest.xml:', error);\n }\n\n return null;\n }\n}\n"],"names":["debug","require","AndroidAppIdResolver","AppIdResolver","constructor","projectRoot","hasNativeProjectAsync","AndroidConfig","Paths","getProjectPathOrThrowAsync","error","resolveAppIdFromNativeAsync","applicationIdFromGradle","Package","getApplicationIdAsync","catch","androidManifest","filePath","getAndroidManifestAsync","Manifest","readAndroidManifestAsync","getMainActivityOrThrow","manifest","$","package"],"mappings":"AAAA;;;;AAA8B,IAAA,cAAsB,WAAtB,sBAAsB,CAAA;AAEtB,IAAA,cAAkB,WAAlB,kBAAkB,CAAA;AAEhD,MAAMA,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAC5B,mDAAmD,CACpD,AAAsB,AAAC;AAGjB,MAAMC,oBAAoB,SAASC,cAAa,cAAA;IACrDC,YAAYC,WAAmB,CAAE;QAC/B,KAAK,CAACA,WAAW,EAAE,SAAS,EAAE,iBAAiB,CAAC,CAAC;KAClD;IAED,MAAMC,qBAAqB,GAAqB;QAC9C,IAAI;YACF,MAAMC,cAAa,cAAA,CAACC,KAAK,CAACC,0BAA0B,CAAC,IAAI,CAACJ,WAAW,CAAC,CAAC;YACvE,OAAO,IAAI,CAAC;SACb,CAAC,OAAOK,KAAK,EAAO;YACnBV,KAAK,CAAC,6CAA6C,EAAEU,KAAK,CAAC,CAAC;YAC5D,OAAO,KAAK,CAAC;SACd;KACF;IAED,MAAMC,2BAA2B,GAA2B;QAC1D,MAAMC,uBAAuB,GAAG,MAAML,cAAa,cAAA,CAACM,OAAO,CAACC,qBAAqB,CAC/E,IAAI,CAACT,WAAW,CACjB,CAACU,KAAK,CAAC,IAAM,IAAI;QAAA,CAAC,AAAC;QACpB,IAAIH,uBAAuB,EAAE;YAC3B,OAAOA,uBAAuB,CAAC;SAChC;QAED,IAAI;gBAKEI,GAAwB;YAJ5B,MAAMC,QAAQ,GAAG,MAAMV,cAAa,cAAA,CAACC,KAAK,CAACU,uBAAuB,CAAC,IAAI,CAACb,WAAW,CAAC,AAAC;YACrF,MAAMW,eAAe,GAAG,MAAMT,cAAa,cAAA,CAACY,QAAQ,CAACC,wBAAwB,CAACH,QAAQ,CAAC,AAAC;YACxF,+BAA+B;YAC/B,MAAMV,cAAa,cAAA,CAACY,QAAQ,CAACE,sBAAsB,CAACL,eAAe,CAAC,CAAC;YACrE,IAAIA,CAAAA,GAAwB,GAAxBA,eAAe,CAACM,QAAQ,SAAG,GAA3BN,KAAAA,CAA2B,GAA3BA,QAAAA,GAAwB,CAAEO,CAAC,SAAA,GAA3BP,KAAAA,CAA2B,QAAEQ,OAAO,AAAT,EAAW;gBACxC,OAAOR,eAAe,CAACM,QAAQ,CAACC,CAAC,CAACC,OAAO,CAAC;aAC3C;SACF,CAAC,OAAOd,KAAK,EAAO;YACnBV,KAAK,CAAC,yEAAyE,EAAEU,KAAK,CAAC,CAAC;SACzF;QAED,OAAO,IAAI,CAAC;KACb;CACF;QArCYR,oBAAoB,GAApBA,oBAAoB"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/start/platforms/android/AndroidPlatformManager.ts"],"sourcesContent":["import { AppIdResolver } from '../AppIdResolver';\nimport { BaseOpenInCustomProps, BaseResolveDeviceProps, PlatformManager } from '../PlatformManager';\nimport { AndroidAppIdResolver } from './AndroidAppIdResolver';\nimport { AndroidDeviceManager } from './AndroidDeviceManager';\nimport { Device } from './adb';\nimport { startAdbReverseAsync } from './adbReverse';\n\ninterface AndroidOpenInCustomProps extends BaseOpenInCustomProps {\n launchActivity?: string;\n}\n\nexport class AndroidPlatformManager extends PlatformManager<Device, AndroidOpenInCustomProps> {\n constructor(\n protected projectRoot: string,\n protected port: number,\n options: {\n /** Get the base URL for the dev server hosting this platform manager. */\n getDevServerUrl: () => string | null;\n /** Expo Go URL. */\n getExpoGoUrl: () => string | null;\n /** Dev Client URL. */\n getCustomRuntimeUrl: (props?: { scheme?: string }) => string | null;\n }\n ) {\n super(projectRoot, {\n platform: 'android',\n ...options,\n resolveDeviceAsync: AndroidDeviceManager.resolveAsync,\n });\n }\n\n async openAsync(\n options:\n | { runtime: 'expo' | 'web' }\n | { runtime: 'custom'; props?: Partial<AndroidOpenInCustomProps> },\n resolveSettings?: Partial<BaseResolveDeviceProps<Device>>\n ): Promise<{ url: string }> {\n await startAdbReverseAsync([this.port]);\n return super.openAsync(options, resolveSettings);\n }\n\n _getAppIdResolver(): AppIdResolver {\n return new AndroidAppIdResolver(this.projectRoot);\n }\n\n _resolveAlternativeLaunchUrl(\n applicationId: string,\n props?: Partial<AndroidOpenInCustomProps>\n ): string {\n return props?.launchActivity ?? `${applicationId}/.MainActivity`;\n }\n}\n"],"names":["AndroidPlatformManager","PlatformManager","constructor","projectRoot","port","options","platform","resolveDeviceAsync","AndroidDeviceManager","resolveAsync","openAsync","resolveSettings","startAdbReverseAsync","_getAppIdResolver","AndroidAppIdResolver","_resolveAlternativeLaunchUrl","applicationId","props","launchActivity"],"mappings":"AAAA;;;;AAC+E,IAAA,gBAAoB,WAApB,oBAAoB,CAAA;AAC9D,IAAA,qBAAwB,WAAxB,wBAAwB,CAAA;AACxB,IAAA,qBAAwB,WAAxB,wBAAwB,CAAA;AAExB,IAAA,WAAc,WAAd,cAAc,CAAA;AAM5C,MAAMA,sBAAsB,SAASC,gBAAe,gBAAA;IACzDC,YACYC,WAAmB,EACnBC,IAAY,EACtBC,OAOC,CACD;QACA,KAAK,CAACF,WAAW,EAAE;YACjBG,QAAQ,EAAE,SAAS;YACnB,GAAGD,OAAO;YACVE,kBAAkB,EAAEC,qBAAoB,qBAAA,CAACC,YAAY;SACtD,CAAC,CAAC;aAfON,WAAmB,GAAnBA,WAAmB;aACnBC,IAAY,GAAZA,IAAY;KAevB;IAED,MAAMM,SAAS,CACbL,OAEoE,EACpEM,eAAyD,EAC/B;QAC1B,MAAMC,CAAAA,GAAAA,WAAoB,AAAa,CAAA,qBAAb,CAAC;YAAC,IAAI,CAACR,IAAI;SAAC,CAAC,CAAC;QACxC,OAAO,KAAK,CAACM,SAAS,CAACL,OAAO,EAAEM,eAAe,CAAC,CAAC;KAClD;IAEDE,iBAAiB,GAAkB;QACjC,OAAO,IAAIC,qBAAoB,qBAAA,CAAC,IAAI,CAACX,WAAW,CAAC,CAAC;KACnD;IAEDY,4BAA4B,CAC1BC,aAAqB,EACrBC,KAAyC,EACjC;YACDA,GAAqB;QAA5B,OAAOA,CAAAA,GAAqB,GAArBA,KAAK,QAAgB,GAArBA,KAAAA,CAAqB,GAArBA,KAAK,CAAEC,cAAc,YAArBD,GAAqB,GAAI,CAAC,EAAED,aAAa,CAAC,cAAc,CAAC,CAAC;KAClE;CACF;QAxCYhB,sBAAsB,GAAtBA,sBAAsB"}
1
+ {"version":3,"sources":["../../../../../src/start/platforms/android/AndroidPlatformManager.ts"],"sourcesContent":["import { AppIdResolver } from '../AppIdResolver';\nimport { BaseOpenInCustomProps, BaseResolveDeviceProps, PlatformManager } from '../PlatformManager';\nimport { AndroidAppIdResolver } from './AndroidAppIdResolver';\nimport { AndroidDeviceManager } from './AndroidDeviceManager';\nimport { Device } from './adb';\nimport { startAdbReverseAsync } from './adbReverse';\n\ninterface AndroidOpenInCustomProps extends BaseOpenInCustomProps {\n launchActivity?: string;\n}\n\nexport class AndroidPlatformManager extends PlatformManager<Device, AndroidOpenInCustomProps> {\n constructor(\n protected projectRoot: string,\n protected port: number,\n options: {\n /** Get the base URL for the dev server hosting this platform manager. */\n getDevServerUrl: () => string | null;\n /** Expo Go URL */\n getExpoGoUrl: () => string;\n /** Get redirect URL for native disambiguation. */\n getRedirectUrl: () => string | null;\n /** Dev Client URL. */\n getCustomRuntimeUrl: (props?: { scheme?: string }) => string | null;\n }\n ) {\n super(projectRoot, {\n platform: 'android',\n ...options,\n resolveDeviceAsync: AndroidDeviceManager.resolveAsync,\n });\n }\n\n async openAsync(\n options:\n | { runtime: 'expo' | 'web' }\n | { runtime: 'custom'; props?: Partial<AndroidOpenInCustomProps> },\n resolveSettings?: Partial<BaseResolveDeviceProps<Device>>\n ): Promise<{ url: string }> {\n await startAdbReverseAsync([this.port]);\n return super.openAsync(options, resolveSettings);\n }\n\n _getAppIdResolver(): AppIdResolver {\n return new AndroidAppIdResolver(this.projectRoot);\n }\n\n _resolveAlternativeLaunchUrl(\n applicationId: string,\n props?: Partial<AndroidOpenInCustomProps>\n ): string {\n return props?.launchActivity ?? `${applicationId}/.MainActivity`;\n }\n}\n"],"names":["AndroidPlatformManager","PlatformManager","constructor","projectRoot","port","options","platform","resolveDeviceAsync","AndroidDeviceManager","resolveAsync","openAsync","resolveSettings","startAdbReverseAsync","_getAppIdResolver","AndroidAppIdResolver","_resolveAlternativeLaunchUrl","applicationId","props","launchActivity"],"mappings":"AAAA;;;;AAC+E,IAAA,gBAAoB,WAApB,oBAAoB,CAAA;AAC9D,IAAA,qBAAwB,WAAxB,wBAAwB,CAAA;AACxB,IAAA,qBAAwB,WAAxB,wBAAwB,CAAA;AAExB,IAAA,WAAc,WAAd,cAAc,CAAA;AAM5C,MAAMA,sBAAsB,SAASC,gBAAe,gBAAA;IACzDC,YACYC,WAAmB,EACnBC,IAAY,EACtBC,OASC,CACD;QACA,KAAK,CAACF,WAAW,EAAE;YACjBG,QAAQ,EAAE,SAAS;YACnB,GAAGD,OAAO;YACVE,kBAAkB,EAAEC,qBAAoB,qBAAA,CAACC,YAAY;SACtD,CAAC,CAAC;aAjBON,WAAmB,GAAnBA,WAAmB;aACnBC,IAAY,GAAZA,IAAY;KAiBvB;IAED,MAAMM,SAAS,CACbL,OAEoE,EACpEM,eAAyD,EAC/B;QAC1B,MAAMC,CAAAA,GAAAA,WAAoB,AAAa,CAAA,qBAAb,CAAC;YAAC,IAAI,CAACR,IAAI;SAAC,CAAC,CAAC;QACxC,OAAO,KAAK,CAACM,SAAS,CAACL,OAAO,EAAEM,eAAe,CAAC,CAAC;KAClD;IAEDE,iBAAiB,GAAkB;QACjC,OAAO,IAAIC,qBAAoB,qBAAA,CAAC,IAAI,CAACX,WAAW,CAAC,CAAC;KACnD;IAEDY,4BAA4B,CAC1BC,aAAqB,EACrBC,KAAyC,EACjC;YACDA,GAAqB;QAA5B,OAAOA,CAAAA,GAAqB,GAArBA,KAAK,QAAgB,GAArBA,KAAAA,CAAqB,GAArBA,KAAK,CAAEC,cAAc,YAArBD,GAAqB,GAAI,CAAC,EAAED,aAAa,CAAC,cAAc,CAAC,CAAC;KAClE;CACF;QA1CYhB,sBAAsB,GAAtBA,sBAAsB"}
@@ -11,15 +11,18 @@ function _interopRequireDefault(obj) {
11
11
  default: obj
12
12
  };
13
13
  }
14
+ const debug = require("debug")("expo:start:platforms:ios:AppleAppIdResolver");
14
15
  class AppleAppIdResolver extends _appIdResolver.AppIdResolver {
15
16
  constructor(projectRoot){
16
17
  super(projectRoot, "ios", "ios.bundleIdentifier");
17
18
  }
18
19
  async hasNativeProjectAsync() {
19
20
  try {
21
+ // Never returns nullish values.
20
22
  return !!_configPlugins.IOSConfig.Paths.getAppDelegateFilePath(this.projectRoot);
21
- } catch {
22
- return true;
23
+ } catch (error) {
24
+ debug("Expected error checking for native project:", error);
25
+ return false;
23
26
  }
24
27
  }
25
28
  async resolveAppIdFromNativeAsync() {
@@ -29,7 +32,9 @@ class AppleAppIdResolver extends _appIdResolver.AppIdResolver {
29
32
  if (bundleId) {
30
33
  return bundleId;
31
34
  }
32
- } catch {}
35
+ } catch (error) {
36
+ debug("Expected error resolving the bundle identifier from the pbxproj:", error);
37
+ }
33
38
  // Check Info.plist
34
39
  try {
35
40
  const infoPlistPath = _configPlugins.IOSConfig.Paths.getInfoPlistPath(this.projectRoot);
@@ -37,7 +42,9 @@ class AppleAppIdResolver extends _appIdResolver.AppIdResolver {
37
42
  if (data.CFBundleIdentifier && !data.CFBundleIdentifier.startsWith("$(")) {
38
43
  return data.CFBundleIdentifier;
39
44
  }
40
- } catch {}
45
+ } catch (error1) {
46
+ debug("Expected error resolving the bundle identifier from the project Info.plist:", error1);
47
+ }
41
48
  return null;
42
49
  }
43
50
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/start/platforms/ios/AppleAppIdResolver.ts"],"sourcesContent":["import { IOSConfig } from '@expo/config-plugins';\nimport plist from '@expo/plist';\nimport fs from 'fs';\n\nimport { AppIdResolver } from '../AppIdResolver';\n\n/** Resolves the iOS bundle identifier from the Expo config or native files. */\nexport class AppleAppIdResolver extends AppIdResolver {\n constructor(projectRoot: string) {\n super(projectRoot, 'ios', 'ios.bundleIdentifier');\n }\n\n async hasNativeProjectAsync(): Promise<boolean> {\n try {\n return !!IOSConfig.Paths.getAppDelegateFilePath(this.projectRoot);\n } catch {\n return true;\n }\n }\n\n async resolveAppIdFromNativeAsync(): Promise<string | null> {\n // Check xcode project\n try {\n const bundleId = IOSConfig.BundleIdentifier.getBundleIdentifierFromPbxproj(this.projectRoot);\n if (bundleId) {\n return bundleId;\n }\n } catch {}\n\n // Check Info.plist\n try {\n const infoPlistPath = IOSConfig.Paths.getInfoPlistPath(this.projectRoot);\n const data = await plist.parse(fs.readFileSync(infoPlistPath, 'utf8'));\n if (data.CFBundleIdentifier && !data.CFBundleIdentifier.startsWith('$(')) {\n return data.CFBundleIdentifier;\n }\n } catch {}\n\n return null;\n }\n}\n"],"names":["AppleAppIdResolver","AppIdResolver","constructor","projectRoot","hasNativeProjectAsync","IOSConfig","Paths","getAppDelegateFilePath","resolveAppIdFromNativeAsync","bundleId","BundleIdentifier","getBundleIdentifierFromPbxproj","infoPlistPath","getInfoPlistPath","data","plist","parse","fs","readFileSync","CFBundleIdentifier","startsWith"],"mappings":"AAAA;;;;AAA0B,IAAA,cAAsB,WAAtB,sBAAsB,CAAA;AAC9B,IAAA,MAAa,kCAAb,aAAa,EAAA;AAChB,IAAA,GAAI,kCAAJ,IAAI,EAAA;AAEW,IAAA,cAAkB,WAAlB,kBAAkB,CAAA;;;;;;AAGzC,MAAMA,kBAAkB,SAASC,cAAa,cAAA;IACnDC,YAAYC,WAAmB,CAAE;QAC/B,KAAK,CAACA,WAAW,EAAE,KAAK,EAAE,sBAAsB,CAAC,CAAC;KACnD;IAED,MAAMC,qBAAqB,GAAqB;QAC9C,IAAI;YACF,OAAO,CAAC,CAACC,cAAS,UAAA,CAACC,KAAK,CAACC,sBAAsB,CAAC,IAAI,CAACJ,WAAW,CAAC,CAAC;SACnE,CAAC,OAAM;YACN,OAAO,IAAI,CAAC;SACb;KACF;IAED,MAAMK,2BAA2B,GAA2B;QAC1D,sBAAsB;QACtB,IAAI;YACF,MAAMC,QAAQ,GAAGJ,cAAS,UAAA,CAACK,gBAAgB,CAACC,8BAA8B,CAAC,IAAI,CAACR,WAAW,CAAC,AAAC;YAC7F,IAAIM,QAAQ,EAAE;gBACZ,OAAOA,QAAQ,CAAC;aACjB;SACF,CAAC,OAAM,EAAE;QAEV,mBAAmB;QACnB,IAAI;YACF,MAAMG,aAAa,GAAGP,cAAS,UAAA,CAACC,KAAK,CAACO,gBAAgB,CAAC,IAAI,CAACV,WAAW,CAAC,AAAC;YACzE,MAAMW,IAAI,GAAG,MAAMC,MAAK,QAAA,CAACC,KAAK,CAACC,GAAE,QAAA,CAACC,YAAY,CAACN,aAAa,EAAE,MAAM,CAAC,CAAC,AAAC;YACvE,IAAIE,IAAI,CAACK,kBAAkB,IAAI,CAACL,IAAI,CAACK,kBAAkB,CAACC,UAAU,CAAC,IAAI,CAAC,EAAE;gBACxE,OAAON,IAAI,CAACK,kBAAkB,CAAC;aAChC;SACF,CAAC,OAAM,EAAE;QAEV,OAAO,IAAI,CAAC;KACb;CACF;QAjCYnB,kBAAkB,GAAlBA,kBAAkB"}
1
+ {"version":3,"sources":["../../../../../src/start/platforms/ios/AppleAppIdResolver.ts"],"sourcesContent":["import { IOSConfig } from '@expo/config-plugins';\nimport plist from '@expo/plist';\nimport fs from 'fs';\n\nimport { AppIdResolver } from '../AppIdResolver';\n\nconst debug = require('debug')('expo:start:platforms:ios:AppleAppIdResolver') as typeof console.log;\n\n/** Resolves the iOS bundle identifier from the Expo config or native files. */\nexport class AppleAppIdResolver extends AppIdResolver {\n constructor(projectRoot: string) {\n super(projectRoot, 'ios', 'ios.bundleIdentifier');\n }\n\n async hasNativeProjectAsync(): Promise<boolean> {\n try {\n // Never returns nullish values.\n return !!IOSConfig.Paths.getAppDelegateFilePath(this.projectRoot);\n } catch (error: any) {\n debug('Expected error checking for native project:', error);\n return false;\n }\n }\n\n async resolveAppIdFromNativeAsync(): Promise<string | null> {\n // Check xcode project\n try {\n const bundleId = IOSConfig.BundleIdentifier.getBundleIdentifierFromPbxproj(this.projectRoot);\n if (bundleId) {\n return bundleId;\n }\n } catch (error: any) {\n debug('Expected error resolving the bundle identifier from the pbxproj:', error);\n }\n\n // Check Info.plist\n try {\n const infoPlistPath = IOSConfig.Paths.getInfoPlistPath(this.projectRoot);\n const data = await plist.parse(fs.readFileSync(infoPlistPath, 'utf8'));\n if (data.CFBundleIdentifier && !data.CFBundleIdentifier.startsWith('$(')) {\n return data.CFBundleIdentifier;\n }\n } catch (error) {\n debug('Expected error resolving the bundle identifier from the project Info.plist:', error);\n }\n\n return null;\n }\n}\n"],"names":["debug","require","AppleAppIdResolver","AppIdResolver","constructor","projectRoot","hasNativeProjectAsync","IOSConfig","Paths","getAppDelegateFilePath","error","resolveAppIdFromNativeAsync","bundleId","BundleIdentifier","getBundleIdentifierFromPbxproj","infoPlistPath","getInfoPlistPath","data","plist","parse","fs","readFileSync","CFBundleIdentifier","startsWith"],"mappings":"AAAA;;;;AAA0B,IAAA,cAAsB,WAAtB,sBAAsB,CAAA;AAC9B,IAAA,MAAa,kCAAb,aAAa,EAAA;AAChB,IAAA,GAAI,kCAAJ,IAAI,EAAA;AAEW,IAAA,cAAkB,WAAlB,kBAAkB,CAAA;;;;;;AAEhD,MAAMA,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,6CAA6C,CAAC,AAAsB,AAAC;AAG7F,MAAMC,kBAAkB,SAASC,cAAa,cAAA;IACnDC,YAAYC,WAAmB,CAAE;QAC/B,KAAK,CAACA,WAAW,EAAE,KAAK,EAAE,sBAAsB,CAAC,CAAC;KACnD;IAED,MAAMC,qBAAqB,GAAqB;QAC9C,IAAI;YACF,gCAAgC;YAChC,OAAO,CAAC,CAACC,cAAS,UAAA,CAACC,KAAK,CAACC,sBAAsB,CAAC,IAAI,CAACJ,WAAW,CAAC,CAAC;SACnE,CAAC,OAAOK,KAAK,EAAO;YACnBV,KAAK,CAAC,6CAA6C,EAAEU,KAAK,CAAC,CAAC;YAC5D,OAAO,KAAK,CAAC;SACd;KACF;IAED,MAAMC,2BAA2B,GAA2B;QAC1D,sBAAsB;QACtB,IAAI;YACF,MAAMC,QAAQ,GAAGL,cAAS,UAAA,CAACM,gBAAgB,CAACC,8BAA8B,CAAC,IAAI,CAACT,WAAW,CAAC,AAAC;YAC7F,IAAIO,QAAQ,EAAE;gBACZ,OAAOA,QAAQ,CAAC;aACjB;SACF,CAAC,OAAOF,KAAK,EAAO;YACnBV,KAAK,CAAC,kEAAkE,EAAEU,KAAK,CAAC,CAAC;SAClF;QAED,mBAAmB;QACnB,IAAI;YACF,MAAMK,aAAa,GAAGR,cAAS,UAAA,CAACC,KAAK,CAACQ,gBAAgB,CAAC,IAAI,CAACX,WAAW,CAAC,AAAC;YACzE,MAAMY,IAAI,GAAG,MAAMC,MAAK,QAAA,CAACC,KAAK,CAACC,GAAE,QAAA,CAACC,YAAY,CAACN,aAAa,EAAE,MAAM,CAAC,CAAC,AAAC;YACvE,IAAIE,IAAI,CAACK,kBAAkB,IAAI,CAACL,IAAI,CAACK,kBAAkB,CAACC,UAAU,CAAC,IAAI,CAAC,EAAE;gBACxE,OAAON,IAAI,CAACK,kBAAkB,CAAC;aAChC;SACF,CAAC,OAAOZ,MAAK,EAAE;YACdV,KAAK,CAAC,6EAA6E,EAAEU,MAAK,CAAC,CAAC;SAC7F;QAED,OAAO,IAAI,CAAC;KACb;CACF;QAvCYR,kBAAkB,GAAlBA,kBAAkB"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/start/platforms/ios/ApplePlatformManager.ts"],"sourcesContent":["import { AppIdResolver } from '../AppIdResolver';\nimport { BaseOpenInCustomProps, PlatformManager } from '../PlatformManager';\nimport { AppleAppIdResolver } from './AppleAppIdResolver';\nimport { AppleDeviceManager } from './AppleDeviceManager';\nimport { Device } from './simctl';\n\n/** Manages launching apps on Apple simulators. */\nexport class ApplePlatformManager extends PlatformManager<Device> {\n constructor(\n protected projectRoot: string,\n protected port: number,\n options: {\n /** Get the base URL for the dev server hosting this platform manager. */\n getDevServerUrl: () => string | null;\n /** Expo Go URL */\n getExpoGoUrl: () => string | null;\n /** Dev Client */\n getCustomRuntimeUrl: (props?: { scheme?: string }) => string | null;\n }\n ) {\n super(projectRoot, {\n platform: 'ios',\n ...options,\n resolveDeviceAsync: AppleDeviceManager.resolveAsync,\n });\n }\n\n async openAsync(\n options:\n | { runtime: 'expo' | 'web' }\n | { runtime: 'custom'; props?: Partial<BaseOpenInCustomProps> },\n resolveSettings?: Partial<{ shouldPrompt?: boolean; device?: Device }>\n ): Promise<{ url: string }> {\n await AppleDeviceManager.assertSystemRequirementsAsync();\n return super.openAsync(options, resolveSettings);\n }\n\n _getAppIdResolver(): AppIdResolver {\n return new AppleAppIdResolver(this.projectRoot);\n }\n\n _resolveAlternativeLaunchUrl(\n applicationId: string,\n props?: Partial<BaseOpenInCustomProps>\n ): string {\n return applicationId;\n }\n}\n"],"names":["ApplePlatformManager","PlatformManager","constructor","projectRoot","port","options","platform","resolveDeviceAsync","AppleDeviceManager","resolveAsync","openAsync","resolveSettings","assertSystemRequirementsAsync","_getAppIdResolver","AppleAppIdResolver","_resolveAlternativeLaunchUrl","applicationId","props"],"mappings":"AAAA;;;;AACuD,IAAA,gBAAoB,WAApB,oBAAoB,CAAA;AACxC,IAAA,mBAAsB,WAAtB,sBAAsB,CAAA;AACtB,IAAA,mBAAsB,WAAtB,sBAAsB,CAAA;AAIlD,MAAMA,oBAAoB,SAASC,gBAAe,gBAAA;IACvDC,YACYC,WAAmB,EACnBC,IAAY,EACtBC,OAOC,CACD;QACA,KAAK,CAACF,WAAW,EAAE;YACjBG,QAAQ,EAAE,KAAK;YACf,GAAGD,OAAO;YACVE,kBAAkB,EAAEC,mBAAkB,mBAAA,CAACC,YAAY;SACpD,CAAC,CAAC;aAfON,WAAmB,GAAnBA,WAAmB;aACnBC,IAAY,GAAZA,IAAY;KAevB;IAED,MAAMM,SAAS,CACbL,OAEiE,EACjEM,eAAsE,EAC5C;QAC1B,MAAMH,mBAAkB,mBAAA,CAACI,6BAA6B,EAAE,CAAC;QACzD,OAAO,KAAK,CAACF,SAAS,CAACL,OAAO,EAAEM,eAAe,CAAC,CAAC;KAClD;IAEDE,iBAAiB,GAAkB;QACjC,OAAO,IAAIC,mBAAkB,mBAAA,CAAC,IAAI,CAACX,WAAW,CAAC,CAAC;KACjD;IAEDY,4BAA4B,CAC1BC,aAAqB,EACrBC,KAAsC,EAC9B;QACR,OAAOD,aAAa,CAAC;KACtB;CACF;QAxCYhB,oBAAoB,GAApBA,oBAAoB"}
1
+ {"version":3,"sources":["../../../../../src/start/platforms/ios/ApplePlatformManager.ts"],"sourcesContent":["import { AppIdResolver } from '../AppIdResolver';\nimport { BaseOpenInCustomProps, PlatformManager } from '../PlatformManager';\nimport { AppleAppIdResolver } from './AppleAppIdResolver';\nimport { AppleDeviceManager } from './AppleDeviceManager';\nimport { Device } from './simctl';\n\n/** Manages launching apps on Apple simulators. */\nexport class ApplePlatformManager extends PlatformManager<Device> {\n constructor(\n protected projectRoot: string,\n protected port: number,\n options: {\n /** Get the base URL for the dev server hosting this platform manager. */\n getDevServerUrl: () => string | null;\n /** Expo Go URL. */\n getExpoGoUrl: () => string;\n /** Get redirect URL for native disambiguation. */\n getRedirectUrl: () => string | null;\n /** Dev Client */\n getCustomRuntimeUrl: (props?: { scheme?: string }) => string | null;\n }\n ) {\n super(projectRoot, {\n platform: 'ios',\n ...options,\n resolveDeviceAsync: AppleDeviceManager.resolveAsync,\n });\n }\n\n async openAsync(\n options:\n | { runtime: 'expo' | 'web' }\n | { runtime: 'custom'; props?: Partial<BaseOpenInCustomProps> },\n resolveSettings?: Partial<{ shouldPrompt?: boolean; device?: Device }>\n ): Promise<{ url: string }> {\n await AppleDeviceManager.assertSystemRequirementsAsync();\n return super.openAsync(options, resolveSettings);\n }\n\n _getAppIdResolver(): AppIdResolver {\n return new AppleAppIdResolver(this.projectRoot);\n }\n\n _resolveAlternativeLaunchUrl(\n applicationId: string,\n props?: Partial<BaseOpenInCustomProps>\n ): string {\n return applicationId;\n }\n}\n"],"names":["ApplePlatformManager","PlatformManager","constructor","projectRoot","port","options","platform","resolveDeviceAsync","AppleDeviceManager","resolveAsync","openAsync","resolveSettings","assertSystemRequirementsAsync","_getAppIdResolver","AppleAppIdResolver","_resolveAlternativeLaunchUrl","applicationId","props"],"mappings":"AAAA;;;;AACuD,IAAA,gBAAoB,WAApB,oBAAoB,CAAA;AACxC,IAAA,mBAAsB,WAAtB,sBAAsB,CAAA;AACtB,IAAA,mBAAsB,WAAtB,sBAAsB,CAAA;AAIlD,MAAMA,oBAAoB,SAASC,gBAAe,gBAAA;IACvDC,YACYC,WAAmB,EACnBC,IAAY,EACtBC,OASC,CACD;QACA,KAAK,CAACF,WAAW,EAAE;YACjBG,QAAQ,EAAE,KAAK;YACf,GAAGD,OAAO;YACVE,kBAAkB,EAAEC,mBAAkB,mBAAA,CAACC,YAAY;SACpD,CAAC,CAAC;aAjBON,WAAmB,GAAnBA,WAAmB;aACnBC,IAAY,GAAZA,IAAY;KAiBvB;IAED,MAAMM,SAAS,CACbL,OAEiE,EACjEM,eAAsE,EAC5C;QAC1B,MAAMH,mBAAkB,mBAAA,CAACI,6BAA6B,EAAE,CAAC;QACzD,OAAO,KAAK,CAACF,SAAS,CAACL,OAAO,EAAEM,eAAe,CAAC,CAAC;KAClD;IAEDE,iBAAiB,GAAkB;QACjC,OAAO,IAAIC,mBAAkB,mBAAA,CAAC,IAAI,CAACX,WAAW,CAAC,CAAC;KACjD;IAEDY,4BAA4B,CAC1BC,aAAqB,EACrBC,KAAsC,EAC9B;QACR,OAAOD,aAAa,CAAC;KACtB;CACF;QA1CYhB,oBAAoB,GAApBA,oBAAoB"}
@@ -276,23 +276,23 @@ class BundlerDevServer {
276
276
  props: launchProps
277
277
  }, resolver);
278
278
  }
279
- /** Should use the interstitial page for selecting which runtime to use. */ shouldUseInterstitialPage() {
280
- return _env.env.EXPO_ENABLE_INTERSTITIAL_PAGE && // Checks if dev client is installed.
281
- !!_resolveFrom.default.silent(this.projectRoot, "expo-dev-launcher");
279
+ /** Get the URL for opening in Expo Go. */ getExpoGoUrl() {
280
+ return this.getUrlCreator().constructUrl({
281
+ scheme: "exp"
282
+ });
282
283
  }
283
- /** Get the URL for opening in Expo Go. */ getExpoGoUrl(platform) {
284
- var ref;
285
- if (this.shouldUseInterstitialPage()) {
286
- var ref4, ref5;
287
- const loadingUrl = platform === "emulator" ? (ref4 = this.urlCreator) == null ? void 0 : ref4.constructLoadingUrl({}, "android") : (ref5 = this.urlCreator) == null ? void 0 : ref5.constructLoadingUrl({
288
- hostType: "localhost"
289
- }, "ios");
290
- return loadingUrl != null ? loadingUrl : null;
284
+ /** Should use the interstitial page for selecting which runtime to use. */ isRedirectPageEnabled() {
285
+ return !_env.env.EXPO_NO_REDIRECT_PAGE && // if user passed --dev-client flag, skip interstitial page
286
+ !this.isDevClient && // Checks if dev client is installed.
287
+ !!_resolveFrom.default.silent(this.projectRoot, "expo-dev-client");
288
+ }
289
+ /** Get the redirect URL when redirecting is enabled. */ getRedirectUrl(platform = null) {
290
+ if (!this.isRedirectPageEnabled()) {
291
+ debug("Redirect page is disabled");
292
+ return null;
291
293
  }
292
- var ref6;
293
- return (ref6 = (ref = this.urlCreator) == null ? void 0 : ref.constructUrl({
294
- scheme: "exp"
295
- })) != null ? ref6 : null;
294
+ var ref;
295
+ return (ref = this.getUrlCreator().constructLoadingUrl({}, platform === "emulator" ? "android" : platform === "simulator" ? "ios" : null)) != null ? ref : null;
296
296
  }
297
297
  async getPlatformManagerAsync(platform) {
298
298
  if (!this.platformManagers[platform]) {
@@ -305,7 +305,8 @@ class BundlerDevServer {
305
305
  debug(`Creating platform manager (platform: ${platform}, port: ${port})`);
306
306
  this.platformManagers[platform] = new Manager(this.projectRoot, port, {
307
307
  getCustomRuntimeUrl: this.urlCreator.constructDevClientUrl.bind(this.urlCreator),
308
- getExpoGoUrl: this.getExpoGoUrl.bind(this, platform),
308
+ getExpoGoUrl: this.getExpoGoUrl.bind(this),
309
+ getRedirectUrl: this.getRedirectUrl.bind(this, platform),
309
310
  getDevServerUrl: this.getDevServerUrl.bind(this, {
310
311
  hostType: "localhost"
311
312
  })
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/start/server/BundlerDevServer.ts"],"sourcesContent":["import { MessageSocket } from '@expo/dev-server';\nimport assert from 'assert';\nimport openBrowserAsync from 'better-opn';\nimport resolveFrom from 'resolve-from';\n\nimport { APISettings } from '../../api/settings';\nimport * as Log from '../../log';\nimport { FileNotifier } from '../../utils/FileNotifier';\nimport { resolveWithTimeout } from '../../utils/delay';\nimport { env } from '../../utils/env';\nimport { CommandError } from '../../utils/errors';\nimport {\n BaseOpenInCustomProps,\n BaseResolveDeviceProps,\n PlatformManager,\n} from '../platforms/PlatformManager';\nimport { AsyncNgrok } from './AsyncNgrok';\nimport { DevelopmentSession } from './DevelopmentSession';\nimport { CreateURLOptions, UrlCreator } from './UrlCreator';\nimport { PlatformBundlers } from './platformBundlers';\n\nconst debug = require('debug')('expo:start:server:devServer') as typeof console.log;\n\nexport type ServerLike = {\n close(callback?: (err?: Error) => void): void;\n};\n\nexport type DevServerInstance = {\n /** Bundler dev server instance. */\n server: ServerLike;\n /** Dev server URL location properties. */\n location: {\n url: string;\n port: number;\n protocol: 'http' | 'https';\n host?: string;\n };\n /** Additional middleware that's attached to the `server`. */\n middleware: any;\n /** Message socket for communicating with the runtime. */\n messageSocket: MessageSocket;\n};\n\nexport interface BundlerStartOptions {\n /** Should the dev server use `https` protocol. */\n https?: boolean;\n /** Should start the dev servers in development mode (minify). */\n mode?: 'development' | 'production';\n /** Is dev client enabled. */\n devClient?: boolean;\n /** Should run dev servers with clean caches. */\n resetDevServer?: boolean;\n /** Which manifest type to serve. */\n forceManifestType?: 'expo-updates' | 'classic';\n /** Code signing private key path (defaults to same directory as certificate) */\n privateKeyPath?: string;\n\n /** Max amount of workers (threads) to use with Metro bundler, defaults to undefined for max workers. */\n maxWorkers?: number;\n /** Port to start the dev server on. */\n port?: number;\n\n /** Should start a headless dev server e.g. mock representation to approximate info from a server running in a different process. */\n headless?: boolean;\n /** Should instruct the bundler to create minified bundles. */\n minify?: boolean;\n\n // Webpack options\n /** Should modify and create PWA icons. */\n isImageEditingEnabled?: boolean;\n\n location: CreateURLOptions;\n}\n\nconst PLATFORM_MANAGERS = {\n simulator: () =>\n require('../platforms/ios/ApplePlatformManager')\n .ApplePlatformManager as typeof import('../platforms/ios/ApplePlatformManager').ApplePlatformManager,\n emulator: () =>\n require('../platforms/android/AndroidPlatformManager')\n .AndroidPlatformManager as typeof import('../platforms/android/AndroidPlatformManager').AndroidPlatformManager,\n};\n\nconst MIDDLEWARES = {\n classic: () =>\n require('./middleware/ClassicManifestMiddleware')\n .ClassicManifestMiddleware as typeof import('./middleware/ClassicManifestMiddleware').ClassicManifestMiddleware,\n 'expo-updates': () =>\n require('./middleware/ExpoGoManifestHandlerMiddleware')\n .ExpoGoManifestHandlerMiddleware as typeof import('./middleware/ExpoGoManifestHandlerMiddleware').ExpoGoManifestHandlerMiddleware,\n};\n\nexport abstract class BundlerDevServer {\n /** Name of the bundler. */\n abstract get name(): string;\n\n /** Ngrok instance for managing tunnel connections. */\n protected ngrok: AsyncNgrok | null = null;\n /** Interfaces with the Expo 'Development Session' API. */\n protected devSession: DevelopmentSession | null = null;\n /** Http server and related info. */\n protected instance: DevServerInstance | null = null;\n /** Native platform interfaces for opening projects. */\n private platformManagers: Record<string, PlatformManager<any>> = {};\n /** Manages the creation of dev server URLs. */\n protected urlCreator?: UrlCreator | null = null;\n\n constructor(\n /** Project root folder. */\n public projectRoot: string,\n /** A mapping of bundlers to platforms. */\n public platformBundlers: PlatformBundlers,\n // TODO: Replace with custom scheme maybe...\n public isDevClient?: boolean\n ) {}\n\n protected setInstance(instance: DevServerInstance) {\n this.instance = instance;\n }\n\n /** Get the manifest middleware function. */\n protected async getManifestMiddlewareAsync(\n options: Pick<\n BundlerStartOptions,\n 'minify' | 'mode' | 'forceManifestType' | 'privateKeyPath'\n > = {}\n ) {\n const manifestType = options.forceManifestType || 'classic';\n assert(manifestType in MIDDLEWARES, `Manifest middleware for type '${manifestType}' not found`);\n const Middleware = MIDDLEWARES[manifestType]();\n\n const urlCreator = this.getUrlCreator();\n const middleware = new Middleware(this.projectRoot, {\n constructUrl: urlCreator.constructUrl.bind(urlCreator),\n mode: options.mode,\n minify: options.minify,\n isNativeWebpack: this.name === 'webpack' && this.isTargetingNative(),\n privateKeyPath: options.privateKeyPath,\n });\n return middleware.getHandler();\n }\n\n /** Start the dev server using settings defined in the start command. */\n public async startAsync(options: BundlerStartOptions): Promise<DevServerInstance> {\n await this.stopAsync();\n\n let instance: DevServerInstance;\n if (options.headless) {\n instance = await this.startHeadlessAsync(options);\n } else {\n instance = await this.startImplementationAsync(options);\n }\n\n this.setInstance(instance);\n await this.postStartAsync(options);\n return instance;\n }\n\n protected abstract startImplementationAsync(\n options: BundlerStartOptions\n ): Promise<DevServerInstance>;\n\n /**\n * Creates a mock server representation that can be used to estimate URLs for a server started in another process.\n * This is used for the run commands where you can reuse the server from a previous run.\n */\n private async startHeadlessAsync(options: BundlerStartOptions): Promise<DevServerInstance> {\n if (!options.port)\n throw new CommandError('HEADLESS_SERVER', 'headless dev server requires a port option');\n this.urlCreator = this.getUrlCreator(options);\n\n return {\n // Create a mock server\n server: {\n close: () => {\n this.instance = null;\n },\n },\n location: {\n // The port is the main thing we want to send back.\n port: options.port,\n // localhost isn't always correct.\n host: 'localhost',\n // http is the only supported protocol on native.\n url: `http://localhost:${options.port}`,\n protocol: 'http',\n },\n middleware: {},\n messageSocket: {\n broadcast: () => {\n throw new CommandError('HEADLESS_SERVER', 'Cannot broadcast messages to headless server');\n },\n },\n };\n }\n\n /**\n * Runs after the `startAsync` function, performing any additional common operations.\n * You can assume the dev server is started by the time this function is called.\n */\n protected async postStartAsync(options: BundlerStartOptions) {\n if (\n options.location.hostType === 'tunnel' &&\n !APISettings.isOffline &&\n // This is a hack to prevent using tunnel on web since we block it upstream for some reason.\n this.isTargetingNative()\n ) {\n await this._startTunnelAsync();\n }\n await this.startDevSessionAsync();\n\n this.watchConfig();\n }\n\n protected abstract getConfigModuleIds(): string[];\n\n protected watchConfig() {\n const notifier = new FileNotifier(this.projectRoot, this.getConfigModuleIds());\n notifier.startObserving();\n }\n\n /** Create ngrok instance and start the tunnel server. Exposed for testing. */\n public async _startTunnelAsync(): Promise<AsyncNgrok | null> {\n const port = this.getInstance()?.location.port;\n if (!port) return null;\n debug('[ngrok] connect to port: ' + port);\n this.ngrok = new AsyncNgrok(this.projectRoot, port);\n await this.ngrok.startAsync();\n return this.ngrok;\n }\n\n protected async startDevSessionAsync() {\n // This is used to make Expo Go open the project in either Expo Go, or the web browser.\n // Must come after ngrok (`startTunnelAsync`) setup.\n\n if (this.devSession) {\n this.devSession.stopNotifying();\n }\n\n this.devSession = new DevelopmentSession(\n this.projectRoot,\n // This URL will be used on external devices so the computer IP won't be relevant.\n this.isTargetingNative()\n ? this.getNativeRuntimeUrl()\n : this.getDevServerUrl({ hostType: 'localhost' })\n );\n\n await this.devSession.startAsync({\n runtime: this.isTargetingNative() ? 'native' : 'web',\n });\n }\n\n public isTargetingNative() {\n // Temporary hack while we implement multi-bundler dev server proxy.\n return true;\n }\n\n public isTargetingWeb() {\n return this.platformBundlers.web === this.name;\n }\n\n /**\n * Sends a message over web sockets to any connected device,\n * does nothing when the dev server is not running.\n *\n * @param method name of the command. In RN projects `reload`, and `devMenu` are available. In Expo Go, `sendDevCommand` is available.\n * @param params\n */\n public broadcastMessage(\n method: 'reload' | 'devMenu' | 'sendDevCommand',\n params?: Record<string, any>\n ) {\n this.getInstance()?.messageSocket.broadcast(method, params);\n }\n\n /** Get the running dev server instance. */\n public getInstance() {\n return this.instance;\n }\n\n /** Stop the running dev server instance. */\n async stopAsync() {\n // Stop the dev session timer and tell Expo API to remove dev session.\n await this.devSession?.closeAsync();\n\n // Stop ngrok if running.\n await this.ngrok?.stopAsync().catch((e) => {\n Log.error(`Error stopping ngrok:`);\n Log.exception(e);\n });\n\n return resolveWithTimeout(\n () =>\n new Promise<void>((resolve, reject) => {\n // Close the server.\n debug(`Stopping dev server (bundler: ${this.name})`);\n\n if (this.instance?.server) {\n this.instance.server.close((error) => {\n debug(`Stopped dev server (bundler: ${this.name})`);\n this.instance = null;\n if (error) {\n reject(error);\n } else {\n resolve();\n }\n });\n } else {\n debug(`Stopped dev server (bundler: ${this.name})`);\n this.instance = null;\n resolve();\n }\n }),\n {\n // NOTE(Bacon): Metro dev server doesn't seem to be closing in time.\n timeout: 1000,\n errorMessage: `Timeout waiting for '${this.name}' dev server to close`,\n }\n );\n }\n\n protected getUrlCreator(options: Partial<Pick<BundlerStartOptions, 'port' | 'location'>> = {}) {\n if (!this.urlCreator) {\n assert(options?.port, 'Dev server instance not found');\n this.urlCreator = new UrlCreator(options.location, {\n port: options.port,\n getTunnelUrl: this.getTunnelUrl.bind(this),\n });\n }\n return this.urlCreator;\n }\n\n public getNativeRuntimeUrl(opts: Partial<CreateURLOptions> = {}) {\n return this.isDevClient\n ? this.getUrlCreator().constructDevClientUrl(opts) ?? this.getDevServerUrl()\n : this.getUrlCreator().constructUrl({ ...opts, scheme: 'exp' });\n }\n\n /** Get the URL for the running instance of the dev server. */\n public getDevServerUrl(options: { hostType?: 'localhost' } = {}): string | null {\n const instance = this.getInstance();\n if (!instance?.location) {\n return null;\n }\n const { location } = instance;\n if (options.hostType === 'localhost') {\n return `${location.protocol}://localhost:${location.port}`;\n }\n return location.url ?? null;\n }\n\n /** Get the tunnel URL from ngrok. */\n public getTunnelUrl(): string | null {\n return this.ngrok?.getActiveUrl() ?? null;\n }\n\n /** Open the dev server in a runtime. */\n public async openPlatformAsync(\n launchTarget: keyof typeof PLATFORM_MANAGERS | 'desktop',\n resolver: BaseResolveDeviceProps<any> = {}\n ) {\n if (launchTarget === 'desktop') {\n const url = this.getDevServerUrl({ hostType: 'localhost' });\n await openBrowserAsync(url!);\n return { url };\n }\n\n const runtime = this.isTargetingNative() ? (this.isDevClient ? 'custom' : 'expo') : 'web';\n const manager = await this.getPlatformManagerAsync(launchTarget);\n return manager.openAsync({ runtime }, resolver);\n }\n\n /** Open the dev server in a runtime. */\n public async openCustomRuntimeAsync(\n launchTarget: keyof typeof PLATFORM_MANAGERS,\n launchProps: Partial<BaseOpenInCustomProps> = {},\n resolver: BaseResolveDeviceProps<any> = {}\n ) {\n const runtime = this.isTargetingNative() ? (this.isDevClient ? 'custom' : 'expo') : 'web';\n if (runtime !== 'custom') {\n throw new CommandError(\n `dev server cannot open custom runtimes either because it does not target native platforms or because it is not targeting dev clients. (target: ${runtime})`\n );\n }\n\n const manager = await this.getPlatformManagerAsync(launchTarget);\n return manager.openAsync({ runtime: 'custom', props: launchProps }, resolver);\n }\n\n /** Should use the interstitial page for selecting which runtime to use. */\n protected shouldUseInterstitialPage(): boolean {\n return (\n env.EXPO_ENABLE_INTERSTITIAL_PAGE &&\n // Checks if dev client is installed.\n !!resolveFrom.silent(this.projectRoot, 'expo-dev-launcher')\n );\n }\n\n /** Get the URL for opening in Expo Go. */\n protected getExpoGoUrl(platform: keyof typeof PLATFORM_MANAGERS): string | null {\n if (this.shouldUseInterstitialPage()) {\n const loadingUrl =\n platform === 'emulator'\n ? this.urlCreator?.constructLoadingUrl({}, 'android')\n : this.urlCreator?.constructLoadingUrl({ hostType: 'localhost' }, 'ios');\n return loadingUrl ?? null;\n }\n\n return this.urlCreator?.constructUrl({ scheme: 'exp' }) ?? null;\n }\n\n protected async getPlatformManagerAsync(platform: keyof typeof PLATFORM_MANAGERS) {\n if (!this.platformManagers[platform]) {\n const Manager = PLATFORM_MANAGERS[platform]();\n const port = this.getInstance()?.location.port;\n if (!port || !this.urlCreator) {\n throw new CommandError(\n 'DEV_SERVER',\n 'Cannot interact with native platforms until dev server has started'\n );\n }\n debug(`Creating platform manager (platform: ${platform}, port: ${port})`);\n this.platformManagers[platform] = new Manager(this.projectRoot, port, {\n getCustomRuntimeUrl: this.urlCreator.constructDevClientUrl.bind(this.urlCreator),\n getExpoGoUrl: this.getExpoGoUrl.bind(this, platform),\n getDevServerUrl: this.getDevServerUrl.bind(this, { hostType: 'localhost' }),\n });\n }\n return this.platformManagers[platform];\n }\n}\n"],"names":["Log","debug","require","PLATFORM_MANAGERS","simulator","ApplePlatformManager","emulator","AndroidPlatformManager","MIDDLEWARES","classic","ClassicManifestMiddleware","ExpoGoManifestHandlerMiddleware","BundlerDevServer","constructor","projectRoot","platformBundlers","isDevClient","ngrok","devSession","instance","platformManagers","urlCreator","setInstance","getManifestMiddlewareAsync","options","manifestType","forceManifestType","assert","Middleware","getUrlCreator","middleware","constructUrl","bind","mode","minify","isNativeWebpack","name","isTargetingNative","privateKeyPath","getHandler","startAsync","stopAsync","headless","startHeadlessAsync","startImplementationAsync","postStartAsync","port","CommandError","server","close","location","host","url","protocol","messageSocket","broadcast","hostType","APISettings","isOffline","_startTunnelAsync","startDevSessionAsync","watchConfig","notifier","FileNotifier","getConfigModuleIds","startObserving","getInstance","AsyncNgrok","stopNotifying","DevelopmentSession","getNativeRuntimeUrl","getDevServerUrl","runtime","isTargetingWeb","web","broadcastMessage","method","params","closeAsync","catch","e","error","exception","resolveWithTimeout","Promise","resolve","reject","timeout","errorMessage","UrlCreator","getTunnelUrl","opts","constructDevClientUrl","scheme","getActiveUrl","openPlatformAsync","launchTarget","resolver","openBrowserAsync","manager","getPlatformManagerAsync","openAsync","openCustomRuntimeAsync","launchProps","props","shouldUseInterstitialPage","env","EXPO_ENABLE_INTERSTITIAL_PAGE","resolveFrom","silent","getExpoGoUrl","platform","loadingUrl","constructLoadingUrl","Manager","getCustomRuntimeUrl"],"mappings":"AAAA;;;;AACmB,IAAA,OAAQ,kCAAR,QAAQ,EAAA;AACE,IAAA,UAAY,kCAAZ,YAAY,EAAA;AACjB,IAAA,YAAc,kCAAd,cAAc,EAAA;AAEV,IAAA,SAAoB,WAApB,oBAAoB,CAAA;AACpCA,IAAAA,GAAG,mCAAM,WAAW,EAAjB;AACc,IAAA,aAA0B,WAA1B,0BAA0B,CAAA;AACpB,IAAA,MAAmB,WAAnB,mBAAmB,CAAA;AAClC,IAAA,IAAiB,WAAjB,iBAAiB,CAAA;AACR,IAAA,OAAoB,WAApB,oBAAoB,CAAA;AAMtB,IAAA,WAAc,WAAd,cAAc,CAAA;AACN,IAAA,mBAAsB,WAAtB,sBAAsB,CAAA;AACZ,IAAA,WAAc,WAAd,cAAc,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAG3D,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,6BAA6B,CAAC,AAAsB,AAAC;AAqDpF,MAAMC,iBAAiB,GAAG;IACxBC,SA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AC9F,UAAU,CAACuE,qBAAqB,CAAC5D,IAAI,CAAC,IAAI,CAACX,UAAU,CAAC;gBAChFyF,YAAY,EAAE,IAAI,CAACA,YAAY,CAAC9E,IAAI,CAAC,IAAI,EAAE+E,QAAQ,CAAC;gBACpDxC,eAAe,EAAE,IAAI,CAACA,eAAe,CAACvC,IAAI,CAAC,IAAI,EAAE;oBAAEwB,QAAQ,EAAE,WAAW;iBAAE,CAAC;aAC5E,CAAC,CAAC;SACJ;QACD,OAAO,IAAI,CAACpC,gBAAgB,CAAC2F,QAAQ,CAAC,CAAC;KACxC;CACF;QAlVqBnG,gBAAgB,GAAhBA,gBAAgB"}
1
+ {"version":3,"sources":["../../../../src/start/server/BundlerDevServer.ts"],"sourcesContent":["import { MessageSocket } from '@expo/dev-server';\nimport assert from 'assert';\nimport openBrowserAsync from 'better-opn';\nimport resolveFrom from 'resolve-from';\n\nimport { APISettings } from '../../api/settings';\nimport * as Log from '../../log';\nimport { FileNotifier } from '../../utils/FileNotifier';\nimport { resolveWithTimeout } from '../../utils/delay';\nimport { env } from '../../utils/env';\nimport { CommandError } from '../../utils/errors';\nimport {\n BaseOpenInCustomProps,\n BaseResolveDeviceProps,\n PlatformManager,\n} from '../platforms/PlatformManager';\nimport { AsyncNgrok } from './AsyncNgrok';\nimport { DevelopmentSession } from './DevelopmentSession';\nimport { CreateURLOptions, UrlCreator } from './UrlCreator';\nimport { PlatformBundlers } from './platformBundlers';\n\nconst debug = require('debug')('expo:start:server:devServer') as typeof console.log;\n\nexport type ServerLike = {\n close(callback?: (err?: Error) => void): void;\n};\n\nexport type DevServerInstance = {\n /** Bundler dev server instance. */\n server: ServerLike;\n /** Dev server URL location properties. */\n location: {\n url: string;\n port: number;\n protocol: 'http' | 'https';\n host?: string;\n };\n /** Additional middleware that's attached to the `server`. */\n middleware: any;\n /** Message socket for communicating with the runtime. */\n messageSocket: MessageSocket;\n};\n\nexport interface BundlerStartOptions {\n /** Should the dev server use `https` protocol. */\n https?: boolean;\n /** Should start the dev servers in development mode (minify). */\n mode?: 'development' | 'production';\n /** Is dev client enabled. */\n devClient?: boolean;\n /** Should run dev servers with clean caches. */\n resetDevServer?: boolean;\n /** Which manifest type to serve. */\n forceManifestType?: 'expo-updates' | 'classic';\n /** Code signing private key path (defaults to same directory as certificate) */\n privateKeyPath?: string;\n\n /** Max amount of workers (threads) to use with Metro bundler, defaults to undefined for max workers. */\n maxWorkers?: number;\n /** Port to start the dev server on. */\n port?: number;\n\n /** Should start a headless dev server e.g. mock representation to approximate info from a server running in a different process. */\n headless?: boolean;\n /** Should instruct the bundler to create minified bundles. */\n minify?: boolean;\n\n // Webpack options\n /** Should modify and create PWA icons. */\n isImageEditingEnabled?: boolean;\n\n location: CreateURLOptions;\n}\n\nconst PLATFORM_MANAGERS = {\n simulator: () =>\n require('../platforms/ios/ApplePlatformManager')\n .ApplePlatformManager as typeof import('../platforms/ios/ApplePlatformManager').ApplePlatformManager,\n emulator: () =>\n require('../platforms/android/AndroidPlatformManager')\n .AndroidPlatformManager as typeof import('../platforms/android/AndroidPlatformManager').AndroidPlatformManager,\n};\n\nconst MIDDLEWARES = {\n classic: () =>\n require('./middleware/ClassicManifestMiddleware')\n .ClassicManifestMiddleware as typeof import('./middleware/ClassicManifestMiddleware').ClassicManifestMiddleware,\n 'expo-updates': () =>\n require('./middleware/ExpoGoManifestHandlerMiddleware')\n .ExpoGoManifestHandlerMiddleware as typeof import('./middleware/ExpoGoManifestHandlerMiddleware').ExpoGoManifestHandlerMiddleware,\n};\n\nexport abstract class BundlerDevServer {\n /** Name of the bundler. */\n abstract get name(): string;\n\n /** Ngrok instance for managing tunnel connections. */\n protected ngrok: AsyncNgrok | null = null;\n /** Interfaces with the Expo 'Development Session' API. */\n protected devSession: DevelopmentSession | null = null;\n /** Http server and related info. */\n protected instance: DevServerInstance | null = null;\n /** Native platform interfaces for opening projects. */\n private platformManagers: Record<string, PlatformManager<any>> = {};\n /** Manages the creation of dev server URLs. */\n protected urlCreator?: UrlCreator | null = null;\n\n constructor(\n /** Project root folder. */\n public projectRoot: string,\n /** A mapping of bundlers to platforms. */\n public platformBundlers: PlatformBundlers,\n // TODO: Replace with custom scheme maybe...\n public isDevClient?: boolean\n ) {}\n\n protected setInstance(instance: DevServerInstance) {\n this.instance = instance;\n }\n\n /** Get the manifest middleware function. */\n protected async getManifestMiddlewareAsync(\n options: Pick<\n BundlerStartOptions,\n 'minify' | 'mode' | 'forceManifestType' | 'privateKeyPath'\n > = {}\n ) {\n const manifestType = options.forceManifestType || 'classic';\n assert(manifestType in MIDDLEWARES, `Manifest middleware for type '${manifestType}' not found`);\n const Middleware = MIDDLEWARES[manifestType]();\n\n const urlCreator = this.getUrlCreator();\n const middleware = new Middleware(this.projectRoot, {\n constructUrl: urlCreator.constructUrl.bind(urlCreator),\n mode: options.mode,\n minify: options.minify,\n isNativeWebpack: this.name === 'webpack' && this.isTargetingNative(),\n privateKeyPath: options.privateKeyPath,\n });\n return middleware.getHandler();\n }\n\n /** Start the dev server using settings defined in the start command. */\n public async startAsync(options: BundlerStartOptions): Promise<DevServerInstance> {\n await this.stopAsync();\n\n let instance: DevServerInstance;\n if (options.headless) {\n instance = await this.startHeadlessAsync(options);\n } else {\n instance = await this.startImplementationAsync(options);\n }\n\n this.setInstance(instance);\n await this.postStartAsync(options);\n return instance;\n }\n\n protected abstract startImplementationAsync(\n options: BundlerStartOptions\n ): Promise<DevServerInstance>;\n\n /**\n * Creates a mock server representation that can be used to estimate URLs for a server started in another process.\n * This is used for the run commands where you can reuse the server from a previous run.\n */\n private async startHeadlessAsync(options: BundlerStartOptions): Promise<DevServerInstance> {\n if (!options.port)\n throw new CommandError('HEADLESS_SERVER', 'headless dev server requires a port option');\n this.urlCreator = this.getUrlCreator(options);\n\n return {\n // Create a mock server\n server: {\n close: () => {\n this.instance = null;\n },\n },\n location: {\n // The port is the main thing we want to send back.\n port: options.port,\n // localhost isn't always correct.\n host: 'localhost',\n // http is the only supported protocol on native.\n url: `http://localhost:${options.port}`,\n protocol: 'http',\n },\n middleware: {},\n messageSocket: {\n broadcast: () => {\n throw new CommandError('HEADLESS_SERVER', 'Cannot broadcast messages to headless server');\n },\n },\n };\n }\n\n /**\n * Runs after the `startAsync` function, performing any additional common operations.\n * You can assume the dev server is started by the time this function is called.\n */\n protected async postStartAsync(options: BundlerStartOptions) {\n if (\n options.location.hostType === 'tunnel' &&\n !APISettings.isOffline &&\n // This is a hack to prevent using tunnel on web since we block it upstream for some reason.\n this.isTargetingNative()\n ) {\n await this._startTunnelAsync();\n }\n await this.startDevSessionAsync();\n\n this.watchConfig();\n }\n\n protected abstract getConfigModuleIds(): string[];\n\n protected watchConfig() {\n const notifier = new FileNotifier(this.projectRoot, this.getConfigModuleIds());\n notifier.startObserving();\n }\n\n /** Create ngrok instance and start the tunnel server. Exposed for testing. */\n public async _startTunnelAsync(): Promise<AsyncNgrok | null> {\n const port = this.getInstance()?.location.port;\n if (!port) return null;\n debug('[ngrok] connect to port: ' + port);\n this.ngrok = new AsyncNgrok(this.projectRoot, port);\n await this.ngrok.startAsync();\n return this.ngrok;\n }\n\n protected async startDevSessionAsync() {\n // This is used to make Expo Go open the project in either Expo Go, or the web browser.\n // Must come after ngrok (`startTunnelAsync`) setup.\n\n if (this.devSession) {\n this.devSession.stopNotifying();\n }\n\n this.devSession = new DevelopmentSession(\n this.projectRoot,\n // This URL will be used on external devices so the computer IP won't be relevant.\n this.isTargetingNative()\n ? this.getNativeRuntimeUrl()\n : this.getDevServerUrl({ hostType: 'localhost' })\n );\n\n await this.devSession.startAsync({\n runtime: this.isTargetingNative() ? 'native' : 'web',\n });\n }\n\n public isTargetingNative() {\n // Temporary hack while we implement multi-bundler dev server proxy.\n return true;\n }\n\n public isTargetingWeb() {\n return this.platformBundlers.web === this.name;\n }\n\n /**\n * Sends a message over web sockets to any connected device,\n * does nothing when the dev server is not running.\n *\n * @param method name of the command. In RN projects `reload`, and `devMenu` are available. In Expo Go, `sendDevCommand` is available.\n * @param params\n */\n public broadcastMessage(\n method: 'reload' | 'devMenu' | 'sendDevCommand',\n params?: Record<string, any>\n ) {\n this.getInstance()?.messageSocket.broadcast(method, params);\n }\n\n /** Get the running dev server instance. */\n public getInstance() {\n return this.instance;\n }\n\n /** Stop the running dev server instance. */\n async stopAsync() {\n // Stop the dev session timer and tell Expo API to remove dev session.\n await this.devSession?.closeAsync();\n\n // Stop ngrok if running.\n await this.ngrok?.stopAsync().catch((e) => {\n Log.error(`Error stopping ngrok:`);\n Log.exception(e);\n });\n\n return resolveWithTimeout(\n () =>\n new Promise<void>((resolve, reject) => {\n // Close the server.\n debug(`Stopping dev server (bundler: ${this.name})`);\n\n if (this.instance?.server) {\n this.instance.server.close((error) => {\n debug(`Stopped dev server (bundler: ${this.name})`);\n this.instance = null;\n if (error) {\n reject(error);\n } else {\n resolve();\n }\n });\n } else {\n debug(`Stopped dev server (bundler: ${this.name})`);\n this.instance = null;\n resolve();\n }\n }),\n {\n // NOTE(Bacon): Metro dev server doesn't seem to be closing in time.\n timeout: 1000,\n errorMessage: `Timeout waiting for '${this.name}' dev server to close`,\n }\n );\n }\n\n protected getUrlCreator(options: Partial<Pick<BundlerStartOptions, 'port' | 'location'>> = {}) {\n if (!this.urlCreator) {\n assert(options?.port, 'Dev server instance not found');\n this.urlCreator = new UrlCreator(options.location, {\n port: options.port,\n getTunnelUrl: this.getTunnelUrl.bind(this),\n });\n }\n return this.urlCreator;\n }\n\n public getNativeRuntimeUrl(opts: Partial<CreateURLOptions> = {}) {\n return this.isDevClient\n ? this.getUrlCreator().constructDevClientUrl(opts) ?? this.getDevServerUrl()\n : this.getUrlCreator().constructUrl({ ...opts, scheme: 'exp' });\n }\n\n /** Get the URL for the running instance of the dev server. */\n public getDevServerUrl(options: { hostType?: 'localhost' } = {}): string | null {\n const instance = this.getInstance();\n if (!instance?.location) {\n return null;\n }\n const { location } = instance;\n if (options.hostType === 'localhost') {\n return `${location.protocol}://localhost:${location.port}`;\n }\n return location.url ?? null;\n }\n\n /** Get the tunnel URL from ngrok. */\n public getTunnelUrl(): string | null {\n return this.ngrok?.getActiveUrl() ?? null;\n }\n\n /** Open the dev server in a runtime. */\n public async openPlatformAsync(\n launchTarget: keyof typeof PLATFORM_MANAGERS | 'desktop',\n resolver: BaseResolveDeviceProps<any> = {}\n ) {\n if (launchTarget === 'desktop') {\n const url = this.getDevServerUrl({ hostType: 'localhost' });\n await openBrowserAsync(url!);\n return { url };\n }\n\n const runtime = this.isTargetingNative() ? (this.isDevClient ? 'custom' : 'expo') : 'web';\n const manager = await this.getPlatformManagerAsync(launchTarget);\n return manager.openAsync({ runtime }, resolver);\n }\n\n /** Open the dev server in a runtime. */\n public async openCustomRuntimeAsync(\n launchTarget: keyof typeof PLATFORM_MANAGERS,\n launchProps: Partial<BaseOpenInCustomProps> = {},\n resolver: BaseResolveDeviceProps<any> = {}\n ) {\n const runtime = this.isTargetingNative() ? (this.isDevClient ? 'custom' : 'expo') : 'web';\n if (runtime !== 'custom') {\n throw new CommandError(\n `dev server cannot open custom runtimes either because it does not target native platforms or because it is not targeting dev clients. (target: ${runtime})`\n );\n }\n\n const manager = await this.getPlatformManagerAsync(launchTarget);\n return manager.openAsync({ runtime: 'custom', props: launchProps }, resolver);\n }\n\n /** Get the URL for opening in Expo Go. */\n protected getExpoGoUrl(): string {\n return this.getUrlCreator().constructUrl({ scheme: 'exp' });\n }\n\n /** Should use the interstitial page for selecting which runtime to use. */\n protected isRedirectPageEnabled(): boolean {\n return (\n !env.EXPO_NO_REDIRECT_PAGE &&\n // if user passed --dev-client flag, skip interstitial page\n !this.isDevClient &&\n // Checks if dev client is installed.\n !!resolveFrom.silent(this.projectRoot, 'expo-dev-client')\n );\n }\n\n /** Get the redirect URL when redirecting is enabled. */\n public getRedirectUrl(platform: keyof typeof PLATFORM_MANAGERS | null = null): string | null {\n if (!this.isRedirectPageEnabled()) {\n debug('Redirect page is disabled');\n return null;\n }\n\n return (\n this.getUrlCreator().constructLoadingUrl(\n {},\n platform === 'emulator' ? 'android' : platform === 'simulator' ? 'ios' : null\n ) ?? null\n );\n }\n\n protected async getPlatformManagerAsync(platform: keyof typeof PLATFORM_MANAGERS) {\n if (!this.platformManagers[platform]) {\n const Manager = PLATFORM_MANAGERS[platform]();\n const port = this.getInstance()?.location.port;\n if (!port || !this.urlCreator) {\n throw new CommandError(\n 'DEV_SERVER',\n 'Cannot interact with native platforms until dev server has started'\n );\n }\n debug(`Creating platform manager (platform: ${platform}, port: ${port})`);\n this.platformManagers[platform] = new Manager(this.projectRoot, port, {\n getCustomRuntimeUrl: this.urlCreator.constructDevClientUrl.bind(this.urlCreator),\n getExpoGoUrl: this.getExpoGoUrl.bind(this),\n getRedirectUrl: this.getRedirectUrl.bind(this, platform),\n getDevServerUrl: this.getDevServerUrl.bind(this, { hostType: 'localhost' }),\n });\n }\n return this.platformManagers[platform];\n }\n}\n"],"names":["Log","debug","require","PLATFORM_MANAGERS","simulator","ApplePlatformManager","emulator","AndroidPlatformManager","MIDDLEWARES","classic","ClassicManifestMiddleware","ExpoGoManifestHandlerMiddleware","BundlerDevServer","constructor","projectRoot","platformBundlers","isDevClient","ngrok","devSession","instance","platformManagers","urlCreator","setInstance","getManifestMiddlewareAsync","options","manifestType","forceManifestType","assert","Middleware","getUrlCreator","middleware","constructUrl","bind","mode","minify","isNativeWebpack","name","isTargetingNative","privateKeyPath","getHandler","startAsync","stopAsync","headless","startHeadlessAsync","startImplementationAsync","postStartAsync","port","CommandError","server","close","location","host","url","protocol","messageSocket","broadcast","hostType","APISettings","isOffline","_startTunnelAsync","startDevSessionAsync","watchConfig","notifier","FileNotifier","getConfigModuleIds","startObserving","getInstance","AsyncNgrok","stopNotifying","DevelopmentSession","getNativeRuntimeUrl","getDevServerUrl","runtime","isTargetingWeb","web","broadcastMessage","method","params","closeAsync","catch","e","error","exception","resolveWithTimeout","Promise","resolve","reject","timeout","errorMessage","UrlCreator","getTunnelUrl","opts","constructDevClientUrl","scheme","getActiveUrl","openPlatformAsync","launchTarget","resolver","openBrowserAsync","manager","getPlatformManagerAsync","openAsync","openCustomRuntimeAsync","launchProps","props","getExpoGoUrl","isRedirectPageEnabled","env","EXPO_NO_REDIRECT_PAGE","resolveFrom","silent","getRedirectUrl","platform","constructLoadingUrl","Manager","getCustomRuntimeUrl"],"mappings":"AAAA;;;;AACmB,IAAA,OAAQ,kCAAR,QAAQ,EAAA;AACE,IAAA,UAAY,kCAAZ,YAAY,EAAA;AACjB,IAAA,YAAc,kCAAd,cAAc,EAAA;AAEV,IAAA,SAAoB,WAApB,oBAAoB,CAAA;AACpCA,IAAAA,GAAG,mCAAM,WAAW,EAAjB;AACc,IAAA,aAA0B,WAA1B,0BAA0B,CAAA;AACpB,IAAA,MAAmB,WAAnB,mBAAmB,CAAA;AAClC,IAAA,IAAiB,WAAjB,iBAAiB,CAAA;AACR,IAAA,OAAoB,WAApB,oBAAoB,CAAA;AAMtB,IAAA,WAAc,WAAd,cAAc,CAAA;AACN,IAAA,mBAAsB,WAAtB,sBAAsB,CAAA;AACZ,IAAA,WAAc,WAAd,cAAc,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAG3D,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,6BAA6B,CAAC,AAAsB,AAAC;AAqDpF,MAAMC,iBAAiB,GAAG;IACxBC,SAAS,EAAE,IACTF,OAAO,CAAC,uCAAuC,CAAC,CAC7CG,oBAAoB;IAA+E;IACxGC,QAAQ,EAAE,IACRJ,OAAO,CAAC,6CAA6C,CAAC,CACnDK,sBAAsB;CAC5B,AAAC;AAEF,MAAMC,WAAW,GAAG;IAClBC,OAAO,EAAE,IACPP,OAAO,CAAC,wCAAwC,CAAC,CAC9CQ,yBAAyB;IAAqF;IACnH,cAAc,EAAE,IACdR,OAAO,CAAC,8CAA8C,CAAC,CACpDS,+BAA+B;CACrC,AAAC;AAEK,MAAeC,gBAAgB;IAepCC,YAESC,WAAmB,EAEnBC,gBAAkC,EAElCC,WAAqB,CAC5B;aALOF,WAAmB,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the "loading" interstitial page that is used to disambiguate which
44
+ * native runtime to open the dev server with.
45
+ *
46
+ * @param options options for creating the URL
47
+ * @param platform when opening the URL from the CLI to a connected device we can specify the platform as a query parameter, otherwise it will be inferred from the unsafe user agent sniffing.
48
+ *
43
49
  * @returns URL like `http://localhost:19000/_expo/loading?platform=ios`
50
+ * @returns URL like `http://localhost:19000/_expo/loading` when no platform is provided.
44
51
  */ constructLoadingUrl(options, platform) {
45
52
  const url = new _url.URL("_expo/loading", this.constructUrl({
46
53
  scheme: "http",
47
54
  ...options
48
55
  }));
49
- url.search = new URLSearchParams({
50
- platform
51
- }).toString();
56
+ if (platform) {
57
+ url.search = new URLSearchParams({
58
+ platform
59
+ }).toString();
60
+ }
52
61
  const loadingUrl = url.toString();
53
62
  debug(`Loading URL: ${loadingUrl}`);
54
63
  return loadingUrl;