Skip to content

Commit ed5c6d3

Browse files
committed
feat: Implement RuleDeduplicator for deduplication and metadata merging
- Added RuleDeduplicator class to process and deduplicate rules. - Introduced ExtendedRuleMetadata interface to extend existing metadata. - Implemented methods for stripping rules, processing duplicates, and merging metadata. - Enhanced logging and error handling throughout the deduplication process. - Added statistics tracking for deduplication results. feat: Create CLI exports for configuration and types - Added cli-exports.ts to explicitly re-export necessary functions and types for CLI usage. - Included types for FilterMetaConfig and ExportOptions. feat: Define configuration structures for meta, paths, and performance - Created meta.ts to define FilterMetaConfig and default metadata. - Implemented paths.ts for managing input/output paths. - Established performance.ts for performance-related configurations. feat: Develop advanced filter formatting and exporting functionality - Created advanced-formatter.ts for generating formatted filter lists. - Implemented formatters for various rule types including hosts, dnsmasq, and unbound. - Added header generation for different filter formats in headers.ts. - Developed index.ts for exporting formatted rules based on specified options. refactor: Enhance rule filtering logic for DNS and browser rules - Improved ruleFilters.ts to filter rules based on type and modifiers. - Added functions to filter out DNS rules and browser-only rules. chore: Update types for better structure and clarity - Expanded SupportedFormat and FilterListMetadata interfaces in types.ts. - Re-exported RuleStore types with explicit file extensions for clarity.
1 parent 5438d6b commit ed5c6d3

22 files changed

Lines changed: 1081 additions & 5827 deletions

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Contributing to @blocking-machine/core
1+
# Contributing to @blockingmachine/core
22

33
Thank you for your interest in contributing to BlockingMachine! This document provides guidelines and instructions for contributing.
44

@@ -90,7 +90,7 @@ npm test
9090

9191
## License and Copyright
9292

93-
By contributing to @blocking-machine/core, you agree that your contributions will be licensed under the BSD 3-Clause License.
93+
By contributing to @blockingmachine/core, you agree that your contributions will be licensed under the BSD 3-Clause License.
9494

9595
### Copyright Notice Requirements
9696

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# @blocking-machine/core
1+
# @blockingmachine/core
22

33
Core functionality for BlockingMachine, providing robust filter list processing and rule management for AdGuard Home and similar applications.
44

5-
[![npm version](https://badge.fury.io/js/@blocking-machine%2Fcore.svg)](https://www.npmjs.com/package/@blockingmachine/core)
5+
[![npm version](https://badge.fury.io/js/@blockingmachine%2Fcore.svg)](https://www.npmjs.com/package/@blockingmachine/core)
66
[![License: BSD-3-Clause](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
77

88
## Features
@@ -21,19 +21,19 @@ Core functionality for BlockingMachine, providing robust filter list processing
2121

2222
```bash
2323
# Using npm
24-
npm install @blocking-machine/core
24+
npm install @blockingmachine/core
2525

2626
# Using yarn
27-
yarn add @blocking-machine/core
27+
yarn add @blockingmachine/core
2828

2929
# Using pnpm
30-
pnpm add @blocking-machine/core
30+
pnpm add @blockingmachine/core
3131
```
3232

3333
## Quick Start
3434

3535
```typescript
36-
import { RuleDeduplicator, parseFilterList, fetchContent } from '@blocking-machine/core';
36+
import { RuleDeduplicator, parseFilterList, fetchContent } from '@blockingmachine/core';
3737

3838
// Basic usage
3939
const rules = await parseFilterList('||example.com^');
@@ -297,10 +297,10 @@ Enable debug logging by setting the environment variable:
297297

298298
```bash
299299
# macOS/Linux
300-
export DEBUG=blocking-machine:*
300+
export DEBUG=blockingmachine:*
301301

302302
# In your code
303-
const debug = require('debug')('blocking-machine:core');
303+
const debug = require('debug')('blockingmachine:core');
304304
debug('Processing rules:', rules.length);
305305
```
306306

@@ -417,7 +417,7 @@ const rules = await parseFilterList(content, {
417417
A: Yes, here's a basic example:
418418
```typescript
419419
import express from 'express';
420-
import { RuleDeduplicator, parseFilterList } from '@blocking-machine/core';
420+
import { RuleDeduplicator, parseFilterList } from '@/core';
421421

422422
const app = express();
423423

0 commit comments

Comments
 (0)