Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hot-file-cache

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hot-file-cache - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

7

CHANGELOG.md

@@ -0,1 +1,8 @@

## 0.0.5
- BREAKING CHANGE: `getFiles` returns absolute paths
- `readFile` throws if pattern does not match
- `fileExists` throws if pattern does not match
- add `isFileWatched`
## 0.0.4

@@ -2,0 +9,0 @@

23

index.js

@@ -29,3 +29,3 @@ var path = require('path');

watcher.on('add', function (file) {
this.watched.push(file);
this.watched.push(path.join(this.options.cwd, file));
}.bind(this));

@@ -51,6 +51,7 @@ watcher.on('unlink', function (file) {

HotFileCache.prototype.fileExists = function (file) {
var relativeFile = path.relative(this.options.cwd, file);
return this.watcher.then(function (watcher) {
var files = watcher.getWatched();
return files[path.dirname(relativeFile) || '.'].indexOf(path.basename(relativeFile)) !== -1;
if (!this.isFileWatched(file)) {
throw new Error('File ' + file + ' does not match any pattern');
}
return this.getFiles().then(function (files) {
return files.indexOf(file) !== -1;
});

@@ -74,4 +75,4 @@ };

var relativeFile = path.relative(this.options.cwd, file);
if (!globule.isMatch(this.patterns, relativeFile)) {
return Promise.reject('File ' + file + ' does not match any pattern');
if (!this.isFileWatched(file)) {
throw new Error('File ' + file + ' does not match any pattern');
}

@@ -96,2 +97,10 @@ return this.watcher.then(function () {

/**
* Returns true if the given file matches the current patterns.
*/
HotFileCache.prototype.isFileWatched = function (file) {
var relativeFile = path.relative(this.options.cwd, file);
return globule.isMatch(this.patterns, relativeFile);
};
/**
* invalidate cache

@@ -98,0 +107,0 @@ */

{
"name": "hot-file-cache",
"version": "0.0.4",
"version": "0.0.5",
"description": "A file cache for development which will invalidate automatically if the source changes",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -42,3 +42,7 @@ Hot File Cache

Options:
All options except the `fileProcessor` are equal to [chokidar](https://github.com/paulmillr/chokidar#getting-started).
# Changelog

@@ -45,0 +49,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc