Commit graph

17 commits

Author SHA1 Message Date
Raymond Hill
314d6082f2
Fix broken GitHub actions
Related discussion:
- ad69c760fb (commitcomment-54363709)
2021-08-03 12:47:26 -04:00
Raymond Hill
89c5653bc6
Export the rule-based filtering engines to the nodejs package
The code exported to nodejs package was revised to use modern
JavaScript syntax. A few issues were fixed at the same time.

The exported classes are:
- DynamicHostRuleFiltering
- DynamicURLRuleFiltering
- DynamicSwitchRuleFiltering

These related to the content the of "My rules" pane in the
uBlock Origin extension.
2021-08-03 12:19:25 -04:00
Manish Jethani
6b85b7f2b1
Create build folder in npm install script (#3799) 2021-08-03 07:02:48 -04:00
Manish Jethani
ad69c760fb
Run ESLint during Node.js package generation (#3798) 2021-08-02 16:55:03 -04:00
Manish Jethani
0b764934e0
Serialize PSL in Node.js install script (#3793) 2021-08-01 16:42:05 -04:00
Raymond Hill
c6d275674d
Revert "Make the nodejs package load a serialized version of the PSL"
This reverts commit 46c6ff8708.
2021-08-01 15:42:46 -04:00
Raymond Hill
46c6ff8708
Make the nodejs package load a serialized version of the PSL
Related discussion:
- https://github.com/cliqz-oss/adblocker/pull/2091#issuecomment-890545926
2021-08-01 12:58:21 -04:00
Manish Jethani
be68a6b5b4
Use set -e in Bash scripts (#3791) 2021-07-31 17:34:25 -04:00
Raymond Hill
6fa8ae619d
Revert "Pass -e flag to bash (#3790)"
This reverts commit bb20159495.
2021-07-31 14:49:32 -04:00
Manish Jethani
bb20159495
Pass -e flag to bash (#3790) 2021-07-31 12:15:32 -04:00
Raymond Hill
de1feb0948
Fix make-nodejs
Broken due to renaming text-iterators to text-utils.
2021-07-31 08:59:55 -04:00
Raymond Hill
d5da88ea87
Simplify loading of WASM modules in nodejs 2021-07-31 07:06:11 -04:00
Raymond Hill
98fc66bb1b
Add support for enabling WASM code paths in NodeJS package
See `test.js` for reference on how to enable WASM code
paths (which are disabled by default).
2021-07-29 16:54:51 -04:00
Manish Jethani
63591ef2aa Make uAssets a submodule 2021-07-29 19:36:49 +05:30
Raymond Hill
09db8803c5
Remove requirement of uAssets presence to build a package
Related discussion:
- https://github.com/cliqz-oss/adblocker/pull/2075#discussion_r678654293
2021-07-28 19:40:11 -04:00
Raymond Hill
e1222d1643
Use require instead of fs
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1664#issuecomment-888332409
2021-07-28 10:38:24 -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