Skip to content

Commit

Permalink
Cache option for searchers (#43)
Browse files Browse the repository at this point in the history
* run prettier in test file

* cache implementation

* test enabled cache option

* make sure cache is always populated

* update docs for cache options

* compare exporers shape completely

* restructure tests + cache off tests

* remove unused type annotation

* refactor to two loops for more efficient look up

* fix double cache check

* tests for no extension loader

* remove cache check in clear cache functions

* Revert "remove cache check in clear cache functions"

This reverts commit f2a4440.

* do not check for existence in visited set before adding

* checking for undefined is faster than looking up key in a map again

* use parentDir util instead of path.dirname

* lower branch test coverage threshhold to 98.9%
  • Loading branch information
antonk52 authored Nov 18, 2023
1 parent b056bd8 commit 6f815f4
Show file tree
Hide file tree
Showing 6 changed files with 741 additions and 201 deletions.
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = {
collectCoverageFrom: ['./src/index.ts'],
coverageThreshold: {
global: {
branches: 99,
branches: 98.9,
functions: 99,
lines: 99,
statements: 99,
Expand Down
6 changes: 2 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,13 @@ lilconfigSync(
```

## Difference to `cosmiconfig`
Lilconfig does not intend to be 100% compatible with `cosmiconfig` but tries to mimic it where possible. The key differences are:
- **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.
- **no** cache
Lilconfig 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.

### Options difference between the two.

|cosmiconfig option | lilconfig |
|------------------------|-----------|
|cache | |
|cache | |
|loaders ||
|ignoreEmptySearchPlaces ||
|packageProp ||
Expand Down
Loading

0 comments on commit 6f815f4

Please sign in to comment.