New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@cliqz/adblocker

Package Overview
Dependencies
Maintainers
2
Versions
181
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cliqz/adblocker - npm Package Compare versions

Comparing version 1.29.0 to 1.30.0

15

dist/commonjs/lists.d.ts

@@ -15,3 +15,6 @@ /*!

NETWORK = 1,
COSMETIC = 2
COSMETIC = 2,
NOT_SUPPORTED_EMPTY = 100,
NOT_SUPPORTED_COMMENT = 101,
NOT_SUPPORTED_ADGUARD = 102
}

@@ -24,5 +27,12 @@ /**

*/
export declare function detectFilterType(line: string): FilterType;
export declare function detectFilterType(line: string, { extendedNonSupportedTypes }?: {
extendedNonSupportedTypes?: boolean | undefined;
}): FilterType;
export declare function parseFilter(filter: string): NetworkFilter | CosmeticFilter | null;
export declare function f(strings: TemplateStringsArray): NetworkFilter | CosmeticFilter | null;
interface NonSupportedFilter {
lineNumber: number;
filter: string;
filterType: FilterType;
}
export declare function parseFilters(list: string, config?: Partial<Config>): {

@@ -32,2 +42,3 @@ networkFilters: NetworkFilter[];

preprocessors: Preprocessor[];
notSupportedFilters: NonSupportedFilter[];
};

@@ -34,0 +45,0 @@ export interface IListDiff {

@@ -54,2 +54,6 @@ "use strict";

FilterType[FilterType["COSMETIC"] = 2] = "COSMETIC";
// available only with `extendedNonSupportedTypes` option for #detectFilterType
FilterType[FilterType["NOT_SUPPORTED_EMPTY"] = 100] = "NOT_SUPPORTED_EMPTY";
FilterType[FilterType["NOT_SUPPORTED_COMMENT"] = 101] = "NOT_SUPPORTED_COMMENT";
FilterType[FilterType["NOT_SUPPORTED_ADGUARD"] = 102] = "NOT_SUPPORTED_ADGUARD";
})(FilterType || (exports.FilterType = FilterType = {}));

@@ -62,5 +66,8 @@ /**

*/
function detectFilterType(line) {
function detectFilterType(line, { extendedNonSupportedTypes = false } = {}) {
// Ignore empty line
if (line.length === 0 || line.length === 1) {
if (extendedNonSupportedTypes) {
return FilterType.NOT_SUPPORTED_EMPTY;
}
return FilterType.NOT_SUPPORTED;

@@ -74,2 +81,5 @@ }

(firstCharCode === 91 /* '[' */ && (0, utils_js_1.fastStartsWith)(line, '[Adblock'))) {
if (extendedNonSupportedTypes) {
return FilterType.NOT_SUPPORTED_COMMENT;
}
return FilterType.NOT_SUPPORTED;

@@ -79,3 +89,5 @@ }

const lastCharCode = line.charCodeAt(line.length - 1);
if (firstCharCode === 36 /* '$' */ ||
if ((firstCharCode === 36 /* '$' */ &&
secondCharCode !== 36 &&
secondCharCode !== 64) /* $$ and $@ as those may be Adguard HTML filtering rules */ ||
firstCharCode === 38 /* '&' */ ||

@@ -105,2 +117,5 @@ firstCharCode === 42 /* '*' */ ||

(0, utils_js_1.fastStartsWithFrom)(line, /* $@$ */ '@$', afterDollarIndex))) {
if (extendedNonSupportedTypes) {
return FilterType.NOT_SUPPORTED_ADGUARD;
}
return FilterType.NOT_SUPPORTED;

@@ -127,13 +142,14 @@ }

((0, utils_js_1.fastStartsWithFrom)(line, /* #@$# */ '@$#', afterSharpIndex) ||
(0, utils_js_1.fastStartsWithFrom)(line, /* #@%# */ '@%#', afterSharpIndex))) ||
(0, utils_js_1.fastStartsWithFrom)(line, /* #@%# */ '@%#', afterSharpIndex) ||
(0, utils_js_1.fastStartsWithFrom)(line, /* #@?# */ '@?#', afterSharpIndex))) ||
(afterSharpCharCode === 37 /* '%' */ &&
(0, utils_js_1.fastStartsWithFrom)(line, /* #%# */ '%#', afterSharpIndex)) ||
(afterSharpCharCode === 36 /* '$' */ &&
(0, utils_js_1.fastStartsWithFrom)(line, /* #$# */ '$#', afterSharpIndex)) ||
((0, utils_js_1.fastStartsWithFrom)(line, /* #$# */ '$#', afterSharpIndex) ||
(0, utils_js_1.fastStartsWithFrom)(line, /* #$?# */ '$?#', afterSharpIndex))) ||
(afterSharpCharCode === 63 /* '?' */ &&
(0, utils_js_1.fastStartsWithFrom)(line, /* #?# */ '?#', afterSharpIndex))) {
// Ignore Adguard cosmetics
// `#$#` `#@$#`
// `#%#` `#@%#`
// `#?#`
if (extendedNonSupportedTypes) {
return FilterType.NOT_SUPPORTED_ADGUARD;
}
return FilterType.NOT_SUPPORTED;

@@ -162,2 +178,3 @@ }

const cosmeticFilters = [];
const notSupportedFilters = [];
const lines = list.split('\n');

@@ -198,3 +215,3 @@ const preprocessors = [];

// Detect if filter is supported, network or cosmetic
const filterType = detectFilterType(line);
const filterType = detectFilterType(line, { extendedNonSupportedTypes: true });
if (filterType === FilterType.NETWORK && config.loadNetworkFilters === true) {

@@ -208,2 +225,9 @@ const filter = network_js_1.default.parse(line, config.debug);

}
else {
notSupportedFilters.push({
lineNumber: i,
filter: line,
filterType,
});
}
}

@@ -220,2 +244,9 @@ else if (filterType === FilterType.COSMETIC && config.loadCosmeticFilters === true) {

}
else {
notSupportedFilters.push({
lineNumber: i,
filter: line,
filterType: FilterType.COSMETIC,
});
}
}

@@ -245,3 +276,17 @@ else if (config.loadPreprocessors) {

}
else if (filterType === FilterType.NOT_SUPPORTED_ADGUARD) {
notSupportedFilters.push({
lineNumber: i,
filter: line,
filterType,
});
}
}
else if (filterType === FilterType.NOT_SUPPORTED_ADGUARD) {
notSupportedFilters.push({
lineNumber: i,
filter: line,
filterType,
});
}
}

@@ -252,2 +297,3 @@ return {

preprocessors: preprocessors.filter((preprocessor) => preprocessor.filterIDs.size > 0),
notSupportedFilters,
};

@@ -254,0 +300,0 @@ }

@@ -15,3 +15,6 @@ /*!

NETWORK = 1,
COSMETIC = 2
COSMETIC = 2,
NOT_SUPPORTED_EMPTY = 100,
NOT_SUPPORTED_COMMENT = 101,
NOT_SUPPORTED_ADGUARD = 102
}

@@ -24,5 +27,12 @@ /**

*/
export declare function detectFilterType(line: string): FilterType;
export declare function detectFilterType(line: string, { extendedNonSupportedTypes }?: {
extendedNonSupportedTypes?: boolean | undefined;
}): FilterType;
export declare function parseFilter(filter: string): NetworkFilter | CosmeticFilter | null;
export declare function f(strings: TemplateStringsArray): NetworkFilter | CosmeticFilter | null;
interface NonSupportedFilter {
lineNumber: number;
filter: string;
filterType: FilterType;
}
export declare function parseFilters(list: string, config?: Partial<Config>): {

@@ -32,2 +42,3 @@ networkFilters: NetworkFilter[];

preprocessors: Preprocessor[];
notSupportedFilters: NonSupportedFilter[];
};

@@ -34,0 +45,0 @@ export interface IListDiff {

@@ -18,2 +18,6 @@ /*!

FilterType[FilterType["COSMETIC"] = 2] = "COSMETIC";
// available only with `extendedNonSupportedTypes` option for #detectFilterType
FilterType[FilterType["NOT_SUPPORTED_EMPTY"] = 100] = "NOT_SUPPORTED_EMPTY";
FilterType[FilterType["NOT_SUPPORTED_COMMENT"] = 101] = "NOT_SUPPORTED_COMMENT";
FilterType[FilterType["NOT_SUPPORTED_ADGUARD"] = 102] = "NOT_SUPPORTED_ADGUARD";
})(FilterType || (FilterType = {}));

@@ -26,5 +30,8 @@ /**

*/
export function detectFilterType(line) {
export function detectFilterType(line, { extendedNonSupportedTypes = false } = {}) {
// Ignore empty line
if (line.length === 0 || line.length === 1) {
if (extendedNonSupportedTypes) {
return FilterType.NOT_SUPPORTED_EMPTY;
}
return FilterType.NOT_SUPPORTED;

@@ -38,2 +45,5 @@ }

(firstCharCode === 91 /* '[' */ && fastStartsWith(line, '[Adblock'))) {
if (extendedNonSupportedTypes) {
return FilterType.NOT_SUPPORTED_COMMENT;
}
return FilterType.NOT_SUPPORTED;

@@ -43,3 +53,5 @@ }

const lastCharCode = line.charCodeAt(line.length - 1);
if (firstCharCode === 36 /* '$' */ ||
if ((firstCharCode === 36 /* '$' */ &&
secondCharCode !== 36 &&
secondCharCode !== 64) /* $$ and $@ as those may be Adguard HTML filtering rules */ ||
firstCharCode === 38 /* '&' */ ||

@@ -69,2 +81,5 @@ firstCharCode === 42 /* '*' */ ||

fastStartsWithFrom(line, /* $@$ */ '@$', afterDollarIndex))) {
if (extendedNonSupportedTypes) {
return FilterType.NOT_SUPPORTED_ADGUARD;
}
return FilterType.NOT_SUPPORTED;

@@ -91,13 +106,14 @@ }

(fastStartsWithFrom(line, /* #@$# */ '@$#', afterSharpIndex) ||
fastStartsWithFrom(line, /* #@%# */ '@%#', afterSharpIndex))) ||
fastStartsWithFrom(line, /* #@%# */ '@%#', afterSharpIndex) ||
fastStartsWithFrom(line, /* #@?# */ '@?#', afterSharpIndex))) ||
(afterSharpCharCode === 37 /* '%' */ &&
fastStartsWithFrom(line, /* #%# */ '%#', afterSharpIndex)) ||
(afterSharpCharCode === 36 /* '$' */ &&
fastStartsWithFrom(line, /* #$# */ '$#', afterSharpIndex)) ||
(fastStartsWithFrom(line, /* #$# */ '$#', afterSharpIndex) ||
fastStartsWithFrom(line, /* #$?# */ '$?#', afterSharpIndex))) ||
(afterSharpCharCode === 63 /* '?' */ &&
fastStartsWithFrom(line, /* #?# */ '?#', afterSharpIndex))) {
// Ignore Adguard cosmetics
// `#$#` `#@$#`
// `#%#` `#@%#`
// `#?#`
if (extendedNonSupportedTypes) {
return FilterType.NOT_SUPPORTED_ADGUARD;
}
return FilterType.NOT_SUPPORTED;

@@ -126,2 +142,3 @@ }

const cosmeticFilters = [];
const notSupportedFilters = [];
const lines = list.split('\n');

@@ -162,3 +179,3 @@ const preprocessors = [];

// Detect if filter is supported, network or cosmetic
const filterType = detectFilterType(line);
const filterType = detectFilterType(line, { extendedNonSupportedTypes: true });
if (filterType === FilterType.NETWORK && config.loadNetworkFilters === true) {

@@ -172,2 +189,9 @@ const filter = NetworkFilter.parse(line, config.debug);

}
else {
notSupportedFilters.push({
lineNumber: i,
filter: line,
filterType,
});
}
}

@@ -184,2 +208,9 @@ else if (filterType === FilterType.COSMETIC && config.loadCosmeticFilters === true) {

}
else {
notSupportedFilters.push({
lineNumber: i,
filter: line,
filterType: FilterType.COSMETIC,
});
}
}

@@ -209,3 +240,17 @@ else if (config.loadPreprocessors) {

}
else if (filterType === FilterType.NOT_SUPPORTED_ADGUARD) {
notSupportedFilters.push({
lineNumber: i,
filter: line,
filterType,
});
}
}
else if (filterType === FilterType.NOT_SUPPORTED_ADGUARD) {
notSupportedFilters.push({
lineNumber: i,
filter: line,
filterType,
});
}
}

@@ -216,2 +261,3 @@ return {

preprocessors: preprocessors.filter((preprocessor) => preprocessor.filterIDs.size > 0),
notSupportedFilters,
};

@@ -218,0 +264,0 @@ }

8

package.json
{
"name": "@cliqz/adblocker",
"version": "1.29.0",
"version": "1.30.0",
"description": "Ghostery adblocker library",

@@ -119,4 +119,4 @@ "author": {

"dependencies": {
"@cliqz/adblocker-content": "^1.29.0",
"@cliqz/adblocker-extended-selectors": "^1.29.0",
"@cliqz/adblocker-content": "^1.30.0",
"@cliqz/adblocker-extended-selectors": "^1.30.0",
"@remusao/guess-url-type": "^1.3.0",

@@ -129,3 +129,3 @@ "@remusao/small": "^1.2.1",

},
"gitHead": "a4b7c5f456a826db4526bf8632bae8ea12b9bb38"
"gitHead": "2f37bd5abc1e7874036cabc19dfe3744417ee6b9"
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc