@expo/cli 0.18.18 → 0.18.19

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 (45) hide show
  1. package/build/bin/cli +1 -1
  2. package/build/src/export/createMetadataJson.js.map +1 -1
  3. package/build/src/export/embed/exportEmbedAsync.js +41 -110
  4. package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
  5. package/build/src/export/embed/resolveOptions.js +1 -0
  6. package/build/src/export/embed/resolveOptions.js.map +1 -1
  7. package/build/src/export/exportApp.js +92 -130
  8. package/build/src/export/exportApp.js.map +1 -1
  9. package/build/src/export/exportAssets.js.map +1 -1
  10. package/build/src/export/exportHermes.js +0 -15
  11. package/build/src/export/exportHermes.js.map +1 -1
  12. package/build/src/export/exportStaticAsync.js +48 -3
  13. package/build/src/export/exportStaticAsync.js.map +1 -1
  14. package/build/src/export/fork-bundleAsync.js +284 -0
  15. package/build/src/export/fork-bundleAsync.js.map +1 -0
  16. package/build/src/export/saveAssets.js.map +1 -1
  17. package/build/src/run/startBundler.js +8 -1
  18. package/build/src/run/startBundler.js.map +1 -1
  19. package/build/src/start/server/BundlerDevServer.js +2 -9
  20. package/build/src/start/server/BundlerDevServer.js.map +1 -1
  21. package/build/src/start/server/DevServerManager.js +1 -13
  22. package/build/src/start/server/DevServerManager.js.map +1 -1
  23. package/build/src/start/server/getStaticRenderFunctions.js +123 -9
  24. package/build/src/start/server/getStaticRenderFunctions.js.map +1 -1
  25. package/build/src/start/server/metro/MetroBundlerDevServer.js +102 -391
  26. package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
  27. package/build/src/start/server/metro/createServerRouteMiddleware.js +9 -0
  28. package/build/src/start/server/metro/createServerRouteMiddleware.js.map +1 -1
  29. package/build/src/start/server/metro/instantiateMetro.js +12 -19
  30. package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
  31. package/build/src/start/server/metro/metroErrorInterface.js +2 -49
  32. package/build/src/start/server/metro/metroErrorInterface.js.map +1 -1
  33. package/build/src/start/server/metro/runServer-fork.js +20 -28
  34. package/build/src/start/server/metro/runServer-fork.js.map +1 -1
  35. package/build/src/start/server/metro/withMetroMultiPlatform.js +9 -8
  36. package/build/src/start/server/metro/withMetroMultiPlatform.js.map +1 -1
  37. package/build/src/start/server/middleware/ManifestMiddleware.js +3 -6
  38. package/build/src/start/server/middleware/ManifestMiddleware.js.map +1 -1
  39. package/build/src/start/server/middleware/metroOptions.js +3 -11
  40. package/build/src/start/server/middleware/metroOptions.js.map +1 -1
  41. package/build/src/start/server/middleware/resolveAssets.js.map +1 -1
  42. package/build/src/utils/telemetry/getContext.js +1 -1
  43. package/package.json +3 -3
  44. package/build/src/start/server/metro/metroPrivateServer.js +0 -26
  45. package/build/src/start/server/metro/metroPrivateServer.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/start/server/middleware/ManifestMiddleware.ts"],"sourcesContent":["import {\n ExpoConfig,\n ExpoGoConfig,\n getConfig,\n PackageJSONConfig,\n ProjectConfig,\n} from '@expo/config';\nimport { resolveEntryPoint } from '@expo/config/paths';\nimport findWorkspaceRoot from 'find-yarn-workspace-root';\nimport path from 'path';\nimport { resolve } from 'url';\n\nimport { ExpoMiddleware } from './ExpoMiddleware';\nimport {\n shouldEnableAsyncImports,\n createBundleUrlPath,\n getBaseUrlFromExpoConfig,\n getAsyncRoutesFromExpoConfig,\n createBundleUrlPathFromExpoConfig,\n} from './metroOptions';\nimport { resolveGoogleServicesFile, resolveManifestAssets } from './resolveAssets';\nimport { parsePlatformHeader, RuntimePlatform } from './resolvePlatform';\nimport { ServerHeaders, ServerNext, ServerRequest, ServerResponse } from './server.types';\nimport { isEnableHermesManaged } from '../../../export/exportHermes';\nimport * as Log from '../../../log';\nimport { env } from '../../../utils/env';\nimport { CommandError } from '../../../utils/errors';\nimport { stripExtension } from '../../../utils/url';\nimport * as ProjectDevices from '../../project/devices';\nimport { UrlCreator } from '../UrlCreator';\nimport { getRouterDirectoryModuleIdWithManifest } from '../metro/router';\nimport { getPlatformBundlers, PlatformBundlers } from '../platformBundlers';\nimport { createTemplateHtmlFromExpoConfigAsync } from '../webTemplate';\n\nconst debug = require('debug')('expo:start:server:middleware:manifest') as typeof console.log;\n\n/** Wraps `findWorkspaceRoot` and guards against having an empty `package.json` file in an upper directory. */\nexport function getWorkspaceRoot(projectRoot: string): string | null {\n try {\n return findWorkspaceRoot(projectRoot);\n } catch (error: any) {\n if (error.message.includes('Unexpected end of JSON input')) {\n return null;\n }\n throw error;\n }\n}\n\nconst supportedPlatforms = ['ios', 'android', 'web', 'none'];\n\nexport function getEntryWithServerRoot(\n projectRoot: string,\n props: { platform: string; pkg?: PackageJSONConfig }\n) {\n if (!supportedPlatforms.includes(props.platform)) {\n throw new CommandError(\n `Failed to resolve the project's entry file: The platform \"${props.platform}\" is not supported.`\n );\n }\n return path.relative(getMetroServerRoot(projectRoot), resolveEntryPoint(projectRoot, props));\n}\n\nexport function getMetroServerRoot(projectRoot: string) {\n if (env.EXPO_USE_METRO_WORKSPACE_ROOT) {\n return getWorkspaceRoot(projectRoot) ?? projectRoot;\n }\n\n return projectRoot;\n}\n\n/** Get the main entry module ID (file) relative to the project root. */\nexport function resolveMainModuleName(\n projectRoot: string,\n props: { platform: string; pkg?: PackageJSONConfig }\n): string {\n const entryPoint = getEntryWithServerRoot(projectRoot, props);\n\n debug(`Resolved entry point: ${entryPoint} (project root: ${projectRoot})`);\n\n return stripExtension(entryPoint, 'js');\n}\n\n/** Info about the computer hosting the dev server. */\nexport interface HostInfo {\n host: string;\n server: 'expo';\n serverVersion: string;\n serverDriver: string | null;\n serverOS: NodeJS.Platform;\n serverOSVersion: string;\n}\n\n/** Parsed values from the supported request headers. */\nexport interface ManifestRequestInfo {\n /** Platform to serve. */\n platform: RuntimePlatform;\n /** Requested host name. */\n hostname?: string | null;\n /** The protocol used to request the manifest */\n protocol?: 'http' | 'https';\n}\n\n/** Project related info. */\nexport type ResponseProjectSettings = {\n expoGoConfig: ExpoGoConfig;\n hostUri: string;\n bundleUrl: string;\n exp: ExpoConfig;\n};\n\nexport const DEVELOPER_TOOL = 'expo-cli';\n\nexport type ManifestMiddlewareOptions = {\n /** Should start the dev servers in development mode (minify). */\n mode?: 'development' | 'production';\n /** Should instruct the bundler to create minified bundles. */\n minify?: boolean;\n constructUrl: UrlCreator['constructUrl'];\n isNativeWebpack?: boolean;\n privateKeyPath?: string;\n};\n\n/** Base middleware creator for serving the Expo manifest (like the index.html but for native runtimes). */\nexport abstract class ManifestMiddleware<\n TManifestRequestInfo extends ManifestRequestInfo,\n> extends ExpoMiddleware {\n private initialProjectConfig: ProjectConfig;\n private platformBundlers: PlatformBundlers;\n\n constructor(\n protected projectRoot: string,\n protected options: ManifestMiddlewareOptions\n ) {\n super(\n projectRoot,\n /**\n * Only support `/`, `/manifest`, `/index.exp` for the manifest middleware.\n */\n ['/', '/manifest', '/index.exp']\n );\n this.initialProjectConfig = getConfig(projectRoot);\n this.platformBundlers = getPlatformBundlers(projectRoot, this.initialProjectConfig.exp);\n }\n\n /** Exposed for testing. */\n public async _resolveProjectSettingsAsync({\n platform,\n hostname,\n protocol,\n }: Pick<\n TManifestRequestInfo,\n 'hostname' | 'platform' | 'protocol'\n >): Promise<ResponseProjectSettings> {\n // Read the config\n const projectConfig = getConfig(this.projectRoot);\n\n // Read from headers\n const mainModuleName = this.resolveMainModuleName({\n pkg: projectConfig.pkg,\n platform,\n });\n\n const isHermesEnabled = isEnableHermesManaged(projectConfig.exp, platform);\n\n // Create the manifest and set fields within it\n const expoGoConfig = this.getExpoGoConfig({\n mainModuleName,\n hostname,\n });\n\n const hostUri = this.options.constructUrl({ scheme: '', hostname });\n\n const bundleUrl = this._getBundleUrl({\n platform,\n mainModuleName,\n hostname,\n engine: isHermesEnabled ? 'hermes' : undefined,\n baseUrl: getBaseUrlFromExpoConfig(projectConfig.exp),\n asyncRoutes: getAsyncRoutesFromExpoConfig(\n projectConfig.exp,\n this.options.mode ?? 'development',\n platform\n ),\n routerRoot: getRouterDirectoryModuleIdWithManifest(this.projectRoot, projectConfig.exp),\n protocol,\n reactCompiler: !!projectConfig.exp.experiments?.reactCompiler,\n });\n\n // Resolve all assets and set them on the manifest as URLs\n await this.mutateManifestWithAssetsAsync(projectConfig.exp, bundleUrl);\n\n return {\n expoGoConfig,\n hostUri,\n bundleUrl,\n exp: projectConfig.exp,\n };\n }\n\n /** Get the main entry module ID (file) relative to the project root. */\n private resolveMainModuleName(props: { pkg: PackageJSONConfig; platform: string }): string {\n let entryPoint = getEntryWithServerRoot(this.projectRoot, props);\n\n debug(`Resolved entry point: ${entryPoint} (project root: ${this.projectRoot})`);\n\n // NOTE(Bacon): Webpack is currently hardcoded to index.bundle on native\n // in the future (TODO) we should move this logic into a Webpack plugin and use\n // a generated file name like we do on web.\n // const server = getDefaultDevServer();\n // // TODO: Move this into BundlerDevServer and read this info from self.\n // const isNativeWebpack = server instanceof WebpackBundlerDevServer && server.isTargetingNative();\n if (this.options.isNativeWebpack) {\n entryPoint = 'index.js';\n }\n\n return stripExtension(entryPoint, 'js');\n }\n\n /** Parse request headers into options. */\n public abstract getParsedHeaders(req: ServerRequest): TManifestRequestInfo;\n\n /** Store device IDs that were sent in the request headers. */\n private async saveDevicesAsync(req: ServerRequest) {\n const deviceIds = req.headers?.['expo-dev-client-id'];\n if (deviceIds) {\n await ProjectDevices.saveDevicesAsync(this.projectRoot, deviceIds).catch((e) =>\n Log.exception(e)\n );\n }\n }\n\n /** Create the bundle URL (points to the single JS entry file). Exposed for testing. */\n public _getBundleUrl({\n platform,\n mainModuleName,\n hostname,\n engine,\n baseUrl,\n isExporting,\n asyncRoutes,\n routerRoot,\n protocol,\n reactCompiler,\n }: {\n platform: string;\n hostname?: string | null;\n mainModuleName: string;\n engine?: 'hermes';\n baseUrl?: string;\n asyncRoutes: boolean;\n isExporting?: boolean;\n routerRoot: string;\n protocol?: 'http' | 'https';\n reactCompiler: boolean;\n }): string {\n const path = createBundleUrlPath({\n mode: this.options.mode ?? 'development',\n minify: this.options.minify,\n platform,\n mainModuleName,\n lazy: shouldEnableAsyncImports(this.projectRoot),\n engine,\n bytecode: engine === 'hermes',\n baseUrl,\n isExporting: !!isExporting,\n asyncRoutes,\n routerRoot,\n reactCompiler,\n });\n\n return (\n this.options.constructUrl({\n scheme: protocol ?? 'http',\n // hostType: this.options.location.hostType,\n hostname,\n }) + path\n );\n }\n\n /** Log telemetry. */\n protected abstract trackManifest(version?: string): void;\n\n /** Get the manifest response to return to the runtime. This file contains info regarding where the assets can be loaded from. Exposed for testing. */\n public abstract _getManifestResponseAsync(options: TManifestRequestInfo): Promise<{\n body: string;\n version: string;\n headers: ServerHeaders;\n }>;\n\n private getExpoGoConfig({\n mainModuleName,\n hostname,\n }: {\n mainModuleName: string;\n hostname?: string | null;\n }): ExpoGoConfig {\n return {\n // localhost:8081\n debuggerHost: this.options.constructUrl({ scheme: '', hostname }),\n // Required for Expo Go to function.\n developer: {\n tool: DEVELOPER_TOOL,\n projectRoot: this.projectRoot,\n },\n packagerOpts: {\n // Required for dev client.\n dev: this.options.mode !== 'production',\n },\n // Indicates the name of the main bundle.\n mainModuleName,\n // Add this string to make Flipper register React Native / Metro as \"running\".\n // Can be tested by running:\n // `METRO_SERVER_PORT=8081 open -a flipper.app`\n // Where 8081 is the port where the Expo project is being hosted.\n __flipperHack: 'React Native packager is running',\n };\n }\n\n /** Resolve all assets and set them on the manifest as URLs */\n private async mutateManifestWithAssetsAsync(manifest: ExpoConfig, bundleUrl: string) {\n await resolveManifestAssets(this.projectRoot, {\n manifest,\n resolver: async (path) => {\n if (this.options.isNativeWebpack) {\n // When using our custom dev server, just do assets normally\n // without the `assets/` subpath redirect.\n return resolve(bundleUrl!.match(/^https?:\\/\\/.*?\\//)![0], path);\n }\n return bundleUrl!.match(/^https?:\\/\\/.*?\\//)![0] + 'assets/' + path;\n },\n });\n // The server normally inserts this but if we're offline we'll do it here\n await resolveGoogleServicesFile(this.projectRoot, manifest);\n }\n\n public getWebBundleUrl() {\n const platform = 'web';\n // Read from headers\n const mainModuleName = this.resolveMainModuleName({\n pkg: this.initialProjectConfig.pkg,\n platform,\n });\n\n return createBundleUrlPathFromExpoConfig(this.projectRoot, this.initialProjectConfig.exp, {\n platform,\n mainModuleName,\n minify: this.options.minify,\n lazy: shouldEnableAsyncImports(this.projectRoot),\n mode: this.options.mode ?? 'development',\n // Hermes doesn't support more modern JS features than most, if not all, modern browser.\n engine: 'hermes',\n isExporting: false,\n bytecode: false,\n });\n }\n\n /**\n * Web platforms should create an index.html response using the same script resolution as native.\n *\n * Instead of adding a `bundleUrl` to a `manifest.json` (native) we'll add a `<script src=\"\">`\n * to an `index.html`, this enables the web platform to load JavaScript from the server.\n */\n private async handleWebRequestAsync(req: ServerRequest, res: ServerResponse) {\n // Read from headers\n const bundleUrl = this.getWebBundleUrl();\n\n res.setHeader('Content-Type', 'text/html');\n\n res.end(\n await createTemplateHtmlFromExpoConfigAsync(this.projectRoot, {\n exp: this.initialProjectConfig.exp,\n scripts: [bundleUrl],\n })\n );\n }\n\n /** Exposed for testing. */\n async checkBrowserRequestAsync(req: ServerRequest, res: ServerResponse, next: ServerNext) {\n if (\n this.platformBundlers.web === 'metro' &&\n this.initialProjectConfig.exp.platforms?.includes('web')\n ) {\n // NOTE(EvanBacon): This effectively disables the safety check we do on custom runtimes to ensure\n // the `expo-platform` header is included. When `web.bundler=web`, if the user has non-standard Expo\n // code loading then they'll get a web bundle without a clear assertion of platform support.\n const platform = parsePlatformHeader(req);\n // On web, serve the public folder\n if (!platform || platform === 'web') {\n if (['static', 'server'].includes(this.initialProjectConfig.exp.web?.output ?? '')) {\n // Skip the spa-styled index.html when static generation is enabled.\n next();\n return true;\n } else {\n await this.handleWebRequestAsync(req, res);\n return true;\n }\n }\n }\n return false;\n }\n\n async handleRequestAsync(\n req: ServerRequest,\n res: ServerResponse,\n next: ServerNext\n ): Promise<void> {\n // First check for standard JavaScript runtimes (aka legacy browsers like Chrome).\n if (await this.checkBrowserRequestAsync(req, res, next)) {\n return;\n }\n\n // Save device IDs for dev client.\n await this.saveDevicesAsync(req);\n\n // Read from headers\n const options = this.getParsedHeaders(req);\n const { body, version, headers } = await this._getManifestResponseAsync(options);\n for (const [headerName, headerValue] of headers) {\n res.setHeader(headerName, headerValue);\n }\n res.end(body);\n\n // Log analytics\n this.trackManifest(version ?? null);\n }\n}\n"],"names":["getWorkspaceRoot","getEntryWithServerRoot","getMetroServerRoot","resolveMainModuleName","DEVELOPER_TOOL","ManifestMiddleware","debug","require","projectRoot","findWorkspaceRoot","error","message","includes","supportedPlatforms","props","platform","CommandError","path","relative","resolveEntryPoint","env","EXPO_USE_METRO_WORKSPACE_ROOT","entryPoint","stripExtension","ExpoMiddleware","constructor","options","initialProjectConfig","getConfig","platformBundlers","getPlatformBundlers","exp","_resolveProjectSettingsAsync","hostname","protocol","projectConfig","mainModuleName","pkg","isHermesEnabled","isEnableHermesManaged","expoGoConfig","getExpoGoConfig","hostUri","constructUrl","scheme","bundleUrl","_getBundleUrl","engine","undefined","baseUrl","getBaseUrlFromExpoConfig","asyncRoutes","getAsyncRoutesFromExpoConfig","mode","routerRoot","getRouterDirectoryModuleIdWithManifest","reactCompiler","experiments","mutateManifestWithAssetsAsync","isNativeWebpack","saveDevicesAsync","req","deviceIds","headers","ProjectDevices","catch","e","Log","exception","isExporting","createBundleUrlPath","minify","lazy","shouldEnableAsyncImports","bytecode","debuggerHost","developer","tool","packagerOpts","dev","__flipperHack","manifest","resolveManifestAssets","resolver","resolve","match","resolveGoogleServicesFile","getWebBundleUrl","createBundleUrlPathFromExpoConfig","handleWebRequestAsync","res","setHeader","end","createTemplateHtmlFromExpoConfigAsync","scripts","checkBrowserRequestAsync","next","web","platforms","parsePlatformHeader","output","handleRequestAsync","getParsedHeaders","body","version","_getManifestResponseAsync","headerName","headerValue","trackManifest"],"mappings":"AAAA;;;;;;;;;;;IAqCgBA,gBAAgB,MAAhBA,gBAAgB;IAahBC,sBAAsB,MAAtBA,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OAAO,CAAE;YAC/C2B,GAAG,CAACC,SAAS,CAACe,UAAU,EAAEC,WAAW,CAAC,CAAC;QACzC,CAAC;QACDjB,GAAG,CAACE,GAAG,CAACW,IAAI,CAAC,CAAC;QAEd,gBAAgB;QAChB,IAAI,CAACK,aAAa,CAACJ,OAAO,WAAPA,OAAO,GAAI,IAAI,CAAC,CAAC;IACtC;CACD"}
1
+ {"version":3,"sources":["../../../../../src/start/server/middleware/ManifestMiddleware.ts"],"sourcesContent":["import {\n ExpoConfig,\n ExpoGoConfig,\n getConfig,\n PackageJSONConfig,\n ProjectConfig,\n} from '@expo/config';\nimport { resolveEntryPoint } from '@expo/config/paths';\nimport findWorkspaceRoot from 'find-yarn-workspace-root';\nimport path from 'path';\nimport { resolve } from 'url';\n\nimport { ExpoMiddleware } from './ExpoMiddleware';\nimport {\n shouldEnableAsyncImports,\n createBundleUrlPath,\n getBaseUrlFromExpoConfig,\n getAsyncRoutesFromExpoConfig,\n createBundleUrlPathFromExpoConfig,\n} from './metroOptions';\nimport { resolveGoogleServicesFile, resolveManifestAssets } from './resolveAssets';\nimport { parsePlatformHeader, RuntimePlatform } from './resolvePlatform';\nimport { ServerHeaders, ServerNext, ServerRequest, ServerResponse } from './server.types';\nimport { isEnableHermesManaged } from '../../../export/exportHermes';\nimport * as Log from '../../../log';\nimport { env } from '../../../utils/env';\nimport { CommandError } from '../../../utils/errors';\nimport { stripExtension } from '../../../utils/url';\nimport * as ProjectDevices from '../../project/devices';\nimport { UrlCreator } from '../UrlCreator';\nimport { getRouterDirectoryModuleIdWithManifest } from '../metro/router';\nimport { getPlatformBundlers, PlatformBundlers } from '../platformBundlers';\nimport { createTemplateHtmlFromExpoConfigAsync } from '../webTemplate';\n\nconst debug = require('debug')('expo:start:server:middleware:manifest') as typeof console.log;\n\n/** Wraps `findWorkspaceRoot` and guards against having an empty `package.json` file in an upper directory. */\nexport function getWorkspaceRoot(projectRoot: string): string | null {\n try {\n return findWorkspaceRoot(projectRoot);\n } catch (error: any) {\n if (error.message.includes('Unexpected end of JSON input')) {\n return null;\n }\n throw error;\n }\n}\n\nconst supportedPlatforms = ['ios', 'android', 'web', 'none'];\n\nexport function getEntryWithServerRoot(\n projectRoot: string,\n props: { platform: string; pkg?: PackageJSONConfig }\n) {\n if (!supportedPlatforms.includes(props.platform)) {\n throw new CommandError(\n `Failed to resolve the project's entry file: The platform \"${props.platform}\" is not supported.`\n );\n }\n return path.relative(getMetroServerRoot(projectRoot), resolveEntryPoint(projectRoot, props));\n}\n\nexport function getMetroServerRoot(projectRoot: string) {\n if (env.EXPO_USE_METRO_WORKSPACE_ROOT) {\n return getWorkspaceRoot(projectRoot) ?? projectRoot;\n }\n\n return projectRoot;\n}\n\n/** Get the main entry module ID (file) relative to the project root. */\nexport function resolveMainModuleName(\n projectRoot: string,\n props: { platform: string; pkg?: PackageJSONConfig }\n): string {\n const entryPoint = getEntryWithServerRoot(projectRoot, props);\n\n debug(`Resolved entry point: ${entryPoint} (project root: ${projectRoot})`);\n\n return stripExtension(entryPoint, 'js');\n}\n\n/** Info about the computer hosting the dev server. */\nexport interface HostInfo {\n host: string;\n server: 'expo';\n serverVersion: string;\n serverDriver: string | null;\n serverOS: NodeJS.Platform;\n serverOSVersion: string;\n}\n\n/** Parsed values from the supported request headers. */\nexport interface ManifestRequestInfo {\n /** Platform to serve. */\n platform: RuntimePlatform;\n /** Requested host name. */\n hostname?: string | null;\n /** The protocol used to request the manifest */\n protocol?: 'http' | 'https';\n}\n\n/** Project related info. */\nexport type ResponseProjectSettings = {\n expoGoConfig: ExpoGoConfig;\n hostUri: string;\n bundleUrl: string;\n exp: ExpoConfig;\n};\n\nexport const DEVELOPER_TOOL = 'expo-cli';\n\nexport type ManifestMiddlewareOptions = {\n /** Should start the dev servers in development mode (minify). */\n mode?: 'development' | 'production';\n /** Should instruct the bundler to create minified bundles. */\n minify?: boolean;\n constructUrl: UrlCreator['constructUrl'];\n isNativeWebpack?: boolean;\n privateKeyPath?: string;\n};\n\n/** Base middleware creator for serving the Expo manifest (like the index.html but for native runtimes). */\nexport abstract class ManifestMiddleware<\n TManifestRequestInfo extends ManifestRequestInfo,\n> extends ExpoMiddleware {\n private initialProjectConfig: ProjectConfig;\n private platformBundlers: PlatformBundlers;\n\n constructor(\n protected projectRoot: string,\n protected options: ManifestMiddlewareOptions\n ) {\n super(\n projectRoot,\n /**\n * Only support `/`, `/manifest`, `/index.exp` for the manifest middleware.\n */\n ['/', '/manifest', '/index.exp']\n );\n this.initialProjectConfig = getConfig(projectRoot);\n this.platformBundlers = getPlatformBundlers(projectRoot, this.initialProjectConfig.exp);\n }\n\n /** Exposed for testing. */\n public async _resolveProjectSettingsAsync({\n platform,\n hostname,\n protocol,\n }: Pick<\n TManifestRequestInfo,\n 'hostname' | 'platform' | 'protocol'\n >): Promise<ResponseProjectSettings> {\n // Read the config\n const projectConfig = getConfig(this.projectRoot);\n\n // Read from headers\n const mainModuleName = this.resolveMainModuleName({\n pkg: projectConfig.pkg,\n platform,\n });\n\n const isHermesEnabled = isEnableHermesManaged(projectConfig.exp, platform);\n\n // Create the manifest and set fields within it\n const expoGoConfig = this.getExpoGoConfig({\n mainModuleName,\n hostname,\n });\n\n const hostUri = this.options.constructUrl({ scheme: '', hostname });\n\n const bundleUrl = this._getBundleUrl({\n platform,\n mainModuleName,\n hostname,\n engine: isHermesEnabled ? 'hermes' : undefined,\n baseUrl: getBaseUrlFromExpoConfig(projectConfig.exp),\n asyncRoutes: getAsyncRoutesFromExpoConfig(\n projectConfig.exp,\n this.options.mode ?? 'development',\n platform\n ),\n routerRoot: getRouterDirectoryModuleIdWithManifest(this.projectRoot, projectConfig.exp),\n protocol,\n });\n\n // Resolve all assets and set them on the manifest as URLs\n await this.mutateManifestWithAssetsAsync(projectConfig.exp, bundleUrl);\n\n return {\n expoGoConfig,\n hostUri,\n bundleUrl,\n exp: projectConfig.exp,\n };\n }\n\n /** Get the main entry module ID (file) relative to the project root. */\n private resolveMainModuleName(props: { pkg: PackageJSONConfig; platform: string }): string {\n let entryPoint = getEntryWithServerRoot(this.projectRoot, props);\n\n debug(`Resolved entry point: ${entryPoint} (project root: ${this.projectRoot})`);\n\n // NOTE(Bacon): Webpack is currently hardcoded to index.bundle on native\n // in the future (TODO) we should move this logic into a Webpack plugin and use\n // a generated file name like we do on web.\n // const server = getDefaultDevServer();\n // // TODO: Move this into BundlerDevServer and read this info from self.\n // const isNativeWebpack = server instanceof WebpackBundlerDevServer && server.isTargetingNative();\n if (this.options.isNativeWebpack) {\n entryPoint = 'index.js';\n }\n\n return stripExtension(entryPoint, 'js');\n }\n\n /** Parse request headers into options. */\n public abstract getParsedHeaders(req: ServerRequest): TManifestRequestInfo;\n\n /** Store device IDs that were sent in the request headers. */\n private async saveDevicesAsync(req: ServerRequest) {\n const deviceIds = req.headers?.['expo-dev-client-id'];\n if (deviceIds) {\n await ProjectDevices.saveDevicesAsync(this.projectRoot, deviceIds).catch((e) =>\n Log.exception(e)\n );\n }\n }\n\n /** Create the bundle URL (points to the single JS entry file). Exposed for testing. */\n public _getBundleUrl({\n platform,\n mainModuleName,\n hostname,\n engine,\n baseUrl,\n isExporting,\n asyncRoutes,\n routerRoot,\n protocol,\n }: {\n platform: string;\n hostname?: string | null;\n mainModuleName: string;\n engine?: 'hermes';\n baseUrl?: string;\n asyncRoutes: boolean;\n isExporting?: boolean;\n routerRoot: string;\n protocol?: 'http' | 'https';\n }): string {\n const path = createBundleUrlPath({\n mode: this.options.mode ?? 'development',\n minify: this.options.minify,\n platform,\n mainModuleName,\n lazy: shouldEnableAsyncImports(this.projectRoot),\n engine,\n bytecode: engine === 'hermes',\n baseUrl,\n isExporting: !!isExporting,\n asyncRoutes,\n routerRoot,\n });\n\n return (\n this.options.constructUrl({\n scheme: protocol ?? 'http',\n // hostType: this.options.location.hostType,\n hostname,\n }) + path\n );\n }\n\n /** Log telemetry. */\n protected abstract trackManifest(version?: string): void;\n\n /** Get the manifest response to return to the runtime. This file contains info regarding where the assets can be loaded from. Exposed for testing. */\n public abstract _getManifestResponseAsync(options: TManifestRequestInfo): Promise<{\n body: string;\n version: string;\n headers: ServerHeaders;\n }>;\n\n private getExpoGoConfig({\n mainModuleName,\n hostname,\n }: {\n mainModuleName: string;\n hostname?: string | null;\n }): ExpoGoConfig {\n return {\n // localhost:8081\n debuggerHost: this.options.constructUrl({ scheme: '', hostname }),\n // Required for Expo Go to function.\n developer: {\n tool: DEVELOPER_TOOL,\n projectRoot: this.projectRoot,\n },\n packagerOpts: {\n // Required for dev client.\n dev: this.options.mode !== 'production',\n },\n // Indicates the name of the main bundle.\n mainModuleName,\n // Add this string to make Flipper register React Native / Metro as \"running\".\n // Can be tested by running:\n // `METRO_SERVER_PORT=8081 open -a flipper.app`\n // Where 8081 is the port where the Expo project is being hosted.\n __flipperHack: 'React Native packager is running',\n };\n }\n\n /** Resolve all assets and set them on the manifest as URLs */\n private async mutateManifestWithAssetsAsync(manifest: ExpoConfig, bundleUrl: string) {\n await resolveManifestAssets(this.projectRoot, {\n manifest,\n resolver: async (path) => {\n if (this.options.isNativeWebpack) {\n // When using our custom dev server, just do assets normally\n // without the `assets/` subpath redirect.\n return resolve(bundleUrl!.match(/^https?:\\/\\/.*?\\//)![0], path);\n }\n return bundleUrl!.match(/^https?:\\/\\/.*?\\//)![0] + 'assets/' + path;\n },\n });\n // The server normally inserts this but if we're offline we'll do it here\n await resolveGoogleServicesFile(this.projectRoot, manifest);\n }\n\n public getWebBundleUrl() {\n const platform = 'web';\n // Read from headers\n const mainModuleName = this.resolveMainModuleName({\n pkg: this.initialProjectConfig.pkg,\n platform,\n });\n\n return createBundleUrlPathFromExpoConfig(this.projectRoot, this.initialProjectConfig.exp, {\n platform,\n mainModuleName,\n minify: this.options.minify,\n lazy: shouldEnableAsyncImports(this.projectRoot),\n mode: this.options.mode ?? 'development',\n // Hermes doesn't support more modern JS features than most, if not all, modern browser.\n engine: 'hermes',\n isExporting: false,\n bytecode: false,\n });\n }\n\n /**\n * Web platforms should create an index.html response using the same script resolution as native.\n *\n * Instead of adding a `bundleUrl` to a `manifest.json` (native) we'll add a `<script src=\"\">`\n * to an `index.html`, this enables the web platform to load JavaScript from the server.\n */\n private async handleWebRequestAsync(req: ServerRequest, res: ServerResponse) {\n // Read from headers\n const bundleUrl = this.getWebBundleUrl();\n\n res.setHeader('Content-Type', 'text/html');\n\n res.end(\n await createTemplateHtmlFromExpoConfigAsync(this.projectRoot, {\n exp: this.initialProjectConfig.exp,\n scripts: [bundleUrl],\n })\n );\n }\n\n /** Exposed for testing. */\n async checkBrowserRequestAsync(req: ServerRequest, res: ServerResponse, next: ServerNext) {\n if (\n this.platformBundlers.web === 'metro' &&\n this.initialProjectConfig.exp.platforms?.includes('web')\n ) {\n // NOTE(EvanBacon): This effectively disables the safety check we do on custom runtimes to ensure\n // the `expo-platform` header is included. When `web.bundler=web`, if the user has non-standard Expo\n // code loading then they'll get a web bundle without a clear assertion of platform support.\n const platform = parsePlatformHeader(req);\n // On web, serve the public folder\n if (!platform || platform === 'web') {\n if (['static', 'server'].includes(this.initialProjectConfig.exp.web?.output ?? '')) {\n // Skip the spa-styled index.html when static generation is enabled.\n next();\n return true;\n } else {\n await this.handleWebRequestAsync(req, res);\n return true;\n }\n }\n }\n return false;\n }\n\n async handleRequestAsync(\n req: ServerRequest,\n res: ServerResponse,\n next: ServerNext\n ): Promise<void> {\n // First check for standard JavaScript runtimes (aka legacy browsers like Chrome).\n if (await this.checkBrowserRequestAsync(req, res, next)) {\n return;\n }\n\n // Save device IDs for dev client.\n await this.saveDevicesAsync(req);\n\n // Read from headers\n const options = this.getParsedHeaders(req);\n const { body, version, headers } = await this._getManifestResponseAsync(options);\n for (const [headerName, headerValue] of headers) {\n res.setHeader(headerName, headerValue);\n }\n res.end(body);\n\n // Log analytics\n this.trackManifest(version ?? null);\n }\n}\n"],"names":["getWorkspaceRoot","getEntryWithServerRoot","getMetroServerRoot","resolveMainModuleName","DEVELOPER_TOOL","ManifestMiddleware","debug","require","projectRoot","findWorkspaceRoot","error","message","includes","supportedPlatforms","props","platform","CommandError","path","relative","resolveEntryPoint","env","EXPO_USE_METRO_WORKSPACE_ROOT","entryPoint","stripExtension","ExpoMiddleware","constructor","options","initialProjectConfig","getConfig","platformBundlers","getPlatformBundlers","exp","_resolveProjectSettingsAsync","hostname","protocol","projectConfig","mainModuleName","pkg","isHermesEnabled","isEnableHermesManaged","expoGoConfig","getExpoGoConfig","hostUri","constructUrl","scheme","bundleUrl","_getBundleUrl","engine","undefined","baseUrl","getBaseUrlFromExpoConfig","asyncRoutes","getAsyncRoutesFromExpoConfig","mode","routerRoot","getRouterDirectoryModuleIdWithManifest","mutateManifestWithAssetsAsync","isNativeWebpack","saveDevicesAsync","req","deviceIds","headers","ProjectDevices","catch","e","Log","exception","isExporting","createBundleUrlPath","minify","lazy","shouldEnableAsyncImports","bytecode","debuggerHost","developer","tool","packagerOpts","dev","__flipperHack","manifest","resolveManifestAssets","resolver","resolve","match","resolveGoogleServicesFile","getWebBundleUrl","createBundleUrlPathFromExpoConfig","handleWebRequestAsync","res","setHeader","end","createTemplateHtmlFromExpoConfigAsync","scripts","checkBrowserRequestAsync","next","web","platforms","parsePlatformHeader","output","handleRequestAsync","getParsedHeaders","body","version","_getManifestResponseAsync","headerName","headerValue","trackManifest"],"mappings":"AAAA;;;;;;;;;;;IAqCgBA,gBAAgB,MAAhBA,gBAAgB;IAahBC,sBAAsB,MAAtBA,sBAAsB;IAYtBC,kBAAkB,MAAlBA,kBAAkB;IASlBC,qBAAqB,MAArBA,qBAAqB;IAuCxBC,cAAc,MAAdA,cAAc;IAaLC,kBAAkB,MAAlBA,kBAAkB;;;yBArHjC,cAAc;;;;;;;yBACa,oBAAoB;;;;;;;8DACxB,0BAA0B;;;;;;;8DACvC,MAAM;;;;;;;yBACC,KAAK;;;;;;gCAEE,kBAAkB;8BAO1C,gBAAgB;+BAC0C,iBAAiB;iCAC7B,mBAAmB;8BAElC,8BAA8B;2DAC/C,cAAc;qBACf,oBAAoB;wBACX,uBAAuB;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G,CAAC,CAAC;oBAC3C,OAAO,IAAI,CAAC;gBACd,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAC;IACf;UAEMW,kBAAkB,CACtBxC,GAAkB,EAClB6B,GAAmB,EACnBM,IAAgB,EACD;QACf,kFAAkF;QAClF,IAAI,MAAM,IAAI,CAACD,wBAAwB,CAAClC,GAAG,EAAE6B,GAAG,EAAEM,IAAI,CAAC,EAAE;YACvD,OAAO;QACT,CAAC;QAED,kCAAkC;QAClC,MAAM,IAAI,CAACpC,gBAAgB,CAACC,GAAG,CAAC,CAAC;QAEjC,oBAAoB;QACpB,MAAMjC,OAAO,GAAG,IAAI,CAAC0E,gBAAgB,CAACzC,GAAG,CAAC,AAAC;QAC3C,MAAM,EAAE0C,IAAI,CAAA,EAAEC,OAAO,CAAA,EAAEzC,OAAO,CAAA,EAAE,GAAG,MAAM,IAAI,CAAC0C,yBAAyB,CAAC7E,OAAO,CAAC,AAAC;QACjF,KAAK,MAAM,CAAC8E,UAAU,EAAEC,WAAW,CAAC,IAAI5C,OAAO,CAAE;YAC/C2B,GAAG,CAACC,SAAS,CAACe,UAAU,EAAEC,WAAW,CAAC,CAAC;QACzC,CAAC;QACDjB,GAAG,CAACE,GAAG,CAACW,IAAI,CAAC,CAAC;QAEd,gBAAgB;QAChB,IAAI,CAACK,aAAa,CAACJ,OAAO,WAAPA,OAAO,GAAI,IAAI,CAAC,CAAC;IACtC;CACD"}
@@ -91,17 +91,15 @@ function getAsyncRoutesFromExpoConfig(exp, mode, platform) {
91
91
  ].includes(asyncRoutesSetting);
92
92
  }
93
93
  function getMetroDirectBundleOptionsForExpoConfig(projectRoot, exp, options) {
94
- var ref;
95
94
  return getMetroDirectBundleOptions({
96
95
  ...options,
97
- reactCompiler: !!((ref = exp.experiments) == null ? void 0 : ref.reactCompiler),
98
96
  baseUrl: getBaseUrlFromExpoConfig(exp),
99
97
  routerRoot: (0, _router.getRouterDirectoryModuleIdWithManifest)(projectRoot, exp),
100
98
  asyncRoutes: getAsyncRoutesFromExpoConfig(exp, options.mode, options.platform)
101
99
  });
102
100
  }
103
101
  function getMetroDirectBundleOptions(options) {
104
- const { mainModuleName , platform , mode , minify , environment , serializerOutput , serializerIncludeMaps , bytecode , lazy , engine , preserveEnvVars , asyncRoutes , baseUrl , routerRoot , isExporting , inlineSourceMap , splitChunks , reactCompiler , } = withDefaults(options);
102
+ const { mainModuleName , platform , mode , minify , environment , serializerOutput , serializerIncludeMaps , bytecode , lazy , engine , preserveEnvVars , asyncRoutes , baseUrl , routerRoot , isExporting , inlineSourceMap , splitChunks , } = withDefaults(options);
105
103
  const dev = mode !== "production";
106
104
  const isHermes = engine === "hermes";
107
105
  if (isExporting) {
@@ -133,8 +131,7 @@ function getMetroDirectBundleOptions(options) {
133
131
  environment,
134
132
  baseUrl,
135
133
  routerRoot,
136
- bytecode,
137
- reactCompiler
134
+ bytecode
138
135
  },
139
136
  customResolverOptions: {
140
137
  __proto__: null,
@@ -151,16 +148,14 @@ function getMetroDirectBundleOptions(options) {
151
148
  return bundleOptions;
152
149
  }
153
150
  function createBundleUrlPathFromExpoConfig(projectRoot, exp, options) {
154
- var ref;
155
151
  return createBundleUrlPath({
156
152
  ...options,
157
- reactCompiler: !!((ref = exp.experiments) == null ? void 0 : ref.reactCompiler),
158
153
  baseUrl: getBaseUrlFromExpoConfig(exp),
159
154
  routerRoot: (0, _router.getRouterDirectoryModuleIdWithManifest)(projectRoot, exp)
160
155
  });
161
156
  }
162
157
  function createBundleUrlPath(options) {
163
- const { platform , mainModuleName , mode , minify , environment , serializerOutput , serializerIncludeMaps , lazy , bytecode , engine , preserveEnvVars , asyncRoutes , baseUrl , routerRoot , reactCompiler , inlineSourceMap , isExporting , splitChunks , } = withDefaults(options);
158
+ const { platform , mainModuleName , mode , minify , environment , serializerOutput , serializerIncludeMaps , lazy , bytecode , engine , preserveEnvVars , asyncRoutes , baseUrl , routerRoot , inlineSourceMap , isExporting , splitChunks , } = withDefaults(options);
164
159
  const dev = String(mode !== "production");
165
160
  const queryParams = new URLSearchParams({
166
161
  platform: encodeURIComponent(platform),
@@ -199,9 +194,6 @@ function createBundleUrlPath(options) {
199
194
  if (routerRoot != null) {
200
195
  queryParams.append("transform.routerRoot", routerRoot);
201
196
  }
202
- if (reactCompiler) {
203
- queryParams.append("transform.reactCompiler", String(reactCompiler));
204
- }
205
197
  if (environment) {
206
198
  queryParams.append("resolver.environment", environment);
207
199
  queryParams.append("transform.environment", environment);
@@ -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 { 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 inlineSourceMap?: boolean;\n splitChunks?: boolean;\n};\n\nexport type SerializerOptions = {\n includeSourceMaps?: boolean;\n output?: 'static';\n splitChunks?: boolean;\n};\n\nexport type ExpoMetroBundleOptions = MetroBundleOptions & {\n serializerOptions?: SerializerOptions;\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') != null;\n}\n\nexport function isServerEnvironment(environment?: any): boolean {\n return environment === 'node' || environment === 'react-server';\n}\n\nfunction withDefaults({\n mode = 'development',\n minify = mode === 'production',\n preserveEnvVars = env.EXPO_NO_CLIENT_ENV_VARS,\n lazy,\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 return {\n mode,\n minify,\n preserveEnvVars,\n lazy: !props.isExporting && lazy,\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 reactCompiler,\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 bundleOptions: Partial<ExpoMetroBundleOptions> = {\n platform,\n entryFile: mainModuleName,\n dev,\n minify: minify ?? !dev,\n inlineSourceMap: inlineSourceMap ?? false,\n lazy,\n unstable_transformProfile: isHermes ? 'hermes-stable' : 'default',\n customTransformOptions: {\n __proto__: null,\n engine,\n preserveEnvVars,\n asyncRoutes,\n environment,\n baseUrl,\n routerRoot,\n bytecode,\n reactCompiler,\n },\n customResolverOptions: {\n __proto__: null,\n environment,\n },\n sourceMapUrl: fakeSourceMapUrl,\n sourceUrl: fakeSourceUrl,\n serializerOptions: {\n splitChunks,\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 {\n platform,\n mainModuleName,\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 splitChunks,\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', String(bytecode));\n }\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 (routerRoot != null) {\n queryParams.append('transform.routerRoot', routerRoot);\n }\n if (reactCompiler) {\n queryParams.append('transform.reactCompiler', String(reactCompiler));\n }\n\n if (environment) {\n queryParams.append('resolver.environment', environment);\n queryParams.append('transform.environment', environment);\n }\n\n if (splitChunks) {\n queryParams.append('serializer.splitChunks', String(splitChunks));\n }\n if (serializerOutput) {\n queryParams.append('serializer.output', serializerOutput);\n }\n if (serializerIncludeMaps) {\n queryParams.append('serializer.map', String(serializerIncludeMaps));\n }\n\n return `/${encodeURI(mainModuleName)}.bundle?${queryParams.toString()}`;\n}\n"],"names":["shouldEnableAsyncImports","isServerEnvironment","getBaseUrlFromExpoConfig","getAsyncRoutesFromExpoConfig","getMetroDirectBundleOptionsForExpoConfig","getMetroDirectBundleOptions","createBundleUrlPathFromExpoConfig","createBundleUrlPath","debug","require","projectRoot","env","EXPO_NO_METRO_LAZY","resolveFrom","silent","environment","withDefaults","mode","minify","preserveEnvVars","EXPO_NO_CLIENT_ENV_VARS","lazy","props","bytecode","platform","CommandError","engine","isExporting","exp","experiments","baseUrl","trim","replace","asyncRoutesSetting","extra","router","asyncRoutes","includes","default","options","reactCompiler","routerRoot","getRouterDirectoryModuleIdWithManifest","mainModuleName","serializerOutput","serializerIncludeMaps","inlineSourceMap","splitChunks","dev","isHermes","fakeSourceUrl","fakeSourceMapUrl","URL","toString","bundleOptions","entryFile","unstable_transformProfile","customTransformOptions","__proto__","customResolverOptions","sourceMapUrl","sourceUrl","serializerOptions","output","includeSourceMaps","String","queryParams","URLSearchParams","encodeURIComponent","hot","append","encodeURI"],"mappings":"AAAA;;;;;;;;;;;IA8CgBA,wBAAwB,MAAxBA,wBAAwB;IAYxBC,mBAAmB,MAAnBA,mBAAmB;IA6BnBC,wBAAwB,MAAxBA,wBAAwB;IAIxBC,4BAA4B,MAA5BA,4BAA4B;IAe5BC,wCAAwC,MAAxCA,wCAAwC;IAcxCC,2BAA2B,MAA3BA,2BAA2B;IAiF3BC,iCAAiC,MAAjCA,iCAAiC;IAajCC,mBAAmB,MAAnBA,mBAAmB;;;8DApNX,cAAc;;;;;;qBAElB,oBAAoB;wBACX,uBAAuB;wBACG,iBAAiB;;;;;;AAExE,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,oBAAoB,CAAC,AAAsB,AAAC;AAsCpE,SAAST,wBAAwB,CAACU,WAAmB,EAAW;IACrE,IAAIC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AE;QACzBqB,WAAW,CAACI,MAAM,CAAC,gBAAgB,EAAEL,MAAM,CAACpB,qBAAqB,CAAC,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,CAAC,CAAC,EAAE0B,SAAS,CAAC5B,cAAc,CAAC,CAAC,QAAQ,EAAEuB,WAAW,CAACb,QAAQ,EAAE,CAAC,CAAC,CAAC;AAC1E,CAAC"}
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 { 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 baseUrl?: string;\n isExporting: boolean;\n inlineSourceMap?: boolean;\n splitChunks?: boolean;\n};\n\nexport type SerializerOptions = {\n includeSourceMaps?: boolean;\n output?: 'static';\n splitChunks?: boolean;\n};\n\nexport type ExpoMetroBundleOptions = MetroBundleOptions & {\n serializerOptions?: SerializerOptions;\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') != null;\n}\n\nexport function isServerEnvironment(environment?: any): boolean {\n return environment === 'node' || environment === 'react-server';\n}\n\nfunction withDefaults({\n mode = 'development',\n minify = mode === 'production',\n preserveEnvVars = env.EXPO_NO_CLIENT_ENV_VARS,\n lazy,\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 return {\n mode,\n minify,\n preserveEnvVars,\n lazy: !props.isExporting && lazy,\n ...props,\n };\n}\n\nexport function getBaseUrlFromExpoConfig(exp: ExpoConfig) {\n return exp.experiments?.baseUrl?.trim().replace(/\\/+$/, '') ?? '';\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' | 'routerRoot' | 'asyncRoutes'>\n): Partial<ExpoMetroBundleOptions> {\n return getMetroDirectBundleOptions({\n ...options,\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 } = 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 bundleOptions: Partial<ExpoMetroBundleOptions> = {\n platform,\n entryFile: mainModuleName,\n dev,\n minify: minify ?? !dev,\n inlineSourceMap: inlineSourceMap ?? false,\n lazy,\n unstable_transformProfile: isHermes ? 'hermes-stable' : 'default',\n customTransformOptions: {\n __proto__: null,\n engine,\n preserveEnvVars,\n asyncRoutes,\n environment,\n baseUrl,\n routerRoot,\n bytecode,\n },\n customResolverOptions: {\n __proto__: null,\n environment,\n },\n sourceMapUrl: fakeSourceMapUrl,\n sourceUrl: fakeSourceUrl,\n serializerOptions: {\n splitChunks,\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, 'baseUrl' | 'routerRoot'>\n): string {\n return createBundleUrlPath({\n ...options,\n baseUrl: getBaseUrlFromExpoConfig(exp),\n routerRoot: getRouterDirectoryModuleIdWithManifest(projectRoot, exp),\n });\n}\n\nexport function createBundleUrlPath(options: ExpoMetroOptions): string {\n const {\n platform,\n mainModuleName,\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 inlineSourceMap,\n isExporting,\n splitChunks,\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', String(bytecode));\n }\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 (routerRoot != null) {\n queryParams.append('transform.routerRoot', routerRoot);\n }\n\n if (environment) {\n queryParams.append('resolver.environment', environment);\n queryParams.append('transform.environment', environment);\n }\n\n if (splitChunks) {\n queryParams.append('serializer.splitChunks', String(splitChunks));\n }\n if (serializerOutput) {\n queryParams.append('serializer.output', serializerOutput);\n }\n if (serializerIncludeMaps) {\n queryParams.append('serializer.map', String(serializerIncludeMaps));\n }\n\n return `/${encodeURI(mainModuleName)}.bundle?${queryParams.toString()}`;\n}\n"],"names":["shouldEnableAsyncImports","isServerEnvironment","getBaseUrlFromExpoConfig","getAsyncRoutesFromExpoConfig","getMetroDirectBundleOptionsForExpoConfig","getMetroDirectBundleOptions","createBundleUrlPathFromExpoConfig","createBundleUrlPath","debug","require","projectRoot","env","EXPO_NO_METRO_LAZY","resolveFrom","silent","environment","withDefaults","mode","minify","preserveEnvVars","EXPO_NO_CLIENT_ENV_VARS","lazy","props","bytecode","platform","CommandError","engine","isExporting","exp","experiments","baseUrl","trim","replace","asyncRoutesSetting","extra","router","asyncRoutes","includes","default","options","routerRoot","getRouterDirectoryModuleIdWithManifest","mainModuleName","serializerOutput","serializerIncludeMaps","inlineSourceMap","splitChunks","dev","isHermes","fakeSourceUrl","fakeSourceMapUrl","URL","toString","bundleOptions","entryFile","unstable_transformProfile","customTransformOptions","__proto__","customResolverOptions","sourceMapUrl","sourceUrl","serializerOptions","output","includeSourceMaps","String","queryParams","URLSearchParams","encodeURIComponent","hot","append","encodeURI"],"mappings":"AAAA;;;;;;;;;;;IA4CgBA,wBAAwB,MAAxBA,wBAAwB;IAYxBC,mBAAmB,MAAnBA,mBAAmB;IA6BnBC,wBAAwB,MAAxBA,wBAAwB;IAGxBC,4BAA4B,MAA5BA,4BAA4B;IAe5BC,wCAAwC,MAAxCA,wCAAwC;IAaxCC,2BAA2B,MAA3BA,2BAA2B;IA+E3BC,iCAAiC,MAAjCA,iCAAiC;IAYjCC,mBAAmB,MAAnBA,mBAAmB;;;8DA7MX,cAAc;;;;;;qBAElB,oBAAoB;wBACX,uBAAuB;wBACG,iBAAiB;;;;;;AAExE,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,oBAAoB,CAAC,AAAsB,AAAC;AAoCpE,SAAST,wBAAwB,CAACU,WAAmB,EAAW;IACrE,IAAIC,IAAG,IAAA,CAACC,kBAAkB,EAAE;QAC1B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,oFAAoF;IACpF,mFAAmF;IACnF,0EAA0E;IAC1E,mEAAmE;IACnE,OAAOC,YAAW,EAAA,QAAA,CAACC,MAAM,CAACJ,WAAW,EAAE,qBAAqB,CAAC,IAAI,IAAI,CAAC;AACxE,CAAC;AAEM,SAAST,mBAAmB,CAACc,WAAiB,EAAW;IAC9D,OAA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sB,EAAE7B,UAAU,CAAC,CAAC;IACzD,CAAC;IAED,IAAIzB,WAAW,EAAE;QACfkD,WAAW,CAACI,MAAM,CAAC,sBAAsB,EAAEtD,WAAW,CAAC,CAAC;QACxDkD,WAAW,CAACI,MAAM,CAAC,uBAAuB,EAAEtD,WAAW,CAAC,CAAC;IAC3D,CAAC;IAED,IAAI+B,WAAW,EAAE;QACfmB,WAAW,CAACI,MAAM,CAAC,wBAAwB,EAAEL,MAAM,CAAClB,WAAW,CAAC,CAAC,CAAC;IACpE,CAAC;IACD,IAAIH,gBAAgB,EAAE;QACpBsB,WAAW,CAACI,MAAM,CAAC,mBAAmB,EAAE1B,gBAAgB,CAAC,CAAC;IAC5D,CAAC;IACD,IAAIC,qBAAqB,EAAE;QACzBqB,WAAW,CAACI,MAAM,CAAC,gBAAgB,EAAEL,MAAM,CAACpB,qBAAqB,CAAC,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,CAAC,CAAC,EAAE0B,SAAS,CAAC5B,cAAc,CAAC,CAAC,QAAQ,EAAEuB,WAAW,CAACb,QAAQ,EAAE,CAAC,CAAC,CAAC;AAC1E,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/start/server/middleware/resolveAssets.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config';\nimport fs from 'fs/promises';\nimport path from 'path';\n\nimport { getAssetSchemasAsync } from '../../../api/getExpoSchema';\nimport { BundleAssetWithFileHashes } from '../../../export/saveAssets';\nimport * as Log from '../../../log';\nimport { fileExistsAsync } from '../../../utils/dir';\nimport { CommandError } from '../../../utils/errors';\nimport { get, set } from '../../../utils/obj';\nimport { validateUrl } from '../../../utils/url';\n\ntype ManifestAsset = { fileHashes: string[]; files: string[]; hash: string };\n\nexport type Asset = ManifestAsset | BundleAssetWithFileHashes;\n\ntype ManifestResolutionError = Error & {\n localAssetPath?: string;\n manifestField?: string;\n};\n\n/** Inline the contents of each platform's `googleServicesFile` so runtimes can access them. */\nexport async function resolveGoogleServicesFile(\n projectRoot: string,\n manifest: Partial<Pick<ExpoConfig, 'android' | 'ios'>>\n) {\n if (manifest.android?.googleServicesFile) {\n try {\n const contents = await fs.readFile(\n path.resolve(projectRoot, manifest.android.googleServicesFile),\n 'utf8'\n );\n manifest.android.googleServicesFile = contents;\n } catch {\n Log.warn(\n `Could not parse Expo config: android.googleServicesFile: \"${manifest.android.googleServicesFile}\"`\n );\n // Delete the field so Expo Go doesn't attempt to read it.\n delete manifest.android.googleServicesFile;\n }\n }\n if (manifest.ios?.googleServicesFile) {\n try {\n const contents = await fs.readFile(\n path.resolve(projectRoot, manifest.ios.googleServicesFile),\n 'base64'\n );\n manifest.ios.googleServicesFile = contents;\n } catch {\n Log.warn(\n `Could not parse Expo config: ios.googleServicesFile: \"${manifest.ios.googleServicesFile}\"`\n );\n // Delete the field so Expo Go doesn't attempt to read it.\n delete manifest.ios.googleServicesFile;\n }\n }\n return manifest;\n}\n\n/**\n * Get all fields in the manifest that match assets, then filter the ones that aren't set.\n *\n * @param manifest\n * @returns Asset fields that the user has set like [\"icon\", \"splash.image\", ...]\n */\nexport async function getAssetFieldPathsForManifestAsync(manifest: ExpoConfig): Promise<string[]> {\n // String array like [\"icon\", \"notification.icon\", \"loading.icon\", \"loading.backgroundImage\", \"ios.icon\", ...]\n const sdkAssetFieldPaths = await getAssetSchemasAsync(manifest.sdkVersion);\n return sdkAssetFieldPaths.filter((assetSchema) => get(manifest, assetSchema));\n}\n\n/** Resolve all assets in the app.json inline. */\nexport async function resolveManifestAssets(\n projectRoot: string,\n {\n manifest,\n resolver,\n strict,\n }: {\n manifest: ExpoConfig;\n resolver: (assetPath: string) => Promise<string>;\n strict?: boolean;\n }\n) {\n try {\n // Asset fields that the user has set like [\"icon\", \"splash.image\"]\n const assetSchemas = await getAssetFieldPathsForManifestAsync(manifest);\n // Get the URLs\n const urls = await Promise.all(\n assetSchemas.map(async (manifestField) => {\n const pathOrURL = get(manifest, manifestField);\n // URL\n if (validateUrl(pathOrURL, { requireProtocol: true })) {\n return pathOrURL;\n }\n\n // File path\n if (await fileExistsAsync(path.resolve(projectRoot, pathOrURL))) {\n return await resolver(pathOrURL);\n }\n\n // Unknown\n const err: ManifestResolutionError = new CommandError(\n 'MANIFEST_ASSET',\n 'Could not resolve local asset: ' + pathOrURL\n );\n err.localAssetPath = pathOrURL;\n err.manifestField = manifestField;\n throw err;\n })\n );\n\n // Set the corresponding URL fields\n assetSchemas.forEach((manifestField, index: number) =>\n set(manifest, `${manifestField}Url`, urls[index])\n );\n } catch (error: any) {\n if (error.localAssetPath) {\n Log.warn(\n `Unable to resolve asset \"${error.localAssetPath}\" from \"${error.manifestField}\" in your app.json or app.config.js`\n );\n } else {\n Log.warn(\n `Warning: Unable to resolve manifest assets. Icons and fonts might not work. ${error.message}.`\n );\n }\n\n if (strict) {\n throw new CommandError(\n 'MANIFEST_ASSET',\n 'Failed to export manifest assets: ' + error.message\n );\n }\n }\n}\n"],"names":["resolveGoogleServicesFile","getAssetFieldPathsForManifestAsync","resolveManifestAssets","projectRoot","manifest","android","googleServicesFile","contents","fs","readFile","path","resolve","Log","warn","ios","sdkAssetFieldPaths","getAssetSchemasAsync","sdkVersion","filter","assetSchema","get","resolver","strict","assetSchemas","urls","Promise","all","map","manifestField","pathOrURL","validateUrl","requireProtocol","fileExistsAsync","err","CommandError","localAssetPath","forEach","index","set","error","message"],"mappings":"AAAA;;;;;;;;;;;IAsBsBA,yBAAyB,MAAzBA,yBAAyB;IA2CzBC,kCAAkC,MAAlCA,kCAAkC;IAOlCC,qBAAqB,MAArBA,qBAAqB;;;8DAvE5B,aAAa;;;;;;;8DACX,MAAM;;;;;;+BAEc,4BAA4B;2DAE5C,cAAc;qBACH,oBAAoB;wBACvB,uBAAuB;qBAC3B,oBAAoB;qBACjB,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYzC,eAAeF,yBAAyB,CAC7CG,WAAmB,EACnBC,QAAsD,EACtD;QACIA,G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ACL,aAAa,GAAGA,aAAa,CAAC;YAClC,MAAMK,GAAG,CAAC;QACZ,CAAC,CAAC,CACH,AAAC;QAEF,mCAAmC;QACnCV,YAAY,CAACa,OAAO,CAAC,CAACR,aAAa,EAAES,KAAa,GAChDC,IAAAA,IAAG,IAAA,EAAClC,QAAQ,EAAE,CAAC,EAAEwB,aAAa,CAAC,GAAG,CAAC,EAAEJ,IAAI,CAACa,KAAK,CAAC,CAAC,CAClD,CAAC;IACJ,EAAE,OAAOE,KAAK,EAAO;QACnB,IAAIA,KAAK,CAACJ,cAAc,EAAE;YACxBvB,IAAG,CAACC,IAAI,CACN,CAAC,yBAAyB,EAAE0B,KAAK,CAACJ,cAAc,CAAC,QAAQ,EAAEI,KAAK,CAACX,aAAa,CAAC,mCAAmC,CAAC,CACpH,CAAC;QACJ,OAAO;YACLhB,IAAG,CAACC,IAAI,CACN,CAAC,4EAA4E,EAAE0B,KAAK,CAACC,OAAO,CAAC,CAAC,CAAC,CAChG,CAAC;QACJ,CAAC;QAED,IAAIlB,MAAM,EAAE;YACV,MAAM,IAAIY,OAAY,aAAA,CACpB,gBAAgB,EAChB,oCAAoC,GAAGK,KAAK,CAACC,OAAO,CACrD,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC"}
1
+ {"version":3,"sources":["../../../../../src/start/server/middleware/resolveAssets.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config';\nimport fs from 'fs/promises';\nimport path from 'path';\n\nimport { getAssetSchemasAsync } from '../../../api/getExpoSchema';\nimport { BundleAssetWithFileHashes } from '../../../export/fork-bundleAsync';\nimport * as Log from '../../../log';\nimport { fileExistsAsync } from '../../../utils/dir';\nimport { CommandError } from '../../../utils/errors';\nimport { get, set } from '../../../utils/obj';\nimport { validateUrl } from '../../../utils/url';\n\ntype ManifestAsset = { fileHashes: string[]; files: string[]; hash: string };\n\nexport type Asset = ManifestAsset | BundleAssetWithFileHashes;\n\ntype ManifestResolutionError = Error & {\n localAssetPath?: string;\n manifestField?: string;\n};\n\n/** Inline the contents of each platform's `googleServicesFile` so runtimes can access them. */\nexport async function resolveGoogleServicesFile(\n projectRoot: string,\n manifest: Partial<Pick<ExpoConfig, 'android' | 'ios'>>\n) {\n if (manifest.android?.googleServicesFile) {\n try {\n const contents = await fs.readFile(\n path.resolve(projectRoot, manifest.android.googleServicesFile),\n 'utf8'\n );\n manifest.android.googleServicesFile = contents;\n } catch {\n Log.warn(\n `Could not parse Expo config: android.googleServicesFile: \"${manifest.android.googleServicesFile}\"`\n );\n // Delete the field so Expo Go doesn't attempt to read it.\n delete manifest.android.googleServicesFile;\n }\n }\n if (manifest.ios?.googleServicesFile) {\n try {\n const contents = await fs.readFile(\n path.resolve(projectRoot, manifest.ios.googleServicesFile),\n 'base64'\n );\n manifest.ios.googleServicesFile = contents;\n } catch {\n Log.warn(\n `Could not parse Expo config: ios.googleServicesFile: \"${manifest.ios.googleServicesFile}\"`\n );\n // Delete the field so Expo Go doesn't attempt to read it.\n delete manifest.ios.googleServicesFile;\n }\n }\n return manifest;\n}\n\n/**\n * Get all fields in the manifest that match assets, then filter the ones that aren't set.\n *\n * @param manifest\n * @returns Asset fields that the user has set like [\"icon\", \"splash.image\", ...]\n */\nexport async function getAssetFieldPathsForManifestAsync(manifest: ExpoConfig): Promise<string[]> {\n // String array like [\"icon\", \"notification.icon\", \"loading.icon\", \"loading.backgroundImage\", \"ios.icon\", ...]\n const sdkAssetFieldPaths = await getAssetSchemasAsync(manifest.sdkVersion);\n return sdkAssetFieldPaths.filter((assetSchema) => get(manifest, assetSchema));\n}\n\n/** Resolve all assets in the app.json inline. */\nexport async function resolveManifestAssets(\n projectRoot: string,\n {\n manifest,\n resolver,\n strict,\n }: {\n manifest: ExpoConfig;\n resolver: (assetPath: string) => Promise<string>;\n strict?: boolean;\n }\n) {\n try {\n // Asset fields that the user has set like [\"icon\", \"splash.image\"]\n const assetSchemas = await getAssetFieldPathsForManifestAsync(manifest);\n // Get the URLs\n const urls = await Promise.all(\n assetSchemas.map(async (manifestField) => {\n const pathOrURL = get(manifest, manifestField);\n // URL\n if (validateUrl(pathOrURL, { requireProtocol: true })) {\n return pathOrURL;\n }\n\n // File path\n if (await fileExistsAsync(path.resolve(projectRoot, pathOrURL))) {\n return await resolver(pathOrURL);\n }\n\n // Unknown\n const err: ManifestResolutionError = new CommandError(\n 'MANIFEST_ASSET',\n 'Could not resolve local asset: ' + pathOrURL\n );\n err.localAssetPath = pathOrURL;\n err.manifestField = manifestField;\n throw err;\n })\n );\n\n // Set the corresponding URL fields\n assetSchemas.forEach((manifestField, index: number) =>\n set(manifest, `${manifestField}Url`, urls[index])\n );\n } catch (error: any) {\n if (error.localAssetPath) {\n Log.warn(\n `Unable to resolve asset \"${error.localAssetPath}\" from \"${error.manifestField}\" in your app.json or app.config.js`\n );\n } else {\n Log.warn(\n `Warning: Unable to resolve manifest assets. Icons and fonts might not work. ${error.message}.`\n );\n }\n\n if (strict) {\n throw new CommandError(\n 'MANIFEST_ASSET',\n 'Failed to export manifest assets: ' + error.message\n );\n }\n }\n}\n"],"names":["resolveGoogleServicesFile","getAssetFieldPathsForManifestAsync","resolveManifestAssets","projectRoot","manifest","android","googleServicesFile","contents","fs","readFile","path","resolve","Log","warn","ios","sdkAssetFieldPaths","getAssetSchemasAsync","sdkVersion","filter","assetSchema","get","resolver","strict","assetSchemas","urls","Promise","all","map","manifestField","pathOrURL","validateUrl","requireProtocol","fileExistsAsync","err","CommandError","localAssetPath","forEach","index","set","error","message"],"mappings":"AAAA;;;;;;;;;;;IAsBsBA,yBAAyB,MAAzBA,yBAAyB;IA2CzBC,kCAAkC,MAAlCA,kCAAkC;IAOlCC,qBAAqB,MAArBA,qBAAqB;;;8DAvE5B,aAAa;;;;;;;8DACX,MAAM;;;;;;+BAEc,4BAA4B;2DAE5C,cAAc;qBACH,oBAAoB;wBACvB,uBAAuB;qBAC3B,oBAAoB;qBACjB,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,AAAC;YACFI,GAAG,CAACE,cAAc,GAAGN,SAAS,CAAC;YAC/BI,GAAG,CAACL,aAAa,GAAGA,aAAa,CAAC;YAClC,MAAMK,GAAG,CAAC;QACZ,CAAC,CAAC,CACH,AAAC;QAEF,mCAAmC;QACnCV,YAAY,CAACa,OAAO,CAAC,CAACR,aAAa,EAAES,KAAa,GAChDC,IAAAA,IAAG,IAAA,EAAClC,QAAQ,EAAE,CAAC,EAAEwB,aAAa,CAAC,GAAG,CAAC,EAAEJ,IAAI,CAACa,KAAK,CAAC,CAAC,CAClD,CAAC;IACJ,EAAE,OAAOE,KAAK,EAAO;QACnB,IAAIA,KAAK,CAACJ,cAAc,EAAE;YACxBvB,IAAG,CAACC,IAAI,CACN,CAAC,yBAAyB,EAAE0B,KAAK,CAACJ,cAAc,CAAC,QAAQ,EAAEI,KAAK,CAACX,aAAa,CAAC,mCAAmC,CAAC,CACpH,CAAC;QACJ,OAAO;YACLhB,IAAG,CAACC,IAAI,CACN,CAAC,4EAA4E,EAAE0B,KAAK,CAACC,OAAO,CAAC,CAAC,CAAC,CAChG,CAAC;QACJ,CAAC;QAED,IAAIlB,MAAM,EAAE;YACV,MAAM,IAAIY,OAAY,aAAA,CACpB,gBAAgB,EAChB,oCAAoC,GAAGK,KAAK,CAACC,OAAO,CACrD,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -79,7 +79,7 @@ function getContext() {
79
79
  cpu: summarizeCpuInfo(),
80
80
  app: {
81
81
  name: "expo/cli",
82
- version: "0.18.18"
82
+ version: "0.18.19"
83
83
  },
84
84
  ci: _ciInfo().isCI ? {
85
85
  name: _ciInfo().name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expo/cli",
3
- "version": "0.18.18",
3
+ "version": "0.18.19",
4
4
  "description": "The Expo CLI",
5
5
  "main": "build/bin/cli",
6
6
  "bin": {
@@ -17,7 +17,7 @@
17
17
  "lint": "expo-module lint",
18
18
  "typecheck": "expo-module typecheck",
19
19
  "test": "expo-module test",
20
- "test:e2e": "jest --config e2e/jest.config.js",
20
+ "test:e2e": "jest --config e2e/jest.config.js --runInBand",
21
21
  "test:playwright": "playwright test",
22
22
  "prepublishOnly": "expo-module prepublishOnly",
23
23
  "expo-module": "expo-module",
@@ -172,5 +172,5 @@
172
172
  "tree-kill": "^1.2.2",
173
173
  "tsd": "^0.28.1"
174
174
  },
175
- "gitHead": "dcd266ad9141c9737d7fee7e7d950848ffd2c4ce"
175
+ "gitHead": "6f609a05a2d4dac7fd281bcc502575440c5af7c9"
176
176
  }
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "assertMetroPrivateServer", {
6
- enumerable: true,
7
- get: ()=>assertMetroPrivateServer
8
- });
9
- function _nodeAssert() {
10
- const data = /*#__PURE__*/ _interopRequireDefault(require("node:assert"));
11
- _nodeAssert = function() {
12
- return data;
13
- };
14
- return data;
15
- }
16
- function _interopRequireDefault(obj) {
17
- return obj && obj.__esModule ? obj : {
18
- default: obj
19
- };
20
- }
21
- function assertMetroPrivateServer(metro) {
22
- (0, _nodeAssert().default)(metro, "Metro server undefined.");
23
- (0, _nodeAssert().default)("_config" in metro && "_bundler" in metro, "Metro server is missing expected properties (_config, _bundler). This could be due to a version mismatch or change in the Metro API.");
24
- }
25
-
26
- //# sourceMappingURL=metroPrivateServer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../src/start/server/metro/metroPrivateServer.ts"],"sourcesContent":["import { TransformInputOptions } from 'metro';\nimport type Metro from 'metro';\nimport { ConfigT } from 'metro-config';\nimport assert from 'node:assert';\n\nexport type MetroPrivateServer = import('metro').Server & {\n _bundler: import('metro/src/IncrementalBundler').default;\n _config: ConfigT;\n _createModuleId: (path: string) => number;\n _isEnded: boolean;\n _nextBundleBuildNumber: number;\n _platforms: Set<string>;\n _reporter: import('metro/src/lib/reporting').Reporter;\n _serverOptions: import('metro').ServerOptions | void;\n\n getNewBuildNumber(): number;\n _getSortedModules(\n graph: import('metro/src/IncrementalBundler').OutputGraph\n ): import('metro/src/DeltaBundler/types').Module[];\n\n _resolveRelativePath(\n filePath: string,\n {\n relativeTo,\n resolverOptions,\n transformOptions,\n }: {\n relativeTo: 'project' | 'server';\n resolverOptions: import('metro/src/shared/types').ResolverInputOptions;\n transformOptions: TransformInputOptions;\n }\n ): Promise<string>;\n\n _shouldAddModuleToIgnoreList(module: import('metro/src/DeltaBundler/types').Module<any>): boolean;\n};\n\nexport function assertMetroPrivateServer(metro: Metro.Server): asserts metro is MetroPrivateServer {\n assert(metro, 'Metro server undefined.');\n assert(\n '_config' in metro && '_bundler' in metro,\n 'Metro server is missing expected properties (_config, _bundler). This could be due to a version mismatch or change in the Metro API.'\n );\n}\n"],"names":["assertMetroPrivateServer","metro","assert"],"mappings":"AAAA;;;;+BAoCgBA,0BAAwB;;aAAxBA,wBAAwB;;;8DAjCrB,aAAa;;;;;;;;;;;AAiCzB,SAASA,wBAAwB,CAACC,KAAmB,EAAuC;IACjGC,IAAAA,WAAM,EAAA,QAAA,EAACD,KAAK,EAAE,yBAAyB,CAAC,CAAC;IACzCC,IAAAA,WAAM,EAAA,QAAA,EACJ,SAAS,IAAID,KAAK,IAAI,UAAU,IAAIA,KAAK,EACzC,sIAAsI,CACvI,CAAC;AACJ,CAAC"}