UNPKG

@pho9ubenaa/remark-mask-text-beta

Version:

A remark plugin to mask text content with block characters

75 lines (74 loc) 2.15 kB
/** * Masking domain type definitions for remark-mask-text plugin * * Why (Business Logic Background): * - Need to accurately identify and process mask target regions in text * - Collect masking statistics to monitor performance * - Maintain context information during AST transformation to support debugging * - Track processing progress to identify bottlenecks */ /** * Represents a region of text that should be masked * * Used internally to track the positions and content of text regions * that are marked for masking within the original text string. This * immutable structure ensures consistent processing of mask regions. */ export interface MaskRegion { /** * Starting position of the mask region in the original text (inclusive) */ readonly start: number; /** * Ending position of the mask region in the original text (exclusive) */ readonly end: number; /** * The actual content between delimiters that will be masked */ readonly content: string; } /** * Statistics about mask processing operations * * Provides insights into the processing results for debugging and optimization. * This information can be useful for performance monitoring and validation. */ export interface ProcessingStats { /** * Total number of mask regions found */ readonly regionsFound: number; /** * Total number of characters masked */ readonly charactersMasked: number; /** * Total number of AST nodes processed */ readonly nodesProcessed: number; /** * Processing time in milliseconds */ readonly processingTimeMs: number; } /** * Context information for AST transformation operations * * Provides additional context for transformation functions to enable * better error reporting and debugging capabilities. */ export interface TransformationContext { /** * The current depth in the AST tree */ readonly depth: number; /** * Path to the current node from root */ readonly nodePath: string[]; /** * Processing statistics */ readonly stats: ProcessingStats; }