@vercel/node 5.6.1 → 5.6.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.
Files changed (2) hide show
  1. package/dist/index.js +62 -0
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -70880,6 +70880,7 @@ var import_fs2 = require("fs");
70880
70880
  var import_path6 = require("path");
70881
70881
  var import_tree_kill = __toESM(require_tree_kill());
70882
70882
  var import_util = require("util");
70883
+ var import_stream = require("stream");
70883
70884
  var import_build_utils7 = require("@vercel/build-utils");
70884
70885
  var import_error_utils2 = require("@vercel/error-utils");
70885
70886
  var import_static_config2 = require("@vercel/static-config");
@@ -71059,9 +71060,70 @@ async function readMessage(child) {
71059
71060
  // src/start-dev-server.ts
71060
71061
  var require_3 = (0, import_module3.createRequire)(__filename);
71061
71062
  var treeKill = (0, import_util.promisify)(import_tree_kill.default);
71063
+ async function syncDependencies(workPath, onStdout, onStderr) {
71064
+ const writeOut = (msg) => {
71065
+ if (onStdout) {
71066
+ onStdout(Buffer.from(msg));
71067
+ } else {
71068
+ process.stdout.write(msg);
71069
+ }
71070
+ };
71071
+ const writeErr = (msg) => {
71072
+ if (onStderr) {
71073
+ onStderr(Buffer.from(msg));
71074
+ } else {
71075
+ process.stderr.write(msg);
71076
+ }
71077
+ };
71078
+ const captured = [];
71079
+ const bufStdout = new import_stream.Writable({
71080
+ write(chunk, _enc, cb) {
71081
+ captured.push([
71082
+ "stdout",
71083
+ Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk)
71084
+ ]);
71085
+ cb();
71086
+ }
71087
+ });
71088
+ const bufStderr = new import_stream.Writable({
71089
+ write(chunk, _enc, cb) {
71090
+ captured.push([
71091
+ "stderr",
71092
+ Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk)
71093
+ ]);
71094
+ cb();
71095
+ }
71096
+ });
71097
+ try {
71098
+ await (0, import_build_utils7.runNpmInstall)(workPath, [], void 0, void 0, void 0, {
71099
+ stdout: bufStdout,
71100
+ stderr: bufStderr
71101
+ });
71102
+ } catch (err) {
71103
+ for (const [channel, chunk] of captured) {
71104
+ (channel === "stdout" ? writeOut : writeErr)(chunk.toString());
71105
+ }
71106
+ throw new import_build_utils7.NowBuildError({
71107
+ code: "NODE_DEPENDENCY_SYNC_FAILED",
71108
+ message: `Failed to install Node.JS dependencies: ${err instanceof Error ? err.message : String(err)}`
71109
+ });
71110
+ }
71111
+ }
71062
71112
  var startDevServer = async (opts) => {
71063
71113
  const { entrypoint, workPath, config, meta = {}, publicDir } = opts;
71064
71114
  const entrypointPath = (0, import_path6.join)(workPath, entrypoint);
71115
+ if (meta.syncDependencies) {
71116
+ const gray = "\x1B[90m";
71117
+ const reset = "\x1B[0m";
71118
+ const syncMessage = `${gray}Synchronizing dependencies...${reset}
71119
+ `;
71120
+ if (opts.onStdout) {
71121
+ opts.onStdout(Buffer.from(syncMessage));
71122
+ } else {
71123
+ console.log(syncMessage);
71124
+ }
71125
+ await syncDependencies(workPath, opts.onStdout, opts.onStderr);
71126
+ }
71065
71127
  const project = new import_ts_morph2.Project();
71066
71128
  const staticConfig = (0, import_static_config2.getConfig)(project, entrypointPath);
71067
71129
  const vercelConfigFile = opts.files["vercel.json"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/node",
3
- "version": "5.6.1",
3
+ "version": "5.6.3",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index",
6
6
  "homepage": "https://vercel.com/docs/runtimes#official-runtimes/node-js",
@@ -32,7 +32,7 @@
32
32
  "tsx": "4.21.0",
33
33
  "typescript": "npm:typescript@5.9.3",
34
34
  "undici": "5.28.4",
35
- "@vercel/build-utils": "13.3.4",
35
+ "@vercel/build-utils": "13.4.0",
36
36
  "@vercel/static-config": "3.1.2",
37
37
  "@vercel/error-utils": "2.0.3"
38
38
  },
@@ -59,7 +59,7 @@
59
59
  "tree-kill": "1.2.2",
60
60
  "vite": "^5.1.6",
61
61
  "vitest": "^2.0.1",
62
- "@vercel/functions": "3.4.1"
62
+ "@vercel/functions": "3.4.2"
63
63
  },
64
64
  "scripts": {
65
65
  "build": "node build.mjs",