@vercel/client 18.12.4-snapshot-fdd4372a7e51 → 18.12.5

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.
@@ -9,6 +9,7 @@ export interface CollectedDeploymentFiles {
9
9
  isDirectory: boolean;
10
10
  ignoreList: string[];
11
11
  warning?: string;
12
+ referenceWarning?: string;
12
13
  }
13
14
  export declare function assertDeploymentPath(path: VercelClientOptions['path'] | undefined, debug: Debug): asserts path is VercelClientOptions['path'];
14
15
  export declare function collectDeploymentFiles(path: VercelClientOptions['path'] | undefined, clientOptions: CollectDeploymentFilesOptions, debug: Debug): Promise<CollectedDeploymentFiles>;
@@ -67,11 +67,7 @@ async function collectDeploymentFiles(path, clientOptions, debug) {
67
67
  } else {
68
68
  debug(`Provided 'path' is a single file`);
69
69
  }
70
- const { fileList, ignoreList, warning } = await (0, import_utils.buildFileTree)(
71
- path,
72
- clientOptions,
73
- debug
74
- );
70
+ const { fileList, ignoreList, warning, referenceWarning } = await (0, import_utils.buildFileTree)(path, clientOptions, debug);
75
71
  const workPath = typeof path === "string" ? path : path[0];
76
72
  let filesMap;
77
73
  try {
@@ -90,7 +86,15 @@ ${err.message}`;
90
86
  if (clientOptions.servePageAtRoot && !clientOptions.prebuilt && clientOptions.archive !== "tgz" && typeof path === "string") {
91
87
  addRootPageAlias(filesMap, isDirectory ? path : (0, import_path.dirname)(path), debug);
92
88
  }
93
- return { fileList, filesMap, workPath, isDirectory, ignoreList, warning };
89
+ return {
90
+ fileList,
91
+ filesMap,
92
+ workPath,
93
+ isDirectory,
94
+ ignoreList,
95
+ warning,
96
+ referenceWarning
97
+ };
94
98
  }
95
99
  function addRootPageAlias(filesMap, root, debug) {
96
100
  let page;
package/dist/continue.js CHANGED
@@ -54,7 +54,7 @@ async function* continueDeployment(options) {
54
54
  })
55
55
  };
56
56
  }
57
- const { fileList, warning } = await (0, import_utils.buildFileTree)(
57
+ const { fileList, warning, referenceWarning } = await (0, import_utils.buildFileTree)(
58
58
  options.path,
59
59
  { isDirectory: true, prebuilt: true, vercelOutputDir: outputDir },
60
60
  debug
@@ -67,6 +67,14 @@ async function* continueDeployment(options) {
67
67
  code: "PREBUILT_FILEPATHMAP_IGNORED"
68
68
  };
69
69
  }
70
+ if (referenceWarning) {
71
+ debug("Yielding a prebuilt skipped references warning");
72
+ yield {
73
+ type: "warning",
74
+ payload: referenceWarning,
75
+ code: "PREBUILT_REFERENCE_SKIPPED"
76
+ };
77
+ }
70
78
  const provisionJsonPath = (0, import_path.join)(outputDir, "provision.json");
71
79
  const unbundledFiles = fileList.filter((f) => f === provisionJsonPath);
72
80
  let files;
@@ -65,7 +65,8 @@ function buildCreateDeployment() {
65
65
  const {
66
66
  fileList,
67
67
  filesMap: files,
68
- warning
68
+ warning,
69
+ referenceWarning
69
70
  } = await (0, import_collect_deployment_files.collectDeploymentFiles)(path, clientOptions, debug);
70
71
  if (warning) {
71
72
  debug("Yielding a prebuilt filePathMap ignore warning");
@@ -75,6 +76,14 @@ function buildCreateDeployment() {
75
76
  code: "PREBUILT_FILEPATHMAP_IGNORED"
76
77
  };
77
78
  }
79
+ if (referenceWarning) {
80
+ debug("Yielding a prebuilt skipped references warning");
81
+ yield {
82
+ type: "warning",
83
+ payload: referenceWarning,
84
+ code: "PREBUILT_REFERENCE_SKIPPED"
85
+ };
86
+ }
78
87
  if (fileList.length === 0) {
79
88
  debug("Deployment path has no files. Yielding a warning event");
80
89
  yield {
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { continueDeployment } from './continue';
2
2
  export { checkDeploymentStatus } from './check-deployment-status';
3
3
  export { inspectDeploymentFiles } from './inspect-deployment-files';
4
- export { getVercelIgnore, buildFileTree } from './utils/index';
4
+ export { getVercelIgnore, buildFileTree, isVercelStateFile, } from './utils/index';
5
5
  export { DPOP_CLOCK_SKEW_TOLERANCE_SECONDS, getDpopServerTime, shouldResendDpopRequest, } from './utils/dpop';
6
6
  export declare const createDeployment: (clientOptions: import("./types").VercelClientOptions, deploymentOptions?: import("./types").DeploymentOptions | Promise<import("./types").DeploymentOptions>) => AsyncIterableIterator<{
7
7
  type: import("./types").DeploymentEventType;
package/dist/index.js CHANGED
@@ -37,6 +37,7 @@ __export(src_exports, {
37
37
  getDpopServerTime: () => import_dpop.getDpopServerTime,
38
38
  getVercelIgnore: () => import_utils.getVercelIgnore,
39
39
  inspectDeploymentFiles: () => import_inspect_deployment_files.inspectDeploymentFiles,
40
+ isVercelStateFile: () => import_utils.isVercelStateFile,
40
41
  shouldResendDpopRequest: () => import_dpop.shouldResendDpopRequest
41
42
  });
42
43
  module.exports = __toCommonJS(src_exports);
@@ -59,6 +60,7 @@ const createDeployment = (0, import_create_deployment.default)();
59
60
  getDpopServerTime,
60
61
  getVercelIgnore,
61
62
  inspectDeploymentFiles,
63
+ isVercelStateFile,
62
64
  shouldResendDpopRequest,
63
65
  ...require("./errors"),
64
66
  ...require("./types")
@@ -13,5 +13,6 @@ export interface DeploymentFileSummary {
13
13
  files: DeploymentFileItem[];
14
14
  ignored: string[];
15
15
  warning?: string;
16
+ referenceWarning?: string;
16
17
  }
17
18
  export declare function inspectDeploymentFiles(clientOptions: Pick<VercelClientOptions, 'archive' | 'bulkRedirectsPath' | 'debug' | 'path' | 'prebuilt' | 'projectName' | 'rootDirectory' | 'servePageAtRoot' | 'vercelOutputDir'>): Promise<DeploymentFileSummary>;
@@ -27,7 +27,14 @@ var import_utils = require("./utils");
27
27
  async function inspectDeploymentFiles(clientOptions) {
28
28
  const { path } = clientOptions;
29
29
  const debug = (0, import_utils.createDebug)(clientOptions.debug);
30
- const { filesMap, workPath, isDirectory, ignoreList, warning } = await (0, import_collect_deployment_files.collectDeploymentFiles)(path, { ...clientOptions }, debug);
30
+ const {
31
+ filesMap,
32
+ workPath,
33
+ isDirectory,
34
+ ignoreList,
35
+ warning,
36
+ referenceWarning
37
+ } = await (0, import_collect_deployment_files.collectDeploymentFiles)(path, { ...clientOptions }, debug);
31
38
  const files = [];
32
39
  let totalSize = 0;
33
40
  for (const [sha, file] of filesMap) {
@@ -55,7 +62,8 @@ async function inspectDeploymentFiles(clientOptions) {
55
62
  ignoredCount: ignoreList.length,
56
63
  files,
57
64
  ignored: ignoreList.sort(),
58
- warning
65
+ warning,
66
+ referenceWarning
59
67
  };
60
68
  }
61
69
  // Annotate the CommonJS export names for ESM import in node:
@@ -9,10 +9,21 @@ export type DeploymentEventType = (typeof EVENTS_ARRAY)[number];
9
9
  export declare const EVENTS: Set<"alias-assigned" | "error" | "hashes-calculated" | "file-count" | "file-uploaded" | "all-files-uploaded" | "created" | "building" | "ready" | "warning" | "notice" | "tip" | "canceled" | "blocked" | "checks-registered" | "checks-completed" | "checks-running" | "checks-conclusion-succeeded" | "checks-conclusion-failed" | "checks-conclusion-skipped" | "checks-conclusion-canceled" | "checks-v2-failed">;
10
10
  export declare function getApiDeploymentsUrl(): string;
11
11
  export declare function parseVercelConfig(filePath?: string): Promise<VercelConfig>;
12
+ /**
13
+ * Whether a root-relative POSIX path is a file directly inside a `.vercel/`
14
+ * directory at any depth. The CLI keeps its local state there: anonymous
15
+ * deployment credentials (`anonymous.json`), link files (`project.json`,
16
+ * `repo.json`), and env files from `vercel pull` (`.env.<target>.local`).
17
+ * Builder work directories nested under `.vercel/` (such as the Python venv in
18
+ * `.vercel/python/.venv`) are not matched; builders reference them in
19
+ * `filePathMap`.
20
+ */
21
+ export declare function isVercelStateFile(posixRel: string): boolean;
12
22
  export declare function buildFileTree(path: string | string[], { isDirectory, prebuilt, vercelOutputDir, rootDirectory, projectName, bulkRedirectsPath, }: Pick<VercelClientOptions, 'isDirectory' | 'prebuilt' | 'vercelOutputDir' | 'rootDirectory' | 'projectName' | 'bulkRedirectsPath'>, debug: Debug): Promise<{
13
23
  fileList: string[];
14
24
  ignoreList: string[];
15
25
  warning?: string;
26
+ referenceWarning?: string;
16
27
  }>;
17
28
  export declare function getVercelIgnore(cwd: string | string[], prebuilt?: boolean, vercelOutputDir?: string): Promise<{
18
29
  ig: Ignore;
@@ -35,6 +35,7 @@ __export(utils_exports, {
35
35
  fetchApi: () => fetchApi,
36
36
  getApiDeploymentsUrl: () => getApiDeploymentsUrl,
37
37
  getVercelIgnore: () => getVercelIgnore,
38
+ isVercelStateFile: () => isVercelStateFile,
38
39
  needsNewDpopProof: () => needsNewDpopProof,
39
40
  parseVercelConfig: () => parseVercelConfig,
40
41
  prepareFiles: () => prepareFiles,
@@ -44,6 +45,7 @@ __export(utils_exports, {
44
45
  module.exports = __toCommonJS(utils_exports);
45
46
  var import_network_error = require("./network-error");
46
47
  var import_path = require("path");
48
+ var import_fs = require("fs");
47
49
  var import_stream = require("stream");
48
50
  var import_url = require("url");
49
51
  var import_ignore = __toESM(require("ignore"));
@@ -130,6 +132,16 @@ async function getUserIgnore(cwd) {
130
132
  }
131
133
  const VCS_DEFAULTS = [".hg", ".git", ".gitmodules", ".svn", "CVS"];
132
134
  const filePathMapVcsDefaults = (0, import_ignore.default)().add(VCS_DEFAULTS);
135
+ function isVercelStateFile(posixRel) {
136
+ const parts = posixRel.split("/");
137
+ return parts.length >= 2 && parts[parts.length - 2].toLowerCase() === ".vercel";
138
+ }
139
+ function isInsideDir(dir, path) {
140
+ if (!dir)
141
+ return false;
142
+ const rel = (0, import_path.relative)(dir, path);
143
+ return rel !== "" && !rel.startsWith("..") && !(0, import_path.isAbsolute)(rel);
144
+ }
133
145
  const FILEPATHMAP_VERCELIGNORE_EXCEPTIONS = [
134
146
  "node_modules",
135
147
  ".next",
@@ -182,6 +194,97 @@ function formatFilePathMapIgnoreWarning(entries, ignoreFileName, truncated = fal
182
194
  `Remove the colliding rules from \`${ignoreFileName}\`, or exclude those paths from tracing with \`outputFileTracingExcludes\`.`
183
195
  ].join("\n");
184
196
  }
197
+ const SENSITIVE_DEFAULT_SEGMENT = /^(?:\.now|\.vercel|\.env\.local|\.env\.[^/]*\.local)$/i;
198
+ function matchesSensitiveDefault(posixRel) {
199
+ return posixRel.split("/").some((segment) => SENSITIVE_DEFAULT_SEGMENT.test(segment));
200
+ }
201
+ function isInDirectory(dir, absPath) {
202
+ if (!dir)
203
+ return false;
204
+ const rel = (0, import_path.relative)(dir, absPath);
205
+ return !rel.startsWith("..") && !(0, import_path.isAbsolute)(rel);
206
+ }
207
+ function realPathOf(absPath) {
208
+ try {
209
+ return import_fs.realpathSync.native(absPath);
210
+ } catch (_err) {
211
+ return void 0;
212
+ }
213
+ }
214
+ function createPrebuiltReferencePolicy(root, vercelOutputDir, userIg) {
215
+ return (absPath, kind) => {
216
+ const rel = (0, import_path.relative)(root, absPath);
217
+ if (rel.startsWith("..") || (0, import_path.isAbsolute)(rel)) {
218
+ return "outside-root";
219
+ }
220
+ const posixRel = rel.split(import_path.sep).join("/");
221
+ if (kind === "filePathMap") {
222
+ if (filePathMapVcsDefaults.ignores(posixRel)) {
223
+ return "vcs-default";
224
+ }
225
+ return userIg?.ig.ignores(posixRel) && !isFilePathMapIgnoreException(posixRel) ? "user-ignore" : void 0;
226
+ }
227
+ if (!posixRel || isInDirectory(vercelOutputDir, absPath)) {
228
+ return void 0;
229
+ }
230
+ if (filePathMapVcsDefaults.ignores(posixRel)) {
231
+ return "vcs-default";
232
+ }
233
+ if (matchesSensitiveDefault(posixRel)) {
234
+ return "sensitive-default";
235
+ }
236
+ return userIg?.ig.ignores(posixRel) ? "user-ignore" : void 0;
237
+ };
238
+ }
239
+ const EXCLUDED_REFERENCE_WARNING_LIST_LIMIT = 20;
240
+ function printable(text) {
241
+ return text.replace(
242
+ /[\u0000-\u001f\u007f-\u009f\u2028\u2029\u202a-\u202e\u2066-\u2069]/g,
243
+ "?"
244
+ );
245
+ }
246
+ function formatSkippedReferencesWarning(entries, total, userRuleTotal, ignoreFileName) {
247
+ const lines = entries.map(
248
+ ([path, exclusion]) => ` ${printable(path)} (${exclusion === "user-ignore" ? `\`${ignoreFileName}\` rule` : exclusion === "unresolved" ? "unknown on-disk path" : "default exclusion"})`
249
+ );
250
+ if (total > entries.length) {
251
+ lines.push(` \u2026and ${total - entries.length} more`);
252
+ }
253
+ return [
254
+ total === 1 ? "A source exclusion matches 1 path that this prebuilt deployment references. The CLI skipped it." : `Source exclusions match ${total} paths that this prebuilt deployment references. The CLI skipped them.`,
255
+ "",
256
+ ...lines,
257
+ "",
258
+ userRuleTotal > 0 ? `To upload a skipped path, remove its rule from \`${ignoreFileName}\`, or move or rename the file.` : "To upload a skipped path, move or rename the file."
259
+ ].join("\n");
260
+ }
261
+ const EXCLUSION_ERROR_TEXT_LIMIT = 200;
262
+ function bulkRedirectsExcludedError(bulkRedirectsPath, exclusion, userIg, posixRels) {
263
+ const shown = (text) => printable(text).slice(0, EXCLUSION_ERROR_TEXT_LIMIT);
264
+ const ignoreFileName = userIg?.ignoreFileName || ".vercelignore";
265
+ let reason;
266
+ let fix;
267
+ if (exclusion === "each-file") {
268
+ reason = `Source exclusions match each file in the bulk redirects path "${shown(bulkRedirectsPath)}".`;
269
+ fix = `Remove the rules from \`${ignoreFileName}\`, or move the redirects to a different path.`;
270
+ } else if (exclusion === "user-ignore" && userIg) {
271
+ const match = posixRels.map((posixRel) => findMatchingIgnoreRule(userIg.ignoreFile, posixRel)).find(({ rule, line }) => rule && line);
272
+ reason = match ? `The bulk redirects path "${shown(bulkRedirectsPath)}" matches the rule \`${shown(match.rule)}\` (\`${ignoreFileName}:${match.line}\`).` : `The bulk redirects path "${shown(bulkRedirectsPath)}" matches a rule in \`${ignoreFileName}\`.`;
273
+ fix = "Remove the rule, or move the redirects to a different path.";
274
+ } else if (exclusion === "unresolved") {
275
+ return new import_build_utils.NowBuildError({
276
+ code: "PREBUILT_BULK_REDIRECTS_EXCLUDED",
277
+ message: `The CLI cannot find the on-disk path of the bulk redirects path "${shown(bulkRedirectsPath)}". The CLI does not upload a path that it cannot check against the source exclusions. Move the redirects to a different path.`
278
+ });
279
+ } else {
280
+ reason = `The bulk redirects path "${shown(bulkRedirectsPath)}" matches a default source exclusion.`;
281
+ fix = "Move the redirects to a different path.";
282
+ }
283
+ return new import_build_utils.NowBuildError({
284
+ code: "PREBUILT_BULK_REDIRECTS_EXCLUDED",
285
+ message: `${reason} The CLI does not upload a path that a source exclusion matches. ${fix}`
286
+ });
287
+ }
185
288
  async function buildFileTree(path, {
186
289
  isDirectory,
187
290
  prebuilt,
@@ -193,6 +296,7 @@ async function buildFileTree(path, {
193
296
  const ignoreList = [];
194
297
  let fileList;
195
298
  let warning;
299
+ let referenceWarning;
196
300
  let { ig, ignores } = await getVercelIgnore(path, prebuilt, vercelOutputDir);
197
301
  debug(`Found ${ignores.length} rules in .vercelignore`);
198
302
  debug("Building file tree...");
@@ -207,11 +311,52 @@ async function buildFileTree(path, {
207
311
  };
208
312
  fileList = await (0, import_readdir_recursive.default)(path, [ignores2]);
209
313
  const refs = /* @__PURE__ */ new Set();
314
+ const userIg = prebuilt ? await getUserIgnore(path) : null;
315
+ const getReferenceExclusion = createPrebuiltReferencePolicy(
316
+ path,
317
+ vercelOutputDir,
318
+ userIg
319
+ );
320
+ let realRoot = null;
321
+ const toRootPath = (realPath) => {
322
+ if (realRoot === null) {
323
+ realRoot = realPathOf(path);
324
+ }
325
+ return realRoot === void 0 ? void 0 : (0, import_path.join)(path, (0, import_path.relative)(realRoot, realPath));
326
+ };
327
+ const getOnDiskExclusion = (absPath, realPath, kind) => {
328
+ const exclusion = getReferenceExclusion(absPath, kind);
329
+ if (exclusion || realPath === absPath) {
330
+ return exclusion;
331
+ }
332
+ const rootPath = realPath === void 0 ? void 0 : toRootPath(realPath);
333
+ if (rootPath === void 0) {
334
+ return "unresolved";
335
+ }
336
+ const onDiskExclusion = getReferenceExclusion(rootPath, kind);
337
+ return onDiskExclusion === "outside-root" ? void 0 : onDiskExclusion;
338
+ };
339
+ const skippedReferences = /* @__PURE__ */ new Map();
340
+ let skippedReferenceCount = 0;
341
+ let skippedByUserRuleCount = 0;
342
+ const skipReference = (absPath, exclusion) => {
343
+ const posixRel = (0, import_path.relative)(path, absPath).split(import_path.sep).join("/");
344
+ debug(`Skipping the reference "${printable(posixRel)}": ${exclusion}`);
345
+ if (exclusion === "outside-root" || skippedReferences.has(posixRel)) {
346
+ return;
347
+ }
348
+ skippedReferenceCount++;
349
+ if (exclusion === "user-ignore") {
350
+ skippedByUserRuleCount++;
351
+ }
352
+ if (skippedReferences.size < EXCLUDED_REFERENCE_WARNING_LIST_LIMIT) {
353
+ skippedReferences.set(posixRel, exclusion);
354
+ }
355
+ };
210
356
  if (prebuilt) {
211
357
  const vcConfigFilePaths = fileList.filter(
212
358
  (file) => (0, import_path.basename)(file) === ".vc-config.json"
213
359
  );
214
- const userIg = await getUserIgnore(path);
215
360
  const ignoredFilePathMap = /* @__PURE__ */ new Map();
216
361
  let ignoredFilePathMapTruncated = false;
217
362
  const vcConfigs = await Promise.all(
@@ -227,20 +372,25 @@ async function buildFileTree(path, {
227
372
  const absPath = (0, import_path.join)(path, v);
228
373
  const rel = (0, import_path.relative)(path, absPath);
229
374
  const posixRel = rel.split(import_path.sep).join("/");
230
- if (rel.startsWith("..") || (0, import_path.isAbsolute)(rel)) {
375
+ const exclusion = getReferenceExclusion(absPath, "filePathMap");
376
+ if (exclusion === "outside-root") {
231
377
  debug(
232
378
  `Ignoring "filePathMap" entry "${v}": resolves outside the deployment root`
233
379
  );
234
380
  continue;
235
381
  }
236
- if (filePathMapVcsDefaults.ignores(posixRel)) {
382
+ if (exclusion === "vcs-default") {
237
383
  throw new import_build_utils.NowBuildError({
238
384
  code: "PREBUILT_FILEPATHMAP_VCS",
239
385
  message: "Prebuilt functions reference version-control files that cannot be uploaded. Exclude version-control files from tracing and rebuild the prebuilt output."
240
386
  });
241
387
  }
388
+ if (isVercelStateFile(posixRel) && !isInsideDir(vercelOutputDir, absPath)) {
389
+ debug('Excluding a "filePathMap" entry: Vercel CLI state file');
390
+ continue;
391
+ }
242
392
  if (userIg && userIg.ig.ignores(posixRel)) {
243
- if (isFilePathMapIgnoreException(posixRel)) {
393
+ if (exclusion !== "user-ignore") {
244
394
  debug(
245
395
  `Keeping "filePathMap" entry "${v}": matches a default-ignored dependency/output path`
246
396
  );
@@ -294,7 +444,16 @@ async function buildFileTree(path, {
294
444
  });
295
445
  }
296
446
  if (microfrontendConfigPath) {
297
- refs.add(microfrontendConfigPath);
447
+ const exclusion = getOnDiskExclusion(
448
+ microfrontendConfigPath,
449
+ realPathOf(microfrontendConfigPath),
450
+ "microfrontends"
451
+ );
452
+ if (exclusion) {
453
+ skipReference(microfrontendConfigPath, exclusion);
454
+ } else {
455
+ refs.add(microfrontendConfigPath);
456
+ }
298
457
  }
299
458
  } catch (e) {
300
459
  debug(`Error detecting microfrontend config: ${e}`);
@@ -318,16 +477,61 @@ async function buildFileTree(path, {
318
477
  rootDirectory || "",
319
478
  bulkRedirectsPath
320
479
  );
321
- const relativeFromRoot = (0, import_path.relative)(projectRoot, bulkRedirectsFullPath);
322
- if (relativeFromRoot.startsWith("..")) {
480
+ if (getReferenceExclusion(bulkRedirectsFullPath, "bulkRedirects") === "outside-root") {
323
481
  debug(
324
482
  `Skipping bulk redirects path "${bulkRedirectsPath}" - path traversal detected (resolves outside project root)`
325
483
  );
326
484
  } else {
327
485
  try {
328
486
  const stats = await (0, import_fs_extra.stat)(bulkRedirectsFullPath);
329
- if (stats.isDirectory()) {
330
- const dirFiles = await (0, import_readdir_recursive.default)(bulkRedirectsFullPath, []);
487
+ const realBulkRedirectsPath = realPathOf(bulkRedirectsFullPath);
488
+ const exclusion = getOnDiskExclusion(
489
+ bulkRedirectsFullPath,
490
+ realBulkRedirectsPath,
491
+ "bulkRedirects"
492
+ );
493
+ if (exclusion || realBulkRedirectsPath === void 0) {
494
+ const rootPath = realBulkRedirectsPath && toRootPath(realBulkRedirectsPath);
495
+ throw bulkRedirectsExcludedError(
496
+ bulkRedirectsPath,
497
+ exclusion || "unresolved",
498
+ userIg,
499
+ [bulkRedirectsFullPath, rootPath || bulkRedirectsFullPath].map(
500
+ (file) => (0, import_path.relative)(path, file).split(import_path.sep).join("/")
501
+ )
502
+ );
503
+ } else if (stats.isDirectory()) {
504
+ let skipped = 0;
505
+ let kept = 0;
506
+ const dirFiles = await (0, import_readdir_recursive.default)(bulkRedirectsFullPath, [
507
+ (file, fileStats) => {
508
+ const fileExclusion = getOnDiskExclusion(
509
+ file,
510
+ (0, import_path.join)(
511
+ realBulkRedirectsPath,
512
+ (0, import_path.relative)(bulkRedirectsFullPath, file)
513
+ ),
514
+ "bulkRedirects"
515
+ );
516
+ if (!fileExclusion) {
517
+ if (!fileStats.isDirectory()) {
518
+ kept++;
519
+ }
520
+ return false;
521
+ }
522
+ skipReference(file, fileExclusion);
523
+ skipped++;
524
+ return true;
525
+ }
526
+ ]);
527
+ if (kept === 0 && skipped > 0) {
528
+ throw bulkRedirectsExcludedError(
529
+ bulkRedirectsPath,
530
+ "each-file",
531
+ userIg,
532
+ []
533
+ );
534
+ }
331
535
  for (const file of dirFiles) {
332
536
  refs.add(file);
333
537
  }
@@ -340,14 +544,28 @@ async function buildFileTree(path, {
340
544
  `Including bulk redirects file "${bulkRedirectsPath}" in deployment`
341
545
  );
342
546
  }
343
- } catch (_e) {
547
+ } catch (e) {
548
+ if (e instanceof import_build_utils.NowBuildError) {
549
+ throw e;
550
+ }
344
551
  debug(`Bulk redirects path "${bulkRedirectsPath}" not found`);
345
552
  }
346
553
  }
347
554
  } catch (e) {
555
+ if (e instanceof import_build_utils.NowBuildError) {
556
+ throw e;
557
+ }
348
558
  debug(`Error checking for bulk redirects path: ${e}`);
349
559
  }
350
560
  }
561
+ if (skippedReferenceCount > 0) {
562
+ referenceWarning = formatSkippedReferencesWarning(
563
+ [...skippedReferences.entries()].sort(([a], [b]) => a.localeCompare(b)),
564
+ skippedReferenceCount,
565
+ skippedByUserRuleCount,
566
+ userIg?.ignoreFileName || ".vercelignore"
567
+ );
568
+ }
351
569
  if (refs.size > 0) {
352
570
  fileList = fileList.concat(Array.from(refs));
353
571
  }
@@ -359,7 +577,7 @@ async function buildFileTree(path, {
359
577
  fileList = [path];
360
578
  debug(`Deploying the provided path as single file`);
361
579
  }
362
- return { fileList, ignoreList, warning };
580
+ return { fileList, ignoreList, warning, referenceWarning };
363
581
  }
364
582
  async function getVercelIgnore(cwd, prebuilt, vercelOutputDir) {
365
583
  const ig = (0, import_ignore.default)();
@@ -606,6 +824,7 @@ function createDebug(debug) {
606
824
  fetchApi,
607
825
  getApiDeploymentsUrl,
608
826
  getVercelIgnore,
827
+ isVercelStateFile,
609
828
  needsNewDpopProof,
610
829
  parseVercelConfig,
611
830
  prepareFiles,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/client",
3
- "version": "18.12.4-snapshot-fdd4372a7e51",
3
+ "version": "18.12.5",
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/routing-utils": "6.6.1",
40
+ "@vercel/build-utils": "15.6.0",
41
41
  "@vercel/error-utils": "2.2.1",
42
- "@vercel/build-utils": "15.5.0-snapshot-fdd4372a7e51"
42
+ "@vercel/routing-utils": "6.6.1"
43
43
  },
44
44
  "scripts": {
45
45
  "build": "node ../../utils/build.mjs",