one
Version:
One is a React framework for web, iOS, and Android apps.
1 lines • 22 kB
Source Map (JSON)
{"version":3,"file":"useLoader.js","names":[],"sources":["esm/useLoader.js"],"sourcesContent":["import { useCallback, useSyncExternalStore } from \"react\";\nimport { registerDevtoolsFunction } from \"./devtools/registry\";\nimport { useParams, usePathname } from \"./hooks\";\nimport { findNearestNotFoundRoute, setNotFoundState } from \"./notFoundState\";\nimport { useContextKey } from \"./router/Route\";\nimport { getContextKey } from \"./router/matchers\";\nimport { router } from \"./router/imperative-api\";\nimport { preloadedLoaderData, preloadingLoader, routeNode } from \"./router/router\";\nimport { setSSRLoaderData, ssrLoaderData } from \"./server/ssrLoaderData\";\nimport { getClientMatchesSnapshot, subscribeToClientMatches, updateMatchLoaderData } from \"./useMatches\";\nimport { getLoaderPath } from \"./utils/cleanUrl\";\nimport { dynamicImport } from \"./utils/dynamicImport\";\nimport { weakKey } from \"./utils/weakKey\";\nimport { useServerContext } from \"./vite/one-server-only\";\n\nprocess.env.ONE_LOADER_TIMEOUT_MS && +process.env.ONE_LOADER_TIMEOUT_MS;\nconst loaderTimingHistory = [];\nconst MAX_TIMING_HISTORY = 50;\nconst recordLoaderTiming = process.env.NODE_ENV === \"development\" ? (entry) => {\n\tloaderTimingHistory.unshift(entry);\n\tif (loaderTimingHistory.length > MAX_TIMING_HISTORY) loaderTimingHistory.pop();\n\tif (typeof window !== \"undefined\" && typeof CustomEvent !== \"undefined\") {\n\t\twindow.dispatchEvent(new CustomEvent(\"one-loader-timing\", { detail: entry }));\n\t\tif (entry.error) window.dispatchEvent(new CustomEvent(\"one-error\", { detail: {\n\t\t\terror: {\n\t\t\t\tmessage: entry.error,\n\t\t\t\tname: \"LoaderError\"\n\t\t\t},\n\t\t\troute: { pathname: entry.path },\n\t\t\ttimestamp: Date.now(),\n\t\t\ttype: \"loader\"\n\t\t} }));\n\t}\n} : void 0;\nfunction getLoaderTimingHistory() {\n\treturn loaderTimingHistory;\n}\nregisterDevtoolsFunction(\"getLoaderTimingHistory\", getLoaderTimingHistory);\nregisterDevtoolsFunction(\"recordLoaderTiming\", recordLoaderTiming);\nconst loaderState = {};\nconst subscribers = /* @__PURE__ */ new Set();\nconst LOADER_STATE_MAX = 200;\nconst loaderStateKeys = [];\nfunction setBoundedLoaderState(path, entry) {\n\tif (!(path in loaderState)) {\n\t\tloaderStateKeys.push(path);\n\t\tif (loaderStateKeys.length > LOADER_STATE_MAX) {\n\t\t\tconst oldest = loaderStateKeys.shift();\n\t\t\tdelete loaderState[oldest];\n\t\t}\n\t}\n\tloaderState[path] = entry;\n}\nfunction updateState(path, updates) {\n\tsetBoundedLoaderState(path, {\n\t\t...loaderState[path],\n\t\t...updates\n\t});\n\tsubscribers.forEach((callback) => {\n\t\tcallback();\n\t});\n}\nfunction subscribe(callback) {\n\tsubscribers.add(callback);\n\treturn () => subscribers.delete(callback);\n}\nfunction getLoaderState(path, preloadedData) {\n\tif (!(path in loaderState)) setBoundedLoaderState(path, {\n\t\tdata: preloadedData,\n\t\terror: void 0,\n\t\tpromise: void 0,\n\t\tstate: \"idle\",\n\t\thasLoadedOnce: !!preloadedData\n\t});\n\treturn loaderState[path];\n}\nasync function refetchLoader(pathname) {\n\tconst startTime = performance.now();\n\tupdateState(pathname, {\n\t\tstate: \"loading\",\n\t\terror: null\n\t});\n\ttry {\n\t\tconst loaderJSUrl = getLoaderPath(pathname, true, `${Date.now()}`);\n\t\tconst moduleLoadStart = performance.now();\n\t\tconst module = await dynamicImport(loaderJSUrl)?.catch(() => null);\n\t\tconst moduleLoadTime = performance.now() - moduleLoadStart;\n\t\tif (!module?.loader) {\n\t\t\tupdateState(pathname, {\n\t\t\t\tdata: void 0,\n\t\t\t\tstate: \"idle\",\n\t\t\t\thasLoadedOnce: true\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst executionStart = performance.now();\n\t\tconst result = await module.loader();\n\t\tconst executionTime = performance.now() - executionStart;\n\t\tconst totalTime = performance.now() - startTime;\n\t\tif (result?.__oneRedirect) {\n\t\t\trecordLoaderTiming?.({\n\t\t\t\tpath: pathname,\n\t\t\t\tstartTime,\n\t\t\t\tmoduleLoadTime,\n\t\t\t\texecutionTime,\n\t\t\t\ttotalTime,\n\t\t\t\tsource: \"refetch\"\n\t\t\t});\n\t\t\tupdateState(pathname, {\n\t\t\t\tdata: void 0,\n\t\t\t\tstate: \"idle\",\n\t\t\t\thasLoadedOnce: true\n\t\t\t});\n\t\t\trouter.replace(result.__oneRedirect);\n\t\t\treturn;\n\t\t}\n\t\tif (result?.__oneError === 404) {\n\t\t\trecordLoaderTiming?.({\n\t\t\t\tpath: pathname,\n\t\t\t\tstartTime,\n\t\t\t\tmoduleLoadTime,\n\t\t\t\texecutionTime,\n\t\t\t\ttotalTime,\n\t\t\t\tsource: \"refetch\"\n\t\t\t});\n\t\t\tconst notFoundRoute = findNearestNotFoundRoute(pathname, routeNode);\n\t\t\tsetNotFoundState({\n\t\t\t\tnotFoundPath: result.__oneNotFoundPath || \"/+not-found\",\n\t\t\t\tnotFoundRouteNode: notFoundRoute || void 0,\n\t\t\t\toriginalPath: pathname\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tupdateState(pathname, {\n\t\t\tdata: result,\n\t\t\tstate: \"idle\",\n\t\t\ttimestamp: Date.now(),\n\t\t\thasLoadedOnce: true\n\t\t});\n\t\tconst currentMatches = getClientMatchesSnapshot();\n\t\tconst pageMatch = currentMatches[currentMatches.length - 1];\n\t\tconst normalizedPathname = pathname.replace(/\\/$/, \"\") || \"/\";\n\t\tconst normalizedMatchPathname = (pageMatch?.pathname || \"\").replace(/\\/$/, \"\") || \"/\";\n\t\tif (pageMatch && normalizedMatchPathname === normalizedPathname) updateMatchLoaderData(pageMatch.routeId, result);\n\t\trecordLoaderTiming?.({\n\t\t\tpath: pathname,\n\t\t\tstartTime,\n\t\t\tmoduleLoadTime,\n\t\t\texecutionTime,\n\t\t\ttotalTime,\n\t\t\tsource: \"refetch\"\n\t\t});\n\t} catch (err) {\n\t\tconst totalTime = performance.now() - startTime;\n\t\tupdateState(pathname, {\n\t\t\terror: err,\n\t\t\tstate: \"idle\"\n\t\t});\n\t\trecordLoaderTiming?.({\n\t\t\tpath: pathname,\n\t\t\tstartTime,\n\t\t\ttotalTime,\n\t\t\terror: err instanceof Error ? err.message : String(err),\n\t\t\tsource: \"refetch\"\n\t\t});\n\t\tthrow err;\n\t}\n}\nif (process.env.NODE_ENV === \"development\" && typeof window !== \"undefined\") window.__oneRefetchLoader = refetchLoader;\nasync function refetchMatchLoader(routeId, currentPath) {\n\tconst module = await dynamicImport(getLoaderPath(currentPath, true, `${Date.now()}`))?.catch(() => null);\n\tif (!module?.loader) return;\n\tconst result = await module.loader();\n\tif (result?.__oneRedirect || result?.__oneError) return;\n\tupdateMatchLoaderData(routeId, result);\n}\nfunction useLoaderState(loader) {\n\tconst { loaderProps: loaderPropsFromServerContext, loaderData: loaderDataFromServerContext } = useServerContext() || {};\n\tconst params = useParams();\n\tconst pathname = usePathname();\n\tconst currentPath = pathname.replace(/\\/index$/, \"\").replace(/\\/$/, \"\") || \"/\";\n\tif (typeof window === \"undefined\") {\n\t\tif (loader) {\n\t\t\tif (ssrLoaderData.has(loader)) return {\n\t\t\t\tdata: ssrLoaderData.get(loader),\n\t\t\t\trefetch: async () => {},\n\t\t\t\tstate: \"idle\"\n\t\t\t};\n\t\t\tconst serverContext = useServerContext();\n\t\t\tif (serverContext?.matches) {\n\t\t\t\tconst contextKey = useContextKey();\n\t\t\t\tconst match = serverContext.matches.find((m) => getContextKey(m.routeId) === contextKey);\n\t\t\t\tif (match && match.loaderData !== void 0) return {\n\t\t\t\t\tdata: match.loaderData,\n\t\t\t\t\trefetch: async () => {},\n\t\t\t\t\tstate: \"idle\"\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tdata: useAsyncFn(loader, loaderPropsFromServerContext || {\n\t\t\t\t\tpath: pathname,\n\t\t\t\t\tparams\n\t\t\t\t}),\n\t\t\t\trefetch: async () => {},\n\t\t\t\tstate: \"idle\"\n\t\t\t};\n\t\t}\n\t\tif (loaderDataFromServerContext !== void 0) return {\n\t\t\tdata: loaderDataFromServerContext,\n\t\t\trefetch: async () => {},\n\t\t\tstate: \"idle\"\n\t\t};\n\t}\n\tconst matchRouteId = loader ? (() => {\n\t\tconst result = loader();\n\t\treturn typeof result === \"string\" && result.startsWith(\"./\") ? result : null;\n\t})() : null;\n\tconst clientMatches = useSyncExternalStore(subscribeToClientMatches, getClientMatchesSnapshot, getClientMatchesSnapshot);\n\tconst preloadedData = loaderPropsFromServerContext?.path === currentPath ? loaderDataFromServerContext : void 0;\n\tconst loaderStateEntry = useSyncExternalStore(subscribe, () => getLoaderState(currentPath, preloadedData), () => getLoaderState(currentPath, preloadedData));\n\tconst refetch = useCallback(() => refetchLoader(currentPath), [currentPath]);\n\tif (matchRouteId) {\n\t\tconst match = clientMatches.find((m) => m.routeId === matchRouteId);\n\t\tconst isPageMatch = clientMatches.length > 0 && clientMatches[clientMatches.length - 1]?.routeId === matchRouteId;\n\t\tconst matchPathNormalized = (match?.pathname || \"\").replace(/\\/$/, \"\") || \"/\";\n\t\tconst matchPathFresh = !isPageMatch || matchPathNormalized === currentPath;\n\t\tif (match && match.loaderData != null && matchPathFresh) return {\n\t\t\tdata: match.loaderData,\n\t\t\trefetch: async () => {\n\t\t\t\tawait refetchLoader(currentPath);\n\t\t\t\tconst fresh = loaderState[currentPath];\n\t\t\t\tif (fresh?.data != null) updateMatchLoaderData(matchRouteId, fresh.data);\n\t\t\t},\n\t\t\tstate: loaderStateEntry.state\n\t\t};\n\t}\n\tif (!loader) return {\n\t\trefetch,\n\t\tstate: loaderStateEntry.state\n\t};\n\tif (!loaderStateEntry.data && !loaderStateEntry.promise && !loaderStateEntry.hasLoadedOnce) {\n\t\tconst resolvedPreloadData = preloadedLoaderData[currentPath];\n\t\tif (resolvedPreloadData != null) {\n\t\t\tdelete preloadedLoaderData[currentPath];\n\t\t\tdelete preloadingLoader[currentPath];\n\t\t\tloaderStateEntry.data = resolvedPreloadData;\n\t\t\tloaderStateEntry.hasLoadedOnce = true;\n\t\t} else if (preloadingLoader[currentPath]) loaderStateEntry.promise = preloadingLoader[currentPath].then((val) => {\n\t\t\tdelete preloadingLoader[currentPath];\n\t\t\tdelete preloadedLoaderData[currentPath];\n\t\t\tif (val != null) updateState(currentPath, {\n\t\t\t\tdata: val,\n\t\t\t\thasLoadedOnce: true,\n\t\t\t\tpromise: void 0\n\t\t\t});\n\t\t\telse updateState(currentPath, { promise: void 0 });\n\t\t}).catch((err) => {\n\t\t\tconsole.error(`Error running loader()`, err);\n\t\t\tdelete preloadingLoader[currentPath];\n\t\t\tupdateState(currentPath, {\n\t\t\t\terror: err,\n\t\t\t\tpromise: void 0\n\t\t\t});\n\t\t});\n\t\telse {\n\t\t\tconst loadData = async () => {\n\t\t\t\tconst startTime = performance.now();\n\t\t\t\ttry {\n\t\t\t\t\tconst loaderJSUrl = getLoaderPath(currentPath, true);\n\t\t\t\t\tconst moduleLoadStart = performance.now();\n\t\t\t\t\tconst module = await dynamicImport(loaderJSUrl)?.catch(() => null);\n\t\t\t\t\tconst moduleLoadTime = performance.now() - moduleLoadStart;\n\t\t\t\t\tif (!module?.loader) {\n\t\t\t\t\t\tupdateState(currentPath, {\n\t\t\t\t\t\t\tdata: void 0,\n\t\t\t\t\t\t\thasLoadedOnce: true,\n\t\t\t\t\t\t\tpromise: void 0\n\t\t\t\t\t\t});\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tconst executionStart = performance.now();\n\t\t\t\t\tconst result = await module.loader();\n\t\t\t\t\tconst executionTime = performance.now() - executionStart;\n\t\t\t\t\tconst totalTime = performance.now() - startTime;\n\t\t\t\t\tif (result?.__oneRedirect) {\n\t\t\t\t\t\trecordLoaderTiming?.({\n\t\t\t\t\t\t\tpath: currentPath,\n\t\t\t\t\t\t\tstartTime,\n\t\t\t\t\t\t\tmoduleLoadTime,\n\t\t\t\t\t\t\texecutionTime,\n\t\t\t\t\t\t\ttotalTime,\n\t\t\t\t\t\t\tsource: \"initial\"\n\t\t\t\t\t\t});\n\t\t\t\t\t\tupdateState(currentPath, {\n\t\t\t\t\t\t\tdata: void 0,\n\t\t\t\t\t\t\thasLoadedOnce: true,\n\t\t\t\t\t\t\tpromise: void 0\n\t\t\t\t\t\t});\n\t\t\t\t\t\trouter.replace(result.__oneRedirect);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tif (result?.__oneError === 404) {\n\t\t\t\t\t\trecordLoaderTiming?.({\n\t\t\t\t\t\t\tpath: currentPath,\n\t\t\t\t\t\t\tstartTime,\n\t\t\t\t\t\t\tmoduleLoadTime,\n\t\t\t\t\t\t\texecutionTime,\n\t\t\t\t\t\t\ttotalTime,\n\t\t\t\t\t\t\tsource: \"initial\"\n\t\t\t\t\t\t});\n\t\t\t\t\t\tconst notFoundRoute = findNearestNotFoundRoute(currentPath, routeNode);\n\t\t\t\t\t\tsetNotFoundState({\n\t\t\t\t\t\t\tnotFoundPath: result.__oneNotFoundPath || \"/+not-found\",\n\t\t\t\t\t\t\tnotFoundRouteNode: notFoundRoute || void 0,\n\t\t\t\t\t\t\toriginalPath: currentPath\n\t\t\t\t\t\t});\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tupdateState(currentPath, {\n\t\t\t\t\t\tdata: result,\n\t\t\t\t\t\thasLoadedOnce: true,\n\t\t\t\t\t\tpromise: void 0\n\t\t\t\t\t});\n\t\t\t\t\trecordLoaderTiming?.({\n\t\t\t\t\t\tpath: currentPath,\n\t\t\t\t\t\tstartTime,\n\t\t\t\t\t\tmoduleLoadTime,\n\t\t\t\t\t\texecutionTime,\n\t\t\t\t\t\ttotalTime,\n\t\t\t\t\t\tsource: \"initial\"\n\t\t\t\t\t});\n\t\t\t\t} catch (err) {\n\t\t\t\t\tconst totalTime = performance.now() - startTime;\n\t\t\t\t\tupdateState(currentPath, {\n\t\t\t\t\t\terror: err,\n\t\t\t\t\t\tpromise: void 0\n\t\t\t\t\t});\n\t\t\t\t\trecordLoaderTiming?.({\n\t\t\t\t\t\tpath: currentPath,\n\t\t\t\t\t\tstartTime,\n\t\t\t\t\t\ttotalTime,\n\t\t\t\t\t\terror: err instanceof Error ? err.message : String(err),\n\t\t\t\t\t\tsource: \"initial\"\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t};\n\t\t\tloaderStateEntry.promise = loadData();\n\t\t}\n\t}\n\tif (loaderStateEntry.error && !loaderStateEntry.hasLoadedOnce) throw loaderStateEntry.error;\n\tif (loaderStateEntry.data === void 0 && loaderStateEntry.promise && !loaderStateEntry.hasLoadedOnce) throw loaderStateEntry.promise;\n\treturn {\n\t\tdata: loaderStateEntry.data,\n\t\trefetch,\n\t\tstate: loaderStateEntry.state\n\t};\n}\nfunction useLoader(loader) {\n\tconst { data } = useLoaderState(loader);\n\treturn data;\n}\nconst results = /* @__PURE__ */ new Map();\nconst started = /* @__PURE__ */ new Map();\nconst USE_ASYNC_FN_CACHE_MAX = 100;\nfunction setBoundedResults(key, value) {\n\tif (results.size >= USE_ASYNC_FN_CACHE_MAX && !results.has(key)) {\n\t\tconst firstKey = results.keys().next().value;\n\t\tif (firstKey !== void 0) {\n\t\t\tresults.delete(firstKey);\n\t\t\tstarted.delete(firstKey);\n\t\t}\n\t}\n\tresults.set(key, value);\n}\nfunction resetLoaderState() {\n\tresults.clear();\n\tstarted.clear();\n}\nfunction useAsyncFn(val, props) {\n\tconst key = (val ? weakKey(val) : \"\") + JSON.stringify(props);\n\tif (val) {\n\t\tif (!started.get(key)) {\n\t\t\tstarted.set(key, true);\n\t\t\tlet next = val(props);\n\t\t\tif (next instanceof Promise) next = next.then((final) => {\n\t\t\t\tsetBoundedResults(key, final);\n\t\t\t}).catch((err) => {\n\t\t\t\tconsole.error(`Error running loader()`, err);\n\t\t\t\tsetBoundedResults(key, void 0);\n\t\t\t});\n\t\t\tsetBoundedResults(key, next);\n\t\t}\n\t}\n\tconst current = results.get(key);\n\tif (current instanceof Promise) throw current;\n\treturn current;\n}\n\nexport { getLoaderTimingHistory, refetchLoader, refetchMatchLoader, resetLoaderState, setSSRLoaderData, useLoader, useLoaderState };"],"mappings":";;;;;;;;;;;;;;;;AAeA,QAAQ,IAAI,yBAAyB,CAAC,QAAQ,IAAI;AAClD,MAAM,sBAAsB,CAAC;AAC7B,MAAM,qBAAqB;AAC3B,MAAM,qBAAqB,QAAQ,IAAI,aAAa,iBAAiB,UAAU;CAC9E,oBAAoB,QAAQ,KAAK;CACjC,IAAI,oBAAoB,SAAS,oBAAoB,oBAAoB,IAAI;CAC7E,IAAI,OAAO,WAAW,eAAe,OAAO,gBAAgB,aAAa;EACxE,OAAO,cAAc,IAAI,YAAY,qBAAqB,EAAE,QAAQ,MAAM,CAAC,CAAC;EAC5E,IAAI,MAAM,OAAO,OAAO,cAAc,IAAI,YAAY,aAAa,EAAE,QAAQ;GAC5E,OAAO;IACN,SAAS,MAAM;IACf,MAAM;GACP;GACA,OAAO,EAAE,UAAU,MAAM,KAAK;GAC9B,WAAW,KAAK,IAAI;GACpB,MAAM;EACP,EAAE,CAAC,CAAC;CACL;AACD,IAAI,KAAK;AACT,SAAS,yBAAyB;CACjC,OAAO;AACR;AACA,yBAAyB,0BAA0B,sBAAsB;AACzE,yBAAyB,sBAAsB,kBAAkB;AACjE,MAAM,cAAc,CAAC;AACrB,MAAM,8BAA8B,IAAI,IAAI;AAC5C,MAAM,mBAAmB;AACzB,MAAM,kBAAkB,CAAC;AACzB,SAAS,sBAAsB,MAAM,OAAO;CAC3C,IAAI,EAAE,QAAQ,cAAc;EAC3B,gBAAgB,KAAK,IAAI;EACzB,IAAI,gBAAgB,SAAS,kBAAkB;GAC9C,MAAM,SAAS,gBAAgB,MAAM;GACrC,OAAO,YAAY;EACpB;CACD;CACA,YAAY,QAAQ;AACrB;AACA,SAAS,YAAY,MAAM,SAAS;CACnC,sBAAsB,MAAM;EAC3B,GAAG,YAAY;EACf,GAAG;CACJ,CA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