@expo/cli 0.18.21 → 0.18.23
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 +1 -1
- package/build/src/start/platforms/android/adb.js +22 -5
- package/build/src/start/platforms/android/adb.js.map +1 -1
- package/build/src/start/platforms/android/promptAndroidDevice.js +40 -24
- package/build/src/start/platforms/android/promptAndroidDevice.js.map +1 -1
- package/build/src/start/server/metro/debugging/createHandlersFactory.js +4 -2
- package/build/src/start/server/metro/debugging/createHandlersFactory.js.map +1 -1
- package/build/src/start/server/metro/debugging/messageHandlers/PageReload.js.map +1 -1
- package/build/src/start/server/metro/debugging/messageHandlers/VscodeRuntimeEvaluate.js +54 -0
- package/build/src/start/server/metro/debugging/messageHandlers/VscodeRuntimeEvaluate.js.map +1 -0
- package/build/src/utils/telemetry/getContext.js +1 -1
- package/package.json +4 -4
package/build/bin/cli
CHANGED
|
@@ -187,16 +187,26 @@ async function getAttachedDevicesAsync() {
|
|
|
187
187
|
// authorized: ['FA8251A00719', 'device', 'usb:336592896X', 'product:walleye', 'model:Pixel_2', 'device:walleye', 'transport_id:4']
|
|
188
188
|
// emulator: ['emulator-5554', 'offline', 'transport_id:1']
|
|
189
189
|
const props = line.split(" ").filter(Boolean);
|
|
190
|
-
const isAuthorized = props[1] !== "unauthorized";
|
|
191
190
|
const type = line.includes("emulator") ? "emulator" : "device";
|
|
191
|
+
let connectionType;
|
|
192
|
+
if (type === "device" && line.includes("usb:")) {
|
|
193
|
+
connectionType = "USB";
|
|
194
|
+
} else if (type === "device" && line.includes("_adb-tls-connect.")) {
|
|
195
|
+
connectionType = "Network";
|
|
196
|
+
}
|
|
197
|
+
const isBooted = type === "emulator" || props[1] !== "offline";
|
|
198
|
+
const isAuthorized = connectionType === "Network" ? line.includes("model:") // Network connected devices show `model:<name>` when authorized
|
|
199
|
+
: props[1] !== "unauthorized";
|
|
192
200
|
return {
|
|
193
201
|
props,
|
|
194
202
|
type,
|
|
195
|
-
isAuthorized
|
|
203
|
+
isAuthorized,
|
|
204
|
+
isBooted,
|
|
205
|
+
connectionType
|
|
196
206
|
};
|
|
197
207
|
}).filter(({ props: [pid] })=>!!pid);
|
|
198
208
|
const devicePromises = attachedDevices.map(async (props)=>{
|
|
199
|
-
const { type , props: [pid, ...deviceInfo] , isAuthorized , } = props;
|
|
209
|
+
const { type , props: [pid, ...deviceInfo] , isAuthorized , isBooted , } = props;
|
|
200
210
|
let name = null;
|
|
201
211
|
if (type === "device") {
|
|
202
212
|
if (isAuthorized) {
|
|
@@ -219,12 +229,19 @@ async function getAttachedDevicesAsync() {
|
|
|
219
229
|
pid
|
|
220
230
|
})) != null ? ref : "";
|
|
221
231
|
}
|
|
222
|
-
return {
|
|
232
|
+
return props.connectionType ? {
|
|
233
|
+
pid,
|
|
234
|
+
name,
|
|
235
|
+
type,
|
|
236
|
+
isAuthorized,
|
|
237
|
+
isBooted,
|
|
238
|
+
connectionType: props.connectionType
|
|
239
|
+
} : {
|
|
223
240
|
pid,
|
|
224
241
|
name,
|
|
225
242
|
type,
|
|
226
243
|
isAuthorized,
|
|
227
|
-
isBooted
|
|
244
|
+
isBooted
|
|
228
245
|
};
|
|
229
246
|
});
|
|
230
247
|
return Promise.all(devicePromises);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/platforms/android/adb.ts"],"sourcesContent":["import chalk from 'chalk';\nimport os from 'os';\n\nimport { ADBServer } from './ADBServer';\nimport * as Log from '../../../log';\nimport { env } from '../../../utils/env';\nimport { CommandError } from '../../../utils/errors';\nimport { learnMore } from '../../../utils/link';\n\nconst debug = require('debug')('expo:start:platforms:android:adb') as typeof console.log;\n\nexport enum DeviceABI {\n // The arch specific android target platforms are soft-deprecated.\n // Instead of using TargetPlatform as a combination arch + platform\n // the code will be updated to carry arch information in [DarwinArch]\n // and [AndroidArch].\n arm = 'arm',\n arm64 = 'arm64',\n x64 = 'x64',\n x86 = 'x86',\n x8664 = 'x86_64',\n arm64v8a = 'arm64-v8a',\n armeabiV7a = 'armeabi-v7a',\n armeabi = 'armeabi',\n universal = 'universal',\n}\n\n/** Represents a connected Android device. */\nexport type Device = {\n /** Process ID. */\n pid?: string;\n /** Name of the device, also used as the ID for opening devices. */\n name: string;\n /** Is emulator or connected device. */\n type: 'emulator' | 'device';\n /** Is the device booted (emulator). */\n isBooted: boolean;\n /** Is device authorized for developing. https://expo.fyi/authorize-android-device */\n isAuthorized: boolean;\n};\n\ntype DeviceContext = Pick<Device, 'pid'>;\n\ntype DeviceProperties = Record<string, string>;\n\nconst CANT_START_ACTIVITY_ERROR = 'Activity not started, unable to resolve Intent';\n// http://developer.android.com/ndk/guides/abis.html\nconst PROP_CPU_NAME = 'ro.product.cpu.abi';\n\nconst PROP_CPU_ABI_LIST_NAME = 'ro.product.cpu.abilist';\n\n// Can sometimes be null\n// http://developer.android.com/ndk/guides/abis.html\nconst PROP_BOOT_ANIMATION_STATE = 'init.svc.bootanim';\n\nlet _server: ADBServer | null;\n\n/** Return the lazily loaded ADB server instance. */\nexport function getServer() {\n _server ??= new ADBServer();\n return _server;\n}\n\n/** Logs an FYI message about authorizing your device. */\nexport function logUnauthorized(device: Device) {\n Log.warn(\n `\\nThis computer is not authorized for developing on ${chalk.bold(device.name)}. ${chalk.dim(\n learnMore('https://expo.fyi/authorize-android-device')\n )}`\n );\n}\n\n/** Returns true if the provided package name is installed on the provided Android device. */\nexport async function isPackageInstalledAsync(\n device: DeviceContext,\n androidPackage: string\n): Promise<boolean> {\n const packages = await getServer().runAsync(\n adbArgs(\n device.pid,\n 'shell',\n 'pm',\n 'list',\n 'packages',\n '--user',\n env.EXPO_ADB_USER,\n androidPackage\n )\n );\n\n const lines = packages.split(/\\r?\\n/);\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i].trim();\n if (line === `package:${androidPackage}`) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * @param device.pid Process ID of the Android device to launch.\n * @param props.launchActivity Activity to launch `[application identifier]/.[main activity name]`, ex: `com.bacon.app/.MainActivity`\n */\nexport async function launchActivityAsync(\n device: DeviceContext,\n {\n launchActivity,\n }: {\n launchActivity: string;\n }\n) {\n return openAsync(\n adbArgs(\n device.pid,\n 'shell',\n 'am',\n 'start',\n // FLAG_ACTIVITY_SINGLE_TOP -- If set, the activity will not be launched if it is already running at the top of the history stack.\n '-f',\n '0x20000000',\n // Activity to open first: com.bacon.app/.MainActivity\n '-n',\n launchActivity\n )\n );\n}\n\n/**\n * @param device.pid Process ID of the Android device to launch.\n * @param props.applicationId package name to launch.\n */\nexport async function openAppIdAsync(\n device: DeviceContext,\n {\n applicationId,\n }: {\n applicationId: string;\n }\n) {\n return openAsync(\n adbArgs(\n device.pid,\n 'shell',\n 'monkey',\n '-p',\n applicationId,\n '-c',\n 'android.intent.category.LAUNCHER',\n '1'\n )\n );\n}\n\n/**\n * @param device.pid Process ID of the Android device to launch.\n * @param props.url URL to launch.\n */\nexport async function openUrlAsync(\n device: DeviceContext,\n {\n url,\n }: {\n url: string;\n }\n) {\n return openAsync(\n adbArgs(\n device.pid,\n 'shell',\n 'am',\n 'start',\n '-a',\n 'android.intent.action.VIEW',\n '-d',\n // ADB requires ampersands to be escaped.\n url.replace(/&/g, String.raw`\\&`)\n )\n );\n}\n\n/** Runs a generic command watches for common errors in order to throw with an expected code. */\nasync function openAsync(args: string[]): Promise<string> {\n const results = await getServer().runAsync(args);\n if (\n results.includes(CANT_START_ACTIVITY_ERROR) ||\n results.match(/Error: Activity class .* does not exist\\./g)\n ) {\n throw new CommandError('APP_NOT_INSTALLED', results.substring(results.indexOf('Error: ')));\n }\n return results;\n}\n\n/** Uninstall an app given its Android package name. */\nexport async function uninstallAsync(\n device: DeviceContext,\n { appId }: { appId: string }\n): Promise<string> {\n return await getServer().runAsync(\n adbArgs(device.pid, 'uninstall', '--user', env.EXPO_ADB_USER, appId)\n );\n}\n\n/** Get package info from an app based on its Android package name. */\nexport async function getPackageInfoAsync(\n device: DeviceContext,\n { appId }: { appId: string }\n): Promise<string> {\n return await getServer().runAsync(adbArgs(device.pid, 'shell', 'dumpsys', 'package', appId));\n}\n\n/** Install an app on a connected device. */\nexport async function installAsync(device: DeviceContext, { filePath }: { filePath: string }) {\n // TODO: Handle the `INSTALL_FAILED_INSUFFICIENT_STORAGE` error.\n return await getServer().runAsync(\n adbArgs(device.pid, 'install', '-r', '-d', '--user', env.EXPO_ADB_USER, filePath)\n );\n}\n\n/** Format ADB args with process ID. */\nexport function adbArgs(pid: Device['pid'], ...options: string[]): string[] {\n const args = [];\n if (pid) {\n args.push('-s', pid);\n }\n\n return args.concat(options);\n}\n\n// TODO: This is very expensive for some operations.\nexport async function getAttachedDevicesAsync(): Promise<Device[]> {\n const output = await getServer().runAsync(['devices', '-l']);\n\n const splitItems = output\n .trim()\n .replace(/\\n$/, '')\n .split(os.EOL)\n // Filter ADB trace logs from the output, e.g.\n // adb D 03-06 15:25:53 63677 4018815 adb_client.cpp:393] adb_query: host:devices-l\n // 03-04 12:29:44.557 16415 16415 D adb : commandline.cpp:1646 Using server socket: tcp:172.27.192.1:5037\n // 03-04 12:29:44.557 16415 16415 D adb : adb_client.cpp:160 _adb_connect: host:version\n .filter((line) => !line.match(/\\.cpp:[0-9]+/));\n\n // First line is `\"List of devices attached\"`, remove it\n // @ts-ignore: todo\n const attachedDevices: {\n props: string[];\n type: Device['type'];\n isAuthorized: Device['isAuthorized'];\n }[] = splitItems\n .slice(1, splitItems.length)\n .map((line) => {\n // unauthorized: ['FA8251A00719', 'unauthorized', 'usb:338690048X', 'transport_id:5']\n // authorized: ['FA8251A00719', 'device', 'usb:336592896X', 'product:walleye', 'model:Pixel_2', 'device:walleye', 'transport_id:4']\n // emulator: ['emulator-5554', 'offline', 'transport_id:1']\n const props = line.split(' ').filter(Boolean);\n\n const isAuthorized = props[1] !== 'unauthorized';\n const type = line.includes('emulator') ? 'emulator' : 'device';\n return { props, type, isAuthorized };\n })\n .filter(({ props: [pid] }) => !!pid);\n\n const devicePromises = attachedDevices.map<Promise<Device>>(async (props) => {\n const {\n type,\n props: [pid, ...deviceInfo],\n isAuthorized,\n } = props;\n\n let name: string | null = null;\n\n if (type === 'device') {\n if (isAuthorized) {\n // Possibly formatted like `model:Pixel_2`\n // Transform to `Pixel_2`\n const modelItem = deviceInfo.find((info) => info.includes('model:'));\n if (modelItem) {\n name = modelItem.replace('model:', '');\n }\n }\n // unauthorized devices don't have a name available to read\n if (!name) {\n // Device FA8251A00719\n name = `Device ${pid}`;\n }\n } else {\n // Given an emulator pid, get the emulator name which can be used to start the emulator later.\n name = (await getAdbNameForDeviceIdAsync({ pid })) ?? '';\n }\n\n return {\n pid,\n name,\n type,\n isAuthorized,\n isBooted: true,\n };\n });\n\n return Promise.all(devicePromises);\n}\n\n/**\n * Return the Emulator name for an emulator ID, this can be used to determine if an emulator is booted.\n *\n * @param device.pid a value like `emulator-5554` from `abd devices`\n */\nexport async function getAdbNameForDeviceIdAsync(device: DeviceContext): Promise<string | null> {\n const results = await getServer().runAsync(adbArgs(device.pid, 'emu', 'avd', 'name'));\n\n if (results.match(/could not connect to TCP port .*: Connection refused/)) {\n // Can also occur when the emulator does not exist.\n throw new CommandError('EMULATOR_NOT_FOUND', results);\n }\n\n return sanitizeAdbDeviceName(results) ?? null;\n}\n\nexport async function isDeviceBootedAsync({\n name,\n}: { name?: string } = {}): Promise<Device | null> {\n const devices = await getAttachedDevicesAsync();\n\n if (!name) {\n return devices[0] ?? null;\n }\n\n return devices.find((device) => device.name === name) ?? null;\n}\n\n/**\n * Returns true when a device's splash screen animation has stopped.\n * This can be used to detect when a device is fully booted and ready to use.\n *\n * @param pid\n */\nexport async function isBootAnimationCompleteAsync(pid?: string): Promise<boolean> {\n try {\n const props = await getPropertyDataForDeviceAsync({ pid }, PROP_BOOT_ANIMATION_STATE);\n return !!props[PROP_BOOT_ANIMATION_STATE].match(/stopped/);\n } catch {\n return false;\n }\n}\n\n/** Get a list of ABIs for the provided device. */\nexport async function getDeviceABIsAsync(\n device: Pick<Device, 'name' | 'pid'>\n): Promise<DeviceABI[]> {\n const cpuAbiList = (await getPropertyDataForDeviceAsync(device, PROP_CPU_ABI_LIST_NAME))[\n PROP_CPU_ABI_LIST_NAME\n ];\n\n if (cpuAbiList) {\n return cpuAbiList.trim().split(',') as DeviceABI[];\n }\n\n const abi = (await getPropertyDataForDeviceAsync(device, PROP_CPU_NAME))[\n PROP_CPU_NAME\n ] as DeviceABI;\n return [abi];\n}\n\nexport async function getPropertyDataForDeviceAsync(\n device: DeviceContext,\n prop?: string\n): Promise<DeviceProperties> {\n // @ts-ignore\n const propCommand = adbArgs(...[device.pid, 'shell', 'getprop', prop].filter(Boolean));\n try {\n // Prevent reading as UTF8.\n const results = await getServer().getFileOutputAsync(propCommand);\n // Like:\n // [wifi.direct.interface]: [p2p-dev-wlan0]\n // [wifi.interface]: [wlan0]\n\n if (prop) {\n debug(`Property data: (device pid: ${device.pid}, prop: ${prop}, data: ${results})`);\n return {\n [prop]: results,\n };\n }\n const props = parseAdbDeviceProperties(results);\n\n debug(`Parsed data:`, props);\n\n return props;\n } catch (error: any) {\n // TODO: Ensure error has message and not stderr\n throw new CommandError(`Failed to get properties for device (${device.pid}): ${error.message}`);\n }\n}\n\nfunction parseAdbDeviceProperties(devicePropertiesString: string) {\n const properties: DeviceProperties = {};\n const propertyExp = /\\[(.*?)\\]: \\[(.*?)\\]/gm;\n for (const match of devicePropertiesString.matchAll(propertyExp)) {\n properties[match[1]] = match[2];\n }\n return properties;\n}\n\n/**\n * Sanitize the ADB device name to only get the actual device name.\n * On Windows, we need to do \\r, \\n, and \\r\\n filtering to get the name.\n */\nexport function sanitizeAdbDeviceName(deviceName: string) {\n return deviceName\n .trim()\n .split(/[\\r\\n]+/)\n .shift();\n}\n"],"names":["getServer","logUnauthorized","isPackageInstalledAsync","launchActivityAsync","openAppIdAsync","openUrlAsync","uninstallAsync","getPackageInfoAsync","installAsync","adbArgs","getAttachedDevicesAsync","getAdbNameForDeviceIdAsync","isDeviceBootedAsync","isBootAnimationCompleteAsync","getDeviceABIsAsync","getPropertyDataForDeviceAsync","sanitizeAdbDeviceName","debug","require","DeviceABI","arm","arm64","x64","x86","x8664","arm64v8a","armeabiV7a","armeabi","universal","CANT_START_ACTIVITY_ERROR","PROP_CPU_NAME","PROP_CPU_ABI_LIST_NAME","PROP_BOOT_ANIMATION_STATE","_server","ADBServer","device","Log","warn","chalk","bold","name","dim","learnMore","androidPackage","packages","runAsync","pid","env","EXPO_ADB_USER","lines","split","i","length","line","trim","launchActivity","openAsync","applicationId","url","replace","String","raw","args","results","includes","match","CommandError","substring","indexOf","appId","filePath","options","push","concat","output","splitItems","os","EOL","filter","attachedDevices","slice","map","props","Boolean","isAuthorized","type","devicePromises","deviceInfo","modelItem","find","info","isBooted","Promise","all","devices","cpuAbiList","abi","prop","propCommand","getFileOutputAsync","parseAdbDeviceProperties","error","message","devicePropertiesString","properties","propertyExp","matchAll","deviceName","shift"],"mappings":"AAAA;;;;;;;;;;;;IA0DgBA,SAAS,MAATA,SAAS;IAMTC,eAAe,MAAfA,eAAe;IASTC,uBAAuB,MAAvBA,uBAAuB;IA+BvBC,mBAAmB,MAAnBA,mBAAmB;IA4BnBC,cAAc,MAAdA,cAAc;IA0BdC,YAAY,MAAZA,YAAY;IAoCZC,cAAc,MAAdA,cAAc;IAUdC,mBAAmB,MAAnBA,mBAAmB;IAQnBC,YAAY,MAAZA,YAAY;IAQlBC,OAAO,MAAPA,OAAO;IAUDC,uBAAuB,MAAvBA,uBAAuB;IA8EvBC,0BAA0B,MAA1BA,0BAA0B;IAW1BC,mBAAmB,MAAnBA,mBAAmB;IAkBnBC,4BAA4B,MAA5BA,4BAA4B;IAU5BC,kBAAkB,MAAlBA,kBAAkB;IAiBlBC,6BAA6B,MAA7BA,6BAA6B;IA2CnCC,qBAAqB,MAArBA,qBAAqB;;;8DAvZnB,OAAO;;;;;;;8DACV,IAAI;;;;;;2BAEO,aAAa;2DAClB,cAAc;qBACf,oBAAo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4B,EAAEkB,MAAM,CAACW,GAAG,CAAC,QAAQ,EAAEmD,IAAI,CAAC,QAAQ,EAAElC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;YACrF,OAAO;gBACL,CAACkC,IAAI,CAAC,EAAElC,OAAO;aAChB,CAAC;QACJ,CAAC;QACD,MAAMmB,KAAK,GAAGkB,wBAAwB,CAACrC,OAAO,CAAC,AAAC;QAEhD9C,KAAK,CAAC,CAAC,YAAY,CAAC,EAAEiE,KAAK,CAAC,CAAC;QAE7B,OAAOA,KAAK,CAAC;IACf,EAAE,OAAOmB,KAAK,EAAO;QACnB,gDAAgD;QAChD,MAAM,IAAInC,OAAY,aAAA,CAAC,CAAC,qCAAqC,EAAE/B,MAAM,CAACW,GAAG,CAAC,GAAG,EAAEuD,KAAK,CAACC,OAAO,CAAC,CAAC,CAAC,CAAC;IAClG,CAAC;AACH,CAAC;AAED,SAASF,wBAAwB,CAACG,sBAA8B,EAAE;IAChE,MAAMC,UAAU,GAAqB,EAAE,AAAC;IACxC,MAAMC,WAAW,2BAA2B,AAAC;IAC7C,KAAK,MAAMxC,KAAK,IAAIsC,sBAAsB,CAACG,QAAQ,CAACD,WAAW,CAAC,CAAE;QAChED,UAAU,CAACvC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAGA,KAAK,CAAC,CAAC,CAAC,CAAC;IAClC,CAAC;IACD,OAAOuC,UAAU,CAAC;AACpB,CAAC;AAMM,SAASxF,qBAAqB,CAAC2F,UAAkB,EAAE;IACxD,OAAOA,UAAU,CACdrD,IAAI,EAAE,CACNJ,KAAK,WAAW,CAChB0D,KAAK,EAAE,CAAC;AACb,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/platforms/android/adb.ts"],"sourcesContent":["import chalk from 'chalk';\nimport os from 'os';\n\nimport { ADBServer } from './ADBServer';\nimport * as Log from '../../../log';\nimport { env } from '../../../utils/env';\nimport { CommandError } from '../../../utils/errors';\nimport { learnMore } from '../../../utils/link';\n\nconst debug = require('debug')('expo:start:platforms:android:adb') as typeof console.log;\n\nexport enum DeviceABI {\n // The arch specific android target platforms are soft-deprecated.\n // Instead of using TargetPlatform as a combination arch + platform\n // the code will be updated to carry arch information in [DarwinArch]\n // and [AndroidArch].\n arm = 'arm',\n arm64 = 'arm64',\n x64 = 'x64',\n x86 = 'x86',\n x8664 = 'x86_64',\n arm64v8a = 'arm64-v8a',\n armeabiV7a = 'armeabi-v7a',\n armeabi = 'armeabi',\n universal = 'universal',\n}\n\n/** Represents a connected Android device. */\nexport type Device = {\n /** Process ID. */\n pid?: string;\n /** Name of the device, also used as the ID for opening devices. */\n name: string;\n /** Is emulator or connected device. */\n type: 'emulator' | 'device';\n /** Is the device booted (emulator). */\n isBooted: boolean;\n /** Is device authorized for developing. https://expo.fyi/authorize-android-device */\n isAuthorized: boolean;\n /** The connection type to ADB, only available when `type: device` */\n connectionType?: 'USB' | 'Network';\n};\n\ntype DeviceContext = Pick<Device, 'pid'>;\n\ntype DeviceProperties = Record<string, string>;\n\nconst CANT_START_ACTIVITY_ERROR = 'Activity not started, unable to resolve Intent';\n// http://developer.android.com/ndk/guides/abis.html\nconst PROP_CPU_NAME = 'ro.product.cpu.abi';\n\nconst PROP_CPU_ABI_LIST_NAME = 'ro.product.cpu.abilist';\n\n// Can sometimes be null\n// http://developer.android.com/ndk/guides/abis.html\nconst PROP_BOOT_ANIMATION_STATE = 'init.svc.bootanim';\n\nlet _server: ADBServer | null;\n\n/** Return the lazily loaded ADB server instance. */\nexport function getServer() {\n _server ??= new ADBServer();\n return _server;\n}\n\n/** Logs an FYI message about authorizing your device. */\nexport function logUnauthorized(device: Device) {\n Log.warn(\n `\\nThis computer is not authorized for developing on ${chalk.bold(device.name)}. ${chalk.dim(\n learnMore('https://expo.fyi/authorize-android-device')\n )}`\n );\n}\n\n/** Returns true if the provided package name is installed on the provided Android device. */\nexport async function isPackageInstalledAsync(\n device: DeviceContext,\n androidPackage: string\n): Promise<boolean> {\n const packages = await getServer().runAsync(\n adbArgs(\n device.pid,\n 'shell',\n 'pm',\n 'list',\n 'packages',\n '--user',\n env.EXPO_ADB_USER,\n androidPackage\n )\n );\n\n const lines = packages.split(/\\r?\\n/);\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i].trim();\n if (line === `package:${androidPackage}`) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * @param device.pid Process ID of the Android device to launch.\n * @param props.launchActivity Activity to launch `[application identifier]/.[main activity name]`, ex: `com.bacon.app/.MainActivity`\n */\nexport async function launchActivityAsync(\n device: DeviceContext,\n {\n launchActivity,\n }: {\n launchActivity: string;\n }\n) {\n return openAsync(\n adbArgs(\n device.pid,\n 'shell',\n 'am',\n 'start',\n // FLAG_ACTIVITY_SINGLE_TOP -- If set, the activity will not be launched if it is already running at the top of the history stack.\n '-f',\n '0x20000000',\n // Activity to open first: com.bacon.app/.MainActivity\n '-n',\n launchActivity\n )\n );\n}\n\n/**\n * @param device.pid Process ID of the Android device to launch.\n * @param props.applicationId package name to launch.\n */\nexport async function openAppIdAsync(\n device: DeviceContext,\n {\n applicationId,\n }: {\n applicationId: string;\n }\n) {\n return openAsync(\n adbArgs(\n device.pid,\n 'shell',\n 'monkey',\n '-p',\n applicationId,\n '-c',\n 'android.intent.category.LAUNCHER',\n '1'\n )\n );\n}\n\n/**\n * @param device.pid Process ID of the Android device to launch.\n * @param props.url URL to launch.\n */\nexport async function openUrlAsync(\n device: DeviceContext,\n {\n url,\n }: {\n url: string;\n }\n) {\n return openAsync(\n adbArgs(\n device.pid,\n 'shell',\n 'am',\n 'start',\n '-a',\n 'android.intent.action.VIEW',\n '-d',\n // ADB requires ampersands to be escaped.\n url.replace(/&/g, String.raw`\\&`)\n )\n );\n}\n\n/** Runs a generic command watches for common errors in order to throw with an expected code. */\nasync function openAsync(args: string[]): Promise<string> {\n const results = await getServer().runAsync(args);\n if (\n results.includes(CANT_START_ACTIVITY_ERROR) ||\n results.match(/Error: Activity class .* does not exist\\./g)\n ) {\n throw new CommandError('APP_NOT_INSTALLED', results.substring(results.indexOf('Error: ')));\n }\n return results;\n}\n\n/** Uninstall an app given its Android package name. */\nexport async function uninstallAsync(\n device: DeviceContext,\n { appId }: { appId: string }\n): Promise<string> {\n return await getServer().runAsync(\n adbArgs(device.pid, 'uninstall', '--user', env.EXPO_ADB_USER, appId)\n );\n}\n\n/** Get package info from an app based on its Android package name. */\nexport async function getPackageInfoAsync(\n device: DeviceContext,\n { appId }: { appId: string }\n): Promise<string> {\n return await getServer().runAsync(adbArgs(device.pid, 'shell', 'dumpsys', 'package', appId));\n}\n\n/** Install an app on a connected device. */\nexport async function installAsync(device: DeviceContext, { filePath }: { filePath: string }) {\n // TODO: Handle the `INSTALL_FAILED_INSUFFICIENT_STORAGE` error.\n return await getServer().runAsync(\n adbArgs(device.pid, 'install', '-r', '-d', '--user', env.EXPO_ADB_USER, filePath)\n );\n}\n\n/** Format ADB args with process ID. */\nexport function adbArgs(pid: Device['pid'], ...options: string[]): string[] {\n const args = [];\n if (pid) {\n args.push('-s', pid);\n }\n\n return args.concat(options);\n}\n\n// TODO: This is very expensive for some operations.\nexport async function getAttachedDevicesAsync(): Promise<Device[]> {\n const output = await getServer().runAsync(['devices', '-l']);\n\n const splitItems = output\n .trim()\n .replace(/\\n$/, '')\n .split(os.EOL)\n // Filter ADB trace logs from the output, e.g.\n // adb D 03-06 15:25:53 63677 4018815 adb_client.cpp:393] adb_query: host:devices-l\n // 03-04 12:29:44.557 16415 16415 D adb : commandline.cpp:1646 Using server socket: tcp:172.27.192.1:5037\n // 03-04 12:29:44.557 16415 16415 D adb : adb_client.cpp:160 _adb_connect: host:version\n .filter((line) => !line.match(/\\.cpp:[0-9]+/));\n\n // First line is `\"List of devices attached\"`, remove it\n // @ts-ignore: todo\n const attachedDevices: {\n props: string[];\n type: Device['type'];\n isAuthorized: Device['isAuthorized'];\n isBooted: Device['isBooted'];\n connectionType?: Device['connectionType'];\n }[] = splitItems\n .slice(1, splitItems.length)\n .map((line) => {\n // unauthorized: ['FA8251A00719', 'unauthorized', 'usb:338690048X', 'transport_id:5']\n // authorized: ['FA8251A00719', 'device', 'usb:336592896X', 'product:walleye', 'model:Pixel_2', 'device:walleye', 'transport_id:4']\n // emulator: ['emulator-5554', 'offline', 'transport_id:1']\n const props = line.split(' ').filter(Boolean);\n const type = line.includes('emulator') ? 'emulator' : 'device';\n\n let connectionType;\n if (type === 'device' && line.includes('usb:')) {\n connectionType = 'USB';\n } else if (type === 'device' && line.includes('_adb-tls-connect.')) {\n connectionType = 'Network';\n }\n\n const isBooted = type === 'emulator' || props[1] !== 'offline';\n const isAuthorized =\n connectionType === 'Network'\n ? line.includes('model:') // Network connected devices show `model:<name>` when authorized\n : props[1] !== 'unauthorized';\n\n return { props, type, isAuthorized, isBooted, connectionType };\n })\n .filter(({ props: [pid] }) => !!pid);\n\n const devicePromises = attachedDevices.map<Promise<Device>>(async (props) => {\n const {\n type,\n props: [pid, ...deviceInfo],\n isAuthorized,\n isBooted,\n } = props;\n\n let name: string | null = null;\n\n if (type === 'device') {\n if (isAuthorized) {\n // Possibly formatted like `model:Pixel_2`\n // Transform to `Pixel_2`\n const modelItem = deviceInfo.find((info) => info.includes('model:'));\n if (modelItem) {\n name = modelItem.replace('model:', '');\n }\n }\n // unauthorized devices don't have a name available to read\n if (!name) {\n // Device FA8251A00719\n name = `Device ${pid}`;\n }\n } else {\n // Given an emulator pid, get the emulator name which can be used to start the emulator later.\n name = (await getAdbNameForDeviceIdAsync({ pid })) ?? '';\n }\n\n return props.connectionType\n ? { pid, name, type, isAuthorized, isBooted, connectionType: props.connectionType }\n : { pid, name, type, isAuthorized, isBooted };\n });\n\n return Promise.all(devicePromises);\n}\n\n/**\n * Return the Emulator name for an emulator ID, this can be used to determine if an emulator is booted.\n *\n * @param device.pid a value like `emulator-5554` from `abd devices`\n */\nexport async function getAdbNameForDeviceIdAsync(device: DeviceContext): Promise<string | null> {\n const results = await getServer().runAsync(adbArgs(device.pid, 'emu', 'avd', 'name'));\n\n if (results.match(/could not connect to TCP port .*: Connection refused/)) {\n // Can also occur when the emulator does not exist.\n throw new CommandError('EMULATOR_NOT_FOUND', results);\n }\n\n return sanitizeAdbDeviceName(results) ?? null;\n}\n\nexport async function isDeviceBootedAsync({\n name,\n}: { name?: string } = {}): Promise<Device | null> {\n const devices = await getAttachedDevicesAsync();\n\n if (!name) {\n return devices[0] ?? null;\n }\n\n return devices.find((device) => device.name === name) ?? null;\n}\n\n/**\n * Returns true when a device's splash screen animation has stopped.\n * This can be used to detect when a device is fully booted and ready to use.\n *\n * @param pid\n */\nexport async function isBootAnimationCompleteAsync(pid?: string): Promise<boolean> {\n try {\n const props = await getPropertyDataForDeviceAsync({ pid }, PROP_BOOT_ANIMATION_STATE);\n return !!props[PROP_BOOT_ANIMATION_STATE].match(/stopped/);\n } catch {\n return false;\n }\n}\n\n/** Get a list of ABIs for the provided device. */\nexport async function getDeviceABIsAsync(\n device: Pick<Device, 'name' | 'pid'>\n): Promise<DeviceABI[]> {\n const cpuAbiList = (await getPropertyDataForDeviceAsync(device, PROP_CPU_ABI_LIST_NAME))[\n PROP_CPU_ABI_LIST_NAME\n ];\n\n if (cpuAbiList) {\n return cpuAbiList.trim().split(',') as DeviceABI[];\n }\n\n const abi = (await getPropertyDataForDeviceAsync(device, PROP_CPU_NAME))[\n PROP_CPU_NAME\n ] as DeviceABI;\n return [abi];\n}\n\nexport async function getPropertyDataForDeviceAsync(\n device: DeviceContext,\n prop?: string\n): Promise<DeviceProperties> {\n // @ts-ignore\n const propCommand = adbArgs(...[device.pid, 'shell', 'getprop', prop].filter(Boolean));\n try {\n // Prevent reading as UTF8.\n const results = await getServer().getFileOutputAsync(propCommand);\n // Like:\n // [wifi.direct.interface]: [p2p-dev-wlan0]\n // [wifi.interface]: [wlan0]\n\n if (prop) {\n debug(`Property data: (device pid: ${device.pid}, prop: ${prop}, data: ${results})`);\n return {\n [prop]: results,\n };\n }\n const props = parseAdbDeviceProperties(results);\n\n debug(`Parsed data:`, props);\n\n return props;\n } catch (error: any) {\n // TODO: Ensure error has message and not stderr\n throw new CommandError(`Failed to get properties for device (${device.pid}): ${error.message}`);\n }\n}\n\nfunction parseAdbDeviceProperties(devicePropertiesString: string) {\n const properties: DeviceProperties = {};\n const propertyExp = /\\[(.*?)\\]: \\[(.*?)\\]/gm;\n for (const match of devicePropertiesString.matchAll(propertyExp)) {\n properties[match[1]] = match[2];\n }\n return properties;\n}\n\n/**\n * Sanitize the ADB device name to only get the actual device name.\n * On Windows, we need to do \\r, \\n, and \\r\\n filtering to get the name.\n */\nexport function sanitizeAdbDeviceName(deviceName: string) {\n return deviceName\n .trim()\n .split(/[\\r\\n]+/)\n .shift();\n}\n"],"names":["getServer","logUnauthorized","isPackageInstalledAsync","launchActivityAsync","openAppIdAsync","openUrlAsync","uninstallAsync","getPackageInfoAsync","installAsync","adbArgs","getAttachedDevicesAsync","getAdbNameForDeviceIdAsync","isDeviceBootedAsync","isBootAnimationCompleteAsync","getDeviceABIsAsync","getPropertyDataForDeviceAsync","sanitizeAdbDeviceName","debug","require","DeviceABI","arm","arm64","x64","x86","x8664","arm64v8a","armeabiV7a","armeabi","universal","CANT_START_ACTIVITY_ERROR","PROP_CPU_NAME","PROP_CPU_ABI_LIST_NAME","PROP_BOOT_ANIMATION_STATE","_server","ADBServer","device","Log","warn","chalk","bold","name","dim","learnMore","androidPackage","packages","runAsync","pid","env","EXPO_ADB_USER","lines","split","i","length","line","trim","launchActivity","openAsync","applicationId","url","replace","String","raw","args","results","includes","match","CommandError","substring","indexOf","appId","filePath","options","push","concat","output","splitItems","os","EOL","filter","attachedDevices","slice","map","props","Boolean","type","connectionType","isBooted","isAuthorized","devicePromises","deviceInfo","modelItem","find","info","Promise","all","devices","cpuAbiList","abi","prop","propCommand","getFileOutputAsync","parseAdbDeviceProperties","error","message","devicePropertiesString","properties","propertyExp","matchAll","deviceName","shift"],"mappings":"AAAA;;;;;;;;;;;;IA4DgBA,SAAS,MAATA,SAAS;IAMTC,eAAe,MAAfA,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ACW,GAAG,CAAC,QAAQ,EAAEoD,IAAI,CAAC,QAAQ,EAAEnC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;YACrF,OAAO;gBACL,CAACmC,IAAI,CAAC,EAAEnC,OAAO;aAChB,CAAC;QACJ,CAAC;QACD,MAAMmB,KAAK,GAAGmB,wBAAwB,CAACtC,OAAO,CAAC,AAAC;QAEhD9C,KAAK,CAAC,CAAC,YAAY,CAAC,EAAEiE,KAAK,CAAC,CAAC;QAE7B,OAAOA,KAAK,CAAC;IACf,EAAE,OAAOoB,KAAK,EAAO;QACnB,gDAAgD;QAChD,MAAM,IAAIpC,OAAY,aAAA,CAAC,CAAC,qCAAqC,EAAE/B,MAAM,CAACW,GAAG,CAAC,GAAG,EAAEwD,KAAK,CAACC,OAAO,CAAC,CAAC,CAAC,CAAC;IAClG,CAAC;AACH,CAAC;AAED,SAASF,wBAAwB,CAACG,sBAA8B,EAAE;IAChE,MAAMC,UAAU,GAAqB,EAAE,AAAC;IACxC,MAAMC,WAAW,2BAA2B,AAAC;IAC7C,KAAK,MAAMzC,KAAK,IAAIuC,sBAAsB,CAACG,QAAQ,CAACD,WAAW,CAAC,CAAE;QAChED,UAAU,CAACxC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAGA,KAAK,CAAC,CAAC,CAAC,CAAC;IAClC,CAAC;IACD,OAAOwC,UAAU,CAAC;AACpB,CAAC;AAMM,SAASzF,qBAAqB,CAAC4F,UAAkB,EAAE;IACxD,OAAOA,UAAU,CACdtD,IAAI,EAAE,CACNJ,KAAK,WAAW,CAChB2D,KAAK,EAAE,CAAC;AACb,CAAC"}
|
|
@@ -2,9 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
promptForDeviceAsync: ()=>promptForDeviceAsync,
|
|
13
|
+
formatDeviceChoice: ()=>formatDeviceChoice
|
|
8
14
|
});
|
|
9
15
|
function _chalk() {
|
|
10
16
|
const data = /*#__PURE__*/ _interopRequireDefault(require("chalk"));
|
|
@@ -21,19 +27,6 @@ function _interopRequireDefault(obj) {
|
|
|
21
27
|
default: obj
|
|
22
28
|
};
|
|
23
29
|
}
|
|
24
|
-
function nameStyleForDevice(device) {
|
|
25
|
-
const isActive = device.isBooted;
|
|
26
|
-
if (!isActive) {
|
|
27
|
-
// Use no style changes for a disconnected device that is available to be opened.
|
|
28
|
-
return (text)=>text;
|
|
29
|
-
}
|
|
30
|
-
// A device that is connected and ready to be used should be bolded to match iOS.
|
|
31
|
-
if (device.isAuthorized) {
|
|
32
|
-
return _chalk().default.bold;
|
|
33
|
-
}
|
|
34
|
-
// Devices that are unauthorized and connected cannot be used, but they are connected so gray them out.
|
|
35
|
-
return (text)=>_chalk().default.bold(_chalk().default.gray(text));
|
|
36
|
-
}
|
|
37
30
|
async function promptForDeviceAsync(devices) {
|
|
38
31
|
// TODO: provide an option to add or download more simulators
|
|
39
32
|
const { value } = await (0, _prompts.promptAsync)({
|
|
@@ -41,14 +34,7 @@ async function promptForDeviceAsync(devices) {
|
|
|
41
34
|
name: "value",
|
|
42
35
|
limit: 11,
|
|
43
36
|
message: "Select a device/emulator",
|
|
44
|
-
choices: devices.map((item)=>
|
|
45
|
-
const format = nameStyleForDevice(item);
|
|
46
|
-
const type = item.isAuthorized ? item.type : "unauthorized";
|
|
47
|
-
return {
|
|
48
|
-
title: `${format(item.name)} ${_chalk().default.dim(`(${type})`)}`,
|
|
49
|
-
value: item.name
|
|
50
|
-
};
|
|
51
|
-
}),
|
|
37
|
+
choices: devices.map((item)=>formatDeviceChoice(item)),
|
|
52
38
|
suggest: (0, _prompts.createSelectionFilter)()
|
|
53
39
|
});
|
|
54
40
|
const device = devices.find(({ name })=>name === value);
|
|
@@ -58,5 +44,35 @@ async function promptForDeviceAsync(devices) {
|
|
|
58
44
|
}
|
|
59
45
|
return device;
|
|
60
46
|
}
|
|
47
|
+
function formatDeviceChoice(device) {
|
|
48
|
+
const symbol = getDeviceChoiceSymbol(device);
|
|
49
|
+
const name = getDeviceChoiceName(device);
|
|
50
|
+
const type = _chalk().default.dim(device.isAuthorized ? device.type : "unauthorized");
|
|
51
|
+
return {
|
|
52
|
+
value: device.name,
|
|
53
|
+
title: `${symbol}${name} (${type})`
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/** Get the styled symbol of the device, based on ADB connection type (usb vs network) */ function getDeviceChoiceSymbol(device) {
|
|
57
|
+
if (device.type === "device" && device.connectionType === "Network") {
|
|
58
|
+
return "\uD83C\uDF10 ";
|
|
59
|
+
}
|
|
60
|
+
if (device.type === "device") {
|
|
61
|
+
return "\uD83D\uDD0C ";
|
|
62
|
+
}
|
|
63
|
+
return "";
|
|
64
|
+
}
|
|
65
|
+
/** Get the styled name of the device, based on device state */ function getDeviceChoiceName(device) {
|
|
66
|
+
// Use no style changes for a disconnected device that is available to be opened.
|
|
67
|
+
if (!device.isBooted) {
|
|
68
|
+
return device.name;
|
|
69
|
+
}
|
|
70
|
+
// A device that is connected and ready to be used should be bolded to match iOS.
|
|
71
|
+
if (device.isAuthorized) {
|
|
72
|
+
return _chalk().default.bold(device.name);
|
|
73
|
+
}
|
|
74
|
+
// Devices that are unauthorized and connected cannot be used, but they are connected so gray them out.
|
|
75
|
+
return _chalk().default.bold(_chalk().default.gray(device.name));
|
|
76
|
+
}
|
|
61
77
|
|
|
62
78
|
//# sourceMappingURL=promptAndroidDevice.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/platforms/android/promptAndroidDevice.ts"],"sourcesContent":["import chalk from 'chalk';\n\nimport { Device, logUnauthorized } from './adb';\nimport { AbortCommandError } from '../../../utils/errors';\nimport { createSelectionFilter, promptAsync } from '../../../utils/prompts';\n\
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/platforms/android/promptAndroidDevice.ts"],"sourcesContent":["import chalk from 'chalk';\n\nimport { Device, logUnauthorized } from './adb';\nimport { AbortCommandError } from '../../../utils/errors';\nimport { createSelectionFilter, promptAsync } from '../../../utils/prompts';\n\nexport async function promptForDeviceAsync(devices: Device[]): Promise<Device> {\n // TODO: provide an option to add or download more simulators\n\n const { value } = await promptAsync({\n type: 'autocomplete',\n name: 'value',\n limit: 11,\n message: 'Select a device/emulator',\n choices: devices.map((item) => formatDeviceChoice(item)),\n suggest: createSelectionFilter(),\n });\n\n const device = devices.find(({ name }) => name === value);\n\n if (device?.isAuthorized === false) {\n logUnauthorized(device);\n throw new AbortCommandError();\n }\n\n return device!;\n}\n\n/**\n * Format the device for prompt list.\n * @internal - Exposed for testing.\n */\nexport function formatDeviceChoice(device: Device): { title: string; value: string } {\n const symbol = getDeviceChoiceSymbol(device);\n const name = getDeviceChoiceName(device);\n const type = chalk.dim(device.isAuthorized ? device.type : 'unauthorized');\n\n return {\n value: device.name,\n title: `${symbol}${name} (${type})`,\n };\n}\n\n/** Get the styled symbol of the device, based on ADB connection type (usb vs network) */\nfunction getDeviceChoiceSymbol(device: Device) {\n if (device.type === 'device' && device.connectionType === 'Network') {\n return '🌐 ';\n }\n\n if (device.type === 'device') {\n return '🔌 ';\n }\n\n return '';\n}\n\n/** Get the styled name of the device, based on device state */\nfunction getDeviceChoiceName(device: Device) {\n // Use no style changes for a disconnected device that is available to be opened.\n if (!device.isBooted) {\n return device.name;\n }\n\n // A device that is connected and ready to be used should be bolded to match iOS.\n if (device.isAuthorized) {\n return chalk.bold(device.name);\n }\n\n // Devices that are unauthorized and connected cannot be used, but they are connected so gray them out.\n return chalk.bold(chalk.gray(device.name));\n}\n"],"names":["promptForDeviceAsync","formatDeviceChoice","devices","value","promptAsync","type","name","limit","message","choices","map","item","suggest","createSelectionFilter","device","find","isAuthorized","logUnauthorized","AbortCommandError","symbol","getDeviceChoiceSymbol","getDeviceChoiceName","chalk","dim","title","connectionType","isBooted","bold","gray"],"mappings":"AAAA;;;;;;;;;;;IAMsBA,oBAAoB,MAApBA,oBAAoB;IA0B1BC,kBAAkB,MAAlBA,kBAAkB;;;8DAhChB,OAAO;;;;;;qBAEe,OAAO;wBACb,uBAAuB;yBACN,wBAAwB;;;;;;AAEpE,eAAeD,oBAAoB,CAACE,OAAiB,EAAmB;IAC7E,6DAA6D;IAE7D,MAAM,EAAEC,KAAK,CAAA,EAAE,GAAG,MAAMC,IAAAA,QAAW,YAAA,EAAC;QAClCC,IAAI,EAAE,cAAc;QACpBC,IAAI,EAAE,OAAO;QACbC,KAAK,EAAE,EAAE;QACTC,OAAO,EAAE,0BAA0B;QACnCC,OAAO,EAAEP,OAAO,CAACQ,GAAG,CAAC,CAACC,IAAI,GAAKV,kBAAkB,CAACU,IAAI,CAAC,CAAC;QACxDC,OAAO,EAAEC,IAAAA,QAAqB,sBAAA,GAAE;KACjC,CAAC,AAAC;IAEH,MAAMC,MAAM,GAAGZ,OAAO,CAACa,IAAI,CAAC,CAAC,EAAET,IAAI,CAAA,EAAE,GAAKA,IAAI,KAAKH,KAAK,CAAC,AAAC;IAE1D,IAAIW,CAAAA,MAAM,QAAc,GAApBA,KAAAA,CAAoB,GAApBA,MAAM,CAAEE,YAAY,CAAA,KAAK,KAAK,EAAE;QAClCC,IAAAA,IAAe,gBAAA,EAACH,MAAM,CAAC,CAAC;QACxB,MAAM,IAAII,OAAiB,kBAAA,EAAE,CAAC;IAChC,CAAC;IAED,OAAOJ,MAAM,CAAE;AACjB,CAAC;AAMM,SAASb,kBAAkB,CAACa,MAAc,EAAoC;IACnF,MAAMK,MAAM,GAAGC,qBAAqB,CAACN,MAAM,CAAC,AAAC;IAC7C,MAAMR,IAAI,GAAGe,mBAAmB,CAACP,MAAM,CAAC,AAAC;IACzC,MAAMT,IAAI,GAAGiB,MAAK,EAAA,QAAA,CAACC,GAAG,CAACT,MAAM,CAACE,YAAY,GAAGF,MAAM,CAACT,IAAI,GAAG,cAAc,CAAC,AAAC;IAE3E,OAAO;QACLF,KAAK,EAAEW,MAAM,CAACR,IAAI;QAClBkB,KAAK,EAAE,CAAC,EAAEL,MAAM,CAAC,EAAEb,IAAI,CAAC,EAAE,EAAED,IAAI,CAAC,CAAC,CAAC;KACpC,CAAC;AACJ,CAAC;AAED,uFAAuF,GACvF,SAASe,qBAAqB,CAACN,MAAc,EAAE;IAC7C,IAAIA,MAAM,CAACT,IAAI,KAAK,QAAQ,IAAIS,MAAM,CAACW,cAAc,KAAK,SAAS,EAAE;QACnE,OAAO,eAAI,CAAC;IACd,CAAC;IAED,IAAIX,MAAM,CAACT,IAAI,KAAK,QAAQ,EAAE;QAC5B,OAAO,eAAI,CAAC;IACd,CAAC;IAED,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,6DAA6D,GAC7D,SAASgB,mBAAmB,CAACP,MAAc,EAAE;IAC3C,iFAAiF;IACjF,IAAI,CAACA,MAAM,CAACY,QAAQ,EAAE;QACpB,OAAOZ,MAAM,CAACR,IAAI,CAAC;IACrB,CAAC;IAED,iFAAiF;IACjF,IAAIQ,MAAM,CAACE,YAAY,EAAE;QACvB,OAAOM,MAAK,EAAA,QAAA,CAACK,IAAI,CAACb,MAAM,CAACR,IAAI,CAAC,CAAC;IACjC,CAAC;IAED,uGAAuG;IACvG,OAAOgB,MAAK,EAAA,QAAA,CAACK,IAAI,CAACL,MAAK,EAAA,QAAA,CAACM,IAAI,CAACd,MAAM,CAACR,IAAI,CAAC,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -11,6 +11,7 @@ const _pageReload = require("./messageHandlers/PageReload");
|
|
|
11
11
|
const _vscodeDebuggerGetPossibleBreakpoints = require("./messageHandlers/VscodeDebuggerGetPossibleBreakpoints");
|
|
12
12
|
const _vscodeDebuggerSetBreakpointByUrl = require("./messageHandlers/VscodeDebuggerSetBreakpointByUrl");
|
|
13
13
|
const _vscodeRuntimeCallFunctionOn = require("./messageHandlers/VscodeRuntimeCallFunctionOn");
|
|
14
|
+
const _vscodeRuntimeEvaluate = require("./messageHandlers/VscodeRuntimeEvaluate");
|
|
14
15
|
const _vscodeRuntimeGetProperties = require("./messageHandlers/VscodeRuntimeGetProperties");
|
|
15
16
|
const _pageIsSupported = require("./pageIsSupported");
|
|
16
17
|
const debug = require("debug")("expo:metro:debugging:messageHandlers");
|
|
@@ -29,7 +30,8 @@ function createHandlersFactory(metroBundler) {
|
|
|
29
30
|
new _vscodeDebuggerGetPossibleBreakpoints.VscodeDebuggerGetPossibleBreakpointsHandler(connection),
|
|
30
31
|
new _vscodeDebuggerSetBreakpointByUrl.VscodeDebuggerSetBreakpointByUrlHandler(connection),
|
|
31
32
|
new _vscodeRuntimeGetProperties.VscodeRuntimeGetPropertiesHandler(connection),
|
|
32
|
-
new _vscodeRuntimeCallFunctionOn.VscodeRuntimeCallFunctionOnHandler(connection),
|
|
33
|
+
new _vscodeRuntimeCallFunctionOn.VscodeRuntimeCallFunctionOnHandler(connection),
|
|
34
|
+
new _vscodeRuntimeEvaluate.VscodeRuntimeEvaluateHandler(connection),
|
|
33
35
|
].filter((middleware)=>middleware.isEnabled());
|
|
34
36
|
if (!handlers.length) {
|
|
35
37
|
debug("Aborted, all handlers are disabled");
|
|
@@ -43,7 +45,7 @@ function createHandlersFactory(metroBundler) {
|
|
|
43
45
|
}));
|
|
44
46
|
},
|
|
45
47
|
handleDebuggerMessage: (message)=>{
|
|
46
|
-
withMessageDebug("debugger", message, handlers.some((middleware)=>{
|
|
48
|
+
return withMessageDebug("debugger", message, handlers.some((middleware)=>{
|
|
47
49
|
return middleware.handleDebuggerMessage == null ? void 0 : middleware.handleDebuggerMessage(message);
|
|
48
50
|
}));
|
|
49
51
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/start/server/metro/debugging/createHandlersFactory.ts"],"sourcesContent":["import type { CreateCustomMessageHandlerFn } from '@react-native/dev-middleware';\n\nimport { NetworkResponseHandler } from './messageHandlers/NetworkResponse';\nimport { PageReloadHandler } from './messageHandlers/PageReload';\nimport { VscodeDebuggerGetPossibleBreakpointsHandler } from './messageHandlers/VscodeDebuggerGetPossibleBreakpoints';\nimport { VscodeDebuggerSetBreakpointByUrlHandler } from './messageHandlers/VscodeDebuggerSetBreakpointByUrl';\nimport { VscodeRuntimeCallFunctionOnHandler } from './messageHandlers/VscodeRuntimeCallFunctionOn';\nimport { VscodeRuntimeGetPropertiesHandler } from './messageHandlers/VscodeRuntimeGetProperties';\nimport { pageIsSupported } from './pageIsSupported';\nimport type { MetroBundlerDevServer } from '../MetroBundlerDevServer';\n\nconst debug = require('debug')('expo:metro:debugging:messageHandlers') as typeof console.log;\n\nexport function createHandlersFactory(\n metroBundler: MetroBundlerDevServer
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/start/server/metro/debugging/createHandlersFactory.ts"],"sourcesContent":["import type { CreateCustomMessageHandlerFn } from '@react-native/dev-middleware';\n\nimport { NetworkResponseHandler } from './messageHandlers/NetworkResponse';\nimport { PageReloadHandler } from './messageHandlers/PageReload';\nimport { VscodeDebuggerGetPossibleBreakpointsHandler } from './messageHandlers/VscodeDebuggerGetPossibleBreakpoints';\nimport { VscodeDebuggerSetBreakpointByUrlHandler } from './messageHandlers/VscodeDebuggerSetBreakpointByUrl';\nimport { VscodeRuntimeCallFunctionOnHandler } from './messageHandlers/VscodeRuntimeCallFunctionOn';\nimport { VscodeRuntimeEvaluateHandler } from './messageHandlers/VscodeRuntimeEvaluate';\nimport { VscodeRuntimeGetPropertiesHandler } from './messageHandlers/VscodeRuntimeGetProperties';\nimport { pageIsSupported } from './pageIsSupported';\nimport type { MetroBundlerDevServer } from '../MetroBundlerDevServer';\n\nconst debug = require('debug')('expo:metro:debugging:messageHandlers') as typeof console.log;\n\nexport function createHandlersFactory(\n metroBundler: Pick<MetroBundlerDevServer, 'broadcastMessage'>\n): CreateCustomMessageHandlerFn {\n return (connection) => {\n debug('Initializing for connection: ', connection.page.title);\n\n if (!pageIsSupported(connection.page)) {\n debug('Aborted, unsupported page capabiltiies:', connection.page.capabilities);\n return null;\n }\n\n const handlers = [\n // Generic handlers\n new NetworkResponseHandler(connection),\n new PageReloadHandler(connection, metroBundler),\n // Vscode-specific handlers\n new VscodeDebuggerGetPossibleBreakpointsHandler(connection),\n new VscodeDebuggerSetBreakpointByUrlHandler(connection),\n new VscodeRuntimeGetPropertiesHandler(connection),\n new VscodeRuntimeCallFunctionOnHandler(connection),\n new VscodeRuntimeEvaluateHandler(connection),\n ].filter((middleware) => middleware.isEnabled());\n\n if (!handlers.length) {\n debug('Aborted, all handlers are disabled');\n return null;\n }\n\n debug(\n 'Initialized with handlers: ',\n handlers.map((middleware) => middleware.constructor.name).join(', ')\n );\n\n return {\n handleDeviceMessage: (message: any) =>\n withMessageDebug(\n 'device',\n message,\n handlers.some((middleware) => middleware.handleDeviceMessage?.(message))\n ),\n handleDebuggerMessage: (message: any) =>\n withMessageDebug(\n 'debugger',\n message,\n handlers.some((middleware) => middleware.handleDebuggerMessage?.(message))\n ),\n };\n };\n}\n\nfunction withMessageDebug(type: 'device' | 'debugger', message: any, result?: null | boolean) {\n const status = result ? 'handled' : 'ignored';\n const prefix = type === 'device' ? '(debugger) <- (device)' : '(debugger) -> (device)';\n\n try {\n debug(`%s = %s:`, prefix, status, JSON.stringify(message));\n } catch {\n debug(`%s = %s:`, prefix, status, 'message not serializable');\n }\n\n return result || undefined;\n}\n"],"names":["createHandlersFactory","debug","require","metroBundler","connection","page","title","pageIsSupported","capabilities","handlers","NetworkResponseHandler","PageReloadHandler","VscodeDebuggerGetPossibleBreakpointsHandler","VscodeDebuggerSetBreakpointByUrlHandler","VscodeRuntimeGetPropertiesHandler","VscodeRuntimeCallFunctionOnHandler","VscodeRuntimeEvaluateHandler","filter","middleware","isEnabled","length","map","constructor","name","join","handleDeviceMessage","message","withMessageDebug","some","handleDebugg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AChE,CAAC;IAED,OAAOD,MAAM,IAAIK,SAAS,CAAC;AAC7B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../src/start/server/metro/debugging/messageHandlers/PageReload.ts"],"sourcesContent":["import type { Protocol } from 'devtools-protocol';\n\nimport type { MetroBundlerDevServer } from '../../MetroBundlerDevServer';\nimport { MessageHandler } from '../MessageHandler';\nimport type { CdpMessage, Connection, DebuggerRequest } from '../types';\n\nexport class PageReloadHandler extends MessageHandler {\n private metroBundler: MetroBundlerDevServer
|
|
1
|
+
{"version":3,"sources":["../../../../../../../src/start/server/metro/debugging/messageHandlers/PageReload.ts"],"sourcesContent":["import type { Protocol } from 'devtools-protocol';\n\nimport type { MetroBundlerDevServer } from '../../MetroBundlerDevServer';\nimport { MessageHandler } from '../MessageHandler';\nimport type { CdpMessage, Connection, DebuggerRequest } from '../types';\n\nexport class PageReloadHandler extends MessageHandler {\n private metroBundler: Pick<MetroBundlerDevServer, 'broadcastMessage'>;\n\n constructor(\n connection: Connection,\n metroBundler: Pick<MetroBundlerDevServer, 'broadcastMessage'>\n ) {\n super(connection);\n this.metroBundler = metroBundler;\n }\n\n handleDebuggerMessage(message: DebuggerRequest<PageReload>) {\n if (message.method === 'Page.reload') {\n this.metroBundler.broadcastMessage('reload');\n return this.sendToDebugger({ id: message.id });\n }\n\n return false;\n }\n}\n\n/** @see https://chromedevtools.github.io/devtools-protocol/1-2/Page/#method-reload */\nexport type PageReload = CdpMessage<'Page.reload', Protocol.Page.ReloadRequest, never>;\n"],"names":["PageReloadHandler","MessageHandler","constructor","connection","metroBundler","handleDebuggerMessage","message","method","broadcastMessage","sendToDebugger","id"],"mappings":"AAAA;;;;+BAMaA,mBAAiB;;aAAjBA,iBAAiB;;gCAHC,mBAAmB;AAG3C,MAAMA,iBAAiB,SAASC,eAAc,eAAA;IAGnDC,YACEC,UAAsB,EACtBC,YAA6D,CAC7D;QACA,KAAK,CAACD,UAAU,CAAC,CAAC;QAClB,IAAI,CAACC,YAAY,GAAGA,YAAY,CAAC;IACnC;IAEAC,qBAAqB,CAACC,OAAoC,EAAE;QAC1D,IAAIA,OAAO,CAACC,MAAM,KAAK,aAAa,EAAE;YACpC,IAAI,CAACH,YAAY,CAACI,gBAAgB,CAAC,QAAQ,CAAC,CAAC;YAC7C,OAAO,IAAI,CAACC,cAAc,CAAC;gBAAEC,EAAE,EAAEJ,OAAO,CAACI,EAAE;aAAE,CAAC,CAAC;QACjD,CAAC;QAED,OAAO,KAAK,CAAC;IACf;CACD"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "VscodeRuntimeEvaluateHandler", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>VscodeRuntimeEvaluateHandler
|
|
8
|
+
});
|
|
9
|
+
const _messageHandler = require("../MessageHandler");
|
|
10
|
+
const _getDebuggerType = require("../getDebuggerType");
|
|
11
|
+
class VscodeRuntimeEvaluateHandler extends _messageHandler.MessageHandler {
|
|
12
|
+
isEnabled() {
|
|
13
|
+
return (0, _getDebuggerType.getDebuggerType)(this.debugger.userAgent) === "vscode";
|
|
14
|
+
}
|
|
15
|
+
handleDebuggerMessage(message) {
|
|
16
|
+
if (message.method === "Runtime.evaluate" && isVscodeNodeAttachEnvironmentInjection(message)) {
|
|
17
|
+
return this.sendToDebugger({
|
|
18
|
+
id: message.id,
|
|
19
|
+
result: {
|
|
20
|
+
result: {
|
|
21
|
+
type: "string",
|
|
22
|
+
value: `Hermes doesn't support environment variables through process.env`
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
if (message.method === "Runtime.evaluate" && isVscodeNodeTelemetry(message)) {
|
|
28
|
+
return this.sendToDebugger({
|
|
29
|
+
id: message.id,
|
|
30
|
+
result: {
|
|
31
|
+
result: {
|
|
32
|
+
type: "object",
|
|
33
|
+
value: {
|
|
34
|
+
processId: this.page.id,
|
|
35
|
+
nodeVersion: process.version,
|
|
36
|
+
architecture: process.arch
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/** @see https://github.com/microsoft/vscode-js-debug/blob/1d104b5184736677ab5cc280c70bbd227403850c/src/targets/node/nodeAttacherBase.ts#L22-L54 */ function isVscodeNodeAttachEnvironmentInjection(message) {
|
|
46
|
+
var ref, ref1, ref2;
|
|
47
|
+
return ((ref = message.params) == null ? void 0 : ref.expression.includes(`typeof process==='undefined'`)) && ((ref1 = message.params) == null ? void 0 : ref1.expression.includes(`'process not defined'`)) && ((ref2 = message.params) == null ? void 0 : ref2.expression.includes(`process.env["NODE_OPTIONS"]`));
|
|
48
|
+
}
|
|
49
|
+
/** @see https://github.com/microsoft/vscode-js-debug/blob/1d104b5184736677ab5cc280c70bbd227403850c/src/targets/node/nodeLauncherBase.ts#L523-L531 */ function isVscodeNodeTelemetry(message) {
|
|
50
|
+
var ref, ref1, ref2, ref3, ref4;
|
|
51
|
+
return ((ref = message.params) == null ? void 0 : ref.expression.includes(`typeof process === 'undefined'`)) && ((ref1 = message.params) == null ? void 0 : ref1.expression.includes(`'process not defined'`)) && ((ref2 = message.params) == null ? void 0 : ref2.expression.includes(`process.pid`)) && ((ref3 = message.params) == null ? void 0 : ref3.expression.includes(`process.version`)) && ((ref4 = message.params) == null ? void 0 : ref4.expression.includes(`process.arch`));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
//# sourceMappingURL=VscodeRuntimeEvaluate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../src/start/server/metro/debugging/messageHandlers/VscodeRuntimeEvaluate.ts"],"sourcesContent":["import type Protocol from 'devtools-protocol';\n\nimport { MessageHandler } from '../MessageHandler';\nimport { getDebuggerType } from '../getDebuggerType';\nimport type { CdpMessage, DebuggerRequest, DeviceResponse } from '../types';\n\n/**\n * Vscode is trying to inject a script to configure Node environment variables.\n * This won't work in Hermes, but vscode will retry this 200x.\n * Avoid sending this \"spam\" to the device.\n *\n * @see https://github.com/microsoft/vscode-js-debug/blob/1d104b5184736677ab5cc280c70bbd227403850c/src/targets/node/nodeAttacherBase.ts#L22-L54\n */\nexport class VscodeRuntimeEvaluateHandler extends MessageHandler {\n isEnabled() {\n return getDebuggerType(this.debugger.userAgent) === 'vscode';\n }\n\n handleDebuggerMessage(message: DebuggerRequest<RuntimeEvaluate>) {\n if (message.method === 'Runtime.evaluate' && isVscodeNodeAttachEnvironmentInjection(message)) {\n return this.sendToDebugger<DeviceResponse<RuntimeEvaluate>>({\n id: message.id,\n result: {\n result: {\n type: 'string',\n value: `Hermes doesn't support environment variables through process.env`,\n },\n },\n });\n }\n\n if (message.method === 'Runtime.evaluate' && isVscodeNodeTelemetry(message)) {\n return this.sendToDebugger<DeviceResponse<RuntimeEvaluate>>({\n id: message.id,\n result: {\n result: {\n type: 'object',\n value: {\n processId: this.page.id,\n nodeVersion: process.version,\n architecture: process.arch,\n },\n },\n },\n });\n }\n\n return false;\n }\n}\n\n/** @see https://chromedevtools.github.io/devtools-protocol/v8/Runtime/#method-evaluate */\nexport type RuntimeEvaluate = CdpMessage<\n 'Runtime.evaluate',\n Protocol.Runtime.EvaluateRequest,\n Protocol.Runtime.EvaluateResponse\n>;\n\n/** @see https://github.com/microsoft/vscode-js-debug/blob/1d104b5184736677ab5cc280c70bbd227403850c/src/targets/node/nodeAttacherBase.ts#L22-L54 */\nfunction isVscodeNodeAttachEnvironmentInjection(message: DebuggerRequest<RuntimeEvaluate>) {\n return (\n message.params?.expression.includes(`typeof process==='undefined'`) &&\n message.params?.expression.includes(`'process not defined'`) &&\n message.params?.expression.includes(`process.env[\"NODE_OPTIONS\"]`)\n );\n}\n\n/** @see https://github.com/microsoft/vscode-js-debug/blob/1d104b5184736677ab5cc280c70bbd227403850c/src/targets/node/nodeLauncherBase.ts#L523-L531 */\nfunction isVscodeNodeTelemetry(message: DebuggerRequest<RuntimeEvaluate>) {\n return (\n message.params?.expression.includes(`typeof process === 'undefined'`) &&\n message.params?.expression.includes(`'process not defined'`) &&\n message.params?.expression.includes(`process.pid`) &&\n message.params?.expression.includes(`process.version`) &&\n message.params?.expression.includes(`process.arch`)\n );\n}\n"],"names":["VscodeRuntimeEvaluateHandler","MessageHandler","isEnabled","getDebuggerType","debugger","userAgent","handleDebuggerMessage","message","method","isVscodeNodeAttachEnvironmentInjection","sendToDebugger","id","result","type","value","isVscodeNodeTelemetry","processId","page","nodeVersion","process","version","architecture","arch","params","expression","includes"],"mappings":"AAAA;;;;+BAaaA,8BAA4B;;aAA5BA,4BAA4B;;gCAXV,mBAAmB;iCAClB,oBAAoB;AAU7C,MAAMA,4BAA4B,SAASC,eAAc,eAAA;IAC9DC,SAAS,GAAG;QACV,OAAOC,IAAAA,gBAAe,gBAAA,EAAC,IAAI,CAACC,QAAQ,CAACC,SAAS,CAAC,KAAK,QAAQ,CAAC;IAC/D;IAEAC,qBAAqB,CAACC,OAAyC,EAAE;QAC/D,IAAIA,OAAO,CAACC,MAAM,KAAK,kBAAkB,IAAIC,sCAAsC,CAACF,OAAO,CAAC,EAAE;YAC5F,OAAO,IAAI,CAACG,cAAc,CAAkC;gBAC1DC,EAAE,EAAEJ,OAAO,CAACI,EAAE;gBACdC,MAAM,EAAE;oBACNA,MAAM,EAAE;wBACNC,IAAI,EAAE,QAAQ;wBACdC,KAAK,EAAE,CAAC,gEAAgE,CAAC;qBAC1E;iBACF;aACF,CAAC,CAAC;QACL,CAAC;QAED,IAAIP,OAAO,CAACC,MAAM,KAAK,kBAAkB,IAAIO,qBAAqB,CAACR,OAAO,CAAC,EAAE;YAC3E,OAAO,IAAI,CAACG,cAAc,CAAkC;gBAC1DC,EAAE,EAAEJ,OAAO,CAACI,EAAE;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OAAO,CAACgB,MAAM,SAAY,GAA1BhB,KAAAA,CAA0B,GAA1BA,IAAc,CAAEiB,UAAU,CAACC,QAAQ,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAA,IAC5DlB,CAAAA,CAAAA,IAAc,GAAdA,OAAO,CAACgB,MAAM,SAAY,GAA1BhB,KAAAA,CAA0B,GAA1BA,IAAc,CAAEiB,UAAU,CAACC,QAAQ,CAAC,CAAC,WAAW,CAAC,CAAC,CAAA,IAClDlB,CAAAA,CAAAA,IAAc,GAAdA,OAAO,CAACgB,MAAM,SAAY,GAA1BhB,KAAAA,CAA0B,GAA1BA,IAAc,CAAEiB,UAAU,CAACC,QAAQ,CAAC,CAAC,eAAe,CAAC,CAAC,CAAA,IACtDlB,CAAAA,CAAAA,IAAc,GAAdA,OAAO,CAACgB,MAAM,SAAY,GAA1BhB,KAAAA,CAA0B,GAA1BA,IAAc,CAAEiB,UAAU,CAACC,QAAQ,CAAC,CAAC,YAAY,CAAC,CAAC,CAAA,CACnD;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/cli",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.23",
|
|
4
4
|
"description": "The Expo CLI",
|
|
5
5
|
"main": "build/bin/cli",
|
|
6
6
|
"bin": {
|
|
@@ -50,11 +50,11 @@
|
|
|
50
50
|
"@expo/osascript": "^2.0.31",
|
|
51
51
|
"@expo/package-manager": "^1.5.0",
|
|
52
52
|
"@expo/plist": "^0.1.0",
|
|
53
|
-
"@expo/prebuild-config": "7.0.
|
|
53
|
+
"@expo/prebuild-config": "7.0.7",
|
|
54
54
|
"@expo/rudder-sdk-node": "1.1.1",
|
|
55
55
|
"@expo/spawn-async": "^1.7.2",
|
|
56
56
|
"@expo/xcpretty": "^4.3.0",
|
|
57
|
-
"@react-native/dev-middleware": "0.74.
|
|
57
|
+
"@react-native/dev-middleware": "0.74.85",
|
|
58
58
|
"@urql/core": "2.3.6",
|
|
59
59
|
"@urql/exchange-retry": "0.3.0",
|
|
60
60
|
"accepts": "^1.3.8",
|
|
@@ -172,5 +172,5 @@
|
|
|
172
172
|
"tree-kill": "^1.2.2",
|
|
173
173
|
"tsd": "^0.28.1"
|
|
174
174
|
},
|
|
175
|
-
"gitHead": "
|
|
175
|
+
"gitHead": "f83423bebc947ad7e328daaa56b2e327912ae580"
|
|
176
176
|
}
|