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

unit test files as UMD modules

This commit is contained in:
porlan1 2017-01-09 11:40:57 -05:00
parent aabfb7788a
commit d9e1cb7955
23 changed files with 727 additions and 129 deletions

View file

@ -305,9 +305,30 @@ function validateFile(path, name, context) {
parts.shift();
}
while (parts[0] === '..') {
if (base.length === 0) {
error('Invalid relative CommonJS path');
}
parts.shift();
base.pop();
}
if (base.length === 0) {
// Reached the project root -- finding prefix matching subpath.
for (var prefix in context.paths) {
if (!context.paths.hasOwnProperty(prefix)) {
continue;
}
var prefixPath = context.paths[prefix];
if (!('./' + parts.join('/') + '/').startsWith(prefixPath + '/')) {
continue;
}
parts.splice(0, prefixPath.split('/').length - 1);
base.push(prefix);
break;
}
if (base.length === 0) {
error('Invalid relative CommonJS path prefix');
}
}
if (j !== base.concat(parts).join('/')) {
error('CommonJS path does not point to right AMD module: ' +
i + ' vs ' + j);
@ -473,6 +494,7 @@ function validateFiles(paths, options) {
exports: Object.create(null),
imports: Object.create(null),
dependencies: Object.create(null),
paths: paths,
errorCallback: errorCallback,
warnCallback: warnCallback,
infoCallback: infoCallback