@vercel/client 13.0.14 → 13.1.1

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.
@@ -37,6 +37,7 @@ var import_hashes = require("./utils/hashes");
37
37
  var import_upload = require("./upload");
38
38
  var import_utils = require("./utils");
39
39
  var import_errors = require("./errors");
40
+ var import_error_utils = require("@vercel/error-utils");
40
41
  var import_build_utils = require("@vercel/build-utils");
41
42
  var import_tar_fs = __toESM(require("tar-fs"));
42
43
  var import_zlib = require("zlib");
@@ -96,25 +97,37 @@ function buildCreateDeployment() {
96
97
  }
97
98
  const workPath = typeof path === "string" ? path : path[0];
98
99
  let files;
99
- if (clientOptions.archive === "tgz") {
100
- debug("Packing tarball");
101
- const tarStream = import_tar_fs.default.pack(workPath, {
102
- entries: fileList.map((file) => (0, import_path.relative)(workPath, file))
103
- }).pipe((0, import_zlib.createGzip)());
104
- const tarBuffer = await (0, import_build_utils.streamToBuffer)(tarStream);
105
- debug("Packed tarball");
106
- files = /* @__PURE__ */ new Map([
107
- [
108
- (0, import_hashes.hash)(tarBuffer),
109
- {
110
- names: [(0, import_path.join)(workPath, ".vercel/source.tgz")],
111
- data: tarBuffer,
112
- mode: 438
113
- }
114
- ]
115
- ]);
116
- } else {
117
- files = await (0, import_hashes.hashes)(fileList);
100
+ try {
101
+ if (clientOptions.archive === "tgz") {
102
+ debug("Packing tarball");
103
+ const tarStream = import_tar_fs.default.pack(workPath, {
104
+ entries: fileList.map((file) => (0, import_path.relative)(workPath, file))
105
+ }).pipe((0, import_zlib.createGzip)());
106
+ const tarBuffer = await (0, import_build_utils.streamToBuffer)(tarStream);
107
+ debug("Packed tarball");
108
+ files = /* @__PURE__ */ new Map([
109
+ [
110
+ (0, import_hashes.hash)(tarBuffer),
111
+ {
112
+ names: [(0, import_path.join)(workPath, ".vercel/source.tgz")],
113
+ data: tarBuffer,
114
+ mode: 438
115
+ }
116
+ ]
117
+ ]);
118
+ } else {
119
+ files = await (0, import_hashes.hashes)(fileList);
120
+ }
121
+ } catch (err) {
122
+ if (clientOptions.prebuilt && (0, import_error_utils.isErrnoException)(err) && err.code === "ENOENT" && err.path) {
123
+ const errPath = (0, import_path.relative)(workPath, err.path);
124
+ err.message = `File does not exist: "${(0, import_path.relative)(workPath, errPath)}"`;
125
+ if (errPath.split(import_path.sep).includes("node_modules")) {
126
+ err.message = `Please ensure project dependencies have been installed:
127
+ ${err.message}`;
128
+ }
129
+ }
130
+ throw err;
118
131
  }
119
132
  debug(`Yielding a 'hashes-calculated' event with ${files.size} hashes`);
120
133
  yield { type: "hashes-calculated", payload: (0, import_hashes.mapToObject)(files) };
@@ -120,6 +120,26 @@ async function buildFileTree(path, {
120
120
  return ignored;
121
121
  };
122
122
  fileList = await (0, import_readdir_recursive.default)(path, [ignores2]);
123
+ if (prebuilt) {
124
+ const refs = /* @__PURE__ */ new Set();
125
+ const vcConfigFilePaths = fileList.filter(
126
+ (file) => (0, import_path.basename)(file) === ".vc-config.json"
127
+ );
128
+ await Promise.all(
129
+ vcConfigFilePaths.map(async (p) => {
130
+ const configJson = await (0, import_fs_extra.readFile)(p, "utf8");
131
+ const config = JSON.parse(configJson);
132
+ if (!config.filePathMap)
133
+ return;
134
+ for (const v of Object.values(config.filePathMap)) {
135
+ refs.add((0, import_path.join)(path, v));
136
+ }
137
+ })
138
+ );
139
+ if (refs.size > 0) {
140
+ fileList = fileList.concat(Array.from(refs));
141
+ }
142
+ }
123
143
  debug(`Found ${fileList.length} files in the specified directory`);
124
144
  } else if (Array.isArray(path)) {
125
145
  fileList = path;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/client",
3
- "version": "13.0.14",
3
+ "version": "13.1.1",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
6
6
  "homepage": "https://vercel.com",
@@ -31,6 +31,7 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@vercel/build-utils": "7.5.1",
34
+ "@vercel/error-utils": "2.0.2",
34
35
  "@vercel/routing-utils": "3.1.0",
35
36
  "@zeit/fetch": "5.2.0",
36
37
  "async-retry": "1.2.3",