@expo/cli 0.17.2 → 0.17.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/bin/cli CHANGED
@@ -137,7 +137,7 @@ const args = (0, _arg).default({
137
137
  });
138
138
  if (args["--version"]) {
139
139
  // Version is added in the build script.
140
- console.log("0.17.2");
140
+ console.log("0.17.3");
141
141
  process.exit(0);
142
142
  }
143
143
  if (args["--non-interactive"]) {
@@ -272,7 +272,7 @@ commands[command]().then((exec)=>{
272
272
  logEventAsync("action", {
273
273
  action: `expo ${command}`,
274
274
  source: "expo/cli",
275
- source_version: "0.17.2"
275
+ source_version: "0.17.3"
276
276
  });
277
277
  }
278
278
  });
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  exports.getAssetLocalPath = getAssetLocalPath;
6
6
  exports.stripAssetPrefix = stripAssetPrefix;
7
+ exports.drawableFileTypes = void 0;
7
8
  var _path = _interopRequireDefault(require("path"));
8
9
  function _interopRequireDefault(obj) {
9
10
  return obj && obj.__esModule ? obj : {
@@ -65,7 +66,6 @@ function stripAssetPrefix(path, baseUrl) {
65
66
  return null;
66
67
  }
67
68
  }
68
- // See https://developer.android.com/guide/topics/resources/drawable-resource.html
69
69
  const drawableFileTypes = new Set([
70
70
  "gif",
71
71
  "jpeg",
@@ -74,6 +74,7 @@ const drawableFileTypes = new Set([
74
74
  "webp",
75
75
  "xml"
76
76
  ]);
77
+ exports.drawableFileTypes = drawableFileTypes;
77
78
  function getAndroidResourceFolderName(asset, scale) {
78
79
  if (!drawableFileTypes.has(asset.type)) {
79
80
  return "raw";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/export/metroAssetLocalPath.ts"],"sourcesContent":["/**\n * Copyright © 2023 650 Industries.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * Based on the community asset persisting for Metro but with base path and web support:\n * https://github.com/facebook/react-native/blob/d6e0bc714ad4d215ede4949d3c4f44af6dea5dd3/packages/community-cli-plugin/src/commands/bundle/saveAssets.js#L1\n */\nimport type { AssetData } from 'metro';\nimport path from 'path';\n\nexport function getAssetLocalPath(\n asset: Pick<AssetData, 'type' | 'httpServerLocation' | 'name'>,\n { baseUrl, scale, platform }: { baseUrl?: string; scale: number; platform: string }\n): string {\n if (platform === 'android') {\n return getAssetLocalPathAndroid(asset, { baseUrl, scale });\n }\n return getAssetLocalPathDefault(asset, { baseUrl, scale });\n}\n\nfunction getAssetLocalPathAndroid(\n asset: Pick<AssetData, 'type' | 'httpServerLocation' | 'name'>,\n {\n baseUrl,\n scale,\n }: {\n // TODO: baseUrl support\n baseUrl?: string;\n scale: number;\n }\n): string {\n const androidFolder = getAndroidResourceFolderName(asset, scale);\n const fileName = getResourceIdentifier(asset);\n return path.join(androidFolder, `${fileName}.${asset.type}`);\n}\n\nfunction getAssetLocalPathDefault(\n asset: Pick<AssetData, 'type' | 'httpServerLocation' | 'name'>,\n { baseUrl, scale }: { baseUrl?: string; scale: number }\n): string {\n const suffix = scale === 1 ? '' : `@${scale}x`;\n const fileName = `${asset.name}${suffix}.${asset.type}`;\n\n const adjustedHttpServerLocation = stripAssetPrefix(asset.httpServerLocation, baseUrl);\n\n return path.join(\n // Assets can have relative paths outside of the project root.\n // Replace `../` with `_` to make sure they don't end up outside of\n // the expected assets directory.\n adjustedHttpServerLocation.replace(/^\\/+/g, '').replace(/\\.\\.\\//g, '_'),\n fileName\n );\n}\n\nexport function stripAssetPrefix(path: string, baseUrl?: string) {\n path = path.replace(/\\/assets\\?export_path=(.*)/, '$1');\n\n // TODO: Windows?\n if (baseUrl) {\n return path.replace(/^\\/+/g, '').replace(\n new RegExp(\n `^${baseUrl\n .replace(/^\\/+/g, '')\n .replace(/[|\\\\{}()[\\]^$+*?.]/g, '\\\\$&')\n .replace(/-/g, '\\\\x2d')}`,\n 'g'\n ),\n ''\n );\n }\n return path;\n}\n\n/**\n * FIXME: using number to represent discrete scale numbers is fragile in essence because of\n * floating point numbers imprecision.\n */\nfunction getAndroidAssetSuffix(scale: number): string | null {\n switch (scale) {\n case 0.75:\n return 'ldpi';\n case 1:\n return 'mdpi';\n case 1.5:\n return 'hdpi';\n case 2:\n return 'xhdpi';\n case 3:\n return 'xxhdpi';\n case 4:\n return 'xxxhdpi';\n default:\n return null;\n }\n}\n\n// See https://developer.android.com/guide/topics/resources/drawable-resource.html\nconst drawableFileTypes = new Set<string>(['gif', 'jpeg', 'jpg', 'png', 'webp', 'xml']);\n\nfunction getAndroidResourceFolderName(asset: Pick<AssetData, 'type'>, scale: number): string {\n if (!drawableFileTypes.has(asset.type)) {\n return 'raw';\n }\n const suffix = getAndroidAssetSuffix(scale);\n if (!suffix) {\n throw new Error(\n `Asset \"${JSON.stringify(asset)}\" does not use a supported Android resolution suffix`\n );\n }\n return `drawable-${suffix}`;\n}\n\nfunction getResourceIdentifier(asset: Pick<AssetData, 'httpServerLocation' | 'name'>): string {\n const folderPath = getBaseUrl(asset);\n return `${folderPath}/${asset.name}`\n .toLowerCase()\n .replace(/\\//g, '_') // Encode folder structure in file name\n .replace(/([^a-z0-9_])/g, '') // Remove illegal chars\n .replace(/^assets_/, ''); // Remove \"assets_\" prefix\n}\n\nfunction getBaseUrl(asset: Pick<AssetData, 'httpServerLocation'>): string {\n let baseUrl = asset.httpServerLocation;\n if (baseUrl[0] === '/') {\n baseUrl = baseUrl.substring(1);\n }\n return baseUrl;\n}\n"],"names":["getAssetLocalPath","stripAssetPrefix","asset","baseUrl","scale","platform","getAssetLocalPathAndroid","getAssetLocalPathDefault","androidFolder","getAndroidResourceFolderName","fileName","getResourceIdentifier","path","join","type","suffix","name","adjustedHttpServerLocation","httpServerLocation","replace","RegExp","getAndroidAssetSuffix","drawableFileTypes","Set","has","Error","JSON","stringify","folderPath","getBaseUrl","toLowerCase","substring"],"mappings":"AAUA;;;;QAGgBA,iBAAiB,GAAjBA,iBAAiB;QA4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KAAK,CAACY,IAAI,CAAC,EAAE;QACtC,OAAO,KAAK,CAAC;KACd;IACD,MAAMC,MAAM,GAAGM,qBAAqB,CAACjB,KAAK,CAAC,AAAC;IAC5C,IAAI,CAACW,MAAM,EAAE;QACX,MAAM,IAAIU,KAAK,CACb,CAAC,OAAO,EAAEC,IAAI,CAACC,SAAS,CAACzB,KAAK,CAAC,CAAC,oDAAoD,CAAC,CACtF,CAAC;KACH;IACD,OAAO,CAAC,SAAS,EAAEa,MAAM,CAAC,CAAC,CAAC;CAC7B;AAED,SAASJ,qBAAqB,CAACT,KAAqD,EAAU;IAC5F,MAAM0B,UAAU,GAAGC,UAAU,CAAC3B,KAAK,CAAC,AAAC;IACrC,OAAO,CAAC,EAAE0B,UAAU,CAAC,CAAC,EAAE1B,KAAK,CAACc,IAAI,CAAC,CAAC,CACjCc,WAAW,EAAE,CACbX,OAAO,QAAQ,GAAG,CAAC,CAAC,uCAAuC;KAC3DA,OAAO,kBAAkB,EAAE,CAAC,CAAC,uBAAuB;KACpDA,OAAO,aAAa,EAAE,CAAC,CAAC,CAAC,0BAA0B;CACvD;AAED,SAASU,UAAU,CAAC3B,KAA4C,EAAU;IACxE,IAAIC,OAAO,GAAGD,KAAK,CAACgB,kBAAkB,AAAC;IACvC,IAAIf,OAAO,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;QACtBA,OAAO,GAAGA,OAAO,CAAC4B,SAAS,CAAC,CAAC,CAAC,CAAC;KAChC;IACD,OAAO5B,OAAO,CAAC;CAChB"}
1
+ {"version":3,"sources":["../../../src/export/metroAssetLocalPath.ts"],"sourcesContent":["/**\n * Copyright © 2023 650 Industries.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * Based on the community asset persisting for Metro but with base path and web support:\n * https://github.com/facebook/react-native/blob/d6e0bc714ad4d215ede4949d3c4f44af6dea5dd3/packages/community-cli-plugin/src/commands/bundle/saveAssets.js#L1\n */\nimport type { AssetData } from 'metro';\nimport path from 'path';\n\nexport function getAssetLocalPath(\n asset: Pick<AssetData, 'type' | 'httpServerLocation' | 'name'>,\n { baseUrl, scale, platform }: { baseUrl?: string; scale: number; platform: string }\n): string {\n if (platform === 'android') {\n return getAssetLocalPathAndroid(asset, { baseUrl, scale });\n }\n return getAssetLocalPathDefault(asset, { baseUrl, scale });\n}\n\nfunction getAssetLocalPathAndroid(\n asset: Pick<AssetData, 'type' | 'httpServerLocation' | 'name'>,\n {\n baseUrl,\n scale,\n }: {\n // TODO: baseUrl support\n baseUrl?: string;\n scale: number;\n }\n): string {\n const androidFolder = getAndroidResourceFolderName(asset, scale);\n const fileName = getResourceIdentifier(asset);\n return path.join(androidFolder, `${fileName}.${asset.type}`);\n}\n\nfunction getAssetLocalPathDefault(\n asset: Pick<AssetData, 'type' | 'httpServerLocation' | 'name'>,\n { baseUrl, scale }: { baseUrl?: string; scale: number }\n): string {\n const suffix = scale === 1 ? '' : `@${scale}x`;\n const fileName = `${asset.name}${suffix}.${asset.type}`;\n\n const adjustedHttpServerLocation = stripAssetPrefix(asset.httpServerLocation, baseUrl);\n\n return path.join(\n // Assets can have relative paths outside of the project root.\n // Replace `../` with `_` to make sure they don't end up outside of\n // the expected assets directory.\n adjustedHttpServerLocation.replace(/^\\/+/g, '').replace(/\\.\\.\\//g, '_'),\n fileName\n );\n}\n\nexport function stripAssetPrefix(path: string, baseUrl?: string) {\n path = path.replace(/\\/assets\\?export_path=(.*)/, '$1');\n\n // TODO: Windows?\n if (baseUrl) {\n return path.replace(/^\\/+/g, '').replace(\n new RegExp(\n `^${baseUrl\n .replace(/^\\/+/g, '')\n .replace(/[|\\\\{}()[\\]^$+*?.]/g, '\\\\$&')\n .replace(/-/g, '\\\\x2d')}`,\n 'g'\n ),\n ''\n );\n }\n return path;\n}\n\n/**\n * FIXME: using number to represent discrete scale numbers is fragile in essence because of\n * floating point numbers imprecision.\n */\nfunction getAndroidAssetSuffix(scale: number): string | null {\n switch (scale) {\n case 0.75:\n return 'ldpi';\n case 1:\n return 'mdpi';\n case 1.5:\n return 'hdpi';\n case 2:\n return 'xhdpi';\n case 3:\n return 'xxhdpi';\n case 4:\n return 'xxxhdpi';\n default:\n return null;\n }\n}\n\n// See https://developer.android.com/guide/topics/resources/drawable-resource.html\nexport const drawableFileTypes = new Set<string>(['gif', 'jpeg', 'jpg', 'png', 'webp', 'xml']);\n\nfunction getAndroidResourceFolderName(asset: Pick<AssetData, 'type'>, scale: number): string {\n if (!drawableFileTypes.has(asset.type)) {\n return 'raw';\n }\n const suffix = getAndroidAssetSuffix(scale);\n if (!suffix) {\n throw new Error(\n `Asset \"${JSON.stringify(asset)}\" does not use a supported Android resolution suffix`\n );\n }\n return `drawable-${suffix}`;\n}\n\nfunction getResourceIdentifier(asset: Pick<AssetData, 'httpServerLocation' | 'name'>): string {\n const folderPath = getBaseUrl(asset);\n return `${folderPath}/${asset.name}`\n .toLowerCase()\n .replace(/\\//g, '_') // Encode folder structure in file name\n .replace(/([^a-z0-9_])/g, '') // Remove illegal chars\n .replace(/^assets_/, ''); // Remove \"assets_\" prefix\n}\n\nfunction getBaseUrl(asset: Pick<AssetData, 'httpServerLocation'>): string {\n let baseUrl = asset.httpServerLocation;\n if (baseUrl[0] === '/') {\n baseUrl = baseUrl.substring(1);\n }\n return baseUrl;\n}\n"],"names":["getAssetLocalPath","stripAssetPrefix","asset","baseUrl","scale","platform","getAssetLocalPathAndroid","getAssetLocalPathDefault","androidFolder","getAndroidResourceFolderName","fileName","getResourceIdentifier","path","join","type","suffix","name","adjustedHttpServerLocation","httpServerLocation","replace","RegExp","getAndroidAssetSuffix","drawableFileTypes","Set","has","Error","JSON","stringify","folderPath","getBaseUrl","toLowerCase","substring"],"mappings":"AAUA;;;;QAGgBA,iBAAiB,GAAjBA,iBAAiB;QA4CjBC,gBAAgB,GAAhBA,gBAAgB;;AA9Cf,IAAA,KAAM,kCAAN,MAAM,EAAA;;;;;;AAEhB,SAASD,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C,MAAM,GAAGM,qBAAqB,CAACjB,KAAK,CAAC,AAAC;IAC5C,IAAI,CAACW,MAAM,EAAE;QACX,MAAM,IAAIU,KAAK,CACb,CAAC,OAAO,EAAEC,IAAI,CAACC,SAAS,CAACzB,KAAK,CAAC,CAAC,oDAAoD,CAAC,CACtF,CAAC;KACH;IACD,OAAO,CAAC,SAAS,EAAEa,MAAM,CAAC,CAAC,CAAC;CAC7B;AAED,SAASJ,qBAAqB,CAACT,KAAqD,EAAU;IAC5F,MAAM0B,UAAU,GAAGC,UAAU,CAAC3B,KAAK,CAAC,AAAC;IACrC,OAAO,CAAC,EAAE0B,UAAU,CAAC,CAAC,EAAE1B,KAAK,CAACc,IAAI,CAAC,CAAC,CACjCc,WAAW,EAAE,CACbX,OAAO,QAAQ,GAAG,CAAC,CAAC,uCAAuC;KAC3DA,OAAO,kBAAkB,EAAE,CAAC,CAAC,uBAAuB;KACpDA,OAAO,aAAa,EAAE,CAAC,CAAC,CAAC,0BAA0B;CACvD;AAED,SAASU,UAAU,CAAC3B,KAA4C,EAAU;IACxE,IAAIC,OAAO,GAAGD,KAAK,CAACgB,kBAAkB,AAAC;IACvC,IAAIf,OAAO,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;QACtBA,OAAO,GAAGA,OAAO,CAAC4B,SAAS,CAAC,CAAC,CAAC,CAAC;KAChC;IACD,OAAO5B,OAAO,CAAC;CAChB"}
@@ -39,10 +39,12 @@ function _interopRequireWildcard(obj) {
39
39
  }
40
40
  const debug = require("debug")("expo:start:interface:interactiveActions");
41
41
  class DevServerManagerActions {
42
- constructor(devServerManager){
42
+ constructor(devServerManager, options){
43
43
  this.devServerManager = devServerManager;
44
+ this.options = options;
44
45
  }
45
46
  printDevServerInfo(options) {
47
+ var ref;
46
48
  // If native dev server is running, print its URL.
47
49
  if (this.devServerManager.getNativeDevServerPort()) {
48
50
  const devServer = this.devServerManager.getDefaultDevServer();
@@ -72,13 +74,15 @@ class DevServerManagerActions {
72
74
  }
73
75
  }
74
76
  }
75
- const webDevServer = this.devServerManager.getWebDevServer();
76
- const webUrl = webDevServer == null ? void 0 : webDevServer.getDevServerUrl({
77
- hostType: "localhost"
78
- });
79
- if (webUrl) {
80
- Log.log();
81
- Log.log((0, _commandsTable).printItem(_chalk.default`Web is waiting on {underline ${webUrl}}`));
77
+ if ((ref = this.options.platforms) == null ? void 0 : ref.includes("web")) {
78
+ const webDevServer = this.devServerManager.getWebDevServer();
79
+ const webUrl = webDevServer == null ? void 0 : webDevServer.getDevServerUrl({
80
+ hostType: "localhost"
81
+ });
82
+ if (webUrl) {
83
+ Log.log();
84
+ Log.log((0, _commandsTable).printItem(_chalk.default`Web is waiting on {underline ${webUrl}}`));
85
+ }
82
86
  }
83
87
  (0, _commandsTable).printUsage(options, {
84
88
  verbose: false
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/start/interface/interactiveActions.ts"],"sourcesContent":["import chalk from 'chalk';\n\nimport { BLT, printHelp, printItem, printQRCode, printUsage, StartOptions } from './commandsTable';\nimport * as Log from '../../log';\nimport { delayAsync } from '../../utils/delay';\nimport { learnMore } from '../../utils/link';\nimport { openBrowserAsync } from '../../utils/open';\nimport { ExpoChoice, selectAsync } from '../../utils/prompts';\nimport { DevServerManager } from '../server/DevServerManager';\nimport {\n addReactDevToolsReloadListener,\n startReactDevToolsProxyAsync,\n} from '../server/ReactDevToolsProxy';\nimport {\n MetroInspectorProxyApp,\n openJsInspector,\n queryAllInspectorAppsAsync,\n} from '../server/middleware/inspector/JsInspector';\n\nconst debug = require('debug')('expo:start:interface:interactiveActions') as typeof console.log;\n\ninterface MoreToolMenuItem extends ExpoChoice<string> {\n action?: () => unknown;\n}\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 if (options.devClient === false) {\n // TODO: if development build, change this message!\n Log.log(\n printItem('Scan the QR code above with Expo Go (Android) or the Camera app (iOS)')\n );\n } else {\n Log.log(\n printItem(\n 'Scan the QR code above to open the project in a development build. ' +\n learnMore('https://expo.fyi/start')\n )\n );\n }\n } catch (error) {\n console.log('err', 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 const metroServerOrigin = this.devServerManager.getDefaultDevServer().getJsInspectorBaseUrl();\n const apps = await queryAllInspectorAppsAsync(metroServerOrigin);\n let app: MetroInspectorProxyApp | null = null;\n\n if (!apps.length) {\n return Log.warn(\n chalk`{bold Debug:} No compatible apps connected. JavaScript Debugging can only be used with the Hermes engine. ${learnMore(\n 'https://docs.expo.dev/guides/using-hermes/'\n )}`\n );\n }\n\n if (apps.length === 1) {\n app = apps[0];\n } else {\n const choices = apps.map((app) => ({\n title: app.deviceName ?? 'Unknown device',\n value: app.id,\n app,\n }));\n\n const value = await selectAsync(chalk`Debug target {dim (Hermes only)}`, choices);\n const menuItem = choices.find((item) => item.value === value);\n if (!menuItem) {\n return Log.error(chalk`{bold Debug:} No device available for \"${value}\"`);\n }\n\n app = menuItem.app;\n }\n\n if (!app) {\n return Log.error(chalk`{bold Debug:} No device selected`);\n }\n\n try {\n await openJsInspector(metroServerOrigin, app);\n } catch (error: any) {\n Log.error('Failed to open JavaScript inspector. This is often an issue with Google Chrome.');\n Log.exception(error);\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 // Options match: Chrome > View > Developer\n try {\n const defaultMenuItems: MoreToolMenuItem[] = [\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 {\n title: 'Open React devtools',\n value: 'openReactDevTools',\n action: this.openReactDevToolsAsync.bind(this),\n },\n // TODO: Maybe a \"View Source\" option to open code.\n ];\n const pluginMenuItems = (\n await this.devServerManager.devtoolsPluginManager.queryPluginsAsync()\n ).map((plugin) => ({\n title: chalk`Open devtools plugin - {bold ${plugin.packageName}}`,\n value: `devtoolsPlugin:${plugin.packageName}`,\n action: async () => {\n const url = new URL(\n plugin.webpageEndpoint,\n this.devServerManager\n .getDefaultDevServer()\n .getUrlCreator()\n .constructUrl({ scheme: 'http' })\n );\n await openBrowserAsync(url.toString());\n },\n }));\n const menuItems = [...defaultMenuItems, ...pluginMenuItems];\n const value = await selectAsync(chalk`Dev tools {dim (native only)}`, menuItems);\n const menuItem = menuItems.find((item) => item.value === value);\n if (menuItem?.action) {\n menuItem.action();\n } else if (menuItem?.value) {\n this.devServerManager.broadcastMessage('sendDevCommand', { name: menuItem.value });\n }\n } catch (error: any) {\n debug(error);\n // do nothing\n } finally {\n printHelp();\n }\n }\n\n async openReactDevToolsAsync() {\n await startReactDevToolsProxyAsync();\n const url = this.devServerManager.getDefaultDevServer().getReactDevToolsUrl();\n await openBrowserAsync(url);\n addReactDevToolsReloadListener(() => {\n this.reconnectReactDevTools();\n });\n this.reconnectReactDevTools();\n }\n\n async reconnectReactDevTools() {\n // Wait a little time for react-devtools to be initialized in browser\n await delayAsync(3000);\n this.devServerManager.broadcastMessage('sendDevCommand', { name: 'reconnectReactDevTools' });\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","devClient","learnMore","error","console","code","serverUrl","getDevServerUrl","webDevServer","getWebDevServer","webUrl","hostType","printUsage","verbose","printHelp","openJsInspectorAsync","metroServerOrigin","getJsInspectorBaseUrl","apps","queryAllInspectorAppsAsync","app","length","warn","choices","map","title","deviceName","value","id","selectAsync","menuItem","find","item","openJsInspector","exception","reloadApp","BLT","broadcastMessage","openMoreToolsAsync","defaultMenuItems","action","openReactDevToolsAsync","bind","pluginMenuItems","devtoolsPluginManager","queryPluginsAsync","plugin","packageName","url","URL","webpageEndpoint","getUrlCreator","constructUrl","scheme","openBrowserAsync","toString","menuItems","name","startReactDevToolsProxyAsync","getReactDevToolsUrl","addReactDevToolsReloadListener","reconnectReactDevTools","delayAsync","toggleDevMenu"],"mappings":"AAAA;;;;AAAkB,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEwD,IAAA,cAAiB,WAAjB,iBAAiB,CAAA;AACtFA,IAAAA,GAAG,mCAAM,WAAW,EAAjB;AACY,IAAA,MAAmB,WAAnB,mBAAmB,CAAA;AACpB,IAAA,KAAkB,WAAlB,kBAAkB,CAAA;AACX,IAAA,KAAk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,EAAEsC,cAAG,IAAA,CAAC,kBAAkB,CAAC,CAAC,CAAC;QACpC,IAAI,CAACjD,gBAAgB,CAACkD,gBAAgB,CAAC,SAAS,CAAC,CAAC;KACnD;CACF;QAjLYpD,uBAAuB,GAAvBA,uBAAuB"}
1
+ {"version":3,"sources":["../../../../src/start/interface/interactiveActions.ts"],"sourcesContent":["import chalk from 'chalk';\n\nimport { BLT, printHelp, printItem, printQRCode, printUsage, StartOptions } from './commandsTable';\nimport * as Log from '../../log';\nimport { delayAsync } from '../../utils/delay';\nimport { learnMore } from '../../utils/link';\nimport { openBrowserAsync } from '../../utils/open';\nimport { ExpoChoice, selectAsync } from '../../utils/prompts';\nimport { DevServerManager } from '../server/DevServerManager';\nimport {\n addReactDevToolsReloadListener,\n startReactDevToolsProxyAsync,\n} from '../server/ReactDevToolsProxy';\nimport {\n MetroInspectorProxyApp,\n openJsInspector,\n queryAllInspectorAppsAsync,\n} from '../server/middleware/inspector/JsInspector';\n\nconst debug = require('debug')('expo:start:interface:interactiveActions') as typeof console.log;\n\ninterface MoreToolMenuItem extends ExpoChoice<string> {\n action?: () => unknown;\n}\n\n/** Wraps the DevServerManager and adds an interface for user actions. */\nexport class DevServerManagerActions {\n constructor(\n private devServerManager: DevServerManager,\n private options: Pick<StartOptions, 'devClient' | 'platforms'>\n ) {}\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 if (options.devClient === false) {\n // TODO: if development build, change this message!\n Log.log(\n printItem('Scan the QR code above with Expo Go (Android) or the Camera app (iOS)')\n );\n } else {\n Log.log(\n printItem(\n 'Scan the QR code above to open the project in a development build. ' +\n learnMore('https://expo.fyi/start')\n )\n );\n }\n } catch (error) {\n console.log('err', 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 if (this.options.platforms?.includes('web')) {\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\n printUsage(options, { verbose: false });\n printHelp();\n Log.log();\n }\n\n async openJsInspectorAsync() {\n const metroServerOrigin = this.devServerManager.getDefaultDevServer().getJsInspectorBaseUrl();\n const apps = await queryAllInspectorAppsAsync(metroServerOrigin);\n let app: MetroInspectorProxyApp | null = null;\n\n if (!apps.length) {\n return Log.warn(\n chalk`{bold Debug:} No compatible apps connected. JavaScript Debugging can only be used with the Hermes engine. ${learnMore(\n 'https://docs.expo.dev/guides/using-hermes/'\n )}`\n );\n }\n\n if (apps.length === 1) {\n app = apps[0];\n } else {\n const choices = apps.map((app) => ({\n title: app.deviceName ?? 'Unknown device',\n value: app.id,\n app,\n }));\n\n const value = await selectAsync(chalk`Debug target {dim (Hermes only)}`, choices);\n const menuItem = choices.find((item) => item.value === value);\n if (!menuItem) {\n return Log.error(chalk`{bold Debug:} No device available for \"${value}\"`);\n }\n\n app = menuItem.app;\n }\n\n if (!app) {\n return Log.error(chalk`{bold Debug:} No device selected`);\n }\n\n try {\n await openJsInspector(metroServerOrigin, app);\n } catch (error: any) {\n Log.error('Failed to open JavaScript inspector. This is often an issue with Google Chrome.');\n Log.exception(error);\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 // Options match: Chrome > View > Developer\n try {\n const defaultMenuItems: MoreToolMenuItem[] = [\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 {\n title: 'Open React devtools',\n value: 'openReactDevTools',\n action: this.openReactDevToolsAsync.bind(this),\n },\n // TODO: Maybe a \"View Source\" option to open code.\n ];\n const pluginMenuItems = (\n await this.devServerManager.devtoolsPluginManager.queryPluginsAsync()\n ).map((plugin) => ({\n title: chalk`Open devtools plugin - {bold ${plugin.packageName}}`,\n value: `devtoolsPlugin:${plugin.packageName}`,\n action: async () => {\n const url = new URL(\n plugin.webpageEndpoint,\n this.devServerManager\n .getDefaultDevServer()\n .getUrlCreator()\n .constructUrl({ scheme: 'http' })\n );\n await openBrowserAsync(url.toString());\n },\n }));\n const menuItems = [...defaultMenuItems, ...pluginMenuItems];\n const value = await selectAsync(chalk`Dev tools {dim (native only)}`, menuItems);\n const menuItem = menuItems.find((item) => item.value === value);\n if (menuItem?.action) {\n menuItem.action();\n } else if (menuItem?.value) {\n this.devServerManager.broadcastMessage('sendDevCommand', { name: menuItem.value });\n }\n } catch (error: any) {\n debug(error);\n // do nothing\n } finally {\n printHelp();\n }\n }\n\n async openReactDevToolsAsync() {\n await startReactDevToolsProxyAsync();\n const url = this.devServerManager.getDefaultDevServer().getReactDevToolsUrl();\n await openBrowserAsync(url);\n addReactDevToolsReloadListener(() => {\n this.reconnectReactDevTools();\n });\n this.reconnectReactDevTools();\n }\n\n async reconnectReactDevTools() {\n // Wait a little time for react-devtools to be initialized in browser\n await delayAsync(3000);\n this.devServerManager.broadcastMessage('sendDevCommand', { name: 'reconnectReactDevTools' });\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","options","printDevServerInfo","getNativeDevServerPort","devServer","getDefaultDevServer","nativeRuntimeUrl","getNativeRuntimeUrl","interstitialPageUrl","getRedirectUrl","printQRCode","log","printItem","chalk","devClient","learnMore","error","console","code","serverUrl","getDevServerUrl","platforms","includes","webDevServer","getWebDevServer","webUrl","hostType","printUsage","verbose","printHelp","openJsInspectorAsync","metroServerOrigin","getJsInspectorBaseUrl","apps","queryAllInspectorAppsAsync","app","length","warn","choices","map","title","deviceName","value","id","selectAsync","menuItem","find","item","openJsInspector","exception","reloadApp","BLT","broadcastMessage","openMoreToolsAsync","defaultMenuItems","action","openReactDevToolsAsync","bind","pluginMenuItems","devtoolsPluginManager","queryPluginsAsync","plugin","packageName","url","URL","webpageEndpoint","getUrlCreator","constructUrl","scheme","openBrowserAsync","toString","menuItems","name","startReactDevToolsProxyAsync","getReactDevToolsUrl","addReactDevToolsReloadListener","reconnectReactDevTools","delayAsync","toggleDevMenu"],"mappings":"AAAA;;;;AAAkB,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEwD,IAAA,cAAiB,WAAjB,iBAAiB,CAAA;AACtFA,IAAAA,GAAG,mCAAM,WAAW,EAAjB;AACY,IAAA,MAAmB,WAAnB,mBAAmB,CAAA;AACpB,IAAA,KAAkB,WAAlB,kBAAkB,CAAA;AACX,IAAA,KAAkB,WAAlB,kBAAkB,CAAA;AACX,IAAA,QAAqB,WAArB,qBAAqB,CAAA;AAKtD,IAAA,mBAA8B,WAA9B,8BAA8B,CAAA;AAK9B,IAAA,YAA4C,WAA5C,4CAA4C,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEnD,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,yCAAyC,CAAC,AAAsB,AAAC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AC,CAAC;QACpC,IAAI,CAACnD,gBAAgB,CAACoD,gBAAgB,CAAC,SAAS,CAAC,CAAC;KACnD;CACF;QAtLYtD,uBAAuB,GAAvBA,uBAAuB"}
@@ -58,7 +58,7 @@ const PLATFORM_SETTINGS = {
58
58
  };
59
59
  async function startInterfaceAsync(devServerManager, options) {
60
60
  var ref2;
61
- const actions = new _interactiveActions.DevServerManagerActions(devServerManager);
61
+ const actions = new _interactiveActions.DevServerManagerActions(devServerManager, options);
62
62
  const isWebSocketsEnabled = (ref2 = devServerManager.getDefaultDevServer()) == null ? void 0 : ref2.isTargetingNative();
63
63
  const usageOptions = {
64
64
  isWebSocketsEnabled,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/start/interface/startInterface.ts"],"sourcesContent":["import chalk from 'chalk';\n\nimport { KeyPressHandler } from './KeyPressHandler';\nimport { BLT, printHelp, printUsage, StartOptions } from './commandsTable';\nimport { DevServerManagerActions } from './interactiveActions';\nimport * as Log from '../../log';\nimport { openInEditorAsync } from '../../utils/editor';\nimport { AbortCommandError } from '../../utils/errors';\nimport { getAllSpinners, ora } from '../../utils/ora';\nimport { getProgressBar, setProgressBar } from '../../utils/progress';\nimport { addInteractionListener, pauseInteractions } from '../../utils/prompts';\nimport { WebSupportProjectPrerequisite } from '../doctor/web/WebSupportProjectPrerequisite';\nimport { DevServerManager } from '../server/DevServerManager';\n\nconst debug = require('debug')('expo:start:interface:startInterface') as typeof console.log;\n\nconst CTRL_C = '\\u0003';\nconst CTRL_D = '\\u0004';\nconst CTRL_L = '\\u000C';\n\nconst PLATFORM_SETTINGS: Record<\n string,\n { name: string; key: 'android' | 'ios'; launchTarget: 'emulator' | 'simulator' }\n> = {\n android: {\n name: 'Android',\n key: 'android',\n launchTarget: 'emulator',\n },\n ios: {\n name: 'iOS',\n key: 'ios',\n launchTarget: 'simulator',\n },\n};\n\nexport async function startInterfaceAsync(\n devServerManager: DevServerManager,\n options: Pick<StartOptions, 'devClient' | 'platforms'>\n) {\n const actions = new DevServerManagerActions(devServerManager);\n\n const isWebSocketsEnabled = devServerManager.getDefaultDevServer()?.isTargetingNative();\n\n const usageOptions = {\n isWebSocketsEnabled,\n devClient: devServerManager.options.devClient,\n ...options,\n };\n\n actions.printDevServerInfo(usageOptions);\n\n const onPressAsync = async (key: string) => {\n // Auxillary commands all escape.\n switch (key) {\n case CTRL_C:\n case CTRL_D: {\n // Prevent terminal UI from accepting commands while the process is closing.\n // Without this, fast typers will close the server then start typing their\n // next command and have a bunch of unrelated things pop up.\n pauseInteractions();\n\n const spinners = getAllSpinners();\n spinners.forEach((spinner) => {\n spinner.fail();\n });\n\n const currentProgress = getProgressBar();\n if (currentProgress) {\n currentProgress.terminate();\n setProgressBar(null);\n }\n const spinner = ora({ text: 'Stopping server', color: 'white' }).start();\n try {\n await devServerManager.stopAsync();\n spinner.stopAndPersist({ text: 'Stopped server', symbol: `\\u203A` });\n // @ts-ignore: Argument of type '\"SIGINT\"' is not assignable to parameter of type '\"disconnect\"'.\n process.emit('SIGINT');\n\n // TODO: Is this the right place to do this?\n process.exit();\n } catch (error) {\n spinner.fail('Failed to stop server');\n throw error;\n }\n break;\n }\n case CTRL_L:\n return Log.clear();\n case '?':\n return printUsage(usageOptions, { verbose: true });\n }\n\n // Optionally enabled\n\n if (isWebSocketsEnabled) {\n switch (key) {\n case 'm':\n return actions.toggleDevMenu();\n case 'M':\n return actions.openMoreToolsAsync();\n }\n }\n\n const { platforms = ['ios', 'android', 'web'] } = options;\n\n if (['i', 'a'].includes(key.toLowerCase())) {\n const platform = key.toLowerCase() === 'i' ? 'ios' : 'android';\n\n const shouldPrompt = ['I', 'A'].includes(key);\n if (shouldPrompt) {\n Log.clear();\n }\n\n const server = devServerManager.getDefaultDevServer();\n const settings = PLATFORM_SETTINGS[platform];\n\n Log.log(`${BLT} Opening on ${settings.name}...`);\n\n if (server.isTargetingNative() && !platforms.includes(settings.key)) {\n Log.warn(\n chalk`${settings.name} is disabled, enable it by adding {bold ${settings.key}} to the platforms array in your app.json or app.config.js`\n );\n } else {\n try {\n await server.openPlatformAsync(settings.launchTarget, { shouldPrompt });\n printHelp();\n } catch (error: any) {\n if (!(error instanceof AbortCommandError)) {\n Log.exception(error);\n }\n }\n }\n // Break out early.\n return;\n }\n\n switch (key) {\n case 's': {\n Log.clear();\n if (await devServerManager.toggleRuntimeMode()) {\n usageOptions.devClient = devServerManager.options.devClient;\n return actions.printDevServerInfo(usageOptions);\n }\n break;\n }\n case 'w': {\n try {\n await devServerManager.ensureProjectPrerequisiteAsync(WebSupportProjectPrerequisite);\n if (!platforms.includes('web')) {\n platforms.push('web');\n options.platforms?.push('web');\n }\n } catch (e: any) {\n Log.warn(e.message);\n break;\n }\n\n const isDisabled = !platforms.includes('web');\n if (isDisabled) {\n debug('Web is disabled');\n // Use warnings from the web support setup.\n break;\n }\n\n // Ensure the Webpack dev server is running first\n if (!devServerManager.getWebDevServer()) {\n debug('Starting up webpack dev server');\n await devServerManager.ensureWebDevServerRunningAsync();\n // When this is the first time webpack is started, reprint the connection info.\n actions.printDevServerInfo(usageOptions);\n }\n\n Log.log(`${BLT} Open in the web browser...`);\n try {\n await devServerManager.getWebDevServer()?.openPlatformAsync('desktop');\n printHelp();\n } catch (error: any) {\n if (!(error instanceof AbortCommandError)) {\n Log.exception(error);\n }\n }\n break;\n }\n case 'c':\n Log.clear();\n return actions.printDevServerInfo(usageOptions);\n case 'j':\n return actions.openJsInspectorAsync();\n case 'r':\n return actions.reloadApp();\n case 'o':\n Log.log(`${BLT} Opening the editor...`);\n return openInEditorAsync(devServerManager.projectRoot);\n }\n };\n\n const keyPressHandler = new KeyPressHandler(onPressAsync);\n\n const listener = keyPressHandler.createInteractionListener();\n\n addInteractionListener(listener);\n\n // Start observing...\n keyPressHandler.startInterceptingKeyStrokes();\n}\n"],"names":["startInterfaceAsync","Log","debug","require","CTRL_C","CTRL_D","CTRL_L","PLATFORM_SETTINGS","android","name","key","launchTarget","ios","devServerManager","options","actions","DevServerManagerActions","isWebSocketsEnabled","getDefaultDevServer","isTargetingNative","usageOptions","devClient","printDevServerInfo","onPressAsync","pauseInteractions","spinners","getAllSpinners","forEach","spinner","fail","currentProgress","getProgressBar","terminate","setProgressBar","ora","text","color","start","stopAsync","stopAndPersist","symbol","process","emit","exit","error","clear","printUsage","verbose","toggleDevMenu","openMoreToolsAsync","platforms","includes","toLowerCase","platform","shouldPrompt","server","settings","log","BLT","warn","chalk","openPlatformAsync","printHelp","AbortCommandError","exception","toggleRuntimeMode","ensureProjectPrerequisiteAsync","WebSupportProjectPrerequisite","push","e","message","isDisabled","getWebDevServer","ensureWebDevServerRunningAsync","openJsInspectorAsync","reloadApp","openInEditorAsync","projectRoot","keyPressHandler","KeyPressHandler","listener","createInteractionListener","addInteractionListener","startInterceptingKeyStrokes"],"mappings":"AAAA;;;;QAoCsBA,mBAAmB,GAAnBA,mBAAmB;AApCvB,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEO,IAAA,gBAAmB,WAAnB,mBAAmB,CAAA;AACM,IAAA,cAAiB,WAAjB,iBAAiB,CAAA;AAClC,IAAA,mBAAsB,WAAtB,sBAAsB,CAAA;AAClDC,IAAAA,GAAG,mCAAM,WAAW,EAAjB;AACmB,IAAA,OAAoB,WAApB,oBAAoB,CAAA;AACpB,IAAA,OAAoB,WAApB,oBAAoB,CAAA;AAClB,IAAA,IAAiB,WAAjB,iBAAiB,CAAA;AACN,IAAA,SAAsB,WAAtB,sBAAsB,CAAA;AACX,IAAA,QAAqB,WAArB,qBAAqB,CAAA;AACjC,IAAA,8BAA6C,WAA7C,6CAA6C,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAG3F,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,qCAAqC,CAAC,AAAsB,AAAC;AAE5F,MAAMC,MAAM,GAAG,MAAQ,AAAC;AACxB,MAAMC,MAAM,GAAG,MAAQ,AAAC;AACxB,MAAMC,MAAM,GAAG,IAAQ,AAAC;AAExB,MAA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A,QAAsB,AAAU,CAAA,uBAAV,CAACF,QAAQ,CAAC,CAAC;IAEjC,qBAAqB;IACrBF,eAAe,CAACK,2BAA2B,EAAE,CAAC;CAC/C"}
1
+ {"version":3,"sources":["../../../../src/start/interface/startInterface.ts"],"sourcesContent":["import chalk from 'chalk';\n\nimport { KeyPressHandler } from './KeyPressHandler';\nimport { BLT, printHelp, printUsage, StartOptions } from './commandsTable';\nimport { DevServerManagerActions } from './interactiveActions';\nimport * as Log from '../../log';\nimport { openInEditorAsync } from '../../utils/editor';\nimport { AbortCommandError } from '../../utils/errors';\nimport { getAllSpinners, ora } from '../../utils/ora';\nimport { getProgressBar, setProgressBar } from '../../utils/progress';\nimport { addInteractionListener, pauseInteractions } from '../../utils/prompts';\nimport { WebSupportProjectPrerequisite } from '../doctor/web/WebSupportProjectPrerequisite';\nimport { DevServerManager } from '../server/DevServerManager';\n\nconst debug = require('debug')('expo:start:interface:startInterface') as typeof console.log;\n\nconst CTRL_C = '\\u0003';\nconst CTRL_D = '\\u0004';\nconst CTRL_L = '\\u000C';\n\nconst PLATFORM_SETTINGS: Record<\n string,\n { name: string; key: 'android' | 'ios'; launchTarget: 'emulator' | 'simulator' }\n> = {\n android: {\n name: 'Android',\n key: 'android',\n launchTarget: 'emulator',\n },\n ios: {\n name: 'iOS',\n key: 'ios',\n launchTarget: 'simulator',\n },\n};\n\nexport async function startInterfaceAsync(\n devServerManager: DevServerManager,\n options: Pick<StartOptions, 'devClient' | 'platforms'>\n) {\n const actions = new DevServerManagerActions(devServerManager, options);\n\n const isWebSocketsEnabled = devServerManager.getDefaultDevServer()?.isTargetingNative();\n\n const usageOptions = {\n isWebSocketsEnabled,\n devClient: devServerManager.options.devClient,\n ...options,\n };\n\n actions.printDevServerInfo(usageOptions);\n\n const onPressAsync = async (key: string) => {\n // Auxillary commands all escape.\n switch (key) {\n case CTRL_C:\n case CTRL_D: {\n // Prevent terminal UI from accepting commands while the process is closing.\n // Without this, fast typers will close the server then start typing their\n // next command and have a bunch of unrelated things pop up.\n pauseInteractions();\n\n const spinners = getAllSpinners();\n spinners.forEach((spinner) => {\n spinner.fail();\n });\n\n const currentProgress = getProgressBar();\n if (currentProgress) {\n currentProgress.terminate();\n setProgressBar(null);\n }\n const spinner = ora({ text: 'Stopping server', color: 'white' }).start();\n try {\n await devServerManager.stopAsync();\n spinner.stopAndPersist({ text: 'Stopped server', symbol: `\\u203A` });\n // @ts-ignore: Argument of type '\"SIGINT\"' is not assignable to parameter of type '\"disconnect\"'.\n process.emit('SIGINT');\n\n // TODO: Is this the right place to do this?\n process.exit();\n } catch (error) {\n spinner.fail('Failed to stop server');\n throw error;\n }\n break;\n }\n case CTRL_L:\n return Log.clear();\n case '?':\n return printUsage(usageOptions, { verbose: true });\n }\n\n // Optionally enabled\n\n if (isWebSocketsEnabled) {\n switch (key) {\n case 'm':\n return actions.toggleDevMenu();\n case 'M':\n return actions.openMoreToolsAsync();\n }\n }\n\n const { platforms = ['ios', 'android', 'web'] } = options;\n\n if (['i', 'a'].includes(key.toLowerCase())) {\n const platform = key.toLowerCase() === 'i' ? 'ios' : 'android';\n\n const shouldPrompt = ['I', 'A'].includes(key);\n if (shouldPrompt) {\n Log.clear();\n }\n\n const server = devServerManager.getDefaultDevServer();\n const settings = PLATFORM_SETTINGS[platform];\n\n Log.log(`${BLT} Opening on ${settings.name}...`);\n\n if (server.isTargetingNative() && !platforms.includes(settings.key)) {\n Log.warn(\n chalk`${settings.name} is disabled, enable it by adding {bold ${settings.key}} to the platforms array in your app.json or app.config.js`\n );\n } else {\n try {\n await server.openPlatformAsync(settings.launchTarget, { shouldPrompt });\n printHelp();\n } catch (error: any) {\n if (!(error instanceof AbortCommandError)) {\n Log.exception(error);\n }\n }\n }\n // Break out early.\n return;\n }\n\n switch (key) {\n case 's': {\n Log.clear();\n if (await devServerManager.toggleRuntimeMode()) {\n usageOptions.devClient = devServerManager.options.devClient;\n return actions.printDevServerInfo(usageOptions);\n }\n break;\n }\n case 'w': {\n try {\n await devServerManager.ensureProjectPrerequisiteAsync(WebSupportProjectPrerequisite);\n if (!platforms.includes('web')) {\n platforms.push('web');\n options.platforms?.push('web');\n }\n } catch (e: any) {\n Log.warn(e.message);\n break;\n }\n\n const isDisabled = !platforms.includes('web');\n if (isDisabled) {\n debug('Web is disabled');\n // Use warnings from the web support setup.\n break;\n }\n\n // Ensure the Webpack dev server is running first\n if (!devServerManager.getWebDevServer()) {\n debug('Starting up webpack dev server');\n await devServerManager.ensureWebDevServerRunningAsync();\n // When this is the first time webpack is started, reprint the connection info.\n actions.printDevServerInfo(usageOptions);\n }\n\n Log.log(`${BLT} Open in the web browser...`);\n try {\n await devServerManager.getWebDevServer()?.openPlatformAsync('desktop');\n printHelp();\n } catch (error: any) {\n if (!(error instanceof AbortCommandError)) {\n Log.exception(error);\n }\n }\n break;\n }\n case 'c':\n Log.clear();\n return actions.printDevServerInfo(usageOptions);\n case 'j':\n return actions.openJsInspectorAsync();\n case 'r':\n return actions.reloadApp();\n case 'o':\n Log.log(`${BLT} Opening the editor...`);\n return openInEditorAsync(devServerManager.projectRoot);\n }\n };\n\n const keyPressHandler = new KeyPressHandler(onPressAsync);\n\n const listener = keyPressHandler.createInteractionListener();\n\n addInteractionListener(listener);\n\n // Start observing...\n keyPressHandler.startInterceptingKeyStrokes();\n}\n"],"names":["startInterfaceAsync","Log","debug","require","CTRL_C","CTRL_D","CTRL_L","PLATFORM_SETTINGS","android","name","key","launchTarget","ios","devServerManager","options","actions","DevServerManagerActions","isWebSocketsEnabled","getDefaultDevServer","isTargetingNative","usageOptions","devClient","printDevServerInfo","onPressAsync","pauseInteractions","spinners","getAllSpinners","forEach","spinner","fail","currentProgress","getProgressBar","terminate","setProgressBar","ora","text","color","start","stopAsync","stopAndPersist","symbol","process","emit","exit","error","clear","printUsage","verbose","toggleDevMenu","openMoreToolsAsync","platforms","includes","toLowerCase","platform","shouldPrompt","server","settings","log","BLT","warn","chalk","openPlatformAsync","printHelp","AbortCommandError","exception","toggleRuntimeMode","ensureProjectPrerequisiteAsync","WebSupportProjectPrerequisite","push","e","message","isDisabled","getWebDevServer","ensureWebDevServerRunningAsync","openJsInspectorAsync","reloadApp","openInEditorAsync","projectRoot","keyPressHandler","KeyPressHandler","listener","createInteractionListener","addInteractionListener","startInterceptingKeyStrokes"],"mappings":"AAAA;;;;QAoCsBA,mBAAmB,GAAnBA,mBAAmB;AApCvB,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEO,IAAA,gBAAmB,WAAnB,mBAAmB,CAAA;AACM,IAAA,cAAiB,WAAjB,iBAAiB,CAAA;AAClC,IAAA,mBAAsB,WAAtB,sBAAsB,CAAA;AAClDC,IAAAA,GAAG,mCAAM,WAAW,EAAjB;AACmB,IAAA,OAAoB,WAApB,oBAAoB,CAAA;AACpB,IAAA,OAAoB,WAApB,oBAAoB,CAAA;AAClB,IAAA,IAAiB,WAAjB,iBAAiB,CAAA;AACN,IAAA,SAAsB,WAAtB,sBAAsB,CAAA;AACX,IAAA,QAAqB,WAArB,qBAAqB,CAAA;AACjC,IAAA,8BAA6C,WAA7C,6CAA6C,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAG3F,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,qCAAqC,CAAC,AAAsB,AAAC;AAE5F,MAAMC,MAAM,GAAG,MAAQ,AAAC;AACxB,MAAMC,MAAM,GAAG,MAAQ,AAAC;AACxB,MAAMC,MAAM,GAAG,IAAQ,AAAC;AAExB,MAAMC,iBAAiB,GAGnB;IACFC,OAAO,EAAE;QACPC,IAAI,EAAE,SAAS;QACfC,GAAG,EAAE,SAAS;QACdC,YAAY,EAAE,UAAU;KACzB;IACDC,GAAG,EAAE;QACHH,IAAI,EAAE,KAAK;QACXC,GAAG,EAAE,KAAK;QACVC,YAAY,EAAE,WAAW;KAC1B;CACF,AAAC;AAEK,eAAeX,mBAAmB,CACvCa,gBAAkC,EAClCC,OAAsD,EACtD;QAG4BD,IAAsC;IAFlE,MAA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ArDA,IAAkC,CAAEgD,iBAAiB,CAAC,SAAS,CAAC,CAAA,CAAC;wBACvEC,CAAAA,GAAAA,cAAS,AAAE,CAAA,UAAF,EAAE,CAAC;qBACb,CAAC,OAAOlB,KAAK,EAAO;wBACnB,IAAI,CAAC,CAACA,KAAK,YAAYmB,OAAiB,kBAAA,CAAC,EAAE;4BACzC9D,GAAG,CAAC+D,SAAS,CAACpB,KAAK,CAAC,CAAC;yBACtB;qBACF;oBACD,MAAM;iBACP;YACD,KAAK,GAAG;gBACN3C,GAAG,CAAC4C,KAAK,EAAE,CAAC;gBACZ,OAAO9B,OAAO,CAACO,kBAAkB,CAACF,YAAY,CAAC,CAAC;YAClD,KAAK,GAAG;gBACN,OAAOL,OAAO,CAAC2D,oBAAoB,EAAE,CAAC;YACxC,KAAK,GAAG;gBACN,OAAO3D,OAAO,CAAC4D,SAAS,EAAE,CAAC;YAC7B,KAAK,GAAG;gBACN1E,GAAG,CAACwD,GAAG,CAAC,CAAC,EAAEC,cAAG,IAAA,CAAC,sBAAsB,CAAC,CAAC,CAAC;gBACxC,OAAOkB,CAAAA,GAAAA,OAAiB,AAA8B,CAAA,kBAA9B,CAAC/D,gBAAgB,CAACgE,WAAW,CAAC,CAAC;SAC1D;KACF,AAAC;IAEF,MAAMC,eAAe,GAAG,IAAIC,gBAAe,gBAAA,CAACxD,YAAY,CAAC,AAAC;IAE1D,MAAMyD,QAAQ,GAAGF,eAAe,CAACG,yBAAyB,EAAE,AAAC;IAE7DC,CAAAA,GAAAA,QAAsB,AAAU,CAAA,uBAAV,CAACF,QAAQ,CAAC,CAAC;IAEjC,qBAAqB;IACrBF,eAAe,CAACK,2BAA2B,EAAE,CAAC;CAC/C"}
@@ -94,7 +94,7 @@ async function logEventAsync(event, properties = {}) {
94
94
  }
95
95
  const { userId , deviceId } = identifyData;
96
96
  const commonEventProperties = {
97
- source_version: "0.17.2",
97
+ source_version: "0.17.3",
98
98
  source: "expo"
99
99
  };
100
100
  const identity = {
@@ -135,7 +135,7 @@ function getContext() {
135
135
  },
136
136
  app: {
137
137
  name: "expo",
138
- version: "0.17.2"
138
+ version: "0.17.3"
139
139
  },
140
140
  ci: ciInfo.isCI ? {
141
141
  name: ciInfo.name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expo/cli",
3
- "version": "0.17.2",
3
+ "version": "0.17.3",
4
4
  "description": "The Expo CLI",
5
5
  "main": "build/bin/cli",
6
6
  "bin": {
@@ -167,5 +167,5 @@
167
167
  "tree-kill": "^1.2.2",
168
168
  "tsd": "^0.28.1"
169
169
  },
170
- "gitHead": "7fb94e3c0598d0e2d428184b16eec5ec67d80388"
170
+ "gitHead": "82b69cba5b2e967806ca03413c3277f1d53bff8d"
171
171
  }