{"name":"lilconfig","version":"2.1.0","keywords":["cosmiconfig","config","configuration","search"],"author":{"name":"antonk52"},"license":"MIT","_id":"lilconfig@2.1.0","maintainers":[{"name":"antonk52","email":"halloy52@gmail.com"}],"homepage":"https://github.com/antonk52/lilconfig#readme","bugs":{"url":"https://github.com/antonk52/lilconfig/issues"},"dist":{"shasum":"78e23ac89ebb7e1bfbf25b18043de756548e7f52","tarball":"http://registry-npm.ywwl.com/lilconfig/download/lilconfig-2.1.0.tgz","fileCount":5,"integrity":"sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==","signatures":[{"sig":"MEUCIQDQuTBdd3HrQhyGLZOJ2JOHKly2C5vUdsEU1FSrFkwaMAIgB6C6HOyIGBUuk+3dzUZOS74c3UVzNjlBc6MVimCzwzw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":16587,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkAPtXACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoftA//Ys74twRTDUEw5L29+LVkszXEcmtRf3XcMvsbPS+X9momm2PA\r\nRHNzpBhLUAiNkEfsZaAOqpGMnh8o5MPGkPqX0b1AfwfZuWXywSnoltkBKVVw\r\noh/WynvZ5rB+7R64mvsW3W+n68Vu4Az6ReXTydf65qtnvEDj/xiLTrOsvFNB\r\n22L6kVyhzLfu5VDxQ767Ik7xRvMb8IuSYrrNkOvugKA6aLOEJDZMt2hukAiM\r\nY/qUJMte7BFP+ds8RXTEOQYb3qEJxSVBtcEbkFEMLObtQGJVxmOWDieM+daI\r\ntLxhAxSrRhCwU1i5ZWQIDNyr2tCN/7Du+u58E6C4DbP/vL30dkk9c2fDUWPp\r\nqr+gkrvYsWrnkXs2C2LAu+tqkvmXx1fL/h9xHb7oxWvid2i036Rz4MkLYxjp\r\nxM3gjvtHluZVIDRcAxEcH75UbKLOvpz4S3FBZ4gYXaoXkTF2Dju5C6S84xu3\r\nc8GaOuQ0JsNikfsvu/fecPrB/8U+OeaDvZaggVCZWArGjpPm39J7rI9Nhnl3\r\nsIkG/HwdAYwEicAKr9i63dfisMvzn5Oj0DbneMzKXJ/x3MoL4zBidKPUUo+6\r\ndMSQgKPzkBYubGbeW8cs/1N4NHUNSMDOFva0c49txyqe+tmjdacuQ8h4lQKF\r\nlpidZyfTdmVJ0xkuB2cjghDgU4klLtW7xV4=\r\n=fzHr\r\n-----END PGP SIGNATURE-----\r\n","size":4505,"noattachment":false,"key":"/lilconfig/-/lilconfig-2.1.0.tgz"},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=10"},"gitHead":"b056bd8e9d78eb258992005eedc855256af8bbe6","scripts":{"lint":"eslint ./src/*.ts","test":"jest --coverage","build":"tsc --declaration","clean":"rm -rf ./dist","prebuild":"npm run clean","postbuild":"du -h ./dist/*"},"_npmUser":{"name":"antonk52","email":"halloy52@gmail.com"},"repository":{"url":"git+https://github.com/antonk52/lilconfig.git","type":"git"},"_npmVersion":"9.5.1","description":"A zero-dependency alternative to cosmiconfig","directories":{},"_nodeVersion":"18.14.2","_hasShrinkwrap":false,"devDependencies":{"jest":"^27.3.1","eslint":"^8.35.0","ts-jest":"27.0.7","prettier":"^2.8.4","typescript":"4.4.4","@types/jest":"^27.0.2","@types/node":"^14.18.36","cosmiconfig":"^7.1.0","eslint-config-prettier":"^8.6.0","eslint-plugin-prettier":"^4.2.1","@typescript-eslint/parser":"^5.54.0","@typescript-eslint/eslint-plugin":"^5.54.0"},"_npmOperationalInternal":{"tmp":"tmp/lilconfig_2.1.0_1677785943467_0.20862771583230444","host":"s3://npm-registry-packages"},"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":1677785943608,"_cnpm_publish_time":1677785943608,"dist-tags":{"latest":"3.1.5"}}