{"version":3,"sources":["../../src/server/get-page-files.ts"],"sourcesContent":["import { denormalizePagePath } from '../shared/lib/page-path/denormalize-page-path'\nimport { normalizePagePath } from '../shared/lib/page-path/normalize-page-path'\n\nexport type BuildManifest = {\n  devFiles: readonly string[]\n  polyfillFiles: readonly string[]\n  lowPriorityFiles: readonly string[]\n  rootMainFiles: readonly string[]\n  // this is a separate field for flying shuttle to allow\n  // different root main files per entries/build (ideally temporary)\n  // until we can stitch the runtime chunks together safely\n  rootMainFilesTree: { [appRoute: string]: readonly string[] }\n  pages: {\n    '/_app': readonly string[]\n    [page: string]: readonly string[]\n  }\n  // Per-page Turbopack chunk-group bootstrap params, stored as raw JSON.\n  pagesChunkGroupBootstrapParams?: { [page: string]: object }\n  // The chunk-loading global the runtime drains (default \"TURBOPACK\").\n  chunkLoadingGlobal?: string\n}\n\n/**\n * Builds inline `globalThis[<global>].push(<params>)` bootstrap content for the given\n * pages, seeding the runtime queue before the shared runtime chunk drains it. Only call\n * this for Turbopack production builds (the only builds that populate\n * `pagesChunkGroupBootstrapParams` / `chunkLoadingGlobal`). Returns undefined when none\n * of the given pages have inlined params.\n */\nexport function getTurbopackChunkGroupBootstrap(\n  paramsByPage: { [page: string]: object },\n  chunkLoadingGlobal: string,\n  pages: readonly string[]\n): string | undefined {\n  const g = JSON.stringify(chunkLoadingGlobal)\n  const statements = pages\n    .map((page) => paramsByPage[page])\n    .filter(Boolean)\n    .map(\n      (params) =>\n        `(globalThis[${g}] || (globalThis[${g}] = [])).push(${JSON.stringify(\n          params\n        )});`\n    )\n\n  return statements.length > 0 ? statements.join('\\n') : undefined\n}\n\nexport function getPageFiles(\n  buildManifest: BuildManifest,\n  page: string\n): readonly string[] {\n  const normalizedPage = denormalizePagePath(normalizePagePath(page))\n  let files = buildManifest.pages[normalizedPage]\n\n  if (!files) {\n    console.warn(\n      `Could not find files for ${normalizedPage} in .next/build-manifest.json`\n    )\n    return []\n  }\n\n  return files\n}\n"],"names":["getPageFiles","getTurbopackChunkGroupBootstrap","paramsByPage","chunkLoadingGlobal","pages","g","JSON","stringify","statements","map","page","filter","Boolean","params","length","join","undefined","buildManifest","normalizedPage","denormalizePagePath","normalizePagePath","files","console","warn"],"mappings":";;;;;;;;;;;;;;;IAgDgBA,YAAY;eAAZA;;IAnBAC,+BAA+B;eAA/BA;;;qCA7BoB;mCACF;AA4B3B,SAASA,gCACdC,YAAwC,EACxCC,kBAA0B,EAC1BC,KAAwB;IAExB,MAAMC,IAAIC,KAAKC,SAAS,CAACJ;IACzB,MAAMK,aAAaJ,MAChBK,GAAG,CAAC,CAACC,OAASR,YAAY,CAACQ,KAAK,EAChCC,MAAM,CAACC,SACPH,GAAG,CACF,CAACI,SACC,CAAC,YAAY,EAAER,EAAE,iBAAiB,EAAEA,EAAE,cAAc,EAAEC,KAAKC,SAAS,CAClEM,QACA,EAAE,CAAC;IAGX,OAAOL,WAAWM,MAAM,GAAG,IAAIN,WAAWO,IAAI,CAAC,QAAQC;AACzD;AAEO,SAAShB,aACdiB,aAA4B,EAC5BP,IAAY;IAEZ,MAAMQ,iBAAiBC,IAAAA,wCAAmB,EAACC,IAAAA,oCAAiB,EAACV;IAC7D,IAAIW,QAAQJ,cAAcb,KAAK,CAACc,eAAe;IAE/C,IAAI,CAACG,OAAO;QACVC,QAAQC,IAAI,CACV,CAAC,yBAAyB,EAAEL,eAAe,6BAA6B,CAAC;QAE3E,OAAO,EAAE;IACX;IAEA,OAAOG;AACT","ignoreList":[0]}