1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-18 17:02:27 +02:00
Commit Graph

18 Commits

Author SHA1 Message Date
Manish Jethani
fd9888f85e
Spawn mocha from test.js (#3818) 2021-08-14 10:33:49 -04:00
Manish Jethani
806fe5dbe1
Add Mocha tests (#3815) 2021-08-13 13:08:13 -04:00
Manish Jethani
daff6b3a34
Add eslint dependency within Node.js package (#3813) 2021-08-13 06:43:20 -04:00
Raymond Hill
c6fb70b1f0
Refactor hntrie to avoid the need for boundary cells
Whereas before the string segment was encoded as:

LL OOOOOOOOOOOO

where L are the upper 8 bits and used to encode the length
of the segment, and O are the lower 24 bits and used to
encode the offset of the string data in the character
buffer, the new code encode as follow:

OOOOOOOOOOOO LL

And furthermore the most significant bit of the length
LL is now used to mark whether the current string segment
is a label boundary.

This means a cell can't reference a segment longer then
127 characters. To work around this limitation for when a
segment is longer than 127 characters (a rare occurrence),
the algorithm will simply split the segment into multiple
adjacent cells.

As a result, there is no longer a need to encode
"boundariness" into special cells, which simplifies
both the storing and matching algorithms.

Additionally, added minimal documentation for the NPM
package on how to import and use HNTrieContainer as a
standalone API.
2021-08-10 09:27:59 -04:00
Manish Jethani
ab9f5ae100
Run build script via tools/make-nodejs.sh (#3808) 2021-08-09 20:02:58 -04:00
Raymond Hill
76abd04898
New revision for npm package 2021-08-09 19:34:35 -04:00
Raymond Hill
5879610597
Bump up nodejs package version 2021-08-08 09:21:03 -04:00
Raymond Hill
af54415959
README has unsaved pending edits... 2021-08-06 08:29:13 -04:00
Raymond Hill
4495c37ca3
Provide basic documentation for the NPM package 2021-08-06 08:25:36 -04:00
Raymond Hill
5eb99a4dd6
... 2021-08-05 14:36:13 -04:00
Raymond Hill
05f0e04c07
Just trying to get this done.. 2021-08-05 14:34:21 -04:00
Raymond Hill
fe7ce8f576
Need to bump version to publish README 2021-08-05 14:32:07 -04:00
Manish Jethani
3879835324
Remove bundle generation from Node.js package (#3796) 2021-08-02 09:17:56 -04:00
Raymond Hill
f1106acf4b
Rename nodejs package
Related discussion:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1664#issuecomment-890834827
2021-08-02 08:08:43 -04:00
Manish Jethani
297bcea49b
Generate bundle.min.js in Node.js install script (#3794) 2021-08-01 18:33:13 -04:00
Manish Jethani
0b764934e0
Serialize PSL in Node.js install script (#3793) 2021-08-01 16:42:05 -04:00
Manish Jethani
8a33bda653
Use lower case for Node.js package name (#3792) 2021-08-01 05:22:57 -04:00
Raymond Hill
22022f636f
Modularize codebase with export/import
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1664

The changes are enough to fulfill the related issue.

A new platform has been added in order to allow for building
a NodeJS package. From the root of the project:

    ./tools/make-nodejs

This will create new uBlock0.nodejs directory in the
./dist/build directory, which is a valid NodeJS package.

From the root of the package, you can try:

    node test

This will instantiate a static network filtering engine,
populated by easylist and easyprivacy, which can be used
to match network requests by filling the appropriate
filtering context object.

The test.js file contains code which is typical example
of usage of the package.

Limitations: the NodeJS package can't execute the WASM
versions of the code since the WASM module requires the
use of fetch(), which is not available in NodeJS.

This is a first pass at modularizing the codebase, and
while at it a number of opportunistic small rewrites
have also been made.

This commit requires the minimum supported version for
Chromium and Firefox be raised to 61 and 60 respectively.
2021-07-27 17:26:04 -04:00