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

View File

@@ -0,0 +1,26 @@
/**
* Copyright © 2026 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 LoaderCache {
private data;
private errors;
private promises;
getData<T = unknown>(path: string): T | undefined;
hasData(path: string): boolean;
getError(path: string): Error | undefined;
getPromise<T = unknown>(path: string): Promise<T> | undefined;
setData(path: string, value: unknown): void;
deleteData(path: string): void;
setError(path: string, error: Error): void;
deleteError(path: string): void;
setPromise(path: string, promise: Promise<unknown>): void;
deletePromise(path: string): void;
clear(): void;
}
export declare const defaultLoaderCache: LoaderCache;
export declare const LoaderCacheContext: import("react").Context<LoaderCache>;
//# sourceMappingURL=LoaderCache.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"LoaderCache.d.ts","sourceRoot":"","sources":["../../src/loaders/LoaderCache.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,qBAAa,WAAW;IACtB,OAAO,CAAC,IAAI,CAA8B;IAC1C,OAAO,CAAC,MAAM,CAA4B;IAC1C,OAAO,CAAC,QAAQ,CAAuC;IAEvD,OAAO,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAIjD,OAAO,CAAC,IAAI,EAAE,MAAM;IAIpB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS;IAIzC,UAAU,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,SAAS;IAI7D,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO;IAIpC,UAAU,CAAC,IAAI,EAAE,MAAM;IAIvB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK;IAInC,WAAW,CAAC,IAAI,EAAE,MAAM;IAIxB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC;IAIlD,aAAa,CAAC,IAAI,EAAE,MAAM;IAI1B,KAAK;CAKN;AAED,eAAO,MAAM,kBAAkB,aAAoB,CAAC;AACpD,eAAO,MAAM,kBAAkB,sCAAiD,CAAC"}

55
node_modules/expo-router/build/loaders/LoaderCache.js generated vendored Normal file
View File

@@ -0,0 +1,55 @@
"use strict";
/**
* Copyright © 2026 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.LoaderCacheContext = exports.defaultLoaderCache = exports.LoaderCache = void 0;
const react_1 = require("react");
class LoaderCache {
data = new Map();
errors = new Map();
promises = new Map();
getData(path) {
return this.data.get(path);
}
hasData(path) {
return this.data.has(path);
}
getError(path) {
return this.errors.get(path);
}
getPromise(path) {
return this.promises.get(path);
}
setData(path, value) {
this.data.set(path, value);
}
deleteData(path) {
this.data.delete(path);
}
setError(path, error) {
this.errors.set(path, error);
}
deleteError(path) {
this.errors.delete(path);
}
setPromise(path, promise) {
this.promises.set(path, promise);
}
deletePromise(path) {
this.promises.delete(path);
}
clear() {
this.data.clear();
this.errors.clear();
this.promises.clear();
}
}
exports.LoaderCache = LoaderCache;
exports.defaultLoaderCache = new LoaderCache();
exports.LoaderCacheContext = (0, react_1.createContext)(exports.defaultLoaderCache);
//# sourceMappingURL=LoaderCache.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"LoaderCache.js","sourceRoot":"","sources":["../../src/loaders/LoaderCache.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,iCAAsC;AAEtC,MAAa,WAAW;IACd,IAAI,GAAG,IAAI,GAAG,EAAmB,CAAC;IAClC,MAAM,GAAG,IAAI,GAAG,EAAiB,CAAC;IAClC,QAAQ,GAAG,IAAI,GAAG,EAA4B,CAAC;IAEvD,OAAO,CAAc,IAAY;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AAEY,QAAA,kBAAkB,GAAG,IAAI,WAAW,EAAE,CAAC;AACvC,QAAA,kBAAkB,GAAG,IAAA,qBAAa,EAAc,0BAAkB,CAAC,CAAC","sourcesContent":["/**\n * Copyright © 2026 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\nimport { createContext } from 'react';\n\nexport class LoaderCache {\n private data = new Map<string, unknown>();\n private errors = new Map<string, Error>();\n private promises = new Map<string, Promise<unknown>>();\n\n getData<T = unknown>(path: string): T | undefined {\n return this.data.get(path) as T | undefined;\n }\n\n hasData(path: string) {\n return this.data.has(path);\n }\n\n getError(path: string): Error | undefined {\n return this.errors.get(path);\n }\n\n getPromise<T = unknown>(path: string): Promise<T> | undefined {\n return this.promises.get(path) as Promise<T> | undefined;\n }\n\n setData(path: string, value: unknown) {\n this.data.set(path, value);\n }\n\n deleteData(path: string) {\n this.data.delete(path);\n }\n\n setError(path: string, error: Error) {\n this.errors.set(path, error);\n }\n\n deleteError(path: string) {\n this.errors.delete(path);\n }\n\n setPromise(path: string, promise: Promise<unknown>) {\n this.promises.set(path, promise);\n }\n\n deletePromise(path: string) {\n this.promises.delete(path);\n }\n\n clear() {\n this.data.clear();\n this.errors.clear();\n this.promises.clear();\n }\n}\n\nexport const defaultLoaderCache = new LoaderCache();\nexport const LoaderCacheContext = createContext<LoaderCache>(defaultLoaderCache);\n"]}

View File

@@ -0,0 +1,10 @@
/**
* Copyright © 2025 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 type ServerDataLoaderData = Record<string, any> | null;
export declare const ServerDataLoaderContext: import("react").Context<ServerDataLoaderData>;
//# sourceMappingURL=ServerDataLoaderContext.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ServerDataLoaderContext.d.ts","sourceRoot":"","sources":["../../src/loaders/ServerDataLoaderContext.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;AAE9D,eAAO,MAAM,uBAAuB,+CAA4C,CAAC"}

View File

@@ -0,0 +1,13 @@
"use strict";
/**
* Copyright © 2025 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.ServerDataLoaderContext = void 0;
const react_1 = require("react");
exports.ServerDataLoaderContext = (0, react_1.createContext)(null);
//# sourceMappingURL=ServerDataLoaderContext.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ServerDataLoaderContext.js","sourceRoot":"","sources":["../../src/loaders/ServerDataLoaderContext.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,iCAAsC;AAIzB,QAAA,uBAAuB,GAAG,IAAA,qBAAa,EAAuB,IAAI,CAAC,CAAC","sourcesContent":["/**\n * Copyright © 2025 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\nimport { createContext } from 'react';\n\nexport type ServerDataLoaderData = Record<string, any> | null;\n\nexport const ServerDataLoaderContext = createContext<ServerDataLoaderData>(null);\n"]}

View File

@@ -0,0 +1,16 @@
/**
* Copyright © 2026 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 { LoaderCache } from './LoaderCache';
type LoaderFetcher<T> = (path: string) => Promise<T>;
export declare function getLoaderData<T>({ resolvedPath, cache, fetcher, }: {
resolvedPath: string;
cache: LoaderCache;
fetcher: LoaderFetcher<T>;
}): T | Promise<T>;
export {};
//# sourceMappingURL=getLoaderData.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"getLoaderData.d.ts","sourceRoot":"","sources":["../../src/loaders/getLoaderData.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,KAAK,aAAa,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;AAErD,wBAAgB,aAAa,CAAC,CAAC,EAAE,EAC/B,YAAY,EACZ,KAAK,EACL,OAAO,GACR,EAAE;IACD,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,WAAW,CAAC;IACnB,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;CAC3B,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAsCjB"}

View File

@@ -0,0 +1,46 @@
"use strict";
/**
* Copyright © 2026 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.getLoaderData = getLoaderData;
function getLoaderData({ resolvedPath, cache, fetcher, }) {
// Check error cache first to prevent infinite retry loops when a loader fails.
// We throw the cached error instead of starting a new fetch
const cachedError = cache.getError(resolvedPath);
if (cachedError) {
throw cachedError;
}
// Check cache for route data
if (cache.hasData(resolvedPath)) {
return cache.getData(resolvedPath);
}
// Fetch data if not cached
const cachedPromise = cache.getPromise(resolvedPath);
if (cachedPromise) {
return cachedPromise;
}
const promise = fetcher(resolvedPath)
.then((data) => {
cache.setData(resolvedPath, data);
cache.deleteError(resolvedPath);
cache.deletePromise(resolvedPath);
return data;
})
.catch((error) => {
const wrappedError = new Error(`Failed to load loader data for route: ${resolvedPath}`, {
cause: error,
});
cache.setError(resolvedPath, wrappedError);
cache.deleteData(resolvedPath);
cache.deletePromise(resolvedPath);
throw wrappedError;
});
cache.setPromise(resolvedPath, promise);
return promise;
}
//# sourceMappingURL=getLoaderData.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"getLoaderData.js","sourceRoot":"","sources":["../../src/loaders/getLoaderData.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAMH,sCA8CC;AA9CD,SAAgB,aAAa,CAAI,EAC/B,YAAY,EACZ,KAAK,EACL,OAAO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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\nimport { LoaderCache } from './LoaderCache';\n\ntype LoaderFetcher<T> = (path: string) => Promise<T>;\n\nexport function getLoaderData<T>({\n resolvedPath,\n cache,\n fetcher,\n}: {\n resolvedPath: string;\n cache: LoaderCache;\n fetcher: LoaderFetcher<T>;\n}): T | Promise<T> {\n // Check error cache first to prevent infinite retry loops when a loader fails.\n // We throw the cached error instead of starting a new fetch\n const cachedError = cache.getError(resolvedPath);\n if (cachedError) {\n throw cachedError;\n }\n\n // Check cache for route data\n if (cache.hasData(resolvedPath)) {\n return cache.getData<T>(resolvedPath) as T;\n }\n\n // Fetch data if not cached\n const cachedPromise = cache.getPromise<T>(resolvedPath);\n if (cachedPromise) {\n return cachedPromise;\n }\n\n const promise = fetcher(resolvedPath)\n .then((data) => {\n cache.setData(resolvedPath, data);\n cache.deleteError(resolvedPath);\n cache.deletePromise(resolvedPath);\n return data;\n })\n .catch((error) => {\n const wrappedError = new Error(`Failed to load loader data for route: ${resolvedPath}`, {\n cause: error,\n });\n cache.setError(resolvedPath, wrappedError);\n cache.deleteData(resolvedPath);\n cache.deletePromise(resolvedPath);\n throw wrappedError;\n });\n\n cache.setPromise(resolvedPath, promise);\n return promise;\n}\n"]}

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

@@ -0,0 +1,21 @@
/**
* 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;
/**
* 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): Promise<any>;
//# sourceMappingURL=utils.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/loaders/utils.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAM7D;AAED;;;;;;;;;GASG;AACH,wBAAsB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAiBjE"}

47
node_modules/expo-router/build/loaders/utils.js generated vendored Normal file
View File

@@ -0,0 +1,47 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getLoaderModulePath = getLoaderModulePath;
exports.fetchLoader = fetchLoader;
const url_1 = require("../utils/url");
/**
* 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`
*/
function getLoaderModulePath(routePath) {
const { pathname, search } = (0, url_1.parseUrlUsingCustomBase)(routePath);
const normalizedPath = pathname === '/' ? '/' : pathname.replace(/\/$/, '');
const pathSegment = normalizedPath === '/' ? '/index' : normalizedPath;
return `/_expo/loaders${pathSegment}${search}`;
}
/**
* 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
*/
async function fetchLoader(routePath) {
const loaderPath = getLoaderModulePath(routePath);
const response = await fetch(loaderPath, {
headers: {
Accept: 'application/json',
},
});
if (!response.ok) {
throw new Error(`Failed to fetch loader data: ${response.status}`);
}
try {
return await response.json();
}
catch (error) {
throw new Error(`Failed to parse loader data: ${error}`);
}
}
//# sourceMappingURL=utils.js.map

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

@@ -0,0 +1 @@
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/loaders/utils.ts"],"names":[],"mappings":";;AAUA,kDAMC;AAYD,kCAiBC;AA7CD,sCAAuD;AAEvD;;;;;;;GAOG;AACH,SAAgB,mBAAmB,CAAC,SAAiB;IACnD,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAA,6BAAuB,EAAC,SAAS,CAAC,CAAC;IAChE,MAAM,cAAc,GAAG,QAAQ,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC5E,MAAM,WAAW,GAAG,cAAc,KAAK,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC;IAEvE,OAAO,iBAAiB,WAAW,GAAG,MAAM,EAAE,CAAC;AACjD,CAAC;AAED;;;;;;;;;GASG;AACI,KAAK,UAAU,WAAW,CAAC,SAAiB;IACjD,MAAM,UAAU,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC;IAElD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,UAAU,EAAE;QACvC,OAAO,EAAE;YACP,MAAM,EAAE,kBAAkB;SAC3B;KACF,CAAC,CAAC;IACH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,gCAAgC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IACrE,CAAC;IAED,IAAI,CAAC;QACH,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IAC/B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,gCAAgC,KAAK,EAAE,CAAC,CAAC;IAC3D,CAAC;AACH,CAAC","sourcesContent":["import { parseUrlUsingCustomBase } from '../utils/url';\n\n/**\n * Convert a route's pathname to a loader module path.\n *\n * @example\n * getLoaderModulePath(`/`); // `/_expo/loaders/index`\n * getLoaderModulePath(`/about`) // `/_expo/loaders/about`\n * getLoaderModulePath(`/posts/1`) // `/_expo/loaders/posts/1`\n */\nexport function getLoaderModulePath(routePath: string): string {\n const { pathname, search } = parseUrlUsingCustomBase(routePath);\n const normalizedPath = pathname === '/' ? '/' : pathname.replace(/\\/$/, '');\n const pathSegment = normalizedPath === '/' ? '/index' : normalizedPath;\n\n return `/_expo/loaders${pathSegment}${search}`;\n}\n\n/**\n * Fetches and parses a loader module from the given route path.\n * This works in all environments including:\n * 1. Development with Metro dev server\n * 2. Production with static files (SSG)\n * 3. SSR environments\n *\n * @see import('packages/@expo/cli/src/start/server/metro/createServerRouteMiddleware.ts').createRouteHandlerMiddleware\n * @see import('packages/expo-server/src/vendor/environment/common.ts').createEnvironment\n */\nexport async function fetchLoader(routePath: string): Promise<any> {\n const loaderPath = getLoaderModulePath(routePath);\n\n const response = await fetch(loaderPath, {\n headers: {\n Accept: 'application/json',\n },\n });\n if (!response.ok) {\n throw new Error(`Failed to fetch loader data: ${response.status}`);\n }\n\n try {\n return await response.json();\n } catch (error) {\n throw new Error(`Failed to parse loader data: ${error}`);\n }\n}\n"]}