|
1 | 1 | import { promises as fsPromises } from "node:fs"; |
2 | 2 | import path from "node:path"; |
3 | 3 | import os from "node:os"; |
4 | | -import { PRERENDER_MANIFEST, SERVER_DIRECTORY } from "next/constants"; |
| 4 | +import { PRERENDER_MANIFEST, SERVER_DIRECTORY } from "next/constants.js"; |
| 5 | +import { CACHE_ONE_YEAR } from "next/dist/lib/constants.js"; |
5 | 6 | import type { PrerenderManifest } from "next/dist/build"; |
6 | | -import { CACHE_ONE_YEAR } from "next/dist/lib/constants"; |
7 | 7 | import { |
8 | 8 | CachedFetchValue, |
9 | 9 | CachedRouteValue, |
@@ -329,25 +329,25 @@ export async function registerInitialCache( |
329 | 329 | }), |
330 | 330 | isAppRouter |
331 | 331 | ? fsPromises |
332 | | - .readFile(`${pathToRouteFiles}.prefetch.rsc`, "utf-8") |
333 | | - .then((data) => data) |
334 | | - .catch((error) => { |
335 | | - if (debug) { |
336 | | - console.warn( |
337 | | - "[CacheHandler] [%s] %s %s", |
338 | | - "registerInitialCache", |
339 | | - "Failed to read page prefetch data, assuming it does not exist", |
340 | | - `Error: ${error}`, |
341 | | - ); |
342 | | - } |
343 | | - |
344 | | - return undefined; |
345 | | - }) |
| 332 | + .readFile(`${pathToRouteFiles}.prefetch.rsc`, "utf-8") |
| 333 | + .then((data) => data) |
| 334 | + .catch((error) => { |
| 335 | + if (debug) { |
| 336 | + console.warn( |
| 337 | + "[CacheHandler] [%s] %s %s", |
| 338 | + "registerInitialCache", |
| 339 | + "Failed to read page prefetch data, assuming it does not exist", |
| 340 | + `Error: ${error}`, |
| 341 | + ); |
| 342 | + } |
| 343 | + |
| 344 | + return undefined; |
| 345 | + }) |
346 | 346 | : undefined, |
347 | 347 | isAppRouter |
348 | 348 | ? fsPromises |
349 | | - .readFile(`${pathToRouteFiles}.meta`, "utf-8") |
350 | | - .then((data) => JSON.parse(data) as NextRouteMetadata) |
| 349 | + .readFile(`${pathToRouteFiles}.meta`, "utf-8") |
| 350 | + .then((data) => JSON.parse(data) as NextRouteMetadata) |
351 | 351 | : undefined, |
352 | 352 | ]); |
353 | 353 | } catch (error) { |
|
0 commit comments