(outDir: string)
| 51 | }; |
| 52 | |
| 53 | const rewritePublishedDocShots = (outDir: string): void => { |
| 54 | const refs = getDocShotRefs(outDir); |
| 55 | DOC_SHOT_OUTPUT_PATHS.forEach((extension) => |
| 56 | forEachDeepFile( |
| 57 | outDir, |
| 58 | (filePath) => { |
| 59 | const file = readFileSync(filePath, UTF8); |
| 60 | const rewritten = refs.reduce((file, ref) => { |
| 61 | const publishedRef = `/${DOC_SHOT_DIR}/${ref}`; |
| 62 | return file |
| 63 | .replaceAll( |
| 64 | new RegExp(`(?<!${DOC_SHOT_DIR})/${escapeRegExp(ref)}`, 'g'), |
| 65 | publishedRef, |
| 66 | ) |
| 67 | .replaceAll( |
| 68 | new RegExp( |
| 69 | `(?<!/)${escapeRegExp(`${DOC_SHOT_DIR}/${ref}`)}`, |
| 70 | 'g', |
| 71 | ), |
| 72 | publishedRef, |
| 73 | ) |
| 74 | .replaceAll( |
| 75 | new RegExp(`(?<![/\\w-])${escapeRegExp(ref)}`, 'g'), |
| 76 | publishedRef, |
| 77 | ); |
| 78 | }, file); |
| 79 | if (rewritten != file) { |
| 80 | writeFileSync(filePath, rewritten, UTF8); |
| 81 | } |
| 82 | }, |
| 83 | extension, |
| 84 | ), |
| 85 | ); |
| 86 | }; |
| 87 | |
| 88 | const getPublishedDocShotRefs = (outDir: string): Map<string, string[]> => { |
| 89 | const refs = new Map<string, string[]>(); |
no test coverage detected
searching dependent graphs…