@vercel/next 4.6.0 → 4.6.2

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 +95 -63
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -824,7 +824,7 @@ var require_superstatic = __commonJS({
824
824
  sourceToRegex: () => sourceToRegex
825
825
  });
826
826
  module2.exports = __toCommonJS2(superstatic_exports);
827
- var import_url4 = require("url");
827
+ var import_url3 = require("url");
828
828
  var import_path_to_regexp = require_dist();
829
829
  var import_path_to_regexp_updated = require_dist2();
830
830
  function cloneKeys(keys) {
@@ -1086,7 +1086,7 @@ var require_superstatic = __commonJS({
1086
1086
  indexes[name] = "$" + name;
1087
1087
  escapedDestination = escapeSegment(escapedDestination, name);
1088
1088
  });
1089
- const parsedDestination = (0, import_url4.parse)(escapedDestination, true);
1089
+ const parsedDestination = (0, import_url3.parse)(escapedDestination, true);
1090
1090
  delete parsedDestination.href;
1091
1091
  delete parsedDestination.path;
1092
1092
  delete parsedDestination.search;
@@ -1138,7 +1138,7 @@ var require_superstatic = __commonJS({
1138
1138
  }
1139
1139
  }
1140
1140
  }
1141
- destination = (0, import_url4.format)({
1141
+ destination = (0, import_url3.format)({
1142
1142
  ...rest,
1143
1143
  hostname,
1144
1144
  pathname,
@@ -8173,24 +8173,24 @@ var require_util = __commonJS({
8173
8173
  }
8174
8174
  exports.urlParse = urlParse;
8175
8175
  function urlGenerate(aParsedUrl) {
8176
- let url4 = "";
8176
+ let url3 = "";
8177
8177
  if (aParsedUrl.scheme) {
8178
- url4 += aParsedUrl.scheme + ":";
8178
+ url3 += aParsedUrl.scheme + ":";
8179
8179
  }
8180
- url4 += "//";
8180
+ url3 += "//";
8181
8181
  if (aParsedUrl.auth) {
8182
- url4 += aParsedUrl.auth + "@";
8182
+ url3 += aParsedUrl.auth + "@";
8183
8183
  }
8184
8184
  if (aParsedUrl.host) {
8185
- url4 += aParsedUrl.host;
8185
+ url3 += aParsedUrl.host;
8186
8186
  }
8187
8187
  if (aParsedUrl.port) {
8188
- url4 += ":" + aParsedUrl.port;
8188
+ url3 += ":" + aParsedUrl.port;
8189
8189
  }
8190
8190
  if (aParsedUrl.path) {
8191
- url4 += aParsedUrl.path;
8191
+ url3 += aParsedUrl.path;
8192
8192
  }
8193
- return url4;
8193
+ return url3;
8194
8194
  }
8195
8195
  exports.urlGenerate = urlGenerate;
8196
8196
  var MAX_CACHED_INPUTS = 32;
@@ -8218,12 +8218,12 @@ var require_util = __commonJS({
8218
8218
  }
8219
8219
  var normalize = lruMemoize(function normalize2(aPath) {
8220
8220
  let path5 = aPath;
8221
- const url4 = urlParse(aPath);
8222
- if (url4) {
8223
- if (!url4.path) {
8221
+ const url3 = urlParse(aPath);
8222
+ if (url3) {
8223
+ if (!url3.path) {
8224
8224
  return aPath;
8225
8225
  }
8226
- path5 = url4.path;
8226
+ path5 = url3.path;
8227
8227
  }
8228
8228
  const isAbsolute = exports.isAbsolute(path5);
8229
8229
  const parts = [];
@@ -8263,9 +8263,9 @@ var require_util = __commonJS({
8263
8263
  if (path5 === "") {
8264
8264
  path5 = isAbsolute ? "/" : ".";
8265
8265
  }
8266
- if (url4) {
8267
- url4.path = path5;
8268
- return urlGenerate(url4);
8266
+ if (url3) {
8267
+ url3.path = path5;
8268
+ return urlGenerate(url3);
8269
8269
  }
8270
8270
  return path5;
8271
8271
  });
@@ -9586,13 +9586,13 @@ var require_source_map_consumer = __commonJS({
9586
9586
  if (this.sourceRoot != null) {
9587
9587
  relativeSource = util.relative(this.sourceRoot, relativeSource);
9588
9588
  }
9589
- let url4;
9590
- if (this.sourceRoot != null && (url4 = util.urlParse(this.sourceRoot))) {
9589
+ let url3;
9590
+ if (this.sourceRoot != null && (url3 = util.urlParse(this.sourceRoot))) {
9591
9591
  const fileUriAbsPath = relativeSource.replace(/^file:\/\//, "");
9592
- if (url4.scheme == "file" && this._sources.has(fileUriAbsPath)) {
9592
+ if (url3.scheme == "file" && this._sources.has(fileUriAbsPath)) {
9593
9593
  return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)];
9594
9594
  }
9595
- if ((!url4.path || url4.path == "/") && this._sources.has("/" + relativeSource)) {
9595
+ if ((!url3.path || url3.path == "/") && this._sources.has("/" + relativeSource)) {
9596
9596
  return this.sourcesContent[this._sources.indexOf("/" + relativeSource)];
9597
9597
  }
9598
9598
  }
@@ -10811,7 +10811,7 @@ var import_find_up = __toESM(require_find_up());
10811
10811
  var import_fs_extra6 = __toESM(require_lib2());
10812
10812
  var import_path5 = __toESM(require("path"));
10813
10813
  var import_semver4 = __toESM(require_semver());
10814
- var import_url3 = __toESM(require("url"));
10814
+ var import_url2 = __toESM(require("url"));
10815
10815
 
10816
10816
  // src/create-serverless-config.ts
10817
10817
  var import_fs_extra4 = __toESM(require_lib2());
@@ -13624,7 +13624,6 @@ var legacy_versions_default = [
13624
13624
 
13625
13625
  // src/server-build.ts
13626
13626
  var import_path4 = __toESM(require("path"));
13627
- var import_url2 = __toESM(require("url"));
13628
13627
  var import_semver3 = __toESM(require_semver());
13629
13628
  var import_async_sema2 = __toESM(require_lib());
13630
13629
  var import_build_utils2 = require("@vercel/build-utils");
@@ -13754,7 +13753,31 @@ async function serverBuild({
13754
13753
  const rewrite = rewrites[i];
13755
13754
  if (!rewrite.src || !rewrite.dest)
13756
13755
  continue;
13757
- const { protocol, pathname, query } = import_url2.default.parse(rewrite.dest);
13756
+ let protocol = null;
13757
+ if (rewrite.dest.startsWith("http://")) {
13758
+ protocol = "http://";
13759
+ } else if (rewrite.dest.startsWith("https://")) {
13760
+ protocol = "https://";
13761
+ }
13762
+ let pathname = null;
13763
+ let query = null;
13764
+ if (!protocol) {
13765
+ pathname = rewrite.dest;
13766
+ let index = pathname.indexOf("?");
13767
+ if (index !== -1) {
13768
+ query = pathname.substring(index + 1);
13769
+ pathname = pathname.substring(0, index);
13770
+ index = query.indexOf("#");
13771
+ if (index !== -1) {
13772
+ query = query.substring(0, index);
13773
+ }
13774
+ } else {
13775
+ index = pathname.indexOf("#");
13776
+ if (index !== -1) {
13777
+ pathname = pathname.substring(0, index);
13778
+ }
13779
+ }
13780
+ }
13758
13781
  if (isAfterFilesRewrite) {
13759
13782
  const parts = ["\\.rsc"];
13760
13783
  if (isAppPPREnabled) {
@@ -13768,11 +13791,12 @@ async function serverBuild({
13768
13791
  /\/?\(\?:\/\)\?/,
13769
13792
  `(?:/)?(?<rscsuff>${rscSuffix})?`
13770
13793
  );
13771
- let destQueryIndex = rewrite.dest.indexOf("?");
13794
+ const destQueryIndex = rewrite.dest.indexOf("?");
13772
13795
  if (destQueryIndex === -1) {
13773
- destQueryIndex = rewrite.dest.length;
13796
+ rewrite.dest = `${rewrite.dest}$rscsuff`;
13797
+ } else {
13798
+ rewrite.dest = `${rewrite.dest.substring(0, destQueryIndex)}$rscsuff${rewrite.dest.substring(destQueryIndex)}`;
13774
13799
  }
13775
- rewrite.dest = rewrite.dest.substring(0, destQueryIndex) + "$rscsuff" + rewrite.dest.substring(destQueryIndex);
13776
13800
  }
13777
13801
  const { rewriteHeaders } = routesManifest;
13778
13802
  if (!rewriteHeaders)
@@ -15703,7 +15727,7 @@ function isLegacyNext(nextVersion) {
15703
15727
  }
15704
15728
  var build = async (buildOptions) => {
15705
15729
  let { workPath, repoRootPath } = buildOptions;
15706
- const buildSpan = buildOptions.span ?? new import_build_utils3.Span({ name: import_build_utils3.BUILDER_COMPILE_STEP });
15730
+ const builderSpan = buildOptions.span ?? new import_build_utils3.Span({ name: "vc.builder" });
15707
15731
  const {
15708
15732
  files,
15709
15733
  entrypoint,
@@ -15817,11 +15841,11 @@ var build = async (buildOptions) => {
15817
15841
  typeof trimmedInstallCommand === "undefined" || // Case 1: We have a install command which is non zero length
15818
15842
  Boolean(trimmedInstallCommand)
15819
15843
  );
15820
- buildSpan.setAttributes({
15844
+ builderSpan.setAttributes({
15821
15845
  install: JSON.stringify(shouldRunInstallCommand)
15822
15846
  });
15823
15847
  if (shouldRunInstallCommand) {
15824
- await buildSpan.child(import_build_utils3.BUILDER_INSTALLER_STEP, {
15848
+ await builderSpan.child(import_build_utils3.BUILDER_INSTALLER_STEP, {
15825
15849
  cliType,
15826
15850
  lockfileVersion: lockfileVersion?.toString(),
15827
15851
  packageJsonPackageManager,
@@ -15909,37 +15933,45 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
15909
15933
  if (isServerMode) {
15910
15934
  env.NODE_ENV = "production";
15911
15935
  }
15912
- await buildSpan.child(import_build_utils3.BUILDER_COMPILE_STEP, {
15913
- buildCommand,
15914
- buildScriptName
15915
- }).trace(async () => {
15916
- if (buildCommand) {
15917
- const nodeBinPaths = (0, import_build_utils3.getNodeBinPaths)({
15918
- start: entryPath,
15919
- base: repoRootPath
15920
- });
15921
- const nodeBinPath = nodeBinPaths.join(import_path5.default.delimiter);
15922
- env.PATH = `${nodeBinPath}${import_path5.default.delimiter}${env.PATH}`;
15923
- if (!env.YARN_NODE_LINKER) {
15924
- env.YARN_NODE_LINKER = "node-modules";
15925
- }
15926
- (0, import_build_utils3.debug)(
15927
- `Added "${nodeBinPath}" to PATH env because a build command was used.`
15928
- );
15929
- console.log(`Running "${buildCommand}"`);
15930
- await (0, import_build_utils3.execCommand)(buildCommand, {
15931
- ...spawnOpts,
15932
- cwd: entryPath,
15933
- env
15934
- });
15935
- } else if (buildScriptName) {
15936
- await (0, import_build_utils3.runPackageJsonScript)(entryPath, buildScriptName, {
15937
- ...spawnOpts,
15938
- env
15939
- });
15940
- }
15936
+ const shouldRunCompileStep = Boolean(buildCommand) || Boolean(buildScriptName);
15937
+ builderSpan.setAttributes({
15938
+ build: JSON.stringify(shouldRunCompileStep)
15941
15939
  });
15942
- (0, import_build_utils3.debug)("build command exited");
15940
+ if (shouldRunCompileStep) {
15941
+ await builderSpan.child(import_build_utils3.BUILDER_COMPILE_STEP, {
15942
+ buildCommand,
15943
+ buildScriptName
15944
+ }).trace(async () => {
15945
+ if (buildCommand) {
15946
+ const nodeBinPaths = (0, import_build_utils3.getNodeBinPaths)({
15947
+ start: entryPath,
15948
+ base: repoRootPath
15949
+ });
15950
+ const nodeBinPath = nodeBinPaths.join(import_path5.default.delimiter);
15951
+ env.PATH = `${nodeBinPath}${import_path5.default.delimiter}${env.PATH}`;
15952
+ if (!env.YARN_NODE_LINKER) {
15953
+ env.YARN_NODE_LINKER = "node-modules";
15954
+ }
15955
+ (0, import_build_utils3.debug)(
15956
+ `Added "${nodeBinPath}" to PATH env because a build command was used.`
15957
+ );
15958
+ console.log(`Running "${buildCommand}"`);
15959
+ await (0, import_build_utils3.execCommand)(buildCommand, {
15960
+ ...spawnOpts,
15961
+ cwd: entryPath,
15962
+ env
15963
+ });
15964
+ } else if (buildScriptName) {
15965
+ await (0, import_build_utils3.runPackageJsonScript)(entryPath, buildScriptName, {
15966
+ ...spawnOpts,
15967
+ env
15968
+ });
15969
+ }
15970
+ });
15971
+ (0, import_build_utils3.debug)("build command exited");
15972
+ } else {
15973
+ console.log(`Skipping "build" command...`);
15974
+ }
15943
15975
  if (buildCallback) {
15944
15976
  await buildCallback(buildOptions);
15945
15977
  }
@@ -17329,7 +17361,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17329
17361
  for (let i = 0; i < dynamicRoutes.length; i++) {
17330
17362
  const route = dynamicRoutes[i];
17331
17363
  mergedDynamicRoutesLambdaRoutes.push(route);
17332
- const { pathname } = import_url3.default.parse(route.dest);
17364
+ const { pathname } = import_url2.default.parse(route.dest);
17333
17365
  if (pathname && pageLambdaMap[pathname]) {
17334
17366
  mergedDynamicRoutesLambdaRoutes.push(
17335
17367
  dynamicPageLambdaRoutesMap[pathname]
@@ -17339,7 +17371,7 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
17339
17371
  for (let i = 0; i < dataRoutes.length; i++) {
17340
17372
  const route = dataRoutes[i];
17341
17373
  mergedDataRoutesLambdaRoutes.push(route);
17342
- const { pathname } = import_url3.default.parse(route.dest);
17374
+ const { pathname } = import_url2.default.parse(route.dest);
17343
17375
  if (pathname && pageLambdaMap[pathname] && dynamicPageLambdaRoutesMap[pathname]) {
17344
17376
  mergedDataRoutesLambdaRoutes.push(dynamicPageLambdaRoutesMap[pathname]);
17345
17377
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/next",
3
- "version": "4.6.0",
3
+ "version": "4.6.2",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index",
6
6
  "homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js",
@@ -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": "9.3.0",
33
+ "@vercel/build-utils": "10.0.1",
34
34
  "@vercel/routing-utils": "5.0.4",
35
35
  "async-sema": "3.0.1",
36
36
  "buffer-crc32": "0.2.13",