55 Commits

Author SHA1 Message Date
Andy
e53e56cf82
Enable '--strictNullChecks' (#22088)
* Enable '--strictNullChecks'

* Fix API baselines

* Make sys.getEnvironmentVariable non-nullable

* make properties optional instead of using `| undefined` in thier type

* reportDiagnostics should be required

* Declare firstAccessor as non-nullable

* Make `some` a type guard

* Fix `getEnvironmentVariable` definition in tests

* Pretend transformFlags are always defined

* Fix one more use of sys.getEnvironmentVariable

* `requiredResponse` accepts undefined, remove assertions

* Mark optional properties as optional instead of using `| undefined`

* Mark optional properties as optional instead of using ` | undefined`

* Remove unnecessary null assertions

* Put the bang on the declaration instead of every use

* Make `createMapFromTemplate` require a parameter

* Mark `EmitResult.emittedFiles` and `EmitResult.sourceMaps` as optional

* Plumb through undefined in emitLsit and EmitExpressionList

* `ElementAccessExpression.argumentExpression` can not be `undefined`

* Add overloads for `writeTokenText`

* Make `shouldWriteSeparatingLineTerminator` argument non-nullable

* Make `synthesizedNodeStartsOnNewLine` argument required

* `PropertyAssignment.initializer` cannot be undefined

* Use one `!` at declaration site instead of on every use site

* Capture host in a constant and avoid null assertions

* Remove few more unused assertions

* Update baselines

* Use parameter defaults

* Update baselines

* Fix lint

* Make Symbol#valueDeclaration and Symbol#declarations non-optional to reduce assertions

* Make Node#symbol and Type#symbol non-optional to reduce assertions

* Make `flags` non-nullable to reduce assertions

* Convert some asserts to type guards

* Make `isNonLocalAlias` a type guard

* Add overload for `getSymbolOfNode` for `Declaration`

* Some more `getSymbolOfNode` changes

* Push undefined suppression into `typeToTypeNodeHelper`

* `NodeBuilderContext.tracker` is never `undefined`

* use `Debug.assertDefined`

* Remove unnecessary tag

* Mark `LiteralType.freshType` and `LiteralTupe.regularType` as required
2018-05-22 14:46:57 -07:00
Andy
4c22bf786e
getEditsForFileRename: Do fresh module resolution instead of relying on cache (#24211)
* getEditsForFileRename: Do fresh module resolution instead of relying on cache

* Add host.resolveModuleNameWithFailedLookupLocations method

* Make host.resolveModuleNameWithFailedLookupLocations mandatory, and implement for Project

* Add test, and no need to check host.fileExists

* Change method name and always use cache

* Update name in string
2018-05-18 16:42:42 -07:00
Alex Ryan
4fb2add9a1
Fix comment typo in resolutionCache.ts
Another comment-only fix.
2018-05-08 14:27:40 -07:00
Sheetal Nandi
1a2fda0f56 Add support to update module resolutions on watches from mono repo like setup with path mapping
Fixes #22349
2018-05-04 15:39:06 -07:00
Sheetal Nandi
d64f2483e4 Update to respond to PR feedback 2018-04-17 14:17:15 -07:00
Sheetal Nandi
60b19f5782 Invalidate the unresolved import resolutions when typing files are set
This has 3 changes:
1. In updateGraph when enqueue the typing installation request (depending on unresolved imports)
2. When ActionSet event is received, invalidate only files with unresolved imports and resolve those.
3. When ActionInvalidate event is received, typing installer has detected some change in global typing cache location, so just enqueue a new typing installation request. This will repeat the cycle of setting correct typings and pickiing unresolved imports
2018-04-13 15:17:13 -07:00
Ryan Cavanaugh
8294259ec2 Remove all reference comments from compiler/ 2018-04-11 15:38:26 -07:00
Sheetal Nandi
306ed1291b Invalidate resolutions from typeRoots watch event as a fallback mechanism
There are times when the directory watcher for failed lookup locations isnt invoked and is not very determinitstic
So as a fallback, when we receive typeRoots watch event, handle failed lookup locations as well
2018-03-22 13:54:41 -07:00
Sheetal Nandi
020f046696 Fix when program module resolution in watch mode when node_modules folder itself gets the rename event
Fixes #22712
2018-03-20 12:10:13 -07:00
Sheetal Nandi
9569b13174 Use refcounts on the resolution so we arent going through failed lookup locations when resolutions are cached. 2018-02-22 16:04:00 -08:00
Sheetal Nandi
fdb5e95f0a Use the module cache to resolve non relative module name as well 2018-02-22 15:44:13 -08:00
Sheetal Nandi
8a51cdaf42 Merge branch 'master' into builderApi 2018-01-19 15:56:40 -08:00
Sheetal Nandi
96ac5aa241 Check if the file added is emitted file after validating extensions
May fix #21274
2018-01-18 12:26:45 -08:00
Sheetal Nandi
5bd3f97b18 Merge branch 'master' into builderApi 2018-01-16 11:14:39 -08:00
Sheetal Nandi
69bb5ea8f0 Do not trigger the failed lookup location invalidation for creation of program emit files
Handles #20934
2018-01-11 12:34:58 -08:00
Sheetal Nandi
cb2636679b When user provided resolution is used, invalidate resolutions for all files
In this case there is no way to tell if resolution has changed so resolution cache wont have answers
2017-12-08 12:38:34 -08:00
Sheetal Nandi
43c2610a69 More functions moved from system to WatchCompilerHost 2017-12-05 16:53:34 -08:00
Sheetal Nandi
471c83b7f5 Rename WatchHost.moduleNameResolver to WatchHost.resolveModuleNames to align with compiler host 2017-12-04 15:11:25 -08:00
Andy
fd41521421
Enable 'callable-types' tslint rule (#19654) 2017-11-02 17:16:09 -07:00
Sheetal Nandi
2d5331edde Handle cases when npm install doesnt get triggered with the actual file added
Fixes #19597
2017-11-02 13:45:50 -07:00
Sheetal Nandi
50628e73c5 Do not watch root folders for failed lookup locations and effective type roots
Fixes #19170
2017-10-16 18:40:21 -07:00
Sheetal Nandi
5a776e28ba Merge pull request #19088 from Microsoft/resolutionCacheDefensiveChecks
Function to clear the per directory resolution
2017-10-12 08:55:17 -07:00
Sheetal Nandi
a7fa187fb2 Merge pull request #19058 from Microsoft/whenWatchesFail
Swallow the directory watcher exceptions and ignore them
2017-10-10 18:32:22 -07:00
Sheetal Nandi
e30a66d22f Add utitlity for stringContains 2017-10-10 17:16:39 -07:00
Sheetal Nandi
cb326ed298 Function to clear the per directory resolution 2017-10-10 16:40:12 -07:00
Sheetal Nandi
b9592d4186 Use the parent most node_modules directory for module resolution failed lookup locations 2017-10-09 15:59:27 -07:00
Sheetal Nandi
07ba906594 Handle the case when finishCachingPerDirectoryResolution is not called because of exception
Fixes #18975
2017-10-09 14:32:33 -07:00
Sheetal Nandi
68d360585a PR feedback 2017-09-26 16:21:15 -07:00
Sheetal Nandi
38f3a2b700 Renamed PartialSystem as DirectoryStructureHost and CachedPartialSystem as CachedDirectoryStructureHost 2017-09-26 11:05:52 -07:00
Sheetal Nandi
23acff5bc8 Merge branch 'master' into watchImprovements 2017-09-25 16:18:26 -07:00
Sheetal Nandi
b536f9dade Should not remove the reused resolutions in the file when file contents have not changed. 2017-09-12 12:09:06 -07:00
Sheetal Nandi
fdb104b242 Merge branch 'master' into watchImprovements 2017-09-11 13:49:36 -07:00
Sheetal Nandi
67f9533c67 Limit the resolution invalidation to max number of files as invalidation for larger cache might take more time than to just recalculate resolutions 2017-09-08 12:10:47 -07:00
Sheetal Nandi
c8e711c3a3 Invalidate resolution of the failed lookup only if its one of the default extension or is one of the failed lookup location without that default extension 2017-09-06 20:03:41 -07:00
Sheetal Nandi
54f64a1695 Resolution is valid unless it is invalidated 2017-09-05 19:22:32 -07:00
Sheetal Nandi
7b2bab5b86 Revert to use refcount to keep track of directory watchers for failed lookup 2017-09-05 15:40:50 -07:00
Sheetal Nandi
8d5d4c2a0e Reduce storage of maps/sets for failed lookups 2017-08-31 15:48:31 -07:00
Sheetal Nandi
d7ce95df25 Watch node_modules if possible 2017-08-31 09:13:59 -07:00
Sheetal Nandi
16cf7c40a8 Watch for the automatic types that included as part of type resolution 2017-08-31 09:13:59 -07:00
Sheetal Nandi
a3b9467d41 Resolve only once in the given directory for name 2017-08-31 09:13:59 -07:00
Sheetal Nandi
254e39306f Watch failed lookups recursively to reduce number of directory watches
Also we dont need to watch type roots any more
2017-08-31 09:13:59 -07:00
Sheetal Nandi
17565d8407 Handle watches of missing directories and make project the module resolution host 2017-08-31 09:13:59 -07:00
Sheetal Nandi
5aafd3f06c Reduce number of watches for failed lookup locations as part of module resolution 2017-08-31 09:13:59 -07:00
Sheetal Nandi
4c79033894 Refactoring to watches and caching of system such that we minimize function expressions
Also unified watcher info logging
2017-08-31 09:13:59 -07:00
Sheetal Nandi
55931c46bb Update the failed lookup watches without doing lookups.
This helps in not having to deal with duplicate locations and checking if there exists watch
Anyways the watches are refCount based so we would just addref and remove ref on the same watches
2017-08-22 11:21:20 -07:00
Sheetal Nandi
e500be28cd Adding test for #16456 to verify watched directories in case-sensitive and non sensitive file system and fixing caching 2017-08-22 11:21:02 -07:00
Sheetal Nandi
a99c04e8f9 Make the failedLookuplocations to be readonly array 2017-08-15 10:22:48 -07:00
Sheetal Nandi
6bf9133461 Update to PR feedback 2017-08-14 18:51:05 -07:00
Sheetal Nandi
136b091a4a Update based on feedback 2017-08-14 16:34:30 -07:00
Sheetal Nandi
f1b1b12604 More work based on feedback 2017-08-14 14:59:51 -07:00