@jefuriiij/synthra 0.1.11 → 0.1.12

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.
@@ -628,6 +628,7 @@ import { createRequire } from "module";
628
628
  import { Language, Parser } from "web-tree-sitter";
629
629
 
630
630
  // src/scanner/parsers/_generic.ts
631
+ import { Query } from "web-tree-sitter";
631
632
  function firstLine(text, max = 200) {
632
633
  const line = text.split(/\r?\n/, 1)[0] ?? "";
633
634
  return line.length > max ? line.slice(0, max) + "\u2026" : line;
@@ -642,7 +643,7 @@ async function runGenericParser(config, f, source) {
642
643
  const { parser, language } = await createParser(config.grammar);
643
644
  const tree = parser.parse(source);
644
645
  if (!tree) return { file: f, source, symbols, imports, calls: [] };
645
- const query = language.query(config.query);
646
+ const query = new Query(language, config.query);
646
647
  const matches = query.matches(tree.rootNode);
647
648
  for (const match of matches) {
648
649
  const byName = /* @__PURE__ */ new Map();
@@ -773,6 +774,7 @@ async function parseCSharp(f, source) {
773
774
  }
774
775
 
775
776
  // src/scanner/parsers/dart.ts
777
+ import { Query as Query2 } from "web-tree-sitter";
776
778
  var QUERY4 = `
777
779
  (class_definition name: (identifier) @class.name) @class
778
780
  (mixin_declaration (identifier) @mixin.name) @mixin
@@ -820,7 +822,7 @@ async function parseDart(f, source) {
820
822
  const { parser, language } = await createParser("dart");
821
823
  const tree = parser.parse(source);
822
824
  if (!tree) return { file: f, source, symbols, imports, calls: [] };
823
- const query = language.query(QUERY4);
825
+ const query = new Query2(language, QUERY4);
824
826
  const matches = query.matches(tree.rootNode);
825
827
  for (const match of matches) {
826
828
  const byName = /* @__PURE__ */ new Map();
@@ -964,6 +966,7 @@ async function parsePhp(f, source) {
964
966
  }
965
967
 
966
968
  // src/scanner/parsers/python.ts
969
+ import { Query as Query3 } from "web-tree-sitter";
967
970
  var QUERY9 = `
968
971
  (function_definition name: (identifier) @function.name) @function
969
972
  (class_definition name: (identifier) @class.name) @class
@@ -982,7 +985,7 @@ async function parsePython(f, source) {
982
985
  const { parser, language } = await createParser("python");
983
986
  const tree = parser.parse(source);
984
987
  if (!tree) return { file: f, source, symbols, imports, calls: [] };
985
- const query = language.query(QUERY9);
988
+ const query = new Query3(language, QUERY9);
986
989
  const matches = query.matches(tree.rootNode);
987
990
  for (const match of matches) {
988
991
  const byName = /* @__PURE__ */ new Map();
@@ -1080,6 +1083,7 @@ async function parseRust(f, source) {
1080
1083
  }
1081
1084
 
1082
1085
  // src/scanner/parsers/typescript.ts
1086
+ import { Query as Query4 } from "web-tree-sitter";
1083
1087
  var TS_QUERY = `
1084
1088
  (function_declaration name: (identifier) @function.name) @function
1085
1089
  (class_declaration name: (type_identifier) @class.name) @class
@@ -1129,7 +1133,7 @@ async function parseTypeScript(f, source) {
1129
1133
  const { parser, language } = await createParser(grammar);
1130
1134
  const tree = parser.parse(source);
1131
1135
  if (!tree) return { file: f, source, symbols, imports, calls: [] };
1132
- const query = language.query(queryFor(grammar));
1136
+ const query = new Query4(language, queryFor(grammar));
1133
1137
  const matches = query.matches(tree.rootNode);
1134
1138
  for (const match of matches) {
1135
1139
  const byName = /* @__PURE__ */ new Map();