* Extract from Liquid source
()
| 34 | * Extract from Liquid source |
| 35 | */ |
| 36 | extract(): ExtractionResult { |
| 37 | const startTime = Date.now(); |
| 38 | |
| 39 | try { |
| 40 | // Create file node |
| 41 | const fileNode = this.createFileNode(); |
| 42 | |
| 43 | // Shopify OS 2.0 JSON template / section group: link each section `type` |
| 44 | // to its `sections/<type>.liquid` file. (No symbol nodes are emitted — the |
| 45 | // JSON file just carries the references — so it stays out of any |
| 46 | // symbol-bearing-file metric while its sections still get their dependents.) |
| 47 | if (this.filePath.endsWith('.json')) { |
| 48 | this.extractShopifyJsonSections(fileNode.id); |
| 49 | } else { |
| 50 | // Extract render/include statements (snippet references) |
| 51 | this.extractSnippetReferences(fileNode.id); |
| 52 | |
| 53 | // Extract section references |
| 54 | this.extractSectionReferences(fileNode.id); |
| 55 | |
| 56 | // Extract schema block |
| 57 | this.extractSchema(fileNode.id); |
| 58 | |
| 59 | // Extract assign and capture declarations as variables |
| 60 | this.extractAssignments(fileNode.id); |
| 61 | } |
| 62 | } catch (error) { |
| 63 | this.errors.push({ |
| 64 | message: `Liquid extraction error: ${error instanceof Error ? error.message : String(error)}`, |
| 65 | severity: 'error', |
| 66 | code: 'parse_error', |
| 67 | }); |
| 68 | } |
| 69 | |
| 70 | return { |
| 71 | nodes: this.nodes, |
| 72 | edges: this.edges, |
| 73 | unresolvedReferences: this.unresolvedReferences, |
| 74 | errors: this.errors, |
| 75 | durationMs: Date.now() - startTime, |
| 76 | }; |
| 77 | } |
| 78 | |
| 79 | /** |
| 80 | * Create a file node for the Liquid template |
nothing calls this directly
no test coverage detected