@proxysoul/soulforge 2.1.1 → 2.2.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.
@@ -16150,7 +16150,7 @@ function toRegExpDetails(pattern, options) {
16150
16150
  }
16151
16151
  return details;
16152
16152
  }
16153
- var cp, r3, envFlags, EsVersion, Target, asciiSpaceChar = "[\t-\r ]", CharsWithoutIgnoreCaseExpansion, defaultWordChar, JsUnicodePropertyMap, LowerToAlternativeLowerCaseMap, LowerToAlternativeUpperCaseMap, LowerToTitleCaseMap, PosixClassMap, UnicodePropertiesWithSpecificCase, FirstPassVisitor, SecondPassVisitor, ThirdPassVisitor, FlagModifierVisitor, generator, BaseEscapeChars, CharClassEscapeChars, CharClassEscapeCharsFlagV, CharCodeEscapeMap, casedRe, EmulatedRegExp;
16153
+ var cp, r3, envFlags, globalRegExp, EsVersion, Target, asciiSpaceChar = "[\t-\r ]", CharsWithoutIgnoreCaseExpansion, defaultWordChar, JsUnicodePropertyMap, LowerToAlternativeLowerCaseMap, LowerToAlternativeUpperCaseMap, LowerToTitleCaseMap, PosixClassMap, UnicodePropertiesWithSpecificCase, FirstPassVisitor, SecondPassVisitor, ThirdPassVisitor, FlagModifierVisitor, generator, BaseEscapeChars, CharClassEscapeChars, CharClassEscapeCharsFlagV, CharCodeEscapeMap, casedRe, EmulatedRegExp;
16154
16154
  var init_esm = __esm(() => {
16155
16155
  init_parse();
16156
16156
  init_parse();
@@ -16162,33 +16162,33 @@ var init_esm = __esm(() => {
16162
16162
  init_src2();
16163
16163
  cp = String.fromCodePoint;
16164
16164
  r3 = String.raw;
16165
- envFlags = {
16166
- flagGroups: (() => {
16167
- try {
16168
- new RegExp("(?i:)");
16169
- } catch {
16170
- return false;
16171
- }
16172
- return true;
16173
- })(),
16174
- unicodeSets: (() => {
16175
- try {
16176
- new RegExp("[[]]", "v");
16177
- } catch {
16178
- return false;
16179
- }
16180
- return true;
16181
- })()
16182
- };
16165
+ envFlags = {};
16166
+ globalRegExp = globalThis.RegExp;
16167
+ envFlags.flagGroups = (() => {
16168
+ try {
16169
+ new globalRegExp("(?i:)");
16170
+ } catch {
16171
+ return false;
16172
+ }
16173
+ return true;
16174
+ })();
16175
+ envFlags.unicodeSets = (() => {
16176
+ try {
16177
+ new globalRegExp("[[]]", "v");
16178
+ } catch {
16179
+ return false;
16180
+ }
16181
+ return true;
16182
+ })();
16183
16183
  envFlags.bugFlagVLiteralHyphenIsRange = envFlags.unicodeSets ? (() => {
16184
16184
  try {
16185
- new RegExp(r3`[\d\-a]`, "v");
16185
+ new globalRegExp(r3`[\d\-a]`, "v");
16186
16186
  } catch {
16187
16187
  return true;
16188
16188
  }
16189
16189
  return false;
16190
16190
  })() : false;
16191
- envFlags.bugNestedClassIgnoresNegation = envFlags.unicodeSets && new RegExp("[[^a]]", "v").test("a");
16191
+ envFlags.bugNestedClassIgnoresNegation = envFlags.unicodeSets && new globalRegExp("[[^a]]", "v").test("a");
16192
16192
  EsVersion = {
16193
16193
  ES2025: 2025,
16194
16194
  ES2024: 2024,
@@ -23992,7 +23992,7 @@ async function findImplementation(filePath, line, col) {
23992
23992
  textDocument = { uri = vim.uri_from_fname(filepath) },
23993
23993
  position = { line = ${String(line)}, character = ${String(col)} },
23994
23994
  }
23995
- local results = vim.lsp.buf_request_sync(bufnr, 'textDocument/implementation', params, 5000)
23995
+ local results = vim.lsp.buf_request_sync(bufnr, 'textDocument/implementation', params, 15000)
23996
23996
  if not results then return '[]' end
23997
23997
  local impls = {}
23998
23998
  for _, res in pairs(results) do
@@ -27624,8 +27624,9 @@ class CodeIntelligenceRouter {
27624
27624
  add(lang254);
27625
27625
  }
27626
27626
  const SKIP = new Set(["node_modules", ".git", "dist", "build", "out", "vendor", "__pycache__", ".venv", "venv", "target", ".next", ".nuxt", ".output", "coverage", ".turbo", ".cache"]);
27627
- const MAX_DEPTH2 = 3;
27628
- const MAX_DIRS = 100;
27627
+ const hasJvm = found.some((l3) => l3 === "java" || l3 === "kotlin" || l3 === "scala");
27628
+ const MAX_DEPTH2 = hasJvm ? 8 : 3;
27629
+ const MAX_DIRS = hasJvm ? 500 : 100;
27629
27630
  const queue = [{
27630
27631
  dir: this.cwd,
27631
27632
  depth: 0
@@ -27673,8 +27674,9 @@ class CodeIntelligenceRouter {
27673
27674
  if (exts.length === 0)
27674
27675
  return null;
27675
27676
  const SKIP = new Set(["node_modules", ".git", "dist", "build", "out", "vendor", "__pycache__", ".venv", "venv", "target", ".next", ".nuxt", ".output", "coverage", ".turbo", ".cache"]);
27676
- const MAX_DEPTH2 = 4;
27677
- const MAX_DIRS = 200;
27677
+ const isJvmLanguage = language === "java" || language === "kotlin" || language === "scala";
27678
+ const MAX_DEPTH2 = isJvmLanguage ? 10 : 4;
27679
+ const MAX_DIRS = isJvmLanguage ? 500 : 200;
27678
27680
  const queue = [{
27679
27681
  dir: this.cwd,
27680
27682
  depth: 0
@@ -27777,16 +27779,16 @@ class CodeIntelligenceRouter {
27777
27779
  label: `findImplementation(${probeSymbolName})`,
27778
27780
  fn: (b3, f3) => b3.findImplementation?.(f3, probeSymbolName) ?? Promise.resolve(null)
27779
27781
  }];
27780
- const probeOp = async (fn, label, probes) => {
27782
+ const probeOp = async (fn, label, probes, timeout = OP_TIMEOUT) => {
27781
27783
  const start2 = performance.now();
27782
27784
  try {
27783
- const result = await Promise.race([fn(), new Promise((r4) => setTimeout(() => r4("timeout"), OP_TIMEOUT))]);
27785
+ const result = await Promise.race([fn(), new Promise((r4) => setTimeout(() => r4("timeout"), timeout))]);
27784
27786
  const ms = Math.round(performance.now() - start2);
27785
27787
  if (result === "timeout") {
27786
27788
  probes.push({
27787
27789
  operation: label,
27788
27790
  status: "timeout",
27789
- ms: OP_TIMEOUT
27791
+ ms: timeout
27790
27792
  });
27791
27793
  } else if (result === null || result === undefined) {
27792
27794
  probes.push({
@@ -27878,13 +27880,43 @@ class CodeIntelligenceRouter {
27878
27880
  }
27879
27881
  }
27880
27882
  const hasStandaloneProbe = backend.name === "lsp" && "probeStandalone" in backend && typeof backend.probeStandalone === "function";
27881
- if (hasStandaloneProbe && probeFile && !initError) {
27883
+ if (hasStandaloneProbe && !initError) {
27882
27884
  const lsp = backend;
27885
+ if (!probeFile) {
27886
+ updateBackend("lsp:nvim", {
27887
+ initialized: this.initialized.has(backend.name),
27888
+ initMs,
27889
+ initError,
27890
+ probes: fileOps.map(({
27891
+ label
27892
+ }) => ({
27893
+ operation: label,
27894
+ status: "empty",
27895
+ error: "no source file found in project"
27896
+ }))
27897
+ });
27898
+ updateBackend("lsp:standalone", {
27899
+ initialized: this.initialized.has(backend.name),
27900
+ initError,
27901
+ probes: fileOps.map(({
27902
+ label
27903
+ }) => ({
27904
+ operation: label,
27905
+ status: "empty",
27906
+ error: "no source file found in project"
27907
+ }))
27908
+ });
27909
+ continue;
27910
+ }
27883
27911
  if (lsp.warmupNvim) {
27884
- try {
27885
- await Promise.race([lsp.warmupNvim(probeFile), new Promise((r4) => setTimeout(() => r4(false), 25000))]);
27886
- } catch {}
27912
+ const nvimAvailable = lsp.isNvimAvailable?.() ?? false;
27913
+ if (nvimAvailable) {
27914
+ try {
27915
+ await Promise.race([lsp.warmupNvim(probeFile), new Promise((r4) => setTimeout(() => r4(false), 25000))]);
27916
+ } catch {}
27917
+ }
27887
27918
  }
27919
+ const IMPL_TIMEOUT = 20000;
27888
27920
  const nvimProbes = [];
27889
27921
  for (const {
27890
27922
  op,
@@ -27898,7 +27930,8 @@ class CodeIntelligenceRouter {
27898
27930
  });
27899
27931
  continue;
27900
27932
  }
27901
- await probeOp(() => fn(backend, probeFile), label, nvimProbes);
27933
+ const t = op === "findImplementation" ? IMPL_TIMEOUT : OP_TIMEOUT;
27934
+ await probeOp(() => fn(backend, probeFile), label, nvimProbes, t);
27902
27935
  }
27903
27936
  updateBackend("lsp:nvim", {
27904
27937
  initialized: this.initialized.has(backend.name),
@@ -27921,7 +27954,8 @@ class CodeIntelligenceRouter {
27921
27954
  });
27922
27955
  continue;
27923
27956
  }
27924
- await probeOp(() => lsp.probeStandalone(probeFile, op), label, standaloneProbes);
27957
+ const t = op === "findImplementation" ? IMPL_TIMEOUT : OP_TIMEOUT;
27958
+ await probeOp(() => lsp.probeStandalone(probeFile, op), label, standaloneProbes, t);
27925
27959
  }
27926
27960
  updateBackend("lsp:standalone", {
27927
27961
  initialized: true,
@@ -29361,6 +29395,16 @@ var init_errors = __esm(() => {
29361
29395
  })));
29362
29396
  });
29363
29397
 
29398
+ // src/core/process-tracker.ts
29399
+ function trackProcess(proc) {
29400
+ tracked.add(proc);
29401
+ proc.on("exit", () => tracked.delete(proc));
29402
+ }
29403
+ var tracked;
29404
+ var init_process_tracker = __esm(() => {
29405
+ tracked = new Set;
29406
+ });
29407
+
29364
29408
  // src/core/intelligence/backends/lsp/standalone-client.ts
29365
29409
  import { spawn } from "child_process";
29366
29410
  import { readFile as readFile3 } from "fs/promises";
@@ -29390,6 +29434,7 @@ class StandaloneLspClient {
29390
29434
  stdio: ["pipe", "pipe", "pipe"],
29391
29435
  cwd: this.cwd
29392
29436
  });
29437
+ trackProcess(this.process);
29393
29438
  this.process.stdout?.on("data", (chunk) => this.onData(chunk));
29394
29439
  this.process.on("exit", (code, signal) => {
29395
29440
  this.process = null;
@@ -29556,7 +29601,7 @@ class StandaloneLspClient {
29556
29601
  }
29557
29602
  return;
29558
29603
  }
29559
- const languageId = this.config.language === "typescript" ? "typescript" : this.config.language === "javascript" ? "javascript" : this.config.language === "python" ? "python" : this.config.language === "go" ? "go" : this.config.language === "rust" ? "rust" : "plaintext";
29604
+ const languageId = LANGUAGE_ID_MAP[this.config.language] ?? this.config.language;
29560
29605
  this.notify("textDocument/didOpen", {
29561
29606
  textDocument: {
29562
29607
  uri,
@@ -29926,9 +29971,40 @@ function normalizeLocations(result) {
29926
29971
  }
29927
29972
  return [result];
29928
29973
  }
29974
+ var LANGUAGE_ID_MAP;
29929
29975
  var init_standalone_client = __esm(() => {
29930
29976
  init_errors();
29977
+ init_process_tracker();
29931
29978
  init_protocol();
29979
+ LANGUAGE_ID_MAP = {
29980
+ typescript: "typescript",
29981
+ javascript: "javascript",
29982
+ python: "python",
29983
+ go: "go",
29984
+ rust: "rust",
29985
+ java: "java",
29986
+ kotlin: "kotlin",
29987
+ scala: "scala",
29988
+ csharp: "csharp",
29989
+ swift: "swift",
29990
+ dart: "dart",
29991
+ elixir: "elixir",
29992
+ ocaml: "ocaml",
29993
+ lua: "lua",
29994
+ c: "c",
29995
+ cpp: "cpp",
29996
+ ruby: "ruby",
29997
+ php: "php",
29998
+ zig: "zig",
29999
+ bash: "shellscript",
30000
+ css: "css",
30001
+ html: "html",
30002
+ json: "json",
30003
+ toml: "toml",
30004
+ yaml: "yaml",
30005
+ dockerfile: "dockerfile",
30006
+ vue: "vue"
30007
+ };
29932
30008
  });
29933
30009
 
29934
30010
  // src/core/intelligence/backends/lsp/index.ts
@@ -29936,7 +30012,7 @@ var exports_lsp = {};
29936
30012
  __export(exports_lsp, {
29937
30013
  LspBackend: () => LspBackend
29938
30014
  });
29939
- import { existsSync as existsSync7 } from "fs";
30015
+ import { existsSync as existsSync7, readdirSync as readdirSync3 } from "fs";
29940
30016
  import { readdir as readdir2, readFile as readFile4 } from "fs/promises";
29941
30017
  import { dirname as dirname3, join as join9, resolve as resolve5 } from "path";
29942
30018
  function getNvimBridge() {
@@ -30688,6 +30764,9 @@ class LspBackend {
30688
30764
  await new Promise((r4) => setTimeout(r4, 500));
30689
30765
  }
30690
30766
  }
30767
+ isNvimAvailable() {
30768
+ return nvimBridge.isNvimAvailable();
30769
+ }
30691
30770
  async warmupNvim(file) {
30692
30771
  if (!nvimBridge.isNvimAvailable())
30693
30772
  return false;
@@ -31094,8 +31173,22 @@ function findProjectRootForLanguage(file, language) {
31094
31173
  return null;
31095
31174
  let dir = dirname3(resolve5(file));
31096
31175
  const root2 = resolve5("/");
31097
- while (dir !== root2) {
31098
- for (const marker of markers) {
31176
+ const MAX_DIRS = 100;
31177
+ let dirCount = 0;
31178
+ while (dir !== root2 && dirCount < MAX_DIRS) {
31179
+ dirCount++;
31180
+ const extMarkers = markers.filter((m3) => m3.startsWith(".") && !m3.includes("/"));
31181
+ const nameMarkers = markers.filter((m3) => !m3.startsWith(".") || m3.includes("/"));
31182
+ if (extMarkers.length > 0) {
31183
+ try {
31184
+ const entries = readdirSync3(dir);
31185
+ for (const marker of extMarkers) {
31186
+ if (entries.some((e) => e.endsWith(marker)))
31187
+ return dir;
31188
+ }
31189
+ } catch {}
31190
+ }
31191
+ for (const marker of nameMarkers) {
31099
31192
  if (existsSync7(join9(dir, marker)))
31100
31193
  return dir;
31101
31194
  }
@@ -31127,15 +31220,24 @@ var init_lsp = __esm(() => {
31127
31220
  return mod[prop];
31128
31221
  }
31129
31222
  });
31130
- SUPPORTED_LANGUAGES = new Set(["typescript", "javascript", "python", "go", "rust", "lua", "c", "cpp", "ruby", "php", "zig", "bash", "css", "html", "json", "yaml", "dockerfile"]);
31223
+ SUPPORTED_LANGUAGES = new Set(["typescript", "javascript", "python", "go", "rust", "java", "kotlin", "scala", "csharp", "swift", "dart", "elixir", "ocaml", "lua", "c", "cpp", "ruby", "php", "zig", "bash", "css", "html", "json", "toml", "yaml", "dockerfile", "vue"]);
31131
31224
  PROJECT_FILES = {
31132
31225
  typescript: ["tsconfig.json"],
31133
31226
  javascript: ["jsconfig.json", "tsconfig.json"],
31134
31227
  python: ["pyproject.toml", "setup.py"],
31135
31228
  go: ["go.mod"],
31136
- rust: ["Cargo.toml"]
31229
+ rust: ["Cargo.toml"],
31230
+ java: ["pom.xml", "build.gradle", "build.gradle.kts", "settings.gradle", "settings.gradle.kts"],
31231
+ kotlin: ["build.gradle.kts", "build.gradle", "settings.gradle.kts", "settings.gradle"],
31232
+ scala: ["build.sbt"],
31233
+ csharp: [".csproj", ".sln"],
31234
+ dart: ["pubspec.yaml"],
31235
+ elixir: ["mix.exs"],
31236
+ ruby: ["Gemfile"],
31237
+ php: ["composer.json"],
31238
+ swift: ["Package.swift"]
31137
31239
  };
31138
- DEFINITION_KEYWORDS = /\b(function|class|const|let|var|type|interface|enum|struct|trait|fn|def|func|impl|mod|pub)\b/;
31240
+ DEFINITION_KEYWORDS = /\b(function|class|const|let|var|type|interface|enum|struct|trait|fn|def|func|impl|mod|pub|public|private|protected|static|void|abstract|override|sealed|record|annotation|object|fun|suspend|data|inline|operator|infix|external|companion|lateinit|val)\b/;
31139
31241
  });
31140
31242
 
31141
31243
  // node_modules/@ts-morph/common/dist/typescript.js
@@ -200018,7 +200120,7 @@ var require_commonjs2 = __commonJS((exports) => {
200018
200120
  const x2 = numeric(n[0]);
200019
200121
  const y3 = numeric(n[1]);
200020
200122
  const width = Math.max(n[0].length, n[1].length);
200021
- let incr = n.length === 3 && n[2] !== undefined ? Math.abs(numeric(n[2])) : 1;
200123
+ let incr = n.length === 3 && n[2] !== undefined ? Math.max(Math.abs(numeric(n[2])), 1) : 1;
200022
200124
  let test = lte;
200023
200125
  const reverse = y3 < x2;
200024
200126
  if (reverse) {
@@ -200206,9 +200308,9 @@ var require_unescape = __commonJS((exports) => {
200206
200308
  exports.unescape = undefined;
200207
200309
  var unescape = (s2, { windowsPathsNoEscape = false, magicalBraces = true } = {}) => {
200208
200310
  if (magicalBraces) {
200209
- return windowsPathsNoEscape ? s2.replace(/\[([^\/\\])\]/g, "$1") : s2.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1");
200311
+ return windowsPathsNoEscape ? s2.replace(/\[([^/\\])\]/g, "$1") : s2.replace(/((?!\\).|^)\[([^/\\])\]/g, "$1$2").replace(/\\([^/])/g, "$1");
200210
200312
  }
200211
- return windowsPathsNoEscape ? s2.replace(/\[([^\/\\{}])\]/g, "$1") : s2.replace(/((?!\\).|^)\[([^\/\\{}])\]/g, "$1$2").replace(/\\([^\/{}])/g, "$1");
200313
+ return windowsPathsNoEscape ? s2.replace(/\[([^/\\{}])\]/g, "$1") : s2.replace(/((?!\\).|^)\[([^/\\{}])\]/g, "$1$2").replace(/\\([^/{}])/g, "$1");
200212
200314
  };
200213
200315
  exports.unescape = unescape;
200214
200316
  });
@@ -200333,13 +200435,7 @@ var require_ast = __commonJS((exports) => {
200333
200435
  return this.#hasMagic;
200334
200436
  }
200335
200437
  toString() {
200336
- if (this.#toString !== undefined)
200337
- return this.#toString;
200338
- if (!this.type) {
200339
- return this.#toString = this.#parts.map((p2) => String(p2)).join("");
200340
- } else {
200341
- return this.#toString = this.type + "(" + this.#parts.map((p2) => String(p2)).join("|") + ")";
200342
- }
200438
+ return this.#toString !== undefined ? this.#toString : !this.type ? this.#toString = this.#parts.map((p2) => String(p2)).join("") : this.#toString = this.type + "(" + this.#parts.map((p2) => String(p2)).join("|") + ")";
200343
200439
  }
200344
200440
  #fillNegs() {
200345
200441
  if (this !== this.#root)
@@ -200818,7 +200914,7 @@ var require_commonjs3 = __commonJS((exports) => {
200818
200914
  return new Minimatch(pattern, options).match(p2);
200819
200915
  };
200820
200916
  exports.minimatch = minimatch;
200821
- var starDotExtRE = /^\*+([^+@!?\*\[\(]*)$/;
200917
+ var starDotExtRE = /^\*+([^+@!?*[(]*)$/;
200822
200918
  var starDotExtTest = (ext2) => (f3) => !f3.startsWith(".") && f3.endsWith(ext2);
200823
200919
  var starDotExtTestDot = (ext2) => (f3) => f3.endsWith(ext2);
200824
200920
  var starDotExtTestNocase = (ext2) => {
@@ -200837,7 +200933,7 @@ var require_commonjs3 = __commonJS((exports) => {
200837
200933
  var starRE = /^\*+$/;
200838
200934
  var starTest = (f3) => f3.length !== 0 && !f3.startsWith(".");
200839
200935
  var starTestDot = (f3) => f3.length !== 0 && f3 !== "." && f3 !== "..";
200840
- var qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
200936
+ var qmarksRE = /^\?+([^+@!?*[(]*)?$/;
200841
200937
  var qmarksTestNocase = ([$0, ext2 = ""]) => {
200842
200938
  const noext = qmarksTestNoExt([$0]);
200843
200939
  if (!ext2)
@@ -201054,10 +201150,10 @@ var require_commonjs3 = __commonJS((exports) => {
201054
201150
  }
201055
201151
  preprocess(globParts) {
201056
201152
  if (this.options.noglobstar) {
201057
- for (let i4 = 0;i4 < globParts.length; i4++) {
201058
- for (let j2 = 0;j2 < globParts[i4].length; j2++) {
201059
- if (globParts[i4][j2] === "**") {
201060
- globParts[i4][j2] = "*";
201153
+ for (const partset of globParts) {
201154
+ for (let j2 = 0;j2 < partset.length; j2++) {
201155
+ if (partset[j2] === "**") {
201156
+ partset[j2] = "*";
201061
201157
  }
201062
201158
  }
201063
201159
  }
@@ -201133,7 +201229,7 @@ var require_commonjs3 = __commonJS((exports) => {
201133
201229
  let dd2 = 0;
201134
201230
  while ((dd2 = parts2.indexOf("..", dd2 + 1)) !== -1) {
201135
201231
  const p2 = parts2[dd2 - 1];
201136
- if (p2 && p2 !== "." && p2 !== ".." && p2 !== "**") {
201232
+ if (p2 && p2 !== "." && p2 !== ".." && p2 !== "**" && !(this.isWindows && /^[a-z]:$/i.test(p2))) {
201137
201233
  didSomething = true;
201138
201234
  parts2.splice(dd2 - 1, 2);
201139
201235
  dd2 -= 2;
@@ -201517,7 +201613,7 @@ var require_commonjs3 = __commonJS((exports) => {
201517
201613
  re3 = "^(?!" + re3 + ").+$";
201518
201614
  try {
201519
201615
  this.regexp = new RegExp(re3, [...flags2].join(""));
201520
- } catch (ex) {
201616
+ } catch {
201521
201617
  this.regexp = false;
201522
201618
  }
201523
201619
  return this.regexp;
@@ -201525,7 +201621,7 @@ var require_commonjs3 = __commonJS((exports) => {
201525
201621
  slashSplit(p2) {
201526
201622
  if (this.preserveMultipleSlashes) {
201527
201623
  return p2.split("/");
201528
- } else if (this.isWindows && /^\/\/[^\/]+/.test(p2)) {
201624
+ } else if (this.isWindows && /^\/\/[^/]+/.test(p2)) {
201529
201625
  return ["", ...p2.split(/\/+/)];
201530
201626
  } else {
201531
201627
  return p2.split(/\/+/);
@@ -201556,8 +201652,7 @@ var require_commonjs3 = __commonJS((exports) => {
201556
201652
  filename = ff[i4];
201557
201653
  }
201558
201654
  }
201559
- for (let i4 = 0;i4 < set.length; i4++) {
201560
- const pattern = set[i4];
201655
+ for (const pattern of set) {
201561
201656
  let file = ff;
201562
201657
  if (options.matchBase && pattern.length === 1) {
201563
201658
  file = [filename];
@@ -202021,6 +202116,7 @@ var require_path_browserify = __commonJS((exports, module2) => {
202021
202116
  var require_constants = __commonJS((exports, module2) => {
202022
202117
  var WIN_SLASH = "\\\\/";
202023
202118
  var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
202119
+ var DEFAULT_MAX_EXTGLOB_RECURSION = 0;
202024
202120
  var DOT_LITERAL = "\\.";
202025
202121
  var PLUS_LITERAL = "\\+";
202026
202122
  var QMARK_LITERAL = "\\?";
@@ -202071,6 +202167,7 @@ var require_constants = __commonJS((exports, module2) => {
202071
202167
  SEP: "\\"
202072
202168
  };
202073
202169
  var POSIX_REGEX_SOURCE = {
202170
+ __proto__: null,
202074
202171
  alnum: "a-zA-Z0-9",
202075
202172
  alpha: "a-zA-Z",
202076
202173
  ascii: "\\x00-\\x7F",
@@ -202087,6 +202184,7 @@ var require_constants = __commonJS((exports, module2) => {
202087
202184
  xdigit: "A-Fa-f0-9"
202088
202185
  };
202089
202186
  module2.exports = {
202187
+ DEFAULT_MAX_EXTGLOB_RECURSION,
202090
202188
  MAX_LENGTH: 1024 * 64,
202091
202189
  POSIX_REGEX_SOURCE,
202092
202190
  REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
@@ -202564,6 +202662,213 @@ var require_parse = __commonJS((exports, module2) => {
202564
202662
  var syntaxError = (type, char) => {
202565
202663
  return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
202566
202664
  };
202665
+ var splitTopLevel = (input) => {
202666
+ const parts2 = [];
202667
+ let bracket = 0;
202668
+ let paren = 0;
202669
+ let quote = 0;
202670
+ let value = "";
202671
+ let escaped = false;
202672
+ for (const ch of input) {
202673
+ if (escaped === true) {
202674
+ value += ch;
202675
+ escaped = false;
202676
+ continue;
202677
+ }
202678
+ if (ch === "\\") {
202679
+ value += ch;
202680
+ escaped = true;
202681
+ continue;
202682
+ }
202683
+ if (ch === '"') {
202684
+ quote = quote === 1 ? 0 : 1;
202685
+ value += ch;
202686
+ continue;
202687
+ }
202688
+ if (quote === 0) {
202689
+ if (ch === "[") {
202690
+ bracket++;
202691
+ } else if (ch === "]" && bracket > 0) {
202692
+ bracket--;
202693
+ } else if (bracket === 0) {
202694
+ if (ch === "(") {
202695
+ paren++;
202696
+ } else if (ch === ")" && paren > 0) {
202697
+ paren--;
202698
+ } else if (ch === "|" && paren === 0) {
202699
+ parts2.push(value);
202700
+ value = "";
202701
+ continue;
202702
+ }
202703
+ }
202704
+ }
202705
+ value += ch;
202706
+ }
202707
+ parts2.push(value);
202708
+ return parts2;
202709
+ };
202710
+ var isPlainBranch = (branch) => {
202711
+ let escaped = false;
202712
+ for (const ch of branch) {
202713
+ if (escaped === true) {
202714
+ escaped = false;
202715
+ continue;
202716
+ }
202717
+ if (ch === "\\") {
202718
+ escaped = true;
202719
+ continue;
202720
+ }
202721
+ if (/[?*+@!()[\]{}]/.test(ch)) {
202722
+ return false;
202723
+ }
202724
+ }
202725
+ return true;
202726
+ };
202727
+ var normalizeSimpleBranch = (branch) => {
202728
+ let value = branch.trim();
202729
+ let changed = true;
202730
+ while (changed === true) {
202731
+ changed = false;
202732
+ if (/^@\([^\\()[\]{}|]+\)$/.test(value)) {
202733
+ value = value.slice(2, -1);
202734
+ changed = true;
202735
+ }
202736
+ }
202737
+ if (!isPlainBranch(value)) {
202738
+ return;
202739
+ }
202740
+ return value.replace(/\\(.)/g, "$1");
202741
+ };
202742
+ var hasRepeatedCharPrefixOverlap = (branches) => {
202743
+ const values = branches.map(normalizeSimpleBranch).filter(Boolean);
202744
+ for (let i4 = 0;i4 < values.length; i4++) {
202745
+ for (let j2 = i4 + 1;j2 < values.length; j2++) {
202746
+ const a2 = values[i4];
202747
+ const b3 = values[j2];
202748
+ const char = a2[0];
202749
+ if (!char || a2 !== char.repeat(a2.length) || b3 !== char.repeat(b3.length)) {
202750
+ continue;
202751
+ }
202752
+ if (a2 === b3 || a2.startsWith(b3) || b3.startsWith(a2)) {
202753
+ return true;
202754
+ }
202755
+ }
202756
+ }
202757
+ return false;
202758
+ };
202759
+ var parseRepeatedExtglob = (pattern, requireEnd = true) => {
202760
+ if (pattern[0] !== "+" && pattern[0] !== "*" || pattern[1] !== "(") {
202761
+ return;
202762
+ }
202763
+ let bracket = 0;
202764
+ let paren = 0;
202765
+ let quote = 0;
202766
+ let escaped = false;
202767
+ for (let i4 = 1;i4 < pattern.length; i4++) {
202768
+ const ch = pattern[i4];
202769
+ if (escaped === true) {
202770
+ escaped = false;
202771
+ continue;
202772
+ }
202773
+ if (ch === "\\") {
202774
+ escaped = true;
202775
+ continue;
202776
+ }
202777
+ if (ch === '"') {
202778
+ quote = quote === 1 ? 0 : 1;
202779
+ continue;
202780
+ }
202781
+ if (quote === 1) {
202782
+ continue;
202783
+ }
202784
+ if (ch === "[") {
202785
+ bracket++;
202786
+ continue;
202787
+ }
202788
+ if (ch === "]" && bracket > 0) {
202789
+ bracket--;
202790
+ continue;
202791
+ }
202792
+ if (bracket > 0) {
202793
+ continue;
202794
+ }
202795
+ if (ch === "(") {
202796
+ paren++;
202797
+ continue;
202798
+ }
202799
+ if (ch === ")") {
202800
+ paren--;
202801
+ if (paren === 0) {
202802
+ if (requireEnd === true && i4 !== pattern.length - 1) {
202803
+ return;
202804
+ }
202805
+ return {
202806
+ type: pattern[0],
202807
+ body: pattern.slice(2, i4),
202808
+ end: i4
202809
+ };
202810
+ }
202811
+ }
202812
+ }
202813
+ };
202814
+ var getStarExtglobSequenceOutput = (pattern) => {
202815
+ let index = 0;
202816
+ const chars = [];
202817
+ while (index < pattern.length) {
202818
+ const match = parseRepeatedExtglob(pattern.slice(index), false);
202819
+ if (!match || match.type !== "*") {
202820
+ return;
202821
+ }
202822
+ const branches = splitTopLevel(match.body).map((branch2) => branch2.trim());
202823
+ if (branches.length !== 1) {
202824
+ return;
202825
+ }
202826
+ const branch = normalizeSimpleBranch(branches[0]);
202827
+ if (!branch || branch.length !== 1) {
202828
+ return;
202829
+ }
202830
+ chars.push(branch);
202831
+ index += match.end + 1;
202832
+ }
202833
+ if (chars.length < 1) {
202834
+ return;
202835
+ }
202836
+ const source = chars.length === 1 ? utils.escapeRegex(chars[0]) : `[${chars.map((ch) => utils.escapeRegex(ch)).join("")}]`;
202837
+ return `${source}*`;
202838
+ };
202839
+ var repeatedExtglobRecursion = (pattern) => {
202840
+ let depth = 0;
202841
+ let value = pattern.trim();
202842
+ let match = parseRepeatedExtglob(value);
202843
+ while (match) {
202844
+ depth++;
202845
+ value = match.body.trim();
202846
+ match = parseRepeatedExtglob(value);
202847
+ }
202848
+ return depth;
202849
+ };
202850
+ var analyzeRepeatedExtglob = (body4, options) => {
202851
+ if (options.maxExtglobRecursion === false) {
202852
+ return { risky: false };
202853
+ }
202854
+ const max = typeof options.maxExtglobRecursion === "number" ? options.maxExtglobRecursion : constants2.DEFAULT_MAX_EXTGLOB_RECURSION;
202855
+ const branches = splitTopLevel(body4).map((branch) => branch.trim());
202856
+ if (branches.length > 1) {
202857
+ if (branches.some((branch) => branch === "") || branches.some((branch) => /^[*?]+$/.test(branch)) || hasRepeatedCharPrefixOverlap(branches)) {
202858
+ return { risky: true };
202859
+ }
202860
+ }
202861
+ for (const branch of branches) {
202862
+ const safeOutput = getStarExtglobSequenceOutput(branch);
202863
+ if (safeOutput) {
202864
+ return { risky: true, safeOutput };
202865
+ }
202866
+ if (repeatedExtglobRecursion(branch) > max) {
202867
+ return { risky: true };
202868
+ }
202869
+ }
202870
+ return { risky: false };
202871
+ };
202567
202872
  var parse = (input, options) => {
202568
202873
  if (typeof input !== "string") {
202569
202874
  throw new TypeError("Expected a string");
@@ -202695,6 +203000,8 @@ var require_parse = __commonJS((exports, module2) => {
202695
203000
  token2.prev = prev;
202696
203001
  token2.parens = state.parens;
202697
203002
  token2.output = state.output;
203003
+ token2.startIndex = state.index;
203004
+ token2.tokensIndex = tokens.length;
202698
203005
  const output = (opts.capture ? "(" : "") + token2.open;
202699
203006
  increment2("parens");
202700
203007
  push({ type, value: value2, output: state.output ? "" : ONE_CHAR });
@@ -202702,6 +203009,26 @@ var require_parse = __commonJS((exports, module2) => {
202702
203009
  extglobs.push(token2);
202703
203010
  };
202704
203011
  const extglobClose = (token2) => {
203012
+ const literal = input.slice(token2.startIndex, state.index + 1);
203013
+ const body4 = input.slice(token2.startIndex + 2, state.index);
203014
+ const analysis = analyzeRepeatedExtglob(body4, opts);
203015
+ if ((token2.type === "plus" || token2.type === "star") && analysis.risky) {
203016
+ const safeOutput = analysis.safeOutput ? (token2.output ? "" : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput) : undefined;
203017
+ const open = tokens[token2.tokensIndex];
203018
+ open.type = "text";
203019
+ open.value = literal;
203020
+ open.output = safeOutput || utils.escapeRegex(literal);
203021
+ for (let i4 = token2.tokensIndex + 1;i4 < tokens.length; i4++) {
203022
+ tokens[i4].value = "";
203023
+ tokens[i4].output = "";
203024
+ delete tokens[i4].suffix;
203025
+ }
203026
+ state.output = token2.output + open.output;
203027
+ state.backtrack = true;
203028
+ push({ type: "paren", extglob: true, value, output: "" });
203029
+ decrement("parens");
203030
+ return;
203031
+ }
202705
203032
  let output = token2.close + (opts.capture ? ")" : "");
202706
203033
  let rest;
202707
203034
  if (token2.type === "negate") {