@dotenvx/next-env 2.1.1 → 2.2.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.
Files changed (2) hide show
  1. package/dist/index.cjs +1959 -42
  2. package/package.json +2 -2
package/dist/index.cjs CHANGED
@@ -6001,21 +6001,22 @@ var require_dist = __commonJS({
6001
6001
  const opMatch = expression.match(opRegex);
6002
6002
  const splitter = opMatch ? opMatch[0] : null;
6003
6003
  const r = expression.split(splitter);
6004
- let defaultValue;
6005
- let value2;
6006
6004
  const name = r.shift();
6007
- if ([":+", "+"].includes(splitter)) {
6008
- defaultValue = env[name] ? r.join(splitter) : "";
6009
- value2 = null;
6005
+ const rest = r.join(splitter);
6006
+ const hasValue = Object.prototype.hasOwnProperty.call(env, name);
6007
+ let replacementValue;
6008
+ if (splitter === ":-") {
6009
+ replacementValue = env[name] || rest;
6010
+ } else if (splitter === "-") {
6011
+ replacementValue = hasValue ? env[name] : rest;
6012
+ } else if (splitter === ":+") {
6013
+ replacementValue = env[name] ? rest : "";
6014
+ } else if (splitter === "+") {
6015
+ replacementValue = hasValue ? rest : "";
6010
6016
  } else {
6011
- defaultValue = r.join(splitter);
6012
- value2 = env[name];
6013
- }
6014
- if (value2) {
6015
- result = result.replace(template, value2);
6016
- } else {
6017
- result = result.replace(template, defaultValue);
6017
+ replacementValue = env[name] || "";
6018
6018
  }
6019
+ result = result.replace(template, replacementValue);
6019
6020
  if (result === env[name]) {
6020
6021
  break;
6021
6022
  }
@@ -6032,7 +6033,14 @@ var require_dist = __commonJS({
6032
6033
  var require_keypair = __commonJS2({
6033
6034
  "src/keypair.js"(exports22, module22) {
6034
6035
  var { PrivateKey } = require_dist2();
6035
- function keypair2() {
6036
+ var derive2 = require_derive();
6037
+ function keypair2(privateKey) {
6038
+ if (privateKey) {
6039
+ return {
6040
+ publicKey: derive2(privateKey),
6041
+ privateKey
6042
+ };
6043
+ }
6036
6044
  const kp = new PrivateKey();
6037
6045
  return {
6038
6046
  publicKey: kp.publicKey.toHex(),
@@ -6042,8 +6050,1756 @@ var require_dist = __commonJS({
6042
6050
  module22.exports = keypair2;
6043
6051
  }
6044
6052
  });
6053
+ var require_constants = __commonJS2({
6054
+ "node_modules/picomatch/lib/constants.js"(exports22, module22) {
6055
+ "use strict";
6056
+ var WIN_SLASH = "\\\\/";
6057
+ var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
6058
+ var DEFAULT_MAX_EXTGLOB_RECURSION = 0;
6059
+ var DOT_LITERAL = "\\.";
6060
+ var PLUS_LITERAL = "\\+";
6061
+ var QMARK_LITERAL = "\\?";
6062
+ var SLASH_LITERAL = "\\/";
6063
+ var ONE_CHAR = "(?=.)";
6064
+ var QMARK = "[^/]";
6065
+ var END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
6066
+ var START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
6067
+ var DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
6068
+ var NO_DOT = `(?!${DOT_LITERAL})`;
6069
+ var NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
6070
+ var NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
6071
+ var NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
6072
+ var QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
6073
+ var STAR = `${QMARK}*?`;
6074
+ var SEP = "/";
6075
+ var POSIX_CHARS = {
6076
+ DOT_LITERAL,
6077
+ PLUS_LITERAL,
6078
+ QMARK_LITERAL,
6079
+ SLASH_LITERAL,
6080
+ ONE_CHAR,
6081
+ QMARK,
6082
+ END_ANCHOR,
6083
+ DOTS_SLASH,
6084
+ NO_DOT,
6085
+ NO_DOTS,
6086
+ NO_DOT_SLASH,
6087
+ NO_DOTS_SLASH,
6088
+ QMARK_NO_DOT,
6089
+ STAR,
6090
+ START_ANCHOR,
6091
+ SEP
6092
+ };
6093
+ var WINDOWS_CHARS = {
6094
+ ...POSIX_CHARS,
6095
+ SLASH_LITERAL: `[${WIN_SLASH}]`,
6096
+ QMARK: WIN_NO_SLASH,
6097
+ STAR: `${WIN_NO_SLASH}*?`,
6098
+ DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
6099
+ NO_DOT: `(?!${DOT_LITERAL})`,
6100
+ NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
6101
+ NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
6102
+ NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
6103
+ QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
6104
+ START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
6105
+ END_ANCHOR: `(?:[${WIN_SLASH}]|$)`,
6106
+ SEP: "\\"
6107
+ };
6108
+ var POSIX_REGEX_SOURCE = {
6109
+ __proto__: null,
6110
+ alnum: "a-zA-Z0-9",
6111
+ alpha: "a-zA-Z",
6112
+ ascii: "\\x00-\\x7F",
6113
+ blank: " \\t",
6114
+ cntrl: "\\x00-\\x1F\\x7F",
6115
+ digit: "0-9",
6116
+ graph: "\\x21-\\x7E",
6117
+ lower: "a-z",
6118
+ print: "\\x20-\\x7E ",
6119
+ punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
6120
+ space: " \\t\\r\\n\\v\\f",
6121
+ upper: "A-Z",
6122
+ word: "A-Za-z0-9_",
6123
+ xdigit: "A-Fa-f0-9"
6124
+ };
6125
+ module22.exports = {
6126
+ DEFAULT_MAX_EXTGLOB_RECURSION,
6127
+ MAX_LENGTH: 1024 * 64,
6128
+ POSIX_REGEX_SOURCE,
6129
+ // regular expressions
6130
+ REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
6131
+ REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
6132
+ REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
6133
+ REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
6134
+ REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
6135
+ REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
6136
+ // Replace globs with equivalent patterns to reduce parsing time.
6137
+ REPLACEMENTS: {
6138
+ __proto__: null,
6139
+ "***": "*",
6140
+ "**/**": "**",
6141
+ "**/**/**": "**"
6142
+ },
6143
+ // Digits
6144
+ CHAR_0: 48,
6145
+ /* 0 */
6146
+ CHAR_9: 57,
6147
+ /* 9 */
6148
+ // Alphabet chars.
6149
+ CHAR_UPPERCASE_A: 65,
6150
+ /* A */
6151
+ CHAR_LOWERCASE_A: 97,
6152
+ /* a */
6153
+ CHAR_UPPERCASE_Z: 90,
6154
+ /* Z */
6155
+ CHAR_LOWERCASE_Z: 122,
6156
+ /* z */
6157
+ CHAR_LEFT_PARENTHESES: 40,
6158
+ /* ( */
6159
+ CHAR_RIGHT_PARENTHESES: 41,
6160
+ /* ) */
6161
+ CHAR_ASTERISK: 42,
6162
+ /* * */
6163
+ // Non-alphabetic chars.
6164
+ CHAR_AMPERSAND: 38,
6165
+ /* & */
6166
+ CHAR_AT: 64,
6167
+ /* @ */
6168
+ CHAR_BACKWARD_SLASH: 92,
6169
+ /* \ */
6170
+ CHAR_CARRIAGE_RETURN: 13,
6171
+ /* \r */
6172
+ CHAR_CIRCUMFLEX_ACCENT: 94,
6173
+ /* ^ */
6174
+ CHAR_COLON: 58,
6175
+ /* : */
6176
+ CHAR_COMMA: 44,
6177
+ /* , */
6178
+ CHAR_DOT: 46,
6179
+ /* . */
6180
+ CHAR_DOUBLE_QUOTE: 34,
6181
+ /* " */
6182
+ CHAR_EQUAL: 61,
6183
+ /* = */
6184
+ CHAR_EXCLAMATION_MARK: 33,
6185
+ /* ! */
6186
+ CHAR_FORM_FEED: 12,
6187
+ /* \f */
6188
+ CHAR_FORWARD_SLASH: 47,
6189
+ /* / */
6190
+ CHAR_GRAVE_ACCENT: 96,
6191
+ /* ` */
6192
+ CHAR_HASH: 35,
6193
+ /* # */
6194
+ CHAR_HYPHEN_MINUS: 45,
6195
+ /* - */
6196
+ CHAR_LEFT_ANGLE_BRACKET: 60,
6197
+ /* < */
6198
+ CHAR_LEFT_CURLY_BRACE: 123,
6199
+ /* { */
6200
+ CHAR_LEFT_SQUARE_BRACKET: 91,
6201
+ /* [ */
6202
+ CHAR_LINE_FEED: 10,
6203
+ /* \n */
6204
+ CHAR_NO_BREAK_SPACE: 160,
6205
+ /* \u00A0 */
6206
+ CHAR_PERCENT: 37,
6207
+ /* % */
6208
+ CHAR_PLUS: 43,
6209
+ /* + */
6210
+ CHAR_QUESTION_MARK: 63,
6211
+ /* ? */
6212
+ CHAR_RIGHT_ANGLE_BRACKET: 62,
6213
+ /* > */
6214
+ CHAR_RIGHT_CURLY_BRACE: 125,
6215
+ /* } */
6216
+ CHAR_RIGHT_SQUARE_BRACKET: 93,
6217
+ /* ] */
6218
+ CHAR_SEMICOLON: 59,
6219
+ /* ; */
6220
+ CHAR_SINGLE_QUOTE: 39,
6221
+ /* ' */
6222
+ CHAR_SPACE: 32,
6223
+ /* */
6224
+ CHAR_TAB: 9,
6225
+ /* \t */
6226
+ CHAR_UNDERSCORE: 95,
6227
+ /* _ */
6228
+ CHAR_VERTICAL_LINE: 124,
6229
+ /* | */
6230
+ CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
6231
+ /* \uFEFF */
6232
+ /**
6233
+ * Create EXTGLOB_CHARS
6234
+ */
6235
+ extglobChars(chars) {
6236
+ return {
6237
+ "!": { type: "negate", open: "(?:(?!(?:", close: `))${chars.STAR})` },
6238
+ "?": { type: "qmark", open: "(?:", close: ")?" },
6239
+ "+": { type: "plus", open: "(?:", close: ")+" },
6240
+ "*": { type: "star", open: "(?:", close: ")*" },
6241
+ "@": { type: "at", open: "(?:", close: ")" }
6242
+ };
6243
+ },
6244
+ /**
6245
+ * Create GLOB_CHARS
6246
+ */
6247
+ globChars(win32) {
6248
+ return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
6249
+ }
6250
+ };
6251
+ }
6252
+ });
6253
+ var require_utils5 = __commonJS2({
6254
+ "node_modules/picomatch/lib/utils.js"(exports22) {
6255
+ "use strict";
6256
+ var {
6257
+ REGEX_BACKSLASH,
6258
+ REGEX_REMOVE_BACKSLASH,
6259
+ REGEX_SPECIAL_CHARS,
6260
+ REGEX_SPECIAL_CHARS_GLOBAL
6261
+ } = require_constants();
6262
+ exports22.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
6263
+ exports22.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
6264
+ exports22.isRegexChar = (str) => str.length === 1 && exports22.hasRegexChars(str);
6265
+ exports22.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
6266
+ exports22.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
6267
+ exports22.isWindows = () => {
6268
+ if (typeof navigator !== "undefined" && navigator.platform) {
6269
+ const platform = navigator.platform.toLowerCase();
6270
+ return platform === "win32" || platform === "windows";
6271
+ }
6272
+ if (typeof process !== "undefined" && process.platform) {
6273
+ return process.platform === "win32";
6274
+ }
6275
+ return false;
6276
+ };
6277
+ exports22.removeBackslashes = (str) => {
6278
+ return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
6279
+ return match === "\\" ? "" : match;
6280
+ });
6281
+ };
6282
+ exports22.escapeLast = (input, char, lastIdx) => {
6283
+ const idx = input.lastIndexOf(char, lastIdx);
6284
+ if (idx === -1) return input;
6285
+ if (input[idx - 1] === "\\") return exports22.escapeLast(input, char, idx - 1);
6286
+ return `${input.slice(0, idx)}\\${input.slice(idx)}`;
6287
+ };
6288
+ exports22.removePrefix = (input, state = {}) => {
6289
+ let output = input;
6290
+ if (output.startsWith("./")) {
6291
+ output = output.slice(2);
6292
+ state.prefix = "./";
6293
+ }
6294
+ return output;
6295
+ };
6296
+ exports22.wrapOutput = (input, state = {}, options = {}) => {
6297
+ const prepend = options.contains ? "" : "^";
6298
+ const append = options.contains ? "" : "$";
6299
+ let output = `${prepend}(?:${input})${append}`;
6300
+ if (state.negated === true) {
6301
+ output = `(?:^(?!${output}).*$)`;
6302
+ }
6303
+ return output;
6304
+ };
6305
+ exports22.basename = (path2, { windows } = {}) => {
6306
+ const segs = path2.split(windows ? /[\\/]/ : "/");
6307
+ const last = segs[segs.length - 1];
6308
+ if (last === "") {
6309
+ return segs[segs.length - 2];
6310
+ }
6311
+ return last;
6312
+ };
6313
+ }
6314
+ });
6045
6315
  var require_scan = __commonJS2({
6316
+ "node_modules/picomatch/lib/scan.js"(exports22, module22) {
6317
+ "use strict";
6318
+ var utils = require_utils5();
6319
+ var {
6320
+ CHAR_ASTERISK,
6321
+ /* * */
6322
+ CHAR_AT,
6323
+ /* @ */
6324
+ CHAR_BACKWARD_SLASH,
6325
+ /* \ */
6326
+ CHAR_COMMA,
6327
+ /* , */
6328
+ CHAR_DOT,
6329
+ /* . */
6330
+ CHAR_EXCLAMATION_MARK,
6331
+ /* ! */
6332
+ CHAR_FORWARD_SLASH,
6333
+ /* / */
6334
+ CHAR_LEFT_CURLY_BRACE,
6335
+ /* { */
6336
+ CHAR_LEFT_PARENTHESES,
6337
+ /* ( */
6338
+ CHAR_LEFT_SQUARE_BRACKET,
6339
+ /* [ */
6340
+ CHAR_PLUS,
6341
+ /* + */
6342
+ CHAR_QUESTION_MARK,
6343
+ /* ? */
6344
+ CHAR_RIGHT_CURLY_BRACE,
6345
+ /* } */
6346
+ CHAR_RIGHT_PARENTHESES,
6347
+ /* ) */
6348
+ CHAR_RIGHT_SQUARE_BRACKET
6349
+ /* ] */
6350
+ } = require_constants();
6351
+ var isPathSeparator = (code) => {
6352
+ return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
6353
+ };
6354
+ var depth = (token) => {
6355
+ if (token.isPrefix !== true) {
6356
+ token.depth = token.isGlobstar ? Infinity : 1;
6357
+ }
6358
+ };
6359
+ var scan2 = (input, options) => {
6360
+ const opts = options || {};
6361
+ const length = input.length - 1;
6362
+ const scanToEnd = opts.parts === true || opts.scanToEnd === true;
6363
+ const slashes = [];
6364
+ const tokens = [];
6365
+ const parts = [];
6366
+ let str = input;
6367
+ let index = -1;
6368
+ let start = 0;
6369
+ let lastIndex = 0;
6370
+ let isBrace = false;
6371
+ let isBracket = false;
6372
+ let isGlob = false;
6373
+ let isExtglob = false;
6374
+ let isGlobstar = false;
6375
+ let braceEscaped = false;
6376
+ let backslashes = false;
6377
+ let negated = false;
6378
+ let negatedExtglob = false;
6379
+ let finished = false;
6380
+ let braces = 0;
6381
+ let prev;
6382
+ let code;
6383
+ let token = { value: "", depth: 0, isGlob: false };
6384
+ const eos = () => index >= length;
6385
+ const peek = () => str.charCodeAt(index + 1);
6386
+ const advance = () => {
6387
+ prev = code;
6388
+ return str.charCodeAt(++index);
6389
+ };
6390
+ while (index < length) {
6391
+ code = advance();
6392
+ let next;
6393
+ if (code === CHAR_BACKWARD_SLASH) {
6394
+ backslashes = token.backslashes = true;
6395
+ code = advance();
6396
+ if (code === CHAR_LEFT_CURLY_BRACE) {
6397
+ braceEscaped = true;
6398
+ }
6399
+ continue;
6400
+ }
6401
+ if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
6402
+ braces++;
6403
+ while (eos() !== true && (code = advance())) {
6404
+ if (code === CHAR_BACKWARD_SLASH) {
6405
+ backslashes = token.backslashes = true;
6406
+ advance();
6407
+ continue;
6408
+ }
6409
+ if (code === CHAR_LEFT_CURLY_BRACE) {
6410
+ braces++;
6411
+ continue;
6412
+ }
6413
+ if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
6414
+ isBrace = token.isBrace = true;
6415
+ isGlob = token.isGlob = true;
6416
+ finished = true;
6417
+ if (scanToEnd === true) {
6418
+ continue;
6419
+ }
6420
+ break;
6421
+ }
6422
+ if (braceEscaped !== true && code === CHAR_COMMA) {
6423
+ isBrace = token.isBrace = true;
6424
+ isGlob = token.isGlob = true;
6425
+ finished = true;
6426
+ if (scanToEnd === true) {
6427
+ continue;
6428
+ }
6429
+ break;
6430
+ }
6431
+ if (code === CHAR_RIGHT_CURLY_BRACE) {
6432
+ braces--;
6433
+ if (braces === 0) {
6434
+ braceEscaped = false;
6435
+ isBrace = token.isBrace = true;
6436
+ finished = true;
6437
+ break;
6438
+ }
6439
+ }
6440
+ }
6441
+ if (scanToEnd === true) {
6442
+ continue;
6443
+ }
6444
+ break;
6445
+ }
6446
+ if (code === CHAR_FORWARD_SLASH) {
6447
+ slashes.push(index);
6448
+ tokens.push(token);
6449
+ token = { value: "", depth: 0, isGlob: false };
6450
+ if (finished === true) continue;
6451
+ if (prev === CHAR_DOT && index === start + 1) {
6452
+ start += 2;
6453
+ continue;
6454
+ }
6455
+ lastIndex = index + 1;
6456
+ continue;
6457
+ }
6458
+ if (opts.noext !== true) {
6459
+ const isExtglobChar = code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK;
6460
+ if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
6461
+ isGlob = token.isGlob = true;
6462
+ isExtglob = token.isExtglob = true;
6463
+ finished = true;
6464
+ if (code === CHAR_EXCLAMATION_MARK && index === start) {
6465
+ negatedExtglob = true;
6466
+ }
6467
+ if (scanToEnd === true) {
6468
+ while (eos() !== true && (code = advance())) {
6469
+ if (code === CHAR_BACKWARD_SLASH) {
6470
+ backslashes = token.backslashes = true;
6471
+ code = advance();
6472
+ continue;
6473
+ }
6474
+ if (code === CHAR_RIGHT_PARENTHESES) {
6475
+ isGlob = token.isGlob = true;
6476
+ finished = true;
6477
+ break;
6478
+ }
6479
+ }
6480
+ continue;
6481
+ }
6482
+ break;
6483
+ }
6484
+ }
6485
+ if (code === CHAR_ASTERISK) {
6486
+ if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
6487
+ isGlob = token.isGlob = true;
6488
+ finished = true;
6489
+ if (scanToEnd === true) {
6490
+ continue;
6491
+ }
6492
+ break;
6493
+ }
6494
+ if (code === CHAR_QUESTION_MARK) {
6495
+ isGlob = token.isGlob = true;
6496
+ finished = true;
6497
+ if (scanToEnd === true) {
6498
+ continue;
6499
+ }
6500
+ break;
6501
+ }
6502
+ if (code === CHAR_LEFT_SQUARE_BRACKET) {
6503
+ while (eos() !== true && (next = advance())) {
6504
+ if (next === CHAR_BACKWARD_SLASH) {
6505
+ backslashes = token.backslashes = true;
6506
+ advance();
6507
+ continue;
6508
+ }
6509
+ if (next === CHAR_RIGHT_SQUARE_BRACKET) {
6510
+ isBracket = token.isBracket = true;
6511
+ isGlob = token.isGlob = true;
6512
+ finished = true;
6513
+ break;
6514
+ }
6515
+ }
6516
+ if (scanToEnd === true) {
6517
+ continue;
6518
+ }
6519
+ break;
6520
+ }
6521
+ if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
6522
+ negated = token.negated = true;
6523
+ start++;
6524
+ continue;
6525
+ }
6526
+ if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
6527
+ isGlob = token.isGlob = true;
6528
+ if (scanToEnd === true) {
6529
+ while (eos() !== true && (code = advance())) {
6530
+ if (code === CHAR_LEFT_PARENTHESES) {
6531
+ backslashes = token.backslashes = true;
6532
+ code = advance();
6533
+ continue;
6534
+ }
6535
+ if (code === CHAR_RIGHT_PARENTHESES) {
6536
+ finished = true;
6537
+ break;
6538
+ }
6539
+ }
6540
+ continue;
6541
+ }
6542
+ break;
6543
+ }
6544
+ if (isGlob === true) {
6545
+ finished = true;
6546
+ if (scanToEnd === true) {
6547
+ continue;
6548
+ }
6549
+ break;
6550
+ }
6551
+ }
6552
+ if (opts.noext === true) {
6553
+ isExtglob = false;
6554
+ isGlob = false;
6555
+ }
6556
+ let base = str;
6557
+ let prefix = "";
6558
+ let glob = "";
6559
+ if (start > 0) {
6560
+ prefix = str.slice(0, start);
6561
+ str = str.slice(start);
6562
+ lastIndex -= start;
6563
+ }
6564
+ if (base && isGlob === true && lastIndex > 0) {
6565
+ base = str.slice(0, lastIndex);
6566
+ glob = str.slice(lastIndex);
6567
+ } else if (isGlob === true) {
6568
+ base = "";
6569
+ glob = str;
6570
+ } else {
6571
+ base = str;
6572
+ }
6573
+ if (base && base !== "" && base !== "/" && base !== str) {
6574
+ if (isPathSeparator(base.charCodeAt(base.length - 1))) {
6575
+ base = base.slice(0, -1);
6576
+ }
6577
+ }
6578
+ if (opts.unescape === true) {
6579
+ if (glob) glob = utils.removeBackslashes(glob);
6580
+ if (base && backslashes === true) {
6581
+ base = utils.removeBackslashes(base);
6582
+ }
6583
+ }
6584
+ const state = {
6585
+ prefix,
6586
+ input,
6587
+ start,
6588
+ base,
6589
+ glob,
6590
+ isBrace,
6591
+ isBracket,
6592
+ isGlob,
6593
+ isExtglob,
6594
+ isGlobstar,
6595
+ negated,
6596
+ negatedExtglob
6597
+ };
6598
+ if (opts.tokens === true) {
6599
+ state.maxDepth = 0;
6600
+ if (!isPathSeparator(code)) {
6601
+ tokens.push(token);
6602
+ }
6603
+ state.tokens = tokens;
6604
+ }
6605
+ if (opts.parts === true || opts.tokens === true) {
6606
+ let prevIndex;
6607
+ for (let idx = 0; idx < slashes.length; idx++) {
6608
+ const n = prevIndex ? prevIndex + 1 : start;
6609
+ const i = slashes[idx];
6610
+ const value = input.slice(n, i);
6611
+ if (opts.tokens) {
6612
+ if (idx === 0 && start !== 0) {
6613
+ tokens[idx].isPrefix = true;
6614
+ tokens[idx].value = prefix;
6615
+ } else {
6616
+ tokens[idx].value = value;
6617
+ }
6618
+ depth(tokens[idx]);
6619
+ state.maxDepth += tokens[idx].depth;
6620
+ }
6621
+ if (idx !== 0 || value !== "") {
6622
+ parts.push(value);
6623
+ }
6624
+ prevIndex = i;
6625
+ }
6626
+ if (prevIndex && prevIndex + 1 < input.length) {
6627
+ const value = input.slice(prevIndex + 1);
6628
+ parts.push(value);
6629
+ if (opts.tokens) {
6630
+ tokens[tokens.length - 1].value = value;
6631
+ depth(tokens[tokens.length - 1]);
6632
+ state.maxDepth += tokens[tokens.length - 1].depth;
6633
+ }
6634
+ }
6635
+ state.slashes = slashes;
6636
+ state.parts = parts;
6637
+ }
6638
+ return state;
6639
+ };
6640
+ module22.exports = scan2;
6641
+ }
6642
+ });
6643
+ var require_parse = __commonJS2({
6644
+ "node_modules/picomatch/lib/parse.js"(exports22, module22) {
6645
+ "use strict";
6646
+ var constants = require_constants();
6647
+ var utils = require_utils5();
6648
+ var {
6649
+ MAX_LENGTH,
6650
+ POSIX_REGEX_SOURCE,
6651
+ REGEX_NON_SPECIAL_CHARS,
6652
+ REGEX_SPECIAL_CHARS_BACKREF,
6653
+ REPLACEMENTS
6654
+ } = constants;
6655
+ var expandRange = (args, options) => {
6656
+ if (typeof options.expandRange === "function") {
6657
+ return options.expandRange(...args, options);
6658
+ }
6659
+ args.sort();
6660
+ const value = `[${args.join("-")}]`;
6661
+ try {
6662
+ new RegExp(value);
6663
+ } catch (ex) {
6664
+ return args.map((v) => utils.escapeRegex(v)).join("..");
6665
+ }
6666
+ return value;
6667
+ };
6668
+ var syntaxError = (type, char) => {
6669
+ return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
6670
+ };
6671
+ var splitTopLevel = (input) => {
6672
+ const parts = [];
6673
+ let bracket = 0;
6674
+ let paren = 0;
6675
+ let quote = 0;
6676
+ let value = "";
6677
+ let escaped = false;
6678
+ for (const ch of input) {
6679
+ if (escaped === true) {
6680
+ value += ch;
6681
+ escaped = false;
6682
+ continue;
6683
+ }
6684
+ if (ch === "\\") {
6685
+ value += ch;
6686
+ escaped = true;
6687
+ continue;
6688
+ }
6689
+ if (ch === '"') {
6690
+ quote = quote === 1 ? 0 : 1;
6691
+ value += ch;
6692
+ continue;
6693
+ }
6694
+ if (quote === 0) {
6695
+ if (ch === "[") {
6696
+ bracket++;
6697
+ } else if (ch === "]" && bracket > 0) {
6698
+ bracket--;
6699
+ } else if (bracket === 0) {
6700
+ if (ch === "(") {
6701
+ paren++;
6702
+ } else if (ch === ")" && paren > 0) {
6703
+ paren--;
6704
+ } else if (ch === "|" && paren === 0) {
6705
+ parts.push(value);
6706
+ value = "";
6707
+ continue;
6708
+ }
6709
+ }
6710
+ }
6711
+ value += ch;
6712
+ }
6713
+ parts.push(value);
6714
+ return parts;
6715
+ };
6716
+ var isPlainBranch = (branch) => {
6717
+ let escaped = false;
6718
+ for (const ch of branch) {
6719
+ if (escaped === true) {
6720
+ escaped = false;
6721
+ continue;
6722
+ }
6723
+ if (ch === "\\") {
6724
+ escaped = true;
6725
+ continue;
6726
+ }
6727
+ if (/[?*+@!()[\]{}]/.test(ch)) {
6728
+ return false;
6729
+ }
6730
+ }
6731
+ return true;
6732
+ };
6733
+ var normalizeSimpleBranch = (branch) => {
6734
+ let value = branch.trim();
6735
+ let changed = true;
6736
+ while (changed === true) {
6737
+ changed = false;
6738
+ if (/^@\([^\\()[\]{}|]+\)$/.test(value)) {
6739
+ value = value.slice(2, -1);
6740
+ changed = true;
6741
+ }
6742
+ }
6743
+ if (!isPlainBranch(value)) {
6744
+ return;
6745
+ }
6746
+ return value.replace(/\\(.)/g, "$1");
6747
+ };
6748
+ var hasRepeatedCharPrefixOverlap = (branches) => {
6749
+ const values = branches.map(normalizeSimpleBranch).filter(Boolean);
6750
+ for (let i = 0; i < values.length; i++) {
6751
+ for (let j = i + 1; j < values.length; j++) {
6752
+ const a = values[i];
6753
+ const b = values[j];
6754
+ const char = a[0];
6755
+ if (!char || a !== char.repeat(a.length) || b !== char.repeat(b.length)) {
6756
+ continue;
6757
+ }
6758
+ if (a === b || a.startsWith(b) || b.startsWith(a)) {
6759
+ return true;
6760
+ }
6761
+ }
6762
+ }
6763
+ return false;
6764
+ };
6765
+ var parseRepeatedExtglob = (pattern, requireEnd = true) => {
6766
+ if (pattern[0] !== "+" && pattern[0] !== "*" || pattern[1] !== "(") {
6767
+ return;
6768
+ }
6769
+ let bracket = 0;
6770
+ let paren = 0;
6771
+ let quote = 0;
6772
+ let escaped = false;
6773
+ for (let i = 1; i < pattern.length; i++) {
6774
+ const ch = pattern[i];
6775
+ if (escaped === true) {
6776
+ escaped = false;
6777
+ continue;
6778
+ }
6779
+ if (ch === "\\") {
6780
+ escaped = true;
6781
+ continue;
6782
+ }
6783
+ if (ch === '"') {
6784
+ quote = quote === 1 ? 0 : 1;
6785
+ continue;
6786
+ }
6787
+ if (quote === 1) {
6788
+ continue;
6789
+ }
6790
+ if (ch === "[") {
6791
+ bracket++;
6792
+ continue;
6793
+ }
6794
+ if (ch === "]" && bracket > 0) {
6795
+ bracket--;
6796
+ continue;
6797
+ }
6798
+ if (bracket > 0) {
6799
+ continue;
6800
+ }
6801
+ if (ch === "(") {
6802
+ paren++;
6803
+ continue;
6804
+ }
6805
+ if (ch === ")") {
6806
+ paren--;
6807
+ if (paren === 0) {
6808
+ if (requireEnd === true && i !== pattern.length - 1) {
6809
+ return;
6810
+ }
6811
+ return {
6812
+ type: pattern[0],
6813
+ body: pattern.slice(2, i),
6814
+ end: i
6815
+ };
6816
+ }
6817
+ }
6818
+ }
6819
+ };
6820
+ var getStarExtglobSequenceOutput = (pattern) => {
6821
+ let index = 0;
6822
+ const chars = [];
6823
+ while (index < pattern.length) {
6824
+ const match = parseRepeatedExtglob(pattern.slice(index), false);
6825
+ if (!match || match.type !== "*") {
6826
+ return;
6827
+ }
6828
+ const branches = splitTopLevel(match.body).map((branch2) => branch2.trim());
6829
+ if (branches.length !== 1) {
6830
+ return;
6831
+ }
6832
+ const branch = normalizeSimpleBranch(branches[0]);
6833
+ if (!branch || branch.length !== 1) {
6834
+ return;
6835
+ }
6836
+ chars.push(branch);
6837
+ index += match.end + 1;
6838
+ }
6839
+ if (chars.length < 1) {
6840
+ return;
6841
+ }
6842
+ const source = chars.length === 1 ? utils.escapeRegex(chars[0]) : `[${chars.map((ch) => utils.escapeRegex(ch)).join("")}]`;
6843
+ return `${source}*`;
6844
+ };
6845
+ var repeatedExtglobRecursion = (pattern) => {
6846
+ let depth = 0;
6847
+ let value = pattern.trim();
6848
+ let match = parseRepeatedExtglob(value);
6849
+ while (match) {
6850
+ depth++;
6851
+ value = match.body.trim();
6852
+ match = parseRepeatedExtglob(value);
6853
+ }
6854
+ return depth;
6855
+ };
6856
+ var analyzeRepeatedExtglob = (body, options) => {
6857
+ if (options.maxExtglobRecursion === false) {
6858
+ return { risky: false };
6859
+ }
6860
+ const max = typeof options.maxExtglobRecursion === "number" ? options.maxExtglobRecursion : constants.DEFAULT_MAX_EXTGLOB_RECURSION;
6861
+ const branches = splitTopLevel(body).map((branch) => branch.trim());
6862
+ if (branches.length > 1) {
6863
+ if (branches.some((branch) => branch === "") || branches.some((branch) => /^[*?]+$/.test(branch)) || hasRepeatedCharPrefixOverlap(branches)) {
6864
+ return { risky: true };
6865
+ }
6866
+ }
6867
+ for (const branch of branches) {
6868
+ const safeOutput = getStarExtglobSequenceOutput(branch);
6869
+ if (safeOutput) {
6870
+ return { risky: true, safeOutput };
6871
+ }
6872
+ if (repeatedExtglobRecursion(branch) > max) {
6873
+ return { risky: true };
6874
+ }
6875
+ }
6876
+ return { risky: false };
6877
+ };
6878
+ var parse2 = (input, options) => {
6879
+ if (typeof input !== "string") {
6880
+ throw new TypeError("Expected a string");
6881
+ }
6882
+ input = REPLACEMENTS[input] || input;
6883
+ const opts = { ...options };
6884
+ const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
6885
+ let len = input.length;
6886
+ if (len > max) {
6887
+ throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
6888
+ }
6889
+ const bos = { type: "bos", value: "", output: opts.prepend || "" };
6890
+ const tokens = [bos];
6891
+ const capture = opts.capture ? "" : "?:";
6892
+ const PLATFORM_CHARS = constants.globChars(opts.windows);
6893
+ const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
6894
+ const {
6895
+ DOT_LITERAL,
6896
+ PLUS_LITERAL,
6897
+ SLASH_LITERAL,
6898
+ ONE_CHAR,
6899
+ DOTS_SLASH,
6900
+ NO_DOT,
6901
+ NO_DOT_SLASH,
6902
+ NO_DOTS_SLASH,
6903
+ QMARK,
6904
+ QMARK_NO_DOT,
6905
+ STAR,
6906
+ START_ANCHOR
6907
+ } = PLATFORM_CHARS;
6908
+ const globstar = (opts2) => {
6909
+ return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
6910
+ };
6911
+ const nodot = opts.dot ? "" : NO_DOT;
6912
+ const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
6913
+ let star = opts.bash === true ? globstar(opts) : STAR;
6914
+ if (opts.capture) {
6915
+ star = `(${star})`;
6916
+ }
6917
+ if (typeof opts.noext === "boolean") {
6918
+ opts.noextglob = opts.noext;
6919
+ }
6920
+ const state = {
6921
+ input,
6922
+ index: -1,
6923
+ start: 0,
6924
+ dot: opts.dot === true,
6925
+ consumed: "",
6926
+ output: "",
6927
+ prefix: "",
6928
+ backtrack: false,
6929
+ negated: false,
6930
+ brackets: 0,
6931
+ braces: 0,
6932
+ parens: 0,
6933
+ quotes: 0,
6934
+ globstar: false,
6935
+ tokens
6936
+ };
6937
+ input = utils.removePrefix(input, state);
6938
+ len = input.length;
6939
+ const extglobs = [];
6940
+ const braces = [];
6941
+ const stack = [];
6942
+ let prev = bos;
6943
+ let value;
6944
+ const eos = () => state.index === len - 1;
6945
+ const peek = state.peek = (n = 1) => input[state.index + n];
6946
+ const advance = state.advance = () => input[++state.index] || "";
6947
+ const remaining = () => input.slice(state.index + 1);
6948
+ const consume = (value2 = "", num = 0) => {
6949
+ state.consumed += value2;
6950
+ state.index += num;
6951
+ };
6952
+ const append = (token) => {
6953
+ state.output += token.output != null ? token.output : token.value;
6954
+ consume(token.value);
6955
+ };
6956
+ const negate = () => {
6957
+ let count = 1;
6958
+ while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) {
6959
+ advance();
6960
+ state.start++;
6961
+ count++;
6962
+ }
6963
+ if (count % 2 === 0) {
6964
+ return false;
6965
+ }
6966
+ state.negated = true;
6967
+ state.start++;
6968
+ return true;
6969
+ };
6970
+ const increment = (type) => {
6971
+ state[type]++;
6972
+ stack.push(type);
6973
+ };
6974
+ const decrement = (type) => {
6975
+ state[type]--;
6976
+ stack.pop();
6977
+ };
6978
+ const push = (tok) => {
6979
+ if (prev.type === "globstar") {
6980
+ const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace");
6981
+ const isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren");
6982
+ if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob) {
6983
+ state.output = state.output.slice(0, -prev.output.length);
6984
+ prev.type = "star";
6985
+ prev.value = "*";
6986
+ prev.output = star;
6987
+ state.output += prev.output;
6988
+ }
6989
+ }
6990
+ if (extglobs.length && tok.type !== "paren") {
6991
+ extglobs[extglobs.length - 1].inner += tok.value;
6992
+ }
6993
+ if (tok.value || tok.output) append(tok);
6994
+ if (prev && prev.type === "text" && tok.type === "text") {
6995
+ prev.output = (prev.output || prev.value) + tok.value;
6996
+ prev.value += tok.value;
6997
+ return;
6998
+ }
6999
+ tok.prev = prev;
7000
+ tokens.push(tok);
7001
+ prev = tok;
7002
+ };
7003
+ const extglobOpen = (type, value2) => {
7004
+ const token = { ...EXTGLOB_CHARS[value2], conditions: 1, inner: "" };
7005
+ token.prev = prev;
7006
+ token.parens = state.parens;
7007
+ token.output = state.output;
7008
+ token.startIndex = state.index;
7009
+ token.tokensIndex = tokens.length;
7010
+ const output = (opts.capture ? "(" : "") + token.open;
7011
+ increment("parens");
7012
+ push({ type, value: value2, output: state.output ? "" : ONE_CHAR });
7013
+ push({ type: "paren", extglob: true, value: advance(), output });
7014
+ extglobs.push(token);
7015
+ };
7016
+ const extglobClose = (token) => {
7017
+ const literal = input.slice(token.startIndex, state.index + 1);
7018
+ const body = input.slice(token.startIndex + 2, state.index);
7019
+ const analysis = analyzeRepeatedExtglob(body, opts);
7020
+ if ((token.type === "plus" || token.type === "star") && analysis.risky) {
7021
+ const safeOutput = analysis.safeOutput ? (token.output ? "" : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput) : void 0;
7022
+ const open = tokens[token.tokensIndex];
7023
+ open.type = "text";
7024
+ open.value = literal;
7025
+ open.output = safeOutput || utils.escapeRegex(literal);
7026
+ for (let i = token.tokensIndex + 1; i < tokens.length; i++) {
7027
+ tokens[i].value = "";
7028
+ tokens[i].output = "";
7029
+ delete tokens[i].suffix;
7030
+ }
7031
+ state.output = token.output + open.output;
7032
+ state.backtrack = true;
7033
+ push({ type: "paren", extglob: true, value, output: "" });
7034
+ decrement("parens");
7035
+ return;
7036
+ }
7037
+ let output = token.close + (opts.capture ? ")" : "");
7038
+ let rest;
7039
+ if (token.type === "negate") {
7040
+ let extglobStar = star;
7041
+ if (token.inner && token.inner.length > 1 && token.inner.includes("/")) {
7042
+ extglobStar = globstar(opts);
7043
+ }
7044
+ if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
7045
+ output = token.close = `)$))${extglobStar}`;
7046
+ }
7047
+ if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
7048
+ const expression = parse2(rest, { ...options, fastpaths: false }).output;
7049
+ output = token.close = `)${expression})${extglobStar})`;
7050
+ }
7051
+ if (token.prev.type === "bos") {
7052
+ state.negatedExtglob = true;
7053
+ }
7054
+ }
7055
+ push({ type: "paren", extglob: true, value, output });
7056
+ decrement("parens");
7057
+ };
7058
+ if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
7059
+ let backslashes = false;
7060
+ let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
7061
+ if (first === "\\") {
7062
+ backslashes = true;
7063
+ return m;
7064
+ }
7065
+ if (first === "?") {
7066
+ if (esc) {
7067
+ return esc + first + (rest ? QMARK.repeat(rest.length) : "");
7068
+ }
7069
+ if (index === 0) {
7070
+ return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : "");
7071
+ }
7072
+ return QMARK.repeat(chars.length);
7073
+ }
7074
+ if (first === ".") {
7075
+ return DOT_LITERAL.repeat(chars.length);
7076
+ }
7077
+ if (first === "*") {
7078
+ if (esc) {
7079
+ return esc + first + (rest ? star : "");
7080
+ }
7081
+ return star;
7082
+ }
7083
+ return esc ? m : `\\${m}`;
7084
+ });
7085
+ if (backslashes === true) {
7086
+ if (opts.unescape === true) {
7087
+ output = output.replace(/\\/g, "");
7088
+ } else {
7089
+ output = output.replace(/\\+/g, (m) => {
7090
+ return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
7091
+ });
7092
+ }
7093
+ }
7094
+ if (output === input && opts.contains === true) {
7095
+ state.output = input;
7096
+ return state;
7097
+ }
7098
+ state.output = utils.wrapOutput(output, state, options);
7099
+ return state;
7100
+ }
7101
+ while (!eos()) {
7102
+ value = advance();
7103
+ if (value === "\0") {
7104
+ continue;
7105
+ }
7106
+ if (value === "\\") {
7107
+ const next = peek();
7108
+ if (next === "/" && opts.bash !== true) {
7109
+ continue;
7110
+ }
7111
+ if (next === "." || next === ";") {
7112
+ continue;
7113
+ }
7114
+ if (!next) {
7115
+ value += "\\";
7116
+ push({ type: "text", value });
7117
+ continue;
7118
+ }
7119
+ const match = /^\\+/.exec(remaining());
7120
+ let slashes = 0;
7121
+ if (match && match[0].length > 2) {
7122
+ slashes = match[0].length;
7123
+ state.index += slashes;
7124
+ if (slashes % 2 !== 0) {
7125
+ value += "\\";
7126
+ }
7127
+ }
7128
+ if (opts.unescape === true) {
7129
+ value = advance();
7130
+ } else {
7131
+ value += advance();
7132
+ }
7133
+ if (state.brackets === 0) {
7134
+ push({ type: "text", value });
7135
+ continue;
7136
+ }
7137
+ }
7138
+ if (state.brackets > 0 && (value !== "]" || prev.value === "[" || prev.value === "[^")) {
7139
+ if (opts.posix !== false && value === ":") {
7140
+ const inner = prev.value.slice(1);
7141
+ if (inner.includes("[")) {
7142
+ prev.posix = true;
7143
+ if (inner.includes(":")) {
7144
+ const idx = prev.value.lastIndexOf("[");
7145
+ const pre = prev.value.slice(0, idx);
7146
+ const rest2 = prev.value.slice(idx + 2);
7147
+ const posix = POSIX_REGEX_SOURCE[rest2];
7148
+ if (posix) {
7149
+ prev.value = pre + posix;
7150
+ state.backtrack = true;
7151
+ advance();
7152
+ if (!bos.output && tokens.indexOf(prev) === 1) {
7153
+ bos.output = ONE_CHAR;
7154
+ }
7155
+ continue;
7156
+ }
7157
+ }
7158
+ }
7159
+ }
7160
+ if (value === "[" && peek() !== ":" || value === "-" && peek() === "]") {
7161
+ value = `\\${value}`;
7162
+ }
7163
+ if (value === "]" && (prev.value === "[" || prev.value === "[^")) {
7164
+ value = `\\${value}`;
7165
+ }
7166
+ if (opts.posix === true && value === "!" && prev.value === "[") {
7167
+ value = "^";
7168
+ }
7169
+ prev.value += value;
7170
+ append({ value });
7171
+ continue;
7172
+ }
7173
+ if (state.quotes === 1 && value !== '"') {
7174
+ value = utils.escapeRegex(value);
7175
+ prev.value += value;
7176
+ append({ value });
7177
+ continue;
7178
+ }
7179
+ if (value === '"') {
7180
+ state.quotes = state.quotes === 1 ? 0 : 1;
7181
+ if (opts.keepQuotes === true) {
7182
+ push({ type: "text", value });
7183
+ }
7184
+ continue;
7185
+ }
7186
+ if (value === "(") {
7187
+ increment("parens");
7188
+ push({ type: "paren", value });
7189
+ continue;
7190
+ }
7191
+ if (value === ")") {
7192
+ if (state.parens === 0 && opts.strictBrackets === true) {
7193
+ throw new SyntaxError(syntaxError("opening", "("));
7194
+ }
7195
+ const extglob = extglobs[extglobs.length - 1];
7196
+ if (extglob && state.parens === extglob.parens + 1) {
7197
+ extglobClose(extglobs.pop());
7198
+ continue;
7199
+ }
7200
+ push({ type: "paren", value, output: state.parens ? ")" : "\\)" });
7201
+ decrement("parens");
7202
+ continue;
7203
+ }
7204
+ if (value === "[") {
7205
+ if (opts.nobracket === true || !remaining().includes("]")) {
7206
+ if (opts.nobracket !== true && opts.strictBrackets === true) {
7207
+ throw new SyntaxError(syntaxError("closing", "]"));
7208
+ }
7209
+ value = `\\${value}`;
7210
+ } else {
7211
+ increment("brackets");
7212
+ }
7213
+ push({ type: "bracket", value });
7214
+ continue;
7215
+ }
7216
+ if (value === "]") {
7217
+ if (opts.nobracket === true || prev && prev.type === "bracket" && prev.value.length === 1) {
7218
+ push({ type: "text", value, output: `\\${value}` });
7219
+ continue;
7220
+ }
7221
+ if (state.brackets === 0) {
7222
+ if (opts.strictBrackets === true) {
7223
+ throw new SyntaxError(syntaxError("opening", "["));
7224
+ }
7225
+ push({ type: "text", value, output: `\\${value}` });
7226
+ continue;
7227
+ }
7228
+ decrement("brackets");
7229
+ const prevValue = prev.value.slice(1);
7230
+ if (prev.posix !== true && prevValue[0] === "^" && !prevValue.includes("/")) {
7231
+ value = `/${value}`;
7232
+ }
7233
+ prev.value += value;
7234
+ append({ value });
7235
+ if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) {
7236
+ continue;
7237
+ }
7238
+ const escaped = utils.escapeRegex(prev.value);
7239
+ state.output = state.output.slice(0, -prev.value.length);
7240
+ if (opts.literalBrackets === true) {
7241
+ state.output += escaped;
7242
+ prev.value = escaped;
7243
+ continue;
7244
+ }
7245
+ prev.value = `(${capture}${escaped}|${prev.value})`;
7246
+ state.output += prev.value;
7247
+ continue;
7248
+ }
7249
+ if (value === "{" && opts.nobrace !== true) {
7250
+ increment("braces");
7251
+ const open = {
7252
+ type: "brace",
7253
+ value,
7254
+ output: "(",
7255
+ outputIndex: state.output.length,
7256
+ tokensIndex: state.tokens.length
7257
+ };
7258
+ braces.push(open);
7259
+ push(open);
7260
+ continue;
7261
+ }
7262
+ if (value === "}") {
7263
+ const brace = braces[braces.length - 1];
7264
+ if (opts.nobrace === true || !brace) {
7265
+ push({ type: "text", value, output: value });
7266
+ continue;
7267
+ }
7268
+ let output = ")";
7269
+ if (brace.dots === true) {
7270
+ const arr = tokens.slice();
7271
+ const range = [];
7272
+ for (let i = arr.length - 1; i >= 0; i--) {
7273
+ tokens.pop();
7274
+ if (arr[i].type === "brace") {
7275
+ break;
7276
+ }
7277
+ if (arr[i].type !== "dots") {
7278
+ range.unshift(arr[i].value);
7279
+ }
7280
+ }
7281
+ output = expandRange(range, opts);
7282
+ state.backtrack = true;
7283
+ }
7284
+ if (brace.comma !== true && brace.dots !== true) {
7285
+ const out = state.output.slice(0, brace.outputIndex);
7286
+ const toks = state.tokens.slice(brace.tokensIndex);
7287
+ brace.value = brace.output = "\\{";
7288
+ value = output = "\\}";
7289
+ state.output = out;
7290
+ for (const t of toks) {
7291
+ state.output += t.output || t.value;
7292
+ }
7293
+ }
7294
+ push({ type: "brace", value, output });
7295
+ decrement("braces");
7296
+ braces.pop();
7297
+ continue;
7298
+ }
7299
+ if (value === "|") {
7300
+ if (extglobs.length > 0) {
7301
+ extglobs[extglobs.length - 1].conditions++;
7302
+ }
7303
+ push({ type: "text", value });
7304
+ continue;
7305
+ }
7306
+ if (value === ",") {
7307
+ let output = value;
7308
+ const brace = braces[braces.length - 1];
7309
+ if (brace && stack[stack.length - 1] === "braces") {
7310
+ brace.comma = true;
7311
+ output = "|";
7312
+ }
7313
+ push({ type: "comma", value, output });
7314
+ continue;
7315
+ }
7316
+ if (value === "/") {
7317
+ if (prev.type === "dot" && state.index === state.start + 1) {
7318
+ state.start = state.index + 1;
7319
+ state.consumed = "";
7320
+ state.output = "";
7321
+ tokens.pop();
7322
+ prev = bos;
7323
+ continue;
7324
+ }
7325
+ push({ type: "slash", value, output: SLASH_LITERAL });
7326
+ continue;
7327
+ }
7328
+ if (value === ".") {
7329
+ if (state.braces > 0 && prev.type === "dot") {
7330
+ if (prev.value === ".") prev.output = DOT_LITERAL;
7331
+ const brace = braces[braces.length - 1];
7332
+ prev.type = "dots";
7333
+ prev.output += value;
7334
+ prev.value += value;
7335
+ brace.dots = true;
7336
+ continue;
7337
+ }
7338
+ if (state.braces + state.parens === 0 && prev.type !== "bos" && prev.type !== "slash") {
7339
+ push({ type: "text", value, output: DOT_LITERAL });
7340
+ continue;
7341
+ }
7342
+ push({ type: "dot", value, output: DOT_LITERAL });
7343
+ continue;
7344
+ }
7345
+ if (value === "?") {
7346
+ const isGroup = prev && prev.value === "(";
7347
+ if (!isGroup && opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
7348
+ extglobOpen("qmark", value);
7349
+ continue;
7350
+ }
7351
+ if (prev && prev.type === "paren") {
7352
+ const next = peek();
7353
+ let output = value;
7354
+ if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) {
7355
+ output = `\\${value}`;
7356
+ }
7357
+ push({ type: "text", value, output });
7358
+ continue;
7359
+ }
7360
+ if (opts.dot !== true && (prev.type === "slash" || prev.type === "bos")) {
7361
+ push({ type: "qmark", value, output: QMARK_NO_DOT });
7362
+ continue;
7363
+ }
7364
+ push({ type: "qmark", value, output: QMARK });
7365
+ continue;
7366
+ }
7367
+ if (value === "!") {
7368
+ if (opts.noextglob !== true && peek() === "(") {
7369
+ if (peek(2) !== "?" || !/[!=<:]/.test(peek(3))) {
7370
+ extglobOpen("negate", value);
7371
+ continue;
7372
+ }
7373
+ }
7374
+ if (opts.nonegate !== true && state.index === 0) {
7375
+ negate();
7376
+ continue;
7377
+ }
7378
+ }
7379
+ if (value === "+") {
7380
+ if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
7381
+ extglobOpen("plus", value);
7382
+ continue;
7383
+ }
7384
+ if (prev && prev.value === "(" || opts.regex === false) {
7385
+ push({ type: "plus", value, output: PLUS_LITERAL });
7386
+ continue;
7387
+ }
7388
+ if (prev && (prev.type === "bracket" || prev.type === "paren" || prev.type === "brace") || state.parens > 0) {
7389
+ push({ type: "plus", value });
7390
+ continue;
7391
+ }
7392
+ push({ type: "plus", value: PLUS_LITERAL });
7393
+ continue;
7394
+ }
7395
+ if (value === "@") {
7396
+ if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
7397
+ push({ type: "at", extglob: true, value, output: "" });
7398
+ continue;
7399
+ }
7400
+ push({ type: "text", value });
7401
+ continue;
7402
+ }
7403
+ if (value !== "*") {
7404
+ if (value === "$" || value === "^") {
7405
+ value = `\\${value}`;
7406
+ }
7407
+ const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
7408
+ if (match) {
7409
+ value += match[0];
7410
+ state.index += match[0].length;
7411
+ }
7412
+ push({ type: "text", value });
7413
+ continue;
7414
+ }
7415
+ if (prev && (prev.type === "globstar" || prev.star === true)) {
7416
+ prev.type = "star";
7417
+ prev.star = true;
7418
+ prev.value += value;
7419
+ prev.output = star;
7420
+ state.backtrack = true;
7421
+ state.globstar = true;
7422
+ consume(value);
7423
+ continue;
7424
+ }
7425
+ let rest = remaining();
7426
+ if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
7427
+ extglobOpen("star", value);
7428
+ continue;
7429
+ }
7430
+ if (prev.type === "star") {
7431
+ if (opts.noglobstar === true) {
7432
+ consume(value);
7433
+ continue;
7434
+ }
7435
+ const prior = prev.prev;
7436
+ const before = prior.prev;
7437
+ const isStart = prior.type === "slash" || prior.type === "bos";
7438
+ const afterStar = before && (before.type === "star" || before.type === "globstar");
7439
+ if (opts.bash === true && (!isStart || rest[0] && rest[0] !== "/")) {
7440
+ push({ type: "star", value, output: "" });
7441
+ continue;
7442
+ }
7443
+ const isBrace = state.braces > 0 && (prior.type === "comma" || prior.type === "brace");
7444
+ const isExtglob = extglobs.length && (prior.type === "pipe" || prior.type === "paren");
7445
+ if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) {
7446
+ push({ type: "star", value, output: "" });
7447
+ continue;
7448
+ }
7449
+ while (rest.slice(0, 3) === "/**") {
7450
+ const after = input[state.index + 4];
7451
+ if (after && after !== "/") {
7452
+ break;
7453
+ }
7454
+ rest = rest.slice(3);
7455
+ consume("/**", 3);
7456
+ }
7457
+ if (prior.type === "bos" && eos()) {
7458
+ prev.type = "globstar";
7459
+ prev.value += value;
7460
+ prev.output = globstar(opts);
7461
+ state.output = prev.output;
7462
+ state.globstar = true;
7463
+ consume(value);
7464
+ continue;
7465
+ }
7466
+ if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && eos()) {
7467
+ state.output = state.output.slice(0, -(prior.output + prev.output).length);
7468
+ prior.output = `(?:${prior.output}`;
7469
+ prev.type = "globstar";
7470
+ prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)");
7471
+ prev.value += value;
7472
+ state.globstar = true;
7473
+ state.output += prior.output + prev.output;
7474
+ consume(value);
7475
+ continue;
7476
+ }
7477
+ if (prior.type === "slash" && prior.prev.type !== "bos" && rest[0] === "/") {
7478
+ const end = rest[1] !== void 0 ? "|$" : "";
7479
+ state.output = state.output.slice(0, -(prior.output + prev.output).length);
7480
+ prior.output = `(?:${prior.output}`;
7481
+ prev.type = "globstar";
7482
+ prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
7483
+ prev.value += value;
7484
+ state.output += prior.output + prev.output;
7485
+ state.globstar = true;
7486
+ consume(value + advance());
7487
+ push({ type: "slash", value: "/", output: "" });
7488
+ continue;
7489
+ }
7490
+ if (prior.type === "bos" && rest[0] === "/") {
7491
+ prev.type = "globstar";
7492
+ prev.value += value;
7493
+ prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
7494
+ state.output = prev.output;
7495
+ state.globstar = true;
7496
+ consume(value + advance());
7497
+ push({ type: "slash", value: "/", output: "" });
7498
+ continue;
7499
+ }
7500
+ state.output = state.output.slice(0, -prev.output.length);
7501
+ prev.type = "globstar";
7502
+ prev.output = globstar(opts);
7503
+ prev.value += value;
7504
+ state.output += prev.output;
7505
+ state.globstar = true;
7506
+ consume(value);
7507
+ continue;
7508
+ }
7509
+ const token = { type: "star", value, output: star };
7510
+ if (opts.bash === true) {
7511
+ token.output = ".*?";
7512
+ if (prev.type === "bos" || prev.type === "slash") {
7513
+ token.output = nodot + token.output;
7514
+ }
7515
+ push(token);
7516
+ continue;
7517
+ }
7518
+ if (prev && (prev.type === "bracket" || prev.type === "paren") && opts.regex === true) {
7519
+ token.output = value;
7520
+ push(token);
7521
+ continue;
7522
+ }
7523
+ if (state.index === state.start || prev.type === "slash" || prev.type === "dot") {
7524
+ if (prev.type === "dot") {
7525
+ state.output += NO_DOT_SLASH;
7526
+ prev.output += NO_DOT_SLASH;
7527
+ } else if (opts.dot === true) {
7528
+ state.output += NO_DOTS_SLASH;
7529
+ prev.output += NO_DOTS_SLASH;
7530
+ } else {
7531
+ state.output += nodot;
7532
+ prev.output += nodot;
7533
+ }
7534
+ if (peek() !== "*") {
7535
+ state.output += ONE_CHAR;
7536
+ prev.output += ONE_CHAR;
7537
+ }
7538
+ }
7539
+ push(token);
7540
+ }
7541
+ while (state.brackets > 0) {
7542
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "]"));
7543
+ state.output = utils.escapeLast(state.output, "[");
7544
+ decrement("brackets");
7545
+ }
7546
+ while (state.parens > 0) {
7547
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", ")"));
7548
+ state.output = utils.escapeLast(state.output, "(");
7549
+ decrement("parens");
7550
+ }
7551
+ while (state.braces > 0) {
7552
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "}"));
7553
+ state.output = utils.escapeLast(state.output, "{");
7554
+ decrement("braces");
7555
+ }
7556
+ if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) {
7557
+ push({ type: "maybe_slash", value: "", output: `${SLASH_LITERAL}?` });
7558
+ }
7559
+ if (state.backtrack === true) {
7560
+ state.output = "";
7561
+ for (const token of state.tokens) {
7562
+ state.output += token.output != null ? token.output : token.value;
7563
+ if (token.suffix) {
7564
+ state.output += token.suffix;
7565
+ }
7566
+ }
7567
+ }
7568
+ return state;
7569
+ };
7570
+ parse2.fastpaths = (input, options) => {
7571
+ const opts = { ...options };
7572
+ const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
7573
+ const len = input.length;
7574
+ if (len > max) {
7575
+ throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
7576
+ }
7577
+ input = REPLACEMENTS[input] || input;
7578
+ const {
7579
+ DOT_LITERAL,
7580
+ SLASH_LITERAL,
7581
+ ONE_CHAR,
7582
+ DOTS_SLASH,
7583
+ NO_DOT,
7584
+ NO_DOTS,
7585
+ NO_DOTS_SLASH,
7586
+ STAR,
7587
+ START_ANCHOR
7588
+ } = constants.globChars(opts.windows);
7589
+ const nodot = opts.dot ? NO_DOTS : NO_DOT;
7590
+ const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
7591
+ const capture = opts.capture ? "" : "?:";
7592
+ const state = { negated: false, prefix: "" };
7593
+ let star = opts.bash === true ? ".*?" : STAR;
7594
+ if (opts.capture) {
7595
+ star = `(${star})`;
7596
+ }
7597
+ const globstar = (opts2) => {
7598
+ if (opts2.noglobstar === true) return star;
7599
+ return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
7600
+ };
7601
+ const create = (str) => {
7602
+ switch (str) {
7603
+ case "*":
7604
+ return `${nodot}${ONE_CHAR}${star}`;
7605
+ case ".*":
7606
+ return `${DOT_LITERAL}${ONE_CHAR}${star}`;
7607
+ case "*.*":
7608
+ return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
7609
+ case "*/*":
7610
+ return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
7611
+ case "**":
7612
+ return nodot + globstar(opts);
7613
+ case "**/*":
7614
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
7615
+ case "**/*.*":
7616
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
7617
+ case "**/.*":
7618
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
7619
+ default: {
7620
+ const match = /^(.*?)\.(\w+)$/.exec(str);
7621
+ if (!match) return;
7622
+ const source2 = create(match[1]);
7623
+ if (!source2) return;
7624
+ return source2 + DOT_LITERAL + match[2];
7625
+ }
7626
+ }
7627
+ };
7628
+ const output = utils.removePrefix(input, state);
7629
+ let source = create(output);
7630
+ if (source && opts.strictSlashes !== true) {
7631
+ source += `${SLASH_LITERAL}?`;
7632
+ }
7633
+ return source;
7634
+ };
7635
+ module22.exports = parse2;
7636
+ }
7637
+ });
7638
+ var require_picomatch = __commonJS2({
7639
+ "node_modules/picomatch/lib/picomatch.js"(exports22, module22) {
7640
+ "use strict";
7641
+ var scan2 = require_scan();
7642
+ var parse2 = require_parse();
7643
+ var utils = require_utils5();
7644
+ var constants = require_constants();
7645
+ var isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
7646
+ var picomatch = (glob, options, returnState = false) => {
7647
+ if (Array.isArray(glob)) {
7648
+ const fns = glob.map((input) => picomatch(input, options, returnState));
7649
+ const arrayMatcher = (str) => {
7650
+ for (const isMatch of fns) {
7651
+ const state2 = isMatch(str);
7652
+ if (state2) return state2;
7653
+ }
7654
+ return false;
7655
+ };
7656
+ return arrayMatcher;
7657
+ }
7658
+ const isState = isObject(glob) && glob.tokens && glob.input;
7659
+ if (glob === "" || typeof glob !== "string" && !isState) {
7660
+ throw new TypeError("Expected pattern to be a non-empty string");
7661
+ }
7662
+ const opts = options || {};
7663
+ const posix = opts.windows;
7664
+ const regex = isState ? picomatch.compileRe(glob, options) : picomatch.makeRe(glob, options, false, true);
7665
+ const state = regex.state;
7666
+ delete regex.state;
7667
+ let isIgnored = () => false;
7668
+ if (opts.ignore) {
7669
+ const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
7670
+ isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
7671
+ }
7672
+ const matcher = (input, returnObject = false) => {
7673
+ const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix });
7674
+ const result = { glob, state, regex, posix, input, output, match, isMatch };
7675
+ if (typeof opts.onResult === "function") {
7676
+ opts.onResult(result);
7677
+ }
7678
+ if (isMatch === false) {
7679
+ result.isMatch = false;
7680
+ return returnObject ? result : false;
7681
+ }
7682
+ if (isIgnored(input)) {
7683
+ if (typeof opts.onIgnore === "function") {
7684
+ opts.onIgnore(result);
7685
+ }
7686
+ result.isMatch = false;
7687
+ return returnObject ? result : false;
7688
+ }
7689
+ if (typeof opts.onMatch === "function") {
7690
+ opts.onMatch(result);
7691
+ }
7692
+ return returnObject ? result : true;
7693
+ };
7694
+ if (returnState) {
7695
+ matcher.state = state;
7696
+ }
7697
+ return matcher;
7698
+ };
7699
+ picomatch.test = (input, regex, options, { glob, posix } = {}) => {
7700
+ if (typeof input !== "string") {
7701
+ throw new TypeError("Expected input to be a string");
7702
+ }
7703
+ if (input === "") {
7704
+ return { isMatch: false, output: "" };
7705
+ }
7706
+ const opts = options || {};
7707
+ const format = opts.format || (posix ? utils.toPosixSlashes : null);
7708
+ let match = input === glob;
7709
+ let output = match && format ? format(input) : input;
7710
+ if (match === false) {
7711
+ output = format ? format(input) : input;
7712
+ match = output === glob;
7713
+ }
7714
+ if (match === false || opts.capture === true) {
7715
+ if (opts.matchBase === true || opts.basename === true) {
7716
+ match = picomatch.matchBase(input, regex, options, posix);
7717
+ } else {
7718
+ match = regex.exec(output);
7719
+ }
7720
+ }
7721
+ return { isMatch: Boolean(match), match, output };
7722
+ };
7723
+ picomatch.matchBase = (input, glob, options) => {
7724
+ const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
7725
+ return regex.test(utils.basename(input));
7726
+ };
7727
+ picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
7728
+ picomatch.parse = (pattern, options) => {
7729
+ if (Array.isArray(pattern)) return pattern.map((p) => picomatch.parse(p, options));
7730
+ return parse2(pattern, { ...options, fastpaths: false });
7731
+ };
7732
+ picomatch.scan = (input, options) => scan2(input, options);
7733
+ picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
7734
+ if (returnOutput === true) {
7735
+ return state.output;
7736
+ }
7737
+ const opts = options || {};
7738
+ const prepend = opts.contains ? "" : "^";
7739
+ const append = opts.contains ? "" : "$";
7740
+ let source = `${prepend}(?:${state.output})${append}`;
7741
+ if (state && state.negated === true) {
7742
+ source = `^(?!${source}).*$`;
7743
+ }
7744
+ const regex = picomatch.toRegex(source, options);
7745
+ if (returnState === true) {
7746
+ regex.state = state;
7747
+ }
7748
+ return regex;
7749
+ };
7750
+ picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
7751
+ if (!input || typeof input !== "string") {
7752
+ throw new TypeError("Expected a non-empty string");
7753
+ }
7754
+ let parsed = { negated: false, fastpaths: true };
7755
+ if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) {
7756
+ parsed.output = parse2.fastpaths(input, options);
7757
+ }
7758
+ if (!parsed.output) {
7759
+ parsed = parse2(input, options);
7760
+ }
7761
+ return picomatch.compileRe(parsed, options, returnOutput, returnState);
7762
+ };
7763
+ picomatch.toRegex = (source, options) => {
7764
+ try {
7765
+ const opts = options || {};
7766
+ return new RegExp(source, opts.flags || (opts.nocase ? "i" : ""));
7767
+ } catch (err) {
7768
+ if (options && options.debug === true) throw err;
7769
+ return /$^/;
7770
+ }
7771
+ };
7772
+ picomatch.constants = constants;
7773
+ module22.exports = picomatch;
7774
+ }
7775
+ });
7776
+ var require_picomatch2 = __commonJS2({
7777
+ "node_modules/picomatch/index.js"(exports22, module22) {
7778
+ "use strict";
7779
+ var pico = require_picomatch();
7780
+ var utils = require_utils5();
7781
+ function picomatch(glob, options, returnState = false) {
7782
+ if (options && (options.windows === null || options.windows === void 0)) {
7783
+ options = { ...options, windows: utils.isWindows() };
7784
+ }
7785
+ return pico(glob, options, returnState);
7786
+ }
7787
+ Object.assign(picomatch, pico);
7788
+ module22.exports = picomatch;
7789
+ }
7790
+ });
7791
+ var require_scan2 = __commonJS2({
6046
7792
  "src/scan.js"(exports22, module22) {
7793
+ var picomatch = require_picomatch2();
7794
+ function list(value) {
7795
+ if (value === void 0 || value === null) {
7796
+ return [];
7797
+ }
7798
+ if (!Array.isArray(value)) {
7799
+ return [value];
7800
+ }
7801
+ return value;
7802
+ }
6047
7803
  function trimmer(value) {
6048
7804
  return (value || "").trim();
6049
7805
  }
@@ -6085,6 +7841,10 @@ var require_dist = __commonJS({
6085
7841
  transform = options;
6086
7842
  options = {};
6087
7843
  }
7844
+ const ik = list(options.ik);
7845
+ const ek = list(options.ek);
7846
+ const include = picomatch(ik, { ignore: ek });
7847
+ const exclude = picomatch(ek);
6088
7848
  const LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
6089
7849
  const parsed = {};
6090
7850
  let lines = (src || "").toString();
@@ -6094,6 +7854,9 @@ var require_dist = __commonJS({
6094
7854
  let match;
6095
7855
  while ((match = LINE.exec(lines)) !== null) {
6096
7856
  const name = match[1];
7857
+ if (exclude(name) || ik.length > 0 && !include(name)) {
7858
+ continue;
7859
+ }
6097
7860
  const raw = match[2];
6098
7861
  const quote = getQuote(raw);
6099
7862
  const value = clean(raw, quote, options);
@@ -6119,7 +7882,7 @@ var require_dist = __commonJS({
6119
7882
  "src/keyring.js"(exports22, module22) {
6120
7883
  var fs2 = require("fs");
6121
7884
  var derive2 = require_derive();
6122
- var scan2 = require_scan();
7885
+ var scan2 = require_scan2();
6123
7886
  async function keysFromFile(filepath = ".env.keys") {
6124
7887
  try {
6125
7888
  const src = await fs2.promises.readFile(filepath, "utf8");
@@ -6127,7 +7890,13 @@ var require_dist = __commonJS({
6127
7890
  const result = [];
6128
7891
  for (const name in parsed) {
6129
7892
  if (name.startsWith("DOTENV_PRIVATE_KEY")) {
6130
- result.push(parsed[name][parsed[name].length - 1]);
7893
+ const values = parsed[name];
7894
+ for (const value of values) {
7895
+ const splits = value.split(",");
7896
+ for (const split of splits) {
7897
+ result.push(split);
7898
+ }
7899
+ }
6131
7900
  }
6132
7901
  }
6133
7902
  return result;
@@ -6142,7 +7911,13 @@ var require_dist = __commonJS({
6142
7911
  const result = [];
6143
7912
  for (const name in parsed) {
6144
7913
  if (name.startsWith("DOTENV_PRIVATE_KEY")) {
6145
- result.push(parsed[name][parsed[name].length - 1]);
7914
+ const values = parsed[name];
7915
+ for (const value of values) {
7916
+ const splits = value.split(",");
7917
+ for (const split of splits) {
7918
+ result.push(split);
7919
+ }
7920
+ }
6146
7921
  }
6147
7922
  }
6148
7923
  return result;
@@ -6160,6 +7935,10 @@ var require_dist = __commonJS({
6160
7935
  privateKeyValues.push(...await keysFromFile(filepath));
6161
7936
  }
6162
7937
  for (const name in processEnv2) {
7938
+ if (name.startsWith("DOTENV_PUBLIC_KEY")) {
7939
+ const publicKeyHex = processEnv2[name];
7940
+ ring[publicKeyHex] ||= "";
7941
+ }
6163
7942
  if (name.startsWith("DOTENV_PRIVATE_KEY")) {
6164
7943
  privateKeyValues.push(processEnv2[name]);
6165
7944
  }
@@ -6176,9 +7955,12 @@ var require_dist = __commonJS({
6176
7955
  if (ring[publicKeyHex]) {
6177
7956
  continue;
6178
7957
  }
6179
- const privateKeyHex = await provider(publicKeyHex);
6180
- if (privateKeyHex) {
6181
- ring[publicKeyHex] = privateKeyHex;
7958
+ const providerRing = await provider(publicKeyHex);
7959
+ for (const providerPublicKeyHex in providerRing || {}) {
7960
+ const providerPrivateKeyHex = providerRing[providerPublicKeyHex];
7961
+ if (providerPrivateKeyHex) {
7962
+ ring[providerPublicKeyHex] = providerPrivateKeyHex;
7963
+ }
6182
7964
  }
6183
7965
  }
6184
7966
  }
@@ -6193,6 +7975,10 @@ var require_dist = __commonJS({
6193
7975
  return acc.concat(keysFromFileSync(filepath));
6194
7976
  }, []);
6195
7977
  for (const name in processEnv2) {
7978
+ if (name.startsWith("DOTENV_PUBLIC_KEY")) {
7979
+ const publicKeyHex = processEnv2[name];
7980
+ ring[publicKeyHex] ||= "";
7981
+ }
6196
7982
  if (name.startsWith("DOTENV_PRIVATE_KEY")) {
6197
7983
  privateKeyValues.push(processEnv2[name]);
6198
7984
  }
@@ -6209,9 +7995,12 @@ var require_dist = __commonJS({
6209
7995
  if (ring[publicKeyHex]) {
6210
7996
  continue;
6211
7997
  }
6212
- const privateKeyHex = provider(publicKeyHex);
6213
- if (privateKeyHex) {
6214
- ring[publicKeyHex] = privateKeyHex;
7998
+ const providerRing = provider(publicKeyHex);
7999
+ for (const providerPublicKeyHex in providerRing || {}) {
8000
+ const providerPrivateKeyHex = providerRing[providerPublicKeyHex];
8001
+ if (providerPrivateKeyHex) {
8002
+ ring[providerPublicKeyHex] = providerPrivateKeyHex;
8003
+ }
6215
8004
  }
6216
8005
  }
6217
8006
  }
@@ -6223,7 +8012,7 @@ var require_dist = __commonJS({
6223
8012
  });
6224
8013
  var require_publickeys = __commonJS2({
6225
8014
  "src/publickeys.js"(exports22, module22) {
6226
- var scan2 = require_scan();
8015
+ var scan2 = require_scan2();
6227
8016
  function publickeys2(src) {
6228
8017
  const { parsed } = scan2(src);
6229
8018
  const result = [];
@@ -6237,16 +8026,27 @@ var require_dist = __commonJS({
6237
8026
  module22.exports = publickeys2;
6238
8027
  }
6239
8028
  });
6240
- var require_parse = __commonJS2({
8029
+ var require_parse2 = __commonJS2({
6241
8030
  "src/parse.js"(exports22, module22) {
6242
8031
  var decrypt2 = require_decrypt();
8032
+ var Errors = require_errors();
6243
8033
  var keyring2 = require_keyring();
6244
8034
  var keyringSync2 = require_keyring().sync;
6245
8035
  var encrypted2 = require_encrypted();
6246
8036
  var evaluate2 = require_evaluate();
6247
8037
  var expand2 = require_expand();
8038
+ var picomatch = require_picomatch2();
6248
8039
  var publickeys2 = require_publickeys();
6249
- var scan2 = require_scan();
8040
+ var scan2 = require_scan2();
8041
+ function list(value) {
8042
+ if (value === void 0 || value === null) {
8043
+ return [];
8044
+ }
8045
+ if (!Array.isArray(value)) {
8046
+ return [value];
8047
+ }
8048
+ return value;
8049
+ }
6250
8050
  function resolveEscapeSequences(value) {
6251
8051
  return value.replace(/\\\$/g, "$");
6252
8052
  }
@@ -6274,18 +8074,32 @@ var require_dist = __commonJS({
6274
8074
  }
6275
8075
  return value;
6276
8076
  }
8077
+ function unresolvedEncryptedError(unresolved) {
8078
+ const keys = Object.keys(unresolved);
8079
+ if (keys.length === 0) {
8080
+ return null;
8081
+ }
8082
+ const error = new Errors({ message: `could not decrypt ${keys.join(", ")}` }).decryptionFailed();
8083
+ return {
8084
+ code: error.code,
8085
+ message: error.message
8086
+ };
8087
+ }
6277
8088
  async function parse2(src, options = {}) {
6278
- const { overload, processEnv: processEnv2, fk, provider, publicKeyHexes, ring: initialRing } = keyringOptions(src, options);
8089
+ const { overload, array, ik, ek, processEnv: processEnv2, fk, provider, publicKeyHexes, ring: initialRing } = keyringOptions(src, options);
6279
8090
  const ring = await keyring2({ processEnv: processEnv2, ring: initialRing, fk, provider });
6280
- return parseWithRing(src, { overload, processEnv: processEnv2, ring, publicKeyHexes });
8091
+ return parseWithRing(src, { overload, array, ik, ek, processEnv: processEnv2, ring, publicKeyHexes });
6281
8092
  }
6282
8093
  function parseSync22(src, options = {}) {
6283
- const { overload, processEnv: processEnv2, fk, provider, publicKeyHexes, ring: initialRing } = keyringOptions(src, options);
8094
+ const { overload, array, ik, ek, processEnv: processEnv2, fk, provider, publicKeyHexes, ring: initialRing } = keyringOptions(src, options);
6284
8095
  const ring = keyringSync2({ processEnv: processEnv2, ring: initialRing, fk, provider });
6285
- return parseWithRing(src, { overload, processEnv: processEnv2, ring, publicKeyHexes });
8096
+ return parseWithRing(src, { overload, array, ik, ek, processEnv: processEnv2, ring, publicKeyHexes });
6286
8097
  }
6287
8098
  function keyringOptions(src, options = {}) {
6288
8099
  const overload = options.overload;
8100
+ const array = options.array;
8101
+ const ik = list(options.ik);
8102
+ const ek = list(options.ek);
6289
8103
  const processEnv2 = options.processEnv || process.env;
6290
8104
  const fk = options.fk;
6291
8105
  const provider = options.provider;
@@ -6294,13 +8108,18 @@ var require_dist = __commonJS({
6294
8108
  for (const publicKeyHex of publicKeyHexes) {
6295
8109
  ring[publicKeyHex] = "";
6296
8110
  }
6297
- return { overload, processEnv: processEnv2, fk, provider, publicKeyHexes, ring };
8111
+ return { overload, array, ik, ek, processEnv: processEnv2, fk, provider, publicKeyHexes, ring };
6298
8112
  }
6299
8113
  function parseWithRing(src, options = {}) {
6300
8114
  const overload = options.overload;
8115
+ const array = options.array;
8116
+ const ik = options.ik || [];
8117
+ const ek = options.ek || [];
6301
8118
  const processEnv2 = options.processEnv || process.env;
6302
8119
  const ring = options.ring || {};
6303
8120
  const publicKeyHexes = options.publicKeyHexes || [];
8121
+ const include = picomatch(ik, { ignore: ek });
8122
+ const exclude = picomatch(ek);
6304
8123
  function inProcessEnv(name) {
6305
8124
  return Object.prototype.hasOwnProperty.call(processEnv2, name);
6306
8125
  }
@@ -6309,12 +8128,19 @@ var require_dist = __commonJS({
6309
8128
  const parsed = {};
6310
8129
  const injected = {};
6311
8130
  const existed = {};
8131
+ const unresolvedEncrypted = {};
6312
8132
  scan2(src, ({ name, value, quote }) => {
6313
8133
  let parsedValue = value;
6314
8134
  if (!overload && inProcessEnv(name)) {
6315
8135
  parsedValue = processEnv2[name];
6316
8136
  }
6317
- parsedValue = decryptWithKeyring(ring, parsedValue, publicKeyHexes);
8137
+ const encryptedBefore = encrypted2(parsedValue);
8138
+ if (!exclude(name) && (ik.length === 0 || include(name))) {
8139
+ parsedValue = decryptWithKeyring(ring, parsedValue, publicKeyHexes);
8140
+ if (encryptedBefore && encrypted2(parsedValue)) {
8141
+ unresolvedEncrypted[name] = true;
8142
+ }
8143
+ }
6318
8144
  const encryptedPrefixed = encrypted2(parsedValue);
6319
8145
  let evaled = false;
6320
8146
  if (!encryptedPrefixed && quote !== "'" && (!inProcessEnv(name) || processEnv2[name] === parsedValue)) {
@@ -6328,24 +8154,45 @@ var require_dist = __commonJS({
6328
8154
  }
6329
8155
  }
6330
8156
  if (!encryptedPrefixed && !evaled && quote !== "'" && (!processEnv2[name] || overload)) {
6331
- parsedValue = resolveEscapeSequences(expand2(parsedValue, { processEnv: processEnv2, runningParsed, literals }));
8157
+ parsedValue = resolveEscapeSequences(expand2(parsedValue, { overload, processEnv: processEnv2, runningParsed, literals }));
6332
8158
  }
6333
8159
  if (quote === "'") {
6334
8160
  literals[name] = parsedValue;
6335
8161
  }
6336
8162
  runningParsed[name] = parsedValue;
6337
- parsed[name] = parsedValue;
8163
+ if (array) {
8164
+ parsed[name] = parsed[name] || [];
8165
+ parsed[name].push(parsedValue);
8166
+ } else {
8167
+ parsed[name] = parsedValue;
8168
+ }
6338
8169
  if (Object.prototype.hasOwnProperty.call(processEnv2, name) && !overload) {
6339
- existed[name] = processEnv2[name];
8170
+ if (array) {
8171
+ existed[name] = existed[name] || [];
8172
+ existed[name].push(processEnv2[name]);
8173
+ } else {
8174
+ existed[name] = processEnv2[name];
8175
+ }
6340
8176
  } else {
6341
- injected[name] = parsed[name];
8177
+ if (array) {
8178
+ injected[name] = injected[name] || [];
8179
+ injected[name].push(parsedValue);
8180
+ } else {
8181
+ injected[name] = parsed[name];
8182
+ }
6342
8183
  }
6343
8184
  return parsedValue;
6344
8185
  });
8186
+ const errors = [];
8187
+ const error = unresolvedEncryptedError(unresolvedEncrypted);
8188
+ if (error) {
8189
+ errors.push(error);
8190
+ }
6345
8191
  return {
6346
8192
  parsed,
6347
8193
  injected,
6348
- existed
8194
+ existed,
8195
+ errors
6349
8196
  };
6350
8197
  }
6351
8198
  module22.exports = parse2;
@@ -6355,15 +8202,21 @@ var require_dist = __commonJS({
6355
8202
  var require_sealed = __commonJS2({
6356
8203
  "src/sealed.js"(exports22, module22) {
6357
8204
  var encrypted2 = require_encrypted();
6358
- var scan2 = require_scan();
8205
+ var scan2 = require_scan2();
6359
8206
  function publicKey(name) {
6360
8207
  return name.startsWith("DOTENV_PUBLIC_KEY");
6361
8208
  }
8209
+ function plainKey(name) {
8210
+ return name.endsWith("_PLAIN");
8211
+ }
6362
8212
  function sealed2(src) {
6363
8213
  const { parsed } = scan2(src);
6364
8214
  for (const [name, values] of Object.entries(parsed)) {
8215
+ if (publicKey(name) || plainKey(name)) {
8216
+ continue;
8217
+ }
6365
8218
  for (const value of values) {
6366
- if (!encrypted2(value) && !publicKey(name)) {
8219
+ if (!encrypted2(value)) {
6367
8220
  return false;
6368
8221
  }
6369
8222
  }
@@ -6373,6 +8226,68 @@ var require_dist = __commonJS({
6373
8226
  module22.exports = sealed2;
6374
8227
  }
6375
8228
  });
8229
+ var require_upsert = __commonJS2({
8230
+ "src/upsert.js"(exports22, module22) {
8231
+ var scan2 = require_scan2();
8232
+ function escapeForRegex(str) {
8233
+ return str.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
8234
+ }
8235
+ function replaceExistingValue(src, key, originalValue, replaceValue) {
8236
+ const escapedKey = escapeForRegex(key);
8237
+ const escapedOriginalValue = escapeForRegex(originalValue);
8238
+ let enforceEndOfLine = "";
8239
+ if (escapedOriginalValue === "") {
8240
+ enforceEndOfLine = "$";
8241
+ }
8242
+ const currentPart = new RegExp(
8243
+ "^(\\s*)?(export\\s+)?" + escapedKey + "\\s*=\\s*([\"'`]?)" + escapedOriginalValue + "\\3" + enforceEndOfLine,
8244
+ "m"
8245
+ );
8246
+ return src.replace(currentPart, function(match, spaces = "", exportPart = "", quote = "") {
8247
+ let newPart = `${key}=${quote}${replaceValue}${quote}`;
8248
+ const newlineMatch = src.match(new RegExp(`${escapedKey}\\s*=\\s*
8249
+
8250
+ `, "m"));
8251
+ if (escapedOriginalValue === "" && quote === "" && newlineMatch) {
8252
+ const newlineCount = newlineMatch[0].match(/\n/g).length - 1;
8253
+ for (let i = 0; i < newlineCount; i++) {
8254
+ newPart += "\n";
8255
+ }
8256
+ }
8257
+ return `${spaces}${exportPart}${newPart}`;
8258
+ });
8259
+ }
8260
+ function upsert2(src, key, replaceValue) {
8261
+ let output;
8262
+ let newPart = "";
8263
+ const { parsed } = scan2(src, { expandDoubleQuotedNewlines: false, convertWindowsNewlines: false });
8264
+ if (Object.prototype.hasOwnProperty.call(parsed, key)) {
8265
+ const allValues = parsed[key];
8266
+ let duplicateOutput = src;
8267
+ const replacements = Array.isArray(replaceValue) ? replaceValue : allValues.map(() => replaceValue);
8268
+ allValues.forEach((value, index) => {
8269
+ duplicateOutput = replaceExistingValue(duplicateOutput, key, value, `\0DOTENVX_UPSERT_${index}\0`);
8270
+ });
8271
+ replacements.forEach((replacement, index) => {
8272
+ duplicateOutput = duplicateOutput.split(`\0DOTENVX_UPSERT_${index}\0`).join(replacement);
8273
+ });
8274
+ return duplicateOutput;
8275
+ } else {
8276
+ newPart += `${key}="${replaceValue}"`;
8277
+ if (src === "") {
8278
+ newPart = newPart + "\n";
8279
+ } else if (src.endsWith("\n")) {
8280
+ newPart = newPart + "\n";
8281
+ } else {
8282
+ newPart = "\n" + newPart;
8283
+ }
8284
+ output = src + newPart;
8285
+ }
8286
+ return output;
8287
+ }
8288
+ module22.exports = upsert2;
8289
+ }
8290
+ });
6376
8291
  var decrypt = require_decrypt();
6377
8292
  var derive = require_derive();
6378
8293
  var encrypt = require_encrypt();
@@ -6382,11 +8297,12 @@ var require_dist = __commonJS({
6382
8297
  var keypair = require_keypair();
6383
8298
  var keyring = require_keyring();
6384
8299
  var keyringSync = require_keyring().sync;
6385
- var parse = require_parse();
6386
- var parseSync2 = require_parse().sync;
8300
+ var parse = require_parse2();
8301
+ var parseSync2 = require_parse2().sync;
6387
8302
  var publickeys = require_publickeys();
6388
- var scan = require_scan();
8303
+ var scan = require_scan2();
6389
8304
  var sealed = require_sealed();
8305
+ var upsert = require_upsert();
6390
8306
  module2.exports = {
6391
8307
  decrypt,
6392
8308
  derive,
@@ -6401,7 +8317,8 @@ var require_dist = __commonJS({
6401
8317
  parseSync: parseSync2,
6402
8318
  publickeys,
6403
8319
  scan,
6404
- sealed
8320
+ sealed,
8321
+ upsert
6405
8322
  };
6406
8323
  }
6407
8324
  });