{"name":"lilconfig","version":"3.1.3","description":"A zero-dependency alternative to cosmiconfig","main":"src/index.js","types":"src/index.d.ts","scripts":{"test":"NODE_OPTIONS=--experimental-vm-modules ./node_modules/.bin/jest --coverage","lint":"biome ci ./src","types":"tsc"},"keywords":["cosmiconfig","config","configuration","search"],"repository":{"type":"git","url":"git+https://github.com/antonk52/lilconfig.git"},"bugs":{"url":"https://github.com/antonk52/lilconfig/issues"},"author":{"name":"antonk52"},"license":"MIT","devDependencies":{"@biomejs/biome":"^1.6.0","@types/jest":"^29.5.12","@types/node":"^14.18.63","@types/webpack-env":"^1.18.5","cosmiconfig":"^8.3.6","jest":"^29.7.0","typescript":"^5.3.3","uvu":"^0.5.6"},"funding":"https://github.com/sponsors/antonk52","engines":{"node":">=14"},"_id":"lilconfig@3.1.3","gitHead":"77d7186c37a3838c85d03e126172f82a8a474ece","homepage":"https://github.com/antonk52/lilconfig#readme","_nodeVersion":"23.3.0","_npmVersion":"10.8.1","dist":{"integrity":"sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw==","shasum":"a1bcfd6257f9585bf5ae14ceeebb7b559025e4c4","tarball":"http://registry-npm.ywwl.com/lilconfig/download/lilconfig-3.1.3.tgz","fileCount":5,"unpackedSize":17959,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD8bwR048YWsbpn+/l/UM2kAZZ2EDS7c7OJgJ4FCJbnRwIhAKl6XH03p7VR9iefq/Ai5yz0vL8ttFe8ReA2iyYUIIj7"}],"size":5223,"noattachment":false,"key":"/lilconfig/-/lilconfig-3.1.3.tgz"},"_npmUser":{"name":"antonk52","email":"halloy52@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/lilconfig_3.1.3_1733226557018_0.7852559988205983"},"_hasShrinkwrap":false,"readme":"# Lilconfig ⚙️\n[![npm version](https://badge.fury.io/js/lilconfig.svg)](https://badge.fury.io/js/lilconfig)\n[![install size](https://packagephobia.now.sh/badge?p=lilconfig)](https://packagephobia.now.sh/result?p=lilconfig)\n[![Coverage Status](https://coveralls.io/repos/github/antonk52/lilconfig/badge.svg)](https://coveralls.io/github/antonk52/lilconfig)\n\nA zero-dependency alternative to [cosmiconfig](https://www.npmjs.com/package/cosmiconfig) with the same API.\n\n## Installation\n\n```sh\nnpm install lilconfig\n```\n\n## Usage\n\n```js\nimport {lilconfig, lilconfigSync} from 'lilconfig';\n\n// all keys are optional\nconst options = {\n    stopDir: '/Users/you/some/dir',\n    searchPlaces: ['package.json', 'myapp.conf.js'],\n    ignoreEmptySearchPlaces: false\n}\n\nlilconfig(\n    'myapp',\n    options // optional\n).search() // Promise<LilconfigResult>\n\nlilconfigSync(\n    'myapp',\n    options // optional\n).load(pathToConfig) // LilconfigResult\n\n/**\n * LilconfigResult\n * {\n *   config: any; // your config\n *   filepath: string;\n * }\n */\n```\n\n## ESM\n\nESM configs can be loaded with **async API only**. Specifically `js` files in projects with `\"type\": \"module\"` in `package.json` or `mjs` files.\n\n## Difference to `cosmiconfig`\nLilconfig does not intend to be 100% compatible with `cosmiconfig` but tries to mimic it where possible. The key difference is **no** support for yaml files out of the box(`lilconfig` attempts to parse files with no extension as JSON instead of YAML). You can still add the support for YAML files by providing a loader, see an [example](#yaml-loader) below.\n\n### Options difference between the two.\n\n|cosmiconfig option      | lilconfig |\n|------------------------|-----------|\n|cache                   | ✅        |\n|loaders                 | ✅        |\n|ignoreEmptySearchPlaces | ✅        |\n|packageProp             | ✅        |\n|searchPlaces            | ✅        |\n|stopDir                 | ✅        |\n|transform               | ✅        |\n\n## Loaders examples\n\n### Yaml loader\n\nIf you need the YAML support you can provide your own loader\n\n```js\nimport {lilconfig} from 'lilconfig';\nimport yaml from 'yaml';\n\nfunction loadYaml(filepath, content) {\n    return yaml.parse(content);\n}\n\nconst options = {\n    loaders: {\n        '.yaml': loadYaml,\n        '.yml': loadYaml,\n        // loader for files with no extension\n        noExt: loadYaml\n    }\n};\n\nlilconfig('myapp', options)\n    .search()\n    .then(result => {\n        result // {config, filepath}\n    });\n```\n\n## Version correlation\n\n- lilconig v1 → cosmiconfig v6\n- lilconig v2 → cosmiconfig v7\n- lilconig v3 → cosmiconfig v8\n","publish_time":1733226557194,"maintainers":[{"name":"antonk52","email":"halloy52@gmail.com"}],"_cnpm_publish_time":1733226557194,"dist-tags":{"latest":"3.1.5"}}