{"name":"lilconfig","version":"2.0.0","keywords":["cosmiconfig","config","configuration","search"],"author":{"name":"antonk52"},"license":"MIT","_id":"lilconfig@2.0.0","maintainers":[{"name":"antonk52","email":"halloy52@gmail.com"}],"dist":{"shasum":"5997d88feebb5f51c0f9aae164f722a14dee66d1","tarball":"http://registry-npm.ywwl.com/lilconfig/download/lilconfig-2.0.0.tgz","fileCount":4,"integrity":"sha512-g6HsB8qzh6yAsixO31LTdcSua3D6kbvEy3ql18MKovNDp4YF9bss/4LLXUqGHH1DEnx4U8ZSF8Ssr5ujRIBZjg==","signatures":[{"sig":"MEUCIQC85fI3+GTpPN+T0af1QKRwGkKNWDWGPxqHTw0N4o75DgIgeP/xnwl2oiY6ltl1VBBTRVp+sz9Sf4RStGjW3+cf2v4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":14400,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfZ2lTCRA9TVsSAnZWagAAWzIP/i424UQijjom39DnDJAR\n+2ME+oHNaqCD+v8uZsfh/BZUJrGDEQyUkB4Jx8WvrocErCtqx2MOXlfpYQNp\nsyReXO4+kEB+SnYGDr+OAv/TIjwgO7ASWDWC75FdxoS8sPY7/jshES8jeLhi\n9HxXZ+4C6PUNMlCLfLgzoX8vm+E5XYOMvkgrcVfxWkgI2zoXsSqG5iMC63IZ\ntjYQ27Nz9o53v5YJTLV0y4Qbobs2N7jDvXen0vw8bFdB2Vr04Xc/s70yrA/l\nMaCSPSs8im3vk51oirXDpS+K4kmjbLNmD1e4uNMKlSPWkngEWhg7ajTW13Hw\ng80gnE86z/5Z83fbKjorJ8tmAvAPrHdJq95FYWYbgdx1atummWzYqqK9FqP+\nicxeevJHbzQJ2ZIeLxF7kabzDshk6X/zOZYsynzchQsmaj8GQn4Hsy2lwNaW\nNR80U4TnSDiZp7DMeLIa3JMZ9c4+JVJa9Exzi2Uke8T0TYTVe3Nw+yDYCV8C\n48yGl0fIO/EnYtTg+Wh4ZmlC8Vlw5XAM5aNx600c2gzh2HnVHo5V5xrodJ50\nVQIGfV8zkCWAW1XpWt77hlauUJbrU+iLmT7wP13mkmgcPITrh6vTZWVH+t6R\nDdvR3lmmpuSAVt0ypn01d2iQvxEi3m6+xqueyxULRwZqsabRzdZ/WySQ3Bec\neYD+\r\n=P4K1\r\n-----END PGP SIGNATURE-----\r\n","size":3588,"noattachment":false,"key":"/lilconfig/-/lilconfig-2.0.0.tgz"},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=10"},"gitHead":"579aa4f6769eca199b04a3276589832fb34b309a","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"},"_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.0_1600612691189_0.2101924541090625","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":1600612691360,"_cnpm_publish_time":1600612691360,"dist-tags":{"latest":"3.1.5"}}