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

Method processScriptBlock

src/extraction/vue-extractor.ts:251–280  ·  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

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