Skip to content
This repository has been archived by the owner on Nov 6, 2023. It is now read-only.

Commit

Permalink
Ensure rewriter runs
Browse files Browse the repository at this point in the history
  • Loading branch information
Hainish committed Jul 8, 2019
1 parent 6abfac5 commit 61143d5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion utils/rewriter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"dependencies": {
"event-stream": "3.0.20",
"readdirp": "2.0.1",
"urijs": "^1.18.1",
"urijs": "^1.19.1",
"xmldom": "0.1.17"
}
}
11 changes: 7 additions & 4 deletions utils/rewriter/rewriter.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
// cd ~/path/to/my/webapp
// git diff

global.self = global;
require("../../lib-wasm/pkg/https_everywhere_lib_wasm.js");

var path = require("path"),
fs = require("fs"),
DOMParser = require('xmldom').DOMParser,
Expand All @@ -34,15 +37,15 @@ var ruleSets = null;
function processDir(dir) {
var stream = readdirp({
root: dir,
fileFilter: ['*.html', '*.js', '*.rb', '*.erb', '*.mustache',
fileFilter: ['*.html', '*.js', '*.rb', '*.erb', '*.mustache',
'*.scala', '*.c', '*.cc', '*.cpp', '*.cxx',
'*.java', '*.go', '*.php', '*.css', '*.pl', '*.py',
'*.rhtml', '*.sh', '*.yaml']
});

stream
.on('warn', function (err) {
console.error('non-fatal error', err);
.on('warn', function (err) {
console.error('non-fatal error', err);
// Optionally call stream.destroy() here in order to abort and cause 'close' to be emitted
})
.on('error', function (err) { console.error('fatal error', err); })
Expand Down Expand Up @@ -94,7 +97,7 @@ function processFile(filename) {
*/
function loadRuleSets() {
console.log("Loading rules...");
var fileContents = fs.readFileSync(path.join(__dirname, '../../pkg/crx/rules/default.rulesets'), 'utf8');
var fileContents = fs.readFileSync(path.join(__dirname, '../../pkg/crx-eff/rules/default.rulesets'), 'utf8');
ruleSets = new rules.RuleSets({});
ruleSets.addFromJson(JSON.parse(fileContents));
}
Expand Down

0 comments on commit 61143d5

Please sign in to comment.