purge only changed files, longer caching

This commit is contained in:
Tobias Koppers 2013-05-13 14:25:37 +02:00
parent 209f96c543
commit 3cb3cf7285
3 changed files with 14 additions and 4 deletions

View File

@ -12,10 +12,15 @@ function NodeEnvironmentPlugin() {
module.exports = NodeEnvironmentPlugin;
NodeEnvironmentPlugin.prototype.apply = function(compiler) {
compiler.inputFileSystem = new NodeJsInputFileSystem();
compiler.inputFileSystem = new CachedInputFileSystem(compiler.inputFileSystem, 6000);
var inputFileSystem = compiler.inputFileSystem = new CachedInputFileSystem(compiler.inputFileSystem, 60000);
compiler.resolvers.normal.fileSystem = compiler.inputFileSystem;
compiler.resolvers.context.fileSystem = compiler.inputFileSystem;
compiler.resolvers.loader.fileSystem = compiler.inputFileSystem;
compiler.outputFileSystem = new NodeOutputFileSystem();
compiler.watchFileSystem = new NodeWatchFileSystem(compiler.inputFileSystem);
compiler.plugin("run", function(compiler, callback) {
if(compiler.inputFileSystem === inputFileSystem)
inputFileSystem.purge();
callback();
});
};

View File

@ -201,8 +201,13 @@ NodeWatchFileSystem.prototype.watch = function(files, dirs, startTime, delay, ca
function onTimeout() {
change = function() {};
if(closed) return;
if(inputFileSystem && inputFileSystem.purge) inputFileSystem.purge();
callback(null, Object.keys(filesModified).sort(), Object.keys(dirsModified).sort(), fileTimestamps, dirTimestamps);
var outdatedFiles = Object.keys(filesModified).sort();
var outdatedDirs = Object.keys(dirsModified).sort();
if(inputFileSystem && inputFileSystem.purge) {
inputFileSystem.purge(outdatedFiles);
inputFileSystem.purge(outdatedDirs);
}
callback(null, outdatedFiles, outdatedDirs, fileTimestamps, dirTimestamps);
close();
}

View File

@ -1,6 +1,6 @@
{
"name": "webpack",
"version": "0.10.0-beta11",
"version": "0.10.0-beta12",
"author": "Tobias Koppers @sokra",
"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.",
"dependencies": {