{"name":"lilconfig","version":"0.0.1","keywords":["cosmiconfig","config","search"],"author":{"name":"antonk52"},"license":"MIT","_id":"lilconfig@0.0.1","maintainers":[{"name":"antonk52","email":"halloy52@gmail.com"}],"dist":{"shasum":"b8d32a9be7925d71371979d0ba70512a92720b12","tarball":"http://registry-npm.ywwl.com/lilconfig/download/lilconfig-0.0.1.tgz","fileCount":5,"integrity":"sha512-KhuTkzR6smC4N/y0fUUk2HPv8WKTRuyF4r9Thy77aGQp6s+S1eRd2HkT2Yl8SdfNukWRTV2jgol0wjL1iQ/4jg==","signatures":[{"sig":"MEQCIGVNwofUC4+yGkaJLgmVpzQ46TcVbBrZgfF+rwdBr4fBAiBsV7PkSQlZYea8iYsxu4pMfoNsFU0LzqOzxe5RLS3w7A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":21150,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeQIdyCRA9TVsSAnZWagAAwBMP/2l/rp6ZdoBtjG20v5H+\nS0oscRZzCPD5Cf5JTABRa0PnqqrfYUZoVE/wxG04G09j28BDuJXr6bwjiSzd\n1JE87jExJIplC6m8oBx574Ga758djYa6WScRcFHHUAKkwOonMJPpvcrTrmiV\nmBghFpTMW6E6oRs8PmMZtsA+7cPrzBUDHXmV7/fOc317bg/MrwESuA0Yl47j\nqvyXVYEFm9xMCT6bq723TjdaQg3r76b4aUbNeYWDdPUghufwgES0ZrQd0Uti\nkXObkseSrP0P6lCuKidi73dokpEZYfUmY8yQ8kadhVISHCbzhOoy7EYq/D9M\n+gpkC8b82Zva2+GxnkjyWRMKlsNSEgdKhcyRndXs40wPC6gpCFcOYadWGdgt\nVgQ+xcQUDMNIh8QkDezRnxzTV3GHzKuDDP07QllTPZxoVKRsmyIq5a9DA0Fs\n9dh15gnuiZYzcBL9tizUOvfLohwsuAde35lQ7n5kUqLmvRLTQOqCahfzr98p\nEiuRiMi9Y49FLQ82yOslPtF0j/8sbM+kJA1Myd923BnRPjjowB6Oo6drCl09\n3rPbDJiD4XD2U7bFuSE23qNjwtmFabfZoFRDyjHbgd6Mq8TWHaSuCgiiIjv7\niuShCwW/q5mV9TXOpWFmD+M8rKXw14qXZXimTENRqi57Ax5HFikCa5DjWzQU\nTfKN\r\n=FvLM\r\n-----END PGP SIGNATURE-----\r\n","size":3292,"noattachment":false,"key":"/lilconfig/-/lilconfig-0.0.1.tgz"},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","gitHead":"c621b73298b1fa8e9ca929974c72735905c59733","scripts":{"test":"echo \"TODO: test for compatibility with cosmiconfig\" && exit 1","build":"npm run build:esm && npm run build:cjs","clean":"rm -rf ./dist","prebuild":"npm run clean","build:cjs":"tsc --declaration","build:esm":"tsc --module ESNext && mv ./dist/index.js ./dist/index.mjs","postbuild":"du -h ./dist/*"},"_npmUser":{"name":"antonk52","email":"halloy52@gmail.com"},"_npmVersion":"5.10.0","description":"A tiny replacement to cosmiconfig","directories":{},"_nodeVersion":"8.9.4","_hasShrinkwrap":false,"devDependencies":{"typescript":"^3.7.5","@types/node":"^13.7.0"},"_npmOperationalInternal":{"tmp":"tmp/lilconfig_0.0.1_1581287281685_0.7448696677178903","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":1581287281818,"_cnpm_publish_time":1581287281818,"dist-tags":{"latest":"3.1.5"}}