New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

browser-require

Package Overview
Dependencies
Maintainers
0
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

browser-require - npm Package Compare versions

Comparing version 0.1.4 to 0.1.6

25

lib/browser-require.js

@@ -22,3 +22,2 @@ // 1. Read the top file

function fail(res, err) {
console.error(err);
res.writeHead(404);

@@ -34,2 +33,3 @@ res.end();

EventEmitter.call(this);
this.setMaxListeners(0);
this.name = name;

@@ -61,5 +61,5 @@ if (npmBase) {

this.lookup( name, parent, function (err, normalized, location, npmBase) {
if (err) return fn(err);
var mod = self.modules[normalized] || (self.modules[normalized] = new ScriptPromise(normalized, location, npmBase));
fn(null, mod);
if (err) return mod.emit('error', err);
fn(mod);
});

@@ -160,3 +160,3 @@ };

fs.readFile(this.location, 'utf8', function (err, src) {
if (err) return self.trigger('error', err);
if (err) return self.emit('error', err);
self.src = src;

@@ -168,4 +168,3 @@ var depNames = self.depsFor(src);

depNames.forEach( function (name) {
ScriptPromise.from(name, self, function (err, script) {
if (err) return self.trigger("error", err);
ScriptPromise.from(name, self, function (script) {
if (!script.isTriggered('loaded')) script.load();

@@ -204,3 +203,3 @@ deps.push(script);

fs.readFile(this.location, 'utf8', function (err, src) {
if (err) return self.trigger('error', err);
if (err) return self.emit('error', err);
self.src = src;

@@ -212,3 +211,3 @@ // Check for dependency additions or removals

// Notify anyone who depends on me
self.trigger('reloaded', src);
self.emit('reloaded', src);
});

@@ -249,6 +248,4 @@ };

ScriptPromise.from(url, null, function (err, script) {
if (err) throw err;
compileAll(script, function (err, compiled) {
if (err) return fail(res, err);
ScriptPromise.from(url, null, function (script) {
compileAll(script, function (compiled) {
if (!compiled) return next();

@@ -266,3 +263,3 @@

if (noDeps) {
return fn(null, script.src);
return fn(script.src);
}

@@ -277,3 +274,3 @@ var compiled = [templates.boilerplate]

compiled.push("browserRequire('" + script.name.slice(0, -3) + "');");
fn(null, compiled.join("\n"));
fn(compiled.join("\n"));
});

@@ -280,0 +277,0 @@ script.load();

{
"name": "browser-require",
"description": "Use CommonJS and NPM modules from the browser",
"version": "0.1.4",
"version": "0.1.6",
"homepage": "https://github.com/bnoguchi/browser-require",

@@ -6,0 +6,0 @@ "repository": "https://github.com/bnoguchi/browser-require.git",

Sorry, the diff of this file is not supported yet

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