@jefuriiij/synthra 0.1.6 → 0.1.7
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/cli/index.js +24 -5
- package/dist/cli/index.js.map +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/dashboard/index.js.map +1 -1
- package/dist/server/index.js +22 -3
- package/dist/server/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -18,7 +18,7 @@ var init_package = __esm({
|
|
|
18
18
|
"package.json"() {
|
|
19
19
|
package_default = {
|
|
20
20
|
name: "@jefuriiij/synthra",
|
|
21
|
-
version: "0.1.
|
|
21
|
+
version: "0.1.7",
|
|
22
22
|
publishConfig: {
|
|
23
23
|
access: "public"
|
|
24
24
|
},
|
|
@@ -864,7 +864,7 @@ var public_default = `<!doctype html>
|
|
|
864
864
|
|
|
865
865
|
<!-- ============ Footer ============ -->
|
|
866
866
|
<footer class="foot">
|
|
867
|
-
<div>Synth<em>ra</em> \xB7 v0.1.
|
|
867
|
+
<div>Synth<em>ra</em> \xB7 v0.1.7</div>
|
|
868
868
|
<div>Cost figures approximate \xB7 @jefuriiij</div>
|
|
869
869
|
</footer>
|
|
870
870
|
|
|
@@ -2631,7 +2631,7 @@ async function parseRust(f, source) {
|
|
|
2631
2631
|
}
|
|
2632
2632
|
|
|
2633
2633
|
// src/scanner/parsers/typescript.ts
|
|
2634
|
-
var
|
|
2634
|
+
var TS_QUERY = `
|
|
2635
2635
|
(function_declaration name: (identifier) @function.name) @function
|
|
2636
2636
|
(class_declaration name: (type_identifier) @class.name) @class
|
|
2637
2637
|
(interface_declaration name: (type_identifier) @interface.name) @interface
|
|
@@ -2641,11 +2641,22 @@ var QUERY12 = `
|
|
|
2641
2641
|
(lexical_declaration (variable_declarator name: (identifier) @const-fn.name value: [(arrow_function) (function_expression)])) @const-fn
|
|
2642
2642
|
(import_statement source: (string) @import)
|
|
2643
2643
|
`;
|
|
2644
|
+
var JS_QUERY = `
|
|
2645
|
+
(function_declaration name: (identifier) @function.name) @function
|
|
2646
|
+
(class_declaration name: (identifier) @class.name) @class
|
|
2647
|
+
(method_definition name: (property_identifier) @method.name) @method
|
|
2648
|
+
(lexical_declaration (variable_declarator name: (identifier) @const-fn.name value: [(arrow_function) (function_expression)])) @const-fn
|
|
2649
|
+
(import_statement source: (string) @import)
|
|
2650
|
+
(call_expression function: (identifier) @_require_fn arguments: (arguments . (string) @require_source))
|
|
2651
|
+
`;
|
|
2644
2652
|
function grammarFor(ext) {
|
|
2645
2653
|
if (ext === ".tsx" || ext === ".jsx") return "tsx";
|
|
2646
2654
|
if (ext === ".js" || ext === ".cjs" || ext === ".mjs") return "javascript";
|
|
2647
2655
|
return "typescript";
|
|
2648
2656
|
}
|
|
2657
|
+
function queryFor(grammar) {
|
|
2658
|
+
return grammar === "javascript" ? JS_QUERY : TS_QUERY;
|
|
2659
|
+
}
|
|
2649
2660
|
function unquote(s) {
|
|
2650
2661
|
return s.replace(/^["'`]|["'`]$/g, "");
|
|
2651
2662
|
}
|
|
@@ -2669,7 +2680,7 @@ async function parseTypeScript(f, source) {
|
|
|
2669
2680
|
const { parser, language } = await createParser(grammar);
|
|
2670
2681
|
const tree = parser.parse(source);
|
|
2671
2682
|
if (!tree) return { file: f, source, symbols, imports, calls: [] };
|
|
2672
|
-
const query = language.query(
|
|
2683
|
+
const query = language.query(queryFor(grammar));
|
|
2673
2684
|
const matches = query.matches(tree.rootNode);
|
|
2674
2685
|
for (const match of matches) {
|
|
2675
2686
|
const byName = /* @__PURE__ */ new Map();
|
|
@@ -2686,7 +2697,15 @@ async function parseTypeScript(f, source) {
|
|
|
2686
2697
|
continue;
|
|
2687
2698
|
}
|
|
2688
2699
|
const importNode = byName.get("import");
|
|
2689
|
-
if (importNode)
|
|
2700
|
+
if (importNode) {
|
|
2701
|
+
imports.push(unquote(importNode.text));
|
|
2702
|
+
continue;
|
|
2703
|
+
}
|
|
2704
|
+
const requireFn = byName.get("_require_fn");
|
|
2705
|
+
const requireSource = byName.get("require_source");
|
|
2706
|
+
if (requireFn && requireSource && requireFn.text === "require") {
|
|
2707
|
+
imports.push(unquote(requireSource.text));
|
|
2708
|
+
}
|
|
2690
2709
|
}
|
|
2691
2710
|
const seen = /* @__PURE__ */ new Set();
|
|
2692
2711
|
symbols = symbols.filter((s) => {
|