Skip to content

Commit 3cb3cf7

Browse files
committed
purge only changed files, longer caching
1 parent 209f96c commit 3cb3cf7

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

lib/node/NodeEnvironmentPlugin.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,15 @@ function NodeEnvironmentPlugin() {
1212
module.exports = NodeEnvironmentPlugin;
1313
NodeEnvironmentPlugin.prototype.apply = function(compiler) {
1414
compiler.inputFileSystem = new NodeJsInputFileSystem();
15-
compiler.inputFileSystem = new CachedInputFileSystem(compiler.inputFileSystem, 6000);
15+
var inputFileSystem = compiler.inputFileSystem = new CachedInputFileSystem(compiler.inputFileSystem, 60000);
1616
compiler.resolvers.normal.fileSystem = compiler.inputFileSystem;
1717
compiler.resolvers.context.fileSystem = compiler.inputFileSystem;
1818
compiler.resolvers.loader.fileSystem = compiler.inputFileSystem;
1919
compiler.outputFileSystem = new NodeOutputFileSystem();
2020
compiler.watchFileSystem = new NodeWatchFileSystem(compiler.inputFileSystem);
21+
compiler.plugin("run", function(compiler, callback) {
22+
if(compiler.inputFileSystem === inputFileSystem)
23+
inputFileSystem.purge();
24+
callback();
25+
});
2126
};

lib/node/NodeWatchFileSystem.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,13 @@ NodeWatchFileSystem.prototype.watch = function(files, dirs, startTime, delay, ca
201201
function onTimeout() {
202202
change = function() {};
203203
if(closed) return;
204-
if(inputFileSystem && inputFileSystem.purge) inputFileSystem.purge();
205-
callback(null, Object.keys(filesModified).sort(), Object.keys(dirsModified).sort(), fileTimestamps, dirTimestamps);
204+
var outdatedFiles = Object.keys(filesModified).sort();
205+
var outdatedDirs = Object.keys(dirsModified).sort();
206+
if(inputFileSystem && inputFileSystem.purge) {
207+
inputFileSystem.purge(outdatedFiles);
208+
inputFileSystem.purge(outdatedDirs);
209+
}
210+
callback(null, outdatedFiles, outdatedDirs, fileTimestamps, dirTimestamps);
206211

207212
close();
208213
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "webpack",
3-
"version": "0.10.0-beta11",
3+
"version": "0.10.0-beta12",
44
"author": "Tobias Koppers @sokra",
55
"description": "Packs CommonJs/AMD/Labeled Modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jade, coffee, css, less, ... and your custom stuff.",
66
"dependencies": {

0 commit comments

Comments
 (0)