Skip to content

Commit f848d61

Browse files
moonglumFND
authored andcommitted
Expose the webRoot in the manifest
1 parent 62e55ff commit f848d61

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

lib/manifest.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,14 @@ let path = require("path");
77

88
module.exports = class Manifest {
99
constructor(referenceDir, { target, key, value, baseURI, webRoot } = {}) {
10+
if(value && (baseURI || webRoot)) {
11+
abort("ERROR: `value` must not be used with `baseURI` and/or `webRoot`");
12+
}
13+
this.webRoot = webRoot = resolvePath(webRoot || "./", referenceDir,
14+
{ enforceRelative: true });
15+
1016
if(target) {
11-
this.filepath = resolvePath(target, referenceDir, {
12-
enforceRelative: true
13-
});
17+
this.filepath = resolvePath(target, referenceDir, { enforceRelative: true });
1418
}
1519
this._index = new Map();
1620

@@ -21,14 +25,9 @@ module.exports = class Manifest {
2125
}
2226

2327
if(value) {
24-
if(baseURI || webRoot) {
25-
abort("ERROR: `value` cannot be used with `baseURI` and/or `webRoot`");
26-
}
2728
this.valueTransform = value;
2829
} else {
2930
baseURI = baseURI || "/";
30-
webRoot = resolvePath(webRoot || "./", referenceDir,
31-
{ enforceRelative: true });
3231
this.valueTransform = filepath => baseURI + path.relative(webRoot, filepath);
3332
}
3433
}

0 commit comments

Comments
 (0)