{"name":"lilconfig","version":"2.0.1","keywords":["cosmiconfig","config","configuration","search"],"author":{"name":"antonk52"},"license":"MIT","_id":"lilconfig@2.0.1","maintainers":[{"name":"antonk52","email":"halloy52@gmail.com"}],"homepage":"https://github.com/antonk52/lilconfig#readme","bugs":{"url":"https://github.com/antonk52/lilconfig/issues"},"dist":{"shasum":"24353e5eadfbd7fcf314bad46714161e4e085ebf","tarball":"http://registry-npm.ywwl.com/lilconfig/download/lilconfig-2.0.1.tgz","fileCount":4,"integrity":"sha512-fFzm+Lj/Up8OGJfygxz1VLVuihcqZQpqFMmQ3yklVwUIA8Z6LWBwiISObInLg8R8g9E9r7b9t2+kh8+N7vRS+g==","signatures":[{"sig":"MEMCIFwItPLeMMwlOVhLdQzBj3P96zO+qEDyujfMK/OS7Fl6Ah86GZrUeulr/WW9lOk3LOVSjHGOfwS4uVqxN7tr1XmP","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":14565,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfkfY9CRA9TVsSAnZWagAAZMYQAJaSLUc8v41TMyZsWz8E\nFaN7IZ7+DEDWJhAAjV9KaexvfDZLYHLz3LjnX+m+yAYdvYFxzzN3DOhy/0m7\ngVexD3XCtzIpm5GD20ROWQ8HkEfNGoKE4n9AmZaWaB7wkALVcnAUHw71fub5\nRTA/D2rZ8ItBp848naFpRRQHhIUBegi+At5eh8NSU32fR0sdNSfZOWkSMuGW\nBAcI7p2sjfjazvj65EGPW68MdaPD6essUYrDbg+mH1yb99HyEMBdpVMrlaF1\nprCyAg3jMNlL1MKAhpx0wvT0H6nsIexPXtbRoWJzvDAG8bYdfzqC2wPHgSlp\nfM2UvSScWttGwx3S6VBli8LKlaLKg70wfyE5EJFhQS1NG60b1weD++5bMZhV\nuN4+xAQtmpIlDUfzF33PZsi7doiDBJ72hnZZ0QwewCqeLJcxu5MM5M/0DqF6\nER57j4swYispTp1zMWdKmvTthFfy/vI854kj7DRiH+zq24bBBafi1tJObSTi\nV9nDP4MHErSOmLZWxDFctawdCkh3EZ2fddNGD3xHetLAq/Uf3DhWGMF4VWxz\nCM9v4uBMFBminuta/Xj7GS29oFHwIZrInth1wPeX4bXOYLW3VEwsm1TJMYZS\nmL0knonWuyJDIiL4cQG72maQ0K3IsMn/2KXDJYDScdetBBL4Nwufub9Bzzn4\nz8pD\r\n=Ev6k\r\n-----END PGP SIGNATURE-----\r\n","size":3630,"noattachment":false,"key":"/lilconfig/-/lilconfig-2.0.1.tgz"},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=10"},"gitHead":"f60c4ed88b887470fcecc27375340891b6bde7ad","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":"6.14.5","description":"A zero-dependency alternative to cosmiconfig","directories":{},"_nodeVersion":"12.16.1","_hasShrinkwrap":false,"devDependencies":{"jest":"^26.4.2","eslint":"^7.9.0","ts-jest":"^26.3.0","prettier":"^2.1.1","typescript":"^4.0.2","@types/jest":"^26.0.13","@types/node":"^14.10.1","cosmiconfig":"7.0.0","eslint-config-prettier":"^6.11.0","eslint-plugin-prettier":"^3.1.4","@typescript-eslint/parser":"^4.1.0","@typescript-eslint/eslint-plugin":"^4.1.0"},"_npmOperationalInternal":{"tmp":"tmp/lilconfig_2.0.1_1603401277172_0.964657425239152","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":1603401277286,"_cnpm_publish_time":1603401277286,"dist-tags":{"latest":"3.1.5"}}