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

@untool/core

Package Overview
Dependencies
Maintainers
3
Versions
93
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@untool/core - npm Package Compare versions

Comparing version 0.4.3 to 0.5.0

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

<a name="0.5.0"></a>
# [0.5.0](https://github.com/untool/untool/compare/v0.4.3...v0.5.0) (2018-05-07)
### Bug Fixes
* update dependency cosmiconfig to v5 ([dc20aaf](https://github.com/untool/untool/commit/dc20aaf))
<a name="0.4.3"></a>

@@ -8,0 +19,0 @@ ## [0.4.3](https://github.com/untool/untool/compare/v0.4.2...v0.4.3) (2018-04-24)

59

lib/config.js

@@ -22,10 +22,6 @@ const { basename, dirname, join } = require('path');

const resolvePreset = (context, preset) => {
try {
return createResolver({
mainFiles: ['preset'],
mainFields: ['preset'],
})(context, preset);
} catch (_) {
throw new Error(`preset not found ${preset}`);
}
return createResolver({
mainFiles: ['preset'],
mainFields: ['preset'],
})(context, preset);
};

@@ -62,11 +58,7 @@

const nsp = process.env.UNTOOL_NSP || 'untool';
try {
const options = preset
? { configPath: resolvePreset(context, preset), sync: true }
: { rcExtensions: true, stopDir: context, sync: true };
const explorer = cosmiconfig(nsp, options);
return applyEnv(explorer.load(context));
} catch (_) {
return null;
}
const explorer = cosmiconfig(nsp, { cache: false, stopDir: context });
const presetPath = preset && resolvePreset(context, preset);
return applyEnv(
presetPath ? explorer.loadSync(presetPath) : explorer.searchSync(context)
);
};

@@ -79,19 +71,22 @@

const loadPreset = (context, preset) => {
try {
return loadConfig(context, preset);
} catch (_) {
return loadConfig(
dirname(resolvePreset(context, `${preset}/package.json`))
);
}
};
const loadPresets = (context, presets = []) =>
presets.reduce((result, preset) => {
const loadedConfig =
loadConfig(context, preset) ||
loadConfig(dirname(resolvePreset(context, join(preset, 'package.json'))));
if (loadedConfig) {
const { config, filepath } = loadedConfig;
const newContext = dirname(filepath);
if (config.mixins) {
config.mixins = config.mixins.map(
mixin => (mixin.startsWith('.') ? join(newContext, mixin) : mixin)
);
}
return merge(result, loadPresets(newContext, config.presets), config);
} else {
throw new Error(`preset not found: ${preset}`);
presets.reduce((configs, preset) => {
const { config, filepath } = loadPreset(context, preset);
const newContext = dirname(filepath);
if (config.mixins) {
config.mixins = config.mixins.map(
mixin => (mixin.startsWith('.') ? join(newContext, mixin) : mixin)
);
}
return merge(configs, loadPresets(newContext, config.presets), config);
}, {});

@@ -98,0 +93,0 @@

{
"name": "@untool/core",
"version": "0.4.3",
"version": "0.5.0",
"description": "untool core",

@@ -24,3 +24,3 @@ "main": "lib/core.js",

"dependencies": {
"cosmiconfig": "^4.0.0",
"cosmiconfig": "^5.0.1",
"enhanced-resolve": "^4.0.0",

@@ -27,0 +27,0 @@ "find-up": "^2.1.0",

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