MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / processScriptBlock

Method processScriptBlock

src/extraction/vue-extractor.ts:245–274  ·  view source on GitHub ↗

* Process a script block by delegating to TreeSitterExtractor

(
    block: { content: string; startLine: number; isSetup: boolean; language: Language },
    componentNodeId: string
  )

Source from the content-addressed store, hash-verified

243 * Process a script block by delegating to TreeSitterExtractor
244 */
245 private processScriptBlock(
246 block: { content: string; startLine: number; isSetup: boolean; language: Language },
247 componentNodeId: string
248 ): void {
249 const scriptLanguage = block.language;
250
251 // Check if the script language parser is available
252 if (!isLanguageSupported(scriptLanguage)) {
253 this.errors.push({
254 message: `Parser for ${scriptLanguage} not available, cannot parse Vue script block`,
255 severity: 'warning',
256 });
257 return;
258 }
259
260 // Delegate to TreeSitterExtractor
261 const extractor = new TreeSitterExtractor(this.filePath, block.content, scriptLanguage);
262 const result = extractor.extract();
263
264 // An Options API component's functions — `methods`, `computed`, `watch`,
265 // lifecycle hooks — are object-literal members the TS extractor leaves as
266 // part of the file. Name each one, and hand it the calls written inside it.
267 if (!block.isSetup) this.addOptionsMembers(block, result, componentNodeId);
268
269 foldScriptResult(
270 result,
271 { filePath: this.filePath, componentNodeId, lineOffset: block.startLine, language: 'vue', perInstance: block.isSetup },
272 { nodes: this.nodes, edges: this.edges, unresolvedReferences: this.unresolvedReferences, errors: this.errors }
273 );
274 }
275
276 /**
277 * Extract component usages from the Vue `<template>`.

Callers 1

extractMethod · 0.95

Calls 5

extractMethod · 0.95
addOptionsMembersMethod · 0.95
isLanguageSupportedFunction · 0.90
foldScriptResultFunction · 0.90
pushMethod · 0.80

Tested by

no test coverage detected