Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function getManifestFile(opts, cb) {
file.read(opts.path, opts, function (err, manifest) {
if (err) {
// not found
if (err.code === 'ENOENT') {
cb(null, new gutil.File(opts));
} else {
cb(err);
}
return;
}
cb(null, manifest);
});
}
static async load(
name: string,
filePath: PathOsBased,
consumerPath: PathOsBased,
base: PathOsBased = consumerPath,
extendedProps?: Record
): Promise {
try {
const baseFile = await vinylFile.read(filePath, { base, cwd: consumerPath });
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
const file = new ExtensionFile(baseFile);
file.name = name;
// @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
file.file = Source.from(file.contents);
const addToFile = (value, key) => (file[key] = value); /* eslint-disable-line no-return-assign */
R.forEachObjIndexed(addToFile, extendedProps);
return file;
} catch (err) {
logger.error(`failed loading file ${filePath}. Error: ${err}`);
if (err.code === 'ENOENT' && err.path) {
throw new ExtensionFileNotFound(err.path);
}
throw err;
}
}
function getManifestFile(opts, cb) {
file.read(opts.path, opts, function (err, manifest) {
if (err) {
// not found
if (err.code === 'ENOENT') {
cb(null, new gutil.File(opts));
} else {
cb(err);
}
return;
}
cb(null, manifest);
});
}
map((cssDependency, callback) => {
if (puiCssPrefixRegexp.test(cssDependency.packageName)) {
const componentName = cssDependency.packageName.replace(puiCssPrefixRegexp, '');
read(`src/pivotal-ui/components/${componentName}/${componentName}.scss`, callback);
} else {
callback();
}
}),
const getManifestFile = opts => vinylFile.read(opts.path, opts).catch(err => {
if (err.code === 'ENOENT') {
return new Vinyl(opts);
}
throw err;
});
async.eachSeries(filenames, function(filename, eachCallback) {
vinylFile.read(filename, function(err, file) {
if (err) return eachCallback(err);
throughStream.push(file);
eachCallback();
});
}, function(err) {
throughCallback(err);
const getManifestFile = async options => {
try {
return await vinylFile.read(options.path, options);
} catch (error) {
if (error.code === 'ENOENT') {
return new Vinyl(options);
}
throw error;
}
};
setTimeout(function () {
vinyl.read(filepath, opts, write.bind(null, event));
}, opts.readDelay);
}
pull.asyncMap(function (filePath, cb) {
vinylFile(filePath, options)
.then(file => cb(null, file))
.catch(cb)
})
)