@datkt/konanc-config
Advanced tools
Comparing version 5.3.2 to 5.3.3
@@ -0,1 +1,11 @@ | ||
<a name="5.3.3"></a> | ||
## [5.3.3](https://github.com/datkt/konanc-config/compare/5.3.2...5.3.3) (2019-03-05) | ||
### Bug Fixes | ||
* **index.js:** Try module resolution for a path ([4a84f17](https://github.com/datkt/konanc-config/commit/4a84f17)) | ||
<a name="5.3.2"></a> | ||
@@ -2,0 +12,0 @@ ## [5.3.2](https://github.com/datkt/konanc-config/compare/5.3.1...5.3.2) (2019-03-05) |
24
index.js
@@ -15,2 +15,4 @@ const { extname, dirname, resolve, sep: PATH_SEPARATOR } = require('path') | ||
function load(name, defaults, env) { | ||
let resolved = false | ||
if (!name || 'string' != typeof name) { | ||
@@ -25,2 +27,3 @@ throw new TypeError("Expecting name to be a non-empty string.") | ||
name = resolve(name, PACKAGE_CONF) | ||
resolved = true | ||
} | ||
@@ -31,3 +34,22 @@ } | ||
} | ||
const paths = [ | ||
resolve('.'), | ||
resolve('..'), | ||
find(resolve('node_modules')), | ||
find(resolve('..', 'node_modules')) | ||
].filter(Boolean) | ||
try { | ||
name = require.resolve(name, { paths }) | ||
resolved = true | ||
} catch (err) { | ||
debug(err) | ||
try { | ||
name = require.resolve(`${name}/${PACKAGE_CONF}`, { paths }) | ||
resolved = true | ||
} catch (err) { | ||
debug(err) | ||
} | ||
} | ||
const config = resolve('.kc' == extname(name) ? name : `${name}.kc`) | ||
@@ -55,2 +77,4 @@ const cwd = process.cwd() | ||
resolved = true | ||
if (!conf || !conf.config || !conf.configs || !conf.configs.length) { | ||
@@ -57,0 +81,0 @@ try { |
{ | ||
"name": "@datkt/konanc-config", | ||
"version": "5.3.2", | ||
"version": "5.3.3", | ||
"description": "Command line utility to read '*.kc' konanc config files to print compiler flags", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
22863
243
5