{"_id":"lilconfig@3.1.5","bugs":{"url":"https://github.com/antonk52/lilconfig/issues"},"dist":{"shasum":"7c9342a74d602bb15c0a1ca67f2c99be056c4656","tarball":"http://registry-npm.ywwl.com/lilconfig/download/lilconfig-3.1.5.tgz","fileCount":5,"integrity":"sha512-aRAOI9Ia43ygL4o1EOmC/sc/0OFxrm7qcQngiIyWaqVnSnz932ybJ07zyCcgMNGSDP8Yxaf88Xj1zHEXmvQ4SA==","signatures":[{"sig":"MEUCIQC/3oQeXs7JhN58MWlFojyKUvmynCIMyd/4pvlEgry82gIgBTmuSwVPz//kIraSWytjx3GT2Mz+qYvnKoXZQdvdJHc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIAY1sDpZZp8oYGCPMx4pBl8adSuedsv5/S91lTej4hM7AiBXKpG7dI2CW/Ss3qFKm9SYqhCVi1GDAi9ytJ8OcFZowA=="}],"unpackedSize":18058,"size":5252,"noattachment":false,"key":"/lilconfig/-/lilconfig-3.1.5.tgz"},"main":"src/index.js","name":"lilconfig","types":"src/index.d.ts","author":{"name":"antonk52"},"engines":{"node":">=14"},"funding":"https://github.com/sponsors/antonk52","gitHead":"7c0e824f2cdfef39fa8afe4bc2a69a880df4d5a8","license":"MIT","scripts":{"lint":"biome ci ./src","test":"NODE_OPTIONS=--experimental-vm-modules ./node_modules/.bin/jest --coverage","types":"tsc"},"version":"3.1.5","_npmUser":{"name":"antonk52","email":"halloy52@gmail.com"},"homepage":"https://github.com/antonk52/lilconfig#readme","keywords":["cosmiconfig","config","configuration","search"],"repository":{"url":"git+https://github.com/antonk52/lilconfig.git","type":"git"},"_npmVersion":"12.0.2","description":"A zero-dependency alternative to cosmiconfig","directories":{},"maintainers":[{"name":"antonk52","email":"halloy52@gmail.com"}],"_nodeVersion":"26.13.0","_hasShrinkwrap":false,"devDependencies":{"uvu":"^0.5.6","jest":"^29.7.0","typescript":"^5.9.3","@types/jest":"^29.5.14","@types/node":"^14.18.63","cosmiconfig":"^8.3.6","@biomejs/biome":"^1.9.4","@types/webpack-env":"^1.18.8"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/lilconfig_3.1.5_1794268760567_0.7898715375148906"},"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### Option 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- lilconfig v1 → cosmiconfig v6\n- lilconfig v2 → cosmiconfig v7\n- lilconfig v3 → cosmiconfig v8\n","publish_time":1794268760781,"_cnpm_publish_time":1794268760781,"dist-tags":{"latest":"3.1.5"}}