@expo/cli 0.24.2 → 0.24.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/bin/cli CHANGED
@@ -123,7 +123,7 @@ const args = (0, _arg().default)({
123
123
  });
124
124
  if (args['--version']) {
125
125
  // Version is added in the build script.
126
- console.log("0.24.2");
126
+ console.log("0.24.3");
127
127
  process.exit(0);
128
128
  }
129
129
  if (args['--non-interactive']) {
@@ -27,7 +27,7 @@ function _interop_require_default(obj) {
27
27
  const ERROR_MESSAGE = 'Unable to fetch compatibility data from React Native Directory. Skipping check.';
28
28
  async function checkPackagesCompatibility(packages) {
29
29
  try {
30
- const packagesToCheck = packages.filter((packageName)=>!packageName.startsWith('@expo-google-fonts/'));
30
+ const packagesToCheck = packages.filter((packageName)=>!packageName.startsWith('@expo/') && !packageName.startsWith('@expo-google-fonts/'));
31
31
  if (!packagesToCheck.length) {
32
32
  return;
33
33
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/install/utils/checkPackagesCompatibility.ts"],"sourcesContent":["// note(Simek): https://github.com/react-native-community/directory/blob/main/pages/api/libraries/check.ts\nimport chalk from 'chalk';\n\nimport { Log } from '../../log';\nimport { fetch } from '../../utils/fetch';\nimport { learnMore } from '../../utils/link';\n\nexport type ReactNativeDirectoryCheckResult = {\n unmaintained: boolean;\n newArchitecture: 'supported' | 'unsupported' | 'untested';\n};\n\nconst ERROR_MESSAGE =\n 'Unable to fetch compatibility data from React Native Directory. Skipping check.';\n\nexport async function checkPackagesCompatibility(packages: string[]) {\n try {\n const packagesToCheck = packages.filter(\n (packageName) => !packageName.startsWith('@expo-google-fonts/')\n );\n\n if (!packagesToCheck.length) {\n return;\n }\n\n const response = await fetch('https://reactnative.directory/api/libraries/check', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({ packages: packagesToCheck }),\n });\n\n if (!response.ok) {\n Log.log(chalk.gray(ERROR_MESSAGE));\n }\n\n const packageMetadata = (await response.json()) as Record<\n string,\n ReactNativeDirectoryCheckResult\n >;\n\n const incompatiblePackages = packagesToCheck.filter(\n (packageName) => packageMetadata[packageName]?.newArchitecture === 'unsupported'\n );\n\n if (incompatiblePackages.length) {\n Log.warn(\n chalk.yellow(\n `${chalk.bold('Warning')}: ${formatPackageNames(incompatiblePackages)} do${incompatiblePackages.length > 1 ? '' : 'es'} not support the New Architecture. ${learnMore('https://docs.expo.dev/guides/new-architecture/')}`\n )\n );\n }\n } catch {\n Log.log(chalk.gray(ERROR_MESSAGE));\n }\n}\n\nfunction formatPackageNames(incompatiblePackages: string[]) {\n if (incompatiblePackages.length === 1) {\n return incompatiblePackages.join();\n }\n\n const lastPackage = incompatiblePackages.pop();\n return `${incompatiblePackages.join(', ')} and ${lastPackage}`;\n}\n"],"names":["checkPackagesCompatibility","ERROR_MESSAGE","packages","packagesToCheck","filter","packageName","startsWith","length","response","fetch","method","headers","body","JSON","stringify","ok","Log","log","chalk","gray","packageMetadata","json","incompatiblePackages","newArchitecture","warn","yellow","bold","formatPackageNames","learnMore","join","lastPackage","pop"],"mappings":"AAAA,0GAA0G;;;;;+BAepFA;;;eAAAA;;;;gEAdJ;;;;;;qBAEE;uBACE;sBACI;;;;;;AAO1B,MAAMC,gBACJ;AAEK,eAAeD,2BAA2BE,QAAkB;IACjE,IAAI;QACF,MAAMC,kBAAkBD,SAASE,MAAM,CACrC,CAACC,cAAgB,CAACA,YAAYC,UAAU,CAAC;QAG3C,IAAI,CAACH,gBAAgBI,MAAM,EAAE;YAC3B;QACF;QAEA,MAAMC,WAAW,MAAMC,IAAAA,YAAK,EAAC,qDAAqD;YAChFC,QAAQ;YACRC,SAAS;gBACP,gBAAgB;YAClB;YACAC,MAAMC,KAAKC,SAAS,CAAC;gBAAEZ,UAAUC;YAAgB;QACnD;QAEA,IAAI,CAACK,SAASO,EAAE,EAAE;YAChBC,QAAG,CAACC,GAAG,CAACC,gBAAK,CAACC,IAAI,CAAClB;QACrB;QAEA,MAAMmB,kBAAmB,MAAMZ,SAASa,IAAI;QAK5C,MAAMC,uBAAuBnB,gBAAgBC,MAAM,CACjD,CAACC;gBAAgBe;mBAAAA,EAAAA,+BAAAA,eAAe,CAACf,YAAY,qBAA5Be,6BAA8BG,eAAe,MAAK;;QAGrE,IAAID,qBAAqBf,MAAM,EAAE;YAC/BS,QAAG,CAACQ,IAAI,CACNN,gBAAK,CAACO,MAAM,CACV,GAAGP,gBAAK,CAACQ,IAAI,CAAC,WAAW,EAAE,EAAEC,mBAAmBL,sBAAsB,GAAG,EAAEA,qBAAqBf,MAAM,GAAG,IAAI,KAAK,KAAK,mCAAmC,EAAEqB,IAAAA,eAAS,EAAC,mDAAmD;QAG/N;IACF,EAAE,OAAM;QACNZ,QAAG,CAACC,GAAG,CAACC,gBAAK,CAACC,IAAI,CAAClB;IACrB;AACF;AAEA,SAAS0B,mBAAmBL,oBAA8B;IACxD,IAAIA,qBAAqBf,MAAM,KAAK,GAAG;QACrC,OAAOe,qBAAqBO,IAAI;IAClC;IAEA,MAAMC,cAAcR,qBAAqBS,GAAG;IAC5C,OAAO,GAAGT,qBAAqBO,IAAI,CAAC,MAAM,KAAK,EAAEC,aAAa;AAChE"}
1
+ {"version":3,"sources":["../../../../src/install/utils/checkPackagesCompatibility.ts"],"sourcesContent":["// note(Simek): https://github.com/react-native-community/directory/blob/main/pages/api/libraries/check.ts\nimport chalk from 'chalk';\n\nimport { Log } from '../../log';\nimport { fetch } from '../../utils/fetch';\nimport { learnMore } from '../../utils/link';\n\nexport type ReactNativeDirectoryCheckResult = {\n unmaintained: boolean;\n newArchitecture: 'supported' | 'unsupported' | 'untested';\n};\n\nconst ERROR_MESSAGE =\n 'Unable to fetch compatibility data from React Native Directory. Skipping check.';\n\nexport async function checkPackagesCompatibility(packages: string[]) {\n try {\n const packagesToCheck = packages.filter(\n (packageName) =>\n !packageName.startsWith('@expo/') && !packageName.startsWith('@expo-google-fonts/')\n );\n\n if (!packagesToCheck.length) {\n return;\n }\n\n const response = await fetch('https://reactnative.directory/api/libraries/check', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({ packages: packagesToCheck }),\n });\n\n if (!response.ok) {\n Log.log(chalk.gray(ERROR_MESSAGE));\n }\n\n const packageMetadata = (await response.json()) as Record<\n string,\n ReactNativeDirectoryCheckResult\n >;\n\n const incompatiblePackages = packagesToCheck.filter(\n (packageName) => packageMetadata[packageName]?.newArchitecture === 'unsupported'\n );\n\n if (incompatiblePackages.length) {\n Log.warn(\n chalk.yellow(\n `${chalk.bold('Warning')}: ${formatPackageNames(incompatiblePackages)} do${incompatiblePackages.length > 1 ? '' : 'es'} not support the New Architecture. ${learnMore('https://docs.expo.dev/guides/new-architecture/')}`\n )\n );\n }\n } catch {\n Log.log(chalk.gray(ERROR_MESSAGE));\n }\n}\n\nfunction formatPackageNames(incompatiblePackages: string[]) {\n if (incompatiblePackages.length === 1) {\n return incompatiblePackages.join();\n }\n\n const lastPackage = incompatiblePackages.pop();\n return `${incompatiblePackages.join(', ')} and ${lastPackage}`;\n}\n"],"names":["checkPackagesCompatibility","ERROR_MESSAGE","packages","packagesToCheck","filter","packageName","startsWith","length","response","fetch","method","headers","body","JSON","stringify","ok","Log","log","chalk","gray","packageMetadata","json","incompatiblePackages","newArchitecture","warn","yellow","bold","formatPackageNames","learnMore","join","lastPackage","pop"],"mappings":"AAAA,0GAA0G;;;;;+BAepFA;;;eAAAA;;;;gEAdJ;;;;;;qBAEE;uBACE;sBACI;;;;;;AAO1B,MAAMC,gBACJ;AAEK,eAAeD,2BAA2BE,QAAkB;IACjE,IAAI;QACF,MAAMC,kBAAkBD,SAASE,MAAM,CACrC,CAACC,cACC,CAACA,YAAYC,UAAU,CAAC,aAAa,CAACD,YAAYC,UAAU,CAAC;QAGjE,IAAI,CAACH,gBAAgBI,MAAM,EAAE;YAC3B;QACF;QAEA,MAAMC,WAAW,MAAMC,IAAAA,YAAK,EAAC,qDAAqD;YAChFC,QAAQ;YACRC,SAAS;gBACP,gBAAgB;YAClB;YACAC,MAAMC,KAAKC,SAAS,CAAC;gBAAEZ,UAAUC;YAAgB;QACnD;QAEA,IAAI,CAACK,SAASO,EAAE,EAAE;YAChBC,QAAG,CAACC,GAAG,CAACC,gBAAK,CAACC,IAAI,CAAClB;QACrB;QAEA,MAAMmB,kBAAmB,MAAMZ,SAASa,IAAI;QAK5C,MAAMC,uBAAuBnB,gBAAgBC,MAAM,CACjD,CAACC;gBAAgBe;mBAAAA,EAAAA,+BAAAA,eAAe,CAACf,YAAY,qBAA5Be,6BAA8BG,eAAe,MAAK;;QAGrE,IAAID,qBAAqBf,MAAM,EAAE;YAC/BS,QAAG,CAACQ,IAAI,CACNN,gBAAK,CAACO,MAAM,CACV,GAAGP,gBAAK,CAACQ,IAAI,CAAC,WAAW,EAAE,EAAEC,mBAAmBL,sBAAsB,GAAG,EAAEA,qBAAqBf,MAAM,GAAG,IAAI,KAAK,KAAK,mCAAmC,EAAEqB,IAAAA,eAAS,EAAC,mDAAmD;QAG/N;IACF,EAAE,OAAM;QACNZ,QAAG,CAACC,GAAG,CAACC,gBAAK,CAACC,IAAI,CAAClB;IACrB;AACF;AAEA,SAAS0B,mBAAmBL,oBAA8B;IACxD,IAAIA,qBAAqBf,MAAM,KAAK,GAAG;QACrC,OAAOe,qBAAqBO,IAAI;IAClC;IAEA,MAAMC,cAAcR,qBAAqBS,GAAG;IAC5C,OAAO,GAAGT,qBAAqBO,IAAI,CAAC,MAAM,KAAK,EAAEC,aAAa;AAChE"}
@@ -66,7 +66,8 @@ async function runAndroidAsync(projectRoot, { install, ...options }) {
66
66
  var _projectConfig_exp_experiments2;
67
67
  const localPath = await (0, _remoteBuildCache.resolveRemoteBuildCache)(projectRoot, {
68
68
  platform: 'android',
69
- provider: (_projectConfig_exp_experiments2 = projectConfig.exp.experiments) == null ? void 0 : _projectConfig_exp_experiments2.remoteBuildCache.provider
69
+ provider: (_projectConfig_exp_experiments2 = projectConfig.exp.experiments) == null ? void 0 : _projectConfig_exp_experiments2.remoteBuildCache.provider,
70
+ runOptions: options
70
71
  });
71
72
  if (localPath) {
72
73
  options.binary = localPath;
@@ -109,6 +110,14 @@ async function runAndroidAsync(projectRoot, { install, ...options }) {
109
110
  scheme: (_this = await (0, _scheme.getSchemesForAndroidAsync)(projectRoot)) == null ? void 0 : _this[0],
110
111
  headless: !props.shouldStartBundler
111
112
  });
113
+ if (!options.binary) {
114
+ // Find the APK file path
115
+ const apkFile = await (0, _resolveInstallApkName.resolveInstallApkNameAsync)(props.device.device, props);
116
+ if (apkFile) {
117
+ // Attempt to install the APK from the file path
118
+ options.binary = _path().default.join(props.apkVariantDirectory, apkFile);
119
+ }
120
+ }
112
121
  if (options.binary) {
113
122
  // Attempt to install the APK from the file path
114
123
  const binaryPath = _path().default.join(options.binary);
@@ -136,28 +145,20 @@ async function runAndroidAsync(projectRoot, { install, ...options }) {
136
145
  var _projectConfig_exp_experiments3;
137
146
  await (0, _remoteBuildCache.uploadRemoteBuildCache)(projectRoot, {
138
147
  platform: 'android',
139
- provider: (_projectConfig_exp_experiments3 = projectConfig.exp.experiments) == null ? void 0 : _projectConfig_exp_experiments3.remoteBuildCache.provider
148
+ provider: (_projectConfig_exp_experiments3 = projectConfig.exp.experiments) == null ? void 0 : _projectConfig_exp_experiments3.remoteBuildCache.provider,
149
+ buildPath: options.binary
140
150
  });
141
151
  }
142
152
  }
143
153
  async function installAppAsync(androidProjectRoot, props) {
144
- // Find the APK file path
145
- const apkFile = await (0, _resolveInstallApkName.resolveInstallApkNameAsync)(props.device.device, props);
146
- if (apkFile) {
147
- // Attempt to install the APK from the file path
148
- const binaryPath = _path().default.join(props.apkVariantDirectory, apkFile);
149
- _log.Log.log(_chalk().default.gray`\u203A Installing ${binaryPath}`);
150
- await props.device.installAppAsync(binaryPath);
151
- } else {
152
- // If we cannot resolve the APK file path then we can attempt to install using Gradle.
153
- // This offers more advanced resolution that we may not have first class support for.
154
- _log.Log.log('› Failed to locate binary file, installing with Gradle...');
155
- await (0, _gradle.installAsync)(androidProjectRoot, {
156
- variant: props.variant ?? 'debug',
157
- appName: props.appName ?? 'app',
158
- port: props.port
159
- });
160
- }
154
+ // If we cannot resolve the APK file path then we can attempt to install using Gradle.
155
+ // This offers more advanced resolution that we may not have first class support for.
156
+ _log.Log.log('› Failed to locate binary file, installing with Gradle...');
157
+ await (0, _gradle.installAsync)(androidProjectRoot, {
158
+ variant: props.variant ?? 'debug',
159
+ appName: props.appName ?? 'app',
160
+ port: props.port
161
+ });
161
162
  }
162
163
 
163
164
  //# sourceMappingURL=runAndroidAsync.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/run/android/runAndroidAsync.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\n\nimport { resolveInstallApkNameAsync } from './resolveInstallApkName';\nimport { Options, ResolvedOptions, resolveOptionsAsync } from './resolveOptions';\nimport { exportEagerAsync } from '../../export/embed/exportEager';\nimport { Log } from '../../log';\nimport type { AndroidOpenInCustomProps } from '../../start/platforms/android/AndroidPlatformManager';\nimport { assembleAsync, installAsync } from '../../start/platforms/android/gradle';\nimport { CommandError } from '../../utils/errors';\nimport { setNodeEnv } from '../../utils/nodeEnv';\nimport { ensurePortAvailabilityAsync } from '../../utils/port';\nimport { getSchemesForAndroidAsync } from '../../utils/scheme';\nimport { ensureNativeProjectAsync } from '../ensureNativeProject';\nimport { logProjectLogsLocation } from '../hints';\nimport { resolveRemoteBuildCache, uploadRemoteBuildCache } from '../remoteBuildCache';\nimport { startBundlerAsync } from '../startBundler';\n\nconst debug = require('debug')('expo:run:android');\n\nexport async function runAndroidAsync(projectRoot: string, { install, ...options }: Options) {\n // NOTE: This is a guess, the developer can overwrite with `NODE_ENV`.\n const isProduction = options.variant?.toLowerCase().endsWith('release');\n setNodeEnv(isProduction ? 'production' : 'development');\n require('@expo/env').load(projectRoot);\n\n const projectConfig = getConfig(projectRoot);\n if (!options.binary && projectConfig.exp.experiments?.remoteBuildCache) {\n const localPath = await resolveRemoteBuildCache(projectRoot, {\n platform: 'android',\n provider: projectConfig.exp.experiments?.remoteBuildCache.provider,\n });\n if (localPath) {\n options.binary = localPath;\n }\n }\n\n await ensureNativeProjectAsync(projectRoot, { platform: 'android', install });\n\n const props = await resolveOptionsAsync(projectRoot, options);\n\n debug('Package name: ' + props.packageName);\n Log.log('› Building app...');\n\n const androidProjectRoot = path.join(projectRoot, 'android');\n\n let shouldUpdateBuildCache = false;\n if (!options.binary) {\n let eagerBundleOptions: string | undefined;\n\n if (isProduction) {\n eagerBundleOptions = JSON.stringify(\n await exportEagerAsync(projectRoot, {\n dev: false,\n platform: 'android',\n })\n );\n }\n\n await assembleAsync(androidProjectRoot, {\n variant: props.variant,\n port: props.port,\n appName: props.appName,\n buildCache: props.buildCache,\n architectures: props.architectures,\n eagerBundleOptions,\n });\n shouldUpdateBuildCache = true;\n\n // Ensure the port hasn't become busy during the build.\n if (props.shouldStartBundler && !(await ensurePortAvailabilityAsync(projectRoot, props))) {\n props.shouldStartBundler = false;\n }\n }\n\n const manager = await startBundlerAsync(projectRoot, {\n port: props.port,\n // If a scheme is specified then use that instead of the package name.\n scheme: (await getSchemesForAndroidAsync(projectRoot))?.[0],\n headless: !props.shouldStartBundler,\n });\n\n if (options.binary) {\n // Attempt to install the APK from the file path\n const binaryPath = path.join(options.binary);\n\n if (!fs.existsSync(binaryPath)) {\n throw new CommandError(`The path to the custom Android binary does not exist: ${binaryPath}`);\n }\n Log.log(chalk.gray`\\u203A Installing ${binaryPath}`);\n await props.device.installAppAsync(binaryPath);\n } else {\n await installAppAsync(androidProjectRoot, props);\n }\n\n await manager.getDefaultDevServer().openCustomRuntimeAsync<AndroidOpenInCustomProps>(\n 'emulator',\n {\n applicationId: props.packageName,\n customAppId: props.customAppId,\n launchActivity: props.launchActivity,\n },\n { device: props.device.device }\n );\n\n if (props.shouldStartBundler) {\n logProjectLogsLocation();\n } else {\n await manager.stopAsync();\n }\n\n if (shouldUpdateBuildCache && projectConfig.exp.experiments?.remoteBuildCache) {\n await uploadRemoteBuildCache(projectRoot, {\n platform: 'android',\n provider: projectConfig.exp.experiments?.remoteBuildCache.provider,\n });\n }\n}\n\nasync function installAppAsync(androidProjectRoot: string, props: ResolvedOptions) {\n // Find the APK file path\n const apkFile = await resolveInstallApkNameAsync(props.device.device, props);\n\n if (apkFile) {\n // Attempt to install the APK from the file path\n const binaryPath = path.join(props.apkVariantDirectory, apkFile);\n Log.log(chalk.gray`\\u203A Installing ${binaryPath}`);\n await props.device.installAppAsync(binaryPath);\n } else {\n // If we cannot resolve the APK file path then we can attempt to install using Gradle.\n // This offers more advanced resolution that we may not have first class support for.\n Log.log('› Failed to locate binary file, installing with Gradle...');\n await installAsync(androidProjectRoot, {\n variant: props.variant ?? 'debug',\n appName: props.appName ?? 'app',\n port: props.port,\n });\n }\n}\n"],"names":["runAndroidAsync","debug","require","projectRoot","install","options","projectConfig","isProduction","variant","toLowerCase","endsWith","setNodeEnv","load","getConfig","binary","exp","experiments","remoteBuildCache","localPath","resolveRemoteBuildCache","platform","provider","ensureNativeProjectAsync","props","resolveOptionsAsync","packageName","Log","log","androidProjectRoot","path","join","shouldUpdateBuildCache","eagerBundleOptions","JSON","stringify","exportEagerAsync","dev","assembleAsync","port","appName","buildCache","architectures","shouldStartBundler","ensurePortAvailabilityAsync","manager","startBundlerAsync","scheme","getSchemesForAndroidAsync","headless","binaryPath","fs","existsSync","CommandError","chalk","gray","device","installAppAsync","getDefaultDevServer","openCustomRuntimeAsync","applicationId","customAppId","launchActivity","logProjectLogsLocation","stopAsync","uploadRemoteBuildCache","apkFile","resolveInstallApkNameAsync","apkVariantDirectory","installAsync"],"mappings":";;;;+BAsBsBA;;;eAAAA;;;;yBAtBI;;;;;;;gEACR;;;;;;;gEACH;;;;;;;gEACE;;;;;;uCAE0B;gCACmB;6BAC7B;qBACb;wBAEwB;wBACf;yBACF;sBACiB;wBACF;qCACD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BoB,IAAAA,6BAAsB;IACxB,OAAO;QACL,MAAMlB,QAAQmB,SAAS;IACzB;IAEA,IAAIhC,4BAA0BzB,kCAAAA,cAAcS,GAAG,CAACC,WAAW,qBAA7BV,gCAA+BW,gBAAgB,GAAE;YAGjEX;QAFZ,MAAM0D,IAAAA,wCAAsB,EAAC7D,aAAa;YACxCiB,UAAU;YACVC,QAAQ,GAAEf,kCAAAA,cAAcS,GAAG,CAACC,WAAW,qBAA7BV,gCAA+BW,gBAAgB,CAACI,QAAQ;QACpE;IACF;AACF;AAEA,eAAemC,gBAAgB5B,kBAA0B,EAAEL,KAAsB;IAC/E,yBAAyB;IACzB,MAAM0C,UAAU,MAAMC,IAAAA,iDAA0B,EAAC3C,MAAMgC,MAAM,CAACA,MAAM,EAAEhC;IAEtE,IAAI0C,SAAS;QACX,gDAAgD;QAChD,MAAMhB,aAAapB,eAAI,CAACC,IAAI,CAACP,MAAM4C,mBAAmB,EAAEF;QACxDvC,QAAG,CAACC,GAAG,CAAC0B,gBAAK,CAACC,IAAI,CAAC,kBAAkB,EAAEL,WAAW,CAAC;QACnD,MAAM1B,MAAMgC,MAAM,CAACC,eAAe,CAACP;IACrC,OAAO;QACL,sFAAsF;QACtF,qFAAqF;QACrFvB,QAAG,CAACC,GAAG,CAAC;QACR,MAAMyC,IAAAA,oBAAY,EAACxC,oBAAoB;YACrCpB,SAASe,MAAMf,OAAO,IAAI;YAC1B+B,SAAShB,MAAMgB,OAAO,IAAI;YAC1BD,MAAMf,MAAMe,IAAI;QAClB;IACF;AACF"}
1
+ {"version":3,"sources":["../../../../src/run/android/runAndroidAsync.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\n\nimport { resolveInstallApkNameAsync } from './resolveInstallApkName';\nimport { Options, ResolvedOptions, resolveOptionsAsync } from './resolveOptions';\nimport { exportEagerAsync } from '../../export/embed/exportEager';\nimport { Log } from '../../log';\nimport type { AndroidOpenInCustomProps } from '../../start/platforms/android/AndroidPlatformManager';\nimport { assembleAsync, installAsync } from '../../start/platforms/android/gradle';\nimport { CommandError } from '../../utils/errors';\nimport { setNodeEnv } from '../../utils/nodeEnv';\nimport { ensurePortAvailabilityAsync } from '../../utils/port';\nimport { getSchemesForAndroidAsync } from '../../utils/scheme';\nimport { ensureNativeProjectAsync } from '../ensureNativeProject';\nimport { logProjectLogsLocation } from '../hints';\nimport { resolveRemoteBuildCache, uploadRemoteBuildCache } from '../remoteBuildCache';\nimport { startBundlerAsync } from '../startBundler';\n\nconst debug = require('debug')('expo:run:android');\n\nexport async function runAndroidAsync(projectRoot: string, { install, ...options }: Options) {\n // NOTE: This is a guess, the developer can overwrite with `NODE_ENV`.\n const isProduction = options.variant?.toLowerCase().endsWith('release');\n setNodeEnv(isProduction ? 'production' : 'development');\n require('@expo/env').load(projectRoot);\n\n const projectConfig = getConfig(projectRoot);\n if (!options.binary && projectConfig.exp.experiments?.remoteBuildCache) {\n const localPath = await resolveRemoteBuildCache(projectRoot, {\n platform: 'android',\n provider: projectConfig.exp.experiments?.remoteBuildCache.provider,\n runOptions: options,\n });\n if (localPath) {\n options.binary = localPath;\n }\n }\n\n await ensureNativeProjectAsync(projectRoot, { platform: 'android', install });\n\n const props = await resolveOptionsAsync(projectRoot, options);\n\n debug('Package name: ' + props.packageName);\n Log.log('› Building app...');\n\n const androidProjectRoot = path.join(projectRoot, 'android');\n\n let shouldUpdateBuildCache = false;\n if (!options.binary) {\n let eagerBundleOptions: string | undefined;\n\n if (isProduction) {\n eagerBundleOptions = JSON.stringify(\n await exportEagerAsync(projectRoot, {\n dev: false,\n platform: 'android',\n })\n );\n }\n\n await assembleAsync(androidProjectRoot, {\n variant: props.variant,\n port: props.port,\n appName: props.appName,\n buildCache: props.buildCache,\n architectures: props.architectures,\n eagerBundleOptions,\n });\n shouldUpdateBuildCache = true;\n\n // Ensure the port hasn't become busy during the build.\n if (props.shouldStartBundler && !(await ensurePortAvailabilityAsync(projectRoot, props))) {\n props.shouldStartBundler = false;\n }\n }\n\n const manager = await startBundlerAsync(projectRoot, {\n port: props.port,\n // If a scheme is specified then use that instead of the package name.\n scheme: (await getSchemesForAndroidAsync(projectRoot))?.[0],\n headless: !props.shouldStartBundler,\n });\n\n if (!options.binary) {\n // Find the APK file path\n const apkFile = await resolveInstallApkNameAsync(props.device.device, props);\n if (apkFile) {\n // Attempt to install the APK from the file path\n options.binary = path.join(props.apkVariantDirectory, apkFile);\n }\n }\n\n if (options.binary) {\n // Attempt to install the APK from the file path\n const binaryPath = path.join(options.binary);\n\n if (!fs.existsSync(binaryPath)) {\n throw new CommandError(`The path to the custom Android binary does not exist: ${binaryPath}`);\n }\n Log.log(chalk.gray`\\u203A Installing ${binaryPath}`);\n await props.device.installAppAsync(binaryPath);\n } else {\n await installAppAsync(androidProjectRoot, props);\n }\n\n await manager.getDefaultDevServer().openCustomRuntimeAsync<AndroidOpenInCustomProps>(\n 'emulator',\n {\n applicationId: props.packageName,\n customAppId: props.customAppId,\n launchActivity: props.launchActivity,\n },\n { device: props.device.device }\n );\n\n if (props.shouldStartBundler) {\n logProjectLogsLocation();\n } else {\n await manager.stopAsync();\n }\n\n if (shouldUpdateBuildCache && projectConfig.exp.experiments?.remoteBuildCache) {\n await uploadRemoteBuildCache(projectRoot, {\n platform: 'android',\n provider: projectConfig.exp.experiments?.remoteBuildCache.provider,\n buildPath: options.binary,\n });\n }\n}\n\nasync function installAppAsync(androidProjectRoot: string, props: ResolvedOptions) {\n // If we cannot resolve the APK file path then we can attempt to install using Gradle.\n // This offers more advanced resolution that we may not have first class support for.\n Log.log('› Failed to locate binary file, installing with Gradle...');\n await installAsync(androidProjectRoot, {\n variant: props.variant ?? 'debug',\n appName: props.appName ?? 'app',\n port: props.port,\n });\n}\n"],"names":["runAndroidAsync","debug","require","projectRoot","install","options","projectConfig","isProduction","variant","toLowerCase","endsWith","setNodeEnv","load","getConfig","binary","exp","experiments","remoteBuildCache","localPath","resolveRemoteBuildCache","platform","provider","runOptions","ensureNativeProjectAsync","props","resolveOptionsAsync","packageName","Log","log","androidProjectRoot","path","join","shouldUpdateBuildCache","eagerBundleOptions","JSON","stringify","exportEagerAsync","dev","assembleAsync","port","appName","buildCache","architectures","shouldStartBundler","ensurePortAvailabilityAsync","manager","startBundlerAsync","scheme","getSchemesForAndroidAsync","headless","apkFile","resolveInstallApkNameAsync","device","apkVariantDirectory","binaryPath","fs","existsSync","CommandError","chalk","gray","installAppAsync","getDefaultDevServer","openCustomRuntimeAsync","applicationId","customAppId","launchActivity","logProjectLogsLocation","stopAsync","uploadRemoteBuildCache","buildPath","installAsync"],"mappings":";;;;+BAsBsBA;;;eAAAA;;;;yBAtBI;;;;;;;gEACR;;;;;;;gEACH;;;;;;;gEACE;;;;;;uCAE0B;gCACmB;6BAC7B;qBACb;wBAEwB;wBACf;yBACF;sBACiB;wBACF;qCACD;uBACF;kCACyB;8BAC9B;;;;;;AAElC,MAAMC,QAAQC,QAAQ,SAAS;AAExB,eAAeF,gBAAgBG,WAAmB,EAAE,EAAEC,OAAO,EAAE,GAAGC,SAAkB;QAEpEA,kBAKEC,gCAoDZ,OA0CmBA;IApG9B,sEAAsE;IACtE,MAAMC,gBAAeF,mBAAAA,QAAQG,OAAO,qBAAfH,iBAAiBI,WAAW,GAAGC,QAAQ,CAAC;IAC7DC,IAAAA,mBAAU,EAACJ,eAAe,eAAe;IACzCL,QAAQ,aAAaU,IAAI,CAACT;IAE1B,MAAMG,gBAAgBO,IAAAA,mBAAS,EAACV;IAChC,IAAI,CAACE,QAAQS,MAAM,MAAIR,iCAAAA,cAAcS,GAAG,CAACC,WAAW,qBAA7BV,+BAA+BW,gBAAgB,GAAE;YAG1DX;QAFZ,MAAMY,YAAY,MAAMC,IAAAA,yCAAuB,EAAChB,aAAa;YAC3DiB,UAAU;YACVC,QAAQ,GAAEf,kCAAAA,cAAcS,GAAG,CAACC,WAAW,qBAA7BV,gCAA+BW,gBAAgB,CAACI,QAAQ;YAClEC,YAAYj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AAEL,KAAsB;IAC/E,sFAAsF;IACtF,qFAAqF;IACrFG,QAAG,CAACC,GAAG,CAAC;IACR,MAAM0C,IAAAA,oBAAY,EAACzC,oBAAoB;QACrCrB,SAASgB,MAAMhB,OAAO,IAAI;QAC1BgC,SAAShB,MAAMgB,OAAO,IAAI;QAC1BD,MAAMf,MAAMe,IAAI;IAClB;AACF"}
@@ -127,7 +127,8 @@ async function runIosAsync(projectRoot, options) {
127
127
  var _projectConfig_exp_experiments2;
128
128
  const localPath = await (0, _remoteBuildCache.resolveRemoteBuildCache)(projectRoot, {
129
129
  platform: 'ios',
130
- provider: (_projectConfig_exp_experiments2 = projectConfig.exp.experiments) == null ? void 0 : _projectConfig_exp_experiments2.remoteBuildCache.provider
130
+ provider: (_projectConfig_exp_experiments2 = projectConfig.exp.experiments) == null ? void 0 : _projectConfig_exp_experiments2.remoteBuildCache.provider,
131
+ runOptions: options
131
132
  });
132
133
  if (localPath) {
133
134
  options.binary = localPath;
@@ -242,7 +243,8 @@ async function runIosAsync(projectRoot, options) {
242
243
  var _projectConfig_exp_experiments3;
243
244
  await (0, _remoteBuildCache.uploadRemoteBuildCache)(projectRoot, {
244
245
  platform: 'ios',
245
- provider: (_projectConfig_exp_experiments3 = projectConfig.exp.experiments) == null ? void 0 : _projectConfig_exp_experiments3.remoteBuildCache.provider
246
+ provider: (_projectConfig_exp_experiments3 = projectConfig.exp.experiments) == null ? void 0 : _projectConfig_exp_experiments3.remoteBuildCache.provider,
247
+ buildPath: binaryPath
246
248
  });
247
249
  }
248
250
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/run/ios/runIosAsync.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport spawnAsync from '@expo/spawn-async';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\n\nimport * as Log from '../../log';\nimport { AppleAppIdResolver } from '../../start/platforms/ios/AppleAppIdResolver';\nimport { maybePromptToSyncPodsAsync } from '../../utils/cocoapods';\nimport { setNodeEnv } from '../../utils/nodeEnv';\nimport { ensurePortAvailabilityAsync } from '../../utils/port';\nimport { profile } from '../../utils/profile';\nimport { getSchemesForIosAsync } from '../../utils/scheme';\nimport { ensureNativeProjectAsync } from '../ensureNativeProject';\nimport { logProjectLogsLocation } from '../hints';\nimport { uploadRemoteBuildCache, resolveRemoteBuildCache } from '../remoteBuildCache';\nimport { startBundlerAsync } from '../startBundler';\nimport * as XcodeBuild from './XcodeBuild';\nimport { Options } from './XcodeBuild.types';\nimport { getLaunchInfoForBinaryAsync, launchAppAsync } from './launchApp';\nimport { resolveOptionsAsync } from './options/resolveOptions';\nimport { getValidBinaryPathAsync } from './validateExternalBinary';\nimport { exportEagerAsync } from '../../export/embed/exportEager';\nimport { getContainerPathAsync, simctlAsync } from '../../start/platforms/ios/simctl';\nimport { CommandError } from '../../utils/errors';\n\nconst debug = require('debug')('expo:run:ios');\n\nexport async function runIosAsync(projectRoot: string, options: Options) {\n setNodeEnv(options.configuration === 'Release' ? 'production' : 'development');\n require('@expo/env').load(projectRoot);\n\n assertPlatform();\n\n const install = !!options.install;\n\n if ((await ensureNativeProjectAsync(projectRoot, { platform: 'ios', install })) && install) {\n await maybePromptToSyncPodsAsync(projectRoot);\n }\n\n // Resolve the CLI arguments into useable options.\n const props = await profile(resolveOptionsAsync)(projectRoot, options);\n\n const projectConfig = getConfig(projectRoot);\n if (!options.binary && projectConfig.exp.experiments?.remoteBuildCache && props.isSimulator) {\n const localPath = await resolveRemoteBuildCache(projectRoot, {\n platform: 'ios',\n provider: projectConfig.exp.experiments?.remoteBuildCache.provider,\n });\n if (localPath) {\n options.binary = localPath;\n }\n }\n\n if (options.rebundle) {\n Log.warn(`The --unstable-rebundle flag is experimental and may not work as expected.`);\n // Get the existing binary path to re-bundle the app.\n\n let binaryPath: string;\n if (!options.binary) {\n if (!props.isSimulator) {\n throw new Error('Re-bundling on physical devices requires the --binary flag.');\n }\n const appId = await new AppleAppIdResolver(projectRoot).getAppIdAsync();\n const possibleBinaryPath = await getContainerPathAsync(props.device, {\n appId,\n });\n if (!possibleBinaryPath) {\n throw new CommandError(\n `Cannot rebundle because no --binary was provided and no existing binary was found on the device for ID: ${appId}.`\n );\n }\n binaryPath = possibleBinaryPath;\n Log.log('Re-using existing binary path:', binaryPath);\n // Set the binary path to the existing binary path.\n options.binary = binaryPath;\n }\n\n Log.log('Rebundling the Expo config file');\n // Re-bundle the config file the same way the app was originally bundled.\n await spawnAsync('node', [\n path.join(require.resolve('expo-constants/package.json'), '../scripts/getAppConfig.js'),\n projectRoot,\n path.join(options.binary, 'EXConstants.bundle'),\n ]);\n // Re-bundle the app.\n\n const possibleBundleOutput = path.join(options.binary, 'main.jsbundle');\n\n if (fs.existsSync(possibleBundleOutput)) {\n Log.log('Rebundling the app...');\n await exportEagerAsync(projectRoot, {\n resetCache: false,\n dev: false,\n platform: 'ios',\n assetsDest: path.join(options.binary, 'assets'),\n bundleOutput: possibleBundleOutput,\n });\n } else {\n Log.warn('Bundle output not found at expected location:', possibleBundleOutput);\n }\n }\n\n let binaryPath: string;\n let shouldUpdateBuildCache = false;\n if (options.binary) {\n binaryPath = await getValidBinaryPathAsync(options.binary, props);\n Log.log('Using custom binary path:', binaryPath);\n } else {\n let eagerBundleOptions: string | undefined;\n\n if (options.configuration === 'Release') {\n eagerBundleOptions = JSON.stringify(\n await exportEagerAsync(projectRoot, {\n dev: false,\n platform: 'ios',\n })\n );\n }\n\n // Spawn the `xcodebuild` process to create the app binary.\n const buildOutput = await XcodeBuild.buildAsync({\n ...props,\n eagerBundleOptions,\n });\n\n // Find the path to the built app binary, this will be used to install the binary\n // on a device.\n binaryPath = await profile(XcodeBuild.getAppBinaryPath)(buildOutput);\n shouldUpdateBuildCache = true;\n }\n debug('Binary path:', binaryPath);\n\n // Ensure the port hasn't become busy during the build.\n if (props.shouldStartBundler && !(await ensurePortAvailabilityAsync(projectRoot, props))) {\n props.shouldStartBundler = false;\n }\n\n const launchInfo = await getLaunchInfoForBinaryAsync(binaryPath);\n const isCustomBinary = !!options.binary;\n\n // Always close the app before launching on a simulator. Otherwise certain cached resources like the splashscreen will not be available.\n if (props.isSimulator) {\n try {\n await simctlAsync(['terminate', props.device.udid, launchInfo.bundleId]);\n } catch (error) {\n // If we failed it's likely that the app was not running to begin with and we will get an `invalid device` error\n debug('Failed to terminate app (possibly because it was not running):', error);\n }\n }\n\n // Start the dev server which creates all of the required info for\n // launching the app on a simulator.\n const manager = await startBundlerAsync(projectRoot, {\n port: props.port,\n headless: !props.shouldStartBundler,\n // If a scheme is specified then use that instead of the package name.\n\n scheme: isCustomBinary\n ? // If launching a custom binary, use the schemes in the Info.plist.\n launchInfo.schemes[0]\n : // If a scheme is specified then use that instead of the package name.\n (await getSchemesForIosAsync(projectRoot))?.[0],\n });\n\n // Install and launch the app binary on a device.\n await launchAppAsync(\n binaryPath,\n manager,\n {\n isSimulator: props.isSimulator,\n device: props.device,\n shouldStartBundler: props.shouldStartBundler,\n },\n launchInfo.bundleId\n );\n\n // Log the location of the JS logs for the device.\n if (props.shouldStartBundler) {\n logProjectLogsLocation();\n } else {\n await manager.stopAsync();\n }\n\n if (shouldUpdateBuildCache && projectConfig.exp.experiments?.remoteBuildCache) {\n await uploadRemoteBuildCache(projectRoot, {\n platform: 'ios',\n provider: projectConfig.exp.experiments?.remoteBuildCache.provider,\n });\n }\n}\n\nfunction assertPlatform() {\n if (process.platform !== 'darwin') {\n Log.exit(\n chalk`iOS apps can only be built on macOS devices. Use {cyan eas build -p ios} to build in the cloud.`\n );\n }\n}\n"],"names":["runIosAsync","debug","require","projectRoot","options","projectConfig","setNodeEnv","configuration","load","assertPlatform","install","ensureNativeProjectAsync","platform","maybePromptToSyncPodsAsync","props","profile","resolveOptionsAsync","getConfig","binary","exp","experiments","remoteBuildCache","isSimulator","localPath","resolveRemoteBuildCache","provider","rebundle","Log","warn","binaryPath","Error","appId","AppleAppIdResolver","getAppIdAsync","possibleBinaryPath","getContainerPathAsync","device","CommandError","log","spawnAsync","path","join","resolve","possibleBundleOutput","fs","existsSync","exportEagerAsync","resetCache","dev","assetsDest","bundleOutput","shouldUpdateBuildCache","getValidBinaryPathAsync","eagerBundleOptions","JSON","stringify","buildOutput","XcodeBuild","buildAsync","getAppBinaryPath","shouldStartBundler","ensurePortAvailabilityAsync","launchInfo","getLaunchInfoForBinaryAsync","isCustomBinary","simctlAsync","udid","bundleId","error","manager","startBundlerAsync","port","headless","scheme","schemes","getSchemesForIosAsync","launchAppAsync","logProjectLogsLocation","stopAsync","uploadRemoteBuildCache","process","exit","chalk"],"mappings":";;;;+BA4BsBA;;;eAAAA;;;;yBA5BI;;;;;;;gEACH;;;;;;;gEACL;;;;;;;gEACH;;;;;;;gEACE;;;;;;6DAEI;oCACc;2BACQ;yBAChB;sBACiB;yBACpB;wBACc;qCACG;uBACF;kCACyB;8BAC9B;oEACN;2BAEgC;gCACxB;wCACI;6BACP;wBACkB;wBACtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE7B,MAAMC,QAAQC,QAAQ,SAAS;AAExB,eAAeF,YAAYG,WAAmB,EAAEC,OAAgB;QAgB9CC,gCAsHhB,OAsBuBA;IA3J9BC,IAAAA,mBAAU,EAACF,QAAQG,aAAa,KAAK,YAAY,eAAe;IAChEL,QAAQ,aAAaM,IAAI,CAACL;IAE1BM;IAEA,MAAMC,UAAU,CAAC,CAACN,QAAQM,OAAO;IAEjC,IAAI,AAAC,MAAMC,IAAAA,6CAAwB,EAACR,aAAa;QAAES,UAAU;QAAOF;IAAQ,MAAOA,SAAS;QAC1F,MAAMG,IAAAA,qCAA0B,EAACV;IACnC;IAEA,kDAAkD;IAClD,MAAMW,QAAQ,MAAMC,IAAAA,gBAAO,EAACC,mCAAmB,EAAEb,aAAaC;IAE9D,MAAMC,gBAAgBY,IAAAA,mBAAS,EAACd;IAChC,IAAI,CAACC,QAAQc,MAAM,MAAIb,iCAAAA,cAAcc,GAAG,CAACC,WAAW,qBAA7Bf,+BAA+BgB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,OAAOC,OAAO;YACd,gHAAgH;YAChHnE,MAAM,kEAAkEmE;QAC1E;IACF;IAEA,kEAAkE;IAClE,oCAAoC;IACpC,MAAMC,UAAU,MAAMC,IAAAA,+BAAiB,EAACnE,aAAa;QACnDoE,MAAMzD,MAAMyD,IAAI;QAChBC,UAAU,CAAC1D,MAAM8C,kBAAkB;QACnC,sEAAsE;QAEtEa,QAAQT,iBAEJF,WAAWY,OAAO,CAAC,EAAE,IAEpB,QAAA,MAAMC,IAAAA,6BAAqB,EAACxE,iCAA7B,AAAC,KAA2C,CAAC,EAAE;IACrD;IAEA,iDAAiD;IACjD,MAAMyE,IAAAA,yBAAc,EAClB/C,YACAwC,SACA;QACE/C,aAAaR,MAAMQ,WAAW;QAC9Bc,QAAQtB,MAAMsB,MAAM;QACpBwB,oBAAoB9C,MAAM8C,kBAAkB;IAC9C,GACAE,WAAWK,QAAQ;IAGrB,kDAAkD;IAClD,IAAIrD,MAAM8C,kBAAkB,EAAE;QAC5BiB,IAAAA,6BAAsB;IACxB,OAAO;QACL,MAAMR,QAAQS,SAAS;IACzB;IAEA,IAAI3B,4BAA0B9C,kCAAAA,cAAcc,GAAG,CAACC,WAAW,qBAA7Bf,gCAA+BgB,gBAAgB,GAAE;YAGjEhB;QAFZ,MAAM0E,IAAAA,wCAAsB,EAAC5E,aAAa;YACxCS,UAAU;YACVa,QAAQ,GAAEpB,kCAAAA,cAAcc,GAAG,CAACC,WAAW,qBAA7Bf,gCAA+BgB,gBAAgB,CAACI,QAAQ;QACpE;IACF;AACF;AAEA,SAAShB;IACP,IAAIuE,QAAQpE,QAAQ,KAAK,UAAU;QACjCe,KAAIsD,IAAI,CACNC,IAAAA,gBAAK,CAAA,CAAC,+FAA+F,CAAC;IAE1G;AACF"}
1
+ {"version":3,"sources":["../../../../src/run/ios/runIosAsync.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\nimport spawnAsync from '@expo/spawn-async';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\n\nimport * as Log from '../../log';\nimport { hasDirectDevClientDependency } from '../../start/detectDevClient';\nimport { AppleAppIdResolver } from '../../start/platforms/ios/AppleAppIdResolver';\nimport { maybePromptToSyncPodsAsync } from '../../utils/cocoapods';\nimport { setNodeEnv } from '../../utils/nodeEnv';\nimport { ensurePortAvailabilityAsync } from '../../utils/port';\nimport { profile } from '../../utils/profile';\nimport { getSchemesForIosAsync } from '../../utils/scheme';\nimport { ensureNativeProjectAsync } from '../ensureNativeProject';\nimport { logProjectLogsLocation } from '../hints';\nimport { uploadRemoteBuildCache, resolveRemoteBuildCache } from '../remoteBuildCache';\nimport { startBundlerAsync } from '../startBundler';\nimport * as XcodeBuild from './XcodeBuild';\nimport { Options } from './XcodeBuild.types';\nimport { getLaunchInfoForBinaryAsync, launchAppAsync } from './launchApp';\nimport { resolveOptionsAsync } from './options/resolveOptions';\nimport { getValidBinaryPathAsync } from './validateExternalBinary';\nimport { exportEagerAsync } from '../../export/embed/exportEager';\nimport { getContainerPathAsync, simctlAsync } from '../../start/platforms/ios/simctl';\nimport { CommandError } from '../../utils/errors';\n\nconst debug = require('debug')('expo:run:ios');\n\nexport async function runIosAsync(projectRoot: string, options: Options) {\n setNodeEnv(options.configuration === 'Release' ? 'production' : 'development');\n require('@expo/env').load(projectRoot);\n\n assertPlatform();\n\n const install = !!options.install;\n\n if ((await ensureNativeProjectAsync(projectRoot, { platform: 'ios', install })) && install) {\n await maybePromptToSyncPodsAsync(projectRoot);\n }\n\n // Resolve the CLI arguments into useable options.\n const props = await profile(resolveOptionsAsync)(projectRoot, options);\n\n const projectConfig = getConfig(projectRoot);\n if (!options.binary && projectConfig.exp.experiments?.remoteBuildCache && props.isSimulator) {\n const localPath = await resolveRemoteBuildCache(projectRoot, {\n platform: 'ios',\n provider: projectConfig.exp.experiments?.remoteBuildCache.provider,\n runOptions: options,\n });\n if (localPath) {\n options.binary = localPath;\n }\n }\n\n if (options.rebundle) {\n Log.warn(`The --unstable-rebundle flag is experimental and may not work as expected.`);\n // Get the existing binary path to re-bundle the app.\n\n let binaryPath: string;\n if (!options.binary) {\n if (!props.isSimulator) {\n throw new Error('Re-bundling on physical devices requires the --binary flag.');\n }\n const appId = await new AppleAppIdResolver(projectRoot).getAppIdAsync();\n const possibleBinaryPath = await getContainerPathAsync(props.device, {\n appId,\n });\n if (!possibleBinaryPath) {\n throw new CommandError(\n `Cannot rebundle because no --binary was provided and no existing binary was found on the device for ID: ${appId}.`\n );\n }\n binaryPath = possibleBinaryPath;\n Log.log('Re-using existing binary path:', binaryPath);\n // Set the binary path to the existing binary path.\n options.binary = binaryPath;\n }\n\n Log.log('Rebundling the Expo config file');\n // Re-bundle the config file the same way the app was originally bundled.\n await spawnAsync('node', [\n path.join(require.resolve('expo-constants/package.json'), '../scripts/getAppConfig.js'),\n projectRoot,\n path.join(options.binary, 'EXConstants.bundle'),\n ]);\n // Re-bundle the app.\n\n const possibleBundleOutput = path.join(options.binary, 'main.jsbundle');\n\n if (fs.existsSync(possibleBundleOutput)) {\n Log.log('Rebundling the app...');\n await exportEagerAsync(projectRoot, {\n resetCache: false,\n dev: false,\n platform: 'ios',\n assetsDest: path.join(options.binary, 'assets'),\n bundleOutput: possibleBundleOutput,\n });\n } else {\n Log.warn('Bundle output not found at expected location:', possibleBundleOutput);\n }\n }\n\n let binaryPath: string;\n let shouldUpdateBuildCache = false;\n if (options.binary) {\n binaryPath = await getValidBinaryPathAsync(options.binary, props);\n Log.log('Using custom binary path:', binaryPath);\n } else {\n let eagerBundleOptions: string | undefined;\n\n if (options.configuration === 'Release') {\n eagerBundleOptions = JSON.stringify(\n await exportEagerAsync(projectRoot, {\n dev: false,\n platform: 'ios',\n })\n );\n }\n\n // Spawn the `xcodebuild` process to create the app binary.\n const buildOutput = await XcodeBuild.buildAsync({\n ...props,\n eagerBundleOptions,\n });\n\n // Find the path to the built app binary, this will be used to install the binary\n // on a device.\n binaryPath = await profile(XcodeBuild.getAppBinaryPath)(buildOutput);\n shouldUpdateBuildCache = true;\n }\n debug('Binary path:', binaryPath);\n\n // Ensure the port hasn't become busy during the build.\n if (props.shouldStartBundler && !(await ensurePortAvailabilityAsync(projectRoot, props))) {\n props.shouldStartBundler = false;\n }\n\n const launchInfo = await getLaunchInfoForBinaryAsync(binaryPath);\n const isCustomBinary = !!options.binary;\n\n // Always close the app before launching on a simulator. Otherwise certain cached resources like the splashscreen will not be available.\n if (props.isSimulator) {\n try {\n await simctlAsync(['terminate', props.device.udid, launchInfo.bundleId]);\n } catch (error) {\n // If we failed it's likely that the app was not running to begin with and we will get an `invalid device` error\n debug('Failed to terminate app (possibly because it was not running):', error);\n }\n }\n\n // Start the dev server which creates all of the required info for\n // launching the app on a simulator.\n const manager = await startBundlerAsync(projectRoot, {\n port: props.port,\n headless: !props.shouldStartBundler,\n // If a scheme is specified then use that instead of the package name.\n\n scheme: isCustomBinary\n ? // If launching a custom binary, use the schemes in the Info.plist.\n launchInfo.schemes[0]\n : // If a scheme is specified then use that instead of the package name.\n (await getSchemesForIosAsync(projectRoot))?.[0],\n });\n\n // Install and launch the app binary on a device.\n await launchAppAsync(\n binaryPath,\n manager,\n {\n isSimulator: props.isSimulator,\n device: props.device,\n shouldStartBundler: props.shouldStartBundler,\n },\n launchInfo.bundleId\n );\n\n // Log the location of the JS logs for the device.\n if (props.shouldStartBundler) {\n logProjectLogsLocation();\n } else {\n await manager.stopAsync();\n }\n\n if (shouldUpdateBuildCache && projectConfig.exp.experiments?.remoteBuildCache) {\n await uploadRemoteBuildCache(projectRoot, {\n platform: 'ios',\n provider: projectConfig.exp.experiments?.remoteBuildCache.provider,\n buildPath: binaryPath,\n });\n }\n}\n\nfunction assertPlatform() {\n if (process.platform !== 'darwin') {\n Log.exit(\n chalk`iOS apps can only be built on macOS devices. Use {cyan eas build -p ios} to build in the cloud.`\n );\n }\n}\n"],"names":["runIosAsync","debug","require","projectRoot","options","projectConfig","setNodeEnv","configuration","load","assertPlatform","install","ensureNativeProjectAsync","platform","maybePromptToSyncPodsAsync","props","profile","resolveOptionsAsync","getConfig","binary","exp","experiments","remoteBuildCache","isSimulator","localPath","resolveRemoteBuildCache","provider","runOptions","rebundle","Log","warn","binaryPath","Error","appId","AppleAppIdResolver","getAppIdAsync","possibleBinaryPath","getContainerPathAsync","device","CommandError","log","spawnAsync","path","join","resolve","possibleBundleOutput","fs","existsSync","exportEagerAsync","resetCache","dev","assetsDest","bundleOutput","shouldUpdateBuildCache","getValidBinaryPathAsync","eagerBundleOptions","JSON","stringify","buildOutput","XcodeBuild","buildAsync","getAppBinaryPath","shouldStartBundler","ensurePortAvailabilityAsync","launchInfo","getLaunchInfoForBinaryAsync","isCustomBinary","simctlAsync","udid","bundleId","error","manager","startBundlerAsync","port","headless","scheme","schemes","getSchemesForIosAsync","launchAppAsync","logProjectLogsLocation","stopAsync","uploadRemoteBuildCache","buildPath","process","exit","chalk"],"mappings":";;;;+BA6BsBA;;;eAAAA;;;;yBA7BI;;;;;;;gEACH;;;;;;;gEACL;;;;;;;gEACH;;;;;;;gEACE;;;;;;6DAEI;oCAEc;2BACQ;yBAChB;sBACiB;yBACpB;wBACc;qCACG;uBACF;kCACyB;8BAC9B;oEACN;2BAEgC;gCACxB;wCACI;6BACP;wBACkB;wBACtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE7B,MAAMC,QAAQC,QAAQ,SAAS;AAExB,eAAeF,YAAYG,WAAmB,EAAEC,OAAgB;QAgB9CC,gCAuHhB,OAsBuBA;IA5J9BC,IAAAA,mBAAU,EAACF,QAAQG,aAAa,KAAK,YAAY,eAAe;IAChEL,QAAQ,aAAaM,IAAI,CAACL;IAE1BM;IAEA,MAAMC,UAAU,CAAC,CAACN,QAAQM,OAAO;IAEjC,IAAI,AAAC,MAAMC,IAAAA,6CAAwB,EAACR,aAAa;QAAES,UAAU;QAAOF;IAAQ,MAAOA,SAAS;QAC1F,MAAMG,IAAAA,qCAA0B,EAACV;IACnC;IAEA,kDAAkD;IAClD,MAAMW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U;QACjCgB,KAAIuD,IAAI,CACNC,IAAAA,gBAAK,CAAA,CAAC,+FAA+F,CAAC;IAE1G;AACF"}
@@ -16,133 +16,45 @@ _export(exports, {
16
16
  return uploadRemoteBuildCache;
17
17
  }
18
18
  });
19
- function _spawnasync() {
20
- const data = /*#__PURE__*/ _interop_require_default(require("@expo/spawn-async"));
21
- _spawnasync = function() {
22
- return data;
23
- };
24
- return data;
25
- }
26
- function _chalk() {
27
- const data = /*#__PURE__*/ _interop_require_default(require("chalk"));
28
- _chalk = function() {
29
- return data;
30
- };
31
- return data;
32
- }
33
- function _fs() {
34
- const data = /*#__PURE__*/ _interop_require_default(require("fs"));
35
- _fs = function() {
36
- return data;
37
- };
38
- return data;
39
- }
40
- function _path() {
41
- const data = /*#__PURE__*/ _interop_require_default(require("path"));
42
- _path = function() {
43
- return data;
44
- };
45
- return data;
46
- }
47
- const _log = require("../log");
48
- const _xcrun = require("../start/platforms/ios/xcrun");
49
- function _interop_require_default(obj) {
50
- return obj && obj.__esModule ? obj : {
51
- default: obj
52
- };
53
- }
19
+ const _eas = require("../utils/remote-build-cache-providers/eas");
54
20
  const debug = require('debug')('expo:run:remote-build');
55
- async function resolveRemoteBuildCache(projectRoot, { platform, provider }) {
21
+ async function resolveRemoteBuildCache(projectRoot, { platform, provider, runOptions }) {
56
22
  const fingerprintHash = await calculateFingerprintHashAsync(projectRoot, platform, provider);
23
+ if (!fingerprintHash) {
24
+ return null;
25
+ }
57
26
  if (provider === 'eas') {
58
- const easJsonPath = _path().default.join(projectRoot, 'eas.json');
59
- if (!_fs().default.existsSync(easJsonPath)) {
60
- debug('eas.json not found, skip checking for remote builds');
61
- return null;
62
- }
63
- _log.Log.log((0, _chalk().default)`{whiteBright \u203A} {bold Searching builds with matching fingerprint on EAS servers}`);
64
- try {
65
- const results = await (0, _spawnasync().default)('npx', [
66
- 'eas-cli',
67
- 'build:download',
68
- `--platform=${platform}`,
69
- `--fingerprint=${fingerprintHash}`,
70
- '--non-interactive',
71
- '--dev-client',
72
- '--json'
73
- ], {
74
- cwd: projectRoot
75
- });
76
- _log.Log.log((0, _chalk().default)`{whiteBright \u203A} {bold Successfully downloaded cached build}`);
77
- // {
78
- // "path": "/var/folders/03/lppcpcnn61q3mz5ckzmzd8w80000gn/T/eas-cli-nodejs/eas-build-run-cache/c0f9ba9c-0cf1-4c5c-8566-b28b7971050f_22f1bbfa-1c09-4b67-9e4a-721906546b58.app"
79
- // }
80
- const json = JSON.parse(results.stdout.trim());
81
- return json == null ? void 0 : json.path;
82
- } catch (error) {
83
- debug('eas-cli error:', error);
84
- // @TODO(2025-04-11): remove this in a future release
85
- if ((0, _xcrun.isSpawnResultError)(error) && error.stderr.includes('command build:download not found')) {
86
- _log.Log.warn(`To take advantage of remote build cache, upgrade your eas-cli installation to latest.`);
87
- }
88
- return null;
89
- }
27
+ return await (0, _eas.resolveEASRemoteBuildCache)({
28
+ platform,
29
+ fingerprintHash,
30
+ projectRoot,
31
+ runOptions
32
+ });
90
33
  }
91
34
  return null;
92
35
  }
93
- async function uploadRemoteBuildCache(projectRoot, { platform, provider }) {
36
+ async function uploadRemoteBuildCache(projectRoot, { platform, provider, buildPath }) {
94
37
  const fingerprintHash = await calculateFingerprintHashAsync(projectRoot, platform, provider);
38
+ if (!fingerprintHash) {
39
+ return;
40
+ }
95
41
  if (provider === 'eas') {
96
- const easJsonPath = _path().default.join(projectRoot, 'eas.json');
97
- if (!_fs().default.existsSync(easJsonPath)) {
98
- debug('eas.json not found, skip checking for remote builds');
99
- return null;
100
- }
101
- try {
102
- _log.Log.log((0, _chalk().default)`{whiteBright \u203A} {bold Uploading build to remote cache}`);
103
- const results = await (0, _spawnasync().default)('npx', [
104
- 'eas-cli',
105
- 'upload',
106
- `--platform=${platform}`,
107
- `--fingerprint=${fingerprintHash}`,
108
- '--non-interactive',
109
- '--json'
110
- ], {
111
- cwd: projectRoot
112
- });
113
- // {
114
- // "url": "/var/folders/03/lppcpcnn61q3mz5ckzmzd8w80000gn/T/eas-cli-nodejs/eas-build-run-cache/c0f9ba9c-0cf1-4c5c-8566-b28b7971050f_22f1bbfa-1c09-4b67-9e4a-721906546b58.app"
115
- // }
116
- const json = JSON.parse(results.stdout.trim());
117
- _log.Log.log((0, _chalk().default)`{whiteBright \u203A} {bold Build successfully uploaded: ${json == null ? void 0 : json.url}}`);
118
- } catch (error) {
119
- debug('eas-cli error:', error);
120
- return null;
121
- }
42
+ await (0, _eas.uploadEASRemoteBuildCache)({
43
+ projectRoot,
44
+ platform,
45
+ fingerprintHash,
46
+ buildPath
47
+ });
122
48
  }
123
- return null;
124
49
  }
125
50
  async function calculateFingerprintHashAsync(projectRoot, platform, provider) {
126
51
  if (provider === 'eas') {
127
- // prefer using `eas fingerprint:generate` because it automatically upload sources
128
- try {
129
- const results = await (0, _spawnasync().default)('npx', [
130
- 'eas-cli',
131
- 'fingerprint:generate',
132
- `--platform=${platform}`,
133
- '--json',
134
- '--non-interactive'
135
- ], {
136
- cwd: projectRoot
137
- });
138
- // {
139
- // "hash": "203f960b965e154b77dc31c6c42e5582e8d77196"
140
- // }
141
- const json = JSON.parse(results.stdout.trim());
142
- return json == null ? void 0 : json.hash;
143
- } catch (error) {
144
- // if eas-cli is not installed, fallback to @expo/fingerprint
145
- debug('eas-cli error:', error);
52
+ const easFingerprintHash = await (0, _eas.calculateEASFingerprintHashAsync)({
53
+ projectRoot,
54
+ platform
55
+ });
56
+ if (easFingerprintHash) {
57
+ return easFingerprintHash;
146
58
  }
147
59
  }
148
60
  const Fingerprint = importFingerprintForDev(projectRoot);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/run/remoteBuildCache.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config';\nimport { ModPlatform } from '@expo/config-plugins';\nimport spawnAsync from '@expo/spawn-async';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\n\nimport { Log } from '../log';\nimport { isSpawnResultError } from '../start/platforms/ios/xcrun';\n\nconst debug = require('debug')('expo:run:remote-build') as typeof console.log;\n\nexport async function resolveRemoteBuildCache(\n projectRoot: string,\n {\n platform,\n provider,\n }: {\n platform: ModPlatform;\n provider?: Required<Required<ExpoConfig>['experiments']>['remoteBuildCache']['provider'];\n }\n): Promise<string | null> {\n const fingerprintHash = await calculateFingerprintHashAsync(projectRoot, platform, provider);\n\n if (provider === 'eas') {\n const easJsonPath = path.join(projectRoot, 'eas.json');\n if (!fs.existsSync(easJsonPath)) {\n debug('eas.json not found, skip checking for remote builds');\n return null;\n }\n\n Log.log(\n chalk`{whiteBright \\u203A} {bold Searching builds with matching fingerprint on EAS servers}`\n );\n try {\n const results = await spawnAsync(\n 'npx',\n [\n 'eas-cli',\n 'build:download',\n `--platform=${platform}`,\n `--fingerprint=${fingerprintHash}`,\n '--non-interactive',\n '--dev-client',\n '--json',\n ],\n {\n cwd: projectRoot,\n }\n );\n\n Log.log(chalk`{whiteBright \\u203A} {bold Successfully downloaded cached build}`);\n // {\n // \"path\": \"/var/folders/03/lppcpcnn61q3mz5ckzmzd8w80000gn/T/eas-cli-nodejs/eas-build-run-cache/c0f9ba9c-0cf1-4c5c-8566-b28b7971050f_22f1bbfa-1c09-4b67-9e4a-721906546b58.app\"\n // }\n const json = JSON.parse(results.stdout.trim());\n return json?.path;\n } catch (error) {\n debug('eas-cli error:', error);\n // @TODO(2025-04-11): remove this in a future release\n if (isSpawnResultError(error) && error.stderr.includes('command build:download not found')) {\n Log.warn(\n `To take advantage of remote build cache, upgrade your eas-cli installation to latest.`\n );\n }\n return null;\n }\n }\n\n return null;\n}\n\nexport async function uploadRemoteBuildCache(\n projectRoot: string,\n {\n platform,\n provider,\n }: {\n platform: ModPlatform;\n provider?: Required<Required<ExpoConfig>['experiments']>['remoteBuildCache']['provider'];\n }\n): Promise<string | null> {\n const fingerprintHash = await calculateFingerprintHashAsync(projectRoot, platform, provider);\n\n if (provider === 'eas') {\n const easJsonPath = path.join(projectRoot, 'eas.json');\n if (!fs.existsSync(easJsonPath)) {\n debug('eas.json not found, skip checking for remote builds');\n return null;\n }\n\n try {\n Log.log(chalk`{whiteBright \\u203A} {bold Uploading build to remote cache}`);\n const results = await spawnAsync(\n 'npx',\n [\n 'eas-cli',\n 'upload',\n `--platform=${platform}`,\n `--fingerprint=${fingerprintHash}`,\n '--non-interactive',\n '--json',\n ],\n {\n cwd: projectRoot,\n }\n );\n // {\n // \"url\": \"/var/folders/03/lppcpcnn61q3mz5ckzmzd8w80000gn/T/eas-cli-nodejs/eas-build-run-cache/c0f9ba9c-0cf1-4c5c-8566-b28b7971050f_22f1bbfa-1c09-4b67-9e4a-721906546b58.app\"\n // }\n const json = JSON.parse(results.stdout.trim());\n Log.log(chalk`{whiteBright \\u203A} {bold Build successfully uploaded: ${json?.url}}`);\n } catch (error) {\n debug('eas-cli error:', error);\n return null;\n }\n }\n\n return null;\n}\n\nasync function calculateFingerprintHashAsync(\n projectRoot: string,\n platform: ModPlatform,\n provider?: Required<Required<ExpoConfig>['experiments']>['remoteBuildCache']['provider']\n): Promise<string | null> {\n if (provider === 'eas') {\n // prefer using `eas fingerprint:generate` because it automatically upload sources\n try {\n const results = await spawnAsync(\n 'npx',\n [\n 'eas-cli',\n 'fingerprint:generate',\n `--platform=${platform}`,\n '--json',\n '--non-interactive',\n ],\n {\n cwd: projectRoot,\n }\n );\n // {\n // \"hash\": \"203f960b965e154b77dc31c6c42e5582e8d77196\"\n // }\n const json = JSON.parse(results.stdout.trim());\n return json?.hash;\n } catch (error) {\n // if eas-cli is not installed, fallback to @expo/fingerprint\n debug('eas-cli error:', error);\n }\n }\n\n const Fingerprint = importFingerprintForDev(projectRoot);\n if (!Fingerprint) {\n debug('@expo/fingerprint is not installed in the project, skip checking for remote builds');\n return null;\n }\n const fingerprint = await Fingerprint.createFingerprintAsync(projectRoot);\n\n return fingerprint.hash;\n}\n\nfunction importFingerprintForDev(projectRoot: string): null | typeof import('@expo/fingerprint') {\n try {\n return require(require.resolve('@expo/fingerprint', { paths: [projectRoot] }));\n } catch {\n return null;\n }\n}\n"],"names":["resolveRemoteBuildCache","uploadRemoteBuildCache","debug","require","projectRoot","platform","provider","fingerprintHash","calculateFingerprintHashAsync","easJsonPath","path","join","fs","existsSync","Log","log","chalk","results","spawnAsync","cwd","json","JSON","parse","stdout","trim","error","isSpawnResultError","stderr","includes","warn","url","hash","Fingerprint","importFingerprintForDev","fingerprint","createFingerprintAsync","resolve","paths"],"mappings":";;;;;;;;;;;IAYsBA,uBAAuB;eAAvBA;;IA4DAC,sBAAsB;eAAtBA;;;;gEAtEC;;;;;;;gEACL;;;;;;;gEACH;;;;;;;gEACE;;;;;;qBAEG;uBACe;;;;;;AAEnC,MAAMC,QAAQC,QAAQ,SAAS;AAExB,eAAeH,wBACpBI,WAAmB,EACnB,EACEC,QAAQ,EACRC,QAAQ,EAIT;IAED,MAAMC,kBAAkB,MAAMC,8BAA8BJ,aAAaC,UAAUC;IAEnF,IAAIA,aAAa,OAAO;QACtB,MAAMG,cAAcC,eAAI,CAACC,IAAI,CAACP,aAAa;QAC3C,IAAI,CAACQ,aAAE,CAACC,UAAU,CAACJ,cAAc;YAC/BP,MAAM;YACN,OAAO;QACT;QAEAY,QAAG,CAACC,GAAG,CACLC,IAAAA,gBAAK,CAAA,CAAC,qFAAqF,CAAC;QAE9F,IAAI;YACF,MAAMC,UAAU,MAAMC,IAAAA,qBAAU,EAC9B,OACA;gBACE;gBACA;gBACA,CAAC,WAAW,EAAEb,UAAU;gBACxB,CAAC,cAAc,EAAEE,iBAAiB;gBAClC;gBACA;gBACA;aACD,EACD;gBACEY,KAAKf;YACP;YAGFU,QAAG,CAACC,GAAG,CAACC,IAAAA,gBAAK,CAAA,CAAC,gEAAgE,CAAC;YAC/E,IAAI;YACJ,gLAAgL;YAChL,IAAI;YACJ,MAAMI,OAAOC,KAAKC,KAAK,CAACL,QAAQM,MAAM,CAACC,IAAI;YAC3C,OAAOJ,wBAAAA,KAAMV,IAAI;QACnB,EAAE,OAAOe,OAAO;YACdvB,MAAM,kBAAkBuB;YAC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AEb,UAAU;gBACxB;gBACA;aACD,EACD;gBACEc,KAAKf;YACP;YAEF,IAAI;YACJ,uDAAuD;YACvD,IAAI;YACJ,MAAMgB,OAAOC,KAAKC,KAAK,CAACL,QAAQM,MAAM,CAACC,IAAI;YAC3C,OAAOJ,wBAAAA,KAAMW,IAAI;QACnB,EAAE,OAAON,OAAO;YACd,6DAA6D;YAC7DvB,MAAM,kBAAkBuB;QAC1B;IACF;IAEA,MAAMO,cAAcC,wBAAwB7B;IAC5C,IAAI,CAAC4B,aAAa;QAChB9B,MAAM;QACN,OAAO;IACT;IACA,MAAMgC,cAAc,MAAMF,YAAYG,sBAAsB,CAAC/B;IAE7D,OAAO8B,YAAYH,IAAI;AACzB;AAEA,SAASE,wBAAwB7B,WAAmB;IAClD,IAAI;QACF,OAAOD,QAAQA,QAAQiC,OAAO,CAAC,qBAAqB;YAAEC,OAAO;gBAACjC;aAAY;QAAC;IAC7E,EAAE,OAAM;QACN,OAAO;IACT;AACF"}
1
+ {"version":3,"sources":["../../../src/run/remoteBuildCache.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config';\nimport { ModPlatform } from '@expo/config-plugins';\n\nimport { type Options as AndroidRunOptions } from './android/resolveOptions';\nimport { type Options as IosRunOptions } from './ios/XcodeBuild.types';\nimport {\n calculateEASFingerprintHashAsync,\n resolveEASRemoteBuildCache,\n uploadEASRemoteBuildCache,\n} from '../utils/remote-build-cache-providers/eas';\nconst debug = require('debug')('expo:run:remote-build') as typeof console.log;\n\nexport async function resolveRemoteBuildCache(\n projectRoot: string,\n {\n platform,\n provider,\n runOptions,\n }: {\n platform: ModPlatform;\n provider?: Required<Required<ExpoConfig>['experiments']>['remoteBuildCache']['provider'];\n runOptions: AndroidRunOptions | IosRunOptions;\n }\n): Promise<string | null> {\n const fingerprintHash = await calculateFingerprintHashAsync(projectRoot, platform, provider);\n if (!fingerprintHash) {\n return null;\n }\n\n if (provider === 'eas') {\n return await resolveEASRemoteBuildCache({ platform, fingerprintHash, projectRoot, runOptions });\n }\n\n return null;\n}\n\nexport async function uploadRemoteBuildCache(\n projectRoot: string,\n {\n platform,\n provider,\n buildPath,\n }: {\n platform: ModPlatform;\n provider?: Required<Required<ExpoConfig>['experiments']>['remoteBuildCache']['provider'];\n buildPath?: string;\n }\n): Promise<void> {\n const fingerprintHash = await calculateFingerprintHashAsync(projectRoot, platform, provider);\n if (!fingerprintHash) {\n return;\n }\n\n if (provider === 'eas') {\n await uploadEASRemoteBuildCache({\n projectRoot,\n platform,\n fingerprintHash,\n buildPath,\n });\n }\n}\n\nasync function calculateFingerprintHashAsync(\n projectRoot: string,\n platform: ModPlatform,\n provider?: Required<Required<ExpoConfig>['experiments']>['remoteBuildCache']['provider']\n): Promise<string | null> {\n if (provider === 'eas') {\n const easFingerprintHash = await calculateEASFingerprintHashAsync({ projectRoot, platform });\n if (easFingerprintHash) {\n return easFingerprintHash;\n }\n }\n\n const Fingerprint = importFingerprintForDev(projectRoot);\n if (!Fingerprint) {\n debug('@expo/fingerprint is not installed in the project, skip checking for remote builds');\n return null;\n }\n const fingerprint = await Fingerprint.createFingerprintAsync(projectRoot);\n\n return fingerprint.hash;\n}\n\nfunction importFingerprintForDev(projectRoot: string): null | typeof import('@expo/fingerprint') {\n try {\n return require(require.resolve('@expo/fingerprint', { paths: [projectRoot] }));\n } catch {\n return null;\n }\n}\n"],"names":["resolveRemoteBuildCache","uploadRemoteBuildCache","debug","require","projectRoot","platform","provider","runOptions","fingerprintHash","calculateFingerprintHashAsync","resolveEASRemoteBuildCache","buildPath","uploadEASRemoteBuildCache","easFingerprintHash","calculateEASFingerprintHashAsync","Fingerprint","importFingerprintForDev","fingerprint","createFingerprintAsync","hash","resolve","paths"],"mappings":";;;;;;;;;;;IAYsBA,uBAAuB;eAAvBA;;IAwBAC,sBAAsB;eAAtBA;;;qBA3Bf;AACP,MAAMC,QAAQC,QAAQ,SAAS;AAExB,eAAeH,wBACpBI,WAAmB,EACnB,EACEC,QAAQ,EACRC,QAAQ,EACRC,UAAU,EAKX;IAED,MAAMC,kBAAkB,MAAMC,8BAA8BL,aAAaC,UAAUC;IACnF,IAAI,CAACE,iBAAiB;QACpB,OAAO;IACT;IAEA,IAAIF,aAAa,OAAO;QACtB,OAAO,MAAMI,IAAAA,+BAA0B,EAAC;YAAEL;YAAUG;YAAiBJ;YAAaG;QAAW;IAC/F;IAEA,OAAO;AACT;AAEO,eAAeN,uBACpBG,WAAmB,EACnB,EACEC,QAAQ,EACRC,QAAQ,EACRK,SAAS,EAKV;IAED,MAAMH,kBAAkB,MAAMC,8BAA8BL,aAAaC,UAAUC;IACnF,IAAI,CAACE,iBAAiB;QACpB;IACF;IAEA,IAAIF,aAAa,OAAO;QACtB,MAAMM,IAAAA,8BAAyB,EAAC;YAC9BR;YACAC;YACAG;YACAG;QACF;IACF;AACF;AAEA,eAAeF,8BACbL,WAAmB,EACnBC,QAAqB,EACrBC,QAAwF;IAExF,IAAIA,aAAa,OAAO;QACtB,MAAMO,qBAAqB,MAAMC,IAAAA,qCAAgC,EAAC;YAAEV;YAAaC;QAAS;QAC1F,IAAIQ,oBAAoB;YACtB,OAAOA;QACT;IACF;IAEA,MAAME,cAAcC,wBAAwBZ;IAC5C,IAAI,CAACW,aAAa;QAChBb,MAAM;QACN,OAAO;IACT;IACA,MAAMe,cAAc,MAAMF,YAAYG,sBAAsB,CAACd;IAE7D,OAAOa,YAAYE,IAAI;AACzB;AAEA,SAASH,wBAAwBZ,WAAmB;IAClD,IAAI;QACF,OAAOD,QAAQA,QAAQiB,OAAO,CAAC,qBAAqB;YAAEC,OAAO;gBAACjB;aAAY;QAAC;IAC7E,EAAE,OAAM;QACN,OAAO;IACT;AACF"}
@@ -16,23 +16,26 @@ _export(exports, {
16
16
  return getStackFormattedLocation;
17
17
  }
18
18
  });
19
+ function _nodepath() {
20
+ const data = /*#__PURE__*/ _interop_require_default(require("node:path"));
21
+ _nodepath = function() {
22
+ return data;
23
+ };
24
+ return data;
25
+ }
26
+ function _interop_require_default(obj) {
27
+ return obj && obj.__esModule ? obj : {
28
+ default: obj
29
+ };
30
+ }
19
31
  function formatProjectFilePath(projectRoot, file) {
20
32
  if (file == null) {
21
33
  return '<unknown>';
22
34
  }
23
- return pathRelativeToPath(file.replace(/\\/g, '/'), projectRoot.replace(/\\/g, '/')).replace(/\?.*$/, '');
24
- }
25
- function pathRelativeToPath(path, relativeTo, sep = '/') {
26
- const relativeToParts = relativeTo.split(sep);
27
- const pathParts = path.split(sep);
28
- let i = 0;
29
- while(i < relativeToParts.length && i < pathParts.length){
30
- if (relativeToParts[i] !== pathParts[i]) {
31
- break;
32
- }
33
- i++;
35
+ if (file === '<anonymous>') {
36
+ return file;
34
37
  }
35
- return pathParts.slice(i).join(sep);
38
+ return _nodepath().default.relative(projectRoot.replace(/\\/g, '/'), file.replace(/\\/g, '/')).replace(/\?.*$/, '');
36
39
  }
37
40
  function getStackFormattedLocation(projectRoot, frame) {
38
41
  const column = frame.column != null && parseInt(String(frame.column), 10);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/start/server/metro/log-box/formatProjectFilePath.ts"],"sourcesContent":["import type { StackFrame } from 'stacktrace-parser';\n\nexport type MetroStackFrame = StackFrame & { collapse?: boolean };\n\nexport function formatProjectFilePath(projectRoot: string, file?: string | null): string {\n if (file == null) {\n return '<unknown>';\n }\n\n return pathRelativeToPath(file.replace(/\\\\/g, '/'), projectRoot.replace(/\\\\/g, '/')).replace(\n /\\?.*$/,\n ''\n );\n}\n\nfunction pathRelativeToPath(path: string, relativeTo: string, sep = '/') {\n const relativeToParts = relativeTo.split(sep);\n const pathParts = path.split(sep);\n let i = 0;\n while (i < relativeToParts.length && i < pathParts.length) {\n if (relativeToParts[i] !== pathParts[i]) {\n break;\n }\n i++;\n }\n return pathParts.slice(i).join(sep);\n}\n\nexport function getStackFormattedLocation(projectRoot: string, frame: MetroStackFrame) {\n const column = frame.column != null && parseInt(String(frame.column), 10);\n const location =\n formatProjectFilePath(projectRoot, frame.file) +\n (frame.lineNumber != null\n ? ':' + frame.lineNumber + (column && !isNaN(column) ? ':' + (column + 1) : '')\n : '');\n\n return location;\n}\n"],"names":["formatProjectFilePath","getStackFormattedLocation","projectRoot","file","pathRelativeToPath","replace","path","relativeTo","sep","relativeToParts","split","pathParts","i","length","slice","join","frame","column","parseInt","String","location","lineNumber","isNaN"],"mappings":";;;;;;;;;;;IAIgBA,qBAAqB;eAArBA;;IAwBAC,yBAAyB;eAAzBA;;;AAxBT,SAASD,sBAAsBE,WAAmB,EAAEC,IAAoB;IAC7E,IAAIA,QAAQ,MAAM;QAChB,OAAO;IACT;IAEA,OAAOC,mBAAmBD,KAAKE,OAAO,CAAC,OAAO,MAAMH,YAAYG,OAAO,CAAC,OAAO,MAAMA,OAAO,CAC1F,SACA;AAEJ;AAEA,SAASD,mBAAmBE,IAAY,EAAEC,UAAkB,EAAEC,MAAM,GAAG;IACrE,MAAMC,kBAAkBF,WAAWG,KAAK,CAACF;IACzC,MAAMG,YAAYL,KAAKI,KAAK,CAACF;IAC7B,IAAII,IAAI;IACR,MAAOA,IAAIH,gBAAgBI,MAAM,IAAID,IAAID,UAAUE,MAAM,CAAE;QACzD,IAAIJ,eAAe,CAACG,EAAE,KAAKD,SAAS,CAACC,EAAE,EAAE;YACvC;QACF;QACAA;IACF;IACA,OAAOD,UAAUG,KAAK,CAACF,GAAGG,IAAI,CAACP;AACjC;AAEO,SAASP,0BAA0BC,WAAmB,EAAEc,KAAsB;IACnF,MAAMC,SAASD,MAAMC,MAAM,IAAI,QAAQC,SAASC,OAAOH,MAAMC,MAAM,GAAG;IACtE,MAAMG,WACJpB,sBAAsBE,aAAac,MAAMb,IAAI,IAC5Ca,CAAAA,MAAMK,UAAU,IAAI,OACjB,MAAML,MAAMK,UAAU,GAAIJ,CAAAA,UAAU,CAACK,MAAML,UAAU,MAAOA,CAAAA,SAAS,CAAA,IAAK,EAAC,IAC3E,EAAC;IAEP,OAAOG;AACT"}
1
+ {"version":3,"sources":["../../../../../../src/start/server/metro/log-box/formatProjectFilePath.ts"],"sourcesContent":["import path from 'node:path';\nimport type { StackFrame } from 'stacktrace-parser';\n\nexport type MetroStackFrame = StackFrame & { collapse?: boolean };\n\nexport function formatProjectFilePath(projectRoot: string, file?: string | null): string {\n if (file == null) {\n return '<unknown>';\n }\n if (file === '<anonymous>') {\n return file;\n }\n\n return path\n .relative(projectRoot.replace(/\\\\/g, '/'), file.replace(/\\\\/g, '/'))\n .replace(/\\?.*$/, '');\n}\n\nexport function getStackFormattedLocation(projectRoot: string, frame: MetroStackFrame) {\n const column = frame.column != null && parseInt(String(frame.column), 10);\n const location =\n formatProjectFilePath(projectRoot, frame.file) +\n (frame.lineNumber != null\n ? ':' + frame.lineNumber + (column && !isNaN(column) ? ':' + (column + 1) : '')\n : '');\n\n return location;\n}\n"],"names":["formatProjectFilePath","getStackFormattedLocation","projectRoot","file","path","relative","replace","frame","column","parseInt","String","location","lineNumber","isNaN"],"mappings":";;;;;;;;;;;IAKgBA,qBAAqB;eAArBA;;IAaAC,yBAAyB;eAAzBA;;;;gEAlBC;;;;;;;;;;;AAKV,SAASD,sBAAsBE,WAAmB,EAAEC,IAAoB;IAC7E,IAAIA,QAAQ,MAAM;QAChB,OAAO;IACT;IACA,IAAIA,SAAS,eAAe;QAC1B,OAAOA;IACT;IAEA,OAAOC,mBAAI,CACRC,QAAQ,CAACH,YAAYI,OAAO,CAAC,OAAO,MAAMH,KAAKG,OAAO,CAAC,OAAO,MAC9DA,OAAO,CAAC,SAAS;AACtB;AAEO,SAASL,0BAA0BC,WAAmB,EAAEK,KAAsB;IACnF,MAAMC,SAASD,MAAMC,MAAM,IAAI,QAAQC,SAASC,OAAOH,MAAMC,MAAM,GAAG;IACtE,MAAMG,WACJX,sBAAsBE,aAAaK,MAAMJ,IAAI,IAC5CI,CAAAA,MAAMK,UAAU,IAAI,OACjB,MAAML,MAAMK,UAAU,GAAIJ,CAAAA,UAAU,CAACK,MAAML,UAAU,MAAOA,CAAAA,SAAS,CAAA,IAAK,EAAC,IAC3E,EAAC;IAEP,OAAOG;AACT"}
@@ -192,7 +192,8 @@ function getMetroDirectBundleOptions(options) {
192
192
  splitChunks,
193
193
  usedExports: usedExports || undefined,
194
194
  output: serializerOutput,
195
- includeSourceMaps: serializerIncludeMaps
195
+ includeSourceMaps: serializerIncludeMaps,
196
+ exporting: isExporting || undefined
196
197
  }
197
198
  };
198
199
  return bundleOptions;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/start/server/middleware/metroOptions.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config';\nimport type { BundleOptions as MetroBundleOptions } from 'metro/src/shared/types';\nimport resolveFrom from 'resolve-from';\n\nimport { env } from '../../../utils/env';\nimport { CommandError } from '../../../utils/errors';\nimport { toPosixPath } from '../../../utils/filePath';\nimport { getRouterDirectoryModuleIdWithManifest } from '../metro/router';\n\nconst debug = require('debug')('expo:metro:options') as typeof console.log;\n\nexport type MetroEnvironment = 'node' | 'react-server' | 'client';\n\nexport type ExpoMetroOptions = {\n platform: string;\n mainModuleName: string;\n mode: string;\n minify?: boolean;\n environment?: MetroEnvironment;\n serializerOutput?: 'static';\n serializerIncludeMaps?: boolean;\n lazy?: boolean;\n engine?: 'hermes';\n preserveEnvVars?: boolean;\n bytecode: boolean;\n /** Enable async routes (route-based bundle splitting) in Expo Router. */\n asyncRoutes?: boolean;\n /** Module ID relative to the projectRoot for the Expo Router app directory. */\n routerRoot: string;\n /** Enable React compiler support in Babel. */\n reactCompiler: boolean;\n baseUrl?: string;\n isExporting: boolean;\n /** Is bundling a DOM Component (\"use dom\"). Requires the entry dom component file path. */\n domRoot?: string;\n /** Exporting MD5 filename based on file contents, for EAS Update. */\n useMd5Filename?: boolean;\n inlineSourceMap?: boolean;\n clientBoundaries?: string[];\n splitChunks?: boolean;\n usedExports?: boolean;\n /** Enable optimized bundling (required for tree shaking). */\n optimize?: boolean;\n\n modulesOnly?: boolean;\n runModule?: boolean;\n};\n\nexport type SerializerOptions = {\n includeSourceMaps?: boolean;\n output?: 'static';\n splitChunks?: boolean;\n usedExports?: boolean;\n};\n\nexport type ExpoMetroBundleOptions = MetroBundleOptions & {\n serializerOptions?: SerializerOptions;\n};\n\nexport function isServerEnvironment(environment?: any): boolean {\n return environment === 'node' || environment === 'react-server';\n}\n\nexport function shouldEnableAsyncImports(projectRoot: string): boolean {\n if (env.EXPO_NO_METRO_LAZY) {\n return false;\n }\n\n // `@expo/metro-runtime` includes support for the fetch + eval runtime code required\n // to support async imports. If it's not installed, we can't support async imports.\n // If it is installed, the user MUST import it somewhere in their project.\n // Expo Router automatically pulls this in, so we can check for it.\n return resolveFrom.silent(projectRoot, '@expo/metro-runtime/package.json') != null;\n}\n\nfunction withDefaults({\n mode = 'development',\n minify = mode === 'production',\n preserveEnvVars = mode !== 'development' && env.EXPO_NO_CLIENT_ENV_VARS,\n lazy,\n environment,\n ...props\n}: ExpoMetroOptions): ExpoMetroOptions {\n if (props.bytecode) {\n if (props.platform === 'web') {\n throw new CommandError('Cannot use bytecode with the web platform');\n }\n if (props.engine !== 'hermes') {\n throw new CommandError('Bytecode is only supported with the Hermes engine');\n }\n }\n\n const optimize =\n props.optimize ??\n (environment !== 'node' && mode === 'production' && env.EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH);\n\n return {\n mode,\n minify,\n preserveEnvVars,\n optimize,\n usedExports: optimize && env.EXPO_UNSTABLE_TREE_SHAKING,\n lazy: !props.isExporting && lazy,\n environment: environment === 'client' ? undefined : environment,\n ...props,\n };\n}\n\nexport function getBaseUrlFromExpoConfig(exp: ExpoConfig) {\n return exp.experiments?.baseUrl?.trim().replace(/\\/+$/, '') ?? '';\n}\n\nexport function getAsyncRoutesFromExpoConfig(exp: ExpoConfig, mode: string, platform: string) {\n let asyncRoutesSetting;\n\n if (exp.extra?.router?.asyncRoutes) {\n const asyncRoutes = exp.extra?.router?.asyncRoutes;\n if (['boolean', 'string'].includes(typeof asyncRoutes)) {\n asyncRoutesSetting = asyncRoutes;\n } else if (typeof asyncRoutes === 'object') {\n asyncRoutesSetting = asyncRoutes[platform] ?? asyncRoutes.default;\n }\n }\n\n return [mode, true].includes(asyncRoutesSetting);\n}\n\nexport function getMetroDirectBundleOptionsForExpoConfig(\n projectRoot: string,\n exp: ExpoConfig,\n options: Omit<ExpoMetroOptions, 'baseUrl' | 'reactCompiler' | 'routerRoot' | 'asyncRoutes'>\n): Partial<ExpoMetroBundleOptions> {\n return getMetroDirectBundleOptions({\n ...options,\n reactCompiler: !!exp.experiments?.reactCompiler,\n baseUrl: getBaseUrlFromExpoConfig(exp),\n routerRoot: getRouterDirectoryModuleIdWithManifest(projectRoot, exp),\n asyncRoutes: getAsyncRoutesFromExpoConfig(exp, options.mode, options.platform),\n });\n}\n\nexport function getMetroDirectBundleOptions(\n options: ExpoMetroOptions\n): Partial<ExpoMetroBundleOptions> {\n const {\n mainModuleName,\n platform,\n mode,\n minify,\n environment,\n serializerOutput,\n serializerIncludeMaps,\n bytecode,\n lazy,\n engine,\n preserveEnvVars,\n asyncRoutes,\n baseUrl,\n routerRoot,\n isExporting,\n inlineSourceMap,\n splitChunks,\n usedExports,\n reactCompiler,\n optimize,\n domRoot,\n clientBoundaries,\n runModule,\n modulesOnly,\n useMd5Filename,\n } = withDefaults(options);\n\n const dev = mode !== 'production';\n const isHermes = engine === 'hermes';\n\n if (isExporting) {\n debug('Disabling lazy bundling for export build');\n options.lazy = false;\n }\n\n let fakeSourceUrl: string | undefined;\n let fakeSourceMapUrl: string | undefined;\n\n // TODO: Upstream support to Metro for passing custom serializer options.\n if (serializerIncludeMaps != null || serializerOutput != null) {\n fakeSourceUrl = new URL(\n createBundleUrlPath(options).replace(/^\\//, ''),\n 'http://localhost:8081'\n ).toString();\n if (serializerIncludeMaps) {\n fakeSourceMapUrl = fakeSourceUrl.replace('.bundle?', '.map?');\n }\n }\n\n const customTransformOptions: ExpoMetroBundleOptions['customTransformOptions'] = {\n __proto__: null,\n optimize: optimize || undefined,\n engine,\n clientBoundaries,\n preserveEnvVars: preserveEnvVars || undefined,\n // Use string to match the query param behavior.\n asyncRoutes: asyncRoutes ? String(asyncRoutes) : undefined,\n environment,\n baseUrl: baseUrl || undefined,\n routerRoot,\n bytecode: bytecode ? '1' : undefined,\n reactCompiler: reactCompiler ? String(reactCompiler) : undefined,\n dom: domRoot,\n useMd5Filename: useMd5Filename || undefined,\n };\n\n // Iterate and delete undefined values\n for (const key in customTransformOptions) {\n if (customTransformOptions[key] === undefined) {\n delete customTransformOptions[key];\n }\n }\n\n const bundleOptions: Partial<ExpoMetroBundleOptions> = {\n platform,\n entryFile: mainModuleName,\n dev,\n minify: minify ?? !dev,\n inlineSourceMap: inlineSourceMap ?? false,\n lazy: (!isExporting && lazy) || undefined,\n unstable_transformProfile: isHermes ? 'hermes-stable' : 'default',\n customTransformOptions,\n runModule,\n modulesOnly,\n customResolverOptions: {\n __proto__: null,\n environment,\n exporting: isExporting || undefined,\n },\n sourceMapUrl: fakeSourceMapUrl,\n sourceUrl: fakeSourceUrl,\n serializerOptions: {\n splitChunks,\n usedExports: usedExports || undefined,\n output: serializerOutput,\n includeSourceMaps: serializerIncludeMaps,\n },\n };\n\n return bundleOptions;\n}\n\nexport function createBundleUrlPathFromExpoConfig(\n projectRoot: string,\n exp: ExpoConfig,\n options: Omit<ExpoMetroOptions, 'reactCompiler' | 'baseUrl' | 'routerRoot'>\n): string {\n return createBundleUrlPath({\n ...options,\n reactCompiler: !!exp.experiments?.reactCompiler,\n baseUrl: getBaseUrlFromExpoConfig(exp),\n routerRoot: getRouterDirectoryModuleIdWithManifest(projectRoot, exp),\n });\n}\n\nexport function createBundleUrlPath(options: ExpoMetroOptions): string {\n const queryParams = createBundleUrlSearchParams(options);\n return `/${encodeURI(options.mainModuleName.replace(/^\\/+/, ''))}.bundle?${queryParams.toString()}`;\n}\n\n/**\n * Create a bundle URL, containing all required query parameters, using a valid \"os path\".\n * On POSIX systems, this would look something like `/Users/../project/file.js?dev=false&..`.\n * On UNIX systems, this would look something like `C:\\Users\\..\\project\\file.js?dev=false&..`.\n * This path can safely be used with `path.*` modifiers and resolved.\n */\nexport function createBundleOsPath(options: ExpoMetroOptions): string {\n const queryParams = createBundleUrlSearchParams(options);\n const mainModuleName = toPosixPath(options.mainModuleName);\n return `${mainModuleName}.bundle?${queryParams.toString()}`;\n}\n\nexport function createBundleUrlSearchParams(options: ExpoMetroOptions): URLSearchParams {\n const {\n platform,\n mode,\n minify,\n environment,\n serializerOutput,\n serializerIncludeMaps,\n lazy,\n bytecode,\n engine,\n preserveEnvVars,\n asyncRoutes,\n baseUrl,\n routerRoot,\n reactCompiler,\n inlineSourceMap,\n isExporting,\n clientBoundaries,\n splitChunks,\n usedExports,\n optimize,\n domRoot,\n modulesOnly,\n runModule,\n } = withDefaults(options);\n\n const dev = String(mode !== 'production');\n const queryParams = new URLSearchParams({\n platform: encodeURIComponent(platform),\n dev,\n // TODO: Is this still needed?\n hot: String(false),\n });\n\n // Lazy bundling must be disabled for bundle splitting to work.\n if (!isExporting && lazy) {\n queryParams.append('lazy', String(lazy));\n }\n\n if (inlineSourceMap) {\n queryParams.append('inlineSourceMap', String(inlineSourceMap));\n }\n\n if (minify) {\n queryParams.append('minify', String(minify));\n }\n\n // We split bytecode from the engine since you could technically use Hermes without bytecode.\n // Hermes indicates the type of language features you want to transform out of the JS, whereas bytecode\n // indicates whether you want to use the Hermes bytecode format.\n if (engine) {\n queryParams.append('transform.engine', engine);\n }\n if (bytecode) {\n queryParams.append('transform.bytecode', '1');\n }\n if (asyncRoutes) {\n queryParams.append('transform.asyncRoutes', String(asyncRoutes));\n }\n if (preserveEnvVars) {\n queryParams.append('transform.preserveEnvVars', String(preserveEnvVars));\n }\n if (baseUrl) {\n queryParams.append('transform.baseUrl', baseUrl);\n }\n if (clientBoundaries?.length) {\n queryParams.append('transform.clientBoundaries', JSON.stringify(clientBoundaries));\n }\n if (routerRoot != null) {\n queryParams.append('transform.routerRoot', routerRoot);\n }\n if (reactCompiler) {\n queryParams.append('transform.reactCompiler', String(reactCompiler));\n }\n if (domRoot) {\n queryParams.append('transform.dom', domRoot);\n }\n\n if (environment) {\n queryParams.append('resolver.environment', environment);\n queryParams.append('transform.environment', environment);\n }\n\n if (isExporting) {\n queryParams.append('resolver.exporting', String(isExporting));\n }\n\n if (splitChunks) {\n queryParams.append('serializer.splitChunks', String(splitChunks));\n }\n if (usedExports) {\n queryParams.append('serializer.usedExports', String(usedExports));\n }\n if (optimize) {\n queryParams.append('transform.optimize', String(optimize));\n }\n if (serializerOutput) {\n queryParams.append('serializer.output', serializerOutput);\n }\n if (serializerIncludeMaps) {\n queryParams.append('serializer.map', String(serializerIncludeMaps));\n }\n if (engine === 'hermes') {\n queryParams.append('unstable_transformProfile', 'hermes-stable');\n }\n\n if (modulesOnly != null) {\n queryParams.set('modulesOnly', String(modulesOnly));\n }\n if (runModule != null) {\n queryParams.set('runModule', String(runModule));\n }\n\n return queryParams;\n}\n\n/**\n * Convert all path separators to `/`, including on Windows.\n * Metro asumes that all module specifiers are posix paths.\n * References to directories can still be Windows-style paths in Metro.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules#importing_features_into_your_script\n * @see https://github.com/facebook/metro/pull/1286\n */\nexport function convertPathToModuleSpecifier(pathLike: string) {\n return toPosixPath(pathLike);\n}\n\nexport function getMetroOptionsFromUrl(urlFragment: string) {\n const url = new URL(urlFragment, 'http://localhost:0');\n const getStringParam = (key: string) => {\n const param = url.searchParams.get(key);\n if (Array.isArray(param)) {\n throw new Error(`Expected single value for ${key}`);\n }\n return param;\n };\n\n let pathname = url.pathname;\n if (pathname.endsWith('.bundle')) {\n pathname = pathname.slice(0, -'.bundle'.length);\n }\n\n const options: ExpoMetroOptions = {\n mode: isTruthy(getStringParam('dev') ?? 'true') ? 'development' : 'production',\n minify: isTruthy(getStringParam('minify') ?? 'false'),\n lazy: isTruthy(getStringParam('lazy') ?? 'false'),\n routerRoot: getStringParam('transform.routerRoot') ?? 'app',\n isExporting: isTruthy(getStringParam('resolver.exporting') ?? 'false'),\n environment: assertEnvironment(getStringParam('transform.environment') ?? 'node'),\n platform: url.searchParams.get('platform') ?? 'web',\n bytecode: isTruthy(getStringParam('transform.bytecode') ?? 'false'),\n mainModuleName: convertPathToModuleSpecifier(pathname),\n reactCompiler: isTruthy(getStringParam('transform.reactCompiler') ?? 'false'),\n asyncRoutes: isTruthy(getStringParam('transform.asyncRoutes') ?? 'false'),\n baseUrl: getStringParam('transform.baseUrl') ?? undefined,\n // clientBoundaries: JSON.parse(getStringParam('transform.clientBoundaries') ?? '[]'),\n engine: assertEngine(getStringParam('transform.engine')),\n runModule: isTruthy(getStringParam('runModule') ?? 'true'),\n modulesOnly: isTruthy(getStringParam('modulesOnly') ?? 'false'),\n };\n\n return options;\n}\n\nfunction isTruthy(value: string | null): boolean {\n return value === 'true' || value === '1';\n}\n\nfunction assertEnvironment(environment: string | undefined): MetroEnvironment | undefined {\n if (!environment) {\n return undefined;\n }\n if (!['node', 'react-server', 'client'].includes(environment)) {\n throw new Error(`Expected transform.environment to be one of: node, react-server, client`);\n }\n return environment as MetroEnvironment;\n}\nfunction assertEngine(engine: string | undefined | null): 'hermes' | undefined {\n if (!engine) {\n return undefined;\n }\n if (!['hermes'].includes(engine)) {\n throw new Error(`Expected transform.engine to be one of: hermes`);\n }\n return engine as 'hermes';\n}\n"],"names":["convertPathToModuleSpecifier","createBundleOsPath","createBundleUrlPath","createBundleUrlPathFromExpoConfig","createBundleUrlSearchParams","getAsyncRoutesFromExpoConfig","getBaseUrlFromExpoConfig","getMetroDirectBundleOptions","getMetroDirectBundleOptionsForExpoConfig","getMetroOptionsFromUrl","isServerEnvironment","shouldEnableAsyncImports","debug","require","environment","projectRoot","env","EXPO_NO_METRO_LAZY","resolveFrom","silent","withDefaults","mode","minify","preserveEnvVars","EXPO_NO_CLIENT_ENV_VARS","lazy","props","bytecode","platform","CommandError","engine","optimize","EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH","usedExports","EXPO_UNSTABLE_TREE_SHAKING","isExporting","undefined","exp","experiments","baseUrl","trim","replace","asyncRoutesSetting","extra","router","asyncRoutes","includes","default","options","reactCompiler","routerRoot","getRouterDirectoryModuleIdWithManifest","mainModuleName","serializerOutput","serializerIncludeMaps","inlineSourceMap","splitChunks","domRoot","clientBoundaries","runModule","modulesOnly","useMd5Filename","dev","isHermes","fakeSourceUrl","fakeSourceMapUrl","URL","toString","customTransformOptions","__proto__","String","dom","key","bundleOptions","entryFile","unstable_transformProfile","customResolverOptions","exporting","sourceMapUrl","sourceUrl","serializerOptions","output","includeSourceMaps","queryParams","encodeURI","toPosixPath","URLSearchParams","encodeURIComponent","hot","append","length","JSON","stringify","set","pathLike","urlFragment","url","getStringParam","param","searchParams","get","Array","isArray","Error","pathname","endsWith","slice","isTruthy","assertEnvironment","assertEngine","value"],"mappings":";;;;;;;;;;;IAkZgBA,4BAA4B;eAA5BA;;IAnIAC,kBAAkB;eAAlBA;;IAXAC,mBAAmB;eAAnBA;;IAbAC,iCAAiC;eAAjCA;;IA8BAC,2BAA2B;eAA3BA;;IArKAC,4BAA4B;eAA5BA;;IAJAC,wBAAwB;eAAxBA;;IAiCAC,2BAA2B;eAA3BA;;IAdAC,wCAAwC;eAAxCA;;IAuRAC,sBAAsB;eAAtBA;;IA3VAC,mBAAmB;eAAnBA;;IAIAC,wBAAwB;eAAxBA;;;;gEA7DQ;;;;;;qBAEJ;wBACS;0BACD;wBAC2B;;;;;;AAEvD,MAAMC,QAAQC,QAAQ,SAAS;AAkDxB,SAASH,oBAAoBI,WAAiB;IACnD,OAAOA,gBAAgB,UAAUA,gBAAgB;AACnD;AAEO,SAASH,yBAAyBI,WAAmB;IAC1D,IAAIC,QAAG,CAACC,kBAAkB,EAAE;QAC1B,OAAO;IACT;IAEA,oFAAoF;IACpF,mFAAmF;IACnF,0EAA0E;IAC1E,mEAAmE;IACnE,OAAOC,sBAAW,CAACC,MAAM,CAACJ,aAAa,uCAAuC;AAChF;AAEA,SAASK,aA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AASF,kBAAkB9F,WAA+B;IACxD,IAAI,CAACA,aAAa;QAChB,OAAOsB;IACT;IACA,IAAI,CAAC;QAAC;QAAQ;QAAgB;KAAS,CAACU,QAAQ,CAAChC,cAAc;QAC7D,MAAM,IAAIyF,MAAM,CAAC,uEAAuE,CAAC;IAC3F;IACA,OAAOzF;AACT;AACA,SAAS+F,aAAa/E,MAAiC;IACrD,IAAI,CAACA,QAAQ;QACX,OAAOM;IACT;IACA,IAAI,CAAC;QAAC;KAAS,CAACU,QAAQ,CAAChB,SAAS;QAChC,MAAM,IAAIyE,MAAM,CAAC,8CAA8C,CAAC;IAClE;IACA,OAAOzE;AACT"}
1
+ {"version":3,"sources":["../../../../../src/start/server/middleware/metroOptions.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config';\nimport type { BundleOptions as MetroBundleOptions } from 'metro/src/shared/types';\nimport resolveFrom from 'resolve-from';\n\nimport { env } from '../../../utils/env';\nimport { CommandError } from '../../../utils/errors';\nimport { toPosixPath } from '../../../utils/filePath';\nimport { getRouterDirectoryModuleIdWithManifest } from '../metro/router';\n\nconst debug = require('debug')('expo:metro:options') as typeof console.log;\n\nexport type MetroEnvironment = 'node' | 'react-server' | 'client';\n\nexport type ExpoMetroOptions = {\n platform: string;\n mainModuleName: string;\n mode: string;\n minify?: boolean;\n environment?: MetroEnvironment;\n serializerOutput?: 'static';\n serializerIncludeMaps?: boolean;\n lazy?: boolean;\n engine?: 'hermes';\n preserveEnvVars?: boolean;\n bytecode: boolean;\n /** Enable async routes (route-based bundle splitting) in Expo Router. */\n asyncRoutes?: boolean;\n /** Module ID relative to the projectRoot for the Expo Router app directory. */\n routerRoot: string;\n /** Enable React compiler support in Babel. */\n reactCompiler: boolean;\n baseUrl?: string;\n isExporting: boolean;\n /** Is bundling a DOM Component (\"use dom\"). Requires the entry dom component file path. */\n domRoot?: string;\n /** Exporting MD5 filename based on file contents, for EAS Update. */\n useMd5Filename?: boolean;\n inlineSourceMap?: boolean;\n clientBoundaries?: string[];\n splitChunks?: boolean;\n usedExports?: boolean;\n /** Enable optimized bundling (required for tree shaking). */\n optimize?: boolean;\n\n modulesOnly?: boolean;\n runModule?: boolean;\n};\n\n// See: @expo/metro-config/src/serializer/fork/baseJSBundle.ts `ExpoSerializerOptions`\nexport type SerializerOptions = {\n includeSourceMaps?: boolean;\n output?: 'static';\n splitChunks?: boolean;\n usedExports?: boolean;\n exporting?: boolean;\n};\n\nexport type ExpoMetroBundleOptions = MetroBundleOptions & {\n serializerOptions?: SerializerOptions;\n};\n\nexport function isServerEnvironment(environment?: any): boolean {\n return environment === 'node' || environment === 'react-server';\n}\n\nexport function shouldEnableAsyncImports(projectRoot: string): boolean {\n if (env.EXPO_NO_METRO_LAZY) {\n return false;\n }\n\n // `@expo/metro-runtime` includes support for the fetch + eval runtime code required\n // to support async imports. If it's not installed, we can't support async imports.\n // If it is installed, the user MUST import it somewhere in their project.\n // Expo Router automatically pulls this in, so we can check for it.\n return resolveFrom.silent(projectRoot, '@expo/metro-runtime/package.json') != null;\n}\n\nfunction withDefaults({\n mode = 'development',\n minify = mode === 'production',\n preserveEnvVars = mode !== 'development' && env.EXPO_NO_CLIENT_ENV_VARS,\n lazy,\n environment,\n ...props\n}: ExpoMetroOptions): ExpoMetroOptions {\n if (props.bytecode) {\n if (props.platform === 'web') {\n throw new CommandError('Cannot use bytecode with the web platform');\n }\n if (props.engine !== 'hermes') {\n throw new CommandError('Bytecode is only supported with the Hermes engine');\n }\n }\n\n const optimize =\n props.optimize ??\n (environment !== 'node' && mode === 'production' && env.EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH);\n\n return {\n mode,\n minify,\n preserveEnvVars,\n optimize,\n usedExports: optimize && env.EXPO_UNSTABLE_TREE_SHAKING,\n lazy: !props.isExporting && lazy,\n environment: environment === 'client' ? undefined : environment,\n ...props,\n };\n}\n\nexport function getBaseUrlFromExpoConfig(exp: ExpoConfig) {\n return exp.experiments?.baseUrl?.trim().replace(/\\/+$/, '') ?? '';\n}\n\nexport function getAsyncRoutesFromExpoConfig(exp: ExpoConfig, mode: string, platform: string) {\n let asyncRoutesSetting;\n\n if (exp.extra?.router?.asyncRoutes) {\n const asyncRoutes = exp.extra?.router?.asyncRoutes;\n if (['boolean', 'string'].includes(typeof asyncRoutes)) {\n asyncRoutesSetting = asyncRoutes;\n } else if (typeof asyncRoutes === 'object') {\n asyncRoutesSetting = asyncRoutes[platform] ?? asyncRoutes.default;\n }\n }\n\n return [mode, true].includes(asyncRoutesSetting);\n}\n\nexport function getMetroDirectBundleOptionsForExpoConfig(\n projectRoot: string,\n exp: ExpoConfig,\n options: Omit<ExpoMetroOptions, 'baseUrl' | 'reactCompiler' | 'routerRoot' | 'asyncRoutes'>\n): Partial<ExpoMetroBundleOptions> {\n return getMetroDirectBundleOptions({\n ...options,\n reactCompiler: !!exp.experiments?.reactCompiler,\n baseUrl: getBaseUrlFromExpoConfig(exp),\n routerRoot: getRouterDirectoryModuleIdWithManifest(projectRoot, exp),\n asyncRoutes: getAsyncRoutesFromExpoConfig(exp, options.mode, options.platform),\n });\n}\n\nexport function getMetroDirectBundleOptions(\n options: ExpoMetroOptions\n): Partial<ExpoMetroBundleOptions> {\n const {\n mainModuleName,\n platform,\n mode,\n minify,\n environment,\n serializerOutput,\n serializerIncludeMaps,\n bytecode,\n lazy,\n engine,\n preserveEnvVars,\n asyncRoutes,\n baseUrl,\n routerRoot,\n isExporting,\n inlineSourceMap,\n splitChunks,\n usedExports,\n reactCompiler,\n optimize,\n domRoot,\n clientBoundaries,\n runModule,\n modulesOnly,\n useMd5Filename,\n } = withDefaults(options);\n\n const dev = mode !== 'production';\n const isHermes = engine === 'hermes';\n\n if (isExporting) {\n debug('Disabling lazy bundling for export build');\n options.lazy = false;\n }\n\n let fakeSourceUrl: string | undefined;\n let fakeSourceMapUrl: string | undefined;\n\n // TODO: Upstream support to Metro for passing custom serializer options.\n if (serializerIncludeMaps != null || serializerOutput != null) {\n fakeSourceUrl = new URL(\n createBundleUrlPath(options).replace(/^\\//, ''),\n 'http://localhost:8081'\n ).toString();\n if (serializerIncludeMaps) {\n fakeSourceMapUrl = fakeSourceUrl.replace('.bundle?', '.map?');\n }\n }\n\n const customTransformOptions: ExpoMetroBundleOptions['customTransformOptions'] = {\n __proto__: null,\n optimize: optimize || undefined,\n engine,\n clientBoundaries,\n preserveEnvVars: preserveEnvVars || undefined,\n // Use string to match the query param behavior.\n asyncRoutes: asyncRoutes ? String(asyncRoutes) : undefined,\n environment,\n baseUrl: baseUrl || undefined,\n routerRoot,\n bytecode: bytecode ? '1' : undefined,\n reactCompiler: reactCompiler ? String(reactCompiler) : undefined,\n dom: domRoot,\n useMd5Filename: useMd5Filename || undefined,\n };\n\n // Iterate and delete undefined values\n for (const key in customTransformOptions) {\n if (customTransformOptions[key] === undefined) {\n delete customTransformOptions[key];\n }\n }\n\n const bundleOptions: Partial<ExpoMetroBundleOptions> = {\n platform,\n entryFile: mainModuleName,\n dev,\n minify: minify ?? !dev,\n inlineSourceMap: inlineSourceMap ?? false,\n lazy: (!isExporting && lazy) || undefined,\n unstable_transformProfile: isHermes ? 'hermes-stable' : 'default',\n customTransformOptions,\n runModule,\n modulesOnly,\n customResolverOptions: {\n __proto__: null,\n environment,\n exporting: isExporting || undefined,\n },\n sourceMapUrl: fakeSourceMapUrl,\n sourceUrl: fakeSourceUrl,\n serializerOptions: {\n splitChunks,\n usedExports: usedExports || undefined,\n output: serializerOutput,\n includeSourceMaps: serializerIncludeMaps,\n exporting: isExporting || undefined,\n },\n };\n\n return bundleOptions;\n}\n\nexport function createBundleUrlPathFromExpoConfig(\n projectRoot: string,\n exp: ExpoConfig,\n options: Omit<ExpoMetroOptions, 'reactCompiler' | 'baseUrl' | 'routerRoot'>\n): string {\n return createBundleUrlPath({\n ...options,\n reactCompiler: !!exp.experiments?.reactCompiler,\n baseUrl: getBaseUrlFromExpoConfig(exp),\n routerRoot: getRouterDirectoryModuleIdWithManifest(projectRoot, exp),\n });\n}\n\nexport function createBundleUrlPath(options: ExpoMetroOptions): string {\n const queryParams = createBundleUrlSearchParams(options);\n return `/${encodeURI(options.mainModuleName.replace(/^\\/+/, ''))}.bundle?${queryParams.toString()}`;\n}\n\n/**\n * Create a bundle URL, containing all required query parameters, using a valid \"os path\".\n * On POSIX systems, this would look something like `/Users/../project/file.js?dev=false&..`.\n * On UNIX systems, this would look something like `C:\\Users\\..\\project\\file.js?dev=false&..`.\n * This path can safely be used with `path.*` modifiers and resolved.\n */\nexport function createBundleOsPath(options: ExpoMetroOptions): string {\n const queryParams = createBundleUrlSearchParams(options);\n const mainModuleName = toPosixPath(options.mainModuleName);\n return `${mainModuleName}.bundle?${queryParams.toString()}`;\n}\n\nexport function createBundleUrlSearchParams(options: ExpoMetroOptions): URLSearchParams {\n const {\n platform,\n mode,\n minify,\n environment,\n serializerOutput,\n serializerIncludeMaps,\n lazy,\n bytecode,\n engine,\n preserveEnvVars,\n asyncRoutes,\n baseUrl,\n routerRoot,\n reactCompiler,\n inlineSourceMap,\n isExporting,\n clientBoundaries,\n splitChunks,\n usedExports,\n optimize,\n domRoot,\n modulesOnly,\n runModule,\n } = withDefaults(options);\n\n const dev = String(mode !== 'production');\n const queryParams = new URLSearchParams({\n platform: encodeURIComponent(platform),\n dev,\n // TODO: Is this still needed?\n hot: String(false),\n });\n\n // Lazy bundling must be disabled for bundle splitting to work.\n if (!isExporting && lazy) {\n queryParams.append('lazy', String(lazy));\n }\n\n if (inlineSourceMap) {\n queryParams.append('inlineSourceMap', String(inlineSourceMap));\n }\n\n if (minify) {\n queryParams.append('minify', String(minify));\n }\n\n // We split bytecode from the engine since you could technically use Hermes without bytecode.\n // Hermes indicates the type of language features you want to transform out of the JS, whereas bytecode\n // indicates whether you want to use the Hermes bytecode format.\n if (engine) {\n queryParams.append('transform.engine', engine);\n }\n if (bytecode) {\n queryParams.append('transform.bytecode', '1');\n }\n if (asyncRoutes) {\n queryParams.append('transform.asyncRoutes', String(asyncRoutes));\n }\n if (preserveEnvVars) {\n queryParams.append('transform.preserveEnvVars', String(preserveEnvVars));\n }\n if (baseUrl) {\n queryParams.append('transform.baseUrl', baseUrl);\n }\n if (clientBoundaries?.length) {\n queryParams.append('transform.clientBoundaries', JSON.stringify(clientBoundaries));\n }\n if (routerRoot != null) {\n queryParams.append('transform.routerRoot', routerRoot);\n }\n if (reactCompiler) {\n queryParams.append('transform.reactCompiler', String(reactCompiler));\n }\n if (domRoot) {\n queryParams.append('transform.dom', domRoot);\n }\n\n if (environment) {\n queryParams.append('resolver.environment', environment);\n queryParams.append('transform.environment', environment);\n }\n\n if (isExporting) {\n queryParams.append('resolver.exporting', String(isExporting));\n }\n\n if (splitChunks) {\n queryParams.append('serializer.splitChunks', String(splitChunks));\n }\n if (usedExports) {\n queryParams.append('serializer.usedExports', String(usedExports));\n }\n if (optimize) {\n queryParams.append('transform.optimize', String(optimize));\n }\n if (serializerOutput) {\n queryParams.append('serializer.output', serializerOutput);\n }\n if (serializerIncludeMaps) {\n queryParams.append('serializer.map', String(serializerIncludeMaps));\n }\n if (engine === 'hermes') {\n queryParams.append('unstable_transformProfile', 'hermes-stable');\n }\n\n if (modulesOnly != null) {\n queryParams.set('modulesOnly', String(modulesOnly));\n }\n if (runModule != null) {\n queryParams.set('runModule', String(runModule));\n }\n\n return queryParams;\n}\n\n/**\n * Convert all path separators to `/`, including on Windows.\n * Metro asumes that all module specifiers are posix paths.\n * References to directories can still be Windows-style paths in Metro.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules#importing_features_into_your_script\n * @see https://github.com/facebook/metro/pull/1286\n */\nexport function convertPathToModuleSpecifier(pathLike: string) {\n return toPosixPath(pathLike);\n}\n\nexport function getMetroOptionsFromUrl(urlFragment: string) {\n const url = new URL(urlFragment, 'http://localhost:0');\n const getStringParam = (key: string) => {\n const param = url.searchParams.get(key);\n if (Array.isArray(param)) {\n throw new Error(`Expected single value for ${key}`);\n }\n return param;\n };\n\n let pathname = url.pathname;\n if (pathname.endsWith('.bundle')) {\n pathname = pathname.slice(0, -'.bundle'.length);\n }\n\n const options: ExpoMetroOptions = {\n mode: isTruthy(getStringParam('dev') ?? 'true') ? 'development' : 'production',\n minify: isTruthy(getStringParam('minify') ?? 'false'),\n lazy: isTruthy(getStringParam('lazy') ?? 'false'),\n routerRoot: getStringParam('transform.routerRoot') ?? 'app',\n isExporting: isTruthy(getStringParam('resolver.exporting') ?? 'false'),\n environment: assertEnvironment(getStringParam('transform.environment') ?? 'node'),\n platform: url.searchParams.get('platform') ?? 'web',\n bytecode: isTruthy(getStringParam('transform.bytecode') ?? 'false'),\n mainModuleName: convertPathToModuleSpecifier(pathname),\n reactCompiler: isTruthy(getStringParam('transform.reactCompiler') ?? 'false'),\n asyncRoutes: isTruthy(getStringParam('transform.asyncRoutes') ?? 'false'),\n baseUrl: getStringParam('transform.baseUrl') ?? undefined,\n // clientBoundaries: JSON.parse(getStringParam('transform.clientBoundaries') ?? '[]'),\n engine: assertEngine(getStringParam('transform.engine')),\n runModule: isTruthy(getStringParam('runModule') ?? 'true'),\n modulesOnly: isTruthy(getStringParam('modulesOnly') ?? 'false'),\n };\n\n return options;\n}\n\nfunction isTruthy(value: string | null): boolean {\n return value === 'true' || value === '1';\n}\n\nfunction assertEnvironment(environment: string | undefined): MetroEnvironment | undefined {\n if (!environment) {\n return undefined;\n }\n if (!['node', 'react-server', 'client'].includes(environment)) {\n throw new Error(`Expected transform.environment to be one of: node, react-server, client`);\n }\n return environment as MetroEnvironment;\n}\nfunction assertEngine(engine: string | undefined | null): 'hermes' | undefined {\n if (!engine) {\n return undefined;\n }\n if (!['hermes'].includes(engine)) {\n throw new Error(`Expected transform.engine to be one of: hermes`);\n }\n return engine as 'hermes';\n}\n"],"names":["convertPathToModuleSpecifier","createBundleOsPath","createBundleUrlPath","createBundleUrlPathFromExpoConfig","createBundleUrlSearchParams","getAsyncRoutesFromExpoConfig","getBaseUrlFromExpoConfig","getMetroDirectBundleOptions","getMetroDirectBundleOptionsForExpoConfig","getMetroOptionsFromUrl","isServerEnvironment","shouldEnableAsyncImports","debug","require","environment","projectRoot","env","EXPO_NO_METRO_LAZY","resolveFrom","silent","withDefaults","mode","minify","preserveEnvVars","EXPO_NO_CLIENT_ENV_VARS","lazy","props","bytecode","platform","CommandError","engine","optimize","EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH","usedExports","EXPO_UNSTABLE_TREE_SHAKING","isExporting","undefined","exp","experiments","baseUrl","trim","replace","asyncRoutesSetting","extra","router","asyncRoutes","includes","default","options","reactCompiler","routerRoot","getRouterDirectoryModuleIdWithManifest","mainModuleName","serializerOutput","serializerIncludeMaps","inlineSourceMap","splitChunks","domRoot","clientBoundaries","runModule","modulesOnly","useMd5Filename","dev","isHermes","fakeSourceUrl","fakeSourceMapUrl","URL","toString","customTransformOptions","__proto__","String","dom","key","bundleOptions","entryFile","unstable_transformProfile","customResolverOptions","exporting","sourceMapUrl","sourceUrl","serializerOptions","output","includeSourceMaps","queryParams","encodeURI","toPosixPath","URLSearchParams","encodeURIComponent","hot","append","length","JSON","stringify","set","pathLike","urlFragment","url","getStringParam","param","searchParams","get","Array","isArray","Error","pathname","endsWith","slice","isTruthy","assertEnvironment","assertEngine","value"],"mappings":";;;;;;;;;;;IAqZgBA,4BAA4B;eAA5BA;;IAnIAC,kBAAkB;eAAlBA;;IAXAC,mBAAmB;eAAnBA;;IAbAC,iCAAiC;eAAjCA;;IA8BAC,2BAA2B;eAA3BA;;IAtKAC,4BAA4B;eAA5BA;;IAJAC,wBAAwB;eAAxBA;;IAiCAC,2BAA2B;eAA3BA;;IAdAC,wCAAwC;eAAxCA;;IAwRAC,sBAAsB;eAAtBA;;IA5VAC,mBAAmB;eAAnBA;;IAIAC,wBAAwB;eAAxBA;;;;gEA/DQ;;;;;;qBAEJ;wBACS;0BACD;wBAC2B;;;;;;AAEvD,MAAMC,QAAQC,QAAQ,SAAS;AAoDxB,SAASH,oBAAoBI,WAAiB;IACnD,OAAOA,gBAAgB,UAAUA,gBAAgB;AAC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jE1D,SAAS0D,eAAe,wBAAwB7D;QAChD,sFAAsF;QACtFN,QAAQ+E,aAAaZ,eAAe;QACpCtC,WAAWgD,SAASV,eAAe,gBAAgB;QACnDrC,aAAa+C,SAASV,eAAe,kBAAkB;IACzD;IAEA,OAAOjD;AACT;AAEA,SAAS2D,SAASG,KAAoB;IACpC,OAAOA,UAAU,UAAUA,UAAU;AACvC;AAEA,SAASF,kBAAkB9F,WAA+B;IACxD,IAAI,CAACA,aAAa;QAChB,OAAOsB;IACT;IACA,IAAI,CAAC;QAAC;QAAQ;QAAgB;KAAS,CAACU,QAAQ,CAAChC,cAAc;QAC7D,MAAM,IAAIyF,MAAM,CAAC,uEAAuE,CAAC;IAC3F;IACA,OAAOzF;AACT;AACA,SAAS+F,aAAa/E,MAAiC;IACrD,IAAI,CAACA,QAAQ;QACX,OAAOM;IACT;IACA,IAAI,CAAC;QAAC;KAAS,CAACU,QAAQ,CAAChB,SAAS;QAChC,MAAM,IAAIyE,MAAM,CAAC,8CAA8C,CAAC;IAClE;IACA,OAAOzE;AACT"}
@@ -8,117 +8,20 @@ Object.defineProperty(exports, "getIpAddress", {
8
8
  return getIpAddress;
9
9
  }
10
10
  });
11
- function _internalip() {
12
- const data = /*#__PURE__*/ _interop_require_default(require("internal-ip"));
13
- _internalip = function() {
11
+ function _lannetwork() {
12
+ const data = require("lan-network");
13
+ _lannetwork = function() {
14
14
  return data;
15
15
  };
16
16
  return data;
17
17
  }
18
- function _nodechild_process() {
19
- const data = require("node:child_process");
20
- _nodechild_process = function() {
21
- return data;
22
- };
23
- return data;
24
- }
25
- function _nodenet() {
26
- const data = require("node:net");
27
- _nodenet = function() {
28
- return data;
29
- };
30
- return data;
31
- }
32
- function _nodeos() {
33
- const data = require("node:os");
34
- _nodeos = function() {
35
- return data;
36
- };
37
- return data;
38
- }
39
- function _interop_require_default(obj) {
40
- return obj && obj.__esModule ? obj : {
41
- default: obj
42
- };
43
- }
44
- /** Gets a route address by opening a UDP socket to a publicly routed address.
45
- * @privateRemarks
46
- * This is wrapped in `spawnSync` since the original `getIpAddress` utility exported
47
- * in this module is used synchronosly. An appropriate timeout has been set and UDP
48
- * ports don't send a message when opened.
49
- * @throws if `spawnSync` fails
50
- */ function getRouteAddress() {
51
- const { error, status, stdout } = (0, _nodechild_process().spawnSync)(process.execPath, [
52
- '-'
53
- ], {
54
- // This should be the cheapest method to determine the default route
55
- // By opening a socket to a publicly routed IP address, we let the default
56
- // gateway handle this socket, which means the socket's address will be
57
- // the prioritised route for public IP addresses.
58
- // It might fall back to `"0.0.0.0"` when no network connection is established
59
- input: `
60
- var socket = require('dgram').createSocket({ type: 'udp4', reuseAddr: true });
61
- socket.unref();
62
- socket.connect(53, '1.1.1.1', function() {
63
- var address = socket.address();
64
- socket.close();
65
- if (address && 'address' in address) {
66
- process.stdout.write(address.address);
67
- process.exit(0);
68
- } else {
69
- process.exit(1);
70
- }
71
- });
72
- `,
73
- shell: false,
74
- timeout: 500,
75
- encoding: 'utf8',
76
- windowsVerbatimArguments: false,
77
- windowsHide: true
78
- });
79
- // We only use the stdout as an IP, if it validates as an IP and we got a zero exit code
80
- if (status || error) {
81
- return null;
82
- } else if (!status && typeof stdout === 'string' && (0, _nodenet().isIPv4)(stdout.trim())) {
83
- return stdout.trim();
84
- } else {
85
- return null;
86
- }
87
- }
88
- /** By convention, a zero mac address means we have a virtual device, which we'd like to exclude */ const VIRTUAL_MAC_ADDRESS = '00:00:00:00:00:00';
89
- /** Determines the internal IP address by opening a socket, then checking the socket address against non-internal network interface assignments
90
- * @throws If no address can be determined.
91
- */ function getRouteIPAddress() {
92
- // We check the IP address we get against the available network interfaces
93
- // It's only an internal IP address if we have a matching address on an interface's IP assignment
94
- let routeAddress = null;
95
- try {
96
- routeAddress = getRouteAddress();
97
- } catch {}
98
- if (!routeAddress) {
99
- return null;
100
- }
101
- let ifaces;
18
+ function getIpAddress() {
102
19
  try {
103
- ifaces = (0, _nodeos().networkInterfaces)();
20
+ const lan = (0, _lannetwork().lanNetworkSync)();
21
+ return lan.address;
104
22
  } catch {
105
- // NOTE: This usually doesn't throw, but invalid builds or unknown targets in Node.js
106
- // can cause this call to unexpectedly raise a system error
107
- return null;
108
- }
109
- for(const iface in ifaces){
110
- const assignments = ifaces[iface];
111
- for(let i = 0; assignments && i < assignments.length; i++){
112
- const assignment = assignments[i];
113
- // Only use IPv4 assigments that aren't internal
114
- // Only use IPv4 assignment if it's not a virtual device (e.g. a VPN network interface)
115
- if (assignment.family === 'IPv4' && !assignment.internal && assignment.address === routeAddress && assignment.mac !== VIRTUAL_MAC_ADDRESS) return routeAddress;
116
- }
23
+ return '127.0.0.1';
117
24
  }
118
- return null;
119
- }
120
- function getIpAddress() {
121
- return _internalip().default.v4.sync() || getRouteIPAddress() || '127.0.0.1';
122
25
  }
123
26
 
124
27
  //# sourceMappingURL=ip.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/utils/ip.ts"],"sourcesContent":["import internalIp from 'internal-ip';\nimport { spawnSync } from 'node:child_process';\nimport { isIPv4 } from 'node:net';\nimport { networkInterfaces } from 'node:os';\n\n/** Gets a route address by opening a UDP socket to a publicly routed address.\n * @privateRemarks\n * This is wrapped in `spawnSync` since the original `getIpAddress` utility exported\n * in this module is used synchronosly. An appropriate timeout has been set and UDP\n * ports don't send a message when opened.\n * @throws if `spawnSync` fails\n */\nfunction getRouteAddress(): string | null {\n const { error, status, stdout } = spawnSync(process.execPath, ['-'], {\n // This should be the cheapest method to determine the default route\n // By opening a socket to a publicly routed IP address, we let the default\n // gateway handle this socket, which means the socket's address will be\n // the prioritised route for public IP addresses.\n // It might fall back to `\"0.0.0.0\"` when no network connection is established\n input: `\n var socket = require('dgram').createSocket({ type: 'udp4', reuseAddr: true });\n socket.unref();\n socket.connect(53, '1.1.1.1', function() {\n var address = socket.address();\n socket.close();\n if (address && 'address' in address) {\n process.stdout.write(address.address);\n process.exit(0);\n } else {\n process.exit(1);\n }\n });\n `,\n shell: false,\n timeout: 500,\n encoding: 'utf8',\n windowsVerbatimArguments: false,\n windowsHide: true,\n });\n // We only use the stdout as an IP, if it validates as an IP and we got a zero exit code\n if (status || error) {\n return null;\n } else if (!status && typeof stdout === 'string' && isIPv4(stdout.trim())) {\n return stdout.trim();\n } else {\n return null;\n }\n}\n\n/** By convention, a zero mac address means we have a virtual device, which we'd like to exclude */\nconst VIRTUAL_MAC_ADDRESS = '00:00:00:00:00:00';\n\n/** Determines the internal IP address by opening a socket, then checking the socket address against non-internal network interface assignments\n * @throws If no address can be determined.\n */\nfunction getRouteIPAddress(): string | null {\n // We check the IP address we get against the available network interfaces\n // It's only an internal IP address if we have a matching address on an interface's IP assignment\n let routeAddress: string | null = null;\n try {\n routeAddress = getRouteAddress();\n } catch {}\n if (!routeAddress) {\n return null;\n }\n let ifaces: ReturnType<typeof networkInterfaces>;\n try {\n ifaces = networkInterfaces();\n } catch {\n // NOTE: This usually doesn't throw, but invalid builds or unknown targets in Node.js\n // can cause this call to unexpectedly raise a system error\n return null;\n }\n for (const iface in ifaces) {\n const assignments = ifaces[iface];\n for (let i = 0; assignments && i < assignments.length; i++) {\n const assignment = assignments[i];\n // Only use IPv4 assigments that aren't internal\n // Only use IPv4 assignment if it's not a virtual device (e.g. a VPN network interface)\n if (\n assignment.family === 'IPv4' &&\n !assignment.internal &&\n assignment.address === routeAddress &&\n assignment.mac !== VIRTUAL_MAC_ADDRESS\n )\n return routeAddress;\n }\n }\n return null;\n}\n\nexport function getIpAddress(): string {\n return internalIp.v4.sync() || getRouteIPAddress() || '127.0.0.1';\n}\n"],"names":["getIpAddress","getRouteAddress","error","status","stdout","spawnSync","process","execPath","input","shell","timeout","encoding","windowsVerbatimArguments","windowsHide","isIPv4","trim","VIRTUAL_MAC_ADDRESS","getRouteIPAddress","routeAddress","ifaces","networkInterfaces","iface","assignments","i","length","assignment","family","internal","address","mac","internalIp","v4","sync"],"mappings":";;;;+BA2FgBA;;;eAAAA;;;;gEA3FO;;;;;;;yBACG;;;;;;;yBACH;;;;;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,OAAO;AACT;AAEO,SAASlB;IACd,OAAO8B,qBAAU,CAACC,EAAE,CAACC,IAAI,MAAMf,uBAAuB;AACxD"}
1
+ {"version":3,"sources":["../../../src/utils/ip.ts"],"sourcesContent":["import { lanNetworkSync } from 'lan-network';\n\nexport function getIpAddress(): string {\n try {\n const lan = lanNetworkSync();\n return lan.address;\n } catch {\n return '127.0.0.1';\n }\n}\n"],"names":["getIpAddress","lan","lanNetworkSync","address"],"mappings":";;;;+BAEgBA;;;eAAAA;;;;yBAFe;;;;;;AAExB,SAASA;IACd,IAAI;QACF,MAAMC,MAAMC,IAAAA,4BAAc;QAC1B,OAAOD,IAAIE,OAAO;IACpB,EAAE,OAAM;QACN,OAAO;IACT;AACF"}
@@ -0,0 +1,147 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ calculateEASFingerprintHashAsync: function() {
13
+ return calculateEASFingerprintHashAsync;
14
+ },
15
+ resolveEASRemoteBuildCache: function() {
16
+ return resolveEASRemoteBuildCache;
17
+ },
18
+ uploadEASRemoteBuildCache: function() {
19
+ return uploadEASRemoteBuildCache;
20
+ }
21
+ });
22
+ function _spawnasync() {
23
+ const data = /*#__PURE__*/ _interop_require_default(require("@expo/spawn-async"));
24
+ _spawnasync = function() {
25
+ return data;
26
+ };
27
+ return data;
28
+ }
29
+ function _chalk() {
30
+ const data = /*#__PURE__*/ _interop_require_default(require("chalk"));
31
+ _chalk = function() {
32
+ return data;
33
+ };
34
+ return data;
35
+ }
36
+ function _fs() {
37
+ const data = /*#__PURE__*/ _interop_require_default(require("fs"));
38
+ _fs = function() {
39
+ return data;
40
+ };
41
+ return data;
42
+ }
43
+ function _path() {
44
+ const data = /*#__PURE__*/ _interop_require_default(require("path"));
45
+ _path = function() {
46
+ return data;
47
+ };
48
+ return data;
49
+ }
50
+ const _helpers = require("./helpers");
51
+ const _log = require("../../log");
52
+ const _xcrun = require("../../start/platforms/ios/xcrun");
53
+ function _interop_require_default(obj) {
54
+ return obj && obj.__esModule ? obj : {
55
+ default: obj
56
+ };
57
+ }
58
+ const debug = require('debug')('expo:eas-remote-build-cache');
59
+ async function resolveEASRemoteBuildCache({ projectRoot, platform, fingerprintHash, runOptions }) {
60
+ const easJsonPath = _path().default.join(projectRoot, 'eas.json');
61
+ if (!_fs().default.existsSync(easJsonPath)) {
62
+ debug('eas.json not found, skip checking for remote builds');
63
+ return null;
64
+ }
65
+ _log.Log.log((0, _chalk().default)`{whiteBright \u203A} {bold Searching builds with matching fingerprint on EAS servers}`);
66
+ try {
67
+ const results = await (0, _spawnasync().default)('npx', [
68
+ 'eas-cli',
69
+ 'build:download',
70
+ `--platform=${platform}`,
71
+ `--fingerprint=${fingerprintHash}`,
72
+ '--non-interactive',
73
+ (0, _helpers.isDevClientBuild)({
74
+ runOptions,
75
+ projectRoot
76
+ }) ? '--dev-client' : '--no-dev-client',
77
+ '--json'
78
+ ], {
79
+ cwd: projectRoot
80
+ });
81
+ _log.Log.log((0, _chalk().default)`{whiteBright \u203A} {bold Successfully downloaded cached build}`);
82
+ // {
83
+ // "path": "/var/folders/03/lppcpcnn61q3mz5ckzmzd8w80000gn/T/eas-cli-nodejs/eas-build-run-cache/c0f9ba9c-0cf1-4c5c-8566-b28b7971050f_22f1bbfa-1c09-4b67-9e4a-721906546b58.app"
84
+ // }
85
+ const json = JSON.parse(results.stdout.trim());
86
+ return json == null ? void 0 : json.path;
87
+ } catch (error) {
88
+ debug('eas-cli error:', error);
89
+ // @TODO(2025-04-11): remove this in a future release
90
+ if ((0, _xcrun.isSpawnResultError)(error) && error.stderr.includes('command build:download not found')) {
91
+ _log.Log.warn(`To take advantage of remote build cache, upgrade your eas-cli installation to latest.`);
92
+ }
93
+ return null;
94
+ }
95
+ }
96
+ async function uploadEASRemoteBuildCache({ projectRoot, platform, fingerprintHash, buildPath }) {
97
+ const easJsonPath = _path().default.join(projectRoot, 'eas.json');
98
+ if (!_fs().default.existsSync(easJsonPath)) {
99
+ debug('eas.json not found, skip checking for remote builds');
100
+ return;
101
+ }
102
+ try {
103
+ _log.Log.log((0, _chalk().default)`{whiteBright \u203A} {bold Uploading build to remote cache}`);
104
+ const results = await (0, _spawnasync().default)('npx', [
105
+ 'eas-cli',
106
+ 'upload',
107
+ `--platform=${platform}`,
108
+ `--fingerprint=${fingerprintHash}`,
109
+ buildPath ? `--build-path=${buildPath}` : '',
110
+ '--non-interactive',
111
+ '--json'
112
+ ], {
113
+ cwd: projectRoot
114
+ });
115
+ // {
116
+ // "url": "/var/folders/03/lppcpcnn61q3mz5ckzmzd8w80000gn/T/eas-cli-nodejs/eas-build-run-cache/c0f9ba9c-0cf1-4c5c-8566-b28b7971050f_22f1bbfa-1c09-4b67-9e4a-721906546b58.app"
117
+ // }
118
+ const json = JSON.parse(results.stdout.trim());
119
+ _log.Log.log((0, _chalk().default)`{whiteBright \u203A} {bold Build successfully uploaded: ${json == null ? void 0 : json.url}}`);
120
+ } catch (error) {
121
+ debug('eas-cli error:', error);
122
+ }
123
+ }
124
+ async function calculateEASFingerprintHashAsync({ projectRoot, platform }) {
125
+ // prefer using `eas fingerprint:generate` because it automatically upload sources
126
+ try {
127
+ const results = await (0, _spawnasync().default)('npx', [
128
+ 'eas-cli',
129
+ 'fingerprint:generate',
130
+ `--platform=${platform}`,
131
+ '--json',
132
+ '--non-interactive'
133
+ ], {
134
+ cwd: projectRoot
135
+ });
136
+ // {
137
+ // "hash": "203f960b965e154b77dc31c6c42e5582e8d77196"
138
+ // }
139
+ const json = JSON.parse(results.stdout.trim());
140
+ return json == null ? void 0 : json.hash;
141
+ } catch (error) {
142
+ debug('eas-cli error:', error);
143
+ }
144
+ return null;
145
+ }
146
+
147
+ //# sourceMappingURL=eas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/utils/remote-build-cache-providers/eas.ts"],"sourcesContent":["import { ModPlatform } from '@expo/config-plugins';\nimport spawnAsync from '@expo/spawn-async';\nimport chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\n\nimport { isDevClientBuild } from './helpers';\nimport { Log } from '../../log';\nimport { type Options as AndroidRunOptions } from '../../run/android/resolveOptions';\nimport { type Options as IosRunOptions } from '../../run/ios/XcodeBuild.types';\nimport { isSpawnResultError } from '../../start/platforms/ios/xcrun';\n\nconst debug = require('debug')('expo:eas-remote-build-cache') as typeof console.log;\n\nexport async function resolveEASRemoteBuildCache({\n projectRoot,\n platform,\n fingerprintHash,\n runOptions,\n}: {\n projectRoot: string;\n platform: ModPlatform;\n fingerprintHash: string;\n runOptions: AndroidRunOptions | IosRunOptions;\n}): Promise<string | null> {\n const easJsonPath = path.join(projectRoot, 'eas.json');\n if (!fs.existsSync(easJsonPath)) {\n debug('eas.json not found, skip checking for remote builds');\n return null;\n }\n\n Log.log(\n chalk`{whiteBright \\u203A} {bold Searching builds with matching fingerprint on EAS servers}`\n );\n try {\n const results = await spawnAsync(\n 'npx',\n [\n 'eas-cli',\n 'build:download',\n `--platform=${platform}`,\n `--fingerprint=${fingerprintHash}`,\n '--non-interactive',\n isDevClientBuild({ runOptions, projectRoot }) ? '--dev-client' : '--no-dev-client',\n '--json',\n ],\n {\n cwd: projectRoot,\n }\n );\n\n Log.log(chalk`{whiteBright \\u203A} {bold Successfully downloaded cached build}`);\n // {\n // \"path\": \"/var/folders/03/lppcpcnn61q3mz5ckzmzd8w80000gn/T/eas-cli-nodejs/eas-build-run-cache/c0f9ba9c-0cf1-4c5c-8566-b28b7971050f_22f1bbfa-1c09-4b67-9e4a-721906546b58.app\"\n // }\n const json = JSON.parse(results.stdout.trim());\n return json?.path;\n } catch (error) {\n debug('eas-cli error:', error);\n // @TODO(2025-04-11): remove this in a future release\n if (isSpawnResultError(error) && error.stderr.includes('command build:download not found')) {\n Log.warn(\n `To take advantage of remote build cache, upgrade your eas-cli installation to latest.`\n );\n }\n return null;\n }\n}\n\nexport async function uploadEASRemoteBuildCache({\n projectRoot,\n platform,\n fingerprintHash,\n buildPath,\n}: {\n projectRoot: string;\n platform: ModPlatform;\n fingerprintHash: string;\n buildPath?: string;\n}): Promise<void> {\n const easJsonPath = path.join(projectRoot, 'eas.json');\n if (!fs.existsSync(easJsonPath)) {\n debug('eas.json not found, skip checking for remote builds');\n return;\n }\n\n try {\n Log.log(chalk`{whiteBright \\u203A} {bold Uploading build to remote cache}`);\n const results = await spawnAsync(\n 'npx',\n [\n 'eas-cli',\n 'upload',\n `--platform=${platform}`,\n `--fingerprint=${fingerprintHash}`,\n buildPath ? `--build-path=${buildPath}` : '',\n '--non-interactive',\n '--json',\n ],\n {\n cwd: projectRoot,\n }\n );\n // {\n // \"url\": \"/var/folders/03/lppcpcnn61q3mz5ckzmzd8w80000gn/T/eas-cli-nodejs/eas-build-run-cache/c0f9ba9c-0cf1-4c5c-8566-b28b7971050f_22f1bbfa-1c09-4b67-9e4a-721906546b58.app\"\n // }\n const json = JSON.parse(results.stdout.trim());\n Log.log(chalk`{whiteBright \\u203A} {bold Build successfully uploaded: ${json?.url}}`);\n } catch (error) {\n debug('eas-cli error:', error);\n }\n}\n\nexport async function calculateEASFingerprintHashAsync({\n projectRoot,\n platform,\n}: {\n projectRoot: string;\n platform: ModPlatform;\n}): Promise<string | null> {\n // prefer using `eas fingerprint:generate` because it automatically upload sources\n try {\n const results = await spawnAsync(\n 'npx',\n ['eas-cli', 'fingerprint:generate', `--platform=${platform}`, '--json', '--non-interactive'],\n {\n cwd: projectRoot,\n }\n );\n // {\n // \"hash\": \"203f960b965e154b77dc31c6c42e5582e8d77196\"\n // }\n const json = JSON.parse(results.stdout.trim());\n return json?.hash;\n } catch (error) {\n debug('eas-cli error:', error);\n }\n return null;\n}\n"],"names":["calculateEASFingerprintHashAsync","resolveEASRemoteBuildCache","uploadEASRemoteBuildCache","debug","require","projectRoot","platform","fingerprintHash","runOptions","easJsonPath","path","join","fs","existsSync","Log","log","chalk","results","spawnAsync","isDevClientBuild","cwd","json","JSON","parse","stdout","trim","error","isSpawnResultError","stderr","includes","warn","buildPath","url","hash"],"mappings":";;;;;;;;;;;IAiHsBA,gCAAgC;eAAhCA;;IAnGAC,0BAA0B;eAA1BA;;IAuDAC,yBAAyB;eAAzBA;;;;gEApEC;;;;;;;gEACL;;;;;;;gEACH;;;;;;;gEACE;;;;;;yBAEgB;qBACb;uBAGe;;;;;;AAEnC,MAAMC,QAAQC,QAAQ,SAAS;AAExB,eAAeH,2BAA2B,EAC/CI,WAAW,EACXC,QAAQ,EACRC,eAAe,EACfC,UAAU,EAMX;IACC,MAAMC,cAAcC,eAAI,CAACC,IAAI,CAACN,aAAa;IAC3C,IAAI,CAACO,aAAE,CAACC,UAAU,CAACJ,cAAc;QAC/BN,MAAM;QACN,OAAO;IACT;IAEAW,QAAG,CAACC,GAAG,CACLC,IAAAA,gBAAK,CAAA,CAAC,qFAAqF,CAAC;IAE9F,IAAI;QACF,MAAMC,UAAU,MAAMC,IAAAA,qBAAU,EAC9B,OACA;YACE;YACA;YACA,CAAC,WAAW,EAAEZ,UAAU;YACxB,CAAC,cAAc,EAAEC,iBAAiB;YAClC;YACAY,IAAAA,yBAAgB,EAAC;gBAAEX;gBAAYH;YAAY,KAAK,iBAAiB;YACjE;SACD,EACD;YACEe,KAAKf;QACP;QAGFS,QAAG,CAACC,GAAG,CAACC,IAAAA,gBAAK,CAAA,CAAC,gEAAgE,CAAC;QAC/E,IAAI;QACJ,gLAAgL;QAChL,IAAI;QACJ,MAAMK,OAAOC,KAAKC,KAAK,CAACN,QAAQO,MAAM,CAACC,IAAI;QAC3C,OAAOJ,wBAAAA,KAAMX,IAAI;IACnB,EAAE,OAAOgB,OAAO;QACdvB,MAAM,kBAAkBuB;QACxB,qDAAqD;QACrD,IAAIC,IAAAA,yBAAkB,EAACD,UAAUA,MAAME,MAAM,CAACC,QAAQ,CAAC,qCAAqC;YAC1Ff,QAAG,CAACgB,IAAI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vB,MAAM,kBAAkBuB;IAC1B;IACA,OAAO;AACT"}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "isDevClientBuild", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return isDevClientBuild;
9
+ }
10
+ });
11
+ const _detectDevClient = require("../../start/detectDevClient");
12
+ function isDevClientBuild({ runOptions, projectRoot }) {
13
+ if (!(0, _detectDevClient.hasDirectDevClientDependency)(projectRoot)) {
14
+ return false;
15
+ }
16
+ if ('variant' in runOptions && runOptions.variant !== undefined) {
17
+ return runOptions.variant === 'debug';
18
+ }
19
+ if ('configuration' in runOptions && runOptions.configuration !== undefined) {
20
+ return runOptions.configuration === 'Debug';
21
+ }
22
+ return true;
23
+ }
24
+
25
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/utils/remote-build-cache-providers/helpers.ts"],"sourcesContent":["import { type Options as AndroidRunOptions } from '../../run/android/resolveOptions';\nimport { type Options as IosRunOptions } from '../../run/ios/XcodeBuild.types';\nimport { hasDirectDevClientDependency } from '../../start/detectDevClient';\n\nexport function isDevClientBuild({\n runOptions,\n projectRoot,\n}: {\n runOptions: AndroidRunOptions | IosRunOptions;\n projectRoot: string;\n}) {\n if (!hasDirectDevClientDependency(projectRoot)) {\n return false;\n }\n\n if ('variant' in runOptions && runOptions.variant !== undefined) {\n return runOptions.variant === 'debug';\n }\n if ('configuration' in runOptions && runOptions.configuration !== undefined) {\n return runOptions.configuration === 'Debug';\n }\n\n return true;\n}\n"],"names":["isDevClientBuild","runOptions","projectRoot","hasDirectDevClientDependency","variant","undefined","configuration"],"mappings":";;;;+BAIgBA;;;eAAAA;;;iCAF6B;AAEtC,SAASA,iBAAiB,EAC/BC,UAAU,EACVC,WAAW,EAIZ;IACC,IAAI,CAACC,IAAAA,6CAA4B,EAACD,cAAc;QAC9C,OAAO;IACT;IAEA,IAAI,aAAaD,cAAcA,WAAWG,OAAO,KAAKC,WAAW;QAC/D,OAAOJ,WAAWG,OAAO,KAAK;IAChC;IACA,IAAI,mBAAmBH,cAAcA,WAAWK,aAAa,KAAKD,WAAW;QAC3E,OAAOJ,WAAWK,aAAa,KAAK;IACtC;IAEA,OAAO;AACT"}
@@ -33,7 +33,7 @@ class FetchClient {
33
33
  this.headers = {
34
34
  accept: 'application/json',
35
35
  'content-type': 'application/json',
36
- 'user-agent': `expo-cli/${"0.24.2"}`,
36
+ 'user-agent': `expo-cli/${"0.24.3"}`,
37
37
  authorization: 'Basic ' + _nodebuffer().Buffer.from(`${target}:`).toString('base64')
38
38
  };
39
39
  }
@@ -83,7 +83,7 @@ function createContext() {
83
83
  cpu: summarizeCpuInfo(),
84
84
  app: {
85
85
  name: 'expo/cli',
86
- version: "0.24.2"
86
+ version: "0.24.3"
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": "0.24.2",
3
+ "version": "0.24.3",
4
4
  "description": "The Expo CLI",
5
5
  "main": "build/bin/cli",
6
6
  "bin": {
@@ -43,20 +43,20 @@
43
43
  "@babel/runtime": "^7.20.0",
44
44
  "@expo/code-signing-certificates": "^0.0.5",
45
45
  "@expo/config": "~11.0.3",
46
- "@expo/config-plugins": "~9.1.4",
46
+ "@expo/config-plugins": "~9.1.5",
47
47
  "@expo/devcert": "^1.1.2",
48
48
  "@expo/env": "~1.0.3",
49
49
  "@expo/image-utils": "^0.7.2",
50
50
  "@expo/json-file": "^9.1.2",
51
- "@expo/metro-config": "~0.20.4",
51
+ "@expo/metro-config": "~0.20.5",
52
52
  "@expo/osascript": "^2.2.2",
53
53
  "@expo/package-manager": "^1.8.2",
54
54
  "@expo/plist": "^0.3.2",
55
- "@expo/prebuild-config": "^9.0.0",
55
+ "@expo/prebuild-config": "^9.0.1",
56
56
  "@expo/spawn-async": "^1.7.2",
57
57
  "@expo/ws-tunnel": "^1.0.1",
58
58
  "@expo/xcpretty": "^4.3.0",
59
- "@react-native/dev-middleware": "0.79.0",
59
+ "@react-native/dev-middleware": "0.79.1",
60
60
  "@urql/core": "^5.0.6",
61
61
  "@urql/exchange-retry": "^1.3.0",
62
62
  "accepts": "^1.3.8",
@@ -73,8 +73,8 @@
73
73
  "freeport-async": "^2.0.0",
74
74
  "getenv": "^1.0.0",
75
75
  "glob": "^10.4.2",
76
- "internal-ip": "6.1.0",
77
76
  "minimatch": "^9.0.0",
77
+ "lan-network": "^0.1.4",
78
78
  "node-forge": "^1.3.1",
79
79
  "npm-package-arg": "^11.0.0",
80
80
  "ora": "^3.4.0",
@@ -152,5 +152,5 @@
152
152
  "tree-kill": "^1.2.2",
153
153
  "tsd": "^0.28.1"
154
154
  },
155
- "gitHead": "aabba5222c2dbbdc9dc5ded1723967c84d7f4237"
155
+ "gitHead": "f1394f21ff2719a9a3037d7511db170704e5c492"
156
156
  }