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

Different watchFile and watchDirectory options through environment variable #21243

Merged
merged 30 commits into from
Mar 8, 2018
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
f6f4652
Fix the error callback of the present directory watcher
sheetalkamat Nov 20, 2017
ed5673c
Simplify and correct the fsWatchFile callback handling with the stats…
sheetalkamat Nov 21, 2017
ca52f08
Rearrange the code to have functions after executing code
sheetalkamat Nov 21, 2017
63a3a65
Use toLowercase as utility function
sheetalkamat Nov 21, 2017
7f32f9a
Rename and restructure non polling watch file
sheetalkamat Nov 21, 2017
c8e2b9c
Simplify check output errors
sheetalkamat Dec 14, 2017
cabb211
Create polling interval as non optional parameter
sheetalkamat Dec 16, 2017
aa5e49a
Update watchFile to take priority (which is currently polling interva…
sheetalkamat Dec 18, 2017
976f330
Watch based on dynamic polling priority frequency queue
sheetalkamat Dec 19, 2017
c3b9904
Add test to verify timeout queues
sheetalkamat Dec 23, 2017
09caaa3
Fix the api test failures
sheetalkamat Jan 16, 2018
fa8d4cb
Move the polling settings to sys instead of watch utilities
sheetalkamat Jan 16, 2018
bcfa02f
Add option to watch using fs.watch instead of watching through polling
sheetalkamat Jan 16, 2018
787c995
Allow recursive directory watching on non supported file system
sheetalkamat Jan 17, 2018
0c04fb1
Add support to test when watching directories through watchFile
sheetalkamat Nov 21, 2017
c3db9fa
Add tests for #19989, #20023
sheetalkamat Jan 17, 2018
ab17600
Improve test to verify the count of callbacks for the watched directo…
sheetalkamat Nov 30, 2017
f4954d0
Test case for watching using fs.watch recursively
sheetalkamat Nov 30, 2017
56d754c
Add watchDirectory to be using dynamic polling
sheetalkamat Jan 17, 2018
a74e54e
Merge branch 'master' into watchOptions
sheetalkamat Jan 22, 2018
4eba27b
Merge branch 'master' into watchOptions
sheetalkamat Jan 22, 2018
93c13ce
Merge branch 'master' into watchOptions
sheetalkamat Jan 25, 2018
95b2630
Add watchFile option to use fsEvents on parent directory
sheetalkamat Jan 25, 2018
ca4af4f
Merge branch 'master' into watchOptions
sheetalkamat Feb 5, 2018
b7f6910
Make the PollingInterval, PollingChunkSize, PollingUnchangedThreshold…
sheetalkamat Feb 5, 2018
c5b21d4
Fix the lint error
sheetalkamat Feb 6, 2018
9a160f2
Merge branch 'master' into watchOptions
sheetalkamat Feb 21, 2018
f1c879d
Merge branch 'master' into watchOptions
sheetalkamat Feb 23, 2018
ae8637c
Merge branch 'master' into watchOptions
sheetalkamat Mar 3, 2018
8378f69
Directly assign values for watchFile and watchDirectory in node System
sheetalkamat Mar 8, 2018
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
20 changes: 1 addition & 19 deletions src/compiler/commandLineParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2021,7 +2021,7 @@ namespace ts {
export function getFileNamesFromConfigSpecs(spec: ConfigFileSpecs, basePath: string, options: CompilerOptions, host: ParseConfigHost, extraFileExtensions: ReadonlyArray<JsFileExtensionInfo> = []): ExpandResult {
basePath = normalizePath(basePath);

const keyMapper = host.useCaseSensitiveFileNames ? caseSensitiveKeyMapper : caseInsensitiveKeyMapper;
const keyMapper = host.useCaseSensitiveFileNames ? identity : toLowerCase;

// Literal file names (provided via the "files" array in tsconfig.json) are stored in a
// file map with a possibly case insensitive key. We use this map later when when including
Expand Down Expand Up @@ -2225,24 +2225,6 @@ namespace ts {
}
}

/**
* Gets a case sensitive key.
*
* @param key The original key.
*/
function caseSensitiveKeyMapper(key: string) {
return key;
}

/**
* Gets a case insensitive key.
*
* @param key The original key.
*/
function caseInsensitiveKeyMapper(key: string) {
return key.toLowerCase();
}

/**
* Produces a cleaned version of compiler options with personally identifiying info (aka, paths) removed.
* Also converts enum values back to strings.
Expand Down
36 changes: 36 additions & 0 deletions src/compiler/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ namespace ts {
/* @internal */
namespace ts {
export const emptyArray: never[] = [] as never[];
export function closeFileWatcher(watcher: FileWatcher) {
watcher.close();
}

/** Create a MapLike with good performance. */
function createDictionaryObject<T>(): MapLike<T> {
const map = Object.create(/*prototype*/ null); // tslint:disable-line:no-null-keyword
Expand Down Expand Up @@ -3143,4 +3147,36 @@ namespace ts {
export function singleElementArray<T>(t: T | undefined): T[] | undefined {
return t === undefined ? undefined : [t];
}

export function enumerateInsertsAndDeletes<T, U>(newItems: ReadonlyArray<T>, oldItems: ReadonlyArray<U>, comparer: (a: T, b: U) => Comparison, inserted: (newItem: T) => void, deleted: (oldItem: U) => void, unchanged?: (oldItem: U, newItem: T) => void) {
unchanged = unchanged || noop;
let newIndex = 0;
let oldIndex = 0;
const newLen = newItems.length;
const oldLen = oldItems.length;
while (newIndex < newLen && oldIndex < oldLen) {
const newItem = newItems[newIndex];
const oldItem = oldItems[oldIndex];
const compareResult = comparer(newItem, oldItem);
if (compareResult === Comparison.LessThan) {
inserted(newItem);
newIndex++;
}
else if (compareResult === Comparison.GreaterThan) {
deleted(oldItem);
oldIndex++;
}
else {
unchanged(oldItem, newItem);
newIndex++;
oldIndex++;
}
}
while (newIndex < newLen) {
inserted(newItems[newIndex++]);
}
while (oldIndex < oldLen) {
deleted(oldItems[oldIndex++]);
}
}
}
Loading