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

browserify-optional

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

browserify-optional - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

yarn.lock

17

index.js
var astTransform = require('ast-transform');
var astTypes = require('ast-types');
var path = require('path');
var resolve = require('browser-resolve');
module.exports = astTransform(function (file) {
if (path.extname(file) !== '.js') return;
return function(ast, next) {

@@ -15,6 +18,6 @@ astTypes.visit(ast, {

return this.traverse(path);
var module = node.arguments[0].value;
var p = path;
while (p = p.parent) {

@@ -24,7 +27,7 @@ var parent = p.value;

break;
if (parent.type === 'TryStatement') {
try {
resolve.sync(module, { filename: file });
} catch (e) {
} catch (e) {
path.replace({

@@ -56,13 +59,13 @@ type: 'CallExpression',

}
break;
}
}
return false;
}
});
next(null, ast);
}
});
{
"name": "browserify-optional",
"version": "1.0.0",
"version": "1.0.1",
"description": "A browserify transform that allows optional dependencies in try..catch blocks",

@@ -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