Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
8d543bd1
Commit
8d543bd1
authored
Dec 31, 2016
by
Naoyuki Kanezawa
Committed by
Guillermo Rauch
Dec 31, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove the monkeypatch of watchpack (#580)
parent
629051db
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
69 deletions
+2
-69
watch-remove-event-plugin.js
server/build/plugins/watch-remove-event-plugin.js
+2
-69
No files found.
server/build/plugins/watch-remove-event-plugin.js
View file @
8d543bd1
...
...
@@ -23,77 +23,10 @@ export default class WatchRemoveEventPlugin {
},
callbackUndelayed
)
const
watchpack
=
watchFileSystem
.
watcher
watchpack
.
fileWatchers
.
forEach
((
w
)
=>
{
w
.
on
(
'remove'
,
this
.
onRemove
.
bind
(
this
,
watchpack
,
w
.
path
)
)
watchpack
.
on
(
'remove'
,
(
file
)
=>
{
this
.
removedFiles
.
push
(
file
)
})
return
result
}
}
onRemove
(
watchpack
,
file
)
{
this
.
removedFiles
.
push
(
file
)
watchpack
.
emit
(
'remove'
,
file
)
watchpack
.
_onChange
(
file
)
}
}
// monkeypatching watchpack module to fix
// https://github.com/webpack/watchpack/pull/33
let
DirectoryWatcher
try
{
DirectoryWatcher
=
require
(
'webpack/node_modules/watchpack/lib/DirectoryWatcher'
)
}
catch
(
err
)
{
DirectoryWatcher
=
require
(
'watchpack/lib/DirectoryWatcher'
)
}
/* eslint-disable */
var
FS_ACCURENCY
=
10000
;
function
withoutCase
(
str
)
{
return
str
.
toLowerCase
();
}
DirectoryWatcher
.
prototype
.
setFileTime
=
function
setFileTime
(
filePath
,
mtime
,
initial
,
type
)
{
var
now
=
Date
.
now
();
var
old
=
this
.
files
[
filePath
];
this
.
files
[
filePath
]
=
[
initial
?
Math
.
min
(
now
,
mtime
)
:
now
,
mtime
];
// we add the fs accurency to reach the maximum possible mtime
if
(
mtime
)
mtime
=
mtime
+
FS_ACCURENCY
;
if
(
!
old
)
{
if
(
mtime
)
{
if
(
this
.
watchers
[
withoutCase
(
filePath
)])
{
this
.
watchers
[
withoutCase
(
filePath
)].
forEach
(
function
(
w
)
{
if
(
!
initial
||
w
.
checkStartTime
(
mtime
,
initial
))
{
w
.
emit
(
"change"
,
mtime
);
}
});
}
}
}
else
if
(
!
initial
&&
mtime
&&
type
!==
"add"
)
{
if
(
this
.
watchers
[
withoutCase
(
filePath
)])
{
this
.
watchers
[
withoutCase
(
filePath
)].
forEach
(
function
(
w
)
{
w
.
emit
(
"change"
,
mtime
);
});
}
}
else
if
(
!
initial
&&
!
mtime
)
{
delete
this
.
files
[
filePath
];
if
(
this
.
watchers
[
withoutCase
(
filePath
)])
{
this
.
watchers
[
withoutCase
(
filePath
)].
forEach
(
function
(
w
)
{
w
.
emit
(
"remove"
);
});
}
}
if
(
this
.
watchers
[
withoutCase
(
this
.
path
)])
{
this
.
watchers
[
withoutCase
(
this
.
path
)].
forEach
(
function
(
w
)
{
if
(
!
initial
||
w
.
checkStartTime
(
mtime
,
initial
))
{
w
.
emit
(
"change"
,
filePath
,
mtime
);
}
});
}
};
/* eslint-enable */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment