{"name":"lilconfig","version":"0.0.2","keywords":["cosmiconfig","config","search"],"author":{"name":"antonk52"},"license":"MIT","_id":"lilconfig@0.0.2","maintainers":[{"name":"antonk52","email":"halloy52@gmail.com"}],"dist":{"shasum":"68416ac78ba77b82177fe249e260e9e65cf8ea27","tarball":"http://registry-npm.ywwl.com/lilconfig/download/lilconfig-0.0.2.tgz","fileCount":4,"integrity":"sha512-DFSBrbylZQWHNOAL2CPUEme1J+rBnaOzxn6/amsafAup1u3bm6qDjonH7kR74Q3oKfSWaV3Or9pP/qmjop3VIg==","signatures":[{"sig":"MEQCIDtV3Byra59UWM7+mQc29n/PjhWPZ66eJ4gLHcRUkjMCAiAl/qFSTT23wV30+4Z3NjS5xyciZGKy+6OEBwU0eJCrVw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":13190,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe3qsvCRA9TVsSAnZWagAAnB0P/2kL22JZS+124PbWk4cd\n0oH51fLCxXXWSBoTqeYbcRgHFZfeRKSoEHEUXz+bIzCCO9VUfq8X3R2jKxLK\nRSethKb0s0Mvbu6eFqJP0E39LhIGAlmcRsVbaCcWE1vuphPlUF2uFYZvdxvU\nPaQLisTqEMlUxe7U3hpefE91Q/GPQeKPY3Cw1L2Pu6Xg/makjwhNei8uuw7/\nYhMC+DCfZCvoCszhAJ+XdO1QhQDnxmHIfv8hh9hN3YOJpPWZVeyBIm4LGTnM\n8MjbaTF8XCHnZ5fnbFJPErXT989Ce20bM8nLiWq7JITS07U1nhO1U4aQkna1\nd35rJSgXyV5pdV2WJSZ82IR6N5/lbEsLkcMBIF6c0ZYRb0RSnVwBTNSVRZgS\nykJLXlS3DsKgBcr6zFXLiv+C0RI7NQYWgLijAgOdfgVHylkANBjkHBkWQNnd\n1nCtDdxk7DZ5izkBZ60SIC0UWDfe2VnG71KfoPgvkbUcl5asOPhYerAo3RqN\nhNaOMHC1FsIJy65S9THxAmrkxemXxsZO8g52lkIiurcdY4a3EsCTaZKhA5PY\nWlS+fANIieVRWl0c4t4/X2e8+iul7nWpIMwSugijauYqux5KqJF8cSrRwL9U\n/GVYdkbbc3nGe7K2asZT+UALLE/6I+b8y+xx8dBvWBvDFQRcxOc62UQAMUry\nrioI\r\n=zpr5\r\n-----END PGP SIGNATURE-----\r\n","size":3225,"noattachment":false,"key":"/lilconfig/-/lilconfig-0.0.2.tgz"},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","engines":{"node":">=8"},"gitHead":"9efb4f043c83e2e3bed5c496e6c60100820bcea7","scripts":{"lint":"eslint ./src/*.ts","test":"echo \"TODO: test for compatibility with cosmiconfig\" && exit 1","build":"tsc --declaration","clean":"rm -rf ./dist","prebuild":"npm run clean","postbuild":"du -h ./dist/*"},"_npmUser":{"name":"antonk52","email":"halloy52@gmail.com"},"_npmVersion":"6.14.5","description":"A tiny replacement to cosmiconfig","directories":{},"_nodeVersion":"12.16.1","_hasShrinkwrap":false,"devDependencies":{"eslint":"^6.8.0","prettier":"^1.19.1","typescript":"^3.7.5","@types/node":"^13.7.0","eslint-config-prettier":"^6.10.0","eslint-plugin-prettier":"^3.1.2","@typescript-eslint/parser":"^2.19.0","@typescript-eslint/eslint-plugin":"^2.19.0"},"_npmOperationalInternal":{"tmp":"tmp/lilconfig_0.0.2_1591651119319_0.6930006854885491","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":1591651119442,"_cnpm_publish_time":1591651119442,"dist-tags":{"latest":"3.1.5"}}