Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use bundle.min.cjs for adblockplus #2101

Merged
merged 1 commit into from
Aug 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions packages/adblocker-benchmarks/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,23 @@ requests.json:

./node_modules/@gorhill/ubo-core:
make -C ./blockers/ublock install-nodejs clean
npx rollup ./node_modules/@gorhill/ubo-core/index.js --file ./node_modules/@gorhill/ubo-core/bundle.min.cjs --format cjs --context global --plugin terser
mjethani marked this conversation as resolved.
Show resolved Hide resolved
npx rollup ./node_modules/@gorhill/ubo-core/index.js \
--file ./node_modules/@gorhill/ubo-core/bundle.min.cjs --format cjs \
--context global --plugin terser

ubo-core: ./blockers/ublock/.git ./node_modules/@gorhill/ubo-core

./node_modules/adblockpluscore:
cp -R ./blockers/adblockpluscore ./node_modules
cp ./blockers/adblockpluscore-index.js ./node_modules/adblockpluscore/lib
npx rollup ./node_modules/adblockpluscore/lib/adblockpluscore-index.js \
--file ./node_modules/adblockpluscore/lib/bundle.min.cjs --format cjs \
--plugin commonjs --plugin json --plugin terser --output.exports named

./blockers/adblockpluscore/.git:
git submodule update --recursive --depth 1 --init blockers/adblockpluscore

adblockpluscore: ./blockers/adblockpluscore/.git
adblockpluscore: ./blockers/adblockpluscore/.git ./node_modules/adblockpluscore

./node_modules/adblock-rs:
npm install --no-save adblock-rs
Expand Down Expand Up @@ -58,5 +67,5 @@ run: deps url tldts cliqz ublock adblockplus brave adblockfast

clean:
rm -f requests.json
npm uninstall ubo-core adblock-rs
npm uninstall adblockpluscore ubo-core adblock-rs
git submodule deinit --all
5 changes: 1 addition & 4 deletions packages/adblocker-benchmarks/blockers/adblockplus.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/

const { contentTypes } = require('./adblockpluscore/lib/contentTypes.js');
const { CombinedMatcher } = require('./adblockpluscore/lib/matcher.js');
const { Filter } = require('./adblockpluscore/lib/filterClasses.js');
const { parseURL } = require('./adblockpluscore/lib/url.js');
const { contentTypes, CombinedMatcher, Filter, parseURL } = require('adblockpluscore/lib/bundle.min.cjs');

// Chrome can't distinguish between OBJECT_SUBREQUEST and OBJECT requests.
contentTypes.OBJECT_SUBREQUEST = contentTypes.OBJECT;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const { contentTypes } = require('./contentTypes.js');
mjethani marked this conversation as resolved.
Show resolved Hide resolved
const { CombinedMatcher } = require('./matcher.js');
const { Filter } = require('./filterClasses.js');
const { parseURL } = require('./url.js');

exports.contentTypes = contentTypes;
exports.CombinedMatcher = CombinedMatcher;
exports.Filter = Filter;
exports.parseURL = parseURL;
2 changes: 2 additions & 0 deletions packages/adblocker-benchmarks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@
}
],
"devDependencies": {
"@rollup/plugin-commonjs": "^20.0.0",
"@rollup/plugin-json": "^4.1.0",
"rollup": "^2.55.1",
"rollup-plugin-terser": "^7.0.2"
}
Expand Down