@vercel/next 4.7.4 → 4.7.7

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 +31 -21
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -11728,7 +11728,8 @@ async function getPrerenderManifest(entryPath, outputDirectory) {
11728
11728
  prefetchDataRoute,
11729
11729
  prefetchDataRouteRegex,
11730
11730
  renderingMode,
11731
- allowHeader
11731
+ allowHeader,
11732
+ fallbackRootParams
11732
11733
  };
11733
11734
  } else {
11734
11735
  ret.omittedRoutes[lazyRoute] = {
@@ -12496,8 +12497,8 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
12496
12497
  };
12497
12498
  }
12498
12499
  let htmlAllowQuery = allowQuery;
12499
- if (renderingMode === "PARTIALLY_STATIC" /* PARTIALLY_STATIC */ && isFallback) {
12500
- const { fallbackRootParams } = prerenderManifest.fallbackRoutes[routeKey];
12500
+ if (renderingMode === "PARTIALLY_STATIC" /* PARTIALLY_STATIC */ && (isFallback || isBlocking)) {
12501
+ const { fallbackRootParams } = isFallback ? prerenderManifest.fallbackRoutes[routeKey] : prerenderManifest.blockingFallbackRoutes[routeKey];
12501
12502
  htmlAllowQuery = fallbackRootParams ?? [];
12502
12503
  }
12503
12504
  prerenders[outputPathPage] = new import_build_utils.Prerender({
@@ -12577,7 +12578,7 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
12577
12578
  if (isAppClientSegmentCacheEnabled && prefetchSegmentSuffix && prefetchSegmentDirSuffix && rscDidPostponeHeader && appDir) {
12578
12579
  const metaPath = import_path2.default.join(appDir, `${routeFileNoExt}.meta`);
12579
12580
  if (import_fs_extra3.default.existsSync(metaPath)) {
12580
- const meta = JSON.parse(await import_fs_extra3.default.readFile(metaPath, "utf8"));
12581
+ const meta = JSON.parse(import_fs_extra3.default.readFileSync(metaPath, "utf8"));
12581
12582
  if (typeof meta === "object" && meta !== null && "segmentPaths" in meta && typeof meta.segmentPaths === "object" && meta.segmentPaths !== null && Array.isArray(meta.segmentPaths)) {
12582
12583
  const segmentsDir = import_path2.default.join(
12583
12584
  appDir,
@@ -12630,7 +12631,7 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
12630
12631
  prerenders[rscKey] = dummyOutput;
12631
12632
  prerenders[prefetchRscKey] = dummyOutput;
12632
12633
  }
12633
- ++prerenderGroup;
12634
+ prerenderGroup++;
12634
12635
  if (routesManifest?.i18n && isBlocking) {
12635
12636
  for (const locale2 of routesManifest.i18n.locales) {
12636
12637
  const localeRouteFileNoExt = addLocaleOrDefault(
@@ -12664,7 +12665,7 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
12664
12665
  group: prerenderGroup
12665
12666
  };
12666
12667
  }
12667
- ++prerenderGroup;
12668
+ prerenderGroup++;
12668
12669
  }
12669
12670
  }
12670
12671
  }
@@ -13987,6 +13988,11 @@ async function serverBuild({
13987
13988
  // We don't want to perform the actual rewrite here, instead we want
13988
13989
  // to just add the headers associated with the rewrite.
13989
13990
  dest: void 0,
13991
+ // We don't want to check here, so omit the check property but we do
13992
+ // want to maintain the order of the rewrites, so add the continue
13993
+ // property.
13994
+ check: void 0,
13995
+ continue: true,
13990
13996
  has,
13991
13997
  headers: headers2
13992
13998
  };
@@ -14035,6 +14041,7 @@ async function serverBuild({
14035
14041
  const lstatSema = new import_async_sema2.Sema(25);
14036
14042
  const lstatResults = {};
14037
14043
  const nonLambdaSsgPages = /* @__PURE__ */ new Set();
14044
+ const static404Pages = new Set(static404Page ? [static404Page] : []);
14038
14045
  Object.keys(prerenderManifest.staticRoutes).forEach((route) => {
14039
14046
  const result = onPrerenderRouteInitial(
14040
14047
  prerenderManifest,
@@ -14047,6 +14054,7 @@ async function serverBuild({
14047
14054
  appDir
14048
14055
  );
14049
14056
  if (result && result.static404Page) {
14057
+ static404Pages.add(result.static404Page);
14050
14058
  static404Page = result.static404Page;
14051
14059
  }
14052
14060
  if (result && result.static500Page) {
@@ -14208,27 +14216,29 @@ async function serverBuild({
14208
14216
  mode: (await import_fs_extra5.default.lstat(nextServerFile)).mode,
14209
14217
  fsPath: nextServerFile
14210
14218
  });
14211
- if (static404Page) {
14219
+ if (static404Pages.size > 0) {
14212
14220
  if (i18n) {
14213
14221
  for (const locale of i18n.locales) {
14214
- let static404File = staticPages[import_path4.default.posix.join(entryDirectory, locale, "/404")];
14215
- if (!static404File) {
14222
+ const static404Page2 = import_path4.default.posix.join(entryDirectory, locale, "404");
14223
+ static404Pages.add(static404Page2);
14224
+ }
14225
+ }
14226
+ for (const static404Page2 of static404Pages) {
14227
+ let static404File = staticPages[static404Page2];
14228
+ if (!static404File) {
14229
+ const static404FilePath = import_path4.default.join(
14230
+ pagesDir,
14231
+ `${static404Page2}.html`
14232
+ );
14233
+ if (import_fs_extra5.default.existsSync(static404FilePath)) {
14216
14234
  static404File = new import_build_utils2.FileFsRef({
14217
- fsPath: import_path4.default.join(pagesDir, locale, "/404.html")
14235
+ fsPath: static404FilePath
14218
14236
  });
14219
- if (!import_fs_extra5.default.existsSync(static404File.fsPath)) {
14220
- static404File = new import_build_utils2.FileFsRef({
14221
- fsPath: import_path4.default.join(pagesDir, "/404.html")
14222
- });
14223
- }
14224
14237
  }
14238
+ }
14239
+ if (static404File) {
14225
14240
  requiredFiles[import_path4.default.relative(baseDir, static404File.fsPath)] = static404File;
14226
14241
  }
14227
- } else {
14228
- const static404File = staticPages[static404Page] || new import_build_utils2.FileFsRef({
14229
- fsPath: import_path4.default.join(pagesDir, "/404.html")
14230
- });
14231
- requiredFiles[import_path4.default.relative(baseDir, static404File.fsPath)] = static404File;
14232
14242
  }
14233
14243
  }
14234
14244
  const envFiles = [];
@@ -16056,7 +16066,7 @@ var build = async (buildOptions) => {
16056
16066
  if (!nextVersion) {
16057
16067
  throw new import_build_utils3.NowBuildError({
16058
16068
  code: "NEXT_NO_VERSION",
16059
- message: 'No Next.js version could be detected in your project. Make sure `"next"` is installed in "dependencies" or "devDependencies"'
16069
+ message: 'No Next.js version detected. Make sure your package.json has "next" in either "dependencies" or "devDependencies". Also check your Root Directory setting matches the directory of your package.json file.'
16060
16070
  });
16061
16071
  }
16062
16072
  let isServerMode = !(config.framework === "blitzjs") && import_semver4.default.gte(nextVersion, SERVER_BUILD_MINIMUM_NEXT_VERSION);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/next",
3
- "version": "4.7.4",
3
+ "version": "4.7.7",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index",
6
6
  "homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js",