@adguard/agtree 3.4.3 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ast-utils/clone.js +2 -2
- package/dist/ast-utils/modifiers.js +2 -2
- package/dist/ast-utils/network-rules.js +2 -2
- package/dist/ast-utils/scriptlets.js +2 -2
- package/dist/common/abp-snippet-injection-body-common.js +2 -2
- package/dist/common/agent-common.js +2 -2
- package/dist/common/ubo-html-filtering-body-common.js +40 -0
- package/dist/common/ubo-selector-common.js +2 -2
- package/dist/compatibility-tables/base.js +2 -2
- package/dist/compatibility-tables/compatibility-table-data.js +2 -2
- package/dist/compatibility-tables/modifiers.js +2 -2
- package/dist/compatibility-tables/platforms.js +2 -2
- package/dist/compatibility-tables/redirects.js +2 -2
- package/dist/compatibility-tables/schemas/base.js +2 -2
- package/dist/compatibility-tables/schemas/modifier.js +2 -2
- package/dist/compatibility-tables/schemas/platform.js +2 -2
- package/dist/compatibility-tables/schemas/redirect.js +2 -2
- package/dist/compatibility-tables/schemas/resource-type.js +2 -2
- package/dist/compatibility-tables/schemas/scriptlet.js +2 -2
- package/dist/compatibility-tables/scriptlets.js +2 -2
- package/dist/compatibility-tables/utils/platform-helpers.js +2 -2
- package/dist/compatibility-tables/utils/resource-type-helpers.js +2 -2
- package/dist/compatibility-tables/utils/zod-camelcase.js +2 -2
- package/dist/converter/base-interfaces/base-converter.js +2 -2
- package/dist/converter/base-interfaces/conversion-result.js +2 -2
- package/dist/converter/base-interfaces/rule-converter-base.js +2 -2
- package/dist/converter/comment/index.js +2 -2
- package/dist/converter/cosmetic/css.js +2 -2
- package/dist/converter/cosmetic/element-hiding.js +2 -2
- package/dist/converter/cosmetic/header-removal.js +24 -42
- package/dist/converter/cosmetic/html.js +580 -438
- package/dist/converter/cosmetic/index.js +3 -2
- package/dist/converter/cosmetic/rule-modifiers/adg.js +2 -2
- package/dist/converter/cosmetic/rule-modifiers/ubo.js +2 -2
- package/dist/converter/cosmetic/scriptlet.js +2 -2
- package/dist/converter/css/index.js +3 -2
- package/dist/converter/data/css.js +32 -54
- package/dist/converter/filter-list.js +2 -2
- package/dist/converter/index.js +2 -2
- package/dist/converter/misc/network-rule-modifier.js +2 -2
- package/dist/converter/network/index.js +2 -2
- package/dist/converter/raw-filter-list.js +2 -2
- package/dist/converter/raw-rule.js +6 -3
- package/dist/converter/rule.js +2 -2
- package/dist/errors/adblock-syntax-error.js +2 -2
- package/dist/errors/binary-schema-mismatch-error.js +2 -2
- package/dist/errors/not-implemented-error.js +2 -2
- package/dist/errors/rule-conversion-error.js +2 -2
- package/dist/generator/base-generator.js +2 -2
- package/dist/generator/comment/agent-comment-generator.js +2 -2
- package/dist/generator/comment/agent-generator.js +2 -2
- package/dist/generator/comment/comment-rule-generator.js +2 -2
- package/dist/generator/comment/config-comment-generator.js +2 -2
- package/dist/generator/comment/hint-comment-generator.js +2 -2
- package/dist/generator/comment/hint-generator.js +2 -2
- package/dist/generator/comment/metadata-comment-generator.js +2 -2
- package/dist/generator/comment/pre-processor-comment-generator.js +2 -2
- package/dist/generator/comment/simple-comment-generator.js +2 -2
- package/dist/generator/cosmetic/cosmetic-rule-body-generator.js +21 -6
- package/dist/generator/cosmetic/cosmetic-rule-generator.js +2 -2
- package/dist/generator/cosmetic/cosmetic-rule-pattern-generator.js +2 -2
- package/dist/generator/cosmetic/html-filtering-body/adg-html-filtering-body-generator.js +38 -0
- package/dist/generator/cosmetic/html-filtering-body/html-filtering-body-generator.js +32 -0
- package/dist/generator/cosmetic/html-filtering-body/ubo-html-filtering-body-generator.js +65 -0
- package/dist/generator/cosmetic/{body → scriptlet-body}/abp-snippet-injection-body-generator.js +2 -2
- package/dist/generator/cosmetic/{body → scriptlet-body}/adg-scriptlet-injection-body-generator.js +2 -2
- package/dist/generator/cosmetic/{body → scriptlet-body}/ubo-scriptlet-injection-body-generator.js +2 -2
- package/dist/generator/cosmetic/selector/attribute-selector-generator.js +42 -0
- package/dist/generator/cosmetic/selector/class-selector-generator.js +26 -0
- package/dist/generator/cosmetic/selector/complex-selector-generator.js +71 -0
- package/dist/generator/cosmetic/selector/id-selector-generator.js +26 -0
- package/dist/generator/cosmetic/selector/pseudo-class-selector-generator.js +35 -0
- package/dist/generator/cosmetic/selector/selector-combinator-generator.js +30 -0
- package/dist/generator/cosmetic/selector/selector-list-generator.js +41 -0
- package/dist/generator/cosmetic/selector/type-selector-generator.js +25 -0
- package/dist/generator/css/adg-css-injection-generator.js +5 -6
- package/dist/generator/filterlist-generator.js +2 -2
- package/dist/generator/index.js +2 -2
- package/dist/generator/misc/domain-list-generator.js +2 -2
- package/dist/generator/misc/list-items-generator.js +2 -2
- package/dist/generator/misc/logical-expression-generator.js +2 -2
- package/dist/generator/misc/modifier-generator.js +2 -2
- package/dist/generator/misc/modifier-list-generator.js +2 -2
- package/dist/generator/misc/parameter-list-generator.js +2 -2
- package/dist/generator/misc/value-generator.js +2 -2
- package/dist/generator/network/host-rule-generator.js +2 -2
- package/dist/generator/network/network-rule-generator.js +2 -2
- package/dist/generator/rule-generator.js +2 -2
- package/dist/index.js +4 -14
- package/dist/nodes/index.js +2 -2
- package/dist/package.json.js +3 -3
- package/dist/parser/base-parser.js +2 -2
- package/dist/parser/comment/agent-comment-parser.js +2 -2
- package/dist/parser/comment/agent-parser.js +2 -2
- package/dist/parser/comment/comment-parser.js +2 -2
- package/dist/parser/comment/config-comment-parser.js +2 -2
- package/dist/parser/comment/hint-comment-parser.js +2 -2
- package/dist/parser/comment/hint-parser.js +2 -2
- package/dist/parser/comment/metadata-comment-parser.js +2 -2
- package/dist/parser/comment/preprocessor-parser.js +2 -2
- package/dist/parser/comment/simple-comment-parser.js +2 -2
- package/dist/parser/cosmetic/cosmetic-rule-parser.js +10 -21
- package/dist/parser/cosmetic/html-filtering-body/adg-html-filtering-body-parser.js +49 -0
- package/dist/parser/cosmetic/html-filtering-body/html-filtering-body-parser.js +70 -0
- package/dist/parser/cosmetic/html-filtering-body/ubo-html-filtering-body-parser.js +180 -0
- package/dist/parser/cosmetic/{body → scriptlet-body}/abp-snippet-injection-body-parser.js +2 -2
- package/dist/parser/cosmetic/{body → scriptlet-body}/adg-scriptlet-injection-body-parser.js +2 -2
- package/dist/parser/cosmetic/{body → scriptlet-body}/ubo-scriptlet-injection-body-parser.js +2 -2
- package/dist/parser/cosmetic/selector/handlers/attribute-selector-handler.js +206 -0
- package/dist/parser/cosmetic/selector/handlers/class-selector-handler.js +48 -0
- package/dist/parser/cosmetic/selector/handlers/complex-selector-handler.js +67 -0
- package/dist/parser/cosmetic/selector/handlers/compound-selector-handler.js +97 -0
- package/dist/parser/cosmetic/selector/handlers/id-selector-handler.js +42 -0
- package/dist/parser/cosmetic/selector/handlers/pseudo-class-selector-handler.js +128 -0
- package/dist/parser/cosmetic/selector/handlers/type-selector-handler.js +58 -0
- package/dist/parser/cosmetic/selector/selector-list-parser.js +164 -0
- package/dist/parser/css/adg-css-injection-parser.js +4 -5
- package/dist/parser/css/balancing.js +2 -2
- package/dist/parser/css/constants.js +2 -2
- package/dist/parser/css/css-token-stream.js +41 -4
- package/dist/parser/css/ubo-selector-parser.js +2 -2
- package/dist/parser/filterlist-parser.js +2 -2
- package/dist/parser/index.js +2 -2
- package/dist/parser/misc/app-list-parser.js +2 -2
- package/dist/parser/misc/domain-list-parser.js +2 -2
- package/dist/parser/misc/list-items-parser.js +2 -2
- package/dist/parser/misc/logical-expression-parser.js +2 -2
- package/dist/parser/misc/method-list-parser.js +2 -2
- package/dist/parser/misc/modifier-list.js +2 -2
- package/dist/parser/misc/modifier-parser.js +2 -2
- package/dist/parser/misc/parameter-list-parser.js +2 -2
- package/dist/parser/misc/stealth-option-list-parser.js +2 -2
- package/dist/parser/misc/ubo-parameter-list-parser.js +2 -2
- package/dist/parser/misc/value-parser.js +2 -2
- package/dist/parser/network/host-rule-parser.js +2 -2
- package/dist/parser/network/network-rule-parser.js +2 -2
- package/dist/parser/options.js +3 -2
- package/dist/parser/rule-parser.js +2 -2
- package/dist/types/common/ubo-html-filtering-body-common.d.ts +12 -0
- package/dist/types/compatibility-tables/compatibility-table-data.d.ts +3 -3
- package/dist/types/compatibility-tables/schemas/redirect.d.ts +1 -1
- package/dist/types/compatibility-tables/schemas/scriptlet.d.ts +2 -2
- package/dist/types/converter/cosmetic/html.d.ts +167 -42
- package/dist/types/converter/data/css.d.ts +18 -6
- package/dist/types/generator/cosmetic/html-filtering-body/adg-html-filtering-body-generator.d.ts +17 -0
- package/dist/types/generator/cosmetic/html-filtering-body/html-filtering-body-generator.d.ts +17 -0
- package/dist/types/generator/cosmetic/html-filtering-body/ubo-html-filtering-body-generator.d.ts +30 -0
- package/dist/types/generator/cosmetic/selector/attribute-selector-generator.d.ts +15 -0
- package/dist/types/generator/cosmetic/selector/class-selector-generator.d.ts +15 -0
- package/dist/types/generator/cosmetic/selector/complex-selector-generator.d.ts +17 -0
- package/dist/types/generator/cosmetic/selector/id-selector-generator.d.ts +15 -0
- package/dist/types/generator/cosmetic/selector/pseudo-class-selector-generator.d.ts +15 -0
- package/dist/types/generator/cosmetic/selector/selector-combinator-generator.d.ts +15 -0
- package/dist/types/generator/cosmetic/selector/selector-list-generator.d.ts +17 -0
- package/dist/types/generator/cosmetic/selector/type-selector-generator.d.ts +15 -0
- package/dist/types/generator/css/adg-css-injection-generator.d.ts +1 -1
- package/dist/types/index.d.ts +3 -13
- package/dist/types/nodes/index.d.ts +159 -3
- package/dist/types/parser/cosmetic/html-filtering-body/adg-html-filtering-body-parser.d.ts +35 -0
- package/dist/types/parser/cosmetic/html-filtering-body/html-filtering-body-parser.d.ts +39 -0
- package/dist/types/parser/cosmetic/html-filtering-body/ubo-html-filtering-body-parser.d.ts +63 -0
- package/dist/types/parser/cosmetic/selector/context.d.ts +42 -0
- package/dist/types/parser/cosmetic/selector/handlers/attribute-selector-handler.d.ts +35 -0
- package/dist/types/parser/cosmetic/selector/handlers/class-selector-handler.d.ts +15 -0
- package/dist/types/parser/cosmetic/selector/handlers/complex-selector-handler.d.ts +20 -0
- package/dist/types/parser/cosmetic/selector/handlers/compound-selector-handler.d.ts +25 -0
- package/dist/types/parser/cosmetic/selector/handlers/id-selector-handler.d.ts +15 -0
- package/dist/types/parser/cosmetic/selector/handlers/pseudo-class-selector-handler.d.ts +15 -0
- package/dist/types/parser/cosmetic/selector/handlers/type-selector-handler.d.ts +15 -0
- package/dist/types/parser/cosmetic/selector/selector-list-parser.d.ts +38 -0
- package/dist/types/parser/css/adg-css-injection-parser.d.ts +0 -2
- package/dist/types/parser/css/css-token-stream.d.ts +18 -0
- package/dist/types/parser/network/network-rule-parser.d.ts +1 -1
- package/dist/types/parser/options.d.ts +5 -0
- package/dist/types/utils/constants.d.ts +1 -0
- package/dist/types/utils/index.d.ts +0 -6
- package/dist/types/utils/quotes.d.ts +44 -0
- package/dist/types/utils/regexp.d.ts +24 -0
- package/dist/utils/adblockers.js +2 -2
- package/dist/utils/bit-count.js +2 -2
- package/dist/utils/categorizer.js +2 -2
- package/dist/utils/clone.js +2 -2
- package/dist/utils/constants.js +6 -9
- package/dist/utils/cosmetic-rule-separator.js +2 -2
- package/dist/utils/deep-freeze.js +2 -2
- package/dist/utils/domain.js +2 -2
- package/dist/utils/error.js +2 -2
- package/dist/utils/index.js +2 -8
- package/dist/utils/logical-expression.js +2 -2
- package/dist/utils/multi-value-map.js +2 -2
- package/dist/utils/noop-modifier.js +2 -2
- package/dist/utils/position-provider.js +2 -2
- package/dist/utils/quotes.js +163 -10
- package/dist/utils/regexp.js +31 -2
- package/dist/utils/string.js +2 -2
- package/dist/utils/type-guards.js +3 -13
- package/dist/validator/constants.js +2 -2
- package/dist/validator/helpers.js +2 -2
- package/dist/validator/index.js +2 -2
- package/dist/validator/value.js +2 -2
- package/dist/version.js +2 -2
- package/package.json +6 -14
- package/dist/deserializer/base-deserializer.js +0 -29
- package/dist/deserializer/comment/agent-comment-deserializer.js +0 -79
- package/dist/deserializer/comment/agent-deserializer.js +0 -65
- package/dist/deserializer/comment/comment-rule-deserializer.js +0 -54
- package/dist/deserializer/comment/config-comment-deserializer.js +0 -111
- package/dist/deserializer/comment/hint-comment-deserializer.js +0 -72
- package/dist/deserializer/comment/hint-deserializer.js +0 -85
- package/dist/deserializer/comment/metadata-comment-deserializer.js +0 -69
- package/dist/deserializer/comment/pre-processor-comment-deserializer.js +0 -112
- package/dist/deserializer/comment/simple-comment-deserializer.js +0 -65
- package/dist/deserializer/cosmetic/cosmetic-rule-deserializer.js +0 -131
- package/dist/deserializer/cosmetic/css-injection-body-deserializer.js +0 -56
- package/dist/deserializer/cosmetic/element-hiding-body-deserializer.js +0 -48
- package/dist/deserializer/cosmetic/scriptlet-body/abp-snippet-injection-body-deserializer.js +0 -39
- package/dist/deserializer/cosmetic/scriptlet-body/adg-scriptlet-injection-body-deserializer.js +0 -40
- package/dist/deserializer/cosmetic/scriptlet-body/scriptlet-body-deserializer.js +0 -54
- package/dist/deserializer/cosmetic/scriptlet-body/ubo-scriptlet-injection-body-deserializer.js +0 -38
- package/dist/deserializer/empty-rule-deserializer.js +0 -48
- package/dist/deserializer/filterlist-deserializer.js +0 -85
- package/dist/deserializer/index.js +0 -8
- package/dist/deserializer/invalid-rule-deserializer.js +0 -50
- package/dist/deserializer/invalid-rule-error-node-deserializer.js +0 -50
- package/dist/deserializer/misc/domain-list-deserializer.js +0 -64
- package/dist/deserializer/misc/list-item-deserializer.js +0 -69
- package/dist/deserializer/misc/list-items-deserializer.js +0 -30
- package/dist/deserializer/misc/logical-expression-deserializer.js +0 -196
- package/dist/deserializer/misc/modifier-deserializer.js +0 -87
- package/dist/deserializer/misc/modifier-list-deserializer.js +0 -61
- package/dist/deserializer/misc/parameter-list-deserializer.js +0 -64
- package/dist/deserializer/misc/value-deserializer.js +0 -50
- package/dist/deserializer/network/host-rule-deserializer.js +0 -67
- package/dist/deserializer/network/hostname-list-deserializer.js +0 -56
- package/dist/deserializer/network/network-rule-deserializer.js +0 -65
- package/dist/deserializer/rule-deserializer.js +0 -65
- package/dist/deserializer/syntax-deserialization-map.js +0 -21
- package/dist/marshalling-utils/comment/agent-comment-common.js +0 -21
- package/dist/marshalling-utils/comment/agent-common.js +0 -40
- package/dist/marshalling-utils/comment/config-comment-common.js +0 -54
- package/dist/marshalling-utils/comment/hint-comment-common.js +0 -22
- package/dist/marshalling-utils/comment/hint-common.js +0 -56
- package/dist/marshalling-utils/comment/metadata-comment-common.js +0 -41
- package/dist/marshalling-utils/comment/pre-processor-comment-common.js +0 -59
- package/dist/marshalling-utils/comment/simple-comment-common.js +0 -22
- package/dist/marshalling-utils/cosmetic/body/abp-snippet-injection-body-common.js +0 -61
- package/dist/marshalling-utils/cosmetic/body/adg-scriptlet-injection-body-common.js +0 -66
- package/dist/marshalling-utils/cosmetic/body/css-injection-body-common.js +0 -24
- package/dist/marshalling-utils/cosmetic/body/element-hiding-body-common.js +0 -21
- package/dist/marshalling-utils/cosmetic/body/ubo-scriptlet-injection-body-common.js +0 -114
- package/dist/marshalling-utils/cosmetic/cosmetic-rule-common.js +0 -46
- package/dist/marshalling-utils/empty-rule-common.js +0 -20
- package/dist/marshalling-utils/filter-list-common.js +0 -21
- package/dist/marshalling-utils/invalid-rule-common.js +0 -21
- package/dist/marshalling-utils/invalid-rule-error-node-common.js +0 -22
- package/dist/marshalling-utils/misc/binary-type-common.js +0 -54
- package/dist/marshalling-utils/misc/domain-list-common.js +0 -36
- package/dist/marshalling-utils/misc/host-rule-common.js +0 -24
- package/dist/marshalling-utils/misc/hostname-list-common.js +0 -21
- package/dist/marshalling-utils/misc/list-item-common.js +0 -22
- package/dist/marshalling-utils/misc/logical-expression-common.js +0 -83
- package/dist/marshalling-utils/misc/modifier-common.js +0 -231
- package/dist/marshalling-utils/misc/modifier-list-common.js +0 -21
- package/dist/marshalling-utils/misc/parameter-list-common.js +0 -21
- package/dist/marshalling-utils/misc/value-common.js +0 -22
- package/dist/marshalling-utils/network/network-rule-common.js +0 -24
- package/dist/marshalling-utils/syntax-serialization-map.js +0 -30
- package/dist/serializer/base-serializer.js +0 -29
- package/dist/serializer/comment/agent-comment-serializer.js +0 -74
- package/dist/serializer/comment/agent-serializer.js +0 -59
- package/dist/serializer/comment/comment-rule-serializer.js +0 -105
- package/dist/serializer/comment/config-comment-serializer.js +0 -82
- package/dist/serializer/comment/hint-comment-serializer.js +0 -65
- package/dist/serializer/comment/hint-serializer.js +0 -54
- package/dist/serializer/comment/metadata-comment-serializer.js +0 -73
- package/dist/serializer/comment/pre-processor-comment-serializer.js +0 -71
- package/dist/serializer/comment/simple-comment-serializer.js +0 -52
- package/dist/serializer/cosmetic/body/abp-snippet-injection-body-serializer.js +0 -36
- package/dist/serializer/cosmetic/body/adg-scriptlet-injection-body-serializer.js +0 -36
- package/dist/serializer/cosmetic/body/scriptlet-body-serializer.js +0 -50
- package/dist/serializer/cosmetic/body/ubo-scriptlet-injection-body-serializer.js +0 -36
- package/dist/serializer/cosmetic/cosmetic-rule-serializer.js +0 -120
- package/dist/serializer/cosmetic/css-injection-body-serializer.js +0 -51
- package/dist/serializer/cosmetic/element-hiding-body-serializer.js +0 -40
- package/dist/serializer/empty-rule-serializer.js +0 -37
- package/dist/serializer/filterlist-serializer.js +0 -45
- package/dist/serializer/index.js +0 -7
- package/dist/serializer/invalid-rule-error-node-serializer.js +0 -41
- package/dist/serializer/invalid-rule-serializer.js +0 -40
- package/dist/serializer/misc/domain-list-serializer.js +0 -64
- package/dist/serializer/misc/list-item-serializer.js +0 -58
- package/dist/serializer/misc/list-items-serializer.js +0 -29
- package/dist/serializer/misc/logical-expression-serializer.js +0 -136
- package/dist/serializer/misc/modifier-list-serializer.js +0 -58
- package/dist/serializer/misc/modifier-serializer.js +0 -49
- package/dist/serializer/misc/parameter-list-serializer.js +0 -52
- package/dist/serializer/misc/value-serializer.js +0 -50
- package/dist/serializer/network/host-rule-serializer.js +0 -70
- package/dist/serializer/network/hostname-list-serializer.js +0 -53
- package/dist/serializer/network/network-rule-serializer.js +0 -54
- package/dist/serializer/rule-serializer.js +0 -61
- package/dist/types/deserializer/base-deserializer.d.ts +0 -15
- package/dist/types/deserializer/comment/agent-comment-deserializer.d.ts +0 -34
- package/dist/types/deserializer/comment/agent-deserializer.d.ts +0 -25
- package/dist/types/deserializer/comment/comment-rule-deserializer.d.ts +0 -16
- package/dist/types/deserializer/comment/config-comment-deserializer.d.ts +0 -27
- package/dist/types/deserializer/comment/hint-comment-deserializer.d.ts +0 -24
- package/dist/types/deserializer/comment/hint-deserializer.d.ts +0 -26
- package/dist/types/deserializer/comment/metadata-comment-deserializer.d.ts +0 -26
- package/dist/types/deserializer/comment/pre-processor-comment-deserializer.d.ts +0 -29
- package/dist/types/deserializer/comment/simple-comment-deserializer.d.ts +0 -26
- package/dist/types/deserializer/cosmetic/cosmetic-rule-deserializer.d.ts +0 -18
- package/dist/types/deserializer/cosmetic/css-injection-body-deserializer.d.ts +0 -15
- package/dist/types/deserializer/cosmetic/element-hiding-body-deserializer.d.ts +0 -16
- package/dist/types/deserializer/cosmetic/scriptlet-body/abp-snippet-injection-body-deserializer.d.ts +0 -17
- package/dist/types/deserializer/cosmetic/scriptlet-body/adg-scriptlet-injection-body-deserializer.d.ts +0 -18
- package/dist/types/deserializer/cosmetic/scriptlet-body/scriptlet-body-deserializer.d.ts +0 -19
- package/dist/types/deserializer/cosmetic/scriptlet-body/ubo-scriptlet-injection-body-deserializer.d.ts +0 -17
- package/dist/types/deserializer/empty-rule-deserializer.d.ts +0 -16
- package/dist/types/deserializer/filterlist-deserializer.d.ts +0 -34
- package/dist/types/deserializer/index.d.ts +0 -2
- package/dist/types/deserializer/invalid-rule-deserializer.d.ts +0 -16
- package/dist/types/deserializer/invalid-rule-error-node-deserializer.d.ts +0 -16
- package/dist/types/deserializer/misc/domain-list-deserializer.d.ts +0 -15
- package/dist/types/deserializer/misc/list-item-deserializer.d.ts +0 -19
- package/dist/types/deserializer/misc/list-items-deserializer.d.ts +0 -16
- package/dist/types/deserializer/misc/logical-expression-deserializer.d.ts +0 -55
- package/dist/types/deserializer/misc/modifier-deserializer.d.ts +0 -18
- package/dist/types/deserializer/misc/modifier-list-deserializer.d.ts +0 -20
- package/dist/types/deserializer/misc/parameter-list-deserializer.d.ts +0 -18
- package/dist/types/deserializer/misc/value-deserializer.d.ts +0 -17
- package/dist/types/deserializer/network/host-rule-deserializer.d.ts +0 -18
- package/dist/types/deserializer/network/hostname-list-deserializer.d.ts +0 -15
- package/dist/types/deserializer/network/network-rule-deserializer.d.ts +0 -18
- package/dist/types/deserializer/rule-deserializer.d.ts +0 -17
- package/dist/types/deserializer/syntax-deserialization-map.d.ts +0 -2
- package/dist/types/marshalling-utils/comment/agent-comment-common.d.ts +0 -14
- package/dist/types/marshalling-utils/comment/agent-common.d.ts +0 -20
- package/dist/types/marshalling-utils/comment/config-comment-common.d.ts +0 -42
- package/dist/types/marshalling-utils/comment/hint-comment-common.d.ts +0 -15
- package/dist/types/marshalling-utils/comment/hint-common.d.ts +0 -33
- package/dist/types/marshalling-utils/comment/metadata-comment-common.d.ts +0 -21
- package/dist/types/marshalling-utils/comment/pre-processor-comment-common.d.ts +0 -37
- package/dist/types/marshalling-utils/comment/simple-comment-common.d.ts +0 -15
- package/dist/types/marshalling-utils/cosmetic/body/abp-snippet-injection-body-common.d.ts +0 -23
- package/dist/types/marshalling-utils/cosmetic/body/adg-scriptlet-injection-body-common.d.ts +0 -9
- package/dist/types/marshalling-utils/cosmetic/body/css-injection-body-common.d.ts +0 -17
- package/dist/types/marshalling-utils/cosmetic/body/element-hiding-body-common.d.ts +0 -14
- package/dist/types/marshalling-utils/cosmetic/body/ubo-scriptlet-injection-body-common.d.ts +0 -9
- package/dist/types/marshalling-utils/cosmetic/cosmetic-rule-common.d.ts +0 -28
- package/dist/types/marshalling-utils/empty-rule-common.d.ts +0 -13
- package/dist/types/marshalling-utils/filter-list-common.d.ts +0 -14
- package/dist/types/marshalling-utils/invalid-rule-common.d.ts +0 -14
- package/dist/types/marshalling-utils/invalid-rule-error-node-common.d.ts +0 -15
- package/dist/types/marshalling-utils/misc/binary-type-common.d.ts +0 -57
- package/dist/types/marshalling-utils/misc/domain-list-common.d.ts +0 -24
- package/dist/types/marshalling-utils/misc/host-rule-common.d.ts +0 -18
- package/dist/types/marshalling-utils/misc/hostname-list-common.d.ts +0 -14
- package/dist/types/marshalling-utils/misc/list-item-common.d.ts +0 -15
- package/dist/types/marshalling-utils/misc/logical-expression-common.d.ts +0 -47
- package/dist/types/marshalling-utils/misc/modifier-common.d.ts +0 -41
- package/dist/types/marshalling-utils/misc/modifier-list-common.d.ts +0 -14
- package/dist/types/marshalling-utils/misc/parameter-list-common.d.ts +0 -14
- package/dist/types/marshalling-utils/misc/value-common.d.ts +0 -15
- package/dist/types/marshalling-utils/network/network-rule-common.d.ts +0 -18
- package/dist/types/marshalling-utils/syntax-serialization-map.d.ts +0 -2
- package/dist/types/serializer/base-serializer.d.ts +0 -15
- package/dist/types/serializer/comment/agent-comment-serializer.d.ts +0 -34
- package/dist/types/serializer/comment/agent-serializer.d.ts +0 -15
- package/dist/types/serializer/comment/comment-rule-serializer.d.ts +0 -68
- package/dist/types/serializer/comment/config-comment-serializer.d.ts +0 -25
- package/dist/types/serializer/comment/hint-comment-serializer.d.ts +0 -23
- package/dist/types/serializer/comment/hint-serializer.d.ts +0 -24
- package/dist/types/serializer/comment/metadata-comment-serializer.d.ts +0 -25
- package/dist/types/serializer/comment/pre-processor-comment-serializer.d.ts +0 -28
- package/dist/types/serializer/comment/simple-comment-serializer.d.ts +0 -24
- package/dist/types/serializer/cosmetic/body/abp-snippet-injection-body-serializer.d.ts +0 -25
- package/dist/types/serializer/cosmetic/body/adg-scriptlet-injection-body-serializer.d.ts +0 -25
- package/dist/types/serializer/cosmetic/body/scriptlet-body-serializer.d.ts +0 -17
- package/dist/types/serializer/cosmetic/body/ubo-scriptlet-injection-body-serializer.d.ts +0 -25
- package/dist/types/serializer/cosmetic/cosmetic-rule-serializer.d.ts +0 -19
- package/dist/types/serializer/cosmetic/css-injection-body-serializer.d.ts +0 -15
- package/dist/types/serializer/cosmetic/element-hiding-body-serializer.d.ts +0 -15
- package/dist/types/serializer/empty-rule-serializer.d.ts +0 -15
- package/dist/types/serializer/filterlist-serializer.d.ts +0 -15
- package/dist/types/serializer/index.d.ts +0 -1
- package/dist/types/serializer/invalid-rule-error-node-serializer.d.ts +0 -15
- package/dist/types/serializer/invalid-rule-serializer.d.ts +0 -15
- package/dist/types/serializer/misc/domain-list-serializer.d.ts +0 -21
- package/dist/types/serializer/misc/list-item-serializer.d.ts +0 -16
- package/dist/types/serializer/misc/list-items-serializer.d.ts +0 -15
- package/dist/types/serializer/misc/logical-expression-serializer.d.ts +0 -52
- package/dist/types/serializer/misc/modifier-list-serializer.d.ts +0 -20
- package/dist/types/serializer/misc/modifier-serializer.d.ts +0 -18
- package/dist/types/serializer/misc/parameter-list-serializer.d.ts +0 -17
- package/dist/types/serializer/misc/value-serializer.d.ts +0 -17
- package/dist/types/serializer/network/host-rule-serializer.d.ts +0 -30
- package/dist/types/serializer/network/hostname-list-serializer.d.ts +0 -15
- package/dist/types/serializer/network/network-rule-serializer.d.ts +0 -18
- package/dist/types/serializer/rule-serializer.d.ts +0 -17
- package/dist/types/utils/binary-schema-version.d.ts +0 -9
- package/dist/types/utils/byte-buffer.d.ts +0 -54
- package/dist/types/utils/input-byte-buffer.d.ts +0 -146
- package/dist/types/utils/is-chromium.d.ts +0 -7
- package/dist/types/utils/output-byte-buffer.d.ts +0 -132
- package/dist/types/utils/storage-interface.d.ts +0 -23
- package/dist/types/utils/text-decoder-polyfill.d.ts +0 -14
- package/dist/types/utils/text-encoder-polyfill.d.ts +0 -18
- package/dist/utils/binary-schema-version.js +0 -17
- package/dist/utils/byte-buffer.js +0 -91
- package/dist/utils/input-byte-buffer.js +0 -266
- package/dist/utils/is-chromium.js +0 -20
- package/dist/utils/output-byte-buffer.js +0 -231
- package/dist/utils/text-decoder-polyfill.js +0 -107
- package/dist/utils/text-encoder-polyfill.js +0 -78
- /package/dist/types/generator/cosmetic/{body → scriptlet-body}/abp-snippet-injection-body-generator.d.ts +0 -0
- /package/dist/types/generator/cosmetic/{body → scriptlet-body}/adg-scriptlet-injection-body-generator.d.ts +0 -0
- /package/dist/types/generator/cosmetic/{body → scriptlet-body}/ubo-scriptlet-injection-body-generator.d.ts +0 -0
- /package/dist/types/parser/cosmetic/{body → scriptlet-body}/abp-snippet-injection-body-parser.d.ts +0 -0
- /package/dist/types/parser/cosmetic/{body → scriptlet-body}/adg-scriptlet-injection-body-parser.d.ts +0 -0
- /package/dist/types/parser/cosmetic/{body → scriptlet-body}/ubo-scriptlet-injection-body-parser.d.ts +0 -0
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree
|
|
3
|
-
* (c)
|
|
2
|
+
* AGTree v4.0.1 (build date: Thu, 19 Feb 2026 05:13:05 GMT)
|
|
3
|
+
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
6
6
|
*/
|
|
7
|
-
import { TokenType, getFormattedTokenName } from '@adguard/css-tokenizer';
|
|
7
|
+
import { TokenType, getFormattedTokenName, tokenizeExtended } from '@adguard/css-tokenizer';
|
|
8
8
|
import { sprintf } from 'sprintf-js';
|
|
9
9
|
import { tokenizeBalanced } from './balancing.js';
|
|
10
10
|
import { EMPTY } from '../../utils/constants.js';
|
|
11
11
|
import { AdblockSyntaxError } from '../../errors/adblock-syntax-error.js';
|
|
12
12
|
import { ERROR_MESSAGES, END_OF_INPUT } from './constants.js';
|
|
13
|
-
import { EXT_CSS_PSEUDO_CLASSES, EXT_CSS_PSEUDO_CLASSES_STRICT, LEGACY_EXT_CSS_ATTRIBUTE_PREFIX, ABP_EXT_CSS_PREFIX } from '../../converter/data/css.js';
|
|
13
|
+
import { EXT_CSS_PSEUDO_CLASSES, EXT_CSS_PSEUDO_CLASSES_STRICT, NATIVE_CSS_PSEUDO_CLASSES, LEGACY_EXT_CSS_ATTRIBUTE_PREFIX, ABP_EXT_CSS_PREFIX } from '../../converter/data/css.js';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* @file CSS token stream.
|
|
@@ -304,6 +304,7 @@ class CssTokenStream {
|
|
|
304
304
|
}
|
|
305
305
|
/**
|
|
306
306
|
* Strictly checks whether the token stream contains any Extended CSS elements, such as `:contains()`.
|
|
307
|
+
*
|
|
307
308
|
* Some Extended CSS elements are natively supported by browsers, like `:has()`.
|
|
308
309
|
* This method is used to check for Extended CSS elements that are not natively supported by browsers,
|
|
309
310
|
* this is why it called "strict", because it strictly checks for Extended CSS elements.
|
|
@@ -313,6 +314,42 @@ class CssTokenStream {
|
|
|
313
314
|
hasAnySelectorExtendedCssNodeStrict() {
|
|
314
315
|
return this.hasAnySelectorExtendedCssNodeInternal(EXT_CSS_PSEUDO_CLASSES_STRICT);
|
|
315
316
|
}
|
|
317
|
+
/**
|
|
318
|
+
* _Lightweight_ static check for native CSS pseudo-classes — `:has()`, `:is()`, `:not()`.
|
|
319
|
+
*
|
|
320
|
+
* This method uses `tokenizeExtended` directly with early stopping,
|
|
321
|
+
* avoiding the overhead of:
|
|
322
|
+
* - full tokenization with balance tracking;
|
|
323
|
+
* - storing all tokens in memory;
|
|
324
|
+
* - processing remaining tokens after a match is found.
|
|
325
|
+
*
|
|
326
|
+
* Use this method when you only need to detect native pseudo-classes
|
|
327
|
+
* and don't need the full `CssTokenStream` functionality.
|
|
328
|
+
*
|
|
329
|
+
* @param selector CSS selector string to check.
|
|
330
|
+
* @returns True if the selector contains `:has()`, `:is()`, or `:not()`,
|
|
331
|
+
* otherwise false.
|
|
332
|
+
*/
|
|
333
|
+
static hasNativeCssPseudoClass(selector) {
|
|
334
|
+
let found = false;
|
|
335
|
+
try {
|
|
336
|
+
tokenizeExtended(selector, (type, start, end, _props, stop) => {
|
|
337
|
+
if (type === TokenType.Function) {
|
|
338
|
+
// Omit trailing '(' from function name
|
|
339
|
+
const name = selector.slice(start, end - 1);
|
|
340
|
+
if (NATIVE_CSS_PSEUDO_CLASSES.has(name)) {
|
|
341
|
+
found = true;
|
|
342
|
+
stop();
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
catch {
|
|
348
|
+
// Invalid CSS, treat as not containing native pseudo-classes
|
|
349
|
+
return false;
|
|
350
|
+
}
|
|
351
|
+
return found;
|
|
352
|
+
}
|
|
316
353
|
/**
|
|
317
354
|
* Checks whether the token stream contains any Extended CSS elements, such as `:has()`, `:contains()`, etc.
|
|
318
355
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree
|
|
3
|
-
* (c)
|
|
2
|
+
* AGTree v4.0.1 (build date: Thu, 19 Feb 2026 05:13:05 GMT)
|
|
3
|
+
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
6
6
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree
|
|
3
|
-
* (c)
|
|
2
|
+
* AGTree v4.0.1 (build date: Thu, 19 Feb 2026 05:13:05 GMT)
|
|
3
|
+
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
6
6
|
*/
|
package/dist/parser/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree
|
|
3
|
-
* (c)
|
|
2
|
+
* AGTree v4.0.1 (build date: Thu, 19 Feb 2026 05:13:05 GMT)
|
|
3
|
+
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
6
6
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree
|
|
3
|
-
* (c)
|
|
2
|
+
* AGTree v4.0.1 (build date: Thu, 19 Feb 2026 05:13:05 GMT)
|
|
3
|
+
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
6
6
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree
|
|
3
|
-
* (c)
|
|
2
|
+
* AGTree v4.0.1 (build date: Thu, 19 Feb 2026 05:13:05 GMT)
|
|
3
|
+
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
6
6
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree
|
|
3
|
-
* (c)
|
|
2
|
+
* AGTree v4.0.1 (build date: Thu, 19 Feb 2026 05:13:05 GMT)
|
|
3
|
+
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
6
6
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree
|
|
3
|
-
* (c)
|
|
2
|
+
* AGTree v4.0.1 (build date: Thu, 19 Feb 2026 05:13:05 GMT)
|
|
3
|
+
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
6
6
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree
|
|
3
|
-
* (c)
|
|
2
|
+
* AGTree v4.0.1 (build date: Thu, 19 Feb 2026 05:13:05 GMT)
|
|
3
|
+
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
6
6
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree
|
|
3
|
-
* (c)
|
|
2
|
+
* AGTree v4.0.1 (build date: Thu, 19 Feb 2026 05:13:05 GMT)
|
|
3
|
+
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
6
6
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree
|
|
3
|
-
* (c)
|
|
2
|
+
* AGTree v4.0.1 (build date: Thu, 19 Feb 2026 05:13:05 GMT)
|
|
3
|
+
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
6
6
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree
|
|
3
|
-
* (c)
|
|
2
|
+
* AGTree v4.0.1 (build date: Thu, 19 Feb 2026 05:13:05 GMT)
|
|
3
|
+
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
6
6
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree
|
|
3
|
-
* (c)
|
|
2
|
+
* AGTree v4.0.1 (build date: Thu, 19 Feb 2026 05:13:05 GMT)
|
|
3
|
+
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
6
6
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree
|
|
3
|
-
* (c)
|
|
2
|
+
* AGTree v4.0.1 (build date: Thu, 19 Feb 2026 05:13:05 GMT)
|
|
3
|
+
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
6
6
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree
|
|
3
|
-
* (c)
|
|
2
|
+
* AGTree v4.0.1 (build date: Thu, 19 Feb 2026 05:13:05 GMT)
|
|
3
|
+
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
6
6
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree
|
|
3
|
-
* (c)
|
|
2
|
+
* AGTree v4.0.1 (build date: Thu, 19 Feb 2026 05:13:05 GMT)
|
|
3
|
+
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
6
6
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree
|
|
3
|
-
* (c)
|
|
2
|
+
* AGTree v4.0.1 (build date: Thu, 19 Feb 2026 05:13:05 GMT)
|
|
3
|
+
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
6
6
|
*/
|
package/dist/parser/options.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree
|
|
3
|
-
* (c)
|
|
2
|
+
* AGTree v4.0.1 (build date: Thu, 19 Feb 2026 05:13:05 GMT)
|
|
3
|
+
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
6
6
|
*/
|
|
@@ -18,6 +18,7 @@ const defaultParserOptions = Object.freeze({
|
|
|
18
18
|
includeRaws: true,
|
|
19
19
|
ignoreComments: false,
|
|
20
20
|
parseHostRules: false,
|
|
21
|
+
parseHtmlFilteringRuleBodies: false,
|
|
21
22
|
});
|
|
22
23
|
|
|
23
24
|
export { defaultParserOptions };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* AGTree
|
|
3
|
-
* (c)
|
|
2
|
+
* AGTree v4.0.1 (build date: Thu, 19 Feb 2026 05:13:05 GMT)
|
|
3
|
+
* (c) 2026 Adguard Software Ltd.
|
|
4
4
|
* Released under the MIT license
|
|
5
5
|
* https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
|
|
6
6
|
*/
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type HtmlFilteringRuleBody } from '../nodes/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Checks whether the given HTML filtering rule body represents a uBlock-style response header removal rule.
|
|
4
|
+
*
|
|
5
|
+
* @param node Potential response header removal rule node.
|
|
6
|
+
*
|
|
7
|
+
* @returns `true` if the node is a response header removal rule, `false` otherwise.
|
|
8
|
+
*
|
|
9
|
+
* @note This method checks `HtmlFilteringRuleBody` because, response header
|
|
10
|
+
* removal rule syntax is same as uBlock-style HTML filtering rule syntax.
|
|
11
|
+
*/
|
|
12
|
+
export declare function isUboResponseHeaderRemovalRuleBody(node: HtmlFilteringRuleBody): boolean;
|
|
@@ -18,11 +18,11 @@ export declare const scriptletsCompatibilityTableData: CompatibilityTable<{
|
|
|
18
18
|
removalMessage: string | null;
|
|
19
19
|
parameters?: {
|
|
20
20
|
name: string;
|
|
21
|
-
debug: boolean;
|
|
22
|
-
pattern: string | null;
|
|
23
21
|
description: string | null;
|
|
24
22
|
default: string | null;
|
|
25
23
|
required: boolean;
|
|
24
|
+
pattern: string | null;
|
|
25
|
+
debug: boolean;
|
|
26
26
|
}[] | undefined;
|
|
27
27
|
}>;
|
|
28
28
|
/**
|
|
@@ -40,7 +40,7 @@ export declare const redirectsCompatibilityTableData: CompatibilityTable<{
|
|
|
40
40
|
removed: boolean;
|
|
41
41
|
removalMessage: string | null;
|
|
42
42
|
isBlocking: boolean;
|
|
43
|
-
resourceTypes: ("object" | "
|
|
43
|
+
resourceTypes: ("object" | "main_frame" | "sub_frame" | "stylesheet" | "script" | "image" | "font" | "xmlhttprequest" | "ping" | "media" | "websocket" | "other")[];
|
|
44
44
|
}>;
|
|
45
45
|
/**
|
|
46
46
|
* Compatibility table data for modifiers.
|
|
@@ -17,7 +17,7 @@ export declare const redirectDataSchema: zod.ZodEffects<zod.ZodTypeAny, {
|
|
|
17
17
|
removed: boolean;
|
|
18
18
|
removalMessage: string | null;
|
|
19
19
|
isBlocking: boolean;
|
|
20
|
-
resourceTypes: ("object" | "
|
|
20
|
+
resourceTypes: ("object" | "main_frame" | "sub_frame" | "stylesheet" | "script" | "image" | "font" | "xmlhttprequest" | "ping" | "media" | "websocket" | "other")[];
|
|
21
21
|
}, any>;
|
|
22
22
|
/**
|
|
23
23
|
* Type of the redirect data schema.
|
|
@@ -18,11 +18,11 @@ export declare const scriptletDataSchema: zod.ZodEffects<zod.ZodTypeAny, {
|
|
|
18
18
|
removalMessage: string | null;
|
|
19
19
|
parameters?: {
|
|
20
20
|
name: string;
|
|
21
|
-
debug: boolean;
|
|
22
|
-
pattern: string | null;
|
|
23
21
|
description: string | null;
|
|
24
22
|
default: string | null;
|
|
25
23
|
required: boolean;
|
|
24
|
+
pattern: string | null;
|
|
25
|
+
debug: boolean;
|
|
26
26
|
}[] | undefined;
|
|
27
27
|
}, any>;
|
|
28
28
|
/**
|
|
@@ -4,25 +4,27 @@
|
|
|
4
4
|
import { type HtmlFilteringRule } from '../../nodes/index.js';
|
|
5
5
|
import { RuleConverterBase } from '../base-interfaces/rule-converter-base.js';
|
|
6
6
|
import { type NodeConversionResult } from '../base-interfaces/conversion-result.js';
|
|
7
|
+
/**
|
|
8
|
+
* Error messages used in HTML filtering rule conversion.
|
|
9
|
+
*/
|
|
7
10
|
export declare const ERROR_MESSAGES: {
|
|
8
|
-
ABP_NOT_SUPPORTED:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
FLAGS_NOT_SUPPORTED: string;
|
|
11
|
+
readonly ABP_NOT_SUPPORTED: "Invalid rule, ABP does not support HTML filtering rules";
|
|
12
|
+
readonly INVALID_RULE: "Invalid HTML filtering rule: %s";
|
|
13
|
+
readonly MIXED_SYNTAX_ADG_UBO: "Mixed AdGuard and uBlock syntax";
|
|
14
|
+
readonly EMPTY_SELECTOR_LIST: "Selector list of HTML filtering rule must not be empty";
|
|
15
|
+
readonly EMPTY_COMPLEX_SELECTOR: "Complex selector of selector list must not be empty";
|
|
16
|
+
readonly INVALID_SELECTOR_COMBINATOR: "Invalid selector combinator '%s' used between selectors";
|
|
17
|
+
readonly UNKNOWN_SELECTOR_TYPE: "Unknown selector type '%s' found during conversion";
|
|
18
|
+
readonly SPECIAL_ATTRIBUTE_SELECTOR_OPERATOR_INVALID: "Special attribute selector '%s' has invalid operator '%s'";
|
|
19
|
+
readonly SPECIAL_ATTRIBUTE_SELECTOR_FLAG_NOT_SUPPORTED: "Special attribute selector '%s' does not support flags";
|
|
20
|
+
readonly SPECIAL_ATTRIBUTE_SELECTOR_VALUE_REQUIRED: "Special attribute selector '%s' requires a value";
|
|
21
|
+
readonly SPECIAL_ATTRIBUTE_SELECTOR_VALUE_INT: "Value of special attribute selector '%s' must be an integer, got '%s'";
|
|
22
|
+
readonly SPECIAL_ATTRIBUTE_SELECTOR_VALUE_POSITIVE: "Value of special attribute selector '%s' must be a positive integer, got '%s'";
|
|
23
|
+
readonly SPECIAL_ATTRIBUTE_SELECTOR_NOT_SUPPORTED: "Special attribute selector '%s' is not supported in conversion";
|
|
24
|
+
readonly SPECIAL_PSEUDO_CLASS_SELECTOR_ARGUMENT_REQUIRED: "Special pseudo-class selector '%s' requires an argument";
|
|
25
|
+
readonly SPECIAL_PSEUDO_CLASS_SELECTOR_ARGUMENT_INT: "Argument of special pseudo-class selector '%s' must be an integer, got '%s'";
|
|
26
|
+
readonly SPECIAL_PSEUDO_CLASS_SELECTOR_ARGUMENT_POSITIVE: "Argument of special pseudo-class selector '%s' must be a positive integer, got '%s'";
|
|
27
|
+
readonly SPECIAL_PSEUDO_CLASS_SELECTOR_NOT_SUPPORTED: "Special pseudo-class selector '%s' is not supported in conversion";
|
|
26
28
|
};
|
|
27
29
|
/**
|
|
28
30
|
* HTML filtering rule converter class
|
|
@@ -31,39 +33,162 @@ export declare const ERROR_MESSAGES: {
|
|
|
31
33
|
*/
|
|
32
34
|
export declare class HtmlRuleConverter extends RuleConverterBase {
|
|
33
35
|
/**
|
|
34
|
-
* Converts a HTML rule to AdGuard syntax, if possible.
|
|
35
|
-
* AdGuard rules to AdGuard syntax to validate them.
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* ```
|
|
40
|
-
* example.com##^div[attr1="value1"][attr2="value2"], script:has-text(value)
|
|
41
|
-
* ```
|
|
42
|
-
* will be converted to multiple AdGuard rules:
|
|
43
|
-
* ```
|
|
44
|
-
* example.com$$div[attr1="value1"][attr2="value2"][max-length="262144"]
|
|
45
|
-
* example.com$$script[tag-content="value"][max-length="262144"]
|
|
46
|
-
* ```
|
|
47
|
-
*
|
|
48
|
-
* @param rule Rule node to convert
|
|
36
|
+
* Converts a HTML rule to AdGuard syntax, if possible.
|
|
37
|
+
* Also can be used to convert AdGuard rules to AdGuard syntax to validate them.
|
|
38
|
+
*
|
|
39
|
+
* @param rule Rule node to convert.
|
|
40
|
+
*
|
|
49
41
|
* @returns An object which follows the {@link NodeConversionResult} interface. Its `result` property contains
|
|
50
42
|
* the array of converted rule nodes, and its `isConverted` flag indicates whether the original rule was converted.
|
|
51
|
-
* If the rule was not converted, the result array will contain the original node with the same object reference
|
|
52
|
-
*
|
|
43
|
+
* If the rule was not converted, the result array will contain the original node with the same object reference.
|
|
44
|
+
*
|
|
45
|
+
* @throws If the rule is invalid or cannot be converted.
|
|
53
46
|
*/
|
|
54
47
|
static convertToAdg(rule: HtmlFilteringRule): NodeConversionResult<HtmlFilteringRule>;
|
|
55
48
|
/**
|
|
56
|
-
* Converts a HTML rule to uBlock
|
|
49
|
+
* Converts a HTML rule to uBlock syntax, if possible.
|
|
50
|
+
* Also can be used to convert uBlock rules to uBlock syntax to validate them.
|
|
57
51
|
*
|
|
58
|
-
* @
|
|
59
|
-
* may be lost in conversion. AdGuard's `[max-length]` and `[tag-content]` attributes will be converted to
|
|
60
|
-
* uBlock's `:min-text-length()` and `:has-text()` pseudo-classes when possible.
|
|
52
|
+
* @param rule Rule node to convert.
|
|
61
53
|
*
|
|
62
|
-
* @param rule Rule node to convert
|
|
63
54
|
* @returns An object which follows the {@link NodeConversionResult} interface. Its `result` property contains
|
|
64
55
|
* the array of converted rule nodes, and its `isConverted` flag indicates whether the original rule was converted.
|
|
65
|
-
* If the rule was not converted, the result array will contain the original node with the same object reference
|
|
66
|
-
*
|
|
56
|
+
* If the rule was not converted, the result array will contain the original node with the same object reference.
|
|
57
|
+
*
|
|
58
|
+
* @throws Error if the rule is invalid or cannot be converted.
|
|
67
59
|
*/
|
|
68
60
|
static convertToUbo(rule: HtmlFilteringRule): NodeConversionResult<HtmlFilteringRule>;
|
|
61
|
+
/**
|
|
62
|
+
* Handles special attribute selectors during AdGuard to AdGuard conversion:
|
|
63
|
+
* - `[tag-content="content"]` -> `:contains(content)`
|
|
64
|
+
* direct conversion, no changes to value
|
|
65
|
+
* - `[wildcard="*content*"]` -> `:contains(/*.content*./s)`
|
|
66
|
+
* convert search pattern to regular expression
|
|
67
|
+
* - `[min-length="min"]` -> `:contains(/^(?=.{min,}$).*\/s)`
|
|
68
|
+
* converts to a length-matching regular expression
|
|
69
|
+
* - `[max-length="max"]` -> `:contains(/^(?=.{0,max}$).*\/s)`
|
|
70
|
+
* converts to a length-matching regular expression
|
|
71
|
+
*
|
|
72
|
+
* Note: This attribute selector to pseudo-class selector conversion
|
|
73
|
+
* is needed because AdGuard special attribute selectors are going
|
|
74
|
+
* to be deprecated and removed soon.
|
|
75
|
+
*
|
|
76
|
+
* @param name Name of the special attribute selector.
|
|
77
|
+
* @param value Value of the special attribute selector.
|
|
78
|
+
*
|
|
79
|
+
* @returns A {@link SimpleSelector} to add to the current complex selector.
|
|
80
|
+
*/
|
|
81
|
+
private static convertSpecialAttributeSelectorAdgToAdg;
|
|
82
|
+
/**
|
|
83
|
+
* Since special pseudo-class selectors do not need conversion
|
|
84
|
+
* in AdGuard to AdGuard conversion, we simply return `true` to keep them as-is.
|
|
85
|
+
*
|
|
86
|
+
* @param name Name of the special pseudo-class selector.
|
|
87
|
+
*
|
|
88
|
+
* @returns `true` to keep the special pseudo-class selector as-is.
|
|
89
|
+
*
|
|
90
|
+
* @throws Rule conversion error for mixed syntax.
|
|
91
|
+
*/
|
|
92
|
+
private static convertSpecialPseudoClassSelectorAdgToAdg;
|
|
93
|
+
/**
|
|
94
|
+
* Since special attribute selectors only AdGuard-specific,
|
|
95
|
+
* we should never encounter them in uBlock rules.
|
|
96
|
+
*
|
|
97
|
+
* @throws Rule conversion error for mixed syntax.
|
|
98
|
+
*/
|
|
99
|
+
private static convertSpecialAttributeSelectorUboToAdg;
|
|
100
|
+
/**
|
|
101
|
+
* Handles special pseudo-class selectors during uBlock to AdGuard conversion:
|
|
102
|
+
* - `:has-text(text)` -> `:contains(text)`
|
|
103
|
+
* direct conversion, no changes to argument
|
|
104
|
+
* - `:min-text-length(min)` -> `:contains(/^(?=.{min,MAX_CONVERSION_DEFAULT}$).*\/s)`
|
|
105
|
+
* converts to a length-matching regular expression
|
|
106
|
+
*
|
|
107
|
+
* @param name Name of the special pseudo-class selector.
|
|
108
|
+
* @param argument Argument of the special pseudo-class selector.
|
|
109
|
+
*
|
|
110
|
+
* @returns A {@link SimpleSelector} to add to the current complex selector.
|
|
111
|
+
*
|
|
112
|
+
* @throws If AdGuard-specific pseudo-class selector is found in uBlock rule.
|
|
113
|
+
*/
|
|
114
|
+
private static convertSpecialPseudoClassSelectorUboToAdg;
|
|
115
|
+
/**
|
|
116
|
+
* Handles special attribute selectors during AdGuard to uBlock conversion:
|
|
117
|
+
* - `[tag-content="content"]` -> `:has-text(content)`
|
|
118
|
+
* direct conversion, no changes to value
|
|
119
|
+
* - `[wildcard="*content*"]` -> `:has-text(/*.content*./s)`
|
|
120
|
+
* convert search pattern to regular expression
|
|
121
|
+
* - `[min-length="min"]` -> `:min-text-length(min)`
|
|
122
|
+
* direct conversion, no changes to value
|
|
123
|
+
* - `[max-length]` is skipped
|
|
124
|
+
*
|
|
125
|
+
* @param name Name of the special attribute selector.
|
|
126
|
+
* @param value Value of the special attribute selector.
|
|
127
|
+
*
|
|
128
|
+
* @returns A {@link SimpleSelector} to add to the current complex selector, or `false` to skip it.
|
|
129
|
+
*/
|
|
130
|
+
private static convertSpecialAttributeSelectorAdgToUbo;
|
|
131
|
+
/**
|
|
132
|
+
* Handles special pseudo-class selectors during AdGuard to uBlock conversion:
|
|
133
|
+
* - `:contains(text)` -> `:has-text(text)`
|
|
134
|
+
* direct conversion, no changes to argument
|
|
135
|
+
*
|
|
136
|
+
* @param name Name of the special pseudo-class selector.
|
|
137
|
+
* @param argument Argument of the special pseudo-class selector.
|
|
138
|
+
*
|
|
139
|
+
* @returns A {@link SimpleSelector} to add to the current complex selector.
|
|
140
|
+
*
|
|
141
|
+
* @throws If uBlock-specific pseudo-class selector is found in AdGuard rule.
|
|
142
|
+
*/
|
|
143
|
+
private static convertSpecialPseudoClassSelectorAdgToUbo;
|
|
144
|
+
/**
|
|
145
|
+
* Converts a HTML filtering rule body by handling special simple selectors via callbacks.
|
|
146
|
+
* Special simple selectors are skipped in the converted selector list and should be handled from callee.
|
|
147
|
+
*
|
|
148
|
+
* @param body HTML filtering rule body to convert.
|
|
149
|
+
* @param parser HTML filtering rule body parser used for parsing raw value bodies.
|
|
150
|
+
* @param generator HTML filtering rule body generator used for generating raw value bodies.
|
|
151
|
+
* @param onSpecialAttributeSelector Callback invoked when a special attribute selector is found.
|
|
152
|
+
* @param onSpecialPseudoClassSelector Callback invoked when a special pseudo-class selector is found.
|
|
153
|
+
*
|
|
154
|
+
* @returns Converted selector list without special simple selectors.
|
|
155
|
+
*/
|
|
156
|
+
private static convertBody;
|
|
157
|
+
/**
|
|
158
|
+
* Clones a simple selector or selector combinator node.
|
|
159
|
+
*
|
|
160
|
+
* @param selector Simple selector or selector combinator node to clone.
|
|
161
|
+
*
|
|
162
|
+
* @returns Cloned simple selector or selector combinator node.
|
|
163
|
+
*/
|
|
164
|
+
private static cloneSelector;
|
|
165
|
+
/**
|
|
166
|
+
* Creates a CSS pseudo-class selector node.
|
|
167
|
+
*
|
|
168
|
+
* @param name The name of the pseudo-class selector.
|
|
169
|
+
* @param argument Optional argument of the pseudo-class selector.
|
|
170
|
+
*
|
|
171
|
+
* @returns CSS pseudo-class selector node.
|
|
172
|
+
*/
|
|
173
|
+
private static getPseudoClassSelectorNode;
|
|
174
|
+
/**
|
|
175
|
+
* Asserts that the given array is not empty.
|
|
176
|
+
*
|
|
177
|
+
* @param array Array to check.
|
|
178
|
+
* @param errorMessage Error message to use if the array is empty.
|
|
179
|
+
*
|
|
180
|
+
* @throws If the array is empty.
|
|
181
|
+
*/
|
|
182
|
+
private static assertNotEmpty;
|
|
183
|
+
/**
|
|
184
|
+
* Asserts that the given special attribute / pseudo-class length value is valid.
|
|
185
|
+
*
|
|
186
|
+
* @param name Name of the attribute or pseudo-class.
|
|
187
|
+
* @param value Value to parse.
|
|
188
|
+
* @param notIntErrorMessage Error message when the value is not an integer.
|
|
189
|
+
* @param notPositiveErrorMessage Error message when the value is not positive.
|
|
190
|
+
*
|
|
191
|
+
* @throws If the value is not a valid number or not positive.
|
|
192
|
+
*/
|
|
193
|
+
private static assertValidLengthValue;
|
|
69
194
|
}
|
|
@@ -21,18 +21,23 @@ export declare const LEGACY_EXT_CSS_ATTRIBUTE_PREFIX = "-ext-";
|
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
23
|
export declare const ABP_EXT_CSS_PREFIX = "-abp";
|
|
24
|
+
/**
|
|
25
|
+
* Known CSS pseudo-classes that are supported by all browsers natively,
|
|
26
|
+
* but can also be applied as extended.
|
|
27
|
+
*/
|
|
28
|
+
export declare const NATIVE_CSS_PSEUDO_CLASSES: ReadonlySet<string>;
|
|
24
29
|
/**
|
|
25
30
|
* Known _strict_ Extended CSS pseudo-classes. Please, keep this list sorted.
|
|
26
31
|
* Strict means that these pseudo-classes are not supported by any browser natively,
|
|
27
32
|
* and they always require Extended CSS libraries to work.
|
|
28
33
|
*/
|
|
29
|
-
export declare const EXT_CSS_PSEUDO_CLASSES_STRICT:
|
|
34
|
+
export declare const EXT_CSS_PSEUDO_CLASSES_STRICT: ReadonlySet<string>;
|
|
30
35
|
/**
|
|
31
36
|
* _ALL_ known Extended CSS pseudo-classes. Please, keep this list sorted.
|
|
32
37
|
* It includes strict pseudo-classes and additional pseudo-classes that may be
|
|
33
38
|
* supported by some browsers natively.
|
|
34
39
|
*/
|
|
35
|
-
export declare const EXT_CSS_PSEUDO_CLASSES:
|
|
40
|
+
export declare const EXT_CSS_PSEUDO_CLASSES: ReadonlySet<string>;
|
|
36
41
|
/**
|
|
37
42
|
* Known legacy Extended CSS attributes. These attributes are deprecated and
|
|
38
43
|
* should be replaced with the corresponding pseudo-classes. In a long term,
|
|
@@ -40,9 +45,16 @@ export declare const EXT_CSS_PSEUDO_CLASSES: Set<string>;
|
|
|
40
45
|
*
|
|
41
46
|
* Please, keep this list sorted.
|
|
42
47
|
*/
|
|
43
|
-
export declare const EXT_CSS_LEGACY_ATTRIBUTES:
|
|
48
|
+
export declare const EXT_CSS_LEGACY_ATTRIBUTES: ReadonlySet<string>;
|
|
49
|
+
/**
|
|
50
|
+
* Known extended CSS property that is used to remove elements.
|
|
51
|
+
*
|
|
52
|
+
* @see {@link https://github.com/AdguardTeam/ExtendedCss#remove-pseudos}
|
|
53
|
+
*/
|
|
54
|
+
export declare const REMOVE_PROPERTY = "remove";
|
|
44
55
|
/**
|
|
45
|
-
* Known CSS
|
|
46
|
-
*
|
|
56
|
+
* Known extended CSS value for {@link REMOVE_PROPERTY} property to remove elements.
|
|
57
|
+
*
|
|
58
|
+
* @see {@link https://github.com/AdguardTeam/ExtendedCss#remove-pseudos}
|
|
47
59
|
*/
|
|
48
|
-
export declare const
|
|
60
|
+
export declare const REMOVE_VALUE = "true";
|
package/dist/types/generator/cosmetic/html-filtering-body/adg-html-filtering-body-generator.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Value, type HtmlFilteringRuleBody } from '../../../nodes/index.js';
|
|
2
|
+
import { BaseGenerator } from '../../base-generator.js';
|
|
3
|
+
/**
|
|
4
|
+
* AdGuard HTML Filtering body generator.
|
|
5
|
+
*/
|
|
6
|
+
export declare class AdgHtmlFilteringBodyGenerator extends BaseGenerator {
|
|
7
|
+
/**
|
|
8
|
+
* Generates a string representation of the AdGuard HTML filtering rule body.
|
|
9
|
+
*
|
|
10
|
+
* @param node HTML filtering rule body.
|
|
11
|
+
*
|
|
12
|
+
* @returns String representation of the rule body.
|
|
13
|
+
*
|
|
14
|
+
* @throws Error if the rule body is invalid.
|
|
15
|
+
*/
|
|
16
|
+
static generate(node: Value | HtmlFilteringRuleBody): string;
|
|
17
|
+
}
|