augmentationsIn
The augmentations a scratch file holds new versions of (<namespace>.global and <namespace>.augments, for each
namespace it writes a declare global or declare module into): a check of it leaves the stored ones out, which
would otherwise declare the same members twice.
export function augmentationsIn(text: string): Set<string> { const paths = new Set<string>(); const leaves = [ ...(/\bdeclare\s+global\b/.test(text) ? ["global"] : []), ...(/\bdeclare\s+module\s+["']/.test(text) ? ["augments"] : []), ]; for (const leaf of leaves) { for (const m of text.matchAll(/^\/\/\s*tcm:\s*namespace\s+(\S+)/gm)) paths.add(`${m[1]}.${leaf}`); for (const m of text.matchAll(/^\/\/\s*tcm:\s*path\s+(\S+)\s*$/gm)) if (m[1]!.endsWith(`.${leaf}`)) paths.add(m[1]!); } return paths; }