@netlify/plugin-nextjs 5.10.0 → 5.10.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.
Files changed (43) hide show
  1. package/dist/build/advanced-api-routes.js +136 -4
  2. package/dist/build/cache.js +25 -4
  3. package/dist/build/content/prerendered.js +293 -11
  4. package/dist/build/content/server.js +219 -11
  5. package/dist/build/content/static.js +112 -15
  6. package/dist/build/functions/edge.js +540 -7
  7. package/dist/build/functions/server.js +130 -11
  8. package/dist/build/image-cdn.js +1599 -3
  9. package/dist/build/plugin-context.js +292 -6
  10. package/dist/build/verification.js +104 -9
  11. package/dist/esm-chunks/{package-F536DQ6H.js → package-UN6EVEHD.js} +1 -1
  12. package/dist/index.js +19 -40
  13. package/dist/run/config.js +1 -4
  14. package/dist/run/constants.js +7 -5
  15. package/dist/run/handlers/cache.cjs +44 -1654
  16. package/dist/run/handlers/server.js +14 -33
  17. package/dist/run/handlers/tracer.cjs +2 -114
  18. package/dist/run/handlers/tracing.js +2 -4
  19. package/dist/run/handlers/wait-until.cjs +2 -116
  20. package/dist/run/headers.js +198 -10
  21. package/dist/run/next.cjs +11 -1623
  22. package/dist/run/regional-blob-store.cjs +37 -4
  23. package/dist/run/revalidate.js +24 -3
  24. package/dist/shared/blobkey.js +15 -3
  25. package/package.json +1 -1
  26. package/dist/esm-chunks/chunk-3RQSTU2O.js +0 -554
  27. package/dist/esm-chunks/chunk-72ZI2IVI.js +0 -36
  28. package/dist/esm-chunks/chunk-AMY4NOT5.js +0 -1610
  29. package/dist/esm-chunks/chunk-DLBTTDNJ.js +0 -309
  30. package/dist/esm-chunks/chunk-DLVROEVU.js +0 -144
  31. package/dist/esm-chunks/chunk-GFYWJNQR.js +0 -305
  32. package/dist/esm-chunks/chunk-IJZEDP6B.js +0 -235
  33. package/dist/esm-chunks/chunk-K4RDUZYO.js +0 -609
  34. package/dist/esm-chunks/chunk-SGXRYMYQ.js +0 -127
  35. package/dist/esm-chunks/chunk-TYCYFZ22.js +0 -25
  36. package/dist/esm-chunks/chunk-UYKENJEU.js +0 -19
  37. package/dist/esm-chunks/chunk-VTKZZRGT.js +0 -132
  38. package/dist/esm-chunks/chunk-WHUPSPWV.js +0 -73
  39. package/dist/esm-chunks/chunk-XS27YRA5.js +0 -34
  40. package/dist/esm-chunks/chunk-YMNWVS6T.js +0 -218
  41. package/dist/esm-chunks/chunk-ZENB67PD.js +0 -148
  42. package/dist/esm-chunks/chunk-ZSVHJNNY.js +0 -120
  43. package/dist/esm-chunks/next-7JK63CHT.js +0 -567
@@ -5,9 +5,1605 @@
5
5
  })();
6
6
 
7
7
  import {
8
- setImageConfig
9
- } from "../esm-chunks/chunk-AMY4NOT5.js";
10
- import "../esm-chunks/chunk-OEQOKJGE.js";
8
+ __commonJS,
9
+ __toESM
10
+ } from "../esm-chunks/chunk-OEQOKJGE.js";
11
+
12
+ // node_modules/picomatch/lib/constants.js
13
+ var require_constants = __commonJS({
14
+ "node_modules/picomatch/lib/constants.js"(exports, module) {
15
+ "use strict";
16
+ var WIN_SLASH = "\\\\/";
17
+ var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
18
+ var DOT_LITERAL = "\\.";
19
+ var PLUS_LITERAL = "\\+";
20
+ var QMARK_LITERAL = "\\?";
21
+ var SLASH_LITERAL = "\\/";
22
+ var ONE_CHAR = "(?=.)";
23
+ var QMARK = "[^/]";
24
+ var END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
25
+ var START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
26
+ var DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
27
+ var NO_DOT = `(?!${DOT_LITERAL})`;
28
+ var NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
29
+ var NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
30
+ var NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
31
+ var QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
32
+ var STAR = `${QMARK}*?`;
33
+ var SEP = "/";
34
+ var POSIX_CHARS = {
35
+ DOT_LITERAL,
36
+ PLUS_LITERAL,
37
+ QMARK_LITERAL,
38
+ SLASH_LITERAL,
39
+ ONE_CHAR,
40
+ QMARK,
41
+ END_ANCHOR,
42
+ DOTS_SLASH,
43
+ NO_DOT,
44
+ NO_DOTS,
45
+ NO_DOT_SLASH,
46
+ NO_DOTS_SLASH,
47
+ QMARK_NO_DOT,
48
+ STAR,
49
+ START_ANCHOR,
50
+ SEP
51
+ };
52
+ var WINDOWS_CHARS = {
53
+ ...POSIX_CHARS,
54
+ SLASH_LITERAL: `[${WIN_SLASH}]`,
55
+ QMARK: WIN_NO_SLASH,
56
+ STAR: `${WIN_NO_SLASH}*?`,
57
+ DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
58
+ NO_DOT: `(?!${DOT_LITERAL})`,
59
+ NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
60
+ NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
61
+ NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
62
+ QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
63
+ START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
64
+ END_ANCHOR: `(?:[${WIN_SLASH}]|$)`,
65
+ SEP: "\\"
66
+ };
67
+ var POSIX_REGEX_SOURCE = {
68
+ alnum: "a-zA-Z0-9",
69
+ alpha: "a-zA-Z",
70
+ ascii: "\\x00-\\x7F",
71
+ blank: " \\t",
72
+ cntrl: "\\x00-\\x1F\\x7F",
73
+ digit: "0-9",
74
+ graph: "\\x21-\\x7E",
75
+ lower: "a-z",
76
+ print: "\\x20-\\x7E ",
77
+ punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
78
+ space: " \\t\\r\\n\\v\\f",
79
+ upper: "A-Z",
80
+ word: "A-Za-z0-9_",
81
+ xdigit: "A-Fa-f0-9"
82
+ };
83
+ module.exports = {
84
+ MAX_LENGTH: 1024 * 64,
85
+ POSIX_REGEX_SOURCE,
86
+ // regular expressions
87
+ REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
88
+ REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
89
+ REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
90
+ REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
91
+ REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
92
+ REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
93
+ // Replace globs with equivalent patterns to reduce parsing time.
94
+ REPLACEMENTS: {
95
+ "***": "*",
96
+ "**/**": "**",
97
+ "**/**/**": "**"
98
+ },
99
+ // Digits
100
+ CHAR_0: 48,
101
+ /* 0 */
102
+ CHAR_9: 57,
103
+ /* 9 */
104
+ // Alphabet chars.
105
+ CHAR_UPPERCASE_A: 65,
106
+ /* A */
107
+ CHAR_LOWERCASE_A: 97,
108
+ /* a */
109
+ CHAR_UPPERCASE_Z: 90,
110
+ /* Z */
111
+ CHAR_LOWERCASE_Z: 122,
112
+ /* z */
113
+ CHAR_LEFT_PARENTHESES: 40,
114
+ /* ( */
115
+ CHAR_RIGHT_PARENTHESES: 41,
116
+ /* ) */
117
+ CHAR_ASTERISK: 42,
118
+ /* * */
119
+ // Non-alphabetic chars.
120
+ CHAR_AMPERSAND: 38,
121
+ /* & */
122
+ CHAR_AT: 64,
123
+ /* @ */
124
+ CHAR_BACKWARD_SLASH: 92,
125
+ /* \ */
126
+ CHAR_CARRIAGE_RETURN: 13,
127
+ /* \r */
128
+ CHAR_CIRCUMFLEX_ACCENT: 94,
129
+ /* ^ */
130
+ CHAR_COLON: 58,
131
+ /* : */
132
+ CHAR_COMMA: 44,
133
+ /* , */
134
+ CHAR_DOT: 46,
135
+ /* . */
136
+ CHAR_DOUBLE_QUOTE: 34,
137
+ /* " */
138
+ CHAR_EQUAL: 61,
139
+ /* = */
140
+ CHAR_EXCLAMATION_MARK: 33,
141
+ /* ! */
142
+ CHAR_FORM_FEED: 12,
143
+ /* \f */
144
+ CHAR_FORWARD_SLASH: 47,
145
+ /* / */
146
+ CHAR_GRAVE_ACCENT: 96,
147
+ /* ` */
148
+ CHAR_HASH: 35,
149
+ /* # */
150
+ CHAR_HYPHEN_MINUS: 45,
151
+ /* - */
152
+ CHAR_LEFT_ANGLE_BRACKET: 60,
153
+ /* < */
154
+ CHAR_LEFT_CURLY_BRACE: 123,
155
+ /* { */
156
+ CHAR_LEFT_SQUARE_BRACKET: 91,
157
+ /* [ */
158
+ CHAR_LINE_FEED: 10,
159
+ /* \n */
160
+ CHAR_NO_BREAK_SPACE: 160,
161
+ /* \u00A0 */
162
+ CHAR_PERCENT: 37,
163
+ /* % */
164
+ CHAR_PLUS: 43,
165
+ /* + */
166
+ CHAR_QUESTION_MARK: 63,
167
+ /* ? */
168
+ CHAR_RIGHT_ANGLE_BRACKET: 62,
169
+ /* > */
170
+ CHAR_RIGHT_CURLY_BRACE: 125,
171
+ /* } */
172
+ CHAR_RIGHT_SQUARE_BRACKET: 93,
173
+ /* ] */
174
+ CHAR_SEMICOLON: 59,
175
+ /* ; */
176
+ CHAR_SINGLE_QUOTE: 39,
177
+ /* ' */
178
+ CHAR_SPACE: 32,
179
+ /* */
180
+ CHAR_TAB: 9,
181
+ /* \t */
182
+ CHAR_UNDERSCORE: 95,
183
+ /* _ */
184
+ CHAR_VERTICAL_LINE: 124,
185
+ /* | */
186
+ CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
187
+ /* \uFEFF */
188
+ /**
189
+ * Create EXTGLOB_CHARS
190
+ */
191
+ extglobChars(chars) {
192
+ return {
193
+ "!": { type: "negate", open: "(?:(?!(?:", close: `))${chars.STAR})` },
194
+ "?": { type: "qmark", open: "(?:", close: ")?" },
195
+ "+": { type: "plus", open: "(?:", close: ")+" },
196
+ "*": { type: "star", open: "(?:", close: ")*" },
197
+ "@": { type: "at", open: "(?:", close: ")" }
198
+ };
199
+ },
200
+ /**
201
+ * Create GLOB_CHARS
202
+ */
203
+ globChars(win32) {
204
+ return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
205
+ }
206
+ };
207
+ }
208
+ });
209
+
210
+ // node_modules/picomatch/lib/utils.js
211
+ var require_utils = __commonJS({
212
+ "node_modules/picomatch/lib/utils.js"(exports) {
213
+ "use strict";
214
+ var {
215
+ REGEX_BACKSLASH,
216
+ REGEX_REMOVE_BACKSLASH,
217
+ REGEX_SPECIAL_CHARS,
218
+ REGEX_SPECIAL_CHARS_GLOBAL
219
+ } = require_constants();
220
+ exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
221
+ exports.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
222
+ exports.isRegexChar = (str) => str.length === 1 && exports.hasRegexChars(str);
223
+ exports.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
224
+ exports.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
225
+ exports.isWindows = () => {
226
+ if (typeof navigator !== "undefined" && navigator.platform) {
227
+ const platform = navigator.platform.toLowerCase();
228
+ return platform === "win32" || platform === "windows";
229
+ }
230
+ if (typeof process !== "undefined" && process.platform) {
231
+ return process.platform === "win32";
232
+ }
233
+ return false;
234
+ };
235
+ exports.removeBackslashes = (str) => {
236
+ return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
237
+ return match === "\\" ? "" : match;
238
+ });
239
+ };
240
+ exports.escapeLast = (input, char, lastIdx) => {
241
+ const idx = input.lastIndexOf(char, lastIdx);
242
+ if (idx === -1) return input;
243
+ if (input[idx - 1] === "\\") return exports.escapeLast(input, char, idx - 1);
244
+ return `${input.slice(0, idx)}\\${input.slice(idx)}`;
245
+ };
246
+ exports.removePrefix = (input, state = {}) => {
247
+ let output = input;
248
+ if (output.startsWith("./")) {
249
+ output = output.slice(2);
250
+ state.prefix = "./";
251
+ }
252
+ return output;
253
+ };
254
+ exports.wrapOutput = (input, state = {}, options = {}) => {
255
+ const prepend = options.contains ? "" : "^";
256
+ const append = options.contains ? "" : "$";
257
+ let output = `${prepend}(?:${input})${append}`;
258
+ if (state.negated === true) {
259
+ output = `(?:^(?!${output}).*$)`;
260
+ }
261
+ return output;
262
+ };
263
+ exports.basename = (path, { windows } = {}) => {
264
+ const segs = path.split(windows ? /[\\/]/ : "/");
265
+ const last = segs[segs.length - 1];
266
+ if (last === "") {
267
+ return segs[segs.length - 2];
268
+ }
269
+ return last;
270
+ };
271
+ }
272
+ });
273
+
274
+ // node_modules/picomatch/lib/scan.js
275
+ var require_scan = __commonJS({
276
+ "node_modules/picomatch/lib/scan.js"(exports, module) {
277
+ "use strict";
278
+ var utils = require_utils();
279
+ var {
280
+ CHAR_ASTERISK,
281
+ /* * */
282
+ CHAR_AT,
283
+ /* @ */
284
+ CHAR_BACKWARD_SLASH,
285
+ /* \ */
286
+ CHAR_COMMA,
287
+ /* , */
288
+ CHAR_DOT,
289
+ /* . */
290
+ CHAR_EXCLAMATION_MARK,
291
+ /* ! */
292
+ CHAR_FORWARD_SLASH,
293
+ /* / */
294
+ CHAR_LEFT_CURLY_BRACE,
295
+ /* { */
296
+ CHAR_LEFT_PARENTHESES,
297
+ /* ( */
298
+ CHAR_LEFT_SQUARE_BRACKET,
299
+ /* [ */
300
+ CHAR_PLUS,
301
+ /* + */
302
+ CHAR_QUESTION_MARK,
303
+ /* ? */
304
+ CHAR_RIGHT_CURLY_BRACE,
305
+ /* } */
306
+ CHAR_RIGHT_PARENTHESES,
307
+ /* ) */
308
+ CHAR_RIGHT_SQUARE_BRACKET
309
+ /* ] */
310
+ } = require_constants();
311
+ var isPathSeparator = (code) => {
312
+ return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
313
+ };
314
+ var depth = (token) => {
315
+ if (token.isPrefix !== true) {
316
+ token.depth = token.isGlobstar ? Infinity : 1;
317
+ }
318
+ };
319
+ var scan = (input, options) => {
320
+ const opts = options || {};
321
+ const length = input.length - 1;
322
+ const scanToEnd = opts.parts === true || opts.scanToEnd === true;
323
+ const slashes = [];
324
+ const tokens = [];
325
+ const parts = [];
326
+ let str = input;
327
+ let index = -1;
328
+ let start = 0;
329
+ let lastIndex = 0;
330
+ let isBrace = false;
331
+ let isBracket = false;
332
+ let isGlob = false;
333
+ let isExtglob = false;
334
+ let isGlobstar = false;
335
+ let braceEscaped = false;
336
+ let backslashes = false;
337
+ let negated = false;
338
+ let negatedExtglob = false;
339
+ let finished = false;
340
+ let braces = 0;
341
+ let prev;
342
+ let code;
343
+ let token = { value: "", depth: 0, isGlob: false };
344
+ const eos = () => index >= length;
345
+ const peek = () => str.charCodeAt(index + 1);
346
+ const advance = () => {
347
+ prev = code;
348
+ return str.charCodeAt(++index);
349
+ };
350
+ while (index < length) {
351
+ code = advance();
352
+ let next;
353
+ if (code === CHAR_BACKWARD_SLASH) {
354
+ backslashes = token.backslashes = true;
355
+ code = advance();
356
+ if (code === CHAR_LEFT_CURLY_BRACE) {
357
+ braceEscaped = true;
358
+ }
359
+ continue;
360
+ }
361
+ if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
362
+ braces++;
363
+ while (eos() !== true && (code = advance())) {
364
+ if (code === CHAR_BACKWARD_SLASH) {
365
+ backslashes = token.backslashes = true;
366
+ advance();
367
+ continue;
368
+ }
369
+ if (code === CHAR_LEFT_CURLY_BRACE) {
370
+ braces++;
371
+ continue;
372
+ }
373
+ if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
374
+ isBrace = token.isBrace = true;
375
+ isGlob = token.isGlob = true;
376
+ finished = true;
377
+ if (scanToEnd === true) {
378
+ continue;
379
+ }
380
+ break;
381
+ }
382
+ if (braceEscaped !== true && code === CHAR_COMMA) {
383
+ isBrace = token.isBrace = true;
384
+ isGlob = token.isGlob = true;
385
+ finished = true;
386
+ if (scanToEnd === true) {
387
+ continue;
388
+ }
389
+ break;
390
+ }
391
+ if (code === CHAR_RIGHT_CURLY_BRACE) {
392
+ braces--;
393
+ if (braces === 0) {
394
+ braceEscaped = false;
395
+ isBrace = token.isBrace = true;
396
+ finished = true;
397
+ break;
398
+ }
399
+ }
400
+ }
401
+ if (scanToEnd === true) {
402
+ continue;
403
+ }
404
+ break;
405
+ }
406
+ if (code === CHAR_FORWARD_SLASH) {
407
+ slashes.push(index);
408
+ tokens.push(token);
409
+ token = { value: "", depth: 0, isGlob: false };
410
+ if (finished === true) continue;
411
+ if (prev === CHAR_DOT && index === start + 1) {
412
+ start += 2;
413
+ continue;
414
+ }
415
+ lastIndex = index + 1;
416
+ continue;
417
+ }
418
+ if (opts.noext !== true) {
419
+ const isExtglobChar = code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK;
420
+ if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
421
+ isGlob = token.isGlob = true;
422
+ isExtglob = token.isExtglob = true;
423
+ finished = true;
424
+ if (code === CHAR_EXCLAMATION_MARK && index === start) {
425
+ negatedExtglob = true;
426
+ }
427
+ if (scanToEnd === true) {
428
+ while (eos() !== true && (code = advance())) {
429
+ if (code === CHAR_BACKWARD_SLASH) {
430
+ backslashes = token.backslashes = true;
431
+ code = advance();
432
+ continue;
433
+ }
434
+ if (code === CHAR_RIGHT_PARENTHESES) {
435
+ isGlob = token.isGlob = true;
436
+ finished = true;
437
+ break;
438
+ }
439
+ }
440
+ continue;
441
+ }
442
+ break;
443
+ }
444
+ }
445
+ if (code === CHAR_ASTERISK) {
446
+ if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
447
+ isGlob = token.isGlob = true;
448
+ finished = true;
449
+ if (scanToEnd === true) {
450
+ continue;
451
+ }
452
+ break;
453
+ }
454
+ if (code === CHAR_QUESTION_MARK) {
455
+ isGlob = token.isGlob = true;
456
+ finished = true;
457
+ if (scanToEnd === true) {
458
+ continue;
459
+ }
460
+ break;
461
+ }
462
+ if (code === CHAR_LEFT_SQUARE_BRACKET) {
463
+ while (eos() !== true && (next = advance())) {
464
+ if (next === CHAR_BACKWARD_SLASH) {
465
+ backslashes = token.backslashes = true;
466
+ advance();
467
+ continue;
468
+ }
469
+ if (next === CHAR_RIGHT_SQUARE_BRACKET) {
470
+ isBracket = token.isBracket = true;
471
+ isGlob = token.isGlob = true;
472
+ finished = true;
473
+ break;
474
+ }
475
+ }
476
+ if (scanToEnd === true) {
477
+ continue;
478
+ }
479
+ break;
480
+ }
481
+ if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
482
+ negated = token.negated = true;
483
+ start++;
484
+ continue;
485
+ }
486
+ if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
487
+ isGlob = token.isGlob = true;
488
+ if (scanToEnd === true) {
489
+ while (eos() !== true && (code = advance())) {
490
+ if (code === CHAR_LEFT_PARENTHESES) {
491
+ backslashes = token.backslashes = true;
492
+ code = advance();
493
+ continue;
494
+ }
495
+ if (code === CHAR_RIGHT_PARENTHESES) {
496
+ finished = true;
497
+ break;
498
+ }
499
+ }
500
+ continue;
501
+ }
502
+ break;
503
+ }
504
+ if (isGlob === true) {
505
+ finished = true;
506
+ if (scanToEnd === true) {
507
+ continue;
508
+ }
509
+ break;
510
+ }
511
+ }
512
+ if (opts.noext === true) {
513
+ isExtglob = false;
514
+ isGlob = false;
515
+ }
516
+ let base = str;
517
+ let prefix = "";
518
+ let glob = "";
519
+ if (start > 0) {
520
+ prefix = str.slice(0, start);
521
+ str = str.slice(start);
522
+ lastIndex -= start;
523
+ }
524
+ if (base && isGlob === true && lastIndex > 0) {
525
+ base = str.slice(0, lastIndex);
526
+ glob = str.slice(lastIndex);
527
+ } else if (isGlob === true) {
528
+ base = "";
529
+ glob = str;
530
+ } else {
531
+ base = str;
532
+ }
533
+ if (base && base !== "" && base !== "/" && base !== str) {
534
+ if (isPathSeparator(base.charCodeAt(base.length - 1))) {
535
+ base = base.slice(0, -1);
536
+ }
537
+ }
538
+ if (opts.unescape === true) {
539
+ if (glob) glob = utils.removeBackslashes(glob);
540
+ if (base && backslashes === true) {
541
+ base = utils.removeBackslashes(base);
542
+ }
543
+ }
544
+ const state = {
545
+ prefix,
546
+ input,
547
+ start,
548
+ base,
549
+ glob,
550
+ isBrace,
551
+ isBracket,
552
+ isGlob,
553
+ isExtglob,
554
+ isGlobstar,
555
+ negated,
556
+ negatedExtglob
557
+ };
558
+ if (opts.tokens === true) {
559
+ state.maxDepth = 0;
560
+ if (!isPathSeparator(code)) {
561
+ tokens.push(token);
562
+ }
563
+ state.tokens = tokens;
564
+ }
565
+ if (opts.parts === true || opts.tokens === true) {
566
+ let prevIndex;
567
+ for (let idx = 0; idx < slashes.length; idx++) {
568
+ const n = prevIndex ? prevIndex + 1 : start;
569
+ const i = slashes[idx];
570
+ const value = input.slice(n, i);
571
+ if (opts.tokens) {
572
+ if (idx === 0 && start !== 0) {
573
+ tokens[idx].isPrefix = true;
574
+ tokens[idx].value = prefix;
575
+ } else {
576
+ tokens[idx].value = value;
577
+ }
578
+ depth(tokens[idx]);
579
+ state.maxDepth += tokens[idx].depth;
580
+ }
581
+ if (idx !== 0 || value !== "") {
582
+ parts.push(value);
583
+ }
584
+ prevIndex = i;
585
+ }
586
+ if (prevIndex && prevIndex + 1 < input.length) {
587
+ const value = input.slice(prevIndex + 1);
588
+ parts.push(value);
589
+ if (opts.tokens) {
590
+ tokens[tokens.length - 1].value = value;
591
+ depth(tokens[tokens.length - 1]);
592
+ state.maxDepth += tokens[tokens.length - 1].depth;
593
+ }
594
+ }
595
+ state.slashes = slashes;
596
+ state.parts = parts;
597
+ }
598
+ return state;
599
+ };
600
+ module.exports = scan;
601
+ }
602
+ });
603
+
604
+ // node_modules/picomatch/lib/parse.js
605
+ var require_parse = __commonJS({
606
+ "node_modules/picomatch/lib/parse.js"(exports, module) {
607
+ "use strict";
608
+ var constants = require_constants();
609
+ var utils = require_utils();
610
+ var {
611
+ MAX_LENGTH,
612
+ POSIX_REGEX_SOURCE,
613
+ REGEX_NON_SPECIAL_CHARS,
614
+ REGEX_SPECIAL_CHARS_BACKREF,
615
+ REPLACEMENTS
616
+ } = constants;
617
+ var expandRange = (args, options) => {
618
+ if (typeof options.expandRange === "function") {
619
+ return options.expandRange(...args, options);
620
+ }
621
+ args.sort();
622
+ const value = `[${args.join("-")}]`;
623
+ try {
624
+ new RegExp(value);
625
+ } catch (ex) {
626
+ return args.map((v) => utils.escapeRegex(v)).join("..");
627
+ }
628
+ return value;
629
+ };
630
+ var syntaxError = (type, char) => {
631
+ return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
632
+ };
633
+ var parse = (input, options) => {
634
+ if (typeof input !== "string") {
635
+ throw new TypeError("Expected a string");
636
+ }
637
+ input = REPLACEMENTS[input] || input;
638
+ const opts = { ...options };
639
+ const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
640
+ let len = input.length;
641
+ if (len > max) {
642
+ throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
643
+ }
644
+ const bos = { type: "bos", value: "", output: opts.prepend || "" };
645
+ const tokens = [bos];
646
+ const capture = opts.capture ? "" : "?:";
647
+ const PLATFORM_CHARS = constants.globChars(opts.windows);
648
+ const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
649
+ const {
650
+ DOT_LITERAL,
651
+ PLUS_LITERAL,
652
+ SLASH_LITERAL,
653
+ ONE_CHAR,
654
+ DOTS_SLASH,
655
+ NO_DOT,
656
+ NO_DOT_SLASH,
657
+ NO_DOTS_SLASH,
658
+ QMARK,
659
+ QMARK_NO_DOT,
660
+ STAR,
661
+ START_ANCHOR
662
+ } = PLATFORM_CHARS;
663
+ const globstar = (opts2) => {
664
+ return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
665
+ };
666
+ const nodot = opts.dot ? "" : NO_DOT;
667
+ const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
668
+ let star = opts.bash === true ? globstar(opts) : STAR;
669
+ if (opts.capture) {
670
+ star = `(${star})`;
671
+ }
672
+ if (typeof opts.noext === "boolean") {
673
+ opts.noextglob = opts.noext;
674
+ }
675
+ const state = {
676
+ input,
677
+ index: -1,
678
+ start: 0,
679
+ dot: opts.dot === true,
680
+ consumed: "",
681
+ output: "",
682
+ prefix: "",
683
+ backtrack: false,
684
+ negated: false,
685
+ brackets: 0,
686
+ braces: 0,
687
+ parens: 0,
688
+ quotes: 0,
689
+ globstar: false,
690
+ tokens
691
+ };
692
+ input = utils.removePrefix(input, state);
693
+ len = input.length;
694
+ const extglobs = [];
695
+ const braces = [];
696
+ const stack = [];
697
+ let prev = bos;
698
+ let value;
699
+ const eos = () => state.index === len - 1;
700
+ const peek = state.peek = (n = 1) => input[state.index + n];
701
+ const advance = state.advance = () => input[++state.index] || "";
702
+ const remaining = () => input.slice(state.index + 1);
703
+ const consume = (value2 = "", num = 0) => {
704
+ state.consumed += value2;
705
+ state.index += num;
706
+ };
707
+ const append = (token) => {
708
+ state.output += token.output != null ? token.output : token.value;
709
+ consume(token.value);
710
+ };
711
+ const negate = () => {
712
+ let count = 1;
713
+ while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) {
714
+ advance();
715
+ state.start++;
716
+ count++;
717
+ }
718
+ if (count % 2 === 0) {
719
+ return false;
720
+ }
721
+ state.negated = true;
722
+ state.start++;
723
+ return true;
724
+ };
725
+ const increment = (type) => {
726
+ state[type]++;
727
+ stack.push(type);
728
+ };
729
+ const decrement = (type) => {
730
+ state[type]--;
731
+ stack.pop();
732
+ };
733
+ const push = (tok) => {
734
+ if (prev.type === "globstar") {
735
+ const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace");
736
+ const isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren");
737
+ if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob) {
738
+ state.output = state.output.slice(0, -prev.output.length);
739
+ prev.type = "star";
740
+ prev.value = "*";
741
+ prev.output = star;
742
+ state.output += prev.output;
743
+ }
744
+ }
745
+ if (extglobs.length && tok.type !== "paren") {
746
+ extglobs[extglobs.length - 1].inner += tok.value;
747
+ }
748
+ if (tok.value || tok.output) append(tok);
749
+ if (prev && prev.type === "text" && tok.type === "text") {
750
+ prev.output = (prev.output || prev.value) + tok.value;
751
+ prev.value += tok.value;
752
+ return;
753
+ }
754
+ tok.prev = prev;
755
+ tokens.push(tok);
756
+ prev = tok;
757
+ };
758
+ const extglobOpen = (type, value2) => {
759
+ const token = { ...EXTGLOB_CHARS[value2], conditions: 1, inner: "" };
760
+ token.prev = prev;
761
+ token.parens = state.parens;
762
+ token.output = state.output;
763
+ const output = (opts.capture ? "(" : "") + token.open;
764
+ increment("parens");
765
+ push({ type, value: value2, output: state.output ? "" : ONE_CHAR });
766
+ push({ type: "paren", extglob: true, value: advance(), output });
767
+ extglobs.push(token);
768
+ };
769
+ const extglobClose = (token) => {
770
+ let output = token.close + (opts.capture ? ")" : "");
771
+ let rest;
772
+ if (token.type === "negate") {
773
+ let extglobStar = star;
774
+ if (token.inner && token.inner.length > 1 && token.inner.includes("/")) {
775
+ extglobStar = globstar(opts);
776
+ }
777
+ if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
778
+ output = token.close = `)$))${extglobStar}`;
779
+ }
780
+ if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
781
+ const expression = parse(rest, { ...options, fastpaths: false }).output;
782
+ output = token.close = `)${expression})${extglobStar})`;
783
+ }
784
+ if (token.prev.type === "bos") {
785
+ state.negatedExtglob = true;
786
+ }
787
+ }
788
+ push({ type: "paren", extglob: true, value, output });
789
+ decrement("parens");
790
+ };
791
+ if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
792
+ let backslashes = false;
793
+ let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
794
+ if (first === "\\") {
795
+ backslashes = true;
796
+ return m;
797
+ }
798
+ if (first === "?") {
799
+ if (esc) {
800
+ return esc + first + (rest ? QMARK.repeat(rest.length) : "");
801
+ }
802
+ if (index === 0) {
803
+ return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : "");
804
+ }
805
+ return QMARK.repeat(chars.length);
806
+ }
807
+ if (first === ".") {
808
+ return DOT_LITERAL.repeat(chars.length);
809
+ }
810
+ if (first === "*") {
811
+ if (esc) {
812
+ return esc + first + (rest ? star : "");
813
+ }
814
+ return star;
815
+ }
816
+ return esc ? m : `\\${m}`;
817
+ });
818
+ if (backslashes === true) {
819
+ if (opts.unescape === true) {
820
+ output = output.replace(/\\/g, "");
821
+ } else {
822
+ output = output.replace(/\\+/g, (m) => {
823
+ return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
824
+ });
825
+ }
826
+ }
827
+ if (output === input && opts.contains === true) {
828
+ state.output = input;
829
+ return state;
830
+ }
831
+ state.output = utils.wrapOutput(output, state, options);
832
+ return state;
833
+ }
834
+ while (!eos()) {
835
+ value = advance();
836
+ if (value === "\0") {
837
+ continue;
838
+ }
839
+ if (value === "\\") {
840
+ const next = peek();
841
+ if (next === "/" && opts.bash !== true) {
842
+ continue;
843
+ }
844
+ if (next === "." || next === ";") {
845
+ continue;
846
+ }
847
+ if (!next) {
848
+ value += "\\";
849
+ push({ type: "text", value });
850
+ continue;
851
+ }
852
+ const match = /^\\+/.exec(remaining());
853
+ let slashes = 0;
854
+ if (match && match[0].length > 2) {
855
+ slashes = match[0].length;
856
+ state.index += slashes;
857
+ if (slashes % 2 !== 0) {
858
+ value += "\\";
859
+ }
860
+ }
861
+ if (opts.unescape === true) {
862
+ value = advance();
863
+ } else {
864
+ value += advance();
865
+ }
866
+ if (state.brackets === 0) {
867
+ push({ type: "text", value });
868
+ continue;
869
+ }
870
+ }
871
+ if (state.brackets > 0 && (value !== "]" || prev.value === "[" || prev.value === "[^")) {
872
+ if (opts.posix !== false && value === ":") {
873
+ const inner = prev.value.slice(1);
874
+ if (inner.includes("[")) {
875
+ prev.posix = true;
876
+ if (inner.includes(":")) {
877
+ const idx = prev.value.lastIndexOf("[");
878
+ const pre = prev.value.slice(0, idx);
879
+ const rest2 = prev.value.slice(idx + 2);
880
+ const posix = POSIX_REGEX_SOURCE[rest2];
881
+ if (posix) {
882
+ prev.value = pre + posix;
883
+ state.backtrack = true;
884
+ advance();
885
+ if (!bos.output && tokens.indexOf(prev) === 1) {
886
+ bos.output = ONE_CHAR;
887
+ }
888
+ continue;
889
+ }
890
+ }
891
+ }
892
+ }
893
+ if (value === "[" && peek() !== ":" || value === "-" && peek() === "]") {
894
+ value = `\\${value}`;
895
+ }
896
+ if (value === "]" && (prev.value === "[" || prev.value === "[^")) {
897
+ value = `\\${value}`;
898
+ }
899
+ if (opts.posix === true && value === "!" && prev.value === "[") {
900
+ value = "^";
901
+ }
902
+ prev.value += value;
903
+ append({ value });
904
+ continue;
905
+ }
906
+ if (state.quotes === 1 && value !== '"') {
907
+ value = utils.escapeRegex(value);
908
+ prev.value += value;
909
+ append({ value });
910
+ continue;
911
+ }
912
+ if (value === '"') {
913
+ state.quotes = state.quotes === 1 ? 0 : 1;
914
+ if (opts.keepQuotes === true) {
915
+ push({ type: "text", value });
916
+ }
917
+ continue;
918
+ }
919
+ if (value === "(") {
920
+ increment("parens");
921
+ push({ type: "paren", value });
922
+ continue;
923
+ }
924
+ if (value === ")") {
925
+ if (state.parens === 0 && opts.strictBrackets === true) {
926
+ throw new SyntaxError(syntaxError("opening", "("));
927
+ }
928
+ const extglob = extglobs[extglobs.length - 1];
929
+ if (extglob && state.parens === extglob.parens + 1) {
930
+ extglobClose(extglobs.pop());
931
+ continue;
932
+ }
933
+ push({ type: "paren", value, output: state.parens ? ")" : "\\)" });
934
+ decrement("parens");
935
+ continue;
936
+ }
937
+ if (value === "[") {
938
+ if (opts.nobracket === true || !remaining().includes("]")) {
939
+ if (opts.nobracket !== true && opts.strictBrackets === true) {
940
+ throw new SyntaxError(syntaxError("closing", "]"));
941
+ }
942
+ value = `\\${value}`;
943
+ } else {
944
+ increment("brackets");
945
+ }
946
+ push({ type: "bracket", value });
947
+ continue;
948
+ }
949
+ if (value === "]") {
950
+ if (opts.nobracket === true || prev && prev.type === "bracket" && prev.value.length === 1) {
951
+ push({ type: "text", value, output: `\\${value}` });
952
+ continue;
953
+ }
954
+ if (state.brackets === 0) {
955
+ if (opts.strictBrackets === true) {
956
+ throw new SyntaxError(syntaxError("opening", "["));
957
+ }
958
+ push({ type: "text", value, output: `\\${value}` });
959
+ continue;
960
+ }
961
+ decrement("brackets");
962
+ const prevValue = prev.value.slice(1);
963
+ if (prev.posix !== true && prevValue[0] === "^" && !prevValue.includes("/")) {
964
+ value = `/${value}`;
965
+ }
966
+ prev.value += value;
967
+ append({ value });
968
+ if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) {
969
+ continue;
970
+ }
971
+ const escaped = utils.escapeRegex(prev.value);
972
+ state.output = state.output.slice(0, -prev.value.length);
973
+ if (opts.literalBrackets === true) {
974
+ state.output += escaped;
975
+ prev.value = escaped;
976
+ continue;
977
+ }
978
+ prev.value = `(${capture}${escaped}|${prev.value})`;
979
+ state.output += prev.value;
980
+ continue;
981
+ }
982
+ if (value === "{" && opts.nobrace !== true) {
983
+ increment("braces");
984
+ const open = {
985
+ type: "brace",
986
+ value,
987
+ output: "(",
988
+ outputIndex: state.output.length,
989
+ tokensIndex: state.tokens.length
990
+ };
991
+ braces.push(open);
992
+ push(open);
993
+ continue;
994
+ }
995
+ if (value === "}") {
996
+ const brace = braces[braces.length - 1];
997
+ if (opts.nobrace === true || !brace) {
998
+ push({ type: "text", value, output: value });
999
+ continue;
1000
+ }
1001
+ let output = ")";
1002
+ if (brace.dots === true) {
1003
+ const arr = tokens.slice();
1004
+ const range = [];
1005
+ for (let i = arr.length - 1; i >= 0; i--) {
1006
+ tokens.pop();
1007
+ if (arr[i].type === "brace") {
1008
+ break;
1009
+ }
1010
+ if (arr[i].type !== "dots") {
1011
+ range.unshift(arr[i].value);
1012
+ }
1013
+ }
1014
+ output = expandRange(range, opts);
1015
+ state.backtrack = true;
1016
+ }
1017
+ if (brace.comma !== true && brace.dots !== true) {
1018
+ const out = state.output.slice(0, brace.outputIndex);
1019
+ const toks = state.tokens.slice(brace.tokensIndex);
1020
+ brace.value = brace.output = "\\{";
1021
+ value = output = "\\}";
1022
+ state.output = out;
1023
+ for (const t of toks) {
1024
+ state.output += t.output || t.value;
1025
+ }
1026
+ }
1027
+ push({ type: "brace", value, output });
1028
+ decrement("braces");
1029
+ braces.pop();
1030
+ continue;
1031
+ }
1032
+ if (value === "|") {
1033
+ if (extglobs.length > 0) {
1034
+ extglobs[extglobs.length - 1].conditions++;
1035
+ }
1036
+ push({ type: "text", value });
1037
+ continue;
1038
+ }
1039
+ if (value === ",") {
1040
+ let output = value;
1041
+ const brace = braces[braces.length - 1];
1042
+ if (brace && stack[stack.length - 1] === "braces") {
1043
+ brace.comma = true;
1044
+ output = "|";
1045
+ }
1046
+ push({ type: "comma", value, output });
1047
+ continue;
1048
+ }
1049
+ if (value === "/") {
1050
+ if (prev.type === "dot" && state.index === state.start + 1) {
1051
+ state.start = state.index + 1;
1052
+ state.consumed = "";
1053
+ state.output = "";
1054
+ tokens.pop();
1055
+ prev = bos;
1056
+ continue;
1057
+ }
1058
+ push({ type: "slash", value, output: SLASH_LITERAL });
1059
+ continue;
1060
+ }
1061
+ if (value === ".") {
1062
+ if (state.braces > 0 && prev.type === "dot") {
1063
+ if (prev.value === ".") prev.output = DOT_LITERAL;
1064
+ const brace = braces[braces.length - 1];
1065
+ prev.type = "dots";
1066
+ prev.output += value;
1067
+ prev.value += value;
1068
+ brace.dots = true;
1069
+ continue;
1070
+ }
1071
+ if (state.braces + state.parens === 0 && prev.type !== "bos" && prev.type !== "slash") {
1072
+ push({ type: "text", value, output: DOT_LITERAL });
1073
+ continue;
1074
+ }
1075
+ push({ type: "dot", value, output: DOT_LITERAL });
1076
+ continue;
1077
+ }
1078
+ if (value === "?") {
1079
+ const isGroup = prev && prev.value === "(";
1080
+ if (!isGroup && opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
1081
+ extglobOpen("qmark", value);
1082
+ continue;
1083
+ }
1084
+ if (prev && prev.type === "paren") {
1085
+ const next = peek();
1086
+ let output = value;
1087
+ if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) {
1088
+ output = `\\${value}`;
1089
+ }
1090
+ push({ type: "text", value, output });
1091
+ continue;
1092
+ }
1093
+ if (opts.dot !== true && (prev.type === "slash" || prev.type === "bos")) {
1094
+ push({ type: "qmark", value, output: QMARK_NO_DOT });
1095
+ continue;
1096
+ }
1097
+ push({ type: "qmark", value, output: QMARK });
1098
+ continue;
1099
+ }
1100
+ if (value === "!") {
1101
+ if (opts.noextglob !== true && peek() === "(") {
1102
+ if (peek(2) !== "?" || !/[!=<:]/.test(peek(3))) {
1103
+ extglobOpen("negate", value);
1104
+ continue;
1105
+ }
1106
+ }
1107
+ if (opts.nonegate !== true && state.index === 0) {
1108
+ negate();
1109
+ continue;
1110
+ }
1111
+ }
1112
+ if (value === "+") {
1113
+ if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
1114
+ extglobOpen("plus", value);
1115
+ continue;
1116
+ }
1117
+ if (prev && prev.value === "(" || opts.regex === false) {
1118
+ push({ type: "plus", value, output: PLUS_LITERAL });
1119
+ continue;
1120
+ }
1121
+ if (prev && (prev.type === "bracket" || prev.type === "paren" || prev.type === "brace") || state.parens > 0) {
1122
+ push({ type: "plus", value });
1123
+ continue;
1124
+ }
1125
+ push({ type: "plus", value: PLUS_LITERAL });
1126
+ continue;
1127
+ }
1128
+ if (value === "@") {
1129
+ if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
1130
+ push({ type: "at", extglob: true, value, output: "" });
1131
+ continue;
1132
+ }
1133
+ push({ type: "text", value });
1134
+ continue;
1135
+ }
1136
+ if (value !== "*") {
1137
+ if (value === "$" || value === "^") {
1138
+ value = `\\${value}`;
1139
+ }
1140
+ const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
1141
+ if (match) {
1142
+ value += match[0];
1143
+ state.index += match[0].length;
1144
+ }
1145
+ push({ type: "text", value });
1146
+ continue;
1147
+ }
1148
+ if (prev && (prev.type === "globstar" || prev.star === true)) {
1149
+ prev.type = "star";
1150
+ prev.star = true;
1151
+ prev.value += value;
1152
+ prev.output = star;
1153
+ state.backtrack = true;
1154
+ state.globstar = true;
1155
+ consume(value);
1156
+ continue;
1157
+ }
1158
+ let rest = remaining();
1159
+ if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
1160
+ extglobOpen("star", value);
1161
+ continue;
1162
+ }
1163
+ if (prev.type === "star") {
1164
+ if (opts.noglobstar === true) {
1165
+ consume(value);
1166
+ continue;
1167
+ }
1168
+ const prior = prev.prev;
1169
+ const before = prior.prev;
1170
+ const isStart = prior.type === "slash" || prior.type === "bos";
1171
+ const afterStar = before && (before.type === "star" || before.type === "globstar");
1172
+ if (opts.bash === true && (!isStart || rest[0] && rest[0] !== "/")) {
1173
+ push({ type: "star", value, output: "" });
1174
+ continue;
1175
+ }
1176
+ const isBrace = state.braces > 0 && (prior.type === "comma" || prior.type === "brace");
1177
+ const isExtglob = extglobs.length && (prior.type === "pipe" || prior.type === "paren");
1178
+ if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) {
1179
+ push({ type: "star", value, output: "" });
1180
+ continue;
1181
+ }
1182
+ while (rest.slice(0, 3) === "/**") {
1183
+ const after = input[state.index + 4];
1184
+ if (after && after !== "/") {
1185
+ break;
1186
+ }
1187
+ rest = rest.slice(3);
1188
+ consume("/**", 3);
1189
+ }
1190
+ if (prior.type === "bos" && eos()) {
1191
+ prev.type = "globstar";
1192
+ prev.value += value;
1193
+ prev.output = globstar(opts);
1194
+ state.output = prev.output;
1195
+ state.globstar = true;
1196
+ consume(value);
1197
+ continue;
1198
+ }
1199
+ if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && eos()) {
1200
+ state.output = state.output.slice(0, -(prior.output + prev.output).length);
1201
+ prior.output = `(?:${prior.output}`;
1202
+ prev.type = "globstar";
1203
+ prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)");
1204
+ prev.value += value;
1205
+ state.globstar = true;
1206
+ state.output += prior.output + prev.output;
1207
+ consume(value);
1208
+ continue;
1209
+ }
1210
+ if (prior.type === "slash" && prior.prev.type !== "bos" && rest[0] === "/") {
1211
+ const end = rest[1] !== void 0 ? "|$" : "";
1212
+ state.output = state.output.slice(0, -(prior.output + prev.output).length);
1213
+ prior.output = `(?:${prior.output}`;
1214
+ prev.type = "globstar";
1215
+ prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
1216
+ prev.value += value;
1217
+ state.output += prior.output + prev.output;
1218
+ state.globstar = true;
1219
+ consume(value + advance());
1220
+ push({ type: "slash", value: "/", output: "" });
1221
+ continue;
1222
+ }
1223
+ if (prior.type === "bos" && rest[0] === "/") {
1224
+ prev.type = "globstar";
1225
+ prev.value += value;
1226
+ prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
1227
+ state.output = prev.output;
1228
+ state.globstar = true;
1229
+ consume(value + advance());
1230
+ push({ type: "slash", value: "/", output: "" });
1231
+ continue;
1232
+ }
1233
+ state.output = state.output.slice(0, -prev.output.length);
1234
+ prev.type = "globstar";
1235
+ prev.output = globstar(opts);
1236
+ prev.value += value;
1237
+ state.output += prev.output;
1238
+ state.globstar = true;
1239
+ consume(value);
1240
+ continue;
1241
+ }
1242
+ const token = { type: "star", value, output: star };
1243
+ if (opts.bash === true) {
1244
+ token.output = ".*?";
1245
+ if (prev.type === "bos" || prev.type === "slash") {
1246
+ token.output = nodot + token.output;
1247
+ }
1248
+ push(token);
1249
+ continue;
1250
+ }
1251
+ if (prev && (prev.type === "bracket" || prev.type === "paren") && opts.regex === true) {
1252
+ token.output = value;
1253
+ push(token);
1254
+ continue;
1255
+ }
1256
+ if (state.index === state.start || prev.type === "slash" || prev.type === "dot") {
1257
+ if (prev.type === "dot") {
1258
+ state.output += NO_DOT_SLASH;
1259
+ prev.output += NO_DOT_SLASH;
1260
+ } else if (opts.dot === true) {
1261
+ state.output += NO_DOTS_SLASH;
1262
+ prev.output += NO_DOTS_SLASH;
1263
+ } else {
1264
+ state.output += nodot;
1265
+ prev.output += nodot;
1266
+ }
1267
+ if (peek() !== "*") {
1268
+ state.output += ONE_CHAR;
1269
+ prev.output += ONE_CHAR;
1270
+ }
1271
+ }
1272
+ push(token);
1273
+ }
1274
+ while (state.brackets > 0) {
1275
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "]"));
1276
+ state.output = utils.escapeLast(state.output, "[");
1277
+ decrement("brackets");
1278
+ }
1279
+ while (state.parens > 0) {
1280
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", ")"));
1281
+ state.output = utils.escapeLast(state.output, "(");
1282
+ decrement("parens");
1283
+ }
1284
+ while (state.braces > 0) {
1285
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "}"));
1286
+ state.output = utils.escapeLast(state.output, "{");
1287
+ decrement("braces");
1288
+ }
1289
+ if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) {
1290
+ push({ type: "maybe_slash", value: "", output: `${SLASH_LITERAL}?` });
1291
+ }
1292
+ if (state.backtrack === true) {
1293
+ state.output = "";
1294
+ for (const token of state.tokens) {
1295
+ state.output += token.output != null ? token.output : token.value;
1296
+ if (token.suffix) {
1297
+ state.output += token.suffix;
1298
+ }
1299
+ }
1300
+ }
1301
+ return state;
1302
+ };
1303
+ parse.fastpaths = (input, options) => {
1304
+ const opts = { ...options };
1305
+ const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
1306
+ const len = input.length;
1307
+ if (len > max) {
1308
+ throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
1309
+ }
1310
+ input = REPLACEMENTS[input] || input;
1311
+ const {
1312
+ DOT_LITERAL,
1313
+ SLASH_LITERAL,
1314
+ ONE_CHAR,
1315
+ DOTS_SLASH,
1316
+ NO_DOT,
1317
+ NO_DOTS,
1318
+ NO_DOTS_SLASH,
1319
+ STAR,
1320
+ START_ANCHOR
1321
+ } = constants.globChars(opts.windows);
1322
+ const nodot = opts.dot ? NO_DOTS : NO_DOT;
1323
+ const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
1324
+ const capture = opts.capture ? "" : "?:";
1325
+ const state = { negated: false, prefix: "" };
1326
+ let star = opts.bash === true ? ".*?" : STAR;
1327
+ if (opts.capture) {
1328
+ star = `(${star})`;
1329
+ }
1330
+ const globstar = (opts2) => {
1331
+ if (opts2.noglobstar === true) return star;
1332
+ return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
1333
+ };
1334
+ const create = (str) => {
1335
+ switch (str) {
1336
+ case "*":
1337
+ return `${nodot}${ONE_CHAR}${star}`;
1338
+ case ".*":
1339
+ return `${DOT_LITERAL}${ONE_CHAR}${star}`;
1340
+ case "*.*":
1341
+ return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
1342
+ case "*/*":
1343
+ return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
1344
+ case "**":
1345
+ return nodot + globstar(opts);
1346
+ case "**/*":
1347
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
1348
+ case "**/*.*":
1349
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
1350
+ case "**/.*":
1351
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
1352
+ default: {
1353
+ const match = /^(.*?)\.(\w+)$/.exec(str);
1354
+ if (!match) return;
1355
+ const source2 = create(match[1]);
1356
+ if (!source2) return;
1357
+ return source2 + DOT_LITERAL + match[2];
1358
+ }
1359
+ }
1360
+ };
1361
+ const output = utils.removePrefix(input, state);
1362
+ let source = create(output);
1363
+ if (source && opts.strictSlashes !== true) {
1364
+ source += `${SLASH_LITERAL}?`;
1365
+ }
1366
+ return source;
1367
+ };
1368
+ module.exports = parse;
1369
+ }
1370
+ });
1371
+
1372
+ // node_modules/picomatch/lib/picomatch.js
1373
+ var require_picomatch = __commonJS({
1374
+ "node_modules/picomatch/lib/picomatch.js"(exports, module) {
1375
+ "use strict";
1376
+ var scan = require_scan();
1377
+ var parse = require_parse();
1378
+ var utils = require_utils();
1379
+ var constants = require_constants();
1380
+ var isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
1381
+ var picomatch = (glob, options, returnState = false) => {
1382
+ if (Array.isArray(glob)) {
1383
+ const fns = glob.map((input) => picomatch(input, options, returnState));
1384
+ const arrayMatcher = (str) => {
1385
+ for (const isMatch of fns) {
1386
+ const state2 = isMatch(str);
1387
+ if (state2) return state2;
1388
+ }
1389
+ return false;
1390
+ };
1391
+ return arrayMatcher;
1392
+ }
1393
+ const isState = isObject(glob) && glob.tokens && glob.input;
1394
+ if (glob === "" || typeof glob !== "string" && !isState) {
1395
+ throw new TypeError("Expected pattern to be a non-empty string");
1396
+ }
1397
+ const opts = options || {};
1398
+ const posix = opts.windows;
1399
+ const regex = isState ? picomatch.compileRe(glob, options) : picomatch.makeRe(glob, options, false, true);
1400
+ const state = regex.state;
1401
+ delete regex.state;
1402
+ let isIgnored = () => false;
1403
+ if (opts.ignore) {
1404
+ const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
1405
+ isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
1406
+ }
1407
+ const matcher = (input, returnObject = false) => {
1408
+ const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix });
1409
+ const result = { glob, state, regex, posix, input, output, match, isMatch };
1410
+ if (typeof opts.onResult === "function") {
1411
+ opts.onResult(result);
1412
+ }
1413
+ if (isMatch === false) {
1414
+ result.isMatch = false;
1415
+ return returnObject ? result : false;
1416
+ }
1417
+ if (isIgnored(input)) {
1418
+ if (typeof opts.onIgnore === "function") {
1419
+ opts.onIgnore(result);
1420
+ }
1421
+ result.isMatch = false;
1422
+ return returnObject ? result : false;
1423
+ }
1424
+ if (typeof opts.onMatch === "function") {
1425
+ opts.onMatch(result);
1426
+ }
1427
+ return returnObject ? result : true;
1428
+ };
1429
+ if (returnState) {
1430
+ matcher.state = state;
1431
+ }
1432
+ return matcher;
1433
+ };
1434
+ picomatch.test = (input, regex, options, { glob, posix } = {}) => {
1435
+ if (typeof input !== "string") {
1436
+ throw new TypeError("Expected input to be a string");
1437
+ }
1438
+ if (input === "") {
1439
+ return { isMatch: false, output: "" };
1440
+ }
1441
+ const opts = options || {};
1442
+ const format = opts.format || (posix ? utils.toPosixSlashes : null);
1443
+ let match = input === glob;
1444
+ let output = match && format ? format(input) : input;
1445
+ if (match === false) {
1446
+ output = format ? format(input) : input;
1447
+ match = output === glob;
1448
+ }
1449
+ if (match === false || opts.capture === true) {
1450
+ if (opts.matchBase === true || opts.basename === true) {
1451
+ match = picomatch.matchBase(input, regex, options, posix);
1452
+ } else {
1453
+ match = regex.exec(output);
1454
+ }
1455
+ }
1456
+ return { isMatch: Boolean(match), match, output };
1457
+ };
1458
+ picomatch.matchBase = (input, glob, options) => {
1459
+ const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
1460
+ return regex.test(utils.basename(input));
1461
+ };
1462
+ picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
1463
+ picomatch.parse = (pattern, options) => {
1464
+ if (Array.isArray(pattern)) return pattern.map((p) => picomatch.parse(p, options));
1465
+ return parse(pattern, { ...options, fastpaths: false });
1466
+ };
1467
+ picomatch.scan = (input, options) => scan(input, options);
1468
+ picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
1469
+ if (returnOutput === true) {
1470
+ return state.output;
1471
+ }
1472
+ const opts = options || {};
1473
+ const prepend = opts.contains ? "" : "^";
1474
+ const append = opts.contains ? "" : "$";
1475
+ let source = `${prepend}(?:${state.output})${append}`;
1476
+ if (state && state.negated === true) {
1477
+ source = `^(?!${source}).*$`;
1478
+ }
1479
+ const regex = picomatch.toRegex(source, options);
1480
+ if (returnState === true) {
1481
+ regex.state = state;
1482
+ }
1483
+ return regex;
1484
+ };
1485
+ picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
1486
+ if (!input || typeof input !== "string") {
1487
+ throw new TypeError("Expected a non-empty string");
1488
+ }
1489
+ let parsed = { negated: false, fastpaths: true };
1490
+ if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) {
1491
+ parsed.output = parse.fastpaths(input, options);
1492
+ }
1493
+ if (!parsed.output) {
1494
+ parsed = parse(input, options);
1495
+ }
1496
+ return picomatch.compileRe(parsed, options, returnOutput, returnState);
1497
+ };
1498
+ picomatch.toRegex = (source, options) => {
1499
+ try {
1500
+ const opts = options || {};
1501
+ return new RegExp(source, opts.flags || (opts.nocase ? "i" : ""));
1502
+ } catch (err) {
1503
+ if (options && options.debug === true) throw err;
1504
+ return /$^/;
1505
+ }
1506
+ };
1507
+ picomatch.constants = constants;
1508
+ module.exports = picomatch;
1509
+ }
1510
+ });
1511
+
1512
+ // node_modules/picomatch/index.js
1513
+ var require_picomatch2 = __commonJS({
1514
+ "node_modules/picomatch/index.js"(exports, module) {
1515
+ "use strict";
1516
+ var pico = require_picomatch();
1517
+ var utils = require_utils();
1518
+ function picomatch(glob, options, returnState = false) {
1519
+ if (options && (options.windows === null || options.windows === void 0)) {
1520
+ options = { ...options, windows: utils.isWindows() };
1521
+ }
1522
+ return pico(glob, options, returnState);
1523
+ }
1524
+ Object.assign(picomatch, pico);
1525
+ module.exports = picomatch;
1526
+ }
1527
+ });
1528
+
1529
+ // src/build/image-cdn.ts
1530
+ var import_picomatch = __toESM(require_picomatch2(), 1);
1531
+ function generateRegexFromPattern(pattern) {
1532
+ return (0, import_picomatch.makeRe)(pattern).source;
1533
+ }
1534
+ var setImageConfig = async (ctx) => {
1535
+ const {
1536
+ images: { domains, remotePatterns, path: imageEndpointPath, loader: imageLoader }
1537
+ } = await ctx.buildConfig;
1538
+ if (imageLoader !== "default") {
1539
+ return;
1540
+ }
1541
+ ctx.netlifyConfig.redirects.push(
1542
+ {
1543
+ from: imageEndpointPath,
1544
+ // w and q are too short to be used as params with id-length rule
1545
+ // but we are forced to do so because of the next/image loader decides on their names
1546
+ // eslint-disable-next-line id-length
1547
+ query: { url: ":url", w: ":width", q: ":quality" },
1548
+ to: "/.netlify/images?url=:url&w=:width&q=:quality",
1549
+ status: 200
1550
+ },
1551
+ // when migrating from @netlify/plugin-nextjs@4 image redirect to ipx might be cached in the browser
1552
+ {
1553
+ from: "/_ipx/*",
1554
+ // w and q are too short to be used as params with id-length rule
1555
+ // but we are forced to do so because of the next/image loader decides on their names
1556
+ // eslint-disable-next-line id-length
1557
+ query: { url: ":url", w: ":width", q: ":quality" },
1558
+ to: "/.netlify/images?url=:url&w=:width&q=:quality",
1559
+ status: 200
1560
+ }
1561
+ );
1562
+ if (remotePatterns?.length !== 0 || domains?.length !== 0) {
1563
+ ctx.netlifyConfig.images ||= { remote_images: [] };
1564
+ ctx.netlifyConfig.images.remote_images ||= [];
1565
+ if (remotePatterns && remotePatterns.length !== 0) {
1566
+ for (const remotePattern of remotePatterns) {
1567
+ let { protocol, hostname, port, pathname } = remotePattern;
1568
+ if (pathname) {
1569
+ pathname = pathname.startsWith("/") ? pathname : `/${pathname}`;
1570
+ }
1571
+ const combinedRemotePattern = `${protocol ?? "http?(s)"}://${hostname}${port ? `:${port}` : ""}${pathname ?? "/**"}`;
1572
+ try {
1573
+ ctx.netlifyConfig.images.remote_images.push(
1574
+ generateRegexFromPattern(combinedRemotePattern)
1575
+ );
1576
+ } catch (error) {
1577
+ ctx.failBuild(
1578
+ `Failed to generate Image CDN remote image regex from Next.js remote pattern: ${JSON.stringify(
1579
+ { remotePattern, combinedRemotePattern },
1580
+ null,
1581
+ 2
1582
+ )}`,
1583
+ error
1584
+ );
1585
+ }
1586
+ }
1587
+ }
1588
+ if (domains && domains.length !== 0) {
1589
+ for (const domain of domains) {
1590
+ const patternFromDomain = `http?(s)://${domain}/**`;
1591
+ try {
1592
+ ctx.netlifyConfig.images.remote_images.push(generateRegexFromPattern(patternFromDomain));
1593
+ } catch (error) {
1594
+ ctx.failBuild(
1595
+ `Failed to generate Image CDN remote image regex from Next.js domain: ${JSON.stringify(
1596
+ { domain, patternFromDomain },
1597
+ null,
1598
+ 2
1599
+ )}`,
1600
+ error
1601
+ );
1602
+ }
1603
+ }
1604
+ }
1605
+ }
1606
+ };
11
1607
  export {
12
1608
  setImageConfig
13
1609
  };