@vercel/client 18.2.2 → 18.2.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.
@@ -101,6 +101,24 @@ const maybeRead = async function(path, default_) {
101
101
  return default_;
102
102
  }
103
103
  };
104
+ async function getUserIgnore(cwd) {
105
+ const [vercelignore, nowignore] = await Promise.all([
106
+ maybeRead((0, import_path.join)(cwd, ".vercelignore"), ""),
107
+ maybeRead((0, import_path.join)(cwd, ".nowignore"), "")
108
+ ]);
109
+ if (vercelignore && nowignore) {
110
+ throw new import_build_utils.NowBuildError({
111
+ code: "CONFLICTING_IGNORE_FILES",
112
+ message: "Cannot use both a `.vercelignore` and `.nowignore` file. Please delete the `.nowignore` file.",
113
+ link: "https://vercel.link/combining-old-and-new-config"
114
+ });
115
+ }
116
+ const ignoreFile = vercelignore || nowignore;
117
+ if (!ignoreFile) {
118
+ return null;
119
+ }
120
+ return (0, import_ignore.default)().add(clearRelative(ignoreFile));
121
+ }
104
122
  async function buildFileTree(path, {
105
123
  isDirectory,
106
124
  prebuilt,
@@ -129,6 +147,7 @@ async function buildFileTree(path, {
129
147
  const vcConfigFilePaths = fileList.filter(
130
148
  (file) => (0, import_path.basename)(file) === ".vc-config.json"
131
149
  );
150
+ const userIg = await getUserIgnore(path);
132
151
  await Promise.all(
133
152
  vcConfigFilePaths.map(async (p) => {
134
153
  const configJson = await (0, import_fs_extra.readFile)(p, "utf8");
@@ -136,7 +155,21 @@ async function buildFileTree(path, {
136
155
  if (!config.filePathMap)
137
156
  return;
138
157
  for (const v of Object.values(config.filePathMap)) {
139
- refs.add((0, import_path.join)(path, v));
158
+ const absPath = (0, import_path.join)(path, v);
159
+ const rel = (0, import_path.relative)(path, absPath);
160
+ if (rel.startsWith("..") || (0, import_path.isAbsolute)(rel)) {
161
+ debug(
162
+ `Ignoring "filePathMap" entry "${v}": resolves outside the deployment root`
163
+ );
164
+ continue;
165
+ }
166
+ if (userIg && userIg.ignores(rel)) {
167
+ debug(
168
+ `Ignoring "filePathMap" entry "${v}": matched by a rule in .vercelignore/.nowignore`
169
+ );
170
+ continue;
171
+ }
172
+ refs.add(absPath);
140
173
  }
141
174
  })
142
175
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/client",
3
- "version": "18.2.2",
3
+ "version": "18.2.3",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
6
6
  "homepage": "https://vercel.com",
@@ -37,9 +37,9 @@
37
37
  "querystring": "^0.2.0",
38
38
  "sleep-promise": "8.0.1",
39
39
  "tar-fs": "1.16.3",
40
- "@vercel/build-utils": "13.36.2",
41
- "@vercel/error-utils": "2.2.0",
42
- "@vercel/routing-utils": "6.4.0"
40
+ "@vercel/routing-utils": "6.4.0",
41
+ "@vercel/build-utils": "13.36.3",
42
+ "@vercel/error-utils": "2.2.0"
43
43
  },
44
44
  "scripts": {
45
45
  "build": "node ../../utils/build.mjs",