@vercel/next 4.18.0 → 4.19.1

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.
@@ -9914,7 +9914,7 @@ async function handleNodeOutputs(nodeOutputs, {
9914
9914
  if (filesHashes) {
9915
9915
  filesHashes["___next_launcher.cjs"] = sha256(handlerSource);
9916
9916
  }
9917
- const operationType = output.type === import_constants.AdapterOutputType.APP_PAGE || import_constants.AdapterOutputType.PAGES ? "PAGE" : "API";
9917
+ const operationType = output.type === import_constants.AdapterOutputType.APP_PAGE || output.type === import_constants.AdapterOutputType.PAGES ? "PAGE" : "API";
9918
9918
  const sourceFile = await getSourceFilePathFromPage({
9919
9919
  workPath: projectDir,
9920
9920
  page: output.sourcePage,
@@ -10231,7 +10231,7 @@ async function handleMiddleware(output, ctx) {
10231
10231
  }
10232
10232
  var _usesSrcCache;
10233
10233
  async function usesSrcDirectory(workPath) {
10234
- if (!_usesSrcCache) {
10234
+ if (_usesSrcCache === void 0) {
10235
10235
  const sourcePages = import_node_path.default.join(workPath, "src", "pages");
10236
10236
  try {
10237
10237
  if ((await import_promises.default.stat(sourcePages)).isDirectory()) {
@@ -10241,7 +10241,7 @@ async function usesSrcDirectory(workPath) {
10241
10241
  _usesSrcCache = false;
10242
10242
  }
10243
10243
  }
10244
- if (!_usesSrcCache) {
10244
+ if (_usesSrcCache === void 0) {
10245
10245
  const sourceAppdir = import_node_path.default.join(workPath, "src", "app");
10246
10246
  try {
10247
10247
  if ((await import_promises.default.stat(sourceAppdir)).isDirectory()) {
@@ -10251,7 +10251,10 @@ async function usesSrcDirectory(workPath) {
10251
10251
  _usesSrcCache = false;
10252
10252
  }
10253
10253
  }
10254
- return Boolean(_usesSrcCache);
10254
+ if (_usesSrcCache === void 0) {
10255
+ _usesSrcCache = false;
10256
+ }
10257
+ return _usesSrcCache;
10255
10258
  }
10256
10259
  function isDirectory(path3) {
10257
10260
  return import_fs_extra3.default.existsSync(path3) && import_fs_extra3.default.lstatSync(path3).isDirectory();
@@ -10624,8 +10627,10 @@ if(${cookieCheck}){
10624
10627
  var myAdapter = {
10625
10628
  name: "Vercel",
10626
10629
  async modifyConfig(config, ctx) {
10627
- if (ctx.phase === import_constants2.PHASE_PRODUCTION_BUILD && process.env.VERCEL_IMMUTABLE_STATIC_FILES_ENABLED === "1") {
10628
- config.experimental.supportsImmutableAssets = true;
10630
+ if (ctx.phase === import_constants2.PHASE_PRODUCTION_BUILD) {
10631
+ config.experimental.supportsImmutableAssets = // Default to true, allow users to opt-out
10632
+ (config.experimental.supportsImmutableAssets ?? true) && // AND with infra support to allow disabling via feature flag if necessary.
10633
+ process.env.VERCEL_IMMUTABLE_STATIC_FILES_ENABLED === "1";
10629
10634
  }
10630
10635
  if (process.env.VERCEL_HASH_SALT != null) {
10631
10636
  config.experimental.outputHashSalt = (config.experimental.outputHashSalt ?? "") + process.env.VERCEL_HASH_SALT;
package/dist/index.js CHANGED
@@ -940,14 +940,23 @@ var require_superstatic = __commonJS({
940
940
  normalizeHasKeys(r.has);
941
941
  normalizeHasKeys(r.missing);
942
942
  try {
943
- const dest = replaceSegments(
943
+ const interpolate = (value) => replaceSegments(
944
944
  segments,
945
945
  hasSegments,
946
- r.destination,
946
+ value,
947
947
  false,
948
948
  internalParamNames
949
949
  );
950
- const route = { src, dest, check: true };
950
+ let route;
951
+ if (typeof r.destination === "string") {
952
+ route = { src, dest: interpolate(r.destination), check: true };
953
+ } else {
954
+ const destination = { ...r.destination };
955
+ if (typeof destination.path === "string") {
956
+ destination.path = interpolate(destination.path);
957
+ }
958
+ route = { src, destination };
959
+ }
951
960
  if (typeof r.env !== "undefined") {
952
961
  route.env = r.env;
953
962
  }
@@ -12512,6 +12521,13 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
12512
12521
  message: "invariant: isOmitted and isFallback cannot both be true"
12513
12522
  });
12514
12523
  }
12524
+ const routeIsDynamic = Boolean(isFallback || isBlocking || isOmitted);
12525
+ let hasFallback;
12526
+ if (isFallback) {
12527
+ hasFallback = true;
12528
+ } else if (isBlocking || isOmitted) {
12529
+ hasFallback = false;
12530
+ }
12515
12531
  let routeFileNoExt = routeKey === "/" ? "/index" : routeKey;
12516
12532
  let origRouteFileNoExt = routeFileNoExt;
12517
12533
  const { isLocalePrefixed } = prerenderManifest;
@@ -12612,6 +12628,15 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
12612
12628
  }
12613
12629
  const isOmittedOrNotFound = isOmitted || isNotFound;
12614
12630
  let htmlFallbackFsRef = null;
12631
+ let htmlSize;
12632
+ if (appDir) {
12633
+ try {
12634
+ htmlSize = import_fs_extra3.default.statSync(
12635
+ import_path3.default.join(appDir, `${routeFileNoExt}.html`)
12636
+ ).size;
12637
+ } catch {
12638
+ }
12639
+ }
12615
12640
  let postponedPrerender;
12616
12641
  let postponedState = null;
12617
12642
  let didPostpone = false;
@@ -12889,6 +12914,9 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
12889
12914
  allowHeader,
12890
12915
  partialFallback: partialFallback || void 0,
12891
12916
  hasPostponed,
12917
+ hasFallback,
12918
+ htmlSize,
12919
+ isDynamicRoute: routeIsDynamic,
12892
12920
  ...isNotFound ? {
12893
12921
  initialStatus: 404
12894
12922
  } : {},
@@ -12923,6 +12951,8 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
12923
12951
  allowHeader,
12924
12952
  partialFallback: void 0,
12925
12953
  hasPostponed,
12954
+ hasFallback,
12955
+ isDynamicRoute: routeIsDynamic,
12926
12956
  ...isNotFound ? {
12927
12957
  initialStatus: 404
12928
12958
  } : {},
@@ -12978,6 +13008,8 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
12978
13008
  allowHeader,
12979
13009
  partialFallback: void 0,
12980
13010
  hasPostponed,
13011
+ hasFallback,
13012
+ isDynamicRoute: routeIsDynamic,
12981
13013
  chain: {
12982
13014
  outputPath: normalizePathData(outputPathData),
12983
13015
  headers: routesManifest.ppr.chain.headers
@@ -13045,6 +13077,8 @@ var onPrerenderRoute = (prerenderRouteArgs) => async (routeKey, {
13045
13077
  allowHeader,
13046
13078
  partialFallback: void 0,
13047
13079
  hasPostponed,
13080
+ hasFallback,
13081
+ isDynamicRoute: routeIsDynamic,
13048
13082
  // These routes are always only static, so they should not
13049
13083
  // permit any bypass unless it's for preview
13050
13084
  bypassToken: prerenderManifest.bypassToken,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/next",
3
- "version": "4.18.0",
3
+ "version": "4.19.1",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index",
6
6
  "homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js",
@@ -16,7 +16,7 @@
16
16
  "@vercel/nft": "1.10.0"
17
17
  },
18
18
  "devDependencies": {
19
- "@next-community/adapter-vercel": "0.0.1-beta.22",
19
+ "@next-community/adapter-vercel": "0.0.1-beta.23",
20
20
  "@types/aws-lambda": "8.10.19",
21
21
  "@types/buffer-crc32": "0.2.0",
22
22
  "@types/bytes": "3.1.1",
@@ -53,8 +53,8 @@
53
53
  "text-table": "0.2.0",
54
54
  "vitest": "2.0.3",
55
55
  "webpack-sources": "3.2.3",
56
- "@vercel/build-utils": "13.28.0",
57
- "@vercel/routing-utils": "6.2.0"
56
+ "@vercel/build-utils": "13.30.0",
57
+ "@vercel/routing-utils": "6.3.0"
58
58
  },
59
59
  "scripts": {
60
60
  "build": "node build.mjs",