@vercel/client 18.4.7 → 18.5.0

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.
package/dist/types.d.ts CHANGED
@@ -138,6 +138,24 @@ export type VercelConfigSchedule = Omit<Schedule, 'target'> & {
138
138
  entrypoint: string;
139
139
  };
140
140
  };
141
+ /**
142
+ * Flat `vercel.json` schedule. Config validation normalizes it to
143
+ * `VercelConfigSchedule`.
144
+ */
145
+ export type VercelConfigFlatSchedule = {
146
+ name: string;
147
+ schedule: string;
148
+ timezone?: string;
149
+ jitter?: number;
150
+ } & ({
151
+ path: string;
152
+ } | {
153
+ function: string;
154
+ } | {
155
+ topic: string;
156
+ } | {
157
+ entrypoint: string;
158
+ });
141
159
  export declare const fileNameSymbol: unique symbol;
142
160
  export interface VercelConfig {
143
161
  [fileNameSymbol]?: string;
@@ -170,7 +188,7 @@ export interface VercelConfig {
170
188
  outputDirectory?: string | null;
171
189
  images?: Images;
172
190
  crons?: Cron[];
173
- schedules?: VercelConfigSchedule[];
191
+ schedules?: (VercelConfigSchedule | VercelConfigFlatSchedule)[];
174
192
  bunVersion?: string;
175
193
  proxy?: ProxyConfig;
176
194
  /**
@@ -119,6 +119,7 @@ async function getUserIgnore(cwd) {
119
119
  }
120
120
  return {
121
121
  ig: (0, import_ignore.default)().add(clearRelative(ignoreFile)),
122
+ ignoreFile,
122
123
  ignoreFileName: vercelignore ? ".vercelignore" : ".nowignore"
123
124
  };
124
125
  }
@@ -138,10 +139,28 @@ const filePathMapVercelignoreExceptions = (0, import_ignore.default)().add(
138
139
  function isFilePathMapIgnoreException(posixRel) {
139
140
  return filePathMapVercelignoreExceptions.ignores(posixRel);
140
141
  }
141
- const FILEPATHMAP_IGNORE_ERROR_LIST_LIMIT = 20;
142
+ const FILEPATHMAP_IGNORE_WARNING_LIST_LIMIT = 100;
143
+ function findMatchingIgnoreRule(ignoreFile, posixRel) {
144
+ const matcher = (0, import_ignore.default)();
145
+ let wasIgnored = false;
146
+ let match = {};
147
+ for (const [index, rule] of ignoreFile.split(/\r?\n/).entries()) {
148
+ matcher.add(clearRelative(rule));
149
+ const isIgnored = matcher.ignores(posixRel);
150
+ if (!wasIgnored && isIgnored) {
151
+ match = { rule, line: index + 1 };
152
+ } else if (wasIgnored && !isIgnored) {
153
+ match = {};
154
+ }
155
+ wasIgnored = isIgnored;
156
+ }
157
+ return match;
158
+ }
142
159
  function formatFilePathMapIgnoreWarning(entries, ignoreFileName, truncated = false) {
143
- const shown = entries.slice(0, FILEPATHMAP_IGNORE_ERROR_LIST_LIMIT);
144
- const lines = shown.map((path) => ` ${path}`);
160
+ const shown = entries.slice(0, FILEPATHMAP_IGNORE_WARNING_LIST_LIMIT);
161
+ const lines = shown.map(
162
+ ({ path, rule, line }) => rule && line ? ` ${path} (matched \`${ignoreFileName}:${line}\`: \`${rule}\`)` : ` ${path}`
163
+ );
145
164
  if (truncated) {
146
165
  lines.push(" \u2026and more");
147
166
  }
@@ -149,7 +168,7 @@ function formatFilePathMapIgnoreWarning(entries, ignoreFileName, truncated = fal
149
168
  const fileWord = !truncated && entries.length === 1 ? "file" : "files";
150
169
  const ignoreFileLabel = ignoreFileName === ".nowignore" ? `\`${ignoreFileName}\` (deprecated)` : `\`${ignoreFileName}\``;
151
170
  return [
152
- `${ignoreFileLabel} excludes ${count} ${fileWord} the prebuilt functions need. An upcoming CLI release will fail this deploy instead of uploading without them.`,
171
+ `${ignoreFileLabel} excludes ${count} ${fileWord} the prebuilt functions need. Uploading without them may fail with ENOENT.`,
153
172
  "",
154
173
  ...lines,
155
174
  "",
@@ -186,7 +205,7 @@ async function buildFileTree(path, {
186
205
  (file) => (0, import_path.basename)(file) === ".vc-config.json"
187
206
  );
188
207
  const userIg = await getUserIgnore(path);
189
- const ignoredFilePathMap = /* @__PURE__ */ new Set();
208
+ const ignoredFilePathMap = /* @__PURE__ */ new Map();
190
209
  let ignoredFilePathMapTruncated = false;
191
210
  const vcConfigs = await Promise.all(
192
211
  vcConfigFilePaths.map(async (p) => {
@@ -219,11 +238,14 @@ async function buildFileTree(path, {
219
238
  `Skipping "filePathMap" entry "${v}": already in the upload set`
220
239
  );
221
240
  continue;
222
- } else if (ignoredFilePathMap.size >= FILEPATHMAP_IGNORE_ERROR_LIST_LIMIT) {
241
+ } else if (ignoredFilePathMap.size >= FILEPATHMAP_IGNORE_WARNING_LIST_LIMIT) {
223
242
  ignoredFilePathMapTruncated = true;
224
243
  continue;
225
244
  } else {
226
- ignoredFilePathMap.add(posixRel);
245
+ ignoredFilePathMap.set(
246
+ posixRel,
247
+ findMatchingIgnoreRule(userIg.ignoreFile, posixRel)
248
+ );
227
249
  continue;
228
250
  }
229
251
  }
@@ -231,8 +253,9 @@ async function buildFileTree(path, {
231
253
  }
232
254
  }
233
255
  if (ignoredFilePathMap.size > 0) {
256
+ const violations = [...ignoredFilePathMap.entries()].sort(([a], [b]) => a.localeCompare(b)).map(([ignoredPath, match]) => ({ path: ignoredPath, ...match }));
234
257
  warning = formatFilePathMapIgnoreWarning(
235
- [...ignoredFilePathMap].sort((a, b) => a.localeCompare(b)),
258
+ violations,
236
259
  userIg?.ignoreFileName || ".vercelignore",
237
260
  ignoredFilePathMapTruncated
238
261
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/client",
3
- "version": "18.4.7",
3
+ "version": "18.5.0",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
6
6
  "homepage": "https://vercel.com",
@@ -37,7 +37,7 @@
37
37
  "querystring": "^0.2.0",
38
38
  "sleep-promise": "8.0.1",
39
39
  "tar-fs": "1.16.3",
40
- "@vercel/build-utils": "14.13.2",
40
+ "@vercel/build-utils": "14.14.0",
41
41
  "@vercel/error-utils": "2.2.1",
42
42
  "@vercel/routing-utils": "6.6.0"
43
43
  },