@expo/cli 0.24.2 → 0.24.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/build/bin/cli +1 -1
  2. package/build/src/install/utils/checkPackagesCompatibility.js +1 -1
  3. package/build/src/install/utils/checkPackagesCompatibility.js.map +1 -1
  4. package/build/src/lint/ESlintPrerequisite.js +2 -2
  5. package/build/src/lint/ESlintPrerequisite.js.map +1 -1
  6. package/build/src/lint/index.js +45 -47
  7. package/build/src/lint/index.js.map +1 -1
  8. package/build/src/lint/lintAsync.js +150 -4
  9. package/build/src/lint/lintAsync.js.map +1 -1
  10. package/build/src/lint/resolveOptions.js +115 -0
  11. package/build/src/lint/resolveOptions.js.map +1 -0
  12. package/build/src/prebuild/renameTemplateAppName.js +4 -1
  13. package/build/src/prebuild/renameTemplateAppName.js.map +1 -1
  14. package/build/src/run/android/runAndroidAsync.js +20 -19
  15. package/build/src/run/android/runAndroidAsync.js.map +1 -1
  16. package/build/src/run/ios/runIosAsync.js +4 -2
  17. package/build/src/run/ios/runIosAsync.js.map +1 -1
  18. package/build/src/run/remoteBuildCache.js +27 -115
  19. package/build/src/run/remoteBuildCache.js.map +1 -1
  20. package/build/src/start/server/metro/log-box/formatProjectFilePath.js +15 -12
  21. package/build/src/start/server/metro/log-box/formatProjectFilePath.js.map +1 -1
  22. package/build/src/start/server/middleware/metroOptions.js +2 -1
  23. package/build/src/start/server/middleware/metroOptions.js.map +1 -1
  24. package/build/src/utils/ip.js +7 -104
  25. package/build/src/utils/ip.js.map +1 -1
  26. package/build/src/utils/remote-build-cache-providers/eas.js +147 -0
  27. package/build/src/utils/remote-build-cache-providers/eas.js.map +1 -0
  28. package/build/src/utils/remote-build-cache-providers/helpers.js +25 -0
  29. package/build/src/utils/remote-build-cache-providers/helpers.js.map +1 -0
  30. package/build/src/utils/resolveArgs.js +8 -0
  31. package/build/src/utils/resolveArgs.js.map +1 -1
  32. package/build/src/utils/telemetry/clients/FetchClient.js +1 -1
  33. package/build/src/utils/telemetry/utils/context.js +1 -1
  34. package/build/src/utils/variadic.js +63 -6
  35. package/build/src/utils/variadic.js.map +1 -1
  36. package/package.json +9 -9
@@ -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;uBACF;kCACyB;8BAC9B;;;;;;AAElC,MAAMC,QAAQC,QAAQ,SAAS;AAExB,eAAeF,gBAAgBG,WAAmB,EAAE,EAAEC,OAAO,EAAE,GAAGC,SAAkB;QAEpEA,kBAKEC,gCAmDZ,OAiCmBA;IA1F9B,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;QACpE;QACA,IAAIH,WAAW;YACbb,QAAQS,MAAM,GAAGI;QACnB;IACF;IAEA,MAAMI,IAAAA,6CAAwB,EAACnB,aAAa;QAAEiB,UAAU;QAAWhB;IAAQ;IAE3E,MAAMmB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AY,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;IAC7D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E;QAC5BuB,IAAAA,6BAAsB;IACxB,OAAO;QACL,MAAMrB,QAAQsB,SAAS;IACzB;IAEA,IAAInC,4BAA0B1B,kCAAAA,cAAcS,GAAG,CAACC,WAAW,qBAA7BV,gCAA+BW,gBAAgB,GAAE;YAGjEX;QAFZ,MAAM8D,IAAAA,wCAAsB,EAACjE,aAAa;YACxCiB,UAAU;YACVC,QAAQ,GAAEf,kCAAAA,cAAcS,GAAG,CAACC,WAAW,qBAA7BV,gCAA+BW,gBAAgB,CAACI,QAAQ;YAClEgD,WAAWhE,QAAQS,MAAM;QAC3B;IACF;AACF;AAEA,eAAe8C,gBAAgB/B,kBAA0B,EAAEL,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;IA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Aa;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,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BiB,IAAAA,6BAAsB;IACxB,OAAO;QACL,MAAMR,QAAQS,SAAS;IACzB;IAEA,IAAI3B,4BAA0B/C,kCAAAA,cAAcc,GAAG,CAACC,WAAW,qBAA7Bf,gCAA+BgB,gBAAgB,GAAE;YAGjEhB;QAFZ,MAAM2E,IAAAA,wCAAsB,EAAC7E,aAAa;YACxCS,UAAU;YACVa,QAAQ,GAAEpB,kCAAAA,cAAcc,GAAG,CAACC,WAAW,qBAA7Bf,gCAA+BgB,gBAAgB,CAACI,QAAQ;YAClEwD,WAAWnD;QACb;IACF;AACF;AAEA,SAASrB;IACP,IAAIyE,QAAQtE,QAAQ,KAAK,UAAU;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,qB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,CAACC,IAAI;YAC3CV,QAAG,CAACC,GAAG,CAACC,IAAAA,gBAAK,CAAA,CAAC,wDAAwD,EAAEI,wBAAAA,KAAMU,GAAG,CAAC,CAAC,CAAC;QACtF,EAAE,OAAOL,OAAO;YACdvB,MAAM,kBAAkBuB;YACxB,OAAO;QACT;IACF;IAEA,OAAO;AACT;AAEA,eAAejB,8BACbJ,WAAmB,EACnBC,QAAqB,EACrBC,QAAwF;IAExF,IAAIA,aAAa,OAAO;QACtB,kFAAkF;QAClF,IAAI;YACF,MAAMW,UAAU,MAAMC,IAAAA,qBAAU,EAC9B,OACA;gBACE;gBACA;gBACA,CAAC,WAAW,EAAEb,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;;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AAC,eAAe;QAC9CzE,UAAUgF,SAASV,eAAe,yBAAyB;QAC3D7C,gBAAgBpD,6BAA6BwG;QAC7CvD,eAAe0D,SAASV,eAAe,8BAA8B;QACrEpD,aAAa8D,SAASV,eAAe,4BAA4B;QACjE1D,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"}
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,m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