@vercel/next 3.1.2 → 3.1.3

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.
package/dist/index.js CHANGED
@@ -42553,6 +42553,13 @@ const build = async ({ files, workPath, repoRootPath, entrypoint, config = {}, m
42553
42553
  const nextVersionRange = await getNextVersionRange(entryPath);
42554
42554
  const nodeVersion = await (0, build_utils_1.getNodeVersion)(entryPath, undefined, config, meta);
42555
42555
  const spawnOpts = (0, build_utils_1.getSpawnOptions)(meta, nodeVersion);
42556
+ const { cliType, lockfileVersion } = await (0, build_utils_1.scanParentDirs)(entryPath);
42557
+ spawnOpts.env = (0, build_utils_1.getEnvForPackageManager)({
42558
+ cliType,
42559
+ lockfileVersion,
42560
+ nodeVersion,
42561
+ env: spawnOpts.env || {},
42562
+ });
42556
42563
  const nowJsonPath = await (0, find_up_1.default)(['now.json', 'vercel.json'], {
42557
42564
  cwd: entryPath,
42558
42565
  });
@@ -42600,25 +42607,8 @@ const build = async ({ files, workPath, repoRootPath, entrypoint, config = {}, m
42600
42607
  if (typeof installCommand === 'string') {
42601
42608
  if (installCommand.trim()) {
42602
42609
  console.log(`Running "install" command: \`${installCommand}\`...`);
42603
- const { cliType, lockfileVersion } = await (0, build_utils_1.scanParentDirs)(entryPath);
42604
- const env = {
42605
- YARN_NODE_LINKER: 'node-modules',
42606
- ...spawnOpts.env,
42607
- };
42608
- if (cliType === 'npm') {
42609
- if (typeof lockfileVersion === 'number' &&
42610
- lockfileVersion >= 2 &&
42611
- (nodeVersion?.major || 0) < 16) {
42612
- // Ensure that npm 7 is at the beginning of the `$PATH`
42613
- env.PATH = `/node16/bin-npm7${path_1.default.delimiter}${env.PATH}`;
42614
- console.log('Detected `package-lock.json` generated by npm 7...');
42615
- }
42616
- }
42617
42610
  await (0, build_utils_1.execCommand)(installCommand, {
42618
42611
  ...spawnOpts,
42619
- // Yarn v2 PnP mode may be activated, so force
42620
- // "node-modules" linker style
42621
- env,
42622
42612
  cwd: entryPath,
42623
42613
  });
42624
42614
  }
@@ -43059,6 +43049,7 @@ const build = async ({ files, workPath, repoRootPath, entrypoint, config = {}, m
43059
43049
  await (0, fs_extra_1.remove)(path_1.default.join(entryPath, '.npmrc'));
43060
43050
  }
43061
43051
  const trailingSlashRedirects = [];
43052
+ let trailingSlash = false;
43062
43053
  redirects = redirects.filter(_redir => {
43063
43054
  const redir = _redir;
43064
43055
  // detect the trailing slash redirect and make sure it's
@@ -43072,6 +43063,9 @@ const build = async ({ files, workPath, repoRootPath, entrypoint, config = {}, m
43072
43063
  // moving underneath i18n routes
43073
43064
  redir.continue = true;
43074
43065
  trailingSlashRedirects.push(redir);
43066
+ if (location === '/$1/') {
43067
+ trailingSlash = true;
43068
+ }
43075
43069
  return false;
43076
43070
  }
43077
43071
  return true;
@@ -43284,6 +43278,7 @@ const build = async ({ files, workPath, repoRootPath, entrypoint, config = {}, m
43284
43278
  return (0, server_build_1.serverBuild)({
43285
43279
  config,
43286
43280
  nextVersion,
43281
+ trailingSlash,
43287
43282
  dynamicPages,
43288
43283
  canUsePreviewMode,
43289
43284
  staticPages,
@@ -44637,7 +44632,7 @@ const pretty_bytes_1 = __importDefault(__webpack_require__(539));
44637
44632
  const CORRECT_NOT_FOUND_ROUTES_VERSION = 'v12.0.1';
44638
44633
  const CORRECT_MIDDLEWARE_ORDER_VERSION = 'v12.1.7-canary.29';
44639
44634
  const NEXT_DATA_MIDDLEWARE_RESOLVING_VERSION = 'v12.1.7-canary.33';
44640
- async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs, baseDir, workPath, entryPath, nodeVersion, buildId, escapedBuildId, dynamicPrefix, entryDirectory, outputDirectory, redirects, beforeFilesRewrites, afterFilesRewrites, fallbackRewrites, headers, dataRoutes, hasIsr404Page, imagesManifest, wildcardConfig, routesManifest, staticPages, lambdaPages, nextVersion, canUsePreviewMode, prerenderManifest, omittedPrerenderRoutes, trailingSlashRedirects, isCorrectLocaleAPIRoutes, lambdaCompressedByteLimit, requiredServerFilesManifest, }) {
44635
+ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs, baseDir, workPath, entryPath, nodeVersion, buildId, escapedBuildId, dynamicPrefix, entryDirectory, outputDirectory, redirects, beforeFilesRewrites, afterFilesRewrites, fallbackRewrites, headers, dataRoutes, hasIsr404Page, imagesManifest, wildcardConfig, routesManifest, staticPages, lambdaPages, nextVersion, canUsePreviewMode, trailingSlash, prerenderManifest, omittedPrerenderRoutes, trailingSlashRedirects, isCorrectLocaleAPIRoutes, lambdaCompressedByteLimit, requiredServerFilesManifest, }) {
44641
44636
  const lambdas = {};
44642
44637
  const prerenders = {};
44643
44638
  const lambdaPageKeys = Object.keys(lambdaPages);
@@ -45106,7 +45101,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
45106
45101
  // strip _next/data prefix for resolving
45107
45102
  {
45108
45103
  src: `^${path_1.default.join('/', entryDirectory, '/_next/data/', escapedBuildId, '/(.*).json')}`,
45109
- dest: `${path_1.default.join('/', entryDirectory, '/$1')}`,
45104
+ dest: `${path_1.default.join('/', entryDirectory, '/$1', trailingSlash ? '/' : '')}`,
45110
45105
  ...(isOverride ? { override: true } : {}),
45111
45106
  continue: true,
45112
45107
  has: [
@@ -45119,14 +45114,14 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
45119
45114
  // normalize "/index" from "/_next/data/index.json" to -> just "/"
45120
45115
  // as matches a rewrite sources will expect just "/"
45121
45116
  {
45122
- src: path_1.default.join('^/', entryDirectory, '/index'),
45117
+ src: path_1.default.join('^/', entryDirectory, '/index(?:/)?'),
45123
45118
  has: [
45124
45119
  {
45125
45120
  type: 'header',
45126
45121
  key: 'x-nextjs-data',
45127
45122
  },
45128
45123
  ],
45129
- dest: path_1.default.join('/', entryDirectory),
45124
+ dest: path_1.default.join('/', entryDirectory, trailingSlash ? '/' : ''),
45130
45125
  ...(isOverride ? { override: true } : {}),
45131
45126
  continue: true,
45132
45127
  },
@@ -45137,7 +45132,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
45137
45132
  return isNextDataServerResolving
45138
45133
  ? [
45139
45134
  {
45140
- src: path_1.default.join('^/', entryDirectory, '$'),
45135
+ src: path_1.default.join('^/', entryDirectory, trailingSlash ? '/' : '', '$'),
45141
45136
  has: [
45142
45137
  {
45143
45138
  type: 'header',
@@ -45148,7 +45143,6 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
45148
45143
  continue: true,
45149
45144
  ...(isOverride ? { override: true } : {}),
45150
45145
  },
45151
- // handle non-trailing slash
45152
45146
  {
45153
45147
  src: path_1.default.join('^/', entryDirectory, '((?!_next/)(?:.*[^/]|.*))/?$'),
45154
45148
  has: [
@@ -19,7 +19,7 @@ const pretty_bytes_1 = __importDefault(require("pretty-bytes"));
19
19
  const CORRECT_NOT_FOUND_ROUTES_VERSION = 'v12.0.1';
20
20
  const CORRECT_MIDDLEWARE_ORDER_VERSION = 'v12.1.7-canary.29';
21
21
  const NEXT_DATA_MIDDLEWARE_RESOLVING_VERSION = 'v12.1.7-canary.33';
22
- async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs, baseDir, workPath, entryPath, nodeVersion, buildId, escapedBuildId, dynamicPrefix, entryDirectory, outputDirectory, redirects, beforeFilesRewrites, afterFilesRewrites, fallbackRewrites, headers, dataRoutes, hasIsr404Page, imagesManifest, wildcardConfig, routesManifest, staticPages, lambdaPages, nextVersion, canUsePreviewMode, prerenderManifest, omittedPrerenderRoutes, trailingSlashRedirects, isCorrectLocaleAPIRoutes, lambdaCompressedByteLimit, requiredServerFilesManifest, }) {
22
+ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs, baseDir, workPath, entryPath, nodeVersion, buildId, escapedBuildId, dynamicPrefix, entryDirectory, outputDirectory, redirects, beforeFilesRewrites, afterFilesRewrites, fallbackRewrites, headers, dataRoutes, hasIsr404Page, imagesManifest, wildcardConfig, routesManifest, staticPages, lambdaPages, nextVersion, canUsePreviewMode, trailingSlash, prerenderManifest, omittedPrerenderRoutes, trailingSlashRedirects, isCorrectLocaleAPIRoutes, lambdaCompressedByteLimit, requiredServerFilesManifest, }) {
23
23
  const lambdas = {};
24
24
  const prerenders = {};
25
25
  const lambdaPageKeys = Object.keys(lambdaPages);
@@ -488,7 +488,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
488
488
  // strip _next/data prefix for resolving
489
489
  {
490
490
  src: `^${path_1.default.join('/', entryDirectory, '/_next/data/', escapedBuildId, '/(.*).json')}`,
491
- dest: `${path_1.default.join('/', entryDirectory, '/$1')}`,
491
+ dest: `${path_1.default.join('/', entryDirectory, '/$1', trailingSlash ? '/' : '')}`,
492
492
  ...(isOverride ? { override: true } : {}),
493
493
  continue: true,
494
494
  has: [
@@ -501,14 +501,14 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
501
501
  // normalize "/index" from "/_next/data/index.json" to -> just "/"
502
502
  // as matches a rewrite sources will expect just "/"
503
503
  {
504
- src: path_1.default.join('^/', entryDirectory, '/index'),
504
+ src: path_1.default.join('^/', entryDirectory, '/index(?:/)?'),
505
505
  has: [
506
506
  {
507
507
  type: 'header',
508
508
  key: 'x-nextjs-data',
509
509
  },
510
510
  ],
511
- dest: path_1.default.join('/', entryDirectory),
511
+ dest: path_1.default.join('/', entryDirectory, trailingSlash ? '/' : ''),
512
512
  ...(isOverride ? { override: true } : {}),
513
513
  continue: true,
514
514
  },
@@ -519,7 +519,7 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
519
519
  return isNextDataServerResolving
520
520
  ? [
521
521
  {
522
- src: path_1.default.join('^/', entryDirectory, '$'),
522
+ src: path_1.default.join('^/', entryDirectory, trailingSlash ? '/' : '', '$'),
523
523
  has: [
524
524
  {
525
525
  type: 'header',
@@ -530,7 +530,6 @@ async function serverBuild({ dynamicPages, pagesDir, config = {}, privateOutputs
530
530
  continue: true,
531
531
  ...(isOverride ? { override: true } : {}),
532
532
  },
533
- // handle non-trailing slash
534
533
  {
535
534
  src: path_1.default.join('^/', entryDirectory, '((?!_next/)(?:.*[^/]|.*))/?$'),
536
535
  has: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/next",
3
- "version": "3.1.2",
3
+ "version": "3.1.3",
4
4
  "license": "MIT",
5
5
  "main": "./dist/index",
6
6
  "homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js",
@@ -45,7 +45,7 @@
45
45
  "@types/semver": "6.0.0",
46
46
  "@types/text-table": "0.2.1",
47
47
  "@types/webpack-sources": "3.2.0",
48
- "@vercel/build-utils": "4.2.1",
48
+ "@vercel/build-utils": "5.0.0",
49
49
  "@vercel/nft": "0.20.1",
50
50
  "@vercel/routing-utils": "1.13.5",
51
51
  "async-sema": "3.0.1",
@@ -70,5 +70,5 @@
70
70
  "typescript": "4.5.2",
71
71
  "webpack-sources": "3.2.3"
72
72
  },
73
- "gitHead": "547e88228e180e883e5f07ab815a16960767bbf5"
73
+ "gitHead": "621b53bc49a1ac4aaf6ab986f9bbbdd517af01f5"
74
74
  }