Socket
Socket
Sign inDemoInstall

lilconfig

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lilconfig - npm Package Compare versions

Comparing version 2.0.4 to 2.0.5

4

dist/index.js

@@ -108,3 +108,3 @@ "use strict";

if (fileName === 'package.json') {
const pkg = loader(filepath, content);
const pkg = await loader(filepath, content);
const maybeConfig = getPackageProp(packageProp, pkg);

@@ -127,3 +127,3 @@ if (maybeConfig != null) {

validateLoader(loader, loaderKey);
result.config = loader(filepath, content);
result.config = await loader(filepath, content);
}

@@ -130,0 +130,0 @@ result.filepath = filepath;

{
"name": "lilconfig",
"version": "2.0.4",
"version": "2.0.5",
"description": "A zero-dependency alternative to cosmiconfig",

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

@@ -62,8 +62,10 @@ # Lilconfig ⚙️

## Loaders example
## Loaders examples
### Yaml loader
If you need the YAML support you can provide your own loader
```js
import {lilconig} from 'lilconfig';
import {lilconfig} from 'lilconfig';
import yaml from 'yaml';

@@ -91,2 +93,25 @@

### ESM loader
Lilconfig v2 does not support ESM modules out of the box. However, you can support it with a custom a loader. Note that this will only work with the async `lilconfig` function and won't work with the sync `lilconfigSync`.
```js
import {lilconfig} from 'lilconfig';
const loadEsm = filepath => import(filepath);
lilconfig('myapp', {
loaders: {
'.js': loadEsm,
'.mjs': loadEsm,
}
})
.search()
.then(result => {
result // {config, filepath}
result.config.default // if config uses `export default`
});
```
## Version correlation

@@ -93,0 +118,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