mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-10 01:02:08 +01:00
Expose ability to compile raw list into their intermeditate form
For clients who may wish to persist the intermediate compiled form in order to be able to skip costly parsing operation when the list is fed to the static network filtering engine.
This commit is contained in:
parent
4818405cf6
commit
63e55a1696
1 changed files with 6 additions and 1 deletions
|
@ -133,6 +133,10 @@ function pslInit(raw) {
|
|||
return globals.publicSuffixList;
|
||||
}
|
||||
|
||||
function createCompiler(parser) {
|
||||
return snfe.createCompiler(parser);
|
||||
}
|
||||
|
||||
async function useCompiledLists(lists) {
|
||||
// Remove all filters
|
||||
reset();
|
||||
|
@ -169,7 +173,7 @@ async function useRawLists(lists, options = {}) {
|
|||
return snfe;
|
||||
}
|
||||
|
||||
const compiler = snfe.createCompiler(new StaticFilteringParser());
|
||||
const compiler = createCompiler(new StaticFilteringParser());
|
||||
|
||||
const consumeList = list => {
|
||||
const writer = new CompiledListWriter();
|
||||
|
@ -209,6 +213,7 @@ export {
|
|||
FilteringContext,
|
||||
enableWASM,
|
||||
pslInit,
|
||||
createCompiler,
|
||||
useCompiledLists,
|
||||
useRawLists,
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue