Registry / devops / loader-fs-cache

loader-fs-cache

JSON →
library1.0.3jsnpmunverified

A filesystem cache helper extracted from babel-loader's fs-cache module. Version 1.0.3 is the latest and only release. This package provides a simple promisified file system cache that stores compiled results on disk, checking timestamps and content hashes to invalidate stale entries. It is a standalone extraction from the babel-loader source. Not recommended for direct use; prefer babel-loader or other caching solutions like webpack's persistent cache.

npm install loader-fs-cache
INSTALL
IMPORT
SIG · LOADER-FS-CACHE
L
loader-fs-cache
devopsjavascriptv1.0.3
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import cache from 'loader-fs-cache'
const cache = require('loader-fs-cache');
Package only provides a default export.
cache
import cache from 'loader-fs-cache'
import { cache } from 'loader-fs-cache';
Named import does not exist; only default.
type
type Cache = typeof import('loader-fs-cache')
import type Cache from 'loader-fs-cache';
No explicit type exports; use typeof.

Demonstrates basic usage: import, find cache directory, set up cache options, and check for cache hit/miss.

import cache from 'loader-fs-cache'; import findCacheDir from 'find-cache-dir'; import { join } from 'path'; const cacheDir = findCacheDir({ name: 'my-repo' }) ?? '.'; const src = 'const x = 1;'; const options = { directory: cacheDir, identifier: 'babel', config: { presets: ['@babel/preset-env'] }, }; cache(options).then((result) => { if (result && result.src === src) { console.log('Cache hit'); } else { console.log('Cache miss'); } });
Debug
Known issues
deprecatedThis package is no longer maintained. It was extracted from babel-loader and has been superseded by babel-loader's own caching or other solutions.
fix
Use babel-loader's built-in cache or implement your own caching with find-cache-dir and fs.
affects: >=0.0.0
gotchaThe cache key is generated from `identifier` and `config` but not from source hash. If source changes without different identifier/config, old cache may be returned.
fix
Ensure you include a hash of the source in the identifier or config to guarantee invalidation.
affects: >=1.0.0
gotchaThe package relies on `find-cache-dir` which may return `undefined` if no package root is found, causing errors.
fix
Provide a fallback directory when using `findCacheDir`.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'find-cache-dir'
Missing peer dependency `find-cache-dir`.
fix
npm install find-cache-dir
TypeError: cache(...) is not a function
Using named import instead of default import.
fix
Use `import cache from 'loader-fs-cache'` instead of `import { cache } from 'loader-fs-cache'`.
Upgrade
Version history
1.0.3latest on npm
Audit
Dependencies
find-cache-dirrequiredDetermines cache directory path based on package root
mkdirprequiredRecursively creates cache directories
promisify-callrequiredConverts callback-based file operations to promises
Agent activity
2 hits · last 30 days
node
2
Resources
loader-fs-cache — npm install loader-fs-cache · libregistry