Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
compiler.inputFileSystem.readFile(file, function(err, data) {
if (err) {
/* istanbul ignore else */
if (err.code === 'ENOENT') {
return callback();
} else {
return callback(err);
}
}
compilation.assets['bower.json'] = new RawSource(data);
Utils.bootstrapAsset(compilation, 'bower.json');
callback();
});
});
this.meta = function(tag) {
if (tag) {
return files[tag]['bower.json'];
} else {
return files['bower.json'];
}
};
this.meta = function(tag) {
if (tag) {
return files[tag]['bower.json'];
} else {
return files['bower.json'];
}
};
function loadAsDirectory(dir) {
"use strict";
if(fileSystem.isFile(dir['package.json'])) {
const pJ = JSON.parse(dir['package.json'].contents);
return loadFromPackageFile(pJ, dir)
}
if(fileSystem.isFile(dir['bower.json'])) {
const pJ = JSON.parse(dir['bower.json'].contents);
return loadFromPackageFile(pJ, dir)
}
if(fileSystem.isFile(dir['index.js'])) {
return dir['index.js']
}
if(fileSystem.isFile(dir['index.json'])) {
return dir['index.json']
}
}
function loadAsDirectory(dir) {
"use strict";
if(fileSystem.isFile(dir['package.json'])) {
const pJ = JSON.parse(dir['package.json'].contents);
return loadFromPackageFile(pJ, dir)
}
if(fileSystem.isFile(dir['bower.json'])) {
const pJ = JSON.parse(dir['bower.json'].contents);
return loadFromPackageFile(pJ, dir)
}
if(fileSystem.isFile(dir['index.js'])) {
return dir['index.js']
}
if(fileSystem.isFile(dir['index.json'])) {
return dir['index.json']
}
}
public async extract(_: string, files: { [p: string]: ExtractorFile }): Promise {
const {
name,
version,
repository,
dependencies,
devDependencies,
bundledDependencies,
} = files["bower.json"].json();
const { organization, module } = parseName(name);
let allDependencies = extract((dependencies || {}), "");
allDependencies = allDependencies.concat(extract((devDependencies || {}), "dev"));
allDependencies = allDependencies.concat(extract((bundledDependencies || {}), "bundled"));
let sourceUrl = repository;
if (typeof repository === "object") {
sourceUrl = repository.url;
}
return {
language: Languages.JAVASCRIPT,
system: "bower",
sourceUrl,