@vercel/next 4.0.15 → 4.0.17

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 (2) hide show
  1. package/dist/index.js +39 -6
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -10707,7 +10707,7 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
10707
10707
  isAppPathRoute = true;
10708
10708
  }
10709
10709
  const isOmittedOrNotFound = isOmitted || isNotFound;
10710
- let htmlFsRef;
10710
+ let htmlFsRef = null;
10711
10711
  let prerender;
10712
10712
  if (experimentalPPR && appDir) {
10713
10713
  const htmlPath = import_path2.default.join(appDir, `${routeFileNoExt}.html`);
@@ -10739,12 +10739,15 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
10739
10739
  throw new Error("Invariant: contentType can't be undefined");
10740
10740
  }
10741
10741
  htmlFsRef = new import_build_utils.FileBlob({ contentType, data: prerender });
10742
- } else if (appDir && !dataRoute && isAppPathRoute && !(isBlocking || isFallback)) {
10742
+ } else if (appDir && !dataRoute && !prefetchDataRoute && isAppPathRoute && !(isBlocking || isFallback)) {
10743
10743
  const contentType = initialHeaders?.["content-type"];
10744
- htmlFsRef = new import_build_utils.FileFsRef({
10745
- fsPath: import_path2.default.join(appDir, `${routeFileNoExt}.body`),
10746
- contentType: contentType || "text/html;charset=utf-8"
10747
- });
10744
+ const fsPath = import_path2.default.join(appDir, `${routeFileNoExt}.body`);
10745
+ if (import_fs_extra3.default.existsSync(fsPath)) {
10746
+ htmlFsRef = new import_build_utils.FileFsRef({
10747
+ fsPath,
10748
+ contentType: contentType || "text/html;charset=utf-8"
10749
+ });
10750
+ }
10748
10751
  } else {
10749
10752
  htmlFsRef = isBlocking || isNotFound && !static404Page ? (
10750
10753
  // Blocking pages do not have an HTML fallback
@@ -12014,6 +12017,19 @@ async function serverBuild({
12014
12017
  value.contentType = rscContentTypeHeader;
12015
12018
  }
12016
12019
  }
12020
+ for (const rewrite of afterFilesRewrites) {
12021
+ if (rewrite.src && rewrite.dest) {
12022
+ rewrite.src = rewrite.src.replace(
12023
+ "(?:/)?",
12024
+ "(?<rscsuff>(\\.prefetch)?\\.rsc)?(?:/)?"
12025
+ );
12026
+ let destQueryIndex = rewrite.dest.indexOf("?");
12027
+ if (destQueryIndex === -1) {
12028
+ destQueryIndex = rewrite.dest.length;
12029
+ }
12030
+ rewrite.dest = rewrite.dest.substring(0, destQueryIndex) + "$rscsuff" + rewrite.dest.substring(destQueryIndex);
12031
+ }
12032
+ }
12017
12033
  }
12018
12034
  const isCorrectNotFoundRoutes = import_semver3.default.gte(
12019
12035
  nextVersion,
@@ -13314,6 +13330,23 @@ async function serverBuild({
13314
13330
  // These need to come before handle: miss or else they are grouped
13315
13331
  // with that routing section
13316
13332
  ...afterFilesRewrites,
13333
+ // ensure non-normalized /.rsc from rewrites is handled
13334
+ ...appPathRoutesManifest ? [
13335
+ {
13336
+ src: import_path4.default.posix.join("/", entryDirectory, "/\\.prefetch\\.rsc$"),
13337
+ dest: import_path4.default.posix.join(
13338
+ "/",
13339
+ entryDirectory,
13340
+ `/__index${RSC_PREFETCH_SUFFIX}`
13341
+ ),
13342
+ check: true
13343
+ },
13344
+ {
13345
+ src: import_path4.default.posix.join("/", entryDirectory, "/\\.rsc$"),
13346
+ dest: import_path4.default.posix.join("/", entryDirectory, `/index.rsc`),
13347
+ check: true
13348
+ }
13349
+ ] : [],
13317
13350
  { handle: "resource" },
13318
13351
  ...fallbackRewrites,
13319
13352
  // make sure 404 page is used when a directory is matched without
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/next",
3
- "version": "4.0.15",
3
+ "version": "4.0.17",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index",
6
6
  "homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js",
@@ -13,7 +13,7 @@
13
13
  "dist"
14
14
  ],
15
15
  "dependencies": {
16
- "@vercel/nft": "0.24.2"
16
+ "@vercel/nft": "0.26.2"
17
17
  },
18
18
  "devDependencies": {
19
19
  "@types/aws-lambda": "8.10.19",
@@ -30,7 +30,7 @@
30
30
  "@types/semver": "6.0.0",
31
31
  "@types/text-table": "0.2.1",
32
32
  "@types/webpack-sources": "3.2.0",
33
- "@vercel/build-utils": "7.2.5",
33
+ "@vercel/build-utils": "7.4.1",
34
34
  "@vercel/routing-utils": "3.1.0",
35
35
  "async-sema": "3.0.1",
36
36
  "buffer-crc32": "0.2.13",