Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@igor.dvlpr/aria

igorskyflyer409MIT2.3.1

๐Ÿงฌ Meet Aria, an efficient Adblock filter list compiler, with many features that make your maintenance of Adblock filter lists a breeze! ๐Ÿฆ–

igorskyflyer, igor.dvlpr, aria, compiler, adblock, filter, filter-list, block-list, content, extension, browser, dns, ads, igorskyflyer

readme

Aria ๐Ÿช…

Adblock template (ADBT) compiler

Aria compiler
๐Ÿงฌ Meet Aria, an efficient Adblock filter list compiler, with many features that make your maintenance of Adblock filter lists a breeze! ๐Ÿฆ–



๐Ÿ’– Support further development

I work hard for every project, including this one and your support means a lot to me!
Consider buying me a coffee. โ˜•
Thank you for supporting my efforts! ๐Ÿ™๐Ÿ˜Š


Donate to igorskyflyer

@igorskyflyer





๐Ÿ•ต๐Ÿผโ€โ™‚๏ธ Install

Install it by executing:

Global install

npm i -g "@igor.dvlpr/aria"

Local install

npm i "@igor.dvlpr/aria"

๐Ÿคน๐Ÿผโ€โ™‚๏ธ Usage

๐Ÿ’ก This file only documents Aria CLI-related API.

You should read the official ADBT API documentation for more information on how ADBT works, its syntax and usage.


๐Ÿช„ Arguments


<None>

Aria - Adblock template compiler CLI Will print the welcome + help screen


File

Compile the input ADBT template file.


Short: -f
Long: --file
Accepts: path: string
Required: yes

Example

aria -f './my-template.adbt'

๐Ÿ’ก Template files should end with the .adbt extension.



Root

Set the root directory (CWD).


Short: -r
Long: --root
Accepts: path: string
Required: no

Example

aria -f './my-template.adbt' --root 'D:\my-filter'

๐Ÿ’ก Useful when passing an absolute template path or when working from a directory that's not the directory where the template file is stored.



Versioning

The versioning to use, can be:

  • auto: default, let Aria decide which versioning system to use.
    If the resulting file already exists, i.e. Aria already compiled the template before, it will re-use the versioning found in the file, otherwise it will use semver,

  • semver: use valid SemVer versioning when exporting the filter file, e.g. v1.0.0, v2.199.222, etc.
    If no version is found the counting starts with v1.0.0,

  • timestamp: use current UNIX timestamp, e.g. 1690409508.


Short: -v
Long: --versioning
Accepts: auto, semver, timestamp
Required: no

Example

aria -f './my-template.adbt' -v semver


โ„น๏ธ Versioning in Adblock filters

Take this snippet from my AdVoid filter list:

! Title: AdVoid.Core
! Description: โœˆ AdVoid is an efficient AdBlock filter that blocks ads! ๐Ÿ‘พ
! Version: 1.8.1082

Aria takes care of the versioning, the last line you see in the snippet above - so you don't have to!


โ—When using SemVer as the versioning system, Aria will always increase only the patch component of the version.


๐Ÿช… Flags

Dry

Do a dry-run and print the resulting AST.


Short: -d
Long: --dry
Accepts: N/A
Required: no

Example

aria -f './my-template.adbt' -d

๐Ÿ’ก The template will not be compiled; Aria will only print out the log.

โ— If you want to both compile and print the log, then use the log flag.



Tree

Will print the resulting AST.


Short: -t
Long: --tree
Accepts: N/A
Required: no

Example

aria -f './my-template.adbt' -t

๐Ÿ’ก This will compile and print out the resulting AST.


๐Ÿค” What is AST?

In computer science, an abstract syntax tree (AST), or just syntax tree, is a tree representation of the abstract syntactic structure of text (often source code) written in a formal language. Each node of the tree denotes a construct occurring in the text. โ€“ Wikipedia



Log

Enable compilation logging.


Short: -l
Long: --log
Accepts: N/A
Required: no

Example

aria -f './my-template.adbt' -l

๐Ÿ’ก The template will be compiled and Aria will log while compiling.

โ— If you only want to do a dry-run and don't compile the template, then use the dry flag.



Help

Show the welcome + help screen.


Short: -h
Long: --help
Accepts: N/A
Required: no

Example

aria --help

๐Ÿ’ก This flag works the same as calling aria on its own - with 0 arguments.


๐Ÿ“ Changelog

โœจ Changelog is available here: CHANGELOG.md.


๐Ÿชช License

Licensed under the MIT license which is available here, MIT license.


ADBT

๐Ÿ“œ Provides ADBT (Adblock template) support in Visual Studio Code. ๐Ÿช…


@igor.dvlpr/adblock-filter-counter

๐Ÿฒ A dead simple npm module that counts Adblock filter rules.๐Ÿฆ˜


@igor.dvlpr/keppo

๐ŸŽก Parse, manage, compare and output SemVer-compatible version numbers. ๐Ÿงฎ


@igor.dvlpr/normalized-string

๐Ÿ’Š NormalizedString provides you with a String type with consistent line-endings, guaranteed. ๐Ÿ“ฎ


@igor.dvlpr/zing

๐ŸŒ Zing is a C# style String formatter for JavaScript that empowers Strings with positional arguments. ๐Ÿš€


AdVoid

โœˆ AdVoid is an efficient AdBlock filter that blocks ads, trackers, malware and a lot more if you want it to! ๐Ÿ‘พ



Provided by Igor Dimitrijeviฤ‡ (@igorskyflyer).

changelog

๐Ÿ“’ Changelog

of @igor.dvlpr/aria


v2.3.1

16-Jul-2024

  • โœ… fix: trim filter file before exporting (#126)


v2.3.0

15-Jul-2024

  • ๐Ÿช… feat: add an auto-generated header to the compiled filter list file (#124)
  • โœ… fix: don't add the version metadata if no header is present (#125)


v2.2.0

15-Jul-2024

ADBT v2.1.0

  • ๐Ÿช… feat: add the implement statement (implement statement in ADBT)
  • ๐Ÿช… feat: log unsupported Actions (#119)
  • ๐Ÿช… feat: disallow duplicate Actions (#110)
  • ๐Ÿช… feat: log applied Actions (#114)
  • ๐Ÿช… feat: add final newline when exporting (#108)
  • ๐Ÿช… feat: support multiple actions per include/import (#106)
  • ๐Ÿช… feat: detect trailing comma for Actions (#121)
  • ๐Ÿช… feat: implement a custom diff algorithm for changes to compiled files
  • ๐Ÿช… feat: resolve meta early (performance gain)
  • ๐Ÿช… feat: allow only 1 implement per ADBT template

  • โœ… fix: meta and compiler var replacement leak (#123)
  • โœ… fix: don't parse Actions for duplicate includes/imports (#111)
  • โœ… fix: fix multiple Actions overwrite (#112)
  • โœ… fix: fix message logging
  • โœ… fix: log line number when throwing an implement exception
  • โœ… fix: rename wrongly named resource string
  • โœ… fix: fix parsing and replacing of meta variables
  • โœ… fix: fix parsing and replacing of compile variables

  • ๐Ÿ’ป dev: remove subnodes property of IAriaNode


v2.1.0

13-Sep-2023

  • ๐Ÿช… feat: log line number of an already included filter file (#102)

  • โœ… fix: add a newline when transforming source only when needed (#98)
  • โœ… fix: sort actions strips final newline (#96)

  • ๐Ÿ’ป dev: make external meta message an info, not a warning (#100)


v2.0.1

31-Aug-2023

  • โœ… fix: inline meta erasing external metadata (#94)


v2.0.0

31-Aug-2023

ADBT v2.0.0

  • ๐Ÿช… feat [BREAKING]: enforce order of statements (#60)

๐Ÿ’ก Keeps track of order of statements (nodes) in the input template and enforces rules, thus keeping the integrity and validity of the exported Adblock filter file.

The following rules are enforced:

  • a header statement cannot appear after a meta statement,
  • a header statement cannot appear after an include/import statement,
  • a meta statement cannot appear after an include/import statement,
  • no statements can appear after an export statement.

    Will throw when order is not correct.

  • ๐Ÿช… feat: add info logging method (#86)

  • ๐Ÿช… feat: log presence of inline meta (#84)
  • ๐Ÿช… feat: validate statements, catch edge-cases (#82)
  • ๐Ÿช… feat: detect and warn when no header/metadata is present (#80)
  • ๐Ÿช… feat: evaluate statements eagerly (#74)
  • ๐Ÿช… feat: reorganize order of nodes detection by usage/order of statements (#72)
  • ๐Ÿช… feat: add meta statement and support for inline meta (#68)

    ๐Ÿ’ก Has highest priority when setting metadata.

  • ๐Ÿช… feat: always amend the Expires field of the metadata of the compiled filter file (#66)
  • ๐Ÿช… feat: always add Entries field to the metadata of the compiled filter file (#64)
  • ๐Ÿช… feat: make all user input paths universal, i.e. allow all OS' to use a forward slash ("/") as the path separator (#62)

    ๐ŸŒŸ Via uPath

  • ๐Ÿช… feat: detect unsupported identifiers/code (#58)


  • โœ… fix: change warning text background color
  • โœ… fix: log unsupported identifiers (#76)
  • โœ… fix: refactor nodes logging (#70)
  • โœ… fix: import paths not being tracked (#56)
  • โœ… fix: actions remove final newline (#54)
  • โœ… fix: filter path not available in logs (#52)
  • โœ… fix: fix messages formatting (#88)
  • โœ… fix: various fixes to strings used in logging

  • ๐Ÿ’ป dev: invert node orders (#78)
  • ๐Ÿ’ป dev: externalize strings (#90)
  • ๐Ÿ’ป dev: add tests and coverage


v1.6.1

22-Aug-2023

  • โœ… fix: fix an error when no action is provided, (#50)
  • โœ… fix: fix an error when passing multiple values for error logging, (#51)


v1.6.0

22-Aug-2023

ADBT v1.3.0

  • ๐Ÿช… feat: add support for statement actions (#48), currently available for:


๐Ÿ’กActions allow you to invoke a certain function when including/importing filter list files.

Supported actions:

  • trim (trims whitespace for each line from the included filter list file)
  • dedupe (removes duplicates from the included filter list file)
  • sort (sorts lines from the included filter list file)
  • append (appends an arbitrary string to each line from the included filter list file)
  • strip (strips a certain element of each line from the included filter list file)

You can read more about Actions in the official ADBT documentation.



v1.5.0

20-Aug-2023

ADBT v1.2.0

  • ๐Ÿช… feat: implement the import statement (#45)

    import statements behave exactly the same as include but prepend the file path of the included filter (as a comment)

  • ๐Ÿช… feat: implement the tag statement (#40)

    Introduce a tagging system; special comments that get inserted in the resulting filter file, for easier navigation, search, etc.

    ๐ŸŒŸ Inspired by AdVoid's way of navigation.

CLI

  • โœ… fix: when passing the -t flag, the input template wasn't being compiled


v1.4.0

19-Aug-2023

ADBT v1.1.0

  • ๐Ÿช… feat: support for Expires meta variable (#38)

CLI

  • ๐Ÿช… feat: log changes of the export file (#36)

  • ๐Ÿ’ป dev: remove value property for placeholders


v1.3.0

14-Aug-2023

  • ๐Ÿช… feat: add support for absolute paths for header, include and export (#30)

  • โœ… fix: literal versioning type leak into the exported file (#32)
  • โœ… fix: don't trigger unreachable code warning for whitespace at the end of file (#34)



v1.2.5

02-Aug-2023

ADBT v1.0.1

  • ๐Ÿช… feat: log execution time (#28)
  • ๐Ÿช… feat: unreachable code detection

  • โœ… fix: always output absolute export path

  • ๐Ÿ“œ docs: update ADBT API link


v1.2.4

02-Aug-2023

  • ๐Ÿ’ป dev: use automated version tagging


v1.2.3

02-Aug-2023

  • โœ… fix: incorrect CLI version


v1.2.2

02-Aug-2023

  • โœ… fix: enable passing of relative template paths while using a root absolute path (#24)


v1.2.1

02-Aug-2023

  • ๐Ÿ“œ docs: update API


v1.2.0

02-Aug-2023

  • ๐Ÿช… feat: root directory option
  • โœ… fix: cwd path (#23)


v1.1.2

02-Aug-2023

  • โœ… fix: sourceline wrong numbering (#18)
  • โœ… fix: String escaping (#17)


v1.1.1

01-Aug-2023

  • โœ… fix: version placeholder was injected even when a version is defined (#14)
  • โœ… fix: don't prepend whitespace when injecting headers (#12)


v1.1.0

31-Jul-2023

  • ๐Ÿช… feat: don't include already included filter lists (#10)


v1.0.3

29-Jul-2023

  • โœ… fix: handle single quotes ' in file paths (#8)


v1.0.2

29-Jul-2023

  • ๐Ÿช… feat: add performance information to CLI output


v1.0.1

28-Jul-2023

  • โœ… fix: encode all files as UTF-8 (#4)
  • โœ… fix: meta and compile variables mixup (#6)

  • ๐Ÿ’ป dev: upgrade TypeScript


v1.0.0

27-Jul-2023

ADBT v1.0.0

  • ๐Ÿš€ launch: initial release ๐ŸŽ‰