@@ -15,12 +15,7 @@ import type { UndeclaredPolicy } from "../../src/types.js";
1515import { readArchitecture , renderArchitectureMermaid } from "./arch-lint.js" ;
1616import { COVERAGE_DATA , type CoverageData } from "./coverage-data.js" ;
1717import { ENDPOINT_ANCHORS , type EndpointAnchors } from "./endpoint-docs.js" ;
18- import {
19- escapeRe ,
20- type GeneratedRegion ,
21- regenerateRegions ,
22- regionBounds ,
23- } from "./lib/generated-regions.js" ;
18+ import { type GeneratedRegion , regenerateRegions , regionBounds } from "./lib/generated-regions.js" ;
2419
2520const ROOT = join ( import . meta. dir , ".." , ".." ) ;
2621export const COVERAGE_PATH = "docs/reference/coverage.md" ;
@@ -428,7 +423,7 @@ function sectionsTableRegion(name: string, heading: string): GeneratedRegion {
428423 name,
429424 placement : { kind : "under-heading" , heading } ,
430425 body : new RegExp (
431- String . raw `^\n(?:${ escapeRe ( TABLE_HEADER ) } \n(?:\| \x60[a-z_]+\x60 \| [^\n]* \|\n)*)?$` ,
426+ String . raw `^\n(?:${ RegExp . escape ( TABLE_HEADER ) } \n(?:\| \x60[a-z_]+\x60 \| [^\n]* \|\n)*)?$` ,
432427 ) ,
433428 render : ( ) => `\n${ renderSectionsTable ( SECTIONS , DOCS ) } \n` ,
434429 } ;
@@ -439,7 +434,7 @@ function outputsListRegion(name: string, heading: string): GeneratedRegion {
439434 name,
440435 placement : { kind : "under-heading" , heading } ,
441436 body : new RegExp (
442- String . raw `^(?:\x60[a-z]+\x60(?: / \x60[a-z]+\x60)*${ escapeRe ( RESULT_TAIL ) } )?$` ,
437+ String . raw `^(?:\x60[a-z]+\x60(?: / \x60[a-z]+\x60)*${ RegExp . escape ( RESULT_TAIL ) } )?$` ,
443438 ) ,
444439 render : ( ) => renderOutputsList ( RUN_RESULTS ) ,
445440 } ;
@@ -450,7 +445,7 @@ function patUrlRegion(name: string): GeneratedRegion {
450445 return {
451446 name,
452447 placement : { kind : "tail" } ,
453- body : new RegExp ( String . raw `^\n(?:\[${ escapeRe ( PAT_FORM_LABEL ) } \]: \S+\n)?$` ) ,
448+ body : new RegExp ( String . raw `^\n(?:\[${ RegExp . escape ( PAT_FORM_LABEL ) } \]: \S+\n)?$` ) ,
454449 render : ( ) => `\n[${ PAT_FORM_LABEL } ]: ${ patFormUrl ( ) } \n` ,
455450 } ;
456451}
@@ -505,10 +500,10 @@ const nonBlank = (excluded: string): string =>
505500 String . raw `[ \t]*[^${ excluded } \s][^${ excluded } \r\n]*` ;
506501const PROSE_LINE = `${ nonBlank ( "" ) } \n` ;
507502const CELL = nonBlank ( "|" ) ;
508- const KEY_CELL = String . raw `\[\x60[a-z_]+\x60\]\(${ escapeRe ( SECTIONS_PAGE ) } \)(?: \(\x60${ nonBlank ( "|\x60" ) } \x60\))?` ;
503+ const KEY_CELL = String . raw `\[\x60[a-z_]+\x60\]\(${ RegExp . escape ( SECTIONS_PAGE ) } \)(?: \(\x60${ nonBlank ( "|\x60" ) } \x60\))?` ;
509504const SUPPORTED_ROWS = String . raw `(?:\| ${ CELL } \| ${ KEY_CELL } \| ${ CELL } \|\n)+` ;
510505const GAP_ROWS = String . raw `(?:\| ${ CELL } \| ${ CELL } \| ${ CELL } \|\n)+` ;
511- const GAPS_BODY = String . raw `(?:${ PROSE_LINE } \n${ escapeRe ( GAPS_HEADER ) } \n|${ escapeRe ( GAPS_HEADER ) } \n${ GAP_ROWS } )` ;
506+ const GAPS_BODY = String . raw `(?:${ PROSE_LINE } \n${ RegExp . escape ( GAPS_HEADER ) } \n|${ RegExp . escape ( GAPS_HEADER ) } \n${ GAP_ROWS } )` ;
512507const BULLETS = `(?:- ${ PROSE_LINE } )+` ;
513508const NOTE_GROUPS = String . raw `(?:\*\*${ nonBlank ( "*" ) } \*\* \(\x60[a-z_]+\x60\)\n\n${ BULLETS } \n)+` ;
514509
@@ -519,10 +514,10 @@ const COVERAGE_REGIONS: readonly GeneratedRegion[] = [
519514 name : "coverage" ,
520515 placement : { kind : "tail" } ,
521516 body : new RegExp (
522- String . raw `^\n(?:(?:${ PROSE_LINE } \n)+${ escapeRe ( SUPPORTED_HEADING ) } \n\n${ escapeRe ( SUPPORTED_HEADER ) } \n` +
523- String . raw `${ SUPPORTED_ROWS } \n${ escapeRe ( NOTES_HEADING ) } \n\n${ NOTE_GROUPS } ` +
524- String . raw `${ escapeRe ( GAPS_HEADING ) } \n\n${ GAPS_BODY } \n${ escapeRe ( NO_API_HEADING ) } \n\n` +
525- String . raw `${ PROSE_LINE } \n${ BULLETS } \n${ escapeRe ( OUT_OF_SCOPE_HEADING ) } \n\n${ BULLETS } )?$` ,
517+ String . raw `^\n(?:(?:${ PROSE_LINE } \n)+${ RegExp . escape ( SUPPORTED_HEADING ) } \n\n${ RegExp . escape ( SUPPORTED_HEADER ) } \n` +
518+ String . raw `${ SUPPORTED_ROWS } \n${ RegExp . escape ( NOTES_HEADING ) } \n\n${ NOTE_GROUPS } ` +
519+ String . raw `${ RegExp . escape ( GAPS_HEADING ) } \n\n${ GAPS_BODY } \n${ RegExp . escape ( NO_API_HEADING ) } \n\n` +
520+ String . raw `${ PROSE_LINE } \n${ BULLETS } \n${ RegExp . escape ( OUT_OF_SCOPE_HEADING ) } \n\n${ BULLETS } )?$` ,
526521 ) ,
527522 render : ( ) => `\n${ renderCoverage ( SECTIONS , DOCS , COVERAGE_DATA , ENDPOINT_ANCHORS ) } \n` ,
528523 } ,
0 commit comments