@expo/cli 54.0.8 → 54.1.0-canary-20250930-9dc59d3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/build/bin/cli +1 -1
  2. package/build/src/start/doctor/dependencies/getVersionedPackages.js +0 -4
  3. package/build/src/start/doctor/dependencies/getVersionedPackages.js.map +1 -1
  4. package/build/src/start/doctor/dependencies/validateDependenciesVersions.js +3 -0
  5. package/build/src/start/doctor/dependencies/validateDependenciesVersions.js.map +1 -1
  6. package/build/src/start/interface/cliExtensionMenuItemHandler.js +173 -0
  7. package/build/src/start/interface/cliExtensionMenuItemHandler.js.map +1 -0
  8. package/build/src/start/interface/createDevToolsMenuItems.js +159 -0
  9. package/build/src/start/interface/createDevToolsMenuItems.js.map +1 -0
  10. package/build/src/start/interface/interactiveActions.js +8 -12
  11. package/build/src/start/interface/interactiveActions.js.map +1 -1
  12. package/build/src/start/platforms/android/adb.js +1 -1
  13. package/build/src/start/platforms/android/adb.js.map +1 -1
  14. package/build/src/start/server/DevToolsPlugin.js +60 -0
  15. package/build/src/start/server/DevToolsPlugin.js.map +1 -0
  16. package/build/src/start/server/DevToolsPlugin.schema.js +79 -0
  17. package/build/src/start/server/DevToolsPlugin.schema.js.map +1 -0
  18. package/build/src/start/server/DevToolsPluginCliExtensionExecutor.js +119 -0
  19. package/build/src/start/server/DevToolsPluginCliExtensionExecutor.js.map +1 -0
  20. package/build/src/start/server/DevToolsPluginCliExtensionResults.js +61 -0
  21. package/build/src/start/server/DevToolsPluginCliExtensionResults.js.map +1 -0
  22. package/build/src/start/server/DevToolsPluginManager.js +4 -8
  23. package/build/src/start/server/DevToolsPluginManager.js.map +1 -1
  24. package/build/src/start/server/metro/MetroBundlerDevServer.js +125 -9
  25. package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
  26. package/build/src/start/server/metro/createServerRouteMiddleware.js +6 -5
  27. package/build/src/start/server/metro/createServerRouteMiddleware.js.map +1 -1
  28. package/build/src/start/server/metro/router.js.map +1 -1
  29. package/build/src/start/server/middleware/DataLoaderModuleMiddleware.js +75 -0
  30. package/build/src/start/server/middleware/DataLoaderModuleMiddleware.js.map +1 -0
  31. package/build/src/utils/telemetry/clients/FetchClient.js +1 -1
  32. package/build/src/utils/telemetry/utils/context.js +1 -1
  33. package/package.json +20 -20
@@ -47,7 +47,7 @@ const debug = require('debug')('expo:start:server:metro');
47
47
  const resolveAsync = (0, _util().promisify)(_resolve().default);
48
48
  function createRouteHandlerMiddleware(projectRoot, options) {
49
49
  if (!_resolvefrom().default.silent(projectRoot, 'expo-router')) {
50
- throw new _errors.CommandError(`static and server rendering requires the expo-router package to be installed in your project. Either install the expo-router package or change 'web.output' to 'static' in your app.json.`);
50
+ throw new _errors.CommandError(`static and server rendering requires the expo-router package to be installed in your project. Either install the expo-router package or change 'web.output' to 'single' in your app.json.`);
51
51
  }
52
52
  const { createRequestHandler } = require('@expo/server/adapter/http');
53
53
  return createRequestHandler({
@@ -74,9 +74,9 @@ function createRouteHandlerMiddleware(projectRoot, options) {
74
74
  rewrites: []
75
75
  };
76
76
  },
77
- async getHtml (request) {
77
+ async getHtml (request, route) {
78
78
  try {
79
- const { content } = await options.getStaticPageAsync(request.url);
79
+ const { content } = await options.getStaticPageAsync(request.url, route);
80
80
  return content;
81
81
  } catch (error) {
82
82
  // Forward the Metro server response as-is. It won't be pretty, but at least it will be accurate.
@@ -104,8 +104,9 @@ function createRouteHandlerMiddleware(projectRoot, options) {
104
104
  }
105
105
  },
106
106
  async handleRouteError (error) {
107
- const { ExpoError } = require('@expo/server');
108
- if (ExpoError.isExpoError(error)) {
107
+ // NOTE(@kitten): temporarily vendored check instead of `ExpoError.isExpoError` to avoid API incompatibility for when
108
+ // we rename `@expo/server` if we ever hot-swap the implementation
109
+ if (error && typeof error === 'object' && error.name === 'ExpoError') {
109
110
  // TODO(@krystofwoldrich): Can we show code snippet of the handler?
110
111
  // NOTE(@krystofwoldrich): Removing stack since to avoid confusion. The error is not in the server code.
111
112
  delete error.stack;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/start/server/metro/createServerRouteMiddleware.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 */\n\nimport type { ProjectConfig } from '@expo/config';\nimport { MiddlewareModule } from '@expo/server/build/types';\nimport resolve from 'resolve';\nimport resolveFrom from 'resolve-from';\nimport { promisify } from 'util';\n\nimport { fetchManifest } from './fetchRouterManifest';\nimport { getErrorOverlayHtmlAsync, logMetroError } from './metroErrorInterface';\nimport {\n warnInvalidWebOutput,\n warnInvalidMiddlewareOutput,\n warnInvalidMiddlewareMatcherSettings,\n} from './router';\nimport { CommandError } from '../../../utils/errors';\n\nconst debug = require('debug')('expo:start:server:metro') as typeof console.log;\n\nconst resolveAsync = promisify(resolve) as any as (\n id: string,\n opts: resolve.AsyncOpts\n) => Promise<string | null>;\n\nexport function createRouteHandlerMiddleware(\n projectRoot: string,\n options: {\n appDir: string;\n routerRoot: string;\n getStaticPageAsync: (pathname: string) => Promise<{ content: string }>;\n bundleApiRoute: (\n functionFilePath: string\n ) => Promise<null | Record<string, Function> | Response>;\n config: ProjectConfig;\n } & import('expo-router/build/routes-manifest').Options\n) {\n if (!resolveFrom.silent(projectRoot, 'expo-router')) {\n throw new CommandError(\n `static and server rendering requires the expo-router package to be installed in your project. Either install the expo-router package or change 'web.output' to 'static' in your app.json.`\n );\n }\n\n const { createRequestHandler } =\n require('@expo/server/adapter/http') as typeof import('@expo/server/adapter/http');\n\n return createRequestHandler(\n { build: '' },\n {\n async getRoutesManifest() {\n const manifest = await fetchManifest<RegExp>(projectRoot, options);\n debug('manifest', manifest);\n // NOTE: no app dir if null\n // TODO: Redirect to 404 page\n return (\n manifest ?? {\n // Support the onboarding screen if there's no manifest\n htmlRoutes: [\n {\n file: 'index.js',\n page: '/index',\n routeKeys: {},\n namedRegex: /^\\/(?:index)?\\/?$/i,\n },\n ],\n apiRoutes: [],\n notFoundRoutes: [],\n redirects: [],\n rewrites: [],\n }\n );\n },\n async getHtml(request) {\n try {\n const { content } = await options.getStaticPageAsync(request.url);\n return content;\n } catch (error: any) {\n // Forward the Metro server response as-is. It won't be pretty, but at least it will be accurate.\n\n try {\n return new Response(\n await getErrorOverlayHtmlAsync({\n error,\n projectRoot,\n routerRoot: options.routerRoot,\n }),\n {\n status: 500,\n headers: {\n 'Content-Type': 'text/html',\n },\n }\n );\n } catch (staticError: any) {\n debug('Failed to render static error overlay:', staticError);\n // Fallback error for when Expo Router is misconfigured in the project.\n return new Response(\n '<span><h3>Internal Error:</h3><b>Project is not setup correctly for static rendering (check terminal for more info):</b><br/>' +\n error.message +\n '<br/><br/>' +\n staticError.message +\n '</span>',\n {\n status: 500,\n headers: {\n 'Content-Type': 'text/html',\n },\n }\n );\n }\n }\n },\n async handleRouteError(error) {\n const { ExpoError } = require('@expo/server') as typeof import('@expo/server');\n\n if (ExpoError.isExpoError(error)) {\n // TODO(@krystofwoldrich): Can we show code snippet of the handler?\n // NOTE(@krystofwoldrich): Removing stack since to avoid confusion. The error is not in the server code.\n delete error.stack;\n }\n\n const htmlServerError = await getErrorOverlayHtmlAsync({\n error,\n projectRoot,\n routerRoot: options.routerRoot!,\n });\n\n return new Response(htmlServerError, {\n status: 500,\n headers: {\n 'Content-Type': 'text/html',\n },\n });\n },\n async getApiRoute(route) {\n const { exp } = options.config;\n if (exp.web?.output !== 'server') {\n warnInvalidWebOutput();\n }\n\n const resolvedFunctionPath = await resolveAsync(route.file, {\n extensions: ['.js', '.jsx', '.ts', '.tsx'],\n basedir: options.appDir,\n })!;\n\n try {\n debug(`Bundling API route at: ${resolvedFunctionPath}`);\n return await options.bundleApiRoute(resolvedFunctionPath!);\n } catch (error: any) {\n return new Response(\n 'Failed to load API Route: ' + resolvedFunctionPath + '\\n\\n' + error.message,\n {\n status: 500,\n headers: {\n 'Content-Type': 'text/html',\n },\n }\n );\n }\n },\n async getMiddleware(route) {\n const { exp } = options.config;\n\n if (!options.unstable_useServerMiddleware) {\n return {\n default: () => {\n throw new CommandError(\n 'Server middleware is not enabled. Add unstable_useServerMiddleware: true to your `expo-router` plugin config.'\n );\n },\n };\n }\n\n if (exp.web?.output !== 'server') {\n warnInvalidMiddlewareOutput();\n return {\n default: () => {\n console.warn(\n 'Server middleware is only supported when web.output is set to \"server\" in your app config'\n );\n },\n };\n }\n\n const resolvedFunctionPath = await resolveAsync(route.file, {\n extensions: ['.js', '.jsx', '.ts', '.tsx'],\n basedir: options.appDir,\n })!;\n\n try {\n debug(`Bundling middleware at: ${resolvedFunctionPath}`);\n const middlewareModule = (await options.bundleApiRoute(\n resolvedFunctionPath!\n )) as unknown as MiddlewareModule;\n\n if (middlewareModule.unstable_settings?.matcher) {\n warnInvalidMiddlewareMatcherSettings(middlewareModule.unstable_settings?.matcher);\n }\n\n return middlewareModule;\n } catch (error: any) {\n return new Response(\n 'Failed to load middleware: ' + resolvedFunctionPath + '\\n\\n' + error.message,\n {\n status: 500,\n headers: {\n 'Content-Type': 'text/html',\n },\n }\n );\n }\n },\n }\n );\n}\n"],"names":["createRouteHandlerMiddleware","debug","require","resolveAsync","promisify","resolve","projectRoot","options","resolveFrom","silent","CommandError","createRequestHandler","build","getRoutesManifest","manifest","fetchManifest","htmlRoutes","file","page","routeKeys","namedRegex","apiRoutes","notFoundRoutes","redirects","rewrites","getHtml","request","content","getStaticPageAsync","url","error","Response","getErrorOverlayHtmlAsync","routerRoot","status","headers","staticError","message","handleRouteError","ExpoError","isExpoError","stack","htmlServerError","getApiRoute","route","exp","config","web","output","warnInvalidWebOutput","resolvedFunctionPath","extensions","basedir","appDir","bundleApiRoute","getMiddleware","unstable_useServerMiddleware","default","warnInvalidMiddlewareOutput","console","warn","middlewareModule","unstable_settings","matcher","warnInvalidMiddlewareMatcherSettings"],"mappings":"AAAA;;;;;CAKC;;;;+BAwBeA;;;eAAAA;;;;gEApBI;;;;;;;g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C,SAAS;wBACP,MAAM,IAAI/C,oBAAY,CACpB;oBAEJ;gBACF;YACF;YAEA,IAAImC,EAAAA,WAAAA,IAAIE,GAAG,qBAAPF,SAASG,MAAM,MAAK,UAAU;gBAChCU,IAAAA,mCAA2B;gBAC3B,OAAO;oBACLD,SAAS;wBACPE,QAAQC,IAAI,CACV;oBAEJ;gBACF;YACF;YAEA,MAAMV,uBAAuB,MAAM/C,aAAayC,MAAM3B,IAAI,EAAE;gBAC1DkC,YAAY;oBAAC;oBAAO;oBAAQ;oBAAO;iBAAO;gBAC1CC,SAAS7C,QAAQ8C,MAAM;YACzB;YAEA,IAAI;oBAMEQ;gBALJ5D,MAAM,CAAC,wBAAwB,EAAEiD,sBAAsB;gBACvD,MAAMW,mBAAoB,MAAMtD,QAAQ+C,cAAc,CACpDJ;gBAGF,KAAIW,sCAAAA,iBAAiBC,iBAAiB,qBAAlCD,oCAAoCE,OAAO,EAAE;wBACVF;oBAArCG,IAAAA,4CAAoC,GAACH,uCAAAA,iBAAiBC,iBAAiB,qBAAlCD,qCAAoCE,OAAO;gBAClF;gBAEA,OAAOF;YACT,EAAE,OAAO/B,OAAY;gBACnB,OAAO,IAAIC,SACT,gCAAgCmB,uBAAuB,SAASpB,MAAMO,OAAO,EAC7E;oBACEH,QAAQ;oBACRC,SAAS;wBACP,gBAAgB;oBAClB;gBACF;YAEJ;QACF;IACF;AAEJ"}
1
+ {"version":3,"sources":["../../../../../src/start/server/metro/createServerRouteMiddleware.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 */\n\nimport type { ProjectConfig } from '@expo/config';\nimport type { MiddlewareSettings } from '@expo/server';\nimport resolve from 'resolve';\nimport resolveFrom from 'resolve-from';\nimport { promisify } from 'util';\n\nimport { fetchManifest, type ExpoRouterServerManifestV1Route } from './fetchRouterManifest';\nimport { getErrorOverlayHtmlAsync } from './metroErrorInterface';\nimport {\n warnInvalidWebOutput,\n warnInvalidMiddlewareOutput,\n warnInvalidMiddlewareMatcherSettings,\n} from './router';\nimport { CommandError } from '../../../utils/errors';\n\nconst debug = require('debug')('expo:start:server:metro') as typeof console.log;\n\nconst resolveAsync = promisify(resolve) as any as (\n id: string,\n opts: resolve.AsyncOpts\n) => Promise<string | null>;\n\nexport function createRouteHandlerMiddleware(\n projectRoot: string,\n options: {\n appDir: string;\n routerRoot: string;\n getStaticPageAsync: (\n pathname: string,\n route: ExpoRouterServerManifestV1Route<RegExp>\n ) => Promise<{ content: string }>;\n bundleApiRoute: (\n functionFilePath: string\n ) => Promise<null | Record<string, Function> | Response>;\n config: ProjectConfig;\n } & import('expo-router/build/routes-manifest').Options\n) {\n if (!resolveFrom.silent(projectRoot, 'expo-router')) {\n throw new CommandError(\n `static and server rendering requires the expo-router package to be installed in your project. Either install the expo-router package or change 'web.output' to 'single' in your app.json.`\n );\n }\n\n const { createRequestHandler } =\n require('@expo/server/adapter/http') as typeof import('@expo/server/adapter/http');\n\n return createRequestHandler(\n { build: '' },\n {\n async getRoutesManifest() {\n const manifest = await fetchManifest<RegExp>(projectRoot, options);\n debug('manifest', manifest);\n // NOTE: no app dir if null\n // TODO: Redirect to 404 page\n return (\n manifest ?? {\n // Support the onboarding screen if there's no manifest\n htmlRoutes: [\n {\n file: 'index.js',\n page: '/index',\n routeKeys: {},\n namedRegex: /^\\/(?:index)?\\/?$/i,\n },\n ],\n apiRoutes: [],\n notFoundRoutes: [],\n redirects: [],\n rewrites: [],\n }\n );\n },\n async getHtml(request, route) {\n try {\n const { content } = await options.getStaticPageAsync(request.url, route);\n return content;\n } catch (error: any) {\n // Forward the Metro server response as-is. It won't be pretty, but at least it will be accurate.\n\n try {\n return new Response(\n await getErrorOverlayHtmlAsync({\n error,\n projectRoot,\n routerRoot: options.routerRoot,\n }),\n {\n status: 500,\n headers: {\n 'Content-Type': 'text/html',\n },\n }\n );\n } catch (staticError: any) {\n debug('Failed to render static error overlay:', staticError);\n // Fallback error for when Expo Router is misconfigured in the project.\n return new Response(\n '<span><h3>Internal Error:</h3><b>Project is not setup correctly for static rendering (check terminal for more info):</b><br/>' +\n error.message +\n '<br/><br/>' +\n staticError.message +\n '</span>',\n {\n status: 500,\n headers: {\n 'Content-Type': 'text/html',\n },\n }\n );\n }\n }\n },\n async handleRouteError(error) {\n // NOTE(@kitten): temporarily vendored check instead of `ExpoError.isExpoError` to avoid API incompatibility for when\n // we rename `@expo/server` if we ever hot-swap the implementation\n if (error && typeof error === 'object' && error.name === 'ExpoError') {\n // TODO(@krystofwoldrich): Can we show code snippet of the handler?\n // NOTE(@krystofwoldrich): Removing stack since to avoid confusion. The error is not in the server code.\n delete error.stack;\n }\n\n const htmlServerError = await getErrorOverlayHtmlAsync({\n error,\n projectRoot,\n routerRoot: options.routerRoot!,\n });\n\n return new Response(htmlServerError, {\n status: 500,\n headers: {\n 'Content-Type': 'text/html',\n },\n });\n },\n async getApiRoute(route) {\n const { exp } = options.config;\n if (exp.web?.output !== 'server') {\n warnInvalidWebOutput();\n }\n\n const resolvedFunctionPath = await resolveAsync(route.file, {\n extensions: ['.js', '.jsx', '.ts', '.tsx'],\n basedir: options.appDir,\n })!;\n\n try {\n debug(`Bundling API route at: ${resolvedFunctionPath}`);\n return await options.bundleApiRoute(resolvedFunctionPath!);\n } catch (error: any) {\n return new Response(\n 'Failed to load API Route: ' + resolvedFunctionPath + '\\n\\n' + error.message,\n {\n status: 500,\n headers: {\n 'Content-Type': 'text/html',\n },\n }\n );\n }\n },\n async getMiddleware(route) {\n const { exp } = options.config;\n\n if (!options.unstable_useServerMiddleware) {\n return {\n default: () => {\n throw new CommandError(\n 'Server middleware is not enabled. Add unstable_useServerMiddleware: true to your `expo-router` plugin config.'\n );\n },\n };\n }\n\n if (exp.web?.output !== 'server') {\n warnInvalidMiddlewareOutput();\n return {\n default: () => {\n console.warn(\n 'Server middleware is only supported when web.output is set to \"server\" in your app config'\n );\n },\n };\n }\n\n const resolvedFunctionPath = await resolveAsync(route.file, {\n extensions: ['.js', '.jsx', '.ts', '.tsx'],\n basedir: options.appDir,\n })!;\n\n try {\n debug(`Bundling middleware at: ${resolvedFunctionPath}`);\n const middlewareModule = (await options.bundleApiRoute(resolvedFunctionPath!)) as any;\n\n if ((middlewareModule.unstable_settings as MiddlewareSettings)?.matcher) {\n warnInvalidMiddlewareMatcherSettings(middlewareModule.unstable_settings?.matcher);\n }\n\n return middlewareModule;\n } catch (error: any) {\n return new Response(\n 'Failed to load middleware: ' + resolvedFunctionPath + '\\n\\n' + error.message,\n {\n status: 500,\n headers: {\n 'Content-Type': 'text/html',\n },\n }\n );\n }\n },\n }\n );\n}\n"],"names":["createRouteHandlerMiddleware","debug","require","resolveAsync","promisify","resolve","projectRoot","options","resolveFrom","silent","CommandError","createRequestHandler","build","getRoutesManifest","manifest","fetchManifest","htmlRoutes","file","page","routeKeys","namedRegex","apiRoutes","notFoundRoutes","redirects","rewrites","getHtml","request","route","content","getStaticPageAsync","url","error","Response","getErrorOverlayHtmlAsync","routerRoot","status","headers","staticError","message","handleRouteError","name","stack","htmlServerError","getApiRoute","exp","config","web","output","warnInvalidWebOutput","resolvedFunctionPath","extensions","basedir","appDir","bundleApiRoute","getMiddleware","unstable_useServerMiddleware","default","warnInvalidMiddlewareOutput","console","warn","middlewareModule","unstable_settings","matcher","warnInvalidMiddlewareMatcherSettings"],"mappings":"AAAA;;;;;CAKC;;;;+BAwBeA;;;eAAAA;;;;gEApBI;;;;;;;gEACI;;;;;;;yBACE;;;;;;qCAE0C;qCAC3B;wBAKlC;wBACsB;;;;;;AAE7B,MAAMC,QAAQC,QAAQ,SAAS;AAE/B,MAAMC,eAAeC,IAAAA,iBAAS,EAACC,kBAAO;AAK/B,SAASL,6BACdM,WAAmB,EACnBC,OAWuD;IAEvD,IAAI,CAACC,sBAAW,CAACC,MAAM,CAACH,aAAa,gBAAgB;QACnD,MAAM,IAAII,oBAAY,CACpB,CAAC,yLAAyL,CAAC;IAE/L;IAEA,MAAM,E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gBAC1DiC,YAAY;oBAAC;oBAAO;oBAAQ;oBAAO;iBAAO;gBAC1CC,SAAS5C,QAAQ6C,MAAM;YACzB;YAEA,IAAI;oBAIGQ;gBAHL3D,MAAM,CAAC,wBAAwB,EAAEgD,sBAAsB;gBACvD,MAAMW,mBAAoB,MAAMrD,QAAQ8C,cAAc,CAACJ;gBAEvD,KAAKW,sCAAAA,iBAAiBC,iBAAiB,qBAAnC,AAACD,oCAA2DE,OAAO,EAAE;wBAClCF;oBAArCG,IAAAA,4CAAoC,GAACH,uCAAAA,iBAAiBC,iBAAiB,qBAAlCD,qCAAoCE,OAAO;gBAClF;gBAEA,OAAOF;YACT,EAAE,OAAO7B,OAAY;gBACnB,OAAO,IAAIC,SACT,gCAAgCiB,uBAAuB,SAASlB,MAAMO,OAAO,EAC7E;oBACEH,QAAQ;oBACRC,SAAS;wBACP,gBAAgB;oBAClB;gBACF;YAEJ;QACF;IACF;AAEJ"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/start/server/metro/router.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config';\nimport type { MiddlewareMatcher } from '@expo/server/build/types';\nimport chalk from 'chalk';\nimport { sync as globSync } from 'glob';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\n\nimport { Log } from '../../../log';\nimport { directoryExistsSync } from '../../../utils/dir';\nimport { toPosixPath } from '../../../utils/filePath';\nimport { learnMore } from '../../../utils/link';\n\nconst debug = require('debug')('expo:start:server:metro:router') as typeof console.log;\n\n/**\n * Get the relative path for requiring the `/app` folder relative to the `expo-router/entry` file.\n * This mechanism does require the server to restart after the `expo-router` package is installed.\n */\nexport function getAppRouterRelativeEntryPath(\n projectRoot: string,\n routerDirectory: string = getRouterDirectory(projectRoot)\n): string | undefined {\n // Auto pick App entry\n const routerEntry =\n resolveFrom.silent(projectRoot, 'expo-router/entry') ?? getFallbackEntryRoot(projectRoot);\n if (!routerEntry) {\n return undefined;\n }\n // It doesn't matter if the app folder exists.\n const appFolder = path.join(projectRoot, routerDirectory);\n const appRoot = path.relative(path.dirname(routerEntry), appFolder);\n debug('expo-router entry', routerEntry, appFolder, appRoot);\n return appRoot;\n}\n\n/** If the `expo-router` package is not installed, then use the `expo` package to determine where the node modules are relative to the project. */\nfunction getFallbackEntryRoot(projectRoot: string): string {\n const expoRoot = resolveFrom.silent(projectRoot, 'expo/package.json');\n if (expoRoot) {\n return path.join(path.dirname(path.dirname(expoRoot)), 'expo-router/entry');\n }\n return path.join(projectRoot, 'node_modules/expo-router/entry');\n}\n\nexport function getRouterDirectoryModuleIdWithManifest(\n projectRoot: string,\n exp: ExpoConfig\n): string {\n return toPosixPath(exp.extra?.router?.root ?? getRouterDirectory(projectRoot));\n}\n\nlet hasWarnedAboutSrcDir = false;\nconst logSrcDir = () => {\n if (hasWarnedAboutSrcDir) return;\n hasWarnedAboutSrcDir = true;\n Log.log(chalk.gray('Using src/app as the root directory for Expo Router.'));\n};\n\nexport function getRouterDirectory(projectRoot: string): string {\n // more specific directories first\n if (directoryExistsSync(path.join(projectRoot, 'src', 'app'))) {\n logSrcDir();\n return path.join('src', 'app');\n }\n\n debug('Using app as the root directory for Expo Router.');\n return 'app';\n}\n\nexport function isApiRouteConvention(name: string): boolean {\n return /\\+api\\.[tj]sx?$/.test(name);\n}\n\nexport function getApiRoutesForDirectory(cwd: string) {\n return globSync('**/*+api.@(ts|tsx|js|jsx)', {\n cwd,\n absolute: true,\n dot: true,\n });\n}\n\n/**\n * Gets the +middleware file for a given directory. In\n * @param cwd\n */\nexport function getMiddlewareForDirectory(cwd: string): string | null {\n const files = globSync('+middleware.@(ts|tsx|js|jsx)', {\n cwd,\n absolute: true,\n dot: true,\n });\n\n if (files.length === 0) return null;\n\n if (files.length > 1) {\n // In development, throw an error if there are multiple root-level middleware files\n if (process.env.NODE_ENV !== 'production') {\n const relativePaths = files.map((f) => './' + path.relative(cwd, f)).sort();\n throw new Error(\n `Only one middleware file is allowed. Keep one of the conflicting files: ${relativePaths.map((p) => `\"${p}\"`).join(' or ')}`\n );\n }\n }\n\n return files[0];\n}\n\n// Used to emulate a context module, but way faster. TODO: May need to adjust the extensions to stay in sync with Metro.\nexport function getRoutePaths(cwd: string) {\n return globSync('**/*.@(ts|tsx|js|jsx)', {\n cwd,\n dot: true,\n }).map((p) => './' + normalizePaths(p));\n}\n\nfunction normalizePaths(p: string) {\n return p.replace(/\\\\/g, '/');\n}\n\nlet hasWarnedAboutApiRouteOutput = false;\nlet hasWarnedAboutMiddlewareOutput = false;\n\nexport function hasWarnedAboutApiRoutes() {\n return hasWarnedAboutApiRouteOutput;\n}\n\nexport function hasWarnedAboutMiddleware() {\n return hasWarnedAboutMiddlewareOutput;\n}\n\nexport function warnInvalidWebOutput() {\n if (!hasWarnedAboutApiRouteOutput) {\n Log.warn(\n chalk.yellow`Using API routes requires the {bold web.output} to be set to {bold \"server\"} in the project {bold app.json}. ${learnMore(\n 'https://docs.expo.dev/router/reference/api-routes/'\n )}`\n );\n }\n\n hasWarnedAboutApiRouteOutput = true;\n}\n\nexport function warnInvalidMiddlewareOutput() {\n if (!hasWarnedAboutMiddlewareOutput) {\n Log.warn(\n chalk.yellow`Using middleware requires the {bold web.output} to be set to {bold \"server\"} in the project {bold app.json}. ${learnMore(\n 'https://docs.expo.dev/router/reference/api-routes/'\n )}`\n );\n }\n\n hasWarnedAboutMiddlewareOutput = true;\n}\n\nexport function warnInvalidMiddlewareMatcherSettings(matcher: MiddlewareMatcher) {\n const validMethods = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS', 'HEAD'];\n\n // Ensure methods are valid HTTP methods\n if (matcher.methods) {\n if (!Array.isArray(matcher.methods)) {\n Log.error(\n chalk.red`Middleware matcher methods must be an array of valid HTTP methods. Supported methods are: ${validMethods.join(', ')}`\n );\n } else {\n for (const method of matcher.methods) {\n if (!validMethods.includes(method)) {\n Log.error(\n chalk.red`Invalid middleware HTTP method: ${method}. Supported methods are: ${validMethods.join(', ')}`\n );\n }\n }\n }\n }\n\n // Ensure patterns are either a string or RegExp\n if (matcher.patterns) {\n const patterns = Array.isArray(matcher.patterns) ? matcher.patterns : [matcher.patterns];\n for (const pattern of patterns) {\n if (typeof pattern !== 'string' && !(pattern instanceof RegExp)) {\n Log.error(\n chalk.red`Middleware matcher patterns must be strings or regular expressions. Received: ${String(\n pattern\n )}`\n );\n }\n\n if (typeof pattern === 'string' && !pattern.startsWith('/')) {\n Log.error(\n chalk.red`String patterns in middleware matcher must start with '/'. Received: ${pattern}`\n );\n }\n }\n }\n}\n"],"names":["getApiRoutesForDirectory","getAppRouterRelativeEntryPath","getMiddlewareForDirectory","getRoutePaths","getRouterDirectory","getRouterDirectoryModuleIdWithManifest","hasWarnedAboutApiRoutes","hasWarnedAboutMiddleware","isApiRouteConvention","warnInvalidMiddlewareMatcherSettings","warnInvalidMiddlewareOutput","warnInvalidWebOutput","debug","require","projectRoot","routerDirectory","routerEntry","resolveFrom","silent","getFallbackEntryRoot","undefined","appFolder","path","join","appRoot","relative","dirname","expoRoot","exp","toPosixPath","extra","router","root","hasWarnedAboutSrcDir","logSrcDir","Log","log","chalk","gray","directoryExistsSync","name","test","cwd","globSync","absolute","dot","files","length","process","env","NODE_ENV","relativePaths","map","f","sort","Error","p","normalizePaths","replace","hasWarnedAboutApiRouteOutput","hasWarnedAboutMiddlewareOutput","warn","yellow","learnMore","matcher","validMethods","methods","Array","isArray","error","red","method","includes","patterns","pattern","RegExp","String","startsWith"],"mappings":";;;;;;;;;;;IAyEgBA,wBAAwB;eAAxBA;;IAvDAC,6BAA6B;eAA7BA;;IAmEAC,yBAAyB;eAAzBA;;IAuBAC,aAAa;eAAbA;;IAlDAC,kBAAkB;eAAlBA;;IAdAC,sCAAsC;eAAtCA;;IA8EAC,uBAAuB;eAAvBA;;IAIAC,wBAAwB;eAAxBA;;IAzDAC,oBAAoB;eAApBA;;IAqFAC,oCAAoC;eAApCA;;IAZAC,2BAA2B;eAA3BA;;IAZAC,oBAAoB;eAApBA;;;;gEAhI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AEA,IAAI,OAAOA,YAAY,YAAY,CAACA,QAAQG,UAAU,CAAC,MAAM;gBAC3D1C,QAAG,CAACkC,KAAK,CACPhC,gBAAK,CAACiC,GAAG,CAAC,qEAAqE,EAAEI,QAAQ,CAAC;YAE9F;QACF;IACF;AACF"}
1
+ {"version":3,"sources":["../../../../../src/start/server/metro/router.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config';\nimport type { MiddlewareMatcher } from '@expo/server';\nimport chalk from 'chalk';\nimport { sync as globSync } from 'glob';\nimport path from 'path';\nimport resolveFrom from 'resolve-from';\n\nimport { Log } from '../../../log';\nimport { directoryExistsSync } from '../../../utils/dir';\nimport { toPosixPath } from '../../../utils/filePath';\nimport { learnMore } from '../../../utils/link';\n\nconst debug = require('debug')('expo:start:server:metro:router') as typeof console.log;\n\n/**\n * Get the relative path for requiring the `/app` folder relative to the `expo-router/entry` file.\n * This mechanism does require the server to restart after the `expo-router` package is installed.\n */\nexport function getAppRouterRelativeEntryPath(\n projectRoot: string,\n routerDirectory: string = getRouterDirectory(projectRoot)\n): string | undefined {\n // Auto pick App entry\n const routerEntry =\n resolveFrom.silent(projectRoot, 'expo-router/entry') ?? getFallbackEntryRoot(projectRoot);\n if (!routerEntry) {\n return undefined;\n }\n // It doesn't matter if the app folder exists.\n const appFolder = path.join(projectRoot, routerDirectory);\n const appRoot = path.relative(path.dirname(routerEntry), appFolder);\n debug('expo-router entry', routerEntry, appFolder, appRoot);\n return appRoot;\n}\n\n/** If the `expo-router` package is not installed, then use the `expo` package to determine where the node modules are relative to the project. */\nfunction getFallbackEntryRoot(projectRoot: string): string {\n const expoRoot = resolveFrom.silent(projectRoot, 'expo/package.json');\n if (expoRoot) {\n return path.join(path.dirname(path.dirname(expoRoot)), 'expo-router/entry');\n }\n return path.join(projectRoot, 'node_modules/expo-router/entry');\n}\n\nexport function getRouterDirectoryModuleIdWithManifest(\n projectRoot: string,\n exp: ExpoConfig\n): string {\n return toPosixPath(exp.extra?.router?.root ?? getRouterDirectory(projectRoot));\n}\n\nlet hasWarnedAboutSrcDir = false;\nconst logSrcDir = () => {\n if (hasWarnedAboutSrcDir) return;\n hasWarnedAboutSrcDir = true;\n Log.log(chalk.gray('Using src/app as the root directory for Expo Router.'));\n};\n\nexport function getRouterDirectory(projectRoot: string): string {\n // more specific directories first\n if (directoryExistsSync(path.join(projectRoot, 'src', 'app'))) {\n logSrcDir();\n return path.join('src', 'app');\n }\n\n debug('Using app as the root directory for Expo Router.');\n return 'app';\n}\n\nexport function isApiRouteConvention(name: string): boolean {\n return /\\+api\\.[tj]sx?$/.test(name);\n}\n\nexport function getApiRoutesForDirectory(cwd: string) {\n return globSync('**/*+api.@(ts|tsx|js|jsx)', {\n cwd,\n absolute: true,\n dot: true,\n });\n}\n\n/**\n * Gets the +middleware file for a given directory. In\n * @param cwd\n */\nexport function getMiddlewareForDirectory(cwd: string): string | null {\n const files = globSync('+middleware.@(ts|tsx|js|jsx)', {\n cwd,\n absolute: true,\n dot: true,\n });\n\n if (files.length === 0) return null;\n\n if (files.length > 1) {\n // In development, throw an error if there are multiple root-level middleware files\n if (process.env.NODE_ENV !== 'production') {\n const relativePaths = files.map((f) => './' + path.relative(cwd, f)).sort();\n throw new Error(\n `Only one middleware file is allowed. Keep one of the conflicting files: ${relativePaths.map((p) => `\"${p}\"`).join(' or ')}`\n );\n }\n }\n\n return files[0];\n}\n\n// Used to emulate a context module, but way faster. TODO: May need to adjust the extensions to stay in sync with Metro.\nexport function getRoutePaths(cwd: string) {\n return globSync('**/*.@(ts|tsx|js|jsx)', {\n cwd,\n dot: true,\n }).map((p) => './' + normalizePaths(p));\n}\n\nfunction normalizePaths(p: string) {\n return p.replace(/\\\\/g, '/');\n}\n\nlet hasWarnedAboutApiRouteOutput = false;\nlet hasWarnedAboutMiddlewareOutput = false;\n\nexport function hasWarnedAboutApiRoutes() {\n return hasWarnedAboutApiRouteOutput;\n}\n\nexport function hasWarnedAboutMiddleware() {\n return hasWarnedAboutMiddlewareOutput;\n}\n\nexport function warnInvalidWebOutput() {\n if (!hasWarnedAboutApiRouteOutput) {\n Log.warn(\n chalk.yellow`Using API routes requires the {bold web.output} to be set to {bold \"server\"} in the project {bold app.json}. ${learnMore(\n 'https://docs.expo.dev/router/reference/api-routes/'\n )}`\n );\n }\n\n hasWarnedAboutApiRouteOutput = true;\n}\n\nexport function warnInvalidMiddlewareOutput() {\n if (!hasWarnedAboutMiddlewareOutput) {\n Log.warn(\n chalk.yellow`Using middleware requires the {bold web.output} to be set to {bold \"server\"} in the project {bold app.json}. ${learnMore(\n 'https://docs.expo.dev/router/reference/api-routes/'\n )}`\n );\n }\n\n hasWarnedAboutMiddlewareOutput = true;\n}\n\nexport function warnInvalidMiddlewareMatcherSettings(matcher: MiddlewareMatcher) {\n const validMethods = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS', 'HEAD'];\n\n // Ensure methods are valid HTTP methods\n if (matcher.methods) {\n if (!Array.isArray(matcher.methods)) {\n Log.error(\n chalk.red`Middleware matcher methods must be an array of valid HTTP methods. Supported methods are: ${validMethods.join(', ')}`\n );\n } else {\n for (const method of matcher.methods) {\n if (!validMethods.includes(method)) {\n Log.error(\n chalk.red`Invalid middleware HTTP method: ${method}. Supported methods are: ${validMethods.join(', ')}`\n );\n }\n }\n }\n }\n\n // Ensure patterns are either a string or RegExp\n if (matcher.patterns) {\n const patterns = Array.isArray(matcher.patterns) ? matcher.patterns : [matcher.patterns];\n for (const pattern of patterns) {\n if (typeof pattern !== 'string' && !(pattern instanceof RegExp)) {\n Log.error(\n chalk.red`Middleware matcher patterns must be strings or regular expressions. Received: ${String(\n pattern\n )}`\n );\n }\n\n if (typeof pattern === 'string' && !pattern.startsWith('/')) {\n Log.error(\n chalk.red`String patterns in middleware matcher must start with '/'. Received: ${pattern}`\n );\n }\n }\n }\n}\n"],"names":["getApiRoutesForDirectory","getAppRouterRelativeEntryPath","getMiddlewareForDirectory","getRoutePaths","getRouterDirectory","getRouterDirectoryModuleIdWithManifest","hasWarnedAboutApiRoutes","hasWarnedAboutMiddleware","isApiRouteConvention","warnInvalidMiddlewareMatcherSettings","warnInvalidMiddlewareOutput","warnInvalidWebOutput","debug","require","projectRoot","routerDirectory","routerEntry","resolveFrom","silent","getFallbackEntryRoot","undefined","appFolder","path","join","appRoot","relative","dirname","expoRoot","exp","toPosixPath","extra","router","root","hasWarnedAboutSrcDir","logSrcDir","Log","log","chalk","gray","directoryExistsSync","name","test","cwd","globSync","absolute","dot","files","length","process","env","NODE_ENV","relativePaths","map","f","sort","Error","p","normalizePaths","replace","hasWarnedAboutApiRouteOutput","hasWarnedAboutMiddlewareOutput","warn","yellow","learnMore","matcher","validMethods","methods","Array","isArray","error","red","method","includes","patterns","pattern","RegExp","String","startsWith"],"mappings":";;;;;;;;;;;IAyEgBA,wBAAwB;eAAxBA;;IAvDAC,6BAA6B;eAA7BA;;IAmEAC,yBAAyB;eAAzBA;;IAuBAC,aAAa;eAAbA;;IAlDAC,kBAAkB;eAAlBA;;IAdAC,sCAAsC;eAAtCA;;IA8EAC,uBAAuB;eAAvBA;;IAIAC,wBAAwB;eAAxBA;;IAzDAC,oBAAoB;eAApBA;;IAqFAC,oCAAoC;eAApCA;;IAZAC,2BAA2B;eAA3BA;;IAZAC,oBAAoB;eAApBA;;;;gEAhIE;;;;;;;yBACe;;;;;;;gEAChB;;;;;;;gEACO;;;;;;qBAEJ;qBACgB;0BACR;sBACF;;;;;;AAE1B,MAAMC,QAAQC,QAAQ,SAAS;AAMxB,SAASZ,8BACda,WAAmB,EACnBC,kBAA0BX,mBAAmBU,YAAY;IAEzD,sBAAsB;IACtB,MAAME,cACJC,sBAAW,CAACC,MAAM,CAACJ,aAAa,wBAAwBK,qBAAqBL;IAC/E,IAAI,CAACE,aAAa;QAChB,OAAOI;IACT;IACA,8CAA8C;IAC9C,MAAMC,YAAYC,eAAI,CAACC,IAAI,CAACT,aAAaC;IACzC,MAAMS,UAAUF,eAAI,CAACG,QAAQ,CAACH,eAAI,C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E,OAAO,EAAE;QACnB,IAAI,CAACC,MAAMC,OAAO,CAACJ,QAAQE,OAAO,GAAG;YACnC/B,QAAG,CAACkC,KAAK,CACPhC,gBAAK,CAACiC,GAAG,CAAC,0FAA0F,EAAEL,aAAa1C,IAAI,CAAC,MAAM,CAAC;QAEnI,OAAO;YACL,KAAK,MAAMgD,UAAUP,QAAQE,OAAO,CAAE;gBACpC,IAAI,CAACD,aAAaO,QAAQ,CAACD,SAAS;oBAClCpC,QAAG,CAACkC,KAAK,CACPhC,gBAAK,CAACiC,GAAG,CAAC,gCAAgC,EAAEC,OAAO,yBAAyB,EAAEN,aAAa1C,IAAI,CAAC,MAAM,CAAC;gBAE3G;YACF;QACF;IACF;IAEA,gDAAgD;IAChD,IAAIyC,QAAQS,QAAQ,EAAE;QACpB,MAAMA,WAAWN,MAAMC,OAAO,CAACJ,QAAQS,QAAQ,IAAIT,QAAQS,QAAQ,GAAG;YAACT,QAAQS,QAAQ;SAAC;QACxF,KAAK,MAAMC,WAAWD,SAAU;YAC9B,IAAI,OAAOC,YAAY,YAAY,CAAEA,CAAAA,mBAAmBC,MAAK,GAAI;gBAC/DxC,QAAG,CAACkC,KAAK,CACPhC,gBAAK,CAACiC,GAAG,CAAC,8EAA8E,EAAEM,OACxFF,SACA,CAAC;YAEP;YAEA,IAAI,OAAOA,YAAY,YAAY,CAACA,QAAQG,UAAU,CAAC,MAAM;gBAC3D1C,QAAG,CAACkC,KAAK,CACPhC,gBAAK,CAACiC,GAAG,CAAC,qEAAqE,EAAEI,QAAQ,CAAC;YAE9F;QACF;IACF;AACF"}
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "DataLoaderModuleMiddleware", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return DataLoaderModuleMiddleware;
9
+ }
10
+ });
11
+ function _config() {
12
+ const data = require("@expo/config");
13
+ _config = function() {
14
+ return data;
15
+ };
16
+ return data;
17
+ }
18
+ const _ExpoMiddleware = require("./ExpoMiddleware");
19
+ const _fetchRouterManifest = require("../metro/fetchRouterManifest");
20
+ const LOADER_MODULE_ENDPOINT = '/_expo/loaders';
21
+ class DataLoaderModuleMiddleware extends _ExpoMiddleware.ExpoMiddleware {
22
+ constructor(projectRoot, appDir, executeServerDataLoaderAsync, getDevServerUrl){
23
+ super(projectRoot, [
24
+ LOADER_MODULE_ENDPOINT
25
+ ]), this.projectRoot = projectRoot, this.appDir = appDir, this.executeServerDataLoaderAsync = executeServerDataLoaderAsync, this.getDevServerUrl = getDevServerUrl;
26
+ }
27
+ /**
28
+ * Only handles a request if `req.pathname` begins with `/_expo/loaders/` and if the request
29
+ * headers include `Accept: application/json`.
30
+ */ shouldHandleRequest(req) {
31
+ var _exp_extra_router, _exp_extra;
32
+ if (!req.url) return false;
33
+ const { pathname } = new URL(req.url, 'http://localhost');
34
+ if (!pathname.startsWith(`${LOADER_MODULE_ENDPOINT}/`)) {
35
+ return false;
36
+ }
37
+ if (req.headers.accept !== 'application/json') {
38
+ return false;
39
+ }
40
+ const { exp } = (0, _config().getConfig)(this.projectRoot);
41
+ return !!((_exp_extra = exp.extra) == null ? void 0 : (_exp_extra_router = _exp_extra.router) == null ? void 0 : _exp_extra_router.unstable_useServerDataLoaders);
42
+ }
43
+ async handleRequestAsync(req, res, next) {
44
+ if (![
45
+ 'GET',
46
+ 'HEAD'
47
+ ].includes(req.method ?? '')) {
48
+ return next();
49
+ }
50
+ const manifest = await (0, _fetchRouterManifest.fetchManifest)(this.projectRoot, {
51
+ appDir: this.appDir
52
+ });
53
+ const { pathname } = new URL(req.url, 'http://localhost');
54
+ try {
55
+ const routePath = pathname.replace('/_expo/loaders', '').replace('/index', '/') || '/';
56
+ const matchingRoute = manifest == null ? void 0 : manifest.htmlRoutes.find((route)=>{
57
+ return route.namedRegex.test(routePath);
58
+ });
59
+ if (!matchingRoute) {
60
+ throw new Error(`No matching route for ${routePath}`);
61
+ }
62
+ const loaderData = await this.executeServerDataLoaderAsync(new URL(routePath, this.getDevServerUrl()), matchingRoute);
63
+ res.setHeader('Content-Type', 'application/javascript; charset=utf-8');
64
+ res.setHeader('Cache-Control', 'no-cache');
65
+ res.statusCode = 200;
66
+ res.end(JSON.stringify(loaderData ?? {}));
67
+ } catch (error) {
68
+ console.error(`Failed to generate loader module for ${pathname}:`, error);
69
+ res.statusCode = 500;
70
+ res.end(`{}`);
71
+ }
72
+ }
73
+ }
74
+
75
+ //# sourceMappingURL=DataLoaderModuleMiddleware.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/start/server/middleware/DataLoaderModuleMiddleware.ts"],"sourcesContent":["import { getConfig } from '@expo/config';\n\nimport { ExpoMiddleware } from './ExpoMiddleware';\nimport { ServerNext, ServerRequest, ServerResponse } from './server.types';\nimport { type ExpoRouterServerManifestV1Route, fetchManifest } from '../metro/fetchRouterManifest';\n\nconst LOADER_MODULE_ENDPOINT = '/_expo/loaders';\n\n/**\n * Middleware for serving loader data modules dynamically during development. This allows\n * client-side navigation to fetch loader data on-demand.\n *\n * In production, these modules are pre-generated as static files.\n */\nexport class DataLoaderModuleMiddleware extends ExpoMiddleware {\n constructor(\n protected projectRoot: string,\n protected appDir: string,\n private executeServerDataLoaderAsync: (\n url: URL,\n route: ExpoRouterServerManifestV1Route<RegExp>\n ) => Promise<any>,\n private getDevServerUrl: () => string\n ) {\n super(projectRoot, [LOADER_MODULE_ENDPOINT]);\n }\n\n /**\n * Only handles a request if `req.pathname` begins with `/_expo/loaders/` and if the request\n * headers include `Accept: application/json`.\n */\n override shouldHandleRequest(req: ServerRequest): boolean {\n if (!req.url) return false;\n const { pathname } = new URL(req.url, 'http://localhost');\n\n if (!pathname.startsWith(`${LOADER_MODULE_ENDPOINT}/`)) {\n return false;\n }\n\n if (req.headers.accept !== 'application/json') {\n return false;\n }\n\n const { exp } = getConfig(this.projectRoot);\n return !!exp.extra?.router?.unstable_useServerDataLoaders;\n }\n\n async handleRequestAsync(\n req: ServerRequest,\n res: ServerResponse,\n next: ServerNext\n ): Promise<void> {\n if (!['GET', 'HEAD'].includes(req.method ?? '')) {\n return next();\n }\n\n const manifest = await fetchManifest<RegExp>(this.projectRoot, {\n appDir: this.appDir,\n });\n\n const { pathname } = new URL(req.url!, 'http://localhost');\n\n try {\n const routePath = pathname.replace('/_expo/loaders', '').replace('/index', '/') || '/';\n\n const matchingRoute = manifest?.htmlRoutes.find((route) => {\n return route.namedRegex.test(routePath);\n });\n\n if (!matchingRoute) {\n throw new Error(`No matching route for ${routePath}`);\n }\n\n const loaderData = await this.executeServerDataLoaderAsync(\n new URL(routePath, this.getDevServerUrl()),\n matchingRoute\n );\n\n res.setHeader('Content-Type', 'application/javascript; charset=utf-8');\n res.setHeader('Cache-Control', 'no-cache');\n res.statusCode = 200;\n res.end(JSON.stringify(loaderData ?? {}));\n } catch (error) {\n console.error(`Failed to generate loader module for ${pathname}:`, error);\n res.statusCode = 500;\n res.end(`{}`);\n }\n }\n}\n"],"names":["DataLoaderModuleMiddleware","LOADER_MODULE_ENDPOINT","ExpoMiddleware","constructor","projectRoot","appDir","executeServerDataLoaderAsync","getDevServerUrl","shouldHandleRequest","req","exp","url","pathname","URL","startsWith","headers","accept","getConfig","extra","router","unstable_useServerDataLoaders","handleRequestAsync","res","next","includes","method","manifest","fetchManifest","routePath","replace","matchingRoute","htmlRoutes","find","route","namedRegex","test","Error","loaderData","setHeader","statusCode","end","JSON","stringify","error","console"],"mappings":";;;;+BAcaA;;;eAAAA;;;;yBAda;;;;;;gCAEK;qCAEqC;AAEpE,MAAMC,yBAAyB;AAQxB,MAAMD,mCAAmCE,8BAAc;IAC5DC,YACE,AAAUC,WAAmB,EAC7B,AAAUC,MAAc,EACxB,AAAQC,4BAGS,EACjB,AAAQC,eAA6B,CACrC;QACA,KAAK,CAACH,aAAa;YAACH;SAAuB,QARjCG,cAAAA,kBACAC,SAAAA,aACFC,+BAAAA,mCAIAC,kBAAAA;IAGV;IAEA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AIO,IAAIe,WAAW,IAAI,CAACrB,eAAe,KACvCuB;YAGFR,IAAIgB,SAAS,CAAC,gBAAgB;YAC9BhB,IAAIgB,SAAS,CAAC,iBAAiB;YAC/BhB,IAAIiB,UAAU,GAAG;YACjBjB,IAAIkB,GAAG,CAACC,KAAKC,SAAS,CAACL,cAAc,CAAC;QACxC,EAAE,OAAOM,OAAO;YACdC,QAAQD,KAAK,CAAC,CAAC,qCAAqC,EAAE/B,SAAS,CAAC,CAAC,EAAE+B;YACnErB,IAAIiB,UAAU,GAAG;YACjBjB,IAAIkB,GAAG,CAAC,CAAC,EAAE,CAAC;QACd;IACF;AACF"}
@@ -33,7 +33,7 @@ class FetchClient {
33
33
  this.headers = {
34
34
  accept: 'application/json',
35
35
  'content-type': 'application/json',
36
- 'user-agent': `expo-cli/${"54.0.8"}`,
36
+ 'user-agent': `expo-cli/${"54.1.0-canary-20250930-9dc59d3"}`,
37
37
  authorization: 'Basic ' + _nodebuffer().Buffer.from(`${target}:`).toString('base64')
38
38
  };
39
39
  }
@@ -83,7 +83,7 @@ function createContext() {
83
83
  cpu: summarizeCpuInfo(),
84
84
  app: {
85
85
  name: 'expo/cli',
86
- version: "54.0.8"
86
+ version: "54.1.0-canary-20250930-9dc59d3"
87
87
  },
88
88
  ci: _ciinfo().isCI ? {
89
89
  name: _ciinfo().name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expo/cli",
3
- "version": "54.0.8",
3
+ "version": "54.1.0-canary-20250930-9dc59d3",
4
4
  "description": "The Expo CLI",
5
5
  "main": "build/bin/cli",
6
6
  "bin": {
@@ -43,25 +43,25 @@
43
43
  "dependencies": {
44
44
  "@0no-co/graphql.web": "^1.0.8",
45
45
  "@expo/code-signing-certificates": "^0.0.5",
46
- "@expo/config": "~12.0.9",
47
- "@expo/config-plugins": "~54.0.1",
46
+ "@expo/config": "12.0.10-canary-20250930-9dc59d3",
47
+ "@expo/config-plugins": "54.1.0-canary-20250930-9dc59d3",
48
48
  "@expo/devcert": "^1.1.2",
49
- "@expo/env": "~2.0.7",
50
- "@expo/image-utils": "^0.8.7",
51
- "@expo/json-file": "^10.0.7",
49
+ "@expo/env": "2.0.8-canary-20250930-9dc59d3",
50
+ "@expo/image-utils": "0.8.8-canary-20250930-9dc59d3",
51
+ "@expo/json-file": "10.0.8-canary-20250930-9dc59d3",
52
52
  "@expo/mcp-tunnel": "~0.0.7",
53
53
  "@expo/metro": "~54.0.0",
54
- "@expo/metro-config": "~54.0.5",
55
- "@expo/osascript": "^2.3.7",
56
- "@expo/package-manager": "^1.9.8",
57
- "@expo/plist": "^0.4.7",
58
- "@expo/prebuild-config": "^54.0.3",
59
- "@expo/schema-utils": "^0.1.7",
60
- "@expo/server": "^0.7.5",
54
+ "@expo/metro-config": "54.0.6-canary-20250930-9dc59d3",
55
+ "@expo/osascript": "2.3.8-canary-20250930-9dc59d3",
56
+ "@expo/package-manager": "1.9.9-canary-20250930-9dc59d3",
57
+ "@expo/plist": "0.4.8-canary-20250930-9dc59d3",
58
+ "@expo/prebuild-config": "54.0.4-canary-20250930-9dc59d3",
59
+ "@expo/schema-utils": "0.1.8-canary-20250930-9dc59d3",
60
+ "@expo/server": "1.0.0-canary-20250930-9dc59d3",
61
61
  "@expo/spawn-async": "^1.7.2",
62
62
  "@expo/ws-tunnel": "^1.0.1",
63
63
  "@expo/xcpretty": "^4.3.0",
64
- "@react-native/dev-middleware": "0.81.4",
64
+ "@react-native/dev-middleware": "0.82.0-rc.4",
65
65
  "@urql/core": "^5.0.6",
66
66
  "@urql/exchange-retry": "^1.3.0",
67
67
  "accepts": "^1.3.8",
@@ -104,7 +104,8 @@
104
104
  "terminal-link": "^2.1.1",
105
105
  "undici": "^6.18.2",
106
106
  "wrap-ansi": "^7.0.0",
107
- "ws": "^8.12.1"
107
+ "ws": "^8.12.1",
108
+ "zod": "^3.25.76"
108
109
  },
109
110
  "taskr": {
110
111
  "requires": [
@@ -112,8 +113,8 @@
112
113
  ]
113
114
  },
114
115
  "peerDependencies": {
115
- "expo": "*",
116
- "expo-router": "*",
116
+ "expo": "55.0.0-canary-20250930-9dc59d3",
117
+ "expo-router": "6.1.0-canary-20250930-9dc59d3",
117
118
  "react-native": "*"
118
119
  },
119
120
  "peerDependenciesMeta": {
@@ -156,7 +157,7 @@
156
157
  "@types/ws": "^8.5.4",
157
158
  "devtools-protocol": "^0.0.1113120",
158
159
  "expo-atlas": "^0.4.1",
159
- "expo-module-scripts": "^5.0.7",
160
+ "expo-module-scripts": "5.0.8-canary-20250930-9dc59d3",
160
161
  "find-process": "^1.4.7",
161
162
  "jest-runner-tsd": "^6.0.0",
162
163
  "klaw-sync": "^6.0.0",
@@ -168,6 +169,5 @@
168
169
  "taskr": "^1.1.0",
169
170
  "tree-kill": "^1.2.2",
170
171
  "tsd": "^0.28.1"
171
- },
172
- "gitHead": "6523053d0d997d2a21f580d2752b2f873c122038"
172
+ }
173
173
  }