Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Track timestamps to filter changed files. #500

Merged
merged 2 commits into from
Mar 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ export interface WebpackNodeWatchFileSystem {

export interface WebpackWatching {
compiler: WebpackCompiler; // a guess
startTime: number;
}

export interface Resolve {
Expand Down
13 changes: 10 additions & 3 deletions src/watch-run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,23 @@ import constants = require('./constants');
function makeWatchRun(
instance: interfaces.TSInstance
) {
const lastTimes = {};
let startTime : number = null;
return (watching: interfaces.WebpackWatching, cb: () => void) => {
const watcher = watching.compiler.watchFileSystem.watcher ||
watching.compiler.watchFileSystem.wfs.watcher;
if (null === instance.modifiedFiles) {
instance.modifiedFiles = {};
}

Object.keys(watcher.getTimes())
.filter(filePath => !!filePath.match(constants.tsTsxJsJsxRegex))
startTime = startTime || watching.startTime;
const times = watcher.getTimes();
Object.keys(times)
.filter(filePath =>
times[filePath] > (lastTimes[filePath] || startTime)
&& !!filePath.match(constants.tsTsxJsJsxRegex)
)
.forEach(filePath => {
lastTimes[filePath] = times[filePath];
filePath = path.normalize(filePath);
const file = instance.files[filePath];
if (file) {
Expand Down

This file was deleted.

This file was deleted.

81 changes: 0 additions & 81 deletions test/comparison-tests/issue441/expectedOutput-2.2/patch0/bundle.js

This file was deleted.

This file was deleted.