🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

eslint-import-resolver-webpack

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-import-resolver-webpack - npm Package Compare versions

Comparing version

to
0.1.1

31

index.js

@@ -5,2 +5,3 @@ var findRoot = require('find-root')

, get = require('lodash.get')
, find = require('array-find')

@@ -64,2 +65,3 @@ var resolveAlias = require('./resolve-alias')

paths: paths,
packageFilter: packageFilter.bind(null, webpackConfig),
})

@@ -90,1 +92,30 @@ }

}
/**
* webpack defaults: http://webpack.github.io/docs/configuration.html#resolve-packagemains
* @type {Array}
*/
var defaultMains = [
'webpack', 'browser', 'web', 'browserify', ['jam', 'main'], 'main',
]
function packageFilter(config, pkg) {
var altMain
// check for rollup-style first
if (pkg['jsnext:main']) {
pkg['main'] = pkg['jsnext:main']
} else {
// check for configured/default alternative main fields
altMain = find(
get(config, ['resolve', 'packageMains']) || defaultMains,
function (m) { return get(pkg, m) })
if (altMain) {
pkg['main'] = pkg[altMain]
}
}
return pkg
}

3

package.json
{
"name": "eslint-import-resolver-webpack",
"version": "0.1.0",
"version": "0.1.1",
"description": "Resolve paths to dependencies, given a webpack.config.js. Plugin for eslint-plugin-import.",

@@ -27,2 +27,3 @@ "main": "index.js",

"dependencies": {
"array-find": "^1.0.0",
"find-root": "^0.1.1",

@@ -29,0 +30,0 @@ "lodash.get": "^3.7.0",