@vercel/next 4.5.2 → 4.6.0

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 +64 -35
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -13820,6 +13820,9 @@ async function serverBuild({
13820
13820
  ) : {};
13821
13821
  const updated = {
13822
13822
  ...rewrite,
13823
+ // We don't want to perform the actual rewrite here, instead we want
13824
+ // to just add the headers associated with the rewrite.
13825
+ dest: void 0,
13823
13826
  has,
13824
13827
  headers: headers2
13825
13828
  };
@@ -15700,6 +15703,7 @@ function isLegacyNext(nextVersion) {
15700
15703
  }
15701
15704
  var build = async (buildOptions) => {
15702
15705
  let { workPath, repoRootPath } = buildOptions;
15706
+ const buildSpan = buildOptions.span ?? new import_build_utils3.Span({ name: import_build_utils3.BUILDER_COMPILE_STEP });
15703
15707
  const {
15704
15708
  files,
15705
15709
  entrypoint,
@@ -15806,18 +15810,38 @@ var build = async (buildOptions) => {
15806
15810
  (0, import_build_utils3.debug)("Found NPM_AUTH_TOKEN in environment, creating .npmrc");
15807
15811
  await writeNpmRc(entryPath, process.env.NPM_AUTH_TOKEN);
15808
15812
  }
15809
- if (typeof installCommand === "string") {
15810
- if (installCommand.trim()) {
15811
- console.log(`Running "install" command: \`${installCommand}\`...`);
15812
- await (0, import_build_utils3.execCommand)(installCommand, {
15813
- ...spawnOpts,
15814
- cwd: entryPath
15815
- });
15816
- } else {
15817
- console.log(`Skipping "install" command...`);
15818
- }
15813
+ const { detectedPackageManager } = (0, import_build_utils3.detectPackageManager)(cliType, lockfileVersion) ?? {};
15814
+ const trimmedInstallCommand = installCommand?.trim();
15815
+ const shouldRunInstallCommand = (
15816
+ // Case 1: We have a zero config install
15817
+ typeof trimmedInstallCommand === "undefined" || // Case 1: We have a install command which is non zero length
15818
+ Boolean(trimmedInstallCommand)
15819
+ );
15820
+ buildSpan.setAttributes({
15821
+ install: JSON.stringify(shouldRunInstallCommand)
15822
+ });
15823
+ if (shouldRunInstallCommand) {
15824
+ await buildSpan.child(import_build_utils3.BUILDER_INSTALLER_STEP, {
15825
+ cliType,
15826
+ lockfileVersion: lockfileVersion?.toString(),
15827
+ packageJsonPackageManager,
15828
+ detectedPackageManager,
15829
+ installCommand: trimmedInstallCommand
15830
+ }).trace(async () => {
15831
+ if (typeof trimmedInstallCommand === "string") {
15832
+ console.log(
15833
+ `Running "install" command: \`${trimmedInstallCommand}\`...`
15834
+ );
15835
+ await (0, import_build_utils3.execCommand)(trimmedInstallCommand, {
15836
+ ...spawnOpts,
15837
+ cwd: entryPath
15838
+ });
15839
+ } else {
15840
+ await (0, import_build_utils3.runNpmInstall)(entryPath, [], spawnOpts, meta, nodeVersion);
15841
+ }
15842
+ });
15819
15843
  } else {
15820
- await (0, import_build_utils3.runNpmInstall)(entryPath, [], spawnOpts, meta, nodeVersion);
15844
+ console.log(`Skipping "install" command...`);
15821
15845
  }
15822
15846
  if (spawnOpts.env.VERCEL_ANALYTICS_ID) {
15823
15847
  (0, import_build_utils3.debug)("Found VERCEL_ANALYTICS_ID in environment");
@@ -15885,31 +15909,36 @@ More info: http://err.sh/vercel/vercel/next-functions-config-optimized-lambdas`
15885
15909
  if (isServerMode) {
15886
15910
  env.NODE_ENV = "production";
15887
15911
  }
15888
- if (buildCommand) {
15889
- const nodeBinPaths = (0, import_build_utils3.getNodeBinPaths)({
15890
- start: entryPath,
15891
- base: repoRootPath
15892
- });
15893
- const nodeBinPath = nodeBinPaths.join(import_path5.default.delimiter);
15894
- env.PATH = `${nodeBinPath}${import_path5.default.delimiter}${env.PATH}`;
15895
- if (!env.YARN_NODE_LINKER) {
15896
- env.YARN_NODE_LINKER = "node-modules";
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
+ });
15897
15940
  }
15898
- (0, import_build_utils3.debug)(
15899
- `Added "${nodeBinPath}" to PATH env because a build command was used.`
15900
- );
15901
- console.log(`Running "${buildCommand}"`);
15902
- await (0, import_build_utils3.execCommand)(buildCommand, {
15903
- ...spawnOpts,
15904
- cwd: entryPath,
15905
- env
15906
- });
15907
- } else if (buildScriptName) {
15908
- await (0, import_build_utils3.runPackageJsonScript)(entryPath, buildScriptName, {
15909
- ...spawnOpts,
15910
- env
15911
- });
15912
- }
15941
+ });
15913
15942
  (0, import_build_utils3.debug)("build command exited");
15914
15943
  if (buildCallback) {
15915
15944
  await buildCallback(buildOptions);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/next",
3
- "version": "4.5.2",
3
+ "version": "4.6.0",
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.2.1",
33
+ "@vercel/build-utils": "9.3.0",
34
34
  "@vercel/routing-utils": "5.0.4",
35
35
  "async-sema": "3.0.1",
36
36
  "buffer-crc32": "0.2.13",