@expo/cli 56.1.21 → 56.1.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 CHANGED
@@ -139,7 +139,7 @@ const args = (0, _arg().default)({
139
139
  });
140
140
  if (args['--version']) {
141
141
  // Version is added in the build script.
142
- console.log("56.1.21");
142
+ console.log("56.1.23");
143
143
  process.exit(0);
144
144
  }
145
145
  if (args['--non-interactive']) {
@@ -76,7 +76,7 @@ function getInitMetadata() {
76
76
  return {
77
77
  format: 'v0-jsonl',
78
78
  // Version is added in the build script.
79
- version: "56.1.21" ?? 'UNVERSIONED'
79
+ version: "56.1.23" ?? 'UNVERSIONED'
80
80
  };
81
81
  }
82
82
  function getWellKnownTemporaryLogFile(projectRoot, command) {
@@ -185,12 +185,16 @@ async function getConnectedAppleDevicesAsync() {
185
185
  const devicesJson = await _jsonfile().default.readAsync(tmpPath);
186
186
  if (![
187
187
  2,
188
- 3
188
+ 3,
189
+ 5
189
190
  ].includes(devicesJson == null ? void 0 : (_devicesJson_info = devicesJson.info) == null ? void 0 : _devicesJson_info.jsonVersion)) {
190
191
  _log.warn('Unexpected devicectl JSON version output from devicectl. Connecting to physical Apple devices may not work as expected.');
191
192
  }
192
193
  assertDevicesJson(devicesJson);
193
- return devicesJson.result.devices;
194
+ return devicesJson.result.devices.filter((device)=>{
195
+ var _device_hardwareProperties;
196
+ return (device == null ? void 0 : (_device_hardwareProperties = device.hardwareProperties) == null ? void 0 : _device_hardwareProperties.reality) !== 'simulated';
197
+ });
194
198
  }
195
199
  function assertDevicesJson(results) {
196
200
  var _results_result;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/start/platforms/ios/devicectl.ts"],"sourcesContent":["/**\n * Copyright © 2024 650 Industries.\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\nimport JsonFile from '@expo/json-file';\nimport type { SpawnOptions, SpawnResult } from '@expo/spawn-async';\nimport spawnAsync from '@expo/spawn-async';\nimport chalk from 'chalk';\nimport { spawn, execSync } from 'child_process';\nimport fs from 'fs';\nimport assert from 'node:assert';\nimport type { Ora } from 'ora';\nimport { EOL } from 'os';\nimport path from 'path';\n\nimport { xcrunAsync } from './xcrun';\nimport { getExpoHomeDirectory } from '../../../api/user/UserSettings';\nimport * as Log from '../../../log';\nimport { createTempFilePath } from '../../../utils/createTempPath';\nimport { CommandError } from '../../../utils/errors';\nimport { installExitHooks } from '../../../utils/exit';\nimport { isInteractive } from '../../../utils/interactive';\nimport { ora } from '../../../utils/ora';\nimport { confirmAsync } from '../../../utils/prompts';\n\nconst DEVICE_CTL_EXISTS_PATH = path.join(getExpoHomeDirectory(), 'devicectl-exists');\n\nconst debug = require('debug')('expo:devicectl') as typeof console.log;\n\ntype AnyEnum<T extends string = string> = T | (string & object);\n\ntype DeviceCtlDevice = {\n capabilities: DeviceCtlDeviceCapability[];\n connectionProperties: DeviceCtlConnectionProperties;\n deviceProperties: DeviceCtlDeviceProperties;\n hardwareProperties: DeviceCtlHardwareProperties;\n /** \"A1A1AAA1-0011-1AA1-11A1-10A1111AA11A\" */\n identifier: string;\n visibilityClass: AnyEnum<'default'>;\n};\n\ntype DeviceCtlHardwareProperties = {\n cpuType: DeviceCtlCpuType;\n deviceType: AnyEnum<'iPhone'>;\n /** 1114404411111111 */\n ecid: number;\n /** \"D74AP\" */\n hardwareModel: string;\n /** 512000000000 */\n internalStorageCapacity: number;\n /** true */\n isProductionFused: boolean;\n /** \"iPhone 14 Pro Max\" */\n marketingName: string;\n /** \"iOS\" */\n platform: AnyEnum<'iOS' | 'xrOS'>;\n /** \"iPhone15,3\" */\n productType: AnyEnum<'iPhone13,4' | 'iPhone15,3'>;\n reality: AnyEnum<'physical'>;\n /** \"X2X1CC1XXX\" */\n serialNumber: string;\n supportedCPUTypes: DeviceCtlCpuType[];\n /** [1] */\n supportedDeviceFamilies: number[];\n thinningProductType: AnyEnum<'iPhone15,3'>;\n /** \"00001110-001111110110101A\" */\n udid: string;\n};\n\ntype DeviceCtlDeviceProperties = {\n /** true */\n bootedFromSnapshot: boolean;\n /** \"com.apple.os.update-AD0CF111ACFF11A11111A76A3D1262AE42A3F56F305AF5AE1135393A7A14A7D1\" */\n bootedSnapshotName: string;\n /** false */\n ddiServicesAvailable: boolean;\n\n developerModeStatus: AnyEnum<'enabled'>;\n /** false */\n hasInternalOSBuild: boolean;\n /** \"Evan's phone\" */\n name: string;\n /** \"21E236\" */\n osBuildUpdate: string;\n /** \"17.4.1\" */\n osVersionNumber: string;\n /** false */\n rootFileSystemIsWritable: boolean;\n};\n\ntype DeviceCtlDeviceCapability =\n | {\n name: AnyEnum;\n featureIdentifier: AnyEnum;\n }\n | {\n featureIdentifier: 'com.apple.coredevice.feature.connectdevice';\n name: 'Connect to Device';\n }\n | {\n featureIdentifier: 'com.apple.coredevice.feature.unpairdevice';\n name: 'Unpair Device';\n }\n | {\n featureIdentifier: 'com.apple.coredevice.feature.acquireusageassertion';\n name: 'Acquire Usage Assertion';\n };\n\ntype DeviceCtlConnectionProperties = {\n authenticationType: AnyEnum<'manualPairing'>;\n isMobileDeviceOnly: boolean;\n /** \"2024-04-20T22:50:04.244Z\" */\n lastConnectionDate: string;\n pairingState: AnyEnum<'paired'>;\n /** [\"00001111-001111110110101A.coredevice.local\", \"A1A1AAA1-0011-1AA1-11A1-10A1111AA11A.coredevice.local\"] */\n potentialHostnames: string[];\n transportType: AnyEnum<'localNetwork' | 'wired'>;\n tunnelState: AnyEnum<'disconnected' | 'unavailable'>;\n tunnelTransportProtocol: AnyEnum<'tcp'>;\n};\n\ntype DeviceCtlCpuType = {\n name: AnyEnum<'arm64e' | 'arm64' | 'arm64_32'>;\n subType: number;\n /** 16777228 */\n type: number;\n};\n\n/** Run a `devicectl` command. */\nexport async function devicectlAsync(\n args: (string | undefined)[],\n options?: SpawnOptions\n): Promise<SpawnResult> {\n try {\n return await xcrunAsync(['devicectl', ...args], options);\n } catch (error: any) {\n if (error instanceof CommandError) {\n throw error;\n }\n if ('stderr' in error) {\n const errorCodes = getDeviceCtlErrorCodes(error.stderr);\n if (errorCodes.includes('Locked')) {\n throw new CommandError('APPLE_DEVICE_LOCKED', 'Device is locked, unlock and try again.');\n }\n }\n throw error;\n }\n}\n\nexport async function getConnectedAppleDevicesAsync() {\n if (!hasDevicectlEverBeenInstalled()) {\n debug('devicectl not found, skipping remote Apple devices.');\n return [];\n }\n\n const tmpPath = createTempFilePath();\n const devices = await devicectlAsync([\n 'list',\n 'devices',\n '--json-output',\n tmpPath,\n // Give two seconds before timing out: between 5 and 9223372036854775807\n '--timeout',\n '5',\n ]);\n debug(devices.stdout);\n const devicesJson = await JsonFile.readAsync(tmpPath);\n\n if (![2, 3].includes((devicesJson as any)?.info?.jsonVersion)) {\n Log.warn(\n 'Unexpected devicectl JSON version output from devicectl. Connecting to physical Apple devices may not work as expected.'\n );\n }\n\n assertDevicesJson(devicesJson);\n\n return devicesJson.result.devices as DeviceCtlDevice[];\n}\n\nfunction assertDevicesJson(\n results: any\n): asserts results is { result: { devices: DeviceCtlDevice[] } } {\n assert(\n results != null && 'result' in results && Array.isArray(results?.result?.devices),\n 'Malformed JSON output from devicectl: ' + JSON.stringify(results, null, 2)\n );\n}\n\nexport async function launchBinaryOnMacAsync(\n bundleId: string,\n appBinaryPath: string\n): Promise<void> {\n const args = ['-b', bundleId, appBinaryPath];\n try {\n await spawnAsync('open', args);\n } catch (error: any) {\n if ('code' in error) {\n if (error.code === 1) {\n throw new CommandError(\n 'MACOS_LAUNCH',\n 'Failed to launch the compatible binary on macOS: open ' +\n args.join(' ') +\n '\\n\\n' +\n error.message\n );\n }\n }\n throw error;\n }\n}\n\nasync function installAppWithDeviceCtlAsync(\n uuid: string,\n bundleIdOrAppPath: string,\n onProgress: (event: { status: string; isComplete: boolean; progress: number }) => void\n): Promise<void> {\n const maxAttempts = 3;\n for (let attempt = 1; attempt <= maxAttempts; attempt++) {\n try {\n await installAppWithDeviceCtlInternalAsync(uuid, bundleIdOrAppPath, onProgress, attempt);\n return;\n } catch (error: any) {\n if (error.code === 'detached') {\n throw error;\n }\n const isTransientDisconnect =\n error.message &&\n (error.message.includes('CoreDeviceError') || error.message.includes('0xFA0'));\n\n if (!isTransientDisconnect || attempt === maxAttempts) {\n throw error;\n }\n const backoffDelay = 500 + Math.pow(2, attempt - 1) * 500;\n await new Promise((resolve) => setTimeout(resolve, backoffDelay));\n }\n }\n}\n\nasync function installAppWithDeviceCtlInternalAsync(\n uuid: string,\n bundleIdOrAppPath: string,\n onProgress: (event: { status: string; isComplete: boolean; progress: number }) => void,\n attempt: number\n): Promise<void> {\n // 𝝠 xcrun devicectl device install app --device 00001110-001111110110101A /Users/evanbacon/Library/Developer/Xcode/DerivedData/Router-hgbqaxzhrhkiftfweydvhgttadvn/Build/Products/Debug-iphoneos/Router.app --verbose\n return new Promise((resolve, reject) => {\n const args: string[] = [\n 'devicectl',\n 'device',\n 'install',\n 'app',\n '--device',\n uuid,\n bundleIdOrAppPath,\n ];\n const childProcess = spawn('xcrun', args);\n debug('xcrun ' + args.join(' '));\n\n let currentProgress = 0;\n let hasStarted = false;\n\n function updateProgress(progress: number) {\n hasStarted = true;\n if (progress <= currentProgress) {\n return;\n }\n currentProgress = progress;\n const statusPrefix = attempt > 1 ? `Installing (attempt ${attempt})` : 'Installing';\n onProgress({\n progress,\n isComplete: progress === 100,\n status: statusPrefix,\n });\n }\n\n childProcess.stdout.on('data', (data: Buffer) => {\n // Sometimes more than one chunk comes at a time, here we split by system newline,\n // then trim and filter.\n const strings = data\n .toString()\n .split(EOL)\n .map((value) => value.trim());\n\n strings.forEach((str) => {\n // Match the progress percentage:\n // - '34%... 35%...' -> 34\n // - '31%...' -> 31\n // - 'Complete!' -> 100\n\n const match = str.match(/(\\d+)%\\.\\.\\./);\n if (match) {\n updateProgress(parseInt(match[1]!, 10));\n } else if (hasStarted) {\n updateProgress(100);\n }\n });\n\n debug('[stdout]:', strings);\n });\n\n let stderrBuffer = '';\n childProcess.stderr.on('data', (data: Buffer) => {\n stderrBuffer += data.toString();\n });\n\n childProcess.on('close', (code) => {\n debug('[close]: ' + code);\n if (code === 0) {\n resolve();\n } else {\n const err = new Error(stderrBuffer || `Command failed with exit code ${code}`);\n (err as any).code = code;\n detach(err);\n }\n });\n\n const detach = async (err?: Error) => {\n off?.();\n if (childProcess) {\n return new Promise<void>((resolve) => {\n childProcess?.on('close', () => resolve());\n childProcess?.kill();\n reject(err ?? new CommandError('detached'));\n });\n }\n };\n\n const off = installExitHooks(() => detach());\n });\n}\n\nexport async function launchAppWithDeviceCtl(deviceId: string, bundleId: string) {\n await devicectlAsync([\n 'device',\n 'process',\n 'launch',\n '--terminate-existing',\n '--device',\n deviceId,\n bundleId,\n ]);\n}\n\n/** Find all error codes from the output log */\nfunction getDeviceCtlErrorCodes(log: string): string[] {\n return [...log.matchAll(/BSErrorCodeDescription\\s+=\\s+(.*)$/gim)].map(([_line, code]) => code!);\n}\n\nlet hasEverBeenInstalled: boolean | undefined;\n\nexport function hasDevicectlEverBeenInstalled() {\n if (hasEverBeenInstalled) return hasEverBeenInstalled;\n // It doesn't appear possible for devicectl to ever be uninstalled. We can just check once and store this result forever\n // to prevent cold boots of devicectl from slowing down all invocations of `expo run ios`\n if (fs.existsSync(DEVICE_CTL_EXISTS_PATH)) {\n hasEverBeenInstalled = true;\n return true;\n }\n\n const isInstalled = isDevicectlInstalled();\n\n if (isInstalled) {\n fs.writeFileSync(DEVICE_CTL_EXISTS_PATH, '1');\n }\n hasEverBeenInstalled = isInstalled;\n return isInstalled;\n}\n\nfunction isDevicectlInstalled() {\n try {\n execSync('xcrun devicectl --version', { stdio: 'ignore' });\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Wraps the apple device method for installing and running an app,\n * adds indicator and retry loop for when the device is locked.\n */\nexport async function installAndLaunchAppAsync(props: {\n bundle: string;\n bundleIdentifier: string;\n udid: string;\n deviceName: string;\n}): Promise<void> {\n debug('Running on device:', props);\n const { bundle, bundleIdentifier, udid, deviceName } = props;\n let indicator: Ora | undefined;\n\n try {\n if (!indicator) {\n indicator = ora(`Connecting to: ${props.deviceName}`).start();\n }\n\n await installAppWithDeviceCtlAsync(\n udid,\n bundle,\n ({\n status,\n isComplete,\n progress,\n }: {\n status: string;\n isComplete: boolean;\n progress: number;\n }) => {\n if (!indicator) {\n indicator = ora(status).start();\n }\n indicator.text = `${chalk.bold(status)} ${progress}%`;\n if (isComplete) {\n indicator.succeed();\n }\n }\n );\n } catch (error: any) {\n if (indicator) {\n indicator.fail();\n }\n throw error;\n }\n\n async function launchAppOptionally() {\n try {\n await launchAppWithDeviceCtl(udid, bundleIdentifier);\n } catch (error: any) {\n if (indicator) {\n indicator.fail();\n }\n if (error.code === 'APPLE_DEVICE_LOCKED') {\n // Get the app name from the binary path.\n const appName = path.basename(bundle).split('.')[0] ?? 'app';\n if (\n isInteractive() &&\n (await confirmAsync({\n message: `Cannot launch ${appName} because the device is locked. Unlock ${deviceName} to continue...`,\n initial: true,\n }))\n ) {\n return launchAppOptionally();\n }\n throw new CommandError(\n `Cannot launch ${appName} on ${deviceName} because the device is locked.`\n );\n }\n throw error;\n }\n }\n\n await launchAppOptionally();\n}\n"],"names":["devicectlAsync","getConnectedAppleDevicesAsync","hasDevicectlEverBeenInstalled","installAndLaunchAppAsync","launchAppWithDeviceCtl","launchBinaryOnMacAsync","DEVICE_CTL_EXISTS_PATH","path","join","getExpoHomeDirectory","debug","require","args","options","xcrunAsync","error","CommandError","errorCodes","getDeviceCtlErrorCodes","stderr","includes","tmpPath","createTempFilePath","devices","stdout","devicesJson","JsonFile","readAsync","info","jsonVersion","Log","warn","assertDevicesJson","result","results","assert","Array","isArray","JSON","stringify","bundleId","appBinaryPath","spawnAsync","code","message","installAppWithDeviceCtlAsync","uuid","bundleIdOrAppPath","onProgress","maxAttempts","attempt","installAppWithDeviceCtlInternalAsync","isTransientDisconnect","backoffDelay","Math","pow","Promise","resolve","setTimeout","reject","childProcess","spawn","currentProgress","hasStarted","updateProgress","progress","statusPrefix","isComplete","status","on","data","strings","toString","split","EOL","map","value","trim","forEach","str","match","parseInt","stderrBuffer","err","Error","detach","off","kill","installExitHooks","deviceId","log","matchAll","_line","hasEverBeenInstalled","fs","existsSync","isInstalled","isDevicectlInstalled","writeFileSync","execSync","stdio","props","bundle","bundleIdentifier","udid","deviceName","indicator","ora","start","text","chalk","bold","succeed","fail","launchAppOptionally","appName","basename","isInteractive","confirmAsync","initial"],"mappings":"AAAA;;;;;CAKC;;;;;;;;;;;QA+HqBA;eAAAA;;QAoBAC;eAAAA;;QAyMNC;eAAAA;;QA+BMC;eAAAA;;QAlDAC;eAAAA;;QA/IAC;eAAAA;;;;gEAxLD;;;;;;;gEAEE;;;;;;;gEACL;;;;;;;yBACc;;;;;;;gEACjB;;;;;;;gEACI;;;;;;;yBAEC;;;;;;;gEACH;;;;;;uBAEU;8BACU;6DAChB;gCACc;wBACN;sBACI;6BACH;qBACV;yBACS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE7B,MAAMC,yBAAyBC,eAAI,CAACC,IAAI,CAACC,IAAAA,kCAAoB,KAAI;AAEjE,MAAMC,QAAQC,QAAQ,SAAS;AAsGxB,eAAeX,eACpBY,IAA4B,EAC5BC,OAAsB;IAEtB,IAAI;QACF,OAAO,MAAMC,IAAAA,iBAAU,EAAC;YAAC;eAAgBF;SAAK,EAAEC;IAClD,EAAE,OAAOE,OAAY;QACnB,IAAIA,iBAAiBC,oBAAY,EAAE;YACjC,MAAMD;QACR;QACA,IAAI,YAAYA,OAAO;YACrB,MAAME,aAAaC,uBAAuBH,MAAMI,MAAM;YACtD,IAAIF,WAAWG,QAAQ,CAAC,WAAW;gBACjC,MAAM,IAAIJ,oBAAY,CAAC,uBAAuB;YAChD;QACF;QACA,MAAMD;IACR;AACF;AAEO,eAAed;QAmBC;IAlBrB,IAAI,CAACC,iCAAiC;QACpCQ,MAAM;QACN,OAAO,EAAE;IACX;IAEA,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AK,CAAC,IAAI,CAAC,EAAE,IAAI;gBACvD,IACE4C,IAAAA,0BAAa,OACZ,MAAMC,IAAAA,qBAAY,EAAC;oBAClB1E,SAAS,CAAC,cAAc,EAAEuE,QAAQ,sCAAsC,EAAEV,WAAW,eAAe,CAAC;oBACrGc,SAAS;gBACX,IACA;oBACA,OAAOL;gBACT;gBACA,MAAM,IAAIlG,oBAAY,CACpB,CAAC,cAAc,EAAEmG,QAAQ,IAAI,EAAEV,WAAW,8BAA8B,CAAC;YAE7E;YACA,MAAM1F;QACR;IACF;IAEA,MAAMmG;AACR"}
1
+ {"version":3,"sources":["../../../../../src/start/platforms/ios/devicectl.ts"],"sourcesContent":["/**\n * Copyright © 2024 650 Industries.\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\nimport JsonFile from '@expo/json-file';\nimport type { SpawnOptions, SpawnResult } from '@expo/spawn-async';\nimport spawnAsync from '@expo/spawn-async';\nimport chalk from 'chalk';\nimport { spawn, execSync } from 'child_process';\nimport fs from 'fs';\nimport assert from 'node:assert';\nimport type { Ora } from 'ora';\nimport { EOL } from 'os';\nimport path from 'path';\n\nimport { xcrunAsync } from './xcrun';\nimport { getExpoHomeDirectory } from '../../../api/user/UserSettings';\nimport * as Log from '../../../log';\nimport { createTempFilePath } from '../../../utils/createTempPath';\nimport { CommandError } from '../../../utils/errors';\nimport { installExitHooks } from '../../../utils/exit';\nimport { isInteractive } from '../../../utils/interactive';\nimport { ora } from '../../../utils/ora';\nimport { confirmAsync } from '../../../utils/prompts';\n\nconst DEVICE_CTL_EXISTS_PATH = path.join(getExpoHomeDirectory(), 'devicectl-exists');\n\nconst debug = require('debug')('expo:devicectl') as typeof console.log;\n\ntype AnyEnum<T extends string = string> = T | (string & object);\n\ntype DeviceCtlDevice = {\n capabilities: DeviceCtlDeviceCapability[];\n connectionProperties: DeviceCtlConnectionProperties;\n deviceProperties: DeviceCtlDeviceProperties;\n hardwareProperties: DeviceCtlHardwareProperties;\n /** \"A1A1AAA1-0011-1AA1-11A1-10A1111AA11A\" */\n identifier: string;\n visibilityClass: AnyEnum<'default'>;\n};\n\ntype DeviceCtlHardwareProperties = {\n cpuType: DeviceCtlCpuType;\n deviceType: AnyEnum<'iPhone'>;\n /** 1114404411111111 */\n ecid: number;\n /** \"D74AP\" */\n hardwareModel: string;\n /** 512000000000 */\n internalStorageCapacity: number;\n /** true */\n isProductionFused: boolean;\n /** \"iPhone 14 Pro Max\" */\n marketingName: string;\n /** \"iOS\" */\n platform: AnyEnum<'iOS' | 'xrOS'>;\n /** \"iPhone15,3\" */\n productType: AnyEnum<'iPhone13,4' | 'iPhone15,3'>;\n reality: AnyEnum<'physical' | 'simulated'>;\n /** \"X2X1CC1XXX\" */\n serialNumber: string;\n supportedCPUTypes: DeviceCtlCpuType[];\n /** [1] */\n supportedDeviceFamilies: number[];\n thinningProductType: AnyEnum<'iPhone15,3'>;\n /** \"00001110-001111110110101A\" */\n udid: string;\n};\n\ntype DeviceCtlDeviceProperties = {\n /** true */\n bootedFromSnapshot: boolean;\n /** \"com.apple.os.update-AD0CF111ACFF11A11111A76A3D1262AE42A3F56F305AF5AE1135393A7A14A7D1\" */\n bootedSnapshotName: string;\n /** false */\n ddiServicesAvailable: boolean;\n\n developerModeStatus: AnyEnum<'enabled'>;\n /** false */\n hasInternalOSBuild: boolean;\n /** \"Evan's phone\" */\n name: string;\n /** \"21E236\" */\n osBuildUpdate: string;\n /** \"17.4.1\" */\n osVersionNumber: string;\n /** false */\n rootFileSystemIsWritable: boolean;\n};\n\ntype DeviceCtlDeviceCapability =\n | {\n name: AnyEnum;\n featureIdentifier: AnyEnum;\n }\n | {\n featureIdentifier: 'com.apple.coredevice.feature.connectdevice';\n name: 'Connect to Device';\n }\n | {\n featureIdentifier: 'com.apple.coredevice.feature.unpairdevice';\n name: 'Unpair Device';\n }\n | {\n featureIdentifier: 'com.apple.coredevice.feature.acquireusageassertion';\n name: 'Acquire Usage Assertion';\n };\n\ntype DeviceCtlConnectionProperties = {\n authenticationType: AnyEnum<'manualPairing'>;\n isMobileDeviceOnly: boolean;\n /** \"2024-04-20T22:50:04.244Z\" */\n lastConnectionDate: string;\n pairingState: AnyEnum<'paired'>;\n /** [\"00001111-001111110110101A.coredevice.local\", \"A1A1AAA1-0011-1AA1-11A1-10A1111AA11A.coredevice.local\"] */\n potentialHostnames: string[];\n transportType: AnyEnum<'localNetwork' | 'wired'>;\n tunnelState: AnyEnum<'disconnected' | 'unavailable'>;\n tunnelTransportProtocol: AnyEnum<'tcp'>;\n};\n\ntype DeviceCtlCpuType = {\n name: AnyEnum<'arm64e' | 'arm64' | 'arm64_32'>;\n subType: number;\n /** 16777228 */\n type: number;\n};\n\n/** Run a `devicectl` command. */\nexport async function devicectlAsync(\n args: (string | undefined)[],\n options?: SpawnOptions\n): Promise<SpawnResult> {\n try {\n return await xcrunAsync(['devicectl', ...args], options);\n } catch (error: any) {\n if (error instanceof CommandError) {\n throw error;\n }\n if ('stderr' in error) {\n const errorCodes = getDeviceCtlErrorCodes(error.stderr);\n if (errorCodes.includes('Locked')) {\n throw new CommandError('APPLE_DEVICE_LOCKED', 'Device is locked, unlock and try again.');\n }\n }\n throw error;\n }\n}\n\nexport async function getConnectedAppleDevicesAsync() {\n if (!hasDevicectlEverBeenInstalled()) {\n debug('devicectl not found, skipping remote Apple devices.');\n return [];\n }\n\n const tmpPath = createTempFilePath();\n const devices = await devicectlAsync([\n 'list',\n 'devices',\n '--json-output',\n tmpPath,\n // Give two seconds before timing out: between 5 and 9223372036854775807\n '--timeout',\n '5',\n ]);\n debug(devices.stdout);\n const devicesJson = await JsonFile.readAsync(tmpPath);\n\n if (![2, 3, 5].includes((devicesJson as any)?.info?.jsonVersion)) {\n Log.warn(\n 'Unexpected devicectl JSON version output from devicectl. Connecting to physical Apple devices may not work as expected.'\n );\n }\n\n assertDevicesJson(devicesJson);\n\n return (devicesJson.result.devices as DeviceCtlDevice[]).filter(\n (device) => device?.hardwareProperties?.reality !== 'simulated'\n );\n}\n\nfunction assertDevicesJson(\n results: any\n): asserts results is { result: { devices: DeviceCtlDevice[] } } {\n assert(\n results != null && 'result' in results && Array.isArray(results?.result?.devices),\n 'Malformed JSON output from devicectl: ' + JSON.stringify(results, null, 2)\n );\n}\n\nexport async function launchBinaryOnMacAsync(\n bundleId: string,\n appBinaryPath: string\n): Promise<void> {\n const args = ['-b', bundleId, appBinaryPath];\n try {\n await spawnAsync('open', args);\n } catch (error: any) {\n if ('code' in error) {\n if (error.code === 1) {\n throw new CommandError(\n 'MACOS_LAUNCH',\n 'Failed to launch the compatible binary on macOS: open ' +\n args.join(' ') +\n '\\n\\n' +\n error.message\n );\n }\n }\n throw error;\n }\n}\n\nasync function installAppWithDeviceCtlAsync(\n uuid: string,\n bundleIdOrAppPath: string,\n onProgress: (event: { status: string; isComplete: boolean; progress: number }) => void\n): Promise<void> {\n const maxAttempts = 3;\n for (let attempt = 1; attempt <= maxAttempts; attempt++) {\n try {\n await installAppWithDeviceCtlInternalAsync(uuid, bundleIdOrAppPath, onProgress, attempt);\n return;\n } catch (error: any) {\n if (error.code === 'detached') {\n throw error;\n }\n const isTransientDisconnect =\n error.message &&\n (error.message.includes('CoreDeviceError') || error.message.includes('0xFA0'));\n\n if (!isTransientDisconnect || attempt === maxAttempts) {\n throw error;\n }\n const backoffDelay = 500 + Math.pow(2, attempt - 1) * 500;\n await new Promise((resolve) => setTimeout(resolve, backoffDelay));\n }\n }\n}\n\nasync function installAppWithDeviceCtlInternalAsync(\n uuid: string,\n bundleIdOrAppPath: string,\n onProgress: (event: { status: string; isComplete: boolean; progress: number }) => void,\n attempt: number\n): Promise<void> {\n // 𝝠 xcrun devicectl device install app --device 00001110-001111110110101A /Users/evanbacon/Library/Developer/Xcode/DerivedData/Router-hgbqaxzhrhkiftfweydvhgttadvn/Build/Products/Debug-iphoneos/Router.app --verbose\n return new Promise((resolve, reject) => {\n const args: string[] = [\n 'devicectl',\n 'device',\n 'install',\n 'app',\n '--device',\n uuid,\n bundleIdOrAppPath,\n ];\n const childProcess = spawn('xcrun', args);\n debug('xcrun ' + args.join(' '));\n\n let currentProgress = 0;\n let hasStarted = false;\n\n function updateProgress(progress: number) {\n hasStarted = true;\n if (progress <= currentProgress) {\n return;\n }\n currentProgress = progress;\n const statusPrefix = attempt > 1 ? `Installing (attempt ${attempt})` : 'Installing';\n onProgress({\n progress,\n isComplete: progress === 100,\n status: statusPrefix,\n });\n }\n\n childProcess.stdout.on('data', (data: Buffer) => {\n // Sometimes more than one chunk comes at a time, here we split by system newline,\n // then trim and filter.\n const strings = data\n .toString()\n .split(EOL)\n .map((value) => value.trim());\n\n strings.forEach((str) => {\n // Match the progress percentage:\n // - '34%... 35%...' -> 34\n // - '31%...' -> 31\n // - 'Complete!' -> 100\n\n const match = str.match(/(\\d+)%\\.\\.\\./);\n if (match) {\n updateProgress(parseInt(match[1]!, 10));\n } else if (hasStarted) {\n updateProgress(100);\n }\n });\n\n debug('[stdout]:', strings);\n });\n\n let stderrBuffer = '';\n childProcess.stderr.on('data', (data: Buffer) => {\n stderrBuffer += data.toString();\n });\n\n childProcess.on('close', (code) => {\n debug('[close]: ' + code);\n if (code === 0) {\n resolve();\n } else {\n const err = new Error(stderrBuffer || `Command failed with exit code ${code}`);\n (err as any).code = code;\n detach(err);\n }\n });\n\n const detach = async (err?: Error) => {\n off?.();\n if (childProcess) {\n return new Promise<void>((resolve) => {\n childProcess?.on('close', () => resolve());\n childProcess?.kill();\n reject(err ?? new CommandError('detached'));\n });\n }\n };\n\n const off = installExitHooks(() => detach());\n });\n}\n\nexport async function launchAppWithDeviceCtl(deviceId: string, bundleId: string) {\n await devicectlAsync([\n 'device',\n 'process',\n 'launch',\n '--terminate-existing',\n '--device',\n deviceId,\n bundleId,\n ]);\n}\n\n/** Find all error codes from the output log */\nfunction getDeviceCtlErrorCodes(log: string): string[] {\n return [...log.matchAll(/BSErrorCodeDescription\\s+=\\s+(.*)$/gim)].map(([_line, code]) => code!);\n}\n\nlet hasEverBeenInstalled: boolean | undefined;\n\nexport function hasDevicectlEverBeenInstalled() {\n if (hasEverBeenInstalled) return hasEverBeenInstalled;\n // It doesn't appear possible for devicectl to ever be uninstalled. We can just check once and store this result forever\n // to prevent cold boots of devicectl from slowing down all invocations of `expo run ios`\n if (fs.existsSync(DEVICE_CTL_EXISTS_PATH)) {\n hasEverBeenInstalled = true;\n return true;\n }\n\n const isInstalled = isDevicectlInstalled();\n\n if (isInstalled) {\n fs.writeFileSync(DEVICE_CTL_EXISTS_PATH, '1');\n }\n hasEverBeenInstalled = isInstalled;\n return isInstalled;\n}\n\nfunction isDevicectlInstalled() {\n try {\n execSync('xcrun devicectl --version', { stdio: 'ignore' });\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Wraps the apple device method for installing and running an app,\n * adds indicator and retry loop for when the device is locked.\n */\nexport async function installAndLaunchAppAsync(props: {\n bundle: string;\n bundleIdentifier: string;\n udid: string;\n deviceName: string;\n}): Promise<void> {\n debug('Running on device:', props);\n const { bundle, bundleIdentifier, udid, deviceName } = props;\n let indicator: Ora | undefined;\n\n try {\n if (!indicator) {\n indicator = ora(`Connecting to: ${props.deviceName}`).start();\n }\n\n await installAppWithDeviceCtlAsync(\n udid,\n bundle,\n ({\n status,\n isComplete,\n progress,\n }: {\n status: string;\n isComplete: boolean;\n progress: number;\n }) => {\n if (!indicator) {\n indicator = ora(status).start();\n }\n indicator.text = `${chalk.bold(status)} ${progress}%`;\n if (isComplete) {\n indicator.succeed();\n }\n }\n );\n } catch (error: any) {\n if (indicator) {\n indicator.fail();\n }\n throw error;\n }\n\n async function launchAppOptionally() {\n try {\n await launchAppWithDeviceCtl(udid, bundleIdentifier);\n } catch (error: any) {\n if (indicator) {\n indicator.fail();\n }\n if (error.code === 'APPLE_DEVICE_LOCKED') {\n // Get the app name from the binary path.\n const appName = path.basename(bundle).split('.')[0] ?? 'app';\n if (\n isInteractive() &&\n (await confirmAsync({\n message: `Cannot launch ${appName} because the device is locked. Unlock ${deviceName} to continue...`,\n initial: true,\n }))\n ) {\n return launchAppOptionally();\n }\n throw new CommandError(\n `Cannot launch ${appName} on ${deviceName} because the device is locked.`\n );\n }\n throw error;\n }\n }\n\n await launchAppOptionally();\n}\n"],"names":["devicectlAsync","getConnectedAppleDevicesAsync","hasDevicectlEverBeenInstalled","installAndLaunchAppAsync","launchAppWithDeviceCtl","launchBinaryOnMacAsync","DEVICE_CTL_EXISTS_PATH","path","join","getExpoHomeDirectory","debug","require","args","options","xcrunAsync","error","CommandError","errorCodes","getDeviceCtlErrorCodes","stderr","includes","tmpPath","createTempFilePath","devices","stdout","devicesJson","JsonFile","readAsync","info","jsonVersion","Log","warn","assertDevicesJson","result","filter","device","hardwareProperties","reality","results","assert","Array","isArray","JSON","stringify","bundleId","appBinaryPath","spawnAsync","code","message","installAppWithDeviceCtlAsync","uuid","bundleIdOrAppPath","onProgress","maxAttempts","attempt","installAppWithDeviceCtlInternalAsync","isTransientDisconnect","backoffDelay","Math","pow","Promise","resolve","setTimeout","reject","childProcess","spawn","currentProgress","hasStarted","updateProgress","progress","statusPrefix","isComplete","status","on","data","strings","toString","split","EOL","map","value","trim","forEach","str","match","parseInt","stderrBuffer","err","Error","detach","off","kill","installExitHooks","deviceId","log","matchAll","_line","hasEverBeenInstalled","fs","existsSync","isInstalled","isDevicectlInstalled","writeFileSync","execSync","stdio","props","bundle","bundleIdentifier","udid","deviceName","indicator","ora","start","text","chalk","bold","succeed","fail","launchAppOptionally","appName","basename","isInteractive","confirmAsync","initial"],"mappings":"AAAA;;;;;CAKC;;;;;;;;;;;QA+HqBA;eAAAA;;QAoBAC;eAAAA;;QA2MNC;eAAAA;;QA+BMC;eAAAA;;QAlDAC;eAAAA;;QA/IAC;eAAAA;;;;gEA1LD;;;;;;;gEAEE;;;;;;;gEACL;;;;;;;yBACc;;;;;;;gEACjB;;;;;;;gEACI;;;;;;;yBAEC;;;;;;;gEACH;;;;;;uBAEU;8BACU;6DAChB;gCACc;wBACN;sBACI;6BACH;qB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I;QACF,IAAI,CAACA,WAAW;YACdA,YAAYC,IAAAA,QAAG,EAAC,CAAC,eAAe,EAAEN,MAAMI,UAAU,EAAE,EAAEG,KAAK;QAC7D;QAEA,MAAM/D,6BACJ2D,MACAF,QACA,CAAC,EACClC,MAAM,EACND,UAAU,EACVF,QAAQ,EAKT;YACC,IAAI,CAACyC,WAAW;gBACdA,YAAYC,IAAAA,QAAG,EAACvC,QAAQwC,KAAK;YAC/B;YACAF,UAAUG,IAAI,GAAG,GAAGC,gBAAK,CAACC,IAAI,CAAC3C,QAAQ,CAAC,EAAEH,SAAS,CAAC,CAAC;YACrD,IAAIE,YAAY;gBACduC,UAAUM,OAAO;YACnB;QACF;IAEJ,EAAE,OAAOrG,OAAY;QACnB,IAAI+F,WAAW;YACbA,UAAUO,IAAI;QAChB;QACA,MAAMtG;IACR;IAEA,eAAeuG;QACb,IAAI;YACF,MAAMlH,uBAAuBwG,MAAMD;QACrC,EAAE,OAAO5F,OAAY;YACnB,IAAI+F,WAAW;gBACbA,UAAUO,IAAI;YAChB;YACA,IAAItG,MAAMgC,IAAI,KAAK,uBAAuB;gBACxC,yCAAyC;gBACzC,MAAMwE,UAAUhH,eAAI,CAACiH,QAAQ,CAACd,QAAQ7B,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI;gBACvD,IACE4C,IAAAA,0BAAa,OACZ,MAAMC,IAAAA,qBAAY,EAAC;oBAClB1E,SAAS,CAAC,cAAc,EAAEuE,QAAQ,sCAAsC,EAAEV,WAAW,eAAe,CAAC;oBACrGc,SAAS;gBACX,IACA;oBACA,OAAOL;gBACT;gBACA,MAAM,IAAItG,oBAAY,CACpB,CAAC,cAAc,EAAEuG,QAAQ,IAAI,EAAEV,WAAW,8BAA8B,CAAC;YAE7E;YACA,MAAM9F;QACR;IACF;IAEA,MAAMuG;AACR"}
@@ -79,6 +79,7 @@ const _withMetroErrorReportingResolver = require("./withMetroErrorReportingResol
79
79
  const _withMetroResolvers = require("./withMetroResolvers");
80
80
  const _withMetroSupervisingTransformWorker = require("./withMetroSupervisingTransformWorker");
81
81
  const _log = require("../../../log");
82
+ const _dir = require("../../../utils/dir");
82
83
  const _env = require("../../../utils/env");
83
84
  const _metroOptions = require("../middleware/metroOptions");
84
85
  const _createTypescriptResolver = require("./createTypescriptResolver");
@@ -778,14 +779,18 @@ function shouldAliasModule(input, alias) {
778
779
  var _input_result, _input_result1;
779
780
  return input.platform === alias.platform && ((_input_result = input.result) == null ? void 0 : _input_result.type) === 'sourceFile' && typeof ((_input_result1 = input.result) == null ? void 0 : _input_result1.filePath) === 'string' && normalizeSlashes(input.result.filePath).endsWith(alias.output);
780
781
  }
781
- async function withMetroMultiPlatformAsync(projectRoot, { config, exp, platformBundlers, isTsconfigPathsEnabled, isAutolinkingResolverEnabled, isExporting, isReactServerComponentsEnabled, getMetroBundler }) {
782
+ async function withMetroMultiPlatformAsync(projectRoot, { config, exp, platformBundlers, serverRoot, isTsconfigPathsEnabled, isAutolinkingResolverEnabled, isExporting, isReactServerComponentsEnabled, getMetroBundler }) {
782
783
  const watchFolders = config.watchFolders || [];
783
784
  asWritable(config).watchFolders = watchFolders;
784
785
  // NOTE(@kitten): If the on-demand filesystem is enabled, we can aggressively cut down the `watchFolders`
785
786
  // to a minimum, since the files will be read lazily. This almost always speeds up exports
786
787
  if (isExporting && !!config.resolver.unstable_onDemandFilesystem) {
788
+ // Preserve additional watchFolders the user added outside of serverRoot explicitly
789
+ // TODO(@kitten): In the future we can instead use the `onDemandFilesystem: 'UNSTABLE_ALLOW_ALL'` mode while issuing a warning
790
+ const internalRoot = serverRoot ?? projectRoot;
791
+ const externalWatchFolders = watchFolders.filter((dir)=>!(0, _dir.isPathInside)(dir, internalRoot));
787
792
  watchFolders.length = 0;
788
- watchFolders.push(projectRoot);
793
+ watchFolders.push(projectRoot, ...externalWatchFolders);
789
794
  }
790
795
  // Change the default metro-runtime to a custom one that supports bundle splitting.
791
796
  // NOTE(@kitten): This is now always active and EXPO_USE_METRO_REQUIRE / isNamedRequiresEnabled is disregarded
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/start/server/metro/withMetroMultiPlatform.ts"],"sourcesContent":["/**\n * Copyright © 2022 650 Industries.\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 */\nimport type { ExpoConfig, Platform } from '@expo/config';\nimport { getPlatformsFromConfig } from '@expo/config';\nimport { getPlatformExtensions } from '@expo/config/paths';\nimport type Bundler from '@expo/metro/metro/Bundler';\nimport type { ConfigT } from '@expo/metro/metro-config';\nimport type {\n Resolution,\n ResolutionContext,\n CustomResolutionContext,\n} from '@expo/metro/metro-resolver';\nimport { resolve as resolver } from '@expo/metro/metro-resolver';\nimport type { SourceFileResolution } from '@expo/metro/metro-resolver/types';\nimport { resolveFrom } from '@expo/require-utils';\nimport fs from 'fs';\nimport path from 'path';\n\nimport type {\n AutolinkingModuleResolverInput,\n AutolinkingPlatform,\n} from './createExpoAutolinkingResolver';\nimport {\n createAutolinkingModuleResolverInput,\n createAutolinkingModuleResolver,\n} from './createExpoAutolinkingResolver';\nimport { createFallbackModuleResolver } from './createExpoFallbackResolver';\nimport { FailedToResolveNativeOnlyModuleError } from './errors/FailedToResolveNativeOnlyModuleError';\nimport { isNodeExternal, shouldCreateVirtualShim } from './externals';\nimport { isFailedToResolveNameError, isFailedToResolvePathError } from './metroErrors';\nimport { getMetroBundlerWithVirtualModules } from './metroVirtualModules';\nimport { withMetroErrorReportingResolver } from './withMetroErrorReportingResolver';\nimport { withMetroMutatedResolverContext, withMetroResolvers } from './withMetroResolvers';\nimport { withMetroSupervisingTransformWorker } from './withMetroSupervisingTransformWorker';\nimport { Log } from '../../../log';\nimport { env } from '../../../utils/env';\nimport { isServerEnvironment } from '../middleware/metroOptions';\nimport type { PlatformBundlers } from '../platformBundlers';\nimport { createTypescriptResolver } from './createTypescriptResolver';\n\nexport type StrictResolver = (moduleName: string) => Resolution;\nexport type StrictResolverFactory = (\n context: ResolutionContext,\n platform: string | null\n) => StrictResolver;\n\nconst ASSET_REGISTRY_SRC = `const assets=[];module.exports={registerAsset:s=>assets.push(s),getAssetByID:s=>assets[s-1]};`;\n\ninterface PlatformExtensions {\n sourceExts: string[];\n unstable_conditionNames: string[];\n}\n\nfunction constructPlatformExtensions(\n config: ConfigT\n): Record<string, PlatformExtensions | undefined> {\n const platformExtensions: Record<string, PlatformExtensions | undefined> = Object.create(null);\n // TODO(@kitten): Temporary internal override config for per-platform extensions\n let unstable_platformExtensions: Record<string, string[] | undefined> | undefined;\n if (\n config.resolver &&\n 'unstable_platformExtensions' in config.resolver &&\n config.resolver.unstable_platformExtensions &&\n typeof config.resolver.unstable_platformExtensions === 'object'\n ) {\n unstable_platformExtensions = config.resolver.unstable_platformExtensions as any;\n }\n for (const platform of config.resolver?.platforms ?? []) {\n const customPlatformExtensions = unstable_platformExtensions?.[platform];\n const sourceExts = getPlatformExtensions(\n platform,\n config.resolver.sourceExts,\n customPlatformExtensions\n );\n // Platform-less resolution drops the platform's package-exports conditions, so fold them in.\n const unstable_conditionNames = [\n ...config.resolver.unstable_conditionNames,\n ...(config.resolver.unstable_conditionsByPlatform[platform] ?? []),\n ];\n if (sourceExts) {\n platformExtensions[platform as Platform] = { sourceExts, unstable_conditionNames };\n }\n }\n return platformExtensions;\n}\n\nfunction resolveWithPlatformExtensions(\n platformExtensions: PlatformExtensions,\n context: ResolutionContext,\n moduleName: string\n): Resolution {\n const platformContext = asWritable(context);\n platformContext.preferNativePlatform = false;\n platformContext.sourceExts = platformExtensions.sourceExts;\n platformContext.unstable_conditionNames = platformExtensions.unstable_conditionNames;\n return resolver(platformContext, moduleName, null);\n}\n\nconst debug = require('debug')('expo:start:server:metro:multi-platform') as typeof console.log;\n\nfunction asWritable<T>(input: T): { -readonly [K in keyof T]: T[K] } {\n return input;\n}\n\nconst _reactNativeHostPackages = new Map<string, string | null>();\nconst _reactNativeHostPathPatterns = new Map<string, RegExp | null>();\n\nfunction getReactNativeHostPackage(platform: string | null): string | null {\n if (!platform) {\n return null;\n }\n let supportPackage = _reactNativeHostPackages.get(platform);\n if (supportPackage === undefined) {\n const { getSupportPackageForPlatform } =\n require('expo/internal/unstable-autolinking-exports') as typeof import('expo-modules-autolinking/exports');\n supportPackage = getSupportPackageForPlatform(platform);\n _reactNativeHostPackages.set(platform, supportPackage);\n }\n return supportPackage;\n}\n\nfunction getReactNativeHostPathPattern(platform: string | null): RegExp | null {\n if (!platform) {\n return null;\n }\n let pattern = _reactNativeHostPathPatterns.get(platform);\n if (pattern === undefined) {\n const supportPackage = getReactNativeHostPackage(platform);\n pattern = supportPackage\n ? new RegExp(`[\\\\\\\\/]node_modules[\\\\\\\\/]${supportPackage}[\\\\\\\\/]`)\n : null;\n _reactNativeHostPathPatterns.set(platform, pattern);\n }\n return pattern;\n}\n\nfunction withWebPolyfills(\n config: ConfigT,\n {\n getMetroBundler,\n }: {\n getMetroBundler: () => Bundler;\n }\n): ConfigT {\n const originalGetPolyfills = config.serializer.getPolyfills\n ? config.serializer.getPolyfills.bind(config.serializer)\n : () => [];\n\n const getPolyfills = (ctx: { platform?: string | null }): readonly string[] => {\n const virtualEnvVarId = `\\0polyfill:environment-variables`;\n\n getMetroBundlerWithVirtualModules(getMetroBundler()).setVirtualModule(\n virtualEnvVarId,\n (() => {\n return `//`;\n })()\n );\n\n const virtualModuleId = `\\0polyfill:external-require`;\n\n getMetroBundlerWithVirtualModules(getMetroBundler()).setVirtualModule(\n virtualModuleId,\n (() => {\n if (ctx.platform === 'web') {\n // NOTE(@hassankhan): We need to wrap require in an arrow function rather than assigning\n // it directly because `workerd` loses its `this` context when `require` is dereferenced\n // and called later.\n return `global.$$require_external = typeof require !== \"undefined\" ? (m) => require(m) : () => null;`;\n } else {\n // Wrap in try/catch to support Android.\n return 'try { global.$$require_external = typeof expo === \"undefined\" ? require : (moduleId) => { throw new Error(`Node.js standard library module ${moduleId} is not available in this JavaScript environment`);} } catch { global.$$require_external = (moduleId) => { throw new Error(`Node.js standard library module ${moduleId} is not available in this JavaScript environment`);} }';\n }\n })()\n );\n\n const virtualModulesPolyfills = [virtualModuleId, virtualEnvVarId];\n\n if (ctx.platform === 'web') {\n try {\n const rnGetPolyfills: () => string[] = require('react-native/rn-get-polyfills');\n return [\n ...virtualModulesPolyfills,\n // Ensure that the error-guard polyfill is included in the web polyfills to\n // make metro-runtime work correctly.\n // TODO: This module is pretty big for a function that simply re-throws an error that doesn't need to be caught.\n // NOTE(@kitten): This is technically the public API to get polyfills rather than resolving directly into\n // `@react-native/js-polyfills`. We should really just start vendoring these, but for now, this exclusion works\n ...rnGetPolyfills().filter((x: string) => !x.includes('/console')),\n ];\n } catch (error: any) {\n if ('code' in error && error.code === 'MODULE_NOT_FOUND') {\n // If react-native is not installed, because we're targeting web, we still continue\n // This should be rare, but we add it so we don't unnecessarily have a fixed peer dependency on react-native\n debug(\n 'Skipping react-native/rn-get-polyfills from getPolyfills. react-native is not installed.'\n );\n return virtualModulesPolyfills;\n } else {\n throw error;\n }\n }\n }\n\n // Generally uses `@expo/metro-config`'s `getPolyfills` function, unless overridden\n const polyfills = originalGetPolyfills(ctx);\n return [\n ...polyfills,\n ...virtualModulesPolyfills,\n // Removed on server platforms during the transform.\n require.resolve('expo/virtual/streams.js'),\n ];\n };\n\n return {\n ...config,\n serializer: {\n ...config.serializer,\n getPolyfills,\n },\n };\n}\n\nfunction normalizeSlashes(p: string) {\n return p.replace(/\\\\/g, '/');\n}\n\nexport function getNodejsExtensions(srcExts: readonly string[]): string[] {\n const mjsExts = srcExts.filter((ext) => /mjs$/.test(ext));\n const nodejsSourceExtensions = srcExts.filter((ext) => !/mjs$/.test(ext));\n // find index of last `*.js` extension\n const jsIndex = nodejsSourceExtensions.reduce((index, ext, i) => {\n return /jsx?$/.test(ext) ? i : index;\n }, -1);\n\n // insert `*.mjs` extensions after `*.js` extensions\n nodejsSourceExtensions.splice(jsIndex + 1, 0, ...mjsExts);\n\n return nodejsSourceExtensions;\n}\n\n/**\n * Apply custom resolvers to do the following:\n * - Disable `.native.js` extensions on web.\n * - Alias `react-native` to `react-native-web` on web.\n * - Redirect `react-native-web/dist/modules/AssetRegistry/index.js` to `@react-native/assets/registry.js` on web.\n * - Add support for `tsconfig.json`/`jsconfig.json` aliases via `compilerOptions.paths`.\n */\nexport function withExtendedResolver(\n config: ConfigT,\n {\n autolinkingModuleResolverInput,\n isTsconfigPathsEnabled,\n isExporting,\n isReactServerComponentsEnabled,\n getMetroBundler,\n }: {\n autolinkingModuleResolverInput?: AutolinkingModuleResolverInput;\n isTsconfigPathsEnabled?: boolean;\n isExporting?: boolean;\n isReactServerComponentsEnabled?: boolean;\n getMetroBundler: () => Bundler;\n }\n) {\n if (isReactServerComponentsEnabled) {\n Log.warn(`React Server Components (beta) is enabled.`);\n }\n\n const aliases: { [key: string]: Record<string, string> } = {\n web: {\n 'react-native': 'react-native-web',\n 'react-native/index': 'react-native-web',\n 'react-native/Libraries/Image/resolveAssetSource': 'expo-asset/build/resolveAssetSource',\n },\n };\n\n const isExpoRouterInstalled = hasExpoRouterModule(\n config.projectRoot,\n autolinkingModuleResolverInput\n );\n\n let _universalAliases: [RegExp, string][] | null;\n\n function getUniversalAliases() {\n if (_universalAliases) {\n return _universalAliases;\n }\n\n _universalAliases = [];\n\n // This package is currently always installed as it is included in the `expo` package.\n if (resolveFrom(config.projectRoot, '@expo/vector-icons/package.json')) {\n debug('Enabling alias: react-native-vector-icons -> @expo/vector-icons');\n _universalAliases.push([/^react-native-vector-icons(\\/.*)?/, '@expo/vector-icons$1']);\n }\n if (isReactServerComponentsEnabled) {\n if (resolveFrom(config.projectRoot, 'expo-router/rsc')) {\n debug('Enabling bridge alias: expo-router -> expo-router/rsc');\n _universalAliases.push([/^expo-router$/, 'expo-router/rsc']);\n // Bridge the internal entry point which is a standalone import to ensure package.json resolution works as expected.\n _universalAliases.push([/^expo-router\\/entry-classic$/, 'expo-router/rsc/entry']);\n }\n }\n return _universalAliases;\n }\n\n // used to resolve externals in `requestCustomExternals` from the project root\n const projectRootOriginPath = path.join(config.projectRoot, 'package.json');\n\n const preferredMainFields: { [key: string]: string[] } = {\n // Defaults from Expo Webpack. Most packages using `react-native` don't support web\n // in the `react-native` field, so we should prefer the `browser` field.\n // https://github.com/expo/router/issues/37\n web: ['browser', 'module', 'main'],\n };\n\n let nodejsSourceExtensions: string[] | null = null;\n\n const platformExtensions = constructPlatformExtensions(config);\n\n const getStrictResolver: StrictResolverFactory = (\n { resolveRequest, ...context },\n platform\n ): StrictResolver => {\n return function doResolve(moduleName: string): Resolution {\n if (platform != null && platformExtensions[platform]) {\n return resolveWithPlatformExtensions(platformExtensions[platform], context, moduleName);\n } else {\n return resolver(context, moduleName, platform);\n }\n };\n };\n\n function getOptionalResolver(context: ResolutionContext, platform: string | null) {\n const doResolve = getStrictResolver(context, platform);\n return function optionalResolve(moduleName: string): Resolution | null {\n try {\n return doResolve(moduleName);\n } catch (error) {\n // If the error is directly related to a resolver not being able to resolve a module, then\n // we can ignore the error and try the next resolver. Otherwise, we should throw the error.\n const isResolutionError =\n isFailedToResolveNameError(error) || isFailedToResolvePathError(error);\n if (!isResolutionError) {\n throw error;\n }\n }\n return null;\n };\n }\n\n // TODO: This is a hack to get resolveWeak working.\n const idFactory = (config.serializer?.createModuleIdFactory?.() ??\n ((id: number | string, context: { platform: string; environment?: string }): number | string =>\n id)) as (\n id: number | string,\n context: { platform: string; environment?: string }\n ) => number | string;\n\n // We're manually resolving the `asyncRequireModulePath` since it's a module request\n // However, in isolated installations it might not resolve from all paths, so we're resolving\n // it from the project root manually\n let _asyncRequireModuleResolvedPath: string | null | undefined;\n const getAsyncRequireModule = () => {\n if (_asyncRequireModuleResolvedPath === undefined) {\n _asyncRequireModuleResolvedPath =\n resolveFrom(config.projectRoot, config.transformer.asyncRequireModulePath) ?? null;\n }\n return _asyncRequireModuleResolvedPath\n ? ({ type: 'sourceFile', filePath: _asyncRequireModuleResolvedPath } as const)\n : null;\n };\n\n const getAssetRegistryModule = () => {\n const virtualModuleId = `\\0polyfill:assets-registry`;\n getMetroBundlerWithVirtualModules(getMetroBundler()).setVirtualModule(\n virtualModuleId,\n ASSET_REGISTRY_SRC\n );\n return {\n type: 'sourceFile',\n filePath: virtualModuleId,\n } as const;\n };\n\n // If Node.js pass-through, then remap to a module like `module.exports = $$require_external(<module>)`.\n // If module should be shimmed, remap to an empty module.\n const externals: {\n match: (context: ResolutionContext, moduleName: string, platform: string | null) => boolean;\n replace: 'empty' | 'node' | 'weak';\n }[] = [\n {\n match: (context: ResolutionContext, moduleName: string) => {\n if (\n // Disable internal externals when exporting for production.\n context.customResolverOptions.exporting ||\n // These externals are only for Node.js environments.\n !isServerEnvironment(context.customResolverOptions?.environment)\n ) {\n return false;\n }\n\n if (context.customResolverOptions?.environment === 'react-server') {\n // Ensure these non-react-server modules are excluded when bundling for React Server Components in development.\n return /^(@babel\\/runtime\\/.+|debug|metro-runtime\\/src\\/modules\\/HMRClient|metro|acorn-loose|acorn|chalk|ws|ansi-styles|supports-color|color-convert|has-flag|utf-8-validate|color-name|react-refresh\\/runtime|@remix-run\\/node\\/.+)$/.test(\n moduleName\n );\n }\n\n // TODO: Windows doesn't support externals somehow.\n if (process.platform === 'win32') {\n return false;\n }\n\n // Extern these modules in standard Node.js environments in development to prevent API routes side-effects\n // from leaking into the dev server process.\n return /^(react|@radix-ui\\/.+|@babel\\/runtime\\/.+|react-dom(\\/.+)?|debug|acorn-loose|acorn|css-in-js-utils\\/lib\\/.+|hyphenate-style-name|color|color-string|color-convert|color-name|fontfaceobserver|fast-deep-equal|query-string|escape-string-regexp|invariant|postcss-value-parser|memoize-one|nullthrows|strict-uri-encode|decode-uri-component|split-on-first|filter-obj|warn-once|simple-swizzle|is-arrayish|inline-style-prefixer\\/.+)$/.test(\n moduleName\n );\n },\n replace: 'node',\n },\n // Externals to speed up async split chunks by extern-ing common packages that appear in the root client chunk.\n {\n match: (context: ResolutionContext, moduleName: string, platform: string | null) => {\n if (\n // Disable internal externals when exporting for production.\n context.customResolverOptions.exporting ||\n // These externals are only for client environments.\n isServerEnvironment(context.customResolverOptions?.environment) ||\n // Only enable for client boundaries\n !context.customResolverOptions.clientboundary\n ) {\n return false;\n }\n\n // We don't support this in the resolver at the moment.\n if (moduleName.endsWith('/package.json')) {\n return false;\n }\n\n const isExternal = // Extern these modules in standard Node.js environments.\n /^(deprecated-react-native-prop-types|react|react\\/jsx-dev-runtime|scheduler|react-native|react-dom(\\/.+)?|metro-runtime(\\/.+)?)$/.test(\n moduleName\n ) ||\n // TODO: Add more\n /^@babel\\/runtime\\/helpers\\/(wrapNativeSuper)$/.test(moduleName);\n\n return isExternal;\n },\n replace: 'weak',\n },\n ];\n\n const skipMetroMainFieldOverride = env.EXPO_METRO_NO_MAIN_FIELD_OVERRIDE;\n const useExpoUnstableWebModule = env.EXPO_UNSTABLE_WEB_MODAL;\n const useExpoUnstableLogBox = env.EXPO_UNSTABLE_LOG_BOX;\n const disableReactNavigationCheck = env.EXPO_ROUTER_DISABLE_RN_NAVIGATION_CHECK;\n const disableNativeTabsMaterialSymbols = env.EXPO_ROUTER_DISABLE_NATIVE_TABS_MD;\n\n const metroConfigWithCustomResolver = withMetroResolvers(config, [\n // Mock out production react imports in development.\n function requestDevMockProdReact(\n context: ResolutionContext,\n moduleName: string,\n platform: string | null\n ) {\n // This resolution is dev-only to prevent bundling the production React packages in development.\n if (!context.dev) return null;\n\n if (\n // Match react-native renderers (in the platform's react-native host package).\n (platform !== 'web' &&\n getReactNativeHostPathPattern(platform)?.test(context.originModulePath) &&\n moduleName.match(/([\\\\/]ReactFabric|ReactNativeRenderer)-prod/)) ||\n // Match react production imports.\n (moduleName.match(/\\.production(\\.min)?\\.js$/) &&\n // Match if the import originated from a react package.\n context.originModulePath.match(/[\\\\/]node_modules[\\\\/](react[-\\\\/]|scheduler[\\\\/])/))\n ) {\n debug(`Skipping production module: ${moduleName}`);\n // /Users/path/to/expo/node_modules/react/index.js ./cjs/react.production.min.js\n // /Users/path/to/expo/node_modules/react/jsx-dev-runtime.js ./cjs/react-jsx-dev-runtime.production.min.js\n // /Users/path/to/expo/node_modules/react-is/index.js ./cjs/react-is.production.min.js\n // /Users/path/to/expo/node_modules/react-refresh/runtime.js ./cjs/react-refresh-runtime.production.min.js\n // /Users/path/to/expo/node_modules/react-native/node_modules/scheduler/index.native.js ./cjs/scheduler.native.production.min.js\n // /Users/path/to/expo/node_modules/react-native/node_modules/react-is/index.js ./cjs/react-is.production.min.js\n return {\n type: 'empty',\n };\n }\n return null;\n },\n\n isTsconfigPathsEnabled\n ? createTypescriptResolver({\n getStrictResolver,\n projectRoot: config.projectRoot,\n getMetroBundler,\n watch: !isExporting && !env.CI,\n })\n : undefined,\n\n // Node.js externals support\n function requestNodeExternals(\n context: ResolutionContext,\n moduleName: string,\n platform: string | null\n ) {\n const isServer =\n context.customResolverOptions?.environment === 'node' ||\n context.customResolverOptions?.environment === 'react-server';\n\n const moduleId = isNodeExternal(moduleName);\n if (!moduleId) {\n return null;\n }\n\n if (\n // In browser runtimes, we want to either resolve a local node module by the same name, or shim the module to\n // prevent crashing when Node.js built-ins are imported.\n !isServer\n ) {\n // Perform optional resolve first. If the module doesn't exist (no module in the node_modules)\n // then we can mock the file to use an empty module.\n const result = getOptionalResolver(context, platform)(moduleName);\n\n if (!result && platform !== 'web') {\n // Preserve previous behavior where native throws an error on node.js internals.\n return null;\n }\n\n return (\n result ?? {\n // In this case, mock the file to use an empty module.\n type: 'empty',\n }\n );\n }\n const contents = `module.exports=$$require_external('node:${moduleId}');`;\n debug(`Virtualizing Node.js \"${moduleId}\"`);\n const virtualModuleId = `\\0node:${moduleId}`;\n getMetroBundlerWithVirtualModules(getMetroBundler()).setVirtualModule(\n virtualModuleId,\n contents\n );\n return {\n type: 'sourceFile',\n filePath: virtualModuleId,\n };\n },\n\n // Custom externals support\n function requestCustomExternals(\n context: ResolutionContext,\n moduleName: string,\n platform: string | null\n ) {\n // We don't support this in the resolver at the moment.\n if (moduleName.endsWith('/package.json')) {\n return null;\n }\n // Skip applying JS externals for CSS files.\n if (/\\.(s?css|sass)$/.test(context.originModulePath)) {\n return null;\n }\n\n for (const external of externals) {\n if (external.match(context, moduleName, platform)) {\n if (external.replace === 'empty') {\n debug(`Redirecting external \"${moduleName}\" to \"${external.replace}\"`);\n return {\n type: external.replace,\n };\n } else if (external.replace === 'weak') {\n // TODO: Make this use require.resolveWeak again. Previously this was just resolving to the same path.\n const realModule = getStrictResolver(context, platform)(moduleName);\n const realPath = realModule.type === 'sourceFile' ? realModule.filePath : moduleName;\n const opaqueId = idFactory(realPath, {\n platform: platform!,\n environment: context.customResolverOptions?.environment,\n });\n const contents =\n typeof opaqueId === 'number'\n ? `module.exports=/*${moduleName}*/__r(${opaqueId})`\n : `module.exports=/*${moduleName}*/__r(${JSON.stringify(opaqueId)})`;\n // const contents = `module.exports=/*${moduleName}*/__r(require.resolveWeak('${moduleName}'))`;\n // const generatedModuleId = fastHashMemoized(contents);\n const virtualModuleId = `\\0weak:${opaqueId}`;\n debug('Virtualizing module:', moduleName, '->', virtualModuleId);\n getMetroBundlerWithVirtualModules(getMetroBundler()).setVirtualModule(\n virtualModuleId,\n contents\n );\n return {\n type: 'sourceFile',\n filePath: virtualModuleId,\n };\n } else if (external.replace === 'node') {\n // TODO(@kitten): Temporary workaround. Our externals logic here isn't generic and only works\n // for development and not exports. We never intend to use it in exported production bundles,\n // however, this is still a dangerous implementation. To protect us from externalizing modules\n // that aren't available to the app, we force any resolution to happen via the project root\n const projectRootContext: ResolutionContext = {\n ...context,\n nodeModulesPaths: [],\n originModulePath: projectRootOriginPath,\n disableHierarchicalLookup: false,\n };\n const externModule = getStrictResolver(projectRootContext, platform)(moduleName);\n if (externModule.type !== 'sourceFile') {\n return null;\n }\n const contents = `module.exports=$$require_external('${moduleName}')`;\n const virtualModuleId = `\\0node:${moduleName}`;\n debug('Virtualizing Node.js (custom):', moduleName, '->', virtualModuleId);\n getMetroBundlerWithVirtualModules(getMetroBundler()).setVirtualModule(\n virtualModuleId,\n contents\n );\n return {\n type: 'sourceFile',\n filePath: virtualModuleId,\n };\n } else {\n external.replace satisfies never;\n }\n }\n }\n return null;\n },\n\n // Basic moduleId aliases\n function requestAlias(context: ResolutionContext, moduleName: string, platform: string | null) {\n // Conditionally remap `react-native` to `react-native-web` on web in\n // a way that doesn't require Babel to resolve the alias.\n if (platform && platform in aliases && aliases[platform]![moduleName]) {\n const redirectedModuleName = aliases[platform]![moduleName];\n return getStrictResolver(context, platform)(redirectedModuleName);\n }\n\n for (const [matcher, alias] of getUniversalAliases()) {\n const match = moduleName.match(matcher);\n if (match) {\n const aliasedModule = alias.replace(\n /\\$(\\d+)/g,\n (_, index) => match[parseInt(index, 10)] ?? ''\n );\n const doResolve = getStrictResolver(context, platform);\n debug(`Alias \"${moduleName}\" to \"${aliasedModule}\"`);\n return doResolve(aliasedModule);\n }\n }\n\n return null;\n },\n\n // Polyfill for asset registry (assetRegistryPath) and async require module (asyncRequireModulePath)\n function requestStableConfigModules(\n context: ResolutionContext,\n moduleName: string,\n platform: string | null\n ) {\n if (moduleName === config.transformer.asyncRequireModulePath) {\n return getAsyncRequireModule();\n }\n\n // TODO(@kitten): Compare against `config.transformer.assetRegistryPath`\n if (/^@react-native\\/assets-registry\\/registry(\\.js)?$/.test(moduleName)) {\n return getAssetRegistryModule();\n }\n\n if (\n platform === 'web' &&\n context.originModulePath.match(/node_modules[\\\\/]react-native-web[\\\\/]/) &&\n moduleName.includes('/modules/AssetRegistry')\n ) {\n return getAssetRegistryModule();\n }\n\n return null;\n },\n\n createAutolinkingModuleResolver(autolinkingModuleResolverInput, {\n getStrictResolver,\n }),\n\n // TODO: Reduce these as much as possible in the future.\n // Complex post-resolution rewrites.\n function requestPostRewrites(\n context: ResolutionContext,\n moduleName: string,\n platform: string | null\n ) {\n // TODO(@kitten): replace and abstract doResolve logic, since it's unsafe and inefficient\n function doResolve(moduleName: string) {\n const projectRootContext: ResolutionContext = {\n ...context,\n nodeModulesPaths: [],\n originModulePath: projectRootOriginPath,\n disableHierarchicalLookup: false,\n };\n return getStrictResolver(projectRootContext, platform)(moduleName);\n }\n\n const result = getStrictResolver(context, platform)(moduleName);\n if (result.type !== 'sourceFile') {\n return result;\n }\n\n const normalizedPath = normalizeSlashes(result.filePath);\n\n const doReplace = (from: string, to: string | undefined, options?: { throws?: boolean }) =>\n doReplaceHelper(from, to, {\n normalizedPath,\n doResolve,\n ...options,\n });\n const doReplaceStrict = (from: string, to: string | undefined) =>\n doReplace(from, to, { throws: true });\n\n if (useExpoUnstableWebModule) {\n const webModalModule = doReplace(\n 'expo-router/build/layouts/_web-modal.js',\n 'expo-router/build/layouts/ExperimentalModalStack.js'\n );\n if (webModalModule) {\n debug('Using `_unstable-web-modal` implementation.');\n return webModalModule;\n }\n }\n\n if (disableNativeTabsMaterialSymbols && platform === 'android') {\n const materialIconConverterModule = doReplace(\n 'expo-router/build/native-tabs/utils/materialIconConverter.android.js',\n 'expo-router/build/native-tabs/utils/materialIconConverter-not-implemented.js'\n );\n if (materialIconConverterModule) {\n debug(\n 'Disabling md support in NativeTabs to tree-shake `expo-symbols` from the Android bundle.'\n );\n return materialIconConverterModule;\n }\n }\n\n if (!disableReactNavigationCheck) {\n // TODO(@ubax): Remove this rewrite once we published migration guide for library authors\n if (isExpoRouterInstalled && moduleName.startsWith('@react-navigation/')) {\n const filePath = context.originModulePath;\n if (!filePath.includes('node_modules')) {\n if (\n moduleName === '@react-navigation/native-stack' ||\n moduleName === '@react-navigation/drawer'\n ) {\n throw new Error(\n [\n 'As of SDK 56, expo-router is no longer compatible with react-navigation.',\n '',\n `Instead of ${moduleName}, use Stack or Drawer from expo-router instead:`,\n '',\n \" import { Stack } from 'expo-router';\",\n \" import { Drawer } from 'expo-router/drawer';\",\n '',\n 'For more information, see https://docs.expo.dev/router/migrate/sdk-55-to-56/.',\n 'You can disable this check by setting the environment variable EXPO_ROUTER_DISABLE_RN_NAVIGATION_CHECK=1.',\n ].join('\\n')\n );\n }\n throw new Error(\n 'As of SDK 56, expo-router is no longer compatible with react-navigation. For more information, see https://docs.expo.dev/router/migrate/sdk-55-to-56/. You can disable this check by setting the environment variable EXPO_ROUTER_DISABLE_RN_NAVIGATION_CHECK=1.'\n );\n }\n if (moduleName === '@react-navigation/core') {\n // We already checked if expo-router resolves\n return doResolve('expo-router/react-navigation');\n }\n }\n }\n\n if (platform === 'web') {\n if (result.filePath.includes('node_modules')) {\n // Disallow importing confusing native modules on web\n if (\n [\n 'react-native/Libraries/ReactPrivate/ReactNativePrivateInitializeCore',\n 'react-native/Libraries/Utilities/codegenNativeCommands',\n 'react-native/Libraries/Utilities/codegenNativeComponent',\n ].some((matcher) =>\n // Support absolute and modules with .js extensions.\n moduleName.includes(matcher)\n )\n ) {\n throw new FailedToResolveNativeOnlyModuleError(\n moduleName,\n path.relative(config.projectRoot, context.originModulePath)\n );\n }\n\n // Replace with static shims\n\n // Drop everything up until the `node_modules` folder.\n const normalName = normalizedPath.replace(/.*node_modules\\//, '');\n\n const shimFile = shouldCreateVirtualShim(normalName);\n if (shimFile) {\n const virtualId = `\\0shim:${normalName}`;\n const bundler = getMetroBundlerWithVirtualModules(getMetroBundler());\n if (!bundler.hasVirtualModule(virtualId)) {\n bundler.setVirtualModule(virtualId, fs.readFileSync(shimFile, 'utf8'));\n }\n debug(`Redirecting module \"${result.filePath}\" to shim`);\n\n return {\n ...result,\n filePath: virtualId,\n };\n }\n }\n } else {\n const isServer =\n context.customResolverOptions?.environment === 'node' ||\n context.customResolverOptions?.environment === 'react-server';\n const hostPackage = getReactNativeHostPackage(platform) ?? 'react-native';\n\n // Shim out React Native native runtime globals in server mode for native.\n if (isServer) {\n const emptyModule = doReplace(\n `${hostPackage}/Libraries/Core/InitializeCore.js`,\n undefined\n );\n if (emptyModule) {\n debug('Shimming out InitializeCore for React Native in native SSR bundle');\n return emptyModule;\n }\n }\n\n const hmrModule = doReplaceStrict(\n `${hostPackage}/Libraries/Utilities/HMRClient.js`,\n 'expo/src/async-require/hmr.ts'\n );\n if (hmrModule) return hmrModule;\n\n if (useExpoUnstableLogBox) {\n // TODO(@kitten): This can never resolve with isolated dependencies\n const logBoxModule = doReplace(\n `${hostPackage}/Libraries/LogBox/LogBoxInspectorContainer.js`,\n '@expo/log-box/swap-rn-logbox.js'\n );\n if (logBoxModule) return logBoxModule;\n\n const logBoxParserModule = doReplace(\n `${hostPackage}/Libraries/LogBox/Data/parseLogBoxLog.js`,\n '@expo/log-box/swap-rn-logbox-parser.js'\n );\n if (logBoxParserModule) return logBoxParserModule;\n }\n }\n\n return result;\n },\n\n // If at this point, we haven't resolved a module yet, if it's a module specifier for a known dependency\n // of either `expo` or `expo-router`, attempt to resolve it from these origin modules instead\n createFallbackModuleResolver({\n projectRoot: config.projectRoot,\n originModuleNames: ['expo', 'expo-router'],\n getStrictResolver,\n }),\n ]);\n\n // Ensure we mutate the resolution context to include the custom resolver options for server and web.\n const metroConfigWithCustomContext = withMetroMutatedResolverContext(\n metroConfigWithCustomResolver,\n (\n immutableContext: CustomResolutionContext,\n moduleName: string,\n platform: string | null\n ): CustomResolutionContext => {\n const context = asWritable({\n ...immutableContext,\n preferNativePlatform: platform !== 'web',\n });\n\n if (isServerEnvironment(context.customResolverOptions?.environment)) {\n // Adjust nodejs source extensions to sort mjs after js, including platform variants.\n if (nodejsSourceExtensions === null) {\n nodejsSourceExtensions = getNodejsExtensions(context.sourceExts);\n }\n context.sourceExts = nodejsSourceExtensions;\n\n context.unstable_enablePackageExports = true;\n context.unstable_conditionsByPlatform = {};\n\n const isReactServerComponents =\n context.customResolverOptions?.environment === 'react-server';\n\n if (isReactServerComponents) {\n // NOTE: Align the behavior across server and client. This is a breaking change so we'll just roll it out with React Server Components.\n // This ensures that react-server and client code both resolve `module` and `main` in the same order.\n if (platform === 'web') {\n // Node.js runtimes should only be importing main at the moment.\n // This is a temporary fix until we can support the package.json exports.\n context.mainFields = ['module', 'main'];\n } else {\n // In Node.js + native, use the standard main fields.\n context.mainFields = ['react-native', 'module', 'main'];\n }\n } else {\n if (platform === 'web') {\n // Node.js runtimes should only be importing main at the moment.\n // This is a temporary fix until we can support the package.json exports.\n context.mainFields = ['main', 'module'];\n } else {\n // In Node.js + native, use the standard main fields.\n context.mainFields = ['react-native', 'main', 'module'];\n }\n }\n\n // Enable react-server import conditions.\n if (context.customResolverOptions?.environment === 'react-server') {\n context.unstable_conditionNames = ['node', 'react-server', 'workerd'];\n } else {\n context.unstable_conditionNames = ['node'];\n }\n } else {\n // Non-server changes\n\n if (!skipMetroMainFieldOverride && platform && platform in preferredMainFields) {\n context.mainFields = preferredMainFields[platform]!;\n }\n }\n\n return context;\n }\n );\n\n return withMetroErrorReportingResolver(\n withMetroSupervisingTransformWorker(metroConfigWithCustomContext)\n );\n}\n\nfunction doReplaceHelper(\n from: string,\n to: string | undefined,\n {\n throws = false,\n normalizedPath,\n doResolve,\n }: {\n throws?: boolean;\n normalizedPath: string;\n doResolve: StrictResolver;\n }\n): SourceFileResolution | { type: 'empty' } | undefined {\n if (!normalizedPath.endsWith(from)) {\n return undefined;\n }\n\n if (to === undefined) {\n return {\n type: 'empty',\n };\n }\n\n try {\n const hmrModule = doResolve(to);\n if (hmrModule.type === 'sourceFile') {\n debug(`Using \\`${to}\\` implementation.`);\n return hmrModule;\n }\n } catch (resolutionError) {\n if (throws) {\n throw new Error(`Failed to replace ${from} with ${to}. Resolution of ${to} failed.`, {\n cause: resolutionError,\n });\n }\n\n debug(`Failed to resolve ${to} when swapping from ${from}: ${resolutionError}`);\n }\n return undefined;\n}\n\n/** @returns `true` if the incoming resolution should be swapped. */\nexport function shouldAliasModule(\n input: {\n platform: string | null;\n result: Resolution;\n },\n alias: { platform: string; output: string }\n): boolean {\n return (\n input.platform === alias.platform &&\n input.result?.type === 'sourceFile' &&\n typeof input.result?.filePath === 'string' &&\n normalizeSlashes(input.result.filePath).endsWith(alias.output)\n );\n}\n\n/** Add support for `react-native-web` and the Web platform. */\nexport async function withMetroMultiPlatformAsync(\n projectRoot: string,\n {\n config,\n exp,\n platformBundlers,\n\n isTsconfigPathsEnabled,\n isAutolinkingResolverEnabled,\n isExporting,\n isReactServerComponentsEnabled,\n\n getMetroBundler,\n }: {\n config: ConfigT;\n exp: ExpoConfig;\n isTsconfigPathsEnabled: boolean;\n platformBundlers: PlatformBundlers;\n serverRoot?: string | undefined;\n\n isAutolinkingResolverEnabled?: boolean;\n isExporting?: boolean;\n isReactServerComponentsEnabled: boolean;\n isNamedRequiresEnabled: boolean;\n\n getMetroBundler: () => Bundler;\n }\n) {\n const watchFolders = (config.watchFolders as string[]) || [];\n asWritable(config).watchFolders = watchFolders;\n\n // NOTE(@kitten): If the on-demand filesystem is enabled, we can aggressively cut down the `watchFolders`\n // to a minimum, since the files will be read lazily. This almost always speeds up exports\n if (isExporting && !!config.resolver.unstable_onDemandFilesystem) {\n watchFolders.length = 0;\n watchFolders.push(projectRoot);\n }\n\n // Change the default metro-runtime to a custom one that supports bundle splitting.\n // NOTE(@kitten): This is now always active and EXPO_USE_METRO_REQUIRE / isNamedRequiresEnabled is disregarded\n const metroDefaults: typeof import('@expo/metro/metro-config/defaults/defaults') = require('@expo/metro/metro-config/defaults/defaults');\n const metroRequirePolyfill = require.resolve('@expo/cli/build/metro-require/require');\n asWritable(metroDefaults).moduleSystem = metroRequirePolyfill;\n watchFolders.push(path.dirname(metroRequirePolyfill));\n\n // Required for @expo/metro-runtime to format paths in the web LogBox.\n process.env.EXPO_PUBLIC_PROJECT_ROOT = process.env.EXPO_PUBLIC_PROJECT_ROOT ?? projectRoot;\n\n const configPlatforms = getPlatformsFromConfig(projectRoot, exp);\n let expoConfigPlatforms = Object.entries(platformBundlers)\n .filter(\n ([platform, bundler]) => bundler === 'metro' && configPlatforms.includes(platform as Platform)\n )\n .map(([platform]) => platform);\n\n if (Array.isArray(config.resolver.platforms)) {\n expoConfigPlatforms = [...new Set(expoConfigPlatforms.concat(config.resolver.platforms))];\n }\n\n asWritable(config.resolver).platforms = expoConfigPlatforms;\n\n config = withWebPolyfills(config, { getMetroBundler });\n\n let autolinkingModuleResolverInput: AutolinkingModuleResolverInput | undefined;\n if (isAutolinkingResolverEnabled) {\n autolinkingModuleResolverInput = await createAutolinkingModuleResolverInput({\n platforms: expoConfigPlatforms,\n projectRoot,\n });\n }\n\n return withExtendedResolver(config, {\n autolinkingModuleResolverInput,\n isTsconfigPathsEnabled,\n isExporting,\n isReactServerComponentsEnabled,\n getMetroBundler,\n });\n}\n\nfunction hasExpoRouterModule(\n projectRoot: string,\n autolinkingModuleResolverInput: AutolinkingModuleResolverInput | undefined\n) {\n if (autolinkingModuleResolverInput) {\n // If we have autolinking enabled, we can skip resolution\n const platform = Object.keys(autolinkingModuleResolverInput)[0] as AutolinkingPlatform;\n return !!autolinkingModuleResolverInput[platform]?.resolvedModulePaths['expo-router'];\n } else {\n return !!resolveFrom(projectRoot, 'expo-router/package.json', {\n skipNodePath: true,\n });\n }\n}\n"],"names":["getNodejsExtensions","shouldAliasModule","withExtendedResolver","withMetroMultiPlatformAsync","ASSET_REGISTRY_SRC","constructPlatformExtensions","config","platformExtensions","Object","create","unstable_platformExtensions","resolver","platform","platforms","customPlatformExtensions","sourceExts","getPlatformExtensions","unstable_conditionNames","unstable_conditionsByPlatform","resolveWithPlatformExtensions","context","moduleName","platformContext","asWritable","preferNativePlatform","debug","require","input","_reactNativeHostPackages","Map","_reactNativeHostPathPatterns","getReactNativeHostPackage","supportPackage","get","undefined","getSupportPackageForPlatform","set","getReactNativeHostPathPattern","pattern","RegExp","withWebPolyfills","getMetroBundler","originalGetPolyfills","serializer","getPolyfills","bind","ctx","virtualEnvVarId","getMetroBundlerWithVirtualModules","setVirtualModule","virtualModuleId","virtualModulesPolyfills","rnGetPolyfills","filter","x","includes","error","code","polyfills","resolve","normalizeSlashes","p","replace","srcExts","mjsExts","ext","test","nodejsSourceExtensions","jsIndex","reduce","index","i","splice","autolinkingModuleResolverInput","isTsconfigPathsEnabled","isExporting","isReactServerComponentsEnabled","Log","warn","aliases","web","isExpoRouterInstalled","hasExpoRouterModule","projectRoot","_universalAliases","getUniversalAliases","resolveFrom","push","projectRootOriginPath","path","join","preferredMainFields","getStrictResolver","resolveRequest","doResolve","getOptionalResolver","optionalResolve","isResolutionError","isFailedToResolveNameError","isFailedToResolvePathError","idFactory","createModuleIdFactory","id","_asyncRequireModuleResolvedPath","getAsyncRequireModule","transformer","asyncRequireModulePath","type","filePath","getAssetRegistryModule","externals","match","customResolverOptions","exporting","isServerEnvironment","environment","process","clientboundary","endsWith","isExternal","skipMetroMainFieldOverride","env","EXPO_METRO_NO_MAIN_FIELD_OVERRIDE","useExpoUnstableWebModule","EXPO_UNSTABLE_WEB_MODAL","useExpoUnstableLogBox","EXPO_UNSTABLE_LOG_BOX","disableReactNavigationCheck","EXPO_ROUTER_DISABLE_RN_NAVIGATION_CHECK","disableNativeTabsMaterialSymbols","EXPO_ROUTER_DISABLE_NATIVE_TABS_MD","metroConfigWithCustomResolver","withMetroResolvers","requestDevMockProdReact","dev","originModulePath","createTypescriptResolver","watch","CI","requestNodeExternals","isServer","moduleId","isNodeExternal","result","contents","requestCustomExternals","external","realModule","realPath","opaqueId","JSON","stringify","projectRootContext","nodeModulesPaths","disableHierarchicalLookup","externModule","requestAlias","redirectedModuleName","matcher","alias","aliasedModule","_","parseInt","requestStableConfigModules","createAutolinkingModuleResolver","requestPostRewrites","normalizedPath","doReplace","from","to","options","doReplaceHelper","doReplaceStrict","throws","webModalModule","materialIconConverterModule","startsWith","Error","some","FailedToResolveNativeOnlyModuleError","relative","normalName","shimFile","shouldCreateVirtualShim","virtualId","bundler","hasVirtualModule","fs","readFileSync","hostPackage","emptyModule","hmrModule","logBoxModule","logBoxParserModule","createFallbackModuleResolver","originModuleNames","metroConfigWithCustomContext","withMetroMutatedResolverContext","immutableContext","unstable_enablePackageExports","isReactServerComponents","mainFields","withMetroErrorReportingResolver","withMetroSupervisingTransformWorker","resolutionError","cause","output","exp","platformBundlers","isAutolinkingResolverEnabled","watchFolders","unstable_onDemandFilesystem","length","metroDefaults","metroRequirePolyfill","moduleSystem","dirname","EXPO_PUBLIC_PROJECT_ROOT","configPlatforms","getPlatformsFromConfig","expoConfigPlatforms","entries","map","Array","isArray","Set","concat","createAutolinkingModuleResolverInput","keys","resolvedModulePaths","skipNodePath"],"mappings":"AAAA;;;;;CAKC;;;;;;;;;;;QAiOeA;eAAAA;;QAovBAC;eAAAA;;QA/tBAC;eAAAA;;QA+uBMC;eAAAA;;;;yBAn+BiB;;;;;;;yBACD;;;;;;;yBAQF;;;;;;;yBAER;;;;;;;gEACb;;;;;;;gEACE;;;;;;+CASV;4CACsC;sDACQ;2BACG;6BACe;qCACrB;iDACF;oCACoB;qDAChB;qBAChC;qBACA;8BACgB;0CAEK;;;;;;AAQzC,MAAMC,qBAAqB,CAAC,6FAA6F,CAAC;AAO1H,SAASC,4BACPC,MAAe;QAaQA;IAXvB,MAAMC,qBAAqEC,OAAOC,MAAM,CAAC;IACzF,gFAAgF;IAChF,IAAIC;IACJ,IACEJ,OAAOK,QAAQ,IACf,iCAAiCL,OAAOK,QAAQ,IAChDL,OAAOK,QAAQ,CAACD,2BAA2B,IAC3C,OAAOJ,OAAOK,QAAQ,CAACD,2BAA2B,KAAK,UACvD;QACAA,8BAA8BJ,OAAOK,QAAQ,CAACD,2BAA2B;IAC3E;IACA,KAAK,MAAME,YAAYN,EAAAA,mBAAAA,OAAOK,QAAQ,qBAAfL,iBAAiBO,SAAS,KAAI,EAAE,CAAE;QACvD,MAAMC,2BAA2BJ,+CAAAA,2BAA6B,CAACE,SAAS;QACxE,MAAMG,aAAaC,IAAAA,8BAAqB,EACtCJ,UACAN,OAAOK,QAAQ,CAACI,UAAU,EAC1BD;QAEF,6FAA6F;QAC7F,MAAMG,0BAA0B;eAC3BX,OAAOK,QAAQ,CAACM,uBAAuB;eACtCX,OAAOK,QAAQ,CAACO,6BAA6B,CAACN,SAAS,IAAI,EAAE;SAClE;QACD,IAAIG,YAAY;YACdR,kBAAkB,CAACK,SAAqB,GAAG;gBAAEG;gBAAYE;YAAwB;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AA8B;QAChCxI,iCAAiC,MAAM0J,IAAAA,mEAAoC,EAAC;YAC1EtN,WAAW+M;YACXzI;QACF;IACF;IAEA,OAAOjF,qBAAqBI,QAAQ;QAClCmE;QACAC;QACAC;QACAC;QACAnC;IACF;AACF;AAEA,SAASyC,oBACPC,WAAmB,EACnBV,8BAA0E;IAE1E,IAAIA,gCAAgC;YAGzBA;QAFT,yDAAyD;QACzD,MAAM7D,WAAWJ,OAAO4N,IAAI,CAAC3J,+BAA+B,CAAC,EAAE;QAC/D,OAAO,CAAC,GAACA,2CAAAA,8BAA8B,CAAC7D,SAAS,qBAAxC6D,yCAA0C4J,mBAAmB,CAAC,cAAc;IACvF,OAAO;QACL,OAAO,CAAC,CAAC/I,IAAAA,2BAAW,EAACH,aAAa,4BAA4B;YAC5DmJ,cAAc;QAChB;IACF;AACF"}
1
+ {"version":3,"sources":["../../../../../src/start/server/metro/withMetroMultiPlatform.ts"],"sourcesContent":["/**\n * Copyright © 2022 650 Industries.\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 */\nimport type { ExpoConfig, Platform } from '@expo/config';\nimport { getPlatformsFromConfig } from '@expo/config';\nimport { getPlatformExtensions } from '@expo/config/paths';\nimport type Bundler from '@expo/metro/metro/Bundler';\nimport type { ConfigT } from '@expo/metro/metro-config';\nimport type {\n Resolution,\n ResolutionContext,\n CustomResolutionContext,\n} from '@expo/metro/metro-resolver';\nimport { resolve as resolver } from '@expo/metro/metro-resolver';\nimport type { SourceFileResolution } from '@expo/metro/metro-resolver/types';\nimport { resolveFrom } from '@expo/require-utils';\nimport fs from 'fs';\nimport path from 'path';\n\nimport type {\n AutolinkingModuleResolverInput,\n AutolinkingPlatform,\n} from './createExpoAutolinkingResolver';\nimport {\n createAutolinkingModuleResolverInput,\n createAutolinkingModuleResolver,\n} from './createExpoAutolinkingResolver';\nimport { createFallbackModuleResolver } from './createExpoFallbackResolver';\nimport { FailedToResolveNativeOnlyModuleError } from './errors/FailedToResolveNativeOnlyModuleError';\nimport { isNodeExternal, shouldCreateVirtualShim } from './externals';\nimport { isFailedToResolveNameError, isFailedToResolvePathError } from './metroErrors';\nimport { getMetroBundlerWithVirtualModules } from './metroVirtualModules';\nimport { withMetroErrorReportingResolver } from './withMetroErrorReportingResolver';\nimport { withMetroMutatedResolverContext, withMetroResolvers } from './withMetroResolvers';\nimport { withMetroSupervisingTransformWorker } from './withMetroSupervisingTransformWorker';\nimport { Log } from '../../../log';\nimport { isPathInside } from '../../../utils/dir';\nimport { env } from '../../../utils/env';\nimport { isServerEnvironment } from '../middleware/metroOptions';\nimport type { PlatformBundlers } from '../platformBundlers';\nimport { createTypescriptResolver } from './createTypescriptResolver';\n\nexport type StrictResolver = (moduleName: string) => Resolution;\nexport type StrictResolverFactory = (\n context: ResolutionContext,\n platform: string | null\n) => StrictResolver;\n\nconst ASSET_REGISTRY_SRC = `const assets=[];module.exports={registerAsset:s=>assets.push(s),getAssetByID:s=>assets[s-1]};`;\n\ninterface PlatformExtensions {\n sourceExts: string[];\n unstable_conditionNames: string[];\n}\n\nfunction constructPlatformExtensions(\n config: ConfigT\n): Record<string, PlatformExtensions | undefined> {\n const platformExtensions: Record<string, PlatformExtensions | undefined> = Object.create(null);\n // TODO(@kitten): Temporary internal override config for per-platform extensions\n let unstable_platformExtensions: Record<string, string[] | undefined> | undefined;\n if (\n config.resolver &&\n 'unstable_platformExtensions' in config.resolver &&\n config.resolver.unstable_platformExtensions &&\n typeof config.resolver.unstable_platformExtensions === 'object'\n ) {\n unstable_platformExtensions = config.resolver.unstable_platformExtensions as any;\n }\n for (const platform of config.resolver?.platforms ?? []) {\n const customPlatformExtensions = unstable_platformExtensions?.[platform];\n const sourceExts = getPlatformExtensions(\n platform,\n config.resolver.sourceExts,\n customPlatformExtensions\n );\n // Platform-less resolution drops the platform's package-exports conditions, so fold them in.\n const unstable_conditionNames = [\n ...config.resolver.unstable_conditionNames,\n ...(config.resolver.unstable_conditionsByPlatform[platform] ?? []),\n ];\n if (sourceExts) {\n platformExtensions[platform as Platform] = { sourceExts, unstable_conditionNames };\n }\n }\n return platformExtensions;\n}\n\nfunction resolveWithPlatformExtensions(\n platformExtensions: PlatformExtensions,\n context: ResolutionContext,\n moduleName: string\n): Resolution {\n const platformContext = asWritable(context);\n platformContext.preferNativePlatform = false;\n platformContext.sourceExts = platformExtensions.sourceExts;\n platformContext.unstable_conditionNames = platformExtensions.unstable_conditionNames;\n return resolver(platformContext, moduleName, null);\n}\n\nconst debug = require('debug')('expo:start:server:metro:multi-platform') as typeof console.log;\n\nfunction asWritable<T>(input: T): { -readonly [K in keyof T]: T[K] } {\n return input;\n}\n\nconst _reactNativeHostPackages = new Map<string, string | null>();\nconst _reactNativeHostPathPatterns = new Map<string, RegExp | null>();\n\nfunction getReactNativeHostPackage(platform: string | null): string | null {\n if (!platform) {\n return null;\n }\n let supportPackage = _reactNativeHostPackages.get(platform);\n if (supportPackage === undefined) {\n const { getSupportPackageForPlatform } =\n require('expo/internal/unstable-autolinking-exports') as typeof import('expo-modules-autolinking/exports');\n supportPackage = getSupportPackageForPlatform(platform);\n _reactNativeHostPackages.set(platform, supportPackage);\n }\n return supportPackage;\n}\n\nfunction getReactNativeHostPathPattern(platform: string | null): RegExp | null {\n if (!platform) {\n return null;\n }\n let pattern = _reactNativeHostPathPatterns.get(platform);\n if (pattern === undefined) {\n const supportPackage = getReactNativeHostPackage(platform);\n pattern = supportPackage\n ? new RegExp(`[\\\\\\\\/]node_modules[\\\\\\\\/]${supportPackage}[\\\\\\\\/]`)\n : null;\n _reactNativeHostPathPatterns.set(platform, pattern);\n }\n return pattern;\n}\n\nfunction withWebPolyfills(\n config: ConfigT,\n {\n getMetroBundler,\n }: {\n getMetroBundler: () => Bundler;\n }\n): ConfigT {\n const originalGetPolyfills = config.serializer.getPolyfills\n ? config.serializer.getPolyfills.bind(config.serializer)\n : () => [];\n\n const getPolyfills = (ctx: { platform?: string | null }): readonly string[] => {\n const virtualEnvVarId = `\\0polyfill:environment-variables`;\n\n getMetroBundlerWithVirtualModules(getMetroBundler()).setVirtualModule(\n virtualEnvVarId,\n (() => {\n return `//`;\n })()\n );\n\n const virtualModuleId = `\\0polyfill:external-require`;\n\n getMetroBundlerWithVirtualModules(getMetroBundler()).setVirtualModule(\n virtualModuleId,\n (() => {\n if (ctx.platform === 'web') {\n // NOTE(@hassankhan): We need to wrap require in an arrow function rather than assigning\n // it directly because `workerd` loses its `this` context when `require` is dereferenced\n // and called later.\n return `global.$$require_external = typeof require !== \"undefined\" ? (m) => require(m) : () => null;`;\n } else {\n // Wrap in try/catch to support Android.\n return 'try { global.$$require_external = typeof expo === \"undefined\" ? require : (moduleId) => { throw new Error(`Node.js standard library module ${moduleId} is not available in this JavaScript environment`);} } catch { global.$$require_external = (moduleId) => { throw new Error(`Node.js standard library module ${moduleId} is not available in this JavaScript environment`);} }';\n }\n })()\n );\n\n const virtualModulesPolyfills = [virtualModuleId, virtualEnvVarId];\n\n if (ctx.platform === 'web') {\n try {\n const rnGetPolyfills: () => string[] = require('react-native/rn-get-polyfills');\n return [\n ...virtualModulesPolyfills,\n // Ensure that the error-guard polyfill is included in the web polyfills to\n // make metro-runtime work correctly.\n // TODO: This module is pretty big for a function that simply re-throws an error that doesn't need to be caught.\n // NOTE(@kitten): This is technically the public API to get polyfills rather than resolving directly into\n // `@react-native/js-polyfills`. We should really just start vendoring these, but for now, this exclusion works\n ...rnGetPolyfills().filter((x: string) => !x.includes('/console')),\n ];\n } catch (error: any) {\n if ('code' in error && error.code === 'MODULE_NOT_FOUND') {\n // If react-native is not installed, because we're targeting web, we still continue\n // This should be rare, but we add it so we don't unnecessarily have a fixed peer dependency on react-native\n debug(\n 'Skipping react-native/rn-get-polyfills from getPolyfills. react-native is not installed.'\n );\n return virtualModulesPolyfills;\n } else {\n throw error;\n }\n }\n }\n\n // Generally uses `@expo/metro-config`'s `getPolyfills` function, unless overridden\n const polyfills = originalGetPolyfills(ctx);\n return [\n ...polyfills,\n ...virtualModulesPolyfills,\n // Removed on server platforms during the transform.\n require.resolve('expo/virtual/streams.js'),\n ];\n };\n\n return {\n ...config,\n serializer: {\n ...config.serializer,\n getPolyfills,\n },\n };\n}\n\nfunction normalizeSlashes(p: string) {\n return p.replace(/\\\\/g, '/');\n}\n\nexport function getNodejsExtensions(srcExts: readonly string[]): string[] {\n const mjsExts = srcExts.filter((ext) => /mjs$/.test(ext));\n const nodejsSourceExtensions = srcExts.filter((ext) => !/mjs$/.test(ext));\n // find index of last `*.js` extension\n const jsIndex = nodejsSourceExtensions.reduce((index, ext, i) => {\n return /jsx?$/.test(ext) ? i : index;\n }, -1);\n\n // insert `*.mjs` extensions after `*.js` extensions\n nodejsSourceExtensions.splice(jsIndex + 1, 0, ...mjsExts);\n\n return nodejsSourceExtensions;\n}\n\n/**\n * Apply custom resolvers to do the following:\n * - Disable `.native.js` extensions on web.\n * - Alias `react-native` to `react-native-web` on web.\n * - Redirect `react-native-web/dist/modules/AssetRegistry/index.js` to `@react-native/assets/registry.js` on web.\n * - Add support for `tsconfig.json`/`jsconfig.json` aliases via `compilerOptions.paths`.\n */\nexport function withExtendedResolver(\n config: ConfigT,\n {\n autolinkingModuleResolverInput,\n isTsconfigPathsEnabled,\n isExporting,\n isReactServerComponentsEnabled,\n getMetroBundler,\n }: {\n autolinkingModuleResolverInput?: AutolinkingModuleResolverInput;\n isTsconfigPathsEnabled?: boolean;\n isExporting?: boolean;\n isReactServerComponentsEnabled?: boolean;\n getMetroBundler: () => Bundler;\n }\n) {\n if (isReactServerComponentsEnabled) {\n Log.warn(`React Server Components (beta) is enabled.`);\n }\n\n const aliases: { [key: string]: Record<string, string> } = {\n web: {\n 'react-native': 'react-native-web',\n 'react-native/index': 'react-native-web',\n 'react-native/Libraries/Image/resolveAssetSource': 'expo-asset/build/resolveAssetSource',\n },\n };\n\n const isExpoRouterInstalled = hasExpoRouterModule(\n config.projectRoot,\n autolinkingModuleResolverInput\n );\n\n let _universalAliases: [RegExp, string][] | null;\n\n function getUniversalAliases() {\n if (_universalAliases) {\n return _universalAliases;\n }\n\n _universalAliases = [];\n\n // This package is currently always installed as it is included in the `expo` package.\n if (resolveFrom(config.projectRoot, '@expo/vector-icons/package.json')) {\n debug('Enabling alias: react-native-vector-icons -> @expo/vector-icons');\n _universalAliases.push([/^react-native-vector-icons(\\/.*)?/, '@expo/vector-icons$1']);\n }\n if (isReactServerComponentsEnabled) {\n if (resolveFrom(config.projectRoot, 'expo-router/rsc')) {\n debug('Enabling bridge alias: expo-router -> expo-router/rsc');\n _universalAliases.push([/^expo-router$/, 'expo-router/rsc']);\n // Bridge the internal entry point which is a standalone import to ensure package.json resolution works as expected.\n _universalAliases.push([/^expo-router\\/entry-classic$/, 'expo-router/rsc/entry']);\n }\n }\n return _universalAliases;\n }\n\n // used to resolve externals in `requestCustomExternals` from the project root\n const projectRootOriginPath = path.join(config.projectRoot, 'package.json');\n\n const preferredMainFields: { [key: string]: string[] } = {\n // Defaults from Expo Webpack. Most packages using `react-native` don't support web\n // in the `react-native` field, so we should prefer the `browser` field.\n // https://github.com/expo/router/issues/37\n web: ['browser', 'module', 'main'],\n };\n\n let nodejsSourceExtensions: string[] | null = null;\n\n const platformExtensions = constructPlatformExtensions(config);\n\n const getStrictResolver: StrictResolverFactory = (\n { resolveRequest, ...context },\n platform\n ): StrictResolver => {\n return function doResolve(moduleName: string): Resolution {\n if (platform != null && platformExtensions[platform]) {\n return resolveWithPlatformExtensions(platformExtensions[platform], context, moduleName);\n } else {\n return resolver(context, moduleName, platform);\n }\n };\n };\n\n function getOptionalResolver(context: ResolutionContext, platform: string | null) {\n const doResolve = getStrictResolver(context, platform);\n return function optionalResolve(moduleName: string): Resolution | null {\n try {\n return doResolve(moduleName);\n } catch (error) {\n // If the error is directly related to a resolver not being able to resolve a module, then\n // we can ignore the error and try the next resolver. Otherwise, we should throw the error.\n const isResolutionError =\n isFailedToResolveNameError(error) || isFailedToResolvePathError(error);\n if (!isResolutionError) {\n throw error;\n }\n }\n return null;\n };\n }\n\n // TODO: This is a hack to get resolveWeak working.\n const idFactory = (config.serializer?.createModuleIdFactory?.() ??\n ((id: number | string, context: { platform: string; environment?: string }): number | string =>\n id)) as (\n id: number | string,\n context: { platform: string; environment?: string }\n ) => number | string;\n\n // We're manually resolving the `asyncRequireModulePath` since it's a module request\n // However, in isolated installations it might not resolve from all paths, so we're resolving\n // it from the project root manually\n let _asyncRequireModuleResolvedPath: string | null | undefined;\n const getAsyncRequireModule = () => {\n if (_asyncRequireModuleResolvedPath === undefined) {\n _asyncRequireModuleResolvedPath =\n resolveFrom(config.projectRoot, config.transformer.asyncRequireModulePath) ?? null;\n }\n return _asyncRequireModuleResolvedPath\n ? ({ type: 'sourceFile', filePath: _asyncRequireModuleResolvedPath } as const)\n : null;\n };\n\n const getAssetRegistryModule = () => {\n const virtualModuleId = `\\0polyfill:assets-registry`;\n getMetroBundlerWithVirtualModules(getMetroBundler()).setVirtualModule(\n virtualModuleId,\n ASSET_REGISTRY_SRC\n );\n return {\n type: 'sourceFile',\n filePath: virtualModuleId,\n } as const;\n };\n\n // If Node.js pass-through, then remap to a module like `module.exports = $$require_external(<module>)`.\n // If module should be shimmed, remap to an empty module.\n const externals: {\n match: (context: ResolutionContext, moduleName: string, platform: string | null) => boolean;\n replace: 'empty' | 'node' | 'weak';\n }[] = [\n {\n match: (context: ResolutionContext, moduleName: string) => {\n if (\n // Disable internal externals when exporting for production.\n context.customResolverOptions.exporting ||\n // These externals are only for Node.js environments.\n !isServerEnvironment(context.customResolverOptions?.environment)\n ) {\n return false;\n }\n\n if (context.customResolverOptions?.environment === 'react-server') {\n // Ensure these non-react-server modules are excluded when bundling for React Server Components in development.\n return /^(@babel\\/runtime\\/.+|debug|metro-runtime\\/src\\/modules\\/HMRClient|metro|acorn-loose|acorn|chalk|ws|ansi-styles|supports-color|color-convert|has-flag|utf-8-validate|color-name|react-refresh\\/runtime|@remix-run\\/node\\/.+)$/.test(\n moduleName\n );\n }\n\n // TODO: Windows doesn't support externals somehow.\n if (process.platform === 'win32') {\n return false;\n }\n\n // Extern these modules in standard Node.js environments in development to prevent API routes side-effects\n // from leaking into the dev server process.\n return /^(react|@radix-ui\\/.+|@babel\\/runtime\\/.+|react-dom(\\/.+)?|debug|acorn-loose|acorn|css-in-js-utils\\/lib\\/.+|hyphenate-style-name|color|color-string|color-convert|color-name|fontfaceobserver|fast-deep-equal|query-string|escape-string-regexp|invariant|postcss-value-parser|memoize-one|nullthrows|strict-uri-encode|decode-uri-component|split-on-first|filter-obj|warn-once|simple-swizzle|is-arrayish|inline-style-prefixer\\/.+)$/.test(\n moduleName\n );\n },\n replace: 'node',\n },\n // Externals to speed up async split chunks by extern-ing common packages that appear in the root client chunk.\n {\n match: (context: ResolutionContext, moduleName: string, platform: string | null) => {\n if (\n // Disable internal externals when exporting for production.\n context.customResolverOptions.exporting ||\n // These externals are only for client environments.\n isServerEnvironment(context.customResolverOptions?.environment) ||\n // Only enable for client boundaries\n !context.customResolverOptions.clientboundary\n ) {\n return false;\n }\n\n // We don't support this in the resolver at the moment.\n if (moduleName.endsWith('/package.json')) {\n return false;\n }\n\n const isExternal = // Extern these modules in standard Node.js environments.\n /^(deprecated-react-native-prop-types|react|react\\/jsx-dev-runtime|scheduler|react-native|react-dom(\\/.+)?|metro-runtime(\\/.+)?)$/.test(\n moduleName\n ) ||\n // TODO: Add more\n /^@babel\\/runtime\\/helpers\\/(wrapNativeSuper)$/.test(moduleName);\n\n return isExternal;\n },\n replace: 'weak',\n },\n ];\n\n const skipMetroMainFieldOverride = env.EXPO_METRO_NO_MAIN_FIELD_OVERRIDE;\n const useExpoUnstableWebModule = env.EXPO_UNSTABLE_WEB_MODAL;\n const useExpoUnstableLogBox = env.EXPO_UNSTABLE_LOG_BOX;\n const disableReactNavigationCheck = env.EXPO_ROUTER_DISABLE_RN_NAVIGATION_CHECK;\n const disableNativeTabsMaterialSymbols = env.EXPO_ROUTER_DISABLE_NATIVE_TABS_MD;\n\n const metroConfigWithCustomResolver = withMetroResolvers(config, [\n // Mock out production react imports in development.\n function requestDevMockProdReact(\n context: ResolutionContext,\n moduleName: string,\n platform: string | null\n ) {\n // This resolution is dev-only to prevent bundling the production React packages in development.\n if (!context.dev) return null;\n\n if (\n // Match react-native renderers (in the platform's react-native host package).\n (platform !== 'web' &&\n getReactNativeHostPathPattern(platform)?.test(context.originModulePath) &&\n moduleName.match(/([\\\\/]ReactFabric|ReactNativeRenderer)-prod/)) ||\n // Match react production imports.\n (moduleName.match(/\\.production(\\.min)?\\.js$/) &&\n // Match if the import originated from a react package.\n context.originModulePath.match(/[\\\\/]node_modules[\\\\/](react[-\\\\/]|scheduler[\\\\/])/))\n ) {\n debug(`Skipping production module: ${moduleName}`);\n // /Users/path/to/expo/node_modules/react/index.js ./cjs/react.production.min.js\n // /Users/path/to/expo/node_modules/react/jsx-dev-runtime.js ./cjs/react-jsx-dev-runtime.production.min.js\n // /Users/path/to/expo/node_modules/react-is/index.js ./cjs/react-is.production.min.js\n // /Users/path/to/expo/node_modules/react-refresh/runtime.js ./cjs/react-refresh-runtime.production.min.js\n // /Users/path/to/expo/node_modules/react-native/node_modules/scheduler/index.native.js ./cjs/scheduler.native.production.min.js\n // /Users/path/to/expo/node_modules/react-native/node_modules/react-is/index.js ./cjs/react-is.production.min.js\n return {\n type: 'empty',\n };\n }\n return null;\n },\n\n isTsconfigPathsEnabled\n ? createTypescriptResolver({\n getStrictResolver,\n projectRoot: config.projectRoot,\n getMetroBundler,\n watch: !isExporting && !env.CI,\n })\n : undefined,\n\n // Node.js externals support\n function requestNodeExternals(\n context: ResolutionContext,\n moduleName: string,\n platform: string | null\n ) {\n const isServer =\n context.customResolverOptions?.environment === 'node' ||\n context.customResolverOptions?.environment === 'react-server';\n\n const moduleId = isNodeExternal(moduleName);\n if (!moduleId) {\n return null;\n }\n\n if (\n // In browser runtimes, we want to either resolve a local node module by the same name, or shim the module to\n // prevent crashing when Node.js built-ins are imported.\n !isServer\n ) {\n // Perform optional resolve first. If the module doesn't exist (no module in the node_modules)\n // then we can mock the file to use an empty module.\n const result = getOptionalResolver(context, platform)(moduleName);\n\n if (!result && platform !== 'web') {\n // Preserve previous behavior where native throws an error on node.js internals.\n return null;\n }\n\n return (\n result ?? {\n // In this case, mock the file to use an empty module.\n type: 'empty',\n }\n );\n }\n const contents = `module.exports=$$require_external('node:${moduleId}');`;\n debug(`Virtualizing Node.js \"${moduleId}\"`);\n const virtualModuleId = `\\0node:${moduleId}`;\n getMetroBundlerWithVirtualModules(getMetroBundler()).setVirtualModule(\n virtualModuleId,\n contents\n );\n return {\n type: 'sourceFile',\n filePath: virtualModuleId,\n };\n },\n\n // Custom externals support\n function requestCustomExternals(\n context: ResolutionContext,\n moduleName: string,\n platform: string | null\n ) {\n // We don't support this in the resolver at the moment.\n if (moduleName.endsWith('/package.json')) {\n return null;\n }\n // Skip applying JS externals for CSS files.\n if (/\\.(s?css|sass)$/.test(context.originModulePath)) {\n return null;\n }\n\n for (const external of externals) {\n if (external.match(context, moduleName, platform)) {\n if (external.replace === 'empty') {\n debug(`Redirecting external \"${moduleName}\" to \"${external.replace}\"`);\n return {\n type: external.replace,\n };\n } else if (external.replace === 'weak') {\n // TODO: Make this use require.resolveWeak again. Previously this was just resolving to the same path.\n const realModule = getStrictResolver(context, platform)(moduleName);\n const realPath = realModule.type === 'sourceFile' ? realModule.filePath : moduleName;\n const opaqueId = idFactory(realPath, {\n platform: platform!,\n environment: context.customResolverOptions?.environment,\n });\n const contents =\n typeof opaqueId === 'number'\n ? `module.exports=/*${moduleName}*/__r(${opaqueId})`\n : `module.exports=/*${moduleName}*/__r(${JSON.stringify(opaqueId)})`;\n // const contents = `module.exports=/*${moduleName}*/__r(require.resolveWeak('${moduleName}'))`;\n // const generatedModuleId = fastHashMemoized(contents);\n const virtualModuleId = `\\0weak:${opaqueId}`;\n debug('Virtualizing module:', moduleName, '->', virtualModuleId);\n getMetroBundlerWithVirtualModules(getMetroBundler()).setVirtualModule(\n virtualModuleId,\n contents\n );\n return {\n type: 'sourceFile',\n filePath: virtualModuleId,\n };\n } else if (external.replace === 'node') {\n // TODO(@kitten): Temporary workaround. Our externals logic here isn't generic and only works\n // for development and not exports. We never intend to use it in exported production bundles,\n // however, this is still a dangerous implementation. To protect us from externalizing modules\n // that aren't available to the app, we force any resolution to happen via the project root\n const projectRootContext: ResolutionContext = {\n ...context,\n nodeModulesPaths: [],\n originModulePath: projectRootOriginPath,\n disableHierarchicalLookup: false,\n };\n const externModule = getStrictResolver(projectRootContext, platform)(moduleName);\n if (externModule.type !== 'sourceFile') {\n return null;\n }\n const contents = `module.exports=$$require_external('${moduleName}')`;\n const virtualModuleId = `\\0node:${moduleName}`;\n debug('Virtualizing Node.js (custom):', moduleName, '->', virtualModuleId);\n getMetroBundlerWithVirtualModules(getMetroBundler()).setVirtualModule(\n virtualModuleId,\n contents\n );\n return {\n type: 'sourceFile',\n filePath: virtualModuleId,\n };\n } else {\n external.replace satisfies never;\n }\n }\n }\n return null;\n },\n\n // Basic moduleId aliases\n function requestAlias(context: ResolutionContext, moduleName: string, platform: string | null) {\n // Conditionally remap `react-native` to `react-native-web` on web in\n // a way that doesn't require Babel to resolve the alias.\n if (platform && platform in aliases && aliases[platform]![moduleName]) {\n const redirectedModuleName = aliases[platform]![moduleName];\n return getStrictResolver(context, platform)(redirectedModuleName);\n }\n\n for (const [matcher, alias] of getUniversalAliases()) {\n const match = moduleName.match(matcher);\n if (match) {\n const aliasedModule = alias.replace(\n /\\$(\\d+)/g,\n (_, index) => match[parseInt(index, 10)] ?? ''\n );\n const doResolve = getStrictResolver(context, platform);\n debug(`Alias \"${moduleName}\" to \"${aliasedModule}\"`);\n return doResolve(aliasedModule);\n }\n }\n\n return null;\n },\n\n // Polyfill for asset registry (assetRegistryPath) and async require module (asyncRequireModulePath)\n function requestStableConfigModules(\n context: ResolutionContext,\n moduleName: string,\n platform: string | null\n ) {\n if (moduleName === config.transformer.asyncRequireModulePath) {\n return getAsyncRequireModule();\n }\n\n // TODO(@kitten): Compare against `config.transformer.assetRegistryPath`\n if (/^@react-native\\/assets-registry\\/registry(\\.js)?$/.test(moduleName)) {\n return getAssetRegistryModule();\n }\n\n if (\n platform === 'web' &&\n context.originModulePath.match(/node_modules[\\\\/]react-native-web[\\\\/]/) &&\n moduleName.includes('/modules/AssetRegistry')\n ) {\n return getAssetRegistryModule();\n }\n\n return null;\n },\n\n createAutolinkingModuleResolver(autolinkingModuleResolverInput, {\n getStrictResolver,\n }),\n\n // TODO: Reduce these as much as possible in the future.\n // Complex post-resolution rewrites.\n function requestPostRewrites(\n context: ResolutionContext,\n moduleName: string,\n platform: string | null\n ) {\n // TODO(@kitten): replace and abstract doResolve logic, since it's unsafe and inefficient\n function doResolve(moduleName: string) {\n const projectRootContext: ResolutionContext = {\n ...context,\n nodeModulesPaths: [],\n originModulePath: projectRootOriginPath,\n disableHierarchicalLookup: false,\n };\n return getStrictResolver(projectRootContext, platform)(moduleName);\n }\n\n const result = getStrictResolver(context, platform)(moduleName);\n if (result.type !== 'sourceFile') {\n return result;\n }\n\n const normalizedPath = normalizeSlashes(result.filePath);\n\n const doReplace = (from: string, to: string | undefined, options?: { throws?: boolean }) =>\n doReplaceHelper(from, to, {\n normalizedPath,\n doResolve,\n ...options,\n });\n const doReplaceStrict = (from: string, to: string | undefined) =>\n doReplace(from, to, { throws: true });\n\n if (useExpoUnstableWebModule) {\n const webModalModule = doReplace(\n 'expo-router/build/layouts/_web-modal.js',\n 'expo-router/build/layouts/ExperimentalModalStack.js'\n );\n if (webModalModule) {\n debug('Using `_unstable-web-modal` implementation.');\n return webModalModule;\n }\n }\n\n if (disableNativeTabsMaterialSymbols && platform === 'android') {\n const materialIconConverterModule = doReplace(\n 'expo-router/build/native-tabs/utils/materialIconConverter.android.js',\n 'expo-router/build/native-tabs/utils/materialIconConverter-not-implemented.js'\n );\n if (materialIconConverterModule) {\n debug(\n 'Disabling md support in NativeTabs to tree-shake `expo-symbols` from the Android bundle.'\n );\n return materialIconConverterModule;\n }\n }\n\n if (!disableReactNavigationCheck) {\n // TODO(@ubax): Remove this rewrite once we published migration guide for library authors\n if (isExpoRouterInstalled && moduleName.startsWith('@react-navigation/')) {\n const filePath = context.originModulePath;\n if (!filePath.includes('node_modules')) {\n if (\n moduleName === '@react-navigation/native-stack' ||\n moduleName === '@react-navigation/drawer'\n ) {\n throw new Error(\n [\n 'As of SDK 56, expo-router is no longer compatible with react-navigation.',\n '',\n `Instead of ${moduleName}, use Stack or Drawer from expo-router instead:`,\n '',\n \" import { Stack } from 'expo-router';\",\n \" import { Drawer } from 'expo-router/drawer';\",\n '',\n 'For more information, see https://docs.expo.dev/router/migrate/sdk-55-to-56/.',\n 'You can disable this check by setting the environment variable EXPO_ROUTER_DISABLE_RN_NAVIGATION_CHECK=1.',\n ].join('\\n')\n );\n }\n throw new Error(\n 'As of SDK 56, expo-router is no longer compatible with react-navigation. For more information, see https://docs.expo.dev/router/migrate/sdk-55-to-56/. You can disable this check by setting the environment variable EXPO_ROUTER_DISABLE_RN_NAVIGATION_CHECK=1.'\n );\n }\n if (moduleName === '@react-navigation/core') {\n // We already checked if expo-router resolves\n return doResolve('expo-router/react-navigation');\n }\n }\n }\n\n if (platform === 'web') {\n if (result.filePath.includes('node_modules')) {\n // Disallow importing confusing native modules on web\n if (\n [\n 'react-native/Libraries/ReactPrivate/ReactNativePrivateInitializeCore',\n 'react-native/Libraries/Utilities/codegenNativeCommands',\n 'react-native/Libraries/Utilities/codegenNativeComponent',\n ].some((matcher) =>\n // Support absolute and modules with .js extensions.\n moduleName.includes(matcher)\n )\n ) {\n throw new FailedToResolveNativeOnlyModuleError(\n moduleName,\n path.relative(config.projectRoot, context.originModulePath)\n );\n }\n\n // Replace with static shims\n\n // Drop everything up until the `node_modules` folder.\n const normalName = normalizedPath.replace(/.*node_modules\\//, '');\n\n const shimFile = shouldCreateVirtualShim(normalName);\n if (shimFile) {\n const virtualId = `\\0shim:${normalName}`;\n const bundler = getMetroBundlerWithVirtualModules(getMetroBundler());\n if (!bundler.hasVirtualModule(virtualId)) {\n bundler.setVirtualModule(virtualId, fs.readFileSync(shimFile, 'utf8'));\n }\n debug(`Redirecting module \"${result.filePath}\" to shim`);\n\n return {\n ...result,\n filePath: virtualId,\n };\n }\n }\n } else {\n const isServer =\n context.customResolverOptions?.environment === 'node' ||\n context.customResolverOptions?.environment === 'react-server';\n const hostPackage = getReactNativeHostPackage(platform) ?? 'react-native';\n\n // Shim out React Native native runtime globals in server mode for native.\n if (isServer) {\n const emptyModule = doReplace(\n `${hostPackage}/Libraries/Core/InitializeCore.js`,\n undefined\n );\n if (emptyModule) {\n debug('Shimming out InitializeCore for React Native in native SSR bundle');\n return emptyModule;\n }\n }\n\n const hmrModule = doReplaceStrict(\n `${hostPackage}/Libraries/Utilities/HMRClient.js`,\n 'expo/src/async-require/hmr.ts'\n );\n if (hmrModule) return hmrModule;\n\n if (useExpoUnstableLogBox) {\n // TODO(@kitten): This can never resolve with isolated dependencies\n const logBoxModule = doReplace(\n `${hostPackage}/Libraries/LogBox/LogBoxInspectorContainer.js`,\n '@expo/log-box/swap-rn-logbox.js'\n );\n if (logBoxModule) return logBoxModule;\n\n const logBoxParserModule = doReplace(\n `${hostPackage}/Libraries/LogBox/Data/parseLogBoxLog.js`,\n '@expo/log-box/swap-rn-logbox-parser.js'\n );\n if (logBoxParserModule) return logBoxParserModule;\n }\n }\n\n return result;\n },\n\n // If at this point, we haven't resolved a module yet, if it's a module specifier for a known dependency\n // of either `expo` or `expo-router`, attempt to resolve it from these origin modules instead\n createFallbackModuleResolver({\n projectRoot: config.projectRoot,\n originModuleNames: ['expo', 'expo-router'],\n getStrictResolver,\n }),\n ]);\n\n // Ensure we mutate the resolution context to include the custom resolver options for server and web.\n const metroConfigWithCustomContext = withMetroMutatedResolverContext(\n metroConfigWithCustomResolver,\n (\n immutableContext: CustomResolutionContext,\n moduleName: string,\n platform: string | null\n ): CustomResolutionContext => {\n const context = asWritable({\n ...immutableContext,\n preferNativePlatform: platform !== 'web',\n });\n\n if (isServerEnvironment(context.customResolverOptions?.environment)) {\n // Adjust nodejs source extensions to sort mjs after js, including platform variants.\n if (nodejsSourceExtensions === null) {\n nodejsSourceExtensions = getNodejsExtensions(context.sourceExts);\n }\n context.sourceExts = nodejsSourceExtensions;\n\n context.unstable_enablePackageExports = true;\n context.unstable_conditionsByPlatform = {};\n\n const isReactServerComponents =\n context.customResolverOptions?.environment === 'react-server';\n\n if (isReactServerComponents) {\n // NOTE: Align the behavior across server and client. This is a breaking change so we'll just roll it out with React Server Components.\n // This ensures that react-server and client code both resolve `module` and `main` in the same order.\n if (platform === 'web') {\n // Node.js runtimes should only be importing main at the moment.\n // This is a temporary fix until we can support the package.json exports.\n context.mainFields = ['module', 'main'];\n } else {\n // In Node.js + native, use the standard main fields.\n context.mainFields = ['react-native', 'module', 'main'];\n }\n } else {\n if (platform === 'web') {\n // Node.js runtimes should only be importing main at the moment.\n // This is a temporary fix until we can support the package.json exports.\n context.mainFields = ['main', 'module'];\n } else {\n // In Node.js + native, use the standard main fields.\n context.mainFields = ['react-native', 'main', 'module'];\n }\n }\n\n // Enable react-server import conditions.\n if (context.customResolverOptions?.environment === 'react-server') {\n context.unstable_conditionNames = ['node', 'react-server', 'workerd'];\n } else {\n context.unstable_conditionNames = ['node'];\n }\n } else {\n // Non-server changes\n\n if (!skipMetroMainFieldOverride && platform && platform in preferredMainFields) {\n context.mainFields = preferredMainFields[platform]!;\n }\n }\n\n return context;\n }\n );\n\n return withMetroErrorReportingResolver(\n withMetroSupervisingTransformWorker(metroConfigWithCustomContext)\n );\n}\n\nfunction doReplaceHelper(\n from: string,\n to: string | undefined,\n {\n throws = false,\n normalizedPath,\n doResolve,\n }: {\n throws?: boolean;\n normalizedPath: string;\n doResolve: StrictResolver;\n }\n): SourceFileResolution | { type: 'empty' } | undefined {\n if (!normalizedPath.endsWith(from)) {\n return undefined;\n }\n\n if (to === undefined) {\n return {\n type: 'empty',\n };\n }\n\n try {\n const hmrModule = doResolve(to);\n if (hmrModule.type === 'sourceFile') {\n debug(`Using \\`${to}\\` implementation.`);\n return hmrModule;\n }\n } catch (resolutionError) {\n if (throws) {\n throw new Error(`Failed to replace ${from} with ${to}. Resolution of ${to} failed.`, {\n cause: resolutionError,\n });\n }\n\n debug(`Failed to resolve ${to} when swapping from ${from}: ${resolutionError}`);\n }\n return undefined;\n}\n\n/** @returns `true` if the incoming resolution should be swapped. */\nexport function shouldAliasModule(\n input: {\n platform: string | null;\n result: Resolution;\n },\n alias: { platform: string; output: string }\n): boolean {\n return (\n input.platform === alias.platform &&\n input.result?.type === 'sourceFile' &&\n typeof input.result?.filePath === 'string' &&\n normalizeSlashes(input.result.filePath).endsWith(alias.output)\n );\n}\n\n/** Add support for `react-native-web` and the Web platform. */\nexport async function withMetroMultiPlatformAsync(\n projectRoot: string,\n {\n config,\n exp,\n platformBundlers,\n serverRoot,\n\n isTsconfigPathsEnabled,\n isAutolinkingResolverEnabled,\n isExporting,\n isReactServerComponentsEnabled,\n\n getMetroBundler,\n }: {\n config: ConfigT;\n exp: ExpoConfig;\n isTsconfigPathsEnabled: boolean;\n platformBundlers: PlatformBundlers;\n serverRoot?: string | undefined;\n\n isAutolinkingResolverEnabled?: boolean;\n isExporting?: boolean;\n isReactServerComponentsEnabled: boolean;\n isNamedRequiresEnabled: boolean;\n\n getMetroBundler: () => Bundler;\n }\n) {\n const watchFolders = (config.watchFolders as string[]) || [];\n asWritable(config).watchFolders = watchFolders;\n\n // NOTE(@kitten): If the on-demand filesystem is enabled, we can aggressively cut down the `watchFolders`\n // to a minimum, since the files will be read lazily. This almost always speeds up exports\n if (isExporting && !!config.resolver.unstable_onDemandFilesystem) {\n // Preserve additional watchFolders the user added outside of serverRoot explicitly\n // TODO(@kitten): In the future we can instead use the `onDemandFilesystem: 'UNSTABLE_ALLOW_ALL'` mode while issuing a warning\n const internalRoot = serverRoot ?? projectRoot;\n const externalWatchFolders = watchFolders.filter((dir) => !isPathInside(dir, internalRoot));\n watchFolders.length = 0;\n watchFolders.push(projectRoot, ...externalWatchFolders);\n }\n\n // Change the default metro-runtime to a custom one that supports bundle splitting.\n // NOTE(@kitten): This is now always active and EXPO_USE_METRO_REQUIRE / isNamedRequiresEnabled is disregarded\n const metroDefaults: typeof import('@expo/metro/metro-config/defaults/defaults') = require('@expo/metro/metro-config/defaults/defaults');\n const metroRequirePolyfill = require.resolve('@expo/cli/build/metro-require/require');\n asWritable(metroDefaults).moduleSystem = metroRequirePolyfill;\n watchFolders.push(path.dirname(metroRequirePolyfill));\n\n // Required for @expo/metro-runtime to format paths in the web LogBox.\n process.env.EXPO_PUBLIC_PROJECT_ROOT = process.env.EXPO_PUBLIC_PROJECT_ROOT ?? projectRoot;\n\n const configPlatforms = getPlatformsFromConfig(projectRoot, exp);\n let expoConfigPlatforms = Object.entries(platformBundlers)\n .filter(\n ([platform, bundler]) => bundler === 'metro' && configPlatforms.includes(platform as Platform)\n )\n .map(([platform]) => platform);\n\n if (Array.isArray(config.resolver.platforms)) {\n expoConfigPlatforms = [...new Set(expoConfigPlatforms.concat(config.resolver.platforms))];\n }\n\n asWritable(config.resolver).platforms = expoConfigPlatforms;\n\n config = withWebPolyfills(config, { getMetroBundler });\n\n let autolinkingModuleResolverInput: AutolinkingModuleResolverInput | undefined;\n if (isAutolinkingResolverEnabled) {\n autolinkingModuleResolverInput = await createAutolinkingModuleResolverInput({\n platforms: expoConfigPlatforms,\n projectRoot,\n });\n }\n\n return withExtendedResolver(config, {\n autolinkingModuleResolverInput,\n isTsconfigPathsEnabled,\n isExporting,\n isReactServerComponentsEnabled,\n getMetroBundler,\n });\n}\n\nfunction hasExpoRouterModule(\n projectRoot: string,\n autolinkingModuleResolverInput: AutolinkingModuleResolverInput | undefined\n) {\n if (autolinkingModuleResolverInput) {\n // If we have autolinking enabled, we can skip resolution\n const platform = Object.keys(autolinkingModuleResolverInput)[0] as AutolinkingPlatform;\n return !!autolinkingModuleResolverInput[platform]?.resolvedModulePaths['expo-router'];\n } else {\n return !!resolveFrom(projectRoot, 'expo-router/package.json', {\n skipNodePath: true,\n });\n }\n}\n"],"names":["getNodejsExtensions","shouldAliasModule","withExtendedResolver","withMetroMultiPlatformAsync","ASSET_REGISTRY_SRC","constructPlatformExtensions","config","platformExtensions","Object","create","unstable_platformExtensions","resolver","platform","platforms","customPlatformExtensions","sourceExts","getPlatformExtensions","unstable_conditionNames","unstable_conditionsByPlatform","resolveWithPlatformExtensions","context","moduleName","platformContext","asWritable","preferNativePlatform","debug","require","input","_reactNativeHostPackages","Map","_reactNativeHostPathPatterns","getReactNativeHostPackage","supportPackage","get","undefined","getSupportPackageForPlatform","set","getReactNativeHostPathPattern","pattern","RegExp","withWebPolyfills","getMetroBundler","originalGetPolyfills","serializer","getPolyfills","bind","ctx","virtualEnvVarId","getMetroBundlerWithVirtualModules","setVirtualModule","virtualModuleId","virtualModulesPolyfills","rnGetPolyfills","filter","x","includes","error","code","polyfills","resolve","normalizeSlashes","p","replace","srcExts","mjsExts","ext","test","nodejsSourceExtensions","jsIndex","reduce","index","i","splice","autolinkingModuleResolverInput","isTsconfigPathsEnabled","isExporting","isReactServerComponentsEnabled","Log","warn","aliases","web","isExpoRouterInstalled","hasExpoRouterModule","projectRoot","_universalAliases","getUniversalAliases","resolveFrom","push","projectRootOriginPath","path","join","preferredMainFields","getStrictResolver","resolveRequest","doResolve","getOptionalResolver","optionalResolve","isResolutionError","isFailedToResolveNameError","isFailedToResolvePathError","idFactory","createModuleIdFactory","id","_asyncRequireModuleResolvedPath","getAsyncRequireModule","transformer","asyncRequireModulePath","type","filePath","getAssetRegistryModule","externals","match","customResolverOptions","exporting","isServerEnvironment","environment","process","clientboundary","endsWith","isExternal","skipMetroMainFieldOverride","env","EXPO_METRO_NO_MAIN_FIELD_OVERRIDE","useExpoUnstableWebModule","EXPO_UNSTABLE_WEB_MODAL","useExpoUnstableLogBox","EXPO_UNSTABLE_LOG_BOX","disableReactNavigationCheck","EXPO_ROUTER_DISABLE_RN_NAVIGATION_CHECK","disableNativeTabsMaterialSymbols","EXPO_ROUTER_DISABLE_NATIVE_TABS_MD","metroConfigWithCustomResolver","withMetroResolvers","requestDevMockProdReact","dev","originModulePath","createTypescriptResolver","watch","CI","requestNodeExternals","isServer","moduleId","isNodeExternal","result","contents","requestCustomExternals","external","realModule","realPath","opaqueId","JSON","stringify","projectRootContext","nodeModulesPaths","disableHierarchicalLookup","externModule","requestAlias","redirectedModuleName","matcher","alias","aliasedModule","_","parseInt","requestStableConfigModules","createAutolinkingModuleResolver","requestPostRewrites","normalizedPath","doReplace","from","to","options","doReplaceHelper","doReplaceStrict","throws","webModalModule","materialIconConverterModule","startsWith","Error","some","FailedToResolveNativeOnlyModuleError","relative","normalName","shimFile","shouldCreateVirtualShim","virtualId","bundler","hasVirtualModule","fs","readFileSync","hostPackage","emptyModule","hmrModule","logBoxModule","logBoxParserModule","createFallbackModuleResolver","originModuleNames","metroConfigWithCustomContext","withMetroMutatedResolverContext","immutableContext","unstable_enablePackageExports","isReactServerComponents","mainFields","withMetroErrorReportingResolver","withMetroSupervisingTransformWorker","resolutionError","cause","output","exp","platformBundlers","serverRoot","isAutolinkingResolverEnabled","watchFolders","unstable_onDemandFilesystem","internalRoot","externalWatchFolders","dir","isPathInside","length","metroDefaults","metroRequirePolyfill","moduleSystem","dirname","EXPO_PUBLIC_PROJECT_ROOT","configPlatforms","getPlatformsFromConfig","expoConfigPlatforms","entries","map","Array","isArray","Set","concat","createAutolinkingModuleResolverInput","keys","resolvedModulePaths","skipNodePath"],"mappings":"AAAA;;;;;CAKC;;;;;;;;;;;QAkOeA;eAAAA;;QAovBAC;eAAAA;;QA/tBAC;eAAAA;;QA+uBMC;eAAAA;;;;yBAp+BiB;;;;;;;yBACD;;;;;;;yBAQF;;;;;;;yBAER;;;;;;;gEACb;;;;;;;gEACE;;;;;;+CASV;4CACsC;sDACQ;2BACG;6BACe;qCACrB;iDACF;oCACoB;qDAChB;qBAChC;qBACS;qBACT;8BACgB;0CAEK;;;;;;AAQzC,MAAMC,qBAAqB,CAAC,6FAA6F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I,CAAChK,+BAA+B,CAAC,EAAE;QAC/D,OAAO,CAAC,GAACA,2CAAAA,8BAA8B,CAAC7D,SAAS,qBAAxC6D,yCAA0CiK,mBAAmB,CAAC,cAAc;IACvF,OAAO;QACL,OAAO,CAAC,CAACpJ,IAAAA,2BAAW,EAACH,aAAa,4BAA4B;YAC5DwJ,cAAc;QAChB;IACF;AACF"}
@@ -26,7 +26,7 @@ class FetchClient {
26
26
  this.headers = {
27
27
  accept: 'application/json',
28
28
  'content-type': 'application/json',
29
- 'user-agent': `expo-cli/${"56.1.21"}`,
29
+ 'user-agent': `expo-cli/${"56.1.23"}`,
30
30
  authorization: 'Basic ' + _nodebuffer().Buffer.from(`${target}:`).toString('base64')
31
31
  };
32
32
  }
@@ -83,7 +83,7 @@ function createContext() {
83
83
  cpu: summarizeCpuInfo(),
84
84
  app: {
85
85
  name: 'expo/cli',
86
- version: "56.1.21"
86
+ version: "56.1.23"
87
87
  },
88
88
  ci: _ciinfo().isCI ? {
89
89
  name: _ciinfo().name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expo/cli",
3
- "version": "56.1.21",
3
+ "version": "56.1.23",
4
4
  "description": "The Expo CLI",
5
5
  "main": "main.js",
6
6
  "bin": {
@@ -44,7 +44,7 @@
44
44
  "@expo/devcert": "^1.2.1",
45
45
  "@expo/env": "~2.3.1",
46
46
  "@expo/image-utils": "^0.10.4",
47
- "@expo/inline-modules": "^0.0.14",
47
+ "@expo/inline-modules": "^0.0.15",
48
48
  "@expo/json-file": "^10.2.0",
49
49
  "@expo/log-box": "^56.0.14",
50
50
  "@expo/metro": "~56.0.0",
@@ -157,13 +157,13 @@
157
157
  "playwright": "^1.59.0",
158
158
  "taskr": "^1.1.0",
159
159
  "tree-kill": "^1.2.2",
160
- "@expo/fingerprint": "0.19.9",
161
- "expo": "56.0.17",
162
- "expo-router": "56.2.16",
160
+ "expo": "56.0.19",
163
161
  "expo-module-scripts": "56.0.3",
164
- "expo-modules-autolinking": "56.0.21"
162
+ "expo-modules-autolinking": "56.0.21",
163
+ "expo-router": "56.2.18",
164
+ "@expo/fingerprint": "0.19.9"
165
165
  },
166
- "gitHead": "60c9da71e15060aa859a7a6e85f4b14062b761f4",
166
+ "gitHead": "eebecc21d8d868d97e72bd61bb8e668fb2feb704",
167
167
  "scripts": {
168
168
  "build": "taskr",
169
169
  "clean": "expo-module clean",