1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-07-05 11:37:01 +02: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:
Raymond Hill 2021-08-05 13:37:41 -04:00
parent 4818405cf6
commit 63e55a1696
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -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,
};