cache-loader
cache-loader copied to clipboard
feat(compare-func): pass cacheData to the compare() function
Also added caching the source file.
This PR contains a:
- [ ] bugfix
- [X] new feature
- [ ] code refactor
- [X] test update
- [ ] typo fix
- [ ] metadata update
Motivation / Use-Case
I needed access to the cached data object as well as the cached source file to support certain cache conditions based on the source code.
Breaking Changes
None.
Codecov Report
Merging #98 into master will not change coverage. The diff coverage is
50.00%.
@@ Coverage Diff @@
## master #98 +/- ##
=======================================
Coverage 83.09% 83.09%
=======================================
Files 2 2
Lines 142 142
Branches 21 21
=======================================
Hits 118 118
Misses 24 24
| Impacted Files | Coverage Δ | |
|---|---|---|
| src/index.js | 82.97% <50.00%> (ø) |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update 4e0e3ae...d454d28. Read the comment docs.
need fix errors on CI
@evilebottnawi -- All set.
Sorry for delay, can you describe a case can when you need it?
Sorry for delay, can you describe a case can when you need it?
@evilebottnawi -- We use the https://github.com/afterwind-io/preprocessor-loader module which allows us to runs certain code blocks under given conditions. However, the cache-loader does not pick up these files that have these directives so we pass the files content to the compare function and check if they exist. If they do, we avoid caching.