Skip to content

v0.13.0

Compare
Choose a tag to compare
@remusao remusao released this 16 Aug 14:37
· 4532 commits to master since this release
82396e5
  • allow correct size allocation for data views #257

    Implement a mechanism which allows to predict the number of
    bytes needed to serialize any of the data-structures used by the
    adblocker, ahead of time (before serialization). This allows to lift
    the limitation of size completely (beforehand, we had to allocate
    a safe amount of memory to be sure there would be enough space).
    As a benefit, only the required amount of memory is used during
    initialization and updates, and there is no longer an arbitrary and
    hard-coded upper limit.

  • create new @cliqz/adblocker-content package with common utils #264

    We currently rely on rollup to create a small bundle for content
    related code imported from @cliqz/adblocker. Multiple times in
    the past the bundler was not aggressive enough and code from
    background was pulled in content bundles. To make sure we do not
    have this issue again, all these content-scripts helpers are moved
    into their own package.

  • provide helpers to download and build engines from lists #280

    This change allows to start blocking ads with very little logic in
    Webextension, Electron and Puppeteer platforms! To achieve this,
    blockers abstraction now provide static methods to fetch pre-built
    engines from Cliqz's CDN or build them from scratch using lists of URLs
    to subscriptions. Here is how it looks like:

    Webextension:

    import { WebExtensionBlocker } from '@cliqz/adblocker-webextension';
    
    WebExtensionBlocker.fromPrebuiltAdsAndTracking(fetch).then((blocker) => {
      blocker.enableBlockingInBrowser();
    });

    Electron:

    import { session } from 'electron';
    import fetch from 'cross-fetch'; // or 'node-fetch'
    
    import { ElectronBlocker } from '@cliqz/adblocker-electron';
    
    ElectronBlocker.fromPrebuiltAdsAndTracking(fetch).then((blocker) => {
      blocker.enableBlockingInSession(session.defaultSession);
    });

    Puppeteer:

    import puppeteer from 'puppeteer';
    import fetch from 'cross-fetch'; // or 'node-fetch'
    
    import { PuppeteerBlocker } from '@cliqz/adblocker-puppeteer';
    
    const browser = await puppeteer.launch();
    const page = await browser.newPage();
    
    PuppeteerBlocker.fromPrebuiltAdsAndTracking(fetch).then((blocker) => {
      blocker.enableBlockingInPage(page);
    });