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

rollup-watch

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-watch - npm Package Compare versions

Comparing version 2.2.0 to 2.3.0

4

CHANGELOG.md
# rollup-watch changelog
## 2.3.0
* Handle `rename` events ([#4](https://github.com/rollup/rollup-watch/issues/4))
## 2.2.0

@@ -4,0 +8,0 @@

25

dist/rollup-watch.cjs.js

@@ -28,3 +28,3 @@ 'use strict';

var name = "rollup-watch";
var version = "2.2.0";
var version = "2.3.0";

@@ -47,9 +47,15 @@ function checkVersion ( name, localVersion ) {

var FileWatcher = function FileWatcher ( file, data, callback ) {
fs.watch( file, { encoding: 'utf-8', persistent: true }, function () {
// this is necessary because we get duplicate events...
var contents = fs.readFileSync( file, 'utf-8' );
if ( contents !== data ) {
data = contents;
var FileWatcher = function FileWatcher ( file, data, callback, dispose ) {
var fsWatcher = fs.watch( file, { encoding: 'utf-8', persistent: true }, function (event) {
if ( event === 'rename' ) {
fsWatcher.close();
dispose();
callback();
} else {
// this is necessary because we get duplicate events...
var contents = fs.readFileSync( file, 'utf-8' );
if ( contents !== data ) {
data = contents;
callback();
}
}

@@ -108,3 +114,6 @@ });

if ( !filewatchers.has( id ) ) {
var watcher = new FileWatcher( id, module.originalCode, triggerRebuild );
var watcher = new FileWatcher( id, module.originalCode, triggerRebuild, function () {
filewatchers.delete( id );
});
filewatchers.set( id, watcher );

@@ -111,0 +120,0 @@ }

@@ -24,3 +24,3 @@ import EventEmitter from 'events';

var name = "rollup-watch";
var version = "2.2.0";
var version = "2.3.0";

@@ -43,9 +43,15 @@ function checkVersion ( name, localVersion ) {

var FileWatcher = function FileWatcher ( file, data, callback ) {
fs.watch( file, { encoding: 'utf-8', persistent: true }, function () {
// this is necessary because we get duplicate events...
var contents = fs.readFileSync( file, 'utf-8' );
if ( contents !== data ) {
data = contents;
var FileWatcher = function FileWatcher ( file, data, callback, dispose ) {
var fsWatcher = fs.watch( file, { encoding: 'utf-8', persistent: true }, function (event) {
if ( event === 'rename' ) {
fsWatcher.close();
dispose();
callback();
} else {
// this is necessary because we get duplicate events...
var contents = fs.readFileSync( file, 'utf-8' );
if ( contents !== data ) {
data = contents;
callback();
}
}

@@ -104,3 +110,6 @@ });

if ( !filewatchers.has( id ) ) {
var watcher = new FileWatcher( id, module.originalCode, triggerRebuild );
var watcher = new FileWatcher( id, module.originalCode, triggerRebuild, function () {
filewatchers.delete( id );
});
filewatchers.set( id, watcher );

@@ -107,0 +116,0 @@ }

{
"name": "rollup-watch",
"version": "2.2.0",
"version": "2.3.0",
"description": "Watch files for changes and perform incremental rebuilds with Rollup",

@@ -5,0 +5,0 @@ "main": "dist/rollup-watch.cjs.js",

@@ -8,9 +8,15 @@ import EventEmitter from 'events';

class FileWatcher {
constructor ( file, data, callback ) {
fs.watch( file, { encoding: 'utf-8', persistent: true }, () => {
// this is necessary because we get duplicate events...
const contents = fs.readFileSync( file, 'utf-8' );
if ( contents !== data ) {
data = contents;
constructor ( file, data, callback, dispose ) {
const fsWatcher = fs.watch( file, { encoding: 'utf-8', persistent: true }, event => {
if ( event === 'rename' ) {
fsWatcher.close();
dispose();
callback();
} else {
// this is necessary because we get duplicate events...
const contents = fs.readFileSync( file, 'utf-8' );
if ( contents !== data ) {
data = contents;
callback();
}
}

@@ -70,3 +76,6 @@ });

if ( !filewatchers.has( id ) ) {
const watcher = new FileWatcher( id, module.originalCode, triggerRebuild );
const watcher = new FileWatcher( id, module.originalCode, triggerRebuild, () => {
filewatchers.delete( id );
});
filewatchers.set( id, watcher );

@@ -73,0 +82,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