browser-resolve
Advanced tools
Comparing version 1.5.0 to 1.6.0
47
index.js
@@ -146,33 +146,32 @@ // builtin | ||
function build_resolve_opts(opts, base) { | ||
return { | ||
paths: opts.paths, | ||
extensions: opts.extensions, | ||
basedir: base, | ||
package: opts.package, | ||
packageFilter: function (info, pkgdir) { | ||
if (opts.packageFilter) info = opts.packageFilter(info, pkgdir); | ||
var packageFilter = opts.packageFilter; | ||
// support legacy browserify field | ||
if (typeof info.browserify === 'string' && !info.browser) { | ||
info.browser = info.browserify; | ||
} | ||
opts.basedir = base; | ||
opts.packageFilter = function (info, pkgdir) { | ||
if (packageFilter) info = packageFilter(info, pkgdir); | ||
// no browser field, keep info unchanged | ||
if (!info.browser) { | ||
return info; | ||
} | ||
// support legacy browserify field | ||
if (typeof info.browserify === 'string' && !info.browser) { | ||
info.browser = info.browserify; | ||
} | ||
// replace main | ||
if (typeof info.browser === 'string') { | ||
info.main = info.browser; | ||
return info; | ||
} | ||
// no browser field, keep info unchanged | ||
if (!info.browser) { | ||
return info; | ||
} | ||
var replace_main = info.browser[info.main || './index.js'] || | ||
info.browser['./' + info.main || './index.js']; | ||
info.main = replace_main || info.main; | ||
// replace main | ||
if (typeof info.browser === 'string') { | ||
info.main = info.browser; | ||
return info; | ||
} | ||
var replace_main = info.browser[info.main || './index.js'] || | ||
info.browser['./' + info.main || './index.js']; | ||
info.main = replace_main || info.main; | ||
return info; | ||
}; | ||
return opts; | ||
} | ||
@@ -179,0 +178,0 @@ |
{ | ||
"name": "browser-resolve", | ||
"version": "1.5.0", | ||
"version": "1.6.0", | ||
"description": "resolve which handles browser field support in package.json", | ||
@@ -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
34115
785