@adguard/agtree
Version:
Tool set for working with adblock filter lists
69 lines (68 loc) • 1.75 kB
TypeScript
import { type AnyCommentRule } from '../../nodes/index.js';
import { type OutputByteBuffer } from '../../utils/output-byte-buffer.js';
import { BaseSerializer } from '../base-serializer.js';
/**
* `CommentRuleSerializer` is responsible for serializing any comment-like adblock rules.
*
* @example
* Example rules:
* - Adblock agent rules:
* - ```adblock
* [AdGuard]
* ```
* - ```adblock
* [Adblock Plus 2.0]
* ```
* - etc.
* - AdGuard hint rules:
* - ```adblock
* !+ NOT_OPTIMIZED
* ```
* - ```adblock
* !+ NOT_OPTIMIZED PLATFORM(windows)
* ```
* - etc.
* - Pre-processor rules:
* - ```adblock
* !#if (adguard)
* ```
* - ```adblock
* !#endif
* ```
* - etc.
* - Metadata rules:
* - ```adblock
* ! Title: My List
* ```
* - ```adblock
* ! Version: 2.0.150
* ```
* - etc.
* - AGLint inline config rules:
* - ```adblock
* ! aglint-enable some-rule
* ```
* - ```adblock
* ! aglint-disable some-rule
* ```
* - etc.
* - Simple comments:
* - Regular version:
* ```adblock
* ! This is just a comment
* ```
* - uBlock Origin / "hostlist" version:
* ```adblock
* # This is just a comment
* ```
* - etc.
*/
export declare class CommentRuleSerializer extends BaseSerializer {
/**
* Serializes a comment rule node to binary format.
*
* @param node Node to serialize.
* @param buffer ByteBuffer for writing binary data.
*/
static serialize(node: AnyCommentRule, buffer: OutputByteBuffer): void;
}