@expo/cli 55.0.5 → 55.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/bin/cli +1 -1
- package/build/src/start/platforms/android/AndroidSdk.js +15 -6
- package/build/src/start/platforms/android/AndroidSdk.js.map +1 -1
- package/build/src/start/server/metro/MetroBundlerDevServer.js +1 -0
- package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/instantiateMetro.js +1 -0
- package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
- package/build/src/start/server/webpack/WebpackBundlerDevServer.js +2 -1
- package/build/src/start/server/webpack/WebpackBundlerDevServer.js.map +1 -1
- package/build/src/utils/telemetry/clients/FetchClient.js +1 -1
- package/build/src/utils/telemetry/utils/context.js +1 -1
- package/package.json +7 -7
package/build/bin/cli
CHANGED
|
@@ -47,9 +47,13 @@ function _interop_require_default(obj) {
|
|
|
47
47
|
* @see https://developer.android.com/studio/intro/studio-config#optimize-studio-windows
|
|
48
48
|
*/ const ANDROID_DEFAULT_LOCATION = {
|
|
49
49
|
darwin: _path().default.join(_os().default.homedir(), 'Library', 'Android', 'sdk'),
|
|
50
|
-
linux:
|
|
50
|
+
linux: [
|
|
51
|
+
_path().default.join(_os().default.homedir(), 'Android', 'Sdk'),
|
|
52
|
+
_path().default.join(_os().default.homedir(), 'Android', 'sdk')
|
|
53
|
+
],
|
|
51
54
|
win32: _path().default.join(_os().default.homedir(), 'AppData', 'Local', 'Android', 'Sdk')
|
|
52
55
|
};
|
|
56
|
+
const isAndroidDefaultLocationKey = (platform)=>ANDROID_DEFAULT_LOCATION[platform] != null;
|
|
53
57
|
function assertSdkRoot() {
|
|
54
58
|
if (process.env.ANDROID_HOME) {
|
|
55
59
|
(0, _assert().default)(_fs().default.existsSync(process.env.ANDROID_HOME), `Failed to resolve the Android SDK path. ANDROID_HOME is set to a non-existing path: ${process.env.ANDROID_HOME}`);
|
|
@@ -59,12 +63,17 @@ function assertSdkRoot() {
|
|
|
59
63
|
(0, _assert().default)(_fs().default.existsSync(process.env.ANDROID_SDK_ROOT), `Failed to resolve the Android SDK path. Deprecated ANDROID_SDK_ROOT is set to a non-existing path: ${process.env.ANDROID_SDK_ROOT}. Use ANDROID_HOME instead.`);
|
|
60
64
|
return process.env.ANDROID_SDK_ROOT;
|
|
61
65
|
}
|
|
62
|
-
const
|
|
63
|
-
if (
|
|
64
|
-
|
|
65
|
-
return defaultLocation;
|
|
66
|
+
const platform = process.platform;
|
|
67
|
+
if (!isAndroidDefaultLocationKey(platform)) {
|
|
68
|
+
return null;
|
|
66
69
|
}
|
|
67
|
-
|
|
70
|
+
const defaultLocation = ANDROID_DEFAULT_LOCATION[platform];
|
|
71
|
+
const locations = !Array.isArray(defaultLocation) ? [
|
|
72
|
+
defaultLocation
|
|
73
|
+
] : defaultLocation;
|
|
74
|
+
const resolvedLocation = locations.find((location)=>_fs().default.existsSync(location));
|
|
75
|
+
(0, _assert().default)(!!resolvedLocation, `Failed to resolve the Android SDK path. Default install location not found: ${locations[0]}. Use ANDROID_HOME to set the Android SDK location.`);
|
|
76
|
+
return resolvedLocation;
|
|
68
77
|
}
|
|
69
78
|
|
|
70
79
|
//# sourceMappingURL=AndroidSdk.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/platforms/android/AndroidSdk.ts"],"sourcesContent":["import assert from 'assert';\nimport fs from 'fs';\nimport os from 'os';\nimport path from 'path';\n\n/**\n * The default Android SDK locations per platform.\n * @see https://developer.android.com/studio/run/emulator-commandline#filedir\n * @see https://developer.android.com/studio/intro/studio-config#optimize-studio-windows\n */\nconst ANDROID_DEFAULT_LOCATION
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/platforms/android/AndroidSdk.ts"],"sourcesContent":["import assert from 'assert';\nimport fs from 'fs';\nimport os from 'os';\nimport path from 'path';\n\n/**\n * The default Android SDK locations per platform.\n * @see https://developer.android.com/studio/run/emulator-commandline#filedir\n * @see https://developer.android.com/studio/intro/studio-config#optimize-studio-windows\n */\nconst ANDROID_DEFAULT_LOCATION = {\n darwin: path.join(os.homedir(), 'Library', 'Android', 'sdk'),\n linux: [path.join(os.homedir(), 'Android', 'Sdk'), path.join(os.homedir(), 'Android', 'sdk')],\n win32: path.join(os.homedir(), 'AppData', 'Local', 'Android', 'Sdk'),\n};\n\nconst isAndroidDefaultLocationKey = (\n platform: string\n): platform is keyof typeof ANDROID_DEFAULT_LOCATION =>\n ANDROID_DEFAULT_LOCATION[platform as keyof typeof ANDROID_DEFAULT_LOCATION] != null;\n\n/**\n * Resolve and validate the root folder where the Android SDK has been installed.\n * This checks both `ANDROID_HOME`, `ANDROID_SDK_ROOT`, and the default path for the current platform.\n * @see https://developer.android.com/studio/command-line/variables\n */\nexport function assertSdkRoot(): string | null {\n if (process.env.ANDROID_HOME) {\n assert(\n fs.existsSync(process.env.ANDROID_HOME),\n `Failed to resolve the Android SDK path. ANDROID_HOME is set to a non-existing path: ${process.env.ANDROID_HOME}`\n );\n return process.env.ANDROID_HOME;\n }\n\n if (process.env.ANDROID_SDK_ROOT) {\n assert(\n fs.existsSync(process.env.ANDROID_SDK_ROOT),\n `Failed to resolve the Android SDK path. Deprecated ANDROID_SDK_ROOT is set to a non-existing path: ${process.env.ANDROID_SDK_ROOT}. Use ANDROID_HOME instead.`\n );\n return process.env.ANDROID_SDK_ROOT;\n }\n\n const platform = process.platform;\n if (!isAndroidDefaultLocationKey(platform)) {\n return null;\n }\n\n const defaultLocation = ANDROID_DEFAULT_LOCATION[platform];\n const locations = !Array.isArray(defaultLocation) ? [defaultLocation] : defaultLocation;\n const resolvedLocation = locations.find((location) => fs.existsSync(location));\n assert(\n !!resolvedLocation,\n `Failed to resolve the Android SDK path. Default install location not found: ${locations[0]}. Use ANDROID_HOME to set the Android SDK location.`\n );\n return resolvedLocation;\n}\n"],"names":["assertSdkRoot","ANDROID_DEFAULT_LOCATION","darwin","path","join","os","homedir","linux","win32","isAndroidDefaultLocationKey","platform","process","env","ANDROID_HOME","assert","fs","existsSync","ANDROID_SDK_ROOT","defaultLocation","locations","Array","isArray","resolvedLocation","find","location"],"mappings":";;;;+BA0BgBA;;;eAAAA;;;;gEA1BG;;;;;;;gEACJ;;;;;;;gEACA;;;;;;;gEACE;;;;;;;;;;;AAEjB;;;;CAIC,GACD,MAAMC,2BAA2B;IAC/BC,QAAQC,eAAI,CAACC,IAAI,CAACC,aAAE,CAACC,OAAO,IAAI,WAAW,WAAW;IACtDC,OAAO;QAACJ,eAAI,CAACC,IAAI,CAACC,aAAE,CAACC,OAAO,IAAI,WAAW;QAAQH,eAAI,CAACC,IAAI,CAACC,aAAE,CAACC,OAAO,IAAI,WAAW;KAAO;IAC7FE,OAAOL,eAAI,CAACC,IAAI,CAACC,aAAE,CAACC,OAAO,IAAI,WAAW,SAAS,WAAW;AAChE;AAEA,MAAMG,8BAA8B,CAClCC,WAEAT,wBAAwB,CAACS,SAAkD,IAAI;AAO1E,SAASV;IACd,IAAIW,QAAQC,GAAG,CAACC,YAAY,EAAE;QAC5BC,IAAAA,iBAAM,EACJC,aAAE,CAACC,UAAU,CAACL,QAAQC,GAAG,CAACC,YAAY,GACtC,CAAC,oFAAoF,EAAEF,QAAQC,GAAG,CAACC,YAAY,EAAE;QAEnH,OAAOF,QAAQC,GAAG,CAACC,YAAY;IACjC;IAEA,IAAIF,QAAQC,GAAG,CAACK,gBAAgB,EAAE;QAChCH,IAAAA,iBAAM,EACJC,aAAE,CAACC,UAAU,CAACL,QAAQC,GAAG,CAACK,gBAAgB,GAC1C,CAAC,mGAAmG,EAAEN,QAAQC,GAAG,CAACK,gBAAgB,CAAC,2BAA2B,CAAC;QAEjK,OAAON,QAAQC,GAAG,CAACK,gBAAgB;IACrC;IAEA,MAAMP,WAAWC,QAAQD,QAAQ;IACjC,IAAI,CAACD,4BAA4BC,WAAW;QAC1C,OAAO;IACT;IAEA,MAAMQ,kBAAkBjB,wBAAwB,CAACS,SAAS;IAC1D,MAAMS,YAAY,CAACC,MAAMC,OAAO,CAACH,mBAAmB;QAACA;KAAgB,GAAGA;IACxE,MAAMI,mBAAmBH,UAAUI,IAAI,CAAC,CAACC,WAAaT,aAAE,CAACC,UAAU,CAACQ;IACpEV,IAAAA,iBAAM,EACJ,CAAC,CAACQ,kBACF,CAAC,4EAA4E,EAAEH,SAAS,CAAC,EAAE,CAAC,mDAAmD,CAAC;IAElJ,OAAOG;AACT"}
|
|
@@ -837,6 +837,7 @@ class MetroBundlerDevServer extends _BundlerDevServer.BundlerDevServer {
|
|
|
837
837
|
};
|
|
838
838
|
this.instanceMetroOptions = instanceMetroOptions;
|
|
839
839
|
const parsedOptions = {
|
|
840
|
+
host: options.location.hostType === 'localhost' ? 'localhost' : undefined,
|
|
840
841
|
port: options.port,
|
|
841
842
|
maxWorkers: options.maxWorkers,
|
|
842
843
|
resetCache: options.resetDevServer
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/server/metro/MetroBundlerDevServer.ts"],"sourcesContent":["/**\n * Copyright © 2022 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { ExpoConfig, getConfig } from '@expo/config';\nimport { getMetroServerRoot } from '@expo/config/paths';\nimport * as runtimeEnv from '@expo/env';\nimport baseJSBundle from '@expo/metro/metro/DeltaBundler/Serializers/baseJSBundle';\nimport {\n sourceMapGeneratorNonBlocking,\n type SourceMapGeneratorOptions,\n} from '@expo/metro/metro/DeltaBundler/Serializers/sourceMapGenerator';\nimport type {\n Module,\n DeltaResult,\n TransformInputOptions,\n} from '@expo/metro/metro/DeltaBundler/types';\nimport type {\n default as MetroHmrServer,\n Client as MetroHmrClient,\n} from '@expo/metro/metro/HmrServer';\nimport type { GraphRevision } from '@expo/metro/metro/IncrementalBundler';\nimport type MetroServer from '@expo/metro/metro/Server';\nimport bundleToString from '@expo/metro/metro/lib/bundleToString';\nimport getGraphId from '@expo/metro/metro/lib/getGraphId';\nimport type { TransformProfile } from '@expo/metro/metro-babel-transformer';\nimport type { CustomResolverOptions } from '@expo/metro/metro-resolver';\nimport { SerialAsset } from '@expo/metro-config/build/serializer/serializerAssets';\nimport type { GetStaticContentOptions } from '@expo/router-server/build/static/renderStaticContent';\nimport assert from 'assert';\nimport chalk from 'chalk';\nimport type { RouteNode } from 'expo-router/build/Route';\nimport { type RouteInfo, type RoutesManifest, type ImmutableRequest } from 'expo-server/private';\nimport path from 'path';\n\nimport {\n createServerComponentsMiddleware,\n fileURLToFilePath,\n} from './createServerComponentsMiddleware';\nimport { createRouteHandlerMiddleware } from './createServerRouteMiddleware';\nimport { fetchManifest, inflateManifest } from './fetchRouterManifest';\nimport { instantiateMetroAsync } from './instantiateMetro';\nimport {\n attachImportStackToRootMessage,\n dropStackIfContainsCodeFrame,\n getErrorOverlayHtmlAsync,\n IS_METRO_BUNDLE_ERROR_SYMBOL,\n} from './metroErrorInterface';\nimport { metroWatchTypeScriptFiles } from './metroWatchTypeScriptFiles';\nimport {\n getRouterDirectoryModuleIdWithManifest,\n hasWarnedAboutApiRoutes,\n isApiRouteConvention,\n warnInvalidWebOutput,\n} from './router';\nimport { serializeHtmlWithAssets } from './serializeHtml';\nimport { observeAnyFileChanges, observeFileChanges } from './waitForMetroToObserveTypeScriptFile';\nimport type {\n BundleAssetWithFileHashes,\n ExportAssetDescriptor,\n ExportAssetMap,\n} from '../../../export/saveAssets';\nimport { Log } from '../../../log';\nimport { env } from '../../../utils/env';\nimport { CommandError } from '../../../utils/errors';\nimport { toPosixPath } from '../../../utils/filePath';\nimport { getFreePortAsync } from '../../../utils/port';\nimport { BundlerDevServer, BundlerStartOptions, DevServerInstance } from '../BundlerDevServer';\nimport {\n cachedSourceMaps,\n evalMetroAndWrapFunctions,\n evalMetroNoHandling,\n} from '../getStaticRenderFunctions';\nimport {\n fromRuntimeManifestRoute,\n fromServerManifestRoute,\n type ResolvedLoaderRoute,\n} from './resolveLoader';\nimport { ContextModuleSourceMapsMiddleware } from '../middleware/ContextModuleSourceMapsMiddleware';\nimport { CreateFileMiddleware } from '../middleware/CreateFileMiddleware';\nimport { DevToolsPluginMiddleware } from '../middleware/DevToolsPluginMiddleware';\nimport { createDomComponentsMiddleware } from '../middleware/DomComponentsMiddleware';\nimport { FaviconMiddleware } from '../middleware/FaviconMiddleware';\nimport { HistoryFallbackMiddleware } from '../middleware/HistoryFallbackMiddleware';\nimport { InterstitialPageMiddleware } from '../middleware/InterstitialPageMiddleware';\nimport { resolveMainModuleName } from '../middleware/ManifestMiddleware';\nimport { RuntimeRedirectMiddleware } from '../middleware/RuntimeRedirectMiddleware';\nimport { ServeStaticMiddleware } from '../middleware/ServeStaticMiddleware';\nimport {\n convertPathToModuleSpecifier,\n createBundleUrlPath,\n ExpoMetroOptions,\n createBundleOsPath,\n getAsyncRoutesFromExpoConfig,\n getBaseUrlFromExpoConfig,\n getMetroDirectBundleOptions,\n} from '../middleware/metroOptions';\nimport { prependMiddleware } from '../middleware/mutations';\nimport { ServerNext, ServerRequest, ServerResponse } from '../middleware/server.types';\nimport { startTypescriptTypeGenerationAsync } from '../type-generation/startTypescriptTypeGeneration';\n\nexport type ExpoRouterRuntimeManifest = Awaited<\n ReturnType<typeof import('@expo/router-server/build/static/renderStaticContent').getManifest>\n>;\n\ntype SSRLoadModuleFunc = <T extends Record<string, any>>(\n filePath: string | null,\n specificOptions?: Partial<ExpoMetroOptions>,\n extras?: { hot?: boolean }\n) => Promise<T>;\n\ninterface BundleDirectResult {\n numModifiedFiles: number;\n lastModifiedDate: Date;\n nextRevId: string;\n bundle: string;\n map: string;\n /** Defined if the output is multi-bundle. */\n artifacts?: SerialAsset[];\n assets?: readonly BundleAssetWithFileHashes[];\n}\n\ninterface MetroModuleContentsResult extends BundleDirectResult {\n filename: string;\n}\n\ninterface SSRModuleContentsResult extends Omit<BundleDirectResult, 'bundle'> {\n filename: string;\n src: string;\n map: string;\n}\n\n// TODO(@kitten): We access this here to run server-side code bundled by metro\n// It's not isolated into a worker thread yet\n// Check `metro-require/require.ts` for how this function is defined\ndeclare namespace globalThis {\n const __c: (() => void) | undefined;\n let __expo_rsc_inject_module: (params: { code: string; id: string }) => void | undefined;\n}\n\nconst debug = require('debug')('expo:start:server:metro') as typeof console.log;\n\n/** Default port to use for apps running in Expo Go. */\nconst EXPO_GO_METRO_PORT = 8081;\n\n/** Default port to use for apps that run in standard React Native projects or Expo Dev Clients. */\nconst DEV_CLIENT_METRO_PORT = 8081;\n\nexport class MetroBundlerDevServer extends BundlerDevServer {\n private metro: MetroServer | null = null;\n private hmrServer: MetroHmrServer<MetroHmrClient> | null = null;\n private ssrHmrClients: Map<string, MetroHmrClient> = new Map();\n isReactServerComponentsEnabled?: boolean;\n isReactServerRoutesEnabled?: boolean;\n\n get name(): string {\n return 'metro';\n }\n\n async resolvePortAsync(options: Partial<BundlerStartOptions> = {}): Promise<number> {\n const port =\n // If the manually defined port is busy then an error should be thrown...\n options.port ??\n // Otherwise use the default port based on the runtime target.\n (options.devClient\n ? // Don't check if the port is busy if we're using the dev client since most clients are hardcoded to 8081.\n Number(process.env.RCT_METRO_PORT) || DEV_CLIENT_METRO_PORT\n : // Otherwise (running in Expo Go) use a free port that falls back on the classic 8081 port.\n await getFreePortAsync(EXPO_GO_METRO_PORT));\n\n return port;\n }\n\n private async exportServerRouteAsync({\n contents,\n artifactFilename,\n files,\n includeSourceMaps,\n descriptor,\n }: {\n contents: { src: string; map?: any } | null | undefined;\n artifactFilename: string;\n files: ExportAssetMap;\n includeSourceMaps?: boolean;\n routeId?: string;\n descriptor: Partial<ExportAssetDescriptor>;\n }) {\n if (!contents) return;\n\n let src = contents.src;\n if (includeSourceMaps && contents.map) {\n // TODO(kitten): Merge the source map transformer in the future\n // https://github.com/expo/expo/blob/0dffdb15/packages/%40expo/metro-config/src/serializer/serializeChunks.ts#L422-L439\n // Alternatively, check whether `sourcesRoot` helps here\n const artifactBasename = encodeURIComponent(path.basename(artifactFilename) + '.map');\n src = src.replace(/\\/\\/# sourceMappingURL=.*/g, `//# sourceMappingURL=${artifactBasename}`);\n const parsedMap = typeof contents.map === 'string' ? JSON.parse(contents.map) : contents.map;\n const mapData: any = {\n ...descriptor,\n contents: JSON.stringify({\n version: parsedMap.version,\n sources: parsedMap.sources.map((source: string) => {\n source =\n typeof source === 'string' && source.startsWith(this.projectRoot)\n ? path.relative(this.projectRoot, source)\n : source;\n return convertPathToModuleSpecifier(source);\n }),\n sourcesContent: new Array(parsedMap.sources.length).fill(null),\n names: parsedMap.names,\n mappings: parsedMap.mappings,\n }),\n targetDomain: 'server',\n };\n files.set(artifactFilename + '.map', mapData);\n }\n const fileData: ExportAssetDescriptor = {\n ...descriptor,\n contents: src,\n targetDomain: 'server',\n };\n files.set(artifactFilename, fileData);\n }\n\n private async exportMiddlewareAsync({\n manifest,\n appDir,\n outputDir,\n files,\n platform,\n includeSourceMaps,\n }: {\n manifest: RoutesManifest;\n appDir: string;\n outputDir: string;\n files: ExportAssetMap;\n platform: string;\n includeSourceMaps?: boolean;\n }) {\n if (!manifest.middleware) return;\n\n const middlewareFilePath = path.isAbsolute(manifest.middleware.file)\n ? manifest.middleware.file\n : path.join(appDir, manifest.middleware.file);\n const contents = await this.bundleApiRoute(middlewareFilePath, { platform });\n const artifactFilename = convertPathToModuleSpecifier(\n path.join(outputDir, path.relative(appDir, middlewareFilePath.replace(/\\.[tj]sx?$/, '.js')))\n );\n\n await this.exportServerRouteAsync({\n contents,\n artifactFilename,\n files,\n includeSourceMaps,\n descriptor: {\n middlewareId: '/middleware',\n },\n });\n\n // Remap the middleware file to represent the output file.\n manifest.middleware.file = artifactFilename;\n }\n\n async exportExpoRouterApiRoutesAsync({\n includeSourceMaps,\n outputDir,\n prerenderManifest,\n platform,\n }: {\n includeSourceMaps?: boolean;\n outputDir: string;\n // This does not contain the API routes info.\n prerenderManifest: RoutesManifest<string>;\n platform: string;\n }): Promise<{ files: ExportAssetMap; manifest: RoutesManifest<string> }> {\n const { routerRoot } = this.instanceMetroOptions;\n assert(\n routerRoot != null,\n 'The server must be started before calling exportExpoRouterApiRoutesAsync.'\n );\n\n const appDir = path.join(this.projectRoot, routerRoot);\n const manifest = await this.getExpoRouterRoutesManifestAsync({ appDir });\n\n const files: ExportAssetMap = new Map();\n\n // Inject RSC middleware.\n const rscPath = '/_flight/[...rsc]';\n\n if (\n this.isReactServerComponentsEnabled &&\n // If the RSC route is not already in the manifest, add it.\n !manifest.apiRoutes.find((route) => route.page.startsWith('/_flight/'))\n ) {\n debug('Adding RSC route to the manifest:', rscPath);\n // NOTE: This might need to be sorted to the correct spot in the future.\n manifest.apiRoutes.push({\n // TODO(@kitten): This isn't great, we shouldn't be needing to rely on files like this\n // It might even be better to make templating strings since that'd be type-checked, but currently,\n // we rely on this being an entrypoint for Metro\n file: require.resolve('@expo/cli/static/template/[...rsc]+api.ts'),\n page: rscPath,\n namedRegex: '^/_flight(?:/(?<rsc>.+?))?(?:/)?$',\n routeKeys: { rsc: 'rsc' },\n });\n }\n\n await this.exportMiddlewareAsync({\n manifest,\n appDir,\n outputDir,\n files,\n platform,\n includeSourceMaps,\n });\n\n for (const route of manifest.apiRoutes) {\n const filepath = path.isAbsolute(route.file) ? route.file : path.join(appDir, route.file);\n const contents = await this.bundleApiRoute(filepath, { platform });\n\n const artifactFilename =\n route.page === rscPath\n ? // HACK: Add RSC renderer to the output...\n convertPathToModuleSpecifier(path.join(outputDir, '.' + rscPath + '.js'))\n : convertPathToModuleSpecifier(\n path.join(outputDir, path.relative(appDir, filepath.replace(/\\.[tj]sx?$/, '.js')))\n );\n\n await this.exportServerRouteAsync({\n contents,\n artifactFilename,\n files,\n includeSourceMaps,\n descriptor: {\n apiRouteId: route.page,\n },\n });\n // Remap the manifest files to represent the output files.\n route.file = artifactFilename;\n }\n\n return {\n manifest: {\n ...manifest,\n htmlRoutes: prerenderManifest.htmlRoutes,\n },\n files,\n };\n }\n\n /**\n * Bundle render module for use in SSR\n */\n async exportExpoRouterRenderModuleAsync({\n files,\n includeSourceMaps,\n platform = 'web',\n }: {\n files: ExportAssetMap;\n includeSourceMaps?: boolean;\n platform?: string;\n }) {\n const renderModule = await this.ssrLoadModuleContents(\n require.resolve('@expo/router-server/node/render.js'),\n {\n environment: 'node',\n platform,\n }\n );\n\n await this.exportServerRouteAsync({\n contents: renderModule,\n artifactFilename: '_expo/server/render.js',\n files,\n includeSourceMaps,\n descriptor: {\n // ssrRenderModule: true,\n targetDomain: 'server',\n },\n });\n\n return files;\n }\n\n /**\n * Export loader bundles as standalone JS files for SSR data loading.\n *\n * Each loader bundle contains only the `loader` export from the route file,\n * with all other exports (default, named) stripped out by the Babel plugin.\n * This keeps loader bundles small for efficient server-side execution.\n */\n async exportExpoRouterLoadersAsync({\n platform,\n entryPoints,\n files,\n outputDir,\n includeSourceMaps,\n }: {\n platform: string;\n entryPoints: { file: string; page: string }[];\n files: ExportAssetMap;\n outputDir: string;\n includeSourceMaps: boolean;\n }): Promise<void> {\n // NOTE(@hassankhan): Should we parallelize loader bundling?\n for (const entry of entryPoints) {\n const contents = await this.bundleLoader(entry.file, { platform });\n const pagePath = entry.page.startsWith('/') ? entry.page.slice(1) : entry.page;\n const artifactFilename = convertPathToModuleSpecifier(path.join(outputDir, pagePath + '.js'));\n\n await this.exportServerRouteAsync({\n contents,\n artifactFilename,\n files,\n includeSourceMaps,\n descriptor: {\n loaderId: entry.page,\n },\n });\n }\n }\n\n async getExpoRouterRoutesManifestAsync({ appDir }: { appDir: string }) {\n // getBuiltTimeServerManifest\n const { exp } = getConfig(this.projectRoot);\n const manifest = await fetchManifest(this.projectRoot, {\n ...exp.extra?.router,\n preserveRedirectAndRewrites: true,\n asJson: true,\n appDir,\n });\n\n if (!manifest) {\n throw new CommandError(\n 'EXPO_ROUTER_SERVER_MANIFEST',\n 'Unexpected error: server manifest could not be fetched.'\n );\n }\n\n return manifest;\n }\n\n async getServerManifestAsync(): Promise<{\n serverManifest: RoutesManifest<string>;\n htmlManifest: ExpoRouterRuntimeManifest;\n }> {\n const { exp } = getConfig(this.projectRoot);\n // NOTE: This could probably be folded back into `renderStaticContent` when expo-asset and font support RSC.\n const { getBuildTimeServerManifestAsync, getManifest } = await this.ssrLoadModule<\n typeof import('@expo/router-server/build/static/getServerManifest')\n >(require.resolve('@expo/router-server/build/static/getServerManifest.js'), {\n // Only use react-server environment when the routes are using react-server rendering by default.\n environment: this.isReactServerRoutesEnabled ? 'react-server' : 'node',\n });\n\n return {\n serverManifest: await getBuildTimeServerManifestAsync({ ...exp.extra?.router }),\n htmlManifest: await getManifest({ ...exp.extra?.router }),\n };\n }\n\n /**\n * This function is invoked when exporting via `expo export`\n */\n async getStaticRenderFunctionAsync(): Promise<{\n serverManifest: RoutesManifest<string>;\n manifest: ExpoRouterRuntimeManifest;\n renderAsync: (\n path: string,\n route: RouteNode,\n opts?: GetStaticContentOptions\n ) => Promise<string>;\n executeLoaderAsync: (path: string, route: RouteNode) => Promise<Response | undefined>;\n }> {\n const { routerRoot } = this.instanceMetroOptions;\n assert(\n routerRoot != null,\n 'The server must be started before calling getStaticRenderFunctionAsync.'\n );\n\n const appDir = path.join(this.projectRoot, routerRoot);\n const url = this.getDevServerUrlOrAssert();\n\n const { getStaticContent, getManifest, getBuildTimeServerManifestAsync } =\n await this.ssrLoadModule<\n typeof import('@expo/router-server/build/static/renderStaticContent')\n >(require.resolve('@expo/router-server/node/render.js'), {\n // This must always use the legacy rendering resolution (no `react-server`) because it leverages\n // the previous React SSG utilities which aren't available in React 19.\n environment: 'node',\n });\n\n const { exp } = getConfig(this.projectRoot);\n const useServerRendering = exp.extra?.router?.unstable_useServerRendering ?? false;\n const isExportingWithSSR =\n exp.web?.output === 'server' && useServerRendering && !this.isReactServerComponentsEnabled;\n\n const serverManifest = await getBuildTimeServerManifestAsync({\n ...exp.extra?.router,\n // Skip static params expansion in SSR mode, routes are matched at runtime instead\n skipStaticParams: isExportingWithSSR,\n });\n\n return {\n serverManifest,\n // Get routes from Expo Router.\n manifest: await getManifest({ preserveApiRoutes: false, ...exp.extra?.router }),\n // Get route generating function\n renderAsync: async (path, route, opts?) => {\n const location = new URL(path, url);\n return await getStaticContent(location, opts);\n },\n executeLoaderAsync: async (path, route) => {\n const location = new URL(path, url);\n\n const resolvedLoaderRoute = fromRuntimeManifestRoute(location.pathname, route, {\n serverManifest: inflateManifest(serverManifest),\n appDir,\n });\n\n if (!resolvedLoaderRoute) {\n return undefined;\n }\n\n return this.executeServerDataLoaderAsync(location, resolvedLoaderRoute);\n },\n };\n }\n\n async getStaticResourcesAsync({\n includeSourceMaps,\n mainModuleName,\n clientBoundaries = this.instanceMetroOptions.clientBoundaries ?? [],\n platform = 'web',\n }: {\n includeSourceMaps?: boolean;\n mainModuleName?: string;\n clientBoundaries?: string[];\n platform?: string;\n } = {}) {\n const { mode, minify, isExporting, baseUrl, reactCompiler, routerRoot, asyncRoutes } =\n this.instanceMetroOptions;\n assert(\n mode != null &&\n isExporting != null &&\n baseUrl != null &&\n routerRoot != null &&\n reactCompiler != null &&\n asyncRoutes != null,\n 'The server must be started before calling getStaticResourcesAsync.'\n );\n\n const resolvedMainModuleName =\n mainModuleName ?? './' + resolveMainModuleName(this.projectRoot, { platform });\n return await this.metroImportAsArtifactsAsync(resolvedMainModuleName, {\n splitChunks: isExporting && !env.EXPO_NO_BUNDLE_SPLITTING,\n platform,\n mode,\n minify,\n environment: 'client',\n serializerIncludeMaps: includeSourceMaps,\n mainModuleName: resolvedMainModuleName,\n lazy: !env.EXPO_NO_METRO_LAZY,\n asyncRoutes,\n baseUrl,\n isExporting,\n routerRoot,\n clientBoundaries,\n reactCompiler,\n bytecode: false,\n });\n }\n\n /**\n * This function is invoked when running in development via `expo start`\n */\n private async getStaticPageAsync(\n pathname: string,\n route: RouteInfo<RegExp>,\n request?: ImmutableRequest\n ) {\n const { exp } = getConfig(this.projectRoot);\n const { mode, isExporting, clientBoundaries, baseUrl, reactCompiler, routerRoot, asyncRoutes } =\n this.instanceMetroOptions;\n assert(\n mode != null &&\n isExporting != null &&\n baseUrl != null &&\n reactCompiler != null &&\n routerRoot != null &&\n asyncRoutes != null,\n 'The server must be started before calling getStaticPageAsync.'\n );\n const platform = 'web';\n\n const devBundleUrlPathname = createBundleUrlPath({\n splitChunks: isExporting && !env.EXPO_NO_BUNDLE_SPLITTING,\n platform,\n mode,\n environment: 'client',\n reactCompiler,\n mainModuleName: resolveMainModuleName(this.projectRoot, { platform }),\n lazy: !env.EXPO_NO_METRO_LAZY,\n baseUrl,\n isExporting,\n asyncRoutes,\n routerRoot,\n clientBoundaries,\n bytecode: false,\n });\n\n const bundleStaticHtml = async (): Promise<string> => {\n const { getStaticContent } = await this.ssrLoadModule<\n typeof import('@expo/router-server/build/static/renderStaticContent')\n >(require.resolve('@expo/router-server/node/render.js'), {\n // This must always use the legacy rendering resolution (no `react-server`) because it leverages\n // the previous React SSG utilities which aren't available in React 19.\n environment: 'node',\n minify: false,\n isExporting,\n platform,\n });\n\n const location = new URL(pathname, this.getDevServerUrlOrAssert());\n\n const useServerDataLoaders = exp.extra?.router?.unstable_useServerDataLoaders;\n if (!useServerDataLoaders) {\n return await getStaticContent(location);\n }\n\n const resolvedLoaderRoute = fromServerManifestRoute(location.pathname, route);\n if (!resolvedLoaderRoute) {\n return await getStaticContent(location);\n }\n\n const loaderResult = await this.executeServerDataLoaderAsync(\n location,\n resolvedLoaderRoute,\n request\n );\n if (!loaderResult) {\n return await getStaticContent(location);\n }\n\n const loaderData = await loaderResult.json();\n return await getStaticContent(location, { loader: { data: loaderData } });\n };\n\n const [{ artifacts: resources }, staticHtml] = await Promise.all([\n this.getStaticResourcesAsync({\n clientBoundaries: [],\n }),\n bundleStaticHtml(),\n ]);\n const content = serializeHtmlWithAssets({\n isExporting,\n resources,\n template: staticHtml,\n devBundleUrl: devBundleUrlPathname,\n baseUrl,\n hydrate: env.EXPO_WEB_DEV_HYDRATE,\n });\n return {\n content,\n resources,\n };\n }\n\n // Set when the server is started.\n private instanceMetroOptions: Partial<ExpoMetroOptions> = {};\n\n private ssrLoadModule: SSRLoadModuleFunc = async (\n filePath,\n specificOptions = {},\n extras = {}\n ) => {\n // NOTE(@kitten): We don't properly initialize the server-side modules\n // Instead, we first load an entrypoint with an empty bundle to initialize the runtime instead\n // See: ./createServerComponentsMiddleware.ts\n const getEmptyModulePath = () => {\n assert(this.metro, 'Metro server must be running to load SSR modules.');\n return this.metro._config.resolver.emptyModulePath;\n };\n\n const res = await this.ssrLoadModuleContents(filePath ?? getEmptyModulePath(), specificOptions);\n\n if (\n // TODO: hot should be a callback function for invalidating the related SSR module.\n extras.hot &&\n this.instanceMetroOptions.isExporting !== true\n ) {\n // Register SSR HMR\n const serverRoot = getMetroServerRoot(this.projectRoot);\n const relativePath = path.relative(serverRoot, res.filename);\n const url = new URL(relativePath, this.getDevServerUrlOrAssert());\n this.setupHmr(url);\n }\n\n return evalMetroAndWrapFunctions(\n this.projectRoot,\n res.src,\n res.filename,\n specificOptions.isExporting ?? this.instanceMetroOptions.isExporting!\n );\n };\n\n private async metroImportAsArtifactsAsync(\n filePath: string,\n specificOptions: Partial<Omit<ExpoMetroOptions, 'serializerOutput'>> = {}\n ) {\n const results = await this.ssrLoadModuleContents(filePath, {\n serializerOutput: 'static',\n ...specificOptions,\n });\n\n // NOTE: This could potentially need more validation in the future.\n if (results.artifacts && results.assets) {\n return {\n artifacts: results.artifacts,\n assets: results.assets,\n src: results.src,\n filename: results.filename,\n map: results.map,\n };\n }\n throw new CommandError('Invalid bundler results: ' + results);\n }\n\n private async metroLoadModuleContents(\n filePath: string,\n specificOptions: ExpoMetroOptions,\n extraOptions: {\n sourceMapUrl?: string;\n unstable_transformProfile?: TransformProfile;\n } = {}\n ): Promise<MetroModuleContentsResult> {\n const { baseUrl } = this.instanceMetroOptions;\n assert(baseUrl != null, 'The server must be started before calling metroLoadModuleContents.');\n\n const opts: ExpoMetroOptions = {\n // TODO: Possibly issues with using an absolute path here...\n // mainModuleName: filePath,\n lazy: false,\n asyncRoutes: false,\n inlineSourceMap: false,\n engine: 'hermes',\n minify: false,\n // bytecode: false,\n // Bundle in Node.js mode for SSR.\n environment: 'node',\n // platform: 'web',\n // mode: 'development',\n //\n ...this.instanceMetroOptions,\n baseUrl,\n // routerRoot,\n // isExporting,\n ...specificOptions,\n };\n\n const expoBundleOptions = getMetroDirectBundleOptions(opts);\n\n const resolverOptions = {\n customResolverOptions: expoBundleOptions.customResolverOptions ?? {},\n dev: expoBundleOptions.dev ?? true,\n };\n\n const transformOptions: TransformInputOptions = {\n dev: expoBundleOptions.dev ?? true,\n minify: expoBundleOptions.minify ?? false,\n type: 'module',\n unstable_transformProfile:\n extraOptions.unstable_transformProfile ??\n expoBundleOptions.unstable_transformProfile ??\n 'default',\n customTransformOptions: expoBundleOptions.customTransformOptions ?? Object.create(null),\n platform: expoBundleOptions.platform ?? 'web',\n };\n\n const resolvedEntryFilePath = await this.resolveRelativePathAsync(filePath, {\n resolverOptions,\n transformOptions,\n });\n\n const filename = createBundleOsPath({\n ...opts,\n mainModuleName: resolvedEntryFilePath,\n });\n\n // https://github.com/facebook/metro/blob/2405f2f6c37a1b641cc379b9c733b1eff0c1c2a1/packages/metro/src/lib/parseOptionsFromUrl.js#L55-L87\n // TODO(@kitten): We've flagged this way of \"direct transpilation\" for replacement, since it's hard to maintain\n // It's possible that the intention here was to do something like what `exportEmbedAsync` is doing (using Server.DEFAULT_BUNDLE_OPTIONS)\n // That's why the defaults were added to match types. It's unclear though if that was correct\n // Maybe the `Server.DEFAULT_BUNDLE_OPTIONS` logic should be hoisted into `getMetroDirectBundleOptions`?\n const results = await this._bundleDirectAsync(resolvedEntryFilePath, {\n graphOptions: {\n lazy: expoBundleOptions.lazy ?? false,\n shallow: expoBundleOptions.shallow ?? false,\n },\n resolverOptions,\n serializerOptions: {\n ...expoBundleOptions.serializerOptions,\n inlineSourceMap: expoBundleOptions.inlineSourceMap ?? false,\n modulesOnly: expoBundleOptions.modulesOnly ?? false,\n runModule: expoBundleOptions.runModule ?? true,\n sourceUrl: expoBundleOptions.sourceUrl!,\n sourceMapUrl: extraOptions.sourceMapUrl ?? expoBundleOptions.sourceMapUrl!,\n },\n transformOptions,\n });\n\n return {\n ...results,\n filename,\n };\n }\n\n private async ssrLoadModuleContents(\n filePath: string,\n specificOptions: Partial<ExpoMetroOptions> = {}\n ): Promise<SSRModuleContentsResult> {\n const { baseUrl, routerRoot, isExporting } = this.instanceMetroOptions;\n assert(\n baseUrl != null && routerRoot != null && isExporting != null,\n 'The server must be started before calling ssrLoadModuleContents.'\n );\n\n const opts: ExpoMetroOptions = {\n // TODO: Possibly issues with using an absolute path here...\n mainModuleName: convertPathToModuleSpecifier(filePath),\n lazy: false,\n asyncRoutes: false,\n inlineSourceMap: false,\n engine: 'hermes',\n minify: false,\n bytecode: false,\n // Bundle in Node.js mode for SSR unless RSC is enabled.\n environment: this.isReactServerComponentsEnabled ? 'react-server' : 'node',\n platform: 'web',\n mode: 'development',\n //\n ...this.instanceMetroOptions,\n\n // Mostly disable compiler in SSR bundles.\n reactCompiler: false,\n baseUrl,\n routerRoot,\n isExporting,\n\n ...specificOptions,\n };\n\n // https://github.com/facebook/metro/blob/2405f2f6c37a1b641cc379b9c733b1eff0c1c2a1/packages/metro/src/lib/parseOptionsFromUrl.js#L55-L87\n const { filename, bundle, map, ...rest } = await this.metroLoadModuleContents(filePath, opts);\n const scriptContents = wrapBundle(bundle);\n\n if (map) {\n debug('Registering SSR source map for:', filename);\n cachedSourceMaps.set(filename, { url: this.projectRoot, map });\n } else {\n debug('No SSR source map found for:', filename);\n }\n\n return {\n ...rest,\n src: scriptContents,\n filename,\n map,\n };\n }\n\n async nativeExportBundleAsync(\n exp: ExpoConfig,\n options: Omit<\n ExpoMetroOptions,\n 'routerRoot' | 'asyncRoutes' | 'isExporting' | 'serializerOutput' | 'environment'\n >,\n files: ExportAssetMap,\n extraOptions: {\n sourceMapUrl?: string;\n unstable_transformProfile?: TransformProfile;\n } = {}\n ): Promise<{\n artifacts: SerialAsset[];\n assets: readonly BundleAssetWithFileHashes[];\n files?: ExportAssetMap;\n }> {\n if (this.isReactServerComponentsEnabled) {\n return this.singlePageReactServerComponentExportAsync(exp, options, files, extraOptions);\n }\n\n return this.legacySinglePageExportBundleAsync(options, extraOptions);\n }\n\n private async singlePageReactServerComponentExportAsync(\n exp: ExpoConfig,\n options: Omit<\n ExpoMetroOptions,\n 'baseUrl' | 'routerRoot' | 'asyncRoutes' | 'isExporting' | 'serializerOutput' | 'environment'\n >,\n files: ExportAssetMap,\n extraOptions: {\n sourceMapUrl?: string;\n unstable_transformProfile?: TransformProfile;\n } = {}\n ): Promise<{\n artifacts: SerialAsset[];\n assets: readonly BundleAssetWithFileHashes[];\n files: ExportAssetMap;\n }> {\n const getReactServerReferences = (artifacts: SerialAsset[]): string[] => {\n // Get the React server action boundaries from the client bundle.\n return unique(\n artifacts\n .filter((a) => a.type === 'js')\n .map((artifact) =>\n artifact.metadata.reactServerReferences?.map((ref) => fileURLToFilePath(ref))\n )\n // TODO: Segment by module for splitting.\n .flat()\n .filter(Boolean) as string[]\n );\n };\n\n // NOTE(EvanBacon): This will not support any code elimination since it's a static pass.\n let {\n reactClientReferences: clientBoundaries,\n reactServerReferences: serverActionReferencesInServer,\n cssModules,\n } = await this.rscRenderer!.getExpoRouterClientReferencesAsync(\n {\n platform: options.platform,\n domRoot: options.domRoot,\n },\n files\n );\n\n // TODO: The output keys should be in production format or use a lookup manifest.\n\n const processClientBoundaries = async (\n reactServerReferences: string[]\n ): Promise<{\n artifacts: SerialAsset[];\n assets: readonly BundleAssetWithFileHashes[];\n }> => {\n debug('Evaluated client boundaries:', clientBoundaries);\n\n // Run metro bundler and create the JS bundles/source maps.\n const bundle = await this.legacySinglePageExportBundleAsync(\n {\n ...options,\n clientBoundaries,\n },\n extraOptions\n );\n\n // Get the React server action boundaries from the client bundle.\n const newReactServerReferences = getReactServerReferences(bundle.artifacts);\n\n if (!newReactServerReferences) {\n // Possible issue with babel plugin / metro-config.\n throw new Error(\n 'Static server action references were not returned from the Metro client bundle'\n );\n }\n debug('React server action boundaries from client:', newReactServerReferences);\n\n const allKnownReactServerReferences = unique([\n ...reactServerReferences,\n ...newReactServerReferences,\n ]);\n\n // When we export the server actions that were imported from the client, we may need to re-bundle the client with the new client boundaries.\n const { clientBoundaries: nestedClientBoundaries } =\n await this.rscRenderer!.exportServerActionsAsync(\n {\n platform: options.platform,\n domRoot: options.domRoot,\n entryPoints: allKnownReactServerReferences,\n },\n files\n );\n\n // TODO: Check against all modules in the initial client bundles.\n const hasUniqueClientBoundaries = nestedClientBoundaries.some(\n (boundary) => !clientBoundaries.includes(boundary)\n );\n\n if (!hasUniqueClientBoundaries) {\n return bundle;\n }\n\n debug('Re-bundling client with nested client boundaries:', nestedClientBoundaries);\n\n clientBoundaries = unique(clientBoundaries.concat(nestedClientBoundaries));\n\n // Re-bundle the client with the new client boundaries that only exist in server actions that were imported from the client.\n // Run metro bundler and create the JS bundles/source maps.\n return processClientBoundaries(allKnownReactServerReferences);\n };\n\n const bundle = await processClientBoundaries(serverActionReferencesInServer);\n\n // Inject the global CSS that was imported during the server render.\n bundle.artifacts.push(...cssModules);\n\n const serverRoot = getMetroServerRoot(this.projectRoot);\n\n // HACK: Maybe this should be done in the serializer.\n const clientBoundariesAsOpaqueIds = clientBoundaries.map((boundary) =>\n // NOTE(cedric): relative module specifiers / IDs should always be POSIX formatted\n toPosixPath(path.relative(serverRoot, boundary))\n );\n const moduleIdToSplitBundle = (\n bundle.artifacts\n .map((artifact) => artifact?.metadata?.paths && Object.values(artifact.metadata.paths))\n .filter(Boolean)\n .flat() as Record<string, string>[]\n ).reduce((acc, paths) => ({ ...acc, ...paths }), {});\n\n debug('SSR Manifest:', moduleIdToSplitBundle, clientBoundariesAsOpaqueIds);\n\n const ssrManifest = new Map<string, string | null>();\n\n if (Object.keys(moduleIdToSplitBundle).length) {\n clientBoundariesAsOpaqueIds.forEach((boundary) => {\n if (boundary in moduleIdToSplitBundle) {\n ssrManifest.set(boundary, moduleIdToSplitBundle[boundary]);\n } else {\n throw new Error(\n `Could not find boundary \"${boundary}\" in the SSR manifest. Available: ${Object.keys(moduleIdToSplitBundle).join(', ')}`\n );\n }\n });\n } else {\n // Native apps with bundle splitting disabled.\n debug('No split bundles');\n clientBoundariesAsOpaqueIds.forEach((boundary) => {\n ssrManifest.set(boundary, null);\n });\n }\n\n const routerOptions = exp.extra?.router;\n\n // Export the static RSC files\n await this.rscRenderer!.exportRoutesAsync(\n {\n platform: options.platform,\n ssrManifest,\n routerOptions,\n },\n files\n );\n\n // Save the SSR manifest so we can perform more replacements in the server renderer and with server actions.\n files.set(`_expo/rsc/${options.platform}/ssr-manifest.js`, {\n targetDomain: 'server',\n contents:\n 'module.exports = ' +\n JSON.stringify(\n // TODO: Add a less leaky version of this across the framework with just [key, value] (module ID, chunk).\n Object.fromEntries(\n Array.from(ssrManifest.entries()).map(([key, value]) => [\n // Must match babel plugin.\n './' + toPosixPath(path.relative(this.projectRoot, path.join(serverRoot, key))),\n [key, value],\n ])\n )\n ),\n });\n\n return { ...bundle, files };\n }\n\n async legacySinglePageExportBundleAsync(\n options: Omit<\n ExpoMetroOptions,\n 'routerRoot' | 'asyncRoutes' | 'isExporting' | 'serializerOutput' | 'environment' | 'hosted'\n >,\n extraOptions: {\n sourceMapUrl?: string;\n unstable_transformProfile?: TransformProfile;\n } = {}\n ): Promise<{ artifacts: SerialAsset[]; assets: readonly BundleAssetWithFileHashes[] }> {\n const { baseUrl, routerRoot, isExporting } = this.instanceMetroOptions;\n assert(options.mainModuleName != null, 'mainModuleName must be provided in options.');\n assert(\n baseUrl != null && routerRoot != null && isExporting != null,\n 'The server must be started before calling legacySinglePageExportBundleAsync.'\n );\n\n const opts: ExpoMetroOptions = {\n ...this.instanceMetroOptions,\n baseUrl,\n routerRoot,\n isExporting,\n ...options,\n environment: 'client',\n serializerOutput: 'static',\n };\n\n // https://github.com/facebook/metro/blob/2405f2f6c37a1b641cc379b9c733b1eff0c1c2a1/packages/metro/src/lib/parseOptionsFromUrl.js#L55-L87\n if (!opts.mainModuleName.startsWith('/') && !path.isAbsolute(opts.mainModuleName)) {\n opts.mainModuleName = './' + opts.mainModuleName;\n }\n\n const output = await this.metroLoadModuleContents(opts.mainModuleName, opts, extraOptions);\n\n return {\n artifacts: output.artifacts!,\n assets: output.assets!,\n };\n }\n\n async watchEnvironmentVariables() {\n if (!this.instance) {\n throw new Error(\n 'Cannot observe environment variable changes without a running Metro instance.'\n );\n }\n if (!this.metro) {\n // This can happen when the run command is used and the server is already running in another\n // process.\n debug('Skipping Environment Variable observation because Metro is not running (headless).');\n return;\n }\n\n const envFiles = runtimeEnv\n .getFiles(process.env.NODE_ENV)\n .map((fileName) => path.join(this.projectRoot, fileName));\n\n observeFileChanges(\n {\n metro: this.metro,\n server: this.instance.server,\n },\n envFiles,\n () => {\n debug('Reloading environment variables...');\n // Force reload the environment variables.\n runtimeEnv.load(this.projectRoot, { force: true });\n }\n );\n }\n\n rscRenderer: Awaited<ReturnType<typeof createServerComponentsMiddleware>> | null = null;\n\n protected async startImplementationAsync(\n options: BundlerStartOptions\n ): Promise<DevServerInstance> {\n options.port = await this.resolvePortAsync(options);\n this.urlCreator = this.getUrlCreator(options);\n\n const config = getConfig(this.projectRoot, { skipSDKVersionRequirement: true });\n const { exp } = config;\n // NOTE: This will change in the future when it's less experimental, we enable React 19, and turn on more RSC flags by default.\n const isReactServerComponentsEnabled =\n !!exp.experiments?.reactServerComponentRoutes || !!exp.experiments?.reactServerFunctions;\n const isReactServerActionsOnlyEnabled =\n !exp.experiments?.reactServerComponentRoutes && !!exp.experiments?.reactServerFunctions;\n this.isReactServerComponentsEnabled = isReactServerComponentsEnabled;\n this.isReactServerRoutesEnabled = !!exp.experiments?.reactServerComponentRoutes;\n\n const useServerRendering = ['static', 'server'].includes(exp.web?.output ?? '');\n const hasApiRoutes = isReactServerComponentsEnabled || exp.web?.output === 'server';\n const baseUrl = getBaseUrlFromExpoConfig(exp);\n const asyncRoutes = getAsyncRoutesFromExpoConfig(exp, options.mode ?? 'development', 'web');\n const routerRoot = getRouterDirectoryModuleIdWithManifest(this.projectRoot, exp);\n const reactCompiler = !!exp.experiments?.reactCompiler;\n const appDir = path.join(this.projectRoot, routerRoot);\n const mode = options.mode ?? 'development';\n\n const routerOptions = exp.extra?.router;\n\n if (isReactServerComponentsEnabled && exp.web?.output === 'static') {\n throw new CommandError(\n `Experimental server component support does not support 'web.output: ${exp.web!.output}' yet. Use 'web.output: \"server\"' during the experimental phase.`\n );\n }\n\n // Error early about the window.location polyfill when React Server Components are enabled.\n if (isReactServerComponentsEnabled && exp?.extra?.router?.origin === false) {\n const configPath = config.dynamicConfigPath ?? config.staticConfigPath ?? '/app.json';\n const configFileName = path.basename(configPath);\n throw new CommandError(\n `The Expo Router \"origin\" property in the Expo config (${configFileName}) cannot be \"false\" when React Server Components is enabled. Remove it from the ${configFileName} file and try again.`\n );\n }\n\n const instanceMetroOptions = {\n isExporting: !!options.isExporting,\n baseUrl,\n mode,\n routerRoot,\n reactCompiler,\n minify: options.minify,\n asyncRoutes,\n // Options that are changing between platforms like engine, platform, and environment aren't set here.\n };\n this.instanceMetroOptions = instanceMetroOptions;\n\n const parsedOptions = {\n port: options.port,\n maxWorkers: options.maxWorkers,\n resetCache: options.resetDevServer,\n };\n\n // Required for symbolication:\n process.env.EXPO_DEV_SERVER_ORIGIN = `http://localhost:${options.port}`;\n\n const { metro, hmrServer, server, middleware, messageSocket } = await instantiateMetroAsync(\n this,\n parsedOptions,\n {\n isExporting: !!options.isExporting,\n exp,\n }\n );\n\n if (!options.isExporting) {\n const manifestMiddleware = await this.getManifestMiddlewareAsync(options);\n\n // Important that we noop source maps for context modules as soon as possible.\n prependMiddleware(middleware, new ContextModuleSourceMapsMiddleware().getHandler());\n\n // We need the manifest handler to be the first middleware to run so our\n // routes take precedence over static files. For example, the manifest is\n // served from '/' and if the user has an index.html file in their project\n // then the manifest handler will never run, the static middleware will run\n // and serve index.html instead of the manifest.\n // https://github.com/expo/expo/issues/13114\n prependMiddleware(middleware, manifestMiddleware.getHandler());\n\n middleware.use(\n new InterstitialPageMiddleware(this.projectRoot, {\n // TODO: Prevent this from becoming stale.\n scheme: options.location.scheme ?? null,\n }).getHandler()\n );\n middleware.use(\n new DevToolsPluginMiddleware(this.projectRoot, this.devToolsPluginManager).getHandler()\n );\n\n const deepLinkMiddleware = new RuntimeRedirectMiddleware(this.projectRoot, {\n getLocation: ({ runtime }) => {\n if (runtime === 'custom') {\n return this.urlCreator?.constructDevClientUrl();\n } else {\n return this.urlCreator?.constructUrl({\n scheme: 'exp',\n });\n }\n },\n });\n middleware.use(deepLinkMiddleware.getHandler());\n\n const serverRoot = getMetroServerRoot(this.projectRoot);\n\n const domComponentRenderer = createDomComponentsMiddleware(\n {\n metroRoot: serverRoot,\n projectRoot: this.projectRoot,\n },\n instanceMetroOptions\n );\n // Add support for DOM components.\n // TODO: Maybe put behind a flag for now?\n middleware.use(domComponentRenderer);\n\n middleware.use(\n new CreateFileMiddleware({\n metroRoot: serverRoot,\n projectRoot: this.projectRoot,\n appDir,\n }).getHandler()\n );\n\n // For providing info to the error overlay.\n middleware.use((req: ServerRequest, res: ServerResponse, next: ServerNext) => {\n // Use by `@expo/log-box` https://github.com/expo/expo/blob/f29b9f3715e42dca87bf3eebf11f7e7dd1ff73c1/packages/%40expo/log-box/src/utils/devServerEndpoints.ts#L82\n if (req.url?.startsWith('/_expo/error-overlay-meta')) {\n res.statusCode = 200;\n res.setHeader('Content-Type', 'application/json');\n res.end(\n JSON.stringify({\n projectRoot: this.projectRoot,\n serverRoot,\n sdkVersion: exp.sdkVersion,\n })\n );\n return;\n }\n return next();\n });\n\n // Append support for redirecting unhandled requests to the index.html page on web.\n if (this.isTargetingWeb()) {\n // This MUST be after the manifest middleware so it doesn't have a chance to serve the template `public/index.html`.\n middleware.use(new ServeStaticMiddleware(this.projectRoot).getHandler());\n\n // This should come after the static middleware so it doesn't serve the favicon from `public/favicon.ico`.\n middleware.use(new FaviconMiddleware(this.projectRoot).getHandler());\n }\n\n if (useServerRendering || isReactServerComponentsEnabled) {\n observeAnyFileChanges(\n {\n metro,\n server,\n },\n (events) => {\n if (hasApiRoutes) {\n // NOTE(EvanBacon): We aren't sure what files the API routes are using so we'll just invalidate\n // aggressively to ensure we always have the latest. The only caching we really get here is for\n // cases where the user is making subsequent requests to the same API route without changing anything.\n // This is useful for testing but pretty suboptimal. Luckily our caching is pretty aggressive so it makes\n // up for a lot of the overhead.\n this.invalidateApiRouteCache();\n } else if (!hasWarnedAboutApiRoutes()) {\n for (const event of events) {\n if (\n // If the user did not delete a file that matches the Expo Router API Route convention, then we should warn that\n // API Routes are not enabled in the project.\n event.metadata?.type !== 'd' &&\n // Ensure the file is in the project's routes directory to prevent false positives in monorepos.\n event.filePath.startsWith(appDir) &&\n isApiRouteConvention(event.filePath)\n ) {\n warnInvalidWebOutput();\n }\n }\n }\n\n // Handle loader file changes for HMR\n if (exp.extra?.router?.unstable_useServerDataLoaders) {\n for (const event of events) {\n if (event.metadata?.type !== 'd') {\n this.handleLoaderFileChange(event.filePath);\n }\n }\n }\n }\n );\n }\n\n // If React 19 is enabled, then add RSC middleware to the dev server.\n if (isReactServerComponentsEnabled) {\n this.bindRSCDevModuleInjectionHandler();\n const rscMiddleware = createServerComponentsMiddleware(this.projectRoot, {\n instanceMetroOptions: this.instanceMetroOptions,\n rscPath: '/_flight',\n ssrLoadModule: this.ssrLoadModule.bind(this),\n ssrLoadModuleArtifacts: this.metroImportAsArtifactsAsync.bind(this),\n useClientRouter: isReactServerActionsOnlyEnabled,\n createModuleId: metro._createModuleId.bind(metro),\n routerOptions,\n });\n this.rscRenderer = rscMiddleware;\n this.onReloadRscEvent = rscMiddleware.onReloadRscEvent;\n }\n\n // Append support for redirecting unhandled requests to the index.html page on web.\n if (this.isTargetingWeb()) {\n // Use `createRouteHandlerMiddleware()` when either of the following is true:\n // - Server rendering is enabled (server/static output)\n // - RSC is enabled. Even in `single` output mode, RSC needs the route handler\n if (!useServerRendering && !isReactServerComponentsEnabled) {\n middleware.use(\n new HistoryFallbackMiddleware(manifestMiddleware.getHandler().internal).getHandler()\n );\n } else {\n middleware.use(\n createRouteHandlerMiddleware(this.projectRoot, {\n appDir,\n routerRoot,\n config,\n ...config.exp.extra?.router,\n bundleApiRoute: (functionFilePath) =>\n this.ssrImportApiRoute(functionFilePath, { platform: 'web' }),\n executeLoaderAsync: async (route, request) => {\n const url = new URL(request.url);\n const resolvedLoaderRoute = fromServerManifestRoute(url.pathname, route);\n if (!resolvedLoaderRoute) {\n return undefined;\n }\n // Only pass the request in SSR mode (server output with SSR enabled).\n // In static mode, loaders should not receive request data.\n const isSSREnabled =\n exp.web?.output === 'server' &&\n exp.extra?.router?.unstable_useServerRendering === true;\n return this.executeServerDataLoaderAsync(\n url,\n resolvedLoaderRoute,\n isSSREnabled ? request : undefined\n );\n },\n getStaticPageAsync: async (pathname, route, request) => {\n // TODO: Add server rendering when RSC is enabled.\n if (isReactServerComponentsEnabled) {\n // NOTE: This is a temporary hack to return the SPA/template index.html in development when RSC is enabled.\n // While this technically works, it doesn't provide the correct experience of server rendering the React code to HTML first.\n const html = await manifestMiddleware.getSingleHtmlTemplateAsync();\n return { content: html };\n }\n\n // Non-RSC apps will bundle the static HTML for a given pathname and respond with it.\n return this.getStaticPageAsync(pathname, route, request);\n },\n rsc: isReactServerComponentsEnabled\n ? {\n path: '/_flight',\n handler: this.rscRenderer!.handler,\n }\n : undefined,\n })\n );\n }\n }\n } else {\n // If React 19 is enabled, then add RSC middleware to the dev server.\n if (isReactServerComponentsEnabled) {\n this.bindRSCDevModuleInjectionHandler();\n const rscMiddleware = createServerComponentsMiddleware(this.projectRoot, {\n instanceMetroOptions: this.instanceMetroOptions,\n rscPath: '/_flight',\n ssrLoadModule: this.ssrLoadModule.bind(this),\n ssrLoadModuleArtifacts: this.metroImportAsArtifactsAsync.bind(this),\n useClientRouter: isReactServerActionsOnlyEnabled,\n createModuleId: metro._createModuleId.bind(metro),\n routerOptions,\n });\n this.rscRenderer = rscMiddleware;\n }\n }\n // Extend the close method to ensure that we clean up the local info.\n const originalClose = server.close.bind(server);\n\n server.close = (callback?: (err?: Error) => void) => {\n return originalClose((err?: Error) => {\n this.instance = null;\n this.metro = null;\n this.hmrServer = null;\n this.ssrHmrClients = new Map();\n callback?.(err);\n });\n };\n\n this.metro = metro;\n this.hmrServer = hmrServer;\n return {\n server,\n location: {\n // The port is the main thing we want to send back.\n port: options.port,\n // localhost isn't always correct.\n host: 'localhost',\n // http is the only supported protocol on native.\n url: `http://localhost:${options.port}`,\n protocol: 'http',\n },\n middleware,\n messageSocket,\n };\n }\n\n private onReloadRscEvent: ((platform: string) => void) | null = null;\n\n private async registerSsrHmrAsync(url: string, onReload: (platform: string[]) => void) {\n if (!this.hmrServer || this.ssrHmrClients.has(url)) {\n return;\n }\n\n debug('[SSR] Register HMR:', url);\n\n const sendFn = (message: string) => {\n const data = JSON.parse(String(message)) as { type: string; body: any };\n\n switch (data.type) {\n case 'bundle-registered':\n case 'update-done':\n case 'update-start':\n break;\n case 'update':\n {\n const update = data.body;\n const {\n isInitialUpdate,\n added,\n modified,\n deleted,\n }: {\n isInitialUpdate?: boolean;\n added: {\n module: [number | string, string];\n sourceURL: string;\n sourceMappingURL: string;\n }[];\n modified: {\n module: [number | string, string];\n sourceURL: string;\n sourceMappingURL: string;\n }[];\n deleted: (number | string)[];\n } = update;\n\n const hasUpdate = added.length || modified.length || deleted.length;\n\n // NOTE: We throw away the updates and instead simply send a trigger to the client to re-fetch the server route.\n if (!isInitialUpdate && hasUpdate) {\n // Clear all SSR modules before sending the reload event. This ensures that the next event will rebuild the in-memory state from scratch.\n if (typeof globalThis.__c === 'function') globalThis.__c();\n\n const allModuleIds = new Set(\n [...added, ...modified].map((m) => m.module[0]).concat(deleted)\n );\n\n const platforms = unique(\n Array.from(allModuleIds)\n .map((moduleId) => {\n if (typeof moduleId !== 'string') {\n return null;\n }\n // Extract platforms from the module IDs.\n return moduleId.match(/[?&]platform=([\\w]+)/)?.[1] ?? null;\n })\n .filter(Boolean)\n ) as string[];\n\n onReload(platforms);\n }\n }\n break;\n case 'error':\n // GraphNotFound can mean that we have an issue in metroOptions where the URL doesn't match the object props.\n Log.error('[SSR] HMR Error: ' + JSON.stringify(data, null, 2));\n\n if (data.body?.type === 'GraphNotFoundError') {\n Log.error(\n 'Available SSR HMR keys:',\n `${this.metro?._bundler._revisionsByGraphId.keys()}`\n );\n }\n break;\n default:\n debug('Unknown HMR message:', data);\n break;\n }\n };\n\n const client = await this.hmrServer!.onClientConnect(url, sendFn);\n this.ssrHmrClients.set(url, client);\n // Opt in...\n client.optedIntoHMR = true;\n await this.hmrServer!._registerEntryPoint(client, url, sendFn);\n }\n\n public async waitForTypeScriptAsync(): Promise<boolean> {\n if (!this.instance) {\n throw new Error('Cannot wait for TypeScript without a running server.');\n }\n\n return new Promise<boolean>((resolve) => {\n if (!this.metro) {\n // This can happen when the run command is used and the server is already running in another\n // process. In this case we can't wait for the TypeScript check to complete because we don't\n // have access to the Metro server.\n debug('Skipping TypeScript check because Metro is not running (headless).');\n return resolve(false);\n }\n\n const off = metroWatchTypeScriptFiles({\n projectRoot: this.projectRoot,\n server: this.instance!.server,\n metro: this.metro,\n tsconfig: true,\n throttle: true,\n eventTypes: ['change', 'add'],\n callback: async () => {\n // Run once, this prevents the TypeScript project prerequisite from running on every file change.\n off();\n const { TypeScriptProjectPrerequisite } = await import(\n '../../doctor/typescript/TypeScriptProjectPrerequisite.js'\n );\n\n try {\n const req = new TypeScriptProjectPrerequisite(this.projectRoot);\n await req.bootstrapAsync();\n resolve(true);\n } catch (error: any) {\n // Ensure the process doesn't fail if the TypeScript check fails.\n // This could happen during the install.\n Log.log();\n Log.error(\n chalk.red`Failed to automatically setup TypeScript for your project. Try restarting the dev server to fix.`\n );\n Log.exception(error);\n resolve(false);\n }\n },\n });\n });\n }\n\n public async startTypeScriptServices() {\n return startTypescriptTypeGenerationAsync({\n server: this.instance?.server,\n metro: this.metro,\n projectRoot: this.projectRoot,\n });\n }\n\n protected getConfigModuleIds(): string[] {\n return ['./metro.config.js', './metro.config.json', './rn-cli.config.js'];\n }\n\n // API Routes\n\n private pendingRouteOperations = new Map<string, Promise<SSRModuleContentsResult | null>>();\n\n // Bundle the API Route with Metro and return the string contents to be evaluated in the server.\n private async bundleApiRoute(\n filePath: string,\n { platform }: { platform: string }\n ): Promise<SSRModuleContentsResult | null | undefined> {\n if (this.pendingRouteOperations.has(filePath)) {\n return this.pendingRouteOperations.get(filePath);\n }\n const bundleAsync = async (): Promise<SSRModuleContentsResult> => {\n try {\n debug('Bundle API route:', this.instanceMetroOptions.routerRoot, filePath);\n return await this.ssrLoadModuleContents(filePath, {\n isExporting: this.instanceMetroOptions.isExporting,\n platform,\n });\n } catch (error: any) {\n const appDir = this.instanceMetroOptions?.routerRoot\n ? path.join(this.projectRoot, this.instanceMetroOptions!.routerRoot!)\n : undefined;\n const relativePath = appDir ? path.relative(appDir, filePath) : filePath;\n\n // Expected errors: invalid syntax, missing resolutions.\n // Wrap with command error for better error messages.\n const err = new CommandError(\n 'API_ROUTE',\n chalk`Failed to bundle API Route: {bold ${relativePath}}\\n\\n` + error.message\n );\n\n for (const key in error) {\n err[key] = error[key];\n }\n\n throw err;\n } finally {\n // pendingRouteOperations.delete(filepath);\n }\n };\n const route = bundleAsync();\n\n this.pendingRouteOperations.set(filePath, route);\n return route;\n }\n\n private async ssrImportApiRoute(\n filePath: string,\n { platform }: { platform: string }\n ): Promise<null | Record<string, Function> | Response> {\n // TODO: Cache the evaluated function.\n try {\n const apiRoute = await this.bundleApiRoute(filePath, { platform });\n\n if (!apiRoute?.src) {\n return null;\n }\n return evalMetroNoHandling(this.projectRoot, apiRoute.src, apiRoute.filename);\n } catch (error) {\n // Format any errors that were thrown in the global scope of the evaluation.\n if (error instanceof Error) {\n try {\n const htmlServerError = await getErrorOverlayHtmlAsync({\n error,\n projectRoot: this.projectRoot,\n routerRoot: this.instanceMetroOptions.routerRoot!,\n });\n\n return new Response(htmlServerError, {\n status: 500,\n headers: {\n 'Content-Type': 'text/html',\n },\n });\n } catch (internalError) {\n debug('Failed to generate Metro server error UI for API Route error:', internalError);\n throw error;\n }\n } else {\n throw error;\n }\n }\n }\n\n private invalidateApiRouteCache() {\n this.pendingRouteOperations.clear();\n }\n\n /**\n * Execute a route's loader function. Used during development and SSG to fetch data required by\n * routes.\n *\n * This function is used during development and production builds, and **must** receive a valid\n * matched route.\n *\n * @experimental\n */\n async executeServerDataLoaderAsync(\n location: URL,\n route: ResolvedLoaderRoute,\n // The `request` object is only available when using SSR\n request?: ImmutableRequest\n ): Promise<Response | undefined> {\n const { exp } = getConfig(this.projectRoot);\n const { unstable_useServerDataLoaders, unstable_useServerRendering } = exp.extra?.router;\n\n if (!unstable_useServerDataLoaders) {\n throw new CommandError(\n 'LOADERS_NOT_ENABLED',\n 'Server data loaders are not enabled. Add `unstable_useServerDataLoaders` to your `expo-router` plugin config.'\n );\n }\n\n const { routerRoot } = this.instanceMetroOptions;\n assert(\n routerRoot != null,\n 'The server must be started before calling executeRouteLoaderAsync.'\n );\n\n try {\n debug(`Matched ${location.pathname} to file: ${route.file}`);\n\n const appDir = path.join(this.projectRoot, routerRoot);\n let modulePath = route.file;\n modulePath = path.isAbsolute(modulePath) ? modulePath : path.join(appDir, modulePath);\n modulePath = modulePath.replace(/\\.(js|ts)x?$/, '');\n\n debug('Using loader module path: ', modulePath);\n\n const routeModule = await this.ssrLoadModule<any>(modulePath, {\n environment: 'node',\n isLoaderBundle: true,\n });\n\n if (routeModule.loader) {\n // Register this module for loader HMR\n this.setupLoaderHmr(modulePath);\n\n const maybeResponse = await routeModule.loader(request, route.params);\n\n let data: unknown;\n if (maybeResponse instanceof Response) {\n debug('Loader returned Response for location:', location.pathname);\n\n // In SSR, preserve `Response` from the loader\n if (exp.web?.output === 'server' && unstable_useServerRendering) {\n return maybeResponse;\n }\n\n // In SSG, extract body\n data = await maybeResponse.json();\n } else {\n data = maybeResponse;\n }\n\n debug('Loader data:', data ?? null, ' for location:', location.pathname);\n return Response.json(data ?? null);\n }\n\n debug('No loader found for location:', location.pathname);\n return undefined;\n } catch (error: any) {\n throw new CommandError(\n 'LOADER_EXECUTION_FAILED',\n `Failed to execute loader for route \"${location.pathname}\": ${error.message}`\n );\n }\n }\n\n /**\n * Bundle a loader module with Metro and return the string contents.\n */\n private async bundleLoader(\n filePath: string,\n { platform }: { platform: string }\n ): Promise<SSRModuleContentsResult> {\n try {\n debug('Bundle loader:', filePath);\n return await this.ssrLoadModuleContents(filePath, {\n isExporting: this.instanceMetroOptions.isExporting,\n platform,\n environment: 'node',\n isLoaderBundle: true,\n });\n } catch (error: any) {\n debug('Failed to bundle loader:', filePath, ':', error.message);\n throw new CommandError(\n 'LOADER_BUNDLE',\n chalk`Failed to bundle loader: {bold ${filePath}}\\n\\n` + error.message\n );\n }\n }\n\n // Ensure the global is available for SSR CSS modules to inject client updates.\n private bindRSCDevModuleInjectionHandler() {\n // Used by SSR CSS modules to broadcast client updates.\n globalThis.__expo_rsc_inject_module = this.sendClientModule.bind(this);\n }\n\n // NOTE: This can only target a single platform at a time (web).\n // used for sending RSC CSS to the root client in development.\n private sendClientModule({ code, id }: { code: string; id: string }) {\n this.broadcastMessage('sendDevCommand', {\n name: 'module-import',\n data: {\n code,\n id,\n },\n });\n }\n\n // Metro HMR\n\n private setupHmr(url: URL) {\n const onReload = (platforms: string[] = []) => {\n // Send reload command to client from Fast Refresh code.\n\n if (!platforms.length) {\n // TODO: When is this called?\n this.broadcastMessage('sendDevCommand', {\n name: 'rsc-reload',\n });\n } else {\n for (const platform of platforms) {\n this.onReloadRscEvent?.(platform);\n this.broadcastMessage('sendDevCommand', {\n name: 'rsc-reload',\n platform,\n });\n }\n }\n };\n\n this.registerSsrHmrAsync(url.toString(), onReload);\n }\n\n private watchedLoaderFiles: Set<string> = new Set();\n\n private setupLoaderHmr(modulePath: string) {\n if (this.watchedLoaderFiles.has(modulePath)) {\n return;\n }\n this.watchedLoaderFiles.add(modulePath);\n\n debug('[Loader HMR] Registering loader file for HMR:', modulePath);\n }\n\n private handleLoaderFileChange(changedFilePath: string) {\n for (const loaderPath of this.watchedLoaderFiles) {\n const possibleExtensions = ['.tsx', '.ts', '.jsx', '.js'];\n const isLoaderFile = possibleExtensions.some(\n (ext) => changedFilePath === loaderPath + ext || changedFilePath === loaderPath\n );\n\n if (isLoaderFile) {\n debug('[Loader HMR] Loader file changed, triggering reload:', changedFilePath);\n this.broadcastMessage('sendDevCommand', {\n name: 'reload',\n });\n }\n }\n }\n\n // Direct Metro access\n\n // Emulates the Metro dev server .bundle endpoint without having to go through a server.\n private async _bundleDirectAsync(\n resolvedEntryFilePath: string,\n {\n transformOptions,\n resolverOptions,\n graphOptions,\n serializerOptions,\n }: {\n transformOptions: TransformInputOptions;\n resolverOptions: {\n customResolverOptions: CustomResolverOptions;\n dev: boolean;\n };\n serializerOptions: {\n output?: 'string' | ({} & string);\n modulesOnly: boolean;\n runModule: boolean;\n sourceMapUrl: string;\n sourceUrl: string;\n inlineSourceMap: boolean;\n excludeSource: boolean;\n };\n graphOptions: {\n shallow: boolean;\n lazy: boolean;\n };\n }\n ): Promise<BundleDirectResult> {\n assert(this.metro, 'Metro server must be running to bundle directly.');\n const config = this.metro._config;\n const buildNumber = this.metro.getNewBuildNumber();\n const bundlePerfLogger = config.unstable_perfLoggerFactory?.('BUNDLING_REQUEST', {\n key: buildNumber,\n });\n\n const onProgress = (transformedFileCount: number, totalFileCount: number) => {\n this.metro?._reporter?.update?.({\n buildID: getBuildID(buildNumber),\n type: 'bundle_transform_progressed',\n transformedFileCount,\n totalFileCount,\n });\n };\n\n const revPromise = this.getMetroRevision(resolvedEntryFilePath, {\n graphOptions,\n transformOptions,\n resolverOptions,\n });\n\n bundlePerfLogger?.point('resolvingAndTransformingDependencies_start');\n bundlePerfLogger?.annotate({\n bool: {\n initial_build: revPromise == null,\n },\n });\n this.metro?._reporter.update({\n buildID: getBuildID(buildNumber),\n bundleDetails: {\n bundleType: transformOptions.type,\n dev: transformOptions.dev,\n entryFile: resolvedEntryFilePath,\n minify: transformOptions.minify,\n platform: transformOptions.platform,\n customResolverOptions: resolverOptions.customResolverOptions,\n customTransformOptions: transformOptions.customTransformOptions ?? {},\n },\n isPrefetch: false,\n type: 'bundle_build_started',\n });\n\n try {\n let delta: DeltaResult;\n let revision: GraphRevision;\n\n try {\n // TODO: Some bug in Metro/RSC causes this to break when changing imports in server components.\n // We should resolve the bug because it results in ~6x faster bundling to reuse the graph revision.\n if (transformOptions.customTransformOptions?.environment === 'react-server') {\n const props = await this.metro.getBundler().initializeGraph(\n // NOTE: Using absolute path instead of relative input path is a breaking change.\n // entryFile,\n resolvedEntryFilePath,\n\n transformOptions,\n resolverOptions,\n {\n onProgress,\n shallow: graphOptions.shallow,\n lazy: graphOptions.lazy,\n }\n );\n delta = props.delta;\n revision = props.revision;\n } else {\n const props = await (revPromise != null\n ? this.metro.getBundler().updateGraph(await revPromise, false)\n : this.metro.getBundler().initializeGraph(\n // NOTE: Using absolute path instead of relative input path is a breaking change.\n // entryFile,\n resolvedEntryFilePath,\n\n transformOptions,\n resolverOptions,\n {\n onProgress,\n shallow: graphOptions.shallow,\n lazy: graphOptions.lazy,\n }\n ));\n delta = props.delta;\n revision = props.revision;\n }\n } catch (error) {\n attachImportStackToRootMessage(error);\n dropStackIfContainsCodeFrame(error);\n throw error;\n }\n\n bundlePerfLogger?.annotate({\n int: {\n graph_node_count: revision.graph.dependencies.size,\n },\n });\n bundlePerfLogger?.point('resolvingAndTransformingDependencies_end');\n bundlePerfLogger?.point('serializingBundle_start');\n\n const shouldAddToIgnoreList = this.metro._shouldAddModuleToIgnoreList.bind(this.metro);\n\n const serializer = this.getMetroSerializer();\n\n const options = {\n asyncRequireModulePath: await this.metro._resolveRelativePath(\n config.transformer.asyncRequireModulePath,\n {\n relativeTo: 'project',\n resolverOptions,\n transformOptions,\n }\n ),\n // ...serializerOptions,\n processModuleFilter: config.serializer.processModuleFilter,\n createModuleId: this.metro._createModuleId,\n getRunModuleStatement: config.serializer.getRunModuleStatement,\n globalPrefix: config.transformer.globalPrefix,\n includeAsyncPaths: graphOptions.lazy,\n dev: transformOptions.dev,\n projectRoot: config.projectRoot,\n modulesOnly: serializerOptions.modulesOnly,\n runBeforeMainModule: config.serializer.getModulesRunBeforeMainModule(\n resolvedEntryFilePath\n // path.relative(config.projectRoot, entryFile)\n ),\n runModule: serializerOptions.runModule,\n sourceMapUrl: serializerOptions.sourceMapUrl,\n sourceUrl: serializerOptions.sourceUrl,\n inlineSourceMap: serializerOptions.inlineSourceMap,\n serverRoot: config.server.unstable_serverRoot ?? config.projectRoot,\n shouldAddToIgnoreList,\n\n // TODO(@kitten): This is incoherently typed. The target should be typed to accept this coherently\n // but we have no type overrides or a proper type chain for this\n serializerOptions,\n };\n\n // TODO(@kitten): Yearns for a refactor. The typings here were and are questionable\n const bundle = await serializer(\n // NOTE: Using absolute path instead of relative input path is a breaking change.\n // entryFile,\n resolvedEntryFilePath,\n revision.prepend,\n revision.graph,\n options\n );\n\n this.metro._reporter.update({\n buildID: getBuildID(buildNumber),\n type: 'bundle_build_done',\n });\n\n bundlePerfLogger?.point('serializingBundle_end');\n\n let bundleCode: string | null = null;\n let bundleMap: string | null = null;\n\n if (serializerOptions.output === 'static') {\n try {\n const parsed = typeof bundle === 'string' ? JSON.parse(bundle) : bundle;\n\n assert(\n 'artifacts' in parsed && Array.isArray(parsed.artifacts),\n 'Expected serializer to return an object with key artifacts to contain an array of serial assets.'\n );\n\n const artifacts = parsed.artifacts as SerialAsset[];\n const assets = parsed.assets;\n\n const bundleCode = artifacts.filter((asset) => asset.type === 'js')[0];\n const bundleMap = artifacts.filter((asset) => asset.type === 'map')?.[0]?.source ?? '';\n\n return {\n numModifiedFiles: delta.reset\n ? delta.added.size + revision.prepend.length\n : delta.added.size + delta.modified.size + delta.deleted.size,\n lastModifiedDate: revision.date,\n nextRevId: revision.id,\n bundle: bundleCode.source,\n map: bundleMap,\n artifacts,\n assets,\n };\n } catch (error: any) {\n throw new Error(\n 'Serializer did not return expected format. The project copy of `expo/metro-config` may be out of date. Error: ' +\n error.message\n );\n }\n }\n\n if (typeof bundle === 'string') {\n bundleCode = bundle;\n\n // Create the source map in a second pass...\n let { prepend, graph } = revision;\n if (serializerOptions.modulesOnly) {\n prepend = [];\n }\n\n bundleMap = await sourceMapStringAsync(\n [\n //\n ...prepend,\n ...this.metro._getSortedModules(graph),\n ],\n {\n excludeSource: serializerOptions.excludeSource,\n processModuleFilter: config.serializer.processModuleFilter,\n shouldAddToIgnoreList,\n }\n );\n } else {\n bundleCode = bundle.code;\n bundleMap = bundle.map;\n }\n\n return {\n numModifiedFiles: delta.reset\n ? delta.added.size + revision.prepend.length\n : delta.added.size + delta.modified.size + delta.deleted.size,\n lastModifiedDate: revision.date,\n nextRevId: revision.id,\n bundle: bundleCode,\n map: bundleMap,\n };\n } catch (error: any) {\n // Mark the error so we know how to format and return it later.\n if (error) {\n error[IS_METRO_BUNDLE_ERROR_SYMBOL] = true;\n }\n\n this.metro._reporter.update({\n buildID: getBuildID(buildNumber),\n type: 'bundle_build_failed',\n });\n\n throw error;\n }\n }\n\n private getMetroSerializer() {\n return (\n this.metro?._config?.serializer.customSerializer ||\n ((entryPoint, preModules, graph, options) =>\n bundleToString(baseJSBundle(entryPoint, preModules, graph, options)).code)\n );\n }\n\n private getMetroRevision(\n resolvedEntryFilePath: string,\n {\n graphOptions,\n transformOptions,\n resolverOptions,\n }: {\n transformOptions: TransformInputOptions;\n resolverOptions: {\n customResolverOptions: CustomResolverOptions;\n dev: boolean;\n };\n graphOptions: {\n shallow: boolean;\n lazy: boolean;\n };\n }\n ) {\n assert(this.metro, 'Metro server must be running to bundle directly.');\n const config = this.metro._config;\n\n const graphId = getGraphId(resolvedEntryFilePath, transformOptions, {\n unstable_allowRequireContext: config.transformer.unstable_allowRequireContext,\n resolverOptions,\n shallow: graphOptions.shallow,\n lazy: graphOptions.lazy,\n });\n return this.metro.getBundler().getRevisionByGraphId(graphId);\n }\n\n private async resolveRelativePathAsync(\n moduleId: string,\n {\n resolverOptions,\n transformOptions,\n }: {\n transformOptions: TransformInputOptions;\n resolverOptions: {\n customResolverOptions: CustomResolverOptions;\n dev: boolean;\n };\n }\n ) {\n assert(this.metro, 'cannot invoke resolveRelativePathAsync without metro instance');\n return await this.metro._resolveRelativePath(convertPathToModuleSpecifier(moduleId), {\n relativeTo: 'server',\n resolverOptions,\n transformOptions,\n });\n }\n}\n\nfunction getBuildID(buildNumber: number): string {\n return buildNumber.toString(36);\n}\n\nfunction wrapBundle(str: string) {\n // Skip the metro runtime so debugging is a bit easier.\n // Replace the __r() call with an export statement.\n // Use gm to apply to the last require line. This is needed when the bundle has side-effects.\n return str.replace(/^(__r\\(.*\\);)$/gm, 'module.exports = $1');\n}\n\nasync function sourceMapStringAsync(\n modules: readonly Module[],\n options: SourceMapGeneratorOptions\n): Promise<string> {\n return (await sourceMapGeneratorNonBlocking(modules, options)).toString(undefined, {\n excludeSource: options.excludeSource,\n });\n}\n\nfunction unique<T>(array: T[]): T[] {\n return Array.from(new Set(array));\n}\n"],"names":["MetroBundlerDevServer","debug","require","EXPO_GO_METRO_PORT","DEV_CLIENT_METRO_PORT","BundlerDevServer","name","resolvePortAsync","options","port","devClient","Number","process","env","RCT_METRO_PORT","getFreePortAsync","exportServerRouteAsync","contents","artifactFilename","files","includeSourceMaps","descriptor","src","map","artifactBasename","encodeURIComponent","path","basename","replace","parsedMap","JSON","parse","mapData","stringify","version","sources","source","startsWith","projectRoot","relative","convertPathToModuleSpecifier","sourcesContent","Array","length","fill","names","mappings","targetDomain","set","fileData","exportMiddlewareAsync","manifest","appDir","outputDir","platform","middleware","middlewareFilePath","isAbsolute","file","join","bundleApiRoute","middlewareId","exportExpoRouterApiRoutesAsync","prerenderManifest","routerRoot","instanceMetroOptions","assert","getExpoRouterRoutesManifestAsync","Map","rscPath","isReactServerComponentsEnabled","apiRoutes","find","route","page","push","resolve","namedRegex","routeKeys","rsc","filepath","apiRouteId","htmlRoutes","exportExpoRouterRenderModuleAsync","renderModule","ssrLoadModuleContents","environment","exportExpoRouterLoadersAsync","entryPoints","entry","bundleLoader","pagePath","slice","loaderId","exp","getConfig","fetchManifest","extra","router","preserveRedirectAndRewrites","asJson","CommandError","getServerManifestAsync","getBuildTimeServerManifestAsync","getManifest","ssrLoadModule","isReactServerRoutesEnabled","serverManifest","htmlManifest","getStaticRenderFunctionAsync","url","getDevServerUrlOrAssert","getStaticContent","useServerRendering","unstable_useServerRendering","isExportingWithSSR","web","output","skipStaticParams","preserveApiRoutes","renderAsync","opts","location","URL","executeLoaderAsync","resolvedLoaderRoute","fromRuntimeManifestRoute","pathname","inflateManifest","undefined","executeServerDataLoaderAsync","getStaticResourcesAsync","mainModuleName","clientBoundaries","mode","minify","isExporting","baseUrl","reactCompiler","asyncRoutes","resolvedMainModuleName","resolveMainModuleName","metroImportAsArtifactsAsync","splitChunks","EXPO_NO_BUNDLE_SPLITTING","serializerIncludeMaps","lazy","EXPO_NO_METRO_LAZY","bytecode","getStaticPageAsync","request","devBundleUrlPathname","createBundleUrlPath","bundleStaticHtml","useServerDataLoaders","unstable_useServerDataLoaders","fromServerManifestRoute","loaderResult","loaderData","json","loader","data","artifacts","resources","staticHtml","Promise","all","content","serializeHtmlWithAssets","template","devBundleUrl","hydrate","EXPO_WEB_DEV_HYDRATE","filePath","specificOptions","results","serializerOutput","assets","filename","metroLoadModuleContents","extraOptions","inlineSourceMap","engine","expoBundleOptions","getMetroDirectBundleOptions","resolverOptions","customResolverOptions","dev","transformOptions","type","unstable_transformProfile","customTransformOptions","Object","create","resolvedEntryFilePath","resolveRelativePathAsync","createBundleOsPath","_bundleDirectAsync","graphOptions","shallow","serializerOptions","modulesOnly","runModule","sourceUrl","sourceMapUrl","bundle","rest","scriptContents","wrapBundle","cachedSourceMaps","nativeExportBundleAsync","singlePageReactServerComponentExportAsync","legacySinglePageExportBundleAsync","getReactServerReferences","unique","filter","a","artifact","metadata","reactServerReferences","ref","fileURLToFilePath","flat","Boolean","reactClientReferences","serverActionReferencesInServer","cssModules","rscRenderer","getExpoRouterClientReferencesAsync","domRoot","processClientBoundaries","newReactServerReferences","Error","allKnownReactServerReferences","nestedClientBoundaries","exportServerActionsAsync","hasUniqueClientBoundaries","some","boundary","includes","concat","serverRoot","getMetroServerRoot","clientBoundariesAsOpaqueIds","toPosixPath","moduleIdToSplitBundle","paths","values","reduce","acc","ssrManifest","keys","forEach","routerOptions","exportRoutesAsync","fromEntries","from","entries","key","value","watchEnvironmentVariables","instance","metro","envFiles","runtimeEnv","getFiles","NODE_ENV","fileName","observeFileChanges","server","load","force","startImplementationAsync","urlCreator","getUrlCreator","config","skipSDKVersionRequirement","experiments","reactServerComponentRoutes","reactServerFunctions","isReactServerActionsOnlyEnabled","hasApiRoutes","getBaseUrlFromExpoConfig","getAsyncRoutesFromExpoConfig","getRouterDirectoryModuleIdWithManifest","origin","configPath","dynamicConfigPath","staticConfigPath","configFileName","parsedOptions","maxWorkers","resetCache","resetDevServer","EXPO_DEV_SERVER_ORIGIN","hmrServer","messageSocket","instantiateMetroAsync","manifestMiddleware","getManifestMiddlewareAsync","prependMiddleware","ContextModuleSourceMapsMiddleware","getHandler","use","InterstitialPageMiddleware","scheme","DevToolsPluginMiddleware","devToolsPluginManager","deepLinkMiddleware","RuntimeRedirectMiddleware","getLocation","runtime","constructDevClientUrl","constructUrl","domComponentRenderer","createDomComponentsMiddleware","metroRoot","CreateFileMiddleware","req","res","next","statusCode","setHeader","end","sdkVersion","isTargetingWeb","ServeStaticMiddleware","FaviconMiddleware","observeAnyFileChanges","events","invalidateApiRouteCache","hasWarnedAboutApiRoutes","event","isApiRouteConvention","warnInvalidWebOutput","handleLoaderFileChange","bindRSCDevModuleInjectionHandler","rscMiddleware","createServerComponentsMiddleware","bind","ssrLoadModuleArtifacts","useClientRouter","createModuleId","_createModuleId","onReloadRscEvent","HistoryFallbackMiddleware","internal","createRouteHandlerMiddleware","functionFilePath","ssrImportApiRoute","isSSREnabled","html","getSingleHtmlTemplateAsync","handler","originalClose","close","callback","err","ssrHmrClients","host","protocol","registerSsrHmrAsync","onReload","has","sendFn","message","String","update","body","isInitialUpdate","added","modified","deleted","hasUpdate","globalThis","__c","allModuleIds","Set","m","module","platforms","moduleId","match","Log","error","_bundler","_revisionsByGraphId","client","onClientConnect","optedIntoHMR","_registerEntryPoint","waitForTypeScriptAsync","off","metroWatchTypeScriptFiles","tsconfig","throttle","eventTypes","TypeScriptProjectPrerequisite","bootstrapAsync","log","chalk","red","exception","startTypeScriptServices","startTypescriptTypeGenerationAsync","getConfigModuleIds","pendingRouteOperations","get","bundleAsync","relativePath","apiRoute","evalMetroNoHandling","htmlServerError","getErrorOverlayHtmlAsync","Response","status","headers","internalError","clear","modulePath","routeModule","isLoaderBundle","setupLoaderHmr","maybeResponse","params","__expo_rsc_inject_module","sendClientModule","code","id","broadcastMessage","setupHmr","toString","watchedLoaderFiles","add","changedFilePath","loaderPath","possibleExtensions","isLoaderFile","ext","_config","buildNumber","getNewBuildNumber","bundlePerfLogger","unstable_perfLoggerFactory","onProgress","transformedFileCount","totalFileCount","_reporter","buildID","getBuildID","revPromise","getMetroRevision","point","annotate","bool","initial_build","bundleDetails","bundleType","entryFile","isPrefetch","delta","revision","props","getBundler","initializeGraph","updateGraph","attachImportStackToRootMessage","dropStackIfContainsCodeFrame","int","graph_node_count","graph","dependencies","size","shouldAddToIgnoreList","_shouldAddModuleToIgnoreList","serializer","getMetroSerializer","asyncRequireModulePath","_resolveRelativePath","transformer","relativeTo","processModuleFilter","getRunModuleStatement","globalPrefix","includeAsyncPaths","runBeforeMainModule","getModulesRunBeforeMainModule","unstable_serverRoot","prepend","bundleCode","bundleMap","parsed","isArray","asset","numModifiedFiles","reset","lastModifiedDate","date","nextRevId","sourceMapStringAsync","_getSortedModules","excludeSource","IS_METRO_BUNDLE_ERROR_SYMBOL","customSerializer","entryPoint","preModules","bundleToString","baseJSBundle","graphId","getGraphId","unstable_allowRequireContext","getRevisionByGraphId","extras","getEmptyModulePath","resolver","emptyModulePath","hot","evalMetroAndWrapFunctions","str","modules","sourceMapGeneratorNonBlocking","array"],"mappings":"AAAA;;;;;CAKC;;;;+BAiJYA;;;eAAAA;;;;yBAhJyB;;;;;;;yBACH;;;;;;;iEACP;;;;;;;gEACH;;;;;;;yBAIlB;;;;;;;gEAYoB;;;;;;;gEACJ;;;;;;;gEAKJ;;;;;;;gEACD;;;;;;;gEAGD;;;;;;kDAKV;6CACsC;qCACE;kCACT;qCAM/B;2CACmC;wBAMnC;+BACiC;qDACkB;qBAMtC;sBACA;wBACS;0BACD;sBACK;kCACwC;0CAKlE;+BAKA;mDAC2C;sCACb;0CACI;yCACK;mCACZ;2CACQ;4CACC;oCACL;2CACI;uCACJ;8BAS/B;2BAC2B;+CAEiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCnD,MAAMC,QAAQC,QAAQ,SAAS;AAE/B,qDAAqD,GACrD,MAAMC,qBAAqB;AAE3B,iGAAiG,GACjG,MAAMC,wBAAwB;AAEvB,MAAMJ,8BAA8BK,kCAAgB;IAOzD,IAAIC,OAAe;QACjB,OAAO;IACT;IAEA,MAAMC,iBAAiBC,UAAwC,CAAC,CAAC,EAAmB;QAClF,MAAMC,OACJ,yEAAyE;QACzED,QAAQC,IAAI,IACZ,8DAA8D;QAC7DD,CAAAA,QAAQE,SAAS,GAEdC,OAAOC,QAAQC,GAAG,CAACC,cAAc,KAAKV,wBAEtC,MAAMW,IAAAA,sBAAgB,EAACZ,mBAAkB;QAE/C,OAAOM;IACT;IAEA,MAAcO,uBAAuB,EACnCC,QAAQ,EACRC,gBAAgB,EAChBC,KAAK,EACLC,iBAAiB,EACjBC,UAAU,EAQX,EAAE;QACD,IAAI,CAACJ,UAAU;QAEf,IAAIK,MAAML,SAASK,GAAG;QACtB,IAAIF,qBAAqBH,SAASM,GAAG,EAAE;YACrC,+DAA+D;YAC/D,uHAAuH;YACvH,wDAAwD;YAC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,QAAQ,CAAC9S,WAAW;QACjFoX,eAAe7e,QAAQ6e,aAAa;IACtC;AACF;AAEA,SAAS/R,OAAUmT,KAAU;IAC3B,OAAO/d,MAAMsN,IAAI,CAAC,IAAIyH,IAAIgJ;AAC5B"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/server/metro/MetroBundlerDevServer.ts"],"sourcesContent":["/**\n * Copyright © 2022 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { ExpoConfig, getConfig } from '@expo/config';\nimport { getMetroServerRoot } from '@expo/config/paths';\nimport * as runtimeEnv from '@expo/env';\nimport baseJSBundle from '@expo/metro/metro/DeltaBundler/Serializers/baseJSBundle';\nimport {\n sourceMapGeneratorNonBlocking,\n type SourceMapGeneratorOptions,\n} from '@expo/metro/metro/DeltaBundler/Serializers/sourceMapGenerator';\nimport type {\n Module,\n DeltaResult,\n TransformInputOptions,\n} from '@expo/metro/metro/DeltaBundler/types';\nimport type {\n default as MetroHmrServer,\n Client as MetroHmrClient,\n} from '@expo/metro/metro/HmrServer';\nimport type { GraphRevision } from '@expo/metro/metro/IncrementalBundler';\nimport type MetroServer from '@expo/metro/metro/Server';\nimport bundleToString from '@expo/metro/metro/lib/bundleToString';\nimport getGraphId from '@expo/metro/metro/lib/getGraphId';\nimport type { TransformProfile } from '@expo/metro/metro-babel-transformer';\nimport type { CustomResolverOptions } from '@expo/metro/metro-resolver';\nimport { SerialAsset } from '@expo/metro-config/build/serializer/serializerAssets';\nimport type { GetStaticContentOptions } from '@expo/router-server/build/static/renderStaticContent';\nimport assert from 'assert';\nimport chalk from 'chalk';\nimport type { RouteNode } from 'expo-router/build/Route';\nimport { type RouteInfo, type RoutesManifest, type ImmutableRequest } from 'expo-server/private';\nimport path from 'path';\n\nimport {\n createServerComponentsMiddleware,\n fileURLToFilePath,\n} from './createServerComponentsMiddleware';\nimport { createRouteHandlerMiddleware } from './createServerRouteMiddleware';\nimport { fetchManifest, inflateManifest } from './fetchRouterManifest';\nimport { instantiateMetroAsync } from './instantiateMetro';\nimport {\n attachImportStackToRootMessage,\n dropStackIfContainsCodeFrame,\n getErrorOverlayHtmlAsync,\n IS_METRO_BUNDLE_ERROR_SYMBOL,\n} from './metroErrorInterface';\nimport { metroWatchTypeScriptFiles } from './metroWatchTypeScriptFiles';\nimport {\n getRouterDirectoryModuleIdWithManifest,\n hasWarnedAboutApiRoutes,\n isApiRouteConvention,\n warnInvalidWebOutput,\n} from './router';\nimport { serializeHtmlWithAssets } from './serializeHtml';\nimport { observeAnyFileChanges, observeFileChanges } from './waitForMetroToObserveTypeScriptFile';\nimport type {\n BundleAssetWithFileHashes,\n ExportAssetDescriptor,\n ExportAssetMap,\n} from '../../../export/saveAssets';\nimport { Log } from '../../../log';\nimport { env } from '../../../utils/env';\nimport { CommandError } from '../../../utils/errors';\nimport { toPosixPath } from '../../../utils/filePath';\nimport { getFreePortAsync } from '../../../utils/port';\nimport { BundlerDevServer, BundlerStartOptions, DevServerInstance } from '../BundlerDevServer';\nimport {\n cachedSourceMaps,\n evalMetroAndWrapFunctions,\n evalMetroNoHandling,\n} from '../getStaticRenderFunctions';\nimport {\n fromRuntimeManifestRoute,\n fromServerManifestRoute,\n type ResolvedLoaderRoute,\n} from './resolveLoader';\nimport { ContextModuleSourceMapsMiddleware } from '../middleware/ContextModuleSourceMapsMiddleware';\nimport { CreateFileMiddleware } from '../middleware/CreateFileMiddleware';\nimport { DevToolsPluginMiddleware } from '../middleware/DevToolsPluginMiddleware';\nimport { createDomComponentsMiddleware } from '../middleware/DomComponentsMiddleware';\nimport { FaviconMiddleware } from '../middleware/FaviconMiddleware';\nimport { HistoryFallbackMiddleware } from '../middleware/HistoryFallbackMiddleware';\nimport { InterstitialPageMiddleware } from '../middleware/InterstitialPageMiddleware';\nimport { resolveMainModuleName } from '../middleware/ManifestMiddleware';\nimport { RuntimeRedirectMiddleware } from '../middleware/RuntimeRedirectMiddleware';\nimport { ServeStaticMiddleware } from '../middleware/ServeStaticMiddleware';\nimport {\n convertPathToModuleSpecifier,\n createBundleUrlPath,\n ExpoMetroOptions,\n createBundleOsPath,\n getAsyncRoutesFromExpoConfig,\n getBaseUrlFromExpoConfig,\n getMetroDirectBundleOptions,\n} from '../middleware/metroOptions';\nimport { prependMiddleware } from '../middleware/mutations';\nimport { ServerNext, ServerRequest, ServerResponse } from '../middleware/server.types';\nimport { startTypescriptTypeGenerationAsync } from '../type-generation/startTypescriptTypeGeneration';\n\nexport type ExpoRouterRuntimeManifest = Awaited<\n ReturnType<typeof import('@expo/router-server/build/static/renderStaticContent').getManifest>\n>;\n\ntype SSRLoadModuleFunc = <T extends Record<string, any>>(\n filePath: string | null,\n specificOptions?: Partial<ExpoMetroOptions>,\n extras?: { hot?: boolean }\n) => Promise<T>;\n\ninterface BundleDirectResult {\n numModifiedFiles: number;\n lastModifiedDate: Date;\n nextRevId: string;\n bundle: string;\n map: string;\n /** Defined if the output is multi-bundle. */\n artifacts?: SerialAsset[];\n assets?: readonly BundleAssetWithFileHashes[];\n}\n\ninterface MetroModuleContentsResult extends BundleDirectResult {\n filename: string;\n}\n\ninterface SSRModuleContentsResult extends Omit<BundleDirectResult, 'bundle'> {\n filename: string;\n src: string;\n map: string;\n}\n\n// TODO(@kitten): We access this here to run server-side code bundled by metro\n// It's not isolated into a worker thread yet\n// Check `metro-require/require.ts` for how this function is defined\ndeclare namespace globalThis {\n const __c: (() => void) | undefined;\n let __expo_rsc_inject_module: (params: { code: string; id: string }) => void | undefined;\n}\n\nconst debug = require('debug')('expo:start:server:metro') as typeof console.log;\n\n/** Default port to use for apps running in Expo Go. */\nconst EXPO_GO_METRO_PORT = 8081;\n\n/** Default port to use for apps that run in standard React Native projects or Expo Dev Clients. */\nconst DEV_CLIENT_METRO_PORT = 8081;\n\nexport class MetroBundlerDevServer extends BundlerDevServer {\n private metro: MetroServer | null = null;\n private hmrServer: MetroHmrServer<MetroHmrClient> | null = null;\n private ssrHmrClients: Map<string, MetroHmrClient> = new Map();\n isReactServerComponentsEnabled?: boolean;\n isReactServerRoutesEnabled?: boolean;\n\n get name(): string {\n return 'metro';\n }\n\n async resolvePortAsync(options: Partial<BundlerStartOptions> = {}): Promise<number> {\n const port =\n // If the manually defined port is busy then an error should be thrown...\n options.port ??\n // Otherwise use the default port based on the runtime target.\n (options.devClient\n ? // Don't check if the port is busy if we're using the dev client since most clients are hardcoded to 8081.\n Number(process.env.RCT_METRO_PORT) || DEV_CLIENT_METRO_PORT\n : // Otherwise (running in Expo Go) use a free port that falls back on the classic 8081 port.\n await getFreePortAsync(EXPO_GO_METRO_PORT));\n\n return port;\n }\n\n private async exportServerRouteAsync({\n contents,\n artifactFilename,\n files,\n includeSourceMaps,\n descriptor,\n }: {\n contents: { src: string; map?: any } | null | undefined;\n artifactFilename: string;\n files: ExportAssetMap;\n includeSourceMaps?: boolean;\n routeId?: string;\n descriptor: Partial<ExportAssetDescriptor>;\n }) {\n if (!contents) return;\n\n let src = contents.src;\n if (includeSourceMaps && contents.map) {\n // TODO(kitten): Merge the source map transformer in the future\n // https://github.com/expo/expo/blob/0dffdb15/packages/%40expo/metro-config/src/serializer/serializeChunks.ts#L422-L439\n // Alternatively, check whether `sourcesRoot` helps here\n const artifactBasename = encodeURIComponent(path.basename(artifactFilename) + '.map');\n src = src.replace(/\\/\\/# sourceMappingURL=.*/g, `//# sourceMappingURL=${artifactBasename}`);\n const parsedMap = typeof contents.map === 'string' ? JSON.parse(contents.map) : contents.map;\n const mapData: any = {\n ...descriptor,\n contents: JSON.stringify({\n version: parsedMap.version,\n sources: parsedMap.sources.map((source: string) => {\n source =\n typeof source === 'string' && source.startsWith(this.projectRoot)\n ? path.relative(this.projectRoot, source)\n : source;\n return convertPathToModuleSpecifier(source);\n }),\n sourcesContent: new Array(parsedMap.sources.length).fill(null),\n names: parsedMap.names,\n mappings: parsedMap.mappings,\n }),\n targetDomain: 'server',\n };\n files.set(artifactFilename + '.map', mapData);\n }\n const fileData: ExportAssetDescriptor = {\n ...descriptor,\n contents: src,\n targetDomain: 'server',\n };\n files.set(artifactFilename, fileData);\n }\n\n private async exportMiddlewareAsync({\n manifest,\n appDir,\n outputDir,\n files,\n platform,\n includeSourceMaps,\n }: {\n manifest: RoutesManifest;\n appDir: string;\n outputDir: string;\n files: ExportAssetMap;\n platform: string;\n includeSourceMaps?: boolean;\n }) {\n if (!manifest.middleware) return;\n\n const middlewareFilePath = path.isAbsolute(manifest.middleware.file)\n ? manifest.middleware.file\n : path.join(appDir, manifest.middleware.file);\n const contents = await this.bundleApiRoute(middlewareFilePath, { platform });\n const artifactFilename = convertPathToModuleSpecifier(\n path.join(outputDir, path.relative(appDir, middlewareFilePath.replace(/\\.[tj]sx?$/, '.js')))\n );\n\n await this.exportServerRouteAsync({\n contents,\n artifactFilename,\n files,\n includeSourceMaps,\n descriptor: {\n middlewareId: '/middleware',\n },\n });\n\n // Remap the middleware file to represent the output file.\n manifest.middleware.file = artifactFilename;\n }\n\n async exportExpoRouterApiRoutesAsync({\n includeSourceMaps,\n outputDir,\n prerenderManifest,\n platform,\n }: {\n includeSourceMaps?: boolean;\n outputDir: string;\n // This does not contain the API routes info.\n prerenderManifest: RoutesManifest<string>;\n platform: string;\n }): Promise<{ files: ExportAssetMap; manifest: RoutesManifest<string> }> {\n const { routerRoot } = this.instanceMetroOptions;\n assert(\n routerRoot != null,\n 'The server must be started before calling exportExpoRouterApiRoutesAsync.'\n );\n\n const appDir = path.join(this.projectRoot, routerRoot);\n const manifest = await this.getExpoRouterRoutesManifestAsync({ appDir });\n\n const files: ExportAssetMap = new Map();\n\n // Inject RSC middleware.\n const rscPath = '/_flight/[...rsc]';\n\n if (\n this.isReactServerComponentsEnabled &&\n // If the RSC route is not already in the manifest, add it.\n !manifest.apiRoutes.find((route) => route.page.startsWith('/_flight/'))\n ) {\n debug('Adding RSC route to the manifest:', rscPath);\n // NOTE: This might need to be sorted to the correct spot in the future.\n manifest.apiRoutes.push({\n // TODO(@kitten): This isn't great, we shouldn't be needing to rely on files like this\n // It might even be better to make templating strings since that'd be type-checked, but currently,\n // we rely on this being an entrypoint for Metro\n file: require.resolve('@expo/cli/static/template/[...rsc]+api.ts'),\n page: rscPath,\n namedRegex: '^/_flight(?:/(?<rsc>.+?))?(?:/)?$',\n routeKeys: { rsc: 'rsc' },\n });\n }\n\n await this.exportMiddlewareAsync({\n manifest,\n appDir,\n outputDir,\n files,\n platform,\n includeSourceMaps,\n });\n\n for (const route of manifest.apiRoutes) {\n const filepath = path.isAbsolute(route.file) ? route.file : path.join(appDir, route.file);\n const contents = await this.bundleApiRoute(filepath, { platform });\n\n const artifactFilename =\n route.page === rscPath\n ? // HACK: Add RSC renderer to the output...\n convertPathToModuleSpecifier(path.join(outputDir, '.' + rscPath + '.js'))\n : convertPathToModuleSpecifier(\n path.join(outputDir, path.relative(appDir, filepath.replace(/\\.[tj]sx?$/, '.js')))\n );\n\n await this.exportServerRouteAsync({\n contents,\n artifactFilename,\n files,\n includeSourceMaps,\n descriptor: {\n apiRouteId: route.page,\n },\n });\n // Remap the manifest files to represent the output files.\n route.file = artifactFilename;\n }\n\n return {\n manifest: {\n ...manifest,\n htmlRoutes: prerenderManifest.htmlRoutes,\n },\n files,\n };\n }\n\n /**\n * Bundle render module for use in SSR\n */\n async exportExpoRouterRenderModuleAsync({\n files,\n includeSourceMaps,\n platform = 'web',\n }: {\n files: ExportAssetMap;\n includeSourceMaps?: boolean;\n platform?: string;\n }) {\n const renderModule = await this.ssrLoadModuleContents(\n require.resolve('@expo/router-server/node/render.js'),\n {\n environment: 'node',\n platform,\n }\n );\n\n await this.exportServerRouteAsync({\n contents: renderModule,\n artifactFilename: '_expo/server/render.js',\n files,\n includeSourceMaps,\n descriptor: {\n // ssrRenderModule: true,\n targetDomain: 'server',\n },\n });\n\n return files;\n }\n\n /**\n * Export loader bundles as standalone JS files for SSR data loading.\n *\n * Each loader bundle contains only the `loader` export from the route file,\n * with all other exports (default, named) stripped out by the Babel plugin.\n * This keeps loader bundles small for efficient server-side execution.\n */\n async exportExpoRouterLoadersAsync({\n platform,\n entryPoints,\n files,\n outputDir,\n includeSourceMaps,\n }: {\n platform: string;\n entryPoints: { file: string; page: string }[];\n files: ExportAssetMap;\n outputDir: string;\n includeSourceMaps: boolean;\n }): Promise<void> {\n // NOTE(@hassankhan): Should we parallelize loader bundling?\n for (const entry of entryPoints) {\n const contents = await this.bundleLoader(entry.file, { platform });\n const pagePath = entry.page.startsWith('/') ? entry.page.slice(1) : entry.page;\n const artifactFilename = convertPathToModuleSpecifier(path.join(outputDir, pagePath + '.js'));\n\n await this.exportServerRouteAsync({\n contents,\n artifactFilename,\n files,\n includeSourceMaps,\n descriptor: {\n loaderId: entry.page,\n },\n });\n }\n }\n\n async getExpoRouterRoutesManifestAsync({ appDir }: { appDir: string }) {\n // getBuiltTimeServerManifest\n const { exp } = getConfig(this.projectRoot);\n const manifest = await fetchManifest(this.projectRoot, {\n ...exp.extra?.router,\n preserveRedirectAndRewrites: true,\n asJson: true,\n appDir,\n });\n\n if (!manifest) {\n throw new CommandError(\n 'EXPO_ROUTER_SERVER_MANIFEST',\n 'Unexpected error: server manifest could not be fetched.'\n );\n }\n\n return manifest;\n }\n\n async getServerManifestAsync(): Promise<{\n serverManifest: RoutesManifest<string>;\n htmlManifest: ExpoRouterRuntimeManifest;\n }> {\n const { exp } = getConfig(this.projectRoot);\n // NOTE: This could probably be folded back into `renderStaticContent` when expo-asset and font support RSC.\n const { getBuildTimeServerManifestAsync, getManifest } = await this.ssrLoadModule<\n typeof import('@expo/router-server/build/static/getServerManifest')\n >(require.resolve('@expo/router-server/build/static/getServerManifest.js'), {\n // Only use react-server environment when the routes are using react-server rendering by default.\n environment: this.isReactServerRoutesEnabled ? 'react-server' : 'node',\n });\n\n return {\n serverManifest: await getBuildTimeServerManifestAsync({ ...exp.extra?.router }),\n htmlManifest: await getManifest({ ...exp.extra?.router }),\n };\n }\n\n /**\n * This function is invoked when exporting via `expo export`\n */\n async getStaticRenderFunctionAsync(): Promise<{\n serverManifest: RoutesManifest<string>;\n manifest: ExpoRouterRuntimeManifest;\n renderAsync: (\n path: string,\n route: RouteNode,\n opts?: GetStaticContentOptions\n ) => Promise<string>;\n executeLoaderAsync: (path: string, route: RouteNode) => Promise<Response | undefined>;\n }> {\n const { routerRoot } = this.instanceMetroOptions;\n assert(\n routerRoot != null,\n 'The server must be started before calling getStaticRenderFunctionAsync.'\n );\n\n const appDir = path.join(this.projectRoot, routerRoot);\n const url = this.getDevServerUrlOrAssert();\n\n const { getStaticContent, getManifest, getBuildTimeServerManifestAsync } =\n await this.ssrLoadModule<\n typeof import('@expo/router-server/build/static/renderStaticContent')\n >(require.resolve('@expo/router-server/node/render.js'), {\n // This must always use the legacy rendering resolution (no `react-server`) because it leverages\n // the previous React SSG utilities which aren't available in React 19.\n environment: 'node',\n });\n\n const { exp } = getConfig(this.projectRoot);\n const useServerRendering = exp.extra?.router?.unstable_useServerRendering ?? false;\n const isExportingWithSSR =\n exp.web?.output === 'server' && useServerRendering && !this.isReactServerComponentsEnabled;\n\n const serverManifest = await getBuildTimeServerManifestAsync({\n ...exp.extra?.router,\n // Skip static params expansion in SSR mode, routes are matched at runtime instead\n skipStaticParams: isExportingWithSSR,\n });\n\n return {\n serverManifest,\n // Get routes from Expo Router.\n manifest: await getManifest({ preserveApiRoutes: false, ...exp.extra?.router }),\n // Get route generating function\n renderAsync: async (path, route, opts?) => {\n const location = new URL(path, url);\n return await getStaticContent(location, opts);\n },\n executeLoaderAsync: async (path, route) => {\n const location = new URL(path, url);\n\n const resolvedLoaderRoute = fromRuntimeManifestRoute(location.pathname, route, {\n serverManifest: inflateManifest(serverManifest),\n appDir,\n });\n\n if (!resolvedLoaderRoute) {\n return undefined;\n }\n\n return this.executeServerDataLoaderAsync(location, resolvedLoaderRoute);\n },\n };\n }\n\n async getStaticResourcesAsync({\n includeSourceMaps,\n mainModuleName,\n clientBoundaries = this.instanceMetroOptions.clientBoundaries ?? [],\n platform = 'web',\n }: {\n includeSourceMaps?: boolean;\n mainModuleName?: string;\n clientBoundaries?: string[];\n platform?: string;\n } = {}) {\n const { mode, minify, isExporting, baseUrl, reactCompiler, routerRoot, asyncRoutes } =\n this.instanceMetroOptions;\n assert(\n mode != null &&\n isExporting != null &&\n baseUrl != null &&\n routerRoot != null &&\n reactCompiler != null &&\n asyncRoutes != null,\n 'The server must be started before calling getStaticResourcesAsync.'\n );\n\n const resolvedMainModuleName =\n mainModuleName ?? './' + resolveMainModuleName(this.projectRoot, { platform });\n return await this.metroImportAsArtifactsAsync(resolvedMainModuleName, {\n splitChunks: isExporting && !env.EXPO_NO_BUNDLE_SPLITTING,\n platform,\n mode,\n minify,\n environment: 'client',\n serializerIncludeMaps: includeSourceMaps,\n mainModuleName: resolvedMainModuleName,\n lazy: !env.EXPO_NO_METRO_LAZY,\n asyncRoutes,\n baseUrl,\n isExporting,\n routerRoot,\n clientBoundaries,\n reactCompiler,\n bytecode: false,\n });\n }\n\n /**\n * This function is invoked when running in development via `expo start`\n */\n private async getStaticPageAsync(\n pathname: string,\n route: RouteInfo<RegExp>,\n request?: ImmutableRequest\n ) {\n const { exp } = getConfig(this.projectRoot);\n const { mode, isExporting, clientBoundaries, baseUrl, reactCompiler, routerRoot, asyncRoutes } =\n this.instanceMetroOptions;\n assert(\n mode != null &&\n isExporting != null &&\n baseUrl != null &&\n reactCompiler != null &&\n routerRoot != null &&\n asyncRoutes != null,\n 'The server must be started before calling getStaticPageAsync.'\n );\n const platform = 'web';\n\n const devBundleUrlPathname = createBundleUrlPath({\n splitChunks: isExporting && !env.EXPO_NO_BUNDLE_SPLITTING,\n platform,\n mode,\n environment: 'client',\n reactCompiler,\n mainModuleName: resolveMainModuleName(this.projectRoot, { platform }),\n lazy: !env.EXPO_NO_METRO_LAZY,\n baseUrl,\n isExporting,\n asyncRoutes,\n routerRoot,\n clientBoundaries,\n bytecode: false,\n });\n\n const bundleStaticHtml = async (): Promise<string> => {\n const { getStaticContent } = await this.ssrLoadModule<\n typeof import('@expo/router-server/build/static/renderStaticContent')\n >(require.resolve('@expo/router-server/node/render.js'), {\n // This must always use the legacy rendering resolution (no `react-server`) because it leverages\n // the previous React SSG utilities which aren't available in React 19.\n environment: 'node',\n minify: false,\n isExporting,\n platform,\n });\n\n const location = new URL(pathname, this.getDevServerUrlOrAssert());\n\n const useServerDataLoaders = exp.extra?.router?.unstable_useServerDataLoaders;\n if (!useServerDataLoaders) {\n return await getStaticContent(location);\n }\n\n const resolvedLoaderRoute = fromServerManifestRoute(location.pathname, route);\n if (!resolvedLoaderRoute) {\n return await getStaticContent(location);\n }\n\n const loaderResult = await this.executeServerDataLoaderAsync(\n location,\n resolvedLoaderRoute,\n request\n );\n if (!loaderResult) {\n return await getStaticContent(location);\n }\n\n const loaderData = await loaderResult.json();\n return await getStaticContent(location, { loader: { data: loaderData } });\n };\n\n const [{ artifacts: resources }, staticHtml] = await Promise.all([\n this.getStaticResourcesAsync({\n clientBoundaries: [],\n }),\n bundleStaticHtml(),\n ]);\n const content = serializeHtmlWithAssets({\n isExporting,\n resources,\n template: staticHtml,\n devBundleUrl: devBundleUrlPathname,\n baseUrl,\n hydrate: env.EXPO_WEB_DEV_HYDRATE,\n });\n return {\n content,\n resources,\n };\n }\n\n // Set when the server is started.\n private instanceMetroOptions: Partial<ExpoMetroOptions> = {};\n\n private ssrLoadModule: SSRLoadModuleFunc = async (\n filePath,\n specificOptions = {},\n extras = {}\n ) => {\n // NOTE(@kitten): We don't properly initialize the server-side modules\n // Instead, we first load an entrypoint with an empty bundle to initialize the runtime instead\n // See: ./createServerComponentsMiddleware.ts\n const getEmptyModulePath = () => {\n assert(this.metro, 'Metro server must be running to load SSR modules.');\n return this.metro._config.resolver.emptyModulePath;\n };\n\n const res = await this.ssrLoadModuleContents(filePath ?? getEmptyModulePath(), specificOptions);\n\n if (\n // TODO: hot should be a callback function for invalidating the related SSR module.\n extras.hot &&\n this.instanceMetroOptions.isExporting !== true\n ) {\n // Register SSR HMR\n const serverRoot = getMetroServerRoot(this.projectRoot);\n const relativePath = path.relative(serverRoot, res.filename);\n const url = new URL(relativePath, this.getDevServerUrlOrAssert());\n this.setupHmr(url);\n }\n\n return evalMetroAndWrapFunctions(\n this.projectRoot,\n res.src,\n res.filename,\n specificOptions.isExporting ?? this.instanceMetroOptions.isExporting!\n );\n };\n\n private async metroImportAsArtifactsAsync(\n filePath: string,\n specificOptions: Partial<Omit<ExpoMetroOptions, 'serializerOutput'>> = {}\n ) {\n const results = await this.ssrLoadModuleContents(filePath, {\n serializerOutput: 'static',\n ...specificOptions,\n });\n\n // NOTE: This could potentially need more validation in the future.\n if (results.artifacts && results.assets) {\n return {\n artifacts: results.artifacts,\n assets: results.assets,\n src: results.src,\n filename: results.filename,\n map: results.map,\n };\n }\n throw new CommandError('Invalid bundler results: ' + results);\n }\n\n private async metroLoadModuleContents(\n filePath: string,\n specificOptions: ExpoMetroOptions,\n extraOptions: {\n sourceMapUrl?: string;\n unstable_transformProfile?: TransformProfile;\n } = {}\n ): Promise<MetroModuleContentsResult> {\n const { baseUrl } = this.instanceMetroOptions;\n assert(baseUrl != null, 'The server must be started before calling metroLoadModuleContents.');\n\n const opts: ExpoMetroOptions = {\n // TODO: Possibly issues with using an absolute path here...\n // mainModuleName: filePath,\n lazy: false,\n asyncRoutes: false,\n inlineSourceMap: false,\n engine: 'hermes',\n minify: false,\n // bytecode: false,\n // Bundle in Node.js mode for SSR.\n environment: 'node',\n // platform: 'web',\n // mode: 'development',\n //\n ...this.instanceMetroOptions,\n baseUrl,\n // routerRoot,\n // isExporting,\n ...specificOptions,\n };\n\n const expoBundleOptions = getMetroDirectBundleOptions(opts);\n\n const resolverOptions = {\n customResolverOptions: expoBundleOptions.customResolverOptions ?? {},\n dev: expoBundleOptions.dev ?? true,\n };\n\n const transformOptions: TransformInputOptions = {\n dev: expoBundleOptions.dev ?? true,\n minify: expoBundleOptions.minify ?? false,\n type: 'module',\n unstable_transformProfile:\n extraOptions.unstable_transformProfile ??\n expoBundleOptions.unstable_transformProfile ??\n 'default',\n customTransformOptions: expoBundleOptions.customTransformOptions ?? Object.create(null),\n platform: expoBundleOptions.platform ?? 'web',\n };\n\n const resolvedEntryFilePath = await this.resolveRelativePathAsync(filePath, {\n resolverOptions,\n transformOptions,\n });\n\n const filename = createBundleOsPath({\n ...opts,\n mainModuleName: resolvedEntryFilePath,\n });\n\n // https://github.com/facebook/metro/blob/2405f2f6c37a1b641cc379b9c733b1eff0c1c2a1/packages/metro/src/lib/parseOptionsFromUrl.js#L55-L87\n // TODO(@kitten): We've flagged this way of \"direct transpilation\" for replacement, since it's hard to maintain\n // It's possible that the intention here was to do something like what `exportEmbedAsync` is doing (using Server.DEFAULT_BUNDLE_OPTIONS)\n // That's why the defaults were added to match types. It's unclear though if that was correct\n // Maybe the `Server.DEFAULT_BUNDLE_OPTIONS` logic should be hoisted into `getMetroDirectBundleOptions`?\n const results = await this._bundleDirectAsync(resolvedEntryFilePath, {\n graphOptions: {\n lazy: expoBundleOptions.lazy ?? false,\n shallow: expoBundleOptions.shallow ?? false,\n },\n resolverOptions,\n serializerOptions: {\n ...expoBundleOptions.serializerOptions,\n inlineSourceMap: expoBundleOptions.inlineSourceMap ?? false,\n modulesOnly: expoBundleOptions.modulesOnly ?? false,\n runModule: expoBundleOptions.runModule ?? true,\n sourceUrl: expoBundleOptions.sourceUrl!,\n sourceMapUrl: extraOptions.sourceMapUrl ?? expoBundleOptions.sourceMapUrl!,\n },\n transformOptions,\n });\n\n return {\n ...results,\n filename,\n };\n }\n\n private async ssrLoadModuleContents(\n filePath: string,\n specificOptions: Partial<ExpoMetroOptions> = {}\n ): Promise<SSRModuleContentsResult> {\n const { baseUrl, routerRoot, isExporting } = this.instanceMetroOptions;\n assert(\n baseUrl != null && routerRoot != null && isExporting != null,\n 'The server must be started before calling ssrLoadModuleContents.'\n );\n\n const opts: ExpoMetroOptions = {\n // TODO: Possibly issues with using an absolute path here...\n mainModuleName: convertPathToModuleSpecifier(filePath),\n lazy: false,\n asyncRoutes: false,\n inlineSourceMap: false,\n engine: 'hermes',\n minify: false,\n bytecode: false,\n // Bundle in Node.js mode for SSR unless RSC is enabled.\n environment: this.isReactServerComponentsEnabled ? 'react-server' : 'node',\n platform: 'web',\n mode: 'development',\n //\n ...this.instanceMetroOptions,\n\n // Mostly disable compiler in SSR bundles.\n reactCompiler: false,\n baseUrl,\n routerRoot,\n isExporting,\n\n ...specificOptions,\n };\n\n // https://github.com/facebook/metro/blob/2405f2f6c37a1b641cc379b9c733b1eff0c1c2a1/packages/metro/src/lib/parseOptionsFromUrl.js#L55-L87\n const { filename, bundle, map, ...rest } = await this.metroLoadModuleContents(filePath, opts);\n const scriptContents = wrapBundle(bundle);\n\n if (map) {\n debug('Registering SSR source map for:', filename);\n cachedSourceMaps.set(filename, { url: this.projectRoot, map });\n } else {\n debug('No SSR source map found for:', filename);\n }\n\n return {\n ...rest,\n src: scriptContents,\n filename,\n map,\n };\n }\n\n async nativeExportBundleAsync(\n exp: ExpoConfig,\n options: Omit<\n ExpoMetroOptions,\n 'routerRoot' | 'asyncRoutes' | 'isExporting' | 'serializerOutput' | 'environment'\n >,\n files: ExportAssetMap,\n extraOptions: {\n sourceMapUrl?: string;\n unstable_transformProfile?: TransformProfile;\n } = {}\n ): Promise<{\n artifacts: SerialAsset[];\n assets: readonly BundleAssetWithFileHashes[];\n files?: ExportAssetMap;\n }> {\n if (this.isReactServerComponentsEnabled) {\n return this.singlePageReactServerComponentExportAsync(exp, options, files, extraOptions);\n }\n\n return this.legacySinglePageExportBundleAsync(options, extraOptions);\n }\n\n private async singlePageReactServerComponentExportAsync(\n exp: ExpoConfig,\n options: Omit<\n ExpoMetroOptions,\n 'baseUrl' | 'routerRoot' | 'asyncRoutes' | 'isExporting' | 'serializerOutput' | 'environment'\n >,\n files: ExportAssetMap,\n extraOptions: {\n sourceMapUrl?: string;\n unstable_transformProfile?: TransformProfile;\n } = {}\n ): Promise<{\n artifacts: SerialAsset[];\n assets: readonly BundleAssetWithFileHashes[];\n files: ExportAssetMap;\n }> {\n const getReactServerReferences = (artifacts: SerialAsset[]): string[] => {\n // Get the React server action boundaries from the client bundle.\n return unique(\n artifacts\n .filter((a) => a.type === 'js')\n .map((artifact) =>\n artifact.metadata.reactServerReferences?.map((ref) => fileURLToFilePath(ref))\n )\n // TODO: Segment by module for splitting.\n .flat()\n .filter(Boolean) as string[]\n );\n };\n\n // NOTE(EvanBacon): This will not support any code elimination since it's a static pass.\n let {\n reactClientReferences: clientBoundaries,\n reactServerReferences: serverActionReferencesInServer,\n cssModules,\n } = await this.rscRenderer!.getExpoRouterClientReferencesAsync(\n {\n platform: options.platform,\n domRoot: options.domRoot,\n },\n files\n );\n\n // TODO: The output keys should be in production format or use a lookup manifest.\n\n const processClientBoundaries = async (\n reactServerReferences: string[]\n ): Promise<{\n artifacts: SerialAsset[];\n assets: readonly BundleAssetWithFileHashes[];\n }> => {\n debug('Evaluated client boundaries:', clientBoundaries);\n\n // Run metro bundler and create the JS bundles/source maps.\n const bundle = await this.legacySinglePageExportBundleAsync(\n {\n ...options,\n clientBoundaries,\n },\n extraOptions\n );\n\n // Get the React server action boundaries from the client bundle.\n const newReactServerReferences = getReactServerReferences(bundle.artifacts);\n\n if (!newReactServerReferences) {\n // Possible issue with babel plugin / metro-config.\n throw new Error(\n 'Static server action references were not returned from the Metro client bundle'\n );\n }\n debug('React server action boundaries from client:', newReactServerReferences);\n\n const allKnownReactServerReferences = unique([\n ...reactServerReferences,\n ...newReactServerReferences,\n ]);\n\n // When we export the server actions that were imported from the client, we may need to re-bundle the client with the new client boundaries.\n const { clientBoundaries: nestedClientBoundaries } =\n await this.rscRenderer!.exportServerActionsAsync(\n {\n platform: options.platform,\n domRoot: options.domRoot,\n entryPoints: allKnownReactServerReferences,\n },\n files\n );\n\n // TODO: Check against all modules in the initial client bundles.\n const hasUniqueClientBoundaries = nestedClientBoundaries.some(\n (boundary) => !clientBoundaries.includes(boundary)\n );\n\n if (!hasUniqueClientBoundaries) {\n return bundle;\n }\n\n debug('Re-bundling client with nested client boundaries:', nestedClientBoundaries);\n\n clientBoundaries = unique(clientBoundaries.concat(nestedClientBoundaries));\n\n // Re-bundle the client with the new client boundaries that only exist in server actions that were imported from the client.\n // Run metro bundler and create the JS bundles/source maps.\n return processClientBoundaries(allKnownReactServerReferences);\n };\n\n const bundle = await processClientBoundaries(serverActionReferencesInServer);\n\n // Inject the global CSS that was imported during the server render.\n bundle.artifacts.push(...cssModules);\n\n const serverRoot = getMetroServerRoot(this.projectRoot);\n\n // HACK: Maybe this should be done in the serializer.\n const clientBoundariesAsOpaqueIds = clientBoundaries.map((boundary) =>\n // NOTE(cedric): relative module specifiers / IDs should always be POSIX formatted\n toPosixPath(path.relative(serverRoot, boundary))\n );\n const moduleIdToSplitBundle = (\n bundle.artifacts\n .map((artifact) => artifact?.metadata?.paths && Object.values(artifact.metadata.paths))\n .filter(Boolean)\n .flat() as Record<string, string>[]\n ).reduce((acc, paths) => ({ ...acc, ...paths }), {});\n\n debug('SSR Manifest:', moduleIdToSplitBundle, clientBoundariesAsOpaqueIds);\n\n const ssrManifest = new Map<string, string | null>();\n\n if (Object.keys(moduleIdToSplitBundle).length) {\n clientBoundariesAsOpaqueIds.forEach((boundary) => {\n if (boundary in moduleIdToSplitBundle) {\n ssrManifest.set(boundary, moduleIdToSplitBundle[boundary]);\n } else {\n throw new Error(\n `Could not find boundary \"${boundary}\" in the SSR manifest. Available: ${Object.keys(moduleIdToSplitBundle).join(', ')}`\n );\n }\n });\n } else {\n // Native apps with bundle splitting disabled.\n debug('No split bundles');\n clientBoundariesAsOpaqueIds.forEach((boundary) => {\n ssrManifest.set(boundary, null);\n });\n }\n\n const routerOptions = exp.extra?.router;\n\n // Export the static RSC files\n await this.rscRenderer!.exportRoutesAsync(\n {\n platform: options.platform,\n ssrManifest,\n routerOptions,\n },\n files\n );\n\n // Save the SSR manifest so we can perform more replacements in the server renderer and with server actions.\n files.set(`_expo/rsc/${options.platform}/ssr-manifest.js`, {\n targetDomain: 'server',\n contents:\n 'module.exports = ' +\n JSON.stringify(\n // TODO: Add a less leaky version of this across the framework with just [key, value] (module ID, chunk).\n Object.fromEntries(\n Array.from(ssrManifest.entries()).map(([key, value]) => [\n // Must match babel plugin.\n './' + toPosixPath(path.relative(this.projectRoot, path.join(serverRoot, key))),\n [key, value],\n ])\n )\n ),\n });\n\n return { ...bundle, files };\n }\n\n async legacySinglePageExportBundleAsync(\n options: Omit<\n ExpoMetroOptions,\n 'routerRoot' | 'asyncRoutes' | 'isExporting' | 'serializerOutput' | 'environment' | 'hosted'\n >,\n extraOptions: {\n sourceMapUrl?: string;\n unstable_transformProfile?: TransformProfile;\n } = {}\n ): Promise<{ artifacts: SerialAsset[]; assets: readonly BundleAssetWithFileHashes[] }> {\n const { baseUrl, routerRoot, isExporting } = this.instanceMetroOptions;\n assert(options.mainModuleName != null, 'mainModuleName must be provided in options.');\n assert(\n baseUrl != null && routerRoot != null && isExporting != null,\n 'The server must be started before calling legacySinglePageExportBundleAsync.'\n );\n\n const opts: ExpoMetroOptions = {\n ...this.instanceMetroOptions,\n baseUrl,\n routerRoot,\n isExporting,\n ...options,\n environment: 'client',\n serializerOutput: 'static',\n };\n\n // https://github.com/facebook/metro/blob/2405f2f6c37a1b641cc379b9c733b1eff0c1c2a1/packages/metro/src/lib/parseOptionsFromUrl.js#L55-L87\n if (!opts.mainModuleName.startsWith('/') && !path.isAbsolute(opts.mainModuleName)) {\n opts.mainModuleName = './' + opts.mainModuleName;\n }\n\n const output = await this.metroLoadModuleContents(opts.mainModuleName, opts, extraOptions);\n\n return {\n artifacts: output.artifacts!,\n assets: output.assets!,\n };\n }\n\n async watchEnvironmentVariables() {\n if (!this.instance) {\n throw new Error(\n 'Cannot observe environment variable changes without a running Metro instance.'\n );\n }\n if (!this.metro) {\n // This can happen when the run command is used and the server is already running in another\n // process.\n debug('Skipping Environment Variable observation because Metro is not running (headless).');\n return;\n }\n\n const envFiles = runtimeEnv\n .getFiles(process.env.NODE_ENV)\n .map((fileName) => path.join(this.projectRoot, fileName));\n\n observeFileChanges(\n {\n metro: this.metro,\n server: this.instance.server,\n },\n envFiles,\n () => {\n debug('Reloading environment variables...');\n // Force reload the environment variables.\n runtimeEnv.load(this.projectRoot, { force: true });\n }\n );\n }\n\n rscRenderer: Awaited<ReturnType<typeof createServerComponentsMiddleware>> | null = null;\n\n protected async startImplementationAsync(\n options: BundlerStartOptions\n ): Promise<DevServerInstance> {\n options.port = await this.resolvePortAsync(options);\n this.urlCreator = this.getUrlCreator(options);\n\n const config = getConfig(this.projectRoot, { skipSDKVersionRequirement: true });\n const { exp } = config;\n // NOTE: This will change in the future when it's less experimental, we enable React 19, and turn on more RSC flags by default.\n const isReactServerComponentsEnabled =\n !!exp.experiments?.reactServerComponentRoutes || !!exp.experiments?.reactServerFunctions;\n const isReactServerActionsOnlyEnabled =\n !exp.experiments?.reactServerComponentRoutes && !!exp.experiments?.reactServerFunctions;\n this.isReactServerComponentsEnabled = isReactServerComponentsEnabled;\n this.isReactServerRoutesEnabled = !!exp.experiments?.reactServerComponentRoutes;\n\n const useServerRendering = ['static', 'server'].includes(exp.web?.output ?? '');\n const hasApiRoutes = isReactServerComponentsEnabled || exp.web?.output === 'server';\n const baseUrl = getBaseUrlFromExpoConfig(exp);\n const asyncRoutes = getAsyncRoutesFromExpoConfig(exp, options.mode ?? 'development', 'web');\n const routerRoot = getRouterDirectoryModuleIdWithManifest(this.projectRoot, exp);\n const reactCompiler = !!exp.experiments?.reactCompiler;\n const appDir = path.join(this.projectRoot, routerRoot);\n const mode = options.mode ?? 'development';\n\n const routerOptions = exp.extra?.router;\n\n if (isReactServerComponentsEnabled && exp.web?.output === 'static') {\n throw new CommandError(\n `Experimental server component support does not support 'web.output: ${exp.web!.output}' yet. Use 'web.output: \"server\"' during the experimental phase.`\n );\n }\n\n // Error early about the window.location polyfill when React Server Components are enabled.\n if (isReactServerComponentsEnabled && exp?.extra?.router?.origin === false) {\n const configPath = config.dynamicConfigPath ?? config.staticConfigPath ?? '/app.json';\n const configFileName = path.basename(configPath);\n throw new CommandError(\n `The Expo Router \"origin\" property in the Expo config (${configFileName}) cannot be \"false\" when React Server Components is enabled. Remove it from the ${configFileName} file and try again.`\n );\n }\n\n const instanceMetroOptions = {\n isExporting: !!options.isExporting,\n baseUrl,\n mode,\n routerRoot,\n reactCompiler,\n minify: options.minify,\n asyncRoutes,\n // Options that are changing between platforms like engine, platform, and environment aren't set here.\n };\n this.instanceMetroOptions = instanceMetroOptions;\n\n const parsedOptions = {\n host: options.location.hostType === 'localhost' ? 'localhost' : undefined,\n port: options.port,\n maxWorkers: options.maxWorkers,\n resetCache: options.resetDevServer,\n };\n\n // Required for symbolication:\n process.env.EXPO_DEV_SERVER_ORIGIN = `http://localhost:${options.port}`;\n\n const { metro, hmrServer, server, middleware, messageSocket } = await instantiateMetroAsync(\n this,\n parsedOptions,\n {\n isExporting: !!options.isExporting,\n exp,\n }\n );\n\n if (!options.isExporting) {\n const manifestMiddleware = await this.getManifestMiddlewareAsync(options);\n\n // Important that we noop source maps for context modules as soon as possible.\n prependMiddleware(middleware, new ContextModuleSourceMapsMiddleware().getHandler());\n\n // We need the manifest handler to be the first middleware to run so our\n // routes take precedence over static files. For example, the manifest is\n // served from '/' and if the user has an index.html file in their project\n // then the manifest handler will never run, the static middleware will run\n // and serve index.html instead of the manifest.\n // https://github.com/expo/expo/issues/13114\n prependMiddleware(middleware, manifestMiddleware.getHandler());\n\n middleware.use(\n new InterstitialPageMiddleware(this.projectRoot, {\n // TODO: Prevent this from becoming stale.\n scheme: options.location.scheme ?? null,\n }).getHandler()\n );\n middleware.use(\n new DevToolsPluginMiddleware(this.projectRoot, this.devToolsPluginManager).getHandler()\n );\n\n const deepLinkMiddleware = new RuntimeRedirectMiddleware(this.projectRoot, {\n getLocation: ({ runtime }) => {\n if (runtime === 'custom') {\n return this.urlCreator?.constructDevClientUrl();\n } else {\n return this.urlCreator?.constructUrl({\n scheme: 'exp',\n });\n }\n },\n });\n middleware.use(deepLinkMiddleware.getHandler());\n\n const serverRoot = getMetroServerRoot(this.projectRoot);\n\n const domComponentRenderer = createDomComponentsMiddleware(\n {\n metroRoot: serverRoot,\n projectRoot: this.projectRoot,\n },\n instanceMetroOptions\n );\n // Add support for DOM components.\n // TODO: Maybe put behind a flag for now?\n middleware.use(domComponentRenderer);\n\n middleware.use(\n new CreateFileMiddleware({\n metroRoot: serverRoot,\n projectRoot: this.projectRoot,\n appDir,\n }).getHandler()\n );\n\n // For providing info to the error overlay.\n middleware.use((req: ServerRequest, res: ServerResponse, next: ServerNext) => {\n // Use by `@expo/log-box` https://github.com/expo/expo/blob/f29b9f3715e42dca87bf3eebf11f7e7dd1ff73c1/packages/%40expo/log-box/src/utils/devServerEndpoints.ts#L82\n if (req.url?.startsWith('/_expo/error-overlay-meta')) {\n res.statusCode = 200;\n res.setHeader('Content-Type', 'application/json');\n res.end(\n JSON.stringify({\n projectRoot: this.projectRoot,\n serverRoot,\n sdkVersion: exp.sdkVersion,\n })\n );\n return;\n }\n return next();\n });\n\n // Append support for redirecting unhandled requests to the index.html page on web.\n if (this.isTargetingWeb()) {\n // This MUST be after the manifest middleware so it doesn't have a chance to serve the template `public/index.html`.\n middleware.use(new ServeStaticMiddleware(this.projectRoot).getHandler());\n\n // This should come after the static middleware so it doesn't serve the favicon from `public/favicon.ico`.\n middleware.use(new FaviconMiddleware(this.projectRoot).getHandler());\n }\n\n if (useServerRendering || isReactServerComponentsEnabled) {\n observeAnyFileChanges(\n {\n metro,\n server,\n },\n (events) => {\n if (hasApiRoutes) {\n // NOTE(EvanBacon): We aren't sure what files the API routes are using so we'll just invalidate\n // aggressively to ensure we always have the latest. The only caching we really get here is for\n // cases where the user is making subsequent requests to the same API route without changing anything.\n // This is useful for testing but pretty suboptimal. Luckily our caching is pretty aggressive so it makes\n // up for a lot of the overhead.\n this.invalidateApiRouteCache();\n } else if (!hasWarnedAboutApiRoutes()) {\n for (const event of events) {\n if (\n // If the user did not delete a file that matches the Expo Router API Route convention, then we should warn that\n // API Routes are not enabled in the project.\n event.metadata?.type !== 'd' &&\n // Ensure the file is in the project's routes directory to prevent false positives in monorepos.\n event.filePath.startsWith(appDir) &&\n isApiRouteConvention(event.filePath)\n ) {\n warnInvalidWebOutput();\n }\n }\n }\n\n // Handle loader file changes for HMR\n if (exp.extra?.router?.unstable_useServerDataLoaders) {\n for (const event of events) {\n if (event.metadata?.type !== 'd') {\n this.handleLoaderFileChange(event.filePath);\n }\n }\n }\n }\n );\n }\n\n // If React 19 is enabled, then add RSC middleware to the dev server.\n if (isReactServerComponentsEnabled) {\n this.bindRSCDevModuleInjectionHandler();\n const rscMiddleware = createServerComponentsMiddleware(this.projectRoot, {\n instanceMetroOptions: this.instanceMetroOptions,\n rscPath: '/_flight',\n ssrLoadModule: this.ssrLoadModule.bind(this),\n ssrLoadModuleArtifacts: this.metroImportAsArtifactsAsync.bind(this),\n useClientRouter: isReactServerActionsOnlyEnabled,\n createModuleId: metro._createModuleId.bind(metro),\n routerOptions,\n });\n this.rscRenderer = rscMiddleware;\n this.onReloadRscEvent = rscMiddleware.onReloadRscEvent;\n }\n\n // Append support for redirecting unhandled requests to the index.html page on web.\n if (this.isTargetingWeb()) {\n // Use `createRouteHandlerMiddleware()` when either of the following is true:\n // - Server rendering is enabled (server/static output)\n // - RSC is enabled. Even in `single` output mode, RSC needs the route handler\n if (!useServerRendering && !isReactServerComponentsEnabled) {\n middleware.use(\n new HistoryFallbackMiddleware(manifestMiddleware.getHandler().internal).getHandler()\n );\n } else {\n middleware.use(\n createRouteHandlerMiddleware(this.projectRoot, {\n appDir,\n routerRoot,\n config,\n ...config.exp.extra?.router,\n bundleApiRoute: (functionFilePath) =>\n this.ssrImportApiRoute(functionFilePath, { platform: 'web' }),\n executeLoaderAsync: async (route, request) => {\n const url = new URL(request.url);\n const resolvedLoaderRoute = fromServerManifestRoute(url.pathname, route);\n if (!resolvedLoaderRoute) {\n return undefined;\n }\n // Only pass the request in SSR mode (server output with SSR enabled).\n // In static mode, loaders should not receive request data.\n const isSSREnabled =\n exp.web?.output === 'server' &&\n exp.extra?.router?.unstable_useServerRendering === true;\n return this.executeServerDataLoaderAsync(\n url,\n resolvedLoaderRoute,\n isSSREnabled ? request : undefined\n );\n },\n getStaticPageAsync: async (pathname, route, request) => {\n // TODO: Add server rendering when RSC is enabled.\n if (isReactServerComponentsEnabled) {\n // NOTE: This is a temporary hack to return the SPA/template index.html in development when RSC is enabled.\n // While this technically works, it doesn't provide the correct experience of server rendering the React code to HTML first.\n const html = await manifestMiddleware.getSingleHtmlTemplateAsync();\n return { content: html };\n }\n\n // Non-RSC apps will bundle the static HTML for a given pathname and respond with it.\n return this.getStaticPageAsync(pathname, route, request);\n },\n rsc: isReactServerComponentsEnabled\n ? {\n path: '/_flight',\n handler: this.rscRenderer!.handler,\n }\n : undefined,\n })\n );\n }\n }\n } else {\n // If React 19 is enabled, then add RSC middleware to the dev server.\n if (isReactServerComponentsEnabled) {\n this.bindRSCDevModuleInjectionHandler();\n const rscMiddleware = createServerComponentsMiddleware(this.projectRoot, {\n instanceMetroOptions: this.instanceMetroOptions,\n rscPath: '/_flight',\n ssrLoadModule: this.ssrLoadModule.bind(this),\n ssrLoadModuleArtifacts: this.metroImportAsArtifactsAsync.bind(this),\n useClientRouter: isReactServerActionsOnlyEnabled,\n createModuleId: metro._createModuleId.bind(metro),\n routerOptions,\n });\n this.rscRenderer = rscMiddleware;\n }\n }\n // Extend the close method to ensure that we clean up the local info.\n const originalClose = server.close.bind(server);\n\n server.close = (callback?: (err?: Error) => void) => {\n return originalClose((err?: Error) => {\n this.instance = null;\n this.metro = null;\n this.hmrServer = null;\n this.ssrHmrClients = new Map();\n callback?.(err);\n });\n };\n\n this.metro = metro;\n this.hmrServer = hmrServer;\n return {\n server,\n location: {\n // The port is the main thing we want to send back.\n port: options.port,\n // localhost isn't always correct.\n host: 'localhost',\n // http is the only supported protocol on native.\n url: `http://localhost:${options.port}`,\n protocol: 'http',\n },\n middleware,\n messageSocket,\n };\n }\n\n private onReloadRscEvent: ((platform: string) => void) | null = null;\n\n private async registerSsrHmrAsync(url: string, onReload: (platform: string[]) => void) {\n if (!this.hmrServer || this.ssrHmrClients.has(url)) {\n return;\n }\n\n debug('[SSR] Register HMR:', url);\n\n const sendFn = (message: string) => {\n const data = JSON.parse(String(message)) as { type: string; body: any };\n\n switch (data.type) {\n case 'bundle-registered':\n case 'update-done':\n case 'update-start':\n break;\n case 'update':\n {\n const update = data.body;\n const {\n isInitialUpdate,\n added,\n modified,\n deleted,\n }: {\n isInitialUpdate?: boolean;\n added: {\n module: [number | string, string];\n sourceURL: string;\n sourceMappingURL: string;\n }[];\n modified: {\n module: [number | string, string];\n sourceURL: string;\n sourceMappingURL: string;\n }[];\n deleted: (number | string)[];\n } = update;\n\n const hasUpdate = added.length || modified.length || deleted.length;\n\n // NOTE: We throw away the updates and instead simply send a trigger to the client to re-fetch the server route.\n if (!isInitialUpdate && hasUpdate) {\n // Clear all SSR modules before sending the reload event. This ensures that the next event will rebuild the in-memory state from scratch.\n if (typeof globalThis.__c === 'function') globalThis.__c();\n\n const allModuleIds = new Set(\n [...added, ...modified].map((m) => m.module[0]).concat(deleted)\n );\n\n const platforms = unique(\n Array.from(allModuleIds)\n .map((moduleId) => {\n if (typeof moduleId !== 'string') {\n return null;\n }\n // Extract platforms from the module IDs.\n return moduleId.match(/[?&]platform=([\\w]+)/)?.[1] ?? null;\n })\n .filter(Boolean)\n ) as string[];\n\n onReload(platforms);\n }\n }\n break;\n case 'error':\n // GraphNotFound can mean that we have an issue in metroOptions where the URL doesn't match the object props.\n Log.error('[SSR] HMR Error: ' + JSON.stringify(data, null, 2));\n\n if (data.body?.type === 'GraphNotFoundError') {\n Log.error(\n 'Available SSR HMR keys:',\n `${this.metro?._bundler._revisionsByGraphId.keys()}`\n );\n }\n break;\n default:\n debug('Unknown HMR message:', data);\n break;\n }\n };\n\n const client = await this.hmrServer!.onClientConnect(url, sendFn);\n this.ssrHmrClients.set(url, client);\n // Opt in...\n client.optedIntoHMR = true;\n await this.hmrServer!._registerEntryPoint(client, url, sendFn);\n }\n\n public async waitForTypeScriptAsync(): Promise<boolean> {\n if (!this.instance) {\n throw new Error('Cannot wait for TypeScript without a running server.');\n }\n\n return new Promise<boolean>((resolve) => {\n if (!this.metro) {\n // This can happen when the run command is used and the server is already running in another\n // process. In this case we can't wait for the TypeScript check to complete because we don't\n // have access to the Metro server.\n debug('Skipping TypeScript check because Metro is not running (headless).');\n return resolve(false);\n }\n\n const off = metroWatchTypeScriptFiles({\n projectRoot: this.projectRoot,\n server: this.instance!.server,\n metro: this.metro,\n tsconfig: true,\n throttle: true,\n eventTypes: ['change', 'add'],\n callback: async () => {\n // Run once, this prevents the TypeScript project prerequisite from running on every file change.\n off();\n const { TypeScriptProjectPrerequisite } = await import(\n '../../doctor/typescript/TypeScriptProjectPrerequisite.js'\n );\n\n try {\n const req = new TypeScriptProjectPrerequisite(this.projectRoot);\n await req.bootstrapAsync();\n resolve(true);\n } catch (error: any) {\n // Ensure the process doesn't fail if the TypeScript check fails.\n // This could happen during the install.\n Log.log();\n Log.error(\n chalk.red`Failed to automatically setup TypeScript for your project. Try restarting the dev server to fix.`\n );\n Log.exception(error);\n resolve(false);\n }\n },\n });\n });\n }\n\n public async startTypeScriptServices() {\n return startTypescriptTypeGenerationAsync({\n server: this.instance?.server,\n metro: this.metro,\n projectRoot: this.projectRoot,\n });\n }\n\n protected getConfigModuleIds(): string[] {\n return ['./metro.config.js', './metro.config.json', './rn-cli.config.js'];\n }\n\n // API Routes\n\n private pendingRouteOperations = new Map<string, Promise<SSRModuleContentsResult | null>>();\n\n // Bundle the API Route with Metro and return the string contents to be evaluated in the server.\n private async bundleApiRoute(\n filePath: string,\n { platform }: { platform: string }\n ): Promise<SSRModuleContentsResult | null | undefined> {\n if (this.pendingRouteOperations.has(filePath)) {\n return this.pendingRouteOperations.get(filePath);\n }\n const bundleAsync = async (): Promise<SSRModuleContentsResult> => {\n try {\n debug('Bundle API route:', this.instanceMetroOptions.routerRoot, filePath);\n return await this.ssrLoadModuleContents(filePath, {\n isExporting: this.instanceMetroOptions.isExporting,\n platform,\n });\n } catch (error: any) {\n const appDir = this.instanceMetroOptions?.routerRoot\n ? path.join(this.projectRoot, this.instanceMetroOptions!.routerRoot!)\n : undefined;\n const relativePath = appDir ? path.relative(appDir, filePath) : filePath;\n\n // Expected errors: invalid syntax, missing resolutions.\n // Wrap with command error for better error messages.\n const err = new CommandError(\n 'API_ROUTE',\n chalk`Failed to bundle API Route: {bold ${relativePath}}\\n\\n` + error.message\n );\n\n for (const key in error) {\n err[key] = error[key];\n }\n\n throw err;\n } finally {\n // pendingRouteOperations.delete(filepath);\n }\n };\n const route = bundleAsync();\n\n this.pendingRouteOperations.set(filePath, route);\n return route;\n }\n\n private async ssrImportApiRoute(\n filePath: string,\n { platform }: { platform: string }\n ): Promise<null | Record<string, Function> | Response> {\n // TODO: Cache the evaluated function.\n try {\n const apiRoute = await this.bundleApiRoute(filePath, { platform });\n\n if (!apiRoute?.src) {\n return null;\n }\n return evalMetroNoHandling(this.projectRoot, apiRoute.src, apiRoute.filename);\n } catch (error) {\n // Format any errors that were thrown in the global scope of the evaluation.\n if (error instanceof Error) {\n try {\n const htmlServerError = await getErrorOverlayHtmlAsync({\n error,\n projectRoot: this.projectRoot,\n routerRoot: this.instanceMetroOptions.routerRoot!,\n });\n\n return new Response(htmlServerError, {\n status: 500,\n headers: {\n 'Content-Type': 'text/html',\n },\n });\n } catch (internalError) {\n debug('Failed to generate Metro server error UI for API Route error:', internalError);\n throw error;\n }\n } else {\n throw error;\n }\n }\n }\n\n private invalidateApiRouteCache() {\n this.pendingRouteOperations.clear();\n }\n\n /**\n * Execute a route's loader function. Used during development and SSG to fetch data required by\n * routes.\n *\n * This function is used during development and production builds, and **must** receive a valid\n * matched route.\n *\n * @experimental\n */\n async executeServerDataLoaderAsync(\n location: URL,\n route: ResolvedLoaderRoute,\n // The `request` object is only available when using SSR\n request?: ImmutableRequest\n ): Promise<Response | undefined> {\n const { exp } = getConfig(this.projectRoot);\n const { unstable_useServerDataLoaders, unstable_useServerRendering } = exp.extra?.router;\n\n if (!unstable_useServerDataLoaders) {\n throw new CommandError(\n 'LOADERS_NOT_ENABLED',\n 'Server data loaders are not enabled. Add `unstable_useServerDataLoaders` to your `expo-router` plugin config.'\n );\n }\n\n const { routerRoot } = this.instanceMetroOptions;\n assert(\n routerRoot != null,\n 'The server must be started before calling executeRouteLoaderAsync.'\n );\n\n try {\n debug(`Matched ${location.pathname} to file: ${route.file}`);\n\n const appDir = path.join(this.projectRoot, routerRoot);\n let modulePath = route.file;\n modulePath = path.isAbsolute(modulePath) ? modulePath : path.join(appDir, modulePath);\n modulePath = modulePath.replace(/\\.(js|ts)x?$/, '');\n\n debug('Using loader module path: ', modulePath);\n\n const routeModule = await this.ssrLoadModule<any>(modulePath, {\n environment: 'node',\n isLoaderBundle: true,\n });\n\n if (routeModule.loader) {\n // Register this module for loader HMR\n this.setupLoaderHmr(modulePath);\n\n const maybeResponse = await routeModule.loader(request, route.params);\n\n let data: unknown;\n if (maybeResponse instanceof Response) {\n debug('Loader returned Response for location:', location.pathname);\n\n // In SSR, preserve `Response` from the loader\n if (exp.web?.output === 'server' && unstable_useServerRendering) {\n return maybeResponse;\n }\n\n // In SSG, extract body\n data = await maybeResponse.json();\n } else {\n data = maybeResponse;\n }\n\n debug('Loader data:', data ?? null, ' for location:', location.pathname);\n return Response.json(data ?? null);\n }\n\n debug('No loader found for location:', location.pathname);\n return undefined;\n } catch (error: any) {\n throw new CommandError(\n 'LOADER_EXECUTION_FAILED',\n `Failed to execute loader for route \"${location.pathname}\": ${error.message}`\n );\n }\n }\n\n /**\n * Bundle a loader module with Metro and return the string contents.\n */\n private async bundleLoader(\n filePath: string,\n { platform }: { platform: string }\n ): Promise<SSRModuleContentsResult> {\n try {\n debug('Bundle loader:', filePath);\n return await this.ssrLoadModuleContents(filePath, {\n isExporting: this.instanceMetroOptions.isExporting,\n platform,\n environment: 'node',\n isLoaderBundle: true,\n });\n } catch (error: any) {\n debug('Failed to bundle loader:', filePath, ':', error.message);\n throw new CommandError(\n 'LOADER_BUNDLE',\n chalk`Failed to bundle loader: {bold ${filePath}}\\n\\n` + error.message\n );\n }\n }\n\n // Ensure the global is available for SSR CSS modules to inject client updates.\n private bindRSCDevModuleInjectionHandler() {\n // Used by SSR CSS modules to broadcast client updates.\n globalThis.__expo_rsc_inject_module = this.sendClientModule.bind(this);\n }\n\n // NOTE: This can only target a single platform at a time (web).\n // used for sending RSC CSS to the root client in development.\n private sendClientModule({ code, id }: { code: string; id: string }) {\n this.broadcastMessage('sendDevCommand', {\n name: 'module-import',\n data: {\n code,\n id,\n },\n });\n }\n\n // Metro HMR\n\n private setupHmr(url: URL) {\n const onReload = (platforms: string[] = []) => {\n // Send reload command to client from Fast Refresh code.\n\n if (!platforms.length) {\n // TODO: When is this called?\n this.broadcastMessage('sendDevCommand', {\n name: 'rsc-reload',\n });\n } else {\n for (const platform of platforms) {\n this.onReloadRscEvent?.(platform);\n this.broadcastMessage('sendDevCommand', {\n name: 'rsc-reload',\n platform,\n });\n }\n }\n };\n\n this.registerSsrHmrAsync(url.toString(), onReload);\n }\n\n private watchedLoaderFiles: Set<string> = new Set();\n\n private setupLoaderHmr(modulePath: string) {\n if (this.watchedLoaderFiles.has(modulePath)) {\n return;\n }\n this.watchedLoaderFiles.add(modulePath);\n\n debug('[Loader HMR] Registering loader file for HMR:', modulePath);\n }\n\n private handleLoaderFileChange(changedFilePath: string) {\n for (const loaderPath of this.watchedLoaderFiles) {\n const possibleExtensions = ['.tsx', '.ts', '.jsx', '.js'];\n const isLoaderFile = possibleExtensions.some(\n (ext) => changedFilePath === loaderPath + ext || changedFilePath === loaderPath\n );\n\n if (isLoaderFile) {\n debug('[Loader HMR] Loader file changed, triggering reload:', changedFilePath);\n this.broadcastMessage('sendDevCommand', {\n name: 'reload',\n });\n }\n }\n }\n\n // Direct Metro access\n\n // Emulates the Metro dev server .bundle endpoint without having to go through a server.\n private async _bundleDirectAsync(\n resolvedEntryFilePath: string,\n {\n transformOptions,\n resolverOptions,\n graphOptions,\n serializerOptions,\n }: {\n transformOptions: TransformInputOptions;\n resolverOptions: {\n customResolverOptions: CustomResolverOptions;\n dev: boolean;\n };\n serializerOptions: {\n output?: 'string' | ({} & string);\n modulesOnly: boolean;\n runModule: boolean;\n sourceMapUrl: string;\n sourceUrl: string;\n inlineSourceMap: boolean;\n excludeSource: boolean;\n };\n graphOptions: {\n shallow: boolean;\n lazy: boolean;\n };\n }\n ): Promise<BundleDirectResult> {\n assert(this.metro, 'Metro server must be running to bundle directly.');\n const config = this.metro._config;\n const buildNumber = this.metro.getNewBuildNumber();\n const bundlePerfLogger = config.unstable_perfLoggerFactory?.('BUNDLING_REQUEST', {\n key: buildNumber,\n });\n\n const onProgress = (transformedFileCount: number, totalFileCount: number) => {\n this.metro?._reporter?.update?.({\n buildID: getBuildID(buildNumber),\n type: 'bundle_transform_progressed',\n transformedFileCount,\n totalFileCount,\n });\n };\n\n const revPromise = this.getMetroRevision(resolvedEntryFilePath, {\n graphOptions,\n transformOptions,\n resolverOptions,\n });\n\n bundlePerfLogger?.point('resolvingAndTransformingDependencies_start');\n bundlePerfLogger?.annotate({\n bool: {\n initial_build: revPromise == null,\n },\n });\n this.metro?._reporter.update({\n buildID: getBuildID(buildNumber),\n bundleDetails: {\n bundleType: transformOptions.type,\n dev: transformOptions.dev,\n entryFile: resolvedEntryFilePath,\n minify: transformOptions.minify,\n platform: transformOptions.platform,\n customResolverOptions: resolverOptions.customResolverOptions,\n customTransformOptions: transformOptions.customTransformOptions ?? {},\n },\n isPrefetch: false,\n type: 'bundle_build_started',\n });\n\n try {\n let delta: DeltaResult;\n let revision: GraphRevision;\n\n try {\n // TODO: Some bug in Metro/RSC causes this to break when changing imports in server components.\n // We should resolve the bug because it results in ~6x faster bundling to reuse the graph revision.\n if (transformOptions.customTransformOptions?.environment === 'react-server') {\n const props = await this.metro.getBundler().initializeGraph(\n // NOTE: Using absolute path instead of relative input path is a breaking change.\n // entryFile,\n resolvedEntryFilePath,\n\n transformOptions,\n resolverOptions,\n {\n onProgress,\n shallow: graphOptions.shallow,\n lazy: graphOptions.lazy,\n }\n );\n delta = props.delta;\n revision = props.revision;\n } else {\n const props = await (revPromise != null\n ? this.metro.getBundler().updateGraph(await revPromise, false)\n : this.metro.getBundler().initializeGraph(\n // NOTE: Using absolute path instead of relative input path is a breaking change.\n // entryFile,\n resolvedEntryFilePath,\n\n transformOptions,\n resolverOptions,\n {\n onProgress,\n shallow: graphOptions.shallow,\n lazy: graphOptions.lazy,\n }\n ));\n delta = props.delta;\n revision = props.revision;\n }\n } catch (error) {\n attachImportStackToRootMessage(error);\n dropStackIfContainsCodeFrame(error);\n throw error;\n }\n\n bundlePerfLogger?.annotate({\n int: {\n graph_node_count: revision.graph.dependencies.size,\n },\n });\n bundlePerfLogger?.point('resolvingAndTransformingDependencies_end');\n bundlePerfLogger?.point('serializingBundle_start');\n\n const shouldAddToIgnoreList = this.metro._shouldAddModuleToIgnoreList.bind(this.metro);\n\n const serializer = this.getMetroSerializer();\n\n const options = {\n asyncRequireModulePath: await this.metro._resolveRelativePath(\n config.transformer.asyncRequireModulePath,\n {\n relativeTo: 'project',\n resolverOptions,\n transformOptions,\n }\n ),\n // ...serializerOptions,\n processModuleFilter: config.serializer.processModuleFilter,\n createModuleId: this.metro._createModuleId,\n getRunModuleStatement: config.serializer.getRunModuleStatement,\n globalPrefix: config.transformer.globalPrefix,\n includeAsyncPaths: graphOptions.lazy,\n dev: transformOptions.dev,\n projectRoot: config.projectRoot,\n modulesOnly: serializerOptions.modulesOnly,\n runBeforeMainModule: config.serializer.getModulesRunBeforeMainModule(\n resolvedEntryFilePath\n // path.relative(config.projectRoot, entryFile)\n ),\n runModule: serializerOptions.runModule,\n sourceMapUrl: serializerOptions.sourceMapUrl,\n sourceUrl: serializerOptions.sourceUrl,\n inlineSourceMap: serializerOptions.inlineSourceMap,\n serverRoot: config.server.unstable_serverRoot ?? config.projectRoot,\n shouldAddToIgnoreList,\n\n // TODO(@kitten): This is incoherently typed. The target should be typed to accept this coherently\n // but we have no type overrides or a proper type chain for this\n serializerOptions,\n };\n\n // TODO(@kitten): Yearns for a refactor. The typings here were and are questionable\n const bundle = await serializer(\n // NOTE: Using absolute path instead of relative input path is a breaking change.\n // entryFile,\n resolvedEntryFilePath,\n revision.prepend,\n revision.graph,\n options\n );\n\n this.metro._reporter.update({\n buildID: getBuildID(buildNumber),\n type: 'bundle_build_done',\n });\n\n bundlePerfLogger?.point('serializingBundle_end');\n\n let bundleCode: string | null = null;\n let bundleMap: string | null = null;\n\n if (serializerOptions.output === 'static') {\n try {\n const parsed = typeof bundle === 'string' ? JSON.parse(bundle) : bundle;\n\n assert(\n 'artifacts' in parsed && Array.isArray(parsed.artifacts),\n 'Expected serializer to return an object with key artifacts to contain an array of serial assets.'\n );\n\n const artifacts = parsed.artifacts as SerialAsset[];\n const assets = parsed.assets;\n\n const bundleCode = artifacts.filter((asset) => asset.type === 'js')[0];\n const bundleMap = artifacts.filter((asset) => asset.type === 'map')?.[0]?.source ?? '';\n\n return {\n numModifiedFiles: delta.reset\n ? delta.added.size + revision.prepend.length\n : delta.added.size + delta.modified.size + delta.deleted.size,\n lastModifiedDate: revision.date,\n nextRevId: revision.id,\n bundle: bundleCode.source,\n map: bundleMap,\n artifacts,\n assets,\n };\n } catch (error: any) {\n throw new Error(\n 'Serializer did not return expected format. The project copy of `expo/metro-config` may be out of date. Error: ' +\n error.message\n );\n }\n }\n\n if (typeof bundle === 'string') {\n bundleCode = bundle;\n\n // Create the source map in a second pass...\n let { prepend, graph } = revision;\n if (serializerOptions.modulesOnly) {\n prepend = [];\n }\n\n bundleMap = await sourceMapStringAsync(\n [\n //\n ...prepend,\n ...this.metro._getSortedModules(graph),\n ],\n {\n excludeSource: serializerOptions.excludeSource,\n processModuleFilter: config.serializer.processModuleFilter,\n shouldAddToIgnoreList,\n }\n );\n } else {\n bundleCode = bundle.code;\n bundleMap = bundle.map;\n }\n\n return {\n numModifiedFiles: delta.reset\n ? delta.added.size + revision.prepend.length\n : delta.added.size + delta.modified.size + delta.deleted.size,\n lastModifiedDate: revision.date,\n nextRevId: revision.id,\n bundle: bundleCode,\n map: bundleMap,\n };\n } catch (error: any) {\n // Mark the error so we know how to format and return it later.\n if (error) {\n error[IS_METRO_BUNDLE_ERROR_SYMBOL] = true;\n }\n\n this.metro._reporter.update({\n buildID: getBuildID(buildNumber),\n type: 'bundle_build_failed',\n });\n\n throw error;\n }\n }\n\n private getMetroSerializer() {\n return (\n this.metro?._config?.serializer.customSerializer ||\n ((entryPoint, preModules, graph, options) =>\n bundleToString(baseJSBundle(entryPoint, preModules, graph, options)).code)\n );\n }\n\n private getMetroRevision(\n resolvedEntryFilePath: string,\n {\n graphOptions,\n transformOptions,\n resolverOptions,\n }: {\n transformOptions: TransformInputOptions;\n resolverOptions: {\n customResolverOptions: CustomResolverOptions;\n dev: boolean;\n };\n graphOptions: {\n shallow: boolean;\n lazy: boolean;\n };\n }\n ) {\n assert(this.metro, 'Metro server must be running to bundle directly.');\n const config = this.metro._config;\n\n const graphId = getGraphId(resolvedEntryFilePath, transformOptions, {\n unstable_allowRequireContext: config.transformer.unstable_allowRequireContext,\n resolverOptions,\n shallow: graphOptions.shallow,\n lazy: graphOptions.lazy,\n });\n return this.metro.getBundler().getRevisionByGraphId(graphId);\n }\n\n private async resolveRelativePathAsync(\n moduleId: string,\n {\n resolverOptions,\n transformOptions,\n }: {\n transformOptions: TransformInputOptions;\n resolverOptions: {\n customResolverOptions: CustomResolverOptions;\n dev: boolean;\n };\n }\n ) {\n assert(this.metro, 'cannot invoke resolveRelativePathAsync without metro instance');\n return await this.metro._resolveRelativePath(convertPathToModuleSpecifier(moduleId), {\n relativeTo: 'server',\n resolverOptions,\n transformOptions,\n });\n }\n}\n\nfunction getBuildID(buildNumber: number): string {\n return buildNumber.toString(36);\n}\n\nfunction wrapBundle(str: string) {\n // Skip the metro runtime so debugging is a bit easier.\n // Replace the __r() call with an export statement.\n // Use gm to apply to the last require line. This is needed when the bundle has side-effects.\n return str.replace(/^(__r\\(.*\\);)$/gm, 'module.exports = $1');\n}\n\nasync function sourceMapStringAsync(\n modules: readonly Module[],\n options: SourceMapGeneratorOptions\n): Promise<string> {\n return (await sourceMapGeneratorNonBlocking(modules, options)).toString(undefined, {\n excludeSource: options.excludeSource,\n });\n}\n\nfunction unique<T>(array: T[]): T[] {\n return Array.from(new Set(array));\n}\n"],"names":["MetroBundlerDevServer","debug","require","EXPO_GO_METRO_PORT","DEV_CLIENT_METRO_PORT","BundlerDevServer","name","resolvePortAsync","options","port","devClient","Number","process","env","RCT_METRO_PORT","getFreePortAsync","exportServerRouteAsync","contents","artifactFilename","files","includeSourceMaps","descriptor","src","map","artifactBasename","encodeURIComponent","path","basename","replace","parsedMap","JSON","parse","mapData","stringify","version","sources","source","startsWith","projectRoot","relative","convertPathToModuleSpecifier","sourcesContent","Array","length","fill","names","mappings","targetDomain","set","fileData","exportMiddlewareAsync","manifest","appDir","outputDir","platform","middleware","middlewareFilePath","isAbsolute","file","join","bundleApiRoute","middlewareId","exportExpoRouterApiRoutesAsync","prerenderManifest","routerRoot","instanceMetroOptions","assert","getExpoRouterRoutesManifestAsync","Map","rscPath","isReactServerComponentsEnabled","apiRoutes","find","route","page","push","resolve","namedRegex","routeKeys","rsc","filepath","apiRouteId","htmlRoutes","exportExpoRouterRenderModuleAsync","renderModule","ssrLoadModuleContents","environment","exportExpoRouterLoadersAsync","entryPoints","entry","bundleLoader","pagePath","slice","loaderId","exp","getConfig","fetchManifest","extra","router","preserveRedirectAndRewrites","asJson","CommandError","getServerManifestAsync","getBuildTimeServerManifestAsync","getManifest","ssrLoadModule","isReactServerRoutesEnabled","serverManifest","htmlManifest","getStaticRenderFunctionAsync","url","getDevServerUrlOrAssert","getStaticContent","useServerRendering","unstable_useServerRendering","isExportingWithSSR","web","output","skipStaticParams","preserveApiRoutes","renderAsync","opts","location","URL","executeLoaderAsync","resolvedLoaderRoute","fromRuntimeManifestRoute","pathname","inflateManifest","undefined","executeServerDataLoaderAsync","getStaticResourcesAsync","mainModuleName","clientBoundaries","mode","minify","isExporting","baseUrl","reactCompiler","asyncRoutes","resolvedMainModuleName","resolveMainModuleName","metroImportAsArtifactsAsync","splitChunks","EXPO_NO_BUNDLE_SPLITTING","serializerIncludeMaps","lazy","EXPO_NO_METRO_LAZY","bytecode","getStaticPageAsync","request","devBundleUrlPathname","createBundleUrlPath","bundleStaticHtml","useServerDataLoaders","unstable_useServerDataLoaders","fromServerManifestRoute","loaderResult","loaderData","json","loader","data","artifacts","resources","staticHtml","Promise","all","content","serializeHtmlWithAssets","template","devBundleUrl","hydrate","EXPO_WEB_DEV_HYDRATE","filePath","specificOptions","results","serializerOutput","assets","filename","metroLoadModuleContents","extraOptions","inlineSourceMap","engine","expoBundleOptions","getMetroDirectBundleOptions","resolverOptions","customResolverOptions","dev","transformOptions","type","unstable_transformProfile","customTransformOptions","Object","create","resolvedEntryFilePath","resolveRelativePathAsync","createBundleOsPath","_bundleDirectAsync","graphOptions","shallow","serializerOptions","modulesOnly","runModule","sourceUrl","sourceMapUrl","bundle","rest","scriptContents","wrapBundle","cachedSourceMaps","nativeExportBundleAsync","singlePageReactServerComponentExportAsync","legacySinglePageExportBundleAsync","getReactServerReferences","unique","filter","a","artifact","metadata","reactServerReferences","ref","fileURLToFilePath","flat","Boolean","reactClientReferences","serverActionReferencesInServer","cssModules","rscRenderer","getExpoRouterClientReferencesAsync","domRoot","processClientBoundaries","newReactServerReferences","Error","allKnownReactServerReferences","nestedClientBoundaries","exportServerActionsAsync","hasUniqueClientBoundaries","some","boundary","includes","concat","serverRoot","getMetroServerRoot","clientBoundariesAsOpaqueIds","toPosixPath","moduleIdToSplitBundle","paths","values","reduce","acc","ssrManifest","keys","forEach","routerOptions","exportRoutesAsync","fromEntries","from","entries","key","value","watchEnvironmentVariables","instance","metro","envFiles","runtimeEnv","getFiles","NODE_ENV","fileName","observeFileChanges","server","load","force","startImplementationAsync","urlCreator","getUrlCreator","config","skipSDKVersionRequirement","experiments","reactServerComponentRoutes","reactServerFunctions","isReactServerActionsOnlyEnabled","hasApiRoutes","getBaseUrlFromExpoConfig","getAsyncRoutesFromExpoConfig","getRouterDirectoryModuleIdWithManifest","origin","configPath","dynamicConfigPath","staticConfigPath","configFileName","parsedOptions","host","hostType","maxWorkers","resetCache","resetDevServer","EXPO_DEV_SERVER_ORIGIN","hmrServer","messageSocket","instantiateMetroAsync","manifestMiddleware","getManifestMiddlewareAsync","prependMiddleware","ContextModuleSourceMapsMiddleware","getHandler","use","InterstitialPageMiddleware","scheme","DevToolsPluginMiddleware","devToolsPluginManager","deepLinkMiddleware","RuntimeRedirectMiddleware","getLocation","runtime","constructDevClientUrl","constructUrl","domComponentRenderer","createDomComponentsMiddleware","metroRoot","CreateFileMiddleware","req","res","next","statusCode","setHeader","end","sdkVersion","isTargetingWeb","ServeStaticMiddleware","FaviconMiddleware","observeAnyFileChanges","events","invalidateApiRouteCache","hasWarnedAboutApiRoutes","event","isApiRouteConvention","warnInvalidWebOutput","handleLoaderFileChange","bindRSCDevModuleInjectionHandler","rscMiddleware","createServerComponentsMiddleware","bind","ssrLoadModuleArtifacts","useClientRouter","createModuleId","_createModuleId","onReloadRscEvent","HistoryFallbackMiddleware","internal","createRouteHandlerMiddleware","functionFilePath","ssrImportApiRoute","isSSREnabled","html","getSingleHtmlTemplateAsync","handler","originalClose","close","callback","err","ssrHmrClients","protocol","registerSsrHmrAsync","onReload","has","sendFn","message","String","update","body","isInitialUpdate","added","modified","deleted","hasUpdate","globalThis","__c","allModuleIds","Set","m","module","platforms","moduleId","match","Log","error","_bundler","_revisionsByGraphId","client","onClientConnect","optedIntoHMR","_registerEntryPoint","waitForTypeScriptAsync","off","metroWatchTypeScriptFiles","tsconfig","throttle","eventTypes","TypeScriptProjectPrerequisite","bootstrapAsync","log","chalk","red","exception","startTypeScriptServices","startTypescriptTypeGenerationAsync","getConfigModuleIds","pendingRouteOperations","get","bundleAsync","relativePath","apiRoute","evalMetroNoHandling","htmlServerError","getErrorOverlayHtmlAsync","Response","status","headers","internalError","clear","modulePath","routeModule","isLoaderBundle","setupLoaderHmr","maybeResponse","params","__expo_rsc_inject_module","sendClientModule","code","id","broadcastMessage","setupHmr","toString","watchedLoaderFiles","add","changedFilePath","loaderPath","possibleExtensions","isLoaderFile","ext","_config","buildNumber","getNewBuildNumber","bundlePerfLogger","unstable_perfLoggerFactory","onProgress","transformedFileCount","totalFileCount","_reporter","buildID","getBuildID","revPromise","getMetroRevision","point","annotate","bool","initial_build","bundleDetails","bundleType","entryFile","isPrefetch","delta","revision","props","getBundler","initializeGraph","updateGraph","attachImportStackToRootMessage","dropStackIfContainsCodeFrame","int","graph_node_count","graph","dependencies","size","shouldAddToIgnoreList","_shouldAddModuleToIgnoreList","serializer","getMetroSerializer","asyncRequireModulePath","_resolveRelativePath","transformer","relativeTo","processModuleFilter","getRunModuleStatement","globalPrefix","includeAsyncPaths","runBeforeMainModule","getModulesRunBeforeMainModule","unstable_serverRoot","prepend","bundleCode","bundleMap","parsed","isArray","asset","numModifiedFiles","reset","lastModifiedDate","date","nextRevId","sourceMapStringAsync","_getSortedModules","excludeSource","IS_METRO_BUNDLE_ERROR_SYMBOL","customSerializer","entryPoint","preModules","bundleToString","baseJSBundle","graphId","getGraphId","unstable_allowRequireContext","getRevisionByGraphId","extras","getEmptyModulePath","resolver","emptyModulePath","hot","evalMetroAndWrapFunctions","str","modules","sourceMapGeneratorNonBlocking","array"],"mappings":"AAAA;;;;;CAKC;;;;+BAiJYA;;;eAAAA;;;;yBAhJyB;;;;;;;yBACH;;;;;;;iEACP;;;;;;;gEACH;;;;;;;yBAIlB;;;;;;;gEAYoB;;;;;;;gEACJ;;;;;;;gEAKJ;;;;;;;gEACD;;;;;;;gEAGD;;;;;;kDAKV;6CACsC;qCACE;kCACT;qCAM/B;2CACmC;wBAMnC;+BACiC;qDACkB;qBAMtC;sBACA;wBACS;0BACD;sBACK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F;YACnFmV,OAAOI,GAAG,IACV,IAAI,CAACpc,oBAAoB,CAACuE,WAAW,KAAK,MAC1C;gBACA,mBAAmB;gBACnB,MAAMyG,aAAaC,IAAAA,2BAAkB,EAAC,IAAI,CAAC5M,WAAW;gBACtD,MAAMoX,eAAehY,eAAI,CAACa,QAAQ,CAAC0M,YAAYgF,IAAI/I,QAAQ;gBAC3D,MAAMpE,MAAM,IAAIa,IAAI+R,cAAc,IAAI,CAAC3S,uBAAuB;gBAC9D,IAAI,CAACgU,QAAQ,CAACjU;YAChB;YAEA,OAAOwZ,IAAAA,mDAAyB,EAC9B,IAAI,CAAChe,WAAW,EAChB2R,IAAI3S,GAAG,EACP2S,IAAI/I,QAAQ,EACZJ,gBAAgBtC,WAAW,IAAI,IAAI,CAACvE,oBAAoB,CAACuE,WAAW;QAExE,QAybA2F,cAAmF,WAiU3EuH,mBAAwD,MAsJhE,aAAa;aAEL6D,yBAAyB,IAAInV,YA2O7B6W,qBAAkC,IAAIvD;;AAqWhD;AAEA,SAASwE,WAAWT,WAAmB;IACrC,OAAOA,YAAYT,QAAQ,CAAC;AAC9B;AAEA,SAAShO,WAAWuT,GAAW;IAC7B,uDAAuD;IACvD,mDAAmD;IACnD,6FAA6F;IAC7F,OAAOA,IAAI3e,OAAO,CAAC,oBAAoB;AACzC;AAEA,eAAewd,qBACboB,OAA0B,EAC1BhgB,OAAkC;IAElC,OAAO,AAAC,CAAA,MAAMigB,IAAAA,mDAA6B,EAACD,SAAShgB,QAAO,EAAGwa,QAAQ,CAAC/S,WAAW;QACjFqX,eAAe9e,QAAQ8e,aAAa;IACtC;AACF;AAEA,SAAShS,OAAUoT,KAAU;IAC3B,OAAOhe,MAAMsN,IAAI,CAAC,IAAI0H,IAAIgJ;AAC5B"}
|
|
@@ -274,6 +274,7 @@ async function instantiateMetroAsync(metroBundler, options, { isExporting, exp =
|
|
|
274
274
|
resetAtlasFile: isExporting
|
|
275
275
|
});
|
|
276
276
|
const { server, hmrServer, metro } = await (0, _runServerfork.runServer)(metroBundler, metroConfig, {
|
|
277
|
+
host: options.host,
|
|
277
278
|
websocketEndpoints,
|
|
278
279
|
watch: !isExporting && isWatchEnabled()
|
|
279
280
|
}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/server/metro/instantiateMetro.ts"],"sourcesContent":["import { type ExpoConfig, getConfig } from '@expo/config';\nimport { getMetroServerRoot } from '@expo/config/paths';\nimport type { Reporter } from '@expo/metro/metro';\nimport type Bundler from '@expo/metro/metro/Bundler';\nimport type { ReadOnlyGraph } from '@expo/metro/metro/DeltaBundler';\nimport type { TransformOptions } from '@expo/metro/metro/DeltaBundler/Worker';\nimport MetroHmrServer, { Client as MetroHmrClient } from '@expo/metro/metro/HmrServer';\nimport RevisionNotFoundError from '@expo/metro/metro/IncrementalBundler/RevisionNotFoundError';\nimport type MetroServer from '@expo/metro/metro/Server';\nimport formatBundlingError from '@expo/metro/metro/lib/formatBundlingError';\nimport { mergeConfig, resolveConfig, type ConfigT } from '@expo/metro/metro-config';\nimport { Terminal } from '@expo/metro/metro-core';\nimport { createStableModuleIdFactory, getDefaultConfig } from '@expo/metro-config';\nimport chalk from 'chalk';\nimport http from 'http';\nimport path from 'path';\n\nimport { createDevToolsPluginWebsocketEndpoint } from './DevToolsPluginWebsocketEndpoint';\nimport { MetroBundlerDevServer } from './MetroBundlerDevServer';\nimport { MetroTerminalReporter } from './MetroTerminalReporter';\nimport { attachAtlasAsync } from './debugging/attachAtlas';\nimport { createDebugMiddleware } from './debugging/createDebugMiddleware';\nimport { createMetroMiddleware } from './dev-server/createMetroMiddleware';\nimport { runServer } from './runServer-fork';\nimport { withMetroMultiPlatformAsync } from './withMetroMultiPlatform';\nimport { Log } from '../../../log';\nimport { env } from '../../../utils/env';\nimport { CommandError } from '../../../utils/errors';\nimport { createCorsMiddleware } from '../middleware/CorsMiddleware';\nimport { createJsInspectorMiddleware } from '../middleware/inspector/createJsInspectorMiddleware';\nimport { prependMiddleware } from '../middleware/mutations';\nimport { getPlatformBundlers } from '../platformBundlers';\n\n// NOTE(@kitten): We pass a custom createStableModuleIdFactory function into the Metro module ID factory sometimes\ninterface MetroServerWithModuleIdMod extends MetroServer {\n _createModuleId: ReturnType<typeof createStableModuleIdFactory> & ((path: string) => number);\n}\ninterface MetroHmrServerWithModuleIdMod extends MetroHmrServer<MetroHmrClient> {\n _createModuleId: ReturnType<typeof createStableModuleIdFactory> & ((path: string) => number);\n}\n\n// From expo/dev-server but with ability to use custom logger.\ntype MessageSocket = {\n broadcast: (method: string, params?: Record<string, any> | undefined) => void;\n};\n\n// TODO(@kitten): We assign this here to run server-side code bundled by metro\n// It's not isolated into a worker thread yet\n// Check `metro-require/require.ts` for how this setting is used\ndeclare namespace globalThis {\n let __requireCycleIgnorePatterns: readonly RegExp[] | undefined;\n}\n\nfunction asWritable<T>(input: T): { -readonly [K in keyof T]: T[K] } {\n return input;\n}\n\n// Wrap terminal and polyfill console.log so we can log during bundling without breaking the indicator.\nclass LogRespectingTerminal extends Terminal {\n constructor(stream: import('node:net').Socket | import('node:stream').Writable) {\n super(stream, { ttyPrint: true });\n\n const sendLog = (...msg: any[]) => {\n if (!msg.length) {\n this.log('');\n } else {\n const [format, ...args] = msg;\n this.log(format, ...args);\n }\n // Flush the logs to the terminal immediately so logs at the end of the process are not lost.\n this.flush();\n };\n\n console.log = sendLog;\n console.info = sendLog;\n }\n}\n\n// Share one instance of Terminal for all instances of Metro.\nconst terminal = new LogRespectingTerminal(process.stdout);\n\ninterface LoadMetroConfigOptions {\n maxWorkers?: number;\n port?: number;\n reporter?: Reporter;\n resetCache?: boolean;\n}\n\nexport async function loadMetroConfigAsync(\n projectRoot: string,\n options: LoadMetroConfigOptions,\n {\n exp,\n isExporting,\n getMetroBundler,\n }: { exp: ExpoConfig; isExporting: boolean; getMetroBundler: () => Bundler }\n) {\n let reportEvent: ((event: any) => void) | undefined;\n\n const autolinkingModuleResolutionEnabled =\n exp.experiments?.autolinkingModuleResolution ?? env.EXPO_USE_STICKY_RESOLVER;\n\n const serverActionsEnabled =\n exp.experiments?.reactServerFunctions ?? env.EXPO_UNSTABLE_SERVER_FUNCTIONS;\n\n if (serverActionsEnabled) {\n process.env.EXPO_UNSTABLE_SERVER_FUNCTIONS = '1';\n }\n\n // NOTE: Enable all the experimental Metro flags when RSC is enabled.\n if (exp.experiments?.reactServerComponentRoutes || serverActionsEnabled) {\n process.env.EXPO_USE_METRO_REQUIRE = '1';\n }\n\n if (exp.experiments?.reactCanary) {\n Log.warn(`React 19 is enabled by default. Remove unused experiments.reactCanary flag.`);\n }\n\n const serverRoot = getMetroServerRoot(projectRoot);\n const terminalReporter = new MetroTerminalReporter(serverRoot, terminal);\n\n // NOTE: Allow external tools to override the metro config. This is considered internal and unstable\n const configPath = env.EXPO_OVERRIDE_METRO_CONFIG ?? undefined;\n const resolvedConfig = await resolveConfig(configPath, projectRoot);\n const defaultConfig = getDefaultConfig(projectRoot);\n\n let config: ConfigT = resolvedConfig.isEmpty\n ? defaultConfig\n : await mergeConfig(defaultConfig, resolvedConfig.config);\n\n // Set the watchfolders to include the projectRoot, as Metro assumes this\n // Force-override the reporter\n config = {\n ...config,\n\n // See: `overrideConfigWithArguments` https://github.com/facebook/metro/blob/5059e26/packages/metro-config/src/loadConfig.js#L274-L339\n // Compare to `LoadOptions` type (disregard `reporter` as we don't expose this)\n resetCache: !!options.resetCache,\n maxWorkers: options.maxWorkers ?? config.maxWorkers,\n server: {\n ...config.server,\n port: options.port ?? config.server.port,\n },\n\n watchFolders: !config.watchFolders.includes(config.projectRoot)\n ? [config.projectRoot, ...config.watchFolders]\n : config.watchFolders,\n reporter: {\n update(event) {\n terminalReporter.update(event);\n if (reportEvent) {\n reportEvent(event);\n }\n },\n },\n };\n\n globalThis.__requireCycleIgnorePatterns = config.resolver?.requireCycleIgnorePatterns;\n\n if (isExporting) {\n // This token will be used in the asset plugin to ensure the path is correct for writing locally.\n asWritable(config.transformer).publicPath = `/assets?export_path=${\n (exp.experiments?.baseUrl ?? '') + '/assets'\n }`;\n } else {\n asWritable(config.transformer).publicPath = '/assets/?unstable_path=.';\n }\n\n const platformBundlers = getPlatformBundlers(projectRoot, exp);\n\n if (exp.experiments?.reactCompiler) {\n Log.log(chalk.gray`React Compiler enabled`);\n }\n\n if (env.EXPO_UNSTABLE_TREE_SHAKING && !env.EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH) {\n throw new CommandError(\n 'EXPO_UNSTABLE_TREE_SHAKING requires EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH to be enabled.'\n );\n }\n\n if (env.EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH) {\n Log.warn(`Experimental bundle optimization is enabled.`);\n }\n if (env.EXPO_UNSTABLE_TREE_SHAKING) {\n Log.warn(`Experimental tree shaking is enabled.`);\n }\n if (env.EXPO_UNSTABLE_LOG_BOX) {\n Log.warn(`Experimental Expo LogBox is enabled.`);\n }\n if (autolinkingModuleResolutionEnabled) {\n Log.warn(`Experimental Expo Autolinking module resolver is enabled.`);\n }\n\n if (serverActionsEnabled) {\n Log.warn(\n `React Server Functions (beta) are enabled. Route rendering mode: ${exp.experiments?.reactServerComponentRoutes ? 'server' : 'client'}`\n );\n }\n\n config = await withMetroMultiPlatformAsync(projectRoot, {\n config,\n exp,\n platformBundlers,\n isTsconfigPathsEnabled: exp.experiments?.tsconfigPaths ?? true,\n isAutolinkingResolverEnabled: autolinkingModuleResolutionEnabled,\n isExporting,\n isNamedRequiresEnabled: env.EXPO_USE_METRO_REQUIRE,\n isReactServerComponentsEnabled: !!exp.experiments?.reactServerComponentRoutes,\n getMetroBundler,\n });\n\n return {\n config,\n setEventReporter: (logger: (event: any) => void) => (reportEvent = logger),\n reporter: terminalReporter,\n };\n}\n\n/** The most generic possible setup for Metro bundler. */\nexport async function instantiateMetroAsync(\n metroBundler: MetroBundlerDevServer,\n options: LoadMetroConfigOptions,\n {\n isExporting,\n exp = getConfig(metroBundler.projectRoot, {\n skipSDKVersionRequirement: true,\n }).exp,\n }: { isExporting: boolean; exp?: ExpoConfig }\n): Promise<{\n metro: MetroServer;\n hmrServer: MetroHmrServer<MetroHmrClient> | null;\n server: http.Server;\n middleware: any;\n messageSocket: MessageSocket;\n}> {\n const projectRoot = metroBundler.projectRoot;\n\n const {\n config: metroConfig,\n setEventReporter,\n reporter,\n } = await loadMetroConfigAsync(projectRoot, options, {\n exp,\n isExporting,\n getMetroBundler() {\n return metro.getBundler().getBundler();\n },\n });\n\n // Create the core middleware stack for Metro, including websocket listeners\n const { middleware, messagesSocket, eventsSocket, websocketEndpoints } =\n createMetroMiddleware(metroConfig);\n\n // Get local URL to Metro bundler server (typically configured as 127.0.0.1:8081)\n const serverBaseUrl = metroBundler\n .getUrlCreator()\n .constructUrl({ scheme: 'http', hostType: 'localhost' });\n\n if (!isExporting) {\n // Enable correct CORS headers for Expo Router features\n prependMiddleware(middleware, createCorsMiddleware(exp));\n\n // Enable debug middleware for CDP-related debugging\n const { debugMiddleware, debugWebsocketEndpoints } = createDebugMiddleware({\n serverBaseUrl,\n reporter,\n });\n Object.assign(websocketEndpoints, debugWebsocketEndpoints);\n middleware.use(debugMiddleware);\n middleware.use('/_expo/debugger', createJsInspectorMiddleware());\n\n // TODO(cedric): `enhanceMiddleware` is deprecated, but is currently used to unify the middleware stacks\n // See: https://github.com/facebook/metro/commit/22e85fde85ec454792a1b70eba4253747a2587a9\n // See: https://github.com/facebook/metro/commit/d0d554381f119bb80ab09dbd6a1d310b54737e52\n const customEnhanceMiddleware = metroConfig.server.enhanceMiddleware;\n asWritable(metroConfig.server).enhanceMiddleware = (\n metroMiddleware: any,\n server: MetroServer\n ) => {\n if (customEnhanceMiddleware) {\n metroMiddleware = customEnhanceMiddleware(metroMiddleware, server);\n }\n return middleware.use(metroMiddleware);\n };\n\n const devtoolsWebsocketEndpoints = createDevToolsPluginWebsocketEndpoint();\n Object.assign(websocketEndpoints, devtoolsWebsocketEndpoints);\n }\n\n // Attach Expo Atlas if enabled\n await attachAtlasAsync({\n isExporting,\n exp,\n projectRoot,\n middleware,\n metroConfig,\n // NOTE(cedric): reset the Atlas file once, and reuse it for static exports\n resetAtlasFile: isExporting,\n });\n\n const { server, hmrServer, metro } = await runServer(\n metroBundler,\n metroConfig,\n {\n websocketEndpoints,\n watch: !isExporting && isWatchEnabled(),\n },\n {\n mockServer: isExporting,\n }\n );\n\n // Patch transform file to remove inconvenient customTransformOptions which are only used in single well-known files.\n const originalTransformFile = metro\n .getBundler()\n .getBundler()\n .transformFile.bind(metro.getBundler().getBundler());\n\n metro.getBundler().getBundler().transformFile = async function (\n filePath: string,\n transformOptions: TransformOptions,\n fileBuffer?: Buffer\n ) {\n return originalTransformFile(\n filePath,\n pruneCustomTransformOptions(\n projectRoot,\n filePath,\n // Clone the options so we don't mutate the original.\n {\n ...transformOptions,\n customTransformOptions: {\n __proto__: null,\n ...transformOptions.customTransformOptions,\n },\n }\n ),\n fileBuffer\n );\n };\n\n setEventReporter(eventsSocket.reportMetroEvent);\n\n // This function ensures that modules in source maps are sorted in the same\n // order as in a plain JS bundle.\n metro._getSortedModules = function (this: MetroServerWithModuleIdMod, graph: ReadOnlyGraph) {\n const modules = [...graph.dependencies.values()];\n\n const ctx = {\n // TODO(@kitten): Increase type-safety here\n platform: graph.transformOptions.platform!,\n environment: graph.transformOptions.customTransformOptions?.environment,\n };\n // Assign IDs to modules in a consistent order\n for (const module of modules) {\n this._createModuleId(module.path, ctx);\n }\n // Sort by IDs\n return modules.sort(\n (a, b) => this._createModuleId(a.path, ctx) - this._createModuleId(b.path, ctx)\n );\n };\n\n if (hmrServer) {\n let hmrJSBundle:\n | typeof import('@expo/metro-config/build/serializer/fork/hmrJSBundle').default\n | typeof import('@expo/metro/metro/DeltaBundler/Serializers/hmrJSBundle').default;\n\n try {\n hmrJSBundle = require('@expo/metro-config/build/serializer/fork/hmrJSBundle').default;\n } catch {\n // TODO: Add fallback for monorepo tests up until the fork is merged.\n Log.warn('Failed to load HMR serializer from @expo/metro-config, using fallback version.');\n hmrJSBundle = require('@expo/metro/metro/DeltaBundler/Serializers/hmrJSBundle');\n }\n\n // Patch HMR Server to send more info to the `_createModuleId` function for deterministic module IDs and add support for serializing HMR updates the same as all other bundles.\n hmrServer._prepareMessage = async function (\n this: MetroHmrServerWithModuleIdMod,\n group,\n options,\n changeEvent\n ) {\n // Fork of https://github.com/facebook/metro/blob/3b3e0aaf725cfa6907bf2c8b5fbc0da352d29efe/packages/metro/src/HmrServer.js#L327-L393\n // with patch for `_createModuleId`.\n const logger = !options.isInitialUpdate ? changeEvent?.logger : null;\n try {\n const revPromise = this._bundler.getRevision(group.revisionId);\n if (!revPromise) {\n return {\n type: 'error',\n body: formatBundlingError(new RevisionNotFoundError(group.revisionId)),\n };\n }\n logger?.point('updateGraph_start');\n const { revision, delta } = await this._bundler.updateGraph(await revPromise, false);\n logger?.point('updateGraph_end');\n this._clientGroups.delete(group.revisionId);\n group.revisionId = revision.id;\n for (const client of group.clients) {\n client.revisionIds = client.revisionIds.filter(\n (revisionId) => revisionId !== group.revisionId\n );\n client.revisionIds.push(revision.id);\n }\n this._clientGroups.set(group.revisionId, group);\n logger?.point('serialize_start');\n // NOTE(EvanBacon): This is the patch\n const moduleIdContext = {\n // TODO(@kitten): Increase type-safety here\n platform: revision.graph.transformOptions.platform!,\n environment: revision.graph.transformOptions.customTransformOptions?.environment,\n };\n const hmrUpdate = hmrJSBundle(delta, revision.graph, {\n clientUrl: group.clientUrl,\n // NOTE(EvanBacon): This is also the patch\n createModuleId: (moduleId: string) => {\n return this._createModuleId(moduleId, moduleIdContext);\n },\n includeAsyncPaths: group.graphOptions.lazy,\n projectRoot: this._config.projectRoot,\n serverRoot: this._config.server.unstable_serverRoot ?? this._config.projectRoot,\n });\n logger?.point('serialize_end');\n return {\n type: 'update',\n body: {\n revisionId: revision.id,\n isInitialUpdate: options.isInitialUpdate,\n ...hmrUpdate,\n },\n };\n } catch (error: any) {\n const formattedError = formatBundlingError(error);\n this._config.reporter.update({\n type: 'bundling_error',\n error,\n });\n return {\n type: 'error',\n body: formattedError,\n };\n }\n };\n }\n\n return {\n metro,\n hmrServer,\n server,\n middleware,\n messageSocket: messagesSocket,\n };\n}\n\n// TODO: Fork the entire transform function so we can simply regex the file contents for keywords instead.\nfunction pruneCustomTransformOptions(\n projectRoot: string,\n filePath: string,\n transformOptions: TransformOptions\n): TransformOptions {\n // Normalize the filepath for cross platform checking.\n filePath = filePath.split(path.sep).join('/');\n\n if (\n transformOptions.customTransformOptions?.dom &&\n // The only generated file that needs the dom root is `expo/dom/entry.js`\n !filePath.match(/expo\\/dom\\/entry\\.js$/)\n ) {\n // Clear the dom root option if we aren't transforming the magic entry file, this ensures\n // that cached artifacts from other DOM component bundles can be reused.\n transformOptions.customTransformOptions.dom = 'true';\n }\n\n const routerRoot = transformOptions.customTransformOptions?.routerRoot;\n if (typeof routerRoot === 'string') {\n const isRouterEntry = /\\/expo-router\\/_ctx/.test(filePath);\n // The router root is used all over expo-router (`process.env.EXPO_ROUTER_ABS_APP_ROOT`, `process.env.EXPO_ROUTER_APP_ROOT`) so we'll just ignore the entire package.\n const isRouterModule = /\\/expo-router\\/build\\//.test(filePath);\n // Any page/router inside the expo-router app folder may access the `routerRoot` option to determine whether it's in the app folder\n const resolvedRouterRoot = path.resolve(projectRoot, routerRoot).split(path.sep).join('/');\n const isRouterRoute = path.isAbsolute(filePath) && filePath.startsWith(resolvedRouterRoot);\n\n // In any other file than the above, we enforce that we mustn't use `routerRoot`, and set it to an arbitrary value here (the default)\n // to ensure that the cache never invalidates when this value is changed\n if (!isRouterEntry && !isRouterModule && !isRouterRoute) {\n transformOptions.customTransformOptions!.routerRoot = 'app';\n }\n }\n\n if (\n transformOptions.customTransformOptions?.asyncRoutes &&\n // The async routes settings are also used in `expo-router/_ctx.ios.js` (and other platform variants) via `process.env.EXPO_ROUTER_IMPORT_MODE`\n !(filePath.match(/\\/expo-router\\/_ctx/) || filePath.match(/\\/expo-router\\/build\\//))\n ) {\n delete transformOptions.customTransformOptions.asyncRoutes;\n }\n\n if (\n transformOptions.customTransformOptions?.clientBoundaries &&\n // The client boundaries are only used in `expo/virtual/rsc.js` for production RSC exports.\n !filePath.match(/\\/expo\\/virtual\\/rsc\\.js$/)\n ) {\n delete transformOptions.customTransformOptions.clientBoundaries;\n }\n\n return transformOptions;\n}\n\n/**\n * Simplify and communicate if Metro is running without watching file updates,.\n * Exposed for testing.\n */\nexport function isWatchEnabled() {\n if (env.CI) {\n Log.log(\n chalk`Metro is running in CI mode, reloads are disabled. Remove {bold CI=true} to enable watch mode.`\n );\n }\n\n return !env.CI;\n}\n"],"names":["instantiateMetroAsync","isWatchEnabled","loadMetroConfigAsync","asWritable","input","LogRespectingTerminal","Terminal","constructor","stream","ttyPrint","sendLog","msg","length","log","format","args","flush","console","info","terminal","process","stdout","projectRoot","options","exp","isExporting","getMetroBundler","config","reportEvent","autolinkingModuleResolutionEnabled","experiments","autolinkingModuleResolution","env","EXPO_USE_STICKY_RESOLVER","serverActionsEnabled","reactServerFunctions","EXPO_UNSTABLE_SERVER_FUNCTIONS","reactServerComponentRoutes","EXPO_USE_METRO_REQUIRE","reactCanary","Log","warn","serverRoot","getMetroServerRoot","terminalReporter","MetroTerminalReporter","configPath","EXPO_OVERRIDE_METRO_CONFIG","undefined","resolvedConfig","resolveConfig","defaultConfig","getDefaultConfig","isEmpty","mergeConfig","resetCache","maxWorkers","server","port","watchFolders","includes","reporter","update","event","globalThis","__requireCycleIgnorePatterns","resolver","requireCycleIgnorePatterns","transformer","publicPath","baseUrl","platformBundlers","getPlatformBundlers","reactCompiler","chalk","gray","EXPO_UNSTABLE_TREE_SHAKING","EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH","CommandError","EXPO_UNSTABLE_LOG_BOX","withMetroMultiPlatformAsync","isTsconfigPathsEnabled","tsconfigPaths","isAutolinkingResolverEnabled","isNamedRequiresEnabled","isReactServerComponentsEnabled","setEventReporter","logger","metroBundler","getConfig","skipSDKVersionRequirement","metroConfig","metro","getBundler","middleware","messagesSocket","eventsSocket","websocketEndpoints","createMetroMiddleware","serverBaseUrl","getUrlCreator","constructUrl","scheme","hostType","prependMiddleware","createCorsMiddleware","debugMiddleware","debugWebsocketEndpoints","createDebugMiddleware","Object","assign","use","createJsInspectorMiddleware","customEnhanceMiddleware","enhanceMiddleware","metroMiddleware","devtoolsWebsocketEndpoints","createDevToolsPluginWebsocketEndpoint","attachAtlasAsync","resetAtlasFile","hmrServer","runServer","watch","mockServer","originalTransformFile","transformFile","bind","filePath","transformOptions","fileBuffer","pruneCustomTransformOptions","customTransformOptions","__proto__","reportMetroEvent","_getSortedModules","graph","modules","dependencies","values","ctx","platform","environment","module","_createModuleId","path","sort","a","b","hmrJSBundle","require","default","_prepareMessage","group","changeEvent","isInitialUpdate","revision","revPromise","_bundler","getRevision","revisionId","type","body","formatBundlingError","RevisionNotFoundError","point","delta","updateGraph","_clientGroups","delete","id","client","clients","revisionIds","filter","push","set","moduleIdContext","hmrUpdate","clientUrl","createModuleId","moduleId","includeAsyncPaths","graphOptions","lazy","_config","unstable_serverRoot","error","formattedError","messageSocket","split","sep","join","dom","match","routerRoot","isRouterEntry","test","isRouterModule","resolvedRouterRoot","resolve","isRouterRoute","isAbsolute","startsWith","asyncRoutes","clientBoundaries","CI"],"mappings":";;;;;;;;;;;IA2NsBA,qBAAqB;eAArBA;;IAsSNC,cAAc;eAAdA;;IAzaMC,oBAAoB;eAApBA;;;;yBAxFqB;;;;;;;yBACR;;;;;;;gEAMD;;;;;;;gEAEF;;;;;;;yBACyB;;;;;;;yBAChC;;;;;;;yBACqC;;;;;;;gEAC5C;;;;;;;gEAED;;;;;;iDAEqC;uCAEhB;6BACL;uCACK;uCACA;+BACZ;wCACkB;qBACxB;qBACA;wBACS;gCACQ;6CACO;2BACV;kCACE;;;;;;AAsBpC,SAASC,WAAcC,KAAQ;IAC7B,OAAOA;AACT;AAEA,uGAAuG;AACvG,MAAMC,8BAA8BC,qBAAQ;IAC1CC,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G,sBAAsB,qBAAvCH,0CAAyC4E,gBAAgB,KACzD,2FAA2F;IAC3F,CAAC7E,SAASkE,KAAK,CAAC,8BAChB;QACA,OAAOjE,iBAAiBG,sBAAsB,CAACyE,gBAAgB;IACjE;IAEA,OAAO5E;AACT;AAMO,SAAS/H;IACd,IAAI+B,QAAG,CAAC6K,EAAE,EAAE;QACVrK,QAAG,CAAC3B,GAAG,CACL6D,IAAAA,gBAAK,CAAA,CAAC,8FAA8F,CAAC;IAEzG;IAEA,OAAO,CAAC1C,QAAG,CAAC6K,EAAE;AAChB"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/server/metro/instantiateMetro.ts"],"sourcesContent":["import { type ExpoConfig, getConfig } from '@expo/config';\nimport { getMetroServerRoot } from '@expo/config/paths';\nimport type { Reporter } from '@expo/metro/metro';\nimport type Bundler from '@expo/metro/metro/Bundler';\nimport type { ReadOnlyGraph } from '@expo/metro/metro/DeltaBundler';\nimport type { TransformOptions } from '@expo/metro/metro/DeltaBundler/Worker';\nimport MetroHmrServer, { Client as MetroHmrClient } from '@expo/metro/metro/HmrServer';\nimport RevisionNotFoundError from '@expo/metro/metro/IncrementalBundler/RevisionNotFoundError';\nimport type MetroServer from '@expo/metro/metro/Server';\nimport formatBundlingError from '@expo/metro/metro/lib/formatBundlingError';\nimport { mergeConfig, resolveConfig, type ConfigT } from '@expo/metro/metro-config';\nimport { Terminal } from '@expo/metro/metro-core';\nimport { createStableModuleIdFactory, getDefaultConfig } from '@expo/metro-config';\nimport chalk from 'chalk';\nimport http from 'http';\nimport path from 'path';\n\nimport { createDevToolsPluginWebsocketEndpoint } from './DevToolsPluginWebsocketEndpoint';\nimport { MetroBundlerDevServer } from './MetroBundlerDevServer';\nimport { MetroTerminalReporter } from './MetroTerminalReporter';\nimport { attachAtlasAsync } from './debugging/attachAtlas';\nimport { createDebugMiddleware } from './debugging/createDebugMiddleware';\nimport { createMetroMiddleware } from './dev-server/createMetroMiddleware';\nimport { runServer } from './runServer-fork';\nimport { withMetroMultiPlatformAsync } from './withMetroMultiPlatform';\nimport { Log } from '../../../log';\nimport { env } from '../../../utils/env';\nimport { CommandError } from '../../../utils/errors';\nimport { createCorsMiddleware } from '../middleware/CorsMiddleware';\nimport { createJsInspectorMiddleware } from '../middleware/inspector/createJsInspectorMiddleware';\nimport { prependMiddleware } from '../middleware/mutations';\nimport { getPlatformBundlers } from '../platformBundlers';\n\n// NOTE(@kitten): We pass a custom createStableModuleIdFactory function into the Metro module ID factory sometimes\ninterface MetroServerWithModuleIdMod extends MetroServer {\n _createModuleId: ReturnType<typeof createStableModuleIdFactory> & ((path: string) => number);\n}\ninterface MetroHmrServerWithModuleIdMod extends MetroHmrServer<MetroHmrClient> {\n _createModuleId: ReturnType<typeof createStableModuleIdFactory> & ((path: string) => number);\n}\n\n// From expo/dev-server but with ability to use custom logger.\ntype MessageSocket = {\n broadcast: (method: string, params?: Record<string, any> | undefined) => void;\n};\n\n// TODO(@kitten): We assign this here to run server-side code bundled by metro\n// It's not isolated into a worker thread yet\n// Check `metro-require/require.ts` for how this setting is used\ndeclare namespace globalThis {\n let __requireCycleIgnorePatterns: readonly RegExp[] | undefined;\n}\n\nfunction asWritable<T>(input: T): { -readonly [K in keyof T]: T[K] } {\n return input;\n}\n\n// Wrap terminal and polyfill console.log so we can log during bundling without breaking the indicator.\nclass LogRespectingTerminal extends Terminal {\n constructor(stream: import('node:net').Socket | import('node:stream').Writable) {\n super(stream, { ttyPrint: true });\n\n const sendLog = (...msg: any[]) => {\n if (!msg.length) {\n this.log('');\n } else {\n const [format, ...args] = msg;\n this.log(format, ...args);\n }\n // Flush the logs to the terminal immediately so logs at the end of the process are not lost.\n this.flush();\n };\n\n console.log = sendLog;\n console.info = sendLog;\n }\n}\n\n// Share one instance of Terminal for all instances of Metro.\nconst terminal = new LogRespectingTerminal(process.stdout);\n\ninterface LoadMetroConfigOptions {\n maxWorkers?: number;\n port?: number;\n reporter?: Reporter;\n resetCache?: boolean;\n}\n\nexport async function loadMetroConfigAsync(\n projectRoot: string,\n options: LoadMetroConfigOptions,\n {\n exp,\n isExporting,\n getMetroBundler,\n }: { exp: ExpoConfig; isExporting: boolean; getMetroBundler: () => Bundler }\n) {\n let reportEvent: ((event: any) => void) | undefined;\n\n const autolinkingModuleResolutionEnabled =\n exp.experiments?.autolinkingModuleResolution ?? env.EXPO_USE_STICKY_RESOLVER;\n\n const serverActionsEnabled =\n exp.experiments?.reactServerFunctions ?? env.EXPO_UNSTABLE_SERVER_FUNCTIONS;\n\n if (serverActionsEnabled) {\n process.env.EXPO_UNSTABLE_SERVER_FUNCTIONS = '1';\n }\n\n // NOTE: Enable all the experimental Metro flags when RSC is enabled.\n if (exp.experiments?.reactServerComponentRoutes || serverActionsEnabled) {\n process.env.EXPO_USE_METRO_REQUIRE = '1';\n }\n\n if (exp.experiments?.reactCanary) {\n Log.warn(`React 19 is enabled by default. Remove unused experiments.reactCanary flag.`);\n }\n\n const serverRoot = getMetroServerRoot(projectRoot);\n const terminalReporter = new MetroTerminalReporter(serverRoot, terminal);\n\n // NOTE: Allow external tools to override the metro config. This is considered internal and unstable\n const configPath = env.EXPO_OVERRIDE_METRO_CONFIG ?? undefined;\n const resolvedConfig = await resolveConfig(configPath, projectRoot);\n const defaultConfig = getDefaultConfig(projectRoot);\n\n let config: ConfigT = resolvedConfig.isEmpty\n ? defaultConfig\n : await mergeConfig(defaultConfig, resolvedConfig.config);\n\n // Set the watchfolders to include the projectRoot, as Metro assumes this\n // Force-override the reporter\n config = {\n ...config,\n\n // See: `overrideConfigWithArguments` https://github.com/facebook/metro/blob/5059e26/packages/metro-config/src/loadConfig.js#L274-L339\n // Compare to `LoadOptions` type (disregard `reporter` as we don't expose this)\n resetCache: !!options.resetCache,\n maxWorkers: options.maxWorkers ?? config.maxWorkers,\n server: {\n ...config.server,\n port: options.port ?? config.server.port,\n },\n\n watchFolders: !config.watchFolders.includes(config.projectRoot)\n ? [config.projectRoot, ...config.watchFolders]\n : config.watchFolders,\n reporter: {\n update(event) {\n terminalReporter.update(event);\n if (reportEvent) {\n reportEvent(event);\n }\n },\n },\n };\n\n globalThis.__requireCycleIgnorePatterns = config.resolver?.requireCycleIgnorePatterns;\n\n if (isExporting) {\n // This token will be used in the asset plugin to ensure the path is correct for writing locally.\n asWritable(config.transformer).publicPath = `/assets?export_path=${\n (exp.experiments?.baseUrl ?? '') + '/assets'\n }`;\n } else {\n asWritable(config.transformer).publicPath = '/assets/?unstable_path=.';\n }\n\n const platformBundlers = getPlatformBundlers(projectRoot, exp);\n\n if (exp.experiments?.reactCompiler) {\n Log.log(chalk.gray`React Compiler enabled`);\n }\n\n if (env.EXPO_UNSTABLE_TREE_SHAKING && !env.EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH) {\n throw new CommandError(\n 'EXPO_UNSTABLE_TREE_SHAKING requires EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH to be enabled.'\n );\n }\n\n if (env.EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH) {\n Log.warn(`Experimental bundle optimization is enabled.`);\n }\n if (env.EXPO_UNSTABLE_TREE_SHAKING) {\n Log.warn(`Experimental tree shaking is enabled.`);\n }\n if (env.EXPO_UNSTABLE_LOG_BOX) {\n Log.warn(`Experimental Expo LogBox is enabled.`);\n }\n if (autolinkingModuleResolutionEnabled) {\n Log.warn(`Experimental Expo Autolinking module resolver is enabled.`);\n }\n\n if (serverActionsEnabled) {\n Log.warn(\n `React Server Functions (beta) are enabled. Route rendering mode: ${exp.experiments?.reactServerComponentRoutes ? 'server' : 'client'}`\n );\n }\n\n config = await withMetroMultiPlatformAsync(projectRoot, {\n config,\n exp,\n platformBundlers,\n isTsconfigPathsEnabled: exp.experiments?.tsconfigPaths ?? true,\n isAutolinkingResolverEnabled: autolinkingModuleResolutionEnabled,\n isExporting,\n isNamedRequiresEnabled: env.EXPO_USE_METRO_REQUIRE,\n isReactServerComponentsEnabled: !!exp.experiments?.reactServerComponentRoutes,\n getMetroBundler,\n });\n\n return {\n config,\n setEventReporter: (logger: (event: any) => void) => (reportEvent = logger),\n reporter: terminalReporter,\n };\n}\n\ninterface InstantiateMetroConfigOptions extends LoadMetroConfigOptions {\n host?: string;\n}\n\n/** The most generic possible setup for Metro bundler. */\nexport async function instantiateMetroAsync(\n metroBundler: MetroBundlerDevServer,\n options: InstantiateMetroConfigOptions,\n {\n isExporting,\n exp = getConfig(metroBundler.projectRoot, {\n skipSDKVersionRequirement: true,\n }).exp,\n }: { isExporting: boolean; exp?: ExpoConfig }\n): Promise<{\n metro: MetroServer;\n hmrServer: MetroHmrServer<MetroHmrClient> | null;\n server: http.Server;\n middleware: any;\n messageSocket: MessageSocket;\n}> {\n const projectRoot = metroBundler.projectRoot;\n\n const {\n config: metroConfig,\n setEventReporter,\n reporter,\n } = await loadMetroConfigAsync(projectRoot, options, {\n exp,\n isExporting,\n getMetroBundler() {\n return metro.getBundler().getBundler();\n },\n });\n\n // Create the core middleware stack for Metro, including websocket listeners\n const { middleware, messagesSocket, eventsSocket, websocketEndpoints } =\n createMetroMiddleware(metroConfig);\n\n // Get local URL to Metro bundler server (typically configured as 127.0.0.1:8081)\n const serverBaseUrl = metroBundler\n .getUrlCreator()\n .constructUrl({ scheme: 'http', hostType: 'localhost' });\n\n if (!isExporting) {\n // Enable correct CORS headers for Expo Router features\n prependMiddleware(middleware, createCorsMiddleware(exp));\n\n // Enable debug middleware for CDP-related debugging\n const { debugMiddleware, debugWebsocketEndpoints } = createDebugMiddleware({\n serverBaseUrl,\n reporter,\n });\n Object.assign(websocketEndpoints, debugWebsocketEndpoints);\n middleware.use(debugMiddleware);\n middleware.use('/_expo/debugger', createJsInspectorMiddleware());\n\n // TODO(cedric): `enhanceMiddleware` is deprecated, but is currently used to unify the middleware stacks\n // See: https://github.com/facebook/metro/commit/22e85fde85ec454792a1b70eba4253747a2587a9\n // See: https://github.com/facebook/metro/commit/d0d554381f119bb80ab09dbd6a1d310b54737e52\n const customEnhanceMiddleware = metroConfig.server.enhanceMiddleware;\n asWritable(metroConfig.server).enhanceMiddleware = (\n metroMiddleware: any,\n server: MetroServer\n ) => {\n if (customEnhanceMiddleware) {\n metroMiddleware = customEnhanceMiddleware(metroMiddleware, server);\n }\n return middleware.use(metroMiddleware);\n };\n\n const devtoolsWebsocketEndpoints = createDevToolsPluginWebsocketEndpoint();\n Object.assign(websocketEndpoints, devtoolsWebsocketEndpoints);\n }\n\n // Attach Expo Atlas if enabled\n await attachAtlasAsync({\n isExporting,\n exp,\n projectRoot,\n middleware,\n metroConfig,\n // NOTE(cedric): reset the Atlas file once, and reuse it for static exports\n resetAtlasFile: isExporting,\n });\n\n const { server, hmrServer, metro } = await runServer(\n metroBundler,\n metroConfig,\n {\n host: options.host,\n websocketEndpoints,\n watch: !isExporting && isWatchEnabled(),\n },\n {\n mockServer: isExporting,\n }\n );\n\n // Patch transform file to remove inconvenient customTransformOptions which are only used in single well-known files.\n const originalTransformFile = metro\n .getBundler()\n .getBundler()\n .transformFile.bind(metro.getBundler().getBundler());\n\n metro.getBundler().getBundler().transformFile = async function (\n filePath: string,\n transformOptions: TransformOptions,\n fileBuffer?: Buffer\n ) {\n return originalTransformFile(\n filePath,\n pruneCustomTransformOptions(\n projectRoot,\n filePath,\n // Clone the options so we don't mutate the original.\n {\n ...transformOptions,\n customTransformOptions: {\n __proto__: null,\n ...transformOptions.customTransformOptions,\n },\n }\n ),\n fileBuffer\n );\n };\n\n setEventReporter(eventsSocket.reportMetroEvent);\n\n // This function ensures that modules in source maps are sorted in the same\n // order as in a plain JS bundle.\n metro._getSortedModules = function (this: MetroServerWithModuleIdMod, graph: ReadOnlyGraph) {\n const modules = [...graph.dependencies.values()];\n\n const ctx = {\n // TODO(@kitten): Increase type-safety here\n platform: graph.transformOptions.platform!,\n environment: graph.transformOptions.customTransformOptions?.environment,\n };\n // Assign IDs to modules in a consistent order\n for (const module of modules) {\n this._createModuleId(module.path, ctx);\n }\n // Sort by IDs\n return modules.sort(\n (a, b) => this._createModuleId(a.path, ctx) - this._createModuleId(b.path, ctx)\n );\n };\n\n if (hmrServer) {\n let hmrJSBundle:\n | typeof import('@expo/metro-config/build/serializer/fork/hmrJSBundle').default\n | typeof import('@expo/metro/metro/DeltaBundler/Serializers/hmrJSBundle').default;\n\n try {\n hmrJSBundle = require('@expo/metro-config/build/serializer/fork/hmrJSBundle').default;\n } catch {\n // TODO: Add fallback for monorepo tests up until the fork is merged.\n Log.warn('Failed to load HMR serializer from @expo/metro-config, using fallback version.');\n hmrJSBundle = require('@expo/metro/metro/DeltaBundler/Serializers/hmrJSBundle');\n }\n\n // Patch HMR Server to send more info to the `_createModuleId` function for deterministic module IDs and add support for serializing HMR updates the same as all other bundles.\n hmrServer._prepareMessage = async function (\n this: MetroHmrServerWithModuleIdMod,\n group,\n options,\n changeEvent\n ) {\n // Fork of https://github.com/facebook/metro/blob/3b3e0aaf725cfa6907bf2c8b5fbc0da352d29efe/packages/metro/src/HmrServer.js#L327-L393\n // with patch for `_createModuleId`.\n const logger = !options.isInitialUpdate ? changeEvent?.logger : null;\n try {\n const revPromise = this._bundler.getRevision(group.revisionId);\n if (!revPromise) {\n return {\n type: 'error',\n body: formatBundlingError(new RevisionNotFoundError(group.revisionId)),\n };\n }\n logger?.point('updateGraph_start');\n const { revision, delta } = await this._bundler.updateGraph(await revPromise, false);\n logger?.point('updateGraph_end');\n this._clientGroups.delete(group.revisionId);\n group.revisionId = revision.id;\n for (const client of group.clients) {\n client.revisionIds = client.revisionIds.filter(\n (revisionId) => revisionId !== group.revisionId\n );\n client.revisionIds.push(revision.id);\n }\n this._clientGroups.set(group.revisionId, group);\n logger?.point('serialize_start');\n // NOTE(EvanBacon): This is the patch\n const moduleIdContext = {\n // TODO(@kitten): Increase type-safety here\n platform: revision.graph.transformOptions.platform!,\n environment: revision.graph.transformOptions.customTransformOptions?.environment,\n };\n const hmrUpdate = hmrJSBundle(delta, revision.graph, {\n clientUrl: group.clientUrl,\n // NOTE(EvanBacon): This is also the patch\n createModuleId: (moduleId: string) => {\n return this._createModuleId(moduleId, moduleIdContext);\n },\n includeAsyncPaths: group.graphOptions.lazy,\n projectRoot: this._config.projectRoot,\n serverRoot: this._config.server.unstable_serverRoot ?? this._config.projectRoot,\n });\n logger?.point('serialize_end');\n return {\n type: 'update',\n body: {\n revisionId: revision.id,\n isInitialUpdate: options.isInitialUpdate,\n ...hmrUpdate,\n },\n };\n } catch (error: any) {\n const formattedError = formatBundlingError(error);\n this._config.reporter.update({\n type: 'bundling_error',\n error,\n });\n return {\n type: 'error',\n body: formattedError,\n };\n }\n };\n }\n\n return {\n metro,\n hmrServer,\n server,\n middleware,\n messageSocket: messagesSocket,\n };\n}\n\n// TODO: Fork the entire transform function so we can simply regex the file contents for keywords instead.\nfunction pruneCustomTransformOptions(\n projectRoot: string,\n filePath: string,\n transformOptions: TransformOptions\n): TransformOptions {\n // Normalize the filepath for cross platform checking.\n filePath = filePath.split(path.sep).join('/');\n\n if (\n transformOptions.customTransformOptions?.dom &&\n // The only generated file that needs the dom root is `expo/dom/entry.js`\n !filePath.match(/expo\\/dom\\/entry\\.js$/)\n ) {\n // Clear the dom root option if we aren't transforming the magic entry file, this ensures\n // that cached artifacts from other DOM component bundles can be reused.\n transformOptions.customTransformOptions.dom = 'true';\n }\n\n const routerRoot = transformOptions.customTransformOptions?.routerRoot;\n if (typeof routerRoot === 'string') {\n const isRouterEntry = /\\/expo-router\\/_ctx/.test(filePath);\n // The router root is used all over expo-router (`process.env.EXPO_ROUTER_ABS_APP_ROOT`, `process.env.EXPO_ROUTER_APP_ROOT`) so we'll just ignore the entire package.\n const isRouterModule = /\\/expo-router\\/build\\//.test(filePath);\n // Any page/router inside the expo-router app folder may access the `routerRoot` option to determine whether it's in the app folder\n const resolvedRouterRoot = path.resolve(projectRoot, routerRoot).split(path.sep).join('/');\n const isRouterRoute = path.isAbsolute(filePath) && filePath.startsWith(resolvedRouterRoot);\n\n // In any other file than the above, we enforce that we mustn't use `routerRoot`, and set it to an arbitrary value here (the default)\n // to ensure that the cache never invalidates when this value is changed\n if (!isRouterEntry && !isRouterModule && !isRouterRoute) {\n transformOptions.customTransformOptions!.routerRoot = 'app';\n }\n }\n\n if (\n transformOptions.customTransformOptions?.asyncRoutes &&\n // The async routes settings are also used in `expo-router/_ctx.ios.js` (and other platform variants) via `process.env.EXPO_ROUTER_IMPORT_MODE`\n !(filePath.match(/\\/expo-router\\/_ctx/) || filePath.match(/\\/expo-router\\/build\\//))\n ) {\n delete transformOptions.customTransformOptions.asyncRoutes;\n }\n\n if (\n transformOptions.customTransformOptions?.clientBoundaries &&\n // The client boundaries are only used in `expo/virtual/rsc.js` for production RSC exports.\n !filePath.match(/\\/expo\\/virtual\\/rsc\\.js$/)\n ) {\n delete transformOptions.customTransformOptions.clientBoundaries;\n }\n\n return transformOptions;\n}\n\n/**\n * Simplify and communicate if Metro is running without watching file updates,.\n * Exposed for testing.\n */\nexport function isWatchEnabled() {\n if (env.CI) {\n Log.log(\n chalk`Metro is running in CI mode, reloads are disabled. Remove {bold CI=true} to enable watch mode.`\n );\n }\n\n return !env.CI;\n}\n"],"names":["instantiateMetroAsync","isWatchEnabled","loadMetroConfigAsync","asWritable","input","LogRespectingTerminal","Terminal","constructor","stream","ttyPrint","sendLog","msg","length","log","format","args","flush","console","info","terminal","process","stdout","projectRoot","options","exp","isExporting","getMetroBundler","config","reportEvent","autolinkingModuleResolutionEnabled","experiments","autolinkingModuleResolution","env","EXPO_USE_STICKY_RESOLVER","serverActionsEnabled","reactServerFunctions","EXPO_UNSTABLE_SERVER_FUNCTIONS","reactServerComponentRoutes","EXPO_USE_METRO_REQUIRE","reactCanary","Log","warn","serverRoot","getMetroServerRoot","terminalReporter","MetroTerminalReporter","configPath","EXPO_OVERRIDE_METRO_CONFIG","undefined","resolvedConfig","resolveConfig","defaultConfig","getDefaultConfig","isEmpty","mergeConfig","resetCache","maxWorkers","server","port","watchFolders","includes","reporter","update","event","globalThis","__requireCycleIgnorePatterns","resolver","requireCycleIgnorePatterns","transformer","publicPath","baseUrl","platformBundlers","getPlatformBundlers","reactCompiler","chalk","gray","EXPO_UNSTABLE_TREE_SHAKING","EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH","CommandError","EXPO_UNSTABLE_LOG_BOX","withMetroMultiPlatformAsync","isTsconfigPathsEnabled","tsconfigPaths","isAutolinkingResolverEnabled","isNamedRequiresEnabled","isReactServerComponentsEnabled","setEventReporter","logger","metroBundler","getConfig","skipSDKVersionRequirement","metroConfig","metro","getBundler","middleware","messagesSocket","eventsSocket","websocketEndpoints","createMetroMiddleware","serverBaseUrl","getUrlCreator","constructUrl","scheme","hostType","prependMiddleware","createCorsMiddleware","debugMiddleware","debugWebsocketEndpoints","createDebugMiddleware","Object","assign","use","createJsInspectorMiddleware","customEnhanceMiddleware","enhanceMiddleware","metroMiddleware","devtoolsWebsocketEndpoints","createDevToolsPluginWebsocketEndpoint","attachAtlasAsync","resetAtlasFile","hmrServer","runServer","host","watch","mockServer","originalTransformFile","transformFile","bind","filePath","transformOptions","fileBuffer","pruneCustomTransformOptions","customTransformOptions","__proto__","reportMetroEvent","_getSortedModules","graph","modules","dependencies","values","ctx","platform","environment","module","_createModuleId","path","sort","a","b","hmrJSBundle","require","default","_prepareMessage","group","changeEvent","isInitialUpdate","revision","revPromise","_bundler","getRevision","revisionId","type","body","formatBundlingError","RevisionNotFoundError","point","delta","updateGraph","_clientGroups","delete","id","client","clients","revisionIds","filter","push","set","moduleIdContext","hmrUpdate","clientUrl","createModuleId","moduleId","includeAsyncPaths","graphOptions","lazy","_config","unstable_serverRoot","error","formattedError","messageSocket","split","sep","join","dom","match","routerRoot","isRouterEntry","test","isRouterModule","resolvedRouterRoot","resolve","isRouterRoute","isAbsolute","startsWith","asyncRoutes","clientBoundaries","CI"],"mappings":";;;;;;;;;;;IA+NsBA,qBAAqB;eAArBA;;IAuSNC,cAAc;eAAdA;;IA9aMC,oBAAoB;eAApBA;;;;yBAxFqB;;;;;;;yBACR;;;;;;;gEAMD;;;;;;;gEAEF;;;;;;;y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sBAAsB,CAAE+D,UAAU,GAAG;QACxD;IACF;IAEA,IACElE,EAAAA,4CAAAA,iBAAiBG,sBAAsB,qBAAvCH,0CAAyC2E,WAAW,KACpD,+IAA+I;IAC/I,CAAE5E,CAAAA,SAASkE,KAAK,CAAC,0BAA0BlE,SAASkE,KAAK,CAAC,yBAAwB,GAClF;QACA,OAAOjE,iBAAiBG,sBAAsB,CAACwE,WAAW;IAC5D;IAEA,IACE3E,EAAAA,4CAAAA,iBAAiBG,sBAAsB,qBAAvCH,0CAAyC4E,gBAAgB,KACzD,2FAA2F;IAC3F,CAAC7E,SAASkE,KAAK,CAAC,8BAChB;QACA,OAAOjE,iBAAiBG,sBAAsB,CAACyE,gBAAgB;IACjE;IAEA,OAAO5E;AACT;AAMO,SAAShI;IACd,IAAI+B,QAAG,CAAC8K,EAAE,EAAE;QACVtK,QAAG,CAAC3B,GAAG,CACL6D,IAAAA,gBAAK,CAAA,CAAC,8FAA8F,CAAC;IAEzG;IAEA,OAAO,CAAC1C,QAAG,CAAC8K,EAAE;AAChB"}
|
|
@@ -221,8 +221,9 @@ class WebpackBundlerDevServer extends _BundlerDevServer.BundlerDevServer {
|
|
|
221
221
|
// Create a webpack compiler that is configured with custom messages.
|
|
222
222
|
const compiler = webpack(config);
|
|
223
223
|
const server = new WebpackDevServer(compiler, config.devServer);
|
|
224
|
+
const host = _env.env.WEB_HOST ?? (options.location.hostType === 'localhost' ? 'localhost' : undefined);
|
|
224
225
|
// Launch WebpackDevServer.
|
|
225
|
-
server.listen(port,
|
|
226
|
+
server.listen(port, host, function(error) {
|
|
226
227
|
if (error) {
|
|
227
228
|
_log.error(error.message);
|
|
228
229
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/server/webpack/WebpackBundlerDevServer.ts"],"sourcesContent":["import chalk from 'chalk';\nimport type { Application } from 'express';\nimport fs from 'node:fs';\nimport http from 'node:http';\nimport path from 'node:path';\nimport resolveFrom from 'resolve-from';\nimport type webpack from 'webpack';\nimport type WebpackDevServer from 'webpack-dev-server';\n\nimport { compileAsync } from './compile';\nimport {\n importExpoWebpackConfigFromProject,\n importWebpackDevServerFromProject,\n importWebpackFromProject,\n} from './resolveFromProject';\nimport { ensureEnvironmentSupportsTLSAsync } from './tls';\nimport * as Log from '../../../log';\nimport { env } from '../../../utils/env';\nimport { CommandError } from '../../../utils/errors';\nimport { getIpAddress } from '../../../utils/ip';\nimport { setNodeEnv } from '../../../utils/nodeEnv';\nimport { choosePortAsync } from '../../../utils/port';\nimport { createProgressBar } from '../../../utils/progress';\nimport { ensureDotExpoProjectDirectoryInitialized } from '../../project/dotExpo';\nimport { BundlerDevServer, BundlerStartOptions, DevServerInstance } from '../BundlerDevServer';\n\nconst debug = require('debug')('expo:start:server:webpack:devServer') as typeof console.log;\n\nexport type WebpackConfiguration = webpack.Configuration & {\n devServer?: {\n before?: (app: Application, server: WebpackDevServer, compiler: webpack.Compiler) => void;\n };\n};\n\nfunction assertIsWebpackDevServer(value: any): asserts value is WebpackDevServer {\n if (!value?.sockWrite && !value?.sendMessage) {\n throw new CommandError(\n 'WEBPACK',\n value\n ? 'Expected Webpack dev server, found: ' + (value.constructor?.name ?? value)\n : 'Webpack dev server not started yet.'\n );\n }\n}\n\nexport class WebpackBundlerDevServer extends BundlerDevServer {\n get name(): string {\n return 'webpack';\n }\n\n public async startTypeScriptServices(): Promise<void> {\n // noop -- this feature is Metro-only.\n }\n\n public broadcastMessage(\n method: string | 'reload' | 'devMenu' | 'sendDevCommand',\n params?: Record<string, any>\n ): void {\n if (!this.instance) {\n return;\n }\n\n assertIsWebpackDevServer(this.instance?.server);\n\n // TODO(EvanBacon): Custom Webpack overlay.\n // Default webpack-dev-server sockets use \"content-changed\" instead of \"reload\" (what we use on native).\n // For now, just manually convert the value so our CLI interface can be unified.\n const hackyConvertedMessage = method === 'reload' ? 'content-changed' : method;\n\n if (\n 'sendMessage' in this.instance.server &&\n typeof this.instance.server.sendMessage === 'function'\n ) {\n // NOTE: https://github.com/expo/expo/issues/21994#issuecomment-1517122501\n this.instance.server.sendMessage(this.instance.server.sockets, hackyConvertedMessage, params);\n } else {\n this.instance.server.sockWrite(this.instance.server.sockets, hackyConvertedMessage, params);\n }\n }\n\n isTargetingNative(): boolean {\n return false;\n }\n\n private async getAvailablePortAsync(options: { defaultPort?: number }): Promise<number> {\n try {\n const defaultPort = options?.defaultPort ?? 19006;\n const port = await choosePortAsync(this.projectRoot, {\n defaultPort,\n host: env.WEB_HOST,\n });\n if (!port) {\n throw new CommandError('NO_PORT_FOUND', `Port ${defaultPort} not available.`);\n }\n return port;\n } catch (error: any) {\n throw new CommandError('NO_PORT_FOUND', error.message);\n }\n }\n\n async bundleAsync({ mode, clear }: { mode: 'development' | 'production'; clear: boolean }) {\n // Do this first to fail faster.\n const webpack = importWebpackFromProject(this.projectRoot);\n\n if (clear) {\n await this.clearWebProjectCacheAsync(this.projectRoot, mode);\n }\n\n const config = await this.loadConfigAsync({\n isImageEditingEnabled: true,\n mode,\n });\n\n if (!config.plugins) {\n config.plugins = [];\n }\n\n const bar = createProgressBar(chalk`{bold Web} Bundling Javascript [:bar] :percent`, {\n width: 64,\n total: 100,\n clear: true,\n complete: '=',\n incomplete: ' ',\n });\n\n // NOTE(EvanBacon): Add a progress bar to the webpack logger if defined (e.g. not in CI).\n if (bar != null) {\n config.plugins.push(\n new webpack.ProgressPlugin((percent: number) => {\n bar?.update(percent);\n if (percent === 1) {\n bar?.terminate();\n }\n })\n );\n }\n\n // Create a webpack compiler that is configured with custom messages.\n const compiler = webpack(config);\n\n try {\n await compileAsync(compiler);\n } catch (error: any) {\n Log.error(chalk.red('Failed to compile'));\n throw error;\n } finally {\n bar?.terminate();\n }\n }\n\n protected async startImplementationAsync(\n options: BundlerStartOptions\n ): Promise<DevServerInstance> {\n // Do this first to fail faster.\n const webpack = importWebpackFromProject(this.projectRoot);\n const WebpackDevServer = importWebpackDevServerFromProject(this.projectRoot);\n\n await this.stopAsync();\n\n options.port = await this.getAvailablePortAsync({\n defaultPort: options.port,\n });\n const { resetDevServer, https, port, mode } = options;\n\n this.urlCreator = this.getUrlCreator({\n port,\n location: {\n scheme: https ? 'https' : 'http',\n },\n });\n\n debug('Starting webpack on port: ' + port);\n\n if (resetDevServer) {\n await this.clearWebProjectCacheAsync(this.projectRoot, mode);\n }\n\n if (https) {\n debug('Configuring TLS to enable HTTPS support');\n await ensureEnvironmentSupportsTLSAsync(this.projectRoot).catch((error) => {\n Log.error(`Error creating TLS certificates: ${error}`);\n });\n }\n\n const config = await this.loadConfigAsync(options);\n\n Log.log(chalk`Starting Webpack on port ${port} in {underline ${mode}} mode.`);\n\n // Create a webpack compiler that is configured with custom messages.\n const compiler = webpack(config);\n\n const server = new WebpackDevServer(compiler, config.devServer);\n // Launch WebpackDevServer.\n server.listen(port, env.WEB_HOST, function (this: http.Server, error) {\n if (error) {\n Log.error(error.message);\n }\n });\n\n // Extend the close method to ensure that we clean up the local info.\n const originalClose = server.close.bind(server);\n\n server.close = (callback?: (err?: Error) => void) => {\n return originalClose((err?: Error) => {\n this.instance = null;\n callback?.(err);\n });\n };\n\n const _host = getIpAddress();\n const protocol = https ? 'https' : 'http';\n\n return {\n // Server instance\n server,\n // URL Info\n location: {\n url: `${protocol}://${_host}:${port}`,\n port,\n protocol,\n host: _host,\n },\n middleware: null,\n // Match the native protocol.\n messageSocket: {\n broadcast: this.broadcastMessage,\n },\n };\n }\n\n /** Load the Webpack config. Exposed for testing. */\n getProjectConfigFilePath(): string | null {\n // Check if the project has a webpack.config.js in the root.\n return (\n this.getConfigModuleIds().reduce<string | null | undefined>(\n (prev, moduleId) => prev || resolveFrom.silent(this.projectRoot, moduleId),\n null\n ) ?? null\n );\n }\n\n async loadConfigAsync(\n options: Pick<BundlerStartOptions, 'mode' | 'isImageEditingEnabled' | 'https'>,\n argv?: string[]\n ): Promise<WebpackConfiguration> {\n // let bar: ProgressBar | null = null;\n\n const env = {\n projectRoot: this.projectRoot,\n pwa: !!options.isImageEditingEnabled,\n // TODO: Use a new loader in Webpack config...\n logger: {\n info() {},\n },\n mode: options.mode,\n https: options.https,\n };\n setNodeEnv(env.mode ?? 'development');\n require('@expo/env').load(env.projectRoot);\n // Check if the project has a webpack.config.js in the root.\n const projectWebpackConfig = this.getProjectConfigFilePath();\n let config: WebpackConfiguration;\n if (projectWebpackConfig) {\n const webpackConfig = require(projectWebpackConfig);\n if (typeof webpackConfig === 'function') {\n config = await webpackConfig(env, argv);\n } else {\n config = webpackConfig;\n }\n } else {\n // Fallback to the default expo webpack config.\n const loadDefaultConfigAsync = importExpoWebpackConfigFromProject(this.projectRoot);\n config = await loadDefaultConfigAsync(env, argv);\n }\n return config;\n }\n\n protected getConfigModuleIds(): string[] {\n return ['./webpack.config.js'];\n }\n\n protected async clearWebProjectCacheAsync(\n projectRoot: string,\n mode: string = 'development'\n ): Promise<void> {\n Log.log(chalk.dim(`Clearing Webpack ${mode} cache directory...`));\n\n const dir = await ensureDotExpoProjectDirectoryInitialized(projectRoot);\n const cacheFolder = path.join(dir, 'web/cache', mode);\n try {\n await fs.promises.rm(cacheFolder, { recursive: true, force: true });\n } catch (error: any) {\n Log.error(`Could not clear ${mode} web cache directory: ${error.message}`);\n }\n }\n}\n\nexport function getProjectWebpackConfigFilePath(projectRoot: string) {\n return resolveFrom.silent(projectRoot, './webpack.config.js');\n}\n"],"names":["WebpackBundlerDevServer","getProjectWebpackConfigFilePath","debug","require","assertIsWebpackDevServer","value","sockWrite","sendMessage","CommandError","constructor","name","BundlerDevServer","startTypeScriptServices","broadcastMessage","method","params","instance","server","hackyConvertedMessage","sockets","isTargetingNative","getAvailablePortAsync","options","defaultPort","port","choosePortAsync","projectRoot","host","env","WEB_HOST","error","message","bundleAsync","mode","clear","webpack","importWebpackFromProject","clearWebProjectCacheAsync","config","loadConfigAsync","isImageEditingEnabled","plugins","bar","createProgressBar","chalk","width","total","complete","incomplete","push","ProgressPlugin","percent","update","terminate","compiler","compileAsync","Log","red","startImplementationAsync","WebpackDevServer","importWebpackDevServerFromProject","stopAsync","resetDevServer","https","urlCreator","getUrlCreator","location","scheme","ensureEnvironmentSupportsTLSAsync","catch","log","devServer","listen","originalClose","close","bind","callback","err","_host","getIpAddress","protocol","url","middleware","messageSocket","broadcast","getProjectConfigFilePath","getConfigModuleIds","reduce","prev","moduleId","resolveFrom","silent","argv","pwa","logger","info","setNodeEnv","load","projectWebpackConfig","webpackConfig","loadDefaultConfigAsync","importExpoWebpackConfigFromProject","dim","dir","ensureDotExpoProjectDirectoryInitialized","cacheFolder","path","join","fs","promises","rm","recursive","force"],"mappings":";;;;;;;;;;;IA6CaA,uBAAuB;eAAvBA;;IA4PGC,+BAA+B;eAA/BA;;;;gEAzSE;;;;;;;gEAEH;;;;;;;gEAEE;;;;;;;gEACO;;;;;;yBAIK;oCAKtB;qBAC2C;6DAC7B;qBACD;wBACS;oBACA;yBACF;sBACK;0BACE;yBACuB;kCACgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEzE,MAAMC,QAAQC,QAAQ,SAAS;AAQ/B,SAASC,yBAAyBC,KAAU;IAC1C,IAAI,EAACA,yBAAAA,MAAOC,SAAS,KAAI,EAACD,yBAAAA,MAAOE,WAAW,GAAE;YAIIF;QAHhD,MAAM,IAAIG,oBAAY,CACpB,WACAH,QACI,yCAA0CA,CAAAA,EAAAA,qBAAAA,MAAMI,WAAW,qBAAjBJ,mBAAmBK,IAAI,KAAIL,KAAI,IACzE;IAER;AACF;AAEO,MAAML,gCAAgCW,kCAAgB;IAC3D,IAAID,OAAe;QACjB,OAAO;IACT;IAEA,MAAaE,0BAAyC;IACpD,uCAAuC;IACzC;IAEOC,iBACLC,MAAwD,EACxDC,MAA4B,EACtB;YAKmB;QAJzB,IAAI,CAAC,IAAI,CAACC,QAAQ,EAAE;YAClB;QACF;QAEAZ,0BAAyB,iBAAA,IAAI,CAACY,QAAQ,qBAAb,eAAeC,MAAM;QAE9C,2CAA2C;QAC3C,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AAcC,mBAAI,CAACC,IAAI,CAACJ,KAAK,aAAatE;QAChD,IAAI;YACF,MAAM2E,iBAAE,CAACC,QAAQ,CAACC,EAAE,CAACL,aAAa;gBAAEM,WAAW;gBAAMC,OAAO;YAAK;QACnE,EAAE,OAAOlF,OAAY;YACnB0B,KAAI1B,KAAK,CAAC,CAAC,gBAAgB,EAAEG,KAAK,sBAAsB,EAAEH,MAAMC,OAAO,EAAE;QAC3E;IACF;AACF;AAEO,SAAS9B,gCAAgCyB,WAAmB;IACjE,OAAOgE,sBAAW,CAACC,MAAM,CAACjE,aAAa;AACzC"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/server/webpack/WebpackBundlerDevServer.ts"],"sourcesContent":["import chalk from 'chalk';\nimport type { Application } from 'express';\nimport fs from 'node:fs';\nimport http from 'node:http';\nimport path from 'node:path';\nimport resolveFrom from 'resolve-from';\nimport type webpack from 'webpack';\nimport type WebpackDevServer from 'webpack-dev-server';\n\nimport { compileAsync } from './compile';\nimport {\n importExpoWebpackConfigFromProject,\n importWebpackDevServerFromProject,\n importWebpackFromProject,\n} from './resolveFromProject';\nimport { ensureEnvironmentSupportsTLSAsync } from './tls';\nimport * as Log from '../../../log';\nimport { env } from '../../../utils/env';\nimport { CommandError } from '../../../utils/errors';\nimport { getIpAddress } from '../../../utils/ip';\nimport { setNodeEnv } from '../../../utils/nodeEnv';\nimport { choosePortAsync } from '../../../utils/port';\nimport { createProgressBar } from '../../../utils/progress';\nimport { ensureDotExpoProjectDirectoryInitialized } from '../../project/dotExpo';\nimport { BundlerDevServer, BundlerStartOptions, DevServerInstance } from '../BundlerDevServer';\n\nconst debug = require('debug')('expo:start:server:webpack:devServer') as typeof console.log;\n\nexport type WebpackConfiguration = webpack.Configuration & {\n devServer?: {\n before?: (app: Application, server: WebpackDevServer, compiler: webpack.Compiler) => void;\n };\n};\n\nfunction assertIsWebpackDevServer(value: any): asserts value is WebpackDevServer {\n if (!value?.sockWrite && !value?.sendMessage) {\n throw new CommandError(\n 'WEBPACK',\n value\n ? 'Expected Webpack dev server, found: ' + (value.constructor?.name ?? value)\n : 'Webpack dev server not started yet.'\n );\n }\n}\n\nexport class WebpackBundlerDevServer extends BundlerDevServer {\n get name(): string {\n return 'webpack';\n }\n\n public async startTypeScriptServices(): Promise<void> {\n // noop -- this feature is Metro-only.\n }\n\n public broadcastMessage(\n method: string | 'reload' | 'devMenu' | 'sendDevCommand',\n params?: Record<string, any>\n ): void {\n if (!this.instance) {\n return;\n }\n\n assertIsWebpackDevServer(this.instance?.server);\n\n // TODO(EvanBacon): Custom Webpack overlay.\n // Default webpack-dev-server sockets use \"content-changed\" instead of \"reload\" (what we use on native).\n // For now, just manually convert the value so our CLI interface can be unified.\n const hackyConvertedMessage = method === 'reload' ? 'content-changed' : method;\n\n if (\n 'sendMessage' in this.instance.server &&\n typeof this.instance.server.sendMessage === 'function'\n ) {\n // NOTE: https://github.com/expo/expo/issues/21994#issuecomment-1517122501\n this.instance.server.sendMessage(this.instance.server.sockets, hackyConvertedMessage, params);\n } else {\n this.instance.server.sockWrite(this.instance.server.sockets, hackyConvertedMessage, params);\n }\n }\n\n isTargetingNative(): boolean {\n return false;\n }\n\n private async getAvailablePortAsync(options: { defaultPort?: number }): Promise<number> {\n try {\n const defaultPort = options?.defaultPort ?? 19006;\n const port = await choosePortAsync(this.projectRoot, {\n defaultPort,\n host: env.WEB_HOST,\n });\n if (!port) {\n throw new CommandError('NO_PORT_FOUND', `Port ${defaultPort} not available.`);\n }\n return port;\n } catch (error: any) {\n throw new CommandError('NO_PORT_FOUND', error.message);\n }\n }\n\n async bundleAsync({ mode, clear }: { mode: 'development' | 'production'; clear: boolean }) {\n // Do this first to fail faster.\n const webpack = importWebpackFromProject(this.projectRoot);\n\n if (clear) {\n await this.clearWebProjectCacheAsync(this.projectRoot, mode);\n }\n\n const config = await this.loadConfigAsync({\n isImageEditingEnabled: true,\n mode,\n });\n\n if (!config.plugins) {\n config.plugins = [];\n }\n\n const bar = createProgressBar(chalk`{bold Web} Bundling Javascript [:bar] :percent`, {\n width: 64,\n total: 100,\n clear: true,\n complete: '=',\n incomplete: ' ',\n });\n\n // NOTE(EvanBacon): Add a progress bar to the webpack logger if defined (e.g. not in CI).\n if (bar != null) {\n config.plugins.push(\n new webpack.ProgressPlugin((percent: number) => {\n bar?.update(percent);\n if (percent === 1) {\n bar?.terminate();\n }\n })\n );\n }\n\n // Create a webpack compiler that is configured with custom messages.\n const compiler = webpack(config);\n\n try {\n await compileAsync(compiler);\n } catch (error: any) {\n Log.error(chalk.red('Failed to compile'));\n throw error;\n } finally {\n bar?.terminate();\n }\n }\n\n protected async startImplementationAsync(\n options: BundlerStartOptions\n ): Promise<DevServerInstance> {\n // Do this first to fail faster.\n const webpack = importWebpackFromProject(this.projectRoot);\n const WebpackDevServer = importWebpackDevServerFromProject(this.projectRoot);\n\n await this.stopAsync();\n\n options.port = await this.getAvailablePortAsync({\n defaultPort: options.port,\n });\n const { resetDevServer, https, port, mode } = options;\n\n this.urlCreator = this.getUrlCreator({\n port,\n location: {\n scheme: https ? 'https' : 'http',\n },\n });\n\n debug('Starting webpack on port: ' + port);\n\n if (resetDevServer) {\n await this.clearWebProjectCacheAsync(this.projectRoot, mode);\n }\n\n if (https) {\n debug('Configuring TLS to enable HTTPS support');\n await ensureEnvironmentSupportsTLSAsync(this.projectRoot).catch((error) => {\n Log.error(`Error creating TLS certificates: ${error}`);\n });\n }\n\n const config = await this.loadConfigAsync(options);\n\n Log.log(chalk`Starting Webpack on port ${port} in {underline ${mode}} mode.`);\n\n // Create a webpack compiler that is configured with custom messages.\n const compiler = webpack(config);\n\n const server = new WebpackDevServer(compiler, config.devServer);\n const host =\n env.WEB_HOST ?? (options.location.hostType === 'localhost' ? 'localhost' : undefined);\n\n // Launch WebpackDevServer.\n server.listen(port, host, function (this: http.Server, error) {\n if (error) {\n Log.error(error.message);\n }\n });\n\n // Extend the close method to ensure that we clean up the local info.\n const originalClose = server.close.bind(server);\n\n server.close = (callback?: (err?: Error) => void) => {\n return originalClose((err?: Error) => {\n this.instance = null;\n callback?.(err);\n });\n };\n\n const _host = getIpAddress();\n const protocol = https ? 'https' : 'http';\n\n return {\n // Server instance\n server,\n // URL Info\n location: {\n url: `${protocol}://${_host}:${port}`,\n port,\n protocol,\n host: _host,\n },\n middleware: null,\n // Match the native protocol.\n messageSocket: {\n broadcast: this.broadcastMessage,\n },\n };\n }\n\n /** Load the Webpack config. Exposed for testing. */\n getProjectConfigFilePath(): string | null {\n // Check if the project has a webpack.config.js in the root.\n return (\n this.getConfigModuleIds().reduce<string | null | undefined>(\n (prev, moduleId) => prev || resolveFrom.silent(this.projectRoot, moduleId),\n null\n ) ?? null\n );\n }\n\n async loadConfigAsync(\n options: Pick<BundlerStartOptions, 'mode' | 'isImageEditingEnabled' | 'https'>,\n argv?: string[]\n ): Promise<WebpackConfiguration> {\n // let bar: ProgressBar | null = null;\n\n const env = {\n projectRoot: this.projectRoot,\n pwa: !!options.isImageEditingEnabled,\n // TODO: Use a new loader in Webpack config...\n logger: {\n info() {},\n },\n mode: options.mode,\n https: options.https,\n };\n setNodeEnv(env.mode ?? 'development');\n require('@expo/env').load(env.projectRoot);\n // Check if the project has a webpack.config.js in the root.\n const projectWebpackConfig = this.getProjectConfigFilePath();\n let config: WebpackConfiguration;\n if (projectWebpackConfig) {\n const webpackConfig = require(projectWebpackConfig);\n if (typeof webpackConfig === 'function') {\n config = await webpackConfig(env, argv);\n } else {\n config = webpackConfig;\n }\n } else {\n // Fallback to the default expo webpack config.\n const loadDefaultConfigAsync = importExpoWebpackConfigFromProject(this.projectRoot);\n config = await loadDefaultConfigAsync(env, argv);\n }\n return config;\n }\n\n protected getConfigModuleIds(): string[] {\n return ['./webpack.config.js'];\n }\n\n protected async clearWebProjectCacheAsync(\n projectRoot: string,\n mode: string = 'development'\n ): Promise<void> {\n Log.log(chalk.dim(`Clearing Webpack ${mode} cache directory...`));\n\n const dir = await ensureDotExpoProjectDirectoryInitialized(projectRoot);\n const cacheFolder = path.join(dir, 'web/cache', mode);\n try {\n await fs.promises.rm(cacheFolder, { recursive: true, force: true });\n } catch (error: any) {\n Log.error(`Could not clear ${mode} web cache directory: ${error.message}`);\n }\n }\n}\n\nexport function getProjectWebpackConfigFilePath(projectRoot: string) {\n return resolveFrom.silent(projectRoot, './webpack.config.js');\n}\n"],"names":["WebpackBundlerDevServer","getProjectWebpackConfigFilePath","debug","require","assertIsWebpackDevServer","value","sockWrite","sendMessage","CommandError","constructor","name","BundlerDevServer","startTypeScriptServices","broadcastMessage","method","params","instance","server","hackyConvertedMessage","sockets","isTargetingNative","getAvailablePortAsync","options","defaultPort","port","choosePortAsync","projectRoot","host","env","WEB_HOST","error","message","bundleAsync","mode","clear","webpack","importWebpackFromProject","clearWebProjectCacheAsync","config","loadConfigAsync","isImageEditingEnabled","plugins","bar","createProgressBar","chalk","width","total","complete","incomplete","push","ProgressPlugin","percent","update","terminate","compiler","compileAsync","Log","red","startImplementationAsync","WebpackDevServer","importWebpackDevServerFromProject","stopAsync","resetDevServer","https","urlCreator","getUrlCreator","location","scheme","ensureEnvironmentSupportsTLSAsync","catch","log","devServer","hostType","undefined","listen","originalClose","close","bind","callback","err","_host","getIpAddress","protocol","url","middleware","messageSocket","broadcast","getProjectConfigFilePath","getConfigModuleIds","reduce","prev","moduleId","resolveFrom","silent","argv","pwa","logger","info","setNodeEnv","load","projectWebpackConfig","webpackConfig","loadDefaultConfigAsync","importExpoWebpackConfigFromProject","dim","dir","ensureDotExpoProjectDirectoryInitialized","cacheFolder","path","join","fs","promises","rm","recursive","force"],"mappings":";;;;;;;;;;;IA6CaA,uBAAuB;eAAvBA;;IA+PGC,+BAA+B;eAA/BA;;;;gEA5SE;;;;;;;gEAEH;;;;;;;gEAEE;;;;;;;gEACO;;;;;;yBAIK;oCAKtB;qBAC2C;6DAC7B;qBACD;wBACS;oBACA;yBACF;sBACK;0BACE;yBACuB;kCACgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAagG,IAAI,CAACvE,IAAIF,WAAW;QACzC,4DAA4D;QAC5D,MAAM0E,uBAAuB,IAAI,CAACb,wBAAwB;QAC1D,IAAIjD;QACJ,IAAI8D,sBAAsB;YACxB,MAAMC,gBAAgBlG,QAAQiG;YAC9B,IAAI,OAAOC,kBAAkB,YAAY;gBACvC/D,SAAS,MAAM+D,cAAczE,KAAKkE;YACpC,OAAO;gBACLxD,SAAS+D;YACX;QACF,OAAO;YACL,+CAA+C;YAC/C,MAAMC,yBAAyBC,IAAAA,sDAAkC,EAAC,IAAI,CAAC7E,WAAW;YAClFY,SAAS,MAAMgE,uBAAuB1E,KAAKkE;QAC7C;QACA,OAAOxD;IACT;IAEUkD,qBAA+B;QACvC,OAAO;YAAC;SAAsB;IAChC;IAEA,MAAgBnD,0BACdX,WAAmB,EACnBO,OAAe,aAAa,EACb;QACfuB,KAAIc,GAAG,CAAC1B,gBAAK,CAAC4D,GAAG,CAAC,CAAC,iBAAiB,EAAEvE,KAAK,mBAAmB,CAAC;QAE/D,MAAMwE,MAAM,MAAMC,IAAAA,iDAAwC,EAAChF;QAC3D,MAAMiF,cAAcC,mBAAI,CAACC,IAAI,CAACJ,KAAK,aAAaxE;QAChD,IAAI;YACF,MAAM6E,iBAAE,CAACC,QAAQ,CAACC,EAAE,CAACL,aAAa;gBAAEM,WAAW;gBAAMC,OAAO;YAAK;QACnE,EAAE,OAAOpF,OAAY;YACnB0B,KAAI1B,KAAK,CAAC,CAAC,gBAAgB,EAAEG,KAAK,sBAAsB,EAAEH,MAAMC,OAAO,EAAE;QAC3E;IACF;AACF;AAEO,SAAS9B,gCAAgCyB,WAAmB;IACjE,OAAOkE,sBAAW,CAACC,MAAM,CAACnE,aAAa;AACzC"}
|
|
@@ -26,7 +26,7 @@ class FetchClient {
|
|
|
26
26
|
this.headers = {
|
|
27
27
|
accept: 'application/json',
|
|
28
28
|
'content-type': 'application/json',
|
|
29
|
-
'user-agent': `expo-cli/${"55.0.
|
|
29
|
+
'user-agent': `expo-cli/${"55.0.6"}`,
|
|
30
30
|
authorization: 'Basic ' + _nodebuffer().Buffer.from(`${target}:`).toString('base64')
|
|
31
31
|
};
|
|
32
32
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/cli",
|
|
3
|
-
"version": "55.0.
|
|
3
|
+
"version": "55.0.6",
|
|
4
4
|
"description": "The Expo CLI",
|
|
5
5
|
"main": "build/bin/cli",
|
|
6
6
|
"bin": {
|
|
@@ -47,14 +47,14 @@
|
|
|
47
47
|
"@expo/env": "~2.0.11",
|
|
48
48
|
"@expo/image-utils": "^0.8.12",
|
|
49
49
|
"@expo/json-file": "^10.0.12",
|
|
50
|
-
"@expo/log-box": "55.0.
|
|
50
|
+
"@expo/log-box": "55.0.5",
|
|
51
51
|
"@expo/metro": "~54.2.0",
|
|
52
52
|
"@expo/metro-config": "~55.0.4",
|
|
53
53
|
"@expo/osascript": "^2.4.2",
|
|
54
54
|
"@expo/package-manager": "^1.10.3",
|
|
55
55
|
"@expo/plist": "^0.5.2",
|
|
56
56
|
"@expo/prebuild-config": "^55.0.4",
|
|
57
|
-
"@expo/router-server": "^55.0.
|
|
57
|
+
"@expo/router-server": "^55.0.5",
|
|
58
58
|
"@expo/schema-utils": "^55.0.2",
|
|
59
59
|
"@expo/spawn-async": "^1.7.2",
|
|
60
60
|
"@expo/ws-tunnel": "^1.0.1",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"dnssd-advertise": "^1.1.1",
|
|
74
74
|
"env-editor": "^0.4.1",
|
|
75
75
|
"expo-server": "^55.0.3",
|
|
76
|
-
"fetch-nodeshim": "^0.4.
|
|
76
|
+
"fetch-nodeshim": "^0.4.4",
|
|
77
77
|
"getenv": "^2.0.0",
|
|
78
78
|
"glob": "^13.0.0",
|
|
79
79
|
"lan-network": "^0.1.6",
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
"devDependencies": {
|
|
122
122
|
"@expo/mcp-tunnel": "~0.2.3",
|
|
123
123
|
"@expo/ngrok": "4.1.3",
|
|
124
|
-
"@playwright/test": "^1.
|
|
124
|
+
"@playwright/test": "^1.53.1",
|
|
125
125
|
"@swc/core": "^1.11.11",
|
|
126
126
|
"@taskr/clear": "^1.1.0",
|
|
127
127
|
"@taskr/esnext": "^1.1.0",
|
|
@@ -155,10 +155,10 @@
|
|
|
155
155
|
"memfs": "^3.2.0",
|
|
156
156
|
"nock": "^14.0.10",
|
|
157
157
|
"node-html-parser": "^6.1.5",
|
|
158
|
-
"playwright": "^1.
|
|
158
|
+
"playwright": "^1.53.1",
|
|
159
159
|
"taskr": "^1.1.0",
|
|
160
160
|
"tree-kill": "^1.2.2",
|
|
161
161
|
"tsd": "^0.28.1"
|
|
162
162
|
},
|
|
163
|
-
"gitHead": "
|
|
163
|
+
"gitHead": "feb52bad4c6c47d4c010248e74265eb3d9873371"
|
|
164
164
|
}
|