Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

debowerify

Package Overview
Dependencies
Maintainers
2
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

debowerify - npm Package Compare versions

Comparing version 0.3.0 to 0.4.0

3

bower.json

@@ -8,4 +8,5 @@ {

"devDependencies": {
"base62": "~0.4.0"
"base62": "~0.4.0",
"test-package-a": "./test/fixtures/test-package-a"
}
}

@@ -45,2 +45,27 @@ var bower = require('bower');

/**
* @param {Object} module As provided by Bower
* @returns {Object} A dictionary of the module dependencies
*/
function getModuleDependencies (module) {
return ['dependencies', 'devDependencies'].reduce(function(dependencies, property) {
for (var name in module[property]) dependencies[name] = module[property][name];
return dependencies;
}, {});
};
/**
* @param {string} name
* @param {Object} [parent] The parent module, as provided by Bower
* @returns {Object|null} The module as provided by Bower or null if not found
*/
function getModule (name, parent) {
parent = parent || bowerModules;
var dependencies = getModuleDependencies(parent);
for (var dependencyName in dependencies) {
var module = dependencies[name] || getModule(name, dependencies[dependencyName]);
if (module) return module;
}
};
function parse () {

@@ -53,27 +78,21 @@ var output = falafel(data, function (node) {

if (moduleName && bowerModules.dependencies) {
var module = bowerModules.dependencies[moduleName];
if (!module && bowerModules.devDependencies) {
module = bowerModules.devDependencies[moduleName];
}
var module = getModule(moduleName);
if (!module) return;
if (module) {
var pkgMeta = module.pkgMeta;
var requiredFilePath = moduleSubPath
var pkgMeta = module.pkgMeta;
var requiredFilePath = moduleSubPath;
if (!requiredFilePath){
if (pkgMeta && pkgMeta.main) {
requiredFilePath = Array.isArray(pkgMeta.main) ? pkgMeta.main[0] : pkgMeta.main;
} else {
// if 'main' wasn't specified by this component, let's try
// guessing that the main file is moduleName.js
requiredFilePath = moduleName + '.js';
}
}
var fullModulePath = path.resolve(path.join(module.canonicalDir, requiredFilePath));
var relativeRequiredFilePath = './' + path.relative(path.dirname(file), fullModulePath);
node.arguments[0].update(JSON.stringify(relativeRequiredFilePath));
if (!requiredFilePath){
if (pkgMeta && pkgMeta.main) {
requiredFilePath = Array.isArray(pkgMeta.main) ? pkgMeta.main[0] : pkgMeta.main;
} else {
// if 'main' wasn't specified by this component, let's try
// guessing that the main file is moduleName.js
requiredFilePath = moduleName + '.js';
}
}
var fullModulePath = path.resolve(path.join(module.canonicalDir, requiredFilePath));
var relativeRequiredFilePath = './' + path.relative(path.dirname(file), fullModulePath);
node.arguments[0].update(JSON.stringify(relativeRequiredFilePath));
}

@@ -80,0 +99,0 @@ });

{
"name": "debowerify",
"version": "0.3.0",
"version": "0.4.0",
"description": "A browserify transform to enable the easy use of bower components in browserify client javascript projects. This can be used in conjunction with deamdify to require AMD components from bower as well.",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc