@@ -9,7 +9,7 @@ declare class Cache$1<K, V> extends Map<K, V> {
99}
1010declare class File$1 {
1111
12- readonly raw : string ;
12+ raw : string ;
1313 readonly lang : DiffHighlighterLang | string ;
1414 readonly fileName ?: string ;
1515 ast ?: DiffAST ;
@@ -84,11 +84,13 @@ export declare class DiffFile {
8484 buildUnifiedDiffLines ( ) : void ;
8585 getSplitLeftLine : ( index : number ) => SplitLineItem ;
8686 getSplitLineByLineNumber : ( lineNumber : number , side : SplitSide ) => SplitLineItem ;
87+ getSplitLineIndexByLineNumber : ( lineNumber : number , side : SplitSide ) => number ;
8788 getSplitRightLine : ( index : number ) => SplitLineItem ;
8889 getSplitHunkLine : ( index : number ) => DiffHunkItem ;
8990 onSplitHunkExpand : ( dir : "up" | "down" | "all" , index : number , needTrigger ?: boolean ) => void ;
9091 getUnifiedLine : ( index : number ) => UnifiedLineItem ;
9192 getUnifiedLineByLineNumber : ( lienNumber : number , side : SplitSide ) => UnifiedLineItem ;
93+ getUnifiedLineIndexByLineNumber : ( lineNumber : number , side : SplitSide ) => number ;
9294 getUnifiedHunkLine : ( index : number ) => DiffHunkItem ;
9395 onUnifiedHunkExpand : ( dir : "up" | "down" | "all" , index : number , needTrigger ?: boolean ) => void ;
9496 onAllExpand : ( mode : "split" | "unified" ) => void ;
@@ -412,8 +414,6 @@ export declare const checkCurrentLineIsHidden: (diffFile: DiffFile, lineNumber:
412414} ;
413415export declare const checkDiffLineIncludeChange : ( diffLine ?: DiffLine ) => boolean ;
414416export declare const disableCache : ( ) => void ;
415- export declare const doAfterTransform : ( content : string ) => string ;
416- export declare const doPreTransform : ( content : string ) => string ;
417417export declare const getDiffRange : ( additions : DiffLine [ ] , deletions : DiffLine [ ] , { getAdditionRaw, getDeletionRaw, getAdditionSyntax, getDeletionSyntax, } : {
418418 getAdditionRaw : ( lineNumber : number ) => string ;
419419 getDeletionRaw : ( lineNumber : number ) => string ;
@@ -438,22 +438,68 @@ export declare const getSyntaxLineTemplate: (line: SyntaxLine) => string;
438438export declare const getUnifiedContentLine : ( diffFile : DiffFile ) => DiffUnifiedContentLineItem [ ] ;
439439export declare const getUnifiedLines : ( diffFile : DiffFile ) => DiffUnifiedLineItem [ ] ;
440440export declare const highlighter : DiffHighlighter ;
441+ /**
442+ * Checks whether content transformation is currently enabled.
443+ *
444+ * @returns {boolean } True if transformation is enabled, false otherwise
445+ *
446+ * @example
447+ * ```typescript
448+ * if (isTransformEnabled()) {
449+ * console.log('Transformations are active');
450+ * }
451+ * ```
452+ */
441453export declare const isTransformEnabled : ( ) => boolean ;
442454export declare const numIterator : < T > ( num : number , cb : ( index : number ) => T ) => T [ ] ;
443455export declare const parseInstance : DiffParser ;
444456export declare const processAST : ( ast : DiffAST ) => {
445457 syntaxFileObject : Record < number , SyntaxLine > ;
446458 syntaxFileLineNumber : number ;
447459} ;
460+ /**
461+ * Applies the transformation function to the provided content if transformation is enabled.
462+ *
463+ * @param content - The content string to transform
464+ * @returns {string } The transformed content if transformation is enabled and configured, otherwise the original content
465+ *
466+ * @example
467+ * ```typescript
468+ * const transformed = processTransformContent(' hello world ');
469+ * ```
470+ */
471+ export declare const processTransformContent : ( content : string ) => string ;
472+ /**
473+ * Applies the file transformation function to the provided content if transformation is enabled.
474+ *
475+ * @param content - The content string to transform
476+ * @returns {string } The transformed content if transformation is enabled and configured, otherwise the original content
477+ *
478+ * @example
479+ * ```typescript
480+ * const transformed = doTransformFile('some file content');
481+ * ```
482+ */
483+ export declare const processTransformForFile : ( content : string ) => string ;
448484export declare const resetDefaultComposeLength : ( ) => void ;
485+ /**
486+ * Resets all transformation functions to their default state and disables transformation.
487+ * This clears any previously set pre-transform and after-transform functions.
488+ *
489+ * @example
490+ * ```typescript
491+ * resetTransform(); // Clears all transformations
492+ * ```
493+ */
449494export declare const resetTransform : ( ) => void ;
450- export declare const setAfterTransform : ( fn : ( content : string ) => string ) => void ;
451495/**
452496 * ⚠️ **WARNING: DANGEROUS OPERATION** ⚠️
453497 *
454498 * Sets a pre-transformation function that will be applied to content before processing.
455499 * This is a global state modification that affects all subsequent operations.
456500 *
501+ * if your set a transform content function, you may also need call `escapeHtml` function to escape html characters.
502+ *
457503 * **CAUTION**:
458504 * - This function modifies global state and may cause unexpected side effects
459505 * - The transformation will be applied to ALL content processing operations
@@ -466,10 +512,32 @@ export declare const setAfterTransform: (fn: (content: string) => string) => voi
466512 * @example
467513 * ```typescript
468514 * // Use with caution - this affects global behavior
469- * setPreTransform((content) => content.trim());
515+ * setTransformForContent((content) => content.trim());
516+ * ```
517+ */
518+ export declare const setTransformForContent : ( fn : ( content : string ) => string ) => void ;
519+ /**
520+ * ⚠️ **WARNING: DANGEROUS OPERATION** ⚠️
521+ *
522+ * Sets a transformation function that will be applied to the file content.
523+ * This is a global state modification that affects all subsequent file operations.
524+ *
525+ * **CAUTION**:
526+ * - This function modifies global state and may cause unexpected side effects
527+ * - The transformation will be applied to ALL file content processing operations
528+ * - Multiple calls will overwrite the previous transform function
529+ * - Ensure proper error handling in your transform function to avoid breaking the entire pipeline
530+ *
531+ * @param fn - The transformation function to apply to file content
532+ * @throws {Error } Throws an error if the provided parameter is not a function
533+ *
534+ * @example
535+ * ```typescript
536+ * // Use with caution - this affects global behavior
537+ * setTransformFile((content) => content.toUpperCase());
470538 * ```
471539 */
472- export declare const setPreTransform : ( fn : ( content : string ) => string ) => void ;
540+ export declare const setTransformForFile : ( fn : ( content : string ) => string ) => void ;
473541export declare const versions : string ;
474542export declare enum DiffFileLineType {
475543 hunk = 1 ,
0 commit comments