Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
resolver.plugin("described-relative", (request, callback) => {
const directory = request.path;
DescriptionFileUtils.loadDescriptionFile(resolver, directory, ["wat.json"], ((err, result) => {
console.log(directory);
if(err) return callback(err);
if(!result) {
if(callback.missing) {
callback.missing.push(resolver.join(directory, "wat.json"));
}
if(callback.log) callback.log("No description file found");
return callback();
}
const relativePath = "." + request.path.substr(result.directory.length).replace(/\\/g, "/");
// This is the requst that will be passed on to the next resolver plugin.
const obj = Object.assign({}, request, {
descriptionFilePath: result.path,
descriptionFileData: result.content,