@vercel/node 5.3.13 → 5.3.15

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 +53 -12
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -69768,7 +69768,8 @@ async function downloadInstallAndBundle({
69768
69768
  entrypoint,
69769
69769
  workPath,
69770
69770
  config,
69771
- meta
69771
+ meta,
69772
+ considerBuildCommand
69772
69773
  }) {
69773
69774
  const downloadedFiles = await (0, import_build_utils3.download)(files, workPath, meta);
69774
69775
  const entrypointFsDirname = (0, import_path3.join)(workPath, (0, import_path3.dirname)(entrypoint));
@@ -69779,14 +69780,27 @@ async function downloadInstallAndBundle({
69779
69780
  meta
69780
69781
  );
69781
69782
  const spawnOpts = (0, import_build_utils3.getSpawnOptions)(meta, nodeVersion);
69782
- await (0, import_build_utils3.runNpmInstall)(
69783
- entrypointFsDirname,
69784
- [],
69785
- spawnOpts,
69786
- meta,
69787
- nodeVersion,
69788
- config.projectSettings?.createdAt
69789
- );
69783
+ const installCommand = config.projectSettings?.installCommand;
69784
+ if (typeof installCommand === "string" && considerBuildCommand) {
69785
+ if (installCommand.trim()) {
69786
+ console.log(`Running "install" command: \`${installCommand}\`...`);
69787
+ await (0, import_build_utils3.execCommand)(installCommand, {
69788
+ ...spawnOpts,
69789
+ cwd: entrypointFsDirname
69790
+ });
69791
+ } else {
69792
+ console.log(`Skipping "install" command...`);
69793
+ }
69794
+ } else {
69795
+ await (0, import_build_utils3.runNpmInstall)(
69796
+ entrypointFsDirname,
69797
+ [],
69798
+ spawnOpts,
69799
+ meta,
69800
+ nodeVersion,
69801
+ config.projectSettings?.createdAt
69802
+ );
69803
+ }
69790
69804
  const entrypointPath = downloadedFiles[entrypoint].fsPath;
69791
69805
  return { entrypointPath, entrypointFsDirname, nodeVersion, spawnOpts };
69792
69806
  }
@@ -70013,17 +70027,25 @@ var build = async ({
70013
70027
  repoRootPath,
70014
70028
  config = {},
70015
70029
  meta = {},
70016
- considerBuildCommand = false
70030
+ considerBuildCommand = false,
70031
+ entrypointCallback
70017
70032
  }) => {
70018
70033
  const baseDir = repoRootPath || workPath;
70019
70034
  const awsLambdaHandler = getAWSLambdaHandler(entrypoint, config);
70020
- const { entrypointPath, entrypointFsDirname, nodeVersion, spawnOpts } = await downloadInstallAndBundle({
70035
+ const {
70036
+ entrypointPath: _entrypointPath,
70037
+ entrypointFsDirname,
70038
+ nodeVersion,
70039
+ spawnOpts
70040
+ } = await downloadInstallAndBundle({
70021
70041
  files,
70022
70042
  entrypoint,
70023
70043
  workPath,
70024
70044
  config,
70025
- meta
70045
+ meta,
70046
+ considerBuildCommand
70026
70047
  });
70048
+ let entrypointPath = _entrypointPath;
70027
70049
  const projectBuildCommand = config.projectSettings?.buildCommand;
70028
70050
  if (projectBuildCommand && considerBuildCommand) {
70029
70051
  await (0, import_build_utils3.execCommand)(projectBuildCommand, {
@@ -70054,6 +70076,25 @@ var build = async ({
70054
70076
  if (runtime) {
70055
70077
  isEdgeFunction = isEdgeRuntime(runtime);
70056
70078
  }
70079
+ if (config.projectSettings?.outputDirectory) {
70080
+ const outputDirFiles = await (0, import_build_utils3.glob)(
70081
+ "**/*",
70082
+ (0, import_path3.join)(workPath, config.projectSettings.outputDirectory)
70083
+ );
70084
+ const outputDirEntrypoint = entrypointCallback?.(outputDirFiles);
70085
+ if (outputDirEntrypoint) {
70086
+ const outputDirEntrypointPath = (0, import_path3.join)(
70087
+ workPath,
70088
+ config.projectSettings.outputDirectory,
70089
+ outputDirEntrypoint
70090
+ );
70091
+ entrypointPath = outputDirEntrypointPath;
70092
+ } else {
70093
+ console.warn(
70094
+ `No entrypoint found in output directory ${config.projectSettings.outputDirectory}. Using the original entrypoint of ${entrypoint}.`
70095
+ );
70096
+ }
70097
+ }
70057
70098
  (0, import_build_utils3.debug)("Tracing input files...");
70058
70099
  const traceTime = Date.now();
70059
70100
  const { preparedFiles, shouldAddSourcemapSupport } = await compile2(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/node",
3
- "version": "5.3.13",
3
+ "version": "5.3.15",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index",
6
6
  "homepage": "https://vercel.com/docs/runtimes#official-runtimes/node-js",
@@ -17,9 +17,9 @@
17
17
  "@edge-runtime/primitives": "4.1.0",
18
18
  "@edge-runtime/vm": "3.2.0",
19
19
  "@types/node": "16.18.11",
20
- "@vercel/build-utils": "11.0.1",
20
+ "@vercel/build-utils": "11.0.2",
21
21
  "@vercel/error-utils": "2.0.3",
22
- "@vercel/nft": "0.29.2",
22
+ "@vercel/nft": "0.30.1",
23
23
  "@vercel/static-config": "3.1.1",
24
24
  "async-listen": "3.0.0",
25
25
  "cjs-module-lexer": "1.2.3",
@@ -57,7 +57,7 @@
57
57
  "tree-kill": "1.2.2",
58
58
  "vite": "^5.1.6",
59
59
  "vitest": "^2.0.1",
60
- "@vercel/functions": "2.2.12"
60
+ "@vercel/functions": "2.2.13"
61
61
  },
62
62
  "scripts": {
63
63
  "build": "node build.mjs",