@vxapp/resolve
Advanced tools
Comparing version 0.0.11 to 0.0.12
23
index.js
@@ -20,3 +20,3 @@ const fs = require('fs'); | ||
const e = path.join(c, d); | ||
return e; | ||
return e.indexOf('.') === 0 ? e : `./${e}`; | ||
}; | ||
@@ -77,15 +77,20 @@ | ||
const getOutputFileName = (filename, { source, target }) => { | ||
var output = filename.replace(source, target); | ||
if(~filename.indexOf('node_modules')){ | ||
const dir = getModulePath(filename); | ||
const pkg = require(path.join(dir, 'package.json')); | ||
const npm = path.join(target, 'npm', `${pkg.name}-${pkg.version}`); | ||
output = filename.replace(dir, npm); | ||
} | ||
return output; | ||
}; | ||
const createResolver = ({ source, target, current, extensions }) => { | ||
const basedir = path.dirname(current); | ||
const filename = current.replace(source, target); | ||
const filename = getOutputFileName(current, { source, target }); | ||
return name => { | ||
const ref = resolve(name, { basedir, extensions }); | ||
if(!ref) throw new Error(`[@vxapp/resolve] can not found module: "${name}" `); | ||
var output = ref.replace(source, target); | ||
if(~ref.indexOf('node_modules')){ | ||
const dir = getModulePath(ref); | ||
const pkg = require(path.join(dir, 'package.json')); | ||
const npm = path.join(target, 'npm', `${pkg.name}-${pkg.version}`); | ||
output = ref.replace(dir, npm); | ||
} | ||
const output = getOutputFileName(ref, { source, target }); | ||
return { | ||
@@ -92,0 +97,0 @@ source, |
{ | ||
"name": "@vxapp/resolve", | ||
"version": "0.0.11", | ||
"version": "0.0.12", | ||
"description": "resolve npm modules", | ||
@@ -21,3 +21,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "7787bf09096686206ef0b336b72a1522f8df39c7" | ||
"gitHead": "9274896b556c2c0398843838cacfce4631b0abe3" | ||
} |
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
3456
93