@vxrn/mdx 1.15.10 → 1.16.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.
package/dist/index.js CHANGED
@@ -1406,13 +1406,13 @@ var require_braces = __commonJS({
1406
1406
  }
1407
1407
  });
1408
1408
 
1409
- // ../../node_modules/micromatch/node_modules/picomatch/lib/constants.js
1409
+ // ../../node_modules/picomatch/lib/constants.js
1410
1410
  var require_constants2 = __commonJS({
1411
- "../../node_modules/micromatch/node_modules/picomatch/lib/constants.js"(exports2, module2) {
1411
+ "../../node_modules/picomatch/lib/constants.js"(exports2, module2) {
1412
1412
  "use strict";
1413
- var path5 = require("path");
1414
1413
  var WIN_SLASH = "\\\\/";
1415
1414
  var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
1415
+ var DEFAULT_MAX_EXTGLOB_RECURSION = 0;
1416
1416
  var DOT_LITERAL = "\\.";
1417
1417
  var PLUS_LITERAL = "\\+";
1418
1418
  var QMARK_LITERAL = "\\?";
@@ -1428,6 +1428,7 @@ var require_constants2 = __commonJS({
1428
1428
  var NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
1429
1429
  var QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
1430
1430
  var STAR = `${QMARK}*?`;
1431
+ var SEP = "/";
1431
1432
  var POSIX_CHARS = {
1432
1433
  DOT_LITERAL,
1433
1434
  PLUS_LITERAL,
@@ -1443,7 +1444,8 @@ var require_constants2 = __commonJS({
1443
1444
  NO_DOTS_SLASH,
1444
1445
  QMARK_NO_DOT,
1445
1446
  STAR,
1446
- START_ANCHOR
1447
+ START_ANCHOR,
1448
+ SEP
1447
1449
  };
1448
1450
  var WINDOWS_CHARS = {
1449
1451
  ...POSIX_CHARS,
@@ -1457,9 +1459,11 @@ var require_constants2 = __commonJS({
1457
1459
  NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
1458
1460
  QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
1459
1461
  START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
1460
- END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
1462
+ END_ANCHOR: `(?:[${WIN_SLASH}]|$)`,
1463
+ SEP: "\\"
1461
1464
  };
1462
1465
  var POSIX_REGEX_SOURCE = {
1466
+ __proto__: null,
1463
1467
  alnum: "a-zA-Z0-9",
1464
1468
  alpha: "a-zA-Z",
1465
1469
  ascii: "\\x00-\\x7F",
@@ -1476,6 +1480,7 @@ var require_constants2 = __commonJS({
1476
1480
  xdigit: "A-Fa-f0-9"
1477
1481
  };
1478
1482
  module2.exports = {
1483
+ DEFAULT_MAX_EXTGLOB_RECURSION,
1479
1484
  MAX_LENGTH: 1024 * 64,
1480
1485
  POSIX_REGEX_SOURCE,
1481
1486
  // regular expressions
@@ -1487,6 +1492,7 @@ var require_constants2 = __commonJS({
1487
1492
  REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
1488
1493
  // Replace globs with equivalent patterns to reduce parsing time.
1489
1494
  REPLACEMENTS: {
1495
+ __proto__: null,
1490
1496
  "***": "*",
1491
1497
  "**/**": "**",
1492
1498
  "**/**/**": "**"
@@ -1580,7 +1586,6 @@ var require_constants2 = __commonJS({
1580
1586
  /* | */
1581
1587
  CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
1582
1588
  /* \uFEFF */
1583
- SEP: path5.sep,
1584
1589
  /**
1585
1590
  * Create EXTGLOB_CHARS
1586
1591
  */
@@ -1603,12 +1608,10 @@ var require_constants2 = __commonJS({
1603
1608
  }
1604
1609
  });
1605
1610
 
1606
- // ../../node_modules/micromatch/node_modules/picomatch/lib/utils.js
1611
+ // ../../node_modules/picomatch/lib/utils.js
1607
1612
  var require_utils2 = __commonJS({
1608
- "../../node_modules/micromatch/node_modules/picomatch/lib/utils.js"(exports2) {
1613
+ "../../node_modules/picomatch/lib/utils.js"(exports2) {
1609
1614
  "use strict";
1610
- var path5 = require("path");
1611
- var win32 = process.platform === "win32";
1612
1615
  var {
1613
1616
  REGEX_BACKSLASH,
1614
1617
  REGEX_REMOVE_BACKSLASH,
@@ -1620,24 +1623,21 @@ var require_utils2 = __commonJS({
1620
1623
  exports2.isRegexChar = (str2) => str2.length === 1 && exports2.hasRegexChars(str2);
1621
1624
  exports2.escapeRegex = (str2) => str2.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
1622
1625
  exports2.toPosixSlashes = (str2) => str2.replace(REGEX_BACKSLASH, "/");
1626
+ exports2.isWindows = () => {
1627
+ if (typeof navigator !== "undefined" && navigator.platform) {
1628
+ const platform = navigator.platform.toLowerCase();
1629
+ return platform === "win32" || platform === "windows";
1630
+ }
1631
+ if (typeof process !== "undefined" && process.platform) {
1632
+ return process.platform === "win32";
1633
+ }
1634
+ return false;
1635
+ };
1623
1636
  exports2.removeBackslashes = (str2) => {
1624
1637
  return str2.replace(REGEX_REMOVE_BACKSLASH, (match) => {
1625
1638
  return match === "\\" ? "" : match;
1626
1639
  });
1627
1640
  };
1628
- exports2.supportsLookbehinds = () => {
1629
- const segs = process.version.slice(1).split(".").map(Number);
1630
- if (segs.length === 3 && segs[0] >= 9 || segs[0] === 8 && segs[1] >= 10) {
1631
- return true;
1632
- }
1633
- return false;
1634
- };
1635
- exports2.isWindows = (options2) => {
1636
- if (options2 && typeof options2.windows === "boolean") {
1637
- return options2.windows;
1638
- }
1639
- return win32 === true || path5.sep === "\\";
1640
- };
1641
1641
  exports2.escapeLast = (input, char, lastIdx) => {
1642
1642
  const idx = input.lastIndexOf(char, lastIdx);
1643
1643
  if (idx === -1) return input;
@@ -1661,12 +1661,20 @@ var require_utils2 = __commonJS({
1661
1661
  }
1662
1662
  return output;
1663
1663
  };
1664
+ exports2.basename = (path5, { windows } = {}) => {
1665
+ const segs = path5.split(windows ? /[\\/]/ : "/");
1666
+ const last = segs[segs.length - 1];
1667
+ if (last === "") {
1668
+ return segs[segs.length - 2];
1669
+ }
1670
+ return last;
1671
+ };
1664
1672
  }
1665
1673
  });
1666
1674
 
1667
- // ../../node_modules/micromatch/node_modules/picomatch/lib/scan.js
1675
+ // ../../node_modules/picomatch/lib/scan.js
1668
1676
  var require_scan = __commonJS({
1669
- "../../node_modules/micromatch/node_modules/picomatch/lib/scan.js"(exports2, module2) {
1677
+ "../../node_modules/picomatch/lib/scan.js"(exports2, module2) {
1670
1678
  "use strict";
1671
1679
  var utils = require_utils2();
1672
1680
  var {
@@ -1994,9 +2002,9 @@ var require_scan = __commonJS({
1994
2002
  }
1995
2003
  });
1996
2004
 
1997
- // ../../node_modules/micromatch/node_modules/picomatch/lib/parse.js
2005
+ // ../../node_modules/picomatch/lib/parse.js
1998
2006
  var require_parse2 = __commonJS({
1999
- "../../node_modules/micromatch/node_modules/picomatch/lib/parse.js"(exports2, module2) {
2007
+ "../../node_modules/picomatch/lib/parse.js"(exports2, module2) {
2000
2008
  "use strict";
2001
2009
  var constants2 = require_constants2();
2002
2010
  var utils = require_utils2();
@@ -2023,6 +2031,213 @@ var require_parse2 = __commonJS({
2023
2031
  var syntaxError = (type, char) => {
2024
2032
  return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
2025
2033
  };
2034
+ var splitTopLevel = (input) => {
2035
+ const parts = [];
2036
+ let bracket = 0;
2037
+ let paren = 0;
2038
+ let quote = 0;
2039
+ let value = "";
2040
+ let escaped = false;
2041
+ for (const ch of input) {
2042
+ if (escaped === true) {
2043
+ value += ch;
2044
+ escaped = false;
2045
+ continue;
2046
+ }
2047
+ if (ch === "\\") {
2048
+ value += ch;
2049
+ escaped = true;
2050
+ continue;
2051
+ }
2052
+ if (ch === '"') {
2053
+ quote = quote === 1 ? 0 : 1;
2054
+ value += ch;
2055
+ continue;
2056
+ }
2057
+ if (quote === 0) {
2058
+ if (ch === "[") {
2059
+ bracket++;
2060
+ } else if (ch === "]" && bracket > 0) {
2061
+ bracket--;
2062
+ } else if (bracket === 0) {
2063
+ if (ch === "(") {
2064
+ paren++;
2065
+ } else if (ch === ")" && paren > 0) {
2066
+ paren--;
2067
+ } else if (ch === "|" && paren === 0) {
2068
+ parts.push(value);
2069
+ value = "";
2070
+ continue;
2071
+ }
2072
+ }
2073
+ }
2074
+ value += ch;
2075
+ }
2076
+ parts.push(value);
2077
+ return parts;
2078
+ };
2079
+ var isPlainBranch = (branch) => {
2080
+ let escaped = false;
2081
+ for (const ch of branch) {
2082
+ if (escaped === true) {
2083
+ escaped = false;
2084
+ continue;
2085
+ }
2086
+ if (ch === "\\") {
2087
+ escaped = true;
2088
+ continue;
2089
+ }
2090
+ if (/[?*+@!()[\]{}]/.test(ch)) {
2091
+ return false;
2092
+ }
2093
+ }
2094
+ return true;
2095
+ };
2096
+ var normalizeSimpleBranch = (branch) => {
2097
+ let value = branch.trim();
2098
+ let changed = true;
2099
+ while (changed === true) {
2100
+ changed = false;
2101
+ if (/^@\([^\\()[\]{}|]+\)$/.test(value)) {
2102
+ value = value.slice(2, -1);
2103
+ changed = true;
2104
+ }
2105
+ }
2106
+ if (!isPlainBranch(value)) {
2107
+ return;
2108
+ }
2109
+ return value.replace(/\\(.)/g, "$1");
2110
+ };
2111
+ var hasRepeatedCharPrefixOverlap = (branches) => {
2112
+ const values = branches.map(normalizeSimpleBranch).filter(Boolean);
2113
+ for (let i = 0; i < values.length; i++) {
2114
+ for (let j = i + 1; j < values.length; j++) {
2115
+ const a = values[i];
2116
+ const b = values[j];
2117
+ const char = a[0];
2118
+ if (!char || a !== char.repeat(a.length) || b !== char.repeat(b.length)) {
2119
+ continue;
2120
+ }
2121
+ if (a === b || a.startsWith(b) || b.startsWith(a)) {
2122
+ return true;
2123
+ }
2124
+ }
2125
+ }
2126
+ return false;
2127
+ };
2128
+ var parseRepeatedExtglob = (pattern, requireEnd = true) => {
2129
+ if (pattern[0] !== "+" && pattern[0] !== "*" || pattern[1] !== "(") {
2130
+ return;
2131
+ }
2132
+ let bracket = 0;
2133
+ let paren = 0;
2134
+ let quote = 0;
2135
+ let escaped = false;
2136
+ for (let i = 1; i < pattern.length; i++) {
2137
+ const ch = pattern[i];
2138
+ if (escaped === true) {
2139
+ escaped = false;
2140
+ continue;
2141
+ }
2142
+ if (ch === "\\") {
2143
+ escaped = true;
2144
+ continue;
2145
+ }
2146
+ if (ch === '"') {
2147
+ quote = quote === 1 ? 0 : 1;
2148
+ continue;
2149
+ }
2150
+ if (quote === 1) {
2151
+ continue;
2152
+ }
2153
+ if (ch === "[") {
2154
+ bracket++;
2155
+ continue;
2156
+ }
2157
+ if (ch === "]" && bracket > 0) {
2158
+ bracket--;
2159
+ continue;
2160
+ }
2161
+ if (bracket > 0) {
2162
+ continue;
2163
+ }
2164
+ if (ch === "(") {
2165
+ paren++;
2166
+ continue;
2167
+ }
2168
+ if (ch === ")") {
2169
+ paren--;
2170
+ if (paren === 0) {
2171
+ if (requireEnd === true && i !== pattern.length - 1) {
2172
+ return;
2173
+ }
2174
+ return {
2175
+ type: pattern[0],
2176
+ body: pattern.slice(2, i),
2177
+ end: i
2178
+ };
2179
+ }
2180
+ }
2181
+ }
2182
+ };
2183
+ var getStarExtglobSequenceOutput = (pattern) => {
2184
+ let index3 = 0;
2185
+ const chars = [];
2186
+ while (index3 < pattern.length) {
2187
+ const match = parseRepeatedExtglob(pattern.slice(index3), false);
2188
+ if (!match || match.type !== "*") {
2189
+ return;
2190
+ }
2191
+ const branches = splitTopLevel(match.body).map((branch2) => branch2.trim());
2192
+ if (branches.length !== 1) {
2193
+ return;
2194
+ }
2195
+ const branch = normalizeSimpleBranch(branches[0]);
2196
+ if (!branch || branch.length !== 1) {
2197
+ return;
2198
+ }
2199
+ chars.push(branch);
2200
+ index3 += match.end + 1;
2201
+ }
2202
+ if (chars.length < 1) {
2203
+ return;
2204
+ }
2205
+ const source = chars.length === 1 ? utils.escapeRegex(chars[0]) : `[${chars.map((ch) => utils.escapeRegex(ch)).join("")}]`;
2206
+ return `${source}*`;
2207
+ };
2208
+ var repeatedExtglobRecursion = (pattern) => {
2209
+ let depth = 0;
2210
+ let value = pattern.trim();
2211
+ let match = parseRepeatedExtglob(value);
2212
+ while (match) {
2213
+ depth++;
2214
+ value = match.body.trim();
2215
+ match = parseRepeatedExtglob(value);
2216
+ }
2217
+ return depth;
2218
+ };
2219
+ var analyzeRepeatedExtglob = (body3, options2) => {
2220
+ if (options2.maxExtglobRecursion === false) {
2221
+ return { risky: false };
2222
+ }
2223
+ const max = typeof options2.maxExtglobRecursion === "number" ? options2.maxExtglobRecursion : constants2.DEFAULT_MAX_EXTGLOB_RECURSION;
2224
+ const branches = splitTopLevel(body3).map((branch) => branch.trim());
2225
+ if (branches.length > 1) {
2226
+ if (branches.some((branch) => branch === "") || branches.some((branch) => /^[*?]+$/.test(branch)) || hasRepeatedCharPrefixOverlap(branches)) {
2227
+ return { risky: true };
2228
+ }
2229
+ }
2230
+ for (const branch of branches) {
2231
+ const safeOutput = getStarExtglobSequenceOutput(branch);
2232
+ if (safeOutput) {
2233
+ return { risky: true, safeOutput };
2234
+ }
2235
+ if (repeatedExtglobRecursion(branch) > max) {
2236
+ return { risky: true };
2237
+ }
2238
+ }
2239
+ return { risky: false };
2240
+ };
2026
2241
  var parse4 = (input, options2) => {
2027
2242
  if (typeof input !== "string") {
2028
2243
  throw new TypeError("Expected a string");
@@ -2037,8 +2252,7 @@ var require_parse2 = __commonJS({
2037
2252
  const bos = { type: "bos", value: "", output: opts.prepend || "" };
2038
2253
  const tokens = [bos];
2039
2254
  const capture = opts.capture ? "" : "?:";
2040
- const win32 = utils.isWindows(options2);
2041
- const PLATFORM_CHARS = constants2.globChars(win32);
2255
+ const PLATFORM_CHARS = constants2.globChars(opts.windows);
2042
2256
  const EXTGLOB_CHARS = constants2.extglobChars(PLATFORM_CHARS);
2043
2257
  const {
2044
2258
  DOT_LITERAL,
@@ -2141,8 +2355,8 @@ var require_parse2 = __commonJS({
2141
2355
  }
2142
2356
  if (tok.value || tok.output) append(tok);
2143
2357
  if (prev && prev.type === "text" && tok.type === "text") {
2358
+ prev.output = (prev.output || prev.value) + tok.value;
2144
2359
  prev.value += tok.value;
2145
- prev.output = (prev.output || "") + tok.value;
2146
2360
  return;
2147
2361
  }
2148
2362
  tok.prev = prev;
@@ -2154,6 +2368,8 @@ var require_parse2 = __commonJS({
2154
2368
  token.prev = prev;
2155
2369
  token.parens = state.parens;
2156
2370
  token.output = state.output;
2371
+ token.startIndex = state.index;
2372
+ token.tokensIndex = tokens.length;
2157
2373
  const output = (opts.capture ? "(" : "") + token.open;
2158
2374
  increment2("parens");
2159
2375
  push({ type, value: value2, output: state.output ? "" : ONE_CHAR });
@@ -2161,6 +2377,26 @@ var require_parse2 = __commonJS({
2161
2377
  extglobs.push(token);
2162
2378
  };
2163
2379
  const extglobClose = (token) => {
2380
+ const literal = input.slice(token.startIndex, state.index + 1);
2381
+ const body3 = input.slice(token.startIndex + 2, state.index);
2382
+ const analysis = analyzeRepeatedExtglob(body3, opts);
2383
+ if ((token.type === "plus" || token.type === "star") && analysis.risky) {
2384
+ const safeOutput = analysis.safeOutput ? (token.output ? "" : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput) : void 0;
2385
+ const open = tokens[token.tokensIndex];
2386
+ open.type = "text";
2387
+ open.value = literal;
2388
+ open.output = safeOutput || utils.escapeRegex(literal);
2389
+ for (let i = token.tokensIndex + 1; i < tokens.length; i++) {
2390
+ tokens[i].value = "";
2391
+ tokens[i].output = "";
2392
+ delete tokens[i].suffix;
2393
+ }
2394
+ state.output = token.output + open.output;
2395
+ state.backtrack = true;
2396
+ push({ type: "paren", extglob: true, value, output: "" });
2397
+ decrement("parens");
2398
+ return;
2399
+ }
2164
2400
  let output = token.close + (opts.capture ? ")" : "");
2165
2401
  let rest;
2166
2402
  if (token.type === "negate") {
@@ -2478,9 +2714,6 @@ var require_parse2 = __commonJS({
2478
2714
  if (prev && prev.type === "paren") {
2479
2715
  const next = peek();
2480
2716
  let output = value;
2481
- if (next === "<" && !utils.supportsLookbehinds()) {
2482
- throw new Error("Node.js v10 or higher is required for regex lookbehinds");
2483
- }
2484
2717
  if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) {
2485
2718
  output = `\\${value}`;
2486
2719
  }
@@ -2705,7 +2938,6 @@ var require_parse2 = __commonJS({
2705
2938
  throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
2706
2939
  }
2707
2940
  input = REPLACEMENTS[input] || input;
2708
- const win32 = utils.isWindows(options2);
2709
2941
  const {
2710
2942
  DOT_LITERAL,
2711
2943
  SLASH_LITERAL,
@@ -2716,7 +2948,7 @@ var require_parse2 = __commonJS({
2716
2948
  NO_DOTS_SLASH,
2717
2949
  STAR,
2718
2950
  START_ANCHOR
2719
- } = constants2.globChars(win32);
2951
+ } = constants2.globChars(opts.windows);
2720
2952
  const nodot = opts.dot ? NO_DOTS : NO_DOT;
2721
2953
  const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
2722
2954
  const capture = opts.capture ? "" : "?:";
@@ -2767,11 +2999,10 @@ var require_parse2 = __commonJS({
2767
2999
  }
2768
3000
  });
2769
3001
 
2770
- // ../../node_modules/micromatch/node_modules/picomatch/lib/picomatch.js
3002
+ // ../../node_modules/picomatch/lib/picomatch.js
2771
3003
  var require_picomatch = __commonJS({
2772
- "../../node_modules/micromatch/node_modules/picomatch/lib/picomatch.js"(exports2, module2) {
3004
+ "../../node_modules/picomatch/lib/picomatch.js"(exports2, module2) {
2773
3005
  "use strict";
2774
- var path5 = require("path");
2775
3006
  var scan = require_scan();
2776
3007
  var parse4 = require_parse2();
2777
3008
  var utils = require_utils2();
@@ -2794,7 +3025,7 @@ var require_picomatch = __commonJS({
2794
3025
  throw new TypeError("Expected pattern to be a non-empty string");
2795
3026
  }
2796
3027
  const opts = options2 || {};
2797
- const posix = utils.isWindows(options2);
3028
+ const posix = opts.windows;
2798
3029
  const regex3 = isState ? picomatch.compileRe(glob2, options2) : picomatch.makeRe(glob2, options2, false, true);
2799
3030
  const state = regex3.state;
2800
3031
  delete regex3.state;
@@ -2854,9 +3085,9 @@ var require_picomatch = __commonJS({
2854
3085
  }
2855
3086
  return { isMatch: Boolean(match), match, output };
2856
3087
  };
2857
- picomatch.matchBase = (input, glob2, options2, posix = utils.isWindows(options2)) => {
3088
+ picomatch.matchBase = (input, glob2, options2) => {
2858
3089
  const regex3 = glob2 instanceof RegExp ? glob2 : picomatch.makeRe(glob2, options2);
2859
- return regex3.test(path5.basename(input));
3090
+ return regex3.test(utils.basename(input));
2860
3091
  };
2861
3092
  picomatch.isMatch = (str2, patterns, options2) => picomatch(patterns, options2)(str2);
2862
3093
  picomatch.parse = (pattern, options2) => {
@@ -2908,11 +3139,20 @@ var require_picomatch = __commonJS({
2908
3139
  }
2909
3140
  });
2910
3141
 
2911
- // ../../node_modules/micromatch/node_modules/picomatch/index.js
3142
+ // ../../node_modules/picomatch/index.js
2912
3143
  var require_picomatch2 = __commonJS({
2913
- "../../node_modules/micromatch/node_modules/picomatch/index.js"(exports2, module2) {
3144
+ "../../node_modules/picomatch/index.js"(exports2, module2) {
2914
3145
  "use strict";
2915
- module2.exports = require_picomatch();
3146
+ var pico = require_picomatch();
3147
+ var utils = require_utils2();
3148
+ function picomatch(glob2, options2, returnState = false) {
3149
+ if (options2 && (options2.windows === null || options2.windows === void 0)) {
3150
+ options2 = { ...options2, windows: utils.isWindows() };
3151
+ }
3152
+ return pico(glob2, options2, returnState);
3153
+ }
3154
+ Object.assign(picomatch, pico);
3155
+ module2.exports = picomatch;
2916
3156
  }
2917
3157
  });
2918
3158