@vercel/next 4.15.2 → 4.15.4

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 +21 -15
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -15390,7 +15390,8 @@ ${JSON.stringify(
15390
15390
  true
15391
15391
  )];
15392
15392
  });
15393
- const isNextDataServerResolving = (middleware.staticRoutes.length > 0 || nodeMiddleware) && import_semver4.default.gte(nextVersion, NEXT_DATA_MIDDLEWARE_RESOLVING_VERSION);
15393
+ const hasPagesRouter = routesManifest.appType ? routesManifest.appType === "pages" || routesManifest.appType === "hybrid" : true;
15394
+ const isNextDataServerResolving = hasPagesRouter && (middleware.staticRoutes.length > 0 || nodeMiddleware) && import_semver4.default.gte(nextVersion, NEXT_DATA_MIDDLEWARE_RESOLVING_VERSION);
15394
15395
  const dynamicRoutes = await getDynamicRoutes({
15395
15396
  entryPath,
15396
15397
  entryDirectory,
@@ -15831,7 +15832,11 @@ ${JSON.stringify(
15831
15832
  ...appDir ? [
15832
15833
  ...isAppClientSegmentCacheEnabled && rscPrefetchHeader && prefetchSegmentHeader && prefetchSegmentDirSuffix && prefetchSegmentSuffix ? [
15833
15834
  {
15834
- src: import_path5.default.posix.join("/", entryDirectory, "/(?<path>.+)$"),
15835
+ src: import_path5.default.posix.join(
15836
+ "/",
15837
+ entryDirectory,
15838
+ "/(?<path>.+?)(?:/)?$"
15839
+ ),
15835
15840
  dest: import_path5.default.posix.join(
15836
15841
  "/",
15837
15842
  entryDirectory,
@@ -15858,7 +15863,7 @@ ${JSON.stringify(
15858
15863
  override: true
15859
15864
  },
15860
15865
  {
15861
- src: import_path5.default.posix.join("^/", entryDirectory, "$"),
15866
+ src: import_path5.default.posix.join("^/", entryDirectory, "/?$"),
15862
15867
  dest: import_path5.default.posix.join(
15863
15868
  "/",
15864
15869
  entryDirectory,
@@ -15974,7 +15979,7 @@ ${JSON.stringify(
15974
15979
  ] : [],
15975
15980
  // normalize _next/data URL before processing rewrites
15976
15981
  ...normalizeNextDataRoute(),
15977
- ...!isNextDataServerResolving ? [
15982
+ ...!isNextDataServerResolving && hasPagesRouter ? [
15978
15983
  // No-op _next/data rewrite to trigger handle: 'rewrites' and then 404
15979
15984
  // if no match to prevent rewriting _next/data unexpectedly
15980
15985
  {
@@ -16184,7 +16189,7 @@ ${JSON.stringify(
16184
16189
  return route;
16185
16190
  }).filter(Boolean)
16186
16191
  ) : dataRoutes,
16187
- ...!isNextDataServerResolving ? [
16192
+ ...!isNextDataServerResolving && hasPagesRouter ? [
16188
16193
  // ensure we 404 for non-existent _next/data routes before
16189
16194
  // trying page dynamic routes
16190
16195
  {
@@ -16460,17 +16465,18 @@ var build = async (buildOptions) => {
16460
16465
  let pkg = await readPackageJson(entryPath);
16461
16466
  const nextVersionRange = await getNextVersionRange(entryPath);
16462
16467
  const nodeVersion = await (0, import_build_utils3.getNodeVersion)(entryPath, void 0, config, meta);
16468
+ const spawnOpts = (0, import_build_utils3.getSpawnOptions)(meta, nodeVersion);
16463
16469
  const {
16464
16470
  cliType,
16465
16471
  lockfileVersion,
16466
16472
  packageJsonPackageManager,
16467
16473
  turboSupportsCorepackHome
16468
16474
  } = await (0, import_build_utils3.scanParentDirs)(entryPath, true);
16469
- const spawnEnv = (0, import_build_utils3.getEnvForPackageManager)({
16475
+ spawnOpts.env = (0, import_build_utils3.getEnvForPackageManager)({
16470
16476
  cliType,
16471
16477
  lockfileVersion,
16472
16478
  packageJsonPackageManager,
16473
- env: process.env,
16479
+ env: spawnOpts.env || {},
16474
16480
  turboSupportsCorepackHome,
16475
16481
  projectCreatedAt: config.projectSettings?.createdAt
16476
16482
  });
@@ -16547,14 +16553,14 @@ var build = async (buildOptions) => {
16547
16553
  `Running "install" command: \`${trimmedInstallCommand}\`...`
16548
16554
  );
16549
16555
  await (0, import_build_utils3.execCommand)(trimmedInstallCommand, {
16550
- env: spawnEnv,
16556
+ ...spawnOpts,
16551
16557
  cwd: entryPath
16552
16558
  });
16553
16559
  } else {
16554
16560
  await (0, import_build_utils3.runNpmInstall)(
16555
16561
  entryPath,
16556
16562
  [],
16557
- { env: spawnEnv },
16563
+ spawnOpts,
16558
16564
  meta,
16559
16565
  config.projectSettings?.createdAt
16560
16566
  );
@@ -16563,14 +16569,14 @@ var build = async (buildOptions) => {
16563
16569
  } else {
16564
16570
  console.log(`Skipping "install" command...`);
16565
16571
  }
16566
- if (spawnEnv.VERCEL_ANALYTICS_ID) {
16572
+ if (spawnOpts.env.VERCEL_ANALYTICS_ID) {
16567
16573
  (0, import_build_utils3.debug)("Found VERCEL_ANALYTICS_ID in environment");
16568
16574
  const version2 = await (0, import_build_utils3.getInstalledPackageVersion)(
16569
16575
  "@vercel/speed-insights",
16570
16576
  entryPath
16571
16577
  );
16572
16578
  if (version2) {
16573
- delete spawnEnv.VERCEL_ANALYTICS_ID;
16579
+ delete spawnOpts.env.VERCEL_ANALYTICS_ID;
16574
16580
  delete process.env.VERCEL_ANALYTICS_ID;
16575
16581
  (0, import_build_utils3.debug)(
16576
16582
  "@vercel/speed-insights is installed, removing VERCEL_ANALYTICS_ID from environment"
@@ -16620,7 +16626,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
16620
16626
  } else if (!isLegacy) {
16621
16627
  target = await createServerlessConfig(workPath, entryPath, nextVersion);
16622
16628
  }
16623
- const env = { ...spawnEnv };
16629
+ const env = { ...spawnOpts.env };
16624
16630
  env.NEXT_EDGE_RUNTIME_PROVIDER = "vercel";
16625
16631
  if (target) {
16626
16632
  env.NEXT_PRIVATE_TARGET = target;
@@ -16653,6 +16659,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
16653
16659
  );
16654
16660
  console.log(`Running "${buildCommand}"`);
16655
16661
  await (0, import_build_utils3.execCommand)(buildCommand, {
16662
+ ...spawnOpts,
16656
16663
  cwd: entryPath,
16657
16664
  env
16658
16665
  });
@@ -16661,6 +16668,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
16661
16668
  entryPath,
16662
16669
  buildScriptName,
16663
16670
  {
16671
+ ...spawnOpts,
16664
16672
  env
16665
16673
  },
16666
16674
  config.projectSettings?.createdAt
@@ -17067,9 +17075,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17067
17075
  await (0, import_build_utils3.runNpmInstall)(
17068
17076
  entryPath,
17069
17077
  ["--production"],
17070
- {
17071
- env: spawnEnv
17072
- },
17078
+ spawnOpts,
17073
17079
  meta,
17074
17080
  config.projectSettings?.createdAt
17075
17081
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/next",
3
- "version": "4.15.2",
3
+ "version": "4.15.4",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index",
6
6
  "homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js",
@@ -30,8 +30,8 @@
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": "13.0.0",
34
- "@vercel/routing-utils": "5.2.1",
33
+ "@vercel/build-utils": "13.2.0",
34
+ "@vercel/routing-utils": "5.3.0",
35
35
  "async-sema": "3.0.1",
36
36
  "buffer-crc32": "0.2.13",
37
37
  "bytes": "3.1.2",