@saluzi/codegraph 0.1.0 → 0.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.
- package/LICENSE +21 -0
- package/README.md +885 -0
- package/package.json +42 -10
- package/scripts/add-lang/bench.sh +60 -0
- package/scripts/add-lang/check-grammar.mjs +75 -0
- package/scripts/add-lang/dump-ast.mjs +103 -0
- package/scripts/add-lang/verify-extraction.mjs +70 -0
- package/scripts/agent-eval/ab-adoption.sh +91 -0
- package/scripts/agent-eval/ab-hook.sh +86 -0
- package/scripts/agent-eval/ab-impl.sh +78 -0
- package/scripts/agent-eval/ab-new-vs-baseline.sh +102 -0
- package/scripts/agent-eval/ab-sufficiency.sh +78 -0
- package/scripts/agent-eval/arms-F.sh +21 -0
- package/scripts/agent-eval/arms-matrix.sh +37 -0
- package/scripts/agent-eval/audit.sh +68 -0
- package/scripts/agent-eval/bench-readme.sh +28 -0
- package/scripts/agent-eval/bench-why-repo.sh +22 -0
- package/scripts/agent-eval/block-read-hook.sh +19 -0
- package/scripts/agent-eval/hook-settings.json +15 -0
- package/scripts/agent-eval/itrun.sh +120 -0
- package/scripts/agent-eval/offload-eval-3arm.sh +72 -0
- package/scripts/agent-eval/offload-eval-cost.mjs +133 -0
- package/scripts/agent-eval/offload-eval-effort.mjs +108 -0
- package/scripts/agent-eval/offload-eval-frontload-matrix.sh +25 -0
- package/scripts/agent-eval/offload-eval-frontload.sh +47 -0
- package/scripts/agent-eval/offload-eval-ground-truth.json +18 -0
- package/scripts/agent-eval/offload-eval-hook.mjs +84 -0
- package/scripts/agent-eval/offload-eval-judge.mjs +103 -0
- package/scripts/agent-eval/offload-eval-matrix.sh +20 -0
- package/scripts/agent-eval/offload-eval-metrics.mjs +94 -0
- package/scripts/agent-eval/offload-eval-refs1.sh +50 -0
- package/scripts/agent-eval/offload-eval-setup.sh +24 -0
- package/scripts/agent-eval/offload-eval-styles.sh +72 -0
- package/scripts/agent-eval/offload-eval-summarize.mjs +68 -0
- package/scripts/agent-eval/offload-eval.md +76 -0
- package/scripts/agent-eval/parse-arms.mjs +116 -0
- package/scripts/agent-eval/parse-bench-readme.mjs +84 -0
- package/scripts/agent-eval/parse-run.mjs +45 -0
- package/scripts/agent-eval/parse-session.mjs +93 -0
- package/scripts/agent-eval/probe-context.mjs +21 -0
- package/scripts/agent-eval/probe-explore.mjs +40 -0
- package/scripts/agent-eval/probe-node.mjs +20 -0
- package/scripts/agent-eval/probe-sweep.mjs +119 -0
- package/scripts/agent-eval/probe-trace.mjs +20 -0
- package/scripts/agent-eval/redirect-read-hook.sh +38 -0
- package/scripts/agent-eval/repro-concurrent-explore.mjs +119 -0
- package/scripts/agent-eval/repro-daemon-clients.mjs +125 -0
- package/scripts/agent-eval/run-agent.sh +34 -0
- package/scripts/agent-eval/run-all.sh +75 -0
- package/scripts/agent-eval/run-arms.sh +56 -0
- package/scripts/agent-eval/seq-matrix.mjs +137 -0
- package/scripts/build-bundle.sh +123 -0
- package/scripts/extract-release-notes.mjs +130 -0
- package/scripts/local-install.sh +41 -0
- package/scripts/npm-sdk.js +75 -0
- package/scripts/npm-shim.js +275 -0
- package/scripts/pack-npm.sh +119 -0
- package/scripts/prepare-release.mjs +270 -0
- package/dist/bin/codegraph.d.ts +0 -25
- package/dist/bin/node-version-check.d.ts +0 -37
- package/dist/bin/uninstall.d.ts +0 -14
- package/dist/context/formatter.d.ts +0 -33
- package/dist/context/formatter.js +0 -244
- package/dist/context/index.d.ts +0 -117
- package/dist/context/index.js +0 -1050
- package/dist/db/index.d.ts +0 -101
- package/dist/db/index.js +0 -250
- package/dist/db/migrations.d.ts +0 -47
- package/dist/db/migrations.js +0 -131
- package/dist/db/queries.d.ts +0 -291
- package/dist/db/queries.js +0 -1349
- package/dist/db/schema.sql +0 -151
- package/dist/db/sqlite-adapter.d.ts +0 -49
- package/dist/db/sqlite-adapter.js +0 -141
- package/dist/directory.d.ts +0 -62
- package/dist/directory.js +0 -264
- package/dist/errors.d.ts +0 -149
- package/dist/errors.js +0 -219
- package/dist/extraction/dfm-extractor.d.ts +0 -31
- package/dist/extraction/dfm-extractor.js +0 -151
- package/dist/extraction/grammars.d.ts +0 -94
- package/dist/extraction/grammars.js +0 -357
- package/dist/extraction/index.d.ts +0 -148
- package/dist/extraction/index.js +0 -1286
- package/dist/extraction/languages/c-cpp.d.ts +0 -4
- package/dist/extraction/languages/c-cpp.js +0 -126
- package/dist/extraction/languages/csharp.d.ts +0 -3
- package/dist/extraction/languages/csharp.js +0 -72
- package/dist/extraction/languages/dart.d.ts +0 -3
- package/dist/extraction/languages/dart.js +0 -192
- package/dist/extraction/languages/go.d.ts +0 -3
- package/dist/extraction/languages/go.js +0 -58
- package/dist/extraction/languages/index.d.ts +0 -10
- package/dist/extraction/languages/index.js +0 -49
- package/dist/extraction/languages/java.d.ts +0 -3
- package/dist/extraction/languages/java.js +0 -64
- package/dist/extraction/languages/javascript.d.ts +0 -3
- package/dist/extraction/languages/javascript.js +0 -90
- package/dist/extraction/languages/kotlin.d.ts +0 -3
- package/dist/extraction/languages/kotlin.js +0 -253
- package/dist/extraction/languages/lua.d.ts +0 -3
- package/dist/extraction/languages/lua.js +0 -150
- package/dist/extraction/languages/luau.d.ts +0 -3
- package/dist/extraction/languages/luau.js +0 -37
- package/dist/extraction/languages/pascal.d.ts +0 -3
- package/dist/extraction/languages/pascal.js +0 -66
- package/dist/extraction/languages/php.d.ts +0 -3
- package/dist/extraction/languages/php.js +0 -107
- package/dist/extraction/languages/python.d.ts +0 -3
- package/dist/extraction/languages/python.js +0 -56
- package/dist/extraction/languages/ruby.d.ts +0 -3
- package/dist/extraction/languages/ruby.js +0 -114
- package/dist/extraction/languages/rust.d.ts +0 -3
- package/dist/extraction/languages/rust.js +0 -109
- package/dist/extraction/languages/scala.d.ts +0 -3
- package/dist/extraction/languages/scala.js +0 -139
- package/dist/extraction/languages/swift.d.ts +0 -3
- package/dist/extraction/languages/swift.js +0 -91
- package/dist/extraction/languages/typescript.d.ts +0 -3
- package/dist/extraction/languages/typescript.js +0 -129
- package/dist/extraction/liquid-extractor.d.ts +0 -52
- package/dist/extraction/liquid-extractor.js +0 -313
- package/dist/extraction/parse-worker.d.ts +0 -8
- package/dist/extraction/parse-worker.js +0 -94
- package/dist/extraction/svelte-extractor.d.ts +0 -56
- package/dist/extraction/svelte-extractor.js +0 -272
- package/dist/extraction/tree-sitter-helpers.d.ts +0 -39
- package/dist/extraction/tree-sitter-helpers.js +0 -103
- package/dist/extraction/tree-sitter-types.d.ts +0 -191
- package/dist/extraction/tree-sitter-types.js +0 -10
- package/dist/extraction/tree-sitter.d.ts +0 -238
- package/dist/extraction/tree-sitter.js +0 -2430
- package/dist/extraction/vue-extractor.d.ts +0 -36
- package/dist/extraction/vue-extractor.js +0 -163
- package/dist/extraction/wasm/tree-sitter-c.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-c_sharp.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-cpp.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-dart.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-go.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-java.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-javascript.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-kotlin.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-lua.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-luau.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-php.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-python.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-ruby.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-rust.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-scala.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-swift.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-tsx.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-typescript.wasm +0 -0
- package/dist/extraction/wasm-runtime-flags.d.ts +0 -46
- package/dist/extraction/wasm-runtime-flags.js +0 -105
- package/dist/graph/index.d.ts +0 -8
- package/dist/graph/index.js +0 -13
- package/dist/graph/queries.d.ts +0 -109
- package/dist/graph/queries.js +0 -366
- package/dist/graph/traversal.d.ts +0 -137
- package/dist/graph/traversal.js +0 -528
- package/dist/index.d.ts +0 -509
- package/dist/index.js +0 -800
- package/dist/installer/claude-md-template.d.ts +0 -19
- package/dist/installer/config-writer.d.ts +0 -29
- package/dist/installer/index.d.ts +0 -140
- package/dist/installer/instructions-template.d.ts +0 -30
- package/dist/installer/targets/claude.d.ts +0 -55
- package/dist/installer/targets/codex.d.ts +0 -18
- package/dist/installer/targets/cursor.d.ts +0 -35
- package/dist/installer/targets/hermes.d.ts +0 -18
- package/dist/installer/targets/opencode.d.ts +0 -30
- package/dist/installer/targets/registry.d.ts +0 -38
- package/dist/installer/targets/shared.d.ts +0 -92
- package/dist/installer/targets/toml.d.ts +0 -64
- package/dist/installer/targets/types.d.ts +0 -122
- package/dist/mcp/index.d.ts +0 -98
- package/dist/mcp/server-instructions.d.ts +0 -20
- package/dist/mcp/tools.d.ts +0 -269
- package/dist/mcp/transport.d.ts +0 -117
- package/dist/resolution/frameworks/cargo-workspace.d.ts +0 -20
- package/dist/resolution/frameworks/cargo-workspace.js +0 -225
- package/dist/resolution/frameworks/csharp.d.ts +0 -8
- package/dist/resolution/frameworks/csharp.js +0 -213
- package/dist/resolution/frameworks/drupal.d.ts +0 -51
- package/dist/resolution/frameworks/drupal.js +0 -335
- package/dist/resolution/frameworks/express.d.ts +0 -8
- package/dist/resolution/frameworks/express.js +0 -225
- package/dist/resolution/frameworks/go.d.ts +0 -8
- package/dist/resolution/frameworks/go.js +0 -158
- package/dist/resolution/frameworks/index.d.ts +0 -52
- package/dist/resolution/frameworks/index.js +0 -137
- package/dist/resolution/frameworks/java.d.ts +0 -8
- package/dist/resolution/frameworks/java.js +0 -177
- package/dist/resolution/frameworks/laravel.d.ts +0 -13
- package/dist/resolution/frameworks/laravel.js +0 -248
- package/dist/resolution/frameworks/nestjs.d.ts +0 -26
- package/dist/resolution/frameworks/nestjs.js +0 -374
- package/dist/resolution/frameworks/python.d.ts +0 -10
- package/dist/resolution/frameworks/python.js +0 -278
- package/dist/resolution/frameworks/react.d.ts +0 -8
- package/dist/resolution/frameworks/react.js +0 -272
- package/dist/resolution/frameworks/ruby.d.ts +0 -8
- package/dist/resolution/frameworks/ruby.js +0 -198
- package/dist/resolution/frameworks/rust.d.ts +0 -8
- package/dist/resolution/frameworks/rust.js +0 -207
- package/dist/resolution/frameworks/svelte.d.ts +0 -9
- package/dist/resolution/frameworks/svelte.js +0 -249
- package/dist/resolution/frameworks/swift.d.ts +0 -10
- package/dist/resolution/frameworks/swift.js +0 -376
- package/dist/resolution/frameworks/vue.d.ts +0 -9
- package/dist/resolution/frameworks/vue.js +0 -306
- package/dist/resolution/import-resolver.d.ts +0 -61
- package/dist/resolution/import-resolver.js +0 -663
- package/dist/resolution/index.d.ts +0 -118
- package/dist/resolution/index.js +0 -744
- package/dist/resolution/lru-cache.d.ts +0 -24
- package/dist/resolution/lru-cache.js +0 -62
- package/dist/resolution/name-matcher.d.ts +0 -50
- package/dist/resolution/name-matcher.js +0 -384
- package/dist/resolution/path-aliases.d.ts +0 -72
- package/dist/resolution/path-aliases.js +0 -238
- package/dist/resolution/strip-comments.d.ts +0 -40
- package/dist/resolution/strip-comments.js +0 -441
- package/dist/resolution/types.d.ts +0 -181
- package/dist/resolution/types.js +0 -8
- package/dist/search/query-parser.d.ts +0 -61
- package/dist/search/query-parser.js +0 -177
- package/dist/search/query-utils.d.ts +0 -59
- package/dist/search/query-utils.js +0 -383
- package/dist/sync/git-hooks.d.ts +0 -54
- package/dist/sync/git-hooks.js +0 -223
- package/dist/sync/index.d.ts +0 -25
- package/dist/sync/index.js +0 -28
- package/dist/sync/watch-policy.d.ts +0 -51
- package/dist/sync/watch-policy.js +0 -124
- package/dist/sync/watcher.d.ts +0 -83
- package/dist/sync/watcher.js +0 -192
- package/dist/types.d.ts +0 -433
- package/dist/types.js +0 -75
- package/dist/ui/glyphs.d.ts +0 -42
- package/dist/ui/shimmer-progress.d.ts +0 -11
- package/dist/ui/shimmer-worker.d.ts +0 -2
- package/dist/ui/types.d.ts +0 -20
- package/dist/utils.d.ts +0 -231
- package/dist/utils.js +0 -549
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.typescriptExtractor = void 0;
|
|
4
|
-
const tree_sitter_helpers_1 = require("../tree-sitter-helpers");
|
|
5
|
-
exports.typescriptExtractor = {
|
|
6
|
-
functionTypes: ['function_declaration', 'arrow_function', 'function_expression'],
|
|
7
|
-
classTypes: ['class_declaration', 'abstract_class_declaration'],
|
|
8
|
-
methodTypes: ['method_definition', 'public_field_definition'],
|
|
9
|
-
interfaceTypes: ['interface_declaration'],
|
|
10
|
-
structTypes: [],
|
|
11
|
-
enumTypes: ['enum_declaration'],
|
|
12
|
-
enumMemberTypes: ['property_identifier', 'enum_assignment'],
|
|
13
|
-
typeAliasTypes: ['type_alias_declaration'],
|
|
14
|
-
importTypes: ['import_statement'],
|
|
15
|
-
callTypes: ['call_expression'],
|
|
16
|
-
variableTypes: ['lexical_declaration', 'variable_declaration'],
|
|
17
|
-
nameField: 'name',
|
|
18
|
-
bodyField: 'body',
|
|
19
|
-
resolveBody: (node, bodyField) => {
|
|
20
|
-
// public_field_definition (arrow function class fields) nest the body inside
|
|
21
|
-
// an arrow_function or function_expression child:
|
|
22
|
-
// public_field_definition → arrow_function → body (statement_block)
|
|
23
|
-
// Also handles wrapper patterns like: field = withBatchedUpdates((e) => { ... })
|
|
24
|
-
// public_field_definition → call_expression → arguments → arrow_function → body
|
|
25
|
-
if (node.type === 'public_field_definition') {
|
|
26
|
-
for (let i = 0; i < node.namedChildCount; i++) {
|
|
27
|
-
const child = node.namedChild(i);
|
|
28
|
-
if (!child)
|
|
29
|
-
continue;
|
|
30
|
-
if (child.type === 'arrow_function' || child.type === 'function_expression') {
|
|
31
|
-
return (0, tree_sitter_helpers_1.getChildByField)(child, bodyField);
|
|
32
|
-
}
|
|
33
|
-
// Check inside call_expression arguments (HOF wrappers like throttle, debounce)
|
|
34
|
-
if (child.type === 'call_expression') {
|
|
35
|
-
const args = (0, tree_sitter_helpers_1.getChildByField)(child, 'arguments');
|
|
36
|
-
if (args) {
|
|
37
|
-
for (let j = 0; j < args.namedChildCount; j++) {
|
|
38
|
-
const arg = args.namedChild(j);
|
|
39
|
-
if (arg && (arg.type === 'arrow_function' || arg.type === 'function_expression')) {
|
|
40
|
-
return (0, tree_sitter_helpers_1.getChildByField)(arg, bodyField);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return null;
|
|
48
|
-
},
|
|
49
|
-
paramsField: 'parameters',
|
|
50
|
-
returnField: 'return_type',
|
|
51
|
-
getSignature: (node, source) => {
|
|
52
|
-
const params = (0, tree_sitter_helpers_1.getChildByField)(node, 'parameters');
|
|
53
|
-
const returnType = (0, tree_sitter_helpers_1.getChildByField)(node, 'return_type');
|
|
54
|
-
if (!params)
|
|
55
|
-
return undefined;
|
|
56
|
-
let sig = (0, tree_sitter_helpers_1.getNodeText)(params, source);
|
|
57
|
-
if (returnType) {
|
|
58
|
-
sig += ': ' + (0, tree_sitter_helpers_1.getNodeText)(returnType, source).replace(/^:\s*/, '');
|
|
59
|
-
}
|
|
60
|
-
return sig;
|
|
61
|
-
},
|
|
62
|
-
getVisibility: (node) => {
|
|
63
|
-
for (let i = 0; i < node.childCount; i++) {
|
|
64
|
-
const child = node.child(i);
|
|
65
|
-
if (child?.type === 'accessibility_modifier') {
|
|
66
|
-
const text = child.text;
|
|
67
|
-
if (text === 'public')
|
|
68
|
-
return 'public';
|
|
69
|
-
if (text === 'private')
|
|
70
|
-
return 'private';
|
|
71
|
-
if (text === 'protected')
|
|
72
|
-
return 'protected';
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
return undefined;
|
|
76
|
-
},
|
|
77
|
-
isExported: (node, _source) => {
|
|
78
|
-
// Walk the parent chain to find an export_statement ancestor.
|
|
79
|
-
// This correctly handles deeply nested nodes like arrow functions
|
|
80
|
-
// inside variable declarations: `export const X = () => { ... }`
|
|
81
|
-
// where the arrow_function is 3 levels deep under export_statement.
|
|
82
|
-
let current = node.parent;
|
|
83
|
-
while (current) {
|
|
84
|
-
if (current.type === 'export_statement')
|
|
85
|
-
return true;
|
|
86
|
-
current = current.parent;
|
|
87
|
-
}
|
|
88
|
-
return false;
|
|
89
|
-
},
|
|
90
|
-
isAsync: (node) => {
|
|
91
|
-
for (let i = 0; i < node.childCount; i++) {
|
|
92
|
-
const child = node.child(i);
|
|
93
|
-
if (child?.type === 'async')
|
|
94
|
-
return true;
|
|
95
|
-
}
|
|
96
|
-
return false;
|
|
97
|
-
},
|
|
98
|
-
isStatic: (node) => {
|
|
99
|
-
for (let i = 0; i < node.childCount; i++) {
|
|
100
|
-
const child = node.child(i);
|
|
101
|
-
if (child?.type === 'static')
|
|
102
|
-
return true;
|
|
103
|
-
}
|
|
104
|
-
return false;
|
|
105
|
-
},
|
|
106
|
-
isConst: (node) => {
|
|
107
|
-
// For lexical_declaration, check if it's 'const' or 'let'
|
|
108
|
-
// For variable_declaration, it's always 'var'
|
|
109
|
-
if (node.type === 'lexical_declaration') {
|
|
110
|
-
for (let i = 0; i < node.childCount; i++) {
|
|
111
|
-
const child = node.child(i);
|
|
112
|
-
if (child?.type === 'const')
|
|
113
|
-
return true;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
return false;
|
|
117
|
-
},
|
|
118
|
-
extractImport: (node, source) => {
|
|
119
|
-
const sourceField = node.childForFieldName('source');
|
|
120
|
-
if (sourceField) {
|
|
121
|
-
const moduleName = source.substring(sourceField.startIndex, sourceField.endIndex).replace(/['"]/g, '');
|
|
122
|
-
if (moduleName) {
|
|
123
|
-
return { moduleName, signature: source.substring(node.startIndex, node.endIndex).trim() };
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
return null;
|
|
127
|
-
},
|
|
128
|
-
};
|
|
129
|
-
//# sourceMappingURL=typescript.js.map
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { ExtractionResult } from '../types'
|
|
2
|
-
/**
|
|
3
|
-
* LiquidExtractor - Extracts relationships from Liquid template files
|
|
4
|
-
*
|
|
5
|
-
* Liquid is a templating language (used by Shopify, Jekyll, etc.) that doesn't
|
|
6
|
-
* have traditional functions or classes. Instead, we extract:
|
|
7
|
-
* - Section references ({% section 'name' %})
|
|
8
|
-
* - Snippet references ({% render 'name' %} and {% include 'name' %})
|
|
9
|
-
* - Schema blocks ({% schema %}...{% endschema %})
|
|
10
|
-
*/
|
|
11
|
-
export declare class LiquidExtractor {
|
|
12
|
-
private filePath
|
|
13
|
-
private source
|
|
14
|
-
private nodes
|
|
15
|
-
private edges
|
|
16
|
-
private unresolvedReferences
|
|
17
|
-
private errors
|
|
18
|
-
constructor(filePath: string, source: string)
|
|
19
|
-
/**
|
|
20
|
-
* Extract from Liquid source
|
|
21
|
-
*/
|
|
22
|
-
extract(): ExtractionResult
|
|
23
|
-
/**
|
|
24
|
-
* Create a file node for the Liquid template
|
|
25
|
-
*/
|
|
26
|
-
private createFileNode
|
|
27
|
-
/**
|
|
28
|
-
* Extract {% render 'snippet' %} and {% include 'snippet' %} references
|
|
29
|
-
*/
|
|
30
|
-
private extractSnippetReferences
|
|
31
|
-
/**
|
|
32
|
-
* Extract {% section 'name' %} references
|
|
33
|
-
*/
|
|
34
|
-
private extractSectionReferences
|
|
35
|
-
/**
|
|
36
|
-
* Extract {% schema %}...{% endschema %} blocks
|
|
37
|
-
*/
|
|
38
|
-
private extractSchema
|
|
39
|
-
/**
|
|
40
|
-
* Extract {% assign var = value %} statements
|
|
41
|
-
*/
|
|
42
|
-
private extractAssignments
|
|
43
|
-
/**
|
|
44
|
-
* Get the line number for a character index
|
|
45
|
-
*/
|
|
46
|
-
private getLineNumber
|
|
47
|
-
/**
|
|
48
|
-
* Get the character index of the start of a line
|
|
49
|
-
*/
|
|
50
|
-
private getLineStart
|
|
51
|
-
}
|
|
52
|
-
//# sourceMappingURL=liquid-extractor.d.ts.map
|
|
@@ -1,313 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LiquidExtractor = void 0;
|
|
4
|
-
const tree_sitter_helpers_1 = require("./tree-sitter-helpers");
|
|
5
|
-
/**
|
|
6
|
-
* LiquidExtractor - Extracts relationships from Liquid template files
|
|
7
|
-
*
|
|
8
|
-
* Liquid is a templating language (used by Shopify, Jekyll, etc.) that doesn't
|
|
9
|
-
* have traditional functions or classes. Instead, we extract:
|
|
10
|
-
* - Section references ({% section 'name' %})
|
|
11
|
-
* - Snippet references ({% render 'name' %} and {% include 'name' %})
|
|
12
|
-
* - Schema blocks ({% schema %}...{% endschema %})
|
|
13
|
-
*/
|
|
14
|
-
class LiquidExtractor {
|
|
15
|
-
filePath;
|
|
16
|
-
source;
|
|
17
|
-
nodes = [];
|
|
18
|
-
edges = [];
|
|
19
|
-
unresolvedReferences = [];
|
|
20
|
-
errors = [];
|
|
21
|
-
constructor(filePath, source) {
|
|
22
|
-
this.filePath = filePath;
|
|
23
|
-
this.source = source;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Extract from Liquid source
|
|
27
|
-
*/
|
|
28
|
-
extract() {
|
|
29
|
-
const startTime = Date.now();
|
|
30
|
-
try {
|
|
31
|
-
// Create file node
|
|
32
|
-
const fileNode = this.createFileNode();
|
|
33
|
-
// Extract render/include statements (snippet references)
|
|
34
|
-
this.extractSnippetReferences(fileNode.id);
|
|
35
|
-
// Extract section references
|
|
36
|
-
this.extractSectionReferences(fileNode.id);
|
|
37
|
-
// Extract schema block
|
|
38
|
-
this.extractSchema(fileNode.id);
|
|
39
|
-
// Extract assign statements as variables
|
|
40
|
-
this.extractAssignments(fileNode.id);
|
|
41
|
-
}
|
|
42
|
-
catch (error) {
|
|
43
|
-
this.errors.push({
|
|
44
|
-
message: `Liquid extraction error: ${error instanceof Error ? error.message : String(error)}`,
|
|
45
|
-
severity: 'error',
|
|
46
|
-
code: 'parse_error',
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
return {
|
|
50
|
-
nodes: this.nodes,
|
|
51
|
-
edges: this.edges,
|
|
52
|
-
unresolvedReferences: this.unresolvedReferences,
|
|
53
|
-
errors: this.errors,
|
|
54
|
-
durationMs: Date.now() - startTime,
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Create a file node for the Liquid template
|
|
59
|
-
*/
|
|
60
|
-
createFileNode() {
|
|
61
|
-
const lines = this.source.split('\n');
|
|
62
|
-
const id = (0, tree_sitter_helpers_1.generateNodeId)(this.filePath, 'file', this.filePath, 1);
|
|
63
|
-
const fileNode = {
|
|
64
|
-
id,
|
|
65
|
-
kind: 'file',
|
|
66
|
-
name: this.filePath.split('/').pop() || this.filePath,
|
|
67
|
-
qualifiedName: this.filePath,
|
|
68
|
-
filePath: this.filePath,
|
|
69
|
-
language: 'liquid',
|
|
70
|
-
startLine: 1,
|
|
71
|
-
endLine: lines.length,
|
|
72
|
-
startColumn: 0,
|
|
73
|
-
endColumn: lines[lines.length - 1]?.length || 0,
|
|
74
|
-
updatedAt: Date.now(),
|
|
75
|
-
};
|
|
76
|
-
this.nodes.push(fileNode);
|
|
77
|
-
return fileNode;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Extract {% render 'snippet' %} and {% include 'snippet' %} references
|
|
81
|
-
*/
|
|
82
|
-
extractSnippetReferences(fileNodeId) {
|
|
83
|
-
// Match {% render 'name' %} or {% include 'name' %} with optional parameters
|
|
84
|
-
const renderRegex = /\{%[-]?\s*(render|include)\s+['"]([^'"]+)['"]/g;
|
|
85
|
-
let match;
|
|
86
|
-
while ((match = renderRegex.exec(this.source)) !== null) {
|
|
87
|
-
const [fullMatch, tagType, snippetName] = match;
|
|
88
|
-
const line = this.getLineNumber(match.index);
|
|
89
|
-
// Create an import node for searchability
|
|
90
|
-
const importNodeId = (0, tree_sitter_helpers_1.generateNodeId)(this.filePath, 'import', snippetName, line);
|
|
91
|
-
const importNode = {
|
|
92
|
-
id: importNodeId,
|
|
93
|
-
kind: 'import',
|
|
94
|
-
name: snippetName,
|
|
95
|
-
qualifiedName: `${this.filePath}::import:${snippetName}`,
|
|
96
|
-
filePath: this.filePath,
|
|
97
|
-
language: 'liquid',
|
|
98
|
-
signature: fullMatch,
|
|
99
|
-
startLine: line,
|
|
100
|
-
endLine: line,
|
|
101
|
-
startColumn: match.index - this.getLineStart(line),
|
|
102
|
-
endColumn: match.index - this.getLineStart(line) + fullMatch.length,
|
|
103
|
-
updatedAt: Date.now(),
|
|
104
|
-
};
|
|
105
|
-
this.nodes.push(importNode);
|
|
106
|
-
// Add containment edge from file to import
|
|
107
|
-
this.edges.push({
|
|
108
|
-
source: fileNodeId,
|
|
109
|
-
target: importNodeId,
|
|
110
|
-
kind: 'contains',
|
|
111
|
-
});
|
|
112
|
-
// Create a component node for the snippet reference
|
|
113
|
-
const nodeId = (0, tree_sitter_helpers_1.generateNodeId)(this.filePath, 'component', `${tagType}:${snippetName}`, line);
|
|
114
|
-
const node = {
|
|
115
|
-
id: nodeId,
|
|
116
|
-
kind: 'component',
|
|
117
|
-
name: snippetName,
|
|
118
|
-
qualifiedName: `${this.filePath}::${tagType}:${snippetName}`,
|
|
119
|
-
filePath: this.filePath,
|
|
120
|
-
language: 'liquid',
|
|
121
|
-
startLine: line,
|
|
122
|
-
endLine: line,
|
|
123
|
-
startColumn: match.index - this.getLineStart(line),
|
|
124
|
-
endColumn: match.index - this.getLineStart(line) + fullMatch.length,
|
|
125
|
-
updatedAt: Date.now(),
|
|
126
|
-
};
|
|
127
|
-
this.nodes.push(node);
|
|
128
|
-
// Add containment edge from file
|
|
129
|
-
this.edges.push({
|
|
130
|
-
source: fileNodeId,
|
|
131
|
-
target: nodeId,
|
|
132
|
-
kind: 'contains',
|
|
133
|
-
});
|
|
134
|
-
// Add unresolved reference to the snippet file
|
|
135
|
-
this.unresolvedReferences.push({
|
|
136
|
-
fromNodeId: fileNodeId,
|
|
137
|
-
referenceName: `snippets/${snippetName}.liquid`,
|
|
138
|
-
referenceKind: 'references',
|
|
139
|
-
line,
|
|
140
|
-
column: match.index - this.getLineStart(line),
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Extract {% section 'name' %} references
|
|
146
|
-
*/
|
|
147
|
-
extractSectionReferences(fileNodeId) {
|
|
148
|
-
// Match {% section 'name' %}
|
|
149
|
-
const sectionRegex = /\{%[-]?\s*section\s+['"]([^'"]+)['"]/g;
|
|
150
|
-
let match;
|
|
151
|
-
while ((match = sectionRegex.exec(this.source)) !== null) {
|
|
152
|
-
const [fullMatch, sectionName] = match;
|
|
153
|
-
const line = this.getLineNumber(match.index);
|
|
154
|
-
// Create an import node for searchability
|
|
155
|
-
const importNodeId = (0, tree_sitter_helpers_1.generateNodeId)(this.filePath, 'import', sectionName, line);
|
|
156
|
-
const importNode = {
|
|
157
|
-
id: importNodeId,
|
|
158
|
-
kind: 'import',
|
|
159
|
-
name: sectionName,
|
|
160
|
-
qualifiedName: `${this.filePath}::import:${sectionName}`,
|
|
161
|
-
filePath: this.filePath,
|
|
162
|
-
language: 'liquid',
|
|
163
|
-
signature: fullMatch,
|
|
164
|
-
startLine: line,
|
|
165
|
-
endLine: line,
|
|
166
|
-
startColumn: match.index - this.getLineStart(line),
|
|
167
|
-
endColumn: match.index - this.getLineStart(line) + fullMatch.length,
|
|
168
|
-
updatedAt: Date.now(),
|
|
169
|
-
};
|
|
170
|
-
this.nodes.push(importNode);
|
|
171
|
-
// Add containment edge from file to import
|
|
172
|
-
this.edges.push({
|
|
173
|
-
source: fileNodeId,
|
|
174
|
-
target: importNodeId,
|
|
175
|
-
kind: 'contains',
|
|
176
|
-
});
|
|
177
|
-
// Create a component node for the section reference
|
|
178
|
-
const nodeId = (0, tree_sitter_helpers_1.generateNodeId)(this.filePath, 'component', `section:${sectionName}`, line);
|
|
179
|
-
const node = {
|
|
180
|
-
id: nodeId,
|
|
181
|
-
kind: 'component',
|
|
182
|
-
name: sectionName,
|
|
183
|
-
qualifiedName: `${this.filePath}::section:${sectionName}`,
|
|
184
|
-
filePath: this.filePath,
|
|
185
|
-
language: 'liquid',
|
|
186
|
-
startLine: line,
|
|
187
|
-
endLine: line,
|
|
188
|
-
startColumn: match.index - this.getLineStart(line),
|
|
189
|
-
endColumn: match.index - this.getLineStart(line) + fullMatch.length,
|
|
190
|
-
updatedAt: Date.now(),
|
|
191
|
-
};
|
|
192
|
-
this.nodes.push(node);
|
|
193
|
-
// Add containment edge from file
|
|
194
|
-
this.edges.push({
|
|
195
|
-
source: fileNodeId,
|
|
196
|
-
target: nodeId,
|
|
197
|
-
kind: 'contains',
|
|
198
|
-
});
|
|
199
|
-
// Add unresolved reference to the section file
|
|
200
|
-
this.unresolvedReferences.push({
|
|
201
|
-
fromNodeId: fileNodeId,
|
|
202
|
-
referenceName: `sections/${sectionName}.liquid`,
|
|
203
|
-
referenceKind: 'references',
|
|
204
|
-
line,
|
|
205
|
-
column: match.index - this.getLineStart(line),
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* Extract {% schema %}...{% endschema %} blocks
|
|
211
|
-
*/
|
|
212
|
-
extractSchema(fileNodeId) {
|
|
213
|
-
// Match {% schema %}...{% endschema %}
|
|
214
|
-
const schemaRegex = /\{%[-]?\s*schema\s*[-]?%\}([\s\S]*?)\{%[-]?\s*endschema\s*[-]?%\}/g;
|
|
215
|
-
let match;
|
|
216
|
-
while ((match = schemaRegex.exec(this.source)) !== null) {
|
|
217
|
-
const [fullMatch, schemaContent] = match;
|
|
218
|
-
const startLine = this.getLineNumber(match.index);
|
|
219
|
-
const endLine = this.getLineNumber(match.index + fullMatch.length);
|
|
220
|
-
// Try to parse the schema JSON to get the name
|
|
221
|
-
let schemaName = 'schema';
|
|
222
|
-
try {
|
|
223
|
-
const schemaJson = JSON.parse(schemaContent);
|
|
224
|
-
if (schemaJson.name) {
|
|
225
|
-
// Shopify schema names can be translation objects like {"en": "...", "fr": "..."}
|
|
226
|
-
schemaName = typeof schemaJson.name === 'string'
|
|
227
|
-
? schemaJson.name
|
|
228
|
-
: schemaJson.name.en || Object.values(schemaJson.name)[0] || 'schema';
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
catch {
|
|
232
|
-
// Schema isn't valid JSON, use default name
|
|
233
|
-
}
|
|
234
|
-
// Create a node for the schema
|
|
235
|
-
const nodeId = (0, tree_sitter_helpers_1.generateNodeId)(this.filePath, 'constant', `schema:${schemaName}`, startLine);
|
|
236
|
-
const node = {
|
|
237
|
-
id: nodeId,
|
|
238
|
-
kind: 'constant',
|
|
239
|
-
name: schemaName,
|
|
240
|
-
qualifiedName: `${this.filePath}::schema:${schemaName}`,
|
|
241
|
-
filePath: this.filePath,
|
|
242
|
-
language: 'liquid',
|
|
243
|
-
startLine,
|
|
244
|
-
endLine,
|
|
245
|
-
startColumn: match.index - this.getLineStart(startLine),
|
|
246
|
-
endColumn: 0,
|
|
247
|
-
docstring: schemaContent?.trim().substring(0, 200), // Store first 200 chars as docstring
|
|
248
|
-
updatedAt: Date.now(),
|
|
249
|
-
};
|
|
250
|
-
this.nodes.push(node);
|
|
251
|
-
// Add containment edge from file
|
|
252
|
-
this.edges.push({
|
|
253
|
-
source: fileNodeId,
|
|
254
|
-
target: nodeId,
|
|
255
|
-
kind: 'contains',
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
/**
|
|
260
|
-
* Extract {% assign var = value %} statements
|
|
261
|
-
*/
|
|
262
|
-
extractAssignments(fileNodeId) {
|
|
263
|
-
// Match {% assign variable_name = ... %}
|
|
264
|
-
const assignRegex = /\{%[-]?\s*assign\s+(\w+)\s*=/g;
|
|
265
|
-
let match;
|
|
266
|
-
while ((match = assignRegex.exec(this.source)) !== null) {
|
|
267
|
-
const [, variableName] = match;
|
|
268
|
-
const line = this.getLineNumber(match.index);
|
|
269
|
-
// Create a variable node
|
|
270
|
-
const nodeId = (0, tree_sitter_helpers_1.generateNodeId)(this.filePath, 'variable', variableName, line);
|
|
271
|
-
const node = {
|
|
272
|
-
id: nodeId,
|
|
273
|
-
kind: 'variable',
|
|
274
|
-
name: variableName,
|
|
275
|
-
qualifiedName: `${this.filePath}::${variableName}`,
|
|
276
|
-
filePath: this.filePath,
|
|
277
|
-
language: 'liquid',
|
|
278
|
-
startLine: line,
|
|
279
|
-
endLine: line,
|
|
280
|
-
startColumn: match.index - this.getLineStart(line),
|
|
281
|
-
endColumn: match.index - this.getLineStart(line) + match[0].length,
|
|
282
|
-
updatedAt: Date.now(),
|
|
283
|
-
};
|
|
284
|
-
this.nodes.push(node);
|
|
285
|
-
// Add containment edge from file
|
|
286
|
-
this.edges.push({
|
|
287
|
-
source: fileNodeId,
|
|
288
|
-
target: nodeId,
|
|
289
|
-
kind: 'contains',
|
|
290
|
-
});
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
/**
|
|
294
|
-
* Get the line number for a character index
|
|
295
|
-
*/
|
|
296
|
-
getLineNumber(index) {
|
|
297
|
-
const substring = this.source.substring(0, index);
|
|
298
|
-
return (substring.match(/\n/g) || []).length + 1;
|
|
299
|
-
}
|
|
300
|
-
/**
|
|
301
|
-
* Get the character index of the start of a line
|
|
302
|
-
*/
|
|
303
|
-
getLineStart(lineNumber) {
|
|
304
|
-
const lines = this.source.split('\n');
|
|
305
|
-
let index = 0;
|
|
306
|
-
for (let i = 0; i < lineNumber - 1 && i < lines.length; i++) {
|
|
307
|
-
index += lines[i].length + 1; // +1 for newline
|
|
308
|
-
}
|
|
309
|
-
return index;
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
exports.LiquidExtractor = LiquidExtractor;
|
|
313
|
-
//# sourceMappingURL=liquid-extractor.js.map
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Parse Worker
|
|
4
|
-
*
|
|
5
|
-
* Runs tree-sitter parsing in a separate thread so the main thread
|
|
6
|
-
* stays unblocked and the UI animation renders smoothly.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
const worker_threads_1 = require("worker_threads");
|
|
10
|
-
const tree_sitter_1 = require("./tree-sitter");
|
|
11
|
-
const grammars_1 = require("./grammars");
|
|
12
|
-
// Emscripten prints `Aborted()` (and a follow-up RuntimeError diag
|
|
13
|
-
// line) directly to stderr when WASM aborts — before the JS catch
|
|
14
|
-
// runs. Worker stderr is inherited by the parent, so each crash leaks
|
|
15
|
-
// a noise line to the user's terminal even though the JS layer
|
|
16
|
-
// already handles the failure cleanly. Filter these specific lines
|
|
17
|
-
// out at the source. Real diagnostic output (anything we log
|
|
18
|
-
// ourselves) goes through console.* / parentPort and is unaffected.
|
|
19
|
-
//
|
|
20
|
-
// Caveats deliberately accepted:
|
|
21
|
-
// - Per-call match: each `write()` call is matched in isolation.
|
|
22
|
-
// If Emscripten ever splits `Aborted(` across two write()s (it
|
|
23
|
-
// doesn't today — synchronous abort prints the whole line at
|
|
24
|
-
// once via libc puts) the first fragment would leak. Buffering
|
|
25
|
-
// across calls would add complexity for a hypothetical case.
|
|
26
|
-
// - Substring exactness: the prefix `Aborted(` is the literal
|
|
27
|
-
// Emscripten signature. Any user code that legitimately writes
|
|
28
|
-
// a stderr line starting with that prefix would also be filtered;
|
|
29
|
-
// in practice no real diagnostic does.
|
|
30
|
-
{
|
|
31
|
-
const realWrite = process.stderr.write.bind(process.stderr);
|
|
32
|
-
process.stderr.write = ((chunk, encoding, cb) => {
|
|
33
|
-
const s = typeof chunk === 'string' ? chunk : Buffer.from(chunk).toString('utf-8');
|
|
34
|
-
if (s.startsWith('Aborted(') ||
|
|
35
|
-
s.includes('Build with -sASSERTIONS for more info')) {
|
|
36
|
-
// Honour the Writable stream contract: callbacks must always
|
|
37
|
-
// fire even when the write is suppressed, or upstream code
|
|
38
|
-
// waiting on the drain signal would hang. Both overload forms
|
|
39
|
-
// are handled (`(chunk, cb)` and `(chunk, encoding, cb)`).
|
|
40
|
-
if (typeof encoding === 'function')
|
|
41
|
-
encoding();
|
|
42
|
-
else if (cb)
|
|
43
|
-
cb();
|
|
44
|
-
return true;
|
|
45
|
-
}
|
|
46
|
-
return realWrite(chunk, encoding, cb);
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
const PARSER_RESET_INTERVAL = 5000;
|
|
50
|
-
const parseCounts = new Map();
|
|
51
|
-
worker_threads_1.parentPort.on('message', async (msg) => {
|
|
52
|
-
if (msg.type === 'load-grammars') {
|
|
53
|
-
await (0, grammars_1.loadGrammarsForLanguages)(msg.languages);
|
|
54
|
-
worker_threads_1.parentPort.postMessage({ type: 'grammars-loaded' });
|
|
55
|
-
}
|
|
56
|
-
else if (msg.type === 'parse') {
|
|
57
|
-
const { id, filePath, content, frameworkNames } = msg;
|
|
58
|
-
try {
|
|
59
|
-
const language = (0, grammars_1.detectLanguage)(filePath, content);
|
|
60
|
-
const result = (0, tree_sitter_1.extractFromSource)(filePath, content, language, frameworkNames);
|
|
61
|
-
// Periodic parser reset to reclaim WASM heap memory
|
|
62
|
-
const count = (parseCounts.get(language) ?? 0) + 1;
|
|
63
|
-
parseCounts.set(language, count);
|
|
64
|
-
if (count % PARSER_RESET_INTERVAL === 0) {
|
|
65
|
-
(0, grammars_1.resetParser)(language);
|
|
66
|
-
}
|
|
67
|
-
worker_threads_1.parentPort.postMessage({ type: 'parse-result', id, result });
|
|
68
|
-
}
|
|
69
|
-
catch (err) {
|
|
70
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
71
|
-
// WASM memory errors leave the module in a corrupted state — all
|
|
72
|
-
// subsequent parses would also fail (cascading failures). Crash the
|
|
73
|
-
// worker so the main thread spawns a fresh one with a clean heap.
|
|
74
|
-
if (message.includes('memory access out of bounds') || message.includes('out of memory')) {
|
|
75
|
-
process.exit(1);
|
|
76
|
-
}
|
|
77
|
-
worker_threads_1.parentPort.postMessage({
|
|
78
|
-
type: 'parse-result',
|
|
79
|
-
id,
|
|
80
|
-
result: {
|
|
81
|
-
nodes: [],
|
|
82
|
-
edges: [],
|
|
83
|
-
unresolvedReferences: [],
|
|
84
|
-
errors: [{ message: `Parse worker error: ${message}`, filePath: filePath, severity: 'error', code: 'parse_error' }],
|
|
85
|
-
durationMs: 0,
|
|
86
|
-
},
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
else if (msg.type === 'shutdown') {
|
|
91
|
-
worker_threads_1.parentPort.postMessage({ type: 'shutdown-ack' });
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
//# sourceMappingURL=parse-worker.js.map
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { ExtractionResult } from '../types'
|
|
2
|
-
/**
|
|
3
|
-
* SvelteExtractor - Extracts code relationships from Svelte component files
|
|
4
|
-
*
|
|
5
|
-
* Svelte files are multi-language (script + template + style). Rather than
|
|
6
|
-
* parsing the full Svelte grammar, we extract the <script> block content
|
|
7
|
-
* and delegate it to the TypeScript/JavaScript TreeSitterExtractor.
|
|
8
|
-
*
|
|
9
|
-
* Also extracts function calls from template expressions (`{fn(...)}`) so
|
|
10
|
-
* cross-file call edges are captured even when calls live in markup.
|
|
11
|
-
*
|
|
12
|
-
* Every .svelte file produces a component node (Svelte components are always importable).
|
|
13
|
-
*/
|
|
14
|
-
export declare class SvelteExtractor {
|
|
15
|
-
private filePath
|
|
16
|
-
private source
|
|
17
|
-
private nodes
|
|
18
|
-
private edges
|
|
19
|
-
private unresolvedReferences
|
|
20
|
-
private errors
|
|
21
|
-
constructor(filePath: string, source: string)
|
|
22
|
-
/**
|
|
23
|
-
* Extract from Svelte source
|
|
24
|
-
*/
|
|
25
|
-
extract(): ExtractionResult
|
|
26
|
-
/**
|
|
27
|
-
* Create a component node for the .svelte file
|
|
28
|
-
*/
|
|
29
|
-
private createComponentNode
|
|
30
|
-
/**
|
|
31
|
-
* Extract <script> blocks from the Svelte source
|
|
32
|
-
*/
|
|
33
|
-
private extractScriptBlocks
|
|
34
|
-
/**
|
|
35
|
-
* Process a script block by delegating to TreeSitterExtractor
|
|
36
|
-
*/
|
|
37
|
-
private processScriptBlock
|
|
38
|
-
/**
|
|
39
|
-
* Extract function calls from Svelte template expressions.
|
|
40
|
-
*
|
|
41
|
-
* In Svelte, many function calls happen in markup (e.g., `class={cn(...)}`),
|
|
42
|
-
* not inside `<script>` blocks. We scan the template portion for `{expression}`
|
|
43
|
-
* blocks and extract call patterns from them.
|
|
44
|
-
*/
|
|
45
|
-
private extractTemplateCalls
|
|
46
|
-
/**
|
|
47
|
-
* Extract component usages from the Svelte template.
|
|
48
|
-
*
|
|
49
|
-
* PascalCase tags like <Modal>, <Button />, <DevServerPreview> represent
|
|
50
|
-
* component instantiations — analogous to function calls in imperative code.
|
|
51
|
-
* Capturing these creates graph edges from parent to child components and
|
|
52
|
-
* gives codegraph_explore anchor points in the template markup.
|
|
53
|
-
*/
|
|
54
|
-
private extractTemplateComponents
|
|
55
|
-
}
|
|
56
|
-
//# sourceMappingURL=svelte-extractor.d.ts.map
|