expo-router
Version:
Expo Router is a file-based router for React Native and web applications.
23 lines (22 loc) • 1.02 kB
TypeScript
/**
* Convert a route's pathname to a loader module path.
*
* @example
* getLoaderModulePath(`/`); // `/_expo/loaders/index`
* getLoaderModulePath(`/about`) // `/_expo/loaders/about`
* getLoaderModulePath(`/posts/1`) // `/_expo/loaders/posts/1`
*/
export declare function getLoaderModulePath(routePath: string): string;
/** Bump the revision appended to loader URLs so dev fetches bypass previously cached responses. */
export declare function bumpDevLoaderRevision(): void;
/**
* Fetches and parses a loader module from the given route path.
* This works in all environments including:
* 1. Development with Metro dev server
* 2. Production with static files (SSG)
* 3. SSR environments
*
* @see import('packages/@expo/cli/src/start/server/metro/createServerRouteMiddleware.ts').createRouteHandlerMiddleware
* @see import('packages/expo-server/src/vendor/environment/common.ts').createEnvironment
*/
export declare function fetchLoader(routePath: string, requestInit?: RequestInit): Promise<any>;