browserify-lite
Advanced tools
Comparing version 0.2.0 to 0.2.1
31
index.js
@@ -253,3 +253,3 @@ var fs = require('fs'); | ||
var searchPath = searchPaths[index]; | ||
if (!searchPath) return cb(new Error("module not found")); | ||
if (!searchPath) return cb(new Error("module " + pkg + " in " + basedir + " not found")); | ||
@@ -288,17 +288,22 @@ requireResolvePath(path.resolve(searchPath, pkg), function(err, resolvedFilename) { | ||
fs.readFile(packageJsonPath, {encoding: 'utf8'}, function(err, packageJsonStr) { | ||
var packageJson; | ||
try { | ||
packageJson = JSON.parse(packageJsonStr); | ||
} catch (err) { | ||
cb(err); | ||
return; | ||
} | ||
var filename; | ||
if (packageJson.main) { | ||
filename = path.resolve(dirname, packageJson.main); | ||
resolveFile(filename, tryIndex); | ||
if (!err) { | ||
var packageJson; | ||
try { | ||
packageJson = JSON.parse(packageJsonStr); | ||
} catch (err) { | ||
cb(new Error("Invalid package.json: " + packageJsonPath + ": "+ err.message)); | ||
return; | ||
} | ||
var filename; | ||
if (packageJson.main) { | ||
filename = path.resolve(dirname, packageJson.main); | ||
resolveFile(filename, tryIndex); | ||
} else { | ||
tryIndex(new Error("no main found in package.json")); | ||
} | ||
} else { | ||
tryIndex(new Error("no main found in package.json")); | ||
tryIndex(new Error("no package.json found")); | ||
} | ||
function tryIndex(err) { | ||
@@ -305,0 +310,0 @@ if (!err) return cb(null, filename); |
{ | ||
"name": "browserify-lite", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "browserify, minus some of the advanced features and heavy dependencies.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14504
391