lilconfig

Zero-dependency nodejs config seeker.

MIT License

Downloads
121.5M
Stars
145
Committers
9

Bot releases are hidden (Show)

lilconfig - v3.1.2 Webpack friendly Latest Release

Published by antonk52 4 months ago

The new changes make lilconfig work as expected when a nodejs app is bundled using webpack.

Thanks @CHC383

lilconfig - v3.1.1 Security release

Published by antonk52 8 months ago

  1. Fix security vulnerability by migrating from typescript to javascript with TSDoc comments. See #48
  2. Use tabs instead of spaces

Due to how typescript compilation works I had to use eval() to have a dynamic import in project compiled to commonjs in v3.1.0. Eval call introduced a security vulnerability as it was pointed out to me by kind people from Secfault Security. As there is currently no way to make typescript output dynamic import with a commonjs target I migrated the source code to be in javascript. This means that the code in this repository is the code that gets published to npm. The package still includes first party typescript types in index.d.ts file that gets published as well. The runtime code now uses TSDoc annotations to maintain type safety.

lilconfig - v3.1.0 Support ESM config files (async api only)

Published by antonk52 8 months ago

Lilconfig now supports loading ESM configuration files.

ESM configs can be searched or loaded via async API only.

ESM syntax can be valid in either

  • .js and .mjs files in projects with "type": "module" in package.json
  • .mjs files in projects that use commonjs

Thanks for pushing this feature @marekdedic

lilconfig - v3.0.0 Cache support

Published by antonk52 11 months ago

BREAKING CHANGES

  • Cache support enabled by default
  • Drop support for Node v10 & v12

New cache feature

Lilconfig now can cache results in between searches within the same nodejs process. If you are reusing the searcher to look up configuration files, you will get much faster configuration lookups.

Otherwise you can disable it in options using the new cache key

lilconfig('myapp', {cache: false})
lilconfig - v2.1.0 adds support for `.config/<name>rc` files

Published by antonk52 over 1 year ago

The default search places for configuration now also searches in the following files:

  • .config/${name}rc
  • .config/${name}rc.json
  • .config/${name}rc.js
  • .config/${name}rc.cjs

This version should nicely correlate with cosmiconfig v7.1.0

lilconfig - v2.0.6 adds missing LICENSE file

Published by antonk52 over 2 years ago

Thanks for reporting @edgan 👏

lilconfig - v2.0.5 Fixes async loaders 👉 user defined ESM support

Published by antonk52 over 2 years ago

Thanks to @michael42 who reported and fixed a bug for async loaders in lilconfig function 👏

You can now add support to ESM configs by providing a custom loader

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`
    });
lilconfig - v2.0.4 Fix relative paths handling for `load` methods

Published by antonk52 almost 3 years ago

Thanks to @iiroj for highlighting a bug in okonet/lint-staged/issues/1034 where relative paths did not work appropriately when passed to load methods. This bug has been fixed and tested to make sure this would not happen again 🙂

There were also a few minor improvements:

  • Dev dependencies update
  • Include nodejs v14 and v16 into PR checks
  • Add missing .yml key in add loaded example in readme
lilconfig - v2.0.3 Fixes unix root directory path (thanks @JounQin)

Published by antonk52 over 3 years ago

This release contains a fix for unix root directory. Please see #17 for more information

Thank you @JounQin for the PR 🙌

lilconfig - Remove deprecated nodejs API

Published by antonk52 almost 4 years ago

Lilconfig got future proof by removing the usage of deprecated nodejs api.

Thanks to @jeetiss & @TrySound 👏

lilconfig - v2 add `.cjs` support and drop support for node.js v8

Published by antonk52 about 4 years ago

lilconfig v2 is supposed to mimic the functionality of cosmiconfig v7

The breaking changes are the same. To learn more about cosmiconfig v7 click here.

lilconfig - v1 release

Published by antonk52 about 4 years ago

After carefully testing compatibility with cosmiconfig, lilconfig's first major release is finally ready.

lilconfig - Type fix and smaller size

Published by antonk52 over 4 years ago

Type fix

  • lilconfig(name).search([searchPlace]) argument should be optional. Thanks @lttb 🎉

Smaller size

  • Since no external modules are used, ts compiler option esModuleInterop was disabled to prevent typescript from inlining import helpers into the transpiled code.