@expo/cli 0.16.6 → 0.16.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 +2 -2
- package/build/src/export/embed/exportEmbedAsync.js +43 -11
- package/build/src/export/embed/exportEmbedAsync.js.map +1 -1
- package/build/src/start/platforms/android/ADBServer.js +7 -0
- package/build/src/start/platforms/android/ADBServer.js.map +1 -1
- package/build/src/start/platforms/android/adb.js +4 -3
- package/build/src/start/platforms/android/adb.js.map +1 -1
- package/build/src/start/server/metro/MetroBundlerDevServer.js +30 -18
- package/build/src/start/server/metro/MetroBundlerDevServer.js.map +1 -1
- package/build/src/start/server/metro/createServerRouteMiddleware.js +6 -0
- package/build/src/start/server/metro/createServerRouteMiddleware.js.map +1 -1
- package/build/src/start/server/metro/router.js +17 -0
- package/build/src/start/server/metro/router.js.map +1 -1
- package/build/src/start/server/metro/waitForMetroToObserveTypeScriptFile.js +1 -1
- package/build/src/start/server/metro/waitForMetroToObserveTypeScriptFile.js.map +1 -1
- package/build/src/start/server/type-generation/__typetests__/fixtures/basic.js.map +1 -1
- package/build/src/start/server/type-generation/routes.js +1 -1
- package/build/src/start/server/type-generation/routes.js.map +1 -1
- package/build/src/utils/analytics/rudderstackClient.js +2 -2
- package/build/src/utils/env.js +3 -0
- package/build/src/utils/env.js.map +1 -1
- package/package.json +2 -2
|
@@ -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 * as runtimeEnv from '@expo/env';\nimport { SerialAsset } from '@expo/metro-config/build/serializer/serializerAssets';\nimport chalk from 'chalk';\nimport { AssetData } from 'metro';\nimport fetch from 'node-fetch';\nimport path from 'path';\n\nimport { bundleApiRoute, invalidateApiRouteCache } from './bundleApiRoutes';\nimport { createRouteHandlerMiddleware } from './createServerRouteMiddleware';\nimport { ExpoRouterServerManifestV1, fetchManifest } from './fetchRouterManifest';\nimport { instantiateMetroAsync } from './instantiateMetro';\nimport { metroWatchTypeScriptFiles } from './metroWatchTypeScriptFiles';\nimport { getRouterDirectoryModuleIdWithManifest } from './router';\nimport { serializeHtmlWithAssets } from './serializeHtml';\nimport { observeAnyFileChanges, observeFileChanges } from './waitForMetroToObserveTypeScriptFile';\nimport { ExportAssetMap } from '../../../export/saveAssets';\nimport { Log } from '../../../log';\nimport getDevClientProperties from '../../../utils/analytics/getDevClientProperties';\nimport { logEventAsync } from '../../../utils/analytics/rudderstackClient';\nimport { CommandError } from '../../../utils/errors';\nimport { getFreePortAsync } from '../../../utils/port';\nimport { BundlerDevServer, BundlerStartOptions, DevServerInstance } from '../BundlerDevServer';\nimport { getStaticRenderFunctions } from '../getStaticRenderFunctions';\nimport { ContextModuleSourceMapsMiddleware } from '../middleware/ContextModuleSourceMapsMiddleware';\nimport { CreateFileMiddleware } from '../middleware/CreateFileMiddleware';\nimport { DevToolsPluginMiddleware } from '../middleware/DevToolsPluginMiddleware';\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 {\n DeepLinkHandler,\n RuntimeRedirectMiddleware,\n} from '../middleware/RuntimeRedirectMiddleware';\nimport { ServeStaticMiddleware } from '../middleware/ServeStaticMiddleware';\nimport {\n shouldEnableAsyncImports,\n createBundleUrlPath,\n getBaseUrlFromExpoConfig,\n getAsyncRoutesFromExpoConfig,\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>;\n\nexport class ForwardHtmlError extends CommandError {\n constructor(\n message: string,\n public html: string,\n public statusCode: number\n ) {\n super(message);\n }\n}\n\nconst debug = require('debug')('expo:start:server:metro') as typeof console.log;\n\n/** Default port to use for apps running in Expo Go. */\nconst EXPO_GO_METRO_PORT = 8081;\n\n/** Default port to use for apps that run in standard React Native projects or Expo Dev Clients. */\nconst DEV_CLIENT_METRO_PORT = 8081;\n\nexport class MetroBundlerDevServer extends BundlerDevServer {\n private metro: import('metro').Server | null = null;\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 mode,\n outputDir,\n prerenderManifest,\n baseUrl,\n routerRoot,\n }: {\n mode: 'development' | 'production';\n outputDir: string;\n // This does not contain the API routes info.\n prerenderManifest: ExpoRouterServerManifestV1;\n baseUrl: string;\n routerRoot: string;\n }): Promise<{ files: ExportAssetMap; manifest: ExpoRouterServerManifestV1<string> }> {\n const appDir = path.join(this.projectRoot, routerRoot);\n const manifest = await this.getExpoRouterRoutesManifestAsync({ appDir });\n\n const files: ExportAssetMap = new Map();\n\n for (const route of manifest.apiRoutes) {\n const filepath = path.join(appDir, route.file);\n const contents = await bundleApiRoute(this.projectRoot, filepath, {\n mode,\n routerRoot,\n port: this.getInstance()?.location.port,\n shouldThrow: true,\n baseUrl,\n });\n const artifactFilename = path.join(\n outputDir,\n path.relative(appDir, filepath.replace(/\\.[tj]sx?$/, '.js'))\n );\n if (contents) {\n files.set(artifactFilename, {\n contents,\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 manifest = await fetchManifest(this.projectRoot, {\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 getStaticRenderFunctionAsync({\n mode,\n minify = mode !== 'development',\n baseUrl,\n routerRoot,\n }: {\n mode: 'development' | 'production';\n minify?: boolean;\n baseUrl: string;\n routerRoot: string;\n }): Promise<{\n serverManifest: ExpoRouterServerManifestV1;\n manifest: ExpoRouterRuntimeManifest;\n renderAsync: (path: string) => Promise<string>;\n }> {\n const url = this.getDevServerUrl()!;\n\n const { getStaticContent, getManifest, getBuildTimeServerManifestAsync } =\n await getStaticRenderFunctions(this.projectRoot, url, {\n minify,\n dev: mode !== 'production',\n // Ensure the API Routes are included\n environment: 'node',\n baseUrl,\n routerRoot,\n });\n\n return {\n serverManifest: await getBuildTimeServerManifestAsync(),\n // Get routes from Expo Router.\n manifest: await getManifest({ fetchData: true, preserveApiRoutes: false }),\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 mode,\n minify = mode !== 'development',\n includeSourceMaps,\n baseUrl,\n mainModuleName,\n isExporting,\n asyncRoutes,\n routerRoot,\n }: {\n isExporting: boolean;\n mode: string;\n minify?: boolean;\n includeSourceMaps?: boolean;\n baseUrl?: string;\n mainModuleName?: string;\n asyncRoutes: boolean;\n routerRoot: string;\n }): Promise<{ artifacts: SerialAsset[]; assets?: AssetData[] }> {\n const devBundleUrlPathname = createBundleUrlPath({\n platform: 'web',\n mode,\n minify,\n environment: 'client',\n serializerOutput: 'static',\n serializerIncludeMaps: includeSourceMaps,\n mainModuleName:\n mainModuleName ?? resolveMainModuleName(this.projectRoot, { platform: 'web' }),\n lazy: shouldEnableAsyncImports(this.projectRoot),\n asyncRoutes,\n baseUrl,\n isExporting,\n routerRoot,\n });\n\n const bundleUrl = new URL(devBundleUrlPathname, this.getDevServerUrl()!);\n\n // Fetch the generated HTML from our custom Metro serializer\n const results = await fetch(bundleUrl.toString());\n\n const txt = await results.text();\n\n let data: any;\n try {\n data = JSON.parse(txt);\n } catch (error: any) {\n debug(txt);\n\n // Metro can throw this error when the initial module id cannot be resolved.\n if (!results.ok && txt.startsWith('<!DOCTYPE html>')) {\n throw new ForwardHtmlError(\n `Metro failed to bundle the project. Check the console for more information.`,\n txt,\n results.status\n );\n }\n\n Log.error(\n 'Failed to generate resources with Metro, the Metro config may not be using the correct serializer. Ensure the metro.config.js is extending the expo/metro-config and is not overriding the serializer.'\n );\n throw error;\n }\n\n // NOTE: This could potentially need more validation in the future.\n if ('artifacts' in data && Array.isArray(data.artifacts)) {\n return data;\n }\n\n if (data != null && (data.errors || data.type?.match(/.*Error$/))) {\n // {\n // type: 'InternalError',\n // errors: [],\n // message: 'Metro has encountered an error: While trying to resolve module `stylis` from file `/Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js`, the package `/Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/stylis/package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`/Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/stylis/dist/stylis.mjs`. Indeed, none of these files exist:\\n' +\n // '\\n' +\n // ' * /Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/stylis/dist/stylis.mjs(.web.ts|.ts|.web.tsx|.tsx|.web.js|.js|.web.jsx|.jsx|.web.json|.json|.web.cjs|.cjs|.web.scss|.scss|.web.sass|.sass|.web.css|.css)\\n' +\n // ' * /Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/stylis/dist/stylis.mjs/index(.web.ts|.ts|.web.tsx|.tsx|.web.js|.js|.web.jsx|.jsx|.web.json|.json|.web.cjs|.cjs|.web.scss|.scss|.web.sass|.sass|.web.css|.css): /Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/metro/src/node-haste/DependencyGraph.js (289:17)\\n' +\n // '\\n' +\n // '\\x1B[0m \\x1B[90m 287 |\\x1B[39m }\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m 288 |\\x1B[39m \\x1B[36mif\\x1B[39m (error \\x1B[36minstanceof\\x1B[39m \\x1B[33mInvalidPackageError\\x1B[39m) {\\x1B[0m\\n' +\n // '\\x1B[0m\\x1B[31m\\x1B[1m>\\x1B[22m\\x1B[39m\\x1B[90m 289 |\\x1B[39m \\x1B[36mthrow\\x1B[39m \\x1B[36mnew\\x1B[39m \\x1B[33mPackageResolutionError\\x1B[39m({\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m |\\x1B[39m \\x1B[31m\\x1B[1m^\\x1B[22m\\x1B[39m\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m 290 |\\x1B[39m packageError\\x1B[33m:\\x1B[39m error\\x1B[33m,\\x1B[39m\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m 291 |\\x1B[39m originModulePath\\x1B[33m:\\x1B[39m \\x1B[36mfrom\\x1B[39m\\x1B[33m,\\x1B[39m\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m 292 |\\x1B[39m targetModuleName\\x1B[33m:\\x1B[39m to\\x1B[33m,\\x1B[39m\\x1B[0m'\n // }\n // The Metro logger already showed this error.\n throw new Error(data.message);\n }\n\n throw new Error(\n 'Invalid resources returned from the Metro serializer. Expected array, found: ' + data\n );\n }\n\n private async getStaticPageAsync(\n pathname: string,\n {\n mode,\n minify = mode !== 'development',\n baseUrl,\n routerRoot,\n isExporting,\n asyncRoutes,\n }: {\n isExporting: boolean;\n mode: 'development' | 'production';\n minify?: boolean;\n baseUrl: string;\n asyncRoutes: boolean;\n routerRoot: string;\n }\n ) {\n const devBundleUrlPathname = createBundleUrlPath({\n platform: 'web',\n mode,\n environment: 'client',\n mainModuleName: resolveMainModuleName(this.projectRoot, { platform: 'web' }),\n lazy: shouldEnableAsyncImports(this.projectRoot),\n baseUrl,\n isExporting,\n asyncRoutes,\n routerRoot,\n });\n\n const bundleStaticHtml = async (): Promise<string> => {\n const { getStaticContent } = await getStaticRenderFunctions(\n this.projectRoot,\n this.getDevServerUrl()!,\n {\n minify: false,\n dev: mode !== 'production',\n // Ensure the API Routes are included\n environment: 'node',\n baseUrl,\n routerRoot,\n }\n );\n\n const location = new URL(pathname, this.getDevServerUrl()!);\n return await getStaticContent(location);\n };\n\n const [{ artifacts: resources }, staticHtml] = await Promise.all([\n this.getStaticResourcesAsync({ isExporting, mode, minify, baseUrl, asyncRoutes, routerRoot }),\n bundleStaticHtml(),\n ]);\n const content = serializeHtmlWithAssets({\n mode,\n resources,\n template: staticHtml,\n devBundleUrl: devBundleUrlPathname,\n baseUrl,\n });\n return {\n content,\n resources,\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 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 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, server, middleware, messageSocket } = await instantiateMetroAsync(\n this,\n parsedOptions,\n {\n isExporting: !!options.isExporting,\n }\n );\n\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 onDeepLink: getDeepLinkHandler(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 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 const { exp } = getConfig(this.projectRoot, { skipSDKVersionRequirement: true });\n const useServerRendering = ['static', 'server'].includes(exp.web?.output ?? '');\n\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 if (useServerRendering) {\n const baseUrl = getBaseUrlFromExpoConfig(exp);\n const asyncRoutes = getAsyncRoutesFromExpoConfig(exp, options.mode ?? 'development', 'web');\n const routerRoot = getRouterDirectoryModuleIdWithManifest(this.projectRoot, exp);\n const appDir = path.join(this.projectRoot, routerRoot);\n middleware.use(\n createRouteHandlerMiddleware(this.projectRoot, {\n ...options,\n appDir,\n baseUrl,\n routerRoot,\n getWebBundleUrl: manifestMiddleware.getWebBundleUrl.bind(manifestMiddleware),\n getStaticPageAsync: (pathname) => {\n return this.getStaticPageAsync(pathname, {\n isExporting: !!options.isExporting,\n mode: options.mode ?? 'development',\n minify: options.minify,\n baseUrl,\n asyncRoutes,\n routerRoot,\n });\n },\n })\n );\n\n if (exp.web?.output === 'server') {\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 observeAnyFileChanges(\n {\n metro,\n server,\n },\n () => {\n invalidateApiRouteCache();\n }\n );\n }\n } else {\n // This MUST run last since it's the fallback.\n middleware.use(\n new HistoryFallbackMiddleware(manifestMiddleware.getHandler().internal).getHandler()\n );\n }\n }\n // Extend the close method to ensure that we clean up the local info.\n const originalClose = server.close.bind(server);\n\n server.close = (callback?: (err?: Error) => void) => {\n return originalClose((err?: Error) => {\n this.instance = null;\n this.metro = null;\n callback?.(err);\n });\n };\n\n this.metro = metro;\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 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\nexport function getDeepLinkHandler(projectRoot: string): DeepLinkHandler {\n return async ({ runtime }) => {\n if (runtime === 'expo') return;\n const { exp } = getConfig(projectRoot);\n await logEventAsync('dev client start command', {\n status: 'started',\n ...getDevClientProperties(projectRoot, exp),\n });\n };\n}\n"],"names":["getDeepLinkHandler","runtimeEnv","ForwardHtmlError","CommandError","constructor","message","html","statusCode","debug","require","EXPO_GO_METRO_PORT","DEV_CLIENT_METRO_PORT","MetroBundlerDevServer","BundlerDevServer","metro","name","resolvePortAsync","options","port","devClient","Number","process","env","RCT_METRO_PORT","getFreePortAsync","exportExpoRouterApiRoutesAsync","mode","outputDir","prerenderManifest","baseUrl","routerRoot","appDir","path","join","projectRoot","manifest","getExpoRouterRoutesManifestAsync","files","Map","route","apiRoutes","filepath","file","contents","bundleApiRoute","getInstance","location","shouldThrow","artifactFilename","relative","replace","set","targetDomain","htmlRoutes","fetchManifest","asJson","getStaticRenderFunctionAsync","minify","url","getDevServerUrl","getStaticContent","getManifest","getBuildTimeServerManifestAsync","getStaticRenderFunctions","dev","environment","serverManifest","fetchData","preserveApiRoutes","renderAsync","URL","getStaticResourcesAsync","includeSourceMaps","mainModuleName","isExporting","asyncRoutes","data","devBundleUrlPathname","createBundleUrlPath","platform","serializerOutput","serializerIncludeMaps","resolveMainModuleName","lazy","shouldEnableAsyncImports","bundleUrl","results","fetch","toString","txt","text","JSON","parse","error","ok","startsWith","status","Log","Array","isArray","artifacts","errors","type","match","Error","getStaticPageAsync","pathname","bundleStaticHtml","resources","staticHtml","Promise","all","content","serializeHtmlWithAssets","template","devBundleUrl","watchEnvironmentVariables","instance","envFiles","getFiles","NODE_ENV","map","fileName","observeFileChanges","server","load","force","startImplementationAsync","urlCreator","getUrlCreator","parsedOptions","maxWorkers","resetCache","resetDevServer","EXPO_DEV_SERVER_ORIGIN","middleware","messageSocket","instantiateMetroAsync","manifestMiddleware","getManifestMiddlewareAsync","prependMiddleware","ContextModuleSourceMapsMiddleware","getHandler","use","InterstitialPageMiddleware","scheme","ReactDevToolsPageMiddleware","DevToolsPluginMiddleware","devToolsPluginManager","deepLinkMiddleware","RuntimeRedirectMiddleware","onDeepLink","getLocation","runtime","constructDevClientUrl","constructUrl","CreateFileMiddleware","isTargetingWeb","exp","getConfig","skipSDKVersionRequirement","useServerRendering","includes","web","output","ServeStaticMiddleware","FaviconMiddleware","getBaseUrlFromExpoConfig","getAsyncRoutesFromExpoConfig","getRouterDirectoryModuleIdWithManifest","createRouteHandlerMiddleware","getWebBundleUrl","bind","observeAnyFileChanges","invalidateApiRouteCache","HistoryFallbackMiddleware","internal","originalClose","close","callback","err","host","protocol","waitForTypeScriptAsync","resolve","off","metroWatchTypeScriptFiles","tsconfig","throttle","eventTypes","TypeScriptProjectPrerequisite","req","bootstrapAsync","log","chalk","red","exception","startTypeScriptServices","startTypescriptTypeGenerationAsync","getConfigModuleIds","logEventAsync","getDevClientProperties"],"mappings":"AAMA;;;;QAmlBgBA,kBAAkB,GAAlBA,kBAAkB;AAnlBR,IAAA,OAAc,WAAd,cAAc,CAAA;AAC5BC,IAAAA,UAAU,mCAAM,WAAW,EAAjB;AAEJ,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEP,IAAA,UAAY,kCAAZ,YAAY,EAAA;AACb,IAAA,KAAM,kCAAN,MAAM,EAAA;AAEiC,IAAA,gBAAmB,WAAnB,mBAAmB,CAAA;AAC9B,IAAA,4BAA+B,WAA/B,+BAA+B,CAAA;AAClB,IAAA,oBAAuB,WAAvB,uBAAuB,CAAA;AAC3C,IAAA,iBAAoB,WAApB,oBAAoB,CAAA;AAChB,IAAA,0BAA6B,WAA7B,6BAA6B,CAAA;AAChB,IAAA,OAAU,WAAV,UAAU,CAAA;AACzB,IAAA,cAAiB,WAAjB,iBAAiB,CAAA;AACC,IAAA,oCAAuC,WAAvC,uCAAuC,CAAA;AAE7E,IAAA,IAAc,WAAd,cAAc,CAAA;AACC,IAAA,uBAAiD,kCAAjD,iDAAiD,EAAA;AACtD,IAAA,kBAA4C,WAA5C,4CAA4C,CAAA;AAC7C,IAAA,OAAuB,WAAvB,uBAAuB,CAAA;AACnB,IAAA,KAAqB,WAArB,qBAAqB,CAAA;AACmB,IAAA,iBAAqB,WAArB,qBAAqB,CAAA;AACrD,IAAA,yBAA6B,WAA7B,6BAA6B,CAAA;AACpB,IAAA,kCAAiD,WAAjD,iDAAiD,CAAA;AAC9D,IAAA,qBAAoC,WAApC,oCAAoC,CAAA;AAChC,IAAA,yBAAwC,WAAxC,wCAAwC,CAAA;AAC/C,IAAA,kBAAiC,WAAjC,iCAA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O,CAAC,KAAK,CAAC,CAAC;qBAChB;iBACF;aACF,CAAC,AAAC;SACJ,CAAC,CAAC;KACJ;IAED,MAAaa,uBAAuB,GAAG;YAE3B,GAAa;QADvB,OAAOC,CAAAA,GAAAA,8BAAkC,AAIvC,CAAA,mCAJuC,CAAC;YACxC1E,MAAM,EAAE,CAAA,GAAa,GAAb,IAAI,CAACP,QAAQ,SAAQ,GAArB,KAAA,CAAqB,GAArB,GAAa,CAAEO,MAAM;YAC7B9G,KAAK,EAAE,IAAI,CAACA,KAAK;YACjBoB,WAAW,EAAE,IAAI,CAACA,WAAW;SAC9B,CAAC,CAAC;KACJ;IAED,AAAUqK,kBAAkB,GAAa;QACvC,OAAO;YAAC,mBAAmB;YAAE,qBAAqB;YAAE,oBAAoB;SAAC,CAAC;KAC3E;CACF;QA7gBY3L,qBAAqB,GAArBA,qBAAqB;AA+gB3B,SAASZ,kBAAkB,CAACkC,WAAmB,EAAmB;IACvE,OAAO,OAAO,EAAEuH,OAAO,CAAA,EAAE,GAAK;QAC5B,IAAIA,OAAO,KAAK,MAAM,EAAE,OAAO;QAC/B,MAAM,EAAEK,GAAG,CAAA,EAAE,GAAGC,CAAAA,GAAAA,OAAS,AAAa,CAAA,UAAb,CAAC7H,WAAW,CAAC,AAAC;QACvC,MAAMsK,CAAAA,GAAAA,kBAAa,AAGjB,CAAA,cAHiB,CAAC,0BAA0B,EAAE;YAC9CxG,MAAM,EAAE,SAAS;YACjB,GAAGyG,CAAAA,GAAAA,uBAAsB,AAAkB,CAAA,QAAlB,CAACvK,WAAW,EAAE4H,GAAG,CAAC;SAC5C,CAAC,CAAC;KACJ,CAAC;CACH"}
|
|
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 * as runtimeEnv from '@expo/env';\nimport { SerialAsset } from '@expo/metro-config/build/serializer/serializerAssets';\nimport chalk from 'chalk';\nimport { AssetData } from 'metro';\nimport fetch from 'node-fetch';\nimport path from 'path';\n\nimport { bundleApiRoute, invalidateApiRouteCache } from './bundleApiRoutes';\nimport { createRouteHandlerMiddleware } from './createServerRouteMiddleware';\nimport { ExpoRouterServerManifestV1, fetchManifest } from './fetchRouterManifest';\nimport { instantiateMetroAsync } from './instantiateMetro';\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 { ExportAssetMap } from '../../../export/saveAssets';\nimport { Log } from '../../../log';\nimport getDevClientProperties from '../../../utils/analytics/getDevClientProperties';\nimport { logEventAsync } from '../../../utils/analytics/rudderstackClient';\nimport { CommandError } from '../../../utils/errors';\nimport { getFreePortAsync } from '../../../utils/port';\nimport { BundlerDevServer, BundlerStartOptions, DevServerInstance } from '../BundlerDevServer';\nimport { getStaticRenderFunctions } from '../getStaticRenderFunctions';\nimport { ContextModuleSourceMapsMiddleware } from '../middleware/ContextModuleSourceMapsMiddleware';\nimport { CreateFileMiddleware } from '../middleware/CreateFileMiddleware';\nimport { DevToolsPluginMiddleware } from '../middleware/DevToolsPluginMiddleware';\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 {\n DeepLinkHandler,\n RuntimeRedirectMiddleware,\n} from '../middleware/RuntimeRedirectMiddleware';\nimport { ServeStaticMiddleware } from '../middleware/ServeStaticMiddleware';\nimport {\n shouldEnableAsyncImports,\n createBundleUrlPath,\n getBaseUrlFromExpoConfig,\n getAsyncRoutesFromExpoConfig,\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>;\n\nexport class ForwardHtmlError extends CommandError {\n constructor(\n message: string,\n public html: string,\n public statusCode: number\n ) {\n super(message);\n }\n}\n\nconst debug = require('debug')('expo:start:server:metro') as typeof console.log;\n\n/** Default port to use for apps running in Expo Go. */\nconst EXPO_GO_METRO_PORT = 8081;\n\n/** Default port to use for apps that run in standard React Native projects or Expo Dev Clients. */\nconst DEV_CLIENT_METRO_PORT = 8081;\n\nexport class MetroBundlerDevServer extends BundlerDevServer {\n private metro: import('metro').Server | null = null;\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 mode,\n outputDir,\n prerenderManifest,\n baseUrl,\n routerRoot,\n }: {\n mode: 'development' | 'production';\n outputDir: string;\n // This does not contain the API routes info.\n prerenderManifest: ExpoRouterServerManifestV1;\n baseUrl: string;\n routerRoot: string;\n }): Promise<{ files: ExportAssetMap; manifest: ExpoRouterServerManifestV1<string> }> {\n const appDir = path.join(this.projectRoot, routerRoot);\n const manifest = await this.getExpoRouterRoutesManifestAsync({ appDir });\n\n const files: ExportAssetMap = new Map();\n\n for (const route of manifest.apiRoutes) {\n const filepath = path.join(appDir, route.file);\n const contents = await bundleApiRoute(this.projectRoot, filepath, {\n mode,\n routerRoot,\n port: this.getInstance()?.location.port,\n shouldThrow: true,\n baseUrl,\n });\n const artifactFilename = path.join(\n outputDir,\n path.relative(appDir, filepath.replace(/\\.[tj]sx?$/, '.js'))\n );\n if (contents) {\n files.set(artifactFilename, {\n contents,\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 manifest = await fetchManifest(this.projectRoot, {\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 getStaticRenderFunctionAsync({\n mode,\n minify = mode !== 'development',\n baseUrl,\n routerRoot,\n }: {\n mode: 'development' | 'production';\n minify?: boolean;\n baseUrl: string;\n routerRoot: string;\n }): Promise<{\n serverManifest: ExpoRouterServerManifestV1;\n manifest: ExpoRouterRuntimeManifest;\n renderAsync: (path: string) => Promise<string>;\n }> {\n const url = this.getDevServerUrl()!;\n\n const { getStaticContent, getManifest, getBuildTimeServerManifestAsync } =\n await getStaticRenderFunctions(this.projectRoot, url, {\n minify,\n dev: mode !== 'production',\n // Ensure the API Routes are included\n environment: 'node',\n baseUrl,\n routerRoot,\n });\n\n return {\n serverManifest: await getBuildTimeServerManifestAsync(),\n // Get routes from Expo Router.\n manifest: await getManifest({ fetchData: true, preserveApiRoutes: false }),\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 mode,\n minify = mode !== 'development',\n includeSourceMaps,\n baseUrl,\n mainModuleName,\n isExporting,\n asyncRoutes,\n routerRoot,\n }: {\n isExporting: boolean;\n mode: string;\n minify?: boolean;\n includeSourceMaps?: boolean;\n baseUrl?: string;\n mainModuleName?: string;\n asyncRoutes: boolean;\n routerRoot: string;\n }): Promise<{ artifacts: SerialAsset[]; assets?: AssetData[] }> {\n const devBundleUrlPathname = createBundleUrlPath({\n platform: 'web',\n mode,\n minify,\n environment: 'client',\n serializerOutput: 'static',\n serializerIncludeMaps: includeSourceMaps,\n mainModuleName:\n mainModuleName ?? resolveMainModuleName(this.projectRoot, { platform: 'web' }),\n lazy: shouldEnableAsyncImports(this.projectRoot),\n asyncRoutes,\n baseUrl,\n isExporting,\n routerRoot,\n });\n\n const bundleUrl = new URL(devBundleUrlPathname, this.getDevServerUrl()!);\n\n // Fetch the generated HTML from our custom Metro serializer\n const results = await fetch(bundleUrl.toString());\n\n const txt = await results.text();\n\n let data: any;\n try {\n data = JSON.parse(txt);\n } catch (error: any) {\n debug(txt);\n\n // Metro can throw this error when the initial module id cannot be resolved.\n if (!results.ok && txt.startsWith('<!DOCTYPE html>')) {\n throw new ForwardHtmlError(\n `Metro failed to bundle the project. Check the console for more information.`,\n txt,\n results.status\n );\n }\n\n Log.error(\n 'Failed to generate resources with Metro, the Metro config may not be using the correct serializer. Ensure the metro.config.js is extending the expo/metro-config and is not overriding the serializer.'\n );\n throw error;\n }\n\n // NOTE: This could potentially need more validation in the future.\n if ('artifacts' in data && Array.isArray(data.artifacts)) {\n return data;\n }\n\n if (data != null && (data.errors || data.type?.match(/.*Error$/))) {\n // {\n // type: 'InternalError',\n // errors: [],\n // message: 'Metro has encountered an error: While trying to resolve module `stylis` from file `/Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js`, the package `/Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/stylis/package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`/Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/stylis/dist/stylis.mjs`. Indeed, none of these files exist:\\n' +\n // '\\n' +\n // ' * /Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/stylis/dist/stylis.mjs(.web.ts|.ts|.web.tsx|.tsx|.web.js|.js|.web.jsx|.jsx|.web.json|.json|.web.cjs|.cjs|.web.scss|.scss|.web.sass|.sass|.web.css|.css)\\n' +\n // ' * /Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/stylis/dist/stylis.mjs/index(.web.ts|.ts|.web.tsx|.tsx|.web.js|.js|.web.jsx|.jsx|.web.json|.json|.web.cjs|.cjs|.web.scss|.scss|.web.sass|.sass|.web.css|.css): /Users/evanbacon/Documents/GitHub/lab/emotion-error-test/node_modules/metro/src/node-haste/DependencyGraph.js (289:17)\\n' +\n // '\\n' +\n // '\\x1B[0m \\x1B[90m 287 |\\x1B[39m }\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m 288 |\\x1B[39m \\x1B[36mif\\x1B[39m (error \\x1B[36minstanceof\\x1B[39m \\x1B[33mInvalidPackageError\\x1B[39m) {\\x1B[0m\\n' +\n // '\\x1B[0m\\x1B[31m\\x1B[1m>\\x1B[22m\\x1B[39m\\x1B[90m 289 |\\x1B[39m \\x1B[36mthrow\\x1B[39m \\x1B[36mnew\\x1B[39m \\x1B[33mPackageResolutionError\\x1B[39m({\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m |\\x1B[39m \\x1B[31m\\x1B[1m^\\x1B[22m\\x1B[39m\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m 290 |\\x1B[39m packageError\\x1B[33m:\\x1B[39m error\\x1B[33m,\\x1B[39m\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m 291 |\\x1B[39m originModulePath\\x1B[33m:\\x1B[39m \\x1B[36mfrom\\x1B[39m\\x1B[33m,\\x1B[39m\\x1B[0m\\n' +\n // '\\x1B[0m \\x1B[90m 292 |\\x1B[39m targetModuleName\\x1B[33m:\\x1B[39m to\\x1B[33m,\\x1B[39m\\x1B[0m'\n // }\n // The Metro logger already showed this error.\n throw new Error(data.message);\n }\n\n throw new Error(\n 'Invalid resources returned from the Metro serializer. Expected array, found: ' + data\n );\n }\n\n private async getStaticPageAsync(\n pathname: string,\n {\n mode,\n minify = mode !== 'development',\n baseUrl,\n routerRoot,\n isExporting,\n asyncRoutes,\n }: {\n isExporting: boolean;\n mode: 'development' | 'production';\n minify?: boolean;\n baseUrl: string;\n asyncRoutes: boolean;\n routerRoot: string;\n }\n ) {\n const devBundleUrlPathname = createBundleUrlPath({\n platform: 'web',\n mode,\n environment: 'client',\n mainModuleName: resolveMainModuleName(this.projectRoot, { platform: 'web' }),\n lazy: shouldEnableAsyncImports(this.projectRoot),\n baseUrl,\n isExporting,\n asyncRoutes,\n routerRoot,\n });\n\n const bundleStaticHtml = async (): Promise<string> => {\n const { getStaticContent } = await getStaticRenderFunctions(\n this.projectRoot,\n this.getDevServerUrl()!,\n {\n minify: false,\n dev: mode !== 'production',\n // Ensure the API Routes are included\n environment: 'node',\n baseUrl,\n routerRoot,\n }\n );\n\n const location = new URL(pathname, this.getDevServerUrl()!);\n return await getStaticContent(location);\n };\n\n const [{ artifacts: resources }, staticHtml] = await Promise.all([\n this.getStaticResourcesAsync({ isExporting, mode, minify, baseUrl, asyncRoutes, routerRoot }),\n bundleStaticHtml(),\n ]);\n const content = serializeHtmlWithAssets({\n mode,\n resources,\n template: staticHtml,\n devBundleUrl: devBundleUrlPathname,\n baseUrl,\n });\n return {\n content,\n resources,\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 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 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, server, middleware, messageSocket } = await instantiateMetroAsync(\n this,\n parsedOptions,\n {\n isExporting: !!options.isExporting,\n }\n );\n\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 onDeepLink: getDeepLinkHandler(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 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 const config = getConfig(this.projectRoot, { skipSDKVersionRequirement: true });\n const { exp } = config;\n const useServerRendering = ['static', 'server'].includes(exp.web?.output ?? '');\n\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 if (useServerRendering) {\n const baseUrl = getBaseUrlFromExpoConfig(exp);\n const asyncRoutes = getAsyncRoutesFromExpoConfig(exp, options.mode ?? 'development', 'web');\n const routerRoot = getRouterDirectoryModuleIdWithManifest(this.projectRoot, exp);\n const appDir = path.join(this.projectRoot, routerRoot);\n middleware.use(\n createRouteHandlerMiddleware(this.projectRoot, {\n ...options,\n appDir,\n baseUrl,\n routerRoot,\n config,\n getWebBundleUrl: manifestMiddleware.getWebBundleUrl.bind(manifestMiddleware),\n getStaticPageAsync: (pathname) => {\n return this.getStaticPageAsync(pathname, {\n isExporting: !!options.isExporting,\n mode: options.mode ?? 'development',\n minify: options.minify,\n baseUrl,\n asyncRoutes,\n routerRoot,\n });\n },\n })\n );\n\n observeAnyFileChanges(\n {\n metro,\n server,\n },\n (events) => {\n if (exp.web?.output === 'server') {\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 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 } else {\n // This MUST run last since it's the fallback.\n middleware.use(\n new HistoryFallbackMiddleware(manifestMiddleware.getHandler().internal).getHandler()\n );\n }\n }\n // Extend the close method to ensure that we clean up the local info.\n const originalClose = server.close.bind(server);\n\n server.close = (callback?: (err?: Error) => void) => {\n return originalClose((err?: Error) => {\n this.instance = null;\n this.metro = null;\n callback?.(err);\n });\n };\n\n this.metro = metro;\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 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\nexport function getDeepLinkHandler(projectRoot: string): DeepLinkHandler {\n return async ({ runtime }) => {\n if (runtime === 'expo') return;\n const { exp } = getConfig(projectRoot);\n await logEventAsync('dev client start command', {\n status: 'started',\n ...getDevClientProperties(projectRoot, exp),\n });\n };\n}\n"],"names":["getDeepLinkHandler","runtimeEnv","ForwardHtmlError","CommandError","constructor","message","html","statusCode","debug","require","EXPO_GO_METRO_PORT","DEV_CLIENT_METRO_PORT","MetroBundlerDevServer","BundlerDevServer","metro","name","resolvePortAsync","options","port","devClient","Number","process","env","RCT_METRO_PORT","getFreePortAsync","exportExpoRouterApiRoutesAsync","mode","outputDir","prerenderManifest","baseUrl","routerRoot","appDir","path","join","projectRoot","manifest","getExpoRouterRoutesManifestAsync","files","Map","route","apiRoutes","filepath","file","contents","bundleApiRoute","getInstance","location","shouldThrow","artifactFilename","relative","replace","set","targetDomain","htmlRoutes","fetchManifest","asJson","getStaticRenderFunctionAsync","minify","url","getDevServerUrl","getStaticContent","getManifest","getBuildTimeServerManifestAsync","getStaticRenderFunctions","dev","environment","serverManifest","fetchData","preserveApiRoutes","renderAsync","URL","getStaticResourcesAsync","includeSourceMaps","mainModuleName","isExporting","asyncRoutes","data","devBundleUrlPathname","createBundleUrlPath","platform","serializerOutput","serializerIncludeMaps","resolveMainModuleName","lazy","shouldEnableAsyncImports","bundleUrl","results","fetch","toString","txt","text","JSON","parse","error","ok","startsWith","status","Log","Array","isArray","artifacts","errors","type","match","Error","getStaticPageAsync","pathname","bundleStaticHtml","resources","staticHtml","Promise","all","content","serializeHtmlWithAssets","template","devBundleUrl","watchEnvironmentVariables","instance","envFiles","getFiles","NODE_ENV","map","fileName","observeFileChanges","server","load","force","startImplementationAsync","urlCreator","getUrlCreator","parsedOptions","maxWorkers","resetCache","resetDevServer","EXPO_DEV_SERVER_ORIGIN","middleware","messageSocket","instantiateMetroAsync","manifestMiddleware","getManifestMiddlewareAsync","prependMiddleware","ContextModuleSourceMapsMiddleware","getHandler","use","InterstitialPageMiddleware","scheme","ReactDevToolsPageMiddleware","DevToolsPluginMiddleware","devToolsPluginManager","deepLinkMiddleware","RuntimeRedirectMiddleware","onDeepLink","getLocation","runtime","constructDevClientUrl","constructUrl","CreateFileMiddleware","isTargetingWeb","exp","config","getConfig","skipSDKVersionRequirement","useServerRendering","includes","web","output","ServeStaticMiddleware","FaviconMiddleware","getBaseUrlFromExpoConfig","getAsyncRoutesFromExpoConfig","getRouterDirectoryModuleIdWithManifest","createRouteHandlerMiddleware","getWebBundleUrl","bind","observeAnyFileChanges","events","invalidateApiRouteCache","hasWarnedAboutApiRoutes","event","metadata","filePath","isApiRouteConvention","warnInvalidWebOutput","HistoryFallbackMiddleware","internal","originalClose","close","callback","err","host","protocol","waitForTypeScriptAsync","resolve","off","metroWatchTypeScriptFiles","tsconfig","throttle","eventTypes","TypeScriptProjectPrerequisite","req","bootstrapAsync","log","chalk","red","exception","startTypeScriptServices","startTypescriptTypeGenerationAsync","getConfigModuleIds","logEventAsync","getDevClientProperties"],"mappings":"AAMA;;;;QAumBgBA,kBAAkB,GAAlBA,kBAAkB;AAvmBR,IAAA,OAAc,WAAd,cAAc,CAAA;AAC5BC,IAAAA,UAAU,mCAAM,WAAW,EAAjB;AAEJ,IAAA,MAAO,kCAAP,OAAO,EAAA;AAEP,IAAA,UAAY,kCAAZ,YAAY,EAAA;AACb,IAAA,KAAM,kCAAN,MAAM,EAAA;AAEiC,IAAA,gBAAmB,WAAnB,mBAAmB,CAAA;AAC9B,IAAA,4BAA+B,WAA/B,+BAA+B,CAAA;AAClB,IAAA,oBAAuB,WAAvB,uBAAuB,CAAA;AAC3C,IAAA,iBAAoB,WAApB,oBAAoB,CAAA;AAChB,IAAA,0BAA6B,WAA7B,6BAA6B,CAAA;AAMhE,IAAA,OAAU,WAAV,UAAU,CAAA;AACuB,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AuB,GAAG;YAE3B,GAAa;QADvB,OAAOC,CAAAA,GAAAA,8BAAkC,AAIvC,CAAA,mCAJuC,CAAC;YACxClF,MAAM,EAAE,CAAA,GAAa,GAAb,IAAI,CAACP,QAAQ,SAAQ,GAArB,KAAA,CAAqB,GAArB,GAAa,CAAEO,MAAM;YAC7B9G,KAAK,EAAE,IAAI,CAACA,KAAK;YACjBoB,WAAW,EAAE,IAAI,CAACA,WAAW;SAC9B,CAAC,CAAC;KACJ;IAED,AAAU6K,kBAAkB,GAAa;QACvC,OAAO;YAAC,mBAAmB;YAAE,qBAAqB;YAAE,oBAAoB;SAAC,CAAC;KAC3E;CACF;QA5hBYnM,qBAAqB,GAArBA,qBAAqB;AA8hB3B,SAASZ,kBAAkB,CAACkC,WAAmB,EAAmB;IACvE,OAAO,OAAO,EAAEuH,OAAO,CAAA,EAAE,GAAK;QAC5B,IAAIA,OAAO,KAAK,MAAM,EAAE,OAAO;QAC/B,MAAM,EAAEK,GAAG,CAAA,EAAE,GAAGE,CAAAA,GAAAA,OAAS,AAAa,CAAA,UAAb,CAAC9H,WAAW,CAAC,AAAC;QACvC,MAAM8K,CAAAA,GAAAA,kBAAa,AAGjB,CAAA,cAHiB,CAAC,0BAA0B,EAAE;YAC9ChH,MAAM,EAAE,SAAS;YACjB,GAAGiH,CAAAA,GAAAA,uBAAsB,AAAkB,CAAA,QAAlB,CAAC/K,WAAW,EAAE4H,GAAG,CAAC;SAC5C,CAAC,CAAC;KACJ,CAAC;CACH"}
|
|
@@ -12,6 +12,7 @@ var _metroBundlerDevServer = require("./MetroBundlerDevServer");
|
|
|
12
12
|
var _bundleApiRoutes = require("./bundleApiRoutes");
|
|
13
13
|
var _fetchRouterManifest = require("./fetchRouterManifest");
|
|
14
14
|
var _metroErrorInterface = require("./metroErrorInterface");
|
|
15
|
+
var _router = require("./router");
|
|
15
16
|
var _log = require("../../../log");
|
|
16
17
|
function _interopRequireDefault(obj) {
|
|
17
18
|
return obj && obj.__esModule ? obj : {
|
|
@@ -85,6 +86,11 @@ function createRouteHandlerMiddleware(projectRoot, options) {
|
|
|
85
86
|
});
|
|
86
87
|
},
|
|
87
88
|
async getApiRoute (route) {
|
|
89
|
+
var ref;
|
|
90
|
+
const { exp } = options.config;
|
|
91
|
+
if (((ref = exp.web) == null ? void 0 : ref.output) !== "server") {
|
|
92
|
+
(0, _router).warnInvalidWebOutput();
|
|
93
|
+
}
|
|
88
94
|
const resolvedFunctionPath = await resolveAsync(route.page, {
|
|
89
95
|
extensions: [
|
|
90
96
|
".js",
|
|
@@ -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 */\nimport { ExpoResponse } from '@expo/server';\nimport { createRequestHandler } from '@expo/server/build/vendor/http';\nimport requireString from 'require-from-string';\nimport resolve from 'resolve';\nimport { promisify } from 'util';\n\nimport { ForwardHtmlError } from './MetroBundlerDevServer';\nimport { bundleApiRoute } from './bundleApiRoutes';\nimport { fetchManifest } from './fetchRouterManifest';\nimport { getErrorOverlayHtmlAsync, logMetroError, logMetroErrorAsync } from './metroErrorInterface';\nimport { Log } from '../../../log';\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 mode?: string;\n appDir: string;\n routerRoot: string;\n port?: number;\n baseUrl: string;\n getWebBundleUrl: () => string;\n getStaticPageAsync: (pathname: string) => Promise<{ content: string }>;\n }\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 }\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 if (error instanceof ForwardHtmlError) {\n return new ExpoResponse(error.html, {\n status: error.statusCode,\n headers: {\n 'Content-Type': 'text/html',\n },\n });\n }\n\n try {\n return new ExpoResponse(\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 // Fallback error for when Expo Router is misconfigured in the project.\n return new ExpoResponse(\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 logApiRouteExecutionError(error) {\n logMetroError(projectRoot, { error });\n },\n async getApiRoute(route) {\n const resolvedFunctionPath = await resolveAsync(route.page, {\n extensions: ['.js', '.jsx', '.ts', '.tsx'],\n basedir: options.appDir,\n });\n\n const middlewareContents = await bundleApiRoute(\n projectRoot,\n resolvedFunctionPath!,\n options\n );\n if (!middlewareContents) {\n // TODO: Error handling\n return null;\n }\n\n try {\n debug(`Bundling middleware at: ${resolvedFunctionPath}`);\n return requireString(middlewareContents);\n } catch (error: any) {\n if (error instanceof Error) {\n await logMetroErrorAsync({ projectRoot, error });\n } else {\n Log.error('Failed to load middleware: ' + error);\n }\n return new ExpoResponse(\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","createRequestHandler","build","getRoutesManifest","manifest","fetchManifest","htmlRoutes","file","page","routeKeys","namedRegex","apiRoutes","notFoundRoutes","getHtml","request","content","getStaticPageAsync","url","error","ForwardHtmlError","ExpoResponse","html","status","statusCode","headers","getErrorOverlayHtmlAsync","routerRoot","staticError","message","logApiRouteExecutionError","logMetroError","getApiRoute","route","resolvedFunctionPath","extensions","basedir","appDir","middlewareContents","bundleApiRoute","requireString","Error","logMetroErrorAsync","Log"],"mappings":"AAMA;;;;
|
|
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 */\nimport type { ProjectConfig } from '@expo/config';\nimport { ExpoResponse } from '@expo/server';\nimport { createRequestHandler } from '@expo/server/build/vendor/http';\nimport requireString from 'require-from-string';\nimport resolve from 'resolve';\nimport { promisify } from 'util';\n\nimport { ForwardHtmlError } from './MetroBundlerDevServer';\nimport { bundleApiRoute } from './bundleApiRoutes';\nimport { fetchManifest } from './fetchRouterManifest';\nimport { getErrorOverlayHtmlAsync, logMetroError, logMetroErrorAsync } from './metroErrorInterface';\nimport { warnInvalidWebOutput } from './router';\nimport { Log } from '../../../log';\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 mode?: string;\n appDir: string;\n routerRoot: string;\n port?: number;\n baseUrl: string;\n getWebBundleUrl: () => string;\n getStaticPageAsync: (pathname: string) => Promise<{ content: string }>;\n config: ProjectConfig;\n }\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 }\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 if (error instanceof ForwardHtmlError) {\n return new ExpoResponse(error.html, {\n status: error.statusCode,\n headers: {\n 'Content-Type': 'text/html',\n },\n });\n }\n\n try {\n return new ExpoResponse(\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 // Fallback error for when Expo Router is misconfigured in the project.\n return new ExpoResponse(\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 logApiRouteExecutionError(error) {\n logMetroError(projectRoot, { error });\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.page, {\n extensions: ['.js', '.jsx', '.ts', '.tsx'],\n basedir: options.appDir,\n });\n\n const middlewareContents = await bundleApiRoute(\n projectRoot,\n resolvedFunctionPath!,\n options\n );\n if (!middlewareContents) {\n // TODO: Error handling\n return null;\n }\n\n try {\n debug(`Bundling middleware at: ${resolvedFunctionPath}`);\n return requireString(middlewareContents);\n } catch (error: any) {\n if (error instanceof Error) {\n await logMetroErrorAsync({ projectRoot, error });\n } else {\n Log.error('Failed to load middleware: ' + error);\n }\n return new ExpoResponse(\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","createRequestHandler","build","getRoutesManifest","manifest","fetchManifest","htmlRoutes","file","page","routeKeys","namedRegex","apiRoutes","notFoundRoutes","getHtml","request","content","getStaticPageAsync","url","error","ForwardHtmlError","ExpoResponse","html","status","statusCode","headers","getErrorOverlayHtmlAsync","routerRoot","staticError","message","logApiRouteExecutionError","logMetroError","getApiRoute","route","exp","config","web","output","warnInvalidWebOutput","resolvedFunctionPath","extensions","basedir","appDir","middlewareContents","bundleApiRoute","requireString","Error","logMetroErrorAsync","Log"],"mappings":"AAMA;;;;QAqBgBA,4BAA4B,GAA5BA,4BAA4B;AApBf,IAAA,OAAc,WAAd,cAAc,CAAA;AACN,IAAA,KAAgC,WAAhC,gCAAgC,CAAA;AAC3C,IAAA,kBAAqB,kCAArB,qBAAqB,EAAA;AAC3B,IAAA,QAAS,kCAAT,SAAS,EAAA;AACH,IAAA,KAAM,WAAN,MAAM,CAAA;AAEC,IAAA,sBAAyB,WAAzB,yBAAyB,CAAA;AAC3B,IAAA,gBAAmB,WAAnB,mBAAmB,CAAA;AACpB,IAAA,oBAAuB,WAAvB,uBAAuB,CAAA;AACuB,IAAA,oBAAuB,WAAvB,uBAAuB,CAAA;AAC9D,IAAA,OAAU,WAAV,UAAU,CAAA;AAC3B,IAAA,IAAc,WAAd,cAAc,CAAA;;;;;;AAElC,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,yBAAyB,CAAC,AAAsB,AAAC;AAEhF,MAAMC,YAAY,GAAGC,CAAAA,GAAAA,KAAS,AAAS,CAAA,UAAT,CAACC,QAAO,QAAA,CAAC,AAGZ,AAAC;AAErB,SAASL,4BAA4B,CAC1CM,WAAmB,EACnBC,OASC,EACD;IACA,OAAOC,CAAAA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,uBAAuB;gBACvB,OAAO,IAAI,CAAC;aACb;YAED,IAAI;gBACFhD,KAAK,CAAC,CAAC,wBAAwB,EAAE4C,oBAAoB,CAAC,CAAC,CAAC,CAAC;gBACzD,OAAOM,CAAAA,GAAAA,kBAAa,AAAoB,CAAA,QAApB,CAACF,kBAAkB,CAAC,CAAC;aAC1C,CAAC,OAAOxB,KAAK,EAAO;gBACnB,IAAIA,KAAK,YAAY2B,KAAK,EAAE;oBAC1B,MAAMC,CAAAA,GAAAA,oBAAkB,AAAwB,CAAA,mBAAxB,CAAC;wBAAE/C,WAAW;wBAAEmB,KAAK;qBAAE,CAAC,CAAC;iBAClD,MAAM;oBACL6B,IAAG,IAAA,CAAC7B,KAAK,CAAC,6BAA6B,GAAGA,KAAK,CAAC,CAAC;iBAClD;gBACD,OAAO,IAAIE,OAAY,aAAA,CACrB,6BAA6B,GAAGkB,oBAAoB,GAAG,MAAM,GAAGpB,KAAK,CAACU,OAAO,EAC7E;oBACEN,MAAM,EAAE,GAAG;oBACXE,OAAO,EAAE;wBACP,cAAc,EAAE,WAAW;qBAC5B;iBACF,CACF,CAAC;aACH;SACF;KACF,CACF,CAAC;CACH"}
|
|
@@ -5,8 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
exports.getAppRouterRelativeEntryPath = getAppRouterRelativeEntryPath;
|
|
6
6
|
exports.getRouterDirectoryModuleIdWithManifest = getRouterDirectoryModuleIdWithManifest;
|
|
7
7
|
exports.getRouterDirectory = getRouterDirectory;
|
|
8
|
+
exports.isApiRouteConvention = isApiRouteConvention;
|
|
8
9
|
exports.getApiRoutesForDirectory = getApiRoutesForDirectory;
|
|
9
10
|
exports.getRoutePaths = getRoutePaths;
|
|
11
|
+
exports.hasWarnedAboutApiRoutes = hasWarnedAboutApiRoutes;
|
|
12
|
+
exports.warnInvalidWebOutput = warnInvalidWebOutput;
|
|
10
13
|
var _chalk = _interopRequireDefault(require("chalk"));
|
|
11
14
|
var _glob = require("glob");
|
|
12
15
|
var _path = _interopRequireDefault(require("path"));
|
|
@@ -14,6 +17,7 @@ var _resolveFrom = _interopRequireDefault(require("resolve-from"));
|
|
|
14
17
|
var _log = require("../../../log");
|
|
15
18
|
var _dir = require("../../../utils/dir");
|
|
16
19
|
var _fn = require("../../../utils/fn");
|
|
20
|
+
var _link = require("../../../utils/link");
|
|
17
21
|
function _interopRequireDefault(obj) {
|
|
18
22
|
return obj && obj.__esModule ? obj : {
|
|
19
23
|
default: obj
|
|
@@ -56,6 +60,9 @@ function getRouterDirectory(projectRoot) {
|
|
|
56
60
|
debug("Using app as the root directory for Expo Router.");
|
|
57
61
|
return "app";
|
|
58
62
|
}
|
|
63
|
+
function isApiRouteConvention(name) {
|
|
64
|
+
return /\+api\.[tj]sx?$/.test(name);
|
|
65
|
+
}
|
|
59
66
|
function getApiRoutesForDirectory(cwd) {
|
|
60
67
|
return (0, _glob).sync("**/*+api.@(ts|tsx|js|jsx)", {
|
|
61
68
|
cwd,
|
|
@@ -71,5 +78,15 @@ function getRoutePaths(cwd) {
|
|
|
71
78
|
function normalizePaths(p) {
|
|
72
79
|
return p.replace(/\\/g, "/");
|
|
73
80
|
}
|
|
81
|
+
let hasWarnedAboutApiRouteOutput = false;
|
|
82
|
+
function hasWarnedAboutApiRoutes() {
|
|
83
|
+
return hasWarnedAboutApiRouteOutput;
|
|
84
|
+
}
|
|
85
|
+
function warnInvalidWebOutput() {
|
|
86
|
+
if (!hasWarnedAboutApiRouteOutput) {
|
|
87
|
+
_log.Log.warn(_chalk.default.yellow`Using API routes requires the {bold web.output} to be set to {bold "server"} in the project {bold app.json}. ${(0, _link).learnMore("https://docs.expo.dev/router/reference/api-routes/")}`);
|
|
88
|
+
}
|
|
89
|
+
hasWarnedAboutApiRouteOutput = true;
|
|
90
|
+
}
|
|
74
91
|
|
|
75
92
|
//# sourceMappingURL=router.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/server/metro/router.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config';\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 { memoize } from '../../../utils/fn';\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 exp.extra?.router?.root ?? getRouterDirectory(projectRoot);\n}\n\nconst logSrcDir = memoize(() =>\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 'src/app';\n }\n\n debug('Using app as the root directory for Expo Router.');\n return 'app';\n}\n\nexport function getApiRoutesForDirectory(cwd: string) {\n return globSync('**/*+api.@(ts|tsx|js|jsx)', {\n cwd,\n absolute: true,\n });\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 }).map((p) => './' + normalizePaths(p));\n}\n\nfunction normalizePaths(p: string) {\n return p.replace(/\\\\/g, '/');\n}\n"],"names":["getAppRouterRelativeEntryPath","getRouterDirectoryModuleIdWithManifest","getRouterDirectory","getApiRoutesForDirectory","getRoutePaths","debug","require","projectRoot","routerDirectory","resolveFrom","routerEntry","silent","getFallbackEntryRoot","undefined","appFolder","path","join","appRoot","relative","dirname","expoRoot","exp","extra","router","root","logSrcDir","memoize","Log","log","chalk","gray","directoryExistsSync","cwd","globSync","absolute","map","p","normalizePaths","replace"],"mappings":"AAAA;;;;
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/server/metro/router.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config';\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 { memoize } from '../../../utils/fn';\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 exp.extra?.router?.root ?? getRouterDirectory(projectRoot);\n}\n\nconst logSrcDir = memoize(() =>\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 '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 });\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 }).map((p) => './' + normalizePaths(p));\n}\n\nfunction normalizePaths(p: string) {\n return p.replace(/\\\\/g, '/');\n}\n\nlet hasWarnedAboutApiRouteOutput = false;\n\nexport function hasWarnedAboutApiRoutes() {\n return hasWarnedAboutApiRouteOutput;\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"],"names":["getAppRouterRelativeEntryPath","getRouterDirectoryModuleIdWithManifest","getRouterDirectory","isApiRouteConvention","getApiRoutesForDirectory","getRoutePaths","hasWarnedAboutApiRoutes","warnInvalidWebOutput","debug","require","projectRoot","routerDirectory","resolveFrom","routerEntry","silent","getFallbackEntryRoot","undefined","appFolder","path","join","appRoot","relative","dirname","expoRoot","exp","extra","router","root","logSrcDir","memoize","Log","log","chalk","gray","directoryExistsSync","name","test","cwd","globSync","absolute","map","p","normalizePaths","replace","hasWarnedAboutApiRouteOutput","warn","yellow","learnMore"],"mappings":"AAAA;;;;QAiBgBA,6BAA6B,GAA7BA,6BAA6B;QA0B7BC,sCAAsC,GAAtCA,sCAAsC;QAWtCC,kBAAkB,GAAlBA,kBAAkB;QAWlBC,oBAAoB,GAApBA,oBAAoB;QAIpBC,wBAAwB,GAAxBA,wBAAwB;QAQxBC,aAAa,GAAbA,aAAa;QAYbC,uBAAuB,GAAvBA,uBAAuB;QAIvBC,oBAAoB,GAApBA,oBAAoB;AA5FlB,IAAA,MAAO,kCAAP,OAAO,EAAA;AACQ,IAAA,KAAM,WAAN,MAAM,CAAA;AACtB,IAAA,KAAM,kCAAN,MAAM,EAAA;AACC,IAAA,YAAc,kCAAd,cAAc,EAAA;AAElB,IAAA,IAAc,WAAd,cAAc,CAAA;AACE,IAAA,IAAoB,WAApB,oBAAoB,CAAA;AAChC,IAAA,GAAmB,WAAnB,mBAAmB,CAAA;AACjB,IAAA,KAAqB,WAArB,qBAAqB,CAAA;;;;;;AAE/C,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,gCAAgC,CAAC,AAAsB,AAAC;AAMhF,SAAST,6BAA6B,CAC3CU,WAAmB,EACnBC,eAAuB,GAAGT,kBAAkB,CAACQ,WAAW,CAAC,EACrC;QAGlBE,GAAoD;IAFtD,sBAAsB;IACtB,MAAMC,WAAW,GACfD,CAAAA,GAAoD,GAApDA,YAAW,QAAA,CAACE,MAAM,CAACJ,WAAW,EAAE,mBAAmB,CAAC,YAApDE,GAAoD,GAAIG,oBAAo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IAAI,CACNb,MAAK,QAAA,CAACc,MAAM,CAAC,6GAA6G,EAAEC,CAAAA,GAAAA,KAAS,AAEpI,CAAA,UAFoI,CACnI,oDAAoD,CACrD,CAAC,CAAC,CACJ,CAAC;KACH;IAEDH,4BAA4B,GAAG,IAAI,CAAC;CACrC"}
|
|
@@ -70,7 +70,7 @@ function observeFileChanges(runner, files, callback) {
|
|
|
70
70
|
function observeAnyFileChanges(runner, callback) {
|
|
71
71
|
const watcher = runner.metro.getBundler().getBundler().getWatcher();
|
|
72
72
|
const listener = ({ eventsQueue })=>{
|
|
73
|
-
callback();
|
|
73
|
+
callback(eventsQueue);
|
|
74
74
|
};
|
|
75
75
|
watcher.addListener("change", listener);
|
|
76
76
|
const off = ()=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/start/server/metro/waitForMetroToObserveTypeScriptFile.ts"],"sourcesContent":["import path from 'path';\n\nimport type { ServerLike } from '../BundlerDevServer';\n\nconst debug = require('debug')('expo:start:server:metro:waitForTypescript') as typeof console.log;\n\n/**\n * Use the native file watcher / Metro ruleset to detect if a\n * TypeScript file is added to the project during development.\n */\nexport function waitForMetroToObserveTypeScriptFile(\n projectRoot: string,\n runner: {\n metro: import('metro').Server;\n server: ServerLike;\n },\n callback: () => Promise<void>\n): () => void {\n const watcher = runner.metro.getBundler().getBundler().getWatcher();\n\n const tsconfigPath = path.join(projectRoot, 'tsconfig.json');\n\n const listener = ({
|
|
1
|
+
{"version":3,"sources":["../../../../../src/start/server/metro/waitForMetroToObserveTypeScriptFile.ts"],"sourcesContent":["import path from 'path';\n\nimport type { ServerLike } from '../BundlerDevServer';\n\nconst debug = require('debug')('expo:start:server:metro:waitForTypescript') as typeof console.log;\n\nexport type FileChangeEvent = {\n filePath: string;\n metadata?: {\n type: 'f' | 'd' | 'l'; // Regular file / Directory / Symlink\n } | null;\n type: string;\n};\n\n/**\n * Use the native file watcher / Metro ruleset to detect if a\n * TypeScript file is added to the project during development.\n */\nexport function waitForMetroToObserveTypeScriptFile(\n projectRoot: string,\n runner: {\n metro: import('metro').Server;\n server: ServerLike;\n },\n callback: () => Promise<void>\n): () => void {\n const watcher = runner.metro.getBundler().getBundler().getWatcher();\n\n const tsconfigPath = path.join(projectRoot, 'tsconfig.json');\n\n const listener = ({ eventsQueue }: { eventsQueue: FileChangeEvent[] }) => {\n for (const event of eventsQueue) {\n if (\n event.type === 'add' &&\n event.metadata?.type !== 'd' &&\n // We need to ignore node_modules because Metro will add all of the files in node_modules to the watcher.\n !/node_modules/.test(event.filePath)\n ) {\n const { filePath } = event;\n // Is TypeScript?\n if (\n // If the user adds a TypeScript file to the observable files in their project.\n /\\.tsx?$/.test(filePath) ||\n // Or if the user adds a tsconfig.json file to the project root.\n filePath === tsconfigPath\n ) {\n debug('Detected TypeScript file added to the project: ', filePath);\n callback();\n off();\n return;\n }\n }\n }\n };\n\n debug('Waiting for TypeScript files to be added to the project...');\n watcher.addListener('change', listener);\n\n const off = () => {\n watcher.removeListener('change', listener);\n };\n\n runner.server.addListener?.('close', off);\n return off;\n}\n\nexport function observeFileChanges(\n runner: {\n metro: import('metro').Server;\n server: ServerLike;\n },\n files: string[],\n callback: () => void | Promise<void>\n): () => void {\n const watcher = runner.metro.getBundler().getBundler().getWatcher();\n\n const listener = ({\n eventsQueue,\n }: {\n eventsQueue: {\n filePath: string;\n metadata?: {\n type: 'f' | 'd' | 'l'; // Regular file / Directory / Symlink\n } | null;\n type: string;\n }[];\n }) => {\n for (const event of eventsQueue) {\n if (\n // event.type === 'add' &&\n event.metadata?.type !== 'd' &&\n // We need to ignore node_modules because Metro will add all of the files in node_modules to the watcher.\n !/node_modules/.test(event.filePath)\n ) {\n const { filePath } = event;\n // Is TypeScript?\n if (files.includes(filePath)) {\n debug('Observed change:', filePath);\n callback();\n return;\n }\n }\n }\n };\n\n debug('Watching file changes:', files);\n watcher.addListener('change', listener);\n\n const off = () => {\n watcher.removeListener('change', listener);\n };\n\n runner.server.addListener?.('close', off);\n return off;\n}\n\nexport function observeAnyFileChanges(\n runner: {\n metro: import('metro').Server;\n server: ServerLike;\n },\n callback: (events: FileChangeEvent[]) => void | Promise<void>\n): () => void {\n const watcher = runner.metro.getBundler().getBundler().getWatcher();\n\n const listener = ({ eventsQueue }: { eventsQueue: FileChangeEvent[] }) => {\n callback(eventsQueue);\n };\n\n watcher.addListener('change', listener);\n\n const off = () => {\n watcher.removeListener('change', listener);\n };\n\n runner.server.addListener?.('close', off);\n return off;\n}\n"],"names":["waitForMetroToObserveTypeScriptFile","observeFileChanges","observeAnyFileChanges","debug","require","projectRoot","runner","callback","watcher","metro","getBundler","getWatcher","tsconfigPath","path","join","listener","eventsQueue","event","type","metadata","test","filePath","off","addListener","removeListener","server","files","includes"],"mappings":"AAAA;;;;QAkBgBA,mCAAmC,GAAnCA,mCAAmC;QAgDnCC,kBAAkB,GAAlBA,kBAAkB;QAkDlBC,qBAAqB,GAArBA,qBAAqB;AApHpB,IAAA,KAAM,kCAAN,MAAM,EAAA;;;;;;AAIvB,MAAMC,KAAK,GAAGC,OAAO,CAAC,OAAO,CAAC,CAAC,2CAA2C,CAAC,AAAsB,AAAC;AAc3F,SAASJ,mCAAmC,CACjDK,WAAmB,EACnBC,MAGC,EACDC,QAA6B,EACjB;IACZ,MAAMC,OAAO,GAAGF,MAAM,CAACG,KAAK,CAACC,UAAU,EAAE,CAACA,UAAU,EAAE,CAACC,UAAU,EAAE,AAAC;IAEpE,MAAMC,YAAY,GAAGC,KAAI,QAAA,CAACC,IAAI,CAACT,WAAW,EAAE,eAAe,CAAC,AAAC;IAE7D,MAAMU,QAAQ,GAAG,CAAC,EAAEC,WAAW,CAAA,EAAsC,GAAK;QACxE,KAAK,MAAMC,KAAK,IAAID,WAAW,CAAE;gBAG7BC,GAAc;YAFhB,IACEA,KAAK,CAACC,IAAI,KAAK,KAAK,IACpBD,CAAAA,CAAAA,GAAc,GAAdA,KAAK,CAACE,QAAQ,SAAM,GAApBF,KAAAA,CAAoB,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AAQ,EAAET,QAAQ,CAAC,CAAC;KAC5C,AAAC;IAEFT,MAAM,CAACmB,MAAM,CAACF,WAAW,QAAgB,GAAzCjB,KAAAA,CAAyC,GAAzCA,MAAM,CAACmB,MAAM,CAACF,WAAW,CAAG,OAAO,EAAED,GAAG,CAAC,AAvI3C,CAuI4C;IAC1C,OAAOA,GAAG,CAAC;CACZ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../src/start/server/type-generation/__typetests__/fixtures/basic.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\n/* eslint-disable import/export */\n/* eslint-disable @typescript-eslint/ban-types */\n\nimport type { LinkProps as OriginalLinkProps } from 'expo-router/build/link/Link';\nimport type { Router as OriginalRouter } from 'expo-router/
|
|
1
|
+
{"version":3,"sources":["../../../../../../../src/start/server/type-generation/__typetests__/fixtures/basic.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\n/* eslint-disable import/export */\n/* eslint-disable @typescript-eslint/ban-types */\n\nimport type { LinkProps as OriginalLinkProps } from 'expo-router/build/link/Link';\nimport type { Router as OriginalRouter } from 'expo-router/build/types';\nexport * from 'expo-router/build';\n\n// prettier-ignore\ntype StaticRoutes = `/apple` | `/banana`;\n// prettier-ignore\ntype DynamicRoutes<T extends string> = `/colors/${SingleRoutePart<T>}` | `/animals/${CatchAllRoutePart<T>}` | `/mix/${SingleRoutePart<T>}/${SingleRoutePart<T>}/${CatchAllRoutePart<T>}`;\n// prettier-ignore\ntype DynamicRouteTemplate = `/colors/[color]` | `/animals/[...animal]` | `/mix/[fruit]/[color]/[...animals]`;\n\ntype RelativePathString = `./${string}` | `../${string}` | '..';\ntype AbsoluteRoute = DynamicRouteTemplate | StaticRoutes;\ntype ExternalPathString = `${string}:${string}`;\n\ntype ExpoRouterRoutes = DynamicRouteTemplate | StaticRoutes | RelativePathString;\nexport type AllRoutes = ExpoRouterRoutes | ExternalPathString;\n\n/****************\n * Route Utils *\n ****************/\n\ntype SearchOrHash = `?${string}` | `#${string}`;\ntype UnknownInputParams = Record<string, string | number | (string | number)[]>;\ntype UnknownOutputParams = Record<string, string | string[]>;\n\n/**\n * Return only the RoutePart of a string. If the string has multiple parts return never\n *\n * string | type\n * ---------|------\n * 123 | 123\n * /123/abc | never\n * 123?abc | never\n * ./123 | never\n * /123 | never\n * 123/../ | never\n */\ntype SingleRoutePart<S extends string> = S extends `${string}/${string}`\n ? never\n : S extends `${string}${SearchOrHash}`\n ? never\n : S extends ''\n ? never\n : S extends `(${string})`\n ? never\n : S extends `[${string}]`\n ? never\n : S;\n\n/**\n * Return only the CatchAll router part. If the string has search parameters or a hash return never\n */\ntype CatchAllRoutePart<S extends string> = S extends `${string}${SearchOrHash}`\n ? never\n : S extends ''\n ? never\n : S extends `${string}(${string})${string}`\n ? never\n : S extends `${string}[${string}]${string}`\n ? never\n : S;\n\n// type OptionalCatchAllRoutePart<S extends string> = S extends `${string}${SearchOrHash}` ? never : S\n\n/**\n * Return the name of a route parameter\n * '[test]' -> 'test'\n * 'test' -> never\n * '[...test]' -> '...test'\n */\ntype IsParameter<Part> = Part extends `[${infer ParamName}]` ? ParamName : never;\n\n/**\n * Return a union of all parameter names. If there are no names return never\n *\n * /[test] -> 'test'\n * /[abc]/[...def] -> 'abc'|'...def'\n */\ntype ParameterNames<Path> = Path extends `${infer PartA}/${infer PartB}`\n ? IsParameter<PartA> | ParameterNames<PartB>\n : IsParameter<Path>;\n\n/**\n * Returns all segements of a route.\n *\n * /(group)/123/abc/[id]/[...rest] -> ['(group)', '123', 'abc', '[id]', '[...rest]'\n */\ntype RouteSegments<Path> = Path extends `${infer PartA}/${infer PartB}`\n ? PartA extends '' | '.'\n ? [...RouteSegments<PartB>]\n : [PartA, ...RouteSegments<PartB>]\n : Path extends ''\n ? []\n : [Path];\n\n/**\n * Returns a Record of the routes parameters as strings and CatchAll parameters\n *\n * There are two versions, input and output, as you can input 'string | number' but\n * the output will always be 'string'\n *\n * /[id]/[...rest] -> { id: string, rest: string[] }\n * /no-params -> {}\n */\ntype InputRouteParams<Path> = {\n [Key in ParameterNames<Path> as Key extends `...${infer Name}`\n ? Name\n : Key]: Key extends `...${string}` ? (string | number)[] : string | number;\n} & UnknownInputParams;\n\ntype OutputRouteParams<Path> = {\n [Key in ParameterNames<Path> as Key extends `...${infer Name}`\n ? Name\n : Key]: Key extends `...${string}` ? string[] : string;\n} & UnknownOutputParams;\n\n/**\n * Returns the search parameters for a route.\n */\nexport type SearchParams<T extends AllRoutes> = T extends DynamicRouteTemplate\n ? OutputRouteParams<T>\n : T extends StaticRoutes\n ? never\n : UnknownOutputParams;\n\n/**\n * Route is mostly used as part of Href to ensure that a valid route is provided\n *\n * Given a dynamic route, this will return never. This is helpful for conditional logic\n *\n * /test -> /test, /test2, etc\n * /test/[abc] -> never\n * /test/resolve -> /test, /test2, etc\n *\n * Note that if we provide a value for [abc] then the route is allowed\n *\n * This is named Route to prevent confusion, as users they will often see it in tooltips\n */\nexport type Route<T> = T extends string\n ? T extends DynamicRouteTemplate\n ? never\n :\n | StaticRoutes\n | RelativePathString\n | ExternalPathString\n | (T extends `${infer P}${SearchOrHash}`\n ? P extends DynamicRoutes<infer _>\n ? T\n : never\n : T extends DynamicRoutes<infer _>\n ? T\n : never)\n : never;\n\n/*********\n * Href *\n *********/\n\nexport type Href<T> = T extends Record<'pathname', string> ? HrefObject<T> : Route<T>;\n\nexport type HrefObject<\n R extends Record<'pathname', string>,\n P = R['pathname'],\n> = P extends DynamicRouteTemplate\n ? { pathname: P; params: InputRouteParams<P> }\n : P extends Route<P>\n ? { pathname: Route<P> | DynamicRouteTemplate; params?: never | InputRouteParams<never> }\n : never;\n\n/***********************\n * Expo Router Exports *\n ***********************/\n\nexport type Router = Omit<OriginalRouter, 'push' | 'replace' | 'setParams'> & {\n /** Navigate to the provided href. */\n push: <T>(href: Href<T>) => void;\n /** Navigate to route without appending to the history. */\n replace: <T>(href: Href<T>) => void;\n /** Update the current route query params. */\n setParams: <T = ''>(params?: T extends '' ? Record<string, string> : InputRouteParams<T>) => void;\n};\n\n/** The imperative router. */\nexport declare const router: Router;\n\n/************\n * <Link /> *\n ************/\nexport interface LinkProps<T> extends OriginalLinkProps {\n href: Href<T>;\n}\n\nexport interface LinkComponent {\n <T>(props: React.PropsWithChildren<LinkProps<T>>): JSX.Element;\n /** Helper method to resolve an Href object into a string. */\n resolveHref: <T>(href: Href<T>) => string;\n}\n\n/**\n * Component to render link to another route using a path.\n * Uses an anchor tag on the web.\n *\n * @param props.href Absolute path to route (e.g. `/feeds/hot`).\n * @param props.replace Should replace the current route without adding to the history.\n * @param props.asChild Forward props to child component. Useful for custom buttons.\n * @param props.children Child elements to render the content.\n * @param props.className On web, this sets the HTML `class` directly. On native, this can be used with CSS interop tools like Nativewind.\n */\nexport declare const Link: LinkComponent;\n\n/** Redirects to the href as soon as the component is mounted. */\nexport declare const Redirect: <T>(\n props: React.PropsWithChildren<{ href: Href<T> }>\n) => JSX.Element;\n\n/************\n * Hooks *\n ************/\nexport declare function useRouter(): Router;\n\nexport declare function useLocalSearchParams<\n T extends AllRoutes | UnknownOutputParams = UnknownOutputParams,\n>(): T extends AllRoutes ? SearchParams<T> : T;\n\n/** @deprecated renamed to `useGlobalSearchParams` */\nexport declare function useSearchParams<\n T extends AllRoutes | UnknownOutputParams = UnknownOutputParams,\n>(): T extends AllRoutes ? SearchParams<T> : T;\n\nexport declare function useGlobalSearchParams<\n T extends AllRoutes | UnknownOutputParams = UnknownOutputParams,\n>(): T extends AllRoutes ? SearchParams<T> : T;\n\nexport declare function useSegments<\n T extends AbsoluteRoute | RouteSegments<AbsoluteRoute> | RelativePathString,\n>(): T extends AbsoluteRoute ? RouteSegments<T> : T extends string ? string[] : T;\n"],"names":[],"mappings":"AAIA;;;;6CAEc,mBAAmB;AAAjC,YAAA,MAAkC;;2CAAlC,MAAkC;;;;mBAAlC,MAAkC;;;EAAA"}
|
|
@@ -249,7 +249,7 @@ declare module "expo-router" {
|
|
|
249
249
|
type ExternalPathString = \`\${string}:\${string}\`;
|
|
250
250
|
|
|
251
251
|
type ExpoRouterRoutes = DynamicRouteTemplate | StaticRoutes | RelativePathString;
|
|
252
|
-
type AllRoutes = ExpoRouterRoutes | ExternalPathString;
|
|
252
|
+
export type AllRoutes = ExpoRouterRoutes | ExternalPathString;
|
|
253
253
|
|
|
254
254
|
/****************
|
|
255
255
|
* Route Utils *
|