af360 0.1.15 → 0.1.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (275) hide show
  1. package/dist/.next/BUILD_ID +1 -1
  2. package/dist/.next/app-build-manifest.json +141 -130
  3. package/dist/.next/app-path-routes-manifest.json +18 -18
  4. package/dist/.next/build-manifest.json +5 -5
  5. package/dist/.next/prerender-manifest.json +49 -49
  6. package/dist/.next/server/app/_not-found/page.js +2 -2
  7. package/dist/.next/server/app/_not-found/page.js.nft.json +1 -1
  8. package/dist/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  9. package/dist/.next/server/app/_not-found.html +1 -1
  10. package/dist/.next/server/app/_not-found.meta +8 -0
  11. package/dist/.next/server/app/_not-found.rsc +3 -3
  12. package/dist/.next/server/app/ahead/page.js +2 -2
  13. package/dist/.next/server/app/ahead/page.js.nft.json +1 -1
  14. package/dist/.next/server/app/ahead/page_client-reference-manifest.js +1 -1
  15. package/dist/.next/server/app/ahead.html +1 -1
  16. package/dist/.next/server/app/ahead.meta +8 -0
  17. package/dist/.next/server/app/ahead.rsc +4 -4
  18. package/dist/.next/server/app/api/browse/route.js +1 -1
  19. package/dist/.next/server/app/api/browse/route.js.nft.json +1 -1
  20. package/dist/.next/server/app/api/browse/route_client-reference-manifest.js +1 -1
  21. package/dist/.next/server/app/api/card/route.js +1 -1
  22. package/dist/.next/server/app/api/card/route.js.nft.json +1 -1
  23. package/dist/.next/server/app/api/card/route_client-reference-manifest.js +1 -1
  24. package/dist/.next/server/app/api/check/route.js +1 -1
  25. package/dist/.next/server/app/api/check/route.js.nft.json +1 -1
  26. package/dist/.next/server/app/api/check/route_client-reference-manifest.js +1 -1
  27. package/dist/.next/server/app/api/config/route.js +1 -1
  28. package/dist/.next/server/app/api/config/route.js.nft.json +1 -1
  29. package/dist/.next/server/app/api/config/route_client-reference-manifest.js +1 -1
  30. package/dist/.next/server/app/api/connections/route.js +3 -3
  31. package/dist/.next/server/app/api/connections/route.js.nft.json +1 -1
  32. package/dist/.next/server/app/api/connections/route_client-reference-manifest.js +1 -1
  33. package/dist/.next/server/app/api/connectors/github/route.js +1 -1
  34. package/dist/.next/server/app/api/connectors/github/route.js.nft.json +1 -1
  35. package/dist/.next/server/app/api/connectors/github/route_client-reference-manifest.js +1 -1
  36. package/dist/.next/server/app/api/consent/route.js +1 -1
  37. package/dist/.next/server/app/api/consent/route.js.nft.json +1 -1
  38. package/dist/.next/server/app/api/consent/route_client-reference-manifest.js +1 -1
  39. package/dist/.next/server/app/api/context/route.js +3 -3
  40. package/dist/.next/server/app/api/context/route.js.nft.json +1 -1
  41. package/dist/.next/server/app/api/context/route_client-reference-manifest.js +1 -1
  42. package/dist/.next/server/app/api/discover/route.js +1 -1
  43. package/dist/.next/server/app/api/discover/route.js.nft.json +1 -1
  44. package/dist/.next/server/app/api/discover/route_client-reference-manifest.js +1 -1
  45. package/dist/.next/server/app/api/expiry/route.js +1 -1
  46. package/dist/.next/server/app/api/expiry/route.js.nft.json +1 -1
  47. package/dist/.next/server/app/api/expiry/route_client-reference-manifest.js +1 -1
  48. package/dist/.next/server/app/api/first-light/route.js +1 -1
  49. package/dist/.next/server/app/api/first-light/route.js.nft.json +1 -1
  50. package/dist/.next/server/app/api/first-light/route_client-reference-manifest.js +1 -1
  51. package/dist/.next/server/app/api/handoff/route.js +1 -1
  52. package/dist/.next/server/app/api/handoff/route.js.nft.json +1 -1
  53. package/dist/.next/server/app/api/handoff/route_client-reference-manifest.js +1 -1
  54. package/dist/.next/server/app/api/health/route.js +1 -1
  55. package/dist/.next/server/app/api/health/route.js.nft.json +1 -1
  56. package/dist/.next/server/app/api/health/route_client-reference-manifest.js +1 -1
  57. package/dist/.next/server/app/api/incidents/route.js +1 -1
  58. package/dist/.next/server/app/api/incidents/route.js.nft.json +1 -1
  59. package/dist/.next/server/app/api/incidents/route_client-reference-manifest.js +1 -1
  60. package/dist/.next/server/app/api/insights/route.js +1 -1
  61. package/dist/.next/server/app/api/insights/route.js.nft.json +1 -1
  62. package/dist/.next/server/app/api/insights/route_client-reference-manifest.js +1 -1
  63. package/dist/.next/server/app/api/log/route.js +1 -1
  64. package/dist/.next/server/app/api/log/route.js.nft.json +1 -1
  65. package/dist/.next/server/app/api/log/route_client-reference-manifest.js +1 -1
  66. package/dist/.next/server/app/api/pulse/route.js +1 -1
  67. package/dist/.next/server/app/api/pulse/route.js.nft.json +1 -1
  68. package/dist/.next/server/app/api/pulse/route_client-reference-manifest.js +1 -1
  69. package/dist/.next/server/app/api/radar/route.js +1 -1
  70. package/dist/.next/server/app/api/radar/route.js.nft.json +1 -1
  71. package/dist/.next/server/app/api/radar/route_client-reference-manifest.js +1 -1
  72. package/dist/.next/server/app/api/report/route.js +1 -1
  73. package/dist/.next/server/app/api/report/route.js.nft.json +1 -1
  74. package/dist/.next/server/app/api/report/route_client-reference-manifest.js +1 -1
  75. package/dist/.next/server/app/api/services/route.js +1 -1
  76. package/dist/.next/server/app/api/services/route.js.nft.json +1 -1
  77. package/dist/.next/server/app/api/services/route_client-reference-manifest.js +1 -1
  78. package/dist/.next/server/app/api/status/route.js +1 -1
  79. package/dist/.next/server/app/api/status/route.js.nft.json +1 -1
  80. package/dist/.next/server/app/api/status/route_client-reference-manifest.js +1 -1
  81. package/dist/.next/server/app/connections/page.js +2 -2
  82. package/dist/.next/server/app/connections/page.js.nft.json +1 -1
  83. package/dist/.next/server/app/connections/page_client-reference-manifest.js +1 -1
  84. package/dist/.next/server/app/connections.html +1 -1
  85. package/dist/.next/server/app/connections.meta +8 -0
  86. package/dist/.next/server/app/connections.rsc +4 -4
  87. package/dist/.next/server/app/dashboard/page.js +2 -2
  88. package/dist/.next/server/app/dashboard/page.js.nft.json +1 -1
  89. package/dist/.next/server/app/dashboard/page_client-reference-manifest.js +1 -1
  90. package/dist/.next/server/app/dashboard.html +1 -1
  91. package/dist/.next/server/app/dashboard.meta +8 -0
  92. package/dist/.next/server/app/dashboard.rsc +3 -3
  93. package/dist/.next/server/app/discoveries/page.js +2 -2
  94. package/dist/.next/server/app/discoveries/page.js.nft.json +1 -1
  95. package/dist/.next/server/app/discoveries/page_client-reference-manifest.js +1 -1
  96. package/dist/.next/server/app/discoveries.html +1 -1
  97. package/dist/.next/server/app/discoveries.meta +8 -0
  98. package/dist/.next/server/app/discoveries.rsc +4 -4
  99. package/dist/.next/server/app/expiry/page.js +2 -2
  100. package/dist/.next/server/app/expiry/page.js.nft.json +1 -1
  101. package/dist/.next/server/app/expiry/page_client-reference-manifest.js +1 -1
  102. package/dist/.next/server/app/expiry.html +1 -1
  103. package/dist/.next/server/app/expiry.meta +8 -0
  104. package/dist/.next/server/app/expiry.rsc +3 -3
  105. package/dist/.next/server/app/fleet/page.js +2 -2
  106. package/dist/.next/server/app/fleet/page.js.nft.json +1 -1
  107. package/dist/.next/server/app/fleet/page_client-reference-manifest.js +1 -1
  108. package/dist/.next/server/app/fleet.html +1 -1
  109. package/dist/.next/server/app/fleet.meta +8 -0
  110. package/dist/.next/server/app/fleet.rsc +3 -3
  111. package/dist/.next/server/app/home/page.js +2 -2
  112. package/dist/.next/server/app/home/page.js.nft.json +1 -1
  113. package/dist/.next/server/app/home/page_client-reference-manifest.js +1 -1
  114. package/dist/.next/server/app/home.html +1 -1
  115. package/dist/.next/server/app/home.meta +8 -0
  116. package/dist/.next/server/app/home.rsc +3 -3
  117. package/dist/.next/server/app/legal/privacy/page.js +2 -2
  118. package/dist/.next/server/app/legal/privacy/page.js.nft.json +1 -1
  119. package/dist/.next/server/app/legal/privacy/page_client-reference-manifest.js +1 -1
  120. package/dist/.next/server/app/legal/terms/page.js +2 -2
  121. package/dist/.next/server/app/legal/terms/page.js.nft.json +1 -1
  122. package/dist/.next/server/app/legal/terms/page_client-reference-manifest.js +1 -1
  123. package/dist/.next/server/app/log/page.js +2 -2
  124. package/dist/.next/server/app/log/page.js.nft.json +1 -1
  125. package/dist/.next/server/app/log/page_client-reference-manifest.js +1 -1
  126. package/dist/.next/server/app/log.html +1 -1
  127. package/dist/.next/server/app/log.meta +8 -0
  128. package/dist/.next/server/app/log.rsc +4 -4
  129. package/dist/.next/server/app/page.js +2 -2
  130. package/dist/.next/server/app/page.js.nft.json +1 -1
  131. package/dist/.next/server/app/page_client-reference-manifest.js +1 -1
  132. package/dist/.next/server/app/projects/page.js +2 -2
  133. package/dist/.next/server/app/projects/page.js.nft.json +1 -1
  134. package/dist/.next/server/app/projects/page_client-reference-manifest.js +1 -1
  135. package/dist/.next/server/app/projects.html +1 -1
  136. package/dist/.next/server/app/projects.meta +8 -0
  137. package/dist/.next/server/app/projects.rsc +4 -4
  138. package/dist/.next/server/app/radar/page.js +2 -2
  139. package/dist/.next/server/app/radar/page.js.nft.json +1 -1
  140. package/dist/.next/server/app/radar/page_client-reference-manifest.js +1 -1
  141. package/dist/.next/server/app/radar.html +1 -1
  142. package/dist/.next/server/app/radar.meta +8 -0
  143. package/dist/.next/server/app/radar.rsc +4 -4
  144. package/dist/.next/server/app/report/page.js +2 -2
  145. package/dist/.next/server/app/report/page.js.nft.json +1 -1
  146. package/dist/.next/server/app/report/page_client-reference-manifest.js +1 -1
  147. package/dist/.next/server/app/report.html +1 -1
  148. package/dist/.next/server/app/report.meta +8 -0
  149. package/dist/.next/server/app/report.rsc +4 -4
  150. package/dist/.next/server/app/settings/page.js +2 -2
  151. package/dist/.next/server/app/settings/page.js.nft.json +1 -1
  152. package/dist/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  153. package/dist/.next/server/app/settings.html +1 -1
  154. package/dist/.next/server/app/settings.meta +8 -0
  155. package/dist/.next/server/app/settings.rsc +4 -4
  156. package/dist/.next/server/app/sites/page.js +2 -2
  157. package/dist/.next/server/app/sites/page.js.nft.json +1 -1
  158. package/dist/.next/server/app/sites/page_client-reference-manifest.js +1 -1
  159. package/dist/.next/server/app/sites.html +1 -1
  160. package/dist/.next/server/app/sites.meta +8 -0
  161. package/dist/.next/server/app/sites.rsc +4 -4
  162. package/dist/.next/server/app/welcome/page.js +2 -2
  163. package/dist/.next/server/app/welcome/page.js.nft.json +1 -1
  164. package/dist/.next/server/app/welcome/page_client-reference-manifest.js +1 -1
  165. package/dist/.next/server/app/welcome.html +1 -1
  166. package/dist/.next/server/app/welcome.meta +8 -0
  167. package/dist/.next/server/app/welcome.rsc +4 -4
  168. package/dist/.next/server/app-paths-manifest.json +18 -18
  169. package/dist/.next/server/chunks/1155.js +1 -0
  170. package/dist/.next/server/chunks/1232.js +1 -0
  171. package/dist/.next/server/chunks/2346.js +1 -1
  172. package/dist/.next/server/chunks/2465.js +20 -20
  173. package/dist/.next/server/chunks/2817.js +1 -1
  174. package/dist/.next/server/chunks/3897.js +22 -0
  175. package/dist/.next/server/chunks/4134.js +1 -1
  176. package/dist/.next/server/chunks/5277.js +1 -0
  177. package/dist/.next/server/chunks/5611.js +1 -1
  178. package/dist/.next/server/chunks/572.js +1 -1
  179. package/dist/.next/server/chunks/6992.js +1 -1
  180. package/dist/.next/server/chunks/7511.js +1 -1
  181. package/dist/.next/server/chunks/7719.js +1 -1
  182. package/dist/.next/server/chunks/8150.js +1 -1
  183. package/dist/.next/server/chunks/8549.js +1 -1
  184. package/dist/.next/server/chunks/9655.js +11 -0
  185. package/dist/.next/server/middleware-build-manifest.js +1 -1
  186. package/dist/.next/server/middleware-manifest.json +5 -5
  187. package/dist/.next/server/pages/404.html +1 -1
  188. package/dist/.next/server/pages/500.html +1 -1
  189. package/dist/.next/server/pages/_document.js.nft.json +1 -1
  190. package/dist/.next/server/pages/_error.js +3 -3
  191. package/dist/.next/server/pages/_error.js.nft.json +1 -1
  192. package/dist/.next/server/pages-manifest.json +1 -1
  193. package/dist/.next/server/server-reference-manifest.json +1 -1
  194. package/dist/.next/static/chunks/1255-5cd2fe06309409a0.js +1 -0
  195. package/dist/.next/static/chunks/2619-3c9e02e22d10480a.js +1 -0
  196. package/dist/.next/static/chunks/3192-7e153722ff079fc6.js +1 -0
  197. package/dist/.next/static/chunks/{7897-b9c15e8805df61ef.js → 7897-52f8a153c1970ef0.js} +1 -1
  198. package/dist/.next/static/chunks/8050-6c17ccfd85ac3208.js +1 -0
  199. package/dist/.next/static/chunks/app/ahead/{page-75602559f92be6c4.js → page-f5789a03967af6e1.js} +1 -1
  200. package/dist/.next/static/chunks/app/connections/{page-ff9d0b4e4fcf5ebe.js → page-5b833f9485623b92.js} +1 -1
  201. package/dist/.next/static/chunks/app/discoveries/{page-6b06c0c2a94f3b94.js → page-337bb60e4cbdcebb.js} +1 -1
  202. package/dist/.next/static/chunks/app/{error-c67c297ef2dd70de.js → error-b32d8c6d4bfa070e.js} +1 -1
  203. package/dist/.next/static/chunks/app/{layout-d14e087b541b48b1.js → layout-0f3f0098b5d1e6be.js} +1 -1
  204. package/dist/.next/static/chunks/app/log/{page-842048c36f071dd6.js → page-1711fe02581c58e8.js} +1 -1
  205. package/dist/.next/static/chunks/app/projects/page-b05c7b0c3284db79.js +1 -0
  206. package/dist/.next/static/chunks/app/radar/page-2c972e78ae153706.js +1 -0
  207. package/dist/.next/static/chunks/app/report/page-6bd98ca320f3730c.js +1 -0
  208. package/dist/.next/static/chunks/app/settings/{page-582279bf3fe509d4.js → page-d50e8193d000c9be.js} +1 -1
  209. package/dist/.next/static/chunks/app/sites/page-80cc0a08ae2339a8.js +1 -0
  210. package/dist/.next/static/chunks/app/welcome/{page-d26225bed7e1ad39.js → page-f2cd15c4b50942bc.js} +1 -1
  211. package/dist/.next/static/chunks/main-8e42304858de4a63.js +1 -0
  212. package/dist/.next/static/css/5ddef273a3ac3217.css +1 -0
  213. package/dist/build-id.json +225 -223
  214. package/dist/node_modules/@next/env/package.json +1 -1
  215. package/dist/node_modules/next/dist/build/swc/index.js +1 -1
  216. package/dist/node_modules/next/dist/build/webpack-config.js +2 -2
  217. package/dist/node_modules/next/dist/compiled/hash.js/sha256/256.js +1 -0
  218. package/dist/node_modules/next/dist/compiled/hash.js/sha256/package.json +1 -0
  219. package/dist/node_modules/next/dist/compiled/next-server/app-page-experimental.runtime.prod.js +13 -13
  220. package/dist/node_modules/next/dist/compiled/next-server/app-page-turbo-experimental.runtime.prod.js +13 -13
  221. package/dist/node_modules/next/dist/compiled/next-server/app-page-turbo.runtime.prod.js +10 -10
  222. package/dist/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js +11 -11
  223. package/dist/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js +2 -2
  224. package/dist/node_modules/next/dist/compiled/next-server/pages-turbo.runtime.prod.js +9 -9
  225. package/dist/node_modules/next/dist/compiled/next-server/pages.runtime.prod.js +8 -8
  226. package/dist/node_modules/next/dist/server/base-server.js +2 -5
  227. package/dist/node_modules/next/dist/server/dev/hot-reloader-turbopack.js +1 -1
  228. package/dist/node_modules/next/dist/server/dev/hot-reloader-webpack.js +1 -1
  229. package/dist/node_modules/next/dist/server/image-optimizer.js +46 -3
  230. package/dist/node_modules/next/dist/server/lib/app-info-log.js +1 -1
  231. package/dist/node_modules/next/dist/server/lib/incremental-cache/file-system-cache.js +180 -19
  232. package/dist/node_modules/next/dist/server/lib/incremental-cache/index.js +36 -17
  233. package/dist/node_modules/next/dist/server/lib/incremental-cache/memory-cache.external.js +3 -3
  234. package/dist/node_modules/next/dist/server/lib/incremental-cache/shared-cache-controls.external.js +14 -6
  235. package/dist/node_modules/next/dist/server/lib/match-next-data-pathname.js +3 -1
  236. package/dist/node_modules/next/dist/server/lib/node-fs-methods.js +14 -0
  237. package/dist/node_modules/next/dist/server/lib/route-cache-key.js +77 -0
  238. package/dist/node_modules/next/dist/server/lib/start-server.js +1 -1
  239. package/dist/node_modules/next/dist/server/next-server.js +8 -6
  240. package/dist/node_modules/next/dist/server/response-cache/index.js +31 -15
  241. package/dist/node_modules/next/dist/server/route-matcher-providers/app-page-route-matcher-provider.js +2 -2
  242. package/dist/node_modules/next/dist/server/route-modules/pages/pages-handler.js +6 -1
  243. package/dist/node_modules/next/dist/server/route-modules/route-module.js +9 -2
  244. package/dist/node_modules/next/dist/shared/lib/canary-only.js +1 -1
  245. package/dist/node_modules/next/dist/shared/lib/router/utils/app-paths.js +17 -1
  246. package/dist/node_modules/next/dist/telemetry/anonymous-meta.js +1 -1
  247. package/dist/node_modules/next/dist/telemetry/events/version.js +2 -2
  248. package/dist/node_modules/next/package.json +11 -11
  249. package/dist/node_modules/source-map-js/lib/quick-sort.js +10 -1
  250. package/dist/node_modules/source-map-js/lib/source-map-consumer.js +51 -3
  251. package/dist/node_modules/source-map-js/lib/source-map-generator.js +6 -4
  252. package/dist/node_modules/source-map-js/lib/source-node.js +7 -0
  253. package/dist/node_modules/source-map-js/package.json +1 -1
  254. package/dist/package.json +3 -3
  255. package/dist/shell/bin/af360-bridge.exe +0 -0
  256. package/docs/legal/PRIVACY.md +1 -1
  257. package/lib/mask.mjs +21 -1
  258. package/package.json +3 -3
  259. package/scripts/mcp-server.mjs +19 -9
  260. package/shell/bin/af360-bridge.exe +0 -0
  261. package/dist/.next/server/chunks/1331.js +0 -22
  262. package/dist/.next/server/chunks/4825.js +0 -1
  263. package/dist/.next/server/chunks/8134.js +0 -11
  264. package/dist/.next/server/chunks/9946.js +0 -1
  265. package/dist/.next/static/chunks/1255-fc6c00ab2f765339.js +0 -1
  266. package/dist/.next/static/chunks/3192-40ade9877c89ec45.js +0 -1
  267. package/dist/.next/static/chunks/8050-a75457e83cd8be0f.js +0 -1
  268. package/dist/.next/static/chunks/app/projects/page-1d6b330842a2ff80.js +0 -1
  269. package/dist/.next/static/chunks/app/radar/page-584b42327baac21b.js +0 -1
  270. package/dist/.next/static/chunks/app/report/page-9dc52d7f76569e42.js +0 -1
  271. package/dist/.next/static/chunks/app/sites/page-3dcc5a0990fae677.js +0 -1
  272. package/dist/.next/static/chunks/main-574ae5bf2f2165c4.js +0 -1
  273. package/dist/.next/static/css/9b639a814d15c5ff.css +0 -1
  274. /package/dist/.next/static/{4602553707d90d0fadeba → be31a391928486d5659f1}/_buildManifest.js +0 -0
  275. /package/dist/.next/static/{4602553707d90d0fadeba → be31a391928486d5659f1}/_ssgManifest.js +0 -0
@@ -417,9 +417,6 @@ class Server {
417
417
  // wait. Also we can't `await` in the constructor.
418
418
  void this.matchers.reload();
419
419
  this.setAssetPrefix(assetPrefix);
420
- this.responseCache = this.getResponseCache({
421
- dev
422
- });
423
420
  }
424
421
  getRouteMatchers() {
425
422
  // Create a new manifest loader that get's the manifests from the server.
@@ -1462,8 +1459,8 @@ class Server {
1462
1459
  const isAppPath = Array.isArray(appPaths);
1463
1460
  let page = pathname;
1464
1461
  if (isAppPath) {
1465
- // the last item in the array is the root page, if there are parallel routes
1466
- page = appPaths[appPaths.length - 1];
1462
+ // Use the same direct entry as the build, independent of manifest order.
1463
+ page = (0, _apppaths.selectAppPageEntry)(pathname, appPaths);
1467
1464
  }
1468
1465
  const result = await this.findPageComponents({
1469
1466
  locale: (0, _requestmeta.getRequestMeta)(ctx.req, 'locale'),
@@ -145,7 +145,7 @@ async function createHotReloaderTurbopack(opts, serverFields, distDir, resetFetc
145
145
  }
146
146
  const hasRewrites = opts.fsChecker.rewrites.afterFiles.length > 0 || opts.fsChecker.rewrites.beforeFiles.length > 0 || opts.fsChecker.rewrites.fallback.length > 0;
147
147
  const hotReloaderSpan = (0, _trace.trace)('hot-reloader', undefined, {
148
- version: "15.5.24"
148
+ version: "15.5.27"
149
149
  });
150
150
  // Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing
151
151
  // of the current `next dev` invocation.
@@ -262,7 +262,7 @@ class HotReloaderWebpack {
262
262
  this.previewProps = previewProps;
263
263
  this.rewrites = rewrites;
264
264
  this.hotReloaderSpan = (0, _trace.trace)('hot-reloader', undefined, {
265
- version: "15.5.24"
265
+ version: "15.5.27"
266
266
  });
267
267
  // Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing
268
268
  // of the current `next dev` invocation.
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  0 && (module.exports = {
6
6
  ImageError: null,
7
7
  ImageOptimizerCache: null,
8
+ canDecodeAvif: null,
8
9
  detectContentType: null,
9
10
  extractEtag: null,
10
11
  fetchExternalImage: null,
@@ -16,6 +17,7 @@ Object.defineProperty(exports, "__esModule", {
16
17
  getPreviouslyCachedImageOrNull: null,
17
18
  getSharp: null,
18
19
  imageOptimizer: null,
20
+ isAvifDecodeSafe: null,
19
21
  optimizeImage: null,
20
22
  sendResponse: null
21
23
  });
@@ -32,6 +34,9 @@ _export(exports, {
32
34
  ImageOptimizerCache: function() {
33
35
  return ImageOptimizerCache;
34
36
  },
37
+ canDecodeAvif: function() {
38
+ return canDecodeAvif;
39
+ },
35
40
  detectContentType: function() {
36
41
  return detectContentType;
37
42
  },
@@ -65,6 +70,9 @@ _export(exports, {
65
70
  imageOptimizer: function() {
66
71
  return imageOptimizer;
67
72
  },
73
+ isAvifDecodeSafe: function() {
74
+ return isAvifDecodeSafe;
75
+ },
68
76
  optimizeImage: function() {
69
77
  return optimizeImage;
70
78
  },
@@ -165,8 +173,7 @@ const BYPASS_TYPES = [
165
173
  ICNS,
166
174
  BMP,
167
175
  JXL,
168
- HEIC,
169
- AVIF
176
+ HEIC
170
177
  ];
171
178
  const BLUR_IMG_SIZE = 8 // should match `next-image-loader`
172
179
  ;
@@ -196,6 +203,7 @@ function getSharp(concurrency) {
196
203
  return _sharp;
197
204
  }
198
205
  try {
206
+ var _sharp_versions;
199
207
  // eslint-disable-next-line @next/internal/typechecked-require -- sharp 0.34 and 0.35 type the module differently, see SharpModule
200
208
  _sharp = require('sharp');
201
209
  _sharp.block({
@@ -213,6 +221,13 @@ function getSharp(concurrency) {
213
221
  'VipsForeignLoadWebp'
214
222
  ]
215
223
  });
224
+ if (isAvifDecodeSafe(((_sharp_versions = _sharp.versions) == null ? void 0 : _sharp_versions.heif) ?? null)) {
225
+ _sharp.unblock({
226
+ operation: [
227
+ 'VipsForeignLoadHeif'
228
+ ]
229
+ });
230
+ }
216
231
  if (_sharp && _sharp.concurrency() > 1) {
217
232
  // Reducing concurrency should reduce the memory usage too.
218
233
  // We more aggressively reduce in dev but also reduce in prod.
@@ -232,6 +247,34 @@ function getSharp(concurrency) {
232
247
  }
233
248
  return _sharp;
234
249
  }
250
+ function isAvifDecodeSafe(heifVersion) {
251
+ if (heifVersion === null) {
252
+ return false;
253
+ }
254
+ const [major = Number.NaN, minor = Number.NaN, patch = Number.NaN] = heifVersion.split('.').map((part)=>Number.parseInt(part, 10));
255
+ if (Number.isNaN(major) || Number.isNaN(minor) || Number.isNaN(patch)) {
256
+ return false;
257
+ }
258
+ return major > 1 || major === 1 && minor > 23 || major === 1 && minor === 23 && patch >= 2;
259
+ }
260
+ let _avifDecodeSafe = null;
261
+ function canDecodeAvif(concurrency) {
262
+ if (_avifDecodeSafe === null) {
263
+ let heifVersion = null;
264
+ try {
265
+ var _getSharp_versions;
266
+ // Custom libvips builds do not report dependency versions, so the
267
+ // absence of a heif version is treated as unsafe.
268
+ heifVersion = ((_getSharp_versions = getSharp(concurrency).versions) == null ? void 0 : _getSharp_versions.heif) ?? null;
269
+ } catch {
270
+ // Without sharp no AVIF can be decoded either, so treat it as unsafe
271
+ // and let the image pass through unoptimized.
272
+ heifVersion = null;
273
+ }
274
+ _avifDecodeSafe = isAvifDecodeSafe(heifVersion);
275
+ }
276
+ return _avifDecodeSafe;
277
+ }
235
278
  function getSupportedMimeType(options, accept = '') {
236
279
  const mimeType = (0, _accept.mediaType)(accept, options);
237
280
  return accept.includes(mimeType) ? mimeType : '';
@@ -1000,7 +1043,7 @@ async function imageOptimizer(imageUpstream, paramsResult, nextConfig, opts) {
1000
1043
  upstreamEtag
1001
1044
  };
1002
1045
  }
1003
- if (BYPASS_TYPES.includes(upstreamType)) {
1046
+ if (BYPASS_TYPES.includes(upstreamType) || upstreamType === AVIF && !canDecodeAvif(nextConfig.experimental.imgOptConcurrency)) {
1004
1047
  return {
1005
1048
  buffer: upstreamBuffer,
1006
1049
  contentType: upstreamType,
@@ -80,7 +80,7 @@ function logStartInfo({ networkUrl, appUrl, envInfo, experimentalFeatures, maxEx
80
80
  } else {
81
81
  bundlerSuffix = '';
82
82
  }
83
- _log.bootstrap(`${(0, _picocolors.bold)((0, _picocolors.purple)(`${_log.prefixes.ready} Next.js ${"15.5.24"}`))}${bundlerSuffix}`);
83
+ _log.bootstrap(`${(0, _picocolors.bold)((0, _picocolors.purple)(`${_log.prefixes.ready} Next.js ${"15.5.27"}`))}${bundlerSuffix}`);
84
84
  if (appUrl) {
85
85
  _log.bootstrap(`- Local: ${appUrl}`);
86
86
  }
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "default", {
8
8
  return FileSystemCache;
9
9
  }
10
10
  });
11
+ const _routecachekey = require("../route-cache-key");
11
12
  const _responsecache = require("../../response-cache");
12
13
  const _path = /*#__PURE__*/ _interop_require_default(require("../../../shared/lib/isomorphic/path"));
13
14
  const _constants = require("../../../lib/constants");
@@ -21,6 +22,7 @@ function _interop_require_default(obj) {
21
22
  }
22
23
  class FileSystemCache {
23
24
  static #_ = this.debug = !!process.env.NEXT_PRIVATE_DEBUG_CACHE;
25
+ static #_2 = this.seedReads = new Map();
24
26
  constructor(ctx){
25
27
  this.fs = ctx.fs;
26
28
  this.flushToDisk = ctx.flushToDisk;
@@ -40,6 +42,32 @@ class FileSystemCache {
40
42
  }
41
43
  }
42
44
  resetRequestCache() {}
45
+ getSeedReadState(key) {
46
+ return FileSystemCache.seedReads.get(`${this.serverDistDir}:${key}`);
47
+ }
48
+ beginSeedRead(key) {
49
+ const stateKey = `${this.serverDistDir}:${key}`;
50
+ let state = FileSystemCache.seedReads.get(stateKey);
51
+ if (!state) {
52
+ state = {
53
+ readers: 0,
54
+ version: 0
55
+ };
56
+ FileSystemCache.seedReads.set(stateKey, state);
57
+ }
58
+ state.readers++;
59
+ return {
60
+ stateKey,
61
+ state,
62
+ version: state.version
63
+ };
64
+ }
65
+ finishSeedRead(stateKey, state) {
66
+ state.readers--;
67
+ if (state.readers === 0 && !state.promotion) {
68
+ FileSystemCache.seedReads.delete(stateKey);
69
+ }
70
+ }
43
71
  async revalidateTag(...args) {
44
72
  let [tags] = args;
45
73
  tags = typeof tags === 'string' ? [
@@ -58,10 +86,18 @@ class FileSystemCache {
58
86
  }
59
87
  }
60
88
  async get(...args) {
61
- var _FileSystemCache_memoryCache, _data_value, _data_value1, _data_value2, _data_value3;
89
+ var _FileSystemCache_memoryCache, _this_getSeedReadState, _data_value, _data_value1, _data_value2, _data_value3;
62
90
  const [key, ctx] = args;
63
91
  const { kind } = ctx;
92
+ let readKey = key;
93
+ let seedRead;
64
94
  let data = (_FileSystemCache_memoryCache = FileSystemCache.memoryCache) == null ? void 0 : _FileSystemCache_memoryCache.get(key);
95
+ const activePromotion = (_this_getSeedReadState = this.getSeedReadState(key)) == null ? void 0 : _this_getSeedReadState.promotion;
96
+ if (!data && activePromotion) {
97
+ var _FileSystemCache_memoryCache1;
98
+ await activePromotion;
99
+ data = (_FileSystemCache_memoryCache1 = FileSystemCache.memoryCache) == null ? void 0 : _FileSystemCache_memoryCache1.get(key);
100
+ }
65
101
  if (FileSystemCache.debug) {
66
102
  if (kind === _responsecache.IncrementalCacheKind.FETCH) {
67
103
  console.log('get', key, ctx.tags, kind, !!data);
@@ -69,16 +105,40 @@ class FileSystemCache {
69
105
  console.log('get', key, kind, !!data);
70
106
  }
71
107
  }
72
- // let's check the disk for seed data
108
+ const isResponse = kind === _responsecache.IncrementalCacheKind.PAGES || kind === _responsecache.IncrementalCacheKind.APP_PAGE || kind === _responsecache.IncrementalCacheKind.APP_ROUTE;
109
+ if (!data && isResponse && key.startsWith(`/${_routecachekey.ROUTE_CACHE_DIRECTORY}/`) && process.env.NEXT_RUNTIME !== 'edge') {
110
+ const primaryPath = this.getFilePath(kind === _responsecache.IncrementalCacheKind.APP_ROUTE ? `${key}.body` : `${key}.html`, kind);
111
+ if (!this.fs.existsSync(primaryPath)) {
112
+ const marker = key.indexOf('/$/');
113
+ if (marker !== -1) {
114
+ const legacyKey = key.slice(marker + 2);
115
+ const legacyMetaPath = this.getFilePath(`${legacyKey}${_constants.NEXT_META_SUFFIX}`, kind);
116
+ try {
117
+ var _meta_routeCache;
118
+ const meta = JSON.parse(this.fs.readFileSync(legacyMetaPath, 'utf8'));
119
+ const namespaceEnd = key.indexOf('/$/');
120
+ const ownerKey = meta.routeCache ? (0, _routecachekey.getRouteCacheKey)('/', meta.routeCache.owner) : undefined;
121
+ if (((_meta_routeCache = meta.routeCache) == null ? void 0 : _meta_routeCache.key) === key && (meta.routeCache.isFallback === Boolean(ctx.isFallback) || // PPR also reads fallback shells through ordinary response and
122
+ // navigation resume-data lookups, which set isFallback: false.
123
+ kind === _responsecache.IncrementalCacheKind.APP_PAGE && ctx.isRoutePPREnabled && meta.postponed != null) && (ownerKey == null ? void 0 : ownerKey.slice(0, ownerKey.indexOf('/$/'))) === key.slice(0, namespaceEnd)) {
124
+ readKey = legacyKey;
125
+ seedRead = this.beginSeedRead(key);
126
+ }
127
+ } catch {}
128
+ }
129
+ }
130
+ }
131
+ // Check the scoped disk entry first, or a verified immutable build seed
132
+ // only when its scoped primary payload is genuinely absent.
73
133
  if (!data && process.env.NEXT_RUNTIME !== 'edge') {
74
134
  try {
75
135
  if (kind === _responsecache.IncrementalCacheKind.APP_ROUTE) {
76
- const filePath = this.getFilePath(`${key}.body`, _responsecache.IncrementalCacheKind.APP_ROUTE);
136
+ const filePath = this.getFilePath(`${readKey}.body`, _responsecache.IncrementalCacheKind.APP_ROUTE);
77
137
  const fileData = await this.fs.readFile(filePath);
78
138
  const { mtime } = await this.fs.stat(filePath);
79
139
  const meta = JSON.parse(await this.fs.readFile(filePath.replace(/\.body$/, _constants.NEXT_META_SUFFIX), 'utf8'));
80
140
  data = {
81
- lastModified: mtime.getTime(),
141
+ lastModified: meta.routeCacheLastModified ?? mtime.getTime(),
82
142
  value: {
83
143
  kind: _responsecache.CachedRouteKind.APP_ROUTE,
84
144
  body: fileData,
@@ -87,7 +147,7 @@ class FileSystemCache {
87
147
  }
88
148
  };
89
149
  } else {
90
- const filePath = this.getFilePath(kind === _responsecache.IncrementalCacheKind.FETCH ? key : `${key}.html`, kind);
150
+ const filePath = this.getFilePath(kind === _responsecache.IncrementalCacheKind.FETCH ? readKey : `${readKey}.html`, kind);
91
151
  const fileData = await this.fs.readFile(filePath, 'utf8');
92
152
  const { mtime } = await this.fs.stat(filePath);
93
153
  if (kind === _responsecache.IncrementalCacheKind.FETCH) {
@@ -119,12 +179,10 @@ class FileSystemCache {
119
179
  }
120
180
  }
121
181
  } else if (kind === _responsecache.IncrementalCacheKind.APP_PAGE) {
122
- // We try to load the metadata file, but if it fails, we don't
123
- // error. We also don't load it if this is a fallback.
124
- let meta;
125
- try {
126
- meta = JSON.parse(await this.fs.readFile(filePath.replace(/\.html$/, _constants.NEXT_META_SUFFIX), 'utf8'));
127
- } catch {}
182
+ // Metadata is required for both normal entries and fallback shells.
183
+ // Promoted entries publish their primary payload last, so a missing
184
+ // sidecar means the scoped entry is incomplete.
185
+ const meta = JSON.parse(await this.fs.readFile(filePath.replace(/\.html$/, _constants.NEXT_META_SUFFIX), 'utf8'));
128
186
  let maybeSegmentData;
129
187
  if (meta == null ? void 0 : meta.segmentPaths) {
130
188
  // Collect all the segment data for this page.
@@ -134,7 +192,7 @@ class FileSystemCache {
134
192
  // identical regardless.
135
193
  const segmentData = new Map();
136
194
  maybeSegmentData = segmentData;
137
- const segmentsDir = key + _constants.RSC_SEGMENTS_DIR_SUFFIX;
195
+ const segmentsDir = readKey + _constants.RSC_SEGMENTS_DIR_SUFFIX;
138
196
  await Promise.all(meta.segmentPaths.map(async (segmentPath)=>{
139
197
  const segmentDataFilePath = this.getFilePath(segmentsDir + segmentPath + _constants.RSC_SEGMENT_SUFFIX, _responsecache.IncrementalCacheKind.APP_PAGE);
140
198
  try {
@@ -148,10 +206,10 @@ class FileSystemCache {
148
206
  }
149
207
  let rscData;
150
208
  if (!ctx.isFallback) {
151
- rscData = await this.fs.readFile(this.getFilePath(`${key}${ctx.isRoutePPREnabled ? _constants.RSC_PREFETCH_SUFFIX : _constants.RSC_SUFFIX}`, _responsecache.IncrementalCacheKind.APP_PAGE));
209
+ rscData = await this.fs.readFile(this.getFilePath(`${readKey}${ctx.isRoutePPREnabled ? _constants.RSC_PREFETCH_SUFFIX : _constants.RSC_SUFFIX}`, _responsecache.IncrementalCacheKind.APP_PAGE));
152
210
  }
153
211
  data = {
154
- lastModified: mtime.getTime(),
212
+ lastModified: meta.routeCacheLastModified ?? mtime.getTime(),
155
213
  value: {
156
214
  kind: _responsecache.CachedRouteKind.APP_PAGE,
157
215
  html: fileData,
@@ -163,13 +221,13 @@ class FileSystemCache {
163
221
  }
164
222
  };
165
223
  } else if (kind === _responsecache.IncrementalCacheKind.PAGES) {
166
- let meta;
224
+ const meta = JSON.parse(await this.fs.readFile(filePath.replace(/\.html$/, _constants.NEXT_META_SUFFIX), 'utf8'));
167
225
  let pageData = {};
168
226
  if (!ctx.isFallback) {
169
- pageData = JSON.parse(await this.fs.readFile(this.getFilePath(`${key}${_constants.NEXT_DATA_SUFFIX}`, _responsecache.IncrementalCacheKind.PAGES), 'utf8'));
227
+ pageData = JSON.parse(await this.fs.readFile(this.getFilePath(`${readKey}${_constants.NEXT_DATA_SUFFIX}`, _responsecache.IncrementalCacheKind.PAGES), 'utf8'));
170
228
  }
171
229
  data = {
172
- lastModified: mtime.getTime(),
230
+ lastModified: meta.routeCacheLastModified ?? mtime.getTime(),
173
231
  value: {
174
232
  kind: _responsecache.CachedRouteKind.PAGES,
175
233
  html: fileData,
@@ -187,10 +245,15 @@ class FileSystemCache {
187
245
  }
188
246
  }
189
247
  if (data) {
190
- var _FileSystemCache_memoryCache1;
191
- (_FileSystemCache_memoryCache1 = FileSystemCache.memoryCache) == null ? void 0 : _FileSystemCache_memoryCache1.set(key, data);
248
+ if (!seedRead) {
249
+ var _FileSystemCache_memoryCache2;
250
+ (_FileSystemCache_memoryCache2 = FileSystemCache.memoryCache) == null ? void 0 : _FileSystemCache_memoryCache2.set(key, data);
251
+ }
192
252
  }
193
253
  } catch {
254
+ if (seedRead) {
255
+ this.finishSeedRead(seedRead.stateKey, seedRead.state);
256
+ }
194
257
  return null;
195
258
  }
196
259
  }
@@ -206,6 +269,9 @@ class FileSystemCache {
206
269
  // had a tag revalidated, if we want to be a background
207
270
  // revalidation instead we return data.lastModified = -1
208
271
  if ((0, _tagsmanifestexternal.isStale)(cacheTags, (data == null ? void 0 : data.lastModified) || Date.now())) {
272
+ if (seedRead) {
273
+ this.finishSeedRead(seedRead.stateKey, seedRead.state);
274
+ }
209
275
  return null;
210
276
  }
211
277
  }
@@ -228,10 +294,92 @@ class FileSystemCache {
228
294
  data = undefined;
229
295
  }
230
296
  }
297
+ if (seedRead && data) {
298
+ const { stateKey, state, version } = seedRead;
299
+ try {
300
+ if (state.version === version) {
301
+ var _FileSystemCache_memoryCache3;
302
+ await this.promoteSeed(key, readKey, data, ctx, stateKey, state, version);
303
+ if (state.version === version && !((_FileSystemCache_memoryCache3 = FileSystemCache.memoryCache) == null ? void 0 : _FileSystemCache_memoryCache3.get(key))) {
304
+ var _FileSystemCache_memoryCache4;
305
+ (_FileSystemCache_memoryCache4 = FileSystemCache.memoryCache) == null ? void 0 : _FileSystemCache_memoryCache4.set(key, data);
306
+ }
307
+ }
308
+ } finally{
309
+ this.finishSeedRead(stateKey, state);
310
+ }
311
+ }
231
312
  return data ?? null;
232
313
  }
314
+ async promoteSeed(key, seedKey, data, ctx, stateKey, state, version) {
315
+ const writeFileAtomic = this.fs.writeFileAtomic;
316
+ if (!this.flushToDisk || !writeFileAtomic || !data.value) return;
317
+ if (state.promotion) {
318
+ await state.promotion;
319
+ return;
320
+ }
321
+ const promotion = (async ()=>{
322
+ const value = data.value;
323
+ if (!value || state.version !== version || value.kind !== _responsecache.CachedRouteKind.PAGES && value.kind !== _responsecache.CachedRouteKind.APP_PAGE && value.kind !== _responsecache.CachedRouteKind.APP_ROUTE) {
324
+ return;
325
+ }
326
+ const kind = ctx.kind;
327
+ const primaryPath = this.getFilePath(value.kind === _responsecache.CachedRouteKind.APP_ROUTE ? `${key}.body` : `${key}.html`, kind);
328
+ if (this.fs.existsSync(primaryPath)) return;
329
+ const seedPrimaryPath = this.getFilePath(value.kind === _responsecache.CachedRouteKind.APP_ROUTE ? `${seedKey}.body` : `${seedKey}.html`, kind);
330
+ const seedMetaPath = seedPrimaryPath.replace(value.kind === _responsecache.CachedRouteKind.APP_ROUTE ? /\.body$/ : /\.html$/, _constants.NEXT_META_SUFFIX);
331
+ const meta = JSON.parse(await this.fs.readFile(seedMetaPath, 'utf8'));
332
+ meta.routeCacheLastModified = data.lastModified;
333
+ // Copy every ancillary seed file first. The scoped primary payload is
334
+ // the publication marker and is written only after metadata is complete.
335
+ const ancillaryFiles = [];
336
+ if (value.kind === _responsecache.CachedRouteKind.PAGES && !ctx.isFallback) {
337
+ ancillaryFiles.push({
338
+ path: this.getFilePath(`${key}${_constants.NEXT_DATA_SUFFIX}`, kind),
339
+ data: await this.fs.readFile(this.getFilePath(`${seedKey}${_constants.NEXT_DATA_SUFFIX}`, kind))
340
+ });
341
+ } else if (value.kind === _responsecache.CachedRouteKind.APP_PAGE) {
342
+ const rscSuffix = ctx.isRoutePPREnabled ? _constants.RSC_PREFETCH_SUFFIX : _constants.RSC_SUFFIX;
343
+ const seedRscPath = this.getFilePath(`${seedKey}${rscSuffix}`, kind);
344
+ // Next 15 PPR shells can include a full prefetch payload even when
345
+ // first read as a fallback. Preserve it for subsequent ordinary reads.
346
+ if (!ctx.isFallback || ctx.isRoutePPREnabled && this.fs.existsSync(seedRscPath)) {
347
+ ancillaryFiles.push({
348
+ path: this.getFilePath(`${key}${rscSuffix}`, kind),
349
+ data: await this.fs.readFile(seedRscPath)
350
+ });
351
+ }
352
+ ancillaryFiles.push(...await Promise.all((meta.segmentPaths ?? []).map(async (segmentPath)=>({
353
+ path: this.getFilePath(key + _constants.RSC_SEGMENTS_DIR_SUFFIX + segmentPath + _constants.RSC_SEGMENT_SUFFIX, kind),
354
+ data: await this.fs.readFile(this.getFilePath(seedKey + _constants.RSC_SEGMENTS_DIR_SUFFIX + segmentPath + _constants.RSC_SEGMENT_SUFFIX, kind))
355
+ }))));
356
+ }
357
+ const writer = new _multifilewriter.MultiFileWriter(this.fs);
358
+ for (const file of ancillaryFiles)writer.append(file.path, file.data);
359
+ await writer.wait();
360
+ if (state.version !== version) return;
361
+ const metaPath = primaryPath.replace(value.kind === _responsecache.CachedRouteKind.APP_ROUTE ? /\.body$/ : /\.html$/, _constants.NEXT_META_SUFFIX);
362
+ await this.fs.mkdir(_path.default.dirname(metaPath));
363
+ await this.fs.writeFile(metaPath, JSON.stringify(meta));
364
+ if (state.version !== version || this.fs.existsSync(primaryPath)) return;
365
+ await writeFileAtomic.call(this.fs, primaryPath, await this.fs.readFile(seedPrimaryPath));
366
+ })();
367
+ state.promotion = promotion.catch((error)=>{
368
+ if (FileSystemCache.debug) {
369
+ console.log('FileSystemCache: failed to promote build seed', error);
370
+ }
371
+ });
372
+ try {
373
+ await state.promotion;
374
+ } finally{
375
+ if (state.promotion) state.promotion = undefined;
376
+ if (state.readers === 0) FileSystemCache.seedReads.delete(stateKey);
377
+ }
378
+ }
233
379
  async set(key, data, ctx) {
234
380
  var _FileSystemCache_memoryCache;
381
+ const seedState = this.getSeedReadState(key);
382
+ if (seedState) seedState.version++;
235
383
  (_FileSystemCache_memoryCache = FileSystemCache.memoryCache) == null ? void 0 : _FileSystemCache_memoryCache.set(key, {
236
384
  value: data,
237
385
  lastModified: Date.now()
@@ -240,6 +388,7 @@ class FileSystemCache {
240
388
  console.log('set', key);
241
389
  }
242
390
  if (!this.flushToDisk || !data) return;
391
+ await (seedState == null ? void 0 : seedState.promotion);
243
392
  // Create a new writer that will prepare to write all the files to disk
244
393
  // after their containing directory is created.
245
394
  const writer = new _multifilewriter.MultiFileWriter(this.fs);
@@ -279,6 +428,14 @@ class FileSystemCache {
279
428
  segmentPaths
280
429
  };
281
430
  writer.append(htmlPath.replace(/\.html$/, _constants.NEXT_META_SUFFIX), JSON.stringify(meta));
431
+ } else {
432
+ const meta = {
433
+ headers: data.headers,
434
+ status: data.status,
435
+ postponed: undefined,
436
+ segmentPaths: undefined
437
+ };
438
+ writer.append(htmlPath.replace(/\.html$/, _constants.NEXT_META_SUFFIX), JSON.stringify(meta));
282
439
  }
283
440
  } else if (data.kind === _responsecache.CachedRouteKind.FETCH) {
284
441
  const filePath = this.getFilePath(key, _responsecache.IncrementalCacheKind.FETCH);
@@ -313,6 +470,10 @@ class FileSystemCache {
313
470
  configurable: true
314
471
  });
315
472
  }
473
+ // Scoped response artifacts live outside the compiled route and ASO files.
474
+ if ((kind === _responsecache.IncrementalCacheKind.PAGES || kind === _responsecache.IncrementalCacheKind.APP_PAGE || kind === _responsecache.IncrementalCacheKind.APP_ROUTE) && key.startsWith(`/${_routecachekey.ROUTE_CACHE_DIRECTORY}/`)) {
475
+ rootDir = _path.default.join(this.serverDistDir, '.');
476
+ }
316
477
  const filePath = _path.default.join(rootDir, key);
317
478
  if (!(filePath.startsWith(rootDir + _path.default.sep) || filePath === rootDir)) {
318
479
  throw Object.defineProperty(new Error(`Invalid file path: ${filePath}`), "__NEXT_ERROR_CODE", {
@@ -20,11 +20,10 @@ _export(exports, {
20
20
  return IncrementalCache;
21
21
  }
22
22
  });
23
+ const _routecachekey = require("../route-cache-key");
23
24
  const _responsecache = require("../../response-cache");
24
25
  const _filesystemcache = /*#__PURE__*/ _interop_require_default(require("./file-system-cache"));
25
- const _normalizepagepath = require("../../../shared/lib/page-path/normalize-page-path");
26
26
  const _constants = require("../../../lib/constants");
27
- const _toroute = require("../to-route");
28
27
  const _sharedcachecontrolsexternal = require("./shared-cache-controls.external");
29
28
  const _workunitasyncstorageexternal = require("../../app-render/work-unit-async-storage.external");
30
29
  const _invarianterror = require("../../../shared/lib/invariant-error");
@@ -88,7 +87,7 @@ async function hashString(cacheString) {
88
87
  const MAIN_KEY_PREFIX = 'v4';
89
88
  class IncrementalCache {
90
89
  static #_ = this.debug = !!process.env.NEXT_PRIVATE_DEBUG_CACHE;
91
- constructor({ fs, dev, flushToDisk, minimalMode, serverDistDir, requestHeaders, maxMemoryCacheSize, getPrerenderManifest, fetchCacheKeyPrefix, CurCacheHandler, allowedRevalidateHeaderKeys }){
90
+ constructor({ fs, dev, flushToDisk, minimalMode, serverDistDir, requestHeaders, maxMemoryCacheSize, getPrerenderManifest, fetchCacheKeyPrefix, CurCacheHandler, allowedRevalidateHeaderKeys, locales }){
92
91
  var _this_prerenderManifest_preview, _this_prerenderManifest;
93
92
  this.locks = new Map();
94
93
  this.hasCustomCacheHandler = Boolean(CurCacheHandler);
@@ -123,7 +122,8 @@ class IncrementalCache {
123
122
  this.requestHeaders = requestHeaders;
124
123
  this.allowedRevalidateHeaderKeys = allowedRevalidateHeaderKeys;
125
124
  this.prerenderManifest = getPrerenderManifest();
126
- this.cacheControls = new _sharedcachecontrolsexternal.SharedCacheControls(this.prerenderManifest);
125
+ this.locales = locales;
126
+ this.cacheControls = new _sharedcachecontrolsexternal.SharedCacheControls(this.prerenderManifest, locales);
127
127
  this.fetchCacheKeyPrefix = fetchCacheKeyPrefix;
128
128
  let revalidatedTags = [];
129
129
  if (requestHeaders[_constants.PRERENDER_REVALIDATE_HEADER] === ((_this_prerenderManifest = this.prerenderManifest) == null ? void 0 : (_this_prerenderManifest_preview = _this_prerenderManifest.preview) == null ? void 0 : _this_prerenderManifest_preview.previewModeId)) {
@@ -146,20 +146,16 @@ class IncrementalCache {
146
146
  });
147
147
  }
148
148
  }
149
- calculateRevalidate(pathname, fromTime, dev, isFallback) {
149
+ calculateRevalidate(cacheControl, fromTime, dev, isFallback) {
150
150
  // in development we don't have a prerender-manifest
151
151
  // and default to always revalidating to allow easier debugging
152
152
  if (dev) return Math.floor(performance.timeOrigin + performance.now() - 1000);
153
- const cacheControl = this.cacheControls.get((0, _toroute.toRoute)(pathname));
154
153
  // if an entry isn't present in routes we fallback to a default
155
154
  // of revalidating after 1 second unless it's a fallback request.
156
155
  const initialRevalidateSeconds = cacheControl ? cacheControl.revalidate : isFallback ? false : 1;
157
156
  const revalidateAfter = typeof initialRevalidateSeconds === 'number' ? initialRevalidateSeconds * 1000 + fromTime : initialRevalidateSeconds;
158
157
  return revalidateAfter;
159
158
  }
160
- _getPathname(pathname, fetchCache) {
161
- return fetchCache ? pathname : (0, _normalizepagepath.normalizePagePath)(pathname);
162
- }
163
159
  resetRequestCache() {
164
160
  var _this_cacheHandler_resetRequestCache, _this_cacheHandler;
165
161
  (_this_cacheHandler = this.cacheHandler) == null ? void 0 : (_this_cacheHandler_resetRequestCache = _this_cacheHandler.resetRequestCache) == null ? void 0 : _this_cacheHandler_resetRequestCache.call(_this_cacheHandler);
@@ -303,6 +299,9 @@ class IncrementalCache {
303
299
  }
304
300
  async get(cacheKey, ctx) {
305
301
  var _this_cacheHandler, _cacheData_value;
302
+ if (ctx.kind === _responsecache.IncrementalCacheKind.IMAGE) {
303
+ throw new _invarianterror.InvariantError('Images must use the image optimizer cache');
304
+ }
306
305
  // Unlike other caches if we have a resume data cache, we use it even if
307
306
  // testmode would normally disable it or if requestHeaders say 'no-cache'.
308
307
  if (ctx.kind === _responsecache.IncrementalCacheKind.FETCH) {
@@ -323,8 +322,16 @@ class IncrementalCache {
323
322
  if (this.disableForTestmode || this.dev && (ctx.kind !== _responsecache.IncrementalCacheKind.FETCH || this.requestHeaders['cache-control'] === 'no-cache')) {
324
323
  return null;
325
324
  }
326
- cacheKey = this._getPathname(cacheKey, ctx.kind === _responsecache.IncrementalCacheKind.FETCH);
327
- const cacheData = await ((_this_cacheHandler = this.cacheHandler) == null ? void 0 : _this_cacheHandler.get(cacheKey, ctx));
325
+ let storageKey = cacheKey;
326
+ let handlerContext = ctx;
327
+ if (ctx.kind !== _responsecache.IncrementalCacheKind.FETCH) {
328
+ // Ownership scopes the key and metadata inside Next.js. Storage handlers
329
+ // only need the resulting key and the existing cache options.
330
+ const { route, ...responseContext } = ctx;
331
+ storageKey = (0, _routecachekey.getRouteCacheKey)(cacheKey, route);
332
+ handlerContext = responseContext;
333
+ }
334
+ const cacheData = await ((_this_cacheHandler = this.cacheHandler) == null ? void 0 : _this_cacheHandler.get(storageKey, handlerContext));
328
335
  if (ctx.kind === _responsecache.IncrementalCacheKind.FETCH) {
329
336
  var _cacheData_value1;
330
337
  if (!cacheData) {
@@ -370,14 +377,14 @@ class IncrementalCache {
370
377
  });
371
378
  }
372
379
  let entry = null;
373
- const cacheControl = this.cacheControls.get((0, _toroute.toRoute)(cacheKey));
380
+ const cacheControl = this.cacheControls.get(cacheKey, ctx.route);
374
381
  let isStale;
375
382
  let revalidateAfter;
376
383
  if ((cacheData == null ? void 0 : cacheData.lastModified) === -1) {
377
384
  isStale = -1;
378
385
  revalidateAfter = -1 * _constants.CACHE_ONE_YEAR;
379
386
  } else {
380
- revalidateAfter = this.calculateRevalidate(cacheKey, (cacheData == null ? void 0 : cacheData.lastModified) || performance.timeOrigin + performance.now(), this.dev ?? false, ctx.isFallback);
387
+ revalidateAfter = this.calculateRevalidate(cacheControl, (cacheData == null ? void 0 : cacheData.lastModified) || performance.timeOrigin + performance.now(), this.dev ?? false, ctx.isFallback);
381
388
  isStale = revalidateAfter !== false && revalidateAfter < performance.timeOrigin + performance.now() ? true : undefined;
382
389
  }
383
390
  if (cacheData) {
@@ -388,7 +395,7 @@ class IncrementalCache {
388
395
  value: cacheData.value
389
396
  };
390
397
  }
391
- if (!cacheData && this.prerenderManifest.notFoundRoutes.includes(cacheKey)) {
398
+ if (!cacheData && this.prerenderManifest.notFoundRoutes.includes(cacheKey) && (0, _routecachekey.isRouteCacheOwner)(cacheKey, ctx.route, this.prerenderManifest.routes[cacheKey], this.locales)) {
392
399
  // for the first hit after starting the server the cache
393
400
  // may not have a way to save notFound: true so if
394
401
  // the prerender-manifest marks this as notFound then we
@@ -408,6 +415,9 @@ class IncrementalCache {
408
415
  return entry;
409
416
  }
410
417
  async set(pathname, data, ctx) {
418
+ if ('kind' in ctx && ctx.kind === _responsecache.IncrementalCacheKind.IMAGE) {
419
+ throw new _invarianterror.InvariantError('Images must use the image optimizer cache');
420
+ }
411
421
  // Even if we otherwise disable caching for testMode or if no fetchCache is
412
422
  // configured we still always stash results in the resume data cache if one
413
423
  // exists. This is because this is a transient in memory cache that
@@ -421,7 +431,16 @@ class IncrementalCache {
421
431
  }
422
432
  }
423
433
  if (this.disableForTestmode || this.dev && !ctx.fetchCache) return;
424
- pathname = this._getPathname(pathname, ctx.fetchCache);
434
+ let storageKey = pathname;
435
+ let handlerContext = ctx;
436
+ if (!ctx.fetchCache) {
437
+ const { route, ...responseContext } = ctx;
438
+ if (!route) {
439
+ throw new _invarianterror.InvariantError('Response cache requires a source route');
440
+ }
441
+ storageKey = (0, _routecachekey.getRouteCacheKey)(pathname, route);
442
+ handlerContext = responseContext;
443
+ }
425
444
  // FetchCache has upper limit of 2MB per-entry currently
426
445
  const itemSize = JSON.stringify(data).length;
427
446
  if (ctx.fetchCache && itemSize > 2 * 1024 * 1024 && // We ignore the size limit when custom cache handler is being used, as it
@@ -443,9 +462,9 @@ class IncrementalCache {
443
462
  try {
444
463
  var _this_cacheHandler;
445
464
  if (!ctx.fetchCache && ctx.cacheControl) {
446
- this.cacheControls.set((0, _toroute.toRoute)(pathname), ctx.cacheControl);
465
+ this.cacheControls.set(storageKey, ctx.cacheControl);
447
466
  }
448
- await ((_this_cacheHandler = this.cacheHandler) == null ? void 0 : _this_cacheHandler.set(pathname, data, ctx));
467
+ await ((_this_cacheHandler = this.cacheHandler) == null ? void 0 : _this_cacheHandler.set(storageKey, data, handlerContext));
449
468
  } catch (error) {
450
469
  console.warn('Failed to update prerender cache for', pathname, error);
451
470
  }