first commit

This commit is contained in:
2026-03-10 16:18:05 +00:00
commit 11f9c069b5
31635 changed files with 3187747 additions and 0 deletions

9
node_modules/expo-router/build/rsc/entry.d.ts generated vendored Normal file
View File

@@ -0,0 +1,9 @@
/**
* Copyright © 2024 650 Industries.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
export declare function App(): React.JSX.Element;
//# sourceMappingURL=entry.d.ts.map

1
node_modules/expo-router/build/rsc/entry.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"entry.d.ts","sourceRoot":"","sources":["../../src/rsc/entry.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,MAAM,OAAO,CAAC;AA4C1B,wBAAgB,GAAG,sBAQlB"}

61
node_modules/expo-router/build/rsc/entry.js generated vendored Normal file
View File

@@ -0,0 +1,61 @@
"use strict";
/**
* Copyright © 2024 650 Industries.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use client';
/**
* Copyright © 2024 650 Industries.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.App = App;
const react_1 = __importDefault(require("react"));
const react_native_safe_area_context_1 = require("react-native-safe-area-context");
const client_1 = require("./router/client");
const ErrorBoundary_1 = require("../views/ErrorBoundary");
const Try_1 = require("../views/Try");
// Add root error recovery.
function RootErrorBoundary(props) {
react_1.default.useEffect(() => {
function refetchRoute() {
if (props.error) {
props.retry();
}
}
// TODO: Only strip when not connected to a dev server.
if (process.env.NODE_ENV === 'development') {
globalThis.__EXPO_RSC_RELOAD_LISTENERS__ ||= [];
const index = globalThis.__EXPO_RSC_RELOAD_LISTENERS__.indexOf(globalThis.__EXPO_REFETCH_ROUTE__);
if (index !== -1) {
globalThis.__EXPO_RSC_RELOAD_LISTENERS__.splice(index, 1, refetchRoute);
}
else {
globalThis.__EXPO_RSC_RELOAD_LISTENERS__.unshift(refetchRoute);
}
globalThis.__EXPO_REFETCH_ROUTE__ = refetchRoute;
}
}, [props.error, props.retry]);
return (<ErrorBoundary_1.ErrorBoundary error={props.error} retry={() => {
// TODO: Invalidate the cache automatically when the request fails.
// Invalidate the fetch cache so we can retry the request.
globalThis.__EXPO_REFETCH_ROUTE_NO_CACHE__?.();
return props.retry();
}}/>);
}
// Must be exported or Fast Refresh won't update the context
function App() {
return (<react_native_safe_area_context_1.SafeAreaProvider>
<Try_1.Try catch={RootErrorBoundary}>
<client_1.Router />
</Try_1.Try>
</react_native_safe_area_context_1.SafeAreaProvider>);
}
//# sourceMappingURL=entry.js.map

1
node_modules/expo-router/build/rsc/entry.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"entry.js","sourceRoot":"","sources":["../../src/rsc/entry.tsx"],"names":[],"mappings":";AAAA;;;;;GAKG;AAEH,YAAY,CAAC;AAPb;;;;;GAKG;;;;;AAgDH,kBAQC;AApDD,kDAA0B;AAC1B,mFAAkE;AAElE,4CAAyC;AACzC,0DAAuD;AACvD,sCAAuD;AAEvD,2BAA2B;AAC3B,SAAS,iBAAiB,CAAC,KAAyB;IAClD,eAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,SAAS,YAAY;YACnB,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;gBAChB,KAAK,CAAC,KAAK,EAAE,CAAC;YAChB,CAAC;QACH,CAAC;QACD,uDAAuD;QACvD,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,EAAE,CAAC;YAC3C,UAAU,CAAC,6BAA6B,KAAK,EAAE,CAAC;YAChD,MAAM,KAAK,GAAG,UAAU,CAAC,6BAA6B,CAAC,OAAO,CAC5D,UAAU,CAAC,sBAAuB,CACnC,CAAC;YACF,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;gBACjB,UAAU,CAAC,6BAA6B,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,YAAY,CAAC,CAAC;YAC1E,CAAC;iBAAM,CAAC;gBACN,UAAU,CAAC,6BAA6B,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;YACjE,CAAC;YACD,UAAU,CAAC,sBAAsB,GAAG,YAAY,CAAC;QACnD,CAAC;IACH,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IAE/B,OAAO,CACL,CAAC,6BAAa,CACZ,KAAK,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CACnB,KAAK,CAAC,CAAC,GAAG,EAAE;YACV,mEAAmE;YACnE,0DAA0D;YAC1D,UAAU,CAAC,+BAA+B,EAAE,EAAE,CAAC;YAC/C,OAAO,KAAK,CAAC,KAAK,EAAE,CAAC;QACvB,CAAC,CAAC,EACF,CACH,CAAC;AACJ,CAAC;AAED,4DAA4D;AAC5D,SAAgB,GAAG;IACjB,OAAO,CACL,CAAC,iDAAgB,CACf;MAAA,CAAC,SAAG,CAAC,KAAK,CAAC,CAAC,iBAAiB,CAAC,CAC5B;QAAA,CAAC,eAAM,CAAC,AAAD,EACT;MAAA,EAAE,SAAG,CACP;IAAA,EAAE,iDAAgB,CAAC,CACpB,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Copyright © 2024 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\n'use client';\n\nimport React from 'react';\nimport { SafeAreaProvider } from 'react-native-safe-area-context';\n\nimport { Router } from './router/client';\nimport { ErrorBoundary } from '../views/ErrorBoundary';\nimport { ErrorBoundaryProps, Try } from '../views/Try';\n\n// Add root error recovery.\nfunction RootErrorBoundary(props: ErrorBoundaryProps) {\n React.useEffect(() => {\n function refetchRoute() {\n if (props.error) {\n props.retry();\n }\n }\n // TODO: Only strip when not connected to a dev server.\n if (process.env.NODE_ENV === 'development') {\n globalThis.__EXPO_RSC_RELOAD_LISTENERS__ ||= [];\n const index = globalThis.__EXPO_RSC_RELOAD_LISTENERS__.indexOf(\n globalThis.__EXPO_REFETCH_ROUTE__!\n );\n if (index !== -1) {\n globalThis.__EXPO_RSC_RELOAD_LISTENERS__.splice(index, 1, refetchRoute);\n } else {\n globalThis.__EXPO_RSC_RELOAD_LISTENERS__.unshift(refetchRoute);\n }\n globalThis.__EXPO_REFETCH_ROUTE__ = refetchRoute;\n }\n }, [props.error, props.retry]);\n\n return (\n <ErrorBoundary\n error={props.error}\n retry={() => {\n // TODO: Invalidate the cache automatically when the request fails.\n // Invalidate the fetch cache so we can retry the request.\n globalThis.__EXPO_REFETCH_ROUTE_NO_CACHE__?.();\n return props.retry();\n }}\n />\n );\n}\n\n// Must be exported or Fast Refresh won't update the context\nexport function App() {\n return (\n <SafeAreaProvider>\n <Try catch={RootErrorBoundary}>\n <Router />\n </Try>\n </SafeAreaProvider>\n );\n}\n"]}

35
node_modules/expo-router/build/rsc/exports.d.ts generated vendored Normal file
View File

@@ -0,0 +1,35 @@
import type { Href } from '../types';
import { useRouter_UNSTABLE } from './router/client';
export { Link } from './router/client';
export declare function usePathname(): string;
export declare function useLocalSearchParams(): {
[k: string]: string;
};
export declare function useGlobalSearchParams(): {
[k: string]: string;
};
export declare function Slot(): import("react").JSX.Element;
export declare function Stack(): import("react").JSX.Element;
export declare function Tabs(): import("react").JSX.Element;
export declare function Navigator(): void;
/**
* Redirects to the `href` as soon as the component is mounted.
*/
export declare function Redirect({ href }: {
href: Href;
}): null;
export declare function ExpoRoot(): void;
export declare function useFocusEffect(): void;
export declare function useNavigation(): void;
export declare function withLayoutContext(): void;
export declare function useNavigationContainerRef(): void;
export declare function useSegments(): void;
export declare function useRootNavigation(): void;
export declare function useRootNavigationState(): void;
export declare function useUnstableGlobalHref(): void;
export { useRouter_UNSTABLE as useRouter };
export { Unmatched } from '../views/Unmatched';
export { ErrorBoundaryProps } from '../views/Try';
export { ErrorBoundary } from '../views/ErrorBoundary';
export declare const router: {};
//# sourceMappingURL=exports.d.ts.map

1
node_modules/expo-router/build/rsc/exports.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../../src/rsc/exports.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAGrD,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEvC,wBAAgB,WAAW,WAG1B;AAGD,wBAAgB,oBAAoB;;EAGnC;AAED,wBAAgB,qBAAqB;;EAGpC;AAED,wBAAgB,IAAI,gCAEnB;AAED,wBAAgB,KAAK,gCAGpB;AAED,wBAAgB,IAAI,gCAGnB;AAED,wBAAgB,SAAS,SAExB;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,QAIhD;AAED,wBAAgB,QAAQ,SAEvB;AAED,wBAAgB,cAAc,SAE7B;AAED,wBAAgB,aAAa,SAE5B;AAED,wBAAgB,iBAAiB,SAEhC;AACD,wBAAgB,yBAAyB,SAExC;AAED,wBAAgB,WAAW,SAE1B;AACD,wBAAgB,iBAAiB,SAEhC;AACD,wBAAgB,sBAAsB,SAErC;AACD,wBAAgB,qBAAqB,SAEpC;AAED,OAAO,EAAE,kBAAkB,IAAI,SAAS,EAAE,CAAC;AAG3C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,eAAO,MAAM,MAAM,IASlB,CAAC"}

100
node_modules/expo-router/build/rsc/exports.js generated vendored Normal file
View File

@@ -0,0 +1,100 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.router = exports.ErrorBoundary = exports.Unmatched = exports.useRouter = exports.Link = void 0;
exports.usePathname = usePathname;
exports.useLocalSearchParams = useLocalSearchParams;
exports.useGlobalSearchParams = useGlobalSearchParams;
exports.Slot = Slot;
exports.Stack = Stack;
exports.Tabs = Tabs;
exports.Navigator = Navigator;
exports.Redirect = Redirect;
exports.ExpoRoot = ExpoRoot;
exports.useFocusEffect = useFocusEffect;
exports.useNavigation = useNavigation;
exports.withLayoutContext = withLayoutContext;
exports.useNavigationContainerRef = useNavigationContainerRef;
exports.useSegments = useSegments;
exports.useRootNavigation = useRootNavigation;
exports.useRootNavigationState = useRootNavigationState;
exports.useUnstableGlobalHref = useUnstableGlobalHref;
const client_1 = require("./router/client");
Object.defineProperty(exports, "useRouter", { enumerable: true, get: function () { return client_1.useRouter_UNSTABLE; } });
const host_1 = require("./router/host");
var client_2 = require("./router/client");
Object.defineProperty(exports, "Link", { enumerable: true, get: function () { return client_2.Link; } });
function usePathname() {
const router = (0, client_1.useRouter_UNSTABLE)();
return router.path;
}
// TODO: This doesn't work the same as the classic version.
function useLocalSearchParams() {
const router = (0, client_1.useRouter_UNSTABLE)();
return Object.fromEntries([...new URLSearchParams(router.query).entries()]);
}
function useGlobalSearchParams() {
const router = (0, client_1.useRouter_UNSTABLE)();
return Object.fromEntries([...new URLSearchParams(router.query).entries()]);
}
function Slot() {
return <host_1.Children />;
}
function Stack() {
console.warn('Stack is not implemented in React Server Components yet');
return <host_1.Children />;
}
function Tabs() {
console.warn('Tabs is not implemented in React Server Components yet');
return <host_1.Children />;
}
function Navigator() {
throw new Error('Navigator is not implemented in React Server Components yet');
}
/**
* Redirects to the `href` as soon as the component is mounted.
*/
function Redirect({ href }) {
const router = (0, client_1.useRouter_UNSTABLE)();
router.replace(href);
return null;
}
function ExpoRoot() {
throw new Error('ExpoRoot is not implemented in React Server Components yet');
}
function useFocusEffect() {
console.warn('useFocusEffect is not implemented in React Server Components yet');
}
function useNavigation() {
console.warn('useNavigation is not implemented in React Server Components yet');
}
function withLayoutContext() {
throw new Error('withLayoutContext is not implemented in React Server Components yet');
}
function useNavigationContainerRef() {
throw new Error('useNavigationContainerRef is not implemented in React Server Components yet');
}
function useSegments() {
throw new Error('useSegments is not implemented in React Server Components yet');
}
function useRootNavigation() {
throw new Error('useRootNavigation is not implemented in React Server Components yet');
}
function useRootNavigationState() {
throw new Error('useRootNavigationState is not implemented in React Server Components yet');
}
function useUnstableGlobalHref() {
throw new Error('useUnstableGlobalHref is not implemented in React Server Components yet');
}
// Expo Router Views
var Unmatched_1 = require("../views/Unmatched");
Object.defineProperty(exports, "Unmatched", { enumerable: true, get: function () { return Unmatched_1.Unmatched; } });
var ErrorBoundary_1 = require("../views/ErrorBoundary");
Object.defineProperty(exports, "ErrorBoundary", { enumerable: true, get: function () { return ErrorBoundary_1.ErrorBoundary; } });
exports.router = new Proxy({}, {
get(target, prop, receiver) {
throw new Error(`The router object is not available in React Server Components. Use the useRouter hook instead.`);
},
});
// TODO:
// export { Redirect } from './link/Link';
//# sourceMappingURL=exports.js.map

1
node_modules/expo-router/build/rsc/exports.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

64
node_modules/expo-router/build/rsc/router/client.d.ts generated vendored Normal file
View File

@@ -0,0 +1,64 @@
/**
* Copyright © 2024 650 Industries.
* Copyright © 2024 2023 Daishi Kato
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* https://github.com/dai-shi/waku/blob/3d1cc7d714b67b142c847e879c30f0724fc457a7/packages/waku/src/router/client.ts#L1
*/
import type { ReactNode, AnchorHTMLAttributes } from 'react';
import type { RouteProps } from './common.js';
import type { Router as ClassicExpoRouterType } from '../../imperative-api';
import type { LinkProps as ClassicLinkProps, LinkComponent } from '../../link/Link.js';
import type { Href } from '../../types.js';
export declare function useRouter_UNSTABLE(): ClassicExpoRouterType & RouteProps & {
forward: () => void;
prefetch: (href: Href) => void;
};
type ShouldSkip = (readonly [
string,
readonly [
boolean,
string[]
]
])[];
type RouterData = [
shouldSkip?: ShouldSkip,
locationListeners?: Set<(path: string, query: string) => void>
];
export declare function Router({ routerData }: {
routerData?: RouterData | undefined;
}): import("react").FunctionComponentElement<Omit<{
initialInput?: string;
initialParams?: unknown;
fetchCache?: {
e?: [input: string, params: unknown, elements: Promise<Record<string, ReactNode>> & {
prev?: Record<string, ReactNode> | undefined;
}];
s?: (updater: (Promise<Record<string, ReactNode>> & {
prev?: Record<string, ReactNode> | undefined;
}) | ((prev: Promise<Record<string, ReactNode>> & {
prev?: Record<string, ReactNode> | undefined;
}) => Promise<Record<string, ReactNode>> & {
prev?: Record<string, ReactNode> | undefined;
})) => void;
o?: ((data: unknown) => void) | undefined;
};
unstable_onFetchData?: (data: unknown) => void;
children: ReactNode;
}, "children">>;
/**
* ServerRouter for SSR
* This is not a public API.
*/
export declare function ServerRouter({ children, route }: {
children: ReactNode;
route: RouteProps;
}): import("react").FunctionComponentElement<import("react").FragmentProps>;
export type LinkProps = ClassicLinkProps & {
href: string;
} & Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>;
export declare const Link: LinkComponent;
export {};
//# sourceMappingURL=client.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/rsc/router/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAmBH,OAAO,KAAK,EAGV,SAAS,EAET,oBAAoB,EAGrB,MAAM,OAAO,CAAC;AAIf,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C,OAAO,KAAK,EAAE,MAAM,IAAI,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,KAAK,EAAE,SAAS,IAAI,gBAAgB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGvF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AA+O3C,wBAAgB,kBAAkB,IAAI,qBAAqB,GACzD,UAAU,GAAG;IACX,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;CAChC,CA4FF;AAoDD,KAAK,UAAU,GAAG,CAAC,SAAS;IAC1B,MAAM;IACN,SAAS;QACP,OAAO;QACP,MAAM,EAAE;KACT;CACF,CAAC,EAAE,CAAC;AAGL,KAAK,UAAU,GAAG;IAChB,UAAU,CAAC,EAAE,UAAU;IACvB,iBAAiB,CAAC,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/D,CAAC;AAIF,wBAAgB,MAAM,CAAC,EAAE,UAAgC,EAAE;;CAAA;;;;;;;;;;;;;;;;;;gBAU1D;AAKD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,UAAU,CAAA;CAAE,2EAgB3F;AAED,MAAM,MAAM,SAAS,GAAG,gBAAgB,GAAG;IACzC,IAAI,EAAE,MAAM,CAAC;CAMd,GAAG,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC,CAAC;AAE1D,eAAO,MAAM,IAAI,EAA4C,aAAa,CAAC"}

443
node_modules/expo-router/build/rsc/router/client.js generated vendored Normal file
View File

@@ -0,0 +1,443 @@
"use strict";
/**
* Copyright © 2024 650 Industries.
* Copyright © 2024 2023 Daishi Kato
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* https://github.com/dai-shi/waku/blob/3d1cc7d714b67b142c847e879c30f0724fc457a7/packages/waku/src/router/client.ts#L1
*/
'use client';
/**
* Copyright © 2024 650 Industries.
* Copyright © 2024 2023 Daishi Kato
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* https://github.com/dai-shi/waku/blob/3d1cc7d714b67b142c847e879c30f0724fc457a7/packages/waku/src/router/client.ts#L1
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.Link = void 0;
exports.useRouter_UNSTABLE = useRouter_UNSTABLE;
exports.Router = Router;
exports.ServerRouter = ServerRouter;
const react_slot_1 = require("@radix-ui/react-slot");
const react_1 = require("react");
const react_native_1 = require("react-native");
const common_js_1 = require("./common.js");
const host_js_1 = require("./host.js");
const href_1 = require("../../link/href");
const useLinkHooks_1 = require("../../link/useLinkHooks");
const normalizeRoutePath = (path) => {
for (const suffix of ['/', '/index.html']) {
if (path.endsWith(suffix)) {
return path.slice(0, -suffix.length) || '/';
}
}
return path;
};
const parseRoute = (url) => {
if (globalThis.__EXPO_ROUTER_404__) {
return { path: '/404', query: '', hash: '' };
}
const { pathname, searchParams, hash } = url;
if (searchParams.has(common_js_1.PARAM_KEY_SKIP)) {
console.warn(`The search param "${common_js_1.PARAM_KEY_SKIP}" is reserved`);
}
return {
path: normalizeRoutePath(pathname),
query: searchParams.toString(),
hash,
};
};
const getHref = () => process.env.EXPO_OS === 'web'
? window.location.href
: // TODO: This is hardcoded on native to simplify the initial PR.
'http://localhost:8081/';
const equalRouteProps = (a, b) => {
if (a.path !== b.path) {
return false;
}
if (a.query !== b.query) {
return false;
}
return true;
};
const RouterContext = (0, react_1.createContext)(null);
const InnerRouter = ({ routerData }) => {
const refetch = (0, host_js_1.useRefetch)();
const initialRouteRef = (0, react_1.useRef)(null);
if (!initialRouteRef.current) {
initialRouteRef.current = parseRoute(new URL(getHref()));
}
const [route, setRoute] = (0, react_1.useState)(() => ({
// This is the first initialization of the route, and it has
// to ignore the hash, because on server side there is none.
// Otherwise there will be a hydration error.
// The client side route, including the hash, will be updated in the effect below.
...initialRouteRef.current,
hash: '',
}));
// Update the route post-load to include the current hash.
(0, react_1.useEffect)(() => {
const initialRoute = initialRouteRef.current;
setRoute((prev) => {
if (prev.path === initialRoute.path &&
prev.query === initialRoute.query &&
prev.hash === initialRoute.hash) {
return prev;
}
return initialRoute;
});
}, []);
const componentIds = (0, common_js_1.getComponentIds)(route.path);
// const refetchRoute = () => {
// const loc = parseRoute(new URL(getHref()));
// const input = getInputString(loc.path);
// refetch(input, loc.query);
// refetch(input, JSON.stringify({ query: route.query }));
// };
// globalThis.__EXPO_REFETCH_ROUTE_NO_CACHE__ = refetchRoute;
const [cached, setCached] = (0, react_1.useState)(() => {
return Object.fromEntries(componentIds.map((id) => [id, route]));
});
const cachedRef = (0, react_1.useRef)(cached);
(0, react_1.useEffect)(() => {
cachedRef.current = cached;
}, [cached]);
const changeRoute = (0, react_1.useCallback)((route, options) => {
const { checkCache, skipRefetch } = options || {};
(0, react_1.startTransition)(() => {
setRoute(route);
});
const componentIds = (0, common_js_1.getComponentIds)(route.path);
if (checkCache &&
componentIds.every((id) => {
const cachedLoc = cachedRef.current[id];
return cachedLoc && equalRouteProps(cachedLoc, route);
})) {
return; // everything is cached
}
const shouldSkip = routerData[0];
const skip = getSkipList(shouldSkip, componentIds, route, cachedRef.current);
if (componentIds.every((id) => skip.includes(id))) {
return; // everything is skipped
}
const input = (0, common_js_1.getInputString)(route.path);
if (!skipRefetch) {
refetch(input, JSON.stringify({ query: route.query, skip }));
}
(0, react_1.startTransition)(() => {
setCached((prev) => ({
...prev,
...Object.fromEntries(componentIds.flatMap((id) => (skip.includes(id) ? [] : [[id, route]]))),
}));
});
}, [refetch, routerData]);
const prefetchRoute = (0, react_1.useCallback)((route) => {
const componentIds = (0, common_js_1.getComponentIds)(route.path);
const shouldSkip = routerData[0];
const skip = getSkipList(shouldSkip, componentIds, route, cachedRef.current);
if (componentIds.every((id) => skip.includes(id))) {
return; // everything is cached
}
const input = (0, common_js_1.getInputString)(route.path);
(0, host_js_1.prefetchRSC)(input, JSON.stringify({ query: route.query, skip }));
globalThis.__EXPO_ROUTER_PREFETCH__?.(route.path);
}, [routerData]);
(0, react_1.useEffect)(() => {
const callback = () => {
const route = parseRoute(new URL(getHref()));
changeRoute(route, { checkCache: true });
};
if (window.addEventListener) {
window.addEventListener('popstate', callback);
return () => {
window.removeEventListener('popstate', callback);
};
}
return () => { };
}, [changeRoute]);
(0, react_1.useEffect)(() => {
const callback = (pathname, searchParamsString) => {
const url = new URL(getHref());
url.pathname = pathname;
url.search = searchParamsString;
url.hash = '';
getHistory().pushState({
...getHistory().state,
expo_new_path: url.pathname !== window.location.pathname,
}, '', url);
changeRoute(parseRoute(url), { skipRefetch: true });
};
// eslint-disable-next-line no-multi-assign
const listeners = (routerData[1] ||= new Set());
listeners.add(callback);
return () => {
listeners.delete(callback);
};
}, [changeRoute, routerData]);
(0, react_1.useEffect)(() => {
const { hash } = window.location;
const { state } = getHistory();
const element = hash && document.getElementById(hash.slice(1));
if (window.scrollTo) {
window.scrollTo({
left: 0,
top: element ? element.getBoundingClientRect().top + window.scrollY : 0,
behavior: state?.expo_new_path ? 'instant' : 'auto',
});
}
else {
// TODO: Native
// console.log('window.scrollTo is not available');
}
});
const children = componentIds.reduceRight((acc, id) => (0, react_1.createElement)(RouterSlot, { route, routerData, cachedRef, id, fallback: acc }, acc), null);
return (0, react_1.createElement)(RouterContext.Provider, { value: { route, changeRoute, prefetchRoute } }, children);
};
function getHistory() {
if (process.env.EXPO_OS === 'web') {
return window.history;
}
// Native shim
return {
pushState: () => { },
replaceState: () => { },
back: () => { },
forward: () => { },
state: {},
};
}
function useRouter_UNSTABLE() {
const router = (0, react_1.use)(RouterContext);
if (!router) {
throw new Error('Missing Router');
}
const { route, changeRoute, prefetchRoute } = router;
const push = (0, react_1.useCallback)((href, options) => {
if (options) {
// TODO(Bacon): Implement options
console.warn('options prop of router.push() is not supported in React Server Components yet');
}
const url = new URL((0, href_1.resolveHref)(href), getHref());
getHistory().pushState({
...getHistory().state,
expo_new_path: url.pathname !== window.location.pathname,
}, '', url);
changeRoute(parseRoute(url));
}, [changeRoute]);
const replace = (0, react_1.useCallback)((href, options) => {
if (options) {
// TODO(Bacon): Implement options
console.warn('options prop of router.replace() is not supported in React Server Components yet');
}
const url = new URL((0, href_1.resolveHref)(href), getHref());
getHistory().replaceState(getHistory().state, '', url);
changeRoute(parseRoute(url));
}, [changeRoute]);
const reload = (0, react_1.useCallback)(() => {
const url = new URL(getHref());
changeRoute(parseRoute(url));
}, [changeRoute]);
const back = (0, react_1.useCallback)(() => {
// FIXME is this correct?
getHistory().back();
}, []);
const forward = (0, react_1.useCallback)(() => {
// FIXME is this correct?
getHistory().forward();
}, []);
const prefetch = (0, react_1.useCallback)((href) => {
const url = new URL((0, href_1.resolveHref)(href), getHref());
prefetchRoute(parseRoute(url));
}, [prefetchRoute]);
return {
...route,
canDismiss() {
throw new Error('router.canDismiss() is not supported in React Server Components yet');
},
canGoBack() {
throw new Error('router.canGoBack() is not supported in React Server Components yet');
},
dismiss() {
throw new Error('router.dismiss() is not supported in React Server Components yet');
},
dismissTo() {
throw new Error('router.dismissTo() is not supported in React Server Components yet');
},
dismissAll() {
throw new Error('router.dismissAll() is not supported in React Server Components yet');
},
setParams() {
throw new Error('router.setParams() is not supported in React Server Components yet');
},
// TODO: The behavior here is not the same as before.
navigate: push,
push,
replace,
reload,
back,
forward,
prefetch,
};
}
const RouterSlot = ({ route, routerData, cachedRef, id, fallback, children, }) => {
// const unstable_shouldRenderPrev = (_err: unknown) => {
// const shouldSkip = routerData[0];
// const skip = getSkipList(shouldSkip, [id], route, cachedRef.current);
// return skip.length > 0;
// };
return (0, react_1.createElement)(host_js_1.Slot, { id, fallback }, children);
};
const getSkipList = (shouldSkip, componentIds, route, cached) => {
const shouldSkipObj = Object.fromEntries(shouldSkip || []);
return componentIds.filter((id) => {
const prevProps = cached[id];
if (!prevProps) {
return false;
}
const shouldCheck = shouldSkipObj[id];
if (!shouldCheck) {
return false;
}
if (shouldCheck[0] && route.path !== prevProps.path) {
return false;
}
if (shouldCheck[0] && route.query !== prevProps.query) {
return false;
}
return true;
});
};
const DEFAULT_ROUTER_DATA = [];
function Router({ routerData = DEFAULT_ROUTER_DATA }) {
const route = parseRoute(new URL(getHref()));
const initialInput = (0, common_js_1.getInputString)(route.path);
const initialParams = JSON.stringify({ query: route.query });
const unstable_onFetchData = () => { };
return (0, react_1.createElement)(host_js_1.Root, { initialInput, initialParams, unstable_onFetchData }, (0, react_1.createElement)(InnerRouter, { routerData }));
}
const notAvailableInServer = (name) => () => {
throw new Error(`${name} is not in the server`);
};
/**
* ServerRouter for SSR
* This is not a public API.
*/
function ServerRouter({ children, route }) {
return (0, react_1.createElement)(react_1.Fragment, null, (0, react_1.createElement)(RouterContext.Provider, {
value: {
route,
changeRoute: notAvailableInServer('changeRoute'),
prefetchRoute: notAvailableInServer('prefetchRoute'),
},
}, children));
}
exports.Link = (0, react_1.forwardRef)(ExpoRouterLink);
exports.Link.resolveHref = href_1.resolveHref;
function ExpoRouterLink({ href, replace, push,
// TODO: This does not prevent default on the anchor tag.
relativeToDirectory, asChild, rel, target, download,
// pending,
// notPending,
// unstable_prefetchOnEnter,
// unstable_prefetchOnView,
children, ...props }, ref) {
// Mutate the style prop to add the className on web.
const style = (0, useLinkHooks_1.useInteropClassName)(props);
// If not passing asChild, we need to forward the props to the anchor tag using React Native Web's `hrefAttrs`.
const hrefAttrs = (0, useLinkHooks_1.useHrefAttrs)({ asChild, rel, target, download });
const resolvedHref = (0, react_1.useMemo)(() => {
if (href == null) {
throw new Error('Link: href is required');
}
return (0, href_1.resolveHref)(href);
}, [href]);
const router = (0, react_1.use)(RouterContext);
const changeRoute = router
? router.changeRoute
: () => {
throw new Error('Missing Router');
};
const prefetchRoute = router
? router.prefetchRoute
: () => {
throw new Error('Missing Router');
};
// TODO: Implement support for pending states in the future.
const [, startTransition] = (0, react_1.useTransition)();
// const elementRef = useRef<HTMLAnchorElement>();
// useEffect(() => {
// if (unstable_prefetchOnView && process.env.EXPO_OS === 'web' && ref.current) {
// const observer = new IntersectionObserver(
// (entries) => {
// entries.forEach((entry) => {
// if (entry.isIntersecting) {
// const url = new URL(resolvedHref, getHref());
// if (router && url.href !== getHref()) {
// const route = parseRoute(url);
// router.prefetchRoute(route);
// }
// }
// });
// },
// { threshold: 0.1 }
// );
// observer.observe(ref.current);
// return () => {
// observer.disconnect();
// };
// }
// return () => {};
// }, [unstable_prefetchOnView, router, resolvedHref]);
const onClick = (event) => {
event.preventDefault();
const url = new URL(resolvedHref, getHref());
// TODO: Use in-memory route for native platforms.
// if (url.href !== getHref()) {
const route = parseRoute(url);
prefetchRoute(route);
startTransition(() => {
getHistory().pushState({
...getHistory().state,
expo_new_path: url.pathname !== window.location.pathname,
}, '', url);
changeRoute(route);
});
// }
props.onClick?.(event);
};
// const onMouseEnter = unstable_prefetchOnEnter
// ? (event: MouseEvent<HTMLAnchorElement>) => {
// const url = new URL(to, getHref());
// if (url.href !== getHref()) {
// const route = parseRoute(url);
// prefetchRoute(route);
// }
// props.onMouseEnter?.(event);
// }
// : props.onMouseEnter;
const Element = asChild ? react_slot_1.Slot : react_native_1.Text;
const ele = (0, react_1.createElement)(
// @ts-expect-error
Element, {
...hrefAttrs,
...props,
style,
href: resolvedHref,
onPress: onClick,
// onMouseEnter,
ref,
}, children);
// if (isPending && pending !== undefined) {
// return createElement(Fragment, null, ele, pending);
// }
// if (!isPending && notPending !== undefined) {
// return createElement(Fragment, null, ele, notPending);
// }
return ele;
}
//# sourceMappingURL=client.js.map

File diff suppressed because one or more lines are too long

26
node_modules/expo-router/build/rsc/router/common.d.ts generated vendored Normal file
View File

@@ -0,0 +1,26 @@
/**
* Copyright © 2024 650 Industries.
* Copyright © 2024 2023 Daishi Kato
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
export type RouteProps = {
path: string;
query: string;
hash: string;
};
export declare function getComponentIds(path: string): readonly string[];
export declare function getInputString(path: string): string;
export declare function parseInputString(input: string): string;
export declare const PARAM_KEY_SKIP = "expo_router_skip";
export declare const SHOULD_SKIP_ID = "/SHOULD_SKIP";
export declare const LOCATION_ID = "/LOCATION";
export type ShouldSkip = (readonly [
componentId: string,
components: readonly [
path?: boolean,
keys?: string[]
]
])[];
//# sourceMappingURL=common.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/rsc/router/common.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAS/D;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKnD;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED,eAAO,MAAM,cAAc,qBAAqB,CAAC;AAGjD,eAAO,MAAM,cAAc,iBAAiB,CAAC;AAG7C,eAAO,MAAM,WAAW,cAAc,CAAC;AAGvC,MAAM,MAAM,UAAU,GAAG,CAAC,SAAS;IACjC,WAAW,EAAE,MAAM;IACnB,UAAU,EAAE,SAAS;QACnB,IAAI,CAAC,EAAE,OAAO;QACd,IAAI,CAAC,EAAE,MAAM,EAAE;KAChB;CACF,CAAC,EAAE,CAAC"}

38
node_modules/expo-router/build/rsc/router/common.js generated vendored Normal file
View File

@@ -0,0 +1,38 @@
"use strict";
/**
* Copyright © 2024 650 Industries.
* Copyright © 2024 2023 Daishi Kato
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.LOCATION_ID = exports.SHOULD_SKIP_ID = exports.PARAM_KEY_SKIP = void 0;
exports.getComponentIds = getComponentIds;
exports.getInputString = getInputString;
exports.parseInputString = parseInputString;
function getComponentIds(path) {
const pathItems = path.split('/').filter(Boolean);
const idSet = new Set();
for (let index = 0; index <= pathItems.length; ++index) {
const id = [...pathItems.slice(0, index), 'layout'].join('/');
idSet.add(id);
}
idSet.add([...pathItems, 'page'].join('/'));
return Array.from(idSet);
}
function getInputString(path) {
if (!path.startsWith('/')) {
throw new Error('Path should start with `/`');
}
return path.slice(1);
}
function parseInputString(input) {
return '/' + input;
}
exports.PARAM_KEY_SKIP = 'expo_router_skip';
// It starts with "/" to avoid conflicing with normal component ids.
exports.SHOULD_SKIP_ID = '/SHOULD_SKIP';
// It starts with "/" to avoid conflicting with normal component ids.
exports.LOCATION_ID = '/LOCATION';
//# sourceMappingURL=common.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/rsc/router/common.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAQH,0CASC;AAED,wCAKC;AAED,4CAEC;AApBD,SAAgB,eAAe,CAAC,IAAY;IAC1C,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAClD,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;IAChC,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,IAAI,SAAS,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,CAAC;QACvD,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC9D,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,CAAC;IACD,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5C,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC3B,CAAC;AAED,SAAgB,cAAc,CAAC,IAAY;IACzC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;IAChD,CAAC;IACD,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACvB,CAAC;AAED,SAAgB,gBAAgB,CAAC,KAAa;IAC5C,OAAO,GAAG,GAAG,KAAK,CAAC;AACrB,CAAC;AAEY,QAAA,cAAc,GAAG,kBAAkB,CAAC;AAEjD,oEAAoE;AACvD,QAAA,cAAc,GAAG,cAAc,CAAC;AAE7C,qEAAqE;AACxD,QAAA,WAAW,GAAG,WAAW,CAAC","sourcesContent":["/**\n * Copyright © 2024 650 Industries.\n * Copyright © 2024 2023 Daishi Kato\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\nexport type RouteProps = {\n path: string;\n query: string;\n hash: string;\n};\n\nexport function getComponentIds(path: string): readonly string[] {\n const pathItems = path.split('/').filter(Boolean);\n const idSet = new Set<string>();\n for (let index = 0; index <= pathItems.length; ++index) {\n const id = [...pathItems.slice(0, index), 'layout'].join('/');\n idSet.add(id);\n }\n idSet.add([...pathItems, 'page'].join('/'));\n return Array.from(idSet);\n}\n\nexport function getInputString(path: string): string {\n if (!path.startsWith('/')) {\n throw new Error('Path should start with `/`');\n }\n return path.slice(1);\n}\n\nexport function parseInputString(input: string): string {\n return '/' + input;\n}\n\nexport const PARAM_KEY_SKIP = 'expo_router_skip';\n\n// It starts with \"/\" to avoid conflicing with normal component ids.\nexport const SHOULD_SKIP_ID = '/SHOULD_SKIP';\n\n// It starts with \"/\" to avoid conflicting with normal component ids.\nexport const LOCATION_ID = '/LOCATION';\n\n// TODO revisit shouldSkip API\nexport type ShouldSkip = (readonly [\n componentId: string,\n components: readonly [\n path?: boolean, // if we compare path\n keys?: string[], // searchParams keys to compare\n ],\n])[];\n"]}

29
node_modules/expo-router/build/rsc/router/errors.d.ts generated vendored Normal file
View File

@@ -0,0 +1,29 @@
/**
* Copyright © 2024 650 Industries.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
export declare class MetroServerError extends Error {
url: string;
code: string;
constructor(errorObject: {
message: string;
} & Record<string, any>, url: string);
}
export declare class ReactServerError extends Error {
url: string;
statusCode: number;
/** Response headers from the server. */
headers: Headers;
code: string;
constructor(message: string, url: string, statusCode: number,
/** Response headers from the server. */
headers: Headers);
}
export declare class NetworkError extends Error {
url: string;
code: string;
constructor(message: string, url: string);
}
//# sourceMappingURL=errors.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/rsc/router/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,qBAAa,gBAAiB,SAAQ,KAAK;IAKhC,GAAG,EAAE,MAAM;IAJpB,IAAI,SAAwB;gBAG1B,WAAW,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC/C,GAAG,EAAE,MAAM;CASrB;AAED,qBAAa,gBAAiB,SAAQ,KAAK;IAKhC,GAAG,EAAE,MAAM;IACX,UAAU,EAAE,MAAM;IACzB,wCAAwC;IACjC,OAAO,EAAE,OAAO;IAPzB,IAAI,SAAwB;gBAG1B,OAAO,EAAE,MAAM,EACR,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,MAAM;IACzB,wCAAwC;IACjC,OAAO,EAAE,OAAO;CAK1B;AAED,qBAAa,YAAa,SAAQ,KAAK;IAK5B,GAAG,EAAE,MAAM;IAJpB,IAAI,SAAmB;gBAGrB,OAAO,EAAE,MAAM,EACR,GAAG,EAAE,MAAM;CAKrB"}

49
node_modules/expo-router/build/rsc/router/errors.js generated vendored Normal file
View File

@@ -0,0 +1,49 @@
"use strict";
/**
* Copyright © 2024 650 Industries.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.NetworkError = exports.ReactServerError = exports.MetroServerError = void 0;
class MetroServerError extends Error {
url;
code = 'METRO_SERVER_ERROR';
constructor(errorObject, url) {
super(errorObject.message);
this.url = url;
this.name = 'MetroServerError';
for (const key in errorObject) {
this[key] = errorObject[key];
}
}
}
exports.MetroServerError = MetroServerError;
class ReactServerError extends Error {
url;
statusCode;
headers;
code = 'REACT_SERVER_ERROR';
constructor(message, url, statusCode,
/** Response headers from the server. */
headers) {
super(message);
this.url = url;
this.statusCode = statusCode;
this.headers = headers;
this.name = 'ReactServerError';
}
}
exports.ReactServerError = ReactServerError;
class NetworkError extends Error {
url;
code = 'NETWORK_ERROR';
constructor(message, url) {
super(message);
this.url = url;
this.name = 'NetworkError';
}
}
exports.NetworkError = NetworkError;
//# sourceMappingURL=errors.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/rsc/router/errors.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,MAAa,gBAAiB,SAAQ,KAAK;IAKhC;IAJT,IAAI,GAAG,oBAAoB,CAAC;IAE5B,YACE,WAAsD,EAC/C,GAAW;QAElB,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QAFpB,QAAG,GAAH,GAAG,CAAQ;QAGlB,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;QAE/B,KAAK,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;YAC7B,IAAY,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;QACxC,CAAC;IACH,CAAC;CACF;AAdD,4CAcC;AAED,MAAa,gBAAiB,SAAQ,KAAK;IAKhC;IACA;IAEA;IAPT,IAAI,GAAG,oBAAoB,CAAC;IAE5B,YACE,OAAe,EACR,GAAW,EACX,UAAkB;IACzB,wCAAwC;IACjC,OAAgB;QAEvB,KAAK,CAAC,OAAO,CAAC,CAAC;QALR,QAAG,GAAH,GAAG,CAAQ;QACX,eAAU,GAAV,UAAU,CAAQ;QAElB,YAAO,GAAP,OAAO,CAAS;QAGvB,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;IACjC,CAAC;CACF;AAbD,4CAaC;AAED,MAAa,YAAa,SAAQ,KAAK;IAK5B;IAJT,IAAI,GAAG,eAAe,CAAC;IAEvB,YACE,OAAe,EACR,GAAW;QAElB,KAAK,CAAC,OAAO,CAAC,CAAC;QAFR,QAAG,GAAH,GAAG,CAAQ;QAGlB,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF;AAVD,oCAUC","sourcesContent":["/**\n * Copyright © 2024 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\nexport class MetroServerError extends Error {\n code = 'METRO_SERVER_ERROR';\n\n constructor(\n errorObject: { message: string } & Record<string, any>,\n public url: string\n ) {\n super(errorObject.message);\n this.name = 'MetroServerError';\n\n for (const key in errorObject) {\n (this as any)[key] = errorObject[key];\n }\n }\n}\n\nexport class ReactServerError extends Error {\n code = 'REACT_SERVER_ERROR';\n\n constructor(\n message: string,\n public url: string,\n public statusCode: number,\n /** Response headers from the server. */\n public headers: Headers\n ) {\n super(message);\n this.name = 'ReactServerError';\n }\n}\n\nexport class NetworkError extends Error {\n code = 'NETWORK_ERROR';\n\n constructor(\n message: string,\n public url: string\n ) {\n super(message);\n this.name = 'NetworkError';\n }\n}\n"]}

3
node_modules/expo-router/build/rsc/router/fetch.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import { type FetchRequestInit } from 'expo/fetch';
export declare function fetch(input: string, init?: FetchRequestInit): Promise<import("expo/build/winter/fetch/FetchResponse").FetchResponse>;
//# sourceMappingURL=fetch.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../src/rsc/router/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAI3E,wBAAsB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,gBAAgB,0EAejE"}

19
node_modules/expo-router/build/rsc/router/fetch.js generated vendored Normal file
View File

@@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.fetch = fetch;
const fetch_1 = require("expo/fetch");
const errors_1 = require("./errors");
async function fetch(input, init) {
try {
return await (0, fetch_1.fetch)(input, init);
}
catch (error) {
if (error instanceof Error) {
if (error.message.match(/(Network request failed|fetch failed): (The network connection was lost|Could not connect to the server)/)) {
throw new errors_1.NetworkError(error.message, input);
}
}
throw error;
}
}
//# sourceMappingURL=fetch.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../../src/rsc/router/fetch.ts"],"names":[],"mappings":";;AAIA,sBAeC;AAnBD,sCAA2E;AAE3E,qCAAwC;AAEjC,KAAK,UAAU,KAAK,CAAC,KAAa,EAAE,IAAuB;IAChE,IAAI,CAAC;QACH,OAAO,MAAM,IAAA,aAAa,EAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAC1C,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YAC3B,IACE,KAAK,CAAC,OAAO,CAAC,KAAK,CACjB,0GAA0G,CAC3G,EACD,CAAC;gBACD,MAAM,IAAI,qBAAY,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;YAC/C,CAAC;QACH,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC","sourcesContent":["import { fetch as upstreamFetch, type FetchRequestInit } from 'expo/fetch';\n\nimport { NetworkError } from './errors';\n\nexport async function fetch(input: string, init?: FetchRequestInit) {\n try {\n return await upstreamFetch(input, init);\n } catch (error: any) {\n if (error instanceof Error) {\n if (\n error.message.match(\n /(Network request failed|fetch failed): (The network connection was lost|Could not connect to the server)/\n )\n ) {\n throw new NetworkError(error.message, input);\n }\n }\n throw error;\n }\n}\n"]}

View File

@@ -0,0 +1,2 @@
export declare const fetch: typeof globalThis.fetch;
//# sourceMappingURL=fetch.web.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"fetch.web.d.ts","sourceRoot":"","sources":["../../../src/rsc/router/fetch.web.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,yBAAmB,CAAC"}

View File

@@ -0,0 +1,5 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.fetch = void 0;
exports.fetch = globalThis.fetch;
//# sourceMappingURL=fetch.web.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"fetch.web.js","sourceRoot":"","sources":["../../../src/rsc/router/fetch.web.ts"],"names":[],"mappings":";;;AAAa,QAAA,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC","sourcesContent":["export const fetch = globalThis.fetch;\n"]}

54
node_modules/expo-router/build/rsc/router/host.d.ts generated vendored Normal file
View File

@@ -0,0 +1,54 @@
/**
* Copyright © 2024 650 Industries.
* Copyright © 2024 2023 Daishi Kato
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* https://github.com/dai-shi/waku/blob/32d52242c1450b5f5965860e671ff73c42da8bd0/packages/waku/src/client.ts#L1
*/
import type { ReactNode } from 'react';
type OnFetchData = (data: unknown) => void;
type SetElements = (updater: Elements | ((prev: Elements) => Elements)) => void;
declare const ENTRY = "e";
declare const SET_ELEMENTS = "s";
declare const ON_FETCH_DATA = "o";
type FetchCache = {
[ENTRY]?: [input: string, params: unknown, elements: Elements];
[SET_ELEMENTS]?: SetElements;
[ON_FETCH_DATA]?: OnFetchData | undefined;
};
type Elements = Promise<Record<string, ReactNode>> & {
prev?: Record<string, ReactNode> | undefined;
};
/**
* callServer callback
* This is not a public API.
*/
export declare const callServerRSC: (actionId: string, args?: unknown[], fetchCache?: FetchCache) => Promise<import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | (string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined)>;
export declare const fetchRSC: (input: string, params?: unknown, fetchCache?: FetchCache) => Elements;
export declare const prefetchRSC: (input: string, params?: unknown) => void;
export declare const Root: ({ initialInput, initialParams, fetchCache, unstable_onFetchData, children, }: {
initialInput?: string;
initialParams?: unknown;
fetchCache?: FetchCache;
unstable_onFetchData?: (data: unknown) => void;
children: ReactNode;
}) => import("react").FunctionComponentElement<import("react").ProviderProps<(input: string, searchParams?: URLSearchParams | string) => void>>;
export declare const useRefetch: () => (input: string, searchParams?: URLSearchParams | string) => void;
export declare const Slot: ({ id, children, fallback, }: {
id: string;
children?: ReactNode;
fallback?: ReactNode;
}) => string | number | bigint | true | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react").FunctionComponentElement<import("react").ProviderProps<ReactNode>>;
export declare const Children: () => ReactNode;
/**
* ServerRoot for SSR
* This is not a public API.
*/
export declare const ServerRoot: ({ elements, children }: {
elements: Elements;
children: ReactNode;
}) => import("react").FunctionComponentElement<import("react").ProviderProps<Elements | null>>;
export {};
//# sourceMappingURL=host.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../../../src/rsc/router/host.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAgBH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAiFvC,KAAK,WAAW,GAAG,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;AAC3C,KAAK,WAAW,GAAG,CAAC,OAAO,EAAE,QAAQ,GAAG,CAAC,CAAC,IAAI,EAAE,QAAQ,KAAK,QAAQ,CAAC,KAAK,IAAI,CAAC;AAIhF,QAAA,MAAM,KAAK,MAAM,CAAC;AAClB,QAAA,MAAM,YAAY,MAAM,CAAC;AACzB,QAAA,MAAM,aAAa,MAAM,CAAC;AAE1B,KAAK,UAAU,GAAG;IAChB,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC/D,CAAC,YAAY,CAAC,CAAC,EAAE,WAAW,CAAC;IAC7B,CAAC,aAAa,CAAC,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;CAC3C,CAAC;AAqEF,KAAK,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,GAAG;IACnD,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,SAAS,CAAC;CAC9C,CAAC;AAmCF;;;GAGG;AACH,eAAO,MAAM,aAAa,GACxB,UAAU,MAAM,EAChB,OAAO,OAAO,EAAE,EAChB,uBAA8B,yUAkB/B,CAAC;AAyBF,eAAO,MAAM,QAAQ,GACnB,OAAO,MAAM,EACb,SAAS,OAAO,EAChB,uBAA8B,KAC7B,QA4CF,CAAC;AAqBF,eAAO,MAAM,WAAW,GAAI,OAAO,MAAM,EAAE,SAAS,OAAO,KAAG,IAQ7D,CAAC;AASF,eAAO,MAAM,IAAI,GAAI,8EAOlB;IACD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,oBAAoB,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAC/C,QAAQ,EAAE,SAAS,CAAC;CACrB,oFAnBS,MAAM,iBAAiB,eAAe,GAAG,MAAM,KAAK,IAAI,EA2CjE,CAAC;AAEF,eAAO,MAAM,UAAU,gBA7Cb,MAAM,iBAAiB,eAAe,GAAG,MAAM,KAAK,IA6CX,CAAC;AAKpD,eAAO,MAAM,IAAI,GAAI,6BAIlB;IACD,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,8bAaA,CAAC;AAEF,eAAO,MAAM,QAAQ,iBAA6B,CAAC;AAEnD;;;GAGG;AACH,eAAO,MAAM,UAAU,GAAI,wBAAwB;IAAE,QAAQ,EAAE,QAAQ,CAAC;IAAC,QAAQ,EAAE,SAAS,CAAA;CAAE,6FACtB,CAAC"}

305
node_modules/expo-router/build/rsc/router/host.js generated vendored Normal file
View File

@@ -0,0 +1,305 @@
"use strict";
/**
* Copyright © 2024 650 Industries.
* Copyright © 2024 2023 Daishi Kato
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* https://github.com/dai-shi/waku/blob/32d52242c1450b5f5965860e671ff73c42da8bd0/packages/waku/src/client.ts#L1
*/
//// <reference types="react/canary" />
'use client';
/**
* Copyright © 2024 650 Industries.
* Copyright © 2024 2023 Daishi Kato
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* https://github.com/dai-shi/waku/blob/32d52242c1450b5f5965860e671ff73c42da8bd0/packages/waku/src/client.ts#L1
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ServerRoot = exports.Children = exports.Slot = exports.useRefetch = exports.Root = exports.prefetchRSC = exports.fetchRSC = exports.callServerRSC = void 0;
const expo_constants_1 = __importDefault(require("expo-constants"));
const react_1 = require("react");
const client_1 = __importDefault(require("react-server-dom-webpack/client"));
const errors_1 = require("./errors");
const fetch_1 = require("./fetch");
const utils_1 = require("./utils");
const getDevServer_1 = require("../../getDevServer");
const url_1 = require("../../head/url");
const { createFromFetch, encodeReply } = client_1.default;
// TODO: Maybe this could be a bundler global instead.
const IS_DOM =
// @ts-expect-error: Added via expo/dom
typeof $$EXPO_INITIAL_PROPS !== 'undefined';
// NOTE: Ensured to start with `/`.
const RSC_PATH = '/_flight/' + process.env.EXPO_OS; // process.env.EXPO_RSC_PATH;
// Using base URL for remote hosts isn't currently supported in DOM components as we use it for offline assets.
const BASE_URL = IS_DOM ? '' : process.env.EXPO_BASE_URL;
let BASE_PATH = `${BASE_URL}${RSC_PATH}`;
if (!BASE_PATH.startsWith('/')) {
BASE_PATH = '/' + BASE_PATH;
}
if (!BASE_PATH.endsWith('/')) {
BASE_PATH += '/';
}
if (BASE_PATH === '/') {
throw new Error(`Invalid React Flight path "${BASE_PATH}". The path should not live at the project root, e.g. /_flight/. Dev server URL: ${(0, getDevServer_1.getDevServer)().fullBundleUrl}`);
}
if (process.env.EXPO_OS !== 'web' && !window.location?.href) {
// This will require a rebuild in bare-workflow to update.
const manifest = expo_constants_1.default.expoConfig;
const originFromConstants = manifest?.extra?.router?.origin ?? manifest?.extra?.router?.generatedOrigin;
// In legacy cases, this can be extraneously set to false since it was the default before we had a production hosting solution for native servers.
if (originFromConstants === false) {
const isExpoGo = typeof expo !== 'undefined' && globalThis.expo?.modules?.ExpoGo;
if (isExpoGo) {
// Updating is a bit easier in Expo Go as you don't need a native rebuild.
throw new Error('The "origin" property in the app config (app.json) cannot be false when React Server Components is enabled. https://docs.expo.dev/guides/server-components/');
}
// Add more context about updating the app.json in development builds.
throw new Error('The "origin" property in the app config (app.json) cannot be "false" when React Server Components is enabled. Remove the "origin" property from your Expo config and rebuild the native app to resolve. https://docs.expo.dev/guides/server-components/');
}
// This can happen if the user attempts to use React Server Components without
// enabling the flags in the app.json. This will set origin to false and prevent the expo/metro-runtime polyfill from running.
throw new Error('window.location.href is not defined. This is required for React Server Components to work correctly. Ensure React Server Components is correctly enabled in your project and config. https://docs.expo.dev/guides/server-components/');
}
const RSC_CONTENT_TYPE = 'text/x-component';
const ENTRY = 'e';
const SET_ELEMENTS = 's';
const ON_FETCH_DATA = 'o';
const defaultFetchCache = {};
const NO_CACHE_HEADERS = process.env.EXPO_OS === 'web'
? {}
: // These are needed for iOS + Prod to get updates after the first request.
{
'Cache-Control': 'no-cache',
Pragma: 'no-cache',
Expires: '0',
};
const ACTION_HEADERS = {
...NO_CACHE_HEADERS,
accept: RSC_CONTENT_TYPE,
'expo-platform': process.env.EXPO_OS,
};
const checkStatus = async (responsePromise) => {
// TODO: Combine with metro async fetch logic.
const response = await responsePromise;
if (!response.ok) {
// NOTE(EvanBacon): Transform the Metro development error into a JS error that can be used by LogBox.
// This was tested against using a Class component in a server component.
if (__DEV__ && (response.status === 500 || response.status === 404)) {
const errorText = await response.text();
let errorJson;
try {
errorJson = JSON.parse(errorText);
}
catch {
// `Unable to resolve module` error should respond as JSON from the dev server and sent to the master red box, this can get corrupt when it's returned as the formatted string.
if (errorText.startsWith('Unable to resolve module')) {
console.error('Unexpected Metro error format from dev server');
// This is an unexpected state that occurs when the dev server renderer does not throw Metro errors in the expected JSON format.
throw new Error(errorJson);
}
throw new errors_1.ReactServerError(errorText, response.url, response.status, response.headers);
}
throw new errors_1.MetroServerError(errorJson, response.url);
}
let responseText;
try {
responseText = await response.text();
}
catch {
throw new errors_1.ReactServerError(response.statusText, response.url, response.status, response.headers);
}
throw new errors_1.ReactServerError(responseText, response.url, response.status, response.headers);
}
return response;
};
function getCached(c, m, k) {
return (m.has(k) ? m : m.set(k, c())).get(k);
}
const cache1 = new WeakMap();
const mergeElements = (a, b) => {
const getResult = () => {
const promise = new Promise((resolve, reject) => {
Promise.all([a, b])
.then(([a, b]) => {
const nextElements = { ...a, ...b };
delete nextElements._value;
promise.prev = a;
resolve(nextElements);
})
.catch((e) => {
a.then((a) => {
promise.prev = a;
reject(e);
}, () => {
promise.prev = a.prev;
reject(e);
});
});
});
return promise;
};
const cache2 = getCached(() => new WeakMap(), cache1, a);
return getCached(getResult, cache2, b);
};
/**
* callServer callback
* This is not a public API.
*/
const callServerRSC = async (actionId, args, fetchCache = defaultFetchCache) => {
const url = getAdjustedRemoteFilePath(BASE_PATH + (0, utils_1.encodeInput)((0, utils_1.encodeActionId)(actionId)));
const response = args === undefined
? (0, fetch_1.fetch)(url, { headers: ACTION_HEADERS })
: encodeReply(args).then((body) => (0, fetch_1.fetch)(url, { method: 'POST', body, headers: ACTION_HEADERS }));
const data = createFromFetch(checkStatus(response), {
callServer: (actionId, args) => (0, exports.callServerRSC)(actionId, args, fetchCache),
});
fetchCache[ON_FETCH_DATA]?.(data);
(0, react_1.startTransition)(() => {
// FIXME this causes rerenders even if data is empty
fetchCache[SET_ELEMENTS]?.((prev) => mergeElements(prev, data));
});
return (await data)._value;
};
exports.callServerRSC = callServerRSC;
const prefetchedParams = new WeakMap();
const fetchRSCInternal = (url, params) => params === undefined
? (0, fetch_1.fetch)(url, {
// Disable caching
headers: {
...NO_CACHE_HEADERS,
'expo-platform': process.env.EXPO_OS,
},
})
: typeof params === 'string'
? (0, fetch_1.fetch)(url, {
headers: {
...NO_CACHE_HEADERS,
'expo-platform': process.env.EXPO_OS,
'X-Expo-Params': params,
},
})
: encodeReply(params).then((body) => (0, fetch_1.fetch)(url, { method: 'POST', headers: ACTION_HEADERS, body }));
const fetchRSC = (input, params, fetchCache = defaultFetchCache) => {
// TODO: strip when "is exporting".
if (process.env.NODE_ENV === 'development') {
const refetchRsc = () => {
delete fetchCache[ENTRY];
const data = (0, exports.fetchRSC)(input, params, fetchCache);
fetchCache[SET_ELEMENTS]?.(() => data);
};
globalThis.__EXPO_RSC_RELOAD_LISTENERS__ ||= [];
const index = globalThis.__EXPO_RSC_RELOAD_LISTENERS__.indexOf(globalThis.__EXPO_REFETCH_RSC__);
if (index !== -1) {
globalThis.__EXPO_RSC_RELOAD_LISTENERS__.splice(index, 1, refetchRsc);
}
else {
globalThis.__EXPO_RSC_RELOAD_LISTENERS__.push(refetchRsc);
}
globalThis.__EXPO_REFETCH_RSC__ = refetchRsc;
}
const entry = fetchCache[ENTRY];
if (entry && entry[0] === input && entry[1] === params) {
return entry[2];
}
// eslint-disable-next-line no-multi-assign
const prefetched = (globalThis.__EXPO_PREFETCHED__ ||= {});
// TODO: Load from on-disk on native when indicated.
// const reqPath = fetchOptions?.remote ? getAdjustedRemoteFilePath(url) : getAdjustedRemoteFilePath(url);
const url = getAdjustedRemoteFilePath(BASE_PATH + (0, utils_1.encodeInput)(input));
const hasValidPrefetchedResponse = !!prefetched[url] &&
// HACK .has() is for the initial hydration
// It's limited and may result in a wrong result. FIXME
(!prefetchedParams.has(prefetched[url]) || prefetchedParams.get(prefetched[url]) === params);
const response = hasValidPrefetchedResponse ? prefetched[url] : fetchRSCInternal(url, params);
delete prefetched[url];
const data = createFromFetch(checkStatus(response), {
callServer: (actionId, args) => (0, exports.callServerRSC)(actionId, args, fetchCache),
});
fetchCache[ON_FETCH_DATA]?.(data);
// eslint-disable-next-line @typescript-eslint/no-floating-promises
fetchCache[ENTRY] = [input, params, data];
return data;
};
exports.fetchRSC = fetchRSC;
function getAdjustedRemoteFilePath(path) {
if (IS_DOM && process.env.NODE_ENV === 'production') {
const origin = (0, url_1.getOriginFromConstants)();
if (!origin) {
throw new Error('Expo RSC: Origin not found in Constants. This is required for production DOM components using server actions.');
}
// DOM components in production need to use the same origin logic as native.
return new URL(path, origin).toString();
}
if (!IS_DOM && process.env.EXPO_OS === 'web') {
return path;
}
return new URL(path, window.location.href).toString();
}
const prefetchRSC = (input, params) => {
// eslint-disable-next-line no-multi-assign
const prefetched = (globalThis.__EXPO_PREFETCHED__ ||= {});
const url = getAdjustedRemoteFilePath(BASE_PATH + (0, utils_1.encodeInput)(input));
if (!(url in prefetched)) {
prefetched[url] = fetchRSCInternal(url, params);
prefetchedParams.set(prefetched[url], params);
}
};
exports.prefetchRSC = prefetchRSC;
const RefetchContext = (0, react_1.createContext)(() => {
throw new Error('Missing Root component');
});
const ElementsContext = (0, react_1.createContext)(null);
const Root = ({ initialInput, initialParams, fetchCache = defaultFetchCache, unstable_onFetchData, children, }) => {
fetchCache[ON_FETCH_DATA] = unstable_onFetchData;
const [elements, setElements] = (0, react_1.useState)(() => (0, exports.fetchRSC)(initialInput || '', initialParams, fetchCache));
(0, react_1.useEffect)(() => {
fetchCache[SET_ELEMENTS] = setElements;
}, [fetchCache, setElements]);
const refetch = (0, react_1.useCallback)((input, params) => {
// clear cache entry before fetching
delete fetchCache[ENTRY];
const data = (0, exports.fetchRSC)(input, params, fetchCache);
(0, react_1.startTransition)(() => {
setElements((prev) => mergeElements(prev, data));
});
}, [fetchCache]);
return (0, react_1.createElement)(RefetchContext.Provider, { value: refetch }, (0, react_1.createElement)(ElementsContext.Provider, { value: elements }, children));
};
exports.Root = Root;
const useRefetch = () => (0, react_1.use)(RefetchContext);
exports.useRefetch = useRefetch;
const ChildrenContext = (0, react_1.createContext)(undefined);
const ChildrenContextProvider = (0, react_1.memo)(ChildrenContext.Provider);
const Slot = ({ id, children, fallback, }) => {
const elementsPromise = (0, react_1.use)(ElementsContext);
if (!elementsPromise) {
throw new Error('Missing Root component');
}
const elements = (0, react_1.use)(elementsPromise);
if (!(id in elements)) {
if (fallback) {
return fallback;
}
throw new Error('Not found: ' + id + '. Expected: ' + Object.keys(elements).join(', '));
}
return (0, react_1.createElement)(ChildrenContextProvider, { value: children }, elements[id]);
};
exports.Slot = Slot;
const Children = () => (0, react_1.use)(ChildrenContext);
exports.Children = Children;
/**
* ServerRoot for SSR
* This is not a public API.
*/
const ServerRoot = ({ elements, children }) => (0, react_1.createElement)(ElementsContext.Provider, { value: elements }, children);
exports.ServerRoot = ServerRoot;
//# sourceMappingURL=host.js.map

File diff suppressed because one or more lines are too long

14
node_modules/expo-router/build/rsc/router/utils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,14 @@
/**
* Copyright © 2024 650 Industries.
* Copyright © 2024 2023 Daishi Kato
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* https://github.com/dai-shi/waku/blob/32d52242c1450b5f5965860e671ff73c42da8bd0/packages/waku/src/client.ts#L1
*/
export declare const filePathToFileURL: (filePath: string) => string;
export declare const encodeInput: (input: string) => string;
export declare const encodeActionId: (actionId: string) => string;
export declare const decodeActionId: (encoded: string) => string | null;
//# sourceMappingURL=utils.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/rsc/router/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,eAAO,MAAM,iBAAiB,GAAI,UAAU,MAAM,WAAoC,CAAC;AAEvF,eAAO,MAAM,WAAW,GAAI,OAAO,MAAM,WAcxC,CAAC;AAIF,eAAO,MAAM,cAAc,GAAI,UAAU,MAAM,WAM9C,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,SAAS,MAAM,kBAM7C,CAAC"}

48
node_modules/expo-router/build/rsc/router/utils.js generated vendored Normal file
View File

@@ -0,0 +1,48 @@
"use strict";
/**
* Copyright © 2024 650 Industries.
* Copyright © 2024 2023 Daishi Kato
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* https://github.com/dai-shi/waku/blob/32d52242c1450b5f5965860e671ff73c42da8bd0/packages/waku/src/client.ts#L1
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.decodeActionId = exports.encodeActionId = exports.encodeInput = exports.filePathToFileURL = void 0;
const filePathToFileURL = (filePath) => 'file://' + encodeURI(filePath);
exports.filePathToFileURL = filePathToFileURL;
const encodeInput = (input) => {
if (input === '') {
return 'index.txt';
}
if (input === 'index') {
throw new Error('Input should not be `index`');
}
if (input.startsWith('/')) {
throw new Error('Input should not start with `/`');
}
if (input.endsWith('/')) {
throw new Error('Input should not end with `/`');
}
return input + '.txt';
};
exports.encodeInput = encodeInput;
const ACTION_PREFIX = 'ACTION_';
const encodeActionId = (actionId) => {
const [file, name] = actionId.split('#');
if (name.includes('/')) {
throw new Error('Unsupported action name');
}
return ACTION_PREFIX + file + '/' + name;
};
exports.encodeActionId = encodeActionId;
const decodeActionId = (encoded) => {
if (!encoded.startsWith(ACTION_PREFIX)) {
return null;
}
const index = encoded.lastIndexOf('/');
return encoded.slice(ACTION_PREFIX.length, index) + '#' + encoded.slice(index + 1);
};
exports.decodeActionId = decodeActionId;
//# sourceMappingURL=utils.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/rsc/router/utils.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAEI,MAAM,iBAAiB,GAAG,CAAC,QAAgB,EAAE,EAAE,CAAC,SAAS,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAA1E,QAAA,iBAAiB,qBAAyD;AAEhF,MAAM,WAAW,GAAG,CAAC,KAAa,EAAE,EAAE;IAC3C,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;QACjB,OAAO,WAAW,CAAC;IACrB,CAAC;IACD,IAAI,KAAK,KAAK,OAAO,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;IACjD,CAAC;IACD,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACrD,CAAC;IACD,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACnD,CAAC;IACD,OAAO,KAAK,GAAG,MAAM,CAAC;AACxB,CAAC,CAAC;AAdW,QAAA,WAAW,eActB;AAEF,MAAM,aAAa,GAAG,SAAS,CAAC;AAEzB,MAAM,cAAc,GAAG,CAAC,QAAgB,EAAE,EAAE;IACjD,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAqB,CAAC;IAC7D,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,OAAO,aAAa,GAAG,IAAI,GAAG,GAAG,GAAG,IAAI,CAAC;AAC3C,CAAC,CAAC;AANW,QAAA,cAAc,kBAMzB;AAEK,MAAM,cAAc,GAAG,CAAC,OAAe,EAAE,EAAE;IAChD,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC;QACvC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,KAAK,GAAG,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACvC,OAAO,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;AACrF,CAAC,CAAC;AANW,QAAA,cAAc,kBAMzB","sourcesContent":["/**\n * Copyright © 2024 650 Industries.\n * Copyright © 2024 2023 Daishi Kato\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 * https://github.com/dai-shi/waku/blob/32d52242c1450b5f5965860e671ff73c42da8bd0/packages/waku/src/client.ts#L1\n */\n\nexport const filePathToFileURL = (filePath: string) => 'file://' + encodeURI(filePath);\n\nexport const encodeInput = (input: string) => {\n if (input === '') {\n return 'index.txt';\n }\n if (input === 'index') {\n throw new Error('Input should not be `index`');\n }\n if (input.startsWith('/')) {\n throw new Error('Input should not start with `/`');\n }\n if (input.endsWith('/')) {\n throw new Error('Input should not end with `/`');\n }\n return input + '.txt';\n};\n\nconst ACTION_PREFIX = 'ACTION_';\n\nexport const encodeActionId = (actionId: string) => {\n const [file, name] = actionId.split('#') as [string, string];\n if (name.includes('/')) {\n throw new Error('Unsupported action name');\n }\n return ACTION_PREFIX + file + '/' + name;\n};\n\nexport const decodeActionId = (encoded: string) => {\n if (!encoded.startsWith(ACTION_PREFIX)) {\n return null;\n }\n const index = encoded.lastIndexOf('/');\n return encoded.slice(ACTION_PREFIX.length, index) + '#' + encoded.slice(index + 1);\n};\n"]}