Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@datkt/konanc-config

Package Overview
Dependencies
Maintainers
2
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@datkt/konanc-config - npm Package Compare versions

Comparing version 1.0.5 to 2.0.0

70

index.js
const { extname, dirname, resolve } = require('path')
const { existsSync } = require('fs')
const { parse } = require('rc/lib/utils')

@@ -18,3 +19,3 @@ const rc = require('rc')

return rc(name, defaults, { config }, (content) => {
const conf = rc(name, defaults, { config }, (content) => {
Object.assign(env, process.env, {

@@ -27,2 +28,69 @@ __dirname: resolve(dirname(config)),

if (conf.require && conf.require.length) {
if (!Array.isArray(conf.require)) {
conf.require = [ conf.require ]
}
const repos = (conf.repo && !Array.isArray(conf.repo)
? [ conf.repo ]
: conf.repo)
for (const dep of conf.require) {
merge(conf, load(dep, defaults, env))
for (const repo of repos) {
merge(conf, load(resolve(repo, dep), defaults, env))
}
}
}
return conf
function merge(target, src) {
if (!target || !src ) {
return
}
if ('object' != typeof target || 'object' != typeof src) {
return
}
for (const k in src) {
if (Array.isArray(src[k])) {
if (Array.isArray(conf[k])) {
for (const x of src[k]) {
if (!conf[k].includes(x)) {
conf[k].push(x)
}
}
} else if ('string' == typeof conf[k]) {
if (src[k].includes(conf[k])) {
conf[k] = src[k]
} else {
conf[k] = [ conf[k] ].concat(src[k])
}
} else {
conf[k] = src[k]
}
} else if ('string' == typeof src[k]) {
if (Array.isArray(conf[k])) {
if (!conf[k].includes(src[k])) {
conf[k].push(src[k])
}
} else if ('string' == typeof conf[k]) {
if (conf[k] != src[k]) {
conf[k] = [ conf[k], src[k] ]
}
}
} else if ('object' == typeof src[k]) {
if ('object' == typeof target[k]) {
merge(src[k], target[k])
} else if (null != target[k] && 'undefined' != typeof target[k]) {
throw new TypeError("Cannot merge source object into target string.")
} else {
target[k] = src[k]
}
}
}
}
function template(content) {

@@ -29,0 +97,0 @@ const vars = Object.keys(env)

2

package.json
{
"name": "@datkt/konanc-config",
"version": "1.0.5",
"version": "2.0.0",
"description": "Command line utility to read '*.kc' konanc config files to print compiler flags",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc