1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 01:58:06 +02:00

Create the WORKER_SRC_FILES and EXT_SRC_FILES lists in make automatically

This commit is contained in:
Christian Krebs 2014-04-09 14:04:43 +02:00
parent a6e5f31ca1
commit 5a49d2eb83
2 changed files with 25 additions and 30 deletions

View file

@ -220,6 +220,28 @@ function build(setup) {
}
exports.build = build;
function getWorkerSrcFiles(filePath) {
var src = fs.readFileSync(filePath).toString();
var reSrcFiles = /var\s+otherFiles\s*=\s*(\[[^\]]*\])/;
var match = reSrcFiles.exec(src);
try {
var files = JSON.parse(match[1].replace(/'/g, '"'));
var srcFiles = files.filter(function(name) {
return name.indexOf('external') == -1;
});
var externalSrcFiles = files.filter(function(name) {
return name.indexOf('external') > -1;
});
return {
srcFiles: srcFiles,
externalSrcFiles: externalSrcFiles
};
} catch(e) {
return {};
}
}
exports.getWorkerSrcFiles = getWorkerSrcFiles;
/**
* Merge two defines arrays. Values in the second param will override values in
* the first.