{"name":"lilconfig","version":"2.0.4","keywords":["cosmiconfig","config","configuration","search"],"author":{"name":"antonk52"},"license":"MIT","_id":"lilconfig@2.0.4","maintainers":[{"name":"antonk52","email":"halloy52@gmail.com"}],"homepage":"https://github.com/antonk52/lilconfig#readme","bugs":{"url":"https://github.com/antonk52/lilconfig/issues"},"dist":{"shasum":"f4507d043d7058b380b6a8f5cb7bcd4b34cee082","tarball":"http://registry-npm.ywwl.com/lilconfig/download/lilconfig-2.0.4.tgz","fileCount":4,"integrity":"sha512-bfTIN7lEsiooCocSISTWXkiWJkRqtL9wYtYy+8EK3Y41qh3mpwPU0ycTOgjdY9ErwXCc8QyrQp82bdL0Xkm9yA==","signatures":[{"sig":"MEUCIQDdAOXVoutMrziycisX6ZX4+O5qfpngRdbrapvNtglnZgIgf0x2f5V+1YO32c/y9t2CpRzJ++GcJxd2TIhMj28O+GQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":14779,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh2x6TCRA9TVsSAnZWagAAmZwQAJkKWZRC8vc6jMFizQwQ\nitXL9yNC0htOOC+ug05nMZq90JDnCQWb9uKDcN9XYYhWXA/ByBUyn1rNI5pD\n3DBFyctBk9Bc3zXE7TvFD2M3Cy9TUtZg+7dkfH6+4xPx6R6d7VooNewqsHJk\nToKKQ05D833w8jRFydnwUwNGB6ULF2djdYJbrp3XK5albsAw4IxAyGU9uDZ2\n+lYn9Cez3ewdJxCagNlBVL2l12niK785Zi959fQi7oNLkMIFl+YQRoflu6o4\nMFY+jFCpgtRjnISLlahbr67ghWmbvsuRDswmp4whf1zrlzEx7+U4hFVYdCfx\nb1Sm8ogPyAnRdv/D2liyRzodiCfqL9DsYQMakiwXYJvWIW+zif1+UAU5fjOj\n1zSK3rTNIj2b4MBdrn13HYa0GpSKp0erNps7j882eHKzaQY+FzrQTQQ5lp88\nHfJvvDshaeKxRedvbSTshcwukCM+ekQ44iD1K6wjvHJ2uOSCFGez92/0QetZ\nDn50DCBGA+qjGmwyUWMhR2KbvLkCO9Y2wRybkO2rqf4gqF4WTf+qJBNxJtRW\nkdEFXBO6YkcmDtQu/N/WHsaJq2TPMk3yMswA4YVhowOyXyNcgVD/sYZlF62A\nKSJfnBfhLV+Z/GScmdGVsIRN5D7e0S/+J25yaW32DwXQGeGYpO0uEkKPbqvj\nvg63\r\n=wsSn\r\n-----END PGP SIGNATURE-----\r\n","size":3629,"noattachment":false,"key":"/lilconfig/-/lilconfig-2.0.4.tgz"},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=10"},"gitHead":"bc992cdbbe5b90647042eb468516d5e79f7fa64c","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":"8.1.0","description":"A zero-dependency alternative to cosmiconfig","directories":{},"_nodeVersion":"16.13.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^27.3.1","eslint":"^8.1.0","ts-jest":"^27.0.7","prettier":"^2.4.1","typescript":"^4.4.4","@types/jest":"^27.0.2","@types/node":"^14.17.2","cosmiconfig":"^7.0.1","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0","@typescript-eslint/parser":"^5.3.0","@typescript-eslint/eslint-plugin":"^5.3.0"},"_npmOperationalInternal":{"tmp":"tmp/lilconfig_2.0.4_1636150403768_0.6897179146165116","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":1636150403887,"_cnpm_publish_time":1636150403887,"dist-tags":{"latest":"3.1.5"}}