MCPcopy
hub / github.com/tinyplex/tinybase / fileRewrite

Function fileRewrite

gulpfile.mjs:290–322  ·  view source on GitHub ↗
(block, addOverrideSnippet)

Source from the content-addressed store, hash-verified

288 block.replace(/\]\((?:\s*\*\s*)?\/shots\//g, `](${siteRoot}/shots/`);
289
290 const fileRewrite = (block, addOverrideSnippet) =>
291 absolutizeDocMedia(
292 block.replace(TYPES_DOC_CODE_BLOCKS, (_, label, code) => {
293 if (labelBlocks.has(label)) {
294 const codeOverride = codeBlocks.get(label);
295 let block = labelBlocks.get(label);
296 if (
297 addOverrideSnippet &&
298 codeBlocks.has(label) &&
299 code.includes('<') &&
300 code.includes('Schema') &&
301 !codeOverride.endsWith('{')
302 ) {
303 const prefix = block.match(/^\s+\*$/m)?.[0];
304 if (prefix) {
305 const line = '\n' + prefix;
306 block = block.replace(
307 /^\s+\*$/m,
308 `${prefix}${line}` +
309 ' This has schema-based typing.' +
310 ' The following is a simplified representation:' +
311 `${line}${line} \`\`\`ts override` +
312 codeOverride.trimEnd() +
313 `${line} \`\`\`${line}`,
314 );
315 }
316 code = code.replace(/^\s*?\/\/\/.*?\n/gm, '');
317 }
318 return block + code;
319 }
320 throw `Missing docs label ${label} in ${module}`;
321 }),
322 );
323
324 await allOf(['', '/with-schemas'], async (extraDir) => {
325 const definitionFile = await ensureDir(

Callers 1

copyDefinitionFunction · 0.85

Calls 2

absolutizeDocMediaFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…