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

requireg

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

requireg - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

13

lib/requireg.js

@@ -10,13 +10,7 @@ var fs = require('fs')

function requireg(module) {
var moduleExports
try {
moduleExports = require(resolve(module))
} catch (e) {}
if (moduleExports === undefined) {
return require(resolve(module))
} catch (e) {
throw new Error("Cannot find global module '"+ module +"'")
}
return moduleExports
}

@@ -30,3 +24,2 @@

function resolve(module, dirname) {

@@ -43,2 +36,2 @@ var i, resolver, modulePath

return modulePath
}
}
var fs = require('fs')
var path = require('path')
var resolve = require('resolve').sync
var rc = require('rc')
var isWin32 = process.platform === 'win32'

@@ -39,9 +40,5 @@

if (!nodePath) {
return
}
if (isWin32) {
nodePath = nodePath.replace(':', ';')
}
if (!nodePath) { return }
if (isWin32) { nodePath = nodePath.replace(':', ';') }
nodePath = nodePath.split(';').map(function (nodepath) {

@@ -53,3 +50,3 @@ return path.normalize(nodepath)

if (modulePath = resolveFn(module, dirname || nodePath[i])) {
break;
break
}

@@ -83,10 +80,13 @@ }

function globalResolve(module) {
var modulePath
var dirname = path.dirname(process.execPath)
var modulePath, dirname, prefix
if (!isWin32) {
dirname = path.join(dirname, '../', 'lib')
if (isWin32) {
dirname = path.dirname(process.execPath)
}
else {
prefix = rc('npm').prefix || path.join(process.execPath, '../..')
dirname = path.join(prefix, 'lib')
}
dirname = path.join(dirname, 'node_modules')
modulePath = resolveFn(module, dirname)

@@ -101,3 +101,3 @@

if (nodeModules && typeof nodeModules === 'string') {
if (typeof nodeModules === 'string') {
nodeModules = nodeModules.split(';')

@@ -104,0 +104,0 @@ for (i = 0, l = nodeModules.length; i < l; i += 1) {

{
"name": "requireg",
"version": "0.1.3",
"description": "Require global modules like a boss",
"version": "0.1.4",
"description": "Require and resolve global modules like a boss",
"homepage": "http://github.com/h2non/requireg",

@@ -34,5 +34,7 @@ "bugs": "https://github.com/h2non/requireg/issues",

"require",
"import"
"import",
"resolve"
],
"dependencies": {
"rc": "~1.0.0",
"resolve": "~0.6.1"

@@ -45,2 +47,2 @@ },

}
}
}

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