{"id":20192,"library":"loader-fs-cache","title":"loader-fs-cache","description":"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.","status":"deprecated","version":"1.0.3","language":"javascript","source_language":"en","source_url":"https://github.com/viankakrisna/loader-fs-cache","tags":["javascript"],"install":[{"cmd":"npm install loader-fs-cache","lang":"bash","label":"npm"},{"cmd":"yarn add loader-fs-cache","lang":"bash","label":"yarn"},{"cmd":"pnpm add loader-fs-cache","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Determines cache directory path based on package root","package":"find-cache-dir","optional":false},{"reason":"Recursively creates cache directories","package":"mkdirp","optional":false},{"reason":"Converts callback-based file operations to promises","package":"promisify-call","optional":false}],"imports":[{"note":"Package only provides a default export.","wrong":"const cache = require('loader-fs-cache');","symbol":"default","correct":"import cache from 'loader-fs-cache'"},{"note":"Named import does not exist; only default.","wrong":"import { cache } from 'loader-fs-cache';","symbol":"cache","correct":"import cache from 'loader-fs-cache'"},{"note":"No explicit type exports; use typeof.","wrong":"import type Cache from 'loader-fs-cache';","symbol":"type","correct":"type Cache = typeof import('loader-fs-cache')"}],"quickstart":{"code":"import cache from 'loader-fs-cache';\nimport findCacheDir from 'find-cache-dir';\nimport { join } from 'path';\n\nconst cacheDir = findCacheDir({ name: 'my-repo' }) ?? '.';\n\nconst src = 'const x = 1;';\nconst options = {\n  directory: cacheDir,\n  identifier: 'babel',\n  config: { presets: ['@babel/preset-env'] },\n};\n\ncache(options).then((result) => {\n  if (result && result.src === src) {\n    console.log('Cache hit');\n  } else {\n    console.log('Cache miss');\n  }\n});","lang":"typescript","description":"Demonstrates basic usage: import, find cache directory, set up cache options, and check for cache hit/miss."},"warnings":[{"fix":"Use babel-loader's built-in cache or implement your own caching with find-cache-dir and fs.","message":"This package is no longer maintained. It was extracted from babel-loader and has been superseded by babel-loader's own caching or other solutions.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"Ensure you include a hash of the source in the identifier or config to guarantee invalidation.","message":"The 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.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Provide a fallback directory when using `findCacheDir`.","message":"The package relies on `find-cache-dir` which may return `undefined` if no package root is found, causing errors.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.0.3':20 'babel':12,59,69 'babel-load':11,58,68 'cach':4,7,17,35,73,79 'check':42 'compil':38 'content':45 'direct':65 'disk':41 'entri':50 'extract':9,55 'file':33 'filesystem':6 'fs':3,16 'fs-cach':15 'hash':46 'helper':8 'invalid':48 'javascript':80 'latest':23 'like':75 'loader':2,13,60,70 'loader-fs-cach':1 'modul':18 'packag':28 'persist':78 'prefer':67 'promisifi':32 'provid':29 'recommend':63 'releas':26 'result':39 'simpl':31 'solut':74 'sourc':61 'stale':49 'standalon':54 'store':37 'system':34 'timestamp':43 'use':66 'version':19 'webpack':76","created_at":"2026-04-25T11:21:48.116228+00:00","updated_at":"2026-04-25T11:21:48.116228+00:00","problems":[{"fix":"npm install find-cache-dir","cause":"Missing peer dependency `find-cache-dir`.","error":"Cannot find module 'find-cache-dir'"},{"fix":"Use `import cache from 'loader-fs-cache'` instead of `import { cache } from 'loader-fs-cache'`.","cause":"Using named import instead of default import.","error":"TypeError: cache(...) is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/viankakrisna/loader-fs-cache","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/loader-fs-cache","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops","serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-24","install_tag":null}}