MCPcopy Index your code
hub / github.com/github/copilot-sdk / appendUniqueExportBlocks

Function appendUniqueExportBlocks

scripts/codegen/typescript.ts:156–177  ·  view source on GitHub ↗
(output: string[], compiled: string, seenBlocks: Map<string, string>)

Source from the content-addressed store, hash-verified

154}
155
156function appendUniqueExportBlocks(output: string[], compiled: string, seenBlocks: Map<string, string>): void {
157 for (const block of splitExportBlocks(compiled)) {
158 const nameMatch = /^export\s+(?:interface|type)\s+(\w+)/m.exec(block);
159 if (!nameMatch) {
160 output.push(block);
161 continue;
162 }
163
164 const name = nameMatch[1];
165 const normalizedBlock = normalizeExportBlock(block);
166 const existing = seenBlocks.get(name);
167 if (existing) {
168 if (existing !== normalizedBlock) {
169 throw new Error(`Duplicate generated TypeScript declaration for "${name}" with different content.`);
170 }
171 continue;
172 }
173
174 seenBlocks.set(name, normalizedBlock);
175 output.push(block);
176 }
177}
178
179function splitExportBlocks(compiled: string): string[] {
180 const normalizedCompiled = compiled

Callers

nothing calls this directly

Calls 6

splitExportBlocksFunction · 0.85
normalizeExportBlockFunction · 0.85
execMethod · 0.45
pushMethod · 0.45
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…