@expo/cli 0.19.7 → 0.19.8
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/server/metro/MetroBundlerDevServer.js +32 -12
- package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/createServerComponentsMiddleware.js +12 -4
- package/build/src/start/server/metro/createServerComponentsMiddleware.js.map +1 -1
- package/build/src/start/server/metro/instantiateMetro.js +20 -9
- package/build/src/start/server/metro/instantiateMetro.js.map +1 -1
- package/build/src/utils/env.js +3 -0
- package/build/src/utils/env.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 +2 -2
package/build/bin/cli
CHANGED
|
@@ -523,13 +523,13 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
|
523
523
|
}
|
|
524
524
|
async singlePageReactServerComponentExportAsync(options, files, extraOptions = {}) {
|
|
525
525
|
// NOTE(EvanBacon): This will not support any code elimination since it's a static pass.
|
|
526
|
-
|
|
526
|
+
let { reactClientReferences: clientBoundaries , reactServerReferences: serverActionReferencesInServer , cssModules , } = await this.rscRenderer.getExpoRouterClientReferencesAsync({
|
|
527
527
|
platform: options.platform
|
|
528
528
|
}, files);
|
|
529
529
|
// TODO: The output keys should be in production format or use a lookup manifest.
|
|
530
530
|
debug("Evaluated client boundaries:", clientBoundaries);
|
|
531
531
|
// Run metro bundler and create the JS bundles/source maps.
|
|
532
|
-
|
|
532
|
+
let bundle = await this.legacySinglePageExportBundleAsync({
|
|
533
533
|
...options,
|
|
534
534
|
clientBoundaries
|
|
535
535
|
}, extraOptions);
|
|
@@ -544,13 +544,30 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
|
544
544
|
throw new Error("Static server action references were not returned from the Metro client bundle");
|
|
545
545
|
}
|
|
546
546
|
debug("React server action boundaries from client:", reactServerReferences);
|
|
547
|
-
|
|
547
|
+
// 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.
|
|
548
|
+
const { clientBoundaries: nestedClientBoundaries } = await this.rscRenderer.exportServerActionsAsync({
|
|
548
549
|
platform: options.platform,
|
|
549
550
|
entryPoints: [
|
|
550
551
|
...serverActionReferencesInServer,
|
|
551
552
|
...reactServerReferences
|
|
552
553
|
]
|
|
553
554
|
}, files);
|
|
555
|
+
const hasUniqueClientBoundaries = nestedClientBoundaries.some((boundary)=>!clientBoundaries.includes(boundary));
|
|
556
|
+
if (hasUniqueClientBoundaries) {
|
|
557
|
+
debug("Re-bundling client with nested client boundaries:", nestedClientBoundaries);
|
|
558
|
+
clientBoundaries = [
|
|
559
|
+
...new Set(clientBoundaries.concat(nestedClientBoundaries))
|
|
560
|
+
];
|
|
561
|
+
// Re-bundle the client with the new client boundaries that only exist in server actions that were imported from the client.
|
|
562
|
+
// Run metro bundler and create the JS bundles/source maps.
|
|
563
|
+
bundle = await this.legacySinglePageExportBundleAsync({
|
|
564
|
+
...options,
|
|
565
|
+
clientBoundaries: [
|
|
566
|
+
...clientBoundaries,
|
|
567
|
+
...nestedClientBoundaries
|
|
568
|
+
]
|
|
569
|
+
}, extraOptions);
|
|
570
|
+
}
|
|
554
571
|
// Inject the global CSS that was imported during the server render.
|
|
555
572
|
bundle.artifacts.push(...cssModules);
|
|
556
573
|
const serverRoot = (0, _paths().getMetroServerRoot)(this.projectRoot);
|
|
@@ -651,7 +668,7 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
|
651
668
|
}
|
|
652
669
|
rscRenderer = null;
|
|
653
670
|
async startImplementationAsync(options) {
|
|
654
|
-
var ref, ref1, ref2, ref3;
|
|
671
|
+
var ref, ref1, ref2, ref3, ref4, ref5, ref6;
|
|
655
672
|
options.port = await this.resolvePortAsync(options);
|
|
656
673
|
this.urlCreator = this.getUrlCreator(options);
|
|
657
674
|
const config = (0, _config().getConfig)(this.projectRoot, {
|
|
@@ -659,17 +676,18 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
|
659
676
|
});
|
|
660
677
|
const { exp } = config;
|
|
661
678
|
// NOTE: This will change in the future when it's less experimental, we enable React 19, and turn on more RSC flags by default.
|
|
662
|
-
const isReactServerComponentsEnabled = !!((ref = exp.experiments) == null ? void 0 : ref.reactServerComponents);
|
|
679
|
+
const isReactServerComponentsEnabled = !!((ref = exp.experiments) == null ? void 0 : ref.reactServerComponents) || !!((ref1 = exp.experiments) == null ? void 0 : ref1.reactServerActions);
|
|
680
|
+
const isReactServerActionsOnlyEnabled = !((ref2 = exp.experiments) == null ? void 0 : ref2.reactServerComponents) && !!((ref3 = exp.experiments) == null ? void 0 : ref3.reactServerActions);
|
|
663
681
|
this.isReactServerComponentsEnabled = isReactServerComponentsEnabled;
|
|
664
682
|
const useServerRendering = [
|
|
665
683
|
"static",
|
|
666
684
|
"server"
|
|
667
|
-
].includes(((
|
|
668
|
-
const hasApiRoutes = isReactServerComponentsEnabled || ((
|
|
685
|
+
].includes(((ref4 = exp.web) == null ? void 0 : ref4.output) ?? "");
|
|
686
|
+
const hasApiRoutes = isReactServerComponentsEnabled || ((ref5 = exp.web) == null ? void 0 : ref5.output) === "server";
|
|
669
687
|
const baseUrl = (0, _metroOptions.getBaseUrlFromExpoConfig)(exp);
|
|
670
688
|
const asyncRoutes = (0, _metroOptions.getAsyncRoutesFromExpoConfig)(exp, options.mode ?? "development", "web");
|
|
671
689
|
const routerRoot = (0, _router.getRouterDirectoryModuleIdWithManifest)(this.projectRoot, exp);
|
|
672
|
-
const reactCompiler = !!((
|
|
690
|
+
const reactCompiler = !!((ref6 = exp.experiments) == null ? void 0 : ref6.reactCompiler);
|
|
673
691
|
const appDir = _path().default.join(this.projectRoot, routerRoot);
|
|
674
692
|
const mode = options.mode ?? "development";
|
|
675
693
|
if (isReactServerComponentsEnabled && useServerRendering) {
|
|
@@ -775,7 +793,8 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
|
775
793
|
instanceMetroOptions: this.instanceMetroOptions,
|
|
776
794
|
rscPath: "/_flight",
|
|
777
795
|
ssrLoadModule: this.ssrLoadModule.bind(this),
|
|
778
|
-
ssrLoadModuleArtifacts: this.metroImportAsArtifactsAsync.bind(this)
|
|
796
|
+
ssrLoadModuleArtifacts: this.metroImportAsArtifactsAsync.bind(this),
|
|
797
|
+
useClientRouter: isReactServerActionsOnlyEnabled
|
|
779
798
|
});
|
|
780
799
|
this.rscRenderer = rscMiddleware;
|
|
781
800
|
middleware.use(rscMiddleware.middleware);
|
|
@@ -787,12 +806,12 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
|
787
806
|
// This MUST run last since it's the fallback.
|
|
788
807
|
middleware.use(new _historyFallbackMiddleware.HistoryFallbackMiddleware(manifestMiddleware.getHandler().internal).getHandler());
|
|
789
808
|
} else {
|
|
790
|
-
var
|
|
809
|
+
var ref7;
|
|
791
810
|
middleware.use((0, _createServerRouteMiddleware.createRouteHandlerMiddleware)(this.projectRoot, {
|
|
792
811
|
appDir,
|
|
793
812
|
routerRoot,
|
|
794
813
|
config,
|
|
795
|
-
...(
|
|
814
|
+
...(ref7 = config.exp.extra) == null ? void 0 : ref7.router,
|
|
796
815
|
bundleApiRoute: (functionFilePath)=>this.ssrImportApiRoute(functionFilePath, {
|
|
797
816
|
platform: "web"
|
|
798
817
|
}),
|
|
@@ -810,7 +829,8 @@ class MetroBundlerDevServer extends _bundlerDevServer.BundlerDevServer {
|
|
|
810
829
|
instanceMetroOptions: this.instanceMetroOptions,
|
|
811
830
|
rscPath: "/_flight",
|
|
812
831
|
ssrLoadModule: this.ssrLoadModule.bind(this),
|
|
813
|
-
ssrLoadModuleArtifacts: this.metroImportAsArtifactsAsync.bind(this)
|
|
832
|
+
ssrLoadModuleArtifacts: this.metroImportAsArtifactsAsync.bind(this),
|
|
833
|
+
useClientRouter: isReactServerActionsOnlyEnabled
|
|
814
834
|
});
|
|
815
835
|
this.rscRenderer = rscMiddleware1;
|
|
816
836
|
}
|
|
@@ -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 { getConfig } from '@expo/config';\nimport { getMetroServerRoot } from '@expo/config/paths';\nimport * as runtimeEnv from '@expo/env';\nimport { SerialAsset } from '@expo/metro-config/build/serializer/serializerAssets';\nimport assert from 'assert';\nimport chalk from 'chalk';\nimport { DeltaResult, TransformInputOptions } from 'metro';\nimport baseJSBundle from 'metro/src/DeltaBundler/Serializers/baseJSBundle';\nimport {\n sourceMapGeneratorNonBlocking,\n type SourceMapGeneratorOptions,\n} from 'metro/src/DeltaBundler/Serializers/sourceMapGenerator';\nimport type MetroHmrServer from 'metro/src/HmrServer';\nimport type { Client as MetroHmrClient } from 'metro/src/HmrServer';\nimport { GraphRevision } from 'metro/src/IncrementalBundler';\nimport bundleToString from 'metro/src/lib/bundleToString';\nimport getGraphId from 'metro/src/lib/getGraphId';\nimport { TransformProfile } from 'metro-babel-transformer';\nimport type { CustomResolverOptions } from 'metro-resolver/src/types';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\n\nimport {\n createServerComponentsMiddleware,\n fileURLToFilePath,\n} from './createServerComponentsMiddleware';\nimport { createRouteHandlerMiddleware } from './createServerRouteMiddleware';\nimport { ExpoRouterServerManifestV1, fetchManifest } from './fetchRouterManifest';\nimport { instantiateMetroAsync } from './instantiateMetro';\nimport { getErrorOverlayHtmlAsync } from './metroErrorInterface';\nimport { assertMetroPrivateServer, MetroPrivateServer } from './metroPrivateServer';\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 { BundleAssetWithFileHashes, ExportAssetMap } from '../../../export/saveAssets';\nimport { Log } from '../../../log';\nimport { env } from '../../../utils/env';\nimport { CommandError } from '../../../utils/errors';\nimport { getFreePortAsync } from '../../../utils/port';\nimport { BundlerDevServer, BundlerStartOptions, DevServerInstance } from '../BundlerDevServer';\nimport {\n cachedSourceMaps,\n evalMetroAndWrapFunctions,\n evalMetroNoHandling,\n} from '../getStaticRenderFunctions';\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 { ReactDevToolsPageMiddleware } from '../middleware/ReactDevToolsPageMiddleware';\nimport { RuntimeRedirectMiddleware } from '../middleware/RuntimeRedirectMiddleware';\nimport { ServeStaticMiddleware } from '../middleware/ServeStaticMiddleware';\nimport {\n convertPathToModuleSpecifier,\n createBundleUrlPath,\n ExpoMetroOptions,\n getAsyncRoutesFromExpoConfig,\n getBaseUrlFromExpoConfig,\n getMetroDirectBundleOptions,\n shouldEnableAsyncImports,\n} from '../middleware/metroOptions';\nimport { prependMiddleware } from '../middleware/mutations';\nimport { startTypescriptTypeGenerationAsync } from '../type-generation/startTypescriptTypeGeneration';\n\nexport type ExpoRouterRuntimeManifest = Awaited<\n ReturnType<typeof import('expo-router/build/static/renderStaticContent').getManifest>\n>;\ntype MetroOnProgress = NonNullable<\n import('metro/src/DeltaBundler/types').Options<void>['onProgress']\n>;\ntype SSRLoadModuleFunc = <T extends Record<string, any>>(\n filePath: string,\n specificOptions?: Partial<ExpoMetroOptions>,\n extras?: { hot?: boolean }\n) => Promise<T>;\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: MetroPrivateServer | null = null;\n private hmrServer: MetroHmrServer | null = null;\n private ssrHmrClients: Map<string, MetroHmrClient> = new Map();\n isReactServerComponentsEnabled?: 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 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: ExpoRouterServerManifestV1;\n platform: string;\n }): Promise<{ files: ExportAssetMap; manifest: ExpoRouterServerManifestV1<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 file: resolveFrom(this.projectRoot, '@expo/cli/static/template/[...rsc]+api.ts'),\n page: rscPath,\n namedRegex: '^/_flight(?:/(?<rsc>.+?))?(?:/)?$',\n routeKeys: { rsc: 'rsc' },\n });\n }\n\n for (const route of manifest.apiRoutes) {\n const filepath = route.file.startsWith('/') ? 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 path.join(outputDir, '.' + rscPath + '.js')\n : path.join(outputDir, path.relative(appDir, filepath.replace(/\\.[tj]sx?$/, '.js')));\n\n if (contents) {\n let src = contents.src;\n\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(\n /\\/\\/# sourceMappingURL=.*/g,\n `//# sourceMappingURL=${artifactBasename}`\n );\n\n const parsedMap =\n typeof contents.map === 'string' ? JSON.parse(contents.map) : contents.map;\n files.set(artifactFilename + '.map', {\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 apiRouteId: route.page,\n targetDomain: 'server',\n });\n }\n files.set(artifactFilename, {\n contents: src,\n apiRouteId: route.page,\n targetDomain: 'server',\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 async getExpoRouterRoutesManifestAsync({ appDir }: { appDir: string }) {\n // getBuiltTimeServerManifest\n const { exp } = getConfig(this.projectRoot);\n const manifest = await fetchManifest(this.projectRoot, {\n ...exp.extra?.router?.platformRoutes,\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({\n environment,\n }: Pick<ExpoMetroOptions, 'environment'> = {}): Promise<{\n serverManifest: ExpoRouterServerManifestV1;\n }> {\n // NOTE: This could probably be folded back into `renderStaticContent` when expo-asset and font support RSC.\n const { getBuildTimeServerManifestAsync } = await this.ssrLoadModule<\n typeof import('expo-router/build/static/getServerManifest')\n >('expo-router/build/static/getServerManifest.js', {\n environment: environment ?? (this.isReactServerComponentsEnabled ? 'react-server' : 'node'),\n });\n\n return {\n serverManifest: await getBuildTimeServerManifestAsync(),\n };\n }\n\n async getStaticRenderFunctionAsync(): Promise<{\n serverManifest: ExpoRouterServerManifestV1;\n manifest: ExpoRouterRuntimeManifest;\n renderAsync: (path: string) => Promise<string>;\n }> {\n const url = this.getDevServerUrlOrAssert();\n\n const { getStaticContent, getManifest, getBuildTimeServerManifestAsync } =\n await this.ssrLoadModule<typeof import('expo-router/build/static/renderStaticContent')>(\n 'expo-router/node/render.js',\n {\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\n const { exp } = getConfig(this.projectRoot);\n\n return {\n serverManifest: await getBuildTimeServerManifestAsync(),\n // Get routes from Expo Router.\n manifest: await getManifest({ preserveApiRoutes: false, ...exp.extra?.router }),\n // Get route generating function\n async renderAsync(path: string) {\n return await getStaticContent(new URL(path, url));\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: shouldEnableAsyncImports(this.projectRoot),\n asyncRoutes,\n baseUrl,\n isExporting,\n routerRoot,\n clientBoundaries,\n reactCompiler,\n bytecode: false,\n });\n }\n\n private async getStaticPageAsync(pathname: string) {\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: shouldEnableAsyncImports(this.projectRoot),\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/build/static/renderStaticContent')\n >('expo-router/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 return await getStaticContent(location);\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 const res = await this.ssrLoadModuleContents(filePath, specificOptions);\n\n if (extras.hot && this.instanceMetroOptions.isExporting !== true) {\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 ) {\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 hot: 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 // @ts-expect-error: `runtimeBytecodeVersion` does not exist in `expoBundleOptions` or `TransformInputOptions`\n runtimeBytecodeVersion: expoBundleOptions.runtimeBytecodeVersion,\n };\n\n const resolvedEntryFilePath = await this.resolveRelativePathAsync(filePath, {\n resolverOptions,\n transformOptions,\n });\n\n // Use fully qualified URL with all options to represent the file path that's used for source maps and HMR. This prevents collisions.\n const filename = createBundleUrlPath({\n ...opts,\n mainModuleName: resolvedEntryFilePath,\n });\n\n // https://github.com/facebook/metro/blob/2405f2f6c37a1b641cc379b9c733b1eff0c1c2a1/packages/metro/src/lib/parseOptionsFromUrl.js#L55-L87\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\n inlineSourceMap: expoBundleOptions.inlineSourceMap ?? false,\n modulesOnly: expoBundleOptions.modulesOnly ?? false,\n runModule: expoBundleOptions.runModule ?? true,\n // @ts-expect-error\n sourceUrl: expoBundleOptions.sourceUrl,\n // @ts-expect-error\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 ) {\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 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 if (this.isReactServerComponentsEnabled) {\n return this.singlePageReactServerComponentExportAsync(options, files, extraOptions);\n }\n\n return this.legacySinglePageExportBundleAsync(options, extraOptions);\n }\n\n private async singlePageReactServerComponentExportAsync(\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 // NOTE(EvanBacon): This will not support any code elimination since it's a static pass.\n const {\n reactClientReferences: clientBoundaries,\n reactServerReferences: serverActionReferencesInServer,\n cssModules,\n } = await this.rscRenderer!.getExpoRouterClientReferencesAsync(\n {\n platform: options.platform,\n },\n files\n );\n\n // TODO: The output keys should be in production format or use a lookup manifest.\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 reactServerReferences = bundle.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 if (!reactServerReferences) {\n // 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\n debug('React server action boundaries from client:', reactServerReferences);\n\n await this.rscRenderer!.exportServerActionsAsync(\n {\n platform: options.platform,\n entryPoints: [...serverActionReferencesInServer, ...reactServerReferences],\n },\n files\n );\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 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>();\n\n if (Object.keys(moduleIdToSplitBundle).length) {\n clientBoundariesAsOpaqueIds.forEach((boundary) => {\n if (boundary in moduleIdToSplitBundle) {\n // Account for nullish values (bundle is in main chunk).\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 // @ts-expect-error\n ssrManifest.set(boundary, null);\n });\n }\n\n // Export the static RSC files\n await this.rscRenderer!.exportRoutesAsync(\n {\n platform: options.platform,\n ssrManifest,\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 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'\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('/')) {\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 = !!exp.experiments?.reactServerComponents;\n this.isReactServerComponentsEnabled = isReactServerComponentsEnabled;\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 if (isReactServerComponentsEnabled && useServerRendering) {\n throw new CommandError(\n `Experimental server component support does not support 'web.output: ${exp.web!.output}' yet. Use 'web.output: \"single\"' during the experimental phase.`\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(new ReactDevToolsPageMiddleware(this.projectRoot).getHandler());\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(new CreateFileMiddleware(this.projectRoot).getHandler());\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 );\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 });\n this.rscRenderer = rscMiddleware;\n middleware.use(rscMiddleware.middleware);\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 if (!useServerRendering || isReactServerComponentsEnabled) {\n // This MUST run last since it's the fallback.\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 getStaticPageAsync: (pathname) => {\n return this.getStaticPageAsync(pathname);\n },\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 });\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 assertMetroPrivateServer(metro);\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: (() => void) | null = null;\n\n private async registerSsrHmrAsync(url: string, onReload: () => 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: unknown[];\n modified: unknown[];\n deleted: unknown[];\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 onReload();\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 // @ts-expect-error\n (this.metro?._bundler._revisionsByGraphId as Map).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<\n string,\n Promise<{ src: string; filename: string; map: string } | null>\n >();\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<{ src: string; filename: string; map?: any } | null | undefined> {\n if (this.pendingRouteOperations.has(filePath)) {\n return this.pendingRouteOperations.get(filePath);\n }\n const bundleAsync = async () => {\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 // @ts-expect-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 // 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 // @ts-expect-error\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 = () => {\n // Send reload command to client from Fast Refresh code.\n debug('[SSR]: Reload requested.');\n\n this.onReloadRscEvent?.();\n\n this.broadcastMessage('sendDevCommand', {\n name: 'rsc-reload',\n // TODO: Target only certain platforms\n // platform,\n });\n };\n\n this.registerSsrHmrAsync(url.toString(), onReload);\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 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<{\n numModifiedFiles: number;\n lastModifiedDate: Date;\n nextRevId: string;\n bundle: string;\n map: string;\n\n // Defined if the output is multi-bundle.\n artifacts?: SerialAsset[];\n assets?: readonly BundleAssetWithFileHashes[];\n }> {\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: MetroOnProgress = (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 // 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\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 bundle = await serializer(\n // NOTE: Using absolute path instead of relative input path is a breaking change.\n // entryFile,\n resolvedEntryFilePath,\n\n revision.prepend as any,\n revision.graph as any,\n {\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 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 // @ts-expect-error: passed to our serializer to enable non-serial return values.\n serializerOptions,\n }\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 // @ts-expect-error: If the output is multi-bundle...\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) {\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 import('metro/src/DeltaBundler/types').Module<any>[],\n options: SourceMapGeneratorOptions\n): Promise<string> {\n return (await sourceMapGeneratorNonBlocking(modules, options)).toString(undefined, {\n excludeSource: options.excludeSource,\n });\n}\n"],"names":["MetroBundlerDevServer","debug","require","EXPO_GO_METRO_PORT","DEV_CLIENT_METRO_PORT","BundlerDevServer","metro","hmrServer","ssrHmrClients","Map","name","resolvePortAsync","options","port","devClient","Number","process","env","RCT_METRO_PORT","getFreePortAsync","exportExpoRouterApiRoutesAsync","includeSourceMaps","outputDir","prerenderManifest","platform","routerRoot","instanceMetroOptions","assert","appDir","path","join","projectRoot","manifest","getExpoRouterRoutesManifestAsync","files","rscPath","isReactServerComponentsEnabled","apiRoutes","find","route","page","startsWith","push","file","resolveFrom","namedRegex","routeKeys","rsc","filepath","contents","bundleApiRoute","artifactFilename","relative","replace","src","map","artifactBasename","encodeURIComponent","basename","parsedMap","JSON","parse","set","stringify","version","sources","source","convertPathToModuleSpecifier","sourcesContent","Array","length","fill","names","mappings","apiRouteId","targetDomain","htmlRoutes","exp","getConfig","fetchManifest","extra","router","platformRoutes","asJson","CommandError","getServerManifestAsync","environment","getBuildTimeServerManifestAsync","ssrLoadModule","serverManifest","getStaticRenderFunctionAsync","url","getDevServerUrlOrAssert","getStaticContent","getManifest","preserveApiRoutes","renderAsync","URL","getStaticResourcesAsync","mainModuleName","clientBoundaries","mode","minify","isExporting","baseUrl","reactCompiler","asyncRoutes","resolvedMainModuleName","resolveMainModuleName","metroImportAsArtifactsAsync","splitChunks","EXPO_NO_BUNDLE_SPLITTING","serializerIncludeMaps","lazy","shouldEnableAsyncImports","bytecode","getStaticPageAsync","pathname","devBundleUrlPathname","createBundleUrlPath","bundleStaticHtml","location","artifacts","resources","staticHtml","Promise","all","content","serializeHtmlWithAssets","template","devBundleUrl","hydrate","EXPO_WEB_DEV_HYDRATE","filePath","specificOptions","extras","res","ssrLoadModuleContents","hot","serverRoot","getMetroServerRoot","relativePath","filename","setupHmr","evalMetroAndWrapFunctions","results","serializerOutput","assets","metroLoadModuleContents","extraOptions","opts","inlineSourceMap","engine","expoBundleOptions","getMetroDirectBundleOptions","resolverOptions","customResolverOptions","dev","transformOptions","type","unstable_transformProfile","customTransformOptions","Object","create","runtimeBytecodeVersion","resolvedEntryFilePath","resolveRelativePathAsync","_bundleDirectAsync","graphOptions","shallow","serializerOptions","modulesOnly","runModule","sourceUrl","sourceMapUrl","bundle","rest","scriptContents","wrapBundle","cachedSourceMaps","nativeExportBundleAsync","singlePageReactServerComponentExportAsync","legacySinglePageExportBundleAsync","reactClientReferences","reactServerReferences","serverActionReferencesInServer","cssModules","rscRenderer","getExpoRouterClientReferencesAsync","filter","a","artifact","metadata","ref","fileURLToFilePath","flat","Boolean","Error","exportServerActionsAsync","entryPoints","clientBoundariesAsOpaqueIds","boundary","moduleIdToSplitBundle","paths","values","reduce","acc","ssrManifest","keys","forEach","exportRoutesAsync","fromEntries","from","entries","key","value","output","watchEnvironmentVariables","instance","envFiles","runtimeEnv","getFiles","NODE_ENV","fileName","observeFileChanges","server","load","force","startImplementationAsync","urlCreator","getUrlCreator","config","skipSDKVersionRequirement","experiments","reactServerComponents","useServerRendering","includes","web","hasApiRoutes","getBaseUrlFromExpoConfig","getAsyncRoutesFromExpoConfig","getRouterDirectoryModuleIdWithManifest","parsedOptions","maxWorkers","resetCache","resetDevServer","EXPO_DEV_SERVER_ORIGIN","middleware","messageSocket","instantiateMetroAsync","manifestMiddleware","getManifestMiddlewareAsync","prependMiddleware","ContextModuleSourceMapsMiddleware","getHandler","use","InterstitialPageMiddleware","scheme","ReactDevToolsPageMiddleware","DevToolsPluginMiddleware","devToolsPluginManager","deepLinkMiddleware","RuntimeRedirectMiddleware","getLocation","runtime","constructDevClientUrl","constructUrl","domComponentRenderer","createDomComponentsMiddleware","metroRoot","CreateFileMiddleware","isTargetingWeb","ServeStaticMiddleware","FaviconMiddleware","observeAnyFileChanges","events","invalidateApiRouteCache","hasWarnedAboutApiRoutes","event","isApiRouteConvention","warnInvalidWebOutput","bindRSCDevModuleInjectionHandler","rscMiddleware","createServerComponentsMiddleware","bind","ssrLoadModuleArtifacts","onReloadRscEvent","HistoryFallbackMiddleware","internal","createRouteHandlerMiddleware","functionFilePath","ssrImportApiRoute","originalClose","close","callback","err","assertMetroPrivateServer","host","protocol","registerSsrHmrAsync","onReload","has","sendFn","message","data","String","update","body","isInitialUpdate","added","modified","deleted","hasUpdate","Log","error","_bundler","_revisionsByGraphId","client","onClientConnect","optedIntoHMR","_registerEntryPoint","waitForTypeScriptAsync","resolve","off","metroWatchTypeScriptFiles","tsconfig","throttle","eventTypes","TypeScriptProjectPrerequisite","req","bootstrapAsync","log","chalk","red","exception","startTypeScriptServices","startTypescriptTypeGenerationAsync","getConfigModuleIds","pendingRouteOperations","get","bundleAsync","undefined","apiRoute","evalMetroNoHandling","htmlServerError","getErrorOverlayHtmlAsync","Response","status","headers","internalError","clear","globalThis","__expo_rsc_inject_module","sendClientModule","code","id","broadcastMessage","toString","_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","int","graph_node_count","graph","dependencies","size","shouldAddToIgnoreList","_shouldAddModuleToIgnoreList","serializer","getMetroSerializer","prepend","asyncRequireModulePath","_resolveRelativePath","transformer","relativeTo","processModuleFilter","createModuleId","_createModuleId","getRunModuleStatement","includeAsyncPaths","runBeforeMainModule","getModulesRunBeforeMainModule","unstable_serverRoot","bundleCode","bundleMap","parsed","isArray","asset","numModifiedFiles","reset","lastModifiedDate","date","nextRevId","sourceMapStringAsync","_getSortedModules","excludeSource","customSerializer","entryPoint","preModules","bundleToString","baseJSBundle","graphId","getGraphId","unstable_allowRequireContext","getRevisionByGraphId","moduleId","str","modules","sourceMapGeneratorNonBlocking"],"mappings":"AAAA;;;;;CAKC,GACD;;;;+BA8FaA,uBAAqB;;aAArBA,qBAAqB;;;yBA9FR,cAAc;;;;;;;yBACL,oBAAoB;;;;;;;+DAC3B,WAAW;;;;;;;8DAEpB,QAAQ;;;;;;;8DACT,OAAO;;;;;;;8DAEA,iDAAiD;;;;;;;yBAInE,uDAAuD;;;;;;;8DAInC,8BAA8B;;;;;;;8DAClC,0BAA0B;;;;;;;8DAGhC,MAAM;;;;;;;8DACC,cAAc;;;;;;kDAK/B,oCAAoC;6CACE,+BAA+B;qCAClB,uBAAuB;kCAC3C,oBAAoB;qCACjB,uBAAuB;oCACH,sBAAsB;2CACzC,6BAA6B;wBAMhE,UAAU;+BACuB,iBAAiB;qDACC,uCAAuC;qBAE7E,cAAc;sBACd,oBAAoB;wBACX,uBAAuB;sBACnB,qBAAqB;kCACmB,qBAAqB;0CAKvF,6BAA6B;mDACc,iDAAiD;sCAC9D,oCAAoC;0CAChC,wCAAwC;yCACnC,uCAAuC;mCACnD,iCAAiC;2CACzB,yCAAyC;4CACxC,0CAA0C;oCAC/C,kCAAkC;6CAC5B,2CAA2C;2CAC7C,yCAAyC;uCAC7C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,CAAC,CAAC;AAClC,CAAC;AAED,SAASnL,UAAU,CAAC4P,GAAW,EAAE;IAC/B,uDAAuD;IACvD,mDAAmD;IACnD,6FAA6F;IAC7F,OAAOA,GAAG,CAACzX,OAAO,qBAAqB,qBAAqB,CAAC,CAAC;AAChE,CAAC;AAED,eAAe4W,oBAAoB,CACjCc,OAAsE,EACtEna,OAAkC,EACjB;IACjB,OAAO,CAAC,MAAMoa,IAAAA,mBAA6B,EAAA,8BAAA,EAACD,OAAO,EAAEna,OAAO,CAAC,CAAC,CAACyV,QAAQ,CAAChB,SAAS,EAAE;QACjF8E,aAAa,EAAEvZ,OAAO,CAACuZ,aAAa;KACrC,CAAC,CAAC;AACL,CAAC"}
|
|
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 { getConfig } from '@expo/config';\nimport { getMetroServerRoot } from '@expo/config/paths';\nimport * as runtimeEnv from '@expo/env';\nimport { SerialAsset } from '@expo/metro-config/build/serializer/serializerAssets';\nimport assert from 'assert';\nimport chalk from 'chalk';\nimport { DeltaResult, TransformInputOptions } from 'metro';\nimport baseJSBundle from 'metro/src/DeltaBundler/Serializers/baseJSBundle';\nimport {\n sourceMapGeneratorNonBlocking,\n type SourceMapGeneratorOptions,\n} from 'metro/src/DeltaBundler/Serializers/sourceMapGenerator';\nimport type MetroHmrServer from 'metro/src/HmrServer';\nimport type { Client as MetroHmrClient } from 'metro/src/HmrServer';\nimport { GraphRevision } from 'metro/src/IncrementalBundler';\nimport bundleToString from 'metro/src/lib/bundleToString';\nimport getGraphId from 'metro/src/lib/getGraphId';\nimport { TransformProfile } from 'metro-babel-transformer';\nimport type { CustomResolverOptions } from 'metro-resolver/src/types';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\n\nimport {\n createServerComponentsMiddleware,\n fileURLToFilePath,\n} from './createServerComponentsMiddleware';\nimport { createRouteHandlerMiddleware } from './createServerRouteMiddleware';\nimport { ExpoRouterServerManifestV1, fetchManifest } from './fetchRouterManifest';\nimport { instantiateMetroAsync } from './instantiateMetro';\nimport { getErrorOverlayHtmlAsync } from './metroErrorInterface';\nimport { assertMetroPrivateServer, MetroPrivateServer } from './metroPrivateServer';\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 { BundleAssetWithFileHashes, ExportAssetMap } from '../../../export/saveAssets';\nimport { Log } from '../../../log';\nimport { env } from '../../../utils/env';\nimport { CommandError } from '../../../utils/errors';\nimport { getFreePortAsync } from '../../../utils/port';\nimport { BundlerDevServer, BundlerStartOptions, DevServerInstance } from '../BundlerDevServer';\nimport {\n cachedSourceMaps,\n evalMetroAndWrapFunctions,\n evalMetroNoHandling,\n} from '../getStaticRenderFunctions';\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 { ReactDevToolsPageMiddleware } from '../middleware/ReactDevToolsPageMiddleware';\nimport { RuntimeRedirectMiddleware } from '../middleware/RuntimeRedirectMiddleware';\nimport { ServeStaticMiddleware } from '../middleware/ServeStaticMiddleware';\nimport {\n convertPathToModuleSpecifier,\n createBundleUrlPath,\n ExpoMetroOptions,\n getAsyncRoutesFromExpoConfig,\n getBaseUrlFromExpoConfig,\n getMetroDirectBundleOptions,\n shouldEnableAsyncImports,\n} from '../middleware/metroOptions';\nimport { prependMiddleware } from '../middleware/mutations';\nimport { startTypescriptTypeGenerationAsync } from '../type-generation/startTypescriptTypeGeneration';\n\nexport type ExpoRouterRuntimeManifest = Awaited<\n ReturnType<typeof import('expo-router/build/static/renderStaticContent').getManifest>\n>;\ntype MetroOnProgress = NonNullable<\n import('metro/src/DeltaBundler/types').Options<void>['onProgress']\n>;\ntype SSRLoadModuleFunc = <T extends Record<string, any>>(\n filePath: string,\n specificOptions?: Partial<ExpoMetroOptions>,\n extras?: { hot?: boolean }\n) => Promise<T>;\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: MetroPrivateServer | null = null;\n private hmrServer: MetroHmrServer | null = null;\n private ssrHmrClients: Map<string, MetroHmrClient> = new Map();\n isReactServerComponentsEnabled?: 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 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: ExpoRouterServerManifestV1;\n platform: string;\n }): Promise<{ files: ExportAssetMap; manifest: ExpoRouterServerManifestV1<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 file: resolveFrom(this.projectRoot, '@expo/cli/static/template/[...rsc]+api.ts'),\n page: rscPath,\n namedRegex: '^/_flight(?:/(?<rsc>.+?))?(?:/)?$',\n routeKeys: { rsc: 'rsc' },\n });\n }\n\n for (const route of manifest.apiRoutes) {\n const filepath = route.file.startsWith('/') ? 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 path.join(outputDir, '.' + rscPath + '.js')\n : path.join(outputDir, path.relative(appDir, filepath.replace(/\\.[tj]sx?$/, '.js')));\n\n if (contents) {\n let src = contents.src;\n\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(\n /\\/\\/# sourceMappingURL=.*/g,\n `//# sourceMappingURL=${artifactBasename}`\n );\n\n const parsedMap =\n typeof contents.map === 'string' ? JSON.parse(contents.map) : contents.map;\n files.set(artifactFilename + '.map', {\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 apiRouteId: route.page,\n targetDomain: 'server',\n });\n }\n files.set(artifactFilename, {\n contents: src,\n apiRouteId: route.page,\n targetDomain: 'server',\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 async getExpoRouterRoutesManifestAsync({ appDir }: { appDir: string }) {\n // getBuiltTimeServerManifest\n const { exp } = getConfig(this.projectRoot);\n const manifest = await fetchManifest(this.projectRoot, {\n ...exp.extra?.router?.platformRoutes,\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({\n environment,\n }: Pick<ExpoMetroOptions, 'environment'> = {}): Promise<{\n serverManifest: ExpoRouterServerManifestV1;\n }> {\n // NOTE: This could probably be folded back into `renderStaticContent` when expo-asset and font support RSC.\n const { getBuildTimeServerManifestAsync } = await this.ssrLoadModule<\n typeof import('expo-router/build/static/getServerManifest')\n >('expo-router/build/static/getServerManifest.js', {\n environment: environment ?? (this.isReactServerComponentsEnabled ? 'react-server' : 'node'),\n });\n\n return {\n serverManifest: await getBuildTimeServerManifestAsync(),\n };\n }\n\n async getStaticRenderFunctionAsync(): Promise<{\n serverManifest: ExpoRouterServerManifestV1;\n manifest: ExpoRouterRuntimeManifest;\n renderAsync: (path: string) => Promise<string>;\n }> {\n const url = this.getDevServerUrlOrAssert();\n\n const { getStaticContent, getManifest, getBuildTimeServerManifestAsync } =\n await this.ssrLoadModule<typeof import('expo-router/build/static/renderStaticContent')>(\n 'expo-router/node/render.js',\n {\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\n const { exp } = getConfig(this.projectRoot);\n\n return {\n serverManifest: await getBuildTimeServerManifestAsync(),\n // Get routes from Expo Router.\n manifest: await getManifest({ preserveApiRoutes: false, ...exp.extra?.router }),\n // Get route generating function\n async renderAsync(path: string) {\n return await getStaticContent(new URL(path, url));\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: shouldEnableAsyncImports(this.projectRoot),\n asyncRoutes,\n baseUrl,\n isExporting,\n routerRoot,\n clientBoundaries,\n reactCompiler,\n bytecode: false,\n });\n }\n\n private async getStaticPageAsync(pathname: string) {\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: shouldEnableAsyncImports(this.projectRoot),\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/build/static/renderStaticContent')\n >('expo-router/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 return await getStaticContent(location);\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 const res = await this.ssrLoadModuleContents(filePath, specificOptions);\n\n if (extras.hot && this.instanceMetroOptions.isExporting !== true) {\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 ) {\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 hot: 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 // @ts-expect-error: `runtimeBytecodeVersion` does not exist in `expoBundleOptions` or `TransformInputOptions`\n runtimeBytecodeVersion: expoBundleOptions.runtimeBytecodeVersion,\n };\n\n const resolvedEntryFilePath = await this.resolveRelativePathAsync(filePath, {\n resolverOptions,\n transformOptions,\n });\n\n // Use fully qualified URL with all options to represent the file path that's used for source maps and HMR. This prevents collisions.\n const filename = createBundleUrlPath({\n ...opts,\n mainModuleName: resolvedEntryFilePath,\n });\n\n // https://github.com/facebook/metro/blob/2405f2f6c37a1b641cc379b9c733b1eff0c1c2a1/packages/metro/src/lib/parseOptionsFromUrl.js#L55-L87\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\n inlineSourceMap: expoBundleOptions.inlineSourceMap ?? false,\n modulesOnly: expoBundleOptions.modulesOnly ?? false,\n runModule: expoBundleOptions.runModule ?? true,\n // @ts-expect-error\n sourceUrl: expoBundleOptions.sourceUrl,\n // @ts-expect-error\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 ) {\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 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 if (this.isReactServerComponentsEnabled) {\n return this.singlePageReactServerComponentExportAsync(options, files, extraOptions);\n }\n\n return this.legacySinglePageExportBundleAsync(options, extraOptions);\n }\n\n private async singlePageReactServerComponentExportAsync(\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 // 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 },\n files\n );\n\n // TODO: The output keys should be in production format or use a lookup manifest.\n\n debug('Evaluated client boundaries:', clientBoundaries);\n\n // Run metro bundler and create the JS bundles/source maps.\n let 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 reactServerReferences = bundle.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 if (!reactServerReferences) {\n // 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\n debug('React server action boundaries from client:', reactServerReferences);\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 entryPoints: [...serverActionReferencesInServer, ...reactServerReferences],\n },\n files\n );\n\n const hasUniqueClientBoundaries = nestedClientBoundaries.some(\n (boundary) => !clientBoundaries.includes(boundary)\n );\n\n if (hasUniqueClientBoundaries) {\n debug('Re-bundling client with nested client boundaries:', nestedClientBoundaries);\n clientBoundaries = [...new Set(clientBoundaries.concat(nestedClientBoundaries))];\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 bundle = await this.legacySinglePageExportBundleAsync(\n {\n ...options,\n clientBoundaries: [...clientBoundaries, ...nestedClientBoundaries],\n },\n extraOptions\n );\n }\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 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>();\n\n if (Object.keys(moduleIdToSplitBundle).length) {\n clientBoundariesAsOpaqueIds.forEach((boundary) => {\n if (boundary in moduleIdToSplitBundle) {\n // Account for nullish values (bundle is in main chunk).\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 // @ts-expect-error\n ssrManifest.set(boundary, null);\n });\n }\n\n // Export the static RSC files\n await this.rscRenderer!.exportRoutesAsync(\n {\n platform: options.platform,\n ssrManifest,\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 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'\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('/')) {\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?.reactServerComponents || !!exp.experiments?.reactServerActions;\n const isReactServerActionsOnlyEnabled =\n !exp.experiments?.reactServerComponents && !!exp.experiments?.reactServerActions;\n this.isReactServerComponentsEnabled = isReactServerComponentsEnabled;\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 if (isReactServerComponentsEnabled && useServerRendering) {\n throw new CommandError(\n `Experimental server component support does not support 'web.output: ${exp.web!.output}' yet. Use 'web.output: \"single\"' during the experimental phase.`\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(new ReactDevToolsPageMiddleware(this.projectRoot).getHandler());\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(new CreateFileMiddleware(this.projectRoot).getHandler());\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 );\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 });\n this.rscRenderer = rscMiddleware;\n middleware.use(rscMiddleware.middleware);\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 if (!useServerRendering || isReactServerComponentsEnabled) {\n // This MUST run last since it's the fallback.\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 getStaticPageAsync: (pathname) => {\n return this.getStaticPageAsync(pathname);\n },\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 });\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 assertMetroPrivateServer(metro);\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: (() => void) | null = null;\n\n private async registerSsrHmrAsync(url: string, onReload: () => 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: unknown[];\n modified: unknown[];\n deleted: unknown[];\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 onReload();\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 // @ts-expect-error\n (this.metro?._bundler._revisionsByGraphId as Map).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<\n string,\n Promise<{ src: string; filename: string; map: string } | null>\n >();\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<{ src: string; filename: string; map?: any } | null | undefined> {\n if (this.pendingRouteOperations.has(filePath)) {\n return this.pendingRouteOperations.get(filePath);\n }\n const bundleAsync = async () => {\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 // @ts-expect-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 // 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 // @ts-expect-error\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 = () => {\n // Send reload command to client from Fast Refresh code.\n debug('[SSR]: Reload requested.');\n\n this.onReloadRscEvent?.();\n\n this.broadcastMessage('sendDevCommand', {\n name: 'rsc-reload',\n // TODO: Target only certain platforms\n // platform,\n });\n };\n\n this.registerSsrHmrAsync(url.toString(), onReload);\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 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<{\n numModifiedFiles: number;\n lastModifiedDate: Date;\n nextRevId: string;\n bundle: string;\n map: string;\n\n // Defined if the output is multi-bundle.\n artifacts?: SerialAsset[];\n assets?: readonly BundleAssetWithFileHashes[];\n }> {\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: MetroOnProgress = (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 // 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\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 bundle = await serializer(\n // NOTE: Using absolute path instead of relative input path is a breaking change.\n // entryFile,\n resolvedEntryFilePath,\n\n revision.prepend as any,\n revision.graph as any,\n {\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 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 // @ts-expect-error: passed to our serializer to enable non-serial return values.\n serializerOptions,\n }\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 // @ts-expect-error: If the output is multi-bundle...\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) {\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 import('metro/src/DeltaBundler/types').Module<any>[],\n options: SourceMapGeneratorOptions\n): Promise<string> {\n return (await sourceMapGeneratorNonBlocking(modules, options)).toString(undefined, {\n excludeSource: options.excludeSource,\n });\n}\n"],"names":["MetroBundlerDevServer","debug","require","EXPO_GO_METRO_PORT","DEV_CLIENT_METRO_PORT","BundlerDevServer","metro","hmrServer","ssrHmrClients","Map","name","resolvePortAsync","options","port","devClient","Number","process","env","RCT_METRO_PORT","getFreePortAsync","exportExpoRouterApiRoutesAsync","includeSourceMaps","outputDir","prerenderManifest","platform","routerRoot","instanceMetroOptions","assert","appDir","path","join","projectRoot","manifest","getExpoRouterRoutesManifestAsync","files","rscPath","isReactServerComponentsEnabled","apiRoutes","find","route","page","startsWith","push","file","resolveFrom","namedRegex","routeKeys","rsc","filepath","contents","bundleApiRoute","artifactFilename","relative","replace","src","map","artifactBasename","encodeURIComponent","basename","parsedMap","JSON","parse","set","stringify","version","sources","source","convertPathToModuleSpecifier","sourcesContent","Array","length","fill","names","mappings","apiRouteId","targetDomain","htmlRoutes","exp","getConfig","fetchManifest","extra","router","platformRoutes","asJson","CommandError","getServerManifestAsync","environment","getBuildTimeServerManifestAsync","ssrLoadModule","serverManifest","getStaticRenderFunctionAsync","url","getDevServerUrlOrAssert","getStaticContent","getManifest","preserveApiRoutes","renderAsync","URL","getStaticResourcesAsync","mainModuleName","clientBoundaries","mode","minify","isExporting","baseUrl","reactCompiler","asyncRoutes","resolvedMainModuleName","resolveMainModuleName","metroImportAsArtifactsAsync","splitChunks","EXPO_NO_BUNDLE_SPLITTING","serializerIncludeMaps","lazy","shouldEnableAsyncImports","bytecode","getStaticPageAsync","pathname","devBundleUrlPathname","createBundleUrlPath","bundleStaticHtml","location","artifacts","resources","staticHtml","Promise","all","content","serializeHtmlWithAssets","template","devBundleUrl","hydrate","EXPO_WEB_DEV_HYDRATE","filePath","specificOptions","extras","res","ssrLoadModuleContents","hot","serverRoot","getMetroServerRoot","relativePath","filename","setupHmr","evalMetroAndWrapFunctions","results","serializerOutput","assets","metroLoadModuleContents","extraOptions","opts","inlineSourceMap","engine","expoBundleOptions","getMetroDirectBundleOptions","resolverOptions","customResolverOptions","dev","transformOptions","type","unstable_transformProfile","customTransformOptions","Object","create","runtimeBytecodeVersion","resolvedEntryFilePath","resolveRelativePathAsync","_bundleDirectAsync","graphOptions","shallow","serializerOptions","modulesOnly","runModule","sourceUrl","sourceMapUrl","bundle","rest","scriptContents","wrapBundle","cachedSourceMaps","nativeExportBundleAsync","singlePageReactServerComponentExportAsync","legacySinglePageExportBundleAsync","reactClientReferences","reactServerReferences","serverActionReferencesInServer","cssModules","rscRenderer","getExpoRouterClientReferencesAsync","filter","a","artifact","metadata","ref","fileURLToFilePath","flat","Boolean","Error","nestedClientBoundaries","exportServerActionsAsync","entryPoints","hasUniqueClientBoundaries","some","boundary","includes","Set","concat","clientBoundariesAsOpaqueIds","moduleIdToSplitBundle","paths","values","reduce","acc","ssrManifest","keys","forEach","exportRoutesAsync","fromEntries","from","entries","key","value","output","watchEnvironmentVariables","instance","envFiles","runtimeEnv","getFiles","NODE_ENV","fileName","observeFileChanges","server","load","force","startImplementationAsync","urlCreator","getUrlCreator","config","skipSDKVersionRequirement","experiments","reactServerComponents","reactServerActions","isReactServerActionsOnlyEnabled","useServerRendering","web","hasApiRoutes","getBaseUrlFromExpoConfig","getAsyncRoutesFromExpoConfig","getRouterDirectoryModuleIdWithManifest","parsedOptions","maxWorkers","resetCache","resetDevServer","EXPO_DEV_SERVER_ORIGIN","middleware","messageSocket","instantiateMetroAsync","manifestMiddleware","getManifestMiddlewareAsync","prependMiddleware","ContextModuleSourceMapsMiddleware","getHandler","use","InterstitialPageMiddleware","scheme","ReactDevToolsPageMiddleware","DevToolsPluginMiddleware","devToolsPluginManager","deepLinkMiddleware","RuntimeRedirectMiddleware","getLocation","runtime","constructDevClientUrl","constructUrl","domComponentRenderer","createDomComponentsMiddleware","metroRoot","CreateFileMiddleware","isTargetingWeb","ServeStaticMiddleware","FaviconMiddleware","observeAnyFileChanges","events","invalidateApiRouteCache","hasWarnedAboutApiRoutes","event","isApiRouteConvention","warnInvalidWebOutput","bindRSCDevModuleInjectionHandler","rscMiddleware","createServerComponentsMiddleware","bind","ssrLoadModuleArtifacts","useClientRouter","onReloadRscEvent","HistoryFallbackMiddleware","internal","createRouteHandlerMiddleware","functionFilePath","ssrImportApiRoute","originalClose","close","callback","err","assertMetroPrivateServer","host","protocol","registerSsrHmrAsync","onReload","has","sendFn","message","data","String","update","body","isInitialUpdate","added","modified","deleted","hasUpdate","Log","error","_bundler","_revisionsByGraphId","client","onClientConnect","optedIntoHMR","_registerEntryPoint","waitForTypeScriptAsync","resolve","off","metroWatchTypeScriptFiles","tsconfig","throttle","eventTypes","TypeScriptProjectPrerequisite","req","bootstrapAsync","log","chalk","red","exception","startTypeScriptServices","startTypescriptTypeGenerationAsync","getConfigModuleIds","pendingRouteOperations","get","bundleAsync","undefined","apiRoute","evalMetroNoHandling","htmlServerError","getErrorOverlayHtmlAsync","Response","status","headers","internalError","clear","globalThis","__expo_rsc_inject_module","sendClientModule","code","id","broadcastMessage","toString","_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","int","graph_node_count","graph","dependencies","size","shouldAddToIgnoreList","_shouldAddModuleToIgnoreList","serializer","getMetroSerializer","prepend","asyncRequireModulePath","_resolveRelativePath","transformer","relativeTo","processModuleFilter","createModuleId","_createModuleId","getRunModuleStatement","includeAsyncPaths","runBeforeMainModule","getModulesRunBeforeMainModule","unstable_serverRoot","bundleCode","bundleMap","parsed","isArray","asset","numModifiedFiles","reset","lastModifiedDate","date","nextRevId","sourceMapStringAsync","_getSortedModules","excludeSource","customSerializer","entryPoint","preModules","bundleToString","baseJSBundle","graphId","getGraphId","unstable_allowRequireContext","getRevisionByGraphId","moduleId","str","modules","sourceMapGeneratorNonBlocking"],"mappings":"AAAA;;;;;CAKC,GACD;;;;+BA8FaA,uBAAqB;;aAArBA,qBAAqB;;;yBA9FR,cAAc;;;;;;;yBACL,oBAAoB;;;;;;;+DAC3B,WAAW;;;;;;;8DAEpB,QAAQ;;;;;;;8DACT,OAAO;;;;;;;8DAEA,iDAAiD;;;;;;;yBAInE,uDAAuD;;;;;;;8DAInC,8BAA8B;;;;;;;8DAClC,0BAA0B;;;;;;;8DAGhC,MAAM;;;;;;;8DACC,cAAc;;;;;;kDAK/B,oCAAoC;6CACE,+BAA+B;qCAClB,uBAAuB;kCAC3C,oBAAoB;qCACjB,uBAAuB;oCACH,sBAAsB;2CACzC,6BAA6B;wBAMhE,UAAU;+BACuB,iBAAiB;qDACC,uCAAuC;qBAE7E,cAAc;sBACd,oBAAoB;wBACX,uBAAuB;sBACnB,qBAAqB;kCACmB,qBAAqB;0CAKvF,6BAA6B;mDACc,iDAAiD;sCAC9D,oCAAoC;0CAChC,wCAAwC;yCACnC,uCAAuC;mCACnD,iCAAiC;2CACzB,yCAAyC;4CACxC,0CAA0C;oCAC/C,kCAAkC;6CAC5B,2CAA2C;2CAC7C,yCAAyC;uCAC7C,qCAAqC;8BASpE,4BAA4B;2BACD,yBAAyB;+CACR,kDAAkD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcrG,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,yBAAyB,CAAC,AAAsB,AAAC;AAEhF,qDAAqD,GACrD,MAAMC,kB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EAAA,8BAAA,EAACD,OAAO,EAAE3a,OAAO,CAAC,CAAC,CAACiW,QAAQ,CAAChB,SAAS,EAAE;QACjF8E,aAAa,EAAE/Z,OAAO,CAAC+Z,aAAa;KACrC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -58,7 +58,8 @@ function _interopRequireDefault(obj) {
|
|
|
58
58
|
}
|
|
59
59
|
const debug = require("debug")("expo:rsc");
|
|
60
60
|
const getMetroServerRootMemo = (0, _fn.memoize)(_paths().getMetroServerRoot);
|
|
61
|
-
function createServerComponentsMiddleware(projectRoot, { rscPath , instanceMetroOptions , ssrLoadModule , ssrLoadModuleArtifacts }) {
|
|
61
|
+
function createServerComponentsMiddleware(projectRoot, { rscPath , instanceMetroOptions , ssrLoadModule , ssrLoadModuleArtifacts , useClientRouter }) {
|
|
62
|
+
const routerModule = useClientRouter ? "expo-router/build/rsc/router/noopRouter" : "expo-router/build/rsc/router/expo-definedRouter";
|
|
62
63
|
const rscMiddleware = (0, _rsc().getRscMiddleware)({
|
|
63
64
|
config: {},
|
|
64
65
|
// Disabled in development
|
|
@@ -109,7 +110,9 @@ function createServerComponentsMiddleware(projectRoot, { rscPath , instanceMetro
|
|
|
109
110
|
// TODO: Support multiple entry points in a single split server bundle...
|
|
110
111
|
const serverRoot = getMetroServerRootMemo(projectRoot);
|
|
111
112
|
const manifest = {};
|
|
113
|
+
const nestedClientBoundaries = [];
|
|
112
114
|
for (const entryPoint of uniqueEntryPoints){
|
|
115
|
+
var ref;
|
|
113
116
|
const contents = await ssrLoadModuleArtifacts(entryPoint, {
|
|
114
117
|
environment: "react-server",
|
|
115
118
|
platform,
|
|
@@ -118,6 +121,10 @@ function createServerComponentsMiddleware(projectRoot, { rscPath , instanceMetro
|
|
|
118
121
|
// Required
|
|
119
122
|
runModule: true
|
|
120
123
|
});
|
|
124
|
+
const reactClientReferences = (ref = contents.artifacts.filter((a)=>a.type === "js")[0].metadata.reactClientReferences) == null ? void 0 : ref.map((ref)=>fileURLToFilePath(ref));
|
|
125
|
+
if (reactClientReferences) {
|
|
126
|
+
nestedClientBoundaries.push(...reactClientReferences);
|
|
127
|
+
}
|
|
121
128
|
// Naive check to ensure the module runtime is not included in the server action bundle.
|
|
122
129
|
if (contents.src.includes("The experimental Metro feature")) {
|
|
123
130
|
throw new Error("Internal error: module runtime should not be included in server action bundles: " + entryPoint);
|
|
@@ -142,12 +149,13 @@ function createServerComponentsMiddleware(projectRoot, { rscPath , instanceMetro
|
|
|
142
149
|
contents: "module.exports = " + JSON.stringify(manifest)
|
|
143
150
|
});
|
|
144
151
|
return {
|
|
145
|
-
manifest
|
|
152
|
+
manifest,
|
|
153
|
+
clientBoundaries: nestedClientBoundaries
|
|
146
154
|
};
|
|
147
155
|
}
|
|
148
156
|
async function getExpoRouterClientReferencesAsync({ platform }, files) {
|
|
149
157
|
var ref, ref1;
|
|
150
|
-
const contents = await ssrLoadModuleArtifacts(
|
|
158
|
+
const contents = await ssrLoadModuleArtifacts(routerModule, {
|
|
151
159
|
environment: "react-server",
|
|
152
160
|
platform
|
|
153
161
|
});
|
|
@@ -176,7 +184,7 @@ function createServerComponentsMiddleware(projectRoot, { rscPath , instanceMetro
|
|
|
176
184
|
};
|
|
177
185
|
}
|
|
178
186
|
async function getExpoRouterRscEntriesGetterAsync({ platform }) {
|
|
179
|
-
return ssrLoadModule(
|
|
187
|
+
return ssrLoadModule(routerModule, {
|
|
180
188
|
environment: "react-server",
|
|
181
189
|
platform
|
|
182
190
|
}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/server/metro/createServerComponentsMiddleware.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 { getMetroServerRoot } from '@expo/config/paths';\nimport { SerialAsset } from '@expo/metro-config/build/serializer/serializerAssets';\nimport { getRscMiddleware } from '@expo/server/build/middleware/rsc';\nimport assert from 'assert';\nimport path from 'path';\n\nimport { logMetroError } from './metroErrorInterface';\nimport { ExportAssetMap } from '../../../export/saveAssets';\nimport { stripAnsi } from '../../../utils/ansi';\nimport { memoize } from '../../../utils/fn';\nimport { streamToStringAsync } from '../../../utils/stream';\nimport { createBuiltinAPIRequestHandler } from '../middleware/createBuiltinAPIRequestHandler';\nimport {\n createBundleUrlSearchParams,\n ExpoMetroOptions,\n getMetroOptionsFromUrl,\n} from '../middleware/metroOptions';\n\nconst debug = require('debug')('expo:rsc') as typeof console.log;\n\ntype SSRLoadModuleArtifactsFunc = (\n filePath: string,\n specificOptions?: Partial<ExpoMetroOptions>\n) => Promise<{ artifacts: SerialAsset[]; src: string }>;\n\ntype SSRLoadModuleFunc = <T extends Record<string, any>>(\n filePath: string,\n specificOptions?: Partial<ExpoMetroOptions>,\n extras?: { hot?: boolean }\n) => Promise<T>;\n\nconst getMetroServerRootMemo = memoize(getMetroServerRoot);\n\nexport function createServerComponentsMiddleware(\n projectRoot: string,\n {\n rscPath,\n instanceMetroOptions,\n ssrLoadModule,\n ssrLoadModuleArtifacts,\n }: {\n rscPath: string;\n instanceMetroOptions: Partial<ExpoMetroOptions>;\n ssrLoadModule: SSRLoadModuleFunc;\n ssrLoadModuleArtifacts: SSRLoadModuleArtifactsFunc;\n }\n) {\n const rscMiddleware = getRscMiddleware({\n config: {},\n // Disabled in development\n baseUrl: '',\n rscPath,\n onError: console.error,\n renderRsc: async (args) => {\n // Dev server-only implementation.\n try {\n return await renderRscToReadableStream({\n ...args,\n body: args.body!,\n });\n } catch (error: any) {\n // If you get a codeFrame error during SSR like when using a Class component in React Server Components, then this\n // will throw with:\n // {\n // rawObject: {\n // type: 'TransformError',\n // lineNumber: 0,\n // errors: [ [Object] ],\n // name: 'SyntaxError',\n // message: '...',\n // }\n // }\n\n // TODO: Revisit all error handling now that we do direct metro bundling...\n await logMetroError(projectRoot, { error });\n\n const sanitizedServerMessage = stripAnsi(error.message) ?? error.message;\n throw new Response(sanitizedServerMessage, {\n status: 500,\n headers: {\n 'Content-Type': 'text/plain',\n },\n });\n }\n },\n });\n\n let rscPathPrefix = rscPath;\n if (rscPathPrefix !== '/') {\n rscPathPrefix += '/';\n }\n\n async function exportServerActionsAsync(\n { platform, entryPoints }: { platform: string; entryPoints: string[] },\n files: ExportAssetMap\n ): Promise<{\n manifest: Record<string, [string, string]>;\n }> {\n const uniqueEntryPoints = [...new Set(entryPoints)];\n // TODO: Support multiple entry points in a single split server bundle...\n const serverRoot = getMetroServerRootMemo(projectRoot);\n\n const manifest: Record<string, [string, string]> = {};\n for (const entryPoint of uniqueEntryPoints) {\n const contents = await ssrLoadModuleArtifacts(entryPoint, {\n environment: 'react-server',\n platform,\n // Ignore the metro runtime to avoid overwriting the original in the API route.\n modulesOnly: true,\n // Required\n runModule: true,\n });\n\n // Naive check to ensure the module runtime is not included in the server action bundle.\n if (contents.src.includes('The experimental Metro feature')) {\n throw new Error(\n 'Internal error: module runtime should not be included in server action bundles: ' +\n entryPoint\n );\n }\n const relativeName = path.relative(serverRoot, entryPoint);\n const safeName = path.basename(contents.artifacts.find((a) => a.type === 'js')!.filename!);\n\n const outputName = `_expo/rsc/${platform}/${safeName}`;\n // While we're here, export the router for the server to dynamically render RSC.\n files.set(outputName, {\n targetDomain: 'server',\n contents: wrapBundle(contents.src),\n });\n\n // Import relative to `dist/server/_expo/rsc/web/router.js`\n manifest[entryPoint] = [relativeName, outputName];\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/${platform}/action-manifest.js`, {\n targetDomain: 'server',\n contents: 'module.exports = ' + JSON.stringify(manifest),\n });\n\n return { manifest };\n }\n\n async function getExpoRouterClientReferencesAsync(\n { platform }: { platform: string },\n files: ExportAssetMap\n ): Promise<{\n reactClientReferences: string[];\n reactServerReferences: string[];\n cssModules: SerialAsset[];\n }> {\n const contents = await ssrLoadModuleArtifacts(\n 'expo-router/build/rsc/router/expo-definedRouter',\n {\n environment: 'react-server',\n platform,\n }\n );\n\n // Extract the global CSS modules that are imported from the router.\n // These will be injected in the head of the HTML document for the website.\n const cssModules = contents.artifacts.filter((a) => a.type.startsWith('css'));\n\n const reactServerReferences = contents.artifacts\n .filter((a) => a.type === 'js')[0]\n .metadata.reactServerReferences?.map((ref) => fileURLToFilePath(ref));\n\n if (!reactServerReferences) {\n throw new Error(\n 'Static server action references were not returned from the Metro SSR bundle for definedRouter'\n );\n }\n debug('React client boundaries:', reactServerReferences);\n\n const reactClientReferences = contents.artifacts\n .filter((a) => a.type === 'js')[0]\n .metadata.reactClientReferences?.map((ref) => fileURLToFilePath(ref));\n\n if (!reactClientReferences) {\n throw new Error(\n 'Static client references were not returned from the Metro SSR bundle for definedRouter'\n );\n }\n debug('React client boundaries:', reactClientReferences);\n\n // While we're here, export the router for the server to dynamically render RSC.\n files.set(`_expo/rsc/${platform}/router.js`, {\n targetDomain: 'server',\n contents: wrapBundle(contents.src),\n });\n\n return { reactClientReferences, reactServerReferences, cssModules };\n }\n\n async function getExpoRouterRscEntriesGetterAsync({ platform }: { platform: string }) {\n return ssrLoadModule<typeof import('expo-router/build/rsc/router/expo-definedRouter')>(\n 'expo-router/build/rsc/router/expo-definedRouter',\n {\n environment: 'react-server',\n platform,\n },\n {\n hot: true,\n }\n );\n }\n\n function getResolveClientEntry(context: {\n platform: string;\n engine?: 'hermes' | null;\n ssrManifest?: Map<string, string>;\n }) {\n const serverRoot = getMetroServerRootMemo(projectRoot);\n\n const {\n mode,\n minify = false,\n isExporting,\n baseUrl,\n routerRoot,\n asyncRoutes,\n preserveEnvVars,\n reactCompiler,\n lazy,\n } = instanceMetroOptions;\n\n assert(\n isExporting != null &&\n baseUrl != null &&\n mode != null &&\n routerRoot != null &&\n asyncRoutes != null,\n `The server must be started. (isExporting: ${isExporting}, baseUrl: ${baseUrl}, mode: ${mode}, routerRoot: ${routerRoot}, asyncRoutes: ${asyncRoutes})`\n );\n\n return (file: string, isServer: boolean) => {\n if (isExporting) {\n assert(context.ssrManifest, 'SSR manifest must exist when exporting');\n const relativeFilePath = path.relative(serverRoot, file);\n\n assert(\n context.ssrManifest.has(relativeFilePath),\n `SSR manifest is missing client boundary \"${relativeFilePath}\"`\n );\n\n const chunk = context.ssrManifest.get(relativeFilePath);\n\n return {\n id: relativeFilePath,\n chunks: chunk != null ? [chunk] : [],\n };\n }\n\n const searchParams = createBundleUrlSearchParams({\n mainModuleName: '',\n platform: context.platform,\n mode,\n minify,\n lazy,\n preserveEnvVars,\n asyncRoutes,\n baseUrl,\n routerRoot,\n isExporting,\n reactCompiler: !!reactCompiler,\n engine: context.engine ?? undefined,\n bytecode: false,\n clientBoundaries: [],\n inlineSourceMap: false,\n environment: isServer ? 'react-server' : 'client',\n modulesOnly: true,\n runModule: false,\n });\n\n searchParams.set('resolver.clientboundary', String(true));\n\n const clientReferenceUrl = new URL('http://a');\n\n // TICKLE: Handshake 1\n searchParams.set('xRSC', '1');\n\n clientReferenceUrl.search = searchParams.toString();\n\n const filePath = file.startsWith('file://') ? fileURLToFilePath(file) : file;\n const relativeFilePath = path.relative(serverRoot, filePath);\n\n clientReferenceUrl.pathname = relativeFilePath;\n\n // Ensure url.pathname ends with '.bundle'\n if (!clientReferenceUrl.pathname.endsWith('.bundle')) {\n clientReferenceUrl.pathname += '.bundle';\n }\n\n // Return relative URLs to help Android fetch from wherever it was loaded from since it doesn't support localhost.\n const id = clientReferenceUrl.pathname + clientReferenceUrl.search;\n\n return { id: relativeFilePath, chunks: [id] };\n };\n }\n\n const rscRendererCache = new Map<string, typeof import('expo-router/build/rsc/rsc-renderer')>();\n\n async function getRscRendererAsync(platform: string) {\n // NOTE(EvanBacon): We memoize this now that there's a persistent server storage cache for Server Actions.\n if (rscRendererCache.has(platform)) {\n return rscRendererCache.get(platform)!;\n }\n\n // TODO: Extract CSS Modules / Assets from the bundler process\n const renderer = await ssrLoadModule<typeof import('expo-router/build/rsc/rsc-renderer')>(\n 'expo-router/build/rsc/rsc-renderer',\n {\n environment: 'react-server',\n platform,\n }\n );\n\n rscRendererCache.set(platform, renderer);\n return renderer;\n }\n\n const rscRenderContext = new Map<string, any>();\n\n function getRscRenderContext(platform: string) {\n // NOTE(EvanBacon): We memoize this now that there's a persistent server storage cache for Server Actions.\n if (rscRenderContext.has(platform)) {\n return rscRenderContext.get(platform)!;\n }\n\n const context = {};\n\n rscRenderContext.set(platform, context);\n return context;\n }\n\n async function renderRscToReadableStream(\n {\n input,\n searchParams,\n method,\n platform,\n body,\n engine,\n contentType,\n ssrManifest,\n decodedBody,\n }: {\n input: string;\n searchParams: URLSearchParams;\n method: 'POST' | 'GET';\n platform: string;\n body?: ReadableStream<Uint8Array>;\n engine?: 'hermes' | null;\n contentType?: string;\n ssrManifest?: Map<string, string>;\n decodedBody?: unknown;\n },\n isExporting: boolean | undefined = instanceMetroOptions.isExporting\n ) {\n assert(\n isExporting != null,\n 'The server must be started before calling renderRscToReadableStream.'\n );\n\n if (method === 'POST') {\n assert(body, 'Server request must be provided when method is POST (server actions)');\n }\n\n const { renderRsc } = await getRscRendererAsync(platform);\n\n return renderRsc(\n {\n body,\n decodedBody,\n context: getRscRenderContext(platform),\n config: {},\n input,\n contentType,\n },\n {\n isExporting,\n entries: await getExpoRouterRscEntriesGetterAsync({ platform }),\n resolveClientEntry: getResolveClientEntry({ platform, engine, ssrManifest }),\n async loadServerModuleRsc(urlFragment) {\n const serverRoot = getMetroServerRootMemo(projectRoot);\n\n debug('[SSR] loadServerModuleRsc:', urlFragment);\n\n const options = getMetroOptionsFromUrl(urlFragment);\n\n return ssrLoadModule(path.join(serverRoot, options.mainModuleName), options);\n },\n }\n );\n }\n\n return {\n // Get the static client boundaries (no dead code elimination allowed) for the production export.\n getExpoRouterClientReferencesAsync,\n exportServerActionsAsync,\n\n async exportRoutesAsync(\n {\n platform,\n ssrManifest,\n }: {\n platform: string;\n ssrManifest: Map<string, string>;\n },\n files: ExportAssetMap\n ) {\n // TODO: When we add web SSR support, we need to extract CSS Modules / Assets from the bundler process to prevent FLOUC.\n const { getBuildConfig } = (await getExpoRouterRscEntriesGetterAsync({ platform })).default;\n\n // Get all the routes to render.\n const buildConfig = await getBuildConfig!(async () =>\n // TODO: Rework prefetching code to use Metro runtime.\n []\n );\n\n await Promise.all(\n Array.from(buildConfig).map(async ({ entries }) => {\n for (const { input, isStatic } of entries || []) {\n if (!isStatic) {\n debug('Skipping static export for route', { input });\n continue;\n }\n const destRscFile = path.join('_flight', platform, encodeInput(input));\n\n const pipe = await renderRscToReadableStream(\n {\n input,\n method: 'GET',\n platform,\n searchParams: new URLSearchParams(),\n ssrManifest,\n },\n true\n );\n\n const rsc = await streamToStringAsync(pipe);\n debug('RSC Payload', { platform, input, rsc });\n\n files.set(destRscFile, {\n contents: rsc,\n targetDomain: 'client',\n rscId: input,\n });\n }\n })\n );\n },\n\n middleware: createBuiltinAPIRequestHandler(\n // Match `/_flight/[platform]/[...path]`\n (req) => {\n return getFullUrl(req.url).pathname.startsWith(rscPathPrefix);\n },\n rscMiddleware\n ),\n onReloadRscEvent: () => {\n // NOTE: We cannot clear the renderer context because it would break the mounted context state.\n\n // Clear the render context to ensure that the next render is a fresh start.\n rscRenderContext.clear();\n },\n };\n}\n\nconst getFullUrl = (url: string) => {\n try {\n return new URL(url);\n } catch {\n return new URL(url, 'http://localhost:0');\n }\n};\n\nexport const fileURLToFilePath = (fileURL: string) => {\n if (!fileURL.startsWith('file://')) {\n throw new Error('Not a file URL');\n }\n return decodeURI(fileURL.slice('file://'.length));\n};\n\nconst encodeInput = (input: string) => {\n if (input === '') {\n return 'index.txt';\n }\n if (input === 'index') {\n throw new Error('Input should not be `index`');\n }\n if (input.startsWith('/')) {\n throw new Error('Input should not start with `/`');\n }\n if (input.endsWith('/')) {\n throw new Error('Input should not end with `/`');\n }\n return input + '.txt';\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"],"names":["createServerComponentsMiddleware","fileURLToFilePath","debug","require","getMetroServerRootMemo","memoize","getMetroServerRoot","projectRoot","rscPath","instanceMetroOptions","ssrLoadModule","ssrLoadModuleArtifacts","rscMiddleware","getRscMiddleware","config","baseUrl","onError","console","error","renderRsc","args","renderRscToReadableStream","body","logMetroError","sanitizedServerMessage","stripAnsi","message","Response","status","headers","rscPathPrefix","exportServerActionsAsync","platform","entryPoints","files","uniqueEntryPoints","Set","serverRoot","manifest","entryPoint","contents","environment","modulesOnly","runModule","src","includes","Error","relativeName","path","relative","safeName","basename","artifacts","find","a","type","filename","outputName","set","targetDomain","wrapBundle","JSON","stringify","getExpoRouterClientReferencesAsync","cssModules","filter","startsWith","reactServerReferences","metadata","map","ref","reactClientReferences","getExpoRouterRscEntriesGetterAsync","hot","getResolveClientEntry","context","mode","minify","isExporting","routerRoot","asyncRoutes","preserveEnvVars","reactCompiler","lazy","assert","file","isServer","ssrManifest","relativeFilePath","has","chunk","get","id","chunks","searchParams","createBundleUrlSearchParams","mainModuleName","engine","undefined","bytecode","clientBoundaries","inlineSourceMap","String","clientReferenceUrl","URL","search","toString","filePath","pathname","endsWith","rscRendererCache","Map","getRscRendererAsync","renderer","rscRenderContext","getRscRenderContext","input","method","contentType","decodedBody","entries","resolveClientEntry","loadServerModuleRsc","urlFragment","options","getMetroOptionsFromUrl","join","exportRoutesAsync","getBuildConfig","default","buildConfig","Promise","all","Array","from","isStatic","destRscFile","encodeInput","pipe","URLSearchParams","rsc","streamToStringAsync","rscId","middleware","createBuiltinAPIRequestHandler","req","getFullUrl","url","onReloadRscEvent","clear","fileURL","decodeURI","slice","length","str","replace"],"mappings":"AAAA;;;;;CAKC,GACD;;;;;;;;;;;IAiCgBA,gCAAgC,MAAhCA,gCAAgC;IA4bnCC,iBAAiB,MAAjBA,iBAAiB;;;yBA7dK,oBAAoB;;;;;;;yBAEtB,mCAAmC;;;;;;;8DACjD,QAAQ;;;;;;;8DACV,MAAM;;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CAACrB,KAAa,GAAK;IACrC,IAAIA,KAAK,KAAK,EAAE,EAAE;QAChB,OAAO,WAAW,CAAC;IACrB,CAAC;IACD,IAAIA,KAAK,KAAK,OAAO,EAAE;QACrB,MAAM,IAAItE,KAAK,CAAC,6BAA6B,CAAC,CAAC;IACjD,CAAC;IACD,IAAIsE,KAAK,CAAClD,UAAU,CAAC,GAAG,CAAC,EAAE;QACzB,MAAM,IAAIpB,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACrD,CAAC;IACD,IAAIsE,KAAK,CAACP,QAAQ,CAAC,GAAG,CAAC,EAAE;QACvB,MAAM,IAAI/D,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACnD,CAAC;IACD,OAAOsE,KAAK,GAAG,MAAM,CAAC;AACxB,CAAC,AAAC;AAEF,SAASxD,UAAU,CAAC8F,GAAW,EAAE;IAC/B,uDAAuD;IACvD,mDAAmD;IACnD,6FAA6F;IAC7F,OAAOA,GAAG,CAACC,OAAO,qBAAqB,qBAAqB,CAAC,CAAC;AAChE,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/server/metro/createServerComponentsMiddleware.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 { getMetroServerRoot } from '@expo/config/paths';\nimport { SerialAsset } from '@expo/metro-config/build/serializer/serializerAssets';\nimport { getRscMiddleware } from '@expo/server/build/middleware/rsc';\nimport assert from 'assert';\nimport path from 'path';\n\nimport { logMetroError } from './metroErrorInterface';\nimport { ExportAssetMap } from '../../../export/saveAssets';\nimport { stripAnsi } from '../../../utils/ansi';\nimport { memoize } from '../../../utils/fn';\nimport { streamToStringAsync } from '../../../utils/stream';\nimport { createBuiltinAPIRequestHandler } from '../middleware/createBuiltinAPIRequestHandler';\nimport {\n createBundleUrlSearchParams,\n ExpoMetroOptions,\n getMetroOptionsFromUrl,\n} from '../middleware/metroOptions';\n\nconst debug = require('debug')('expo:rsc') as typeof console.log;\n\ntype SSRLoadModuleArtifactsFunc = (\n filePath: string,\n specificOptions?: Partial<ExpoMetroOptions>\n) => Promise<{ artifacts: SerialAsset[]; src: string }>;\n\ntype SSRLoadModuleFunc = <T extends Record<string, any>>(\n filePath: string,\n specificOptions?: Partial<ExpoMetroOptions>,\n extras?: { hot?: boolean }\n) => Promise<T>;\n\nconst getMetroServerRootMemo = memoize(getMetroServerRoot);\n\nexport function createServerComponentsMiddleware(\n projectRoot: string,\n {\n rscPath,\n instanceMetroOptions,\n ssrLoadModule,\n ssrLoadModuleArtifacts,\n useClientRouter,\n }: {\n rscPath: string;\n instanceMetroOptions: Partial<ExpoMetroOptions>;\n ssrLoadModule: SSRLoadModuleFunc;\n ssrLoadModuleArtifacts: SSRLoadModuleArtifactsFunc;\n useClientRouter: boolean;\n }\n) {\n const routerModule = useClientRouter\n ? 'expo-router/build/rsc/router/noopRouter'\n : 'expo-router/build/rsc/router/expo-definedRouter';\n\n const rscMiddleware = getRscMiddleware({\n config: {},\n // Disabled in development\n baseUrl: '',\n rscPath,\n onError: console.error,\n renderRsc: async (args) => {\n // Dev server-only implementation.\n try {\n return await renderRscToReadableStream({\n ...args,\n body: args.body!,\n });\n } catch (error: any) {\n // If you get a codeFrame error during SSR like when using a Class component in React Server Components, then this\n // will throw with:\n // {\n // rawObject: {\n // type: 'TransformError',\n // lineNumber: 0,\n // errors: [ [Object] ],\n // name: 'SyntaxError',\n // message: '...',\n // }\n // }\n\n // TODO: Revisit all error handling now that we do direct metro bundling...\n await logMetroError(projectRoot, { error });\n\n const sanitizedServerMessage = stripAnsi(error.message) ?? error.message;\n throw new Response(sanitizedServerMessage, {\n status: 500,\n headers: {\n 'Content-Type': 'text/plain',\n },\n });\n }\n },\n });\n\n let rscPathPrefix = rscPath;\n if (rscPathPrefix !== '/') {\n rscPathPrefix += '/';\n }\n\n async function exportServerActionsAsync(\n { platform, entryPoints }: { platform: string; entryPoints: string[] },\n files: ExportAssetMap\n ): Promise<{\n clientBoundaries: string[];\n manifest: Record<string, [string, string]>;\n }> {\n const uniqueEntryPoints = [...new Set(entryPoints)];\n // TODO: Support multiple entry points in a single split server bundle...\n const serverRoot = getMetroServerRootMemo(projectRoot);\n\n const manifest: Record<string, [string, string]> = {};\n const nestedClientBoundaries: string[] = [];\n for (const entryPoint of uniqueEntryPoints) {\n const contents = await ssrLoadModuleArtifacts(entryPoint, {\n environment: 'react-server',\n platform,\n // Ignore the metro runtime to avoid overwriting the original in the API route.\n modulesOnly: true,\n // Required\n runModule: true,\n });\n\n const reactClientReferences = contents.artifacts\n .filter((a) => a.type === 'js')[0]\n .metadata.reactClientReferences?.map((ref) => fileURLToFilePath(ref));\n\n if (reactClientReferences) {\n nestedClientBoundaries.push(...reactClientReferences!);\n }\n\n // Naive check to ensure the module runtime is not included in the server action bundle.\n if (contents.src.includes('The experimental Metro feature')) {\n throw new Error(\n 'Internal error: module runtime should not be included in server action bundles: ' +\n entryPoint\n );\n }\n const relativeName = path.relative(serverRoot, entryPoint);\n const safeName = path.basename(contents.artifacts.find((a) => a.type === 'js')!.filename!);\n\n const outputName = `_expo/rsc/${platform}/${safeName}`;\n // While we're here, export the router for the server to dynamically render RSC.\n files.set(outputName, {\n targetDomain: 'server',\n contents: wrapBundle(contents.src),\n });\n\n // Import relative to `dist/server/_expo/rsc/web/router.js`\n manifest[entryPoint] = [relativeName, outputName];\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/${platform}/action-manifest.js`, {\n targetDomain: 'server',\n contents: 'module.exports = ' + JSON.stringify(manifest),\n });\n\n return { manifest, clientBoundaries: nestedClientBoundaries };\n }\n\n async function getExpoRouterClientReferencesAsync(\n { platform }: { platform: string },\n files: ExportAssetMap\n ): Promise<{\n reactClientReferences: string[];\n reactServerReferences: string[];\n cssModules: SerialAsset[];\n }> {\n const contents = await ssrLoadModuleArtifacts(routerModule, {\n environment: 'react-server',\n platform,\n });\n\n // Extract the global CSS modules that are imported from the router.\n // These will be injected in the head of the HTML document for the website.\n const cssModules = contents.artifacts.filter((a) => a.type.startsWith('css'));\n\n const reactServerReferences = contents.artifacts\n .filter((a) => a.type === 'js')[0]\n .metadata.reactServerReferences?.map((ref) => fileURLToFilePath(ref));\n\n if (!reactServerReferences) {\n throw new Error(\n 'Static server action references were not returned from the Metro SSR bundle for definedRouter'\n );\n }\n debug('React client boundaries:', reactServerReferences);\n\n const reactClientReferences = contents.artifacts\n .filter((a) => a.type === 'js')[0]\n .metadata.reactClientReferences?.map((ref) => fileURLToFilePath(ref));\n\n if (!reactClientReferences) {\n throw new Error(\n 'Static client references were not returned from the Metro SSR bundle for definedRouter'\n );\n }\n debug('React client boundaries:', reactClientReferences);\n\n // While we're here, export the router for the server to dynamically render RSC.\n files.set(`_expo/rsc/${platform}/router.js`, {\n targetDomain: 'server',\n contents: wrapBundle(contents.src),\n });\n\n return { reactClientReferences, reactServerReferences, cssModules };\n }\n\n async function getExpoRouterRscEntriesGetterAsync({ platform }: { platform: string }) {\n return ssrLoadModule<typeof import('expo-router/build/rsc/router/expo-definedRouter')>(\n routerModule,\n {\n environment: 'react-server',\n platform,\n },\n {\n hot: true,\n }\n );\n }\n\n function getResolveClientEntry(context: {\n platform: string;\n engine?: 'hermes' | null;\n ssrManifest?: Map<string, string>;\n }) {\n const serverRoot = getMetroServerRootMemo(projectRoot);\n\n const {\n mode,\n minify = false,\n isExporting,\n baseUrl,\n routerRoot,\n asyncRoutes,\n preserveEnvVars,\n reactCompiler,\n lazy,\n } = instanceMetroOptions;\n\n assert(\n isExporting != null &&\n baseUrl != null &&\n mode != null &&\n routerRoot != null &&\n asyncRoutes != null,\n `The server must be started. (isExporting: ${isExporting}, baseUrl: ${baseUrl}, mode: ${mode}, routerRoot: ${routerRoot}, asyncRoutes: ${asyncRoutes})`\n );\n\n return (file: string, isServer: boolean) => {\n if (isExporting) {\n assert(context.ssrManifest, 'SSR manifest must exist when exporting');\n const relativeFilePath = path.relative(serverRoot, file);\n\n assert(\n context.ssrManifest.has(relativeFilePath),\n `SSR manifest is missing client boundary \"${relativeFilePath}\"`\n );\n\n const chunk = context.ssrManifest.get(relativeFilePath);\n\n return {\n id: relativeFilePath,\n chunks: chunk != null ? [chunk] : [],\n };\n }\n\n const searchParams = createBundleUrlSearchParams({\n mainModuleName: '',\n platform: context.platform,\n mode,\n minify,\n lazy,\n preserveEnvVars,\n asyncRoutes,\n baseUrl,\n routerRoot,\n isExporting,\n reactCompiler: !!reactCompiler,\n engine: context.engine ?? undefined,\n bytecode: false,\n clientBoundaries: [],\n inlineSourceMap: false,\n environment: isServer ? 'react-server' : 'client',\n modulesOnly: true,\n runModule: false,\n });\n\n searchParams.set('resolver.clientboundary', String(true));\n\n const clientReferenceUrl = new URL('http://a');\n\n // TICKLE: Handshake 1\n searchParams.set('xRSC', '1');\n\n clientReferenceUrl.search = searchParams.toString();\n\n const filePath = file.startsWith('file://') ? fileURLToFilePath(file) : file;\n const relativeFilePath = path.relative(serverRoot, filePath);\n\n clientReferenceUrl.pathname = relativeFilePath;\n\n // Ensure url.pathname ends with '.bundle'\n if (!clientReferenceUrl.pathname.endsWith('.bundle')) {\n clientReferenceUrl.pathname += '.bundle';\n }\n\n // Return relative URLs to help Android fetch from wherever it was loaded from since it doesn't support localhost.\n const id = clientReferenceUrl.pathname + clientReferenceUrl.search;\n\n return { id: relativeFilePath, chunks: [id] };\n };\n }\n\n const rscRendererCache = new Map<string, typeof import('expo-router/build/rsc/rsc-renderer')>();\n\n async function getRscRendererAsync(platform: string) {\n // NOTE(EvanBacon): We memoize this now that there's a persistent server storage cache for Server Actions.\n if (rscRendererCache.has(platform)) {\n return rscRendererCache.get(platform)!;\n }\n\n // TODO: Extract CSS Modules / Assets from the bundler process\n const renderer = await ssrLoadModule<typeof import('expo-router/build/rsc/rsc-renderer')>(\n 'expo-router/build/rsc/rsc-renderer',\n {\n environment: 'react-server',\n platform,\n }\n );\n\n rscRendererCache.set(platform, renderer);\n return renderer;\n }\n\n const rscRenderContext = new Map<string, any>();\n\n function getRscRenderContext(platform: string) {\n // NOTE(EvanBacon): We memoize this now that there's a persistent server storage cache for Server Actions.\n if (rscRenderContext.has(platform)) {\n return rscRenderContext.get(platform)!;\n }\n\n const context = {};\n\n rscRenderContext.set(platform, context);\n return context;\n }\n\n async function renderRscToReadableStream(\n {\n input,\n searchParams,\n method,\n platform,\n body,\n engine,\n contentType,\n ssrManifest,\n decodedBody,\n }: {\n input: string;\n searchParams: URLSearchParams;\n method: 'POST' | 'GET';\n platform: string;\n body?: ReadableStream<Uint8Array>;\n engine?: 'hermes' | null;\n contentType?: string;\n ssrManifest?: Map<string, string>;\n decodedBody?: unknown;\n },\n isExporting: boolean | undefined = instanceMetroOptions.isExporting\n ) {\n assert(\n isExporting != null,\n 'The server must be started before calling renderRscToReadableStream.'\n );\n\n if (method === 'POST') {\n assert(body, 'Server request must be provided when method is POST (server actions)');\n }\n\n const { renderRsc } = await getRscRendererAsync(platform);\n\n return renderRsc(\n {\n body,\n decodedBody,\n context: getRscRenderContext(platform),\n config: {},\n input,\n contentType,\n },\n {\n isExporting,\n entries: await getExpoRouterRscEntriesGetterAsync({ platform }),\n resolveClientEntry: getResolveClientEntry({ platform, engine, ssrManifest }),\n async loadServerModuleRsc(urlFragment) {\n const serverRoot = getMetroServerRootMemo(projectRoot);\n\n debug('[SSR] loadServerModuleRsc:', urlFragment);\n\n const options = getMetroOptionsFromUrl(urlFragment);\n\n return ssrLoadModule(path.join(serverRoot, options.mainModuleName), options);\n },\n }\n );\n }\n\n return {\n // Get the static client boundaries (no dead code elimination allowed) for the production export.\n getExpoRouterClientReferencesAsync,\n exportServerActionsAsync,\n\n async exportRoutesAsync(\n {\n platform,\n ssrManifest,\n }: {\n platform: string;\n ssrManifest: Map<string, string>;\n },\n files: ExportAssetMap\n ) {\n // TODO: When we add web SSR support, we need to extract CSS Modules / Assets from the bundler process to prevent FLOUC.\n const { getBuildConfig } = (await getExpoRouterRscEntriesGetterAsync({ platform })).default;\n\n // Get all the routes to render.\n const buildConfig = await getBuildConfig!(async () =>\n // TODO: Rework prefetching code to use Metro runtime.\n []\n );\n\n await Promise.all(\n Array.from(buildConfig).map(async ({ entries }) => {\n for (const { input, isStatic } of entries || []) {\n if (!isStatic) {\n debug('Skipping static export for route', { input });\n continue;\n }\n const destRscFile = path.join('_flight', platform, encodeInput(input));\n\n const pipe = await renderRscToReadableStream(\n {\n input,\n method: 'GET',\n platform,\n searchParams: new URLSearchParams(),\n ssrManifest,\n },\n true\n );\n\n const rsc = await streamToStringAsync(pipe);\n debug('RSC Payload', { platform, input, rsc });\n\n files.set(destRscFile, {\n contents: rsc,\n targetDomain: 'client',\n rscId: input,\n });\n }\n })\n );\n },\n\n middleware: createBuiltinAPIRequestHandler(\n // Match `/_flight/[platform]/[...path]`\n (req) => {\n return getFullUrl(req.url).pathname.startsWith(rscPathPrefix);\n },\n rscMiddleware\n ),\n onReloadRscEvent: () => {\n // NOTE: We cannot clear the renderer context because it would break the mounted context state.\n\n // Clear the render context to ensure that the next render is a fresh start.\n rscRenderContext.clear();\n },\n };\n}\n\nconst getFullUrl = (url: string) => {\n try {\n return new URL(url);\n } catch {\n return new URL(url, 'http://localhost:0');\n }\n};\n\nexport const fileURLToFilePath = (fileURL: string) => {\n if (!fileURL.startsWith('file://')) {\n throw new Error('Not a file URL');\n }\n return decodeURI(fileURL.slice('file://'.length));\n};\n\nconst encodeInput = (input: string) => {\n if (input === '') {\n return 'index.txt';\n }\n if (input === 'index') {\n throw new Error('Input should not be `index`');\n }\n if (input.startsWith('/')) {\n throw new Error('Input should not start with `/`');\n }\n if (input.endsWith('/')) {\n throw new Error('Input should not end with `/`');\n }\n return input + '.txt';\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"],"names":["createServerComponentsMiddleware","fileURLToFilePath","debug","require","getMetroServerRootMemo","memoize","getMetroServerRoot","projectRoot","rscPath","instanceMetroOptions","ssrLoadModule","ssrLoadModuleArtifacts","useClientRouter","routerModule","rscMiddleware","getRscMiddleware","config","baseUrl","onError","console","error","renderRsc","args","renderRscToReadableStream","body","logMetroError","sanitizedServerMessage","stripAnsi","message","Response","status","headers","rscPathPrefix","exportServerActionsAsync","platform","entryPoints","files","uniqueEntryPoints","Set","serverRoot","manifest","nestedClientBoundaries","entryPoint","contents","environment","modulesOnly","runModule","reactClientReferences","artifacts","filter","a","type","metadata","map","ref","push","src","includes","Error","relativeName","path","relative","safeName","basename","find","filename","outputName","set","targetDomain","wrapBundle","JSON","stringify","clientBoundaries","getExpoRouterClientReferencesAsync","cssModules","startsWith","reactServerReferences","getExpoRouterRscEntriesGetterAsync","hot","getResolveClientEntry","context","mode","minify","isExporting","routerRoot","asyncRoutes","preserveEnvVars","reactCompiler","lazy","assert","file","isServer","ssrManifest","relativeFilePath","has","chunk","get","id","chunks","searchParams","createBundleUrlSearchParams","mainModuleName","engine","undefined","bytecode","inlineSourceMap","String","clientReferenceUrl","URL","search","toString","filePath","pathname","endsWith","rscRendererCache","Map","getRscRendererAsync","renderer","rscRenderContext","getRscRenderContext","input","method","contentType","decodedBody","entries","resolveClientEntry","loadServerModuleRsc","urlFragment","options","getMetroOptionsFromUrl","join","exportRoutesAsync","getBuildConfig","default","buildConfig","Promise","all","Array","from","isStatic","destRscFile","encodeInput","pipe","URLSearchParams","rsc","streamToStringAsync","rscId","middleware","createBuiltinAPIRequestHandler","req","getFullUrl","url","onReloadRscEvent","clear","fileURL","decodeURI","slice","length","str","replace"],"mappings":"AAAA;;;;;CAKC,GACD;;;;;;;;;;;IAiCgBA,gCAAgC,MAAhCA,gCAAgC;IAycnCC,iBAAiB,MAAjBA,iBAAiB;;;yBA1eK,oBAAoB;;;;;;;yBAEtB,mCAAmC;;;;;;;8DACjD,QAAQ;;;;;;;8DACV,MAAM;;;;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AChE,CAAC"}
|
|
@@ -99,10 +99,14 @@ class LogRespectingTerminal extends _metroCore().Terminal {
|
|
|
99
99
|
// Share one instance of Terminal for all instances of Metro.
|
|
100
100
|
const terminal = new LogRespectingTerminal(process.stdout);
|
|
101
101
|
async function loadMetroConfigAsync(projectRoot, options, { exp , isExporting , getMetroBundler }) {
|
|
102
|
-
var ref, ref1, ref2, ref3, ref4, ref5, ref6;
|
|
102
|
+
var ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7;
|
|
103
103
|
let reportEvent;
|
|
104
|
+
const serverActionsEnabled = ((ref = exp.experiments) == null ? void 0 : ref.reactServerActions) ?? _env.env.EXPO_UNSTABLE_SERVER_ACTIONS;
|
|
105
|
+
if (serverActionsEnabled) {
|
|
106
|
+
process.env.EXPO_UNSTABLE_SERVER_ACTIONS = "1";
|
|
107
|
+
}
|
|
104
108
|
// NOTE: Enable all the experimental Metro flags when RSC is enabled.
|
|
105
|
-
if ((
|
|
109
|
+
if (((ref1 = exp.experiments) == null ? void 0 : ref1.reactServerComponents) || serverActionsEnabled) {
|
|
106
110
|
process.env.EXPO_USE_METRO_REQUIRE = "1";
|
|
107
111
|
process.env.EXPO_USE_FAST_RESOLVER = "1";
|
|
108
112
|
}
|
|
@@ -126,18 +130,18 @@ async function loadMetroConfigAsync(projectRoot, options, { exp , isExporting ,
|
|
|
126
130
|
}
|
|
127
131
|
};
|
|
128
132
|
// @ts-expect-error: Set the global require cycle ignore patterns for SSR bundles. This won't work with custom global prefixes, but we don't use those.
|
|
129
|
-
globalThis.__requireCycleIgnorePatterns = (
|
|
133
|
+
globalThis.__requireCycleIgnorePatterns = (ref2 = config.resolver) == null ? void 0 : ref2.requireCycleIgnorePatterns;
|
|
130
134
|
if (isExporting) {
|
|
131
|
-
var
|
|
135
|
+
var ref8;
|
|
132
136
|
// This token will be used in the asset plugin to ensure the path is correct for writing locally.
|
|
133
137
|
// @ts-expect-error: typed as readonly.
|
|
134
|
-
config.transformer.publicPath = `/assets?export_path=${(((
|
|
138
|
+
config.transformer.publicPath = `/assets?export_path=${(((ref8 = exp.experiments) == null ? void 0 : ref8.baseUrl) ?? "") + "/assets"}`;
|
|
135
139
|
} else {
|
|
136
140
|
// @ts-expect-error: typed as readonly
|
|
137
141
|
config.transformer.publicPath = "/assets/?unstable_path=.";
|
|
138
142
|
}
|
|
139
143
|
const platformBundlers = (0, _platformBundlers.getPlatformBundlers)(projectRoot, exp);
|
|
140
|
-
if ((
|
|
144
|
+
if ((ref3 = exp.experiments) == null ? void 0 : ref3.reactCompiler) {
|
|
141
145
|
_log.Log.warn(`Experimental React Compiler is enabled.`);
|
|
142
146
|
}
|
|
143
147
|
if (_env.env.EXPO_UNSTABLE_TREE_SHAKING && !_env.env.EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH) {
|
|
@@ -149,16 +153,23 @@ async function loadMetroConfigAsync(projectRoot, options, { exp , isExporting ,
|
|
|
149
153
|
if (_env.env.EXPO_UNSTABLE_TREE_SHAKING) {
|
|
150
154
|
_log.Log.warn(`Experimental tree shaking is enabled.`);
|
|
151
155
|
}
|
|
156
|
+
if (serverActionsEnabled) {
|
|
157
|
+
var ref9;
|
|
158
|
+
_log.Log.warn(`Experimental React Server Actions are enabled. Production exports are not supported yet.`);
|
|
159
|
+
if (!((ref9 = exp.experiments) == null ? void 0 : ref9.reactServerComponents)) {
|
|
160
|
+
_log.Log.warn(`- React Server Components are NOT enabled. Routes will render in client-only mode.`);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
152
163
|
config = await (0, _withMetroMultiPlatform.withMetroMultiPlatformAsync)(projectRoot, {
|
|
153
164
|
config,
|
|
154
165
|
exp,
|
|
155
166
|
platformBundlers,
|
|
156
|
-
isTsconfigPathsEnabled: ((
|
|
167
|
+
isTsconfigPathsEnabled: ((ref4 = exp.experiments) == null ? void 0 : ref4.tsconfigPaths) ?? true,
|
|
157
168
|
isFastResolverEnabled: _env.env.EXPO_USE_FAST_RESOLVER,
|
|
158
169
|
isExporting,
|
|
159
|
-
isReactCanaryEnabled: (((
|
|
170
|
+
isReactCanaryEnabled: (((ref5 = exp.experiments) == null ? void 0 : ref5.reactServerComponents) || serverActionsEnabled || ((ref6 = exp.experiments) == null ? void 0 : ref6.reactCanary)) ?? false,
|
|
160
171
|
isNamedRequiresEnabled: _env.env.EXPO_USE_METRO_REQUIRE,
|
|
161
|
-
isReactServerComponentsEnabled: !!((
|
|
172
|
+
isReactServerComponentsEnabled: !!((ref7 = exp.experiments) == null ? void 0 : ref7.reactServerComponents),
|
|
162
173
|
getMetroBundler
|
|
163
174
|
});
|
|
164
175
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/server/metro/instantiateMetro.ts"],"sourcesContent":["import { ExpoConfig, getConfig } from '@expo/config';\nimport { getMetroServerRoot } from '@expo/config/paths';\nimport { getDefaultConfig, LoadOptions } from '@expo/metro-config';\nimport chalk from 'chalk';\nimport http from 'http';\nimport type Metro from 'metro';\nimport Bundler from 'metro/src/Bundler';\nimport type { TransformOptions } from 'metro/src/DeltaBundler/Worker';\nimport MetroHmrServer from 'metro/src/HmrServer';\nimport { loadConfig, resolveConfig, ConfigT } from 'metro-config';\nimport { Terminal } from 'metro-core';\nimport util from 'node:util';\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// 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// 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);\n\n const sendLog = (...args: any[]) => {\n this._logLines.push(\n // format args like console.log\n util.format(...args)\n );\n this._scheduleUpdate();\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\nexport async function loadMetroConfigAsync(\n projectRoot: string,\n options: LoadOptions,\n {\n exp,\n isExporting,\n getMetroBundler,\n }: { exp: ExpoConfig; isExporting: boolean; getMetroBundler: () => Bundler }\n) {\n let reportEvent: ((event: any) => void) | undefined;\n\n // NOTE: Enable all the experimental Metro flags when RSC is enabled.\n if (exp.experiments?.reactServerComponents) {\n process.env.EXPO_USE_METRO_REQUIRE = '1';\n process.env.EXPO_USE_FAST_RESOLVER = '1';\n }\n\n const serverRoot = getMetroServerRoot(projectRoot);\n const terminalReporter = new MetroTerminalReporter(serverRoot, terminal);\n\n const hasConfig = await resolveConfig(options.config, projectRoot);\n let config: ConfigT = {\n ...(await loadConfig(\n { cwd: projectRoot, projectRoot, ...options },\n // If the project does not have a metro.config.js, then we use the default config.\n hasConfig.isEmpty ? getDefaultConfig(projectRoot) : undefined\n )),\n reporter: {\n update(event: any) {\n terminalReporter.update(event);\n if (reportEvent) {\n reportEvent(event);\n }\n },\n },\n };\n\n // @ts-expect-error: Set the global require cycle ignore patterns for SSR bundles. This won't work with custom global prefixes, but we don't use those.\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 // @ts-expect-error: typed as readonly.\n config.transformer.publicPath = `/assets?export_path=${\n (exp.experiments?.baseUrl ?? '') + '/assets'\n }`;\n } else {\n // @ts-expect-error: typed as readonly\n config.transformer.publicPath = '/assets/?unstable_path=.';\n }\n\n const platformBundlers = getPlatformBundlers(projectRoot, exp);\n\n if (exp.experiments?.reactCompiler) {\n Log.warn(`Experimental React Compiler is 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\n config = await withMetroMultiPlatformAsync(projectRoot, {\n config,\n exp,\n platformBundlers,\n isTsconfigPathsEnabled: exp.experiments?.tsconfigPaths ?? true,\n isFastResolverEnabled: env.EXPO_USE_FAST_RESOLVER,\n isExporting,\n isReactCanaryEnabled:\n (exp.experiments?.reactServerComponents || exp.experiments?.reactCanary) ?? false,\n isNamedRequiresEnabled: env.EXPO_USE_METRO_REQUIRE,\n isReactServerComponentsEnabled: !!exp.experiments?.reactServerComponents,\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: Omit<LoadOptions, 'logger'>,\n {\n isExporting,\n exp = getConfig(metroBundler.projectRoot, {\n skipSDKVersionRequirement: true,\n }).exp,\n }: { isExporting: boolean; exp?: ExpoConfig }\n): Promise<{\n metro: Metro.Server;\n hmrServer: MetroHmrServer | null;\n server: http.Server;\n middleware: any;\n messageSocket: MessageSocket;\n}> {\n const projectRoot = metroBundler.projectRoot;\n\n const { config: metroConfig, setEventReporter } = await loadMetroConfigAsync(\n projectRoot,\n options,\n {\n exp,\n isExporting,\n getMetroBundler() {\n return metro.getBundler().getBundler();\n },\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 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(metroBundler);\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 // @ts-expect-error: can't mutate readonly config\n metroConfig.server.enhanceMiddleware = (metroMiddleware: any, server: Metro.Server) => {\n if (customEnhanceMiddleware) {\n metroMiddleware = customEnhanceMiddleware(metroMiddleware, server);\n }\n return middleware.use(metroMiddleware);\n };\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 ...websocketEndpoints,\n ...createDevToolsPluginWebsocketEndpoint(),\n },\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 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 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 filePath: string,\n transformOptions: TransformOptions\n): TransformOptions {\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 if (\n transformOptions.customTransformOptions?.routerRoot &&\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 !(filePath.match(/\\/expo-router\\/_ctx/) || filePath.match(/\\/expo-router\\/build\\//))\n ) {\n // Set to the default value.\n transformOptions.customTransformOptions.routerRoot = 'app';\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-router/virtual-client-boundaries.js` for production RSC exports.\n !filePath.match(/\\/expo-router\\/virtual-client-boundaries\\.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":["loadMetroConfigAsync","instantiateMetroAsync","isWatchEnabled","LogRespectingTerminal","Terminal","constructor","stream","sendLog","args","_logLines","push","util","format","_scheduleUpdate","flush","console","log","info","terminal","process","stdout","projectRoot","options","exp","isExporting","getMetroBundler","config","reportEvent","experiments","reactServerComponents","env","EXPO_USE_METRO_REQUIRE","EXPO_USE_FAST_RESOLVER","serverRoot","getMetroServerRoot","terminalReporter","MetroTerminalReporter","hasConfig","resolveConfig","loadConfig","cwd","isEmpty","getDefaultConfig","undefined","reporter","update","event","globalThis","__requireCycleIgnorePatterns","resolver","requireCycleIgnorePatterns","transformer","publicPath","baseUrl","platformBundlers","getPlatformBundlers","reactCompiler","Log","warn","EXPO_UNSTABLE_TREE_SHAKING","EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH","CommandError","withMetroMultiPlatformAsync","isTsconfigPathsEnabled","tsconfigPaths","isFastResolverEnabled","isReactCanaryEnabled","reactCanary","isNamedRequiresEnabled","isReactServerComponentsEnabled","setEventReporter","logger","metroBundler","getConfig","skipSDKVersionRequirement","metroConfig","metro","getBundler","middleware","messagesSocket","eventsSocket","websocketEndpoints","createMetroMiddleware","prependMiddleware","createCorsMiddleware","debugMiddleware","debugWebsocketEndpoints","createDebugMiddleware","Object","assign","use","createJsInspectorMiddleware","customEnhanceMiddleware","server","enhanceMiddleware","metroMiddleware","attachAtlasAsync","resetAtlasFile","hmrServer","runServer","createDevToolsPluginWebsocketEndpoint","watch","mockServer","originalTransformFile","transformFile","bind","filePath","transformOptions","fileBuffer","pruneCustomTransformOptions","customTransformOptions","__proto__","reportMetroEvent","messageSocket","dom","match","routerRoot","asyncRoutes","clientBoundaries","CI","chalk"],"mappings":"AAAA;;;;;;;;;;;IA0DsBA,oBAAoB,MAApBA,oBAAoB;IA4FpBC,qBAAqB,MAArBA,qBAAqB;IAwK3BC,cAAc,MAAdA,cAAc;;;yBA9TQ,cAAc;;;;;;;yBACjB,oBAAoB;;;;;;;yBACT,oBAAoB;;;;;;;8DAChD,OAAO;;;;;;;yBAM0B,cAAc;;;;;;;yBACxC,YAAY;;;;;;;8DACpB,WAAW;;;;;;iDAE0B,mCAAmC;uCAEnD,yBAAyB;6BAC9B,yBAAyB;uCACpB,mCAAmC;uCACnC,oCAAoC;+BAChD,kBAAkB;wCACA,0BAA0B;qBAClD,cAAc;qBACd,oBAAoB;wBACX,uBAAuB;gCACf,8BAA8B;6CACvB,qDAAqD;2BAC/D,yBAAyB;kCACvB,qBAAqB;;;;;;AAOzD,uGAAuG;AACvG,MAAMC,qBAAqB,SAASC,UAAQ,EAAA,SAAA;IAC1CC,YAAYC,MAAkE,CAAE;QAC9E,KAAK,CAACA,MAAM,CAAC,CAAC;QAEd,MAAMC,OAAO,GAAG,CAAC,GAAGC,IAAI,AAAO,GAAK;YAClC,IAAI,CAACC,SAAS,CAACC,IAAI,CACjB,+BAA+B;YAC/BC,SAAI,EAAA,QAAA,CAACC,MAAM,IAAIJ,IAAI,CAAC,CACrB,CAAC;YACF,IAAI,CAACK,eAAe,EAAE,CAAC;YAEvB,6FAA6F;YAC7F,IAAI,CAACC,KAAK,EAAE,CAAC;QACf,CAAC,AAAC;QAEFC,OAAO,CAACC,GAAG,GAAGT,OAAO,CAAC;QACtBQ,OAAO,CAACE,IAAI,GAAGV,OAAO,CAAC;IACzB;CACD;AAED,6DAA6D;AAC7D,MAAMW,QAAQ,GAAG,IAAIf,qBAAqB,CAACgB,OAAO,CAACC,MAAM,CAAC,AAAC;AAEpD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IAC7D,CAAC;IAED,IACEV,CAAAA,CAAAA,IAAuC,GAAvCA,gBAAgB,CAACG,sBAAsB,SAAkB,GAAzDH,KAAAA,CAAyD,GAAzDA,IAAuC,CAAEW,gBAAgB,CAAA,IACzD,gHAAgH;IAChH,CAACZ,QAAQ,CAACS,KAAK,iDAAiD,EAChE;QACA,OAAOR,gBAAgB,CAACG,sBAAsB,CAACQ,gBAAgB,CAAC;IAClE,CAAC;IAED,OAAOX,gBAAgB,CAAC;AAC1B,CAAC;AAMM,SAASzG,cAAc,GAAG;IAC/B,IAAI4B,IAAG,IAAA,CAACyF,EAAE,EAAE;QACV9D,IAAG,IAAA,CAACzC,GAAG,CACLwG,IAAAA,MAAK,EAAA,QAAA,CAAA,CAAC,8FAA8F,CAAC,CACtG,CAAC;IACJ,CAAC;IAED,OAAO,CAAC1F,IAAG,IAAA,CAACyF,EAAE,CAAC;AACjB,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/server/metro/instantiateMetro.ts"],"sourcesContent":["import { ExpoConfig, getConfig } from '@expo/config';\nimport { getMetroServerRoot } from '@expo/config/paths';\nimport { getDefaultConfig, LoadOptions } from '@expo/metro-config';\nimport chalk from 'chalk';\nimport http from 'http';\nimport type Metro from 'metro';\nimport Bundler from 'metro/src/Bundler';\nimport type { TransformOptions } from 'metro/src/DeltaBundler/Worker';\nimport MetroHmrServer from 'metro/src/HmrServer';\nimport { loadConfig, resolveConfig, ConfigT } from 'metro-config';\nimport { Terminal } from 'metro-core';\nimport util from 'node:util';\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// 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// 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);\n\n const sendLog = (...args: any[]) => {\n this._logLines.push(\n // format args like console.log\n util.format(...args)\n );\n this._scheduleUpdate();\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\nexport async function loadMetroConfigAsync(\n projectRoot: string,\n options: LoadOptions,\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 serverActionsEnabled =\n exp.experiments?.reactServerActions ?? env.EXPO_UNSTABLE_SERVER_ACTIONS;\n\n if (serverActionsEnabled) {\n process.env.EXPO_UNSTABLE_SERVER_ACTIONS = '1';\n }\n\n // NOTE: Enable all the experimental Metro flags when RSC is enabled.\n if (exp.experiments?.reactServerComponents || serverActionsEnabled) {\n process.env.EXPO_USE_METRO_REQUIRE = '1';\n process.env.EXPO_USE_FAST_RESOLVER = '1';\n }\n\n const serverRoot = getMetroServerRoot(projectRoot);\n const terminalReporter = new MetroTerminalReporter(serverRoot, terminal);\n\n const hasConfig = await resolveConfig(options.config, projectRoot);\n let config: ConfigT = {\n ...(await loadConfig(\n { cwd: projectRoot, projectRoot, ...options },\n // If the project does not have a metro.config.js, then we use the default config.\n hasConfig.isEmpty ? getDefaultConfig(projectRoot) : undefined\n )),\n reporter: {\n update(event: any) {\n terminalReporter.update(event);\n if (reportEvent) {\n reportEvent(event);\n }\n },\n },\n };\n\n // @ts-expect-error: Set the global require cycle ignore patterns for SSR bundles. This won't work with custom global prefixes, but we don't use those.\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 // @ts-expect-error: typed as readonly.\n config.transformer.publicPath = `/assets?export_path=${\n (exp.experiments?.baseUrl ?? '') + '/assets'\n }`;\n } else {\n // @ts-expect-error: typed as readonly\n config.transformer.publicPath = '/assets/?unstable_path=.';\n }\n\n const platformBundlers = getPlatformBundlers(projectRoot, exp);\n\n if (exp.experiments?.reactCompiler) {\n Log.warn(`Experimental React Compiler is 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\n if (serverActionsEnabled) {\n Log.warn(\n `Experimental React Server Actions are enabled. Production exports are not supported yet.`\n );\n if (!exp.experiments?.reactServerComponents) {\n Log.warn(\n `- React Server Components are NOT enabled. Routes will render in client-only mode.`\n );\n }\n }\n\n config = await withMetroMultiPlatformAsync(projectRoot, {\n config,\n exp,\n platformBundlers,\n isTsconfigPathsEnabled: exp.experiments?.tsconfigPaths ?? true,\n isFastResolverEnabled: env.EXPO_USE_FAST_RESOLVER,\n isExporting,\n isReactCanaryEnabled:\n (exp.experiments?.reactServerComponents ||\n serverActionsEnabled ||\n exp.experiments?.reactCanary) ??\n false,\n isNamedRequiresEnabled: env.EXPO_USE_METRO_REQUIRE,\n isReactServerComponentsEnabled: !!exp.experiments?.reactServerComponents,\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: Omit<LoadOptions, 'logger'>,\n {\n isExporting,\n exp = getConfig(metroBundler.projectRoot, {\n skipSDKVersionRequirement: true,\n }).exp,\n }: { isExporting: boolean; exp?: ExpoConfig }\n): Promise<{\n metro: Metro.Server;\n hmrServer: MetroHmrServer | null;\n server: http.Server;\n middleware: any;\n messageSocket: MessageSocket;\n}> {\n const projectRoot = metroBundler.projectRoot;\n\n const { config: metroConfig, setEventReporter } = await loadMetroConfigAsync(\n projectRoot,\n options,\n {\n exp,\n isExporting,\n getMetroBundler() {\n return metro.getBundler().getBundler();\n },\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 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(metroBundler);\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 // @ts-expect-error: can't mutate readonly config\n metroConfig.server.enhanceMiddleware = (metroMiddleware: any, server: Metro.Server) => {\n if (customEnhanceMiddleware) {\n metroMiddleware = customEnhanceMiddleware(metroMiddleware, server);\n }\n return middleware.use(metroMiddleware);\n };\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 ...websocketEndpoints,\n ...createDevToolsPluginWebsocketEndpoint(),\n },\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 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 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 filePath: string,\n transformOptions: TransformOptions\n): TransformOptions {\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 if (\n transformOptions.customTransformOptions?.routerRoot &&\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 !(filePath.match(/\\/expo-router\\/_ctx/) || filePath.match(/\\/expo-router\\/build\\//))\n ) {\n // Set to the default value.\n transformOptions.customTransformOptions.routerRoot = 'app';\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-router/virtual-client-boundaries.js` for production RSC exports.\n !filePath.match(/\\/expo-router\\/virtual-client-boundaries\\.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":["loadMetroConfigAsync","instantiateMetroAsync","isWatchEnabled","LogRespectingTerminal","Terminal","constructor","stream","sendLog","args","_logLines","push","util","format","_scheduleUpdate","flush","console","log","info","terminal","process","stdout","projectRoot","options","exp","isExporting","getMetroBundler","config","reportEvent","serverActionsEnabled","experiments","reactServerActions","env","EXPO_UNSTABLE_SERVER_ACTIONS","reactServerComponents","EXPO_USE_METRO_REQUIRE","EXPO_USE_FAST_RESOLVER","serverRoot","getMetroServerRoot","terminalReporter","MetroTerminalReporter","hasConfig","resolveConfig","loadConfig","cwd","isEmpty","getDefaultConfig","undefined","reporter","update","event","globalThis","__requireCycleIgnorePatterns","resolver","requireCycleIgnorePatterns","transformer","publicPath","baseUrl","platformBundlers","getPlatformBundlers","reactCompiler","Log","warn","EXPO_UNSTABLE_TREE_SHAKING","EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH","CommandError","withMetroMultiPlatformAsync","isTsconfigPathsEnabled","tsconfigPaths","isFastResolverEnabled","isReactCanaryEnabled","reactCanary","isNamedRequiresEnabled","isReactServerComponentsEnabled","setEventReporter","logger","metroBundler","getConfig","skipSDKVersionRequirement","metroConfig","metro","getBundler","middleware","messagesSocket","eventsSocket","websocketEndpoints","createMetroMiddleware","prependMiddleware","createCorsMiddleware","debugMiddleware","debugWebsocketEndpoints","createDebugMiddleware","Object","assign","use","createJsInspectorMiddleware","customEnhanceMiddleware","server","enhanceMiddleware","metroMiddleware","attachAtlasAsync","resetAtlasFile","hmrServer","runServer","createDevToolsPluginWebsocketEndpoint","watch","mockServer","originalTransformFile","transformFile","bind","filePath","transformOptions","fileBuffer","pruneCustomTransformOptions","customTransformOptions","__proto__","reportMetroEvent","messageSocket","dom","match","routerRoot","asyncRoutes","clientBoundaries","CI","chalk"],"mappings":"AAAA;;;;;;;;;;;IA0DsBA,oBAAoB,MAApBA,oBAAoB;IAiHpBC,qBAAqB,MAArBA,qBAAqB;IAwK3BC,cAAc,MAAdA,cAAc;;;yBAnVQ,cAAc;;;;;;;yBACjB,oBAAoB;;;;;;;yBACT,oBAAoB;;;;;;;8DAChD,OAAO;;;;;;;yBAM0B,cAAc;;;;;;;yBACxC,YAAY;;;;;;;8DACpB,WAAW;;;;;;iDAE0B,mCAAmC;uCAEnD,yBAAyB;6BAC9B,yBAAyB;uCACpB,mCAAmC;uCACnC,oCAAoC;+BAChD,kBAAkB;wCACA,0BAA0B;qBAClD,cAAc;qBACd,oBAAoB;wBACX,uBAAuB;gCACf,8BAA8B;6CACvB,qDAAqD;2BAC/D,yBAAyB;kCACvB,qBAAqB;;;;;;AAOzD,uGAAuG;AACvG,MAAMC,qBAAqB,SAASC,UAAQ,EAAA,SAAA;IAC1CC,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ACEV,CAAAA,CAAAA,IAAuC,GAAvCA,gBAAgB,CAACG,sBAAsB,SAAkB,GAAzDH,KAAAA,CAAyD,GAAzDA,IAAuC,CAAEW,gBAAgB,CAAA,IACzD,gHAAgH;IAChH,CAACZ,QAAQ,CAACS,KAAK,iDAAiD,EAChE;QACA,OAAOR,gBAAgB,CAACG,sBAAsB,CAACQ,gBAAgB,CAAC;IAClE,CAAC;IAED,OAAOX,gBAAgB,CAAC;AAC1B,CAAC;AAMM,SAAS5G,cAAc,GAAG;IAC/B,IAAI6B,IAAG,IAAA,CAAC2F,EAAE,EAAE;QACV9D,IAAG,IAAA,CAAC5C,GAAG,CACL2G,IAAAA,MAAK,EAAA,QAAA,CAAA,CAAC,8FAA8F,CAAC,CACtG,CAAC;IACJ,CAAC;IAED,OAAO,CAAC5F,IAAG,IAAA,CAAC2F,EAAE,CAAC;AACjB,CAAC"}
|
package/build/src/utils/env.js
CHANGED
|
@@ -166,6 +166,9 @@ class Env {
|
|
|
166
166
|
/** Enable hydration during development when rendering Expo Web */ get EXPO_WEB_DEV_HYDRATE() {
|
|
167
167
|
return (0, _getenv().boolish)("EXPO_WEB_DEV_HYDRATE", false);
|
|
168
168
|
}
|
|
169
|
+
/** Enable experimental React Server Actions support. */ get EXPO_UNSTABLE_SERVER_ACTIONS() {
|
|
170
|
+
return (0, _getenv().boolish)("EXPO_UNSTABLE_SERVER_ACTIONS", false);
|
|
171
|
+
}
|
|
169
172
|
}
|
|
170
173
|
const env = new Env();
|
|
171
174
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/env.ts"],"sourcesContent":["import { boolish, int, string } from 'getenv';\n\n// @expo/webpack-config -> expo-pwa -> @expo/image-utils: EXPO_IMAGE_UTILS_NO_SHARP\n\n// TODO: EXPO_CLI_USERNAME, EXPO_CLI_PASSWORD\n\nclass Env {\n /** Enable profiling metrics */\n get EXPO_PROFILE() {\n return boolish('EXPO_PROFILE', false);\n }\n\n /** Enable debug logging */\n get EXPO_DEBUG() {\n return boolish('EXPO_DEBUG', false);\n }\n\n /** Disable all network requests */\n get EXPO_OFFLINE() {\n return boolish('EXPO_OFFLINE', false);\n }\n\n /** Enable the beta version of Expo (TODO: Should this just be in the beta version of expo releases?) */\n get EXPO_BETA() {\n return boolish('EXPO_BETA', false);\n }\n\n /** Enable staging API environment */\n get EXPO_STAGING() {\n return boolish('EXPO_STAGING', false);\n }\n\n /** Enable local API environment */\n get EXPO_LOCAL() {\n return boolish('EXPO_LOCAL', false);\n }\n\n /** Is running in non-interactive CI mode */\n get CI() {\n return boolish('CI', false);\n }\n\n /** Disable telemetry (analytics) */\n get EXPO_NO_TELEMETRY() {\n return boolish('EXPO_NO_TELEMETRY', false);\n }\n\n /** Disable detaching telemetry to separate process */\n get EXPO_NO_TELEMETRY_DETACH() {\n return boolish('EXPO_NO_TELEMETRY_DETACH', false);\n }\n\n /** local directory to the universe repo for testing locally */\n get EXPO_UNIVERSE_DIR() {\n return string('EXPO_UNIVERSE_DIR', '');\n }\n\n /** @deprecated Default Webpack host string */\n get WEB_HOST() {\n return string('WEB_HOST', '0.0.0.0');\n }\n\n /** Skip warning users about a dirty git status */\n get EXPO_NO_GIT_STATUS() {\n return boolish('EXPO_NO_GIT_STATUS', false);\n }\n /** Disable auto web setup */\n get EXPO_NO_WEB_SETUP() {\n return boolish('EXPO_NO_WEB_SETUP', false);\n }\n /** Disable auto TypeScript setup */\n get EXPO_NO_TYPESCRIPT_SETUP() {\n return boolish('EXPO_NO_TYPESCRIPT_SETUP', false);\n }\n /** Disable all API caches. Does not disable bundler caches. */\n get EXPO_NO_CACHE() {\n return boolish('EXPO_NO_CACHE', false);\n }\n /** Disable the app select redirect page. */\n get EXPO_NO_REDIRECT_PAGE() {\n return boolish('EXPO_NO_REDIRECT_PAGE', false);\n }\n /** The React Metro port that's baked into react-native scripts and tools. */\n get RCT_METRO_PORT() {\n return int('RCT_METRO_PORT', 0);\n }\n /** Skip validating the manifest during `export`. */\n get EXPO_SKIP_MANIFEST_VALIDATION_TOKEN(): boolean {\n return !!string('EXPO_SKIP_MANIFEST_VALIDATION_TOKEN', '');\n }\n\n /** Public folder path relative to the project root. Default to `public` */\n get EXPO_PUBLIC_FOLDER(): string {\n return string('EXPO_PUBLIC_FOLDER', 'public');\n }\n\n /** Higher priority `$EDIOTR` variable for indicating which editor to use when pressing `o` in the Terminal UI. */\n get EXPO_EDITOR(): string {\n return string('EXPO_EDITOR', '');\n }\n\n /**\n * Overwrite the dev server URL, disregarding the `--port`, `--host`, `--tunnel`, `--lan`, `--localhost` arguments.\n * This is useful for browser editors that require custom proxy URLs.\n */\n get EXPO_PACKAGER_PROXY_URL(): string {\n return string('EXPO_PACKAGER_PROXY_URL', '');\n }\n\n /**\n * **Experimental** - Disable using `exp.direct` as the hostname for\n * `--tunnel` connections. This enables **https://** forwarding which\n * can be used to test universal links on iOS.\n *\n * This may cause issues with `expo-linking` and Expo Go.\n *\n * Select the exact subdomain by passing a string value that is not one of: `true`, `false`, `1`, `0`.\n */\n get EXPO_TUNNEL_SUBDOMAIN(): string | boolean {\n const subdomain = string('EXPO_TUNNEL_SUBDOMAIN', '');\n if (['0', 'false', ''].includes(subdomain)) {\n return false;\n } else if (['1', 'true'].includes(subdomain)) {\n return true;\n }\n return subdomain;\n }\n\n /**\n * Force Expo CLI to use the [`resolver.resolverMainFields`](https://facebook.github.io/metro/docs/configuration/#resolvermainfields) from the project `metro.config.js` for all platforms.\n *\n * By default, Expo CLI will use `['browser', 'module', 'main']` (default for Webpack) for web and the user-defined main fields for other platforms.\n */\n get EXPO_METRO_NO_MAIN_FIELD_OVERRIDE(): boolean {\n return boolish('EXPO_METRO_NO_MAIN_FIELD_OVERRIDE', false);\n }\n\n /**\n * HTTP/HTTPS proxy to connect to for network requests. Configures [https-proxy-agent](https://www.npmjs.com/package/https-proxy-agent).\n */\n get HTTP_PROXY(): string {\n return process.env.HTTP_PROXY || process.env.http_proxy || '';\n }\n\n /**\n * Use the network inspector by overriding the metro inspector proxy with a custom version.\n * @deprecated This has been replaced by `@react-native/dev-middleware` and is now unused.\n */\n get EXPO_NO_INSPECTOR_PROXY(): boolean {\n return boolish('EXPO_NO_INSPECTOR_PROXY', false);\n }\n\n /** Disable lazy bundling in Metro bundler. */\n get EXPO_NO_METRO_LAZY() {\n return boolish('EXPO_NO_METRO_LAZY', false);\n }\n\n /** Enable the unstable inverse dependency stack trace for Metro bundling errors. */\n get EXPO_METRO_UNSTABLE_ERRORS() {\n return boolish('EXPO_METRO_UNSTABLE_ERRORS', false);\n }\n\n /** Enable the unstable fast resolver for Metro. */\n get EXPO_USE_FAST_RESOLVER() {\n return boolish('EXPO_USE_FAST_RESOLVER', false);\n }\n\n /** Disable Environment Variable injection in client bundles. */\n get EXPO_NO_CLIENT_ENV_VARS(): boolean {\n return boolish('EXPO_NO_CLIENT_ENV_VARS', false);\n }\n\n /** Set the default `user` that should be passed to `--user` with ADB commands. Used for installing APKs on Android devices with multiple profiles. Defaults to `0`. */\n get EXPO_ADB_USER(): string {\n return string('EXPO_ADB_USER', '0');\n }\n\n /** Used internally to enable E2E utilities. This behavior is not stable to external users. */\n get __EXPO_E2E_TEST(): boolean {\n return boolish('__EXPO_E2E_TEST', false);\n }\n\n /** Unstable: Force single-bundle exports in production. */\n get EXPO_NO_BUNDLE_SPLITTING(): boolean {\n return boolish('EXPO_NO_BUNDLE_SPLITTING', false);\n }\n\n /** Enable unstable/experimental Atlas to gather bundle information during development or export */\n get EXPO_UNSTABLE_ATLAS() {\n return boolish('EXPO_UNSTABLE_ATLAS', false);\n }\n\n /** Unstable: Enable tree shaking for Metro. */\n get EXPO_UNSTABLE_TREE_SHAKING() {\n return boolish('EXPO_UNSTABLE_TREE_SHAKING', false);\n }\n\n /** Unstable: Enable eager bundling where transformation runs uncached after the entire bundle has been created. This is required for production tree shaking and less optimized for development bundling. */\n get EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH() {\n return boolish('EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH', false);\n }\n\n /** Enable the use of Expo's custom metro require implementation. The custom require supports better debugging, tree shaking, and React Server Components. */\n get EXPO_USE_METRO_REQUIRE() {\n return boolish('EXPO_USE_METRO_REQUIRE', false);\n }\n\n /** Internal key used to pass eager bundle data from the CLI to the native run scripts during `npx expo run` commands. */\n get __EXPO_EAGER_BUNDLE_OPTIONS() {\n return string('__EXPO_EAGER_BUNDLE_OPTIONS', '');\n }\n\n /** Disable server deployment during production builds (during `expo export:embed`). This is useful for testing API routes and server components against a local server. */\n get EXPO_NO_DEPLOY(): boolean {\n return boolish('EXPO_NO_DEPLOY', false);\n }\n\n /** Enable hydration during development when rendering Expo Web */\n get EXPO_WEB_DEV_HYDRATE(): boolean {\n return boolish('EXPO_WEB_DEV_HYDRATE', false);\n }\n}\n\nexport const env = new Env();\n"],"names":["env","Env","EXPO_PROFILE","boolish","EXPO_DEBUG","EXPO_OFFLINE","EXPO_BETA","EXPO_STAGING","EXPO_LOCAL","CI","EXPO_NO_TELEMETRY","EXPO_NO_TELEMETRY_DETACH","EXPO_UNIVERSE_DIR","string","WEB_HOST","EXPO_NO_GIT_STATUS","EXPO_NO_WEB_SETUP","EXPO_NO_TYPESCRIPT_SETUP","EXPO_NO_CACHE","EXPO_NO_REDIRECT_PAGE","RCT_METRO_PORT","int","EXPO_SKIP_MANIFEST_VALIDATION_TOKEN","EXPO_PUBLIC_FOLDER","EXPO_EDITOR","EXPO_PACKAGER_PROXY_URL","EXPO_TUNNEL_SUBDOMAIN","subdomain","includes","EXPO_METRO_NO_MAIN_FIELD_OVERRIDE","HTTP_PROXY","process","http_proxy","EXPO_NO_INSPECTOR_PROXY","EXPO_NO_METRO_LAZY","EXPO_METRO_UNSTABLE_ERRORS","EXPO_USE_FAST_RESOLVER","EXPO_NO_CLIENT_ENV_VARS","EXPO_ADB_USER","__EXPO_E2E_TEST","EXPO_NO_BUNDLE_SPLITTING","EXPO_UNSTABLE_ATLAS","EXPO_UNSTABLE_TREE_SHAKING","EX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OAAM,EAAA,OAAA,EAAC,6BAA6B,EAAE,EAAE,CAAC,CAAC;IACnD;IAEA,yKAAyK,OACrKiC,cAAc,GAAY;QAC5B,OAAO3C,IAAAA,OAAO,EAAA,QAAA,EAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC;IAC1C;IAEA,gEAAgE,OAC5D4C,oBAAoB,GAAY;QAClC,OAAO5C,IAAAA,OAAO,EAAA,QAAA,EAAC,sBAAsB,EAAE,KAAK,CAAC,CAAC;IAChD;CACD;AAEM,MAAMH,GAAG,GAAG,IAAIC,GAAG,EAAE,AAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/env.ts"],"sourcesContent":["import { boolish, int, string } from 'getenv';\n\n// @expo/webpack-config -> expo-pwa -> @expo/image-utils: EXPO_IMAGE_UTILS_NO_SHARP\n\n// TODO: EXPO_CLI_USERNAME, EXPO_CLI_PASSWORD\n\nclass Env {\n /** Enable profiling metrics */\n get EXPO_PROFILE() {\n return boolish('EXPO_PROFILE', false);\n }\n\n /** Enable debug logging */\n get EXPO_DEBUG() {\n return boolish('EXPO_DEBUG', false);\n }\n\n /** Disable all network requests */\n get EXPO_OFFLINE() {\n return boolish('EXPO_OFFLINE', false);\n }\n\n /** Enable the beta version of Expo (TODO: Should this just be in the beta version of expo releases?) */\n get EXPO_BETA() {\n return boolish('EXPO_BETA', false);\n }\n\n /** Enable staging API environment */\n get EXPO_STAGING() {\n return boolish('EXPO_STAGING', false);\n }\n\n /** Enable local API environment */\n get EXPO_LOCAL() {\n return boolish('EXPO_LOCAL', false);\n }\n\n /** Is running in non-interactive CI mode */\n get CI() {\n return boolish('CI', false);\n }\n\n /** Disable telemetry (analytics) */\n get EXPO_NO_TELEMETRY() {\n return boolish('EXPO_NO_TELEMETRY', false);\n }\n\n /** Disable detaching telemetry to separate process */\n get EXPO_NO_TELEMETRY_DETACH() {\n return boolish('EXPO_NO_TELEMETRY_DETACH', false);\n }\n\n /** local directory to the universe repo for testing locally */\n get EXPO_UNIVERSE_DIR() {\n return string('EXPO_UNIVERSE_DIR', '');\n }\n\n /** @deprecated Default Webpack host string */\n get WEB_HOST() {\n return string('WEB_HOST', '0.0.0.0');\n }\n\n /** Skip warning users about a dirty git status */\n get EXPO_NO_GIT_STATUS() {\n return boolish('EXPO_NO_GIT_STATUS', false);\n }\n /** Disable auto web setup */\n get EXPO_NO_WEB_SETUP() {\n return boolish('EXPO_NO_WEB_SETUP', false);\n }\n /** Disable auto TypeScript setup */\n get EXPO_NO_TYPESCRIPT_SETUP() {\n return boolish('EXPO_NO_TYPESCRIPT_SETUP', false);\n }\n /** Disable all API caches. Does not disable bundler caches. */\n get EXPO_NO_CACHE() {\n return boolish('EXPO_NO_CACHE', false);\n }\n /** Disable the app select redirect page. */\n get EXPO_NO_REDIRECT_PAGE() {\n return boolish('EXPO_NO_REDIRECT_PAGE', false);\n }\n /** The React Metro port that's baked into react-native scripts and tools. */\n get RCT_METRO_PORT() {\n return int('RCT_METRO_PORT', 0);\n }\n /** Skip validating the manifest during `export`. */\n get EXPO_SKIP_MANIFEST_VALIDATION_TOKEN(): boolean {\n return !!string('EXPO_SKIP_MANIFEST_VALIDATION_TOKEN', '');\n }\n\n /** Public folder path relative to the project root. Default to `public` */\n get EXPO_PUBLIC_FOLDER(): string {\n return string('EXPO_PUBLIC_FOLDER', 'public');\n }\n\n /** Higher priority `$EDIOTR` variable for indicating which editor to use when pressing `o` in the Terminal UI. */\n get EXPO_EDITOR(): string {\n return string('EXPO_EDITOR', '');\n }\n\n /**\n * Overwrite the dev server URL, disregarding the `--port`, `--host`, `--tunnel`, `--lan`, `--localhost` arguments.\n * This is useful for browser editors that require custom proxy URLs.\n */\n get EXPO_PACKAGER_PROXY_URL(): string {\n return string('EXPO_PACKAGER_PROXY_URL', '');\n }\n\n /**\n * **Experimental** - Disable using `exp.direct` as the hostname for\n * `--tunnel` connections. This enables **https://** forwarding which\n * can be used to test universal links on iOS.\n *\n * This may cause issues with `expo-linking` and Expo Go.\n *\n * Select the exact subdomain by passing a string value that is not one of: `true`, `false`, `1`, `0`.\n */\n get EXPO_TUNNEL_SUBDOMAIN(): string | boolean {\n const subdomain = string('EXPO_TUNNEL_SUBDOMAIN', '');\n if (['0', 'false', ''].includes(subdomain)) {\n return false;\n } else if (['1', 'true'].includes(subdomain)) {\n return true;\n }\n return subdomain;\n }\n\n /**\n * Force Expo CLI to use the [`resolver.resolverMainFields`](https://facebook.github.io/metro/docs/configuration/#resolvermainfields) from the project `metro.config.js` for all platforms.\n *\n * By default, Expo CLI will use `['browser', 'module', 'main']` (default for Webpack) for web and the user-defined main fields for other platforms.\n */\n get EXPO_METRO_NO_MAIN_FIELD_OVERRIDE(): boolean {\n return boolish('EXPO_METRO_NO_MAIN_FIELD_OVERRIDE', false);\n }\n\n /**\n * HTTP/HTTPS proxy to connect to for network requests. Configures [https-proxy-agent](https://www.npmjs.com/package/https-proxy-agent).\n */\n get HTTP_PROXY(): string {\n return process.env.HTTP_PROXY || process.env.http_proxy || '';\n }\n\n /**\n * Use the network inspector by overriding the metro inspector proxy with a custom version.\n * @deprecated This has been replaced by `@react-native/dev-middleware` and is now unused.\n */\n get EXPO_NO_INSPECTOR_PROXY(): boolean {\n return boolish('EXPO_NO_INSPECTOR_PROXY', false);\n }\n\n /** Disable lazy bundling in Metro bundler. */\n get EXPO_NO_METRO_LAZY() {\n return boolish('EXPO_NO_METRO_LAZY', false);\n }\n\n /** Enable the unstable inverse dependency stack trace for Metro bundling errors. */\n get EXPO_METRO_UNSTABLE_ERRORS() {\n return boolish('EXPO_METRO_UNSTABLE_ERRORS', false);\n }\n\n /** Enable the unstable fast resolver for Metro. */\n get EXPO_USE_FAST_RESOLVER() {\n return boolish('EXPO_USE_FAST_RESOLVER', false);\n }\n\n /** Disable Environment Variable injection in client bundles. */\n get EXPO_NO_CLIENT_ENV_VARS(): boolean {\n return boolish('EXPO_NO_CLIENT_ENV_VARS', false);\n }\n\n /** Set the default `user` that should be passed to `--user` with ADB commands. Used for installing APKs on Android devices with multiple profiles. Defaults to `0`. */\n get EXPO_ADB_USER(): string {\n return string('EXPO_ADB_USER', '0');\n }\n\n /** Used internally to enable E2E utilities. This behavior is not stable to external users. */\n get __EXPO_E2E_TEST(): boolean {\n return boolish('__EXPO_E2E_TEST', false);\n }\n\n /** Unstable: Force single-bundle exports in production. */\n get EXPO_NO_BUNDLE_SPLITTING(): boolean {\n return boolish('EXPO_NO_BUNDLE_SPLITTING', false);\n }\n\n /** Enable unstable/experimental Atlas to gather bundle information during development or export */\n get EXPO_UNSTABLE_ATLAS() {\n return boolish('EXPO_UNSTABLE_ATLAS', false);\n }\n\n /** Unstable: Enable tree shaking for Metro. */\n get EXPO_UNSTABLE_TREE_SHAKING() {\n return boolish('EXPO_UNSTABLE_TREE_SHAKING', false);\n }\n\n /** Unstable: Enable eager bundling where transformation runs uncached after the entire bundle has been created. This is required for production tree shaking and less optimized for development bundling. */\n get EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH() {\n return boolish('EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH', false);\n }\n\n /** Enable the use of Expo's custom metro require implementation. The custom require supports better debugging, tree shaking, and React Server Components. */\n get EXPO_USE_METRO_REQUIRE() {\n return boolish('EXPO_USE_METRO_REQUIRE', false);\n }\n\n /** Internal key used to pass eager bundle data from the CLI to the native run scripts during `npx expo run` commands. */\n get __EXPO_EAGER_BUNDLE_OPTIONS() {\n return string('__EXPO_EAGER_BUNDLE_OPTIONS', '');\n }\n\n /** Disable server deployment during production builds (during `expo export:embed`). This is useful for testing API routes and server components against a local server. */\n get EXPO_NO_DEPLOY(): boolean {\n return boolish('EXPO_NO_DEPLOY', false);\n }\n\n /** Enable hydration during development when rendering Expo Web */\n get EXPO_WEB_DEV_HYDRATE(): boolean {\n return boolish('EXPO_WEB_DEV_HYDRATE', false);\n }\n\n /** Enable experimental React Server Actions support. */\n get EXPO_UNSTABLE_SERVER_ACTIONS(): boolean {\n return boolish('EXPO_UNSTABLE_SERVER_ACTIONS', false);\n }\n}\n\nexport const env = new Env();\n"],"names":["env","Env","EXPO_PROFILE","boolish","EXPO_DEBUG","EXPO_OFFLINE","EXPO_BETA","EXPO_STAGING","EXPO_LOCAL","CI","EXPO_NO_TELEMETRY","EXPO_NO_TELEMETRY_DETACH","EXPO_UNIVERSE_DIR","string","WEB_HOST","EXPO_NO_GIT_STATUS","EXPO_NO_WEB_SETUP","EXPO_NO_TYPESCRIPT_SETUP","EXPO_NO_CACHE","EXPO_NO_REDIRECT_PAGE","RCT_METRO_PORT","int","EXPO_SKIP_MANIFEST_VALIDATION_TOKEN","EXPO_PUBLIC_FOLDER","EXPO_EDITOR","EXPO_PACKAGER_PROXY_URL","EXPO_TUNNEL_SUBDOMAIN","subdomain","includes","EXPO_METRO_NO_MAIN_FIELD_OVERRIDE","HTTP_PROXY","process","http_proxy","EXPO_NO_INSPECTOR_PROXY","EXPO_NO_METRO_LAZY","EXPO_METRO_UNSTABLE_ERRORS","EXPO_USE_FAST_RESOLVER","EXPO_NO_CLIENT_ENV_VARS","EXPO_ADB_USER","__EXPO_E2E_TEST","EXPO_NO_BUNDLE_SPLITTING","EXPO_UNSTABLE_ATLAS","EXPO_UNSTABLE_TREE_SHAKING","EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH","EXPO_USE_METRO_REQUIRE","__EXPO_EAGER_BUNDLE_OPTIONS","EXPO_NO_DEPLOY","EXPO_WEB_DEV_HYDRATE","EXPO_UNSTABLE_SERVER_ACTIONS"],"mappings":"AAAA;;;;+BAoOaA,KAAG;;aAAHA,GAAG;;;yBApOqB,QAAQ;;;;;;AAE7C,mFAAmF;AAEnF,6CAA6C;AAE7C,MAAMC,GAAG;IACP,6BAA6B,OACzBC,YAAY,GAAG;QACjB,OAAOC,IAAAA,OAAO,EAAA,QAAA,EAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACxC;IAEA,yBAAyB,OACrBC,UAAU,GAAG;QACf,OAAOD,IAAAA,OAAO,EAAA,QAAA,EAAC,YAAY,EA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AAG,IAAIC,GAAG,EAAE,AAAC"}
|
|
@@ -31,7 +31,7 @@ class FetchClient {
|
|
|
31
31
|
this.headers = {
|
|
32
32
|
accept: "application/json",
|
|
33
33
|
"content-type": "application/json",
|
|
34
|
-
"user-agent": `expo-cli/${"0.19.
|
|
34
|
+
"user-agent": `expo-cli/${"0.19.8"}`,
|
|
35
35
|
authorization: "Basic " + _nodeBuffer().Buffer.from(`${target}:`).toString("base64")
|
|
36
36
|
};
|
|
37
37
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/cli",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.8",
|
|
4
4
|
"description": "The Expo CLI",
|
|
5
5
|
"main": "build/bin/cli",
|
|
6
6
|
"bin": {
|
|
@@ -167,5 +167,5 @@
|
|
|
167
167
|
"tree-kill": "^1.2.2",
|
|
168
168
|
"tsd": "^0.28.1"
|
|
169
169
|
},
|
|
170
|
-
"gitHead": "
|
|
170
|
+
"gitHead": "d5b7ec4949eb461634b2f02a1a0ff1df2a0e2a21"
|
|
171
171
|
}
|