{"version":3,"sources":["../../../src/server/use-cache/use-cache-probe-globals.ts"],"sourcesContent":["import type { Params } from '../request/params'\n\n// Cross-module handoff for the `'use cache'` hang-detection probe. A symbol on\n// `globalThis` decouples the dev-server entry point (which installs the\n// jest-worker pool) from the read site inside `use-cache-wrapper.ts` — avoiding\n// a direct import of dev-only code from the use-cache module. In any process\n// where the symbol is not set (prod, edge, unit tests, the probe worker itself)\n// `getUseCacheProbe()` returns undefined, which doubles as the recursion guard\n// against a probe spawning another probe.\nconst SYMBOL: unique symbol = Symbol.for('next.dev.useCacheProbe')\n\n/**\n * Serializable view of the outer `RequestStore` forwarded to the probe\n * worker. The worker rebuilds a real `RequestStore` from this so cache\n * bodies that read `cookies()`, `headers()`, or `draftMode()` behave the\n * same as in a real fill — without it, those reads would diverge from\n * production behaviour and could mask the actual deadlock.\n */\nexport type UseCacheProbeRequestSnapshot = {\n  headers: [string, string][]\n  cookieHeader: string | undefined\n  urlPathname: string\n  urlSearch: string\n  rootParams: Params\n  isDraftMode: boolean\n  isHmrRefresh: boolean\n  hmrRefreshHash: string | undefined\n  requestStartTime: number\n}\n\n/**\n * Probe hook installed by the dev server. Resolves to `true` if the cache\n * function ran to completion in isolation — the strong signal that shared\n * outer-scope state is deadlocking the main fill. Resolves to `false` for\n * any other outcome (probe timeout, decode failure, missing module, etc.).\n */\nexport type UseCacheProbe = (args: {\n  /**\n   * Page key as it appears in the build manifest, e.g. `/static/page` for\n   * `app/static/page.tsx`. The trailing `/page` (or `/route`) suffix is\n   * load-bearing — the worker passes this directly to `loadComponents()`.\n   */\n  page: string\n  /** Route pathname; used to populate the worker's `WorkStore.route`. */\n  route: string\n  id: string\n  kind: string\n  encodedArguments: string | FormData\n  request: UseCacheProbeRequestSnapshot\n  timeoutMs: number\n}) => Promise<boolean>\n\ninterface ProbeHolder {\n  [SYMBOL]?: UseCacheProbe\n}\n\nexport function setUseCacheProbe(fn: UseCacheProbe | undefined): void {\n  ;(globalThis as ProbeHolder)[SYMBOL] = fn\n}\n\nexport function getUseCacheProbe(): UseCacheProbe | undefined {\n  return (globalThis as ProbeHolder)[SYMBOL]\n}\n"],"names":["getUseCacheProbe","setUseCacheProbe","SYMBOL","Symbol","for","fn","globalThis"],"mappings":";;;;;;;;;;;;;;;IA4DgBA,gBAAgB;eAAhBA;;IAJAC,gBAAgB;eAAhBA;;;AAtDhB,+EAA+E;AAC/E,wEAAwE;AACxE,gFAAgF;AAChF,6EAA6E;AAC7E,gFAAgF;AAChF,+EAA+E;AAC/E,0CAA0C;AAC1C,MAAMC,SAAwBC,OAAOC,GAAG,CAAC;AA+ClC,SAASH,iBAAiBI,EAA6B;;IAC1DC,UAA0B,CAACJ,OAAO,GAAGG;AACzC;AAEO,SAASL;IACd,OAAO,AAACM,UAA0B,CAACJ,OAAO;AAC5C","ignoreList":[0]}